代码调整

This commit is contained in:
dong 2022-10-27 17:34:57 +08:00
parent 44e4673945
commit 8272afcb13

View File

@ -50,7 +50,7 @@
placeholder="请输入内容"
/>
</el-form-item>
<el-table :data="Object.values(mapConfigData)" style="width: 100%;" size="small" max-height="180">
<el-table :data="configList" style="width: 100%;" size="small" max-height="180">
<el-table-column prop="configKey" label="key" />
<el-table-column prop="configValue" label="value">
<template slot-scope="scope">
@ -87,13 +87,13 @@ export default {
title: '',
mapSystemId: '',
memberList: [],
mapConfigData: {
singleClient: {configKey: 'singleClient', configValue: false, defaultValue: false, type: 'boolean', remark: '是否单客户端'},
singleMember: {configKey: 'singleMember', configValue: false, defaultValue: false, type: 'boolean', remark: '是否单角色类型'},
hasExam: {configKey: 'hasExam', configValue: false, defaultValue: false, type: 'boolean', remark: '是否含有考试'},
hasTraining: {configKey: 'hasTraining', configValue: false, defaultValue: false, type: 'boolean', remark: '是否含有实训'},
trainingDesign: {configKey: 'trainingDesign', configValue: false, defaultValue: false, type: 'boolean', remark: '是否含有实训设计'}
},
configList: [
{configKey: 'singleClient', configValue: false, defaultValue: false, type: 'boolean', remark: '是否单客户端'},
{configKey: 'singleMember', configValue: false, defaultValue: false, type: 'boolean', remark: '是否单角色类型'},
{configKey: 'hasExam', configValue: false, defaultValue: false, type: 'boolean', remark: '是否含有考试'},
{configKey: 'hasTraining', configValue: false, defaultValue: false, type: 'boolean', remark: '是否含有实训'},
{configKey: 'trainingDesign', configValue: false, defaultValue: false, type: 'boolean', remark: '是否含有实训设计'}
],
rules: {
name: [
{ required: true, message: '请输入子系统名称', trigger: 'blur' }
@ -195,11 +195,11 @@ export default {
this.visible = true;
},
setConfigData(obj) {
Object.keys(this.mapConfigData).forEach(key => {
if (obj.hasOwnProperty(key)) {
this.mapConfigData[key].configValue = obj[key];
this.configList.forEach(item => {
if (obj.hasOwnProperty(item.configKey)) {
item.configValue = obj[item.configKey];
} else {
this.mapConfigData[key].configValue = this.mapConfigData[key].defaultValue;
item.configValue = item.defaultValue;
}
});
},
@ -327,7 +327,7 @@ export default {
functionMap[this.ruleForm.function] = { function: this.ruleForm.function };
}
const configData = {};
Object.values(this.mapConfigData).forEach(item => {
this.configList.forEach(item => {
configData[item.configKey] = item.configValue;
});
const data = {