CopyExamDialog.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <el-dialog
  3. ref="dialog"
  4. title="复制考试批次"
  5. width="450px"
  6. :visible.sync="visible"
  7. @close="closeDialog"
  8. >
  9. <el-form
  10. :model="form"
  11. ref="form"
  12. :rules="rules"
  13. label-position="right"
  14. label-width="120px"
  15. >
  16. <el-row>
  17. <el-form-item label="批次名称" prop="name">
  18. <el-input
  19. class="pull_length"
  20. v-model="form.name"
  21. placeholder="批次名称"
  22. />
  23. </el-form-item>
  24. </el-row>
  25. <el-row>
  26. <el-form-item label="批次编码" prop="code">
  27. <el-input
  28. class="pull_length"
  29. v-model="form.code"
  30. placeholder="批次编码"
  31. disabled
  32. />
  33. </el-form-item>
  34. </el-row>
  35. <el-row class="d-flex justify-content-center">
  36. <el-button type="primary" @click="submitForm">保 存</el-button>
  37. <el-button @click="closeDialog">取 消</el-button>
  38. </el-row>
  39. </el-form>
  40. </el-dialog>
  41. </template>
  42. <script>
  43. import { copyExam } from "@/api/examwork-exam";
  44. export default {
  45. name: "CopyExamDialog",
  46. props: {
  47. exam: Object,
  48. },
  49. data() {
  50. return {
  51. visible: false,
  52. form: {
  53. name: "",
  54. code: "",
  55. },
  56. rules: {},
  57. };
  58. },
  59. watch: {
  60. "form.name"(val) {
  61. this.form.code = val;
  62. },
  63. },
  64. methods: {
  65. openDialog() {
  66. this.visible = true;
  67. },
  68. closeDialog() {
  69. this.visible = false;
  70. },
  71. async submitForm() {
  72. await copyExam({
  73. sourceId: this.exam.id,
  74. code: this.form.code,
  75. name: this.form.name,
  76. });
  77. this.$emit("reload");
  78. this.closeDialog();
  79. },
  80. },
  81. };
  82. </script>
  83. <style></style>