浏览代码

修改切换项目 系统类型未刷新bug

haojianlong 5 年之前
父节点
当前提交
fab34b55dd
共有 1 个文件被更改,包括 15 次插入11 次删除
  1. 15 11
      src/components/ledger/lib/system.vue

+ 15 - 11
src/components/ledger/lib/system.vue

@@ -2,7 +2,7 @@
   <div id="cascaderMap">
     <span class="buildFloor" style="padding-right: 12px;">所属专业系统类型</span>
     <el-select v-model="value" placeholder="请选择" :props="props" filterable :style="isWidth ? '' : 'width:160px;'" size="small" @change="changeVal">
-      <el-option  v-for="item in options" :key="item.Category" :label="item.CategoryName" :value="item.Category"></el-option>
+      <el-option v-for="item in options" :key="item.Category" :label="item.CategoryName" :value="item.Category"></el-option>
     </el-select>
     <!-- <el-cascader placeholder="请选择" :options="options" v-model="value" :props="props" filterable :style="isWidth ? '' : 'width:160px;'" size="small"
       @change="changeVal" change-on-select></el-cascader> -->
@@ -18,8 +18,8 @@ export default {
       type: Boolean,
       default: true
     },
-    all:{
-      default:false
+    all: {
+      default: false
     }
   },
   computed: {
@@ -36,20 +36,24 @@ export default {
     };
   },
   created() {
-    if(this.all){
-      //物理世界所有系统
-      this.getAllData();
-    }else{
-      //当前项目下已有的系统
-      this.getData();
-    }
+    this.init()
   },
   watch: {
     projectId() {
       this.value = ''
+      this.init()
     }
   },
   methods: {
+    init() {
+      if (this.all) {
+        //物理世界所有系统
+        this.getAllData();
+      } else {
+        //当前项目下已有的系统
+        this.getData();
+      }
+    },
     setValue(val) {
       this.value = val
     },
@@ -80,7 +84,7 @@ export default {
         }
       })
     },
-    getAllData(){
+    getAllData() {
       getEqCode().then(res => {
         this.options = this.changeArr(res.data.Content)
         if (this.value) {