jhprjv2/ruoyi-ui/src/views/project/projectPlan/index.vue

173 lines
6.7 KiB
Vue
Raw Normal View History

2023-09-07 23:50:10 +08:00
<template>
<div class="app-container">
2023-09-08 23:42:40 +08:00
<el-tabs v-model="activeName" @tab-click="tabClick">
<el-tab-pane label="城建项目计划" name="f"></el-tab-pane>
<el-tab-pane label="重点项目计划" name="s"></el-tab-pane>
</el-tabs>
2023-09-07 23:50:10 +08:00
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
2023-09-08 23:42:40 +08:00
<el-button type="primary" plain icon="el-icon-upload" size="mini" @click="doImport"
v-hasPermi="['project:projectPlan:import']">导入</el-button>
2023-09-07 23:50:10 +08:00
</el-col>
<el-col :span="1.5">
2023-09-08 23:42:40 +08:00
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="doExport"
v-hasPermi="['project:projectPlan:export']">导出</el-button>
2023-09-07 23:50:10 +08:00
</el-col>
2023-09-08 23:42:40 +08:00
<right-toolbar :showSearch.sync="showSearch" :search="false" @queryTable="getList"></right-toolbar>
2023-09-07 23:50:10 +08:00
</el-row>
2023-09-08 23:42:40 +08:00
<el-table v-loading="loading" :data="projectPlanList">
<el-table-column label="No." align="center" prop="id" width="50"><template slot-scope="scope" >{{scope.$index+1}}</template></el-table-column>
<el-table-column :label="activeName == 'f' ? '项目名称' : '项目名称'" align="left" min-width="200" prop="projectName" :show-overflow-tooltip="true"/>
<el-table-column :label="activeName == 'f' ? '建设规模及主要工程内容' : '建设规模及主要建设内容'" min-width="300" align="left" prop="content" :show-overflow-tooltip="true"/>
<el-table-column :label="activeName == 'f' ? '建设性质' : '建设性质'" align="center" prop="buildType" />
<el-table-column :label="activeName == 'f' ? '包抓部门' : '包抓部门'" align="center" prop="dept" min-width="200"/>
<el-table-column :label="activeName == 'f' ? '开工时限' : '开工日期'" align="center" prop="startDate" width="180">
2023-09-07 23:50:10 +08:00
<template slot-scope="scope">
<span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
2023-09-08 23:42:40 +08:00
<el-table-column :label="activeName == 'f' ? '建成时限' : '完工日期'" align="center" prop="endDate" width="180">
2023-09-07 23:50:10 +08:00
<template slot-scope="scope">
<span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
2023-09-08 23:42:40 +08:00
<el-table-column :label="activeName == 'f' ? '总投资(万元)' : '总投资(万元)'" min-width="100" align="center" prop="totalInvestment" />
<el-table-column :label="activeName == 'f' ? '年度投资(万元)' : '年度计划投资(万元)'" min-width="150" align="center" prop="yearInvestment" />
2023-09-07 23:50:10 +08:00
</el-table>
2023-09-08 23:42:40 +08:00
<!-- 用户导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="600px" :close-on-click-modal="false" :key="activeName"
:close-on-press-escape="false" append-to-body :custom-class="'proj-plan-import-dlg file-' + upload.files.length">
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :multiple="false"
:on-change="uploadChange" :action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading" :on-remove="uploadChange" :on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess" :auto-upload="false" drag>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<span>仅允许导入xlsxlsx格式文件</span>
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
@click="doExport">下载模板</el-link>
</div>
</el-upload>
2023-09-07 23:50:10 +08:00
<div slot="footer" class="dialog-footer">
2023-09-08 23:42:40 +08:00
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button>
2023-09-07 23:50:10 +08:00
</div>
</el-dialog>
</div>
</template>
<script>
2023-09-08 23:42:40 +08:00
import { listAll} from "@/api/project/projectPlan.js";
import { getToken } from "@/utils/auth";
2023-09-07 23:50:10 +08:00
export default {
name: "ProjectPlan",
data() {
return {
2023-09-08 23:42:40 +08:00
activeName: 'f',
showSearch: false,
2023-09-07 23:50:10 +08:00
// 遮罩层
loading: true,
// 项目跟进计划表格数据
2023-09-08 23:42:40 +08:00
projectPlanList: [],
// 用户导入参数
upload: {
files: [],
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
title: "",
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的用户数据
updateSupport: 0,
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API ,
2023-09-07 23:50:10 +08:00
},
};
},
created() {
2023-09-08 23:42:40 +08:00
},
mounted(){
2023-09-07 23:50:10 +08:00
this.getList();
},
methods: {
2023-09-08 23:42:40 +08:00
tabClick() {
this.getList();
},
2023-09-07 23:50:10 +08:00
/** 查询项目跟进计划列表 */
getList() {
this.loading = true;
2023-09-08 23:42:40 +08:00
listAll(this.activeName=='f'?0:1).then(data => {
this.projectPlanList =data.data||[];
2023-09-07 23:50:10 +08:00
this.loading = false;
});
},
2023-09-08 23:42:40 +08:00
uploadChange(a, b, c) {
this.upload.files = b;
2023-09-07 23:50:10 +08:00
},
2023-09-08 23:42:40 +08:00
submitFileForm() {
this.$refs.upload.submit();
2023-09-07 23:50:10 +08:00
},
2023-09-08 23:42:40 +08:00
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
2023-09-07 23:50:10 +08:00
},
2023-09-08 23:42:40 +08:00
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
response.msg +
"</div>",
"导入结果",
{ dangerouslyUseHTMLString: true }
);
this.getList();
2023-09-07 23:50:10 +08:00
},
/** 新增按钮操作 */
2023-09-08 23:42:40 +08:00
doImport() {
if (this.activeName == 'f') {
this.upload.url = process.env.VUE_APP_BASE_API + "/project/projectPlan/importUrbanPlan";
} else {
this.upload.url = process.env.VUE_APP_BASE_API +"/project/projectPlan/importMajorPlan";
}
let name = this.activeName == 'f' ? '城建项目计划' : '重点项目计划';
this.upload.title = `${name}_导入`;
this.upload.open = true;
2023-09-07 23:50:10 +08:00
},
/** 导出按钮操作 */
2023-09-08 23:42:40 +08:00
doExport() {
let url = `project/projectPlan/export/${this.activeName == 'f' ? 0 : 1}`;
let name = this.activeName == 'f' ? '城建项目计划' : '重点项目计划';
this.download(url, {}, `${name}_${this.$dt(new Date()).format("YYYYMMDDHHmmss")}.xlsx`)
2023-09-07 23:50:10 +08:00
}
}
};
</script>
2023-09-08 23:42:40 +08:00
<style lang="scss">
.proj-plan-import-dlg {
.el-upload {
width: 100%;
.el-upload-dragger {
width: 100%;
}
}
&.file-1 {
.el-upload {
display: none;
}
.el-upload__tip {
display: none;
}
}
}
</style>