This commit is contained in:
2025-08-26 21:04:22 +08:00
16 changed files with 588 additions and 385 deletions

View File

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

View File

@ -8,11 +8,10 @@ import { ProgressCategoryVO, ProgressCategoryForm, ProgressCategoryQuery } from
* @returns {*}
*/
export const listProgressCategory = (query?: ProgressCategoryQuery): AxiosPromise<ProgressCategoryVO[]> => {
export const listProgressCategory = (id?: string | number): AxiosPromise<any[]> => {
return request({
url: '/progress/progressCategory/list',
method: 'get',
params: query
url: '/progress/progressCategory/listByParent/' + id,
method: 'get'
});
};
@ -70,3 +69,30 @@ export const downloadProgressCategory = (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;
constructionPrice?: string | number;
ownerPrice?: string | number;
relevancyStructure?: string;
/**
* 父类别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({
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'
});
};

View File

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

View File

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

View File

@ -51,11 +51,12 @@ const getTableData = async () => {
//点击消息,写入已读
const onNewsClick = (item: any) => {
newsList.value[item].read = true;
console.log('🚀 ~ onNewsClick ~ newsList.value[item]:', newsList.value[item]);
//并且写入pinia
noticeStore.state.value.notices = newsList.value;
//如果有formPath就前往
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, () => {
console.log('🚀 ~ initSSE ~ data:', JSON.parse(data.value));
let label = '';
let route1 = '';
let detailId = '';
try {
if (JSON.parse(data.value)) {
const obj = JSON.parse(data.value);
route1 = obj.route;
label = obj.message;
detailId = obj.detailId;
route1 = obj.type;
label = obj.content;
// detailId = obj.detailId;
data.value = null;
}
} catch (error) {

View File

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

View File

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

View File

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

View File

@ -4,40 +4,23 @@
<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-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()" 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"
@ -45,6 +28,7 @@
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">
@ -103,16 +87,6 @@
</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"
@ -162,7 +136,79 @@
</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;
}

View File

@ -4,31 +4,27 @@
<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-button type="primary" plain icon="Plus" @click="handleAdd()">新增</el-button>
</el-col>
<el-col :span="1.5">
<file-upload
@ -96,6 +92,13 @@
{{ 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>
@ -110,6 +113,8 @@
</el-table-column>
</el-table>
</el-card>
</el-tabs>
<!-- 添加或修改分项工程单价对话框 -->
<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();
};

View File

@ -20,9 +20,8 @@
</el-card>
</div>
</transition>
<el-tabs type="border-card">
<el-tab-pane label="User"></el-tab-pane>
<el-tab-pane label="Config"></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 {
@ -156,7 +170,7 @@ const buttonLoading = ref(false);
const showSearch = ref(true);
const isExpandAll = ref(true);
const loading = ref(false);
const tabList = ref<any[]>([]);
const queryFormRef = ref<ElFormInstance>();
const progressCategoryTemplateFormRef = ref<ElFormInstance>();
const progressCategoryTemplateTableRef = ref<ElTableInstance>();
@ -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,9 +327,10 @@ const handleDelete = async (row: ProgressCategoryTemplateVO) => {
};
onMounted(() => {
getTabList('0').then((res) => {
tabList.value = res.data;
activeTab.value = res.data[0]?.id;
getList();
getTabList().then((res) => {
console.log('tabList', res.data);
});
});
</script>

View File

@ -20,7 +20,8 @@
</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">
@ -52,6 +53,13 @@
<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">
@ -74,6 +82,8 @@
</el-table-column>
</el-table>
</el-card>
</el-tabs>
<!-- 添加或修改进度类别模版对话框 -->
<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;
getTabList(queryParams.value.projectId as string).then((res) => {
tabList.value = res.data;
activeTab.value = res.data[0]?.id;
getList();
});
};
onMounted(() => {

View File

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