zhaobao há 2 anos atrás
pai
commit
c6d2d58467
2 ficheiros alterados com 42 adições e 27 exclusões
  1. 34 15
      src/views/goaf/info/components/GoafInfo.vue
  2. 8 12
      src/views/goaf/sensor/Model.vue

+ 34 - 15
src/views/goaf/info/components/GoafInfo.vue

@@ -41,13 +41,12 @@
         <el-table-column prop="goafCanfillVolume" label="可充填体积(m³)" width="150" />
         <el-table-column prop="goafRemainVolume" label="剩余可充填体积(m³)" width="280">
           <template v-slot="{row}">
-            <!-- <span v-if="row.status===1" style="color:'#49E86C'">
-              <el-input-number v-model="row.goafRemainVolume" placeholder="剩余可充填体积(m³)" :controls="false" size="mini" @blur="row.status=0" />
-              <input type="number" name="" >
-              <el-button type="primary">提交</el-button>
+            <span v-if="row.goafRemainVolumeCanEdit===true" class="table-input-number-box">
+              <input v-model="row.goafRemainVolume" type="number" placeholder="剩余可充填体积(m³)" class="table-input-number" :max="row.goafCanfillVolume">
+              <el-button size="mini" type="primary" @click="onUpdateGoaf(row)">提交</el-button>
+              <el-button size="mini" @click="row.goafRemainVolumeCanEdit=false">取消</el-button>
             </span>
-            <span v-else>{{ row.goafRemainVolume }}</span> -->
-            <span>{{ row.goafRemainVolume }}</span>
+            <span v-else>{{ row.goafRemainVolume }}</span>
           </template>
         </el-table-column>
         <el-table-column prop="goafIsFill" label="是否充填" width="80">
@@ -74,7 +73,7 @@
 </template>
 
 <script>
-import { getGoafBaseInfoByPage, delGoaf, getGoafBaseInfo } from '@/api/goaf/info'
+import { getGoafBaseInfoByPage, delGoaf, getGoafBaseInfo, updateGoaf } from '@/api/goaf/info'
 import { Pagination } from '@/components'
 import Goaf from './Goaf'
 import Detail from './detail'
@@ -125,7 +124,12 @@ export default {
         this.listLoading = false
         const { code, msg, data, total } = resp
         if (code === 0) {
-          this.dataList = data
+          this.dataList = data.map(item => {
+            return {
+              ...item,
+              goafRemainVolumeCanEdit: false
+            }
+          })
           this.total = total
         } else {
           this.$message.error(msg)
@@ -230,6 +234,11 @@ export default {
         this.downloadLoading = false
       })
     },
+    onUpdateGoaf(params) {
+      updateGoaf(params).then(() => {
+        this.getData()
+      })
+    },
     mergesJson(list = [], filterVal = ['goafOrebelt']) {
       const rowIndexs = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
       const merges = []
@@ -274,15 +283,14 @@ export default {
       return {
         goafOrebelt: '矿带', goafOrebody: '矿体', goafOreheight: '中段', goafName: '采空区名称',
         goafAvexArea: '水平断面均暴露面积(㎡)', goafKeyTrend: '倾向(度)', goafKeyDipangle: '倾角(度)',
-        goafAvinWidth: '平均倾向宽度(m)', goafAvexHeight: '平均暴露高度(m)', goafVoidVolume: '体积(m³)',
+        goafAvinWidth: '平均倾向宽度(m)', goafAvexHeight: '平均暴露高度(m)', goafVoidVolume: '体积(m³)', goafCanfillVolume: '可充填体积(m³)', goafRemainVolume: '剩余可充填体积(m³)',
         goafRoofpillarThickness: '顶板矿柱厚度(m)', goafIncoavThickness: '保安间柱平均厚度(m)', goafExpLocation: '勘探位置',
         goafRockLithology: '围岩岩性', goafRockStability: '围岩稳定性', goafFormationTime: '形成时间'
       }
     },
     cellDblclick(row, cell) {
       if (cell.property === 'goafRemainVolume') {
-        row.status = 1
-        row.goafRemainVolume = row.goafRemainVolume.toFixed()
+        row.goafRemainVolumeCanEdit = true
       }
     },
     unique(arr = [], name = 'name') {
@@ -346,9 +354,20 @@ export default {
   background-color: #306379;
 }
 .goaf{
-      .page-table{
-        height: calc(100vh - 260px);
-        overflow-y: auto;
-      }
+    .page-table{
+      height: calc(100vh - 260px);
+      overflow-y: auto;
     }
+  }
+  .table-input-number-box{
+    display: flex;
+    align-items: center;
+    .table-input-number{
+      width: 120px;
+      height: 30px;
+      outline: none;
+      margin-right: 10px;
+    }
+  }
+
 </style>

+ 8 - 12
src/views/goaf/sensor/Model.vue

@@ -252,36 +252,32 @@ export default {
       })
     },
     changeArea(type) {
-      const goafOrebelts = this.deeepClone(this.goafOrebelts)
+      const goafs = this.deeepClone(this.goaf)
       let goafOrebodys = this.deeepClone(this.goafOrebodys)
       let goafOreheights = this.deeepClone(this.goafOreheights)
       let goafNames = this.deeepClone(this.goafNames)
       if (type === 1) {
-        goafOrebodys = goafOrebelts.filter(
-          (item) => item.goafOrebelt === this.formData.goafOrebelt
-        )
+        goafOrebodys = goafs.filter(item => item.goafOrebelt === this.formData.goafOrebelt)
         goafOrebodys = this.unique(goafOrebodys, 'goafOrebody')
         this.goafOrebodys = goafOrebodys
         this.goafOreheights = []
         this.goafNames = []
         this.formData.goafOrebody = ''
         this.formData.goafOreheight = ''
+        this.formData.goafName = ''
         this.formData.goafId = ''
       } else if (type === 2) {
-        goafOreheights = goafOrebodys.filter(
-          (item) => item.goafOrebody === this.formData.goafOrebody
-        )
-        goafOreheights = this.unique(goafOreheights, 'goafOreheight')
+        goafOreheights = goafs.filter(item => (item.goafOrebody === this.formData.goafOrebody) && (item.goafOrebelt === this.formData.goafOrebelt))
+        goafOreheights = this.unique(goafOrebodys, 'goafOreheight')
         this.goafOreheights = goafOreheights
         this.goafNames = []
         this.formData.goafOreheight = ''
+        this.formData.goafName = ''
         this.formData.goafId = ''
       } else if (type === 3) {
-        goafNames = goafOreheights.filter(
-          (item) => item.goafOreheight === this.formData.goafOreheight
-        )
-        // goafNames = this.unique(goafNames, 'goafName')
+        goafNames = goafs.filter(item => (item.goafOreheight === this.formData.goafOreheight) && (item.goafOrebody === this.formData.goafOrebody) && (item.goafOrebelt === this.formData.goafOrebelt))
         this.goafNames = goafNames
+        this.formData.goafName = ''
         this.formData.goafId = ''
       } else {
         for (let i = 0; i < goafNames.length; i++) {