|
|
|
@ -8,11 +8,11 @@
|
|
|
|
|
label-position="top"
|
|
|
|
|
>
|
|
|
|
|
<el-row :gutter="24">
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<!-- <el-col :span="12">
|
|
|
|
|
<el-form-item label="分时模型(月日)id" prop="dateId">
|
|
|
|
|
<el-input v-model="formData.dateId" placeholder="请输入分时模型(月日)id" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-col> -->
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="计费模型名称" prop="name">
|
|
|
|
|
<el-input v-model="formData.name" placeholder="请输入计费模型名称" />
|
|
|
|
@ -25,8 +25,8 @@
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col> -->
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="尖电价时间范围" prop="Time">
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<!-- <el-form-item label="尖电价时间范围" prop="Time">
|
|
|
|
|
<el-time-picker
|
|
|
|
|
v-model="formData.Time"
|
|
|
|
|
is-range
|
|
|
|
@ -35,11 +35,17 @@
|
|
|
|
|
end-placeholder="结束时间"
|
|
|
|
|
value-format="HH:mm:ss"
|
|
|
|
|
/>
|
|
|
|
|
<!-- <el-form-item label="尖电价开始时刻" prop="startTime">
|
|
|
|
|
|
|
|
|
|
</el-form-item> -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="尖电价开始时刻" prop="startTime">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="formData.startTime"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="x"
|
|
|
|
|
format="hh:mm:ss"
|
|
|
|
|
value-format="hh:mm:ss"
|
|
|
|
|
placeholder="选择尖电价开始时刻"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
@ -49,14 +55,25 @@
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="formData.endTime"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="x"
|
|
|
|
|
format="hh:mm:ss"
|
|
|
|
|
value-format="hh:mm:ss"
|
|
|
|
|
placeholder="选择尖电价结束时刻"
|
|
|
|
|
/> -->
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="电价模型id" prop="electricityModelId">
|
|
|
|
|
<el-input v-model="formData.electricityModelId" placeholder="请输入电价模型id" />
|
|
|
|
|
<el-form-item label="电价模型名称" prop="electricityModel">
|
|
|
|
|
<el-select v-model="formData.electricityModelId" style="width: 100%;">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in electricityModel"
|
|
|
|
|
:key="item.id"
|
|
|
|
|
:label="item.name"
|
|
|
|
|
:value="item.id"
|
|
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
@ -70,30 +87,37 @@ import {
|
|
|
|
|
ElectricityTimeApi,
|
|
|
|
|
ElectricityTimeVO
|
|
|
|
|
} from '@/api/operationsManagement/electricityPriceModel/timeModel'
|
|
|
|
|
|
|
|
|
|
import { ElectricityDateApi, ElectricityDateVO } from '@/api/operationsManagement/electricityPriceModel/monthModel'
|
|
|
|
|
/** 电价模型小时 表单 */
|
|
|
|
|
defineOptions({ name: 'ElectricityTimeForm' })
|
|
|
|
|
|
|
|
|
|
const props=defineProps({
|
|
|
|
|
selectId:{
|
|
|
|
|
type:String,
|
|
|
|
|
default:''
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
|
|
|
|
|
|
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
|
|
|
|
const dialogTitle = ref('') // 弹窗的标题
|
|
|
|
|
const electricityModel = ref('')
|
|
|
|
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
|
|
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|
|
|
|
const formType = ref('create') // 表单的类型:create - 新增;update - 修改
|
|
|
|
|
const formData = ref({
|
|
|
|
|
id: undefined,
|
|
|
|
|
dateId: undefined,
|
|
|
|
|
dateId: props.selectId,
|
|
|
|
|
name: undefined,
|
|
|
|
|
type: undefined,
|
|
|
|
|
startTime: undefined,
|
|
|
|
|
endTime: undefined,
|
|
|
|
|
electricityModelId: undefined,
|
|
|
|
|
Time:[]
|
|
|
|
|
|
|
|
|
|
// Time:[]
|
|
|
|
|
})
|
|
|
|
|
const formRules = reactive({
|
|
|
|
|
name: [{ required: true, message: '计费模型名称不能为空', trigger: 'blur' }],
|
|
|
|
|
electricityModelId: [{ required: true, message: '电价模型id不能为空', trigger: 'blur' }]
|
|
|
|
|
electricityModelId: [{ required: true, message: '电价模型名称不能为空', trigger: 'blur' }]
|
|
|
|
|
})
|
|
|
|
|
const formRef = ref() // 表单 Ref
|
|
|
|
|
const onCencel=()=>{
|
|
|
|
@ -111,7 +135,9 @@ const open = async (type: string, id?: number) => {
|
|
|
|
|
if (id) {
|
|
|
|
|
formLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
// const res = await ElectricityTimeApi.getElectricityTime(id)
|
|
|
|
|
formData.value = await ElectricityTimeApi.getElectricityTime(id)
|
|
|
|
|
// formData.value={...res,Time:[res?.startTime,res?.endTime]}
|
|
|
|
|
} finally {
|
|
|
|
|
formLoading.value = false
|
|
|
|
|
}
|
|
|
|
@ -126,8 +152,11 @@ const submitForm = async () => {
|
|
|
|
|
await formRef.value.validate()
|
|
|
|
|
// 提交请求
|
|
|
|
|
formLoading.value = true
|
|
|
|
|
formData.value.dateId=props.selectId
|
|
|
|
|
try {
|
|
|
|
|
const data = formData.value as unknown as ElectricityTimeApi.ElectricityTimeVO
|
|
|
|
|
// data.startTime=formData.value.Time[0]
|
|
|
|
|
// data.endTime=formData.value.Time[1]
|
|
|
|
|
if (formType.value === 'create') {
|
|
|
|
|
await ElectricityTimeApi.createElectricityTime(data)
|
|
|
|
|
message.success(t('common.createSuccess'))
|
|
|
|
@ -157,12 +186,20 @@ const resetForm = () => {
|
|
|
|
|
formRef.value?.resetFields()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// watch(()=>props.selectId,async(newValue)=>{
|
|
|
|
|
// console.log('newValue',newValue)
|
|
|
|
|
// getbillingDateData()
|
|
|
|
|
async function getbillingDateData(){
|
|
|
|
|
// const data = await ElectricityDateApi.getElectricityDatenew({modelId:props.selectId})
|
|
|
|
|
const data = await ElectricityDateApi.getElectricityDatePage({priceId:props.selectId})
|
|
|
|
|
// console.log(data,"-++++++++++-")
|
|
|
|
|
electricityModel.value=data.list||[]
|
|
|
|
|
|
|
|
|
|
// },{
|
|
|
|
|
// deep:true,
|
|
|
|
|
// immediate:true
|
|
|
|
|
// })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
watch(()=>props.selectId,async(newValue)=>{
|
|
|
|
|
console.log('newValue',newValue)
|
|
|
|
|
getbillingDateData()
|
|
|
|
|
|
|
|
|
|
},{
|
|
|
|
|
deep:true,
|
|
|
|
|
immediate:true
|
|
|
|
|
})
|
|
|
|
|
</script>
|