优化逻辑bug
This commit is contained in:
@ -73,7 +73,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.parentId">
|
||||
<div>
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['progress:progressCategory:edit']">
|
||||
修改
|
||||
</el-button>
|
||||
@ -88,6 +88,21 @@
|
||||
<!-- 添加或修改分项工程单价对话框 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="progressCategoryFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="父类别" prop="parentId">
|
||||
<el-tree-select
|
||||
v-model="form.parentId"
|
||||
:data="progressCategoryOptions"
|
||||
:props="{ value: 'id', label: 'name', children: 'children' }"
|
||||
value-key="id"
|
||||
placeholder="请选择父类别"
|
||||
check-strictly
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="计量方式" prop="unitType">
|
||||
<el-select v-model="form.unitType" placeholder="请选择关联数据">
|
||||
<el-option v-for="dict in progress_unit_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="类别名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入类别名称" :disabled="form.id != null" />
|
||||
</el-form-item>
|
||||
@ -100,7 +115,14 @@
|
||||
<el-form-item label="综合单价" prop="unitPrice">
|
||||
<el-input v-model="form.unitPrice" placeholder="请输入综合单价" />
|
||||
</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" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="总数量/百分比" prop="total">
|
||||
<el-input v-model="form.total" placeholder="请输入总数量/百分比" />
|
||||
</el-form-item> -->
|
||||
@ -128,7 +150,7 @@ import { ProgressCategoryVO, ProgressCategoryQuery, ProgressCategoryForm } from
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { progress_unit_type, progress_status } = toRefs<any>(proxy?.useDict('progress_unit_type', 'progress_status'));
|
||||
const { progress_unit_type, progress_work_type } = toRefs<any>(proxy?.useDict('progress_unit_type', 'progress_work_type'));
|
||||
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
@ -161,7 +183,7 @@ const dialog = reactive<DialogOption>({
|
||||
const initFormData: ProgressCategoryForm = {
|
||||
id: undefined,
|
||||
parentId: undefined,
|
||||
projectId: currentProject.value?.id,
|
||||
projectId: '',
|
||||
matrixId: undefined,
|
||||
matrixName: undefined,
|
||||
name: undefined,
|
||||
@ -183,6 +205,7 @@ const data = reactive<PageData<ProgressCategoryForm, ProgressCategoryQuery>>({
|
||||
queryParams: {
|
||||
parentId: undefined,
|
||||
projectId: currentProject.value?.id,
|
||||
|
||||
matrixId: undefined,
|
||||
matrixName: undefined,
|
||||
name: undefined,
|
||||
@ -229,7 +252,10 @@ const getList = async () => {
|
||||
});
|
||||
if (!matrixValue.value) matrixValue.value = matrixList[0].id;
|
||||
matrixOptions.value = matrixList;
|
||||
console.log('🚀 ~ getList ~ matrixList:', matrixList);
|
||||
queryParams.value.matrixId = matrixList[0].children[0].matrixId;
|
||||
form.value.projectId = matrixList[0].projectId;
|
||||
form.value.matrixId = matrixList[0].children[0].matrixId;
|
||||
}
|
||||
}
|
||||
loading.value = true;
|
||||
@ -262,12 +288,19 @@ const cancel = () => {
|
||||
|
||||
// 表单重置
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
const projectId = form.value.projectId;
|
||||
const matrixId = form.value.matrixId;
|
||||
|
||||
form.value = { ...initFormData, projectId, matrixId };
|
||||
|
||||
isDisabled.value = false;
|
||||
progressCategoryFormRef.value?.resetFields();
|
||||
};
|
||||
/** 级联选择器改变事件 */
|
||||
const handleChange = (value: number) => {
|
||||
form.value.matrixId = value[1];
|
||||
form.value.projectId = value[0];
|
||||
|
||||
queryParams.value.matrixId = value[1];
|
||||
|
||||
getList();
|
||||
|
@ -9,7 +9,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="施工类型" prop="constructionType">
|
||||
<el-select v-model="queryParams.constructionType" placeholder="请选择施工类型" clearable @change="getList">
|
||||
<el-option v-for="dict in project_category_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
<el-option v-for="dict in project_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
@ -89,7 +89,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="施工类型" prop="constructionType">
|
||||
<el-select v-model="form.constructionType" placeholder="请选择施工类型" disabled>
|
||||
<el-option v-for="dict in project_category_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
<el-option v-for="dict in project_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="计量方式" prop="unitType">
|
||||
@ -141,8 +141,8 @@ type ProgressCategoryTemplateOption = {
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const { progress_work_type, progress_unit_type, project_category_type } = toRefs<any>(
|
||||
proxy?.useDict('progress_work_type', 'progress_unit_type', 'project_category_type')
|
||||
const { progress_work_type, progress_unit_type, project_type } = toRefs<any>(
|
||||
proxy?.useDict('progress_work_type', 'progress_unit_type', 'project_type')
|
||||
);
|
||||
const progressCategoryTemplateList = ref<ProgressCategoryTemplateVO[]>([]);
|
||||
const progressCategoryTemplateOptions = ref<ProgressCategoryTemplateOption[]>([]);
|
||||
|
@ -77,13 +77,13 @@
|
||||
<!-- 添加或修改进度类别模版对话框 -->
|
||||
<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-item label="父类别id" prop="parentId">
|
||||
<el-form-item label="父类别" prop="parentId">
|
||||
<el-tree-select
|
||||
v-model="form.parentId"
|
||||
:data="progressCategoryTemplateOptions"
|
||||
:props="{ value: 'id', label: 'name', children: 'children' }"
|
||||
value-key="id"
|
||||
placeholder="请选择父类别id"
|
||||
placeholder="请选择父类别"
|
||||
check-strictly
|
||||
/>
|
||||
</el-form-item>
|
||||
@ -138,9 +138,7 @@ type ProgressCategoryTemplateOption = {
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const { progress_work_type, progress_unit_type, project_category_type } = toRefs<any>(
|
||||
proxy?.useDict('progress_work_type', 'progress_unit_type', 'project_category_type')
|
||||
);
|
||||
const { progress_work_type, progress_unit_type } = toRefs<any>(proxy?.useDict('progress_work_type', 'progress_unit_type'));
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
|
Reference in New Issue
Block a user