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 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ES文档ID
+
+
+
+
+
+
+ 排序
+
+
+
+
+
+
+
+
+
+ 搜索字段
+
+
+
+
+
+
+
+
+
+ 同步频率
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ES文档ID
+
+
+
+
+
+
+
+
+
+ 搜索字段
+
+
+
+
+
+
+
+
+
+ 同步频率
+
+
+
+
+
+
+ 排序
+
+
+
+
+
+
+ 取消
+ 保存
+
+
+
+
+
+
+
+
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"
>
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
- ES文档ID
-
+ 数据库配置
+
-
+
@@ -47,32 +44,6 @@
-
-
-
-
-
- 搜索字段
-
-
-
-
-
-
-
-
-
- 同步频率
-
-
-
-
@@ -80,31 +51,25 @@
-
-
-
-
-
+
+
-
-
+
+
-
-
+
+
-
+
- ES文档ID
-
+ 数据库配置
+
-
+
@@ -116,32 +81,6 @@
-
-
-
-
-
- 搜索字段
-
-
-
-
-
-
-
-
-
- 同步频率
-
-
-
-
取消
@@ -166,16 +105,12 @@
}
const state = reactive({
condition: {
- author: null,
- databaseName: null,
- documentIdExp: null,
id: null,
+ databaseType: null,
+ datasource: null,
order: null,
- searchCode: null,
- searchFiled: null,
- searchName: null,
- syncCron: null,
- systemId: null,
+ systemCode: null,
+ systemName: null,
},
});
watch(
@@ -187,16 +122,12 @@
);
const handleReset = () => {
state.condition = {
- author: null,
- databaseName: null,
- documentIdExp: null,
id: null,
+ databaseType: null,
+ datasource: null,
order: null,
- searchCode: null,
- searchFiled: null,
- searchName: null,
- syncCron: null,
- systemId: null,
+ systemCode: null,
+ systemName: null,
};
};
const handleSearch = async () => {
@@ -212,27 +143,19 @@
formVisible: false,
submitting: false,
form: {
- author: null,
- databaseName: null,
- documentIdExp: null,
id: null,
+ databaseType: null,
+ datasource: null,
order: null,
- searchCode: null,
- searchFiled: null,
- searchName: null,
- syncCron: null,
- systemId: null,
+ systemCode: null,
+ systemName: null,
},
rules: {
- author: [{ required: true, message: '作者不能为空' }],
- databaseName: [{ required: true, message: '数据库名称不能为空' }],
- documentIdExp: [{ required: true, message: 'ES文档ID不能为空' }],
+ databaseType: [{ required: true, message: '数据库类型不能为空' }],
+ datasource: [{ required: true, message: '数据库配置不能为空' }],
order: [{ required: true, message: '排序不能为空' }],
- searchCode: [{ required: true, message: '搜索码不能为空' }],
- searchFiled: [{ required: true, message: '搜索字段不能为空' }],
- searchName: [{ required: true, message: '搜索名不能为空' }],
- syncCron: [{ required: true, message: '同步频率不能为空' }],
- systemId: [{ required: true, message: '系统ID不能为空' }],
+ systemCode: [{ required: true, message: '系统编码不能为空' }],
+ systemName: [{ required: true, message: '系统名称不能为空' }],
},
});
// 添加/编辑
@@ -240,16 +163,12 @@
Object.assign(
formState.form,
row || {
- author: null,
- databaseName: null,
- documentIdExp: null,
id: null,
+ databaseType: null,
+ datasource: null,
order: null,
- searchCode: null,
- searchFiled: null,
- searchName: null,
- syncCron: null,
- systemId: null,
+ systemCode: null,
+ systemName: null,
}
);
formState.formVisible = true;
@@ -285,29 +204,28 @@
width: 100,
},
{
- label: '系统ID',
- prop: 'systemId',
+ label: '系统编码',
+ prop: 'systemCode',
},
{
- label: '作者',
- prop: 'author',
+ label: '系统名称',
+ prop: 'systemName',
},
{
- label: '数据库名称',
- prop: 'databaseName',
- minWidth: 120,
+ label: '数据库类型',
+ width: 100,
+ slots: {
+ default: ({ row }) => proxy.$dict(unref(opts).type, row.databaseType),
+ },
},
{
- prop: 'documentIdExp',
+ prop: 'datasource',
minWidth: 120,
slots: {
header: () => (
- ES文档ID
-
+ 数据库配置
+
),
},
@@ -327,44 +245,6 @@
),
},
},
- {
- label: '搜索码',
- prop: 'searchCode',
- },
- {
- prop: 'searchFiled',
- minWidth: 120,
- slots: {
- header: () => (
-
- 搜索字段
-
-
- ),
- },
- },
- {
- label: '搜索名',
- prop: 'searchName',
- },
- {
- prop: 'syncCron',
- minWidth: 120,
- slots: {
- header: () => (
-
- 同步频率
-
-
- ),
- },
- },
{
label: '操作',
fixed: 'right',