Merge branch 'test_dispaly' of https://git.code.tencent.com/lian-cbtc/jl-client into test_dispaly
This commit is contained in:
commit
44e4673945
@ -48,9 +48,9 @@ export default {
|
||||
},
|
||||
{
|
||||
title: this.$t('orderAuthor.belongsToMap'),
|
||||
prop: 'mapId',
|
||||
prop: 'mapName',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.$convertField(row.mapId, this.mapList, ['value', 'label']); },
|
||||
columnValue: (row) => { return row.mapName || ''; },
|
||||
tagType: (row) => { return ''; }
|
||||
},
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ export default {
|
||||
}).catch((err) => {
|
||||
console.log('err', err);
|
||||
this.loading = false;
|
||||
this.$message.error(`${this.isEdit ? '编辑' : '新建'}失败!`);
|
||||
this.$message.error(`${this.isEdit ? '编辑' : '新建'}失败!,${err.message}`);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -33,8 +33,13 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类" prop="tags">
|
||||
<el-select multiple v-model="form.tags" @change="getQuestionAmount">
|
||||
<el-option v-for="label in labels" :key="label" :label="label" :value="label"></el-option>
|
||||
<el-select v-model="form.tags" @change="getQuestionAmount">
|
||||
<el-option
|
||||
v-for="item in labels"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="题目数量" prop="amount">
|
||||
@ -44,8 +49,7 @@
|
||||
style="width: calc(100% - 280px); float: left; margin-right: 10px;"
|
||||
/>
|
||||
<span v-if="this.form.type === 1" style="width: 190px; float: left;">
|
||||
{{ $t('publish.allNumberTipOne') }} {{ topicNum }} {{ $t('publish.allNumberTipTwo') }}, 剩余
|
||||
{{ remainNum }}题
|
||||
{{ $t('publish.allNumberTipOne') }} {{ topicNum }} {{ $t('publish.allNumberTipTwo') }}
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('publish.scorePerQuestion')" prop="score">
|
||||
@ -94,7 +98,7 @@ export default {
|
||||
message(new Error(this.$t('publish.inputQuestionNumberError')))
|
||||
} else if (!Number(value)) {
|
||||
message(new Error(this.$t('publish.inputValidNumber')))
|
||||
} else if (Number(value) > this.remainNum && this.form.type === 1) {
|
||||
} else if (Number(value) > this.topicNum && this.form.type === 1) {
|
||||
message(new Error(this.$t('publish.inputNumberError')))
|
||||
} else {
|
||||
message()
|
||||
@ -113,13 +117,12 @@ export default {
|
||||
id: '',
|
||||
type: '',
|
||||
subtype: '',
|
||||
tags: [],
|
||||
tags: '',
|
||||
amount: 1,
|
||||
score: 1,
|
||||
},
|
||||
labels: [],
|
||||
topicNum: 0,
|
||||
remainNum: 0,
|
||||
index: -1,
|
||||
dialogShow: false,
|
||||
rules: {
|
||||
@ -132,7 +135,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
getLabelList().then(resp => {
|
||||
this.labels = resp.data
|
||||
this.labels = [{ label: '无', value: '' }, ...resp.data.map(item => ({ label: item, value: item }))]
|
||||
})
|
||||
},
|
||||
mounted() {},
|
||||
@ -150,13 +153,11 @@ export default {
|
||||
amount: detail.amount,
|
||||
score: detail.score,
|
||||
id: detail.id || '',
|
||||
tags: detail.tags
|
||||
tags: detail.tags || '',
|
||||
}
|
||||
this.topicNum = detail.topicNum
|
||||
this.remainNum = detail.remainNum
|
||||
} else {
|
||||
this.isEditMode = false
|
||||
this.remainNum = 0
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -167,56 +168,21 @@ export default {
|
||||
rule =>
|
||||
rule.type === this.form.type &&
|
||||
rule.subtype === this.form.subtype &&
|
||||
rule.tags.length === this.form.tags.length &&
|
||||
rule.tags.every(tag => this.form.tags.includes(tag))
|
||||
rule.tags === this.form.tags
|
||||
)
|
||||
return isDuplicated
|
||||
},
|
||||
getQuestionAmount(e) {
|
||||
if (!(this.form.type && this.form.subtype)) return
|
||||
if (this.form.type === 2) return //实训题暂不支持查询数量
|
||||
// if (this.isDuplicated()) {
|
||||
// this.$message.warning('与已有规则重复, 请重新选择')
|
||||
// return
|
||||
// }
|
||||
const param = {
|
||||
orgId: this.$store.state.user.companyId,
|
||||
groupType: this.form.type,
|
||||
subType: this.form.subtype,
|
||||
tags: this.form.tags,
|
||||
}
|
||||
if (this.form.tags) param.tags = [this.form.tags]
|
||||
getQuestionAmount(param).then(resp => {
|
||||
const num = resp.data
|
||||
this.topicNum = num
|
||||
const { type, subtype, tags } = this.form
|
||||
if (this.ruleList.length > 0) {
|
||||
const smallerRangeRules = this.ruleList.filter(
|
||||
(rule, i) =>
|
||||
rule.type === type &&
|
||||
rule.subtype === subtype &&
|
||||
rule.tags.length >= tags.length &&
|
||||
(tags.every(tag => rule.tags.includes(tag)) || tags.length === 0) &&
|
||||
(this.isEditMode ? this.index !== i : true) //排除正在编辑中的自己
|
||||
)
|
||||
//更小(及相同)的题目集合中已占用的题目数
|
||||
const amount1 = smallerRangeRules.reduce((prev, curr) => prev + curr.amount, 0)
|
||||
const largerRangeRules = this.ruleList.filter(
|
||||
(rule, i) =>
|
||||
rule.type === type &&
|
||||
rule.subtype === subtype &&
|
||||
rule.tags.length < tags.length &&
|
||||
(rule.tags.every(tag => tags.includes(tag)) || rule.tags.length === 0) &&
|
||||
(this.isEditMode ? this.index !== i : true)
|
||||
)
|
||||
//更大的题目集合中未占用的题目数的最小值
|
||||
const amount2 = largerRangeRules.reduce(
|
||||
(prev, curr) => (curr.topicNum - curr.amount < prev ? curr.topicNum - curr.amount : prev),
|
||||
num
|
||||
)
|
||||
this.remainNum = amount2 - amount1
|
||||
} else {
|
||||
this.remainNum = num
|
||||
}
|
||||
this.topicNum = resp.data
|
||||
})
|
||||
},
|
||||
clearSubtype() {
|
||||
@ -231,11 +197,7 @@ export default {
|
||||
return
|
||||
}
|
||||
}
|
||||
this.$emit(
|
||||
'submit',
|
||||
{ ...this.form, topicNum: this.topicNum, remainNum: this.remainNum },
|
||||
this.isEditMode
|
||||
)
|
||||
this.$emit('submit', { ...this.form, topicNum: this.topicNum }, this.isEditMode)
|
||||
this.handleCancel()
|
||||
}
|
||||
})
|
||||
|
@ -105,8 +105,7 @@ export default {
|
||||
amount: formData.amount,
|
||||
score: formData.score,
|
||||
topicNum: formData.topicNum,
|
||||
remainNum: formData.remainNum,
|
||||
tags: formData.tags,
|
||||
tags: [formData.tags],
|
||||
}
|
||||
if (isEdit) {
|
||||
this.$set(this.ruleList, this.editingIndex, data)
|
||||
|
@ -50,23 +50,18 @@
|
||||
placeholder="请输入内容"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="单客户端:" prop="singleClient">
|
||||
<el-checkbox v-model="ruleForm.singleClient" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="单角色类型:" prop="singleMember">
|
||||
<el-checkbox v-model="ruleForm.singleMember" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="含有实训:" prop="hasTraining">
|
||||
<el-checkbox v-model="ruleForm.hasTraining" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table :data="Object.values(mapConfigData)" 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">
|
||||
<div v-if="scope.row.type === 'boolean'">
|
||||
<el-radio v-model="scope.row.configValue" :label="true">是</el-radio>
|
||||
<el-radio v-model="scope.row.configValue" :label="false">否</el-radio>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remark" label="描述" />
|
||||
</el-table>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="close">取 消</el-button>
|
||||
@ -92,6 +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: '是否含有实训设计'}
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '请输入子系统名称', trigger: 'blur' }
|
||||
@ -111,10 +113,10 @@ export default {
|
||||
client: '',
|
||||
function: '',
|
||||
trainingId: '',
|
||||
trainingName: '',
|
||||
singleMember: false,
|
||||
singleClient: false,
|
||||
hasTraining: false
|
||||
trainingName: ''
|
||||
// singleMember: false,
|
||||
// singleClient: false,
|
||||
// hasTraining: false
|
||||
},
|
||||
clientList: [
|
||||
{ label: '中心ATS工作站', value: 'C_ATS' },
|
||||
@ -174,6 +176,7 @@ export default {
|
||||
this.ruleForm.type = row.paramVO.type;
|
||||
this.ruleForm.client = row.paramVO.client || '';
|
||||
this.ruleForm.memberId = row.paramVO.memberId || '';
|
||||
this.setConfigData(row.paramVO.domConfig || {});
|
||||
this.clientChange(this.ruleForm.client);
|
||||
if (row.paramVO.functionInfoMap) {
|
||||
const functionList = Object.keys(row.paramVO.functionInfoMap);
|
||||
@ -191,6 +194,15 @@ export default {
|
||||
}
|
||||
this.visible = true;
|
||||
},
|
||||
setConfigData(obj) {
|
||||
Object.keys(this.mapConfigData).forEach(key => {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
this.mapConfigData[key].configValue = obj[key];
|
||||
} else {
|
||||
this.mapConfigData[key].configValue = this.mapConfigData[key].defaultValue;
|
||||
}
|
||||
});
|
||||
},
|
||||
typeChange(val) {
|
||||
if (val === 'METRO') {
|
||||
this.memberList = [...this.memberMetroList];
|
||||
@ -294,11 +306,12 @@ export default {
|
||||
client: '',
|
||||
function: '',
|
||||
trainingId: '',
|
||||
trainingName: '',
|
||||
singleClient: false,
|
||||
singleMember: false,
|
||||
hasTraining: false
|
||||
trainingName: ''
|
||||
// singleClient: false,
|
||||
// singleMember: false,
|
||||
// hasTraining: false
|
||||
};
|
||||
this.setConfigData({});
|
||||
this.visible = false;
|
||||
this.$refs.ruleForm.resetFields();
|
||||
},
|
||||
@ -313,6 +326,10 @@ export default {
|
||||
functionMap = {};
|
||||
functionMap[this.ruleForm.function] = { function: this.ruleForm.function };
|
||||
}
|
||||
const configData = {};
|
||||
Object.values(this.mapConfigData).forEach(item => {
|
||||
configData[item.configKey] = item.configValue;
|
||||
});
|
||||
const data = {
|
||||
mapId: this.$route.query.mapId,
|
||||
name: this.ruleForm.name,
|
||||
@ -323,9 +340,10 @@ export default {
|
||||
memberId: this.ruleForm.memberId,
|
||||
functionInfoMap: functionMap,
|
||||
domConfig: {
|
||||
singleClient: this.ruleForm.singleClient,
|
||||
singleMember: this.ruleForm.singleMember,
|
||||
hasTraining: this.ruleForm.hasTraining
|
||||
// singleClient: this.ruleForm.singleClient,
|
||||
// singleMember: this.ruleForm.singleMember,
|
||||
// hasTraining: this.ruleForm.hasTraining
|
||||
...configData
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user