Browse Source

修复了数组为空取值导致页面报错,重置按钮代码无法继续往下执行

Guos 8 hours ago
parent
commit
35817d66c0

+ 7 - 4
src/views/qw/qwUserVoiceLog/index.vue

@@ -77,7 +77,7 @@
 
       <el-form-item label="标签" prop="tagIds">
         <div @click="hangleChangeTags()" style="cursor: pointer; border: 1px solid #e6e6e6; background-color: white; overflow: hidden; flex-grow: 1;width: 250px">
-          <div style="min-height: 35px; max-height: 200px; overflow-y: auto;">
+          <div style="min-height: 35px; max-height: 200px; overflow-y: auto;" :key="selectTags.length">
             <el-tag type="success"
                     closable
                     :disable-transitions="false"
@@ -560,20 +560,23 @@ export default {
       }else {
         this.queryParams.tagIds=null;
       }
-
-
       this.queryParams.pageNum = 1;
       this.getList();
     },
     /** 重置按钮操作 */
     resetQuery() {
       this.resetForm("queryForm");
-      this.queryParams.corpId= this.myQwCompanyList[0].dictValue;
+      if (this.myQwCompanyList && this.myQwCompanyList.length > 0) {
+        this.queryParams.corpId = this.myQwCompanyList[0].dictValue;
+      } else {
+        this.queryParams.corpId = null; // 或设置默认值
+      }
       this.selectTags=[];
       this.createTime=null;
       this.queryParams.sTime=null;
       this.queryParams.eTime=null;
       this.queryParams.tagIds=null;
+      this.$forceUpdate();
       this.handleQuery();
     },
     // 多选框选中数据

+ 7 - 2
src/views/qw/qwUserVoiceLogTotal/index.vue

@@ -83,7 +83,7 @@
             </el-form-item>-->
       <el-form-item label="标签" prop="tagIds">
         <div @click="hangleChangeTags()" style="cursor: pointer; border: 1px solid #e6e6e6; background-color: white; overflow: hidden; flex-grow: 1;width: 250px">
-          <div style="min-height: 35px; max-height: 200px; overflow-y: auto;">
+          <div style="min-height: 35px; max-height: 200px; overflow-y: auto;" :key="selectTags.length">
             <el-tag type="success"
                     closable
                     :disable-transitions="false"
@@ -635,12 +635,17 @@ export default {
       this.queryParams.beginTime = null;
       this.queryParams.endTime = null;
       this.queryParams.deptId = null;
-      this.queryParams.corpId= this.myQwCompanyList[0].dictValue;
+      if (this.myQwCompanyList && this.myQwCompanyList.length > 0) {
+        this.queryParams.corpId= this.myQwCompanyList[0].dictValue;
+      } else {
+        this.queryParams.corpId = null; // 或设置默认值
+      }
       this.selectTags=[];
       this.createTime=null;
       this.queryParams.sTime=null;
       this.queryParams.eTime=null;
       this.queryParams.tagIds=null;
+      this.$forceUpdate();
       this.handleQuery();
     },
     // 多选框选中数据