Kaynağa Gözat

视频诊断绑定,初始渲染页面优化

humingshi-7@163.com 10 ay önce
ebeveyn
işleme
6e87d0dd4a

+ 9 - 21
src/views/iot/diagnoseMission/dialog.bindMission.vue

@@ -55,7 +55,7 @@ export default {
       isShow: false,
       formData: this.reset(),
       formDataRules: {
-        bindMissionId: [{ required: true, message: "请选择任务名称" }]
+        bindMissionId: [{ required: true, message: "请选择任务名称",trigger:'blur' }]
       },
       // 查询参数
       queryParams: {
@@ -80,24 +80,6 @@ export default {
   },
   methods: {
     ...mapMutations([]),
-    initDeviceTypeList(){
-          missionTypeList()
-            .then((r) => {
-              // 使用 map 而不是 filter 进行数据转换
-              const transformedList = r.map((item) => ({
-                value: item.value,
-                label: item.label,
-                type: item.type,
-              }));
-
-              // 将转换后的数据推送到 this.deviceTypeList
-              this.deviceTypes.push(...transformedList);
-            })
-            .catch((error) => {
-              // 处理错误
-              console.error('Error fetching device type list:', error);
-            });
-    },
     reset() {
       return {
         bindMissionId:null,
@@ -105,7 +87,14 @@ export default {
     },
     async show(queryParams, deviceTypes) {
       this.queryParams = queryParams;
-      this.deviceTypes.push(deviceTypes);
+      // 使用 map 而不是 filter 进行数据转换
+      this.deviceTypes = [];
+      const transformedList = deviceTypes.map((item) => ({
+        value: item.value,
+        label: item.label,
+        type: item.type,
+      }));
+      this.deviceTypes.push(...transformedList);
       this.isShow = true;
     },
     // 事件
@@ -137,7 +126,6 @@ export default {
     },
   },
   created() {
-      this.initDeviceTypeList();
   },
   mounted() {},
   components: { },

+ 9 - 21
src/views/iot/diagnoseThreshold/dialog.bindThreshold.vue

@@ -56,7 +56,7 @@ export default {
       isShow: false,
       formData: this.reset(),
       formDataRules: {
-        bindThresholdCodes: [{ required: true, message: "请选择阈值名称" }]
+        bindThresholdCodes: [{ required: true, message: "请选择阈值名称",trigger:'blur' }]
       },
       // 查询参数
       queryParams: {
@@ -81,24 +81,6 @@ export default {
   },
   methods: {
     ...mapMutations([]),
-    initDeviceTypeList(){
-          thresholdTypeList()
-            .then((r) => {
-              // 使用 map 而不是 filter 进行数据转换
-              const transformedList = r.map((item) => ({
-                value: item.value,
-                label: item.label,
-                type: item.type,
-              }));
-
-              // 将转换后的数据推送到 this.deviceTypeList
-              this.deviceTypes.push(...transformedList);
-            })
-            .catch((error) => {
-              // 处理错误
-              console.error('Error fetching device type list:', error);
-            });
-    },
     reset() {
       return {
         bindThresholdCodes:null,
@@ -106,7 +88,14 @@ export default {
     },
     async show(queryParams, deviceTypes) {
       this.queryParams = queryParams;
-      this.deviceTypes.push(deviceTypes);
+      // 使用 map 而不是 filter 进行数据转换
+      this.deviceTypes = [];
+      const transformedList = deviceTypes.map((item) => ({
+        value: item.value,
+        label: item.label,
+        type: item.type,
+      }));
+      this.deviceTypes.push(...transformedList);
       this.isShow = true;
     },
     // 事件
@@ -138,7 +127,6 @@ export default {
     },
   },
   created() {
-      this.initDeviceTypeList();
   },
   mounted() {},
   components: { },

+ 9 - 21
src/views/iot/diagnoseThreshold/dialog.unbindThreshold.vue

@@ -56,7 +56,7 @@ export default {
       isShow: false,
       formData: this.reset(),
       formDataRules: {
-        bindThresholdCodes: [{ required: true, message: "请选择阈值名称" }]
+        bindThresholdCodes: [{ required: true, message: "请选择阈值名称",trigger:'blur' }]
       },
       // 查询参数
       queryParams: {
@@ -81,24 +81,6 @@ export default {
   },
   methods: {
     ...mapMutations([]),
-    initDeviceTypeList(){
-          thresholdTypeList()
-            .then((r) => {
-              // 使用 map 而不是 filter 进行数据转换
-              const transformedList = r.map((item) => ({
-                value: item.value,
-                label: item.label,
-                type: item.type,
-              }));
-
-              // 将转换后的数据推送到 this.deviceTypeList
-              this.deviceTypes.push(...transformedList);
-            })
-            .catch((error) => {
-              // 处理错误
-              console.error('Error fetching device type list:', error);
-            });
-    },
     reset() {
       return {
         bindThresholdCodes:null,
@@ -106,7 +88,14 @@ export default {
     },
     async show(queryParams, deviceTypes) {
       this.queryParams = queryParams;
-      this.deviceTypes.push(deviceTypes);
+      // 使用 map 而不是 filter 进行数据转换
+      this.deviceTypes = [];
+      const transformedList = deviceTypes.map((item) => ({
+        value: item.value,
+        label: item.label,
+        type: item.type,
+      }));
+      this.deviceTypes.push(...transformedList);
       this.isShow = true;
     },
     // 事件
@@ -137,7 +126,6 @@ export default {
     },
   },
   created() {
-      this.initDeviceTypeList();
   },
   mounted() {},
   components: { },