This commit is contained in:
lcw
2026-03-24 12:18:39 +08:00
parent c181530639
commit 60de16032f
49 changed files with 16031 additions and 12706 deletions

View File

@ -6,38 +6,26 @@
<el-button type="primary" v-if="showBut" :disabled="disabled" @click="submit">保存</el-button>
</div>
<div>
<FormMessage :disabled="disabled" v-model="listQuery" :formList="formData" labelWidth="100px" ref="elform"
<FormMessage :disabled="disabled" v-model="listQuery" :formList="formData" labelWidth="130px" ref="elform"
:rules="rules">
<template #ryzp>
<div style="width: 100%; padding-left: 50px">
<MOSTY.Upload :showBtn="false" :limit="1" v-model="listQuery.ryzp" />
</div>
</template>
<template #ryLxdh>
<div class="phone-input-container">
<div class="inputGroup" v-for="(item, index) in listQuery.ryLxdh" :key="index">
<el-input v-model="listQuery.ryLxdh[index]" class="group" placeholder="请输入电话号码" />
<div class="flex align-center but">
<el-button type="primary" :icon="Plus" circle @click="addPhone" title="添加电话号码"
v-if="listQuery.ryLxdh.length - 1 == index" />
<el-button type="success" :icon="Minus" circle @click="removePhone(index)" title="删除电话号码" />
</div>
</div>
</div>
</template>
<template #gkmjxm>
<template #gkMjXm>
<div>
<el-input v-model="listQuery.gkmjxm" class="group" placeholder="请输入管控民警姓名" readonly
<el-input v-model="listQuery.gkMjXm" class="group" placeholder="请输入管控民警姓名" readonly
@click="chooseMarksVisible = true" />
</div>
</template>
<template #gkmjsfzh>
<!-- <template #gkmjsfzh>
<div>
<el-input v-model="listQuery.gkmjsfzh" class="group" placeholder="请输入管控民警身份证号" readonly
@click="chooseMarksVisible = true" />
</div>
</template>
<!-- { label: "管控民警", prop: "gkmjxm", type: "slot" }, -->
</template> -->
<!-- { label: "管控民警", prop: "gkMjXm", type: "slot" }, -->
<!-- { label: "管控民警身份证号", prop: "gkmjsfzh", type: "slot" }, -->
</FormMessage>
</div>
@ -48,8 +36,8 @@
<script setup>
import * as rule from "@/utils/rules.js";
import { IdCard } from "@/utils/validate.js";
import * as MOSTY from "@/components/MyComponents/index";
import { Plus, Minus } from "@element-plus/icons-vue";
import FormMessage from "@/components/aboutTable/FormMessage.vue";
import ChooseUser from "@/components/ChooseList/ChooseUser/index.vue";
import { ref, reactive, onMounted, getCurrentInstance, watch } from "vue";
@ -73,57 +61,61 @@ const props = defineProps({
const rules = reactive({
ryXm: [{ required: true, message: "请输入姓名", trigger: "blur" }],
...rule.identityCardRule({ validator: true }, 'rySfzh'), //身份证校验
...rule.phoneRule({ validator: true }, "ryLxdh"), // 是否必填 是否进行校验,
...rule.phoneRule({ validator: true }, "gkMjLxfs"), // 是否必填 是否进行校验,
rySfzh: [{ required: true, message: "请输入身份证号", trigger: "blur" }],
ryLxdh: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
ryXb: [{ required: true, message: "请选择性别", trigger: "change" }],
ryMz: [{ required: true, message: "请选择民族", trigger: "change" }],
ryCsrq: [{ required: true, message: "请选择出生日期", trigger: "change" }],
zdrRyjb: [{ required: true, message: "请选择人员级别", trigger: "change" }],
zdrYjdj: [{ required: true, message: "请选择预警等级", trigger: "change" }],
zrSsbmdm: [{ required: true, message: "请选择责任单位", trigger: "change" }],
// gkmjxm: [{ required: true, message: "请选择管控民警", trigger: "change" }],
gxSsbmdm: [{ required: true, message: "请选择协管单位", trigger: "change" }],
zdrRkkssj: [{ required: true, message: "请选择入库开始时间", trigger: "change" }],
zdrRkjssj: [{ required: true, message: "请选择入库结束时间", trigger: "change" }],
gkMjLxfs: [{ required: true, message: "请输入民警联系方式", trigger: "blur" }],
// gkMjXm: [{ required: true, message: "请选择管控民警", trigger: "change" }],
// gkmjsfzh: [{ required: true, message: "请选择管控民警身份证号", trigger: "change" }],
// rylx: [{ required: true, message: "请选择人员类型", trigger: "change" }]
});
const listQuery = ref({ ryLxdh: [""] }); //表单
const listQuery = ref({}); //表单
const chooseMarksVisible = ref(false); // 控制标签选择弹窗显示
const roleIds = ref([]); // 已选择的标签ID
const formData = ref([
{ label: "人员照片", prop: "ryzp", type: "slot", width: "100%" },
{ label: "姓名", prop: "ryXm", type: "input" },
{ label: "性别", prop: "ryXb", type: "select", options: D_BZ_XB },
{ label: "身份证号", prop: "rySfzh", type: "input" },
{ label: "籍贯", prop: "ryJg", type: "select", options: D_BZ_XZQHDM },
{ label: "曾用名", prop: "cym", type: "input" },
{ label: "文化程度", prop: "whcdBm", type: "select", options: D_BZ_WHCD },
{ label: "民族", prop: "ryMz", type: "select", options: D_BZ_MZ },
{ label: "政治面貌", prop: "zzmm", type: "select", options: D_BZ_ZZMM },
{ label: "职业", prop: "zyBm", type: "select", options: D_ZDRY_ZYLB },
{ label: "人员级别", prop: "zdrRyjb", type: "select", options: D_GS_ZDR_RYJB },
{ label: "预警等级", prop: "zdrYjdj", type: "select", options: D_GS_ZDR_YJDJ },
{ label: "出生日期", prop: "ryCsrq", type: "date" },
{ label: "户籍地区划", prop: "hjdQh", type: "select", options: D_BZ_XZQHDM },
{ label: "户籍地详址", prop: "hjdXz", type: "input" },
{ label: "户籍地派出所", prop: "hjdPcsdm", depMc: "hjdPcsmc", type: "department" },
{ label: "现住地区划", prop: "xzdQh", type: "select", options: D_BZ_XZQHDM },
{ label: "现住地详址", prop: "xzdXz", type: "input" },
{ label: "现住地派出所", prop: "xzdPcsdm", depMc: "xzdPcsmc", type: "department" },
{ label: "管控民警", prop: "gkmjxm", type: "slot" },
{ label: "民警身份证", prop: "gkmjsfzh", type: "slot" },
{ label: "管辖单位", prop: "gxSsbmdm", depMc: 'gxSsbmmc', type: "department" },
{ label: "诉求单位", prop: "sqSsbmdm", depMc: 'sqSsbmmc', type: "department" },
{ label: "责任单位", prop: "zrSsbmdm", depMc: 'zrSsbmmc', type: "department" },
{ label: "所属警种", prop: "zdrSsjz", type: "select", options: D_GS_BK_SSJZ },
{ label: "涉及警种", prop: "zdrSjjz", type: "select", options: D_GS_BK_SSJZ, multiple: true },
{ label: "婚姻状态", prop: "hyzk", type: "select", options: D_BZ_HYZK },
// { label: "处置状态", prop: "zdrCzzt", type: "select", options: D_GS_ZDR_CZZT },
// { label: "布控状态", prop: "zdrBkZt", type: "select", options: D_BZ_RCBKZT },
{ label: "姓名", prop: "ryXm", type: "input", width: "30%" },
{ label: "身份证号", prop: "rySfzh", type: "input", width: "30%" },
{ label: "性别", prop: "ryXb", type: "select", options: D_BZ_XB, width: "30%" },
{ label: "出生日期", prop: "ryCsrq", type: "date", width: "30%" },
{ label: "民族", prop: "ryMz", type: "select", options: D_BZ_MZ, width: "30%" },
{ label: "协管单位", prop: "gxSsbmdm", depMc: 'gxSsbmmc', type: "department", width: "30%" },
{ label: "预警等级", prop: "zdrYjdj", type: "select", options: D_GS_ZDR_YJDJ, width: "30%" },
{ label: "管控民警", prop: "gkMjXm", type: "slot", width: "30%" },
{ label: "民警联系方式", prop: "gkMjLxfs", type: "input", width: "30%" },
{ label: "入库开始时间", prop: "zdrRkkssj", type: "datetime", width: "30%" },
{ label: "入库结束时间", prop: "zdrRkjssj", type: "datetime", width: "30%" },
{ label: "重点人联系电话", prop: "ryLxdh", type: "input", width: "30%" },
{ label: "籍贯", prop: "ryJg", type: "input", width: "30%" },
{ label: "曾用名", prop: "cym", type: "input", width: "30%" },
{ label: "文化程度", prop: "whcdBm", type: "select", options: D_BZ_WHCD, width: "30%" },
{ label: "政治面貌", prop: "zzmm", type: "select", options: D_BZ_ZZMM, width: "30%" },
{ label: "职业", prop: "zyBm", type: "input", width: "30%" },
{ label: "人员级别", prop: "zdrRyjb", type: "select", options: D_GS_ZDR_RYJB, width: "30%" },
{ label: "户籍地区划", prop: "hjdQh", type: "input", width: "30%" },
{ label: "户籍地详址", prop: "hjdXz", type: "input", width: "30%" },
{ label: "户籍地派出所", prop: "hjdPcsmc", type: "input", width: "30%" },
{ label: "现住地区划", prop: "xzdQh", type: "input", width: "30%" },
{ label: "现住地详址", prop: "xzdXz", type: "input", width: "30%" },
{ label: "现住地派出所", prop: "xzdPcsdm", depMc: "xzdPcsmc", type: "department", width: "30%" },
// { label: "民警身份证", prop: "gkmjsfzh", type: "slot" },
{ label: "诉求单位", prop: "sqSsbmmc", type: "input", width: "30%" },
{ label: "责任单位", prop: "zrSsbmmc", type: "input", width: "30%" },
{ label: "所属警种", prop: "zdrSsjz", type: "select", options: D_GS_BK_SSJZ, width: "30%" },
{ label: "涉及警种", prop: "zdrSjjz", type: "select", options: D_GS_BK_SSJZ, multiple: true, width: "30%" },
{ label: "婚姻状态", prop: "hyzk", type: "select", options: D_BZ_HYZK, width: "30%" },
{ label: "处置状态", prop: "zdrCzzt", type: "select", options: D_GS_ZDR_CZZT, width: "30%" },
{ label: "布控状态", prop: "zdrBkZt", type: "select", options: D_BZ_RCBKZT, width: "30%" },
// { label: "人员类型", prop: "rylx", type: "select", options: D_ZDRY_RYLX },
{ label: "入库开始时间", prop: "zdrRkkssj", type: "datetime" },
{ label: "入库结束时间", prop: "zdrRkjssj", type: "datetime" },
{ label: "Mac地址", prop: "macDz", type: "input" },
{ label: "联系电话", prop: "ryLxdh", type: "slot", width: "100%" },
{ label: "Mac地址", prop: "macDz", type: "input", width: "30%" },
// { label: "标签选择", prop: "tags", type: "slot", width: "100%" },
{ label: "管控原因", prop: "zdrLkyy", type: "textarea", width: "100%" },
]);
@ -150,9 +142,22 @@ const deepClone = (obj) => {
}
return clonedObj;
};
// 监听身份证号变化,自动填充性别、出生日期和民族
watch(() => listQuery.value.rySfzh, (val) => {
if (val && val.length === 18) {
// 使用IdCard方法提取出生日期
listQuery.value.ryCsrq = IdCard(val, 1);
// 使用IdCard方法提取性别
const genderText = IdCard(val, 2);
listQuery.value.ryXb = D_BZ_XB.value.find(item => item.zdmc === genderText).dm;
}
});
// 监听props.dataList变化处理初始化数据
watch(() => props.dataList, (val) => {
if (val) {
console.log(val);
// 使用深拷贝避免直接引用同一个对象
listQuery.value = deepClone(val);
// 处理照片数据
@ -175,14 +180,9 @@ const submit = () => {
};
//
const gettbGsxtZdryUpdate = () => {
const promes = {
...listQuery.value,
ryzp: listQuery.value.ryzp.length > 0 ? listQuery.value.ryzp.toString() : "",
ryLxdh: listQuery.value.ryLxdh,
zdrSjjz: JSON.stringify(listQuery.value.zdrSjjz),
}
@ -200,28 +200,6 @@ const gettbGsxtZdryUpdate = () => {
});
})
}
// 添加电话号码
const addPhone = () => {
// 确保新添加的电话号码与现有数据结构一致
// 创建深拷贝以避免响应式更新问题
const newPhoneList = [...listQuery.value.ryLxdh];
newPhoneList.push('');
// 用全新数组替换现有数组确保Vue正确检测到变化
listQuery.value.ryLxdh = newPhoneList;
}
// 删除电话号码
const removePhone = (index) => {
if (listQuery.value.ryLxdh.length > 1) {
listQuery.value.ryLxdh.splice(index, 1);
} else {
// 清空输入但保留输入框
listQuery.value.ryLxdh[0] = '';
proxy.$message.warning('至少保留一个联系电话');
}
}
const throwData = () => {
@ -229,32 +207,19 @@ const throwData = () => {
if (elform.value && elform.value.validate) {
elform.value.submit((data) => {
// 过滤掉空的电话号码
const validPhones = listQuery.value.ryLxdh.filter(phone => phone && phone.trim());
if (validPhones.length === 0) {
proxy.$message.warning('请至少输入一个有效的联系电话');
reject(new Error('请至少输入一个有效的联系电话'));
return;
}
resolve({
...listQuery.value,
ryzp: listQuery.value.ryzp && listQuery.value.ryzp.length > 0 ? listQuery.value.ryzp.toString() : '',
ryLxdh: validPhones,
zdrSjjz: JSON.stringify(listQuery.value.zdrSjjz),
});
})
} else {
elform.value.submit((data) => {
// 如果没有验证方法,直接返回数据
const validPhones = listQuery.value.ryLxdh.filter(phone => phone && phone.trim());
if (validPhones.length === 0) {
proxy.$message.warning('请至少输入一个有效的联系电话');
reject(new Error('请至少输入一个有效的联系电话'));
return;
}
resolve({
...listQuery.value,
ryzp: listQuery.value.ryzp && listQuery.value.ryzp.length > 0 ? listQuery.value.ryzp.toString() : '',
ryLxdh: validPhones,
zdrSjjz: JSON.stringify(listQuery.value.zdrSjjz),
});
@ -265,8 +230,9 @@ const throwData = () => {
};
const choosed = (val) => {
roleIds.value = [val[0].id]
listQuery.value.gkmjxm = val[0].userName
listQuery.value.gkMjXm = val[0].userName
listQuery.value.gkmjsfzh = val[0].idEntityCard
listQuery.value.gkMjLxfs = val[0].mobile
console.log(listQuery.value);
};