wyh 1 год назад
Родитель
Сommit
fee066c150
1 измененных файлов с 89 добавлено и 5 удалено
  1. 89 5
      src/views/module_base/energyRate/modules/EnergyRateForm.vue

+ 89 - 5
src/views/module_base/energyRate/modules/EnergyRateForm.vue

@@ -23,7 +23,7 @@
                   <a-icon type="exclamation-circle" />
                 </a-tooltip>
               </span>
-              <j-dict-select-tag type="list" v-model="model.ratetype" dictCode="energy_rate_type" placeholder="请选择费率类型" @change="handleChangeType"/>
+              <j-dict-select-tag type="list" v-model="model.ratetype" dictCode="energy_rate_type" placeholder="请选择费率类型" @change="handleChangeType" :disabled="ratetypeDisabled"/>
             </a-form-model-item>
           </a-col>
           <a-col :xs="24" :sm="12">
@@ -166,6 +166,7 @@
         model:{
           loading: false,
           data: [],
+          baseEnergyRateDetailList: [],
           columns1: []
         },
         validatorRules: {
@@ -244,11 +245,13 @@
           add: "/energyRate/energyRate/add",
           edit: "/energyRate/energyRate/edit",
           baseEnergyRateDetail: {
-            list: '/energyRate/energyRate/queryDetailByMainId'
+            list: '/energyRate/energyRate/queryDetailByMainId',
+            list2: '/energyRate/energyRate/xqqueryById'
           },
         },
         count: 1,
         ratetype: '',
+        ratetypeDisabled: false,
         dictCode: 'ems_pandv'
       }
     },
@@ -295,16 +298,96 @@
       },
       // 新增
       add(){
-        this.model = {}
+        // this.model = {}
         this.visible = true;
       },
       // 修改
       edit (record) {
-        getAction(this.url.baseEnergyRateDetail.list, {id:record.id}).then((res) => {
+        this.ratetypeDisabled = true
+        getAction(this.url.baseEnergyRateDetail.list2, {id:record.id}).then((res) => {
           console.log(77777,res)
+          this.model = res.result
+          this.model.data = this.model.baseEnergyRateDetailList
+          if (this.model.ratetype == 1) {
+            this.model.columns1 = [
+              {
+                title: '分时开始时间',
+                dataIndex: 'begintime',
+                key: 'begintime',
+                width:"200px",
+                align: 'center',
+                scopedSlots: { customRender: 'begintime' },
+              },
+              {
+                title: '分时结束时间',
+                dataIndex: 'endtime',
+                key: 'endtime',
+                width:"200px",
+                align: 'center',
+                scopedSlots: { customRender: 'endtime' },
+              },
+              {
+                title: '峰平谷',
+                dataIndex: 'pandv',
+                key: 'pandv',
+                width:"200px",
+                align: 'center',
+                scopedSlots: { customRender: 'pandv' },
+              },
+              {
+                title: '价格',
+                dataIndex: 'price',
+                key: 'price',
+                width:"200px",
+                align: 'center',
+                scopedSlots: { customRender: 'price' },
+              },
+              {
+                title: '操作',
+                key: 'operation',
+                align: 'center',
+                width:"100px",
+                scopedSlots: { customRender: 'operation' }
+              }
+            ]
+          } else {
+            this.model.columns1 = [
+              {
+                title: '起始量',
+                dataIndex: 'beginamount',
+                key: 'beginamount',
+                width:"200px",
+                align: 'center',
+                scopedSlots: { customRender: 'beginamount' },
+              },
+              {
+                title: '结束量',
+                dataIndex: 'endamount',
+                key: 'endamount',
+                width:"200px",
+                align: 'center',
+                scopedSlots: { customRender: 'endamount' },
+              },
+              {
+                title: '价格',
+                dataIndex: 'price',
+                key: 'price',
+                width:"200px",
+                align: 'center',
+                scopedSlots: { customRender: 'price' },
+              },
+              {
+                title: '操作',
+                key: 'operation',
+                align: 'center',
+                width:"100px",
+                scopedSlots: { customRender: 'operation' }
+              }
+            ]
+          }
         })
         // this.model = Object.assign({}, record);
-        // this.visible = true;
+        this.visible = true;
       },
       /** 调用完edit()方法之后会自动调用此方法 */
       editAfter() {
@@ -494,6 +577,7 @@
         // 触发表单验证
         this.$refs.form.validate(valid => {
           if (valid) {
+            that.model.baseEnergyRateDetailList = that.model.data
             that.confirmLoading = true;
             let httpurl = '';
             let method = '';