From a0a366923d2b3d603e09828278318a1e69ba4f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=96=87=E5=8F=AF?= <1041367524@qq.com> Date: Sat, 11 Jun 2022 14:49:16 +0800 Subject: [PATCH 1/5] feat: api --- src/api/search/config.js | 35 +++++++++++++++++++++++++++++++++++ src/api/search/system.js | 35 +++++++++++++++++++++++++++++++++++ vite.config.js | 2 +- 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 src/api/search/config.js create mode 100644 src/api/search/system.js diff --git a/src/api/search/config.js b/src/api/search/config.js new file mode 100644 index 0000000..069204f --- /dev/null +++ b/src/api/search/config.js @@ -0,0 +1,35 @@ +import request from '@/utils/request.js'; +export const search = (params) => { + return request({ + url: '/search/admin/searchConfig', + method: 'get', + params, + }); +}; +export const detail = (id) => { + return request({ + url: '/search/admin/searchConfig/' + id, + method: 'get', + }); +}; +export const create = (data) => { + return request({ + url: '/search/admin/searchConfig', + method: 'post', + data, + }); +}; +export const update = (data) => { + return request({ + url: '/search/admin/searchConfig', + method: 'put', + data, + }); +}; +export const remove = (id) => { + return request({ + url: '/search/admin/searchConfig', + method: 'delete', + params: { id }, + }); +}; diff --git a/src/api/search/system.js b/src/api/search/system.js new file mode 100644 index 0000000..c47358c --- /dev/null +++ b/src/api/search/system.js @@ -0,0 +1,35 @@ +import request from '@/utils/request.js'; +export const search = (params) => { + return request({ + url: '/search/admin/systemConfig', + method: 'get', + params, + }); +}; +export const detail = (id) => { + return request({ + url: '/search/admin/systemConfig/' + id, + method: 'get', + }); +}; +export const create = (data) => { + return request({ + url: '/search/admin/systemConfig', + method: 'post', + data, + }); +}; +export const update = (data) => { + return request({ + url: '/search/admin/systemConfig', + method: 'put', + data, + }); +}; +export const remove = (id) => { + return request({ + url: '/search/admin/systemConfig', + method: 'delete', + params: { id }, + }); +}; diff --git a/vite.config.js b/vite.config.js index 611fffc..0ea91a2 100644 --- a/vite.config.js +++ b/vite.config.js @@ -22,7 +22,7 @@ export default (configEnv) => { '/api': { // target: 'http://192.168.10.109:8090/', // 显雨 // target: 'http://192.168.10.5:4500', // 高玉 - // target: 'http://192.168.10.67:8090', // 罗战 + // target: 'http://192.168.10.87:8090', // 罗战 // target: 'http://192.168.10.93:8090', // 周渺 // target: 'http://192.168.10.124:8090', // 舒梦娇 target: 'https://k8s-horse-gateway.mashibing.cn/', // 测试地址 From f282e344fc9b1ba20e6abb312fd8b48673842618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=96=87=E5=8F=AF?= <1041367524@qq.com> Date: Sat, 11 Jun 2022 16:10:28 +0800 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20=E7=B3=BB=E7=BB=9F=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/extra/ElTooltip.vue | 16 + src/store/modules/search/searchSystem.js | 78 +++++ src/views/search/config/index.vue | 247 ++++++++++++++ src/views/search/system/index.vue | 389 +++++++++++++++++++++++ 4 files changed, 730 insertions(+) create mode 100644 src/components/extra/ElTooltip.vue create mode 100644 src/store/modules/search/searchSystem.js create mode 100644 src/views/search/config/index.vue create mode 100644 src/views/search/system/index.vue diff --git a/src/components/extra/ElTooltip.vue b/src/components/extra/ElTooltip.vue new file mode 100644 index 0000000..27068e6 --- /dev/null +++ b/src/components/extra/ElTooltip.vue @@ -0,0 +1,16 @@ + + + diff --git a/src/store/modules/search/searchSystem.js b/src/store/modules/search/searchSystem.js new file mode 100644 index 0000000..d45d247 --- /dev/null +++ b/src/store/modules/search/searchSystem.js @@ -0,0 +1,78 @@ +import * as api from '@/api/system/notify.js'; +import { ElMessage, ElMessageBox } from '@/plugins/element-plus'; +const state = () => ({ + code: 'SearchSystem', + condition: {}, + list: [], + total: 0, + opts: { + init: false, + }, +}); +const getters = {}; +const mutations = { + setCode: (state, data) => (state.code = data), + setCondition: (state, data) => (state.condition = data), + setList: (state, data) => (state.list = data), + setTotal: (state, data) => (state.total = data), + setOpts: (state, data) => (state.opts = data), +}; +const actions = { + search: async ({ state, commit, rootGetters }) => { + let data = { ...state.condition }; + let res = await api.search({ ...rootGetters['local/page'](state.code), ...data }); + commit('setList', res?.records || []); + commit('setTotal', res?.total || 0); + if (!res) { + ElMessage.error('查询失败'); + } + return res; + }, + load: async ({ commit }) => { + commit('setOpts', { + init: true, + }); + }, + detail: async (context, id) => { + let res = await api.detail(id); + if (!res) { + ElMessage.error('加载详情失败'); + } + return res; + }, + save: async ({ dispatch }, data) => { + let save = data.id ? api.update : api.create; + let res = await save(data); + if (res) { + ElMessage.success('保存成功'); + dispatch('search'); + } else { + ElMessage.error('保存失败'); + } + return res; + }, + remove: async ({ dispatch }, idList) => { + if (!idList.length) { + ElMessage.warning('请选择要删除的数据'); + } else { + try { + await ElMessageBox.confirm('数据删除后无法恢复,确定要删除吗?', '危险操作'); + let res = await api.remove(idList.join(',')); + if (res) { + ElMessage.success('删除成功'); + dispatch('search'); + } else { + ElMessage.error('删除失败'); + } + } catch (e) { + console.info('取消删除', e); + } + } + }, +}; +export default { + state, + getters, + mutations, + actions, +}; diff --git a/src/views/search/config/index.vue b/src/views/search/config/index.vue new file mode 100644 index 0000000..08614ff --- /dev/null +++ b/src/views/search/config/index.vue @@ -0,0 +1,247 @@ + + + + + diff --git a/src/views/search/system/index.vue b/src/views/search/system/index.vue new file mode 100644 index 0000000..fa0b63d --- /dev/null +++ b/src/views/search/system/index.vue @@ -0,0 +1,389 @@ + + + + + From 8edf39fe4f4f3244513f8369b61f6d7adc635d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=96=87=E5=8F=AF?= <1041367524@qq.com> Date: Sat, 11 Jun 2022 16:23:53 +0800 Subject: [PATCH 3/5] =?UTF-8?q?feat:=20=E6=90=9C=E7=B4=A2=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/sales/category.js | 7 +- src/store/modules/sales/orderShip.js | 5 +- src/store/modules/search/searchConfig.js | 79 +++++ src/store/modules/search/searchSystem.js | 9 +- src/store/modules/system/customer.js | 12 +- src/store/modules/system/notify.js | 3 +- src/views/search/config/index.vue | 247 --------------- src/views/search/search/index.vue | 386 +++++++++++++++++++++++ src/views/search/system/index.vue | 228 ++++--------- 9 files changed, 540 insertions(+), 436 deletions(-) create mode 100644 src/store/modules/search/searchConfig.js delete mode 100644 src/views/search/config/index.vue create mode 100644 src/views/search/search/index.vue diff --git a/src/store/modules/sales/category.js b/src/store/modules/sales/category.js index 57b9eb1..c3fcb62 100644 --- a/src/store/modules/sales/category.js +++ b/src/store/modules/sales/category.js @@ -34,13 +34,10 @@ const actions = { } return res; }, - load: async ({ commit }) => { + load: async ({ state, commit }) => { commit('setOpts', { + ...state.opts, init: true, - visible: [ - { label: '显示', value: true }, - { label: '隐藏', value: false }, - ], }); }, detail: async ({ state, dispatch }, id) => { diff --git a/src/store/modules/sales/orderShip.js b/src/store/modules/sales/orderShip.js index 35989a6..ff458b7 100644 --- a/src/store/modules/sales/orderShip.js +++ b/src/store/modules/sales/orderShip.js @@ -11,7 +11,7 @@ const state = () => ({ summary: [], opts: { init: false, - company: [{ label: '顺丰', value: 'sf' }], + company: [], }, }); const getters = {}; @@ -31,8 +31,9 @@ const actions = { } return res; }, - load: async ({ commit }) => { + load: async ({ state, commit }) => { commit('setOpts', { + ...state.opts, init: true, company: await api.searchShip(), }); diff --git a/src/store/modules/search/searchConfig.js b/src/store/modules/search/searchConfig.js new file mode 100644 index 0000000..ce103e4 --- /dev/null +++ b/src/store/modules/search/searchConfig.js @@ -0,0 +1,79 @@ +import * as api from '@/api/system/notify.js'; +import { ElMessage, ElMessageBox } from '@/plugins/element-plus'; +const state = () => ({ + code: 'SearchConfig', + condition: {}, + list: [], + total: 0, + opts: { + init: false, + }, +}); +const getters = {}; +const mutations = { + setCode: (state, data) => (state.code = data), + setCondition: (state, data) => (state.condition = data), + setList: (state, data) => (state.list = data), + setTotal: (state, data) => (state.total = data), + setOpts: (state, data) => (state.opts = data), +}; +const actions = { + search: async ({ state, commit, rootGetters }) => { + let data = { ...state.condition }; + let res = await api.search({ ...rootGetters['local/page'](state.code), ...data }); + commit('setList', res?.records || []); + commit('setTotal', res?.total || 0); + if (!res) { + ElMessage.error('查询失败'); + } + return res; + }, + load: async ({ state, commit }) => { + commit('setOpts', { + ...state.opts, + init: true, + }); + }, + detail: async (context, id) => { + let res = await api.detail(id); + if (!res) { + ElMessage.error('加载详情失败'); + } + return res; + }, + save: async ({ dispatch }, data) => { + let save = data.id ? api.update : api.create; + let res = await save(data); + if (res) { + ElMessage.success('保存成功'); + dispatch('search'); + } else { + ElMessage.error('保存失败'); + } + return res; + }, + remove: async ({ dispatch }, idList) => { + if (!idList.length) { + ElMessage.warning('请选择要删除的数据'); + } else { + try { + await ElMessageBox.confirm('数据删除后无法恢复,确定要删除吗?', '危险操作'); + let res = await api.remove(idList.join(',')); + if (res) { + ElMessage.success('删除成功'); + dispatch('search'); + } else { + ElMessage.error('删除失败'); + } + } catch (e) { + console.info('取消删除', e); + } + } + }, +}; +export default { + state, + getters, + mutations, + actions, +}; diff --git a/src/store/modules/search/searchSystem.js b/src/store/modules/search/searchSystem.js index d45d247..1ace0e9 100644 --- a/src/store/modules/search/searchSystem.js +++ b/src/store/modules/search/searchSystem.js @@ -7,6 +7,12 @@ const state = () => ({ total: 0, opts: { init: false, + type: [ + { + label: 'MySQL', + value: 1, + }, + ], }, }); const getters = {}; @@ -28,8 +34,9 @@ const actions = { } return res; }, - load: async ({ commit }) => { + load: async ({ state, commit }) => { commit('setOpts', { + ...state.opts, init: true, }); }, diff --git a/src/store/modules/system/customer.js b/src/store/modules/system/customer.js index f39bdc7..dfabe3b 100644 --- a/src/store/modules/system/customer.js +++ b/src/store/modules/system/customer.js @@ -7,7 +7,10 @@ const state = () => ({ total: 0, opts: { init: false, - gender: [], + gender: [ + { label: '男', value: 1 }, + { label: '女', value: 2 }, + ], }, }); const getters = {}; @@ -36,13 +39,10 @@ const actions = { } return res; }, - load: async ({ commit }) => { + load: async ({ state, commit }) => { commit('setOpts', { + ...state.opts, init: true, - gender: [ - { label: '男', value: 1 }, - { label: '女', value: 2 }, - ], }); }, enable: async ({ dispatch }, data) => { diff --git a/src/store/modules/system/notify.js b/src/store/modules/system/notify.js index 535c033..284c8b7 100644 --- a/src/store/modules/system/notify.js +++ b/src/store/modules/system/notify.js @@ -33,8 +33,9 @@ const actions = { } return res; }, - load: async ({ commit }) => { + load: async ({ state, commit }) => { commit('setOpts', { + ...state.opts, init: true, }); }, diff --git a/src/views/search/config/index.vue b/src/views/search/config/index.vue deleted file mode 100644 index 08614ff..0000000 --- a/src/views/search/config/index.vue +++ /dev/null @@ -1,247 +0,0 @@ - - - - - diff --git a/src/views/search/search/index.vue b/src/views/search/search/index.vue new file mode 100644 index 0000000..0584b6c --- /dev/null +++ b/src/views/search/search/index.vue @@ -0,0 +1,386 @@ + + + + + diff --git a/src/views/search/system/index.vue b/src/views/search/system/index.vue index fa0b63d..73dc77b 100644 --- a/src/views/search/system/index.vue +++ b/src/views/search/system/index.vue @@ -14,28 +14,25 @@ @search="handleSearch" > @@ -80,31 +51,25 @@ - - - - - + + - - + + - - + + - + - + - - - - - - - - - - - - - -