ソースを参照

更新清运功能

zhangdan 4 年 前
コミット
1d3cd40226

+ 12 - 3
src/api/cleanManage.js

@@ -81,7 +81,7 @@ export const cleanUserList = (params) => {
 
 // 待清运列表
 export const netWorkCleanRecordList = (params) => {
-  const url = `cleanStation/waitToClean/${params.pageNo}/${params.pageSize}`
+  const url = `cleanStationDevice/waitToClean/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageSize
   return axios({
@@ -93,7 +93,7 @@ export const netWorkCleanRecordList = (params) => {
 
 // 总计
 export const getCleanStationSum = (params) => {
-  const url = `cleanStation/waitToClean/sum`
+  const url = `cleanStationDevice/waitToClean/sum`
   return axios.request({
     url: url,
     data: params,
@@ -142,6 +142,15 @@ export const driverQueryList = (params) => {
   })
 }
 
+// 查司机
+export const findDriverName = params => {
+  return axios({
+    url: `driver/findById/${params.id}`,
+    data: params,
+    method: 'get'
+  })
+}
+
 // 删除用户接口
 export const delectDriver = params => {
   return axios({
@@ -216,4 +225,4 @@ export const findTotalGroupDateAndRubbishType = (params) => {
     data: params,
     method: 'post'
   })
-}
+}

+ 25 - 31
src/views/cleanManage/cleanModal.vue

@@ -1,18 +1,9 @@
 <template>
   <div>
     <a-modal title="确认清运" :footer="null" v-model="isShow" @cancel="cancel" centered>
-      <a-form-model ref="ruleForm" :model="queryParam" :rules="rules" :label-col="{span:5}" :wrapper-col="{span:17}">
-        <a-form-model-item label="清运司机" prop="dirverUserId">
-          <a-select
-            placeholder="请选择清运司机"
-            allowClear
-            id="cleanModal-dirverUserId"
-            v-model="queryParam.dirverUserId"
-            :showSearch="true"
-            option-filter-prop="children"
-            :filter-option="filterOption">
-            <a-select-option v-for="item in optionData" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
-          </a-select>
+      <a-form-model ref="ruleForm" :model="queryParam" :label-col="{span:5}" :wrapper-col="{span:17}">
+        <a-form-model-item label="清运司机">
+          {{ driverName }}
         </a-form-model-item>
         <a-form-model-item label="备注">
           <a-textarea
@@ -37,7 +28,7 @@
 </template>
 
 <script>
-import { driverQueryList, cleanByDevice } from '@/api/cleanManage.js'
+import { findDriverName, cleanByDevice } from '@/api/cleanManage.js'
 export default {
   name: 'CleanModal',
   props: {
@@ -45,11 +36,11 @@ export default {
       type: Boolean,
       default: false
     },
-    stationNo: {
+    cleanStationDeviceNo: {
       type: [Number, String],
       default: ''
     },
-    deviceNo: {
+    dirverUserId: {
       type: [Number, String],
       default: ''
     }
@@ -59,11 +50,9 @@ export default {
       optionData: [], // 司机列表数据
       isShow: this.openModal,
       queryParam: {
-        dirverUserId: undefined,
-        remarks: ''
+        remark: ''
       },
-      // 校验规则
-      rules: { dirverUserId: [{ required: true, message: '请选择清运司机', trigger: ['blur', 'change'] }] }
+      driverName: ''
     }
   },
   methods: {
@@ -73,12 +62,13 @@ export default {
       )
     },
     // 司机数据
-    getDriverList () {
-      driverQueryList({ loginFlag: 1 }).then(res => {
+    getDriverName () {
+      findDriverName({ id: this.dirverUserId }).then(res => {
         if (res.status == 200) {
-          this.optionData = res.data || []
+          console.log(res)
+          this.driverName = res.data.name
         } else {
-          this.optionData = []
+          this.driverName = ''
         }
       })
     },
@@ -88,9 +78,7 @@ export default {
         const _this = this
         if (valid) {
           const params = {
-            stationNo: this.stationNo,
-            deviceNo: this.deviceNo,
-            dirverUserId: this.queryParam.dirverUserId,
+            cleanStationDeviceNo: this.cleanStationDeviceNo,
             remarks: this.queryParam.remarks
           }
           cleanByDevice(params).then(res => {
@@ -132,11 +120,17 @@ export default {
         })
       }
     },
-    stationNo (newValue, oldValue) {
-      console.log(this.isShow, newValue)
-      if (this.isShow && newValue) {
-        this.getDriverList()
-      }
+    // cleanStationDeviceNo (newValue, oldValue) {
+    //   console.log(this.isShow, newValue)
+    //   if (this.isShow && newValue) {
+    //     // this.getDriverName(this.dirverUserId)
+    //   }
+    // },
+    dirverUserId (newValue, oldValue) {
+	  console.log(this.isShow, newValue)
+	  if (this.isShow && newValue) {
+	    this.getDriverName()
+	  }
     }
   }
 }

+ 22 - 18
src/views/cleanManage/notCleanNetwork.vue

@@ -105,31 +105,35 @@
       </template>
       <!-- 废旧衣物 -->
       <template slot="clothes" slot-scope="text,record">
-        <span :style="{ color: record.maxVal==record.clothes ? 'red' : '' }">{{ (record.clothes/1000).toFixed(2) || 0 }}</span>
+        <span :style="{ color: record.maxVal==record.clothes ? 'red' : '' }">{{ record.clothes ? (record.clothes/1000).toFixed(2) : '0.00' }}</span>
       </template>
       <!-- 废旧纸张 -->
       <template slot="paper" slot-scope="text,record">
-        <span :style="{ color: record.maxVal==record.paper ? 'red' : '' }">{{ (record.paper/1000).toFixed(2) || 0 }}</span>
+        <span :style="{ color: record.maxVal==record.paper ? 'red' : '' }">{{ record.paper ? (record.paper/1000).toFixed(2) : '0.00' }}</span>
       </template>
       <!-- 废旧塑料 -->
       <template slot="plastic" slot-scope="text,record">
-        <span :style="{ color: record.maxVal==record.plastic ? 'red' : '' }">{{ (record.plastic/1000).toFixed(2) || 0 }}</span>
+        <span :style="{ color: record.maxVal==record.plastic ? 'red' : '' }">{{ record.plastic ? (record.plastic/1000).toFixed(2) : '0.00' }}</span>
       </template>
       <!-- 废旧金属 -->
       <template slot="metal" slot-scope="text,record">
-        <span :style="{ color: record.maxVal==record.metal ? 'red' : '' }">{{ (record.metal/1000).toFixed(2) || 0 }}</span>
+        <span :style="{ color: record.maxVal==record.metal ? 'red' : '' }">{{ record.metal ? (record.metal/1000).toFixed(2) : '0.00' }}</span>
       </template>
       <!-- 废旧金属/塑料 -->
-      <template slot="metPla" slot-scope="text,record">
-        <span :style="{ color: record.maxVal==record.metPla ? 'red' : '' }">{{ (record.metPla/1000).toFixed(2) || 0 }}</span>
+      <template slot="plaMet" slot-scope="text,record">
+        <span :style="{ color: record.maxVal==record.plaMet ? 'red' : '' }">{{ record.plaMet ? (record.plaMet/1000).toFixed(2) : '0.00' }}</span>
       </template>
       <!-- 废旧玻璃 -->
       <template slot="glass" slot-scope="text,record">
-        <span :style="{ color: record.maxVal==record.glass ? 'red' : '' }">{{ (record.glass/1000).toFixed(2) || 0 }}</span>
+        <span :style="{ color: record.maxVal==record.glass ? 'red' : '' }">{{ record.glass ? (record.glass/1000).toFixed(2) : '0.00' }}</span>
       </template>
       <!-- 可回收物 -->
       <template slot="recycling" slot-scope="text,record">
-        <span :style="{ color: record.maxVal==record.recycling ? 'red' : '' }">{{ (record.recycling/1000).toFixed(2) || 0 }}</span>
+        <span :style="{ color: record.maxVal==record.recycling ? 'red' : '' }">{{ record.recycling ? (record.recycling/1000).toFixed(2) : '0.00' }}</span>
+      </template>
+      <!-- 可回收物小计 -->
+      <template slot="totalWeight" slot-scope="text,record">
+        <span >{{ record.totalWeight ? (record.totalWeight/1000).toFixed(2) : '0.00' }}</span>
       </template>
       <!-- 操作 -->
       <span slot="action" slot-scope="text,record">
@@ -139,8 +143,8 @@
     </s-table>
     <!-- 清运弹窗 -->
     <cleanModal
-      :stationNo="itemStationNo"
-      :deviceNo="itemDeviceNo"
+      :cleanStationDeviceNo="itemCleanStationDeviceNo"
+      :dirverUserId="itemDirverUserId"
       :openModal="isOpenModal"
       @refresh="refreshTable"
       @close="closeCleanModal"></cleanModal>
@@ -171,8 +175,8 @@ export default {
         }
       },
       isOpenModal: false, // 默认弹窗关闭
-      itemStationNo: null, // 当前待清运记录id
-      itemDeviceNo: null,
+      itemCleanStationDeviceNo: null, // 当前待清运记录司机id
+	  itemDirverUserId: null,
       orderTotal: '', //  总计条数
       recyclableWasteTotal: '', //  可回收垃圾总计
       wasteClothes: '', //  废旧衣物总计
@@ -207,11 +211,11 @@ export default {
             { title: '废旧纸张', scopedSlots: { customRender: 'paper' }, width: 100, align: 'center' },
             { title: '废旧塑料', scopedSlots: { customRender: 'plastic' }, width: 100, align: 'center' },
             { title: '废旧金属', scopedSlots: { customRender: 'metal' }, width: 100, align: 'center' },
-            { title: '废旧金属/塑料', scopedSlots: { customRender: 'metPla' }, width: 100, align: 'center' },
+            { title: '废旧金属/塑料', scopedSlots: { customRender: 'plaMet' }, width: 100, align: 'center' },
             { title: '废旧玻璃', scopedSlots: { customRender: 'glass' }, width: 100, align: 'center' },
             { title: '可回收物', scopedSlots: { customRender: 'recycling' }, width: 100, align: 'center' }]
         },
-        { title: '可回收垃圾小计(kg)', dataIndex: 'totalWeight', width: 100, align: 'center', customRender: (text) => { return (text / 1000).toFixed(2) || 0 } },
+        { title: '可回收垃圾小计(kg)', dataIndex: 'totalWeight', width: 100, align: 'center', scopedSlots: { customRender: 'totalWeight' } },
         { title: '最后清运时间', dataIndex: 'lastCleanDate', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
         { title: '操作', dataIndex: 'action', width: 100, align: 'center', scopedSlots: { customRender: 'action' } }
       ],
@@ -230,7 +234,7 @@ export default {
             for (let i = 0; i < res.data.list.length; i++) {
               const _item = res.data.list[i]
               //  找出可回收垃圾库存量最大的值
-              const arr = [_item.clothes, _item.paper, _item.plastic, _item.metal, _item.metPla, _item.glass, _item.recycling]
+              const arr = [_item.clothes, _item.paper, _item.plastic, _item.metal, _item.plaMet, _item.glass, _item.recycling]
               const maxVal = Math.max(...arr)
               if (maxVal == 0) {
                 _item.maxVal = null
@@ -387,10 +391,10 @@ export default {
       this.time = []
       this.$refs.table.refresh(true)
     },
-    // 查看清运详情
+    // 立即清运
     handleDetail (record) {
-      this.itemStationNo = record.stationNo
-      this.itemDeviceNo = record.deviceNo
+      this.itemCleanStationDeviceNo = record.cleanStationDeviceNo
+	  this.itemDirverUserId = record.dirverUserId
       this.isOpenModal = true
     }
   }