feat: 接口对接

feat-search-0611-xwk
向文可 3 years ago
parent 8edf39fe4f
commit d20aa839ae

@ -1,4 +1,5 @@
import * as api from '@/api/system/notify.js';
import * as api from '@/api/search/config.js';
import * as systemAPI from '@/api/search/system.js';
import { ElMessage, ElMessageBox } from '@/plugins/element-plus';
const state = () => ({
code: 'SearchConfig',
@ -7,6 +8,7 @@ const state = () => ({
total: 0,
opts: {
init: false,
system: [],
},
});
const getters = {};
@ -32,6 +34,7 @@ const actions = {
commit('setOpts', {
...state.opts,
init: true,
system: (await systemAPI.search({ pageIndex: 1, length: 99999 }))?.records || [],
});
},
detail: async (context, id) => {

@ -1,4 +1,4 @@
import * as api from '@/api/system/notify.js';
import * as api from '@/api/search/system.js';
import { ElMessage, ElMessageBox } from '@/plugins/element-plus';
const state = () => ({
code: 'SearchSystem',

@ -15,12 +15,16 @@
>
<template #search>
<el-form inline label-width="100px">
<el-form-item label="所属系统" prop="systemId">
<el-select
v-model="state.condition.systemId"
:config="{ label: 'systemName', value: 'id' }"
:opts="opts.system"
/>
</el-form-item>
<el-form-item label="主键" prop="id">
<el-input v-model="state.condition.id" />
</el-form-item>
<el-form-item label="系统ID" prop="systemId">
<el-input v-model="state.condition.systemId" />
</el-form-item>
<el-form-item label="作者" prop="author">
<el-input v-model="state.condition.author" />
</el-form-item>
@ -84,8 +88,12 @@
:model="formState.form"
:rules="formState.rules"
>
<el-form-item label="系统ID" prop="systemId">
<el-input v-model="formState.form.systemId" />
<el-form-item label="所属系统" prop="systemId">
<el-select
v-model="formState.form.systemId"
:config="{ label: 'systemName', value: 'id' }"
:opts="opts.system"
/>
</el-form-item>
<el-form-item label="作者" prop="author">
<el-input v-model="formState.form.author" />
@ -129,16 +137,6 @@
</template>
<el-input v-model="formState.form.syncCron" />
</el-form-item>
<el-form-item prop="order">
<template #label>
<span>排序</span>
<el-tooltip
content="在字段名后加“:asc或:desc”指定升序降序多个字段使用逗号分隔省略排序默认使用升序"
placement="top"
/>
</template>
<el-input v-model="formState.form.order" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="formState.formVisible = false">取消</el-button>
@ -213,7 +211,6 @@
databaseName: null,
documentIdExp: null,
id: null,
order: null,
searchCode: null,
searchFiled: null,
searchName: null,
@ -224,7 +221,6 @@
author: [{ required: true, message: '作者不能为空' }],
databaseName: [{ required: true, message: '数据库名称不能为空' }],
documentIdExp: [{ required: true, message: 'ES文档ID不能为空' }],
order: [{ required: true, message: '排序不能为空' }],
searchCode: [{ required: true, message: '搜索码不能为空' }],
searchFiled: [{ required: true, message: '搜索字段不能为空' }],
searchName: [{ required: true, message: '搜索名不能为空' }],
@ -241,7 +237,6 @@
databaseName: null,
documentIdExp: null,
id: null,
order: null,
searchCode: null,
searchFiled: null,
searchName: null,
@ -257,8 +252,10 @@
try {
await proxy.$validate(refsForm);
let data = _.cloneDeep(formState.form);
await store.dispatch('searchConfig/save', data);
formState.formVisible = false;
let res = await store.dispatch('searchConfig/save', data);
if (res) {
formState.formVisible = false;
}
} catch (e) {
console.info('取消保存', e);
}
@ -276,15 +273,20 @@
type: 'selection',
width: 60,
},
{
label: '所属系统',
prop: 'systemId',
minWidth: 120,
slots: {
default: ({ row }) =>
proxy.$dict(unref(opts).system, row.systemId, { label: 'systemName', value: 'id' }),
},
},
{
label: '主键',
prop: 'id',
width: 100,
},
{
label: '系统ID',
prop: 'systemId',
},
{
label: '作者',
prop: 'author',
@ -309,21 +311,6 @@
),
},
},
{
prop: 'order',
width: 100,
slots: {
header: () => (
<p>
<span>排序</span>
<ElTooltip
content="在字段名后加“:asc或:desc”指定升序降序多个字段使用逗号分隔省略排序默认使用升序"
placement="top"
/>
</p>
),
},
},
{
label: '搜索码',
prop: 'searchCode',

@ -71,16 +71,6 @@
</template>
<el-input v-model="formState.form.datasource" />
</el-form-item>
<el-form-item prop="order">
<template #label>
<span>排序</span>
<el-tooltip
content="在字段名后加“:asc或:desc”指定升序降序多个字段使用逗号分隔省略排序默认使用升序"
placement="top"
/>
</template>
<el-input v-model="formState.form.order" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="formState.formVisible = false">取消</el-button>
@ -108,7 +98,6 @@
id: null,
databaseType: null,
datasource: null,
order: null,
systemCode: null,
systemName: null,
},
@ -125,7 +114,6 @@
id: null,
databaseType: null,
datasource: null,
order: null,
systemCode: null,
systemName: null,
};
@ -146,14 +134,12 @@
id: null,
databaseType: null,
datasource: null,
order: null,
systemCode: null,
systemName: null,
},
rules: {
databaseType: [{ required: true, message: '数据库类型不能为空' }],
datasource: [{ required: true, message: '数据库配置不能为空' }],
order: [{ required: true, message: '排序不能为空' }],
systemCode: [{ required: true, message: '系统编码不能为空' }],
systemName: [{ required: true, message: '系统名称不能为空' }],
},
@ -179,8 +165,10 @@
try {
await proxy.$validate(refsForm);
let data = _.cloneDeep(formState.form);
await store.dispatch('searchSystem/save', data);
formState.formVisible = false;
let res = await store.dispatch('searchSystem/save', data);
if (res) {
formState.formVisible = false;
}
} catch (e) {
console.info('取消保存', e);
}
@ -230,21 +218,6 @@
),
},
},
{
prop: 'order',
width: 100,
slots: {
header: () => (
<p>
<span>排序</span>
<ElTooltip
content="在字段名后加“:asc或:desc”指定升序降序多个字段使用逗号分隔省略排序默认使用升序"
placement="top"
/>
</p>
),
},
},
{
label: '操作',
fixed: 'right',

@ -22,10 +22,10 @@ export default (configEnv) => {
'/api': {
// target: 'http://192.168.10.109:8090/', // 显雨
// target: 'http://192.168.10.5:4500', // 高玉
// target: 'http://192.168.10.87: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/', // 测试地址
// target: 'https://k8s-horse-gateway.mashibing.cn/', // 测试地址
// target: 'https://you-gateway.mashibing.com', // 生产环境
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),

Loading…
Cancel
Save