diff --git a/src/api/biz/bininfo/index.ts b/src/api/biz/bininfo/index.ts new file mode 100644 index 0000000..879090c --- /dev/null +++ b/src/api/biz/bininfo/index.ts @@ -0,0 +1,88 @@ +import request from '@/config/axios' + +// 仓位 VO +export interface BinInfoVO { + // id + id: number + // 换电站编码 + stationNo: string + // 仓位编号 + no: string + // 仓位编码 + code: string + // 仓位名称 + name: string + // 在位状态:0-不在位;1-在位;2-无效 + exists: number + // 电池编号 + batteryNo: string + // 充电机编号 + chargerNo: string + // 充电枪编号 + chargerGunNo: string + // 水冷编号 + waterCoolNo: string + // 是否有电插头;0-无电插头;1-有电插头 + elecPluginFlag: number + // 电插头状态;0-未知;1-已经连接;2-未连接 + elecPluginStatus: string + // 是否有水插头;0-无水插头;1-有水插头 + waterPluginFlag: string + // 预约锁定;0-未锁定;1-锁定 + amtLock: number + // soc + soc: number + // soe + soe: number + // soh + soh: number + // 电池入仓顺序 + batteryEnterSeq: number + // 充电状态;0-未知;1-正在充电;2-无电池;3-禁用 4-充電完成 + chargeStatus: number + // 仓位状态;0-禁用;1-启用 + status: number + // 最后结束充电时间 结束充电后更新 + lastChargeFinishTime: Date + // 缓存仓标记,0:不是 1:是 + cacheBinFlag: number + // 是否可以换电,0:不能 1:能 + canSwapFlag: number + // 是否可以充电,0:不能 1:能 + canChargeFlag: number + // 入仓时间 + inTime: Date +} + +// 仓位 API +export const BinInfoApi = { + // 查询仓位分页 + getBinInfoPage: async (params: any) => { + return await request.get({ url: `/cloud/bin-info/page`, params }) + }, + + // 查询仓位详情 + getBinInfo: async (id: number) => { + return await request.get({ url: `/cloud/bin-info/get?id=` + id }) + }, + + // 新增仓位 + createBinInfo: async (data: BinInfoVO) => { + return await request.post({ url: `/cloud/bin-info/create`, data }) + }, + + // 修改仓位 + updateBinInfo: async (data: BinInfoVO) => { + return await request.put({ url: `/cloud/bin-info/update`, data }) + }, + + // 删除仓位 + deleteBinInfo: async (id: number) => { + return await request.delete({ url: `/cloud/bin-info/delete?id=` + id }) + }, + + // 导出仓位 Excel + exportBinInfo: async (params) => { + return await request.download({ url: `/cloud/bin-info/export-excel`, params }) + }, +} diff --git a/src/api/biz/team/index.ts b/src/api/biz/team/index.ts new file mode 100644 index 0000000..3b4579c --- /dev/null +++ b/src/api/biz/team/index.ts @@ -0,0 +1,94 @@ +import request from '@/config/axios' + +// 车队 VO +export interface TeamVO { + // 编码 + id: number + // 运营商id + operatorId: number + // 队长 userid + captain: number + // 车队编码 + teamCode: string + // 车队名称 + teamName: string + // 负责人 + principal: string + // 联系方式 + contactWay: string + // 舍入模式 + roundingMode: number + // 额度限制 + limit: number + // 是否开启 + openFlag: number +} + +// 车队 API +export const TeamApi = { + // 查询车队分页 + getTeamPage: async (params: any) => { + return await request.get({ url: `/cloud/team/page`, params }) + }, + + // 查询车队详情 + getTeam: async (id: number) => { + return await request.get({ url: `/cloud/team/get?id=` + id }) + }, + + // 启用车队账户 + getTeamEnable: async (params: any) => { + return await request.get({ url: `/cloud/team/enable/${params.id}` }) + }, + + // 新增车队 + createTeam: async (data: TeamVO) => { + return await request.post({ url: `/cloud/team/create`, data }) + }, + + // 选择多辆车辆绑定 + postcheckbindVehicle: async (data: any) => { + return await request.post({ url: `/cloud/team/bindVehicle`, data }) + }, + + // 修改车队 + updateTeam: async (data: TeamVO) => { + return await request.put({ url: `/cloud/team/update`, data }) + }, + + // 删除车队 + deleteTeam: async (id: number) => { + return await request.delete({ url: `/cloud/team/delete?id=` + id }) + }, + + // 导出车队 Excel + exportTeam: async (params) => { + return await request.download({ url: `/cloud/team/export-excel`, params }) + }, + + // ==================== 子表(车队车辆信息) ==================== + + // 获得车队车辆信息分页 + getTeamVehiclePage: async (params) => { + return await request.get({ url: `/cloud/teamVehicle/page`, params }) + }, + // 新增车队车辆信息 + createTeamVehicle: async (data) => { + return await request.post({ url: `/cloud/teamVehicle/create`, data }) + }, + + // 修改车队车辆信息 + updateTeamVehicle: async (data) => { + return await request.put({ url: `/cloud/teamVehicle/update`, data }) + }, + + // 删除车队车辆信息 + deleteTeamVehicle: async (id: number) => { + return await request.delete({ url: `/cloud/teamVehicle/delete?id=` + id }) + }, + + // 获得车队车辆信息 + getTeamVehicle: async (id: number) => { + return await request.get({ url: `/cloud/teamVehicle/get?id=` + id }) + }, +} diff --git a/src/api/share/stationinfo/index.ts b/src/api/share/stationinfo/index.ts new file mode 100644 index 0000000..1458006 --- /dev/null +++ b/src/api/share/stationinfo/index.ts @@ -0,0 +1,144 @@ +import request from '@/config/axios' + +// 换电站基础信息 VO +export interface StationInfoVO { + // id + id: number + // 运营商id + operatorId: number + // 换电站编码 + stationNo: string + // 换电站名称 + stationName: string + // 换电站识别号 + stationSn: string + // 地理位置 + stationLocation: string + // 站类型 + stationType: number + // 计费模型id + sbmId: number + // 电价模型id + priceId: number + // 场站运营模型id + runId: number + // 换电站现场照片 + avatar: string + // 纬度 + latitude: string + // 经度 + longitude: string + // 区域名称 + areaName: string + // 区域编号 + areaCode: string + // 营运时间 + operationTime: Date + // 投放时间 + launchTime: Date + // 联系方式-手机号 + contactWay: string + // 服务电话,400开头 + serviceTel: string + // 联系方式-邮箱地址 + email: string + // 负责人 + principal: string + // 所属运营企业 + stationCompany: string + // 所属运营企业统一社会信用代码 + socialCreditCode: string + // 站控主机软件版本号 + stationSftVer: string + // 供应商代码 + supplierCode: string + // 云平台区域编码 + nodeId: number + // 场站服务状态:0:未知 1:换电站服务启用 2:换电站服务停用 + status: number + // 站控版本号 + version: string + // 协议版本号 + protocolVersion: string + // 设备列表版本号 + deviceVersion: string + // 场站运行模式:0:本地模式;1:云端模式 + runModel: number + // 工位分类 + staType: string + // 区域分类 + areaType: string + // 特殊配置 + specialConfig: string + // 站型类型 + type: string + // 是否小程序可见:0否;1是 + appAccess: number + // 1.计费模型(交流/直流/SOC);2.计费模型(交流);3.计费模型(直流);4.计费模型(交流) + 电网电价(直流);5.计费模型(交流) + 电网电价(交流);6.计费模型(直流) + 电网电价(交流);7.计费模型(直流) + 电网电价(直流 + settleType: number + // 站点类型 1:公共; 50:个人; 100:公交(专用)101:环卫(专用)102:物流(专用)103: 出租⻋(专用)104:分时租赁(专用)105:小区共享(专用)106:单位(专用)107:私人共享桩(专用)255:其他") + siteType: number + // 服务车型 + matchVehicles: string + // is open all hours 是否全天营业0是;1否 + oahFlag: number + // classification站点分类 1:充电站;2:换电站;3:充换电一体站 + siteClassification: number + // construction建设场所 1:居民区;2:公共机构;3:企事业单位;4:写字楼;5:工业园区;6:交通枢纽;" + "7:大型文体设施;8:城市绿地;9:大型建筑配建停车场;10:路边停车位;11:城际高速服务区;2:风景区;13:公交场站;14:加油加气站;15:出租车;255:其他 + constructionSite: number + // 电池运营模型id + batteryId: number +} + +// 换电站基础信息 API +export const StationInfoApi = { + // 查询换电站基础信息分页 + getStationInfoPage: async (params: any) => { + return await request.get({ url: `/cloud/station-info/page`, params }) + }, + + // 查询换电站基础信息列表 + getStationInfoList: async () => { + return await request.get({ url: `/cloud/station-info/list` }) + }, + + // 查询电价模型 + getBillingModelList: async () => { + return await request.get({ url: `/cloud/billing-model/list` }) + }, + + // 查询换电计费模型 + getElectricityPriceList: async () => { + return await request.get({ url: `/cloud/electricity-price/list` }) + }, + + // 查询场站模型 + getRunModelList: async () => { + return await request.get({ url: `/cloud/run-model/list` }) + }, + + // 查询换电站基础信息详情 + getStationInfo: async (id: number) => { + return await request.get({ url: `/cloud/station-info/get?id=` + id }) + }, + + // 新增换电站基础信息 + createStationInfo: async (data: StationInfoVO) => { + return await request.post({ url: `/cloud/station-info/create`, data }) + }, + + // 修改换电站基础信息 + updateStationInfo: async (data: StationInfoVO) => { + return await request.put({ url: `/cloud/station-info/update`, data }) + }, + + // 删除换电站基础信息 + deleteStationInfo: async (id: number) => { + return await request.delete({ url: `/cloud/station-info/delete?id=` + id }) + }, + + // 导出换电站基础信息 Excel + exportStationInfo: async (params) => { + return await request.download({ url: `/cloud/station-info/export-excel`, params }) + }, +} diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 348e61b..14391c7 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -101,13 +101,13 @@ export const getDictLabel = (dictType: string, value: any): string => { } export enum DICT_TYPE { - DETAIL_TYPE = 'detail_type',//1:上月订单收益 2:上月订单退款 3:跨月订单退款 - COMMISSION_STATUS = 'commission_status',//状态:0:未打款 1:未完成打款 2:已完成打款 - PAYMENT_STATUS = 'payment_status',//0 未支付 10 支付成功 20 已退款 30 支付关闭 + DETAIL_TYPE = 'detail_type',//1:上月订单收益 2:上月订单退款 3:跨月订单退款 + COMMISSION_STATUS = 'commission_status',//状态:0:未打款 1:未完成打款 2:已完成打款 + PAYMENT_STATUS = 'payment_status',//0 未支付 10 支付成功 20 已退款 30 支付关闭 STORE_STATUS = 'store_status',//zz 门店状态 0-禁用 1-启用 VEHICLE_STATUS = 'vehicle_status',//zz车辆、电池 状态 在线状态: 0-离线;1-在线 VEHICLE_STATUS_TWO = 'vehicle_status_two',//zz status车辆 状态 0-离线: 1-正常; 2-使用中;3-异常;4-停用 - CAR_RENTAL_ORDER ='car_rental_order', //zz 骑行订单状态 + CAR_RENTAL_ORDER = 'car_rental_order', //zz 骑行订单状态 REFUND_ORDER_STATUS = 'refund_order_status',//zz 退款单状态 CHECK_ORDER_STATUS = 'check_order_status',//zz退款状态 状态:1-申请中;2-退款成功;3-取消 CHECK_ORDER_STATUS_ONE = 'check_order_status_one',//zz退款单状态 状态:2-退款成功;3-取消 @@ -219,6 +219,30 @@ export enum DICT_TYPE { CRM_PERMISSION_LEVEL = 'crm_permission_level', // CRM 数据权限的级别 CRM_PRODUCT_UNIT = 'crm_product_unit', // 产品单位 CRM_FOLLOW_UP_TYPE = 'crm_follow_up_type', // 跟进方式 - + + // ----------------------------------------------------------------------------最新 + + STATIONINFO_ENABLE = 'stationInfo_enable', + CONSTRUCTIONSITE = 'constructionSite', + SITECLASSIFICATION_TYPE = 'siteClassification_type', + OAHFLAG_STATUS = 'oahFlag_status', + SITE_TYPE = 'site_type', + APPACCESS_STATUS = 'appAccess_status', + RUNMODEL_TYPE = 'runModel_type', + STATION_INFO_STATUS = 'station_info_status', + SETTLE_TYPE = 'settle_type', + EXISTS_FLAG = 'existsFlag', + ELEC_PLUGIN_FLAG = 'elecPluginFlag', + ELEC_PLUGIN_STATUS = 'elecPluginStatus', + WATER_PLUGIN_FLAG = 'waterPluginFlag', + AMT_LOCK = 'amtLock', + CHARGE_STATUS = 'chargeStatus', + POSITION_STATUS = 'position_status', + CACHE_BIN_FLAG = 'cacheBinFlag', + CAN_SWAG_CHARGE_FLAG = 'canSwag_charge_Flag', + CANOFFLINE = 'canOffline', + OPENFLAG = 'openFlag', + ROUNDINGMODE = 'roundingMode', + } diff --git a/src/views/Login/LoginForm.vue b/src/views/Login/LoginForm.vue index 6ef9340..7fcae54 100644 --- a/src/views/Login/LoginForm.vue +++ b/src/views/Login/LoginForm.vue @@ -58,7 +58,7 @@ {{ t('login.remember') }} - @@ -75,13 +75,13 @@ /> - + /> @@ -266,7 +266,7 @@ const handleLogin = async (params) => { } authUtil.setToken(res) if (!redirect.value) { - redirect.value = '/' + redirect.value = '/index' } // 判断是否为SSO登录 if (redirect.value.indexOf('sso') !== -1) { diff --git a/src/views/system/substation/binManagement/BinInfoForm.vue b/src/views/system/substation/binManagement/BinInfoForm.vue new file mode 100644 index 0000000..d9a92a3 --- /dev/null +++ b/src/views/system/substation/binManagement/BinInfoForm.vue @@ -0,0 +1,388 @@ + + diff --git a/src/views/system/substation/binManagement/index.vue b/src/views/system/substation/binManagement/index.vue index f018a53..c1d0af6 100644 --- a/src/views/system/substation/binManagement/index.vue +++ b/src/views/system/substation/binManagement/index.vue @@ -1,5 +1,305 @@ + \ No newline at end of file +import { dateFormatter } from '@/utils/formatTime' +import download from '@/utils/download' +import { BinInfoApi, BinInfoVO } from '@/api/biz/bininfo' +import { StationInfoApi, StationInfoVO } from '@/api/share/stationinfo' +import BinInfoForm from './BinInfoForm.vue' +import { getIntDictOptions, getStrDictOptions, DICT_TYPE } from '@/utils/dict' + +/** 仓位 列表 */ +defineOptions({ name: 'BinInfo' }) + +const message = useMessage() // 消息弹窗 +const { t } = useI18n() // 国际化 + +const loading = ref(true) // 列表的加载中 +const list = ref([]) // 列表的数据 +// 列表的总页数 +const total = ref(0) +const queryParams = reactive({ + pageNo: 1, + pageSize: 10, + stationNo: undefined, + no: undefined, + code: undefined, + name: undefined, + exists: undefined, + batteryNo: undefined, + chargerNo: undefined, + chargerGunNo: undefined, + waterCoolNo: undefined, + elecPluginFlag: undefined, + elecPluginStatus: undefined, + waterPluginFlag: undefined, + amtLock: undefined, + soc: undefined, + soe: undefined, + soh: undefined, + batteryEnterSeq: undefined, + chargeStatus: undefined, + status: undefined, + lastChargeFinishTime: [], + cacheBinFlag: undefined, + canSwapFlag: undefined, + canChargeFlag: undefined, + inTime: [], + createTime: [] +}) +const queryFormRef = ref() // 搜索的表单 +const exportLoading = ref(false) // 导出的加载中 + +const handle_stationNo = (data) => { + let str = '' + for (var i = 0; i < stationinfoList.value.length; i++) { + if (data == stationinfoList.value[i].stationNo) { + str = stationinfoList.value[i].stationName + } + } + return str +} + +/** 查询列表 */ +const getList = async () => { + loading.value = true + try { + const data = await BinInfoApi.getBinInfoPage(queryParams) + list.value = data.list + total.value = data.total + } finally { + loading.value = false + } +} +const stationinfoList = ref([]) +const getStationList = async () => { + try { + const data = await StationInfoApi.getStationInfoList() + // console.log(data, 'data') + stationinfoList.value = data + } finally { + } +} + +/** 搜索按钮操作 */ +const handleQuery = () => { + queryParams.pageNo = 1 + getList() +} + +/** 重置按钮操作 */ +const resetQuery = () => { + queryFormRef.value.resetFields() + handleQuery() +} + +/** 添加/修改操作 */ +const formRef = ref() +const openForm = (type: string, id?: number) => { + formRef.value.open(type, id) +} + +/** 删除按钮操作 */ +const handleDelete = async (id: number) => { + try { + // 删除的二次确认 + await message.delConfirm() + // 发起删除 + await BinInfoApi.deleteBinInfo(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} + +/** 导出按钮操作 */ +const handleExport = async () => { + try { + // 导出的二次确认 + await message.exportConfirm() + // 发起导出 + exportLoading.value = true + const data = await BinInfoApi.exportBinInfo(queryParams) + download.excel(data, '仓位.xls') + } catch { + } finally { + exportLoading.value = false + } +} + +/** 初始化 **/ +onMounted(() => { + getList() + getStationList() +}) + diff --git a/src/views/system/substation/fleetManagement/TeamForm.vue b/src/views/system/substation/fleetManagement/TeamForm.vue new file mode 100644 index 0000000..d8426c5 --- /dev/null +++ b/src/views/system/substation/fleetManagement/TeamForm.vue @@ -0,0 +1,171 @@ + + diff --git a/src/views/system/substation/fleetManagement/components/TeamVehicleForm.vue b/src/views/system/substation/fleetManagement/components/TeamVehicleForm.vue new file mode 100644 index 0000000..e48a17a --- /dev/null +++ b/src/views/system/substation/fleetManagement/components/TeamVehicleForm.vue @@ -0,0 +1,188 @@ + + \ No newline at end of file diff --git a/src/views/system/substation/fleetManagement/components/TeamVehicleList.vue b/src/views/system/substation/fleetManagement/components/TeamVehicleList.vue new file mode 100644 index 0000000..f95f0f7 --- /dev/null +++ b/src/views/system/substation/fleetManagement/components/TeamVehicleList.vue @@ -0,0 +1,145 @@ + + \ No newline at end of file diff --git a/src/views/system/substation/fleetManagement/index.vue b/src/views/system/substation/fleetManagement/index.vue index f018a53..1cd6711 100644 --- a/src/views/system/substation/fleetManagement/index.vue +++ b/src/views/system/substation/fleetManagement/index.vue @@ -1,5 +1,434 @@ + \ No newline at end of file +import { getIntDictOptions, DICT_TYPE } from '@/utils/dict' +import { dateFormatter } from '@/utils/formatTime' +import download from '@/utils/download' +import { TeamApi, TeamVO } from '@/api/biz/team' +import TeamForm from './TeamForm.vue' +import TeamVehicleList from './components/TeamVehicleList.vue' + +/** 车队 列表 */ +defineOptions({ name: 'Team' }) + +const message = useMessage() // 消息弹窗 +const { t } = useI18n() // 国际化 + +const loading = ref(true) // 列表的加载中 +const list = ref([]) // 列表的数据 +// 列表的总页数 +const total = ref(0) +const queryParams = reactive({ + pageNo: 1, + pageSize: 10, + operatorId: undefined, + captain: undefined, + teamCode: undefined, + teamName: undefined, + principal: undefined, + contactWay: undefined, + roundingMode: undefined, + limit: undefined, + createTime: [], + openFlag: undefined +}) +const bind_queryParams = reactive({ + pageNo: 1, + pageSize: 10, + vehicleType: undefined, + vehicleNo: undefined, + vehicleVin: undefined, + filerTeamFlag: true +}) +const queryFormRef = ref() // 搜索的表单 +const bind_queryFormRef = ref() // 搜索的表单 +const exportLoading = ref(false) // 导出的加载中 +const dialogVisible_binding = ref(false) // 绑定车辆的弹窗 +/** 查询列表 */ +const getList = async () => { + loading.value = true + try { + const data = await TeamApi.getTeamPage(queryParams) + list.value = data.list + total.value = data.total + } finally { + loading.value = false + } +} + +const binding_tableData = ref([]) +const bind_total = ref(0) +const get_team_list = async () => { + try { + const data = await TeamApi.getTeamVehiclePage(bind_queryParams) + // let array = [] + // data.list.map((item) => { + // if (item.teamId == null) { + // array.push(item) + // } + // }) + // console.log(array, 'array') + + binding_tableData.value = data.list + bind_total.value = data.total + } finally { + } +} + +const currentRow_id = ref([]) +const selectionChange = (rows: TeamVO[]) => { + let array = [] + array = rows.map((item) => item.id) + // console.log(array, 'array') + currentRow_id.value = array +} + +const submit_bind = async () => { + let params = { + teamId: currentRow.value.id, + vehicleIds: currentRow_id.value + } + try { + const data = await TeamApi.postcheckbindVehicle(params) + message.success('绑定成功') + dialogVisible_binding.value = false + // getList() + get_team_list() + currentRow.value.id = 0 + currentRow.value.id = params.teamId + } finally { + } +} + +/** 搜索按钮操作 */ +const handleQuery = () => { + queryParams.pageNo = 1 + getList() +} + +/** 重置按钮操作 */ +const resetQuery = () => { + queryFormRef.value.resetFields() + handleQuery() +} +const bind_resetQuery = () => { + bind_queryFormRef.value.resetFields() + get_team_list() +} + +/** 添加/修改操作 */ +const formRef = ref() +const openForm = (type: string, id?: number) => { + formRef.value.open(type, id) +} + +/** 删除按钮操作 */ +const handleDelete = async (id: number) => { + try { + // 删除的二次确认 + await message.delConfirm() + // 发起删除 + await TeamApi.deleteTeam(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} + +const handle_set_openflag = async (scope: any) => { + try { + let params = { + id: scope.row.id + } + await TeamApi.getTeamEnable(params) + // 刷新列表 + await getList() + } catch {} +} + +/** 导出按钮操作 */ +const handleExport = async () => { + try { + // 导出的二次确认 + await message.exportConfirm() + // 发起导出 + exportLoading.value = true + const data = await TeamApi.exportTeam(queryParams) + download.excel(data, '车队.xls') + } catch { + } finally { + exportLoading.value = false + } +} + +/** 选中行操作 */ +const currentRow = ref({}) // 选中行 +const handleCurrentChange = (row) => { + currentRow.value = row +} + +/** 初始化 **/ +onMounted(() => { + getList() + get_team_list() +}) + diff --git a/src/views/system/substation/siteManager/StationInfoForm.vue b/src/views/system/substation/siteManager/StationInfoForm.vue new file mode 100644 index 0000000..a3a7f7d --- /dev/null +++ b/src/views/system/substation/siteManager/StationInfoForm.vue @@ -0,0 +1,578 @@ + + diff --git a/src/views/system/substation/siteManager/index.vue b/src/views/system/substation/siteManager/index.vue index f018a53..d502a99 100644 --- a/src/views/system/substation/siteManager/index.vue +++ b/src/views/system/substation/siteManager/index.vue @@ -1,5 +1,396 @@ + \ No newline at end of file +import { dateFormatter } from '@/utils/formatTime' +import download from '@/utils/download' +import { StationInfoApi, StationInfoVO } from '@/api/share/stationinfo' +import StationInfoForm from './StationInfoForm.vue' +import { getIntDictOptions, DICT_TYPE } from '@/utils/dict' + +/** 换电站基础信息 列表 */ +defineOptions({ name: 'StationInfo' }) + +const message = useMessage() // 消息弹窗 +const { t } = useI18n() // 国际化 + +const loading = ref(true) // 列表的加载中 +const list = ref([]) // 列表的数据 +// 列表的总页数 +const total = ref(0) +const queryParams = reactive({ + pageNo: 1, + pageSize: 10, + operatorId: undefined, + stationNo: undefined, + stationName: undefined, + stationSn: undefined, + stationLocation: undefined, + stationType: undefined, + sbmId: undefined, + priceId: undefined, + runId: undefined, + avatar: undefined, + latitude: undefined, + longitude: undefined, + areaName: undefined, + areaCode: undefined, + operationTime: [], + launchTime: [], + contactWay: undefined, + serviceTel: undefined, + email: undefined, + principal: undefined, + stationCompany: undefined, + socialCreditCode: undefined, + stationSftVer: undefined, + supplierCode: undefined, + nodeId: undefined, + status: undefined, + version: undefined, + protocolVersion: undefined, + deviceVersion: undefined, + runModel: undefined, + staType: undefined, + areaType: undefined, + specialConfig: undefined, + type: undefined, + appAccess: undefined, + settleType: undefined, + siteType: undefined, + matchVehicles: undefined, + oahFlag: undefined, + siteClassification: undefined, + constructionSite: undefined, + batteryId: undefined, + enable: undefined, + createTime: [] +}) +const queryFormRef = ref() // 搜索的表单 +const exportLoading = ref(false) // 导出的加载中 + +/** 查询列表 */ +const getList = async () => { + loading.value = true + try { + const data = await StationInfoApi.getStationInfoPage(queryParams) + list.value = data.list + total.value = data.total + } finally { + loading.value = false + } +} + +const priceIdList = ref([]) +const getElectricityPriceList = async () => { + try { + const data = await StationInfoApi.getElectricityPriceList() + // console.log(data, 'data') + priceIdList.value = data + } finally { + } +} + +const sbmIdlist = ref([]) +const getBillingModelList = async () => { + try { + const data = await StationInfoApi.getBillingModelList() + // console.log(data, 'data') + sbmIdlist.value = data + } finally { + } +} + +const runIdlist = ref([]) +const getRunModelList = async () => { + try { + const data = await StationInfoApi.getRunModelList() + // console.log(data, 'data') + runIdlist.value = data + } finally { + } +} + +const handle_sbmId = (data) => { + let str = '' + for (var i = 0; i < sbmIdlist.value.length; i++) { + if (data == sbmIdlist.value[i].id) { + str = sbmIdlist.value[i].name + } + } + return str +} + +const handle_priceId = (data) => { + let str = '' + for (var i = 0; i < priceIdList.value.length; i++) { + if (data == priceIdList.value[i].id) { + str = priceIdList.value[i].name + } + } + return str +} + +const handle_runId = (data) => { + let str = '' + for (var i = 0; i < runIdlist.value.length; i++) { + if (data == runIdlist.value[i].id) { + str = runIdlist.value[i].name + } + } + return str +} + +/** 搜索按钮操作 */ +const handleQuery = () => { + queryParams.pageNo = 1 + getList() +} + +/** 重置按钮操作 */ +const resetQuery = () => { + queryFormRef.value.resetFields() + handleQuery() +} + +/** 添加/修改操作 */ +const formRef = ref() +const openForm = (type: string, id?: number) => { + formRef.value.open(type, id) +} + +/** 删除按钮操作 */ +const handleDelete = async (id: number) => { + try { + // 删除的二次确认 + await message.delConfirm() + // 发起删除 + await StationInfoApi.deleteStationInfo(id) + message.success(t('common.delSuccess')) + // 刷新列表 + await getList() + } catch {} +} + +/** 导出按钮操作 */ +const handleExport = async () => { + try { + // 导出的二次确认 + await message.exportConfirm() + // 发起导出 + exportLoading.value = true + const data = await StationInfoApi.exportStationInfo(queryParams) + download.excel(data, '换电站基础信息.xls') + } catch { + } finally { + exportLoading.value = false + } +} + +/** 初始化 **/ +onMounted(() => { + getList() + getBillingModelList() + getElectricityPriceList() + getRunModelList() +}) +