Merge branch 'main' of http://xny.yj-3d.com:3000/taoge/new_project into ljx
This commit is contained in:
@ -6,7 +6,7 @@ VITE_APP_ENV = 'development'
|
||||
|
||||
# 开发环境
|
||||
# 李陈杰 209
|
||||
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'
|
||||
# 罗成
|
||||
|
Binary file not shown.
@ -127,6 +127,17 @@ export const majorList = (params) => {
|
||||
params: params
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 获取人员列表
|
||||
* @param query
|
||||
*/
|
||||
export const copyUserList = (params) => {
|
||||
return request({
|
||||
url: '/design/volumeCatalog/copyUserList',
|
||||
method: 'get',
|
||||
params: params
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 获取二维码信息
|
||||
* @param query
|
||||
|
@ -5,8 +5,6 @@ import { ProjectTeamVO } from '@/api/project/projectTeam/types';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
export const getProjectTeam = async () => {
|
||||
const isPermission = useUserStore().permissions.some((item) => item == 'project:team:list');
|
||||
console.log(useUserStore().permissions);
|
||||
|
||||
if (!isPermission && useUserStore().permissions[0] != '*:*:*') return;
|
||||
|
||||
const { id } = $cache.local.getJSON('selectedProject');
|
||||
|
@ -65,12 +65,7 @@
|
||||
<el-button type="primary" con="edit" @click="clickApprovalSheet()">审核</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="state.versionsData.status == 'waiting' || state.versionsData.status == 'finish'">
|
||||
<el-button
|
||||
icon="view"
|
||||
@click="lookApprovalFlow()"
|
||||
type="warning"
|
||||
>查看流程</el-button
|
||||
>
|
||||
<el-button icon="view" @click="lookApprovalFlow()" type="warning">查看流程</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
@ -153,6 +153,11 @@
|
||||
<el-form-item v-if="uploadForm.type == '3'" label="蓝图" prop="fileIds">
|
||||
<file-upload :fileType="['pdf']" :isShowTip="false" :fileSize="100" v-model="uploadForm.fileIds"></file-upload>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="uploadForm.type == '3'" label="抄送人">
|
||||
<el-select multiple filterable clearable v-model="form.userIds" placeholder="请选择抄送人">
|
||||
<el-option :value="item.userId" v-for="item in userCoryList" :key="item.userId" :label="item.nickName + '-' + item.phonenumber" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="uploadForm.type == '1'" label="过程图纸" prop="cancellationIds">
|
||||
<file-upload :fileType="['pdf']" :isShowTip="false" :fileSize="100" v-model="uploadForm.cancellationIds"></file-upload>
|
||||
</el-form-item>
|
||||
@ -255,7 +260,8 @@ import {
|
||||
uploadVolumeFile,
|
||||
majorList,
|
||||
getVolumeCatafileList,
|
||||
volumeFileList
|
||||
volumeFileList,
|
||||
copyUserList
|
||||
} from '@/api/design/volumeCatalog';
|
||||
import { VolumeCatalogVO } from '@/api/design/volumeCatalog/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
@ -281,6 +287,7 @@ const uploadOpinionVisible = ref(false);
|
||||
const design = ref('');
|
||||
const total = ref(0);
|
||||
const dialogHistory = ref(false);
|
||||
const userCoryList = ref([]);
|
||||
const opinion = ref('');
|
||||
const updateRow = ref({
|
||||
opinion: []
|
||||
@ -416,7 +423,13 @@ const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
// 获取人员列表
|
||||
const getDesignUserList = async () => {
|
||||
const res = await copyUserList({});
|
||||
if (res.code === 200) {
|
||||
userCoryList.value = res.data;
|
||||
}
|
||||
};
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
@ -546,7 +559,7 @@ const onSubmit = async () => {
|
||||
type: uploadForm.type
|
||||
};
|
||||
try {
|
||||
await uploadVolumeFile(obj);
|
||||
await uploadVolumeFile({ ...obj, userIds: form.value.userIds });
|
||||
proxy?.$modal.msgSuccess('文件上传成功');
|
||||
uploadVisible.value = false;
|
||||
await getList();
|
||||
@ -656,6 +669,7 @@ const handleAuditInfo = (row) => {
|
||||
// 审核图纸
|
||||
};
|
||||
onMounted(() => {
|
||||
getDesignUserList();
|
||||
getSpecialtyList();
|
||||
getList();
|
||||
});
|
||||
@ -666,6 +680,7 @@ const listeningProject = watch(
|
||||
(nid, oid) => {
|
||||
queryParams.value.projectId = nid;
|
||||
form.value.projectId = nid;
|
||||
getDesignUserList();
|
||||
getSpecialtyList();
|
||||
getList();
|
||||
}
|
||||
|
@ -36,7 +36,6 @@
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="monthPlanList">
|
||||
<el-table-column type="index" label="序号" width="55" align="center" />
|
||||
<el-table-column label="计划月份" align="center" prop="planMonth" />
|
||||
|
@ -175,7 +175,7 @@ const getInfo = () => {
|
||||
form.value = res.data as any;
|
||||
|
||||
console.log('🚀 ~ getInfo ~ form.value:', form.value[0].projectId);
|
||||
|
||||
form.value[0].mid = form.value[0].id;
|
||||
form.value[0].id = form.value[0].projectId + '_' + form.value[0].planMonth;
|
||||
loading.value = false;
|
||||
buttonLoading.value = false;
|
||||
@ -231,13 +231,15 @@ const approvalVerifyOpen = async () => {
|
||||
// 图纸上传成功之后 开始提交
|
||||
const submit = async (status, data) => {
|
||||
form.value = data;
|
||||
console.log(form.value);
|
||||
|
||||
if (status === 'draft') {
|
||||
buttonLoading.value = false;
|
||||
proxy?.$modal.msgSuccess('暂存成功');
|
||||
proxy.$tab.closePage(proxy.$route);
|
||||
proxy.$router.go(-1);
|
||||
} else {
|
||||
const res = await isSubmit(data[1]?.id);
|
||||
const res = await isSubmit(data[0]?.mid);
|
||||
|
||||
if (!res.data) {
|
||||
proxy?.$modal.msgError('三种计划产值必须填写');
|
||||
|
@ -78,6 +78,7 @@
|
||||
</el-table>
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-card>
|
||||
|
||||
<!-- 地块表单弹窗 -->
|
||||
<el-dialog draggable :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="landBlockFormRef" :model="form" :rules="rules" label-width="100px">
|
||||
@ -107,20 +108,22 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 关联方阵弹窗(核心修改区域) -->
|
||||
|
||||
<!-- 关联方阵弹窗(核心修复区域) -->
|
||||
<el-dialog draggable :title="dialogMatrix.title" v-model="dialogMatrix.visible" width="900px" append-to-body>
|
||||
<el-button type="primary" plain icon="Plus" @click="addUnitBoItem" style="margin-bottom: 15px">添加</el-button>
|
||||
<!-- 方阵表单:绑定unitBoList的索引,实现动态校验 -->
|
||||
<!-- 修复1:表单模型绑定formM(根模型),确保嵌套字段校验生效 -->
|
||||
<el-form ref="landBlockFormMatrixRef" :model="formM" label-width="100px">
|
||||
<!-- 修复2:循环formM.unitBoList(而非独立ref),保证数据双向绑定 -->
|
||||
<el-row v-for="(item, i) of formM.unitBoList" :key="i" class="mb-4">
|
||||
<!-- 方阵选择:必填校验 -->
|
||||
<!-- 方阵选择:修复校验规则(移除min:2,改为min:1,适配单层级选择) -->
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="方阵"
|
||||
:prop="`unitBoList[${i}].unitProjectId`"
|
||||
:rules="[
|
||||
{ required: true, message: '请选择方阵', trigger: 'change' },
|
||||
{ type: 'array', min: 2, message: '请选择完整的方阵层级', trigger: 'change' }
|
||||
{ type: 'array', min: 1, message: '请选择完整的方阵', trigger: 'change' }
|
||||
]"
|
||||
>
|
||||
<el-cascader
|
||||
@ -133,7 +136,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- 所属工区:必填校验 -->
|
||||
<!-- 所属工区:保留原有规则 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="所属工区"
|
||||
@ -143,7 +146,7 @@
|
||||
<el-input v-model="item.unitProjectArea" placeholder="请输入所属工区" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- 方阵状态:必填校验 -->
|
||||
<!-- 方阵状态:保留原有规则 -->
|
||||
<el-col :span="6">
|
||||
<el-form-item
|
||||
label="方阵状态"
|
||||
@ -153,8 +156,15 @@
|
||||
<el-input v-model="item.unitProjectStatus" placeholder="请输入方阵状态" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- 删除按钮:禁用逻辑优化(至少保留1项) -->
|
||||
<el-col :span="1" style="margin-left: 15px; display: flex; align-items: flex-end">
|
||||
<el-button style="margin-bottom: 18px" type="danger" icon="Delete" @click="removeUnitBoItem(i)"></el-button>
|
||||
<el-button
|
||||
style="margin-bottom: 18px"
|
||||
type="danger"
|
||||
icon="Delete"
|
||||
@click="removeUnitBoItem(i)"
|
||||
:disabled="formM.unitBoList.length <= 1"
|
||||
></el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
@ -181,21 +191,35 @@ import {
|
||||
} from '@/api/system/landTransfer/landBlock';
|
||||
import { LandBlockVO, LandBlockQuery, LandBlockForm } from '@/api/system/landTransfer/landBlock/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
import { getCurrentInstance, ComponentInternalInstance, onMounted, onUnmounted, watch } from 'vue';
|
||||
import { ElFormInstance, ElMessage } from 'element-plus';
|
||||
import { getCurrentInstance, ComponentInternalInstance, onMounted, onUnmounted, watch, reactive, ref, toRefs, computed } from 'vue';
|
||||
import { ElFormInstance } from 'element-plus';
|
||||
|
||||
// 类型定义补充(避免any)
|
||||
// 类型定义补充
|
||||
interface DialogOption {
|
||||
visible: boolean;
|
||||
title: string;
|
||||
}
|
||||
|
||||
// 方阵级联选择器选项类型
|
||||
interface FangzhenOption {
|
||||
matrixId: string | number;
|
||||
name: string;
|
||||
children?: FangzhenOption[];
|
||||
}
|
||||
|
||||
// 方阵表单项类型
|
||||
interface UnitBoItem {
|
||||
unitProjectArea: string;
|
||||
unitProjectStatus: string;
|
||||
unitProjectId: (string | number)[]; // 级联选择值(数组)
|
||||
}
|
||||
|
||||
// 方阵表单根模型类型(关键:显式声明unitBoList)
|
||||
interface MatrixForm {
|
||||
landId?: string | number; // 关联的地块ID
|
||||
unitBoList: UnitBoItem[]; // 方阵列表
|
||||
}
|
||||
|
||||
// 基础实例与Store
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const userStore = useUserStoreHook();
|
||||
@ -203,14 +227,17 @@ const currentProject = computed(() => userStore.selectedProject);
|
||||
|
||||
// 响应式数据
|
||||
const landBlockList = ref<LandBlockVO[]>([]);
|
||||
const fangzhenList = ref<any[]>([]); // 方阵列表(实际项目建议定义具体类型)
|
||||
const fangzhenList = ref<FangzhenOption[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const uploadRef = ref<any>(null); // upload组件ref
|
||||
const uploadRef = ref<any>(null);
|
||||
|
||||
// 方阵表单数据(核心修改:初始值为空,避免默认填充无效数据)
|
||||
const unitBoList = ref<UnitBoItem[]>([{ unitProjectArea: '', unitProjectStatus: '', unitProjectId: [] }]);
|
||||
// 方阵表单模型(核心修复:使用reactive并显式声明结构)
|
||||
const formM = reactive<MatrixForm>({
|
||||
landId: undefined,
|
||||
unitBoList: [{ unitProjectArea: '', unitProjectStatus: '', unitProjectId: [] }]
|
||||
});
|
||||
|
||||
// 表格选择相关
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
@ -255,7 +282,7 @@ const data = reactive({
|
||||
farmerCount: undefined,
|
||||
params: {}
|
||||
},
|
||||
// 地块表单规则(原有规则保留)
|
||||
// 地块表单规则
|
||||
rules: {
|
||||
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }],
|
||||
projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }],
|
||||
@ -263,7 +290,7 @@ const data = reactive({
|
||||
landName: [{ required: true, message: '地块名称不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
const formM: any = ref({ landId: undefined, unitBoList: [{ unitProjectArea: '', unitProjectStatus: '', unitProjectId: [] }] }); // 方阵关联表单(仅存地块ID)
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询地块列表 */
|
||||
@ -380,10 +407,10 @@ const getfangzhenList = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await subMatrix(currentProject.value.id);
|
||||
// 处理方阵数据(级联选择需父子结构,此处保留原有逻辑)
|
||||
// 处理方阵数据(级联选择需父子结构)
|
||||
res.data.forEach((item: any) => {
|
||||
item.children?.forEach((item2: any) => {
|
||||
item2.matrixId = `${item2.name}_${item2.matrixId}`; // 拼接名称+ID,便于后续拆分
|
||||
item2.matrixId = `${item2.name}_${item2.matrixId}`;
|
||||
});
|
||||
});
|
||||
fangzhenList.value = res.data;
|
||||
@ -394,15 +421,15 @@ const getfangzhenList = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
/** 关联方阵(核心修改:打开弹窗前强制重置表单) */
|
||||
/** 关联方阵 */
|
||||
const handleView = async (row: LandBlockVO) => {
|
||||
if (!row?.id) return proxy?.$modal.msgWarning('请选择有效的地块');
|
||||
|
||||
// 1. 重置方阵表单(清空历史数据)
|
||||
|
||||
// 2. 绑定当前地块ID
|
||||
formM.value.landId = row.id;
|
||||
// 3. 打开弹窗
|
||||
// 重置方阵表单
|
||||
resetMatrix();
|
||||
// 绑定当前地块ID
|
||||
formM.landId = row.id;
|
||||
// 打开弹窗
|
||||
dialogMatrix.visible = true;
|
||||
nextTick(() => {
|
||||
resetMatrix();
|
||||
@ -412,53 +439,59 @@ const handleView = async (row: LandBlockVO) => {
|
||||
|
||||
/** 新增方阵表单项 */
|
||||
const addUnitBoItem = () => {
|
||||
formM.value.unitBoList.push({
|
||||
formM.unitBoList.push({
|
||||
unitProjectArea: '',
|
||||
unitProjectStatus: '',
|
||||
unitProjectId: [] // 级联选择初始为空数组
|
||||
unitProjectId: []
|
||||
});
|
||||
// 重置校验状态
|
||||
landBlockFormMatrixRef.value?.clearValidate();
|
||||
};
|
||||
|
||||
/** 删除方阵表单项 */
|
||||
const removeUnitBoItem = (index: number) => {
|
||||
if (formM.value.unitBoList.length <= 1) {
|
||||
if (formM.unitBoList.length <= 1) {
|
||||
return proxy?.$modal.msgWarning('至少保留一项方阵配置');
|
||||
}
|
||||
formM.value.unitBoList.splice(index, 1);
|
||||
// 重置表单校验状态(避免删除后残留校验提示)
|
||||
formM.unitBoList.splice(index, 1);
|
||||
landBlockFormMatrixRef.value?.clearValidate();
|
||||
};
|
||||
|
||||
/** 提交方阵关联表单 */
|
||||
/** 提交方阵关联表单(核心修复:数据处理逻辑) */
|
||||
const submitFormMatrix = () => {
|
||||
landBlockFormMatrixRef.value?.validate(async (valid: boolean) => {
|
||||
if (!valid) return;
|
||||
if (!formM.value.landId) return proxy?.$modal.msgWarning('地块ID异常,请重新选择地块');
|
||||
if (!formM.landId) return proxy?.$modal.msgWarning('地块ID异常,请重新选择地块');
|
||||
|
||||
try {
|
||||
// 处理方阵数据(拆分名称+ID)
|
||||
const unitBoListParams = formM.value.unitBoList.map((item) => {
|
||||
const [unitProjectName, unitProjectId] = item.unitProjectId[1]?.split('_') || [];
|
||||
if (!unitProjectId) throw new Error('方阵ID解析失败,请重新选择方阵');
|
||||
// 处理方阵数据(修复ID拆分逻辑)
|
||||
const unitBoListParams = formM.unitBoList.map((item) => {
|
||||
// 取级联选择的最后一层值
|
||||
const lastLevelValue = item.unitProjectId[item.unitProjectId.length - 1];
|
||||
if (!lastLevelValue) throw new Error('请选择完整的方阵');
|
||||
|
||||
// 拆分名称和ID
|
||||
const [unitProjectName, unitProjectId] = String(lastLevelValue).split('_');
|
||||
if (!unitProjectId) throw new Error('方阵ID解析失败,请重新选择');
|
||||
|
||||
return {
|
||||
unitProjectArea: item.unitProjectArea.trim(),
|
||||
unitProjectStatus: item.unitProjectStatus.trim(),
|
||||
unitProjectId: unitProjectId, // 纯ID(后端需要)
|
||||
unitProjectName: unitProjectName // 名称(可选,用于显示)
|
||||
unitProjectId: unitProjectId,
|
||||
unitProjectName: unitProjectName
|
||||
};
|
||||
});
|
||||
|
||||
// 调用关联接口
|
||||
const res = await LandUnit({
|
||||
landId: formM.value.landId,
|
||||
landId: formM.landId,
|
||||
unitBoList: unitBoListParams
|
||||
});
|
||||
|
||||
if (res.code === 200) {
|
||||
proxy?.$modal.msgSuccess('关联方阵成功');
|
||||
cancelMatrix(); // 关闭弹窗并重置表单
|
||||
await getList(); // 刷新地块列表
|
||||
dialogMatrix.visible = false;
|
||||
await getList();
|
||||
} else {
|
||||
proxy?.$modal.msgError(res.msg || '关联失败');
|
||||
}
|
||||
@ -474,16 +507,10 @@ const cancelMatrix = () => {
|
||||
dialogMatrix.visible = false;
|
||||
};
|
||||
|
||||
/** 方阵表单重置(核心修改:清空所有数据+重置校验) */
|
||||
/** 方阵表单重置 */
|
||||
const resetMatrix = () => {
|
||||
// 1. 清空地块ID
|
||||
formM.value.landId = undefined;
|
||||
// 2. 重置方阵列表(仅保留一个空项)
|
||||
// 使用splice方法修改数组
|
||||
formM.value.unitBoList = [{ unitProjectArea: '', unitProjectStatus: '', unitProjectId: [] }];
|
||||
console.log(formM.value.unitBoList, 'unitBoList');
|
||||
|
||||
// 3. 重置表单校验状态
|
||||
formM.landId = undefined;
|
||||
formM.unitBoList = [{ unitProjectArea: '', unitProjectStatus: '', unitProjectId: [] }];
|
||||
if (landBlockFormMatrixRef.value) {
|
||||
landBlockFormMatrixRef.value.resetFields();
|
||||
landBlockFormMatrixRef.value.clearValidate();
|
||||
@ -496,11 +523,11 @@ const listeningProject = watch(
|
||||
(newId) => {
|
||||
if (newId) {
|
||||
queryParams.value.projectId = newId;
|
||||
getfangzhenList(); // 刷新方阵列表
|
||||
getList(); // 刷新地块列表
|
||||
getfangzhenList();
|
||||
getList();
|
||||
}
|
||||
},
|
||||
{ immediate: true } // 初始加载时执行一次
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
/** 导入Excel */
|
||||
@ -529,36 +556,34 @@ const handleImport = (options: { file: File }) => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
/** 导出模板 */
|
||||
const exportFile = () => {
|
||||
// 导出模版文件
|
||||
try {
|
||||
// 创建a标签
|
||||
const link = document.createElement('a');
|
||||
// 设置PDF文件路径 - 相对于public目录
|
||||
link.href = '/dikuai.xlsx';
|
||||
// 设置下载后的文件名
|
||||
link.download = '地块信息导入模版.xlsx';
|
||||
// 触发点击
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
// 清理
|
||||
document.body.removeChild(link);
|
||||
} catch (error) {
|
||||
alert('下载失败,请重试');
|
||||
}
|
||||
};
|
||||
|
||||
/** 下载导入模板 */
|
||||
const downloadTemplate = () => {
|
||||
try {
|
||||
const link = document.createElement('a');
|
||||
link.href = '/landBlock.xlsx'; // 模板路径(需确保public目录下存在该文件)
|
||||
link.download = '地块信息导入模板.xlsx'; // 下载后文件名
|
||||
link.href = '/landBlock.xlsx';
|
||||
link.download = '地块信息导入模板.xlsx';
|
||||
document.body.appendChild(link);
|
||||
link.click(); // 触发下载
|
||||
link.click();
|
||||
} catch (err) {
|
||||
proxy?.$modal.msgError('模板下载失败,请重试');
|
||||
} finally {
|
||||
document.body.removeChild(link); // 清理DOM
|
||||
const link = document.querySelector('a[download="地块信息导入模板.xlsx"]');
|
||||
if (link) document.body.removeChild(link);
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user