修改进度管理bug

This commit is contained in:
Teo
2025-08-26 20:38:35 +08:00
parent 8d7736b3fc
commit cec48c13af
16 changed files with 587 additions and 385 deletions

View File

@ -6,13 +6,13 @@ VITE_APP_ENV = 'development'
# 开发环境 # 开发环境
# 李陈杰 209 # 李陈杰 209
VITE_APP_BASE_API = 'http://192.168.110.149:8899' VITE_APP_BASE_API = 'http://192.168.110.209:8899'
# 曾涛 # 曾涛
# VITE_APP_BASE_API = 'http://192.168.110.180:8899' # VITE_APP_BASE_API = 'http://192.168.110.180:8899'
# 罗成 # 罗成
# VITE_APP_BASE_API = 'http://192.168.110.213:8899' # VITE_APP_BASE_API = 'http://192.168.110.213:8899'
# 朱银 # 朱银
VITE_APP_BASE_API = 'http://192.168.110.149:8899' # VITE_APP_BASE_API = 'http://192.168.110.149:8899'
#曾涛 #曾涛
# VITE_APP_BASE_API = 'http://192.168.110.171:8899' # VITE_APP_BASE_API = 'http://192.168.110.171:8899'

View File

@ -8,11 +8,10 @@ import { ProgressCategoryVO, ProgressCategoryForm, ProgressCategoryQuery } from
* @returns {*} * @returns {*}
*/ */
export const listProgressCategory = (query?: ProgressCategoryQuery): AxiosPromise<ProgressCategoryVO[]> => { export const listProgressCategory = (id?: string | number): AxiosPromise<any[]> => {
return request({ return request({
url: '/progress/progressCategory/list', url: '/progress/progressCategory/listByParent/' + id,
method: 'get', method: 'get'
params: query
}); });
}; };
@ -70,3 +69,30 @@ export const downloadProgressCategory = (data) => {
data data
}); });
}; };
/**
* 查询分项工程单价下拉树结构
* @param query
* @returns {*}
*/
export const getCategoryTabList = (id?: string | number): AxiosPromise<any[]> => {
return request({
url: '/progress/progressCategory/listTopBySubProjectId/' + id,
method: 'get'
});
};
/**
* 查询分项工程单价外层结构
* @param query
* @returns {*}
*/
export const getCategoryList = (id?: string | number): AxiosPromise<any[]> => {
return request({
url: '/progress/progressCategory/list',
method: 'get',
params: {
parentId: id
}
});
};

View File

@ -97,6 +97,8 @@ export interface ProgressCategoryForm extends BaseEntity {
id?: string | number; id?: string | number;
constructionPrice?: string | number; constructionPrice?: string | number;
ownerPrice?: string | number; ownerPrice?: string | number;
relevancyStructure?: string;
/** /**
* 父类别id * 父类别id
*/ */

View File

@ -66,9 +66,21 @@ export const delProgressCategoryTemplate = (id: string | number | Array<string |
}); });
}; };
export const getTabList = () => { export const getTabList = (id: string) => {
return request({ return request({
url: '/progress/progressCategoryTemplate/listSystemTop', url: '/progress/progressCategoryTemplate/listSystemTop/' + id,
method: 'get'
});
};
/**
* 筛选查询进度类别模版列表
* @param parentId
* @returns {*}
*/
export const listProgressCategoryTemplateByParent = (parentId: string | number): AxiosPromise<ProgressCategoryTemplateVO[]> => {
return request({
url: '/progress/progressCategoryTemplate/listByParent/' + parentId,
method: 'get' method: 'get'
}); });
}; };

View File

@ -12,7 +12,7 @@ export interface ProgressCategoryTemplateVO {
* 计量方式0无 1数量 2百分比 * 计量方式0无 1数量 2百分比
*/ */
unitType: string; unitType: string;
parentId?: string | number;
/** /**
* 工作类型 * 工作类型
*/ */
@ -39,7 +39,9 @@ export interface ProgressCategoryTemplateForm extends BaseEntity {
* 主键id * 主键id
*/ */
id?: string | number; id?: string | number;
parentId?: string | number;
constructionType?: string;
relevancyStructure?: string;
/** /**
* 父类别id * 父类别id
*/ */
@ -76,7 +78,8 @@ export interface ProgressCategoryTemplateQuery {
* 父类别id * 父类别id
*/ */
pid?: string | number; pid?: string | number;
parentId?: string | number;
constructionType?: string;
/** /**
* 类别名称 * 类别名称
*/ */

View File

@ -11,6 +11,7 @@
:on-exceed="handleExceed" :on-exceed="handleExceed"
:on-success="handleUploadSuccess" :on-success="handleUploadSuccess"
:show-file-list="showFileList" :show-file-list="showFileList"
:on-preview="handlePreview"
:headers="headers" :headers="headers"
class="upload-file-uploader" class="upload-file-uploader"
:list-type="isConstruction ? 'picture-card' : 'text'" :list-type="isConstruction ? 'picture-card' : 'text'"
@ -308,6 +309,12 @@ const handleRemove = (file: any, fileList: any) => {
emit('handleRemove', file, fileList); emit('handleRemove', file, fileList);
}; };
const handlePreview = (file: any) => {
if (file.url) {
window.open(file.url);
}
};
// 删除文件 // 删除文件
const handleDelete = async (index: string | number, type?: string) => { const handleDelete = async (index: string | number, type?: string) => {
await proxy?.$modal.confirm('是否确认删除此文件?').finally(); await proxy?.$modal.confirm('是否确认删除此文件?').finally();

View File

@ -51,11 +51,12 @@ const getTableData = async () => {
//点击消息,写入已读 //点击消息,写入已读
const onNewsClick = (item: any) => { const onNewsClick = (item: any) => {
newsList.value[item].read = true; newsList.value[item].read = true;
console.log('🚀 ~ onNewsClick ~ newsList.value[item]:', newsList.value[item]);
//并且写入pinia //并且写入pinia
noticeStore.state.value.notices = newsList.value; noticeStore.state.value.notices = newsList.value;
//如果有formPath就前往 //如果有formPath就前往
if (newsList.value[item].route) { if (newsList.value[item].route) {
proxy?.$tab.openPage('/' + newsList.value[item].route, '', { id: newsList.value[item].detailId, type: 'view' }); proxy?.$tab.openPage(newsList.value[item].route, '', { id: newsList.value[item].detailId, type: 'view' });
} }
}; };

View File

@ -25,15 +25,16 @@ export const initSSE = (url: any) => {
}); });
watch(data, () => { watch(data, () => {
console.log('🚀 ~ initSSE ~ data:', JSON.parse(data.value));
let label = ''; let label = '';
let route1 = ''; let route1 = '';
let detailId = ''; let detailId = '';
try { try {
if (JSON.parse(data.value)) { if (JSON.parse(data.value)) {
const obj = JSON.parse(data.value); const obj = JSON.parse(data.value);
route1 = obj.route; route1 = obj.type;
label = obj.message; label = obj.content;
detailId = obj.detailId; // detailId = obj.detailId;
data.value = null; data.value = null;
} }
} catch (error) { } catch (error) {

View File

@ -48,7 +48,7 @@
v-if="scope.row.status !== 'draft'" v-if="scope.row.status !== 'draft'"
icon="Edit" icon="Edit"
@click="handleView(scope.row)" @click="handleView(scope.row)"
v-hasPermi="['design:PrelimScheme:query']" v-hasPermi="['design:prelimScheme:query']"
>查看流程</el-button >查看流程</el-button
> >
<el-button <el-button
@ -57,7 +57,7 @@
v-if="scope.row.status === 'draft'" v-if="scope.row.status === 'draft'"
icon="Edit" icon="Edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['design:PrelimScheme:edit']" v-hasPermi="['design:prelimScheme:edit']"
>修改</el-button >修改</el-button
> >
<!-- <el-button <!-- <el-button
@ -109,7 +109,7 @@ const dialog = reactive<DialogOption>({
const initFormData: PrelimSchemeForm = { const initFormData: PrelimSchemeForm = {
id: undefined, id: undefined,
projectId: undefined, projectId: currentProject.value?.id,
ossId: undefined, ossId: undefined,
fileName: undefined, fileName: undefined,
fileUrl: undefined, fileUrl: undefined,
@ -120,7 +120,8 @@ const data = reactive<PageData<PrelimSchemeForm, PrelimSchemeQuery>>({
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
projectId: undefined, projectId: currentProject.value?.id,
ossId: undefined, ossId: undefined,
fileName: undefined, fileName: undefined,
fileUrl: undefined, fileUrl: undefined,

View File

@ -173,8 +173,6 @@ const getInfo = () => {
const res = await getPrelimScheme(routeParams.value.id); const res = await getPrelimScheme(routeParams.value.id);
Object.assign(form.value, res.data); Object.assign(form.value, res.data);
form.value.file = res.data.ossId; form.value.file = res.data.ossId;
showFileList.value = false;
loading.value = false; loading.value = false;
buttonLoading.value = false; buttonLoading.value = false;
}); });
@ -188,11 +186,10 @@ const submitForm = async (status1: string) => {
if (form.value.id) { if (form.value.id) {
if (!updateFileStatus.value) return proxy?.$modal.msgError('请上传图纸文件'); if (!updateFileStatus.value) return proxy?.$modal.msgError('请上传图纸文件');
buttonLoading.value = true; buttonLoading.value = true;
let data = { id: form.value.id, projectId: form.value.id, file: form.value.file }; let data = { id: form.value.id, projectId: form.value.projectId, file: form.value.file };
if (form.value.file === form.value.ossId) { if (form.value.file === form.value.ossId && !isUpdateFile.value) {
data.file = ''; data.file = '';
res = await updatePrelimScheme(data).finally(() => (buttonLoading.value = false)); res = await updatePrelimScheme(data).finally(() => (buttonLoading.value = false));
if (res.code == 200) { if (res.code == 200) {
dialog.visible = false; dialog.visible = false;
submit(status.value, form.value); submit(status.value, form.value);
@ -286,10 +283,11 @@ const handleUploadSuccess = (list, res) => {
const fileStatus = ref(false); const fileStatus = ref(false);
const updateFileStatus = ref(true); const updateFileStatus = ref(true);
const isUpdateFile = ref(false); //记录是否在修改页面时是否有新上传的文件
const handleFileChange = (file, fileList) => { const handleFileChange = (file, fileList) => {
if (form.value.id) { if (form.value.id) {
updateFileStatus.value = true; updateFileStatus.value = true;
isUpdateFile.value = true; //记录是否在修改页面时是否有新上传的文件
} }
fileStatus.value = true; fileStatus.value = true;
}; };
@ -297,6 +295,7 @@ const handleFileChange = (file, fileList) => {
const handleFileRemove = (file, fileList) => { const handleFileRemove = (file, fileList) => {
if (form.value.id) { if (form.value.id) {
updateFileStatus.value = false; updateFileStatus.value = false;
isUpdateFile.value = false; //记录是否在修改页面时是否有新上传的文件
} }
showFileList.value = true; showFileList.value = true;

View File

@ -185,8 +185,6 @@ const getInfo = () => {
const res = await getScheme(routeParams.value.id); const res = await getScheme(routeParams.value.id);
Object.assign(form.value, res.data); Object.assign(form.value, res.data);
form.value.file = res.data.ossId; form.value.file = res.data.ossId;
showFileList.value = false;
loading.value = false; loading.value = false;
buttonLoading.value = false; buttonLoading.value = false;
}); });
@ -202,7 +200,7 @@ const submitForm = async (status1: string) => {
buttonLoading.value = true; buttonLoading.value = true;
let data = { id: form.value.id, projectId: form.value.id, file: form.value.file }; let data = { id: form.value.id, projectId: form.value.id, file: form.value.file };
if (form.value.file === form.value.ossId) { if (form.value.file === form.value.ossId && !isUpdateFile.value) {
data.file = ''; data.file = '';
res = await updateScheme(data).finally(() => (buttonLoading.value = false)); res = await updateScheme(data).finally(() => (buttonLoading.value = false));
if (res.code == 200) { if (res.code == 200) {
@ -298,10 +296,11 @@ const handleUploadSuccess = (list, res) => {
}; };
const fileStatus = ref(false); const fileStatus = ref(false);
const updateFileStatus = ref(true); const updateFileStatus = ref(true);
const isUpdateFile = ref(false);
const handleFileChange = (file, fileList) => { const handleFileChange = (file, fileList) => {
if (form.value.id) { if (form.value.id) {
updateFileStatus.value = true; updateFileStatus.value = true;
isUpdateFile.value = true;
} }
fileStatus.value = true; fileStatus.value = true;
}; };
@ -309,6 +308,7 @@ const handleFileChange = (file, fileList) => {
const handleFileRemove = (file, fileList) => { const handleFileRemove = (file, fileList) => {
if (form.value.id) { if (form.value.id) {
updateFileStatus.value = false; updateFileStatus.value = false;
isUpdateFile.value = false;
} }
showFileList.value = true; showFileList.value = true;

View File

@ -4,165 +4,211 @@
<div v-show="showSearch" class="mb-[10px]"> <div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover"> <el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true"> <el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="请选择方阵" prop="pid" label-width="100"> <el-form-item label="请选择项目" prop="pid" label-width="100">
<!-- <el-input v-model="queryParams.pid" placeholder="请选择" clearable /> --> <el-select v-model="queryParams.projectId" placeholder="请选择" @change="handleChange" clearable>
<el-cascader <el-option v-for="item in matrixOptions" :key="item.projectId" :label="item.name" :value="item.projectId" />
:options="matrixOptions" </el-select>
placeholder="请选择" </el-form-item>
@change="handleChange" <el-form-item label="请选择方阵:" prop="pid" label-width="100" v-if="relevancyStructure == '2'">
:props="{ value: 'matrixId', label: 'name' }" <el-select v-model="matrixValue" placeholder="请选择" @change="handleChange" clearable>
v-model="queryParams.matrixId" <el-option v-for="item in matrixList" :key="item.id" :label="item.matrixName" :value="item.id" />
clearable </el-select>
/>
<!-- <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> </el-form-item>
<!-- <el-form-item>
<el-button type="primary" icon="Download" @click="handleQuery">导出周报</el-button>
</el-form-item> -->
</el-form> </el-form>
</el-card> </el-card>
</div> </div>
</transition> </transition>
<el-tabs type="border-card" v-model="activeTab" @tab-click="handleTabClick">
<el-card shadow="never"> <el-tab-pane :label="item.name" v-for="item in tabList" :key="item.id" :name="item.id"></el-tab-pane>
<!-- <template #header> <el-card shadow="never">
<el-row :gutter="10" class="mb8"> <el-table
<el-col :span="1.5"> ref="progressCategoryTableRef"
<el-button type="primary" plain icon="Plus" @click="handleAdd()" v-hasPermi="['progress:progressCategory:add']">新增</el-button> v-loading="loading"
</el-col> :data="progressCategoryList"
<el-col :span="1.5"> row-key="id"
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button> :default-expand-all="isExpandAll"
</el-col> :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> v-if="isExpand"
</el-row> border
</template> --> >
<el-table <el-table-column label="" width="50" type="expand">
ref="progressCategoryTableRef" <template #header>
v-loading="loading" <el-icon
:data="progressCategoryList" class="cursor-pointer text-4! transform-rotate-z--90 transition-all-300"
row-key="id" :class="!isExpandAll ? 'transform-rotate-z--90' : 'transform-rotate-z-90'"
:default-expand-all="isExpandAll" @click="handleToggleExpandAll"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }" ><Expand
border /></el-icon>
> </template>
<el-table-column label="" width="50" type="expand"> <template #default="scope">
<template #header> <el-card class="pl-25" shadow="hover">
<el-icon <el-table :data="scope.row.children" border>
class="cursor-pointer text-4! transform-rotate-z--90 transition-all-300" <el-table-column label="名称" align="center" prop="name" width="170">
:class="!isExpandAll ? 'transform-rotate-z--90' : 'transform-rotate-z-90'" <template #default="{ row }">
@click="handleToggleExpandAll" <el-tooltip :content="row.remark" placement="top" effect="dark" v-if="row.remark">
><Expand <span class="flex items-center justify-center"
/></el-icon> ><i class="iconfont icon-wenhao mr-0.5 text-3.5! text-#999"></i>{{ row.name }}</span
</template> >
<template #default="scope"> </el-tooltip>
<el-card class="pl-25" shadow="hover"> <span v-else>{{ row.name }}</span>
<el-table :data="scope.row.children" border> </template>
<el-table-column label="名称" align="center" prop="name" width="170"> </el-table-column>
<template #default="{ row }"> <el-table-column label="状态" align="center" prop="status" width="100">
<el-tooltip :content="row.remark" placement="top" effect="dark" v-if="row.remark"> <template #default="{ row }">
<span class="flex items-center justify-center" <dict-tag :options="progress_status" :value="row.status" />
><i class="iconfont icon-wenhao mr-0.5 text-3.5! text-#999"></i>{{ row.name }}</span </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> </el-button>
</template> <el-button
</el-table-column> type="success"
<el-table-column label="状态" align="center" prop="status" width="100"> icon="Plus"
<template #default="{ row }"> link
<dict-tag :options="progress_status" :value="row.status" /> size="small"
</template> @click="planRef.openDialog(scope.row)"
</el-table-column> v-hasPermi="['progress:progressCategory:add']"
<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> </el-button>
</template> <el-button
</el-table-column> type="primary"
<el-table-column label="计量方式" align="center" prop="unitType" width="100"> icon="Plus"
<template #default="{ row }"> link
<dict-tag :options="progress_unit_type" :value="row.unitType" /> size="small"
</template> @click="handleDayAdd(scope.row)"
</el-table-column> v-hasPermi="['progress:progressCategory:add']"
<el-table-column label="总量" align="center" prop="total" width="100" /> >
<el-table-column label="总进度" align="center" prop="projectId"> 日报
<template #default="{ row }"> </el-button>
<el-progress :text-inside="true" :stroke-width="20" :percentage="row.completedPercentage" status="success" /> </template>
</template> </el-table-column>
</el-table-column> </el-table>
<el-table-column label="计划总量" align="center" prop="planTotal" width="100" /> </el-card>
<el-table-column label="计划中" align="center" prop="projectId"> </template>
<template #default="{ row }"> </el-table-column>
<el-progress :text-inside="true" :stroke-width="20" :percentage="row.planTotalPercentage" /> <el-table-column label="名称" align="center" prop="name" width="150" />
</template> <el-table-column label="状态" align="center" prop="status" width="100">
</el-table-column> <template #default="{ row }">
<el-table-column label="对比" align="center" prop="unitType" width="100"> <dict-tag :options="progress_status" :value="row.status" />
<template #default="{ row }"> </template>
{{ row.completed + '/' + row.total }} </el-table-column>
</template> <el-table-column label="总进度" align="center" prop="projectId">
</el-table-column> <template #default="{ row }">
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200"> <el-progress :text-inside="true" :stroke-width="20" :percentage="row.completedPercentage" status="success" />
<template #default="scope"> </template>
<!-- <el-button </el-table-column>
type="warning" </el-table>
icon="Download" <el-table ref="progressCategoryTableRef" v-loading="loading" :data="progressCategoryList" v-else border>
link <el-table-column label="名称" align="center" prop="name" width="170">
size="small" <template #default="{ row }">
@click="openDialog(scope.row, 'importDataStatus', '上传数据')" <el-tooltip :content="row.remark" placement="top" effect="dark" v-if="row.remark">
v-hasPermi="['progress:progressCategory:add']" <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>
</el-button> --> </template>
<el-button </el-table-column>
type="warning" <el-table-column label="状态" align="center" prop="status" width="100">
icon="Download" <template #default="{ row }">
link <dict-tag :options="progress_status" :value="row.status" />
size="small" </template>
v-if="scope.row.name === '光伏板'" </el-table-column>
@click="openDialog(scope.row, 'importTableStatus', '上传表格')" <el-table-column label="是否延期" align="center" prop="isDelay" width="100">
v-hasPermi="['progress:progressCategory:add']" <template #default="{ row }">
> <el-tag :type="row.isDelay == '1' ? 'danger' : 'primary'">{{ row.isDelay == '1' ? '是' : '否' }}</el-tag>
导入表格 </template>
</el-button> </el-table-column>
<el-button <el-table-column label="计量方式" align="center" prop="unitType" width="100">
type="success" <template #default="{ row }">
icon="Plus" <dict-tag :options="progress_unit_type" :value="row.unitType" />
link </template>
size="small" </el-table-column>
@click="planRef.openDialog(scope.row)" <el-table-column label="总量" align="center" prop="total" width="100" />
v-hasPermi="['progress:progressCategory:add']" <el-table-column label="总进度" align="center" prop="projectId">
> <template #default="{ row }">
计划 <el-progress :text-inside="true" :stroke-width="20" :percentage="row.completedPercentage" status="success" />
</el-button> </template>
<el-button </el-table-column>
type="primary" <el-table-column label="计划总量" align="center" prop="planTotal" width="100" />
icon="Plus" <el-table-column label="计划中" align="center" prop="projectId">
link <template #default="{ row }">
size="small" <el-progress :text-inside="true" :stroke-width="20" :percentage="row.planTotalPercentage" />
@click="handleDayAdd(scope.row)" </template>
v-hasPermi="['progress:progressCategory:add']" </el-table-column>
> <el-table-column label="对比" align="center" prop="unitType" width="100">
日报 <template #default="{ row }">
</el-button> {{ row.completed + '/' + row.total }}
</template> </template>
</el-table-column> </el-table-column>
</el-table> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
</el-card> <template #default="scope">
</template> <el-button
</el-table-column> type="warning"
<el-table-column label="名称" align="center" prop="name" width="150" /> icon="Download"
<el-table-column label="状态" align="center" prop="status" width="100"> link
<template #default="{ row }"> size="small"
<dict-tag :options="progress_status" :value="row.status" /> v-if="scope.row.name === '光伏板'"
</template> @click="openDialog(scope.row, 'importTableStatus', '上传表格')"
</el-table-column> v-hasPermi="['progress:progressCategory:add']"
<el-table-column label="总进度" align="center" prop="projectId"> >
<template #default="{ row }"> 导入表格
<el-progress :text-inside="true" :stroke-width="20" :percentage="row.completedPercentage" status="success" /> </el-button>
</template> <el-button
</el-table-column> type="success"
</el-table> icon="Plus"
</el-card> 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> <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']" /> <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> </template>
<script setup name="ProgressCategory" lang="ts"> <script setup name="ProgressCategory" lang="ts">
import { import { getProgressCategory, delProgressCategory, addProgressCategory, updateProgressCategory, getProjectSquare } from '@/api/progress/plan/index';
listProgressCategory,
getProgressCategory,
delProgressCategory,
addProgressCategory,
updateProgressCategory,
getProjectSquare
} from '@/api/progress/plan/index';
import { ProgressCategoryVO, ProgressCategoryQuery, ProgressCategoryForm } from '@/api/progress/plan/types'; import { ProgressCategoryVO, ProgressCategoryQuery, ProgressCategoryForm } from '@/api/progress/plan/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -214,6 +253,7 @@ type ProgressCategoryOption = {
}; };
import { useUserStoreHook } from '@/store/modules/user'; import { useUserStoreHook } from '@/store/modules/user';
import { getCategoryTabList, listProgressCategory } from '@/api/progress/progressCategory';
// 获取用户 store // 获取用户 store
const userStore = useUserStoreHook(); const userStore = useUserStoreHook();
// 从 store 中获取项目列表和当前选中的项目 // 从 store 中获取项目列表和当前选中的项目
@ -239,6 +279,11 @@ const dialog = reactive<any>({
title: '', title: '',
file: '' 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 matrixValue = ref<number | undefined>(matrixOptions.value.length > 0 ? matrixOptions.value[0].id : undefined);
const initFormData: ProgressCategoryForm = { const initFormData: ProgressCategoryForm = {
id: undefined, id: undefined,
@ -255,7 +300,7 @@ const data = reactive<PageData<ProgressCategoryForm, ProgressCategoryQuery>>({
pid: undefined, pid: undefined,
name: undefined, name: undefined,
unitType: undefined, unitType: undefined,
projectId: currentProject.value?.id, projectId: undefined,
matrixId: undefined, matrixId: undefined,
params: {} params: {}
}, },
@ -272,7 +317,7 @@ const { queryParams, form, rules } = toRefs(data);
/** 查询进度类别列表 */ /** 查询进度类别列表 */
const getList = async () => { const getList = async () => {
if (!queryParams.value.matrixId) { if (!queryParams.value.projectId) {
const res = await getProjectSquare(currentProject.value?.id); const res = await getProjectSquare(currentProject.value?.id);
if (!res.data || res.data.length === 0) { if (!res.data || res.data.length === 0) {
proxy?.$modal.msgWarning('当前项目下没有方阵,请先创建方阵'); proxy?.$modal.msgWarning('当前项目下没有方阵,请先创建方阵');
@ -286,7 +331,13 @@ const getList = async () => {
try { try {
if (!matrixValue.value) matrixValue.value = matrixList[0].id; if (!matrixValue.value) matrixValue.value = matrixList[0].id;
matrixOptions.value = matrixList; 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) { } catch (error) {
// proxy?.$modal.msgError('获取方阵失败'); // proxy?.$modal.msgError('获取方阵失败');
} }
@ -294,10 +345,20 @@ const getList = async () => {
} }
loading.value = true; loading.value = true;
try { 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'); const data = proxy?.handleTree<ProgressCategoryVO>(res.data, 'id', 'parentId');
if (data) { if (data) {
if (data.every((item) => !item.children)) {
isExpand.value = false;
} else {
isExpand.value = true;
}
progressCategoryList.value = data; progressCategoryList.value = data;
progressCategoryOptions.value = [];
const datas: ProgressCategoryOption = { id: 0, name: '顶级节点', children: [...data] };
progressCategoryOptions.value.push(datas);
loading.value = false;
} }
} finally { } finally {
// 不管成功或失败,最后都设置为 false // 不管成功或失败,最后都设置为 false
@ -305,13 +366,19 @@ const getList = async () => {
} }
}; };
/** 查询进度类别下拉树结构 */ const handleTabClick = (tab: any) => {
const getTreeselect = async () => { const id = tab.props.name; // 实际上就是 item.id
const res = await listProgressCategory(); const current = tabList.value.find((item) => item.id === id);
progressCategoryOptions.value = []; if (current.matrixStructureList && current.matrixStructureList.length > 0) {
const data: ProgressCategoryOption = { id: 0, name: '顶级节点', children: [] }; matrixList.value = current.matrixStructureList;
data.children = proxy?.handleTree<ProgressCategoryOption>(res.data, 'id', 'pid'); activeTab.value = current.matrixStructureList[0].id;
progressCategoryOptions.value.push(data); 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) => { const handleUpdate = async (row: ProgressCategoryVO) => {
reset(); reset();
await getTreeselect();
if (row != null) { if (row != null) {
form.value.pid = row.pid; form.value.pid = row.pid;
} }

View File

@ -4,112 +4,117 @@
<div v-show="showSearch" class="mb-[10px]"> <div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover"> <el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true"> <el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="请选择方阵" prop="pid" label-width="100"> <el-form-item label="请选择项目" prop="pid" label-width="100">
<!-- <el-input v-model="queryParams.pid" placeholder="请选择" clearable /> --> <el-select v-model="queryParams.projectId" placeholder="请选择" @change="handleChange" clearable>
<el-cascader <el-option v-for="item in matrixOptions" :key="item.projectId" :label="item.name" :value="item.projectId" />
:options="matrixOptions" </el-select>
ref="treeRef" </el-form-item>
placeholder="请选择" <el-form-item label="请选择方阵:" prop="pid" label-width="100" v-if="relevancyStructure == '2'">
@change="handleChange" <el-select v-model="matrixValue" placeholder="请选择" @change="handleChange" clearable>
:props="{ value: 'matrixId', label: 'name' }" <el-option v-for="item in matrixList" :key="item.id" :label="item.matrixName" :value="item.id" />
v-model="queryParams.matrixId" </el-select>
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> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
</div> </div>
</transition> </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-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
<el-form ref="progressCategoryFormRef" :model="form" :rules="rules" label-width="120px"> <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-option v-for="dict in progress_work_type" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select> </el-select>
</el-form-item> </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-form-item label="备注" prop="remark" v-if="!form.id">
<el-input v-model="form.remark" placeholder="请输入备注" /> <el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item> </el-form-item>
@ -173,14 +184,20 @@ import {
delProgressCategory, delProgressCategory,
addProgressCategory, addProgressCategory,
updateProgressCategory, updateProgressCategory,
downloadProgressCategory downloadProgressCategory,
getCategoryTabList,
getCategoryList
} from '@/api/progress/progressCategory'; } from '@/api/progress/progressCategory';
import { ProgressCategoryVO, ProgressCategoryQuery, ProgressCategoryForm } from '@/api/progress/progressCategory/types'; import { ProgressCategoryVO, ProgressCategoryQuery, ProgressCategoryForm } from '@/api/progress/progressCategory/types';
import { getTabList } from '@/api/progress/progressCategoryTemplate';
import { useUserStoreHook } from '@/store/modules/user'; import { useUserStoreHook } from '@/store/modules/user';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { progress_unit_type, progress_work_type } = toRefs<any>(proxy?.useDict('progress_unit_type', 'progress_work_type')); 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 // 获取用户 store
const userStore = useUserStoreHook(); const userStore = useUserStoreHook();
// 从 store 中获取项目列表和当前选中的项目 // 从 store 中获取项目列表和当前选中的项目
@ -219,6 +236,8 @@ const initFormData: ProgressCategoryForm = {
unitType: undefined, unitType: undefined,
unit: undefined, unit: undefined,
constructionPrice: undefined, constructionPrice: undefined,
relevancyStructure: undefined,
ownerPrice: undefined, ownerPrice: undefined,
unitPrice: undefined, unitPrice: undefined,
outputValue: undefined, outputValue: undefined,
@ -235,7 +254,7 @@ const data = reactive<PageData<ProgressCategoryForm, ProgressCategoryQuery>>({
form: { ...initFormData }, form: { ...initFormData },
queryParams: { queryParams: {
parentId: undefined, parentId: undefined,
projectId: currentProject.value?.id, projectId: undefined,
matrixId: undefined, matrixId: undefined,
matrixName: undefined, matrixName: undefined,
@ -264,7 +283,8 @@ const data = reactive<PageData<ProgressCategoryForm, ProgressCategoryQuery>>({
isDelay: [{ required: true, message: '是否超期不能为空', trigger: 'blur' }], isDelay: [{ required: true, message: '是否超期不能为空', trigger: 'blur' }],
status: [{ required: true, message: '完成状态不能为空', trigger: 'change' }], status: [{ required: true, message: '完成状态不能为空', trigger: 'change' }],
constructionPrice: [{ 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 () => { const getList = async () => {
if (!queryParams.value.matrixId) { if (!queryParams.value.projectId) {
const res = await getProjectSquare(currentProject.value?.id); const res = await getProjectSquare(currentProject.value?.id);
if (res.data.length === 0) { if (res.data.length === 0) {
proxy?.$modal.msgWarning('当前项目下没有方阵,请先创建方阵'); proxy?.$modal.msgWarning('当前项目下没有方阵,请先创建方阵');
@ -286,17 +306,26 @@ const getList = async () => {
}); });
if (!matrixValue.value) matrixValue.value = matrixList[0].id; if (!matrixValue.value) matrixValue.value = matrixList[0].id;
matrixOptions.value = matrixList; 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.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; loading.value = true;
try { 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'); const data = proxy?.handleTree<ProgressCategoryVO>(res.data, 'id', 'parentId');
if (data) { if (data) {
progressCategoryList.value = 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; loading.value = false;
} }
} finally { } finally {
@ -311,11 +340,12 @@ const handleSuccess = () => {
/** 查询分项工程单价下拉树结构 */ /** 查询分项工程单价下拉树结构 */
const getTreeselect = async () => { const getTreeselect = async () => {
const res = await listProgressCategory(queryParams.value); // const id = relevancyStructure.value == '2' ? matrixValue.value : activeTab.value;
progressCategoryOptions.value = []; // const res = await getCategoryList(id);
const data: ProgressCategoryOption = { id: 0, name: '顶级节点', children: [] }; // progressCategoryOptions.value = [];
data.children = proxy?.handleTree<ProgressCategoryOption>(res.data, 'id', 'parentId'); // const data: ProgressCategoryOption = { id: 0, name: '顶级节点', children: [] };
progressCategoryOptions.value.push(data); // data.children = proxy?.handleTree<ProgressCategoryOption>(res.data, 'id', 'parentId');
// progressCategoryOptions.value.push(data);
}; };
// 取消按钮 // 取消按钮
@ -324,6 +354,21 @@ const cancel = () => {
dialog.visible = false; 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 reset = () => {
const projectId = form.value.projectId; const projectId = form.value.projectId;
@ -332,10 +377,7 @@ const reset = () => {
progressCategoryFormRef.value?.resetFields(); progressCategoryFormRef.value?.resetFields();
}; };
/** 级联选择器改变事件 */ /** 级联选择器改变事件 */
const handleChange = (value: number) => { const handleChange = (value: string) => {
form.value.matrixId = value[1];
form.value.projectId = value[0];
queryParams.value.matrixId = value[1];
getList(); getList();
}; };

View File

@ -20,9 +20,8 @@
</el-card> </el-card>
</div> </div>
</transition> </transition>
<el-tabs type="border-card"> <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"></el-tab-pane> <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-card shadow="never">
<template #header> <template #header>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
@ -55,6 +54,14 @@
<dict-tag :options="progress_work_type" :value="row.workType" /> <dict-tag :options="progress_work_type" :value="row.workType" />
</template> </template>
</el-table-column> </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" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope"> <template #default="scope">
@ -105,6 +112,12 @@
<el-form-item label="类别名称" prop="name"> <el-form-item label="类别名称" prop="name">
<el-input v-model="form.name" placeholder="请输入类别名称" /> <el-input v-model="form.name" placeholder="请输入类别名称" />
</el-form-item> </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-form-item label="关联数据" prop="workType">
<el-select v-model="form.workType" placeholder="请选择关联数据"> <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" /> <el-option v-for="dict in progress_work_type" :key="dict.value" :label="dict.label" :value="dict.value" />
@ -131,6 +144,7 @@ import {
getProgressCategoryTemplate, getProgressCategoryTemplate,
getTabList, getTabList,
listProgressCategoryTemplate, listProgressCategoryTemplate,
listProgressCategoryTemplateByParent,
updateProgressCategoryTemplate updateProgressCategoryTemplate
} from '@/api/progress/progressCategoryTemplate'; } from '@/api/progress/progressCategoryTemplate';
import { import {
@ -165,6 +179,7 @@ const dialog = reactive<DialogOption>({
visible: false, visible: false,
title: '' title: ''
}); });
const activeTab = ref('0');
const initFormData: ProgressCategoryTemplateForm = { const initFormData: ProgressCategoryTemplateForm = {
id: undefined, id: undefined,
@ -194,7 +209,8 @@ const data = reactive<PageData<ProgressCategoryTemplateForm, ProgressCategoryTem
name: [{ required: true, message: '类别名称不能为空', trigger: 'blur' }], name: [{ required: true, message: '类别名称不能为空', trigger: 'blur' }],
unitType: [{ required: true, message: '计量方式不能为空', trigger: 'change' }], unitType: [{ required: true, message: '计量方式不能为空', trigger: 'change' }],
projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }], 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 () => { const getList = async () => {
loading.value = true; loading.value = true;
const res = await listProgressCategoryTemplate(queryParams.value); const res = await listProgressCategoryTemplateByParent(activeTab.value);
const data = proxy?.handleTree<ProgressCategoryTemplateVO>(res.data, 'id', 'parentId'); const data = proxy?.handleTree<ProgressCategoryTemplateVO>(res.data, 'id', 'parentId');
if (data) { if (data) {
progressCategoryTemplateList.value = data; progressCategoryTemplateList.value = data;
@ -213,7 +229,7 @@ const getList = async () => {
/** 查询进度类别模版下拉树结构 */ /** 查询进度类别模版下拉树结构 */
const getTreeselect = async () => { const getTreeselect = async () => {
const res = await listProgressCategoryTemplate(); const res = await listProgressCategoryTemplate({ projectId: 0 });
progressCategoryTemplateOptions.value = []; progressCategoryTemplateOptions.value = [];
const data: ProgressCategoryTemplateOption = { id: 0, name: '顶级节点', children: [] }; const data: ProgressCategoryTemplateOption = { id: 0, name: '顶级节点', children: [] };
data.children = proxy?.handleTree<ProgressCategoryTemplateOption>(res.data, 'id', 'parentId'); data.children = proxy?.handleTree<ProgressCategoryTemplateOption>(res.data, 'id', 'parentId');
@ -311,10 +327,10 @@ const handleDelete = async (row: ProgressCategoryTemplateVO) => {
}; };
onMounted(() => { onMounted(() => {
getList(); getTabList('0').then((res) => {
getTabList().then((res) => {
console.log('tabList', res.data);
tabList.value = res.data; tabList.value = res.data;
activeTab.value = res.data[0]?.id;
getList();
}); });
}); });
</script> </script>

View File

@ -20,60 +20,70 @@
</el-card> </el-card>
</div> </div>
</transition> </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-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
<el-form ref="progressCategoryTemplateFormRef" :model="form" :rules="rules" label-width="80px"> <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-option v-for="dict in progress_work_type" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select> </el-select>
</el-form-item> </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-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item> </el-form-item>
@ -119,7 +135,9 @@ import {
addProgressCategoryTemplate, addProgressCategoryTemplate,
delProgressCategoryTemplate, delProgressCategoryTemplate,
getProgressCategoryTemplate, getProgressCategoryTemplate,
getTabList,
listProgressCategoryTemplate, listProgressCategoryTemplate,
listProgressCategoryTemplateByParent,
updateProgressCategoryTemplate updateProgressCategoryTemplate
} from '@/api/progress/progressCategoryTemplate'; } from '@/api/progress/progressCategoryTemplate';
import { import {
@ -135,6 +153,8 @@ type ProgressCategoryTemplateOption = {
name: string; name: string;
children?: ProgressCategoryTemplateOption[]; children?: ProgressCategoryTemplateOption[];
}; };
const activeTab = ref('0');
const tabList = ref<any[]>([]);
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -186,7 +206,8 @@ const data = reactive<PageData<ProgressCategoryTemplateForm, ProgressCategoryTem
parentId: [{ required: true, message: '父类别id不能为空', trigger: 'blur' }], parentId: [{ required: true, message: '父类别id不能为空', trigger: 'blur' }],
name: [{ required: true, message: '类别名称不能为空', trigger: 'blur' }], name: [{ required: true, message: '类别名称不能为空', trigger: 'blur' }],
unitType: [{ required: true, message: '计量方式不能为空', trigger: 'change' }], 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 () => { const getList = async () => {
loading.value = true; loading.value = true;
const res = await listProgressCategoryTemplate(queryParams.value); const res = await listProgressCategoryTemplateByParent(activeTab.value);
const data = proxy?.handleTree<ProgressCategoryTemplateVO>(res.data, 'id', 'parentId'); const data = proxy?.handleTree<ProgressCategoryTemplateVO>(res.data, 'id', 'parentId');
if (data) { if (data) {
progressCategoryTemplateList.value = data; progressCategoryTemplateList.value = data;
@ -205,7 +226,7 @@ const getList = async () => {
/** 查询进度类别模版下拉树结构 */ /** 查询进度类别模版下拉树结构 */
const getTreeselect = async () => { const getTreeselect = async () => {
const res = await listProgressCategoryTemplate(); const res = await listProgressCategoryTemplate({ projectId: queryParams.value.projectId });
progressCategoryTemplateOptions.value = []; progressCategoryTemplateOptions.value = [];
const data: ProgressCategoryTemplateOption = { id: 0, name: '顶级节点', children: [] }; const data: ProgressCategoryTemplateOption = { id: 0, name: '顶级节点', children: [] };
data.children = proxy?.handleTree<ProgressCategoryTemplateOption>(res.data, 'id', 'parentId'); data.children = proxy?.handleTree<ProgressCategoryTemplateOption>(res.data, 'id', 'parentId');
@ -310,7 +331,11 @@ const getSubProjectList = async () => {
const res = await getChildProject(currentProject.value?.id); const res = await getChildProject(currentProject.value?.id);
projectSon.value = res.data; projectSon.value = res.data;
queryParams.value.projectId = projectSon.value[0]?.id; 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(() => { onMounted(() => {

View File

@ -94,6 +94,7 @@ const options = reactive<Options>({
previews: {}, previews: {},
visible: false visible: false
}); });
console.log('🚀 ~ userStore.avatar:', userStore.avatar);
/** 编辑头像 */ /** 编辑头像 */
const editCropper = () => { const editCropper = () => {