فهرست منبع

Merge branch 'deploy' of http://git.chelingzhu.com/chelingzhu-web/zxyj-admin-html into deploy

lilei 4 سال پیش
والد
کامیت
5cd0abf09a

+ 85 - 67
src/views/equipmentManage/boxSetting/AddBoxModal.vue

@@ -21,46 +21,43 @@
               rules: [{ required: true, message: '请输入箱体类型名称(最多30个字符)!' }] }]" />
         </a-form-item>
         <!-- 内置箱体数量 -->
-        <a-form-item
-          label="内置箱体数量"
-          :label-col="{ span: 5 }"
-          :wrapper-col="{ span: 14 }"
-        >
-          <a-select
-            allowClear
+        <a-form-item label="内置箱体数量" :label-col="{ span: 5 }" :wrapper-col="{ span: 14 }">
+          <v-select
+            ref="orderStatus"
+            id="addBoxModal-status"
+            code="BOX_NUM"
             @change="handleNumChange"
             placeholder="请选择"
-            v-decorator="['formData.num', {
-              initialValue: formData.num,
-              rules: [{ required: true, message: '请选择箱体类型!' }] }]">
-            <a-select-option v-for="item in numList" :value="item" :key="item">
-              {{ item }}
-            </a-select-option>
-          </a-select>
+            allowClear
+            v-decorator="[
+              `formData.boxNum`,
+              {
+                initialValue: formData.boxNum,
+                validateTrigger: ['change', 'blur'],
+                rules: [
+                  {
+                    required: true, message: '请选择箱体类型!'
+                  },
+                ],
+              },
+            ]">
+          </v-select>
         </a-form-item>
         <!-- 箱体限投 -->
-        <a-row
-          type="flex"
-          align="middle"
-          v-for="(k, index) in keys"
-          :key="k">
+        <a-row type="flex" align="middle" v-for="(k, index) in keys" :key="k">
           <a-col span="12">
             <!-- 投放开始时间 -->
-            <a-form-item
-              :label=" '内置'+(index+1)+'号箱限投(kg)'"
-              :required="true"
-              :label-col=" { span: 10 }"
-              :wrapper-col=" { span: 14 }"
-            >
+            <a-form-item :label=" '内置'+(index+1)+'号箱限投(kg)'" :required="true" :label-col=" { span: 10 }" :wrapper-col=" { span: 14 }">
               <a-input-number
                 :min="1"
                 :max="1000"
-                precision="2"
+                :precision="0"
                 style="width: 200px;"
                 placeholder="请输入数字(最大1000)"
                 v-decorator="[
-                  `formData.settings[${k}].limitNum`,
+                  `formData.maxWeight[${k}]`,
                   {
+                    initialValue: formData[`maxWeight[${k}]`],
                     validateTrigger: ['change', 'blur'],
                     rules: [
                       {
@@ -68,26 +65,23 @@
                       },
                     ],
                   },
-                ]"
-              />
+                ]" />
             </a-form-item>
           </a-col>
           <a-col span="1"></a-col>
           <a-col span="9">
             <!-- 请选择分类 -->
-            <a-form-item
-              :label="''"
-              :required="false"
-              :wrapper-col="{ span: 18 }">
+            <a-form-item :label="''" :required="false" :wrapper-col="{ span: 18 }">
               <v-select
                 ref="orderStatus"
                 id="addBoxModal-status"
-                code="SETTLE_STATUS_ALL"
+                code="RUBBISH_TYPE"
                 placeholder="请选择分类"
                 allowClear
                 v-decorator="[
-                  `formData.settings[${k}].type`,
+                  `formData.rubbishType[${k}]`,
                   {
+                    initialValue: formData[`rubbishType[${k}]`],
                     validateTrigger: ['change', 'blur'],
                     rules: [
                       {
@@ -120,10 +114,9 @@ import {
   VSelect
 } from '@/components'
 import {
-  saveRolePower
-} from '@/api/power-role.js'
-import moment from 'moment'
-import numberToFixed from '@/utils/util.js'
+  saveBoxSetting,
+  viewBoxSetting
+} from '@/api/boxSetting.js'
 export default {
   name: 'RoleModal',
   components: {
@@ -135,33 +128,31 @@ export default {
       type: Boolean,
       default: false
     },
-    data: {
-      type: Object,
+    id: {
+      type: [String, Number],
       default: function () {
-        return {}
+        return ''
       }
     }
   },
   data () {
     return {
-      id: 0,
       titleText: '新增',
       isshow: this.visible,
       formLayout: 'horizontal',
       form: this.$form.createForm(this, {
         name: 'AddBoxModal'
       }),
-	  numList: [2, 4, 5], // 内置箱体数量选择
       formData: {
         name: '',
-        num: '',
-        settings: []
+        boxNum: '',
+        maxWeight: [],
+        rubbishType: []
       },
       keys: []
     }
   },
   methods: {
-    numberToFixed,
     cancel (e) {
       this.clear()
       this.$emit('close')
@@ -169,23 +160,54 @@ export default {
     // 内置箱体选择修改
     handleNumChange (v) {
       console.log(v, 'vvvvvvvvvv')
-	  const arr = []
-	  for (let x = 0; x < v; x++) {
-		  arr.push(x)
-	  }
-	  this.keys = arr
-	  console.log(this.keys, 'this.keys')
+      const arr = []
+      for (let x = 0; x < v; x++) {
+        arr.push(x)
+      }
+      this.keys = arr
+      console.log(this.keys, 'this.keys')
+    },
+    // 查详情
+    getDetailData (id) {
+      viewBoxSetting({
+        id: id
+      }).then(res => {
+        if (res.status == 200) {
+          this.formData = Object.assign({}, this.formData, res.data)
+		  this.handleNumChange(this.formData.boxNum)
+          // 回显数据
+          this.formData.deviceTypeBoxList.map((item, index) => {
+            this.formData['maxWeight[' + index + ']'] = item.maxWeight
+            this.formData['rubbishType[' + index + ']'] = item.rubbishType
+          })
+        }
+      })
     },
     // 保存提交
     handleSubmit () {
       const _this = this
       this.form.validateFields((err, values) => {
-		  console.log(values, ' formData.type222222222')
+        console.log(values, ' formData.type222222222')
         if (!err) {
-          saveRolePower(Object.assign(this.formData, values.formData)).then(res => {
+          const params = Object.assign({}, this.formData, values.formData)
+		  console.log(this.keys, params, 'kkkkkkkk')
+		  const arr = []
+          this.keys.map((item, index) => {
+			  const p = {
+				  boxCode: index + 1,
+				  maxWeight: params.maxWeight[index],
+				  rubbishType: params.rubbishType[index]
+			  }
+			 arr.push(p)
+          })
+		  delete params.maxWeight
+		  delete params.rubbishType
+		  params.deviceTypeBoxList = arr
+		  console.log(params, 'ppppppppp')
+          saveBoxSetting(params).then(res => {
             console.log(res, 'res--save')
-            if (res.status + '' === '200') {
-              this.$message.success(res.message ? res.message : '保存成功')
+            if (res.status == '200') {
+              this.$message.success(res.message)
               this.$emit('refresh')
               setTimeout(function () {
                 _this.cancel()
@@ -203,14 +225,11 @@ export default {
     },
     clear () {
       this.form.resetFields()
-      delete this.formData.id
       this.formData.name = ''
-      this.formData.isEnable = ''
-      this.formData.remarks = ''
+      this.formData.boxNum = ''
     }
 
   },
-  mounted () {},
   beforeCreate () {
     this.form = this.$form.createForm(this, {
       name: 'AddBoxModal'
@@ -227,12 +246,9 @@ export default {
           preserve: true
         })
         this.id = 0
-        if (this.data.id) { // 编辑
+        if (this.id) { // 编辑
           this.titleText = '编辑'
-          this.formData = Object.assign({}, this.data)
-          delete this.formData.no
-          this.formData.isEnable = Number(this.formData.isEnable)
-          console.log(this.formData, 'this.formData')
+		  this.getDetailData(this.id)
         } else {
           this.titleText = '新增'
         }
@@ -250,10 +266,12 @@ export default {
 	.ant-modal-footer {
 		display: none;
 	}
+
 	.dynamic-delete-button {
 		margin-right: 20px;
 	}
-	.linenums{
+
+	.linenums {
 		padding: 0 20px;
 	}
 </style>

+ 36 - 21
src/views/equipmentManage/boxSetting/boxSetting.vue

@@ -5,7 +5,7 @@
         <a-row :gutter="48">
           <a-col :span="6">
             <a-form-item label="箱体类型" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
-              <a-input id="boxSetting-name" allowClear :maxLength="30" v-model="queryParam.name" placeholder="请输入箱体类型" />
+              <a-input id="boxSetting-name" allowClear :maxLength="30" v-model="queryParam.name" placeholder="请输入箱体类型名称" />
             </a-form-item>
           </a-col>
           <a-col :span="6">
@@ -32,7 +32,7 @@
       </template>
     </s-table>
     <!-- 新增/编辑 弹窗 -->
-    <add-box-modal :visible="openBoxModal" :data="itemData" @refresh="refreshTable" @close="openBoxModal = false"></add-box-modal>
+    <add-box-modal :visible="openBoxModal" :id="itemId" @refresh="refreshTable" @close="openBoxModal = false"></add-box-modal>
   </a-card>
 </template>
 
@@ -69,7 +69,7 @@ export default {
         name: '' // 箱体类型
       },
       openBoxModal: false, // 新增/编辑弹窗
-      boxId: '', //  箱体id
+      itemId: '', //  箱体id
       // 表头
       columns: [{
         title: '序号',
@@ -79,61 +79,67 @@ export default {
       },
       {
         title: '创建时间',
-        dataIndex: 'networkName',
+        dataIndex: 'createDate',
         width: 200,
         align: 'center'
       },
       {
         title: '箱体类型',
-        dataIndex: 'address',
+        dataIndex: 'name',
         width: 200,
         align: 'center'
       },
       {
         title: '内置箱体数量(个)',
-        dataIndex: 'equipmentNo',
+        dataIndex: 'boxNum',
         width: 200,
         align: 'center'
       },
       {
-        title: '内置箱体投放限重(kg)',
+        title: '内置箱体投放限重(kg)/ 对应资源分类',
         children: [{
           title: '1号箱',
-          dataIndex: 'oProportion',
+          dataIndex: 'one',
           width: 100,
-          align: 'center'
+          align: 'center',
+		  customRender: (record, text) => {
+		    return record ? (record.maxWeight ? (record.maxWeight + '/' + record.rubbishType) : '--') : '--'
+		  }
         },
         {
           title: '2号箱',
-          dataIndex: 'tProportion',
+          dataIndex: 'two',
           width: 100,
-          align: 'center'
+          align: 'center',
+		  customRender: (record, text) => {
+		    return record ? (record.maxWeight ? (record.maxWeight + '/' + record.rubbishType) : '--') : '--'
+		  }
         },
         {
           title: '3号箱',
-          dataIndex: 'tProportion',
+          dataIndex: 'three',
           width: 100,
           align: 'center',
-          customRender: (record, index) => {
-            return record.tProportion || '--'
+          customRender: (record, text) => {
+            return record ? (record.maxWeight ? (record.maxWeight + '/' + record.rubbishType) : '--') : '--'
           }
         },
         {
           title: '4号箱',
-          dataIndex: 'tProportion',
+          dataIndex: 'four',
           width: 100,
           align: 'center',
-          customRender: (record, index) => {
-            return record.tProportion || '--'
+          customRender: (record, text) => {
+            return record ? (record.maxWeight ? (record.maxWeight + '/' + record.rubbishType) : '--') : '--'
           }
         },
         {
           title: '5号箱',
-          dataIndex: 'tProportion',
+          dataIndex: 'five',
           width: 100,
           align: 'center',
-          customRender: (record, index) => {
-            return record.tProportion || '--'
+          customRender: (record, text) => {
+            return record ? (record.maxWeight ? (record.maxWeight + '/' + record.rubbishType) : '--') : '--'
           }
         }
         ]
@@ -178,11 +184,20 @@ export default {
     // 新建
     openModal () {
       this.openBoxModal = true
-      this.itemData = {}
+      this.itemId = ''
     },
     // 编辑
     handleEdit (item) {
       this.openBoxModal = true
+	  this.itemId = item.id
+    },
+    // 新增/编辑 后刷新列表
+    refreshTable () {
+	  if (this.itemId) {
+	    this.$refs.table.refresh()
+	  } else {
+	    this.$refs.table.refresh(true)
+	  }
     },
     // 删除
     delect (row) {

+ 1 - 0
src/views/equipmentManage/equipment/logModal.vue

@@ -100,6 +100,7 @@ export default {
           searchData.endDate = ''
         }
         searchData.srcDeviceCode = this.srcDeviceCode
+        searchData.onlineFlag = 0
         return deviceLogList(searchData).then(res => {
           if (res.status == 200) {
             const no = (res.data.pageNo - 1) * res.data.pageSize

+ 1 - 1
src/views/equipmentManage/network/equipmentModal.vue

@@ -202,7 +202,7 @@ export default {
         centered: true,
         content: '确定解绑该设备吗?',
         onOk () {
-          stationUnBind({ srcDeviceCode: item.srcDeviceCode }).then(res => {
+          stationUnBind({ srcDeviceCode: item.srcDeviceCode, stationNo: _this.networkNo }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.getDevice()