代码调整

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