wyh пре 9 месеци
родитељ
комит
9779f49f71
1 измењених фајлова са 35 додато и 8 уклоњено
  1. 35 8
      src/views/module_interLock/baseInterLock/modules/BaseInterLockModal.vue

+ 35 - 8
src/views/module_interLock/baseInterLock/modules/BaseInterLockModal.vue

@@ -32,7 +32,7 @@
               hasChildField="has_child"
               >
             </j-tree-select> -->
-            <a-tree-select
+            <!-- <a-tree-select
               v-model="model.pid"
               style="width: 100%"
               :tree-data="interlockTwoTree"
@@ -44,7 +44,14 @@
                 value: 'id',
                 title: 'interlockName',
               }"
-              ></a-tree-select>
+              ></a-tree-select> -->
+              <a-select
+                v-model="model.pid"
+                show-search
+                placeholder="请选择装置"
+                >
+                <a-select-option v-for="(item) in interlockTwoTree" :key="item.key" :value="item.key">{{ item.title }}</a-select-option>
+              </a-select>
               <!-- :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" -->
           </a-form-model-item>
         </template>
@@ -89,6 +96,7 @@
           add: "/base/interlockBase/add",
           edit: "/base/interlockBase/edit",
           lever12: '/base/interlockBase/lever12',
+          interLockSelect: '/sys/dict/loadTreeData',
         },
         expandedRowKeys:[],
         pidField:"pid",
@@ -101,19 +109,38 @@
        this.modelDefault = JSON.parse(JSON.stringify(this.model));
     },
     methods: {
-      getInterlockTwoTree(){
-        getAction(this.url.lever12).then(res => {
-          console.log(res)
-          this.interlockTwoTree = res
+      // getInterlockTwoTree(){
+      //   getAction(this.url.lever12).then(res => {
+      //     console.log(res)
+      //     this.interlockTwoTree = res
+      //   })
+      // },
+      // 获取装置/系统/联锁数据--默认获取装置数据
+      getData(pid, dataName){
+        let param = {
+          pid: pid,
+          tableName: 'interlock_base',
+          text: 'interlock_name',
+          code: 'id',
+          pidField: 'pid',
+          hasChildField: 'has_child',
+          condition: ''
+        }
+        getAction(this.url.interLockSelect,param).then(res=>{
+          if(res.success){
+            this[dataName] = res.result
+          }
         })
       },
       add (obj) {
-        this.getInterlockTwoTree()
+        // this.getInterlockTwoTree()
+        this.getData('0', 'interlockTwoTree')
         this.modelDefault.pid=''
         this.edit(Object.assign(this.modelDefault , obj));
       },
       edit (record) {
-        this.getInterlockTwoTree()
+        // this.getInterlockTwoTree()
+        this.getData('0', 'interlockTwoTree')
         this.model = Object.assign({}, record);
         this.visible = true;
       },