|
@@ -17,17 +17,26 @@
|
|
|
import type { BasicColumn } from '/@/components/Table/src/types/table';
|
|
import type { BasicColumn } from '/@/components/Table/src/types/table';
|
|
|
import { useRouter } from 'vue-router';
|
|
import { useRouter } from 'vue-router';
|
|
|
import SvgIcon from '/@/components/Icon/src/SvgIcon.vue';
|
|
import SvgIcon from '/@/components/Icon/src/SvgIcon.vue';
|
|
|
|
|
+ import { ref, watch } from 'vue';
|
|
|
|
|
+ import { useMineDepartmentStore } from '/@/store/modules/mine';
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
|
|
+ const deptId = ref();
|
|
|
|
|
|
|
|
// 封装接口调用,获取数据后手动添加「总计」行
|
|
// 封装接口调用,获取数据后手动添加「总计」行
|
|
|
const fetchTableData = async (params: any) => {
|
|
const fetchTableData = async (params: any) => {
|
|
|
// 1. 调用原始接口,获取数据
|
|
// 1. 调用原始接口,获取数据
|
|
|
- const originalRecords = await getGoafAccessCount(params);
|
|
|
|
|
|
|
+ setLoading(true);
|
|
|
|
|
+ const originalRecords = await getGoafAccessCount({
|
|
|
|
|
+ deptId: deptId.value,
|
|
|
|
|
+ ...params,
|
|
|
|
|
+ }).finally(() => {
|
|
|
|
|
+ setLoading(false);
|
|
|
|
|
+ });
|
|
|
if (originalRecords.length === 0) return originalRecords; // 无数据时直接返回
|
|
if (originalRecords.length === 0) return originalRecords; // 无数据时直接返回
|
|
|
|
|
|
|
|
// 2. 定义需要求和的数值列字段
|
|
// 2. 定义需要求和的数值列字段
|
|
|
- const numberFields = ['mineNum', 'yjNum', 'wxjrNum', 'jrNum', 'wjNum', 'zxNum', 'lxNum'];
|
|
|
|
|
|
|
+ const numberFields = ['mineNum', 'yjNum', 'wxjrNum', 'jrNum', 'wjNum', 'zxNum', 'lxNum', 'zdNum'];
|
|
|
|
|
|
|
|
// 3. 构建「总计」行对象
|
|
// 3. 构建「总计」行对象
|
|
|
const totalRow = {
|
|
const totalRow = {
|
|
@@ -72,7 +81,7 @@
|
|
|
// 拼接最终列配置(序号列 + 原有业务列)
|
|
// 拼接最终列配置(序号列 + 原有业务列)
|
|
|
const finalTableColumns = [customIndexColumn, ...accessStatisticsColumns];
|
|
const finalTableColumns = [customIndexColumn, ...accessStatisticsColumns];
|
|
|
|
|
|
|
|
- const [registerTable] = useTable({
|
|
|
|
|
|
|
+ const [registerTable, { reload, setLoading }] = useTable({
|
|
|
title: '矿山信息表格',
|
|
title: '矿山信息表格',
|
|
|
api: fetchTableData, // 数据统计接口
|
|
api: fetchTableData, // 数据统计接口
|
|
|
columns: finalTableColumns,
|
|
columns: finalTableColumns,
|
|
@@ -101,6 +110,18 @@
|
|
|
query: { deptId },
|
|
query: { deptId },
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ const mineStore = useMineDepartmentStore();
|
|
|
|
|
+ watch(
|
|
|
|
|
+ () => mineStore.getDepartId,
|
|
|
|
|
+ (v) => {
|
|
|
|
|
+ deptId.value = v || mineStore.getRootId;
|
|
|
|
|
+ reload();
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ immediate: true,
|
|
|
|
|
+ }
|
|
|
|
|
+ );
|
|
|
</script>
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
<style lang="less" scoped>
|
|
|
:deep(.ant-table-thead th:nth-child(1)) {
|
|
:deep(.ant-table-thead th:nth-child(1)) {
|