Forráskód Böngészése

事项清单 业务逻辑

Luka 1 napja
szülő
commit
57855d4e2a

+ 367 - 307
src/components/components/pageContent.vue

@@ -1,131 +1,190 @@
 <template>
-    <div class="contenBox">
-        <div class="table-action flex-b">
-            <div class="customList">{{ contentConfig.header.title ? contentConfig.header.title : '' }}</div>
-            <div class="btns">
-                <slot name="button"></slot>
-            </div>
-        </div>
-        <el-table :data="pageList" style="width: 100%; max-height: 55vh; overflow: auto"
-            @selection-change="handleSelectionChange" ref="multipleTableRef" v-bind="props.contentConfig?.tableProps"
-            :row-key="getRowKeys" v-loading="loading">
-            <template v-for="item in contentConfig.propsList">
-                <!-- 序号 -->
-                <el-table-column :fixed="item.fixed" v-if="item.type === 'index'" type="index" :key="item.prop" center>
-                </el-table-column>
-                <!-- 选择 -->
-                <el-table-column :fixed="item.fixed" type="selection" width="55" align="center" :key="item.prop"
-                    v-if="item.type === 'selection'" :reserve-selection="true" />
-                <!-- 操作类 -->
-                <el-table-column :key="item" :fixed="item.fixed" align="center" v-bind="item"
-                    v-else-if="item.type === 'handler'">
-                    <template #default="scope">
-                        <slot :name="item.slotName" v-bind="scope"></slot>
-                    </template>
-                </el-table-column>
+	<div class="contenBox">
+		<div class="table-action flex-b">
+			<div class="customList">{{ contentConfig.header.title ? contentConfig.header.title : '' }}</div>
+			<div class="btns">
+				<slot name="button"></slot>
+			</div>
+		</div>
+		<el-table
+			:data="pageList"
+			style="width: 100%; max-height: 55vh; overflow: auto"
+			@selection-change="handleSelectionChange"
+			ref="multipleTableRef"
+			v-bind="props.contentConfig?.tableProps"
+			:row-key="getRowKeys"
+			v-loading="loading"
+		>
+			<template v-for="item in contentConfig.propsList">
+				<!-- 序号 -->
+				<el-table-column
+					:fixed="item.fixed"
+					v-if="item.type === 'index'"
+					type="index"
+					:key="item.prop"
+					center
+				>
+				</el-table-column>
+				<!-- 选择 -->
+				<el-table-column
+					:fixed="item.fixed"
+					type="selection"
+					width="55"
+					align="center"
+					:key="item.prop"
+					v-if="item.type === 'selection'"
+					:reserve-selection="true"
+				/>
+				<!-- 操作类 -->
+				<el-table-column
+					:key="item"
+					:fixed="item.fixed"
+					align="center"
+					v-bind="item"
+					v-else-if="item.type === 'handler'"
+				>
+					<template #default="scope">
+						<slot :name="item.slotName" v-bind="scope"></slot>
+					</template>
+				</el-table-column>
 
-                <!-- 自定义类 -->
-                <el-table-column show-overflow-tooltip :fixed="item.fixed" :key="item.label"
-                    v-else-if="item.type === 'custom'" :label="item.label" :width="item.width" :prop="item.prop"
-                    :sortable="item.sortable || false" :column-key="item.prop">
-                    <template #default="scope">
-                        <slot :name="item.slotName" v-bind="scope"></slot>
-                    </template>
-                </el-table-column>
-                <!-- 时间类 -->
-                <el-table-column show-overflow-tooltip :fixed="item.fixed" :key="item.label"
-                    v-else-if="item.type === 'time'" align="center" :label="item.label" :width="item.width">
-                    <template #default="scope">
-                        {{ parseTime(scope.row[item.prop]) }}
-                    </template>
-                </el-table-column>
-                <!-- 普通渲染类 -->
-                <el-table-column :fixed="item.fixed" show-overflow-tooltip v-else-if="item.type === 'normal'"
-                    :key="item.label" v-bind="item" :prop="item.prop" :sortable="item.sortable || false"
-                    :column-key="item.prop" />
-                <!-- 倒序类 -->
-                <el-table-column :fixed="item.fixed" show-overflow-tooltip v-else-if="item.type === 'sortable'"
-                    :key="item.label" sortable v-bind="item" />
-            </template>
-        </el-table>
-        <div class="flex-b">
-            <div v-if="contentConfig.moneyTotal">
-                <div class="flex" v-if="contentConfig.moneyTotalType === false">
-                    <div class="footSlotStyle mr10">小计:</div>
-                    <div class="footSlotStyle mr20" v-if="!contentConfig.customSubtotal">
-                        数量 {{ subNumber || 0 }}
-                        张
-                    </div>
-                    <div class="footSlotStyle mr20" v-else>数量 {{ subtotalNum || 0 }}</div>
-                    <slot name="subtotalSlot"></slot>
-                </div>
-                <div v-else class="flex">
-                    <div class="footSlotStyle mr10">小计:</div>
-                    <div class="footSlotStyle mr20" v-if="!contentConfig.customSubtotal">
-                        费用金额 {{ subtotal || 0 }}元
-                    </div>
-                    <div class="footSlotStyle mr20" v-else>费用金额 {{ subtotalNum || 0 }}元</div>
-                    <slot name="subtotalSlot"></slot>
-                </div>
-                <div v-if="contentConfig.moneyTotalType === false" class="flex">
-                    <div class="footSlotStyle mr10">总计:</div>
-                    <div class="footSlotStyle mr20">数量 {{ resDate.moneyTotal || 0 }} 张</div>
-                    <slot name="totalSlot"></slot>
-                </div>
-                <div v-else class="flex">
-                    <div class="footSlotStyle mr10">总计:</div>
-                    <div class="footSlotStyle mr20">费用金额 {{ resDate.moneyTotal || 0 }} 元</div>
-                    <slot name="totalSlot"></slot>
-                </div>
-            </div>
-            <div v-else-if="contentConfig.energyMonery">
-                <div class="flex">
-                    <div class="footSlotStyle mr10">小计:</div>
-                    <div class="footSlotStyle mr20 energyClass">
-                        <div class="itemName">电:{{ electricity || 0 }}</div>
-                        <div class="itemName">水:{{ water || 0 }}</div>
-                        <div class="itemName">气:{{ gas || 0 }}</div>
-                    </div>
-                    <slot name="subtotalSlot"></slot>
-                </div>
-                <div class="flex">
-                    <div class="footSlotStyle mr10">总计:</div>
-                    <div class="footSlotStyle mr20 energyClass">
-                        <div class="itemName">电:{{ electricityTotalPrice || 0 }}</div>
-                        <div class="itemName">水:{{ waterTotalPrice || 0 }}</div>
-                        <div class="itemName">气:{{ gasTotalPrice || 0 }}</div>
-                    </div>
-                    <slot name="totalSlot"></slot>
-                </div>
-            </div>
-            <!-- 其他/能耗费用计算 -->
-            <div style="width: 60%;" v-else-if="contentConfig.energyConsumption">
-                <div class="flex" v-if="contentConfig.energyConsumptionType === false">
-                    <div class="footSlotStyle mr10">能耗总量:</div>
-                    <div class="footSlotStyle mr20 energyClass">
-                        <div class="itemName" v-for="(item, index) in rowDate.value" :key="index">{{ item.energyName
-                        }}:{{
-                                item.dosage || 0 }}
-                        </div>
-
-                    </div>
-                </div>
-                <div class="flex" v-else>
-                    <div class="footSlotStyle mr10">能耗总量:</div>
-                    <div class="footSlotStyle mr20 energyClass">
-                        <div class="itemName">电:{{ electricityDosage || 0 }}</div>
-                        <div class="itemName">水:{{ waterDosage || 0 }}</div>
-                        <div class="itemName">气:{{ gasDosage || 0 }}</div>
-                    </div>
-                </div>
-            </div>
-            <div class="flex" v-else></div>
-            <el-pagination class="mt10" v-model:current-page="systemStore.pageInfo.pageNum"
-                v-model:page-size="systemStore.pageInfo.pageSize" :page-sizes="sizes" :small="false" :disabled="false"
-                :background="true" layout="total, sizes, prev, pager, next, jumper" :total="pageTotalCount"
-                @size-change="onPageSizeChange" @current-change="onPageChange" />
-        </div>
-    </div>
+				<!-- 自定义类 -->
+				<el-table-column
+					show-overflow-tooltip
+					:fixed="item.fixed"
+					:key="item.label"
+					v-else-if="item.type === 'custom'"
+					:label="item.label"
+					:width="item.width"
+					:prop="item.prop"
+					:sortable="item.sortable || false"
+					:column-key="item.prop"
+				>
+					<template #default="scope">
+						<slot :name="item.slotName" v-bind="scope"></slot>
+					</template>
+				</el-table-column>
+				<!-- 时间类 -->
+				<el-table-column
+					show-overflow-tooltip
+					:fixed="item.fixed"
+					:key="item.label"
+					v-else-if="item.type === 'time'"
+					align="center"
+					:label="item.label"
+					:width="item.width"
+				>
+					<template #default="scope">
+						{{ parseTime(scope.row[item.prop]) }}
+					</template>
+				</el-table-column>
+				<!-- 普通渲染类 -->
+				<el-table-column
+					:fixed="item.fixed"
+					show-overflow-tooltip
+					v-else-if="item.type === 'normal'"
+					:key="item.label"
+					v-bind="item"
+					:prop="item.prop"
+					:sortable="item.sortable || false"
+					:column-key="item.prop"
+				/>
+				<!-- 倒序类 -->
+				<el-table-column
+					:fixed="item.fixed"
+					show-overflow-tooltip
+					v-else-if="item.type === 'sortable'"
+					:key="item.label"
+					sortable
+					v-bind="item"
+				/>
+			</template>
+		</el-table>
+		<div class="flex-b">
+			<div v-if="contentConfig.moneyTotal">
+				<div class="flex" v-if="contentConfig.moneyTotalType === false">
+					<div class="footSlotStyle mr10">小计:</div>
+					<div class="footSlotStyle mr20" v-if="!contentConfig.customSubtotal">
+						数量 {{ subNumber || 0 }}
+						张
+					</div>
+					<div class="footSlotStyle mr20" v-else>数量 {{ subtotalNum || 0 }}</div>
+					<slot name="subtotalSlot"></slot>
+				</div>
+				<div v-else class="flex">
+					<div class="footSlotStyle mr10">小计:</div>
+					<div class="footSlotStyle mr20" v-if="!contentConfig.customSubtotal">
+						费用金额 {{ subtotal || 0 }}元
+					</div>
+					<div class="footSlotStyle mr20" v-else>费用金额 {{ subtotalNum || 0 }}元</div>
+					<slot name="subtotalSlot"></slot>
+				</div>
+				<div v-if="contentConfig.moneyTotalType === false" class="flex">
+					<div class="footSlotStyle mr10">总计:</div>
+					<div class="footSlotStyle mr20">数量 {{ resDate.moneyTotal || 0 }} 张</div>
+					<slot name="totalSlot"></slot>
+				</div>
+				<div v-else class="flex">
+					<div class="footSlotStyle mr10">总计:</div>
+					<div class="footSlotStyle mr20">费用金额 {{ resDate.moneyTotal || 0 }} 元</div>
+					<slot name="totalSlot"></slot>
+				</div>
+			</div>
+			<div v-else-if="contentConfig.energyMonery">
+				<div class="flex">
+					<div class="footSlotStyle mr10">小计:</div>
+					<div class="footSlotStyle mr20 energyClass">
+						<div class="itemName">电:{{ electricity || 0 }}</div>
+						<div class="itemName">水:{{ water || 0 }}</div>
+						<div class="itemName">气:{{ gas || 0 }}</div>
+					</div>
+					<slot name="subtotalSlot"></slot>
+				</div>
+				<div class="flex">
+					<div class="footSlotStyle mr10">总计:</div>
+					<div class="footSlotStyle mr20 energyClass">
+						<div class="itemName">电:{{ electricityTotalPrice || 0 }}</div>
+						<div class="itemName">水:{{ waterTotalPrice || 0 }}</div>
+						<div class="itemName">气:{{ gasTotalPrice || 0 }}</div>
+					</div>
+					<slot name="totalSlot"></slot>
+				</div>
+			</div>
+			<!-- 其他/能耗费用计算 -->
+			<div style="width: 60%" v-else-if="contentConfig.energyConsumption">
+				<div class="flex" v-if="contentConfig.energyConsumptionType === false">
+					<div class="footSlotStyle mr10">能耗总量:</div>
+					<div class="footSlotStyle mr20 energyClass">
+						<div class="itemName" v-for="(item, index) in rowDate.value" :key="index">
+							{{ item.energyName }}:{{ item.dosage || 0 }}
+						</div>
+					</div>
+				</div>
+				<div class="flex" v-else>
+					<div class="footSlotStyle mr10">能耗总量:</div>
+					<div class="footSlotStyle mr20 energyClass">
+						<div class="itemName">电:{{ electricityDosage || 0 }}</div>
+						<div class="itemName">水:{{ waterDosage || 0 }}</div>
+						<div class="itemName">气:{{ gasDosage || 0 }}</div>
+					</div>
+				</div>
+			</div>
+			<div class="flex" v-else></div>
+			<el-pagination
+				class="mt10"
+				v-model:current-page="systemStore.pageInfo.pageNum"
+				v-model:page-size="systemStore.pageInfo.pageSize"
+				:page-sizes="sizes"
+				:small="false"
+				:disabled="false"
+				:background="true"
+				layout="total, sizes, prev, pager, next, jumper"
+				:total="pageTotalCount"
+				@size-change="onPageSizeChange"
+				@current-change="onPageChange"
+			/>
+		</div>
+	</div>
 </template>
 
 <script setup lang="ts" name="content">
@@ -138,34 +197,34 @@ import { ref, watch } from 'vue';
 import { useSharedValueStore } from './sharedValueStore';
 
 const props = withDefaults(
-    defineProps<{
-        contentConfig: {
-            pageName: string;
-            status: string;
-            createUser: string;
-            oneself: number;
-            header: {
-                title: string;
-            };
-            tableProps: any;
-            propsList: any[];
-            pageListParams?: {};
-            moneyTotal?: boolean;
-            energyConsumption?: boolean;
-            energyConsumptionType?: boolean;
-            energyMonery?: boolean;
-            moneyTotalType?: boolean;
-            customSubtotal?: boolean;
-        };
-        sizes?: number[];
-        showSummary?: boolean;
-        summaryMethod?: () => any;
-        subtotalNum?: number;
-    }>(),
-    {
-        sizes: [10, 50, 100, 300, 500],
-        customSubtotal: false,
-    }
+	defineProps<{
+		contentConfig: {
+			pageName: string;
+			status: string;
+			createUser: string;
+			oneself: number;
+			header: {
+				title: string;
+			};
+			tableProps: any;
+			propsList: any[];
+			pageListParams?: {};
+			moneyTotal?: boolean;
+			energyConsumption?: boolean;
+			energyConsumptionType?: boolean;
+			energyMonery?: boolean;
+			moneyTotalType?: boolean;
+			customSubtotal?: boolean;
+		};
+		sizes?: number[];
+		showSummary?: boolean;
+		summaryMethod?: () => any;
+		subtotalNum?: number;
+	}>(),
+	{
+		sizes: [10, 50, 100, 300, 500],
+		customSubtotal: false,
+	}
 );
 const emit = defineEmits(['handleSelect', 'pageChanged']);
 const loading = ref(true);
@@ -180,34 +239,37 @@ const sharedValue = computed(() => sharedValueStore.sharedValue);
 
 // 获取列表
 async function fetchPageListData(queryInfo: any = {}) {
-    loading.value = true;
-    // const pageNumber = pageNum.value;
-    // const pageSizeValue = pageSize.value;
-    // 2.发生网络请求
-    await systemStore
-        .getPageListDataAction(props.contentConfig.pageName, {
-            pageNum: systemStore.pageInfo.pageNum,
-            pageSize: systemStore.pageInfo.pageSize,
-            userId: userStore,
-            status: props.contentConfig.status,
-            createUser: props.contentConfig.createUser,
-            oneself: props.contentConfig.oneself,
-            ...queryInfo,
-            ...props.contentConfig.pageListParams,
-        })
-        .then(res => {
-            loading.value = false;
-        });
+	loading.value = true;
+	// const pageNumber = pageNum.value;
+	// const pageSizeValue = pageSize.value;
+	// 2.发生网络请求
+	await systemStore
+		.getPageListDataAction(props.contentConfig.pageName, {
+			pageNum: systemStore.pageInfo.pageNum,
+			pageSize: systemStore.pageInfo.pageSize,
+			userId: userStore,
+			status: props.contentConfig.status,
+			createUser: props.contentConfig.createUser,
+			oneself: props.contentConfig.oneself,
+			...queryInfo,
+			...props.contentConfig.pageListParams,
+		})
+		.then(res => {
+			loading.value = false;
+		})
+		.finally(() => {
+			loading.value = false;
+		});
 }
 
 fetchPageListData();
 systemStore.$onAction(arg => {
-    if (arg.name === 'newPageDataAction' || arg.name === 'deletePageDataAction') {
-        // pageNum.value = 1;
-        // pageSize.value = 10;
-        systemStore.pageInfo.pageNum = 1;
-        systemStore.pageInfo.pageSize = 50;
-    }
+	if (arg.name === 'newPageDataAction' || arg.name === 'deletePageDataAction') {
+		// pageNum.value = 1;
+		// pageSize.value = 10;
+		systemStore.pageInfo.pageNum = 1;
+		systemStore.pageInfo.pageSize = 50;
+	}
 });
 
 // 2.展示数据
@@ -225,182 +287,180 @@ const electricityTotalPrice = ref();
 const gasTotalPrice = ref();
 const waterTotalPrice = ref();
 watch(
-    () => resDate,
-    (newValue: any) => {
-        if (props.contentConfig?.energyConsumption === true) {
-            if (props.contentConfig?.energyConsumptionType === false) {
-                rowDate.value = newValue._object.resDate.otherEnergyList
-            } else {
-                electricityDosage.value = newValue._object.resDate.electricityDosage
-                gasDosage.value = newValue._object.resDate.gasDosage
-                waterDosage.value = newValue._object.resDate.waterDosage
-            }
-        } if (props.contentConfig?.energyMonery === true) {
-            electricityTotalPrice.value = newValue._object.resDate.electricityDosage
-            gasTotalPrice.value = newValue._object.resDate.gasDosage
-            waterTotalPrice.value = newValue._object.resDate.waterDosage
-        }
-
-    },
-    { deep: true }
+	() => resDate,
+	(newValue: any) => {
+		if (props.contentConfig?.energyConsumption === true) {
+			if (props.contentConfig?.energyConsumptionType === false) {
+				rowDate.value = newValue._object.resDate.otherEnergyList;
+			} else {
+				electricityDosage.value = newValue._object.resDate.electricityDosage;
+				gasDosage.value = newValue._object.resDate.gasDosage;
+				waterDosage.value = newValue._object.resDate.waterDosage;
+			}
+		}
+		if (props.contentConfig?.energyMonery === true) {
+			electricityTotalPrice.value = newValue._object.resDate.electricityDosage;
+			gasTotalPrice.value = newValue._object.resDate.gasDosage;
+			waterTotalPrice.value = newValue._object.resDate.waterDosage;
+		}
+	},
+	{ deep: true }
 );
 watch(
-    () => pageList,
-    (newValue: any) => {
-        if (clearFlag.value) {
-            multipleTableRef.value!.clearSelection();
-            subtotal.value = 0;
-            subNumber.value = 0;
-        }
-        // 控制是否清空所选项
-        clearFlag.value = true;
-        // pageList.value.forEach((item: any) => {
-        //     subtotal.value += item.moneyTotal;
-        // });
-        // subtotal.value = Number(subtotal.value.toFixed(2)).toFixed(2);
-    },
-    { deep: true }
+	() => pageList,
+	(newValue: any) => {
+		if (clearFlag.value) {
+			multipleTableRef.value!.clearSelection();
+			subtotal.value = 0;
+			subNumber.value = 0;
+		}
+		// 控制是否清空所选项
+		clearFlag.value = true;
+		// pageList.value.forEach((item: any) => {
+		//     subtotal.value += item.moneyTotal;
+		// });
+		// subtotal.value = Number(subtotal.value.toFixed(2)).toFixed(2);
+	},
+	{ deep: true }
 );
 // 处理选中状态
 const selectedItems = ref([] as any);
 
 const getRowKeys = row => {
-    return row.checkId;
+	return row.checkId;
 };
 
 const echoWay = async () => {
-    await pageList.value.forEach((row: any) => {
-        if (selectedItems.value!.indexOf(row.checkId) >= 0) {
-            multipleTableRef.value!.toggleRowSelection(row, true);
-        }
-    });
-    // console.log(selectedItems.value);
+	await pageList.value.forEach((row: any) => {
+		if (selectedItems.value!.indexOf(row.checkId) >= 0) {
+			multipleTableRef.value!.toggleRowSelection(row, true);
+		}
+	});
+	// console.log(selectedItems.value);
 };
 
 // 清空多选
 function clearSelection() {
-    if (pageList) {
-        multipleTableRef.value!.clearSelection();
-    }
+	if (pageList) {
+		multipleTableRef.value!.clearSelection();
+	}
 }
 const water = ref();
 const electricity = ref();
 const gas = ref();
 // 多选框切换
 function handleSelectionChange(e: any) {
-    emit('handleSelect', e);
-    if (props.contentConfig.energyMonery) {
-        water.value = 0;
-        electricity.value = 0;
-        gas.value = 0;
-        e.forEach(item => {
-            if (item.energyType == '水') {
-                let waters = item.moneyTotal * 100; // 将金额转换为分;
-                water.value += waters;
-            } else if (item.energyType == '电') {
-                let electricitys = item.moneyTotal * 100; // 将金额转换为分;
-                electricity.value += electricitys;
-            } else if (item.energyType == '气') {
-                let gase = item.moneyTotal * 100; // 将金额转换为分;
-                gas.value += gase;
-            }
-        });
-        water.value = (water.value / 100).toFixed(2);
-        electricity.value = (electricity.value / 100).toFixed(2);
-        gas.value = (gas.value / 100).toFixed(2);
-        console.log('zheshi', water.value, electricity.value, gas.value);
-
-    } else {
-        subtotal.value = 0;
-        subNumber.value = 0;
-        selectedItems.value = [];
-        e.forEach(item => {
-            subNumber.value += item.moneyTotal;
-            let moneyTotalInCents = item.moneyTotal * 100; // 将金额转换为分
-            subtotal.value += moneyTotalInCents;
-            selectedItems.value.push(item.checkId);
-        });
-        subtotal.value = (subtotal.value / 100).toFixed(2);
-        // selectedItems.value = e.map(item => {
-        //     console.log(item.moneyTotal);
-        //     subtotal.value += item.moneyTotal;
-        //     return item.checkId;
-        // });
-        // console.log(subtotal.value);
-    }
-
+	emit('handleSelect', e);
+	if (props.contentConfig.energyMonery) {
+		water.value = 0;
+		electricity.value = 0;
+		gas.value = 0;
+		e.forEach(item => {
+			if (item.energyType == '水') {
+				let waters = item.moneyTotal * 100; // 将金额转换为分;
+				water.value += waters;
+			} else if (item.energyType == '电') {
+				let electricitys = item.moneyTotal * 100; // 将金额转换为分;
+				electricity.value += electricitys;
+			} else if (item.energyType == '气') {
+				let gase = item.moneyTotal * 100; // 将金额转换为分;
+				gas.value += gase;
+			}
+		});
+		water.value = (water.value / 100).toFixed(2);
+		electricity.value = (electricity.value / 100).toFixed(2);
+		gas.value = (gas.value / 100).toFixed(2);
+		console.log('zheshi', water.value, electricity.value, gas.value);
+	} else {
+		subtotal.value = 0;
+		subNumber.value = 0;
+		selectedItems.value = [];
+		e.forEach(item => {
+			subNumber.value += item.moneyTotal;
+			let moneyTotalInCents = item.moneyTotal * 100; // 将金额转换为分
+			subtotal.value += moneyTotalInCents;
+			selectedItems.value.push(item.checkId);
+		});
+		subtotal.value = (subtotal.value / 100).toFixed(2);
+		// selectedItems.value = e.map(item => {
+		//     console.log(item.moneyTotal);
+		//     subtotal.value += item.moneyTotal;
+		//     return item.checkId;
+		// });
+		// console.log(subtotal.value);
+	}
 }
 
 // 页码变化
 async function onPageSizeChange(size: number) {
-    // 每页条数改变函数
-    // pageSize.value = size;
-    // pageNum.value = 1;
-    systemStore.pageInfo.pageSize = size;
-    systemStore.pageInfo.pageNum = 1;
-    // 控制是否清空所选项
-    clearFlag.value = false;
-    await fetchPageListData();
-    // 恢复选中状态
-    // await echoWay();
+	// 每页条数改变函数
+	// pageSize.value = size;
+	// pageNum.value = 1;
+	systemStore.pageInfo.pageSize = size;
+	systemStore.pageInfo.pageNum = 1;
+	// 控制是否清空所选项
+	clearFlag.value = false;
+	await fetchPageListData();
+	// 恢复选中状态
+	// await echoWay();
 }
 async function onPageChange(current: number) {
-    // 页码改变函数
-    systemStore.pageInfo.pageNum = current;
-    systemStore.pageInfo.pageNum = current;
-    // 控制是否清空所选项
-    clearFlag.value = false;
-    await fetchPageListData();
-    // 恢复选中状态
-    // await echoWay();
+	// 页码改变函数
+	systemStore.pageInfo.pageNum = current;
+	systemStore.pageInfo.pageNum = current;
+	// 控制是否清空所选项
+	clearFlag.value = false;
+	await fetchPageListData();
+	// 恢复选中状态
+	// await echoWay();
 }
 watch(
-    () => sharedValueStore.pageNum,
-    (newVal, oldVal) => {
-        // pageNum.value = 1;
-        systemStore.pageInfo.pageNum = 1;
-    },
-    { deep: true }
+	() => sharedValueStore.pageNum,
+	(newVal, oldVal) => {
+		// pageNum.value = 1;
+		systemStore.pageInfo.pageNum = 1;
+	},
+	{ deep: true }
 );
 // 暴露函数
 defineExpose({
-    clearSelection,
-    fetchPageListData,
+	clearSelection,
+	fetchPageListData,
 });
 </script>
 
 <style scoped lang="scss">
 .contenBox {
-    padding: 15px 20px 20px 20px;
-    margin-top: 20px;
-    background-color: #fff;
+	padding: 15px 20px 20px 20px;
+	margin-top: 20px;
+	background-color: #fff;
 
-    .table-action {
-        margin-bottom: 15px;
+	.table-action {
+		margin-bottom: 15px;
 
-        button {
-            margin-right: 10px;
-        }
-    }
+		button {
+			margin-right: 10px;
+		}
+	}
 
-    .ivu-table-header thead tr th {
-        background-color: #f0f9fe;
-    }
+	.ivu-table-header thead tr th {
+		background-color: #f0f9fe;
+	}
 }
 
 .customList {
-    color: #606266;
-    font-weight: 700;
+	color: #606266;
+	font-weight: 700;
 }
 
 .itemName {
-    margin: 0 10px 5px 10px;
+	margin: 0 10px 5px 10px;
 }
 
 .energyClass {
-    display: flex;
-    align-items: center;
-    flex-wrap: wrap;
-    flex: 1;
+	display: flex;
+	align-items: center;
+	flex-wrap: wrap;
+	flex: 1;
 }
 </style>

+ 11 - 10
src/views/addressBook/components/treeSelect.vue

@@ -31,7 +31,7 @@
 import { ref, computed } from 'vue';
 import { ElTree } from 'element-plus';
 
-const emit = defineEmits(['treeCheck']); 
+const emit = defineEmits(['treeCheck']);
 
 // 树形配置项
 const treeProps = {
@@ -104,16 +104,16 @@ const filterNode = (value: string, data: any) => {
 };
 
 const handleCheckChange = (data: Tree, checked: boolean, indeterminate: boolean) => {
-  console.log('勾选状态变化:', {
-    nodeId: data.id,
-    nodeLabel: data.label,
-    isChecked: checked,       // 是否完全勾选
-    isIndeterminate: indeterminate  // 是否半选(父节点部分子节点勾选)
-  });
+	// console.log('勾选状态变化:', {
+	//   nodeId: data.id,
+	//   nodeLabel: data.label,
+	//   isChecked: checked,       // 是否完全勾选
+	//   isIndeterminate: indeterminate  // 是否半选(父节点部分子节点勾选)
+	// });
 	// 以上参数按照项目需求取值,正常情况下只会用到 allCheckedKeys
-  const allCheckedKeys = treeRef.value?.getCheckedKeys(false) || [];
-  console.log('所有勾选的节点ID:', allCheckedKeys);
-	emit('treeCheck', allCheckedKeys)
+	const allCheckedKeys = treeRef.value?.getCheckedKeys(false) || [];
+	// console.log('所有勾选的节点ID:', allCheckedKeys);
+	emit('treeCheck', allCheckedKeys);
 };
 
 // 处理搜索
@@ -127,6 +127,7 @@ const handleReset = () => {
 	treeRef.value!.setCheckedKeys([], false);
 	treeRef.value?.filter('');
 };
+defineExpose({ handleReset });
 </script>
 
 <style scoped lang="scss">

+ 4 - 1
src/views/addressBook/config/content.config.ts

@@ -1,8 +1,11 @@
 const contentConfig = {
-	pageName: 'rentalCompany',
+	pageName: 'contactPerson',
 	header: {
 		title: '行内联络员',
 	},
+	pageListParams: {
+		type: 'industry',
+	},
 	propsList: [
 		{ type: 'index', label: '序号' },
 		{ type: 'normal', label: '单位名称', prop: 'contactDeptName', fixed: true },

+ 4 - 1
src/views/addressBook/config/content.nonIndustry.config.ts

@@ -1,8 +1,11 @@
 const contentConfig = {
-	pageName: 'rentalCompany',
+	pageName: 'contactPerson',
 	header: {
 		title: '行外联络员',
 	},
+	pageListParams: {
+		type: 'nonIndustry',
+	},
 	propsList: [
 		{ type: 'index', label: '序号' },
 		{ type: 'normal', label: '单位名称', prop: 'contactDeptName', fixed: true },

+ 1 - 1
src/views/addressBook/config/detail.nonIndustry.config.ts

@@ -1,5 +1,5 @@
 const modalConfig = {
-	pageName: 'rentalCompany',
+	pageName: 'contactPerson',
 	addTitle: '新增行业外违法信息通报通讯录',
 	editTitle: '编辑行业外违法信息通报通讯录',
 	detailTitle: '查看行业外违法信息通报通讯录',

+ 5 - 1
src/views/addressBook/config/search.config.ts

@@ -4,7 +4,11 @@ interface Inew {
 }
 
 const searchConfig = {
-	pageName: 'rentalCompany',
+	pageName: 'contactPerson',
+	pageListParams: {
+		type: 'industry',
+		deptIds: '',
+	},
 	formItems: [
 		{
 			label: '姓名',

+ 5 - 1
src/views/addressBook/config/search.nonIndustry.config.ts

@@ -4,7 +4,11 @@ interface Inew {
 }
 
 const searchConfig = {
-	pageName: 'rentalCompany',
+	pageName: 'contactPerson',
+	pageListParams: {
+		type: 'nonIndustry',
+		deptIds: '',
+	},
 	formItems: [
 		{
 			label: '姓名',

+ 34 - 12
src/views/addressBook/index.vue

@@ -1,8 +1,8 @@
 <template>
-	<el-tabs type="card" v-model="activeTab" style="height: 100%">
+	<el-tabs type="card" v-model="activeTab" style="height: 100%" @tab-click="handleClick">
 		<el-tab-pane v-for="tab in tabs" :key="tab.key" :label="tab.label" :name="tab.key">
 			<div class="sensitive-words flex">
-				<TreeSelect class="mr20" @treeCheck="getTreeCheck"></TreeSelect>
+				<TreeSelect class="mr20" ref="treeSelectdRef" @treeCheck="getTreeCheck"></TreeSelect>
 				<div class="table-box">
 					<pageSearch
 						ref="searchTableRef"
@@ -47,8 +47,8 @@ import detailConfig from './config/detail.config';
 import detailNonIndustryConfig from './config/detail.nonIndustry.config';
 import pageDetail from './components/detail.vue';
 import useSystemStore from '@/store/main';
-import FileUpload from '@/components/FileUpload/index.vue';
 import TreeSelect from './components/treeSelect.vue';
+import { type TabsPaneContext } from 'element-plus';
 // 使用pinia数据
 const systemStore = useSystemStore();
 const { pageDetailInfo } = storeToRefs(systemStore);
@@ -56,7 +56,7 @@ const { pageDetailInfo } = storeToRefs(systemStore);
 const total = ref(0);
 const pageSize = ref([10, 20, 30]);
 const tableData = ref([]);
-const tableListRef = ref<InstanceType<typeof pageContent>>(); 
+const tableListRef = ref<InstanceType<typeof pageContent>>();
 
 const tabs = reactive([
 	{
@@ -84,13 +84,35 @@ import usePageModal from '@/components/components/hooks/usePageDetails';
 const { modalRef, handleNewDataClick, handleEditDataClick, handleCheckDataClick, handlePageDetail } =
 	usePageModal();
 
-const getTreeCheck = async(data) => {
-    console.log(await tableListRef.value);
-    // TODO 因为是tabs的v-for,现在有两个tableListRef节点,后面你需要优化一下
-    if (tableListRef.value) {
-        await tableListRef.value[0].fetchPageListData();
-    }
-}
+const getTreeCheck = async data => {
+	// console.log(await tableListRef.value);
+	// console.log(data);
+	if (tableListRef.value) {
+		if (activeTab.value == 'industry') {
+			searchConfig.pageListParams.deptIds = data.join();
+		} else {
+			searchNonIndustryConfig.pageListParams.deptIds = data.join();
+		}
+
+		await tableListRef.value[0].fetchPageListData({ type: activeTab.value, deptIds: data.join() });
+	}
+};
+const treeSelectdRef = ref<InstanceType<typeof TreeSelect>>();
+const searchTableRef = ref<InstanceType<typeof pageSearch>>();
+const handleClick = async (tab: TabsPaneContext) => {
+	console.log(tab.props.name);
+	setTimeout(() => {
+		// if (treeSelectdRef.value) {
+		// 	treeSelectdRef.value[0].handleReset();
+		// }
+		// if (searchTableRef.value) {
+		// 	searchTableRef.value[0].handleResetClick();
+		// }
+		if (tableListRef.value) {
+			tableListRef.value[0].fetchPageListData();
+		}
+	}, 500);
+};
 
 const handleEdit = async (id: string) => {
 	await handlePageDetail(id);
@@ -116,7 +138,7 @@ const onImport = () => {
 	document.body.removeChild(link);
 };
 const onExport = () => {};
-const searchTableRef = ref();
+
 // 删除按钮
 function onDelete(value: any) {
 	ElMessageBox.confirm('确定删除该条违法信息通报通讯录吗?', '删除提示', {