|
@@ -5,28 +5,37 @@
|
|
ref="modalFormComp"
|
|
ref="modalFormComp"
|
|
:model="modalForm"
|
|
:model="modalForm"
|
|
:rules="rules"
|
|
:rules="rules"
|
|
- label-width="160px"
|
|
|
|
|
|
+ label-width="200px"
|
|
>
|
|
>
|
|
- <el-form-item prop="openOcr" label="是否开启OCR识别:">
|
|
|
|
- <el-radio-group v-model="modalForm.openOcr">
|
|
|
|
- <el-radio
|
|
|
|
- v-for="item in BOOLEAN_STATUS"
|
|
|
|
- :key="item.value"
|
|
|
|
- :label="item.value"
|
|
|
|
- >{{ item.label }}</el-radio
|
|
|
|
|
|
+ <div v-for="(group, gindex) in setList" :key="gindex" class="form-part">
|
|
|
|
+ <h2 class="form-part-title">{{ group.name }}</h2>
|
|
|
|
+ <div class="form-part-body">
|
|
|
|
+ <el-form-item
|
|
|
|
+ v-for="field in group.data"
|
|
|
|
+ :key="field.code"
|
|
|
|
+ :prop="field.code"
|
|
|
|
+ :label="`${field.name}:`"
|
|
>
|
|
>
|
|
- </el-radio-group>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item prop="openGlobalMatch" label="是否开启全局匹配:">
|
|
|
|
- <el-radio-group v-model="modalForm.openGlobalMatch">
|
|
|
|
- <el-radio
|
|
|
|
- v-for="item in BOOLEAN_STATUS"
|
|
|
|
- :key="item.value"
|
|
|
|
- :label="item.value"
|
|
|
|
- >{{ item.label }}</el-radio
|
|
|
|
- >
|
|
|
|
- </el-radio-group>
|
|
|
|
- </el-form-item>
|
|
|
|
|
|
+ <el-radio-group
|
|
|
|
+ v-if="checkValueIsBoolean(field.value)"
|
|
|
|
+ v-model="modalForm[field.code]"
|
|
|
|
+ >
|
|
|
|
+ <el-radio
|
|
|
|
+ v-for="item in BOOLEAN_STATUS"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ :label="item.value"
|
|
|
|
+ >{{ item.label }}</el-radio
|
|
|
|
+ >
|
|
|
|
+ </el-radio-group>
|
|
|
|
+ <el-input
|
|
|
|
+ v-else
|
|
|
|
+ v-model="modalForm[field.code]"
|
|
|
|
+ placeholder="请输入"
|
|
|
|
+ clearable
|
|
|
|
+ ></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" :disabled="isSubmit" @click="submit"
|
|
<el-button type="primary" :disabled="isSubmit" @click="submit"
|
|
>确认</el-button
|
|
>确认</el-button
|
|
@@ -39,10 +48,6 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { systemSettingQuery, updateSystemSetting } from "../api";
|
|
import { systemSettingQuery, updateSystemSetting } from "../api";
|
|
-const initModalForm = {
|
|
|
|
- openOcr: false,
|
|
|
|
- openGlobalMatch: false
|
|
|
|
-};
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "system-setting",
|
|
name: "system-setting",
|
|
@@ -53,38 +58,43 @@ export default {
|
|
BOOLEAN_STATUS: [
|
|
BOOLEAN_STATUS: [
|
|
{
|
|
{
|
|
label: "开启",
|
|
label: "开启",
|
|
- value: true
|
|
|
|
|
|
+ value: "true"
|
|
},
|
|
},
|
|
{
|
|
{
|
|
label: "关闭",
|
|
label: "关闭",
|
|
- value: false
|
|
|
|
|
|
+ value: "false"
|
|
}
|
|
}
|
|
],
|
|
],
|
|
- rules: {
|
|
|
|
- openOcr: [
|
|
|
|
- {
|
|
|
|
- required: true,
|
|
|
|
- message: "请选择",
|
|
|
|
- trigger: "change"
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
- openGlobalMatch: [
|
|
|
|
- {
|
|
|
|
- required: true,
|
|
|
|
- message: "请选择",
|
|
|
|
- trigger: "change"
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
- }
|
|
|
|
|
|
+ rules: {},
|
|
|
|
+ setList: []
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
this.getSysSet();
|
|
this.getSysSet();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ checkValueIsBoolean(val) {
|
|
|
|
+ return ["true", "false"].includes(val);
|
|
|
|
+ },
|
|
async getSysSet() {
|
|
async getSysSet() {
|
|
- const res = await systemSettingQuery();
|
|
|
|
- this.modalForm = this.$objAssign(initModalForm, res || {});
|
|
|
|
|
|
+ const data = await systemSettingQuery(this.$attrs.isSystem);
|
|
|
|
+ this.setList = data;
|
|
|
|
+ let modalForm = {},
|
|
|
|
+ rules = {};
|
|
|
|
+ data.forEach(item => {
|
|
|
|
+ item.data.forEach(field => {
|
|
|
|
+ modalForm[field.code] = field.value;
|
|
|
|
+ rules[field.code] = [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: `请设置${field.name}`,
|
|
|
|
+ trigger: "change"
|
|
|
|
+ }
|
|
|
|
+ ];
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ this.modalForm = modalForm;
|
|
|
|
+ this.rules = rules;
|
|
},
|
|
},
|
|
async submit() {
|
|
async submit() {
|
|
const valid = await this.$refs.modalFormComp.validate().catch(() => {});
|
|
const valid = await this.$refs.modalFormComp.validate().catch(() => {});
|
|
@@ -92,7 +102,13 @@ export default {
|
|
|
|
|
|
if (this.isSubmit) return;
|
|
if (this.isSubmit) return;
|
|
this.isSubmit = true;
|
|
this.isSubmit = true;
|
|
- const data = await updateSystemSetting(this.modalForm).catch(() => {});
|
|
|
|
|
|
+ this.setList.forEach(item => {
|
|
|
|
+ item.data.forEach(field => {
|
|
|
|
+ field.value = this.modalForm[field.code];
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ const data = await updateSystemSetting(this.setList).catch(() => {});
|
|
this.isSubmit = false;
|
|
this.isSubmit = false;
|
|
|
|
|
|
if (!data) return;
|
|
if (!data) return;
|