工程量清单添加模板下载

This commit is contained in:
2025-08-27 17:12:52 +08:00
parent f637e65635
commit fa1f3215cf
4 changed files with 41 additions and 4 deletions

View File

@ -6,9 +6,9 @@ VITE_APP_ENV = 'development'
# 开发环境
# 李陈杰 209
# VITE_APP_BASE_API = 'http://192.168.110.209: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'
# 朱银

Binary file not shown.

Binary file not shown.

View File

@ -21,6 +21,9 @@
<el-form-item>
<el-button type="primary" @click="openTable(false, index)">一键收起</el-button>
</el-form-item>
<el-form-item>
<el-button type="success" @click="downloadTemplate(1)">下载模板</el-button>
</el-form-item>
<el-form-item>
<el-upload ref="uploadRef" class="upload-demo" :http-request="importExcel" :show-file-list="false">
<template #trigger>
@ -51,15 +54,21 @@
<el-option v-for="item in state.options" :key="item.versions" :label="item.versions" :value="item.versions" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="success" @click="downloadTemplate(2)">下载模板</el-button>
</el-form-item>
<el-form-item>
<el-upload ref="uploadRef" class="upload-demo" :http-request="importExcel" :show-file-list="false" style="margin-right: 10px">
<template #trigger>
<el-button type="primary">导入excel</el-button>
</template>
</el-upload>
<el-button v-if="state.versionsData.status == 'draft'" type="primary" con="edit" @click="clickApprovalSheet()">审核</el-button>
</el-form-item>
<el-form-item v-if="state.versionsData.status == 'draft'">
<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
v-if="state.versionsData.status == 'waiting' || state.versionsData.status == 'finish'"
icon="view"
@click="lookApprovalFlow()"
type="warning"
@ -345,6 +354,34 @@ function lookApprovalFlow(row) {
}
});
}
// 下载模板
const downloadTemplate = (type) => {
// 导出模版文件
try {
let linkurl = '';
let name = '';
if (type==1) {
linkurl = '/billOfQuantities.xlsx';
name = '工程量清单模板.xlsx';
}else{
linkurl = '/materialsEquipment.xlsx';
name = '物资设备清单模板.xlsx';
}
// 创建a标签
const link = document.createElement('a');
// 设置PDF文件路径 - 相对于public目录
link.href = linkurl;
// 设置下载后的文件名
link.download = name;
// 触发点击
document.body.appendChild(link);
link.click();
// 清理
document.body.removeChild(link);
} catch (error) {
alert('下载失败,请重试');
}
};
</script>
<style>
.billof-quantities {