|
@@ -6,39 +6,40 @@
|
|
|
<div>修改巡查人员</div>
|
|
|
</div>
|
|
|
<div class="common-dialog-box">
|
|
|
- <el-form ref="form" :model="formData" :rules="rules" label-width="120px">
|
|
|
+ <el-form ref="form" :model="formData" :rules="rules" label-width="120px" class="custom-disabled">
|
|
|
<!-- <el-form-item label="姓名:" prop="nick_name">-->
|
|
|
<!-- <el-input v-model="formData.nick_name" style="width: 468px !important" />-->
|
|
|
<!-- </el-form-item>-->
|
|
|
- <el-form-item label="姓名:" prop="user_id">
|
|
|
+ <el-form-item label="姓名:" prop="nick_name">
|
|
|
<el-tree-select
|
|
|
- v-model="formData.user_id"
|
|
|
+ v-model="formData.nick_name"
|
|
|
:data="treeData"
|
|
|
:props="defaultProps"
|
|
|
node-key="id"
|
|
|
:render-after-expand="false"
|
|
|
style="width: 468px"
|
|
|
- @change="onUserNameChange"
|
|
|
filterable
|
|
|
+ disabled
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="粤政易组织:" prop="yzy_account">
|
|
|
- <el-input v-model="formData.yzy_account" style="width: 468px !important" />
|
|
|
+ <el-form-item label="粤政易组织:" prop="ancestors_names">
|
|
|
+ <el-input v-model="formData.ancestors_names" style="width: 468px !important" disabled />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="联系方式:" prop="phonenumber">
|
|
|
- <el-input v-model="formData.phonenumber" style="width: 468px !important" />
|
|
|
+ <el-input v-model="formData.phonenumber" style="width: 468px !important" disabled />
|
|
|
</el-form-item>
|
|
|
<!-- <el-form-item label="责任区划:" prop="area_code">-->
|
|
|
<!-- <el-input v-model="formData.area_code" style="width: 468px !important" />-->
|
|
|
<!-- </el-form-item>-->
|
|
|
- <el-form-item label="责任区划:" prop="area_code">
|
|
|
+ <el-form-item label="责任区划:" prop="area">
|
|
|
<el-tree-select
|
|
|
- v-model="formData.area_code"
|
|
|
- :data="formattedDivisionData"
|
|
|
- :props="{ label: 'label', value: 'code', children: 'children' }"
|
|
|
+ v-model="formData.area"
|
|
|
+ :load="loadNodes"
|
|
|
+ lazy
|
|
|
+ node-key="id"
|
|
|
+ :props="{ label: 'label', value: 'id', children: 'children', isLeaf: 'isShowSelect' }"
|
|
|
:render-after-expand="false"
|
|
|
style="width: 468px"
|
|
|
- @change="onDivisionChange"
|
|
|
check-strictly
|
|
|
/>
|
|
|
</el-form-item>
|
|
@@ -61,6 +62,7 @@ import {
|
|
|
} from '@/api/inspectionWork/inspector';
|
|
|
import { reactive, ref, watch } from 'vue';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
+import { getRegionalTree } from '@/api/PreventionResponsible';
|
|
|
const emits = defineEmits(['close']);
|
|
|
const treeData = ref([]);
|
|
|
const formattedDivisionData = ref([]);
|
|
@@ -69,11 +71,11 @@ const props = defineProps<{
|
|
|
eventId: string | number;
|
|
|
}>();
|
|
|
const formData = ref({
|
|
|
- user_id: '',
|
|
|
- nick_name: '',
|
|
|
- phonenumber: '',
|
|
|
- yzy_account: '',
|
|
|
- area_code: ''
|
|
|
+ // user_id: '',
|
|
|
+ // nick_name: '',
|
|
|
+ // phonenumber: '',
|
|
|
+ // yzy_account: '',
|
|
|
+ // area_code: ''
|
|
|
});
|
|
|
// 表单验证规则
|
|
|
const rules = ref({
|
|
@@ -90,6 +92,23 @@ const fetchDetail = async () => {
|
|
|
ElMessage.error(response.msg);
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+const loadNodes = (node, resolve) => {
|
|
|
+ if (!node.data.id) {
|
|
|
+ resolve([{
|
|
|
+ id: 1,
|
|
|
+ isShowSelect: false,
|
|
|
+ label: "广东省",
|
|
|
+ parentLabel: "",
|
|
|
+ personSum: -1,
|
|
|
+ }]);
|
|
|
+ } else {
|
|
|
+ getRegionalTree(node.data.id).then((res) => {
|
|
|
+ resolve(res.data);
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
watch(
|
|
|
() => props.eventId,
|
|
|
(newVal) => {
|
|
@@ -148,10 +167,10 @@ const submitForm = async () => {
|
|
|
}
|
|
|
|
|
|
};
|
|
|
-const fetchPhoneList = async () => {
|
|
|
- const response = await phoneList();
|
|
|
- treeData.value = response.data;
|
|
|
-};
|
|
|
+// const fetchPhoneList = async () => {
|
|
|
+// const response = await phoneList();
|
|
|
+// treeData.value = response.data;
|
|
|
+// };
|
|
|
|
|
|
const defaultProps = reactive({
|
|
|
children:'children',
|
|
@@ -160,31 +179,12 @@ const defaultProps = reactive({
|
|
|
return node.deptType && !node.children;
|
|
|
}
|
|
|
})
|
|
|
-const onUserNameChange = async (value) => {
|
|
|
- if (value) {
|
|
|
- const response = await userList({ userId: value });
|
|
|
- if (response.code === 200 && response.rows.length > 0) {
|
|
|
- updateFormData(response);
|
|
|
- } else {
|
|
|
- ElMessage.error(response.msg);
|
|
|
- }
|
|
|
- }
|
|
|
-};
|
|
|
-// 格式化责任区划数据
|
|
|
-const formatDivisionData = (data) => {
|
|
|
- return data.map((item) => ({
|
|
|
- id: item.id,
|
|
|
- label: item.label,
|
|
|
- code: item.code,
|
|
|
- children: item.children ? formatDivisionData(item.children) : []
|
|
|
- }));
|
|
|
-};
|
|
|
+
|
|
|
const fetchDivisionData = async () => {
|
|
|
const response = await inspectorDivision();
|
|
|
if (response.code === 200) {
|
|
|
rawDivisionData.value = response.data;
|
|
|
- formattedDivisionData.value = formatDivisionData(rawDivisionData.value);
|
|
|
- console.log('Formatted Division Data:', formattedDivisionData.value);
|
|
|
+ formattedDivisionData.value = rawDivisionData.value;
|
|
|
} else {
|
|
|
ElMessage.error(response.msg);
|
|
|
}
|
|
@@ -202,8 +202,20 @@ const onDivisionChange = (value) => {
|
|
|
};
|
|
|
|
|
|
onMounted(() => {
|
|
|
- fetchPhoneList();
|
|
|
+ // fetchPhoneList();
|
|
|
fetchDivisionData();
|
|
|
});
|
|
|
</script>
|
|
|
-<style scoped></style>
|
|
|
+<style scoped>
|
|
|
+.custom-disabled {
|
|
|
+ :deep(.el-select__wrapper.is-disabled),
|
|
|
+ :deep(.el-input__wrapper) {
|
|
|
+ background-color: #ffffff !important;
|
|
|
+ }
|
|
|
+ :deep(.el-select__wrapper.is-disabled .el-select__selected-item),
|
|
|
+ :deep(.el-input__inner) {
|
|
|
+ color: rgba(0, 0, 0, 0.85) !important;
|
|
|
+ -webkit-text-fill-color: rgba(0, 0, 0, 0.85) !important;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|