Browse Source

Merge branch 'dev-xuzhao'

Luka 15 hours ago
parent
commit
0a2275bf55

+ 128 - 28
src/views/notificationInfoManage/addressBook/components/detail.vue

@@ -73,8 +73,8 @@
 										/>
 									</template>
 									<template v-if="item.type === 'msgRecipient'">
-										<el-radio-group v-model="formData.msgRecipient">
-											<el-radio v-for="vax in bj_msg_recipient" border :value="vax.value">{{
+										<el-radio-group v-model="formData[item.prop]">
+											<el-radio v-for="vax in bj_msg_recipient" border :label="vax.value">{{
 												vax.label
 											}}</el-radio>
 										</el-radio-group>
@@ -89,16 +89,47 @@
 											:placeholder="item.placeholder"
 											:remote-method="remoteuserNameMethod"
 											:loading="userLoading"
+											remote-show-suffix
 											style="width: 100%"
 										>
 											<el-option
-												v-for="item in options"
+												v-for="item in userNameOptions"
 												:key="item.value"
 												:label="item.label"
 												:value="item.value"
 											/>
 										</el-select>
 									</template>
+									<template v-if="item.type === 'unitName'">
+										<el-tree-select
+											v-model="formData[item.prop]"
+											:data="unitOptions"
+											node-key="id"
+											filterable
+											check-strictly="true"
+											:placeholder="item.placeholder"
+											style="width: 100%"
+										/>
+									</template>
+									<template v-if="item.type === 'belongsDept'">
+										<el-tree-select
+											v-model="formData[item.prop]"
+											:data="belongsDeptOptions"
+											:render-after-expand="false"
+											node-key="id"
+											filterable
+											:placeholder="item.placeholder"
+											style="width: 100%"
+										/>
+									</template>
+
+									<template v-if="item.type === 'abStatus'">
+										<el-radio-group v-model="formData[item.prop]">
+											<el-radio v-for="vax in bj_ab_status" border :label="vax.value">{{
+												vax.label
+											}}</el-radio>
+										</el-radio-group>
+									</template>
 								</el-form-item>
 							</el-col>
 						</template>
@@ -125,8 +156,11 @@
 import { reactive, ref } from 'vue';
 import type { FormInstance } from 'element-plus';
 import useSystemStore from '@/store/main';
+import { getDeptTree } from '@/api/address/index';
 import { outTypeList } from '@/libs/commonMeth';
 const bj_msg_recipient = outTypeList('bj_msg_recipient'); //短信接收人
+const bj_ab_status = outTypeList('bj_ab_status'); //短信接收人
+import dayjs from 'dayjs';
 // 定义props
 interface IProps {
 	modalConfig: {
@@ -165,23 +199,54 @@ allOptions.value = [
 	{ label: '综合办公室-王五', value: 'Arizona' },
 	{ label: '科技信息处-赵六', value: 'California' },
 ];
-const options = ref<userNameListItem[]>([]);
+
 const userLoading = ref(false);
+
+const userNameOptions = ref<userNameListItem[]>([]);
 const remoteuserNameMethod = (query: string) => {
 	if (query) {
 		userLoading.value = true;
 		setTimeout(() => {
 			userLoading.value = false;
-			options.value = allOptions.value.filter(item => {
+			userNameOptions.value = allOptions.value.filter(item => {
 				return item.label.toLowerCase().includes(query.toLowerCase());
 			});
 		}, 200);
 	} else {
-		options.value = [];
+		userNameOptions.value = allOptions.value;
 	}
 };
 
-onMounted(async () => {});
+// const hideitem = (str: string) => {
+// 	if (isEdit.value == true) {
+// 		return true;
+// 	}
+// 	if (['addName', 'addDept', 'addDate'].includes(str)) {
+// 		return false;
+// 	} else {
+// 		return true;
+// 	}
+// };
+onMounted(async () => {
+	getTree();
+});
+interface Tree {
+	id: number;
+	label: string;
+	children?: Tree[];
+}
+const unitOptions: any = ref<Tree[]>();
+const belongsDeptOptions: any = ref<Tree[]>();
+// 过滤节点(搜索功能)
+const getTree = () => {
+	getDeptTree().then((res: any) => {
+		if (res.code == 200) {
+			unitOptions.value = res.data;
+		} else {
+			unitOptions.value = [];
+		}
+	});
+};
 
 // 定义数据绑定
 const initialForm: any = {};
@@ -193,6 +258,7 @@ let formData = ref(JSON.parse(JSON.stringify(initialForm)));
 
 const dialogTitle = ref();
 const dialogLook = ref(false);
+const nowStr = dayjs().format('YYYY-MM-DD HH:mm:ss');
 // 新建或者编辑
 async function setDialogVisible(isNew: boolean = true, check: boolean = false) {
 	dialogVisible.value = true;
@@ -215,9 +281,22 @@ async function setDialogVisible(isNew: boolean = true, check: boolean = false) {
 	} else {
 		props.modalConfig.formItems.map((m: any) => {
 			if (m.prop === 'msgRecipient') {
-				initialForm[m.prop] = '2';
+				initialForm[m.prop] = '1';
+			}
+			if (m.prop === 'abStatus') {
+				initialForm[m.prop] = '1';
+			}
+			if (m.prop === 'addName') {
+				initialForm[m.prop] = '张浩楠';
+			}
+			if (m.prop === 'addDept') {
+				initialForm[m.prop] = '交通运输部海事局';
+			}
+			if (m.prop === 'addDate') {
+				initialForm[m.prop] = nowStr;
 			}
 		});
+
 		formData.value = JSON.parse(JSON.stringify(initialForm));
 		await nextTick();
 		dialogTitle.value = props.modalConfig.addTitle;
@@ -226,28 +305,49 @@ async function setDialogVisible(isNew: boolean = true, check: boolean = false) {
 	}
 	isEdit.value = !isNew;
 }
+
+watch(
+	() => formData.value.unitName,
+	(newVal, oldVal) => {
+		belongsDeptOptions.value = getChildrenById(unitOptions.value, newVal);
+	}
+);
+
+/** 深度优先搜索,找到第一个 id 匹配的节点并返回它的 children */
+function getChildrenById(treeData: any[], targetId: string): any {
+	for (const node of treeData) {
+		if (node.id === targetId) {
+			return node.children;
+		}
+		if (node.children) {
+			const found = getChildrenById(node.children, targetId);
+			if (found) return found;
+		}
+	}
+	return [];
+}
+
 // 点击确定
 function handleConfirmClick(formEl: FormInstance | undefined) {
-	console.log(formData.msgRecipient);
-	// if (!formEl) return;
-	// formEl.validate((valid, fields) => {
-	// 	if (valid) {
-	// 		dialogVisible.value = false;
-	// 		let data = { ...formData.value };
-	// 		if (props.otherInfo) {
-	// 			data = { ...data, ...props.otherInfo };
-	// 		}
-	// 		if (!isEdit.value) {
-	// 			systemStore.newPageDataAction(props.modalConfig.pageName, data, props.modalConfig.pageListParams);
-	// 		} else {
-	// 			if (pageOperateType.value === 'edit') {
-	// 				systemStore.editPageDataAction(props.modalConfig.pageName, data, props.modalConfig.pageListParams);
-	// 			}
-	// 		}
-	// 	} else {
-	// 		console.log('error submit!', fields);
-	// 	}
-	// });
+	if (!formEl) return;
+	formEl.validate((valid, fields) => {
+		if (valid) {
+			dialogVisible.value = false;
+			let data = { ...formData.value };
+			if (props.otherInfo) {
+				data = { ...data, ...props.otherInfo };
+			}
+			if (!isEdit.value) {
+				systemStore.newPageDataAction(props.modalConfig.pageName, data, props.modalConfig.pageListParams);
+			} else {
+				if (pageOperateType.value === 'edit') {
+					systemStore.editPageDataAction(props.modalConfig.pageName, data, props.modalConfig.pageListParams);
+				}
+			}
+		} else {
+			console.log('error submit!', fields);
+		}
+	});
 }
 // 取消
 function handleExcel(formEl: FormInstance | undefined) {

+ 1 - 47
src/views/notificationInfoManage/addressBook/components/treeSelect.vue

@@ -31,7 +31,6 @@
 import { ref, computed } from 'vue';
 import { ElTree } from 'element-plus';
 import { getDeptTree } from '@/api/address/index';
-import { el } from 'element-plus/es/locale';
 
 const emit = defineEmits(['treeCheck']);
 
@@ -53,52 +52,7 @@ const checkedKeys = ref<(string | number)[]>([]);
 // 树形组件实例
 const treeRef = ref<InstanceType<typeof ElTree>>();
 // 树形结构数据(模拟后端返回数据)
-// const treeData = ref<Tree[]>();
-	const treeData = ref<Tree[]>([
-	{
-		id: 1,
-		label: '交通部根节点',
-		children: [
-			{ id: 11, label: 'XXXXXXXX机构11' },
-			{
-				id: 12,
-				label: 'XXXXXXXX机构12',
-				children: [
-					{ id: 121, label: 'XXXXXXXX机构121' },
-					{ id: 122, label: 'XXXXXXXX机构123' },
-					{ id: 123, label: 'XXXXXXXX机构123' },
-					{ id: 124, label: 'XXXXXXXX机构124' },
-					{ id: 125, label: 'XXXXXXXX机构125' },
-					{ id: 126, label: 'XXXXXXXX机构126' },
-				],
-			},
-			{
-				id: 13,
-				label: 'XXXXXXXX机构13',
-				children: [
-					{ id: 131, label: 'XXXXXXXX机构131' },
-					{ id: 132, label: 'XXXXXXXX机构132' },
-					{ id: 133, label: 'XXXXXXXX机构133' },
-					{ id: 134, label: 'XXXXXXXX机构134' },
-					{ id: 135, label: 'XXXXXXXX机构135' },
-					{ id: 136, label: 'XXXXXXXX机构136' },
-				],
-			},
-			{
-				id: 14,
-				label: 'XXXXXXXX机构14',
-				children: [
-					{ id: 141, label: 'XXXXXXXX机构141' },
-					{ id: 142, label: 'XXXXXXXX机构142' },
-					{ id: 143, label: 'XXXXXXXX机构143' },
-					{ id: 144, label: 'XXXXXXXX机构144' },
-					{ id: 145, label: 'XXXXXXXX机构145' },
-					{ id: 146, label: 'XXXXXXXX机构146' },
-				],
-			},
-		],
-	},
-]);
+const treeData = ref<Tree[]>();
 
 onMounted(async () => {
 	getTree();

+ 2 - 2
src/views/notificationInfoManage/addressBook/config/content.config.ts

@@ -8,8 +8,8 @@ const contentConfig = {
 	},
 	propsList: [
 		{ type: 'index', label: '序号' },
-		{ type: 'normal', label: '单位名称', sortable: true, prop: 'unitName' },
-		{ type: 'normal', label: '所属部门', sortable: true, prop: 'belongsDept', width: 140 },
+		{ type: 'normal', label: '单位名称', sortable: true, prop: 'unitNameStr' },
+		{ type: 'normal', label: '所属部门', sortable: true, prop: 'belongsDeptStr', width: 140 },
 		{ type: 'normal', label: '职务', prop: 'position', sortable: true, width: 140 },
 		{ type: 'normal', label: '联络人姓名', prop: 'contactName', width: 140 },
 		{ type: 'normal', label: '联系方式', prop: 'contactNumber', width: 140 },

+ 2 - 2
src/views/notificationInfoManage/addressBook/config/content.nonIndustry.config.ts

@@ -8,8 +8,8 @@ const contentConfig = {
 	},
 	propsList: [
 		{ type: 'index', label: '序号' },
-		{ type: 'normal', label: '单位名称', sortable: true, prop: 'unitName' },
-		{ type: 'normal', label: '所属部门', sortable: true, prop: 'belongsDept', width: 140 },
+		{ type: 'normal', label: '单位名称', sortable: true, prop: 'unitNameStr' },
+		{ type: 'normal', label: '所属部门', sortable: true, prop: 'belongsDeptStr', width: 140 },
 		{ type: 'normal', label: '职务', prop: 'position', sortable: true, width: 140 },
 		{ type: 'normal', label: '联络人姓名', prop: 'contactName', width: 140 },
 		{ type: 'normal', label: '联系方式', prop: 'contactNumber', width: 140 },

+ 19 - 11
src/views/notificationInfoManage/addressBook/config/detail.config.ts

@@ -5,12 +5,15 @@ const modalConfig = {
 	detailTitle: '个人基本信息',
 	labelWidth: '150px',
 	formRules: {
-		contactDeptName: [{ required: true, message: '请选择单位名称', trigger: 'change' }],
-		userName: [{ required: true, message: '请输入联络人名称', trigger: 'change' }],
-		updaterDeptId: [{ required: true, message: '请选择所属部门', trigger: 'change' }],
-		dutyName: [{ required: true, message: '请选择所属职位', trigger: 'change' }],
-		mobilePhone: [{ required: true, message: '请输入联络电话', trigger: 'change' }],
-		msgReceiver: [{ required: true, message: '请选择短信接收人', trigger: 'change' }],
+		unitName: [{ required: true, message: '请选择单位名称', trigger: 'change' }],
+		contactName: [{ required: true, message: '请输入联络人名称', trigger: 'change' }],
+		belongsDept: [{ required: true, message: '请选择所属部门', trigger: 'change' }],
+		position: [{ required: true, message: '请选择所属职位', trigger: 'change' }],
+		contactNumber: [{ required: true, message: '请输入联络电话', trigger: 'change' }],
+		msgRecipient: [{ required: true, message: '请选择短信接收人', trigger: 'change' }],
+	},
+	pageListParams: {
+		industryType: '1',
 	},
 	formItems: [
 		{
@@ -37,7 +40,7 @@ const modalConfig = {
 		{
 			label: '单位名称',
 			prop: 'unitName',
-			type: 'select',
+			type: 'unitName',
 			placeholder: '请选择单位名称',
 		},
 		{
@@ -49,7 +52,7 @@ const modalConfig = {
 		{
 			label: '所属部门',
 			prop: 'belongsDept',
-			type: 'input',
+			type: 'belongsDept',
 			placeholder: '请输入所属部门',
 		},
 		{
@@ -67,18 +70,18 @@ const modalConfig = {
 		{
 			label: '联系电话',
 			prop: 'contactNumber',
-			type: 'input',
+			type: 'number',
 			placeholder: '请输入联系电话',
 		},
 		{
 			label: '固定电话',
-			prop: 'telephone',
+			prop: 'fixedTelephone',
 			type: 'input',
 			placeholder: '请输入固定电话',
 		},
 		{
 			label: '传真号',
-			prop: 'fixedTelephone',
+			prop: 'faxNumber',
 			type: 'input',
 			placeholder: '请输入传真号',
 		},
@@ -93,6 +96,11 @@ const modalConfig = {
 			prop: 'msgRecipient',
 			type: 'msgRecipient',
 		},
+		{
+			label: '通讯录状态',
+			prop: 'abStatus',
+			type: 'abStatus',
+		},
 	],
 };
 

+ 17 - 9
src/views/notificationInfoManage/addressBook/config/detail.nonIndustry.config.ts

@@ -5,11 +5,14 @@ const modalConfig = {
 	detailTitle: '个人基本信息',
 	labelWidth: '150px',
 	formRules: {
-		contactDeptName: [{ required: true, message: '请选择单位名称', trigger: 'change' }],
-		userName: [{ required: true, message: '请输入联络人名称', trigger: 'change' }],
-		updaterDeptId: [{ required: true, message: '请选择所属部门', trigger: 'change' }],
-		dutyName: [{ required: true, message: '请选择所属职位', trigger: 'change' }],
-		mobilePhone: [{ required: true, message: '请输入联络电话', trigger: 'change' }],
+		unitName: [{ required: true, message: '请选择单位名称', trigger: 'change' }],
+		contactName: [{ required: true, message: '请输入联络人名称', trigger: 'change' }],
+		belongsDept: [{ required: true, message: '请选择所属部门', trigger: 'change' }],
+		position: [{ required: true, message: '请选择所属职位', trigger: 'change' }],
+		contactNumber: [{ required: true, message: '请输入联络电话', trigger: 'change' }],
+	},
+	pageListParams: {
+		industryType: '2',
 	},
 	formItems: [
 		{
@@ -36,7 +39,7 @@ const modalConfig = {
 		{
 			label: '单位名称',
 			prop: 'unitName',
-			type: 'select',
+			type: 'unitName',
 			placeholder: '请选择单位名称',
 		},
 		{
@@ -48,7 +51,7 @@ const modalConfig = {
 		{
 			label: '所属部门',
 			prop: 'belongsDept',
-			type: 'input',
+			type: 'belongsDept',
 			placeholder: '请输入所属部门',
 		},
 		{
@@ -71,13 +74,13 @@ const modalConfig = {
 		},
 		{
 			label: '固定电话',
-			prop: 'telephone',
+			prop: 'fixedTelephone',
 			type: 'input',
 			placeholder: '请输入固定电话',
 		},
 		{
 			label: '传真号',
-			prop: 'fixedTelephone',
+			prop: 'faxNumber',
 			type: 'input',
 			placeholder: '请输入传真号',
 		},
@@ -87,6 +90,11 @@ const modalConfig = {
 			type: 'input',
 			placeholder: '请输入电子邮箱',
 		},
+		{
+			label: '通讯录状态',
+			prop: 'abStatus',
+			type: 'abStatus',
+		},
 	],
 };
 

+ 10 - 5
src/views/notificationInfoManage/addressBook/index.vue

@@ -11,6 +11,7 @@
 					<pageContent
 						ref="tableListRef"
 						:total="total"
+						v-loading="loading"
 						:contentConfig="activeTab === '1' ? contentConfig : contentNonIndustryConfig"
 						:pageList="tableData"
 					>
@@ -45,7 +46,7 @@
 						<template #operate="scope">
 							<el-button type="primary" link @click="handleEdit(scope.row.liaisonId)"> 编辑 </el-button>
 							<el-button type="primary" link @click="handleCheck(scope.row.liaisonId)"> 查看 </el-button>
-							<el-button type="primary" link @click="onDelete(scope.row.liaisonId)"> 删除 </el-button>
+							<el-button type="primary" link @click="onDelete(scope.row)"> 删除 </el-button>
 						</template>
 					</pageContent>
 				</div>
@@ -117,8 +118,9 @@ const getTreeCheck = async data => {
 	searchTableRef.value[0].handleQueryClick();
 };
 const treeSelectdRef = ref<InstanceType<typeof TreeSelect>>();
-
+const loading = ref(false);
 const handleClick = async (tab: TabsPaneContext) => {
+	loading.value = true;
 	setTimeout(() => {
 		if (treeSelectdRef.value) {
 			treeSelectdRef.value[0].handleReset(false);
@@ -126,6 +128,7 @@ const handleClick = async (tab: TabsPaneContext) => {
 		if (searchTableRef.value) {
 			searchTableRef.value[0].handleResetClick();
 		}
+		loading.value = false;
 	}, 500);
 };
 
@@ -155,14 +158,16 @@ const onImport = () => {
 const onExport = () => {};
 
 // 删除按钮
-function onDelete(value: any) {
-	ElMessageBox.confirm('确定删除该条违法信息通报通讯录吗?', '删除提示', {
+function onDelete(row: any) {
+	ElMessageBox.confirm(`确定删除联络人“${row.contactName}”条条目信息吗?`, '删除提示', {
 		confirmButtonText: '确定',
 		cancelButtonText: '取消',
 		type: 'warning',
 	})
 		.then(() => {
-			systemStore.deletePageDataAction(contentConfig.pageName, value);
+			systemStore.deletePageDataAction(contentConfig.pageName, row.liaisonId, {
+				industryType: activeTab.value,
+			});
 		})
 		.catch(() => {
 			ElMessage({