|
@@ -20,19 +20,70 @@
|
|
|
@filter-change="handleFilterChange"
|
|
@filter-change="handleFilterChange"
|
|
|
></page-content>
|
|
></page-content>
|
|
|
|
|
|
|
|
- <!-- 新增 -->
|
|
|
|
|
- <page-modal
|
|
|
|
|
- ref="addModalRef"
|
|
|
|
|
- :modal-config="addModalConfig"
|
|
|
|
|
- @submit-click="handleSubmitClick"
|
|
|
|
|
- ></page-modal>
|
|
|
|
|
-
|
|
|
|
|
- <!-- 编辑 -->
|
|
|
|
|
- <page-modal
|
|
|
|
|
- ref="editModalRef"
|
|
|
|
|
- :modal-config="editModalConfig"
|
|
|
|
|
- @submit-click="handleSubmitClick"
|
|
|
|
|
- ></page-modal>
|
|
|
|
|
|
|
+ <!-- 编辑提示语弹窗 -->
|
|
|
|
|
+ <el-dialog
|
|
|
|
|
+ v-model="tipsDialogVisible"
|
|
|
|
|
+ :title="tipsDialogTitle"
|
|
|
|
|
+ width="500px"
|
|
|
|
|
+ draggable
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-form :model="tipsForm" label-width="100px">
|
|
|
|
|
+ <el-form-item label="充电提示语">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="tipsForm.connectorTips"
|
|
|
|
|
+ type="textarea"
|
|
|
|
|
+ :rows="4"
|
|
|
|
|
+ maxlength="500"
|
|
|
|
|
+ show-word-limit
|
|
|
|
|
+ placeholder="请输入充电提示语,如:充电减免2小时停车费"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <el-button @click="tipsDialogVisible = false">取消</el-button>
|
|
|
|
|
+ <el-button type="primary" @click="handleTipsSubmit">确定</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 按站点一键修改弹窗 -->
|
|
|
|
|
+ <el-dialog
|
|
|
|
|
+ v-model="stationTipsDialogVisible"
|
|
|
|
|
+ title="按站点一键修改提示语"
|
|
|
|
|
+ width="500px"
|
|
|
|
|
+ draggable
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-form :model="stationTipsForm" label-width="100px">
|
|
|
|
|
+ <el-form-item label="选择站点">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="stationTipsForm.stationInfoId"
|
|
|
|
|
+ placeholder="请选择站点"
|
|
|
|
|
+ filterable
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in stationOptions"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :label="item.stationName"
|
|
|
|
|
+ :value="item.id"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="充电提示语">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="stationTipsForm.connectorTips"
|
|
|
|
|
+ type="textarea"
|
|
|
|
|
+ :rows="4"
|
|
|
|
|
+ maxlength="500"
|
|
|
|
|
+ show-word-limit
|
|
|
|
|
+ placeholder="请输入充电提示语"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <el-button @click="stationTipsDialogVisible = false">取消</el-button>
|
|
|
|
|
+ <el-button type="primary" @click="handleStationTipsSubmit">确定</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -40,32 +91,140 @@
|
|
|
defineOptions({ name: "ThirdPartyEquipmentInfo" });
|
|
defineOptions({ name: "ThirdPartyEquipmentInfo" });
|
|
|
|
|
|
|
|
import ThirdPartyEquipmentInfoAPI, {
|
|
import ThirdPartyEquipmentInfoAPI, {
|
|
|
- ThirdPartyEquipmentInfoForm,
|
|
|
|
|
ThirdPartyEquipmentInfoPageQuery,
|
|
ThirdPartyEquipmentInfoPageQuery,
|
|
|
|
|
+ ConnectorTipsUpdateDTO,
|
|
|
} from "@/api/equipmentManage/third-party-equipment-info-api";
|
|
} from "@/api/equipmentManage/third-party-equipment-info-api";
|
|
|
-import type { IObject, IModalConfig, IContentConfig, ISearchConfig } from "@/components/CURD/types";
|
|
|
|
|
|
|
+import BillingStrategyAPI from "@/api/operationsManage/billing-strategy-api";
|
|
|
|
|
+import type { IObject, IContentConfig, ISearchConfig } from "@/components/CURD/types";
|
|
|
import usePage from "@/components/CURD/usePage";
|
|
import usePage from "@/components/CURD/usePage";
|
|
|
|
|
+import { ElMessage } from "element-plus";
|
|
|
|
|
|
|
|
// 组合式 CRUD
|
|
// 组合式 CRUD
|
|
|
const {
|
|
const {
|
|
|
searchRef,
|
|
searchRef,
|
|
|
contentRef,
|
|
contentRef,
|
|
|
- addModalRef,
|
|
|
|
|
- editModalRef,
|
|
|
|
|
handleQueryClick,
|
|
handleQueryClick,
|
|
|
handleResetClick,
|
|
handleResetClick,
|
|
|
handleAddClick,
|
|
handleAddClick,
|
|
|
- handleEditClick,
|
|
|
|
|
- handleSubmitClick,
|
|
|
|
|
handleExportClick,
|
|
handleExportClick,
|
|
|
handleSearchClick,
|
|
handleSearchClick,
|
|
|
handleFilterChange,
|
|
handleFilterChange,
|
|
|
} = usePage();
|
|
} = usePage();
|
|
|
|
|
|
|
|
|
|
+// 站点选项
|
|
|
|
|
+const stationOptions = ref<any[]>([]);
|
|
|
|
|
+
|
|
|
|
|
+// 获取站点列表
|
|
|
|
|
+const loadStationOptions = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const data = await BillingStrategyAPI.getChargingPileSelect();
|
|
|
|
|
+ stationOptions.value = data || [];
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error("获取站点列表失败", error);
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+onMounted(() => {
|
|
|
|
|
+ loadStationOptions();
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+// ============== 编辑提示语弹窗 ==============
|
|
|
|
|
+const tipsDialogVisible = ref(false);
|
|
|
|
|
+const tipsDialogTitle = ref("编辑提示语");
|
|
|
|
|
+const tipsForm = reactive<ConnectorTipsUpdateDTO>({
|
|
|
|
|
+ id: undefined,
|
|
|
|
|
+ ids: undefined,
|
|
|
|
|
+ connectorTips: "",
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+// 打开单个编辑弹窗
|
|
|
|
|
+const openEditTipsDialog = (row: any) => {
|
|
|
|
|
+ tipsDialogTitle.value = "编辑提示语";
|
|
|
|
|
+ tipsForm.id = row.id;
|
|
|
|
|
+ tipsForm.ids = undefined;
|
|
|
|
|
+ tipsForm.connectorTips = row.connectorTips || "";
|
|
|
|
|
+ tipsDialogVisible.value = true;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 打开批量编辑弹窗
|
|
|
|
|
+const openBatchEditTipsDialog = () => {
|
|
|
|
|
+ const selectedData = contentRef.value?.getSelectionData() || [];
|
|
|
|
|
+ if (selectedData.length === 0) {
|
|
|
|
|
+ ElMessage.warning("请先选择要修改的充电桩");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ tipsDialogTitle.value = `批量修改提示语(已选${selectedData.length}条)`;
|
|
|
|
|
+ tipsForm.id = undefined;
|
|
|
|
|
+ tipsForm.ids = selectedData.map((item: any) => item.id);
|
|
|
|
|
+ tipsForm.connectorTips = "";
|
|
|
|
|
+ tipsDialogVisible.value = true;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 提交提示语修改
|
|
|
|
|
+const handleTipsSubmit = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ await ThirdPartyEquipmentInfoAPI.updateTips(tipsForm);
|
|
|
|
|
+ ElMessage.success("修改成功");
|
|
|
|
|
+ tipsDialogVisible.value = false;
|
|
|
|
|
+ contentRef.value?.handleRefresh();
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error("修改失败", error);
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// ============== 按站点一键修改弹窗 ==============
|
|
|
|
|
+const stationTipsDialogVisible = ref(false);
|
|
|
|
|
+const stationTipsForm = reactive<ConnectorTipsUpdateDTO>({
|
|
|
|
|
+ stationInfoId: undefined,
|
|
|
|
|
+ connectorTips: "",
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+// 打开按站点修改弹窗
|
|
|
|
|
+const openStationTipsDialog = () => {
|
|
|
|
|
+ stationTipsForm.stationInfoId = undefined;
|
|
|
|
|
+ stationTipsForm.connectorTips = "";
|
|
|
|
|
+ stationTipsDialogVisible.value = true;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 提交按站点修改
|
|
|
|
|
+const handleStationTipsSubmit = async () => {
|
|
|
|
|
+ if (!stationTipsForm.stationInfoId) {
|
|
|
|
|
+ ElMessage.warning("请选择站点");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ const count = await ThirdPartyEquipmentInfoAPI.updateTips(stationTipsForm);
|
|
|
|
|
+ ElMessage.success(`修改成功,共更新${count}条记录`);
|
|
|
|
|
+ stationTipsDialogVisible.value = false;
|
|
|
|
|
+ contentRef.value?.handleRefresh();
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error("修改失败", error);
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// 搜索配置
|
|
// 搜索配置
|
|
|
const searchConfig: ISearchConfig = reactive({
|
|
const searchConfig: ISearchConfig = reactive({
|
|
|
permPrefix: "system:third-party-equipment-info",
|
|
permPrefix: "system:third-party-equipment-info",
|
|
|
formItems: [
|
|
formItems: [
|
|
|
|
|
+ {
|
|
|
|
|
+ type: "select",
|
|
|
|
|
+ label: "所属站点",
|
|
|
|
|
+ prop: "stationName",
|
|
|
|
|
+ attrs: {
|
|
|
|
|
+ placeholder: "请选择站点",
|
|
|
|
|
+ clearable: true,
|
|
|
|
|
+ filterable: true,
|
|
|
|
|
+ style: { width: "200px" },
|
|
|
|
|
+ },
|
|
|
|
|
+ options: [],
|
|
|
|
|
+ async initFn(formItem) {
|
|
|
|
|
+ const data = await BillingStrategyAPI.getChargingPileSelect();
|
|
|
|
|
+ formItem.options = (data || []).map((item: any) => ({
|
|
|
|
|
+ label: item.stationName,
|
|
|
|
|
+ value: item.stationName,
|
|
|
|
|
+ }));
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
type: "input",
|
|
type: "input",
|
|
|
label: "设备编码",
|
|
label: "设备编码",
|
|
@@ -118,8 +277,24 @@ const contentConfig: IContentConfig<ThirdPartyEquipmentInfoPageQuery> = reactive
|
|
|
pageSizes: [10, 20, 30, 50],
|
|
pageSizes: [10, 20, 30, 50],
|
|
|
},
|
|
},
|
|
|
// 工具栏配置
|
|
// 工具栏配置
|
|
|
- toolbar: ["export"],
|
|
|
|
|
|
|
+ toolbar: [
|
|
|
|
|
+ "export",
|
|
|
|
|
+ {
|
|
|
|
|
+ name: "batchEditTips",
|
|
|
|
|
+ text: "批量修改提示语",
|
|
|
|
|
+ perm: "edit",
|
|
|
|
|
+ attrs: { icon: "edit", type: "warning" },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: "stationEditTips",
|
|
|
|
|
+ text: "按站点一键修改",
|
|
|
|
|
+ perm: "edit",
|
|
|
|
|
+ attrs: { icon: "setting", type: "primary" },
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
defaultToolbar: ["refresh", "filter"],
|
|
defaultToolbar: ["refresh", "filter"],
|
|
|
|
|
+ // 导出接口
|
|
|
|
|
+ exportAction: ThirdPartyEquipmentInfoAPI.export,
|
|
|
// 表格列配置
|
|
// 表格列配置
|
|
|
cols: [
|
|
cols: [
|
|
|
{ type: "selection", width: 55, align: "center" },
|
|
{ type: "selection", width: 55, align: "center" },
|
|
@@ -145,90 +320,38 @@ const contentConfig: IContentConfig<ThirdPartyEquipmentInfoPageQuery> = reactive
|
|
|
return row.nationalStandard == 1 ? "2011" : "2015";
|
|
return row.nationalStandard == 1 ? "2011" : "2015";
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "充电提示语",
|
|
|
|
|
+ prop: "connectorTips",
|
|
|
|
|
+ minWidth: 150,
|
|
|
|
|
+ templet: "format",
|
|
|
|
|
+ formatter: (row: any) => {
|
|
|
|
|
+ return row.connectorTips || "--";
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
label: "操作",
|
|
label: "操作",
|
|
|
prop: "operation",
|
|
prop: "operation",
|
|
|
- width: 220,
|
|
|
|
|
|
|
+ width: 120,
|
|
|
templet: "tool",
|
|
templet: "tool",
|
|
|
operat: ["edit"],
|
|
operat: ["edit"],
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-// 新增配置
|
|
|
|
|
-const addModalConfig: IModalConfig<ThirdPartyEquipmentInfoForm> = reactive({
|
|
|
|
|
- // 权限前缀
|
|
|
|
|
- permPrefix: "system:third-party-equipment-info",
|
|
|
|
|
- // 主键
|
|
|
|
|
- pk: "id",
|
|
|
|
|
- // 弹窗配置
|
|
|
|
|
- dialog: {
|
|
|
|
|
- title: "新增",
|
|
|
|
|
- width: 800,
|
|
|
|
|
- draggable: true,
|
|
|
|
|
- },
|
|
|
|
|
- form: {
|
|
|
|
|
- labelWidth: 100,
|
|
|
|
|
- },
|
|
|
|
|
- // 表单项配置
|
|
|
|
|
- formItems: [
|
|
|
|
|
- {
|
|
|
|
|
- type: "input",
|
|
|
|
|
- attrs: {
|
|
|
|
|
- placeholder: "设备编码",
|
|
|
|
|
- disabled: true,
|
|
|
|
|
- },
|
|
|
|
|
- label: "设备编码",
|
|
|
|
|
- prop: "equipmentId",
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- type: "input",
|
|
|
|
|
- attrs: {
|
|
|
|
|
- placeholder: "设备名称",
|
|
|
|
|
- disabled: true,
|
|
|
|
|
- },
|
|
|
|
|
- label: "设备名称",
|
|
|
|
|
- prop: "equipmentName",
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- // 提交函数
|
|
|
|
|
- formAction: (data: ThirdPartyEquipmentInfoForm) => {
|
|
|
|
|
- if (data.id) {
|
|
|
|
|
- // 编辑
|
|
|
|
|
- return ThirdPartyEquipmentInfoAPI.update(data.id as string, data);
|
|
|
|
|
- } else {
|
|
|
|
|
- // 新增
|
|
|
|
|
- return ThirdPartyEquipmentInfoAPI.create(data);
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
-});
|
|
|
|
|
-
|
|
|
|
|
-// 编辑配置
|
|
|
|
|
-const editModalConfig: IModalConfig<ThirdPartyEquipmentInfoForm> = reactive({
|
|
|
|
|
- permPrefix: "system:third-party-equipment-info",
|
|
|
|
|
- component: "drawer",
|
|
|
|
|
- drawer: {
|
|
|
|
|
- title: "编辑",
|
|
|
|
|
- size: 500,
|
|
|
|
|
- },
|
|
|
|
|
- pk: "id",
|
|
|
|
|
- formAction(data: any) {
|
|
|
|
|
- return ThirdPartyEquipmentInfoAPI.update(data.id as string, data);
|
|
|
|
|
- },
|
|
|
|
|
- formItems: addModalConfig.formItems, // 复用新增的表单项
|
|
|
|
|
-});
|
|
|
|
|
-
|
|
|
|
|
// 处理操作按钮点击
|
|
// 处理操作按钮点击
|
|
|
const handleOperateClick = (data: IObject) => {
|
|
const handleOperateClick = (data: IObject) => {
|
|
|
if (data.name === "edit") {
|
|
if (data.name === "edit") {
|
|
|
- handleEditClick(data.row, async () => {
|
|
|
|
|
- return await ThirdPartyEquipmentInfoAPI.getFormData(data.row.id);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ openEditTipsDialog(data.row);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// 处理工具栏按钮点击(删除等)
|
|
|
|
|
|
|
+// 处理工具栏按钮点击
|
|
|
const handleToolbarClick = (name: string) => {
|
|
const handleToolbarClick = (name: string) => {
|
|
|
- console.log(name);
|
|
|
|
|
|
|
+ if (name === "batchEditTips") {
|
|
|
|
|
+ openBatchEditTipsDialog();
|
|
|
|
|
+ } else if (name === "stationEditTips") {
|
|
|
|
|
+ openStationTipsDialog();
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|