408249787 пре 2 година
родитељ
комит
a248c2c2da
2 измењених фајлова са 18 додато и 33 уклоњено
  1. 3 6
      src/views/sb/info/SbInfo.vue
  2. 15 27
      src/views/sb/info/modules/BaseFormLocation.vue

+ 3 - 6
src/views/sb/info/SbInfo.vue

@@ -162,12 +162,9 @@
                   <a-popconfirm v-if="measureStatus===1" :visible="false" @visibleChange="batchIncorrect()">
                     <a-menu-item key="2"><my-icon type="icon-pandian" /><a>检定</a></a-menu-item>
                   </a-popconfirm>
-                  <a-popconfirm v-if="measureStatus!==1" :visible="false" @visibleChange="batchLocation(2)">
+                  <a-popconfirm v-if="measureStatus!==1" :visible="false" @visibleChange="batchLocation()">
                     <a-menu-item key="3"><my-icon type="icon-pandian" /><a>设备位号</a></a-menu-item>
                   </a-popconfirm>
-                  <a-popconfirm v-if="measureStatus!==1" :visible="false" @visibleChange="batchLocation(1)">
-                    <a-menu-item key="4"><my-icon type="icon-pandian" /><a>设备位置</a></a-menu-item>
-                  </a-popconfirm>
                 </a-menu>
                 <a-button style="margin-left: 8px">
                   批量操作 <a-icon type="down" />
@@ -655,7 +652,7 @@ export default {
         modal.base([res.data])
       })
     },
-    batchLocation (type) {
+    batchLocation () {
       let ids = []
       const length = this.selectedRows.length
       if (length === 0) {
@@ -667,7 +664,7 @@ export default {
       batchLocationList({ ids }).then(res => {
         this.visible = false
         const modal = this.$refs.baseFormLocation
-        modal.base(res.data, type)
+        modal.base(res.data)
       })
     },
     batchIncorrect (id) {

+ 15 - 27
src/views/sb/info/modules/BaseFormLocation.vue

@@ -19,23 +19,15 @@
           {{ index+1 }}
         </template>
         <template v-slot:positionNo="text,record,index">
-          <div v-if="changeType===1">
-            {{ text }}
-          </div>
-          <div v-else>
-            <a-input v-if="record.isChild !== 1" style="width: 150px" v-model="record.positionNo" />
-            <div v-else style="width:300px">
-              <a-input
-                disabled
-                style="width: 50%"
-                v-model="record.positionNo"/>
-              <a-button type="primary" @click="handleSbNoSelect(index)">选择</a-button>
-            </div>
+          <div style="width:300px">
+            <a-input
+              style="width: 50%"
+              v-model="record.positionNo"/>
+            <a-button v-if="record.isChild !== 1" type="primary" @click="handleSbNoSelect(record.positionId,index)">选择</a-button>
           </div>
         </template>
         <template v-slot:positionName="text,record">
           <a-tree-select
-            v-if="changeType===1"
             style="width: 150px"
             :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
             :treeData="treeData"
@@ -45,7 +37,6 @@
             placeholder="请选择"
           >
           </a-tree-select>
-          <span v-else>  {{ text }}</span>
         </template>
         <span slot="status" slot-scope="text">
           <badge
@@ -61,7 +52,7 @@
 
 <script>
 import { getSbPositionTree } from '@/api/sb/position'
-import SbPositionNoModal from '@/views/sb/info/modules/SbPositionNoModal'
+import SbPositionNoModal from '@/views/sb/location/modules/LocationSelectModal'
 import { batchChanges } from '@/api/sb/info'
 
 export default {
@@ -77,7 +68,6 @@ export default {
       treeData: [],
       sbParentOPt: '',
       statusMap: {},
-      changeType: 0,
       columns: [
         {
           title: '序号',
@@ -104,12 +94,6 @@ export default {
             return record.typeName
           }
         },
-        {
-          title: '设备位号',
-          dataIndex: 'positionNo',
-          width: 150,
-          scopedSlots: { customRender: 'positionNo' }
-        },
         {
           title: '设备位置',
           checked: true,
@@ -118,6 +102,12 @@ export default {
           scopedSlots: { customRender: 'positionName' }
 
         },
+        {
+          title: '设备位号',
+          dataIndex: 'positionNo',
+          width: 150,
+          scopedSlots: { customRender: 'positionNo' }
+        },
         {
           title: '状态',
           dataIndex: 'status',
@@ -138,15 +128,13 @@ export default {
     })
   },
   methods: {
-    base (record, type) {
+    base (record) {
       this.visible = true
-      this.changeType = type
       this.modal = record.map(item => {
         if (item.children.length === 0) item.children = null
         return item
       })
       console.log(this.modal)
-      console.log(this.changeType)
     },
     save () {
       const params = this.modal.map(item => {
@@ -164,9 +152,9 @@ export default {
       })
       console.log(params)
     },
-    handleSbNoSelect (i) {
+    handleSbNoSelect (positionId, i) {
       this.sbParentOPt = i
-      this.$refs.sbPositionNoModal.base()
+      this.$refs.sbPositionNoModal.base({ positionId })
     },
     handleSbNoSelectd (keys, rows) {
       console.log(keys, rows)