修改进度管理bug
This commit is contained in:
@ -4,165 +4,211 @@
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="请选择方阵:" prop="pid" label-width="100">
|
||||
<!-- <el-input v-model="queryParams.pid" placeholder="请选择" clearable /> -->
|
||||
<el-cascader
|
||||
:options="matrixOptions"
|
||||
placeholder="请选择"
|
||||
@change="handleChange"
|
||||
:props="{ value: 'matrixId', label: 'name' }"
|
||||
v-model="queryParams.matrixId"
|
||||
clearable
|
||||
/>
|
||||
<!-- <el-select v-model="matrixValue" placeholder="请选择" @change="handleChange" clearable>
|
||||
<el-option v-for="item in matrixOptions" :key="item.id" :label="item.matrixName" :value="item.id" />
|
||||
</el-select> -->
|
||||
<el-form-item label="请选择项目:" prop="pid" label-width="100">
|
||||
<el-select v-model="queryParams.projectId" placeholder="请选择" @change="handleChange" clearable>
|
||||
<el-option v-for="item in matrixOptions" :key="item.projectId" :label="item.name" :value="item.projectId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="请选择方阵:" prop="pid" label-width="100" v-if="relevancyStructure == '2'">
|
||||
<el-select v-model="matrixValue" placeholder="请选择" @change="handleChange" clearable>
|
||||
<el-option v-for="item in matrixList" :key="item.id" :label="item.matrixName" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item>
|
||||
<el-button type="primary" icon="Download" @click="handleQuery">导出周报</el-button>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never">
|
||||
<!-- <template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd()" v-hasPermi="['progress:progressCategory:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template> -->
|
||||
<el-table
|
||||
ref="progressCategoryTableRef"
|
||||
v-loading="loading"
|
||||
:data="progressCategoryList"
|
||||
row-key="id"
|
||||
:default-expand-all="isExpandAll"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
border
|
||||
>
|
||||
<el-table-column label="" width="50" type="expand">
|
||||
<template #header>
|
||||
<el-icon
|
||||
class="cursor-pointer text-4! transform-rotate-z--90 transition-all-300"
|
||||
:class="!isExpandAll ? 'transform-rotate-z--90' : 'transform-rotate-z-90'"
|
||||
@click="handleToggleExpandAll"
|
||||
><Expand
|
||||
/></el-icon>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<el-card class="pl-25" shadow="hover">
|
||||
<el-table :data="scope.row.children" border>
|
||||
<el-table-column label="名称" align="center" prop="name" width="170">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip :content="row.remark" placement="top" effect="dark" v-if="row.remark">
|
||||
<span class="flex items-center justify-center"
|
||||
><i class="iconfont icon-wenhao mr-0.5 text-3.5! text-#999"></i>{{ row.name }}</span
|
||||
<el-tabs type="border-card" v-model="activeTab" @tab-click="handleTabClick">
|
||||
<el-tab-pane :label="item.name" v-for="item in tabList" :key="item.id" :name="item.id"></el-tab-pane>
|
||||
<el-card shadow="never">
|
||||
<el-table
|
||||
ref="progressCategoryTableRef"
|
||||
v-loading="loading"
|
||||
:data="progressCategoryList"
|
||||
row-key="id"
|
||||
:default-expand-all="isExpandAll"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
v-if="isExpand"
|
||||
border
|
||||
>
|
||||
<el-table-column label="" width="50" type="expand">
|
||||
<template #header>
|
||||
<el-icon
|
||||
class="cursor-pointer text-4! transform-rotate-z--90 transition-all-300"
|
||||
:class="!isExpandAll ? 'transform-rotate-z--90' : 'transform-rotate-z-90'"
|
||||
@click="handleToggleExpandAll"
|
||||
><Expand
|
||||
/></el-icon>
|
||||
</template>
|
||||
<template #default="scope">
|
||||
<el-card class="pl-25" shadow="hover">
|
||||
<el-table :data="scope.row.children" border>
|
||||
<el-table-column label="名称" align="center" prop="name" width="170">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip :content="row.remark" placement="top" effect="dark" v-if="row.remark">
|
||||
<span class="flex items-center justify-center"
|
||||
><i class="iconfont icon-wenhao mr-0.5 text-3.5! text-#999"></i>{{ row.name }}</span
|
||||
>
|
||||
</el-tooltip>
|
||||
<span v-else>{{ row.name }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="progress_status" :value="row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否延期" align="center" prop="isDelay" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.isDelay == '1' ? 'danger' : 'primary'">{{ row.isDelay == '1' ? '是' : '否' }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计量方式" align="center" prop="unitType" width="100">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="progress_unit_type" :value="row.unitType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总量" align="center" prop="total" width="100" />
|
||||
<el-table-column label="总进度" align="center" prop="projectId">
|
||||
<template #default="{ row }">
|
||||
<el-progress :text-inside="true" :stroke-width="20" :percentage="row.completedPercentage" status="success" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计划总量" align="center" prop="planTotal" width="100" />
|
||||
<el-table-column label="计划中" align="center" prop="projectId">
|
||||
<template #default="{ row }">
|
||||
<el-progress :text-inside="true" :stroke-width="20" :percentage="row.planTotalPercentage" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="对比" align="center" prop="unitType" width="100">
|
||||
<template #default="{ row }">
|
||||
{{ row.completed + '/' + row.total }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="warning"
|
||||
icon="Download"
|
||||
link
|
||||
size="small"
|
||||
v-if="scope.row.name === '光伏板'"
|
||||
@click="openDialog(scope.row, 'importTableStatus', '上传表格')"
|
||||
v-hasPermi="['progress:progressCategory:add']"
|
||||
>
|
||||
</el-tooltip>
|
||||
<span v-else>{{ row.name }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="progress_status" :value="row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否延期" align="center" prop="isDelay" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.isDelay == '1' ? 'danger' : 'primary'">{{ row.isDelay == '1' ? '是' : '否' }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计量方式" align="center" prop="unitType" width="100">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="progress_unit_type" :value="row.unitType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总量" align="center" prop="total" width="100" />
|
||||
<el-table-column label="总进度" align="center" prop="projectId">
|
||||
<template #default="{ row }">
|
||||
<el-progress :text-inside="true" :stroke-width="20" :percentage="row.completedPercentage" status="success" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计划总量" align="center" prop="planTotal" width="100" />
|
||||
<el-table-column label="计划中" align="center" prop="projectId">
|
||||
<template #default="{ row }">
|
||||
<el-progress :text-inside="true" :stroke-width="20" :percentage="row.planTotalPercentage" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="对比" align="center" prop="unitType" width="100">
|
||||
<template #default="{ row }">
|
||||
{{ row.completed + '/' + row.total }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
|
||||
<template #default="scope">
|
||||
<!-- <el-button
|
||||
type="warning"
|
||||
icon="Download"
|
||||
link
|
||||
size="small"
|
||||
@click="openDialog(scope.row, 'importDataStatus', '上传数据')"
|
||||
v-hasPermi="['progress:progressCategory:add']"
|
||||
>
|
||||
导入数据
|
||||
</el-button> -->
|
||||
<el-button
|
||||
type="warning"
|
||||
icon="Download"
|
||||
link
|
||||
size="small"
|
||||
v-if="scope.row.name === '光伏板'"
|
||||
@click="openDialog(scope.row, 'importTableStatus', '上传表格')"
|
||||
v-hasPermi="['progress:progressCategory:add']"
|
||||
>
|
||||
导入表格
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
icon="Plus"
|
||||
link
|
||||
size="small"
|
||||
@click="planRef.openDialog(scope.row)"
|
||||
v-hasPermi="['progress:progressCategory:add']"
|
||||
>
|
||||
计划
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="Plus"
|
||||
link
|
||||
size="small"
|
||||
@click="handleDayAdd(scope.row)"
|
||||
v-hasPermi="['progress:progressCategory:add']"
|
||||
>
|
||||
日报
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="名称" align="center" prop="name" width="150" />
|
||||
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="progress_status" :value="row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总进度" align="center" prop="projectId">
|
||||
<template #default="{ row }">
|
||||
<el-progress :text-inside="true" :stroke-width="20" :percentage="row.completedPercentage" status="success" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
导入表格
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
icon="Plus"
|
||||
link
|
||||
size="small"
|
||||
@click="planRef.openDialog(scope.row)"
|
||||
v-hasPermi="['progress:progressCategory:add']"
|
||||
>
|
||||
计划
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="Plus"
|
||||
link
|
||||
size="small"
|
||||
@click="handleDayAdd(scope.row)"
|
||||
v-hasPermi="['progress:progressCategory:add']"
|
||||
>
|
||||
日报
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="名称" align="center" prop="name" width="150" />
|
||||
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="progress_status" :value="row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总进度" align="center" prop="projectId">
|
||||
<template #default="{ row }">
|
||||
<el-progress :text-inside="true" :stroke-width="20" :percentage="row.completedPercentage" status="success" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-table ref="progressCategoryTableRef" v-loading="loading" :data="progressCategoryList" v-else border>
|
||||
<el-table-column label="名称" align="center" prop="name" width="170">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip :content="row.remark" placement="top" effect="dark" v-if="row.remark">
|
||||
<span class="flex items-center justify-center"><i class="iconfont icon-wenhao mr-0.5 text-3.5! text-#999"></i>{{ row.name }}</span>
|
||||
</el-tooltip>
|
||||
<span v-else>{{ row.name }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="progress_status" :value="row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否延期" align="center" prop="isDelay" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.isDelay == '1' ? 'danger' : 'primary'">{{ row.isDelay == '1' ? '是' : '否' }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计量方式" align="center" prop="unitType" width="100">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="progress_unit_type" :value="row.unitType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总量" align="center" prop="total" width="100" />
|
||||
<el-table-column label="总进度" align="center" prop="projectId">
|
||||
<template #default="{ row }">
|
||||
<el-progress :text-inside="true" :stroke-width="20" :percentage="row.completedPercentage" status="success" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计划总量" align="center" prop="planTotal" width="100" />
|
||||
<el-table-column label="计划中" align="center" prop="projectId">
|
||||
<template #default="{ row }">
|
||||
<el-progress :text-inside="true" :stroke-width="20" :percentage="row.planTotalPercentage" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="对比" align="center" prop="unitType" width="100">
|
||||
<template #default="{ row }">
|
||||
{{ row.completed + '/' + row.total }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="warning"
|
||||
icon="Download"
|
||||
link
|
||||
size="small"
|
||||
v-if="scope.row.name === '光伏板'"
|
||||
@click="openDialog(scope.row, 'importTableStatus', '上传表格')"
|
||||
v-hasPermi="['progress:progressCategory:add']"
|
||||
>
|
||||
导入表格
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
icon="Plus"
|
||||
link
|
||||
size="small"
|
||||
@click="planRef.openDialog(scope.row)"
|
||||
v-hasPermi="['progress:progressCategory:add']"
|
||||
>
|
||||
计划
|
||||
</el-button>
|
||||
<el-button type="primary" icon="Plus" link size="small" @click="handleDayAdd(scope.row)" v-hasPermi="['progress:progressCategory:add']">
|
||||
日报
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-tabs>
|
||||
|
||||
<!-- 导入数据对话框 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.importDataStatus" width="500px" append-to-body>
|
||||
<file-upload class="pl-20 pt" v-model="dialog.file" :limit="20" :file-size="50" :file-type="['shp', 'shx', 'dbf']" />
|
||||
@ -191,14 +237,7 @@
|
||||
</template>
|
||||
|
||||
<script setup name="ProgressCategory" lang="ts">
|
||||
import {
|
||||
listProgressCategory,
|
||||
getProgressCategory,
|
||||
delProgressCategory,
|
||||
addProgressCategory,
|
||||
updateProgressCategory,
|
||||
getProjectSquare
|
||||
} from '@/api/progress/plan/index';
|
||||
import { getProgressCategory, delProgressCategory, addProgressCategory, updateProgressCategory, getProjectSquare } from '@/api/progress/plan/index';
|
||||
import { ProgressCategoryVO, ProgressCategoryQuery, ProgressCategoryForm } from '@/api/progress/plan/types';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
@ -214,6 +253,7 @@ type ProgressCategoryOption = {
|
||||
};
|
||||
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
import { getCategoryTabList, listProgressCategory } from '@/api/progress/progressCategory';
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
@ -239,6 +279,11 @@ const dialog = reactive<any>({
|
||||
title: '',
|
||||
file: ''
|
||||
});
|
||||
const isExpand = ref(true);
|
||||
const activeTab = ref('0');
|
||||
const relevancyStructure = ref('1');
|
||||
const matrixList = ref([]);
|
||||
const tabList = ref<any[]>([]);
|
||||
const matrixValue = ref<number | undefined>(matrixOptions.value.length > 0 ? matrixOptions.value[0].id : undefined);
|
||||
const initFormData: ProgressCategoryForm = {
|
||||
id: undefined,
|
||||
@ -255,7 +300,7 @@ const data = reactive<PageData<ProgressCategoryForm, ProgressCategoryQuery>>({
|
||||
pid: undefined,
|
||||
name: undefined,
|
||||
unitType: undefined,
|
||||
projectId: currentProject.value?.id,
|
||||
projectId: undefined,
|
||||
matrixId: undefined,
|
||||
params: {}
|
||||
},
|
||||
@ -272,7 +317,7 @@ const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询进度类别列表 */
|
||||
const getList = async () => {
|
||||
if (!queryParams.value.matrixId) {
|
||||
if (!queryParams.value.projectId) {
|
||||
const res = await getProjectSquare(currentProject.value?.id);
|
||||
if (!res.data || res.data.length === 0) {
|
||||
proxy?.$modal.msgWarning('当前项目下没有方阵,请先创建方阵');
|
||||
@ -286,7 +331,13 @@ const getList = async () => {
|
||||
try {
|
||||
if (!matrixValue.value) matrixValue.value = matrixList[0].id;
|
||||
matrixOptions.value = matrixList;
|
||||
queryParams.value.matrixId = matrixList[0].children[0].matrixId;
|
||||
console.log('🚀 ~ getList ~ matrixList:', matrixList);
|
||||
queryParams.value.projectId = matrixList[0].projectId;
|
||||
form.value.projectId = matrixList[0].projectId;
|
||||
await getCategoryTabList(queryParams.value.projectId as string).then((res) => {
|
||||
tabList.value = res.data;
|
||||
activeTab.value = res.data[0]?.id;
|
||||
});
|
||||
} catch (error) {
|
||||
// proxy?.$modal.msgError('获取方阵失败');
|
||||
}
|
||||
@ -294,10 +345,20 @@ const getList = async () => {
|
||||
}
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await listProgressCategory(queryParams.value);
|
||||
const id = relevancyStructure.value == '2' ? matrixValue.value : activeTab.value;
|
||||
const res = await listProgressCategory(id);
|
||||
const data = proxy?.handleTree<ProgressCategoryVO>(res.data, 'id', 'parentId');
|
||||
if (data) {
|
||||
if (data.every((item) => !item.children)) {
|
||||
isExpand.value = false;
|
||||
} else {
|
||||
isExpand.value = true;
|
||||
}
|
||||
progressCategoryList.value = data;
|
||||
progressCategoryOptions.value = [];
|
||||
const datas: ProgressCategoryOption = { id: 0, name: '顶级节点', children: [...data] };
|
||||
progressCategoryOptions.value.push(datas);
|
||||
loading.value = false;
|
||||
}
|
||||
} finally {
|
||||
// 不管成功或失败,最后都设置为 false
|
||||
@ -305,13 +366,19 @@ const getList = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
/** 查询进度类别下拉树结构 */
|
||||
const getTreeselect = async () => {
|
||||
const res = await listProgressCategory();
|
||||
progressCategoryOptions.value = [];
|
||||
const data: ProgressCategoryOption = { id: 0, name: '顶级节点', children: [] };
|
||||
data.children = proxy?.handleTree<ProgressCategoryOption>(res.data, 'id', 'pid');
|
||||
progressCategoryOptions.value.push(data);
|
||||
const handleTabClick = (tab: any) => {
|
||||
const id = tab.props.name; // 实际上就是 item.id
|
||||
const current = tabList.value.find((item) => item.id === id);
|
||||
if (current.matrixStructureList && current.matrixStructureList.length > 0) {
|
||||
matrixList.value = current.matrixStructureList;
|
||||
activeTab.value = current.matrixStructureList[0].id;
|
||||
matrixValue.value = current.matrixStructureList[0].id;
|
||||
} else {
|
||||
activeTab.value = current.id;
|
||||
}
|
||||
|
||||
relevancyStructure.value = current.relevancyStructure;
|
||||
getList();
|
||||
};
|
||||
|
||||
// 取消按钮
|
||||
@ -383,7 +450,6 @@ const toggleExpandAll = (data: ProgressCategoryVO[], status: boolean) => {
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row: ProgressCategoryVO) => {
|
||||
reset();
|
||||
await getTreeselect();
|
||||
if (row != null) {
|
||||
form.value.pid = row.pid;
|
||||
}
|
||||
|
@ -4,112 +4,117 @@
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="请选择方阵:" prop="pid" label-width="100">
|
||||
<!-- <el-input v-model="queryParams.pid" placeholder="请选择" clearable /> -->
|
||||
<el-cascader
|
||||
:options="matrixOptions"
|
||||
ref="treeRef"
|
||||
placeholder="请选择"
|
||||
@change="handleChange"
|
||||
:props="{ value: 'matrixId', label: 'name' }"
|
||||
v-model="queryParams.matrixId"
|
||||
clearable
|
||||
/>
|
||||
<!-- <el-select v-model="matrixValue" placeholder="请选择" @change="handleChange" clearable>
|
||||
<el-option v-for="item in matrixOptions" :key="item.id" :label="item.matrixName" :value="item.id" />
|
||||
</el-select> -->
|
||||
<el-form-item label="请选择项目:" prop="pid" label-width="100">
|
||||
<el-select v-model="queryParams.projectId" placeholder="请选择" @change="handleChange" clearable>
|
||||
<el-option v-for="item in matrixOptions" :key="item.projectId" :label="item.name" :value="item.projectId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="请选择方阵:" prop="pid" label-width="100" v-if="relevancyStructure == '2'">
|
||||
<el-select v-model="matrixValue" placeholder="请选择" @change="handleChange" clearable>
|
||||
<el-option v-for="item in matrixList" :key="item.id" :label="item.matrixName" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
<el-tabs type="border-card" v-model="activeTab" @tab-click="handleTabClick">
|
||||
<el-tab-pane :label="item.name" v-for="item in tabList" :key="item.id" :name="item.id"></el-tab-pane>
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd()">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<file-upload
|
||||
upload-url="/progress/progressCategory/import"
|
||||
v-model="file"
|
||||
:limit="1"
|
||||
:file-type="['xls', 'xlsx']"
|
||||
:on-upload-success="handleSuccess"
|
||||
>
|
||||
<el-button type="primary" plain icon="Compass">导入</el-button>
|
||||
</file-upload>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Filter" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
<el-table
|
||||
ref="progressCategoryTableRef"
|
||||
v-loading="loading"
|
||||
:data="progressCategoryList"
|
||||
row-key="id"
|
||||
:default-expand-all="isExpandAll"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
>
|
||||
<!-- <el-table-column label="父类别id" prop="parentId" /> -->
|
||||
<el-table-column label="类别名称" prop="name" width="230" />
|
||||
<el-table-column label="计量方式" align="center" prop="unitType">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="progress_unit_type" :value="row.unitType" v-if="row.parentId != 0" />
|
||||
<span v-else></span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计量单位" align="center" prop="unit">
|
||||
<template #default="{ row }">
|
||||
{{ row.parentId == 0 ? '' : row.unit }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="综合单价(业主)" align="center" prop="ownerPrice">
|
||||
<template #default="{ row }">
|
||||
{{ row.parentId == 0 ? '' : row.ownerPrice }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="综合单价(分包)" align="center" prop="constructionPrice">
|
||||
<template #default="{ row }">
|
||||
{{ row.parentId == 0 ? '' : row.constructionPrice }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产值金额(业主)" align="center" prop="ownerOutputValue">
|
||||
<template #default="{ row }">
|
||||
{{ row.parentId == 0 ? '' : row.ownerOutputValue }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产值金额(分包)" align="center" prop="constructionOutputValue">
|
||||
<template #default="{ row }">
|
||||
{{ row.parentId == 0 ? '' : row.constructionOutputValue }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总数量" align="center" prop="total">
|
||||
<template #default="{ row }">
|
||||
{{ row.parentId == 0 ? '' : row.total }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="关联结构" align="center" prop="relevancyStructure" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.relevancyStructure == '1' ? 'primary' : 'success'">
|
||||
{{ row.relevancyStructure == '1' ? '子项目' : '方阵' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<div>
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['progress:progressCategory:edit']">
|
||||
修改
|
||||
</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['progress:progressCategory:remove']">
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-tabs>
|
||||
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<file-upload
|
||||
upload-url="/progress/progressCategory/import"
|
||||
v-model="file"
|
||||
:limit="1"
|
||||
:file-type="['xls', 'xlsx']"
|
||||
:on-upload-success="handleSuccess"
|
||||
>
|
||||
<el-button type="primary" plain icon="Compass">导入</el-button>
|
||||
</file-upload>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Filter" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
<el-table
|
||||
ref="progressCategoryTableRef"
|
||||
v-loading="loading"
|
||||
:data="progressCategoryList"
|
||||
row-key="id"
|
||||
:default-expand-all="isExpandAll"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
>
|
||||
<!-- <el-table-column label="父类别id" prop="parentId" /> -->
|
||||
<el-table-column label="类别名称" prop="name" width="230" />
|
||||
<el-table-column label="计量方式" align="center" prop="unitType">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="progress_unit_type" :value="row.unitType" v-if="row.parentId != 0" />
|
||||
<span v-else></span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计量单位" align="center" prop="unit">
|
||||
<template #default="{ row }">
|
||||
{{ row.parentId == 0 ? '' : row.unit }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="综合单价(业主)" align="center" prop="ownerPrice">
|
||||
<template #default="{ row }">
|
||||
{{ row.parentId == 0 ? '' : row.ownerPrice }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="综合单价(分包)" align="center" prop="constructionPrice">
|
||||
<template #default="{ row }">
|
||||
{{ row.parentId == 0 ? '' : row.constructionPrice }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产值金额(业主)" align="center" prop="ownerOutputValue">
|
||||
<template #default="{ row }">
|
||||
{{ row.parentId == 0 ? '' : row.ownerOutputValue }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产值金额(分包)" align="center" prop="constructionOutputValue">
|
||||
<template #default="{ row }">
|
||||
{{ row.parentId == 0 ? '' : row.constructionOutputValue }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总数量" align="center" prop="total">
|
||||
<template #default="{ row }">
|
||||
{{ row.parentId == 0 ? '' : row.total }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<div>
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['progress:progressCategory:edit']">
|
||||
修改
|
||||
</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['progress:progressCategory:remove']">
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<!-- 添加或修改分项工程单价对话框 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="progressCategoryFormRef" :model="form" :rules="rules" label-width="120px">
|
||||
@ -148,6 +153,12 @@
|
||||
<el-option v-for="dict in progress_work_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="关联结构" prop="relevancyStructure">
|
||||
<el-select v-model="form.relevancyStructure" value-key="" placeholder="请选择关联结构" clearable filterable @change="">
|
||||
<el-option label="子项目" value="1"></el-option>
|
||||
<el-option label="方阵" value="2"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark" v-if="!form.id">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
@ -173,14 +184,20 @@ import {
|
||||
delProgressCategory,
|
||||
addProgressCategory,
|
||||
updateProgressCategory,
|
||||
downloadProgressCategory
|
||||
downloadProgressCategory,
|
||||
getCategoryTabList,
|
||||
getCategoryList
|
||||
} from '@/api/progress/progressCategory';
|
||||
import { ProgressCategoryVO, ProgressCategoryQuery, ProgressCategoryForm } from '@/api/progress/progressCategory/types';
|
||||
import { getTabList } from '@/api/progress/progressCategoryTemplate';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { progress_unit_type, progress_work_type } = toRefs<any>(proxy?.useDict('progress_unit_type', 'progress_work_type'));
|
||||
|
||||
const activeTab = ref('0');
|
||||
const relevancyStructure = ref('1');
|
||||
const matrixList = ref([]);
|
||||
const tabList = ref<any[]>([]);
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
@ -219,6 +236,8 @@ const initFormData: ProgressCategoryForm = {
|
||||
unitType: undefined,
|
||||
unit: undefined,
|
||||
constructionPrice: undefined,
|
||||
relevancyStructure: undefined,
|
||||
|
||||
ownerPrice: undefined,
|
||||
unitPrice: undefined,
|
||||
outputValue: undefined,
|
||||
@ -235,7 +254,7 @@ const data = reactive<PageData<ProgressCategoryForm, ProgressCategoryQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
parentId: undefined,
|
||||
projectId: currentProject.value?.id,
|
||||
projectId: undefined,
|
||||
|
||||
matrixId: undefined,
|
||||
matrixName: undefined,
|
||||
@ -264,7 +283,8 @@ const data = reactive<PageData<ProgressCategoryForm, ProgressCategoryQuery>>({
|
||||
isDelay: [{ required: true, message: '是否超期不能为空', trigger: 'blur' }],
|
||||
status: [{ required: true, message: '完成状态不能为空', trigger: 'change' }],
|
||||
constructionPrice: [{ required: true, message: '综合单价(分包)不能为空', trigger: 'change' }],
|
||||
ownerPrice: [{ required: true, message: '综合单价(业主)不能为空', trigger: 'change' }]
|
||||
ownerPrice: [{ required: true, message: '综合单价(业主)不能为空', trigger: 'change' }],
|
||||
relevancyStructure: [{ required: true, message: '关联结构不能为空', trigger: 'change' }]
|
||||
}
|
||||
});
|
||||
|
||||
@ -273,7 +293,7 @@ const matrixIdList = ref([]);
|
||||
|
||||
/** 查询分项工程单价列表 */
|
||||
const getList = async () => {
|
||||
if (!queryParams.value.matrixId) {
|
||||
if (!queryParams.value.projectId) {
|
||||
const res = await getProjectSquare(currentProject.value?.id);
|
||||
if (res.data.length === 0) {
|
||||
proxy?.$modal.msgWarning('当前项目下没有方阵,请先创建方阵');
|
||||
@ -286,17 +306,26 @@ const getList = async () => {
|
||||
});
|
||||
if (!matrixValue.value) matrixValue.value = matrixList[0].id;
|
||||
matrixOptions.value = matrixList;
|
||||
queryParams.value.matrixId = matrixList[0].children[0].matrixId;
|
||||
queryParams.value.projectId = matrixList[0].projectId;
|
||||
form.value.projectId = matrixList[0].projectId;
|
||||
form.value.matrixId = matrixList[0].children[0].matrixId;
|
||||
// form.value.matrixId = matrixList[0].projectId;
|
||||
await getCategoryTabList(queryParams.value.projectId as string).then((res) => {
|
||||
tabList.value = res.data;
|
||||
activeTab.value = res.data[0]?.id;
|
||||
});
|
||||
}
|
||||
}
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await listProgressCategory(queryParams.value);
|
||||
const id = relevancyStructure.value == '2' ? matrixValue.value : activeTab.value;
|
||||
const res = await listProgressCategory(id);
|
||||
const data = proxy?.handleTree<ProgressCategoryVO>(res.data, 'id', 'parentId');
|
||||
if (data) {
|
||||
progressCategoryList.value = data;
|
||||
progressCategoryOptions.value = [];
|
||||
const datas: ProgressCategoryOption = { id: 0, name: '顶级节点', children: [...data] };
|
||||
progressCategoryOptions.value.push(datas);
|
||||
console.log('🚀 ~ getList ~ progressCategoryOptions.value:', progressCategoryOptions.value);
|
||||
loading.value = false;
|
||||
}
|
||||
} finally {
|
||||
@ -311,11 +340,12 @@ const handleSuccess = () => {
|
||||
|
||||
/** 查询分项工程单价下拉树结构 */
|
||||
const getTreeselect = async () => {
|
||||
const res = await listProgressCategory(queryParams.value);
|
||||
progressCategoryOptions.value = [];
|
||||
const data: ProgressCategoryOption = { id: 0, name: '顶级节点', children: [] };
|
||||
data.children = proxy?.handleTree<ProgressCategoryOption>(res.data, 'id', 'parentId');
|
||||
progressCategoryOptions.value.push(data);
|
||||
// const id = relevancyStructure.value == '2' ? matrixValue.value : activeTab.value;
|
||||
// const res = await getCategoryList(id);
|
||||
// progressCategoryOptions.value = [];
|
||||
// const data: ProgressCategoryOption = { id: 0, name: '顶级节点', children: [] };
|
||||
// data.children = proxy?.handleTree<ProgressCategoryOption>(res.data, 'id', 'parentId');
|
||||
// progressCategoryOptions.value.push(data);
|
||||
};
|
||||
|
||||
// 取消按钮
|
||||
@ -324,6 +354,21 @@ const cancel = () => {
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
const handleTabClick = (tab: any) => {
|
||||
const id = tab.props.name; // 实际上就是 item.id
|
||||
const current = tabList.value.find((item) => item.id === id);
|
||||
if (current.matrixStructureList && current.matrixStructureList.length > 0) {
|
||||
matrixList.value = current.matrixStructureList;
|
||||
activeTab.value = current.matrixStructureList[0].id;
|
||||
matrixValue.value = current.matrixStructureList[0].id;
|
||||
} else {
|
||||
activeTab.value = current.id;
|
||||
}
|
||||
|
||||
relevancyStructure.value = current.relevancyStructure;
|
||||
getList();
|
||||
};
|
||||
|
||||
// 表单重置
|
||||
const reset = () => {
|
||||
const projectId = form.value.projectId;
|
||||
@ -332,10 +377,7 @@ const reset = () => {
|
||||
progressCategoryFormRef.value?.resetFields();
|
||||
};
|
||||
/** 级联选择器改变事件 */
|
||||
const handleChange = (value: number) => {
|
||||
form.value.matrixId = value[1];
|
||||
form.value.projectId = value[0];
|
||||
queryParams.value.matrixId = value[1];
|
||||
const handleChange = (value: string) => {
|
||||
getList();
|
||||
};
|
||||
|
||||
|
@ -20,9 +20,8 @@
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
<el-tabs type="border-card">
|
||||
<el-tab-pane :label="item.name" v-for="item in tabList" :key="item.id"></el-tab-pane>
|
||||
|
||||
<el-tabs type="border-card" v-model="activeTab" @tab-change="getList">
|
||||
<el-tab-pane :label="item.name" v-for="item in tabList" :key="item.id" :name="item.id"></el-tab-pane>
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
@ -55,6 +54,14 @@
|
||||
<dict-tag :options="progress_work_type" :value="row.workType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="关联结构" align="center" prop="relevancyStructure" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.relevancyStructure == '1' ? 'primary' : 'success'">
|
||||
{{ row.relevancyStructure == '1' ? '子项目' : '方阵' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
@ -105,6 +112,12 @@
|
||||
<el-form-item label="类别名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入类别名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="关联结构" prop="relevancyStructure">
|
||||
<el-select v-model="form.relevancyStructure" value-key="" placeholder="请选择关联结构" clearable filterable @change="">
|
||||
<el-option label="子项目" value="1"></el-option>
|
||||
<el-option label="方阵" value="2"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="关联数据" prop="workType">
|
||||
<el-select v-model="form.workType" placeholder="请选择关联数据">
|
||||
<el-option v-for="dict in progress_work_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
@ -131,6 +144,7 @@ import {
|
||||
getProgressCategoryTemplate,
|
||||
getTabList,
|
||||
listProgressCategoryTemplate,
|
||||
listProgressCategoryTemplateByParent,
|
||||
updateProgressCategoryTemplate
|
||||
} from '@/api/progress/progressCategoryTemplate';
|
||||
import {
|
||||
@ -165,6 +179,7 @@ const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
const activeTab = ref('0');
|
||||
|
||||
const initFormData: ProgressCategoryTemplateForm = {
|
||||
id: undefined,
|
||||
@ -194,7 +209,8 @@ const data = reactive<PageData<ProgressCategoryTemplateForm, ProgressCategoryTem
|
||||
name: [{ required: true, message: '类别名称不能为空', trigger: 'blur' }],
|
||||
unitType: [{ required: true, message: '计量方式不能为空', trigger: 'change' }],
|
||||
projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }],
|
||||
constructionType: [{ required: true, message: '施工类型不能为空', trigger: 'change' }]
|
||||
constructionType: [{ required: true, message: '施工类型不能为空', trigger: 'change' }],
|
||||
relevancyStructure: [{ required: true, message: '关联结构不能为空', trigger: 'change' }]
|
||||
}
|
||||
});
|
||||
|
||||
@ -203,7 +219,7 @@ const { queryParams, form, rules } = toRefs(data);
|
||||
/** 查询进度类别模版列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listProgressCategoryTemplate(queryParams.value);
|
||||
const res = await listProgressCategoryTemplateByParent(activeTab.value);
|
||||
const data = proxy?.handleTree<ProgressCategoryTemplateVO>(res.data, 'id', 'parentId');
|
||||
if (data) {
|
||||
progressCategoryTemplateList.value = data;
|
||||
@ -213,7 +229,7 @@ const getList = async () => {
|
||||
|
||||
/** 查询进度类别模版下拉树结构 */
|
||||
const getTreeselect = async () => {
|
||||
const res = await listProgressCategoryTemplate();
|
||||
const res = await listProgressCategoryTemplate({ projectId: 0 });
|
||||
progressCategoryTemplateOptions.value = [];
|
||||
const data: ProgressCategoryTemplateOption = { id: 0, name: '顶级节点', children: [] };
|
||||
data.children = proxy?.handleTree<ProgressCategoryTemplateOption>(res.data, 'id', 'parentId');
|
||||
@ -311,10 +327,10 @@ const handleDelete = async (row: ProgressCategoryTemplateVO) => {
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
getTabList().then((res) => {
|
||||
console.log('tabList', res.data);
|
||||
getTabList('0').then((res) => {
|
||||
tabList.value = res.data;
|
||||
activeTab.value = res.data[0]?.id;
|
||||
getList();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -20,60 +20,70 @@
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
<el-tabs type="border-card" v-model="activeTab" @tab-change="getList">
|
||||
<el-tab-pane :label="item.name" v-for="item in tabList" :key="item.id" :name="item.id"></el-tab-pane>
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd()" v-hasPermi="['progress:progressCategoryTemplate:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
<el-table
|
||||
ref="progressCategoryTemplateTableRef"
|
||||
v-loading="loading"
|
||||
:data="progressCategoryTemplateList"
|
||||
row-key="id"
|
||||
:default-expand-all="isExpandAll"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
>
|
||||
<el-table-column label="类别名称" prop="name" />
|
||||
<el-table-column label="计量方式" align="center" prop="unitType" width="100">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="progress_unit_type" :value="row.unitType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="关联数据" align="center" prop="workType">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="progress_work_type" :value="row.workType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="关联结构" align="center" prop="relevancyStructure" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.relevancyStructure == '1' ? 'primary' : 'success'">
|
||||
{{ row.relevancyStructure == '1' ? '子项目' : '方阵' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['progress:progressCategoryTemplate:edit']" />
|
||||
</el-tooltip>
|
||||
<el-tooltip content="新增" placement="top">
|
||||
<el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['progress:progressCategoryTemplate:add']" />
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['progress:progressCategoryTemplate:remove']"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-tabs>
|
||||
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd()" v-hasPermi="['progress:progressCategoryTemplate:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
<el-table
|
||||
ref="progressCategoryTemplateTableRef"
|
||||
v-loading="loading"
|
||||
:data="progressCategoryTemplateList"
|
||||
row-key="id"
|
||||
:default-expand-all="isExpandAll"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
>
|
||||
<el-table-column label="类别名称" prop="name" />
|
||||
<el-table-column label="计量方式" align="center" prop="unitType" width="100">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="progress_unit_type" :value="row.unitType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="关联数据" align="center" prop="workType">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="progress_work_type" :value="row.workType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['progress:progressCategoryTemplate:edit']" />
|
||||
</el-tooltip>
|
||||
<el-tooltip content="新增" placement="top">
|
||||
<el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['progress:progressCategoryTemplate:add']" />
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['progress:progressCategoryTemplate:remove']"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<!-- 添加或修改进度类别模版对话框 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="progressCategoryTemplateFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
@ -100,6 +110,12 @@
|
||||
<el-option v-for="dict in progress_work_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="关联结构" prop="relevancyStructure">
|
||||
<el-select v-model="form.relevancyStructure" value-key="" placeholder="请选择关联结构" clearable filterable @change="">
|
||||
<el-option label="子项目" value="1"></el-option>
|
||||
<el-option label="方阵" value="2"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
@ -119,7 +135,9 @@ import {
|
||||
addProgressCategoryTemplate,
|
||||
delProgressCategoryTemplate,
|
||||
getProgressCategoryTemplate,
|
||||
getTabList,
|
||||
listProgressCategoryTemplate,
|
||||
listProgressCategoryTemplateByParent,
|
||||
updateProgressCategoryTemplate
|
||||
} from '@/api/progress/progressCategoryTemplate';
|
||||
import {
|
||||
@ -135,6 +153,8 @@ type ProgressCategoryTemplateOption = {
|
||||
name: string;
|
||||
children?: ProgressCategoryTemplateOption[];
|
||||
};
|
||||
const activeTab = ref('0');
|
||||
const tabList = ref<any[]>([]);
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
@ -186,7 +206,8 @@ const data = reactive<PageData<ProgressCategoryTemplateForm, ProgressCategoryTem
|
||||
parentId: [{ required: true, message: '父类别id不能为空', trigger: 'blur' }],
|
||||
name: [{ required: true, message: '类别名称不能为空', trigger: 'blur' }],
|
||||
unitType: [{ required: true, message: '计量方式不能为空', trigger: 'change' }],
|
||||
projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }]
|
||||
projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }],
|
||||
relevancyStructure: [{ required: true, message: '关联结构不能为空', trigger: 'change' }]
|
||||
}
|
||||
});
|
||||
|
||||
@ -195,7 +216,7 @@ const { queryParams, form, rules } = toRefs(data);
|
||||
/** 查询进度类别模版列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listProgressCategoryTemplate(queryParams.value);
|
||||
const res = await listProgressCategoryTemplateByParent(activeTab.value);
|
||||
const data = proxy?.handleTree<ProgressCategoryTemplateVO>(res.data, 'id', 'parentId');
|
||||
if (data) {
|
||||
progressCategoryTemplateList.value = data;
|
||||
@ -205,7 +226,7 @@ const getList = async () => {
|
||||
|
||||
/** 查询进度类别模版下拉树结构 */
|
||||
const getTreeselect = async () => {
|
||||
const res = await listProgressCategoryTemplate();
|
||||
const res = await listProgressCategoryTemplate({ projectId: queryParams.value.projectId });
|
||||
progressCategoryTemplateOptions.value = [];
|
||||
const data: ProgressCategoryTemplateOption = { id: 0, name: '顶级节点', children: [] };
|
||||
data.children = proxy?.handleTree<ProgressCategoryTemplateOption>(res.data, 'id', 'parentId');
|
||||
@ -310,7 +331,11 @@ const getSubProjectList = async () => {
|
||||
const res = await getChildProject(currentProject.value?.id);
|
||||
projectSon.value = res.data;
|
||||
queryParams.value.projectId = projectSon.value[0]?.id;
|
||||
getList();
|
||||
getTabList(queryParams.value.projectId as string).then((res) => {
|
||||
tabList.value = res.data;
|
||||
activeTab.value = res.data[0]?.id;
|
||||
getList();
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
|
Reference in New Issue
Block a user