谢杰标 před 3 roky
rodič
revize
c706cd7417

+ 16 - 16
src/views/education/marketingCampaignManageMent/marketingActivitiesList/index.vue

@@ -60,8 +60,11 @@
             <el-input v-model="listData.name"></el-input>
           </el-form-item>
           <el-form-item label="关联模考" prop="mockApplyId">
-            <span style="margin-right: 10px">{{ listData.mockApplyName }}</span>
+            <span style="margin-right: 10px" v-if="listData.mockApplyId"
+              >{{ listData.mockApplyName }}({{ listData.mockApplyCode }})</span
+            >
             <el-button type="text" @click="showDialog">关联</el-button>
+            <!-- <el-input v-model="listData.mockApplyId"></el-input> -->
           </el-form-item>
           <el-form-item label="活动开始时间" prop="startTime"
             ><el-date-picker
@@ -246,15 +249,12 @@ export default {
       ],
       tableData: [], //表单数据
       total: 0, //一共多少条
-      listData: {
-        name: "",
-        majors: "",
-        startTime: "",
-        endTime: "",
-      },
+      listData: {},
       rules: {
         name: [{ required: true, message: "请输入活动名称", trigger: "blur" }],
-        majors: [{ required: true, message: "请输入科目", trigger: "blur" }],
+        mockApplyId: [
+          { required: true, message: "请选择关联模考", trigger: "change" },
+        ],
         startTime: [
           {
             type: "date",
@@ -347,12 +347,12 @@ export default {
         status: "0,1",
         mockActivity: 1,
       };
+      this.getMockList();
     },
-    showDialog(id) {
+    showDialog() {
       this.dialogTableVisible = true;
-      this.tableRadio = id;
+      this.tableRadio = "";
       this.dialogInit();
-      this.getMockList();
     },
     getMockList() {
       this.dialogLoading = true;
@@ -376,18 +376,18 @@ export default {
       this.getMockList();
     },
     submitAss() {
-      if (!this.tableRadio) {
+      let item = this.dialogTableData.find((e) => e.applyId == this.tableRadio);
+      if (!this.tableRadio || !item) {
         return this.$message({
           message: "请选择关联模考",
           type: "warning",
         });
       }
-      let { applyName, code } = this.dialogTableData.find(
-        (e) => e.applyId == this.tableRadio
-      );
+      let { applyName, code } = item;
       this.listData.mockApplyName = applyName;
       this.listData.mockApplyId = this.tableRadio;
       this.listData.mockApplyCode = code;
+      this.$refs["listData"].validateField(["mockApplyId"]);
       this.dialogTableVisible = false;
     },
     //将base64转换为blob
@@ -544,9 +544,9 @@ export default {
       this.listPop = 1;
       this.listData = {
         name: "",
-        majors: "",
         startTime: "",
         endTime: "",
+        mockApplyId: undefined,
       };
       this.dialogVisible = true;
       this.$nextTick(() => {