Bläddra i källkod

虚拟总表优化

zjz 2 år sedan
förälder
incheckning
d3b4fd7170

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 65 - 8
src/views/zhpt/zonghezhanshi/waterMeterDataMatch/components/addWaterMeter.vue


+ 15 - 1
src/views/zhpt/zonghezhanshi/waterMeterDataMatch/components/userTable.vue

@@ -1,6 +1,9 @@
 <template>
   <div>
     <el-row style="padding:10px 0px ;">
+      <span class="title">关键字</span>
+      <el-input v-model="search.likeStr" style="display: inline-block; margin-left: 5px; width:140px;" placeholder="客户编号、姓名、地址" size="small" />
+      <el-button size="small" type="primary" @click="searchUserTable">查询</el-button>
       <el-button size="small" type="primary" @click="batchRemoveAll">全部移除</el-button>
       <el-button size="small" type="primary" :disabled="multipleSelection.length==0" @click="batchRemove">批量移除</el-button>
       <el-button size="small" type="primary" :disabled="multipleSelection.length==0" @click="batchMove">批量移动</el-button>
@@ -117,7 +120,10 @@ export default {
         }
       ],
       pageInfo: { current: 1, size: 10, tableTotal: 0 }, // 分页数据
-      multipleSelection: []
+      multipleSelection: [],
+      search:{
+        likeStr:''
+      }
     }
   },
   watch: {
@@ -185,6 +191,7 @@ export default {
         size: this.pageInfo.size,
         current: this.pageInfo.current,
         tableIds: this.rowData.id,
+        likeStr: this.search.likeStr,
         code: 0
       }
       associatedCustomer(data).then(res => {
@@ -195,7 +202,14 @@ export default {
       }).catch(err => {
         console.log(err)
       })
+    },
+    /**
+     * 用户查询
+     */
+    searchUserTable(){
+      this.getAssociatedCustomer()
     }
+
   }
 }
 </script>

+ 70 - 18
src/views/zhpt/zonghezhanshi/waterMeterDataMatch/widget.vue

@@ -12,6 +12,9 @@
           <el-select v-model="totalWaterMeter.search.type" style="display: inline-block; margin-left: 5px; width:120px;" collapse-tags size="small" placeholder="请选择状态">
             <el-option v-for="(item) in totalWaterMeter.stateList" :key="item.value" :label="item.name" :value="item.value" />
           </el-select>
+          <span class="title">关键字</span>
+          <el-input v-model="totalWaterMeter.search.likeStr" style="display: inline-block; margin-left: 5px; width:100px;" placeholder="水表编号、地址" size="small" />
+
           <el-button size="small" type="primary" @click="searchTotalWaterMeterList">查询</el-button>
           <el-button size="small" type="primary" @click="automatch">批量匹配</el-button>
           <!-- <el-button size="small" type="primary" :disabled="buttonList.batchButton" @click="batchRemove">批量移除</el-button> -->
@@ -19,13 +22,15 @@
           <el-button size="small" type="primary" :disabled="buttonList.batchButton" @click="batchSetVillageName">小区设置</el-button> -->
           <el-button size="small" type="primary" :disabled="buttonList.totalButton" @click="batchConfirmPipe">总表与管线确认</el-button>
           <!-- <el-button size="small" type="primary" :disabled="buttonList.totalButton" @click="batchConfirmCustomer">客户与总表确认</el-button> -->
-          <el-button size="small" type="primary" @click="addWaterMeterDialog=true">新增虚拟总表</el-button>
-          <el-button size="small" type="primary" :disabled="existDelXn" @click="delWaterMeter">删除虚拟总表</el-button>
+          <el-button size="small" type="primary" @click="addWaterMeter">新增总表</el-button>
+          <el-button size="small" type="primary" :disabled="existDelXn" @click="editWaterMeter">编辑总表</el-button>
+          <el-button size="small" type="primary" :disabled="existDelXn" @click="delWaterMeter">删除总表</el-button>
         </el-row>
         <!-- 列表展示 -->
         <el-table
           ref="totalWaterMeterTable"
           class="mapTable"
+          v-loading="totalLoading"
           :data="totalWaterMeter.data"
           row-key="id"
           stripe
@@ -135,7 +140,7 @@
         <el-dialog title="移动" :visible.sync="setTotalWaterMeterPage" width="400px" top="calc(50vh - 300px)" append-to-body @close="cancelSetTotalWater">
           <div style="width:100%;padding-right:8px;">
             <span class="flexTitle">总水表:</span>
-            <el-select v-model="inputInfo.totalWater" style="display: inline-block; margin-left: 5px; width:240px;" collapse-tags size="small" placeholder="请选择总水表">
+            <el-select v-model="inputInfo.totalWater" filterable style="display: inline-block; margin-left: 5px; width:240px;" collapse-tags size="small" placeholder="请选择总水表">
               <el-option v-for="(item) in totalData" :key="item.id" :label="item.sid" :value="item.id" />
             </el-select>
           </div>
@@ -147,7 +152,7 @@
         <el-dialog title="重新关联" :visible.sync="setNewWaterMeterPage" width="400px" top="calc(50vh - 300px)" append-to-body @close="cancelChange">
           <div style="width:100%;padding-right:8px;">
             <span class="flexTitle">新总水表:</span>
-            <el-select v-model="inputInfo.newNumber" style="display: inline-block; margin-left: 5px; width:240px;" collapse-tags size="small" placeholder="请选择总水表">
+            <el-select v-model="inputInfo.newNumber" filterable style="display: inline-block; margin-left: 5px; width:240px;" collapse-tags size="small" placeholder="请选择总水表">
               <el-option v-for="(item) in totalData" :key="item.id" :label="item.sid" :value="item.id" />
             </el-select>
           </div>
@@ -179,13 +184,13 @@
         <el-dialog title="客户水表关联总水表" :visible.sync="associatedTotalPage" width="400px" top="calc(50vh - 300px)" append-to-body @close="cancelAssociatedTotal">
           <div style="width:100%;padding-right:8px;">
             <span class="flexTitle">总水表:</span>
-            <el-select v-model="inputInfo.associatedTotal" style="display: inline-block; margin-left: 5px; width:240px;" collapse-tags size="small" placeholder="请选择总水表">
+            <el-select v-model="inputInfo.associatedTotal" filterable style="display: inline-block; margin-left: 5px; width:240px;" collapse-tags size="small" placeholder="请选择总水表">
               <el-option v-for="(item) in totalData" :key="item.id" :label="item.sid" :value="item.id" />
             </el-select>
           </div>
           <span slot="footer" class="dialog-footer">
             <el-button size="small" @click="cancelAssociatedTotal">取消</el-button>
-            <el-button type="primary" size="small" @click="confirmAssociatedTotal">确定</el-button>
+            <el-button type="primary" size="small"  :loading="customersWaterMeter.btnLoad" @click="confirmAssociatedTotal">确定</el-button>
           </span>
         </el-dialog>
         <el-dialog title="" :visible.sync="schedulePage" width="400px" top="calc(50vh - 300px)" append-to-body @close="cancelAssociatedTotal">
@@ -227,7 +232,12 @@
       :visible.sync="addWaterMeterDialog"
       width="800px"
     >
-      <AddWaterMeter ref="addWaterMeter" :map-view="data.mapView" @addSuccess="addSuccess" />
+      <AddWaterMeter ref="addWaterMeter" 
+        :map-view="data.mapView" 
+        :waterMeterData="totalWaterMeter.fromData" 
+        @addSuccess="addSuccess" 
+        :isEdit="addWaterMeterDialog"
+        />
       <span slot="footer" class="dialog-footer">
         <el-button size="small" @click="clearTableData()">取消</el-button>
         <el-button
@@ -246,7 +256,7 @@ import { loadModules } from 'esri-loader'
 import { viewTablePipe, userToTable, getTableInfo, moveUserTable, removeUser,
   inTheTable, confirmTableUser, confirmTablePipe, bindLine,
   associatedCustomer, setPlotName, autoMatch, getSchedule, addWaterMeter, getTableUserBindList ,
-  delTableUser
+  delTableUser , editTableUser
 } from '@/api/waterMeterDataMatchApi'
 import config from './config'
 import UserTable from './components/userTable'
@@ -257,6 +267,7 @@ export default {
   props: { data: Object },
   data() {
     return {
+      totalLoading:true,
       userTableLoading: true,
       addWaterMeterDialog: false,
 
@@ -287,11 +298,22 @@ export default {
         total: 0, // 总水表的总个数
         search: {// 查询的数据
           type: '3', // 状态
+          likeStr:'',   //关键字水表编号和地址模糊查询
           size: 10, // 当前每页显示条数
           current: 1 // 当前第几页
-        }
+        },
+        fromData:{
+          id:'',
+          issum:'1',
+          sid: '',
+          address: '',
+          pointLon: null,
+          pointLat: null
+        },
       },
-      pageSizes: [10, 25, 50, 100,200,500,1000,5000,10000], // 可改变的页数
+      isSumEdit:false,
+
+      pageSizes: [10, 25, 50, 100,200,500, 1000, 5000], // 可改变的页数
       expandTable: {
         selectData: [],
         data: [],
@@ -312,7 +334,8 @@ export default {
           cbbmc:'',   //抄表本名称
           size: 10, // 当前每页显示条数
           current: 1 // 当前第几页
-        }
+        },
+        btnLoad:false
       },
       loading: true,
       buttonList: {
@@ -380,7 +403,7 @@ export default {
      * @description 总表与管线确认
      */
     existPartBtn(){
-      return this.customersWaterMeter.selectData.length <= 1
+      return this.customersWaterMeter.selectData.length < 0
     }
   },
   destroyed() {
@@ -430,6 +453,7 @@ export default {
      * 客户表显示条数的改变
     */
     partChangeSize(data) {
+      debugger
       this.customersWaterMeter.search.size = data
       // 条数改变的时候重置到第一页(避免条件查询后,数据量不足不能翻页到当前页面)
       this.customersWaterMeter.search.current = 1
@@ -483,6 +507,7 @@ export default {
      * 获取总表与管线的关联管线
      * */
     getTotalWaterMeter() {
+      this.totalLoading = true;
       viewTablePipe(this.totalWaterMeter.search).then(res => {
         if (res.code == 1) {
           this.totalWaterMeter.data = res.result.records ? res.result.records : []
@@ -491,8 +516,10 @@ export default {
         } else {
           this.restTotalData()
         }
+        this.totalLoading = false;
       }).catch(err => {
         this.restTotalData()
+        this.totalLoading = false;
         console.log(err)
       })
     },
@@ -1302,13 +1329,15 @@ export default {
      * 客户水表与关联总水表
     */
     confirmAssociatedTotal() {
+      this.customersWaterMeter.btnLoad = true
+
       const ids = this.inputInfo.selectCustomers.map(item => { return { khbh: item.userCode, sbbh: item.waterMeterCode, yhxm: item.userName, yhdz: item.userAddress } })
       const sendData = {
         info: ids,
         tableId: this.inputInfo.associatedTotal
       }
-      debugger
       userToTable(sendData).then(res => {
+        this.customersWaterMeter.btnLoad = false
         if (res.code == 1) {
           this.$message.info('客户水表关联总水表成功')
           this.cancelAssociatedTotal()
@@ -1319,6 +1348,7 @@ export default {
         }
       }).catch(err => {
         this.$message.info('客户水表关联总水表失败')
+        this.customersWaterMeter.btnLoad = false
         console.log(err)
       })
     },
@@ -1394,7 +1424,11 @@ export default {
       this.addWaterMeterDialog = false
     },
     xjPointInfoSubmit() {
-      this.$refs.addWaterMeter.addMeter()
+      if(this.isSumEdit){
+        this.$refs.addWaterMeter.updateMeter()
+      }else{
+        this.$refs.addWaterMeter.addMeter()
+      }
     },
     addSuccess() {
       this.addWaterMeterDialog = false
@@ -1408,6 +1442,28 @@ export default {
       return row.waterMeterNameList?.join(',')
     },
 
+    /**
+     * @description 新增虚拟总表
+     */
+     addWaterMeter(){
+      // editTableUser
+      const that = this
+      that.addWaterMeterDialog = true
+      that.isSumEdit = false
+    },
+    /**
+     * @description 编辑虚拟总表
+     */
+    editWaterMeter(){
+      // editTableUser
+      const that = this
+      that.addWaterMeterDialog = true
+      const { id, sid, address , x,y } = that.totalWaterMeter.selectData[0]
+      that.totalWaterMeter.fromData = { id, sid, address , x , y } 
+      console.log("参数:"+ JSON.stringify(that.totalWaterMeter.fromData))
+      that.isSumEdit = true
+    },
+
     /**
      * @description 删除虚拟总表
      */
@@ -1418,10 +1474,6 @@ export default {
       this.$confirm('删除虚拟总表(删除总表后,同步删除关联管线、绑定用户), 是否继续?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
-        // showInput:true,
-        // inputType:"checkbox",
-        // inputValue:false,
-        // inputPlaceholder:"操作所有数据",
         type: 'info'
       }).then(() => {
         delWater()