|
@@ -16,8 +16,14 @@
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :xs="24" :sm="12">
|
|
|
- <a-form-model-item label="费率类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ratetype">
|
|
|
- <j-dict-select-tag type="list" v-model="model.ratetype" dictCode="energy_rate_type" placeholder="请选择费率类型" />
|
|
|
+ <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ratetype">
|
|
|
+ <span slot="label">
|
|
|
+ 费率类型
|
|
|
+ <a-tooltip title="切换类型后,价格信息表将重置">
|
|
|
+ <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"/>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :xs="24" :sm="12">
|
|
@@ -44,20 +50,70 @@
|
|
|
</a-form-model>
|
|
|
</j-form-container>
|
|
|
<!-- 子表单区域 -->
|
|
|
- <a-tabs v-model="activeKey" @change="handleChangeTabs">
|
|
|
+ <div class="cmms-dialog-item-title">价格信息表详情</div>
|
|
|
+ <a-button type="primary" style="margin-bottom:10px;" @click="newMember">新增</a-button>
|
|
|
+ <a-table
|
|
|
+ size="small"
|
|
|
+ :columns="model.columns1"
|
|
|
+ :dataSource="model.data"
|
|
|
+ :pagination="false"
|
|
|
+ :rowKey="(record, index) => { return index }"
|
|
|
+ bordered
|
|
|
+ class="j-table-force-nowrap"
|
|
|
+ >
|
|
|
+
|
|
|
+ <template slot="begintime" slot-scope="text, record,index">
|
|
|
+ <a-form-model-item :prop="'data.'+index+'.begintime'" :rules="validatorListRules.begintime" style="margin-bottom: 0px;">
|
|
|
+ <a-time-picker date-format="HH:mm:ss" placeholder="请选择分时开始时间" v-model="record.begintime" style="width: 100%" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </template>
|
|
|
+ <template slot="endtime" slot-scope="text, record,index">
|
|
|
+ <a-form-model-item :prop="'data.'+index+'.endtime'" :rules="validatorListRules.endtime" style="margin-bottom: 0px;">
|
|
|
+ <a-time-picker date-format="HH:mm:ss" placeholder="请选择分时结束时间" v-model="record.endtime" style="width: 100%" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </template>
|
|
|
+ <template slot="pandv" slot-scope="text, record,index">
|
|
|
+ <a-form-model-item :prop="'data.'+index+'.pandv'" :rules="validatorListRules.pandv" style="margin-bottom: 0px;">
|
|
|
+ <j-dict-select-tag type="list" v-model="record.pandv" dictCode="ems_pandv" placeholder="请选择峰平谷" style="width: 100%" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </template>
|
|
|
+ <template slot="price" slot-scope="text, record,index">
|
|
|
+ <a-form-model-item :prop="'data.'+index+'.price'" :rules="validatorListRules.price" style="margin-bottom: 0px;">
|
|
|
+ <a-input v-model="record.price" placeholder="请输入价格" ></a-input>
|
|
|
+ </a-form-model-item>
|
|
|
+ </template>
|
|
|
+ <template slot="beginamount" slot-scope="text, record,index">
|
|
|
+ <a-form-model-item :prop="'data.'+index+'.beginamount'" :rules="validatorListRules.beginamount" style="margin-bottom: 0px;">
|
|
|
+ <a-input v-model="record.beginamount" placeholder="请输入起始量" ></a-input>
|
|
|
+ </a-form-model-item>
|
|
|
+ </template>
|
|
|
+ <template slot="endamount" slot-scope="text, record,index">
|
|
|
+ <a-form-model-item :prop="'data.'+index+'.endamount'" :rules="validatorListRules.endamount" style="margin-bottom: 0px;">
|
|
|
+ <a-input v-model="record.endamount" placeholder="请输入结束量" ></a-input>
|
|
|
+ </a-form-model-item>
|
|
|
+ </template>
|
|
|
+ <template slot="operation" slot-scope="text, record">
|
|
|
+ <span>
|
|
|
+ <a-popconfirm title="是否要删除此行?" @confirm="remove(record.key)">
|
|
|
+ <a>删除</a>
|
|
|
+ </a-popconfirm>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
+ <!-- <a-tabs v-model="activeKey" @change="handleChangeTabs">
|
|
|
<a-tab-pane tab="详情" :key="refKeys[0]" :forceRender="true">
|
|
|
<j-editable-table
|
|
|
:ref="refKeys[0]"
|
|
|
- :loading="baseEnergyRateDetailTable.loading"
|
|
|
- :columns="baseEnergyRateDetailTable.columns"
|
|
|
- :dataSource="baseEnergyRateDetailTable.dataSource"
|
|
|
+ :loading="model.loading"
|
|
|
+ :columns="model.columns"
|
|
|
+ :dataSource="model.data"
|
|
|
:maxHeight="300"
|
|
|
:disabled="formDisabled"
|
|
|
:rowNumber="true"
|
|
|
:rowSelection="true"
|
|
|
:actionButton="true"/>
|
|
|
</a-tab-pane>
|
|
|
- </a-tabs>
|
|
|
+ </a-tabs> -->
|
|
|
</a-spin>
|
|
|
</template>
|
|
|
|
|
@@ -91,6 +147,9 @@
|
|
|
sm: { span: 20 },
|
|
|
},
|
|
|
model:{
|
|
|
+ loading: false,
|
|
|
+ data: [],
|
|
|
+ columns1: []
|
|
|
},
|
|
|
validatorRules: {
|
|
|
energyrateid: [
|
|
@@ -105,9 +164,9 @@
|
|
|
ratetype: [
|
|
|
{ required: true, message: '请输入费率类型:分时费率、阶梯费率!'},
|
|
|
],
|
|
|
- rateunit: [
|
|
|
- { required: true, message: '请输入单位!'},
|
|
|
- ],
|
|
|
+ // rateunit: [
|
|
|
+ // { required: true, message: '请输入单位!'},
|
|
|
+ // ],
|
|
|
begintime: [
|
|
|
{ required: true, message: '请输入费率有效期开始!'},
|
|
|
],
|
|
@@ -115,84 +174,46 @@
|
|
|
{ required: true, message: '请输入费率有效期结束!'},
|
|
|
],
|
|
|
},
|
|
|
+ validatorListRules: {
|
|
|
+ begintime: [
|
|
|
+ { required: true, message: '请选择分时开始时间!'},
|
|
|
+ ],
|
|
|
+ endtime: [
|
|
|
+ { required: true, message: '请选择分时结束时间!'},
|
|
|
+ ],
|
|
|
+ pandv: [
|
|
|
+ { required: true, message: '请选择峰平谷!'},
|
|
|
+ ],
|
|
|
+ price: [
|
|
|
+ { required: true, message: '请输入价格!'},
|
|
|
+ ],
|
|
|
+ beginamount: [
|
|
|
+ { required: true, message: '请输入起始量!'},
|
|
|
+ ],
|
|
|
+ endamount: [
|
|
|
+ { required: true, message: '请输入结束量!'},
|
|
|
+ ],
|
|
|
+ },
|
|
|
// 新增时子表默认添加几行空数据
|
|
|
addDefaultRowNum: 1,
|
|
|
refKeys: ['baseEnergyRateDetail', ],
|
|
|
tableKeys:['baseEnergyRateDetail', ],
|
|
|
activeKey: 'baseEnergyRateDetail',
|
|
|
// base_energy_rate_detail
|
|
|
- baseEnergyRateDetailTable: {
|
|
|
- loading: false,
|
|
|
- dataSource: [],
|
|
|
- columns: [
|
|
|
- {
|
|
|
- title: '分时开始时间',
|
|
|
- key: 'begintime',
|
|
|
- type: FormTypes.time,
|
|
|
- width:"190px",
|
|
|
- placeholder: '请输入${title}',
|
|
|
- defaultValue:'',
|
|
|
- validateRules: [{ required: true, message: '${title}不能为空' }],
|
|
|
- },
|
|
|
- {
|
|
|
- title: '分时结束时间',
|
|
|
- key: 'endtime',
|
|
|
- type: FormTypes.time,
|
|
|
- width:"190px",
|
|
|
- placeholder: '请输入${title}',
|
|
|
- defaultValue:'',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '峰平谷',
|
|
|
- key: 'pandv',
|
|
|
- type: FormTypes.select,
|
|
|
- width:"190px",
|
|
|
- placeholder: '请选择${title}',
|
|
|
- defaultValue: '',
|
|
|
- validateRules: [{ required: true, message: '${title}不能为空' }],
|
|
|
- options: [
|
|
|
- {title:'尖',value:'尖'},
|
|
|
- {title:'峰',value:'峰'},
|
|
|
- {title:'谷',value:'谷'},
|
|
|
- {title:'平',value:'平'}
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- title: '价格',
|
|
|
- key: 'price',
|
|
|
- type: FormTypes.input,
|
|
|
- width:"190px",
|
|
|
- placeholder: '请输入${title}',
|
|
|
- defaultValue:'',
|
|
|
- validateRules: [{ required: true, message: '${title}不能为空' }],
|
|
|
- },
|
|
|
- {
|
|
|
- title: '起始量',
|
|
|
- key: 'beginamount',
|
|
|
- type: FormTypes.input,
|
|
|
- width:"190px",
|
|
|
- placeholder: '请输入${title}',
|
|
|
- defaultValue:'',
|
|
|
- validateRules: [{ required: true, message: '${title}不能为空' }],
|
|
|
- },
|
|
|
- {
|
|
|
- title: '结束量',
|
|
|
- key: 'endamount',
|
|
|
- type: FormTypes.input,
|
|
|
- width:"190px",
|
|
|
- placeholder: '请输入${title}',
|
|
|
- defaultValue:'',
|
|
|
- // validateRules: [{ required: true, message: '${title}不能为空' }],
|
|
|
- },
|
|
|
- ]
|
|
|
- },
|
|
|
+ // model: {
|
|
|
+ // loading: false,
|
|
|
+ // data: [],
|
|
|
+ // columns1: []
|
|
|
+ // },
|
|
|
url: {
|
|
|
add: "/energyRate/energyRate/add",
|
|
|
edit: "/energyRate/energyRate/edit",
|
|
|
baseEnergyRateDetail: {
|
|
|
list: '/energyRate/energyRate/queryDetailByMainId'
|
|
|
},
|
|
|
- }
|
|
|
+ },
|
|
|
+ count: 1,
|
|
|
+ ratetype: ''
|
|
|
}
|
|
|
},
|
|
|
props: {
|
|
@@ -212,7 +233,7 @@
|
|
|
},
|
|
|
methods: {
|
|
|
addBefore(){
|
|
|
- this.baseEnergyRateDetailTable.dataSource=[]
|
|
|
+ this.model.data=[]
|
|
|
},
|
|
|
getAllTable() {
|
|
|
let values = this.tableKeys.map(key => getRefPromise(this, key))
|
|
@@ -225,7 +246,7 @@
|
|
|
// 加载子表数据
|
|
|
if (this.model.id) {
|
|
|
let params = { id: this.model.id }
|
|
|
- this.requestSubTableData(this.url.baseEnergyRateDetail.list, params, this.baseEnergyRateDetailTable)
|
|
|
+ this.requestSubTableData(this.url.baseEnergyRateDetail.list, params, this.model)
|
|
|
}
|
|
|
},
|
|
|
//校验所有一对一子表表单
|
|
@@ -261,7 +282,143 @@
|
|
|
this.$emit('close')
|
|
|
this.$refs.form.clearValidate();
|
|
|
},
|
|
|
-
|
|
|
+ // 获取选中的费率类型
|
|
|
+ handleChangeType(value){
|
|
|
+ console.log(99,value)
|
|
|
+ if (value == '') {
|
|
|
+ // this.model.columns1 = []
|
|
|
+ this.model.data = []
|
|
|
+ this.count = 1
|
|
|
+ this.ratetype = ''
|
|
|
+ }
|
|
|
+ if (value != this.ratetype) {
|
|
|
+ this.model.data = []
|
|
|
+ this.count = 1
|
|
|
+ }
|
|
|
+ if (value == 1) {
|
|
|
+ this.ratetype = value
|
|
|
+ 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' }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ this.model.data.push({
|
|
|
+ key: this.count + '',
|
|
|
+ begintime: '',
|
|
|
+ endtime: '',
|
|
|
+ pandv: '',
|
|
|
+ price: '',
|
|
|
+ beginamount: '',
|
|
|
+ endamount: ''
|
|
|
+ })
|
|
|
+ this.count++
|
|
|
+ }
|
|
|
+ if (value == 2) {
|
|
|
+ this.ratetype = value
|
|
|
+ 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.data.push({
|
|
|
+ key: this.count + '',
|
|
|
+ begintime: '',
|
|
|
+ endtime: '',
|
|
|
+ pandv: '',
|
|
|
+ price: '',
|
|
|
+ beginamount: '',
|
|
|
+ endamount: ''
|
|
|
+ })
|
|
|
+ this.count++
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 创建一条新数据
|
|
|
+ newMember() {
|
|
|
+ console.log(this.model.ratetype)
|
|
|
+ if (this.model.ratetype == undefined) {
|
|
|
+ this.$message.warning('请先选择费率类型');
|
|
|
+ } else {
|
|
|
+ this.model.data.push({
|
|
|
+ key: this.count + '',
|
|
|
+ begintime: '',
|
|
|
+ endtime: '',
|
|
|
+ pandv: '',
|
|
|
+ price: '',
|
|
|
+ beginamount: '',
|
|
|
+ endamount: ''
|
|
|
+ })
|
|
|
+ this.count++
|
|
|
+ }
|
|
|
+ },
|
|
|
+ remove(key) {
|
|
|
+ console.log(key)
|
|
|
+ const newData = this.model.data.filter(item => item.key !== key)
|
|
|
+ this.model.data = newData
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|