123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <template>
- <el-dialog
- :visible.sync="modalIsShow"
- title="课程目标预期值"
- top="10vh"
- width="500px"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- append-to-body
- @open="visibleChange"
- >
- <el-form ref="modalFormComp" :model="modalForm" :rules="rules">
- <el-form-item prop="expectValue" label="预期值:">
- <el-input-number
- v-model="modalForm.expectValue"
- :min="0.01"
- :max="1"
- :step="0.01"
- step-strictly
- :controls="false"
- ></el-input-number>
- </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 { updateCourseOutlineTargetPredict } from "../../api";
- const initModalForm = {
- obeCourseOutlineId: null,
- expectValue: "",
- };
- export default {
- name: "modify-training-plan-requirement-predict",
- props: {
- rowData: {
- type: Object,
- default() {
- return {};
- },
- },
- },
- data() {
- return {
- modalIsShow: false,
- isSubmit: false,
- modalForm: { ...initModalForm },
- rules: {
- expectValue: [
- {
- required: true,
- message: "请输入课程目标预期值",
- trigger: "change",
- },
- ],
- },
- };
- },
- methods: {
- visibleChange() {
- this.modalForm = {
- obeCourseOutlineId: this.rowData.id,
- expectValue: this.rowData.expectValue,
- };
- },
- cancel() {
- this.modalIsShow = false;
- },
- open() {
- this.modalIsShow = true;
- },
- async submit() {
- const valid = await this.$refs.modalFormComp.validate().catch(() => {});
- if (!valid) return;
- if (this.isSubmit) return;
- this.isSubmit = true;
- const data = await updateCourseOutlineTargetPredict(this.modalForm).catch(
- () => {}
- );
- this.isSubmit = false;
- if (!data) return;
- this.$message.success("修改成功!");
- this.$emit("modified");
- this.cancel();
- },
- },
- };
- </script>
|