|
@@ -2,14 +2,13 @@
|
|
|
<el-dialog
|
|
|
class="modify-exam-config-detail"
|
|
|
:visible.sync="modalIsShow"
|
|
|
- :title="title"
|
|
|
top="0"
|
|
|
width="800px"
|
|
|
+ title="考试配置"
|
|
|
:close-on-click-modal="false"
|
|
|
:close-on-press-escape="false"
|
|
|
append-to-body
|
|
|
@opened="dialogOpened"
|
|
|
- @close="dialogClose"
|
|
|
>
|
|
|
<el-form
|
|
|
ref="modalFormComp"
|
|
@@ -228,27 +227,6 @@
|
|
|
</div>
|
|
|
|
|
|
<el-form-item prop="selectedPrint"></el-form-item>
|
|
|
-
|
|
|
- <el-form-item prop="orgIds" label="适用范围:">
|
|
|
- <!-- <select-orgs v-model="modalForm.orgIds" ref="SelectOrgs"></select-orgs> -->
|
|
|
- <div
|
|
|
- v-if="orgDataReady"
|
|
|
- class="select-orgs part-box part-box-pad part-box-border"
|
|
|
- >
|
|
|
- <el-tree
|
|
|
- :data="orgs"
|
|
|
- show-checkbox
|
|
|
- default-expand-all
|
|
|
- node-key="id"
|
|
|
- ref="MenuTree"
|
|
|
- :props="defaultProps"
|
|
|
- check-on-click-node
|
|
|
- :expand-on-click-node="false"
|
|
|
- @check-change="checkChange"
|
|
|
- >
|
|
|
- </el-tree>
|
|
|
- </div>
|
|
|
- </el-form-item>
|
|
|
</el-form>
|
|
|
|
|
|
<div slot="footer">
|
|
@@ -270,7 +248,7 @@ import {
|
|
|
CONFIRM_PRINT_TYPE,
|
|
|
} from "@/constants/enumerate";
|
|
|
import { deepCopy } from "@/plugins/utils";
|
|
|
-import { updateExamConfig, listOrgsByExamId, organizationList } from "../api";
|
|
|
+import { examConfigQuery, updateExamConfig } from "../api";
|
|
|
import { printPlanTemplateList } from "../../print/api";
|
|
|
import ExamBackupEdit from "./ExamBackupEdit.vue";
|
|
|
|
|
@@ -280,7 +258,6 @@ const initModalForm = {
|
|
|
review: true,
|
|
|
printMethod: "AUTO",
|
|
|
cardRuleId: "",
|
|
|
- orgIds: [],
|
|
|
printContent: [],
|
|
|
backupMethod: "ROOM",
|
|
|
backupCount: 1,
|
|
@@ -316,7 +293,7 @@ export default {
|
|
|
name: "modify-exam-config-detail",
|
|
|
components: { ExamBackupEdit },
|
|
|
props: {
|
|
|
- instance: {
|
|
|
+ exam: {
|
|
|
type: Object,
|
|
|
default() {
|
|
|
return {};
|
|
@@ -324,12 +301,6 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
computed: {
|
|
|
- isEdit() {
|
|
|
- return !!this.instance.id;
|
|
|
- },
|
|
|
- title() {
|
|
|
- return (this.isEdit ? "编辑" : "新增") + "考试配置";
|
|
|
- },
|
|
|
contentIncludesPaper() {
|
|
|
return this.modalForm.printContent.includes("PAPER");
|
|
|
},
|
|
@@ -383,7 +354,6 @@ export default {
|
|
|
ordinaryContent: [],
|
|
|
templateSources: {},
|
|
|
oldPrintContent: [],
|
|
|
- usedOrgIds: [],
|
|
|
allSelected: false,
|
|
|
infoShow: true,
|
|
|
rules: {
|
|
@@ -422,50 +392,22 @@ export default {
|
|
|
trigger: "change",
|
|
|
},
|
|
|
],
|
|
|
- orgIds: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- validator: (rule, value, callback) => {
|
|
|
- if (value.length) {
|
|
|
- callback();
|
|
|
- } else {
|
|
|
- callback(new Error("请选择适用范围"));
|
|
|
- }
|
|
|
- },
|
|
|
- trigger: "change",
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- // org select
|
|
|
- orgDataReady: false,
|
|
|
- orgs: [],
|
|
|
- orgIds: [],
|
|
|
- leafOrgIds: [],
|
|
|
- defaultProps: {
|
|
|
- label: "name",
|
|
|
},
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getTemplates();
|
|
|
- this.getOrgs();
|
|
|
},
|
|
|
methods: {
|
|
|
async dialogOpened() {
|
|
|
- const data = await listOrgsByExamId({
|
|
|
- examId: this.instance.examId,
|
|
|
- id: this.instance.id,
|
|
|
- });
|
|
|
- this.usedOrgIds = data || [];
|
|
|
- this.setDisabledOrgs(this.orgIds);
|
|
|
- this.orgDataReady = true;
|
|
|
-
|
|
|
- this.$nextTick(() => {
|
|
|
- this.initData(this.instance);
|
|
|
+ const data = await examConfigQuery({
|
|
|
+ examId: this.exam.id,
|
|
|
+ pageNumber: 1,
|
|
|
+ pageSize: 10,
|
|
|
});
|
|
|
- },
|
|
|
- dialogClose() {
|
|
|
- this.orgDataReady = false;
|
|
|
+ let val = data.records[0] || {};
|
|
|
+ val.examId = this.exam.id;
|
|
|
+ this.initData(val);
|
|
|
},
|
|
|
cancel() {
|
|
|
this.modalIsShow = false;
|
|
@@ -531,7 +473,6 @@ export default {
|
|
|
});
|
|
|
|
|
|
this.modalForm.printContent = JSON.parse(val.printContent);
|
|
|
- this.modalForm.orgIds = val.orgs.map((item) => item.id);
|
|
|
} else {
|
|
|
let modalForm = this.$objAssign(deepCopy(initModalForm), val);
|
|
|
modalForm.variableContent = modalForm.variableContent.filter(
|
|
@@ -541,13 +482,8 @@ export default {
|
|
|
(item) => this.templateSources[item.type]
|
|
|
);
|
|
|
this.modalForm = modalForm;
|
|
|
- if (!this.usedOrgIds.length) {
|
|
|
- this.modalForm.orgIds = [...this.leafOrgIds];
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
- this.setCheckedNode(this.modalForm.orgIds);
|
|
|
-
|
|
|
if (!this.checkHasSelect()) {
|
|
|
this.allSelected = true;
|
|
|
this.selectAll(this.allSelected);
|
|
@@ -665,7 +601,6 @@ export default {
|
|
|
async submit() {
|
|
|
const valid = await this.$refs.modalFormComp.validate().catch(() => {});
|
|
|
if (!valid) return;
|
|
|
- console.log(valid);
|
|
|
|
|
|
if (this.isSubmit) return;
|
|
|
this.isSubmit = true;
|
|
@@ -677,62 +612,10 @@ export default {
|
|
|
if (!data) return;
|
|
|
|
|
|
this.isSubmit = false;
|
|
|
- this.$message.success(this.title + "成功!");
|
|
|
+ this.$message.success("编辑成功!");
|
|
|
this.$emit("modified");
|
|
|
this.cancel();
|
|
|
},
|
|
|
- // org select
|
|
|
- async getOrgs() {
|
|
|
- const orgs = await organizationList();
|
|
|
- this.orgs = orgs || [];
|
|
|
-
|
|
|
- if (this.orgs.length) {
|
|
|
- this.orgs[0].children.sort((a, b) => {
|
|
|
- if (a.type === "PRINTING_HOUSE") return 1;
|
|
|
- if (b.type === "PRINTING_HOUSE") return -1;
|
|
|
-
|
|
|
- return 0;
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- let leafOrgIds = [];
|
|
|
- let orgIds = [];
|
|
|
- const getLeafOrg = (orgs) => {
|
|
|
- orgs.forEach((org) => {
|
|
|
- org.disabled = false;
|
|
|
- orgIds.push(org.id);
|
|
|
- if (org["children"] && org["children"].length) {
|
|
|
- getLeafOrg(org.children);
|
|
|
- } else {
|
|
|
- leafOrgIds.push(org.id);
|
|
|
- }
|
|
|
- });
|
|
|
- };
|
|
|
- getLeafOrg(this.orgs);
|
|
|
- this.leafOrgIds = leafOrgIds;
|
|
|
- this.orgIds = orgIds;
|
|
|
- },
|
|
|
- setDisabledOrgs(disabledOrgIds) {
|
|
|
- const updateInfo = (orgs) => {
|
|
|
- orgs.forEach((org) => {
|
|
|
- org.disabled = disabledOrgIds.includes(org.id);
|
|
|
- if (org["children"] && org["children"].length) {
|
|
|
- updateInfo(org.children);
|
|
|
- }
|
|
|
- });
|
|
|
- };
|
|
|
- updateInfo(this.orgs);
|
|
|
- },
|
|
|
- setCheckedNode(selectedIds) {
|
|
|
- const leafSelectedIds = selectedIds.filter((id) =>
|
|
|
- this.leafOrgIds.includes(id)
|
|
|
- );
|
|
|
- this.$refs.MenuTree.setCheckedKeys(leafSelectedIds);
|
|
|
- },
|
|
|
- checkChange() {
|
|
|
- this.modalForm.orgIds = this.$refs.MenuTree.getCheckedKeys();
|
|
|
- this.$refs.modalFormComp.validateField("orgIds");
|
|
|
- },
|
|
|
},
|
|
|
};
|
|
|
</script>
|