水电表基本搭建完成

This commit is contained in:
Zy
2026-04-27 08:08:30 +08:00
parent ab736fa15f
commit 826b22e206
26 changed files with 2208 additions and 393 deletions

View File

@@ -39,27 +39,31 @@
<el-table v-loading="loading" border :data="chargeItemList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="项目名称" align="center" prop="name" />
<el-table-column label="计费方式" align="center" prop="billingMethod">
<el-table-column label="项目名称" align="center" prop="itemName" />
<el-table-column label="计费方式" align="center" prop="billingType">
<template #default="scope">
<dict-tag :options="com_charge_item_method" :value="scope.row.billingMethod"></dict-tag>
<dict-tag :options="com_charge_item_method" :value="scope.row.billingType"></dict-tag>
</template>
</el-table-column>
<el-table-column label="单价" align="center" prop="price">
<el-table-column label="计算公式" align="center" prop="formula">
<template #default="scope">
<dict-tag :options="com_charge_item_formula" :value="scope.row.formula"></dict-tag>
</template>
</el-table-column>
<el-table-column label="单价" align="center" prop="fixedPrice">
<template #default="scope">
{{ scope.row.price }}
<dict-tag :options="com_charge_item_unit" :value="scope.row.unit"></dict-tag>
<dict-tag :options="com_charge_item_unit" :value="scope.row.fixedPrice"></dict-tag>
</template>
</el-table-column>
<el-table-column label=" 计算方式" align="center" prop="price" />
<el-table-column label="计量单位" align="center" prop="unit">
<template #default="scope">
<dict-tag :options="com_charge_item_unit" :value="scope.row.unit"></dict-tag>
</template>
</el-table-column>
<el-table-column label="计算精度" align="center" prop="precision">
<el-table-column label="计算精度" align="center" prop="accuracy">
<template #default="scope">
<dict-tag :options="com_charge_item_precision" :value="scope.row.precision"></dict-tag>
<dict-tag :options="com_charge_item_precision" :value="scope.row.accuracy"></dict-tag>
</template>
</el-table-column>
<el-table-column label="进位方式" align="center" prop="carryMethod">
@@ -69,7 +73,14 @@
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<el-switch inactive-text="停用" active-text="启用" inactive-value="0" active-value="1" v-model="scope.row.status"></el-switch>
<el-switch
@change="(val: string) => handleSwitch(val, scope.row)"
inactive-text="停用"
active-text="启用"
inactive-value="1"
active-value="0"
v-model="scope.row.status"
></el-switch>
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
@@ -86,7 +97,7 @@
</template>
<script setup name="ChargeItem" lang="ts">
import { listChargeItem, getChargeItem, delChargeItem, addChargeItem, updateChargeItem } from '@/api/system/SdbChargeItem';
import { listChargeItem, getChargeItem, delChargeItem, addChargeItem, updateChargeItem, changChargeItem } from '@/api/system/SdbChargeItem';
import { ChargeItemVO, ChargeItemQuery, ChargeItemForm } from '@/api/system/SdbChargeItem/type';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@@ -94,6 +105,7 @@ const { com_charge_item_method } = toRefs<any>(proxy?.useDict('com_charge_item_m
const { com_charge_item_unit } = toRefs<any>(proxy?.useDict('com_charge_item_unit'));
const { com_charge_item_precision } = toRefs<any>(proxy?.useDict('com_charge_item_precision'));
const { com_charge_item_carry_method } = toRefs<any>(proxy?.useDict('com_charge_item_carry_method'));
const { com_charge_item_formula } = toRefs<any>(proxy?.useDict('com_charge_item_formula'));
const chargeItemList = ref<ChargeItemVO[]>([]);
const buttonLoading = ref(false);
@@ -204,27 +216,20 @@ const handleUpdate = async (row?: ChargeItemVO) => {
});
};
/** 提交按钮 */
const submitForm = () => {
chargeItemFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
if (form.value.id) {
await updateChargeItem(form.value).finally(() => (buttonLoading.value = false));
} else {
await addChargeItem(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
const handleSwitch = (val: string, row: ChargeItemVO) => {
console.log(val, typeof val, row);
// 1停用 0 启用
updateChargeItem({
id: row.id,
status: val
}).then(() => {
ElMessage.success('修改成功');
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: ChargeItemVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除收费项目管理编号为"' + _ids + '"的数据项').finally(() => (loading.value = false));
await proxy?.$modal.confirm('是否确认删除收费项目?').finally(() => (loading.value = false));
await delChargeItem(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();