zhangdan 4 năm trước cách đây
mục cha
commit
f9a9e99a00

+ 70 - 0
src/api/cleanManage.js

@@ -0,0 +1,70 @@
+import { axios } from '@/utils/request'
+
+// 清运管理--网点清运记录
+
+// 列表
+export const cleanRecordList = (params) => {
+  const url = `cleanStation/queryCleanStationByStation/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 总计
+export const getCleanStationTotal = (params) => {
+  const url = `cleanStation/getCleanStationTotal`
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 详情
+export const networkDetail = (params) => {
+  const url = `cleanStationDevice/querycleanStationParticular/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 清运明细
+// 列表
+export const cleanDetailsList = (params) => {
+  const url = `cleanStationDevice/queryCleanStationDeviceByDevice/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 总计
+export const getCleanDetailsTotal = (params) => {
+  const url = `cleanStationDevice/getCleanStationDeviceTotal`
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 详情
+export const getCleanDetails = (params) => {
+  const url = `cleanLog/queryCleanStationDeviceParticular`
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}

+ 41 - 0
src/api/electronicScale.js

@@ -0,0 +1,41 @@
+import { axios } from '@/utils/request'
+
+// 电子秤
+// 获取列表数据
+export const getDeviceList = params => {
+  const url = `device/query/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'POST'
+  })
+}
+
+// 删除
+export const delectDevice = params => {
+  return axios({
+    url: `device/deleteSteelyardById/${params.id}`,
+    data: {},
+    method: 'get'
+  })
+}
+
+// 新增/编辑保存接口
+export const saveDevice = params => {
+  return axios({
+    url: 'device/saveSteelyard',
+    data: params,
+    method: 'POST'
+  })
+}
+
+// 查详情
+export const deviceDetails = params => {
+  return axios({
+    url: `device/findBySrcDeviceNo/${params.srcDeviceCode}`,
+    data: {},
+    method: 'get'
+  })
+}

+ 12 - 11
src/views/cleanManage/addDiverModal.vue

@@ -36,7 +36,7 @@ import {
   VSelect
 } from '@/components'
 import {
-  slelerDetails
+  slelerDetails, saveUserPower
 } from '@/api/userManage.js'
 export default {
   name: 'AddDiverModal',
@@ -116,21 +116,22 @@ export default {
     // 保存提交
     onSubmit () {
       this.$refs.ruleForm.validate(valid => {
+		  const _this = this
 		  console.log(valid, '--------------提交')
         if (valid) {
           console.log(valid, '--------------提交', this.formData)
           const params = JSON.parse(JSON.stringify(this.formData))
 				 console.log(params)
-          // saveUserPower(formData).then(res => {
-          //   console.log(res, 'rrrrrrrrr')
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     _this.$emit('refresh')
-          //     setTimeout(function () {
-          //       _this.isshow = false
-          //     }, 300)
-          //   }
-          // })
+          saveUserPower(params).then(res => {
+            console.log(res, 'rrrrrrrrr')
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$emit('refresh')
+              setTimeout(function () {
+                _this.cancel()
+              }, 300)
+            }
+          })
         }
       })
     },

+ 104 - 156
src/views/cleanManage/cleanDetail.vue

@@ -6,32 +6,36 @@
         ref="queryParam"
         :model="queryParam"
         layout="inline"
-        @keyup.enter.native="$refs.table.refresh(true)"
+        @keyup.enter.native="refresh"
         v-bind="formItemLayout">
         <a-row :gutter="24">
           <a-col :xs="24" :sm="12" :md="6" :lg="5">
             <a-form-model-item label="清运时间:" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
-              <a-range-picker :disabledDate="disabledDate" v-model="queryOrderDate" id="cleanDetail-queryOrderDate" :format="dateFormat" :placeholder="['开始时间', '结束时间']" />
+              <a-range-picker
+                :disabledDate="disabledDate"
+                v-model="time"
+                id="cleanDetail-time"
+                :format="dateFormat"
+                :placeholder="['开始时间', '结束时间']" />
             </a-form-model-item>
           </a-col>
           <a-col :xs="24" :sm="12" :md="6" :lg="5">
             <a-form-model-item label="网点名称" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
               <a-select
-                id="cleanDetail-queryOrderDate"
+                id="cleanDetail-stationNo"
                 placeholder="请选择网点名称"
                 allowClear
                 v-model="queryParam.stationNo"
-                :showSearch="true"
+                showSearch
                 option-filter-prop="children"
                 :filter-option="filterOption">
                 <a-select-option v-for="item in optionData" :key="item.stationNo" :value="item.stationNo">{{ item.name }}</a-select-option>
               </a-select>
             </a-form-model-item>
           </a-col>
-          <!-- <a-col :xs="24" :sm="12" :md="6" :lg="5"><a-form-model-item label="司机姓名" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol"><a-input allowClear :maxLength="30" placeholder="请输入司机姓名" v-model.trim="queryParam.name"/></a-form-model-item></a-col> -->
           <a-col :xs="24" :sm="12" :md="6" :lg="5">
             <a-form-model-item label="设备编号" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
-              <a-input allowClear placeholder="请输入设备编号" v-model.trim="queryParam.phone" id="cleanDetail-queryOrderDate"/>
+              <a-input allowClear placeholder="请输入设备编号" v-model.trim="queryParam.deviceNo" id="cleanDetail-queryOrderDate" />
             </a-form-model-item>
           </a-col>
           <a-col :xs="24" :sm="12" :md="6" :lg="5">
@@ -40,7 +44,7 @@
             </a-form-model-item>
           </a-col>
           <a-col :xs="24" :sm="12" :md="6" :lg="4">
-            <a-button type="primary" @click="$refs.table.refresh(true)" style="margin: 4px 10px 0 20px" id="cleanDetail-refresh">查询</a-button>
+            <a-button type="primary" @click="refresh" style="margin: 4px 10px 0 20px" id="cleanDetail-refresh">查询</a-button>
             <a-button type="" @click="reset" style="margin-top: 4px" id="cleanDetail-reset">重置</a-button>
           </a-col>
         </a-row>
@@ -48,147 +52,33 @@
     </div>
     <!-- 合计 -->
     <a-alert type="info" showIcon style="margin-bottom:15px">
-      <div class="ftext" slot="message">总计<span> {{ }} </span>条,可回收物清运量总计<span> {{ }} </span>kg</div>
+      <div class="ftext" slot="message">总计<span> {{ totalNum }} </span>条,可回收物清运量总计<span> {{ cleanWeightTotal }} </span>kg</div>
     </a-alert>
     <!-- 列表 -->
-    <a-table
+    <s-table
       ref="table"
       :rowKey="(record) => record.id"
       :columns="columns"
-      :data-source="data"
+      :data="loadData"
       bordered
-      @change="changeSort">
+    >
       <span slot="action" slot-scope="text,record">
         <a-button type="primary" @click="handleDetail(record)">查看清运明细</a-button>
       </span>
-    </a-table>
+    </s-table>
     <!-- 详情弹窗 -->
-    <cleanDetailModal :id="itemId" :visible="isOpenModal" @close="isOpenModal=false"></cleanDetailModal>
+    <cleanDetailModal :deviceNo="itemDeviceNo" :cleanTime="itemCleanTime" :visible="isOpenModal" @close="isOpenModal=false"></cleanDetailModal>
   </a-card>
 </template>
 
 <script>
-import {
-  STable,
-  VSelect
-} from '@/components'
-import {
-  stationList
-} from '@/api/releaseRecord.js'
+import { STable, VSelect } from '@/components'
+import { stationList } from '@/api/releaseRecord.js'
 import cleanDetailModal from './cleanDetailModal.vue'
-const columns = [{
-  title: '序号',
-  dataIndex: 'no',
-  width: 60,
-  align: 'center'
-},
-{
-  title: '清运时间',
-  dataIndex: 'createDate',
-  width: 100,
-  align: 'center'
-},
-{
-  title: '网点名称',
-  dataIndex: 'name',
-  width: 100,
-  align: 'center',
-  customRender: (text) => {
-    return text || '--'
-  }
-},
-{
-  title: '设备编号',
-  dataIndex: 'num',
-  width: 100,
-  align: 'center',
-  customRender: (text) => {
-    return text || '--'
-  }
-},
-{
-  title: '可回收物清运量(kg)',
-  dataIndex: 'org',
-  width: 100,
-  align: 'center',
-  sorter: true,
-  customRender: (text) => {
-    return text || 0
-  }
-},
-{
-  title: '清运司机',
-  dataIndex: 'changjia',
-  width: 100,
-  align: 'center',
-  customRender: (text) => {
-    return text || '--'
-  }
-},
-{
-  title: '操作人',
-  dataIndex: 'MAC',
-  width: 100,
-  align: 'center'
-},
-{
-  title: '备注',
-  dataIndex: 'remark',
-  width: 100,
-  align: 'center',
-  customRender: (text) => {
-    return text || '--'
-  }
-},
-{
-  title: '操作',
-  dataIndex: 'action',
-  width: 100,
-  align: 'center',
-  scopedSlots: {
-    customRender: 'action'
-  }
-}
-]
-const data = [{
-  createDate: '2020-01-05',
-  MAC: '22210245224555',
-  name: '电子秤',
-  num: '2222554585877',
-  org: 'X-001',
-  changjia: '上海电子厂'
-},
-{
-  createDate: '2020-01-05',
-  MAC: '22210245224555',
-  name: '电子秤',
-  num: '2222554585877',
-  org: 'X-001',
-  changjia: '上海电子厂'
-},
-{
-  createDate: '2020-01-05',
-  MAC: '22210245224555',
-  name: '电子秤',
-  num: '2222554585877',
-  org: 'X-001',
-  changjia: '上海电子厂'
-},
-{
-  createDate: '2020-01-05',
-  MAC: '22210245224555',
-  name: '电子秤',
-  num: '2222554585877',
-  org: 'X-001',
-  changjia: '上海电子厂'
-}
-]
+import { cleanDetailsList, getCleanDetailsTotal } from '@/api/cleanManage.js'
+import moment from 'moment'
 export default {
-  components: {
-    STable,
-    VSelect,
-    cleanDetailModal
-  },
+  components: { STable, VSelect, cleanDetailModal },
   data () {
     return {
       formItemLayout: {
@@ -199,27 +89,64 @@ export default {
           span: 17
         }
       },
-	  isOpenModal: false, // 默认弹窗关闭
-	  itemId: '', // 行id
+      isOpenModal: false, // 默认弹窗关闭
+      itemDeviceNo: '', // 每行设备编号
+      itemCleanTime: '', // 每行清运时间
       // 查询参数
       queryParam: {
-        stationNo: undefined,
-        phone: '',
+        stationNo: undefined, // 网点编号
+        deviceNo: null, // 设备编号
         loginFlag: '',
-        beginDate: null,
-        endDate: null
+        beginDate: null, // 开始时间
+        endDate: null // 结束时间
       },
-      // 网点名称数据
-      optionData: [],
-      columns,
-      data,
+      optionData: [], // 网点名称数据
       // 将默认当天时间日期回显在时间选择框中
-      queryOrderDate: [],
-      dateFormat: 'YYYY-MM-DD'
+      time: [],
+      dateFormat: 'YYYY-MM-DD', // 日期格式
+      totalNum: '', // 总条数
+      cleanWeightTotal: '', // 可回收物清运量总计
+      columns: [{ title: '序号', dataIndex: 'no', width: 60, align: 'center' },
+        { title: '清运时间', dataIndex: 'cleanTime', width: 100, align: 'center' },
+        { title: '网点名称', dataIndex: 'stationName', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
+        { title: '设备编号', dataIndex: 'deviceNo', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
+        { title: '可回收物清运量(kg)', dataIndex: 'cleanWeight', width: 100, align: 'center', sorter: true, customRender: (text) => { return text || 0 } },
+        { title: '清运司机', dataIndex: 'driverName', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
+        { title: '操作人', dataIndex: 'operatorName', width: 100, align: 'center' },
+        { title: '备注', dataIndex: 'remark', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
+        { title: '操作', dataIndex: 'action', width: 100, align: 'center', scopedSlots: { customRender: 'action' } }],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        const searchData = Object.assign(parameter, this.queryParam)
+        if (this.time && this.time.length) {
+          searchData.beginDate = moment(this.time[0]).format('YYYY-MM-DD')
+          searchData.endDate = moment(this.time[1]).format('YYYY-MM-DD')
+        } else {
+          searchData.beginDate = null
+          searchData.endDate = null
+        }
+        return cleanDetailsList(searchData).then(res => {
+          if (res.status == 200) {
+            const no = (res.data.pageNo - 1) * res.data.pageSize
+            for (let i = 0; i < res.data.list.length; i++) {
+              const _item = res.data.list[i]
+              _item.no = no + i + 1
+              if (_item.cleanWeight != null || 0) {
+                _item.cleanWeight = (_item.cleanWeight / 1000).toFixed(2)
+              }
+            }
+            this.totalNum = res.data.count
+            return res.data
+          } else {
+            this.totalNum = 0
+          }
+        })
+      }
     }
   },
   mounted () {
     this.getStationList()
+    this.getTotal()
   },
   methods: {
     // 不可选日期
@@ -246,31 +173,52 @@ export default {
         }
       })
     },
-    // 排序
-    changeSort () {
-      console.log('-------------排序 ')
+    // 合计
+    getTotal () {
+      const params = this.queryParam
+      if (this.time && this.time.length) {
+        params.beginDate = moment(this.time[0]).format('YYYY-MM-DD')
+        params.endDate = moment(this.time[1]).format('YYYY-MM-DD')
+      } else {
+        params.beginDate = null
+        params.endDate = null
+      }
+      getCleanDetailsTotal(params).then(res => {
+        if (res.status == 200) {
+          if (res.data != 0 || null) {
+            this.cleanWeightTotal = (res.data / 1000).toFixed(2)
+          }
+        } else {
+          this.cleanWeightTotal = 0
+        }
+      })
+    },
+    // 查询
+    refresh () {
+      this.$refs.table.refresh(true)
+      this.getTotal()
     },
     // 重置
     reset () {
       this.queryParam = {
-        stationNo: undefined,
-        phone: '',
+        stationNo: undefined, // 网点编号
+        deviceNo: null, // 设备编号
         loginFlag: '',
-        beginDate: null,
-        endDate: null
+        beginDate: null, // 开始时间
+        endDate: null // 结束时间
       }
-      this.queryOrderDate = []
+      this.time = []
+      this.$refs.table.refresh(true)
     },
     // 查看清运详情
     handleDetail (record) {
-      // this.itemId = record.id
-	  this.isOpenModal = true
-      console.log('----------详情')
+      this.itemDeviceNo = record.deviceNo
+      this.itemCleanTime = record.cleanTime
+      this.isOpenModal = true
     }
   }
 }
 </script>
-
 <style lang='less' scoped>
 	.cleanDetail-container {
 		.cleanDetail-container-searchForm {

+ 85 - 10
src/views/cleanManage/cleanDetailModal.vue

@@ -1,13 +1,17 @@
 <template>
   <a-modal title="清运详情" :footer="null" v-model="isShow" @cancel="isShow=false" centered>
-    <div class="detail-item">废旧衣物:{{ 200 }}kg</div>
-    <div class="detail-item">废旧衣物:{{ 200 }}kg</div>
-    <div class="detail-item">废旧衣物:{{ 200 }}kg</div>
-    <div class="detail-item">废旧衣物:{{ 200 }}kg</div>
+    <div class="detail-item"><span>废旧衣物:</span>{{ clothes }} kg</div>
+    <div class="detail-item"><span>废旧金属:</span>{{ metal }} kg</div>
+    <div class="detail-item"><span>废旧塑料:</span>{{ plasticv }} kg</div>
+    <div class="detail-item"><span>废旧纸张:</span>{{ paper }} kg</div>
+    <div class="detail-item"><span>废旧玻璃:</span>{{ glass }} kg</div>
+    <div class="detail-item"><span>可回收物:</span>{{ recycling }} kg</div>
+    <div class="detail-item"><span>废旧金属/塑料:</span>{{ plaMet }} kg</div>
   </a-modal>
 </template>
 
 <script>
+import { getCleanDetails } from '@/api/cleanManage.js'
 export default {
   name: 'CleanDetailModal',
   props: {
@@ -15,14 +19,77 @@ export default {
       type: Boolean,
       default: false
     },
-    id: {
+    deviceNo: {
+      type: [Number, String],
+      default: ''
+    },
+    cleanTime: {
       type: [Number, String],
       default: ''
     }
   },
   data () {
     return {
-      isShow: this.visible
+      isShow: this.visible,
+      pageInfo: {}
+    }
+  },
+  methods: {
+    getDetailInfo () {
+      getCleanDetails({ deviceNo: this.deviceNo, cleanDate: this.cleanTime }).then(res => {
+        this.pageInfo = res.data[0]
+      })
+    }
+  },
+  computed: {
+    clothes () {
+      if (this.pageInfo.clothes && (this.pageInfo.clothes != 0 || null)) {
+        return (this.pageInfo.clothes / 1000).toFixed(2)
+      } else {
+        return 0
+      }
+    },
+    metal () {
+      if (this.pageInfo.metal && (this.pageInfo.metal != 0 || null)) {
+        return (this.pageInfo.metal / 1000).toFixed(2)
+      } else {
+        return 0
+      }
+    },
+    plasticv () {
+      if (this.pageInfo.plasticv && (this.pageInfo.plasticv != 0 || null)) {
+        return (this.pageInfo.plasticv / 1000).toFixed(2)
+      } else {
+        return 0
+      }
+    },
+    paper () {
+      if (this.pageInfo.paper && (this.pageInfo.paper != 0 || null)) {
+        return (this.pageInfo.paper / 1000).toFixed(2)
+      } else {
+        return 0
+      }
+    },
+    glass () {
+      if (this.pageInfo.glass && (this.pageInfo.glass != 0 || null)) {
+        return (this.pageInfo.glass / 1000).toFixed(2)
+      } else {
+        return 0
+      }
+    },
+    recycling () {
+      if (this.pageInfo.recycling && (this.pageInfo.recycling != 0 || null)) {
+        return (this.pageInfo.recycling / 1000).toFixed(2)
+      } else {
+        return 0
+      }
+    },
+    plaMet () {
+      if (this.pageInfo.plaMet && (this.pageInfo.plaMet != 0 || null)) {
+        return (this.pageInfo.plaMet / 1000).toFixed(2)
+      } else {
+        return 0
+      }
     }
   },
   watch: {
@@ -30,9 +97,11 @@ export default {
       this.isShow = newValue
     },
     isShow (newValue, oldValue) {
-	  if (!newValue) {
-	    this.$emit('close')
-	  }
+      if (!newValue) {
+        this.$emit('close')
+      } else {
+        this.getDetailInfo()
+      }
     }
   }
 }
@@ -41,8 +110,14 @@ export default {
 
 <style lang="less" scoped="scoped">
 	.detail-item{
-		text-align: center;
 		margin:10px 0;
 		letter-spacing: 0.5px;
+		font-weight: bold;
+		span{
+			display: inline-block;
+			text-align: right;
+			width: 50%;
+			font-weight:normal
+		}
 	}
 </style>

+ 35 - 43
src/views/cleanManage/netWorkCleanModal.vue

@@ -18,12 +18,9 @@
 </template>
 
 <script>
-import {
-  STable
-} from '@/components'
-import {
-  getLuckyWinList
-} from '@/api/luckyDraw.js'
+import { STable } from '@/components'
+import { networkDetail } from '@/api/cleanManage.js'
+import moment from 'moment'
 export default {
   name: 'CleanDetailModal',
   components: {
@@ -34,55 +31,46 @@ export default {
       type: Boolean,
       default: false
     },
-    id: {
+    stationNo: {
       type: [Number, String],
       default: ''
+    },
+    searchDate: {
+      type: Array,
+      default: function () {
+        return []
+      }
     }
   },
   data () {
     return {
-      isShow: this.visible,
-      columns: [{
-        title: '序号',
-        dataIndex: 'no',
-        width: 60,
-        align: 'center'
-      },
-      {
-        title: '清运时间',
-        dataIndex: 'no',
-        width: 100,
-        align: 'center'
-      },
-      {
-        title: '设备编号',
-        dataIndex: 'no',
-        width: 100,
-        align: 'center'
-      },
-      {
-        title: '清运重量',
-        dataIndex: 'no',
-        width: 100,
-        align: 'center'
-      },
-      {
-        title: '清运司机',
-        dataIndex: 'no',
-        width: 100,
-        align: 'center'
-      }
-      ],
+      isShow: this.visible, // 弹窗的状态
+      columns: [{ title: '序号', dataIndex: 'no', width: 60, align: 'center' },
+        { title: '清运时间', dataIndex: 'cleanTime', width: 100, align: 'center' },
+        { title: '设备编号', dataIndex: 'deviceNo', width: 100, align: 'center' },
+        { title: '清运重量(kg)', dataIndex: 'cleanWeight', width: 100, align: 'center' },
+        { title: '清运司机', dataIndex: 'driverName', width: 100, align: 'center' }],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        const searchData = Object.assign(parameter)
-        return getLuckyWinList(searchData).then(res => {
+        const searchDateModal = this.searchDate
+        if (this.searchDate && this.searchDate.length) {
+          searchDateModal.beginDate = moment(this.searchDate[0]).format('YYYY-MM-DD')
+          searchDateModal.endDate = moment(this.searchDate[1]).format('YYYY-MM-DD')
+        } else {
+          searchDateModal.beginDate = null
+          searchDateModal.endDate = null
+        }
+        const searchData = Object.assign(parameter, { stationNo: this.stationNo }, { beginDate: searchDateModal.beginDate }, { endDate: searchDateModal.endDate })
+        console.log(searchData, '----------详情参数')
+        return networkDetail(searchData).then(res => {
           if (res.status == 200) {
             const no = (res.data.pageNo - 1) * res.data.pageSize
             for (let i = 0; i < res.data.list.length; i++) {
               const _item = res.data.list[i]
               _item.no = no + i + 1
-              _item.status = _item.status + '' === '1'
+              if (_item.cleanWeight != null || 0) {
+                _item.cleanWeight = (_item.cleanWeight / 1000).toFixed(2)
+              }
             }
             return res.data
           }
@@ -95,10 +83,14 @@ export default {
       this.isShow = newValue
     },
     isShow (newValue, oldValue) {
-      console.log(newValue, oldValue, '----')
       if (!newValue) {
         this.$emit('close')
       }
+    },
+    stationNo (newValue, oldValue) {
+      if (newValue && this.isShow) {
+        this.$refs.table.refresh(true)
+      }
     }
   }
 }

+ 85 - 136
src/views/cleanManage/netWorkCleanRecord.vue

@@ -6,7 +6,7 @@
         ref="queryParam"
         :model="queryParam"
         layout="inline"
-        @keyup.enter.native="$refs.table.refresh(true)"
+        @keyup.enter.native="refresh"
         v-bind="formItemLayout">
         <a-row :gutter="24">
           <a-col :xs="24" :sm="12" :md="6" :lg="5">
@@ -36,17 +36,7 @@
             </a-form-model-item>
           </a-col>
           <a-col :xs="24" :sm="12" :md="6" :lg="5">
-            <a-form-model-item label="设备编号" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
-              <a-input allowClear placeholder="请输入设备编号" v-model.trim="queryParam.phone" id="netWorkCleanRecord-stationNo"/>
-            </a-form-model-item>
-          </a-col>
-          <a-col :xs="24" :sm="12" :md="6" :lg="5">
-            <a-form-model-item label="操作人" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
-              <v-select code="ENABLE_FLAG" v-model="queryParam.loginFlag" allowClear placeholder="请选择操作人" id="netWorkCleanRecord-stationNo" ></v-select>
-            </a-form-model-item>
-          </a-col>
-          <a-col :xs="24" :sm="12" :md="6" :lg="4">
-            <a-button type="primary" @click="$refs.table.refresh(true)" id="netWorkCleanRecord-refresh" style="margin: 4px 10px 0 20px">查询</a-button>
+            <a-button type="primary" @click="refresh" id="netWorkCleanRecord-refresh" style="margin: 4px 10px 0 20px">查询</a-button>
             <a-button type="" @click="reset" id="netWorkCleanRecord-reset" style="margin-top: 4px">重置</a-button>
           </a-col>
         </a-row>
@@ -54,126 +44,34 @@
     </div>
     <!-- 合计 -->
     <a-alert type="info" showIcon style="margin-bottom:15px">
-      <div class="ftext" slot="message">总计<span> {{ }} </span>条,可回收物清运量总计<span> {{ }} </span>kg</div>
+      <div class="ftext" slot="message">总计<span> {{ totalNum }} </span>条,可回收物清运量总计<span> {{ cleanWeightTotal }} </span>kg</div>
     </a-alert>
     <!-- 列表 -->
-    <a-table
+    <s-table
       ref="table"
       :rowKey="(record) => record.id"
       :columns="columns"
-      :data-source="data"
+      :data="loadData"
       bordered
-      @change="changeSort">
+    >
       <span slot="action" slot-scope="text,record">
         <a-button type="primary" @click="handleDetail(record)">查看详情</a-button>
       </span>
-    </a-table>
+    </s-table>
     <!-- 详情弹窗 -->
-    <netWorkCleanModal :id="itemId" :visible="isOpenModal" @close="isOpenModal=false"></netWorkCleanModal>
+    <netWorkCleanModal :stationNo="itemStationNo" :searchDate="time" :visible="isOpenModal" @close="isOpenModal=false"></netWorkCleanModal>
   </a-card>
 </template>
 
 <script>
-import {
-  STable,
-  VSelect
-} from '@/components'
-import {
-  stationList
-} from '@/api/releaseRecord.js'
+import { STable, VSelect } from '@/components'
+import { stationList } from '@/api/releaseRecord.js'
+import { cleanRecordList, getCleanStationTotal } from '@/api/cleanManage.js'
 import netWorkCleanModal from './netWorkCleanModal.vue'
 import moment from 'moment'
 import getDate from '@/libs/getDate.js'
-const columns = [{
-  title: '序号',
-  dataIndex: 'no',
-  width: 60,
-  align: 'center'
-},
-{
-  title: '网点名称',
-  dataIndex: 'name',
-  width: 100,
-  align: 'center',
-  customRender: (text) => {
-    return text || '--'
-  }
-},
-{
-  title: '清运次数',
-  dataIndex: 'createDate',
-  width: 100,
-  align: 'center',
-  sorter: true
-},
-{
-  title: '清运重量(kg)',
-  dataIndex: 'org',
-  width: 100,
-  align: 'center',
-  sorter: true,
-  customRender: (text) => {
-    return text || 0
-  }
-},
-{
-  title: '最后清运时间',
-  dataIndex: 'changjia',
-  width: 100,
-  align: 'center',
-  customRender: (text) => {
-    return text || '--'
-  }
-},
-{
-  title: '操作',
-  dataIndex: 'action',
-  width: 100,
-  align: 'center',
-  scopedSlots: {
-    customRender: 'action'
-  }
-}
-]
-const data = [{
-  createDate: '2020-01-05',
-  MAC: '22210245224555',
-  name: '电子秤',
-  num: '2222554585877',
-  org: 'X-001',
-  changjia: '上海电子厂'
-},
-{
-  createDate: '2020-01-05',
-  MAC: '22210245224555',
-  name: '电子秤',
-  num: '2222554585877',
-  org: 'X-001',
-  changjia: '上海电子厂'
-},
-{
-  createDate: '2020-01-05',
-  MAC: '22210245224555',
-  name: '电子秤',
-  num: '2222554585877',
-  org: 'X-001',
-  changjia: '上海电子厂'
-},
-{
-  createDate: '2020-01-05',
-  MAC: '22210245224555',
-  name: '电子秤',
-  num: '2222554585877',
-  org: 'X-001',
-  changjia: '上海电子厂'
-}
-]
 export default {
-  components: {
-    STable,
-    VSelect,
-    netWorkCleanModal
-  },
+  components: { STable, VSelect, netWorkCleanModal },
   data () {
     return {
       formItemLayout: {
@@ -184,30 +82,61 @@ export default {
           span: 17
         }
       },
-	  isOpenModal: false, // 默认弹窗关闭
-	  itemId: '', // 行id
+      isOpenModal: false, // 默认弹窗关闭
+      itemStationNo: '', // 每行网点编号
       // 查询参数
       queryParam: {
-        stationNo: undefined,
-        phone: '',
-        loginFlag: '',
-        beginDate: null,
-        endDate: null
+        beginDate: null, // 开始时间
+        endDate: null, // 结束时间
+        stationNo: undefined // 网点编号
       },
-      // 网点名称数据
-      optionData: [],
-      columns,
-      data,
-      // 将默认当天时间日期回显在时间选择框中
+      totalNum: 0, // 总条数
+      cleanWeightTotal: 0, // 回收物总计
+      optionData: [], // 网点名称数据
+      // 将默认近一周时间日期回显在时间选择框中
       time: [
         moment(getDate.getRecentday().starttime, 'YYYY-MM-DD'),
         moment(getDate.getRecentday().endtime, 'YYYY-MM-DD')
       ],
-      dateFormat: 'YYYY-MM-DD'
+      dateFormat: 'YYYY-MM-DD',
+      columns: [{ title: '序号', dataIndex: 'no', width: 60, align: 'center' },
+        { title: '网点名称', dataIndex: 'stationName', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
+        { title: '清运次数', dataIndex: 'cleanTimes', width: 100, align: 'center', sorter: true },
+        { title: '清运重量(kg)', dataIndex: 'cleanWeight', width: 100, align: 'center', sorter: true, customRender: (text) => { return text || 0 } },
+        { title: '最后清运时间', dataIndex: 'cleanTime', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
+        { title: '操作', dataIndex: 'action', width: 100, align: 'center', scopedSlots: { customRender: 'action' } }],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        const searchData = Object.assign(parameter, this.queryParam)
+        if (this.time && this.time.length) {
+          searchData.beginDate = moment(this.time[0]).format('YYYY-MM-DD')
+          searchData.endDate = moment(this.time[1]).format('YYYY-MM-DD')
+        } else {
+          searchData.beginDate = null
+          searchData.endDate = null
+        }
+        return cleanRecordList(searchData).then(res => {
+          if (res.status == 200) {
+            const no = (res.data.pageNo - 1) * res.data.pageSize
+            for (let i = 0; i < res.data.list.length; i++) {
+              const _item = res.data.list[i]
+              _item.no = no + i + 1
+              if (_item.cleanWeight != null || 0) {
+                _item.cleanWeight = (_item.cleanWeight / 1000).toFixed(2)
+              }
+            }
+            this.totalNum = res.data.count
+            return res.data
+          } else {
+            this.totalNum = 0
+          }
+        })
+      }
     }
   },
   mounted () {
     this.getStationList()
+    this.getTotal()
   },
   methods: {
     // 不可选日期
@@ -226,7 +155,7 @@ export default {
         option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
       )
     },
-    // 获取合作商数据
+    // 获取网点名称数据
     getStationList () {
       stationList().then(res => {
         if (res.status == 200) {
@@ -234,16 +163,35 @@ export default {
         }
       })
     },
-    // 排序
-    changeSort () {
-      console.log('-------------排序 ')
+    // 总计
+    getTotal () {
+      const params = this.queryParam
+      if (this.time && this.time.length) {
+        params.beginDate = moment(this.time[0]).format('YYYY-MM-DD')
+        params.endDate = moment(this.time[1]).format('YYYY-MM-DD')
+      } else {
+        params.beginDate = null
+        params.endDate = null
+      }
+      getCleanStationTotal(params).then(res => {
+        if (res.status == 200) {
+          if (res.data != 0 || null) {
+            this.cleanWeightTotal = (res.data / 1000).toFixed(2)
+          }
+        } else {
+          this.cleanWeightTotal = 0
+        }
+      })
+    },
+    // 查询
+    refresh () {
+      this.$refs.table.refresh(true)
+      this.getTotal()
     },
     // 重置
     reset () {
       this.queryParam = {
         stationNo: undefined,
-        phone: '',
-        loginFlag: '',
         beginDate: null,
         endDate: null
       }
@@ -251,12 +199,13 @@ export default {
         moment(getDate.getRecentday().starttime, 'YYYY-MM-DD'),
         moment(getDate.getRecentday().endtime, 'YYYY-MM-DD')
       ]
+      this.$refs.table.refresh(true)
     },
     // 查看清运详情
     handleDetail (record) {
-      // this.itemId = record.id
-	  this.isOpenModal = true
-      console.log('----------详情')
+      this.itemStationNo = record.stationNo
+      this.searchDate = this.time
+      this.isOpenModal = true
     }
   }
 }

+ 98 - 160
src/views/cleanManage/notCleanNetwork.vue

@@ -80,13 +80,13 @@
       <div class="ftext" slot="message">总计<span> {{ }} </span>条,可回收垃圾总计<span> {{ }} </span>kg。  其中,废旧衣物<span> {{ }} </span>kg,废旧纸张<span> {{ }} </span>kg,废旧金属<span> {{ }} </span>kg,废旧塑料<span> {{ }} </span>kg,废旧金属/塑料<span> {{ }} </span>kg,废旧玻璃<span> {{ }} </span>kg,可回收物<span> {{ }} </span>kg</div>
     </a-alert>
     <!-- 列表 -->
-    <a-table
+    <s-table
       ref="table"
       :rowKey="(record) => record.id"
       :columns="columns"
-      :data-source="data"
+      :data="loadData"
       bordered
-      @change="changeSort">
+    >
       <template slot="customTitle">
         <a-tooltip placement="top">
           <template slot="title">
@@ -100,110 +100,19 @@
       <span slot="action" slot-scope="text,record">
         <a-button type="primary" @click="handleDetail(record)">立即清运</a-button>
       </span>
-    </a-table>
+    </s-table>
     <!-- 清运弹窗 -->
     <cleanModal :id="itemId" :visible="isOpenModal" @close="isOpenModal=false"></cleanModal>
   </a-card>
 </template>
 
 <script>
-import {
-  STable,
-  VSelect
-} from '@/components'
-import {
-  stationList
-} from '@/api/releaseRecord.js'
-import {
-  getProvince,
-  getCityByPro,
-  getDistrictByCity
-} from '@/api/station'
+import { STable, VSelect } from '@/components'
+import { stationList } from '@/api/releaseRecord.js'
+import { cleanDetailsList } from '@/api/cleanManage.js'
+import { getProvince, getCityByPro, getDistrictByCity } from '@/api/station'
 import cleanModal from './cleanModal.vue'
 import moment from 'moment'
-import getDate from '@/libs/getDate.js'
-const columns = [{title: '网点名称', dataIndex: 'no',width: 60,align: 'center'},
-{title: '设备编号', dataIndex: 'name',width: 100,align: 'center',customRender: (text) => {return text || '--' }},
-{slots: { title: 'customTitle' },
-  children: [
-    { title: '废旧衣物', dataIndex: 'yiwu', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
-    { title: '废旧纸张', dataIndex: 'zhizhang', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
-    { title: '废旧塑料', dataIndex: 'suliao', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
-    { title: '废旧金属', dataIndex: 'jinshu', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
-    { title: '废旧金属/塑料', dataIndex: 'jssl', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
-    { title: '废旧玻璃', dataIndex: 'boli', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
-    { title: '可回收物', dataIndex: 'huishou', width: 100, align: 'center', customRender: (text) => { return text || 0 } }
-  ]
-},
-{title: '可回收垃圾小计(kg)',dataIndex: 'createDate',width: 100,align: 'center'},
-{title: '最后清运时间',dataIndex: 'changjia',width: 100,align: 'center',customRender: (text) => {return text || '--'}},
-{title: '操作',dataIndex: 'action',width: 100,align: 'center',scopedSlots: {customRender: 'action'}}]
-const data = [{
-  createDate: '2020-01-05',
-  MAC: '22210245224555',
-  name: '电子秤',
-  num: '2222554585877',
-  org: 'X-001',
-  changjia: '上海电子厂',
-  yiwu: '50',
-  zhizhang: '45',
-  suliao: '55',
-  jinshu: '70',
-  jssl: '80',
-  boli: '100',
-  huishou: '152'
-},
-{
-  createDate: '2020-01-05',
-  MAC: '22210245224555',
-  name: '电子秤',
-  num: '2222554585877',
-  org: 'X-001',
-  changjia: '上海电子厂',
-  yiwu: '50',
-  zhizhang: '45',
-  suliao: '55',
-  jinshu: '270',
-  jssl: '80',
-  boli: '100',
-  huishou: '152'
-},
-{
-  createDate: '2020-01-05',
-  MAC: '22210245224555',
-  name: '电子秤',
-  num: '2222554585877',
-  org: 'X-001',
-  changjia: '上海电子厂',
-  yiwu: '50',
-  zhizhang: '45',
-  suliao: '155',
-  jinshu: '70',
-  jssl: '80',
-  boli: '100',
-  huishou: '152'
-},
-{
-  createDate: '2020-01-05',
-  MAC: '22210245224555',
-  name: '电子秤',
-  num: '2222554585877',
-  org: 'X-001',
-  changjia: '上海电子厂',
-  yiwu: '50',
-  zhizhang: '45',
-  suliao: '55',
-  jinshu: '70',
-  jssl: '180',
-  boli: '100',
-  huishou: '152'
-}
-]
-const arr = [{ yiwu: '50', zhizhang: '45', suliao: '55', jinshu: '70', jssl: '180', boli: '100', huishou: '152' },
-  { yiwu: '50', zhizhang: '45', suliao: '55', jinshu: '70', jssl: '180', boli: '100', huishou: '152' },
-  { yiwu: '50', zhizhang: '45', suliao: '55', jinshu: '70', jssl: '180', boli: '100', huishou: '152' },
-  { yiwu: '50', zhizhang: '45', suliao: '55', jinshu: '70', jssl: '180', boli: '100', huishou: '152' }]
-// let maxNum=
 export default {
   components: {
     STable,
@@ -220,32 +129,70 @@ export default {
           span: 16
         }
       },
-	  isOpenModal: false, // 默认弹窗关闭
-	  itemId: '', // 行id
+      isOpenModal: false, // 默认弹窗关闭
+      itemId: '', // 行id
       // 查询参数
       queryParam: {
-        stationNo: undefined,
-        phone: '',
-        loginFlag: '',
-        beginDate: null,
-        endDate: null,
+        stationNo: undefined, // 设备编号
+        phone: '', // 手机号码
+        loginFlag: '', // 状态
+        beginDate: null, // 开始时间
+        endDate: null, // 结束时间
         provinceCode: undefined, //  省
         cityCode: undefined, // 市
         districtCode: undefined // 区
       },
       // 网点名称数据
       optionData: [],
-	  addrProvinceList: [], //  省下拉
-	  addrCityList: [], //  市下拉
-	  addrDistrictList: [], //  区下拉
-      columns,
-      data,
+      addrProvinceList: [], //  省下拉
+      addrCityList: [], //  市下拉
+      addrDistrictList: [], //  区下拉
       // 将默认当天时间日期回显在时间选择框中
-      time: [
-        moment(getDate.getRecentday().starttime, 'YYYY-MM-DD'),
-        moment(getDate.getRecentday().endtime, 'YYYY-MM-DD')
-      ],
-      dateFormat: 'YYYY-MM-DD'
+      time: [],
+      dateFormat: 'YYYY-MM-DD', // 日期格式
+      columns: [{ title: '网点名称', dataIndex: 'no', width: 100, align: 'center' },
+        { title: '设备编号', dataIndex: 'name', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
+        { slots: { title: 'customTitle' },
+          children: [
+            { title: '废旧衣物', dataIndex: 'yiwu', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
+            { title: '废旧纸张', dataIndex: 'zhizhang', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
+            { title: '废旧塑料', dataIndex: 'suliao', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
+            { title: '废旧金属', dataIndex: 'jinshu', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
+            { title: '废旧金属/塑料', dataIndex: 'jssl', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
+            { title: '废旧玻璃', dataIndex: 'boli', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
+            { title: '可回收物', dataIndex: 'huishou', width: 100, align: 'center', customRender: (text) => { return text || 0 } }
+          ]
+        },
+        { title: '可回收垃圾小计(kg)', dataIndex: 'createDate', width: 100, align: 'center' },
+        { title: '最后清运时间', dataIndex: 'changjia', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
+        { title: '操作', dataIndex: 'action', width: 100, align: 'center', scopedSlots: { customRender: 'action' } }],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        const searchData = Object.assign(parameter, this.queryParam)
+        if (this.time && this.time.length) {
+          searchData.beginDate = moment(this.time[0]).format('YYYY-MM-DD')
+          searchData.endDate = moment(this.time[1]).format('YYYY-MM-DD')
+        } else {
+          searchData.beginDate = null
+          searchData.endDate = null
+        }
+        // return cleanDetailsList(searchData).then(res => {
+        //   if (res.status == 200) {
+        //     const no = (res.data.pageNo - 1) * res.data.pageSize
+        //     for (let i = 0; i < res.data.list.length; i++) {
+        //       const _item = res.data.list[i]
+        //       _item.no = no + i + 1
+        //       if (_item.cleanWeight != null || 0) {
+        //         _item.cleanWeight = (_item.cleanWeight / 1000).toFixed(2)
+        //       }
+        //     }
+        //     this.totalNum = res.data.count
+        //     return res.data
+        //   } else {
+        //     this.totalNum = 0
+        //   }
+        // })
+      }
     }
   },
   mounted () {
@@ -278,55 +225,51 @@ export default {
         }
       })
     },
-    // 获取省列表'
+    // 获取省列表
     getProvinceList () {
-	  getProvince().then(res => {
-	    if (res.status == 200) {
-	      this.addrProvinceList = res.data || []
-	    } else {
-	      this.addrProvinceList = []
-	    }
-	  })
+      getProvince().then(res => {
+        if (res.status == 200) {
+          this.addrProvinceList = res.data || []
+        } else {
+          this.addrProvinceList = []
+        }
+      })
     },
     // 获取城市列表
     getCityList (val) {
-	  this.addrCityList = []
-	  this.addrDistrictList = []
-	  this.queryParam.cityCode = undefined
-	  this.queryParam.districtCode = undefined
-	  this.getCityListRequest(val)
+      this.addrCityList = []
+      this.addrDistrictList = []
+      this.queryParam.cityCode = undefined
+      this.queryParam.districtCode = undefined
+      this.getCityListRequest(val)
     },
     getCityListRequest (val) {
-	  getCityByPro({
-	    id: val
-	  }).then(res => {
-	    if (res.status == 200) {
-	      this.addrCityList = res.data || []
-	    } else {
-	      this.addrCityList = []
-	    }
-	  })
+      getCityByPro({
+        id: val
+      }).then(res => {
+        if (res.status == 200) {
+          this.addrCityList = res.data || []
+        } else {
+          this.addrCityList = []
+        }
+      })
     },
     // 获取区县列表
     getAreaList (val) {
-	  this.addrDistrictList = []
-	  this.queryParam.districtCode = undefined
-	  this.getAreaListRequest(val)
+      this.addrDistrictList = []
+      this.queryParam.districtCode = undefined
+      this.getAreaListRequest(val)
     },
     getAreaListRequest (val) {
-	  getDistrictByCity({
-	    id: val
-	  }).then(res => {
-	    if (res.status == 200) {
-	      this.addrDistrictList = res.data || []
-	    } else {
-	      this.addrDistrictList = []
-	    }
-	  })
-    },
-    // 排序
-    changeSort () {
-      console.log('-------------排序 ')
+      getDistrictByCity({
+        id: val
+      }).then(res => {
+        if (res.status == 200) {
+          this.addrDistrictList = res.data || []
+        } else {
+          this.addrDistrictList = []
+        }
+      })
     },
     // 重置
     reset () {
@@ -337,16 +280,11 @@ export default {
         beginDate: null,
         endDate: null
       }
-      this.time = [
-        moment(getDate.getRecentday().starttime, 'YYYY-MM-DD'),
-        moment(getDate.getRecentday().endtime, 'YYYY-MM-DD')
-      ]
+      this.time = []
     },
     // 查看清运详情
     handleDetail (record) {
-      // this.itemId = record.id
       this.isOpenModal = true
-      console.log(this.isOpenModal, '----------详情')
     }
   }
 }

+ 108 - 47
src/views/equipmentManage/electronicScale/addElectronicScale.vue

@@ -1,20 +1,26 @@
 <template>
   <a-modal :footer="null" centered :title="modalTit" v-model="isShow" @cancle="isShow=false">
-    <a-form-model :model="form" ref="ruleForm" :rules="rules">
-      <a-form-model-item label="设备MAC地址" :label-col="{span:6}" :wrapper-col="{span:16}" prop="MAC">
-        <a-input placeholder="请输入设备MAC地址" v-model="form.MAC" allowClea oninput="value=value.toLowerCase()" :maxLength="12"/>
+    <a-form-model :model="formData" ref="ruleForm" :rules="rules">
+      <a-form-model-item label="设备MAC地址" :label-col="{span:6}" :wrapper-col="{span:16}" prop="macAddress">
+        <a-input
+          placeholder="请输入设备MAC地址"
+          :disabled="this.deviceCode ? true : false"
+          v-model="formData.macAddress"
+          allowClea
+          oninput="value=value.toLowerCase()"
+          :maxLength="12" />
       </a-form-model-item>
-      <a-form-model-item label="设备名称" :label-col="{span:6}" :wrapper-col="{span:16}" prop="MAC">
-        <a-input placeholder="请输入设备名称" v-model="form.MAC" allowClear :maxLength="30"/>
+      <a-form-model-item label="设备名称" :label-col="{span:6}" :wrapper-col="{span:16}" prop="deviceName">
+        <a-input placeholder="请输入设备名称" v-model="formData.deviceName" allowClear :maxLength="30"/>
       </a-form-model-item>
-      <a-form-model-item label="设备编号" :label-col="{span:6}" :wrapper-col="{span:16}" prop="MAC">
-        <a-input placeholder="请输入设备编号" v-model="form.MAC" allowClear :maxLength="30"/>
+      <a-form-model-item label="设备编号" :label-col="{span:6}" :wrapper-col="{span:16}" prop="deviceCode">
+        <a-input placeholder="请输入设备编号" v-model="formData.deviceCode" allowClear :maxLength="30"/>
       </a-form-model-item>
-      <a-form-model-item label="设备型号" :label-col="{span:6}" :wrapper-col="{span:16}" prop="MAC">
-        <a-input placeholder="请输入设备型号" v-model="form.MAC" allowClear :maxLength="30"/>
+      <a-form-model-item label="设备型号" :label-col="{span:6}" :wrapper-col="{span:16}" prop="deviceModel">
+        <a-input placeholder="请输入设备型号" v-model="formData.deviceModel" allowClear :maxLength="30"/>
       </a-form-model-item>
-      <a-form-model-item label="生产厂家" :label-col="{span:6}" :wrapper-col="{span:16}" prop="MAC">
-        <a-input placeholder="请输入生产厂家" v-model="form.MAC" allowClear :maxLength="30"/>
+      <a-form-model-item label="生产厂家" :label-col="{span:6}" :wrapper-col="{span:16}" prop="manufacturer">
+        <a-input placeholder="请输入生产厂家" v-model="formData.manufacturer" allowClear :maxLength="30"/>
       </a-form-model-item>
       <a-form-model-item :wrapper-col="{ span: 24, offset: 8 }">
         <a-button type="primary" @click="handleSubmit()" :style="{ marginRight: '15px' }">
@@ -29,6 +35,7 @@
 </template>
 
 <script>
+import { saveDevice, deviceDetails } from '@/api/electronicScale.js'
 export default {
   name: 'AddElectronicScale',
   props: {
@@ -36,58 +43,106 @@ export default {
       type: Boolean,
       default: false
     },
-    id: {
+    deviceCode: {
       type: [Number, String],
       default: ''
     }
   },
   data () {
     return {
-      form: {
-        MAC: ''
-      },
-      MAC: '',
+      formData: { macAddress: '', deviceCode: '', deviceName: '', deviceModel: '', manufacturer: '' },
       isShow: this.visible, // 弹框状态
       rules: {
-        MAC: [{
-          required: true,
-          message: '请输入设备MAC地址(数字与英文字母组合)',
-          trigger: 'blur',
-		  pattern: /^[A-Za-z0-9]+$/
-        }]
+        macAddress: [{ required: true, message: '请输入设备MAC地址(数字与英文字母组合)', trigger: 'blur', pattern: /^[A-Za-z0-9]+$/ }]
       }
     }
   },
   methods: {
+	  cancel (e) {
+	    this.clear()
+	    this.$emit('close')
+	  },
+	  clear () {
+	    this.$refs.ruleForm.resetFields()
+	    delete this.formData.id
+	    this.formData.macAddress = ''
+	    this.formData.deviceCode = ''
+	    this.formData.deviceName = ''
+      this.formData.deviceModel = ''
+      this.formData.manufacturer = ''
+	  },
+	  // 数据详情
+	  getPageInfo () {
+	    deviceDetails({
+	      deviceCode: this.deviceCode
+	    }).then(res => {
+	      if (res.status == 200) {
+	        console.log(res, '-------------返回数据')
+	  	  this.formData = Object.assign({}, this.formData, res.data)
+	  	  this.formData.loginFlag = Number(this.formData.loginFlag)
+	  	  // this.formData.loginFlag
+	  	  // console.log(this.formData, '-----------数据')
+	        // this.form.setFieldsValue({
+	        //   'formData': res.data
+	        // })
+	        // this.formData.setFieldsValue({ 'formData.loginFlag': Number(res.data.loginFlag) })
+	        // this.formData.setFieldsValue({ 'formData.name': res.data.name })
+	        // this.formData.setFieldsValue({ 'formData.phone': res.data.phone })
+	        // this.form.setFieldsValue({ 'formData.sex': res.data.sex })
+	        // this.form.setFieldsValue({ 'formData.org.name': res.data.org.name })
+	        // this.form.setFieldsValue({ 'formData.remarks': res.data.remarks })
+	      }
+	    })
+	  },
     handleSubmit () {
-      this.$refs.ruleForm.validate(valid => {
-        console.log(valid, this.form, ' formData.type222222222')
-        if (valid) {
-          const params = JSON.parse(JSON.stringify(this.form))
-          // 编辑
-          // if (this.id) {
-          //   params.deviceTypeBoxList.map(item => {
-          //     delete item.id
-          //   })
-          // }
-          console.log(params)
-          // saveBoxSetting(params).then(res => {
-          //   console.log(res, 'res--save')
-          //   if (res.status == '200') {
-          //     this.$message.success(res.message)
-          //     this.$emit('refresh')
-          //     setTimeout(function () {
-          //       _this.cancel()
-          //     }, 300)
-          //   } else {
-          //     // this.$message.error(res.message)
-          //   }
-          // })
-        }
-      })
+      // this.$refs.ruleForm.validate(valid => {
+      //   console.log(valid, this.form, ' formData.type222222222')
+      //   if (valid) {
+      //     const params = JSON.parse(JSON.stringify(this.form))
+      //     // 编辑
+      //     // if (this.id) {
+      //     //   params.deviceTypeBoxList.map(item => {
+      //     //     delete item.id
+      //     //   })
+      //     // }
+      //     console.log(params)
+      //     // saveBoxSetting(params).then(res => {
+      //     //   console.log(res, 'res--save')
+      //     //   if (res.status == '200') {
+      //     //     this.$message.success(res.message)
+      //     //     this.$emit('refresh')
+      //     //     setTimeout(function () {
+      //     //       _this.cancel()
+      //     //     }, 300)
+      //     //   } else {
+      //     //     // this.$message.error(res.message)
+      //     //   }
+      //     // })
+      //   }
+      // })
+	  this.$refs.ruleForm.validate(valid => {
+	  		  const _this = this
+	  		  console.log(valid, '--------------提交')
+	    if (valid) {
+	      console.log(valid, '--------------提交', this.formData)
+	      const params = JSON.parse(JSON.stringify(this.formData))
+	  				 console.log(params)
+	      saveDevice(params).then(res => {
+	        console.log(res, 'rrrrrrrrr')
+	        if (res.status == 200) {
+	          _this.$message.success(res.message)
+	          _this.$emit('refresh')
+	          setTimeout(function () {
+	            _this.cancel()
+	          }, 300)
+	        }
+	      })
+	    }
+	  })
     }
   },
   computed: {
+    // 弹窗标题
     modalTit () {
       return this.id ? '编辑设备信息' : '新增设备信息'
     }
@@ -106,6 +161,12 @@ export default {
           this.$refs.ruleForm.resetFields()
         })
       }
+    },
+    deviceCode () {
+      if (newValue && this.isshow) {
+		  this.getPageInfo(newValue)
+      } else {
+      }
     }
   }
 }

+ 52 - 58
src/views/equipmentManage/electronicScale/electronicScale.vue

@@ -6,7 +6,7 @@
         <a-row :gutter="24">
           <a-col :xs="24" :sm="12" :md="8" :lg="6">
             <a-form-model-item label="设备MAC码" :label-col="{span:7}" :wrapper-col="{span:17}">
-              <a-input v-model="searchForm.MAC" placeholder="请输入设备MAC码" oninput="value=value.toUpperCase()" :maxLength="30"/>
+              <a-input v-model="searchForm.macAddress" placeholder="请输入设备MAC码" oninput="value=value.toUpperCase()" :maxLength="30"/>
             </a-form-model-item>
           </a-col>
           <a-col :xs="24" :sm="12" :md="8" :lg="6">
@@ -25,33 +25,21 @@
       <div class="ftext" slot="message">总计<span> {{ }} </span>条,乐豆变动量总计<span> {{ }} </span>个</div>
     </a-alert>
     <!-- 列表 -->
-    <a-table ref="table" :rowKey="(record) => record.id" :columns="columns" :data-source="data" bordered>
+    <s-table ref="table" :rowKey="(record) => record.id" :columns="columns" :data="loadData" bordered>
       <span slot="action" slot-scope="text,record">
         <a-icon type="edit" title="编辑" class="actionBtn icon-blues" @click="handleEdit(record)"/>
         <a-icon type="delete" title="删除" class="actionBtn icon-red" @click="delect(record)"/>
       </span>
-    </a-table>
+    </s-table>
     <!-- 新增/编辑弹窗 -->
-    <addElectronicScale :visible="isOpenModal" :id="itemId" @refresh="refreshTable" @close="isOpenModal=false"></addElectronicScale>
+    <addElectronicScale :visible="isOpenModal" :deviceCode="itemDeviceCode" @refresh="refreshTable" @close="isOpenModal=false"></addElectronicScale>
   </a-card>
 </template>
 
 <script>
 import { STable } from '@/components'
 import addElectronicScale from './addElectronicScale.vue'
-const columns = [{ title: '序号', dataIndex: 'no', width: 60, align: 'center' },
-  { title: '创建时间', dataIndex: 'createDate', width: 100, align: 'center' },
-  { title: '设备MAC码', dataIndex: 'MAC', width: 100, align: 'center' },
-  { title: '设备名称', dataIndex: 'name', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
-  { title: '设备编号', dataIndex: 'num', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
-  { title: '设备型号', dataIndex: 'org', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
-  { title: '生产厂家', dataIndex: 'changjia', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
-  { title: '操作', dataIndex: 'action', width: 100, align: 'center', scopedSlots: { customRender: 'action' } }
-]
-const data = [{ createDate: '2020-01-05', MAC: '22210245224555', name: '电子秤', num: '2222554585877', org: 'X-001', changjia: '上海电子厂' },
-  { createDate: '2020-01-05', MAC: '22210245224555', name: '电子秤', num: '2222554585877', org: 'X-001', changjia: '上海电子厂' },
-  { createDate: '2020-01-05', MAC: '22210245224555', name: '电子秤', num: '2222554585877', org: 'X-001', changjia: '上海电子厂' },
-  { createDate: '2020-01-05', MAC: '22210245224555', name: '电子秤', num: '2222554585877', org: 'X-001', changjia: '上海电子厂' }]
+import { getDeviceList, delectDevice } from '@/api/electronicScale.js'
 export default {
   components: { STable, addElectronicScale },
   data () {
@@ -59,73 +47,79 @@ export default {
       searchForm: {
         MAC: ''
       },
-	  columns,
-	  data,
 	  isOpenModal: false, // 默认弹窗关闭
-	  itemId: '' // 编辑行id
+	  itemDeviceCode: '', // 编辑行设备编号
       // 列表表头
-      // columns: [{ title: '序号', dataIndex: 'no', width: 60, align: 'center' },
-      //   { title: '创建时间', dataIndex: 'createDate', width: 100, align: 'center' },
-      //   { title: '设备MAC码', dataIndex: 'MAC', width: 100, align: 'center' },
-      //   { title: '设备名称', dataIndex: 'name', width: 100, align: 'center' },
-      //   { title: '设备编号', dataIndex: 'num', width: 100, align: 'center' },
-      //   { title: '设备型号', dataIndex: 'org', width: 100, align: 'center' },
-      //   { title: '生产厂家', dataIndex: 'changjia', width: 100, align: 'center' },
-      //   { title: '操作', dataIndex: 'action', width: 100, align: 'center' }
-      // ]
-	  // data: [{ createDate: '2020-01-05', MAC: '22210245224555', name: '电子秤', num: '2222554585877', org: 'X-001', changjia: '上海电子厂' }]
+      columns: [{ title: '序号', dataIndex: 'no', width: 60, align: 'center' },
+        { title: '创建时间', dataIndex: 'createDate', width: 100, align: 'center' },
+        { title: '设备MAC码', dataIndex: 'macAddress', width: 100, align: 'center' },
+        { title: '设备名称', dataIndex: 'deviceName', width: 100, align: 'center' },
+        { title: '设备编号', dataIndex: 'deviceCode', width: 100, align: 'center' },
+        { title: '设备型号', dataIndex: 'deviceModel', width: 100, align: 'center' },
+        { title: '生产厂家', dataIndex: 'manufacturer', width: 100, align: 'center' },
+        { title: '操作', dataIndex: 'action', width: 100, align: 'center', scopedSlots: { customRender: 'action' } }
+      ],
 	  // 加载数据方法 必须为 Promise 对象
-	  // loadData: parameter => {
-	  //   // return getBoxList(Object.assign(parameter, this.queryParam)).then(res => {
-	  //   //   if (res.status == 200) {
-	  //   //     const no = (res.data.pageNo - 1) * res.data.pageSize
-	  //   //     for (let i = 0; i < res.data.list.length; i++) {
-	  //   //       const _item = res.data.list[i]
-	  //   //       _item.no = no + i + 1
-	  //   //     }
-	  //   //     return res.data
-	  //   //   }
-	  //   // })
-	  // }
+	  loadData: parameter => {
+	    return getDeviceList(Object.assign(parameter, this.queryParam)).then(res => {
+	      if (res.status == 200) {
+	        const no = (res.data.pageNo - 1) * res.data.pageSize
+	        for (let i = 0; i < res.data.list.length; i++) {
+	          const _item = res.data.list[i]
+	          _item.no = no + i + 1
+	        }
+	        return res.data
+	      }
+	    })
+	  }
     }
   },
   methods: {
     // 重置
     handleReset () {
-		this.searchForm= {
-        MAC: ''
+      this.searchForm = {
+        macAddress: ''
       }
     },
     // 新增
     openModal () {
       this.isOpenModal = true
-		console.log('新增')
+      console.log('新增')
     },
     // 编辑
     handleEdit (record) {
+      this.itemDeviceCode = record.deviceCode
       this.isOpenModal = true
-		console.log('编辑')
+      console.log('编辑')
     },
     // 删除
-    delect () {
-			this.$confirm({
-				title: '警告',
-				centered: true,
-				content: '删除后无法恢复,确认删除?',
-				okText: '确定',
-				cancelText: '取消',
-				onOk() {
-				}
-			})
+    delect (record) {
+      this.$confirm({
+        title: '警告',
+        centered: true,
+        content: '删除后无法恢复,确认删除?',
+        okText: '确定',
+        cancelText: '取消',
+        onOk () {
+          delectDevice({
+			  id: row.id
+          }).then(res => {
+			  if (res.status == 200) {
+			    this.$message.success(res.message)
+			    this.$refs.table.refresh()
+			  }
+          })
+        }
+      })
     },
     // 保存或编辑后刷新列表
     refreshTable () {
       // 编辑
       if (this.itemId) {
-			this.$refs.table.refresh()
+        this.$refs.table.refresh()
       } else {
         // 保存
-			this.$refs.table.refresh(true)
+        this.$refs.table.refresh(true)
       }
     }
   }

+ 1 - 1
src/views/userInfo/allLdDetail.vue

@@ -122,9 +122,9 @@ export default {
               const _item = res.data.list[i]
               _item.no = no + i + 1
             }
+            return res.data
             // 总条数
             this.total = res.data.count
-            return res.data
           }
         })
       }