123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <template>
- <el-dialog
- class="modify-semester"
- :visible.sync="modalIsShow"
- :title="title"
- top="10vh"
- width="700px"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- append-to-body
- @open="visibleChange"
- >
- <el-form
- ref="modalFormComp"
- :model="modalForm"
- :rules="rules"
- label-width="120px"
- label-position="top"
- >
- <el-form-item prop="evaluation" label="评价方式:">
- <el-input
- v-model.trim="modalForm.evaluation"
- placeholder="请输入评价方式"
- clearable
- :disabled="isEdit"
- ></el-input>
- </el-form-item>
- <el-form-item prop="evaluationDesc" label="评价方式描述:">
- <el-input
- v-model="modalForm.evaluationDesc"
- placeholder="请输入评价方式描述"
- type="textarea"
- :autosize="{ minRows: 4, maxRows: 10 }"
- :maxlength="999"
- resize="none"
- show-word-limit
- ></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer">
- <el-button type="primary" :disabled="isSubmit" @click="submit"
- >确认</el-button
- >
- <el-button @click="cancel">取消</el-button>
- </div>
- </el-dialog>
- </template>
- <script>
- import { updateCourseExamineEvaluation } from "../../api";
- import { mapState } from "vuex";
- const initModalForm = {
- evaluationId: null,
- obeCourseOutlineId: "",
- evaluation: "",
- evaluationDesc: "",
- };
- export default {
- name: "modify-course-examine-evaluation",
- props: {
- instance: {
- type: Object,
- default() {
- return {};
- },
- },
- },
- computed: {
- ...mapState("target", ["cwStatus"]),
- isEdit() {
- return !!this.instance.evaluationId;
- },
- title() {
- return (this.isEdit ? "编辑" : "新增") + "评价方式";
- },
- },
- data() {
- return {
- modalIsShow: false,
- isSubmit: false,
- modalForm: { ...initModalForm },
- rules: {
- evaluation: [
- {
- required: true,
- message: "请输入评价方式",
- trigger: "change",
- },
- {
- message: "评价方式不能超过30个字",
- max: 30,
- trigger: "change",
- },
- ],
- evaluationDesc: [
- {
- required: true,
- max: 999,
- message: "评价方式描述不能超过999个字",
- trigger: "change",
- },
- ],
- },
- };
- },
- methods: {
- initData(val) {
- this.modalForm = this.$objAssign(initModalForm, val);
- },
- visibleChange() {
- this.initData(this.instance);
- },
- cancel() {
- this.modalIsShow = false;
- },
- open() {
- this.modalIsShow = true;
- },
- async submit() {
- const valid = await this.$refs.modalFormComp.validate().catch(() => {});
- if (!valid) return;
- if (this.cwStatus.everSettingStatus) {
- const confirm = await this.$confirm(
- `${this.title}会影响权重设置,确定要${this.title}吗?`,
- "提示",
- {
- type: "warning",
- }
- ).catch(() => {});
- if (confirm !== "confirm") return;
- }
- if (this.isSubmit) return;
- this.isSubmit = true;
- let datas = { ...this.modalForm, id: this.modalForm.evaluationId };
- const res = await updateCourseExamineEvaluation(datas).catch(() => {});
- this.isSubmit = false;
- if (!res) return;
- this.$message.success(this.title + "成功!");
- if (res.warning) {
- this.$notify({
- title: "警告",
- message: "评价方式有变化,请重新设置权重设置!",
- type: "warning",
- duration: 5000,
- });
- }
- this.$emit("modified");
- this.cancel();
- },
- },
- };
- </script>
|