7/10 缴费分析,人员分析 数据对接

This commit is contained in:
Zy
2026-07-10 17:44:28 +08:00
parent 3a808750ac
commit 298f93380c
46 changed files with 1065 additions and 673 deletions

View File

@@ -37,7 +37,13 @@
<el-row>
<el-col :span="12">
<el-form-item label="装修押金(元)" prop="decorationDeposit">
<el-input v-model.trim="form.decorationDeposit" placeholder="请输入装修押金" />
<el-input
type="number"
min="0"
step="0.01"
placeholder="请输入装修押金最多保留2位小数"
v-model.trim.number="form.decorationDeposit"
/>
</el-form-item>
</el-col>
</el-row>
@@ -57,7 +63,7 @@ import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { addDecoration, getDecoration, updateDecoration } from '@/api/system/Decoration';
import { useHouseStore } from '@/store/modules/house';
import { getHousePathById } from '@/utils/house';
import { validator } from '@/utils/Reg';
const houseStore = useHouseStore();
const treedata = ref([]);
@@ -68,15 +74,56 @@ const formRef = ref();
const form = ref({
'id': null,
'houseId': null,
'buildingId': null,
'unitNoId': null,
'applyName': '',
'decorationCompany': '',
'decorationContent': '',
'decorationDeposit': null
});
/**
* 通用金额校验器
* @param value 输入值
* @param type money金额 / num整数
* @returns 校验提示信息,空则校验通过
*/
const validator = (value: number | null, type: 'money' | 'num') => {
// 空值由 required 规则拦截,这里只处理有值的情况
if (value === null || value === undefined) return '';
// 转字符串处理小数位数
const strVal = String(value);
// 禁止负数
if (value < 0) return '金额不能为负数';
if (type === 'money') {
// 匹配最多两位小数
const reg = /^\d+(\.\d{1,2})?$/;
if (!reg.test(strVal)) return '金额仅支持最多两位小数';
// 限制金额上限(可按需修改)
if (value > 9999999.99) return '押金金额不能超过9999999.99元';
} else if (type === 'num') {
const reg = /^\d+$/;
if (!reg.test(strVal)) return '只能输入正整数';
}
return '';
};
const rules = {
houseId: [{ required: true, message: '请选择具体房屋', trigger: 'blur' }],
applyName: [{ required: true, message: '请输入申请人', trigger: 'blur' }],
decorationDeposit: [{ required: true, message: '请输入装修押金', trigger: 'blur' }],
decorationDeposit: [
{ required: true, message: '请输入装修押金', trigger: 'blur' },
{
validator: (rule, val, callback) => {
const msg = validator(val, 'money');
if (msg) callback(new Error(msg));
else callback();
},
trigger: ['blur', 'change']
}
],
decorationContent: [{ required: true, message: '请输入装修内容', trigger: 'blur' }]
};
const userid = ref();
@@ -85,7 +132,7 @@ const userid = ref();
const userHousepath = ref([]);
function handleChange(val: (string | number)[]) {
if (val.length >= 3) {
form.value.houseId = val.pop() as number;
form.value.houseId = val.at(2) as number;
} else {
form.value.houseId = null;
}
@@ -102,14 +149,14 @@ function getTree() {
});
}
getTree();
// TODO
function init() {
getDecoration(userid.value).then((res) => {
form.value = {
...form.value,
...res.data
};
const arr = getHousePathById(treedata.value, form.value.houseId);
userHousepath.value = arr;
userHousepath.value = [form.value.buildingId, form.value.unitNoId, form.value.houseId];
});
}