|
@@ -90,6 +90,27 @@
|
|
>{{ column.name }}</el-checkbox
|
|
>{{ column.name }}</el-checkbox
|
|
>
|
|
>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
+ <el-form-item
|
|
|
|
+ v-if="
|
|
|
|
+ deletedField.requiredFields.length ||
|
|
|
|
+ deletedField.extendFields.length
|
|
|
|
+ "
|
|
|
|
+ label="通用规则已删除字段:"
|
|
|
|
+ label-width="160px"
|
|
|
|
+ >
|
|
|
|
+ <el-checkbox
|
|
|
|
+ v-for="column in deletedField.requiredFields"
|
|
|
|
+ :key="column.code"
|
|
|
|
+ v-model="column.enable"
|
|
|
|
+ >{{ column.name }}</el-checkbox
|
|
|
|
+ >
|
|
|
|
+ <el-checkbox
|
|
|
|
+ v-for="column in deletedField.extendFields"
|
|
|
|
+ :key="column.code"
|
|
|
|
+ v-model="column.enable"
|
|
|
|
+ >{{ column.name }}</el-checkbox
|
|
|
|
+ >
|
|
|
|
+ </el-form-item>
|
|
</div>
|
|
</div>
|
|
<el-form-item prop="attention" label="注意事项:">
|
|
<el-form-item prop="attention" label="注意事项:">
|
|
<el-input
|
|
<el-input
|
|
@@ -122,6 +143,7 @@
|
|
import { mapState, mapMutations, mapActions } from "vuex";
|
|
import { mapState, mapMutations, mapActions } from "vuex";
|
|
import { objAssign } from "../plugins/utils";
|
|
import { objAssign } from "../plugins/utils";
|
|
import { EXAM_NUMBER_STYLE, PAPER_TYPE } from "@/constants/enumerate";
|
|
import { EXAM_NUMBER_STYLE, PAPER_TYPE } from "@/constants/enumerate";
|
|
|
|
+import { examRuleDetail, getEnums } from "@/modules/base/api";
|
|
|
|
|
|
const initModalForm = {
|
|
const initModalForm = {
|
|
examNumberStyle: "",
|
|
examNumberStyle: "",
|
|
@@ -142,6 +164,10 @@ export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
modalForm: { ...initModalForm },
|
|
modalForm: { ...initModalForm },
|
|
|
|
+ deletedField: {
|
|
|
|
+ requiredFields: [],
|
|
|
|
+ extendFields: [],
|
|
|
|
+ },
|
|
EXAM_NUMBER_STYLE,
|
|
EXAM_NUMBER_STYLE,
|
|
PAPER_TYPE,
|
|
PAPER_TYPE,
|
|
drawer: false,
|
|
drawer: false,
|
|
@@ -210,24 +236,80 @@ export default {
|
|
},
|
|
},
|
|
],
|
|
],
|
|
},
|
|
},
|
|
|
|
+ examRule: {},
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
...mapState("card", ["cardConfig"]),
|
|
...mapState("card", ["cardConfig"]),
|
|
},
|
|
},
|
|
- watch: {
|
|
|
|
- cardConfig: {
|
|
|
|
- immediate: true,
|
|
|
|
- handler(val) {
|
|
|
|
- this.modalForm = objAssign(initModalForm, val);
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
|
|
+ mounted() {
|
|
|
|
+ this.getExamRule();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
...mapMutations("card", ["setCardConfig"]),
|
|
...mapMutations("card", ["setCardConfig"]),
|
|
...mapActions("card", ["rebuildPages"]),
|
|
...mapActions("card", ["rebuildPages"]),
|
|
|
|
+ async getExamRule() {
|
|
|
|
+ const examRequiredFields = await getEnums("REQUIRED_FIELDS");
|
|
|
|
+ const cardRequiredFields = await getEnums("CARD_REQUIRED_FIELDS");
|
|
|
|
+ const cardRequiredFieldCodes = cardRequiredFields.map(
|
|
|
|
+ (item) => item.code
|
|
|
|
+ );
|
|
|
|
+ const extendFields = examRequiredFields
|
|
|
|
+ .filter(
|
|
|
|
+ (field) =>
|
|
|
|
+ !cardRequiredFieldCodes.includes(field.code) && field.enable
|
|
|
|
+ )
|
|
|
|
+ .map((item) => {
|
|
|
|
+ return {
|
|
|
|
+ code: item.code,
|
|
|
|
+ name: item.name,
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+ let examRule = await examRuleDetail();
|
|
|
|
+ const cardExtendFields = [
|
|
|
|
+ ...extendFields,
|
|
|
|
+ ...JSON.parse(examRule.extendFields).filter((item) => item.enable),
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ this.examRule = {
|
|
|
|
+ requiredFields: cardRequiredFields.map((item) => {
|
|
|
|
+ return {
|
|
|
|
+ code: item.code,
|
|
|
|
+ name: item.name,
|
|
|
|
+ enable: true,
|
|
|
|
+ };
|
|
|
|
+ }),
|
|
|
|
+ extendFields: cardExtendFields.map((item) => {
|
|
|
|
+ return {
|
|
|
|
+ code: item.code,
|
|
|
|
+ name: item.name,
|
|
|
|
+ enable: false,
|
|
|
|
+ };
|
|
|
|
+ }),
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ initData() {
|
|
|
|
+ this.modalForm = objAssign(initModalForm, this.cardConfig);
|
|
|
|
+ this.updateField("requiredFields");
|
|
|
|
+ this.updateField("extendFields");
|
|
|
|
+ },
|
|
|
|
+ updateField(type) {
|
|
|
|
+ const examRuleFieldCodes = this.examRule[type].map((item) => item.code);
|
|
|
|
+ this.deletedField[type] = this.modalForm[type].filter(
|
|
|
|
+ (field) => !examRuleFieldCodes.includes(field.code)
|
|
|
|
+ );
|
|
|
|
+ this.modalForm[type] = this.modalForm[type].filter((field) =>
|
|
|
|
+ examRuleFieldCodes.includes(field.code)
|
|
|
|
+ );
|
|
|
|
+ const modalFormFieldCodes = this.modalForm[type].map((item) => item.code);
|
|
|
|
+ this.examRule[type].forEach((field) => {
|
|
|
|
+ if (modalFormFieldCodes.includes(field.code)) return;
|
|
|
|
+ this.modalForm[type].push({ ...field });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
open() {
|
|
open() {
|
|
this.drawer = true;
|
|
this.drawer = true;
|
|
|
|
+ this.initData();
|
|
},
|
|
},
|
|
cancel() {
|
|
cancel() {
|
|
this.drawer = false;
|
|
this.drawer = false;
|
|
@@ -242,7 +324,19 @@ export default {
|
|
const valid = await this.$refs.modalFormComp.validate().catch(() => {});
|
|
const valid = await this.$refs.modalFormComp.validate().catch(() => {});
|
|
if (!valid) return;
|
|
if (!valid) return;
|
|
|
|
|
|
- this.setCardConfig({ ...this.modalForm });
|
|
|
|
|
|
+ const data = { ...this.modalForm };
|
|
|
|
+ this.deletedField.requiredFields.forEach((item) => {
|
|
|
|
+ if (item.enable) {
|
|
|
|
+ data.requiredFields.push({ ...item });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ this.deletedField.extendFields.forEach((item) => {
|
|
|
|
+ if (item.enable) {
|
|
|
|
+ data.extendFields.push({ ...item });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ this.setCardConfig(data);
|
|
this.cancel();
|
|
this.cancel();
|
|
|
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|