chenrui 4 سال پیش
والد
کامیت
4046eeed49

+ 35 - 0
src/api/device.js

@@ -0,0 +1,35 @@
+import { axios } from '@/utils/request'
+
+// 设备列表
+export const deviceList = (params) => {
+  const url = `/device/query/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 查设备列表  不分页
+export const deviceListQuery = (params) => {
+  return axios.request({
+    url: `/device/query`,
+    method: 'post',
+    data: params
+  })
+}
+// 设备启禁用   0禁用   1启用
+export const deviceEnable = (params) => {
+  return axios.request({
+    url: `/device/enable/${params.id}/${params.state}`,
+    method: 'get'
+  })
+}
+// 设备更换箱体类型
+export const deviceTypeUpdate = (params) => {
+  return axios.request({
+    url: `/device/enable/${params.id}/${params.deviceTypeNo}`,
+    method: 'get'
+  })
+}

+ 8 - 0
src/api/exchangeSetting.js

@@ -11,6 +11,14 @@ export const getList = (params) => {
     method: 'post'
   })
 }
+// 查兑换列表  不分页
+export const goldExListQuery = (params) => {
+  return axios.request({
+    url: `/goldEx/queryList`,
+    method: 'post',
+    data: params
+  })
+}
 // 确认保存
 export const saveExchangeSetting = (params) => {
   const url = `goldEx/save`

+ 8 - 0
src/api/openTimeSetting.js

@@ -11,6 +11,14 @@ export const getList = (params) => {
     method: 'post'
   })
 }
+// 查投放时间规则列表  不分页
+export const deliveryTimeListQuery = (params) => {
+  return axios.request({
+    url: `/deliveryTime/queryList`,
+    method: 'post',
+    data: params
+  })
+}
 // 确认保存
 export const saveTimeSetting = (params) => {
   const url = `deliveryTime/save`

+ 43 - 0
src/api/station.js

@@ -0,0 +1,43 @@
+import { axios } from '@/utils/request'
+
+// 网点列表
+export const stationList = (params) => {
+  const url = `/station/query/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 查网点列表  不分页
+export const stationListQuery = (params) => {
+  return axios.request({
+    url: `/station/queryList`,
+    method: 'post',
+    data: params
+  })
+}
+// 网点详情
+export const stationFind = (params) => {
+  return axios.request({
+    url: `/station/findById/${params.id}`,
+    method: 'get'
+  })
+}
+// 网点保存
+export const stationSave = (params) => {
+  return axios.request({
+    url: '/station/save',
+    data: params,
+    method: 'post'
+  })
+}
+// 网点删除
+export const stationDel = (params) => {
+  return axios.request({
+    url: `/station/delete/${params.id}`,
+    method: 'get'
+  })
+}

+ 48 - 42
src/views/equipmentManage/equipment/equipment.vue

@@ -5,12 +5,12 @@
         <a-row :gutter="48">
           <a-col :span="6">
             <a-form-item label="设备编号" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
-              <a-input id="equipment-equipmentNo" allowClear :maxLength="30" v-model="queryParam.equipmentNo" placeholder="请输入网点名称" />
+              <a-input id="equipment-deviceNo" allowClear :maxLength="30" v-model="queryParam.deviceNo" placeholder="请输入网点名称" />
             </a-form-item>
           </a-col>
           <a-col :span="6">
             <a-form-item label="网点名称" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
-              <a-input id="equipment-networkName" allowClear :maxLength="30" v-model="queryParam.networkName" placeholder="请输入网点名称" />
+              <a-input id="equipment-stationName" allowClear :maxLength="30" v-model="queryParam.stationName" placeholder="请输入网点名称" />
             </a-form-item>
           </a-col>
           <a-col :span="6">
@@ -32,6 +32,16 @@
       :columns="columns"
       :data="loadData"
       bordered>
+      <!-- 箱体投放比例 -->
+      <template slot="boxOnePersent" slot-scope="text, record">{{ record.boxOnePersent ? record.boxOnePersent * 100 + '%' : '--' }}</template>
+      <template slot="boxTwoPersent" slot-scope="text, record">{{ record.boxTwoPersent ? record.boxTwoPersent * 100 + '%' : '--' }}</template>
+      <template slot="boxThreePersent" slot-scope="text, record">{{ record.boxThreePersent ? record.boxThreePersent * 100 + '%' : '--' }}</template>
+      <template slot="boxFourPersent" slot-scope="text, record">{{ record.boxFourPersent ? record.boxFourPersent * 100 + '%' : '--' }}</template>
+      <template slot="boxFivePersent" slot-scope="text, record">{{ record.boxFivePersent ? record.boxFivePersent * 100 + '%' : '--' }}</template>
+      <!-- 状态 -->
+      <template slot="state" slot-scope="text, record">
+        <span :class="record.state==0 ? 'red' : record.state==1 ? 'green' : ''">{{ record.state == 0 ? '已禁用' : record.state == 1 ? '已启用' : '--' }}</span>
+      </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
         <a-button
@@ -49,6 +59,7 @@
 <script>
 import { STable, VSelect } from '@/components'
 import equipmentLogModal from './logModal.vue'
+import { deviceList } from '@/api/device'
 export default {
   name: 'Equipment',
   components: { STable, VSelect, equipmentLogModal },
@@ -60,51 +71,42 @@ export default {
       },
       // 查询参数
       queryParam: {
-        equipmentNo: '', // 设备编号
-        networkName: '' //  网点名称
+        deviceNo: '', // 设备编号
+        stationName: '' //  网点名称
       },
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '网点名称', dataIndex: 'networkName', width: 200, align: 'center' },
-        { title: '地址', dataIndex: 'address', width: 200, align: 'center' },
-        { title: '设备编号', dataIndex: 'equipmentNo', width: 200, align: 'center' },
-        { title: '箱体类型', dataIndex: 'type', width: 200, align: 'center' },
+        { title: '网点名称', dataIndex: 'stationName', width: 200, align: 'center' },
+        { title: '地址', dataIndex: 'stationAddress', width: 200, align: 'center' },
+        { title: '设备编号', dataIndex: 'deviceNo', width: 200, align: 'center' },
+        { title: '箱体类型', dataIndex: 'deviceTypeName', width: 200, align: 'center' },
         { title: '内置箱体数', dataIndex: 'boxNum', width: 200, align: 'center' },
         { title: '内置各箱体已投放比例(%)',
           children: [
-            { title: '1号箱', dataIndex: 'oProportion', width: 100, align: 'center' },
-            { title: '2号箱', dataIndex: 'tProportion', width: 100, align: 'center' }
+            { title: '1号箱', scopedSlots: { customRender: 'boxOnePersent' }, width: 100, align: 'center' },
+            { title: '2号箱', scopedSlots: { customRender: 'boxTwoPersent' }, width: 100, align: 'center' },
+            { title: '3号箱', scopedSlots: { customRender: 'boxThreePersent' }, width: 100, align: 'center' },
+            { title: '4号箱', scopedSlots: { customRender: 'boxFourPersent' }, width: 100, align: 'center' },
+            { title: '5号箱', scopedSlots: { customRender: 'boxFivePersent' }, width: 100, align: 'center' }
           ]
         },
-        { title: '版本', dataIndex: 'edition', width: 200, align: 'center' },
-        { title: '状态', dataIndex: 'status', width: 100, align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 240, align: 'center' }
+        { title: '版本', dataIndex: 'boxVersion', width: 200, align: 'center' },
+        { title: '状态', scopedSlots: { customRender: 'state' }, width: 150, align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        // return getTenantsList(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
-        //       _item.status = _item.status + '' === '1'
-        //     }
-        //     return res.data
-        //   }
-        // })
-        return new Promise((resolve) => {
-          const data = [
-            { id: 1, no: 1, networkName: '网点1', equipmentNo: '陕西省', type: '西安市', boxNum: '未央区', address: '凤城十二路', oProportion: '早高峰期', tProportion: '23%', edition: '1.2.1', status: '1' },
-            { id: 2, no: 2, networkName: '网点2', equipmentNo: '陕西省', type: '西安市', boxNum: '未央区', address: '凤城十二路', oProportion: '晚高峰期', tProportion: '23%', edition: '1.2.1', status: '1' },
-            { id: 3, no: 3, networkName: '网点3', equipmentNo: '陕西省', type: '西安市', boxNum: '未央区', address: '凤城十二路', oProportion: '早高峰期', tProportion: '23%', edition: '1.2.1', status: '1' },
-            { id: 4, no: 4, networkName: '网点4', equipmentNo: '陕西省', type: '西安市', boxNum: '未央区', address: '凤城十二路', oProportion: '早高峰期', tProportion: '23%', edition: '1.2.1', status: '1' },
-            { id: 5, no: 5, networkName: '网点5', equipmentNo: '陕西省', type: '西安市', boxNum: '未央区', address: '凤城十二路', oProportion: '早高峰期', tProportion: '23%', edition: '1.2.1', status: '1' },
-            { id: 6, no: 6, networkName: '网点6', equipmentNo: '陕西省', type: '西安市', boxNum: '未央区', address: '凤城十二路', oProportion: '早高峰期', tProportion: '23%', edition: '1.2.1', status: '1' },
-            { id: 7, no: 7, networkName: '网点7', equipmentNo: '陕西省', type: '西安市', boxNum: '未央区', address: '凤城十二路', oProportion: '早高峰期', tProportion: '23%', edition: '1.2.1', status: '1' }
-          ]
-          resolve(data)
+        return deviceList(Object.assign(parameter, this.queryParam)).then(res => {
+          if (res.status == 200) {
+            const no = (res.data.pageNo - 1) * res.data.pageSize
+            this.orderTotal = res.data.count
+            for (let i = 0; i < res.data.list.length; i++) {
+              const _item = res.data.list[i]
+              _item.no = no + i + 1
+            }
+            return res.data
+          }
         })
       },
       orderTotal: '', // 合计开单数量
@@ -112,16 +114,11 @@ export default {
       equipmentId: null //  设备id
     }
   },
-  beforeRouteEnter (to, from, next) {
-    next(vm => {
-      vm.handleReset()
-    })
-  },
   methods: {
     // 重置
     handleReset () {
-      console.log('重置', this.queryParam)
-      this.form.resetFields()
+      this.queryParam.deviceNo = ''
+      this.queryParam.stationName = ''
       this.$refs.table.refresh(true)
     },
     //  查看掉线日志
@@ -166,5 +163,14 @@ export default {
     		margin-right: 10px;
     	}
     }
+    .blue {
+    	color: #1890FF;
+    }
+    .green {
+    	color: #16b50e;
+    }
+    .red {
+    	color: red;
+    }
   }
 </style>

+ 60 - 18
src/views/equipmentManage/network/detailsModal.vue

@@ -9,36 +9,35 @@
     @cancle="isShow=false"
     :width="1000">
     <!-- 网点信息 -->
-    <div>
-      <!-- <div v-if="detailsData"> -->
+    <div v-if="detailsData">
       <a-row :gutter="35">
         <a-col :span="8" class="item-cont">
           <p class="item-label">网点名称:</p>
-          <p class="item-main">卡迪夫还是空见风使舵</p>
+          <p class="item-main">{{ detailsData.name }}</p>
         </a-col>
         <a-col :span="16" class="item-cont">
           <p class="item-label">地址:</p>
-          <p class="item-main">陕西省西安市未央区凤城八路爱打架个大神阿斯顿撒多</p>
+          <p class="item-main">{{ detailsData.provinceName }}{{ detailsData.cityName }}{{ detailsData.districtName }}{{ detailsData.address }}</p>
         </a-col>
       </a-row>
       <a-row :gutter="35">
         <a-col :span="8" class="item-cont">
           <p class="item-label">纬度:</p>
-          <p class="item-main">89.5645</p>
+          <p class="item-main">{{ detailsData.lat }}</p>
         </a-col>
         <a-col :span="8" class="item-cont">
           <p class="item-label">经度:</p>
-          <p class="item-main">148.5478</p>
+          <p class="item-main">{{ detailsData.lon }}</p>
         </a-col>
         <a-col :span="8" class="item-cont">
           <p class="item-label">投递时间段:</p>
-          <p class="item-main">上下班高峰期投放</p>
+          <p class="item-main">{{ detailsData.timeRuleName }}</p>
         </a-col>
       </a-row>
       <a-row :gutter="35">
         <a-col :span="24" class="item-cont">
           <p class="item-label">兑换规则:</p>
-          <p class="item-main">兑换规兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则兑换规则则</p>
+          <p class="item-main">{{ detailsData.exRuleName }}</p>
         </a-col>
       </a-row>
     </div>
@@ -53,13 +52,32 @@
         :columns="columns"
         :dataSource="equipmentData"
         :pagination="false"
-        bordered></a-table>
+        bordered>
+        <!-- 设备状态 -->
+        <template slot="onlineFlag" slot-scope="text, record">
+          <span :class="record.onlineFlag==0 ? 'red' : record.onlineFlag==1 ? 'green' : ''">{{ record.onlineFlag == 0 ? '离线' : record.onlineFlag == 1 ? '在线' : '--' }}</span>
+        </template>
+        <!-- 投放情况 -->
+        <template slot="situation" slot-scope="text, record">
+          [{{ record.boxOnePersent ? record.boxOnePersent * 100 + '%' : '--' }}] --
+          [{{ record.boxTwoPersent ? record.boxTwoPersent * 100 + '%' : '--' }}] -
+          [{{ record.boxThreePersent ? record.boxThreePersent * 100 + '%' : '--' }}] -
+          [{{ record.boxFourPersent ? record.boxFourPersent * 100 + '%' : '--' }}] -
+          [{{ record.boxFivePersent ? record.boxFivePersent * 100 + '%' : '--' }}]
+        </template>
+        <!-- 工作状态 -->
+        <template slot="state" slot-scope="text, record">
+          <span :class="record.state==0 ? 'red' : record.state==1 ? 'green' : ''">{{ record.state == 0 ? '已禁用' : record.state == 1 ? '已启用' : '--' }}</span>
+        </template>
+      </a-table>
     </div>
     <div class="btn-cont"><a-button id="network-detail-modal-back" @click="isShow = false">返回列表</a-button></div>
   </a-modal>
 </template>
 
 <script>
+import { stationFind } from '@/api/station'
+import { deviceListQuery } from '@/api/device'
 export default {
   name: 'DetailsModal',
   props: {
@@ -78,20 +96,34 @@ export default {
       detailsData: null, //  网点数据
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '设备编号', dataIndex: 'equipmentNo', width: 200, align: 'center' },
-        { title: '设备状态', dataIndex: 'equipmentStatus', width: 200, align: 'center' },
-        { title: '投放情况', dataIndex: 'situation', width: 200, align: 'center' },
-        { title: '工作状态', dataIndex: 'workStatus', width: 200, align: 'center' },
-        { title: '箱体类型', dataIndex: 'type', width: 200, align: 'center' }
+        { title: '设备编号', dataIndex: 'deviceNo', width: 200, align: 'center' },
+        { title: '设备状态', scopedSlots: { customRender: 'onlineFlag' }, width: 200, align: 'center' },
+        { title: '投放情况', scopedSlots: { customRender: 'situation' }, width: 200, align: 'center' },
+        { title: '工作状态', scopedSlots: { customRender: 'state' }, width: 200, align: 'center' },
+        { title: '箱体类型', dataIndex: 'deviceTypeName', width: 200, align: 'center' }
       ],
-      equipmentData: [
-        { id: 1, no: 1, equipmentNo: 'hgd13612875712', equipmentStatus: '1', situation: '41%-12%-21%-0%', workStatus: 1, type: '咸阳二代箱体' }
-      ]
+      equipmentData: []
     }
   },
   methods: {
     //  获取详情
-    getDetails () {}
+    getDetails () {
+      stationFind({ id: this.networkId }).then(res => {
+        console.log(res, '----res')
+        if (res.status == 200) {
+          this.detailsData = res.data
+        }
+      })
+    },
+    //  已绑设备
+    getDevice () {
+      deviceListQuery({ stationNo: this.detailsData }).then(res => {
+        console.log(res)
+        if (res.status == 200) {
+          this.equipmentData = res.data
+        }
+      })
+    }
   },
   watch: {
     //  父页面传过来的弹框状态
@@ -106,6 +138,7 @@ export default {
     },
     networkId (newValue, oldValue) {
       if (this.isShow && newValue) {
+        this.getDevice()
         this.getDetails()
       }
     }
@@ -167,5 +200,14 @@ export default {
     	text-align: center;
     	margin: 35px 0 10px;
     }
+    .blue {
+    	color: #1890FF;
+    }
+    .green {
+    	color: #16b50e;
+    }
+    .red {
+    	color: red;
+    }
   }
 </style>

+ 84 - 20
src/views/equipmentManage/network/editModal.vue

@@ -66,10 +66,10 @@
         <a-col :span="10">
           <a-form-item label="经度" :label-col="{ span: 10 }" :wrapper-col="{ span: 14 }">
             <a-input
-              id="network-edit-lnt"
+              id="network-edit-lon"
               v-decorator="[
-                'formData.lnt',
-                { initialValue: formData.lnt, getValueFromEvent: $filterEmpty, rules: [
+                'formData.lon',
+                { initialValue: formData.lon, getValueFromEvent: $filterEmpty, rules: [
                   { required: true, message: '请输入经度' },
                   { pattern: /^[\-\+]?(0?\d{1,2}\.\d{1,8}|1[0-7]?\d{1}\.\d{1,8}|180\.0{1,8})$/, message: '请输入正确的经度,整数部分为0~180,必须输入1到8位小数' }
                 ] }
@@ -89,15 +89,15 @@
           id="network-edit-rules"
           allowClear
           v-decorator="[
-            'formData.exchangeRules',
-            { initialValue: formData.exchangeRules,
+            'formData.goldExRuleNo',
+            { initialValue: formData.goldExRuleNo,
               rules: [{ required: true, message: '请选择兑换规则' }] },
           ]"
           placeholder="请选择兑换规则"
-          @change="exchangeRulesChange"
+          @change="goldExRuleNoChange"
         >
-          <a-select-option v-for="(item,index) in deliverList" :key="index" :value="item.value">
-            {{ item.value }}
+          <a-select-option v-for="(item,index) in goldExRuleNoList" :key="index" :value="item.goldExRuleNo">
+            {{ item.name }}
           </a-select-option>
         </a-select>
       </a-form-item>
@@ -106,15 +106,15 @@
           id="network-edit-times"
           allowClear
           v-decorator="[
-            'formData.deliver',
-            { initialValue: formData.deliver,
+            'formData.deliveryTimeRuleNo',
+            { initialValue: formData.deliveryTimeRuleNo,
               rules: [{ required: true, message: '请选择投递时间段' }] },
           ]"
           placeholder="请选择投递时间段"
-          @change="deliverChange"
+          @change="deliveryTimeRuleNoChange"
         >
-          <a-select-option v-for="(item,index) in deliverList" :key="index" :value="item.value">
-            {{ item.value }}
+          <a-select-option v-for="(item,index) in deliveryTimeRuleNoList" :key="index" :value="item.deliveryTimeRuleNo">
+            {{ item.name }}
           </a-select-option>
         </a-select>
       </a-form-item>
@@ -128,6 +128,9 @@
 
 <script>
 import addrData, { province, city, area } from '@/api/address'
+import { stationSave, stationFind } from '@/api/station'
+import { goldExListQuery } from '@/api/exchangeSetting.js'
+import { deliveryTimeListQuery } from '@/api/openTimeSetting.js'
 export default {
   name: 'EditModal',
   props: {
@@ -150,14 +153,21 @@ export default {
       },
       formData: {
         name: null, //  网点名称
+        provinceCode: null, //  省
+        cityCode: null, // 市
+        districtCode: null, // 区
         address: '', //  详细地址
         lat: '', //  纬度
-        lnt: '', //  经度
-        deliver: undefined //  投递时间段
+        lon: '', //  经度
+        goldExRuleNo: undefined, //  兑换规则
+        deliveryTimeRuleNo: undefined //  投递时间段
+        // goldExRuleNo: 'sss', //  兑换规则
+        // deliveryTimeRuleNo: 'ddd' //  投递时间段
       },
       options: addrData, //  省市区下拉数据
       areas: [], //  省市区 值
-      deliverList: [] //  投递时间段下拉数据
+      goldExRuleNoList: [], //  兑换规则下拉数据
+      deliveryTimeRuleNoList: [] //  投递时间段下拉数据
     }
   },
   computed: {
@@ -167,23 +177,73 @@ export default {
   },
   methods: {
     //  获取详情
-    getDetails () {},
+    getDetails () {
+      stationFind({ id: this.networkId }).then(res => {
+        if (res.status == 200) {
+          //  省市区
+          this.areas = [res.data.provinceCode, res.data.cityCode, res.data.districtCode]
+          this.form.setFieldsValue({ 'formData.name': res.data.name })
+          this.form.setFieldsValue({ 'formData.address': res.data.address })
+          this.form.setFieldsValue({ 'formData.lat': res.data.lat })
+          this.form.setFieldsValue({ 'formData.lon': res.data.lon })
+          this.form.setFieldsValue({ 'formData.goldExRuleNo': res.data.goldExRuleNo })
+          this.form.setFieldsValue({ 'formData.deliveryTimeRuleNo': res.data.deliveryTimeRuleNo })
+        }
+      })
+    },
     //  物流信息  保存
     handleSubmit (e) {
       e.preventDefault()
       const _this = this
       this.form.validateFields((err, values) => {
+        console.log(err, values, '-上传')
         if (!err) {
-          this.$emit('success')
+          if (values.options.length) {
+            values.formData.provinceCode = values.options[0]
+            values.formData.provinceName = _.find(province, ['code', values.options[0]]).name
+            values.formData.cityCode = values.options[1]
+            values.formData.cityName = _.find(city, ['code', values.options[1]]).name
+            values.formData.districtCode = values.options[2]
+            values.formData.districtName = _.find(area, ['code', values.options[2]]).name
+          }
+          const formData = values.formData
+          formData.id = this.networkId || null
+          stationSave(formData).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              setTimeout(() => {
+                _this.$emit('success')
+                _this.isShow = false
+              }, 1000)
+            }
+          })
         }
       })
     },
     //  投递时间段  change
-    deliverChange (val) {
+    deliveryTimeRuleNoChange (val) {
 
     },
     //  兑换规则  change
-    exchangeRulesChange (val) {}
+    goldExRuleNoChange (val) {},
+    //  投递时间段
+    getdeliveryTimeRule () {
+      deliveryTimeListQuery({}).then(res => {
+        console.log(res)
+        if (res.status == 200) {
+          this.deliveryTimeRuleNoList = res.data
+        }
+      })
+    },
+    //  兑换规则
+    getgoldExRule () {
+      goldExListQuery({}).then(res => {
+        console.log(res)
+        if (res.status == 200) {
+          this.goldExRuleNoList = res.data
+        }
+      })
+    }
   },
   watch: {
     //  父页面传过来的弹框状态
@@ -195,10 +255,14 @@ export default {
       if (!newValue) {
         this.$emit('close')
       } else {
+        this.getdeliveryTimeRule() //  投递时间段
+        this.getgoldExRule() //  兑换规则
+        this.areas = []
         this.form.resetFields()
       }
     },
     networkId (newValue, oldValue) {
+      console.log(newValue, '-----newValue')
       if (this.isShow && newValue) {
         this.getDetails()
       }

+ 32 - 39
src/views/equipmentManage/network/network.vue

@@ -16,7 +16,7 @@
           </a-col>
           <a-col :span="6">
             <a-form-item label="网点名称" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
-              <a-input id="network-networkName" allowClear :maxLength="30" v-model="queryParam.networkName" placeholder="请输入网点名称" />
+              <a-input id="network-name" allowClear :maxLength="30" v-model="queryParam.name" placeholder="请输入网点名称" />
             </a-form-item>
           </a-col>
           <a-col :span="6">
@@ -29,7 +29,8 @@
                    rules: []}
                 ]"
                 :options="options"
-                placeholder="请选择省市区" />
+                placeholder="请选择省市区"
+                @change="addrChange"/>
             </a-form-item>
           </a-col>
           <a-col :span="6">
@@ -81,6 +82,7 @@ import moment from 'moment'
 import editNetworkModal from './editModal.vue'
 import detailsNetworkModal from './detailsModal.vue'
 import equipmentModal from './equipmentModal.vue'
+import { stationList } from '@/api/station'
 export default {
   name: 'Network',
   components: { STable, VSelect, editNetworkModal, detailsNetworkModal, equipmentModal },
@@ -94,48 +96,36 @@ export default {
       queryParam: {
         beginDate: null, // 开始时间
         endDate: null, // 结束时间
-        networkName: '', //  网点名称
-        province: null, //  省
-        city: null, // 市
-        area: null // 区
+        name: '', //  网点名称
+        provinceCode: null, //  省
+        cityCode: null, // 市
+        districtCode: null // 区
       },
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '创建时间', dataIndex: 'orderDate', width: 200, align: 'center' },
-        { title: '网点名称', dataIndex: 'networkName', width: 200, align: 'center' },
+        { title: '创建时间', dataIndex: 'createDate', width: 200, align: 'center' },
+        { title: '网点名称', dataIndex: 'name', width: 200, align: 'center' },
         { title: '省', dataIndex: 'provinceName', width: 200, align: 'center' },
         { title: '市', dataIndex: 'cityName', width: 200, align: 'center' },
-        { title: '区', dataIndex: 'areaName', width: 200, align: 'center' },
+        { title: '区', dataIndex: 'districtName', width: 200, align: 'center' },
         { title: '详细地址', dataIndex: 'address', width: 200, align: 'center' },
-        { title: '兑换规则', dataIndex: 'exchangeRules', width: 200, align: 'center' },
-        { title: '投放时间段名称', dataIndex: 'times', width: 220, align: 'center' },
+        { title: '兑换规则', dataIndex: 'exRuleName', width: 200, align: 'center' },
+        { title: '投放时间段名称', dataIndex: 'timeRuleName', width: 220, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 240, align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        // return getTenantsList(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
-        //       _item.status = _item.status + '' === '1'
-        //     }
-        //     return res.data
-        //   }
-        // })
-        return new Promise((resolve) => {
-          const data = [
-            { id: 1, no: 1, orderDate: '2020-10-30 09:14', networkName: '网点1', provinceName: '陕西省', cityName: '西安市', areaName: '未央区', address: '凤城十二路', exchangeRules: '规则1', times: '早高峰期' },
-            { id: 2, no: 2, orderDate: '2020-10-30 09:14', networkName: '网点2', provinceName: '陕西省', cityName: '西安市', areaName: '未央区', address: '凤城十二路', exchangeRules: '规则2', times: '晚高峰期' },
-            { id: 3, no: 3, orderDate: '2020-10-30 09:14', networkName: '网点3', provinceName: '陕西省', cityName: '西安市', areaName: '未央区', address: '凤城十二路', exchangeRules: '规则3', times: '早高峰期' },
-            { id: 4, no: 4, orderDate: '2020-10-30 09:14', networkName: '网点4', provinceName: '陕西省', cityName: '西安市', areaName: '未央区', address: '凤城十二路', exchangeRules: '规则4', times: '早高峰期' },
-            { id: 5, no: 5, orderDate: '2020-10-30 09:14', networkName: '网点5', provinceName: '陕西省', cityName: '西安市', areaName: '未央区', address: '凤城十二路', exchangeRules: '规则5', times: '早高峰期' },
-            { id: 6, no: 6, orderDate: '2020-10-30 09:14', networkName: '网点6', provinceName: '陕西省', cityName: '西安市', areaName: '未央区', address: '凤城十二路', exchangeRules: '规则6', times: '早高峰期' },
-            { id: 7, no: 7, orderDate: '2020-10-30 09:14', networkName: '网点7', provinceName: '陕西省', cityName: '西安市', areaName: '未央区', address: '凤城十二路', exchangeRules: '规则7', times: '早高峰期' }
-          ]
-          resolve(data)
+        return stationList(Object.assign(parameter, this.queryParam)).then(res => {
+          if (res.status == 200) {
+            const no = (res.data.pageNo - 1) * res.data.pageSize
+            this.orderTotal = res.data.count
+            for (let i = 0; i < res.data.list.length; i++) {
+              const _item = res.data.list[i]
+              _item.no = no + i + 1
+            }
+            return res.data
+          }
         })
       },
       // 将默认当天时间日期回显在时间选择框中
@@ -150,11 +140,6 @@ export default {
       openBindModal: false //  绑定箱体设备
     }
   },
-  beforeRouteEnter (to, from, next) {
-    next(vm => {
-      vm.handleReset()
-    })
-  },
   methods: {
     moment,
     // 不可选日期
@@ -168,15 +153,23 @@ export default {
         this.queryParam.endDate = dateStrings[1]
       }
     },
+    //  省市区  change
+    addrChange (val) {
+      console.log(this.areas, '省市区-', val)
+    },
     // 重置
     handleReset () {
       console.log('重置', this.queryParam)
       this.queryParam.beginDate = null
       this.queryParam.endDate = null
+      this.queryParam.name = ''
+      this.queryParam.provinceCode = null
+      this.queryParam.cityCode = null
+      this.queryParam.districtCode = null
       this.time = []
       this.areas = []
-      this.form.resetFields()
       this.$refs.table.refresh(true)
+      this.networkId = null
     },
     //  新增、编辑网点
     handleEdit (row) {