|
@@ -63,32 +63,39 @@
|
|
|
>
|
|
|
|
|
|
<template slot="begintime" slot-scope="text, record,index">
|
|
|
- <a-form-model-item :prop="'data.'+index+'.begintime'" :rules="validatorListRules.begintime" style="margin-bottom: 0px;">
|
|
|
+ <a-form-model-item :prop="'data.'+index+'.begintime'" :rules="validatorRules.begintime2" 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-form-model-item :prop="'data.'+index+'.endtime'" :rules="validatorRules.endtime2" 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 :prop="'data.'+index+'.pandv'" :rules="validatorRules.pandv" style="margin-bottom: 0px;">
|
|
|
+ <!-- <j-dict-select-tag type="list" v-model="record.pandv" dictCode="ems_pandv" placeholder="请选择峰平谷" style="width: 100%" /> -->
|
|
|
+ <a-select
|
|
|
+ v-model="record.pandv"
|
|
|
+ placeholder="请选择峰平谷"
|
|
|
+ showSearch
|
|
|
+ :filterOption="filterOption"
|
|
|
+ :options="typeOptions">
|
|
|
+ </a-select>
|
|
|
</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-form-model-item :prop="'data.'+index+'.price'" :rules="validatorRules.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-form-model-item :prop="'data.'+index+'.beginamount'" :rules="validatorRules.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-form-model-item :prop="'data.'+index+'.endamount'" :rules="validatorRules.endamount" style="margin-bottom: 0px;">
|
|
|
<a-input v-model="record.endamount" placeholder="请输入结束量" ></a-input>
|
|
|
</a-form-model-item>
|
|
|
</template>
|
|
@@ -124,6 +131,7 @@
|
|
|
import { FormTypes,getRefPromise,VALIDATE_NO_PASSED } from '@/utils/JEditableTableUtil'
|
|
|
import { JEditableTableModelMixin } from '@/mixins/JEditableTableModelMixin'
|
|
|
import { validateDuplicateValue } from '@/utils/util'
|
|
|
+ import {ajaxGetDictItems,getDictItemsFromCache} from '@/api/api'
|
|
|
|
|
|
export default {
|
|
|
name: 'EnergyRateForm',
|
|
@@ -132,6 +140,12 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ // typeOptions: [
|
|
|
+ // {label: '尖', value: 0},
|
|
|
+ // {label: '峰', value: 1},
|
|
|
+ // {label: '平', value: 2},
|
|
|
+ // {label: '谷', value: 3},
|
|
|
+ // ],
|
|
|
labelCol: {
|
|
|
xs: { span: 24 },
|
|
|
sm: { span: 6 },
|
|
@@ -175,12 +189,10 @@
|
|
|
endtime: [
|
|
|
{ required: true, message: '请输入费率有效期结束!'},
|
|
|
],
|
|
|
- },
|
|
|
- validatorListRules: {
|
|
|
- begintime: [
|
|
|
+ begintime2: [
|
|
|
{ required: true, message: '请选择分时开始时间!'},
|
|
|
],
|
|
|
- endtime: [
|
|
|
+ endtime2: [
|
|
|
{ required: true, message: '请选择分时结束时间!'},
|
|
|
],
|
|
|
pandv: [
|
|
@@ -196,6 +208,26 @@
|
|
|
{ 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', ],
|
|
@@ -215,7 +247,8 @@
|
|
|
},
|
|
|
},
|
|
|
count: 1,
|
|
|
- ratetype: ''
|
|
|
+ ratetype: '',
|
|
|
+ dictCode: 'ems_pandv'
|
|
|
}
|
|
|
},
|
|
|
props: {
|
|
@@ -232,8 +265,27 @@
|
|
|
},
|
|
|
},
|
|
|
created () {
|
|
|
+ this.initDictData()
|
|
|
},
|
|
|
methods: {
|
|
|
+ initDictData() {
|
|
|
+ //优先从缓存中读取字典配置
|
|
|
+ if(getDictItemsFromCache(this.dictCode)){
|
|
|
+ this.typeOptions = getDictItemsFromCache(this.dictCode);
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据字典Code, 初始化字典数组
|
|
|
+ ajaxGetDictItems(this.dictCode, null).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+// console.log(res.result);
|
|
|
+ this.typeOptions = res.result;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ filterOption (value, option) {
|
|
|
+ return option.componentOptions.children[0].text.indexOf(value) >= 0
|
|
|
+ },
|
|
|
addBefore(){
|
|
|
this.model.data=[]
|
|
|
},
|