Przeglądaj źródła

feat: 处理三级联动数据设别和活动权益都不能为空

Damon 11 miesięcy temu
rodzic
commit
e9f5189a9a
1 zmienionych plików z 22 dodań i 31 usunięć
  1. 22 31
      src/views/operation/activity/detail.vue

+ 22 - 31
src/views/operation/activity/detail.vue

@@ -84,11 +84,7 @@
             </template>
           </el-table-column>
 
-          <!-- <el-table-column
-            v-if="form.platformName === platformNames[1]"
-            label="活动权益"
-            align="center"
-          >
+          <el-table-column label="活动权益" align="center">
             <template slot-scope="scope">
               <el-form-item
                 :prop="`deviceRespList.${scope.$index}.goodId`"
@@ -97,44 +93,33 @@
                 <el-select
                   v-model="scope.row.goodId"
                   placeholder="请选择活动权益"
-                  :disabled="scope.row.deviceId == null || disabledActivity"
-                >
-                  <el-option
-                    v-for="item in form.platformName === platformNames[1]?aaaa[scope.row.deviceId]:serviceTimeOptions"
-                    :key="item.goodId"
-                    :value="item.goodId"
-                    :label="item.goodName"
-                  />
-                </el-select>
-              </el-form-item>
-            </template>
-          </el-table-column> -->
-
-          <el-table-column label="活动权益" align="center">
-            <template slot-scope="scope">
-              <el-form-item>
-                <el-select
-                  v-model="scope.row.goodId"
-                  placeholder="请选择活动权益"
                   :disabled="disabledActivity"
                 >
                   <el-option
                     v-for="item in form.platformName === platformNames[1]
                       ? aaaa[scope.row.deviceId]
                       : serviceTimeOptions"
-                    :key="item.value"
-                    :value="item.value"
-                    :label="item.label"
+                    :key="
+                      form.platformName === platformNames[1]
+                        ? item.goodId
+                        : item.value
+                    "
+                    :value="
+                      form.platformName === platformNames[1]
+                        ? item.goodId
+                        : item.value
+                    "
+                    :label="
+                      form.platformName === platformNames[1]
+                        ? item.goodName
+                        : item.label
+                    "
                   />
                 </el-select>
               </el-form-item>
-              {{ scope.row.deviceId }}---{{ aaaa }}--
             </template>
           </el-table-column>
 
-
-
-
           <el-table-column label="领取数量" align="center">
             <template slot-scope="scope">
               <el-form-item
@@ -238,6 +223,7 @@ export default {
   watch: {
     "form.deviceRespList": {
       handler(val) {
+        // 判断是否流量充值,当前设备是否有数据
         if (this.form.platformName == this.platformNames[1]) {
           if (this.deviceRespListTemp.length == val.length) {
             for (var i = 0; i < val.length; i++) {
@@ -276,6 +262,9 @@ export default {
           if (this.form.deviceRespList[i].goodId != null) {
             this.form.deviceRespList[i].goodId = null;
           }
+          if (this.form.deviceRespList[i].deviceId != null) {
+            this.form.deviceRespList[i].deviceId = null;
+          }
         }
       },
       deep: true,
@@ -307,9 +296,11 @@ export default {
       goodList(param).then((res) => {
         if (res.code === 0) {
           this.aaaa[`${deviceId}`] = res.data;
+          this.form.deviceRespList = this.form.deviceRespList.filter((i) => i);
           console.log(
             "gasdfasdfasdfaf==啊啊啊啊=11=" + JSON.stringify(this.aaaa)
           );
+
           ///goodId  goodName
         }
       });