计划出图

This commit is contained in:
2025-08-14 10:50:34 +08:00

View File

@ -43,7 +43,7 @@
class="upload-demo" class="upload-demo"
:http-request="importExcel" :http-request="importExcel"
style="margin-right: 12px" style="margin-right: 12px"
v-if="Object.keys(state.versionsData).length === 0 || state.versionsData.status == 'cancel' || state.versionsData.status == 'draft'" v-if="Object.keys(state.versionsData).length === 0 || state.versionsData.status == 'cancel'"
:show-file-list="false" :show-file-list="false"
> >
<template #trigger> <template #trigger>
@ -52,9 +52,9 @@
</el-upload> </el-upload>
<el-button v-if="state.versionsData.status == 'draft'" type="primary" con="edit" @click="clickApprovalSheet()">审核</el-button> <el-button v-if="state.versionsData.status == 'draft'" type="primary" con="edit" @click="clickApprovalSheet()">审核</el-button>
<el-button <el-button
v-if="state.versionsData.status == 'warning' || state.versionsData.status == 'finish'" v-if="state.versionsData.status == 'waiting' || state.versionsData.status == 'finish'"
icon="view" icon="view"
@click="lookApprovalSheet()" @click="lookApprovalFlow()"
type="warning" type="warning"
>查看流程</el-button >查看流程</el-button
> >
@ -65,6 +65,9 @@
v-if="index < 3" v-if="index < 3"
:ref="(el) => (tableRef[index] = el)" :ref="(el) => (tableRef[index] = el)"
:data="state.tableData" :data="state.tableData"
v-loading="state.loading.list"
stripe
:row-class-name="state.tableData.length === 0 ? 'table-null' : ''"
style="width: 100%; margin-bottom: 20px; height: calc(100vh - 305px)" style="width: 100%; margin-bottom: 20px; height: calc(100vh - 305px)"
row-key="id" row-key="id"
border border
@ -132,7 +135,7 @@ const state = reactive({
// 物质设备清单 // 物质设备清单
// tableData_sdsqd: [], // tableData_sdsqd: [],
// 展开收起 // 展开收起
isOpen: false, isOpen: true,
// 版本号 // 版本号
versionsData: {} versionsData: {}
}); });
@ -172,6 +175,10 @@ async function getVersionNums(isSheet = true) {
state.options = rows || []; state.options = rows || [];
if (state.options.length > 0) { if (state.options.length > 0) {
state.queryForm.versions = state.options[0].versions; state.queryForm.versions = state.options[0].versions;
if (state.work_order_type == 3) {
state.versionsData = state.options[0] || [];
console.log('state.versionsData', state.versionsData);
}
// 等待表名加载完成 // 等待表名加载完成
console.log(isSheet, state.sheets.length); console.log(isSheet, state.sheets.length);
if (isSheet) { if (isSheet) {
@ -181,8 +188,7 @@ async function getVersionNums(isSheet = true) {
} }
} }
} else { } else {
state.error = `获取版本号失败: 错误码 ${code}`; await handleQueryList(isSheet);
console.error(state.error);
} }
} catch (err) { } catch (err) {
state.error = `获取版本号时发生错误: ${err.message}`; state.error = `获取版本号时发生错误: ${err.message}`;
@ -238,9 +244,6 @@ async function handleQueryList(isSheet = true) {
const result = await obtainTheList(state.queryForm); const result = await obtainTheList(state.queryForm);
if (result?.code === 200) { if (result?.code === 200) {
if (state.work_order_type == 3) {
state.versionsData = result.data || [];
}
state.tableData = result.data || []; state.tableData = result.data || [];
} else { } else {
state.error = `获取列表数据失败: 错误码 ${result?.code}`; state.error = `获取列表数据失败: 错误码 ${result?.code}`;
@ -256,13 +259,9 @@ async function handleQueryList(isSheet = true) {
// 上传excel // 上传excel
function importExcel(options) { function importExcel(options) {
console.log(options); console.log(options);
const loading = ElLoading.service({
lock: true,
text: '正在导入,请稍候...',
background: 'rgba(0, 0, 0, 0.7)'
});
let formData = new FormData(); let formData = new FormData();
formData.append('file', options.file); formData.append('file', options.file);
state.loading.list = true;
importExcelFile({ workOrderType: state.work_order_type, projectId: currentProject.value?.id }, formData) importExcelFile({ workOrderType: state.work_order_type, projectId: currentProject.value?.id }, formData)
.then((res) => { .then((res) => {
const { code } = res; const { code } = res;
@ -271,11 +270,15 @@ function importExcel(options) {
// 更新列表 // 更新列表
getVersionNums(false); getVersionNums(false);
} else { } else {
getVersionNums();
proxy.$modal.msgError(res.msg || '导入失败'); proxy.$modal.msgError(res.msg || '导入失败');
} }
}) })
.finally(() => { .finally(() => {
loading.close(); state.loading.list = false;
})
.finally(() => {
// loading.close();
}); });
} }
// 切换表名 // 切换表名