|
@@ -1,5 +1,5 @@
|
|
<template>
|
|
<template>
|
|
- <div class="rule-exam part-box part-box-pad part-box-border">
|
|
|
|
|
|
+ <div class="rule-exam part-box part-box-pad">
|
|
<h4 class="part-box-tips">变量印刷考务字段配置:</h4>
|
|
<h4 class="part-box-tips">变量印刷考务字段配置:</h4>
|
|
<el-form
|
|
<el-form
|
|
ref="modalFormComp"
|
|
ref="modalFormComp"
|
|
@@ -27,7 +27,7 @@
|
|
<el-checkbox
|
|
<el-checkbox
|
|
v-model="field.enable"
|
|
v-model="field.enable"
|
|
class="label-item-content"
|
|
class="label-item-content"
|
|
- @change="validateExtendFields"
|
|
|
|
|
|
+ @change="checkRuleChange"
|
|
>{{ field.name }}</el-checkbox
|
|
>{{ field.name }}</el-checkbox
|
|
>
|
|
>
|
|
<i
|
|
<i
|
|
@@ -50,22 +50,9 @@
|
|
step-strictly
|
|
step-strictly
|
|
:controls="false"
|
|
:controls="false"
|
|
style="width: 100px;"
|
|
style="width: 100px;"
|
|
|
|
+ @change="checkRuleChange"
|
|
></el-input-number>
|
|
></el-input-number>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="是否启用入库审核:" required>
|
|
|
|
- <el-switch v-model="modalForm.review" inactive-color="#dcdfe6">
|
|
|
|
- </el-switch>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="提交印刷方式:" required>
|
|
|
|
- <el-radio-group v-model="modalForm.printMethod">
|
|
|
|
- <el-radio
|
|
|
|
- v-for="(val, key) in CONFIRM_PRINT_TYPE"
|
|
|
|
- :key="key"
|
|
|
|
- :label="key"
|
|
|
|
- >{{ val }}</el-radio
|
|
|
|
- >
|
|
|
|
- </el-radio-group>
|
|
|
|
- </el-form-item>
|
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
<el-button
|
|
<el-button
|
|
type="primary"
|
|
type="primary"
|
|
@@ -74,6 +61,7 @@
|
|
@click="submit"
|
|
@click="submit"
|
|
>保存</el-button
|
|
>保存</el-button
|
|
>
|
|
>
|
|
|
|
+ <span v-if="ruleChanged" class="tips-info tips-error">(有修改)</span>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
@@ -84,15 +72,11 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import ModifyField from "../components/ModifyField";
|
|
import ModifyField from "../components/ModifyField";
|
|
-import { CONFIRM_PRINT_TYPE } from "@/constants/enumerate";
|
|
|
|
import { examRuleDetail, saveExamRule } from "../api";
|
|
import { examRuleDetail, saveExamRule } from "../api";
|
|
-import { getEnums } from "../../login/api";
|
|
|
|
|
|
|
|
const initModalForm = {
|
|
const initModalForm = {
|
|
id: null,
|
|
id: null,
|
|
- review: true,
|
|
|
|
examNumberDigit: 8,
|
|
examNumberDigit: 8,
|
|
- printMethod: "AUTO",
|
|
|
|
requiredFields: "[]",
|
|
requiredFields: "[]",
|
|
extendFields: "[]"
|
|
extendFields: "[]"
|
|
};
|
|
};
|
|
@@ -104,7 +88,9 @@ export default {
|
|
return {
|
|
return {
|
|
modalForm: { ...initModalForm },
|
|
modalForm: { ...initModalForm },
|
|
isSubmit: false,
|
|
isSubmit: false,
|
|
- CONFIRM_PRINT_TYPE,
|
|
|
|
|
|
+ examRule: {},
|
|
|
|
+ ruleChanged: false,
|
|
|
|
+ prevModalFrom: "",
|
|
rules: {
|
|
rules: {
|
|
examNumberDigit: [
|
|
examNumberDigit: [
|
|
{
|
|
{
|
|
@@ -121,40 +107,38 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
async init() {
|
|
async init() {
|
|
- const requiredFields = await getEnums("REQUIRED_FIELDS");
|
|
|
|
- const examRule = await examRuleDetail();
|
|
|
|
- this.modalForm = Object.assign({}, initModalForm, examRule || {});
|
|
|
|
|
|
+ this.examRule = await examRuleDetail();
|
|
this.modalForm.examNumberDigit =
|
|
this.modalForm.examNumberDigit =
|
|
- this.modalForm.examNumberDigit || initModalForm.examNumberDigit;
|
|
|
|
|
|
+ this.examRule.examNumberDigit || initModalForm.examNumberDigit;
|
|
|
|
+ this.modalForm.requiredFields = JSON.parse(this.examRule.requiredFields);
|
|
|
|
+ if (this.modalForm.extendFields)
|
|
|
|
+ this.modalForm.extendFields = JSON.parse(this.examRule.extendFields);
|
|
|
|
+
|
|
|
|
+ if (!this.examRule.id) {
|
|
|
|
+ this.$message.warning("当前系统还没有考务规则,请修改保存!");
|
|
|
|
+ }
|
|
|
|
|
|
- this.modalForm.requiredFields = requiredFields.map(item => {
|
|
|
|
- return {
|
|
|
|
- code: item.code,
|
|
|
|
- name: item.desc,
|
|
|
|
- enable: true
|
|
|
|
- };
|
|
|
|
- });
|
|
|
|
- // console.log(this.modalForm.extendFields);
|
|
|
|
- this.modalForm.extendFields = JSON.parse(this.modalForm.extendFields);
|
|
|
|
|
|
+ this.prevModalFrom = JSON.stringify(this.modalForm);
|
|
},
|
|
},
|
|
- validateRequiredFields() {
|
|
|
|
- this.$refs.modalFormComp.validateField("requiredFields");
|
|
|
|
|
|
+ checkRuleChange() {
|
|
|
|
+ this.ruleChanged = this.prevModalFrom !== JSON.stringify(this.modalForm);
|
|
},
|
|
},
|
|
- validateExtendFields() {
|
|
|
|
- this.$refs.modalFormComp.validateField("extendFields");
|
|
|
|
|
|
+ checkRuleExist() {
|
|
|
|
+ return !!this.examRule.id;
|
|
},
|
|
},
|
|
toAddField() {
|
|
toAddField() {
|
|
this.$refs.ModifyField.open();
|
|
this.$refs.ModifyField.open();
|
|
},
|
|
},
|
|
addField(field) {
|
|
addField(field) {
|
|
this.modalForm.extendFields.push({ ...field });
|
|
this.modalForm.extendFields.push({ ...field });
|
|
|
|
+ this.checkRuleChange();
|
|
},
|
|
},
|
|
deleteField(field) {
|
|
deleteField(field) {
|
|
const index = this.modalForm.extendFields.findIndex(
|
|
const index = this.modalForm.extendFields.findIndex(
|
|
item => item.code === field.code
|
|
item => item.code === field.code
|
|
);
|
|
);
|
|
if (index !== -1) this.modalForm.extendFields.splice(index, 1);
|
|
if (index !== -1) this.modalForm.extendFields.splice(index, 1);
|
|
- this.validateExtendFields();
|
|
|
|
|
|
+ this.checkRuleChange();
|
|
},
|
|
},
|
|
async submit() {
|
|
async submit() {
|
|
const valid = await this.$refs.modalFormComp.validate().catch(() => {});
|
|
const valid = await this.$refs.modalFormComp.validate().catch(() => {});
|