完成水电表列表

This commit is contained in:
Zy
2026-04-18 18:14:07 +08:00
parent 9a95e2b7e3
commit d0888c6afb
115 changed files with 2842 additions and 343 deletions

View File

@@ -119,6 +119,7 @@ import { useUserStore } from '@/store/modules/user';
import { CascaderValue } from 'element-plus';
import { addVillageAPI, editVillageAPI, getVillageByIdAPI, uploadVillageImageAPI } from '@/api/system/community/index';
import { communitylist_rows_type } from '@/api/system/community/type';
const route = useRoute();
const router = useRouter();
const editId = ref(route.query.id as string);
@@ -151,6 +152,7 @@ const formRef = ref();
const uploadRef = ref();
const form = ref<communitylist_rows_type>({
villageId: null,
villageName: '',
villageCode: '',
address: '',
@@ -182,7 +184,8 @@ const rules = ref({
/** 获取编辑小区的信息 */
function getCommunityinfo() {
getVillageByIdAPI(editId.value).then((res) => {
const id = Number(editId.value);
getVillageByIdAPI(id).then((res) => {
city.value = (res.data.city as string).split('/');
if (res.data.villageImageUrl) {
villageImg.value = res.data.villageImageUrl
@@ -203,6 +206,7 @@ function getCommunityinfo() {
});
}
if (isedit.value) {
console.log('编辑小区id', editId.value, typeof editId.value, Boolean(editId.value));
getCommunityinfo();
}
// 请求头
@@ -308,48 +312,47 @@ const submitForm = () => {
function submitFormInfo() {
if (form.value.managePhone.trim()) {
if (reg.phone.test(form.value.managePhone)) {
if (!reg.phone.test(form.value.managePhone)) {
ElMessage.error('请输入正确的手机号码');
return;
}
}
if (form.value.manageVx.trim()) {
if (reg.wechat.test(form.value.manageVx)) {
if (!reg.wechat.test(form.value.manageVx)) {
ElMessage.error('请输入正确的微信号');
return;
}
}
if (form.value.manageQq.trim()) {
if (reg.qq.test(form.value.manageQq)) {
if (!reg.qq.test(form.value.manageQq)) {
ElMessage.error('请输入正确的QQ号码');
return;
}
}
if (form.value.manageEmail.trim()) {
if (reg.email.test(form.value.manageEmail)) {
if (!reg.email.test(form.value.manageEmail)) {
ElMessage.error('请输入正确的邮箱号码');
return;
}
}
if (isedit.value) {
console.log('编辑小区提交的数据', form.value);
editVillageAPI<communitylist_rows_type>(form.value).then((res) => {
ElMessage.success('编辑成功');
router.push({
path: '/community'
});
cancelForm();
});
} else {
addVillageAPI<communitylist_rows_type>(form.value).then((res) => {
ElMessage.success('添加成功');
router.push({
path: '/community'
});
cancelForm();
});
}
}
const cancelForm = () => {
console.log('取消');
router.push({
path: '/community'
});
};
</script>