This commit is contained in:
2025-08-22 20:01:49 +08:00
6 changed files with 432 additions and 13 deletions

View File

@ -8,6 +8,7 @@
<!-- <el-input v-model="queryParams.pid" placeholder="请选择" clearable /> -->
<el-cascader
:options="matrixOptions"
ref="treeRef"
placeholder="请选择"
@change="handleChange"
:props="{ value: 'matrixId', label: 'name' }"
@ -29,6 +30,9 @@
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="primary" plain icon="Export" @click="handleExport">导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
</el-col>
@ -144,10 +148,12 @@ import {
getProgressCategory,
delProgressCategory,
addProgressCategory,
updateProgressCategory
updateProgressCategory,
downloadProgressCategory
} from '@/api/progress/progressCategory';
import { ProgressCategoryVO, ProgressCategoryQuery, ProgressCategoryForm } from '@/api/progress/progressCategory/types';
import { useUserStoreHook } from '@/store/modules/user';
import { download } from '@/utils/request';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { progress_unit_type, progress_work_type } = toRefs<any>(proxy?.useDict('progress_unit_type', 'progress_work_type'));
@ -161,7 +167,7 @@ type ProgressCategoryOption = {
name: string;
children?: ProgressCategoryOption[];
};
const treeRef = ref();
const matrixOptions = ref([]);
const progressCategoryList = ref<ProgressCategoryVO[]>([]);
@ -236,6 +242,7 @@ const data = reactive<PageData<ProgressCategoryForm, ProgressCategoryQuery>>({
});
const { queryParams, form, rules } = toRefs(data);
const matrixIdList = ref([]);
/** 查询分项工程单价列表 */
const getList = async () => {
@ -252,7 +259,6 @@ const getList = async () => {
});
if (!matrixValue.value) matrixValue.value = matrixList[0].id;
matrixOptions.value = matrixList;
console.log('🚀 ~ getList ~ matrixList:', matrixList);
queryParams.value.matrixId = matrixList[0].children[0].matrixId;
form.value.projectId = matrixList[0].projectId;
form.value.matrixId = matrixList[0].children[0].matrixId;
@ -300,9 +306,7 @@ const reset = () => {
const handleChange = (value: number) => {
form.value.matrixId = value[1];
form.value.projectId = value[0];
queryParams.value.matrixId = value[1];
getList();
};
@ -361,6 +365,13 @@ const handleUpdate = async (row: ProgressCategoryVO) => {
dialog.title = '修改分项工程单价';
};
const handleExport = async () => {
const ids = treeRef.value.getCheckedNodes()[0].pathNodes[0].childrenData.map((item) => item.matrixId);
const res = await downloadProgressCategory({ ids });
download('/progress/progressCategory/export', { ids }, '方阵.xlsx', true);
// window.open(res.data);
};
/** 提交按钮 */
const submitForm = () => {
progressCategoryFormRef.value?.validate(async (valid: boolean) => {