Jelajahi Sumber

Signed-off-by: 1004749546@qq.com <1004749546@qq.com>
修改哈

1004749546@qq.com 4 tahun lalu
induk
melakukan
f2aeae8ba3

+ 11 - 0
src/api/boxSetting.js

@@ -0,0 +1,11 @@
+import { axios } from '@/utils/request'
+
+// 列表查询
+export const getList = (params) => {
+  const url = `advert/query/${params.pageNo}/${params.pageSize}`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}

+ 42 - 0
src/api/exchangeSetting.js

@@ -0,0 +1,42 @@
+import { axios } from '@/utils/request'
+
+// 列表查询
+export const getList = (params) => {
+  const url = `goldEx/query/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 确认保存
+export const saveExchangeSetting = (params) => {
+  const url = `goldEx/save`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 查详情
+export const viewExchangeSetting = (params) => {
+  const url = `goldEx/findById/${params.id}`
+  return axios({
+    url: url,
+    data: {},
+    method: 'get'
+  })
+}
+
+// 删除
+export const deleteExchangeSetting = (params) => {
+  const url = `goldEx/delete/${params.id}`
+  return axios({
+    url: url,
+    data: {},
+    method: 'get'
+  })
+}

+ 42 - 0
src/api/openTimeSetting.js

@@ -0,0 +1,42 @@
+import { axios } from '@/utils/request'
+
+// 列表查询
+export const getList = (params) => {
+  const url = `deliveryTime/query/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 确认保存
+export const saveTimeSetting = (params) => {
+  const url = `deliveryTime/save`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 查详情
+export const viewTimeSetting = (params) => {
+  const url = `deliveryTime/findById/${params.id}`
+  return axios({
+    url: url,
+    data: {},
+    method: 'get'
+  })
+}
+
+// 删除
+export const deleteTimeSetting = (params) => {
+  const url = `deliveryTime/delete/${params.id}`
+  return axios({
+    url: url,
+    data: {},
+    method: 'get'
+  })
+}

+ 25 - 35
src/views/equipmentManage/boxSetting/boxSetting.vue

@@ -5,12 +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">
@@ -33,12 +28,7 @@
       <!-- 操作 -->
       <template 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"
-          v-if="!record.isEnable"
-          @click="delect(record)" />
+        <a-icon type="delete" title="删除" class="actionBtn icon-red" v-if="!record.isEnable" @click="delect(record)" />
       </template>
     </s-table>
     <!-- 新增/编辑 弹窗 -->
@@ -74,8 +64,8 @@ export default {
       queryParam: {
         name: '' // 箱体类型
       },
-	  openBoxModal: false, // 新增/编辑弹窗
-	  boxId: '', //  箱体id
+      openBoxModal: false, // 新增/编辑弹窗
+      boxId: '', //  箱体id
       // 表头
       columns: [{
         title: '序号',
@@ -116,31 +106,31 @@ export default {
           align: 'center'
         },
         {
-		  title: '3号箱',
-		  dataIndex: 'tProportion',
-		  width: 100,
-		  align: 'center',
-		  customRender: (record, index) => {
-			  return record.tProportion || '--'
-		  }
+          title: '3号箱',
+          dataIndex: 'tProportion',
+          width: 100,
+          align: 'center',
+          customRender: (record, index) => {
+            return record.tProportion || '--'
+          }
         },
         {
-		  title: '4号箱',
-		  dataIndex: 'tProportion',
-		  width: 100,
-		  align: 'center',
-		  customRender: (record, index) => {
-			  return record.tProportion || '--'
-		  }
+          title: '4号箱',
+          dataIndex: 'tProportion',
+          width: 100,
+          align: 'center',
+          customRender: (record, index) => {
+            return record.tProportion || '--'
+          }
         },
         {
-		  title: '5号箱',
-		  dataIndex: 'tProportion',
-		  width: 100,
-		  align: 'center',
-		  customRender: (record, index) => {
-			  return record.tProportion || '--'
-		  }
+          title: '5号箱',
+          dataIndex: 'tProportion',
+          width: 100,
+          align: 'center',
+          customRender: (record, index) => {
+            return record.tProportion || '--'
+          }
         }
         ]
       },

+ 47 - 21
src/views/equipmentManage/exchangeSetting/AddSetModal.vue

@@ -39,36 +39,38 @@
           align="middle"
           v-for="(item, index) in keys"
           :key="index">
-          <a-col span="12">
+          <a-col span="11">
             <!-- 请输入投放重量 -->
             <a-form-item
               :label="item.dispName"
               :required="true"
-              :label-col=" { span: 10 }"
-              :wrapper-col=" { span: 14 }"
+              :label-col=" { span: 11 }"
+              :wrapper-col=" { span: 13 }"
             >
               <a-input-number
                 :min="1"
                 :max="999999"
-                precision="2"
-                style="width: 200px;"
-                placeholder="请输入投放重量(g)(最大999999)"
+                :precision="2"
+                :disabled="!item.exchangeStatus"
+                style="width: 150px;"
+                placeholder="请输入投放重量(最大999999)"
                 v-decorator="[
                   `formData.settings[${index}].weight`,
                   {
                     validateTrigger: ['change', 'blur'],
                     rules: [
                       {
-                        required: true, message: '请输入投放重量(g)(最大999999)!'
+                        required: true, message: '请输入投放重量(最大999999)!'
                       },
                     ],
                   },
                 ]"
               />
+              <span>(g)</span>
             </a-form-item>
           </a-col>
           <a-col span="1"></a-col>
-          <a-col span="9">
+          <a-col span="8">
             <!-- 请输入可兑乐豆数 -->
             <a-form-item
               :label="''"
@@ -77,8 +79,9 @@
               <a-input-number
                 :min="1"
                 :max="999999"
-                precision="0"
-                style="width: 200px;"
+                :precision="0"
+                :disabled="!item.exchangeStatus"
+                style="width: 140px;"
                 placeholder="请输入可兑乐豆数(最大999999)"
                 v-decorator="[
                   `formData.settings[${index}].num`,
@@ -92,7 +95,17 @@
                   },
                 ]"
               />
-              </v-select>
+              <span>(个)</span>
+            </a-form-item>
+          </a-col>
+          <a-col span="3">
+            <a-form-item
+              :label="''"
+              :required="false"
+              :wrapper-col="{ span: 24 }">
+              <a-checkbox :checked="!item.exchangeStatus" @change="handleStatusChange(item,index)">
+                不兑换
+              </a-checkbox>
             </a-form-item>
           </a-col>
         </a-row>
@@ -115,9 +128,8 @@ import {
   STable,
   VSelect
 } from '@/components'
-import {
-  saveRolePower
-} from '@/api/power-role.js'
+import { viewExchangeSetting, saveExchangeSetting } from '@/api/exchangeSetting.js'
+import { listLookUp } from '@/api/data'
 export default {
   name: 'RoleModal',
   components: {
@@ -158,13 +170,28 @@ export default {
       this.clear()
       this.$emit('close')
     },
+    // 查详情
+    getDetailData (id) {
+	  viewExchangeSetting({ id: id }).then(res => {
+	    if (res.status == 200) {
+
+	    }
+	  })
+    },
+    // 是否兑换切换
+    handleStatusChange (item, index) {
+      item.exchangeStatus = item.exchangeStatus ? 0 : 1
+	  this.form.setFieldsValue({ '`formData.settings[${index}].num`': '' })
+	  // this.formData.settings[index].num = ''
+	  // this.formData.settings[index].weight = ''
+    },
     // 保存提交
     handleSubmit () {
       const _this = this
       this.form.validateFields((err, values) => {
 		  console.log(values, ' formData.type222222222')
         if (!err) {
-          saveRolePower(Object.assign(this.formData, values.formData)).then(res => {
+          saveExchangeSetting(Object.assign(this.formData, values.formData)).then(res => {
             console.log(res, 'res--save')
             if (res.status + '' === '200') {
               this.$message.success(res.message ? res.message : '保存成功')
@@ -185,7 +212,6 @@ export default {
     },
     clear () {
       this.form.resetFields()
-      delete this.formData.id
       this.formData.name = ''
       this.formData.isEnable = ''
       this.formData.remarks = ''
@@ -205,11 +231,11 @@ export default {
     isshow (newValue, oldValue) {
       if (newValue) {
 		  this.keys = [
-			  { dispName: '废旧衣物', code: 'fjyw', id: 11 },
-			  { dispName: '废旧衣物', code: 'fjyw', id: 12 },
-			  { dispName: '废旧衣物', code: 'fjyw', id: 13 },
-			  { dispName: '废旧衣物', code: 'fjyw', id: 14 },
-			  { dispName: '废旧衣物', code: 'fjyw', id: 15 }
+			  { dispName: '废旧衣物', code: 'fjyw', id: 11, exchangeStatus: 1 },
+			  { dispName: '废旧衣物', code: 'fjyw', id: 12, exchangeStatus: 1 },
+			  { dispName: '废旧衣物', code: 'fjyw', id: 13, exchangeStatus: 1 },
+			  { dispName: '废旧衣物', code: 'fjyw', id: 14, exchangeStatus: 1 },
+			  { dispName: '废旧衣物', code: 'fjyw', id: 15, exchangeStatus: 0 }
 		  ]
         if (this.data.id) { // 编辑
           this.titleText = '编辑'

+ 109 - 109
src/views/equipmentManage/exchangeSetting/ExchangeSetting.vue

@@ -52,6 +52,7 @@ import {
   VSelect
 } from '@/components'
 import AddSetModal from './AddSetModal.vue'
+import { getList, deleteExchangeSetting } from '@/api/exchangeSetting.js'
 export default {
   name: 'Equipment',
   components: {
@@ -104,19 +105,19 @@ export default {
       {
         title: '兑换规则(投放重量(g)/可兑换乐豆数(个))',
         children: [{
-          title: '废旧衣',
+          title: '废旧衣',
           dataIndex: 'oProportion',
           width: 100,
           align: 'center'
         },
         {
-          title: '废旧衣物',
+          title: '废旧塑料',
           dataIndex: 'tProportion',
           width: 100,
           align: 'center'
         },
         {
-		  title: '废旧衣物',
+		  title: '废旧金属',
 		  dataIndex: 'tProportion',
 		  width: 100,
 		  align: 'center',
@@ -125,7 +126,7 @@ export default {
 		  }
         },
         {
-		  title: '废旧衣物',
+		  title: '废旧纸张',
 		  dataIndex: 'tProportion',
 		  width: 100,
 		  align: 'center',
@@ -155,112 +156,111 @@ export default {
       ],
       // 加载数据方法 必须为 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'
+        return getList(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
           }
-          ]
-          resolve(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)
+      //   })
       }
 
     }
@@ -296,7 +296,7 @@ export default {
         okText: '确定',
         cancelText: '取消',
         onOk () {
-          delectRolePower({
+          deleteExchangeSetting({
             id: row.id
           }).then(res => {
             console.log(res, 'res1111')

+ 48 - 27
src/views/equipmentManage/openTimeSetting/AddTimeModal.vue

@@ -37,8 +37,9 @@
               <a-time-picker
                 placeholder="开始时间"
                 v-decorator="[
-                  `times[${k}].startTime`,
+                  `formData.deliveryTimeRuleItemList[${k}].openTime`,
                   {
+                    initialValue: `formData.deliveryTimeRuleItemList[${k}].openTime`,
                     validateTrigger: ['change', 'blur'],
                     rules: [
                       {
@@ -65,8 +66,9 @@
               <a-time-picker
                 placeholder="结束时间"
                 v-decorator="[
-                  `times[${k}].endTime`,
+                  `formData.deliveryTimeRuleItemList[${k}].closeTime`,
                   {
+                    initialValue: `formData.deliveryTimeRuleItemList[${k}].closeTime`,
                     validateTrigger: ['change', 'blur'],
                     rules: [
                       { required: true, message: '请选择投放结束时间!' }
@@ -110,9 +112,7 @@ import {
   STable,
   VSelect
 } from '@/components'
-import {
-  saveRolePower
-} from '@/api/power-role.js'
+import { viewTimeSetting, saveTimeSetting } from '@/api/openTimeSetting.js'
 import moment from 'moment'
 export default {
   name: 'RoleModal',
@@ -125,16 +125,16 @@ export default {
       type: Boolean,
       default: false
     },
-    data: {
-      type: Object,
+    id: {
+      type: [String, Number],
       default: function () {
-        return {}
+        return ''
       }
     }
   },
   data () {
     return {
-      id: 0,
+      index: 0, // 用于增加时间列的全局变量
       titleText: '新增',
       isshow: this.visible,
       formLayout: 'horizontal',
@@ -143,10 +143,8 @@ export default {
       }),
       formData: {
         name: '',
-        isEnable: '', // 活动状态
-        remarks: ''
-      },
-      keys: []
+        deliveryTimeRuleItemList: []
+      }
     }
   },
   methods: {
@@ -155,6 +153,29 @@ export default {
       this.clear()
       this.$emit('close')
     },
+    // 查详情
+    getDetailData (id) {
+      viewTimeSetting({ id: id }).then(res => {
+        if (res.status == 200) {
+          this.formData.name = res.data.name
+		  const list = res.data.deliveryTimeRuleItemList
+		  this.index = list.length - 1
+		  const keys = this.form.getFieldValue('keys')
+		  let keysL = []
+		  for (let x = 0; x < list.length; x++) {
+			  keysL = keys.concat(x)
+		  }
+		  this.form.setFieldsValue({
+		    keys: keysL
+		  })
+		  list.map(item => {
+			  item.openTime = moment(item.openTime, 'HH:mm')
+			  item.closeTime = moment(item.closeTime, 'HH:mm')
+		  })
+		  this.form.setFieldsValue({ 'formData.deliveryTimeRuleItemList': list })
+        }
+      })
+    },
     // 校验
     changeTimeValidator (rule, value, callback) {
 	  console.log('value', value, rule)
@@ -184,7 +205,7 @@ export default {
       } = this
       const keys = form.getFieldValue('keys')
       console.log(keys, 'kkkkkk')
-      const nextKeys = keys.concat(this.id++)
+      const nextKeys = keys.concat(this.index++)
       form.setFieldsValue({
         keys: nextKeys
       })
@@ -195,7 +216,15 @@ export default {
       this.form.validateFields((err, values) => {
 		  console.log(values, ' formData.type222222222')
         if (!err) {
-          saveRolePower(Object.assign(this.formData, values.formData)).then(res => {
+          const params = values.formData
+          params.deliveryTimeRuleItemList.map(item => {
+            item.openTime = moment(item.openTime).format('HH:mm')
+            item.closeTime = moment(item.closeTime).format('HH:mm')
+          })
+		  if (this.id) {
+			  params.id = this.id
+		  }
+          saveTimeSetting(params).then(res => {
             console.log(res, 'res--save')
             if (res.status + '' === '200') {
               this.$message.success(res.message ? res.message : '保存成功')
@@ -216,14 +245,10 @@ export default {
     },
     clear () {
       this.form.resetFields()
-      delete this.formData.id
       this.formData.name = ''
-      this.formData.isEnable = ''
-      this.formData.remarks = ''
     }
 
   },
-  mounted () {},
   beforeCreate () {
     this.form = this.$form.createForm(this, {
       name: 'addTimeModal'
@@ -239,16 +264,12 @@ export default {
           initialValue: [],
           preserve: true
         })
-        this.id = 0
+        this.index = 0
         this.add()
-        const keys = this.form.getFieldValue('keys')
-        console.log(keys, 'kkkkkk')
-        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 = '新增'
         }

+ 46 - 35
src/views/equipmentManage/openTimeSetting/OpenTimeSetting.vue

@@ -3,7 +3,6 @@
     <div class="table-operator">
       <a-button type="primary" icon="plus" @click="openModal" id="roleList-openModal">新增</a-button>
     </div>
-
     <s-table
       ref="table"
       size="default"
@@ -11,6 +10,10 @@
       :columns="columns"
       :data="loadData"
       bordered>
+      <!-- 时间段 -->
+      <template slot="deliveryTimeRuleItemList" slot-scope="text, record">
+        <span>{{ filterData(record.deliveryTimeRuleItemList) }}</span>
+      </template>
       <!-- 操作 -->
       <span slot="action" slot-scope="text, record">
         <a-icon type="edit" title="编辑" class="actionBtn icon-blues" @click="handleEdit(record)" />
@@ -23,7 +26,7 @@
       </span>
     </s-table>
     <!-- 新增/编辑 弹窗 -->
-    <add-time-modal :visible="showModal" :data="itemData" @refresh="refreshTable" @close="showModal = false"></add-time-modal>
+    <add-time-modal :visible="showModal" :id="itemId" @refresh="refreshTable" @close="showModal = false"></add-time-modal>
   </a-card>
 </template>
 
@@ -33,12 +36,7 @@ import {
   VSelect
 } from '@/components'
 import AddTimeModal from './AddTimeModal.vue'
-import {
-  getPowerRoleList,
-  updateEnableStatus,
-  delectRolePower,
-  getMenuList
-} from '@/api/power-role.js'
+import { getList, deleteTimeSetting } from '@/api/openTimeSetting.js'
 export default {
   name: 'RoleList',
   components: {
@@ -49,7 +47,7 @@ export default {
   data () {
     return {
       showModal: false, // 是否打开新增时间段弹窗
-      itemData: {}, // 编辑行数据
+      itemId: {}, // 编辑行id
       // 表头
       columns: [{
         title: '序号',
@@ -71,9 +69,12 @@ export default {
       },
 	  {
 	    title: '投放时间段',
-	    dataIndex: 'time',
+	    dataIndex: 'deliveryTimeRuleItemList',
 	    width: 200,
-	    align: 'center'
+	    align: 'center',
+        scopedSlots: {
+		  customRender: 'deliveryTimeRuleItemList'
+        }
 	  },
       {
         title: '操作',
@@ -87,27 +88,25 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         console.log(parameter, 'parameter')
-
-        // return getPowerRoleList(Object.assign(parameter, this.queryParam)).then(res => {
-        //   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.isEnable = _item.isEnable + '' === '1'
-        //   }
-        //   return res.data
-        // })
-        return new Promise((resolve) => {
-		  const data = [
-		    { no: 1, id: '1', createDate: '2020-10-30 09:14', name: '上下班高峰', time: '8:00-9:00,18:00-20:00' },
-		    { no: 2, id: '12', createDate: '2020-10-30 09:14', name: '中午', time: '8:00-9:00,18:00-20:00' },
-		    { no: 3, id: '13', createDate: '2020-10-30 09:14', name: '下午茶', time: '8:00-9:00,18:00-20:00' },
-		    { no: 4, id: '14', createDate: '2020-10-30 09:14', name: '晚高峰', time: '8:00-9:00,18:00-20:00' },
-		    { no: 5, id: '15', createDate: '2020-10-30 09:14', name: '早高峰', time: '8:00-9:00,18:00-20:00' },
-		    { no: 6, id: '16', createDate: '2020-10-30 09:14', name: '深夜', time: '8:00-9:00,18:00-20:00' }
-		  ]
-		  resolve(data)
+        return getList(Object.assign(parameter, this.queryParam)).then(res => {
+          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
         })
+        //     return new Promise((resolve) => {
+		  // const data = [
+		  //   { no: 1, id: '1', createDate: '2020-10-30 09:14', name: '上下班高峰', time: '8:00-9:00,18:00-20:00' },
+		  //   { no: 2, id: '12', createDate: '2020-10-30 09:14', name: '中午', time: '8:00-9:00,18:00-20:00' },
+		  //   { no: 3, id: '13', createDate: '2020-10-30 09:14', name: '下午茶', time: '8:00-9:00,18:00-20:00' },
+		  //   { no: 4, id: '14', createDate: '2020-10-30 09:14', name: '晚高峰', time: '8:00-9:00,18:00-20:00' },
+		  //   { no: 5, id: '15', createDate: '2020-10-30 09:14', name: '早高峰', time: '8:00-9:00,18:00-20:00' },
+		  //   { no: 6, id: '16', createDate: '2020-10-30 09:14', name: '深夜', time: '8:00-9:00,18:00-20:00' }
+		  // ]
+		  // resolve(data)
+        //     })
       }
     }
   },
@@ -124,9 +123,21 @@ export default {
     // 新建
     openModal () {
       this.showModal = true
-      this.itemData = {}
+      this.itemId = ''
+    },
+    // 时间段数据处理
+    filterData (row) {
+	  if (row) {
+		  let str = ''
+		  row.map((item, index) => {
+			  const p = item.openTime + '-' + item.closeTime
+		    str = str + p + ((index == row.length - 1) ? '' : ',')
+		  })
+		  return str
+	  } else {
+		  return '--'
+	  }
     },
-
     // 删除
     delect (row) {
       const _this = this
@@ -137,7 +148,7 @@ export default {
         okText: '确定',
         cancelText: '取消',
         onOk () {
-          delectRolePower({
+          deleteTimeSetting({
             id: row.id
           }).then(res => {
             console.log(res, 'res1111')
@@ -153,7 +164,7 @@ export default {
     handleEdit (row) {
       console.log(row, 'row')
       this.showModal = true
-      this.itemData = row
+      this.itemId = row.id
     }
   }
 }

+ 1 - 1
vue.config.js

@@ -108,7 +108,7 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        target: 'http://192.168.16.155:8301/gc-admin/',
+        target: 'http://192.168.16.104:8301/gc-admin/',
         ws: false,
         changeOrigin: true,
         pathRewrite: {