8.19 下午提交

master
zz 3 months ago
parent 62e90e9b81
commit ac3db5c053

@ -269,7 +269,7 @@ const resetForm = () => {
async function getbillingDateData(){ async function getbillingDateData(){
const data = await ElectricityDateApi.getElectricityDatenew({modeId:props.selectId})//id const data = await ElectricityDateApi.getElectricityDatenew({modeId:props.selectId})//id
// const data = await ElectricityDateApi.getElectricityDatePage({modelId:props.selectId}) // const data = await ElectricityDateApi.getElectricityDatePage({modelId:props.selectId})
console.log(data,"----------") // console.log(data,"----------")
billingDateData.value=data||[] billingDateData.value=data||[]
} }

@ -17,7 +17,25 @@
class="!w-200px" class="!w-200px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="换电服务单价" prop="price"> <el-form-item label="计费模型名称" prop="billingDateId">
<el-select v-model="queryParams.billingDateId" style="width: 100%;">
<el-option
v-for="item in namelist"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
<!-- <el-input
v-model="queryParams.name"
placeholder="请输入计费模型名称"
clearable
@keyup.enter="handleQuery"
class="!w-200px"
/> -->
</el-form-item>
<!-- <el-form-item label="换电服务单价" prop="price">
<el-input <el-input
v-model="queryParams.price" v-model="queryParams.price"
placeholder="请输入换电服务单价" placeholder="请输入换电服务单价"
@ -25,7 +43,7 @@
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
class="!w-200px" class="!w-200px"
/> />
</el-form-item> </el-form-item> -->
<!-- <el-form-item label="是否启用:0启用;1禁用" prop="status"> <!-- <el-form-item label="是否启用:0启用;1禁用" prop="status">
@ -43,7 +61,7 @@
<el-form-item label="开始时刻" prop="startTime"> <!-- <el-form-item label="开始时刻" prop="startTime">
<el-date-picker <el-date-picker
v-model="queryParams.startTime" v-model="queryParams.startTime"
value-format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
@ -64,7 +82,7 @@
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-200px" class="!w-200px"
/> />
</el-form-item> </el-form-item> -->
<el-form-item> <el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
@ -98,7 +116,12 @@
<!-- <el-table-column label="索引" align="center" prop="id" /> --> <!-- <el-table-column label="索引" align="center" prop="id" /> -->
<el-table-column label="计费模型名称" align="center" prop="name" /> <el-table-column label="计费模型名称" align="center" prop="name" />
<!-- <el-table-column label="计费模型id" align="center" prop="billingModelId" /> --> <!-- <el-table-column label="计费模型id" align="center" prop="billingModelId" /> -->
<el-table-column label="换电服务单价" align="center" prop="price" /> <el-table-column label="换电服务单价" align="center" prop="price" >
<template #defaluut="scope">
{{scope.price / 100}}
</template>
</el-table-column>
<el-table-column label="电池服务费" align="center" prop="batFee" /> <el-table-column label="电池服务费" align="center" prop="batFee" />
<el-table-column label="平台服务费" align="center" prop="platformFee" /> <el-table-column label="平台服务费" align="center" prop="platformFee" />
<el-table-column label="是否启用" align="center" prop="status" > <el-table-column label="是否启用" align="center" prop="status" >
@ -158,7 +181,8 @@
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import download from '@/utils/download' import download from '@/utils/download'
import { BillingTimeApi, BillingTimeVO } from '@/api/operationsManagement/billingModel/timeModel' import { BillingTimeApi, BillingTimeVO } from '@/api/operationsManagement/billingModel/timeModel'
//
import { ElectricityDateApi, ElectricityDateVO } from '@/api/operationsManagement/billingModel/monthModel'
// import modelTimeForm from './hoursAndMinutes/modelTimeForm.vue' // import modelTimeForm from './hoursAndMinutes/modelTimeForm.vue'
/** 换电计费分时模型 列表 */ /** 换电计费分时模型 列表 */
@ -174,6 +198,7 @@
const { t } = useI18n() // const { t } = useI18n() //
const loading = ref(true) // const loading = ref(true) //
const namelist = ref('') //
const list = ref<BillingTimeVO[]>([]) // const list = ref<BillingTimeVO[]>([]) //
// //
const total = ref(0) const total = ref(0)
@ -255,7 +280,12 @@
exportLoading.value = false exportLoading.value = false
} }
} }
async function getbillingDateData(){
const data = await ElectricityDateApi.getElectricityDatenew({modeId:props.selectId})//id
namelist.value=data||[]
}
/** 初始化 **/ /** 初始化 **/
// onMounted(() => { // onMounted(() => {
// getList() // getList()
@ -264,6 +294,7 @@
watch(()=>props.selectId,async(newValue)=>{ watch(()=>props.selectId,async(newValue)=>{
getList() getList()
getbillingDateData()
},{ },{
deep:true, deep:true,
immediate:true immediate:true

@ -33,10 +33,10 @@
<el-form-item> <el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<!-- <el-button type="primary" plain @click="openForm('create')"> <el-button type="primary" plain @click="openFormone('create')">
<Icon icon="ep:plus" class="mr-5px" /> 新增 <Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button> </el-button>
<el-button type="success" plain @click="handleExport" :loading="exportLoading"> <!-- <el-button type="success" plain @click="handleExport" :loading="exportLoading">
<Icon icon="ep:download" class="mr-5px" /> 导出 <Icon icon="ep:download" class="mr-5px" /> 导出
</el-button> --> </el-button> -->
</el-form-item> </el-form-item>
@ -113,6 +113,8 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BillingModelForm ref="formRef" @success="getList" /> <BillingModelForm ref="formRef" @success="getList" />
<!-- 模型的新增 -->
<YuanForm ref="formRefone" @success="getList" />
<!-- 详情 --> <!-- 详情 -->
<billingModelDetails ref="detailRef" /> <billingModelDetails ref="detailRef" />
</template> </template>
@ -125,6 +127,7 @@ import download from '@/utils/download'
import { BillingModelApi, BillingModelVO } from '@/api/operationsManagement/billingModel' import { BillingModelApi, BillingModelVO } from '@/api/operationsManagement/billingModel'
import BillingModelForm from './BillingModelForm.vue' import BillingModelForm from './BillingModelForm.vue'
import billingModelDetails from './billingModelDetails.vue' import billingModelDetails from './billingModelDetails.vue'
import YuanForm from './YuanForm.vue'
/** 换电计费模型 列表 */ /** 换电计费模型 列表 */
defineOptions({ name: 'BillingModel' }) defineOptions({ name: 'BillingModel' })
@ -182,6 +185,11 @@ const formRef = ref()
const openForm = (type: string, id?: number) => { const openForm = (type: string, id?: number) => {
formRef.value.open(type, id) formRef.value.open(type, id)
} }
/** 添加*/
const formRefone = ref()
const openFormone = (type: string, id?: number) => {
formRefone.value.open(type, id)
}
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {

@ -63,7 +63,7 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="电价模型名称" prop="dateId"> <el-form-item label="计费模型月名称" prop="dateId">
<el-select v-model="formData.dateId" style="width: 100%;"> <el-select v-model="formData.dateId" style="width: 100%;">
<el-option <el-option
v-for="item in dateId" v-for="item in dateId"

@ -6,17 +6,26 @@
:model="queryParams" :model="queryParams"
ref="queryFormRef" ref="queryFormRef"
:inline="true" :inline="true"
label-width="100px" label-width="110px"
> >
<el-form-item label="计费模型名称" prop="name"> <el-form-item label="计费模型月名称" prop="name">
<el-input <el-select v-model="queryParams.dateId" style="width: 100%;">
<el-option
v-for="item in namelist"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
<!-- <el-input
v-model="queryParams.name" v-model="queryParams.name"
placeholder="请输入计费模型名称" placeholder="请输入计费模型名称"
clearable clearable
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
class="!w-200px" class="!w-200px"
/> /> -->
</el-form-item> </el-form-item>
<!-- <el-form-item label="1尖2峰3平4谷" prop="type"> <!-- <el-form-item label="1尖2峰3平4谷" prop="type">
<el-select <el-select
@ -41,7 +50,7 @@
<el-form-item> <el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<el-button <!-- <el-button
type="primary" type="primary"
plain plain
@click="openForm('create')" @click="openForm('create')"
@ -57,7 +66,7 @@
> >
<Icon icon="ep:download" class="mr-5px" /> 导出 <Icon icon="ep:download" class="mr-5px" /> 导出
</el-button> </el-button> -->
</el-form-item> </el-form-item>
</el-form> </el-form>
</ContentWrap> </ContentWrap>
@ -74,17 +83,17 @@
<el-table-column label="尖电价开始时刻" align="center" prop="startTime" /> <el-table-column label="尖电价开始时刻" align="center" prop="startTime" />
<el-table-column label="尖电价结束时刻" align="center" prop="endTime" /> <el-table-column label="尖电价结束时刻" align="center" prop="endTime" />
<el-table-column label="电价模型id" align="center" prop="electric5ityModelId" /> <!-- <el-table-column label="电价模型id" align="center" prop="electric5ityModelId" /> -->
<el-table-column label="操作" align="center" width="120" fixed="right"> <el-table-column label="操作" align="center" width="120" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <!-- <el-button
link link
type="primary" type="primary"
@click="openForm('update', scope.row.id)" @click="openForm('update', scope.row.id)"
> >
编辑 编辑
</el-button> </el-button> -->
<el-button <el-button
link link
type="danger" type="danger"
@ -114,7 +123,8 @@ import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download' import download from '@/utils/download'
import { ElectricityTimeApi, ElectricityTimeVO } from '@/api/operationsManagement/electricityPriceModel/timeModel' import { ElectricityTimeApi, ElectricityTimeVO } from '@/api/operationsManagement/electricityPriceModel/timeModel'
import ElectricityTimeForm from './ElectricityTimeForm.vue' import ElectricityTimeForm from './ElectricityTimeForm.vue'
//
import { ElectricityDateApi, ElectricityDateVO } from '@/api/operationsManagement/electricityPriceModel/monthModel'
/** 电价模型小时 列表 */ /** 电价模型小时 列表 */
defineOptions({ name: 'ElectricityTime' }) defineOptions({ name: 'ElectricityTime' })
const emit=defineEmits(["open"]) const emit=defineEmits(["open"])
@ -131,16 +141,17 @@ const loading = ref(true) // 列表的加载中
const list = ref<ElectricityTimeVO[]>([]) // const list = ref<ElectricityTimeVO[]>([]) //
// //
const total = ref(0) const total = ref(0)
const namelist = ref('')
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
dateId: props.selectId, dateId:undefined ,
name: undefined, name: undefined,
type: undefined, type: undefined,
startTime: [], startTime: [],
endTime: [], endTime: [],
createTime: [], createTime: [],
electricityModelId:undefined, electricityModelId:props.selectId,
}) })
const queryFormRef = ref() // const queryFormRef = ref() //
const exportLoading = ref(false) // const exportLoading = ref(false) //
@ -149,7 +160,7 @@ const exportLoading = ref(false) // 导出的加载中
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
try { try {
queryParams.dateId=props.selectId queryParams.electricityModelId=props.selectId
const data = await ElectricityTimeApi.getElectricityTimePage(queryParams) const data = await ElectricityTimeApi.getElectricityTimePage(queryParams)
list.value = data.list list.value = data.list
total.value = data.total total.value = data.total
@ -209,8 +220,18 @@ defineExpose({ getList })
// onMounted(() => { // onMounted(() => {
// getList() // getList()
// }) // })
async function getbillingDateData(){
// const data = await ElectricityDateApi.getElectricityDatenew({modelId:props.selectId})
const data = await ElectricityDateApi.getElectricityList({modeId:props.selectId})
// console.log(data,"-++++++++++-")
namelist.value=data||[]
// electricityModel.value=data||[]
}
watch(()=>props.selectId,async(newValue)=>{ watch(()=>props.selectId,async(newValue)=>{
getList() getList()
getbillingDateData()
},{ },{
deep:true, deep:true,
immediate:true immediate:true

@ -104,10 +104,11 @@
<el-table-column label="序列" align="center" prop="no" /> --> <el-table-column label="序列" align="center" prop="no" /> -->
<el-table-column label="开始日期" align="center" prop="startDate" /> <el-table-column label="开始日期" align="center" prop="startDate" />
<el-table-column label="结束日期" align="center" prop="endDate" /> <el-table-column label="结束日期" align="center" prop="endDate" />
<el-table-column label="尖电价" align="center" prop="theTipPrice" /> <el-table-column label="尖电价(元)" align="center" prop="theTipPrice" />
<el-table-column label="峰电价" align="center" prop="peakPrice" />
<el-table-column label="平电价" align="center" prop="flatPrice" /> <el-table-column label="峰电价(元)" align="center" prop="peakPrice" />
<el-table-column label="谷电价" align="center" prop="theValleyPrice" /> <el-table-column label="平电价(元)" align="center" prop="flatPrice" />
<el-table-column label="谷电价(元)" align="center" prop="theValleyPrice" />
<!-- <el-table-column label="是否启用:0启用;1禁用" align="center" prop="status" /> --> <!-- <el-table-column label="是否启用:0启用;1禁用" align="center" prop="status" /> -->
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark" />
<!-- <el-table-column label="数据来源:0:云平台;1;三方运营商" align="center" prop="source" /> <!-- <el-table-column label="数据来源:0:云平台;1;三方运营商" align="center" prop="source" />
@ -115,14 +116,14 @@
<el-table-column label="操作" align="center" width="120" fixed="right"> <el-table-column label="操作" align="center" width="120" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <!-- <el-button
link link
type="primary" type="primary"
@click="openForm('update', scope.row.id)" @click="openForm('update', scope.row.id)"
> >
编辑 编辑
</el-button> </el-button> -->
<el-button <el-button
link link
type="danger" type="danger"

@ -21,9 +21,9 @@
<el-form-item> <el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<!-- <el-button type="primary" plain @click="openForm('create')"> <el-button type="primary" plain @click="openFormone('create')">
<Icon icon="ep:plus" class="mr-5px" /> 新增 <Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button> --> </el-button>
<!-- <el-button type="success" plain @click="handleExport" :loading="exportLoading"> <!-- <el-button type="success" plain @click="handleExport" :loading="exportLoading">
<Icon icon="ep:download" class="mr-5px" /> 导出 <Icon icon="ep:download" class="mr-5px" /> 导出
</el-button> --> </el-button> -->
@ -89,6 +89,7 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<ElectricityPriceForm ref="formRef" @success="getList" /> <ElectricityPriceForm ref="formRef" @success="getList" />
<yuanForm ref="formRefone" @success="getList" />
<!-- 详情 --> <!-- 详情 -->
<electricityPriceModelDetails ref="detailRef" /> <electricityPriceModelDetails ref="detailRef" />
</template> </template>
@ -102,6 +103,7 @@ import {
} from '@/api/operationsManagement/electricityPriceModel' } from '@/api/operationsManagement/electricityPriceModel'
import ElectricityPriceForm from './ElectricityPriceForm.vue' import ElectricityPriceForm from './ElectricityPriceForm.vue'
import electricityPriceModelDetails from './electricityPriceModelDetails.vue' import electricityPriceModelDetails from './electricityPriceModelDetails.vue'
import yuanForm from './yuanForm.vue'
/** 电价模型 列表 */ /** 电价模型 列表 */
defineOptions({ name: 'ElectricityPrice' }) defineOptions({ name: 'ElectricityPrice' })
@ -159,6 +161,10 @@ const formRef = ref()
const openForm = (type: string, id?: number) => { const openForm = (type: string, id?: number) => {
formRef.value.open(type, id) formRef.value.open(type, id)
} }
const formRefone = ref()
const openFormone = (type: string, id?: number) => {
formRefone.value.open(type, id)
}
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {

@ -10,7 +10,7 @@
<el-form-item label="计费模型名称" prop="name"> <el-form-item label="计费模型名称" prop="name">
<el-input v-model="formData.name" placeholder="请输入计费模型名称" /> <el-input v-model="formData.name" placeholder="请输入计费模型名称" />
</el-form-item> </el-form-item>
<el-form-item label="尖电价" prop="theTipPrice"> <!-- <el-form-item label="尖电价" prop="theTipPrice">
<el-input v-model="formData.theTipPrice" placeholder="请输入尖电价" /> <el-input v-model="formData.theTipPrice" placeholder="请输入尖电价" />
</el-form-item> </el-form-item>
<el-form-item label="峰电价" prop="peakPrice"> <el-form-item label="峰电价" prop="peakPrice">
@ -30,7 +30,7 @@
</el-form-item> </el-form-item>
<el-form-item label="运营商id" prop="operatorId"> <el-form-item label="运营商id" prop="operatorId">
<el-input v-model="formData.operatorId" placeholder="请输入运营商id" /> <el-input v-model="formData.operatorId" placeholder="请输入运营商id" />
</el-form-item> </el-form-item> -->
</el-form> </el-form>
<template #footer> <template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button> <el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>

@ -22,11 +22,11 @@
<el-form-item> <el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<el-button <!-- <el-button
type="primary" type="primary"
plain plain
@click="openForm('create')" @click="openForm('create')"
v-hasPermi="['cloud:run-model-detail:create']"
> >
<Icon icon="ep:plus" class="mr-5px" /> 新增 <Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button> </el-button>
@ -35,10 +35,10 @@
plain plain
@click="handleExport" @click="handleExport"
:loading="exportLoading" :loading="exportLoading"
v-hasPermi="['cloud:run-model-detail:export']"
> >
<Icon icon="ep:download" class="mr-5px" /> 导出 <Icon icon="ep:download" class="mr-5px" /> 导出
</el-button> </el-button> -->
</el-form-item> </el-form-item>
</el-form> </el-form>
</ContentWrap> </ContentWrap>
@ -60,14 +60,14 @@
<el-table-column label="结束时刻" align="center" prop="endTime" /> <el-table-column label="结束时刻" align="center" prop="endTime" />
<el-table-column label="操作" align="center" width="120" fixed="right"> <el-table-column label="操作" align="center" width="120" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button <!-- <el-button
link link
type="primary" type="primary"
@click="openForm('update', scope.row.id)" @click="openForm('update', scope.row.id)"
> >
编辑 编辑
</el-button> </el-button> -->
<el-button <el-button
link link
type="danger" type="danger"

@ -21,15 +21,15 @@
<el-form-item> <el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<!-- <el-button <el-button
type="primary" type="primary"
plain plain
@click="openForm('create')" @click="openFormone('create')"
v-hasPermi="['cloud:run-model:create']"
> >
<Icon icon="ep:plus" class="mr-5px" /> 新增 <Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button> </el-button>
<el-button <!-- <el-button
type="success" type="success"
plain plain
@click="handleExport" @click="handleExport"
@ -104,6 +104,8 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<RunModelForm ref="formRef" @success="getList" /> <RunModelForm ref="formRef" @success="getList" />
<!-- 模型新增 -->
<yuanForm ref="formRefone" @success="getList" />
<!-- 详情 --> <!-- 详情 -->
<RunModelDetails ref="detailRef" /> <RunModelDetails ref="detailRef" />
</template> </template>
@ -114,6 +116,7 @@
import { RunModelApi, RunModelVO } from '@/api/operationsManagement/operationalModel' import { RunModelApi, RunModelVO } from '@/api/operationsManagement/operationalModel'
import RunModelForm from './RunModelForm.vue' import RunModelForm from './RunModelForm.vue'
import RunModelDetails from './RunModelDetails.vue' import RunModelDetails from './RunModelDetails.vue'
import yuanForm from './yuanForm.vue'
/** 场站运营模型 列表 */ /** 场站运营模型 列表 */
defineOptions({ name: 'RunModel' }) defineOptions({ name: 'RunModel' })
@ -166,6 +169,10 @@ const detailRef = ref()
const openForm = (type: string, id?: number) => { const openForm = (type: string, id?: number) => {
formRef.value.open(type, id) formRef.value.open(type, id)
} }
const formRefone = ref()
const openFormone = (type: string, id?: number) => {
formRefone.value.open(type, id)
}
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {

@ -0,0 +1,102 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="120px"
v-loading="formLoading"
>
<el-form-item label="运营模型名称" prop="name">
<el-input v-model="formData.name" placeholder="请输入运营模型名称" />
</el-form-item>
<!-- <el-form-item label="运营商id" prop="operatorId">
<el-input v-model="formData.operatorId" placeholder="请输入运营商id" />
</el-form-item>
<el-form-item label="时段数" prop="periodsAmount">
<el-input v-model="formData.periodsAmount" placeholder="请输入时段数" />
</el-form-item> -->
</el-form>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { RunModelApi, RunModelVO } from '@/api/operationsManagement/operationalModel'
/** 场站运营模型 表单 */
defineOptions({ name: 'RunModelForm' })
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
name: undefined,
operatorId: undefined,
periodsAmount: undefined,
})
const formRules = reactive({
name: [{ required: true, message: '运营模型名称不能为空', trigger: 'blur' }],
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await RunModelApi.getRunModel(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
await formRef.value.validate()
//
formLoading.value = true
try {
const data = formData.value as unknown as RunModelApi.RunModelVO
if (formType.value === 'create') {
await RunModelApi.createRunModel(data)
message.success(t('common.createSuccess'))
} else {
await RunModelApi.updateRunModel(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
name: undefined,
operatorId: undefined,
periodsAmount: undefined,
}
formRef.value?.resetFields()
}
</script>
Loading…
Cancel
Save