|
@@ -1,51 +1,21 @@
|
|
<template>
|
|
<template>
|
|
<div class="school-set-mark part-box part-box-pad">
|
|
<div class="school-set-mark part-box part-box-pad">
|
|
<el-form
|
|
<el-form
|
|
- v-if="fields.length"
|
|
|
|
ref="modalFormComp"
|
|
ref="modalFormComp"
|
|
:model="modalForm"
|
|
:model="modalForm"
|
|
:rules="rules"
|
|
:rules="rules"
|
|
- label-width="140px"
|
|
|
|
|
|
+ label-width="180px"
|
|
>
|
|
>
|
|
- <el-form-item
|
|
|
|
- v-for="field in fields"
|
|
|
|
- :key="field.code"
|
|
|
|
- :prop="field.prop"
|
|
|
|
- :label="field.name + ':'"
|
|
|
|
- >
|
|
|
|
- <template v-if="field.options">
|
|
|
|
- <el-radio-group v-model="field.value">
|
|
|
|
- <el-radio
|
|
|
|
- v-for="item in field.options"
|
|
|
|
- :key="item.value"
|
|
|
|
- :label="item.value"
|
|
|
|
- >{{ item.label }}</el-radio
|
|
|
|
- >
|
|
|
|
- </el-radio-group>
|
|
|
|
- </template>
|
|
|
|
- <template v-else>
|
|
|
|
- <el-radio-group v-model="field.enable" @change="resetVal(field)">
|
|
|
|
- <el-radio
|
|
|
|
- v-for="item in OPEN_STATUS"
|
|
|
|
- :key="item.value"
|
|
|
|
- :label="item.value"
|
|
|
|
- >{{ item.label }}</el-radio
|
|
|
|
- >
|
|
|
|
- </el-radio-group>
|
|
|
|
- <br />
|
|
|
|
- <el-input
|
|
|
|
- v-if="field.enable"
|
|
|
|
- v-model.trim="field.value"
|
|
|
|
- placeholder="请输入内容"
|
|
|
|
- clearable
|
|
|
|
|
|
+ <el-form-item prop="bindSet" label="评卷员自动绑定设置:">
|
|
|
|
+ <el-radio-group v-model="modalForm.bindSet">
|
|
|
|
+ <el-radio
|
|
|
|
+ v-for="item in bindList"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ :label="item.value"
|
|
>
|
|
>
|
|
- </el-input>
|
|
|
|
- </template>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item>
|
|
|
|
- <el-button type="primary" :loading="loading" @click="confirm"
|
|
|
|
- >保存</el-button
|
|
|
|
- >
|
|
|
|
|
|
+ {{ item.name }}
|
|
|
|
+ </el-radio>
|
|
|
|
+ </el-radio-group>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
@@ -53,7 +23,6 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { schoolSetMarkeInfo, schoolSetMarkerUpdate } from "../../api";
|
|
import { schoolSetMarkeInfo, schoolSetMarkerUpdate } from "../../api";
|
|
-import { OPEN_STATUS } from "../../../../constants/enumerate";
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "school-set-mark",
|
|
name: "school-set-mark",
|
|
@@ -68,40 +37,61 @@ export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
loading: false,
|
|
loading: false,
|
|
- OPEN_STATUS,
|
|
|
|
- modalForm: {},
|
|
|
|
|
|
+ bindInfo: [],
|
|
|
|
+ cachedModalForm: null,
|
|
|
|
+ modalForm: {
|
|
|
|
+ bindSet: "",
|
|
|
|
+ },
|
|
|
|
+ bindList: [
|
|
|
|
+ {
|
|
|
|
+ name: "不绑定",
|
|
|
|
+ value: "NONE",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: "交卷老师及任课老师",
|
|
|
|
+ value: "SUBJECT_AND_ASSIGN_TEACHER",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: "交卷老师",
|
|
|
|
+ value: "ASSIGN_TEACHER",
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
fields: [],
|
|
fields: [],
|
|
- rules: {},
|
|
|
|
|
|
+ rules: {
|
|
|
|
+ bindSet: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: "请选择评卷员自动绑定设置",
|
|
|
|
+ trigger: "change",
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
};
|
|
};
|
|
},
|
|
},
|
|
|
|
+ watch: {
|
|
|
|
+ modalForm: {
|
|
|
|
+ deep: true,
|
|
|
|
+ handler() {
|
|
|
|
+ const isChanged = this.checkConfigChanged();
|
|
|
|
+ this.$emit("config-changed", isChanged);
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ },
|
|
mounted() {
|
|
mounted() {
|
|
this.initData();
|
|
this.initData();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
async initData() {
|
|
async initData() {
|
|
const data = await schoolSetMarkeInfo(this.school.id);
|
|
const data = await schoolSetMarkeInfo(this.school.id);
|
|
- this.fields = data.result || [];
|
|
|
|
- this.fields.forEach((field) => {
|
|
|
|
- field.prop = field.code.split(".").join("_");
|
|
|
|
- this.$set(this.modalForm, field.prop, field.value);
|
|
|
|
- if (field.options) return;
|
|
|
|
-
|
|
|
|
- this.rules[field.prop] = [
|
|
|
|
- {
|
|
|
|
- validator: (rule, value, callback) => {
|
|
|
|
- if (!field.value && field.enable) {
|
|
|
|
- return callback(new Error(`请输入${field.name}`));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- callback();
|
|
|
|
- },
|
|
|
|
- trigger: "change",
|
|
|
|
- },
|
|
|
|
- ];
|
|
|
|
- });
|
|
|
|
|
|
+ this.bindInfo = data.result;
|
|
|
|
+ this.modalForm.bindSet = data.result[0]?.value || "";
|
|
|
|
+ this.cachedModalForm = JSON.parse(JSON.stringify(this.modalForm));
|
|
},
|
|
},
|
|
- resetVal(field) {
|
|
|
|
- if (!field.enable) field.value = "";
|
|
|
|
|
|
+ checkConfigChanged() {
|
|
|
|
+ if (!this.cachedModalForm) return false;
|
|
|
|
+ return (
|
|
|
|
+ JSON.stringify(this.modalForm) !== JSON.stringify(this.cachedModalForm)
|
|
|
|
+ );
|
|
},
|
|
},
|
|
async confirm() {
|
|
async confirm() {
|
|
const valid = await this.$refs.modalFormComp.validate().catch(() => {});
|
|
const valid = await this.$refs.modalFormComp.validate().catch(() => {});
|
|
@@ -109,12 +99,14 @@ export default {
|
|
|
|
|
|
if (this.loading) return;
|
|
if (this.loading) return;
|
|
this.loading = true;
|
|
this.loading = true;
|
|
- const datas = { param: this.fields, schoolId: this.school.id };
|
|
|
|
|
|
+ this.bindInfo[0].value = this.modalForm.bindSet;
|
|
|
|
+ const datas = { param: this.bindInfo, schoolId: this.school.id };
|
|
const res = await schoolSetMarkerUpdate(datas).catch(() => {});
|
|
const res = await schoolSetMarkerUpdate(datas).catch(() => {});
|
|
this.loading = false;
|
|
this.loading = false;
|
|
if (!res) return;
|
|
if (!res) return;
|
|
|
|
|
|
- this.$message.success("修改成功!");
|
|
|
|
|
|
+ this.cachedModalForm = JSON.parse(JSON.stringify(this.modalForm));
|
|
|
|
+ this.$emit("config-changed", false);
|
|
this.initData();
|
|
this.initData();
|
|
},
|
|
},
|
|
},
|
|
},
|