明树Git Lab

Commit 7a7b7aa7 authored by zhanghan's avatar zhanghan

投资后评价

parent f034cb1c
import * as XLSX from "xlsx"; import * as XLSX from "xlsx";
// 导入excel文件显示到前端页面 // 导入excel文件显示到前端页面
const importTableFile = async (file) => { const getTableFileData = async (file, tableColumns) => {
const data = await readFile(file.raw); const data = await readFile(file.raw);
// 使用 xlsx 解析 // 使用 xlsx 解析
let workbook = XLSX.read(data, { let workbook = XLSX.read(data, {
...@@ -8,7 +8,24 @@ const importTableFile = async (file) => { ...@@ -8,7 +8,24 @@ const importTableFile = async (file) => {
cellDates: true, cellDates: true,
cellStyles: true cellStyles: true
}); });
console.log(workbook); const sheetName = workbook.SheetNames[0];
const sheet = workbook.Sheets[sheetName];
const rawData = XLSX.utils.sheet_to_json(sheet, {
header: 1,
defval: ""
});
let list = [];
const [head, ...fileData] = rawData;
fileData && fileData.map(item => {
let obj = {};
tableColumns.map(column => {
let index = head.indexOf(column.label);
let def = column.type === "number" ? null : "";
obj[column.prop] = index != -1 ? item[index] || def : def;
})
list.push(obj)
})
return list;
}; };
const readFile = (file) => { const readFile = (file) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
...@@ -23,7 +40,7 @@ const exportTableFile = (tableData, tableColumns, title, fileName) => { ...@@ -23,7 +40,7 @@ const exportTableFile = (tableData, tableColumns, title, fileName) => {
const wb = XLSX.utils.book_new() const wb = XLSX.utils.book_new()
// 2. 准备数据 // 2. 准备数据
let wsData = [[title], []] let wsData = title ? [[title]] : []
// 添加表头 // 添加表头
if (tableColumns && tableColumns.length > 0) { if (tableColumns && tableColumns.length > 0) {
...@@ -64,9 +81,11 @@ const exportTableFile = (tableData, tableColumns, title, fileName) => { ...@@ -64,9 +81,11 @@ const exportTableFile = (tableData, tableColumns, title, fileName) => {
ws['!cols'] = colWidths ws['!cols'] = colWidths
} }
// 合并标题单元格 // 合并标题单元格
ws['!merges'] = [ if (title) {
XLSX.utils.decode_range('A1:Q1') // 合并第一行的 A-E 列 ws['!merges'] = [
] XLSX.utils.decode_range('A1:Q1') // 合并第一行的 A-E 列
]
}
// 5. 将工作表添加到工作簿 // 5. 将工作表添加到工作簿
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1') XLSX.utils.book_append_sheet(wb, ws, 'Sheet1')
...@@ -88,6 +107,6 @@ const formatCellValue = (value, formatter) => { ...@@ -88,6 +107,6 @@ const formatCellValue = (value, formatter) => {
return value return value
} }
export{ export{
importTableFile, getTableFileData,
exportTableFile exportTableFile
} }
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="manage-header"> <div class="manage-header">
<div class="header-left"></div> <div class="header-left"></div>
<div class="header-right"> <div class="header-right">
<el-button type="primary" @click="constructionAdd">新增</el-button> <el-button type="primary" @click="evaluateAdd">新增</el-button>
</div> </div>
</div> </div>
<div class="manage-content" v-loading="loading"> <div class="manage-content" v-loading="loading">
...@@ -68,6 +68,22 @@ let tableColumns = ref([ ...@@ -68,6 +68,22 @@ let tableColumns = ref([
label: "项目信息", label: "项目信息",
showOverflowTooltip: true, showOverflowTooltip: true,
}, },
{
prop: "xmgszcbgLen",
label: "项目公司自查报告",
showOverflowTooltip: true,
},
{
prop: "hpjbgLen",
label: "后评价报告",
showOverflowTooltip: true,
},
{
prop: "qsmzqpjLen",
label: "全生命评价结果",
showOverflowTooltip: true,
},
{ {
prop: "operations", prop: "operations",
...@@ -86,15 +102,21 @@ let pageSize = ref(10); ...@@ -86,15 +102,21 @@ let pageSize = ref(10);
const getStatementData = () => { const getStatementData = () => {
loading.value = true; loading.value = true;
proxy.$post({ proxy.$post({
url: "/api/project/getJsqtzjcList", url: "/api/project/getTzhpjList",
data: { data: {
page: currentPage.value, page: currentPage.value,
pagesize: pageSize.value, pagesize: pageSize.value,
}, },
callback: (data) => { callback: (data) => {
console.log(data, "data"); tableData.value = data.rows.map((it) => {
return {
...it,
tableData.value = data.rows; xmgszcbgLen: it.xmgszcbg?.length + "个",
hpjbgLen: it.hpjbg?.length + "个",
qsmzqpjLen: it.qsmzqpj?.length + "个",
};
});
total.value = data.count; total.value = data.count;
loading.value = false; loading.value = false;
}, },
...@@ -110,12 +132,12 @@ const handleCurrentPageChange = (page) => { ...@@ -110,12 +132,12 @@ const handleCurrentPageChange = (page) => {
currentPage.value = page; currentPage.value = page;
getStatementData(); getStatementData();
}; };
const constructionAdd = () => { const evaluateAdd = () => {
router.push("/constructionAdd"); router.push("/evaluateAdd");
}; };
const editStatement = (item) => { const editStatement = (item) => {
router.push({ router.push({
name: "constructionAdd", name: "evaluateAdd",
query: { query: {
id: item.id, id: item.id,
}, },
...@@ -123,7 +145,7 @@ const editStatement = (item) => { ...@@ -123,7 +145,7 @@ const editStatement = (item) => {
}; };
const previewStatement = (item) => { const previewStatement = (item) => {
router.push({ router.push({
name: "constructionAdd", name: "evaluateAdd",
query: { query: {
isPreview: true, isPreview: true,
id: item.id, id: item.id,
...@@ -138,7 +160,7 @@ const deleteStatement = (item) => { ...@@ -138,7 +160,7 @@ const deleteStatement = (item) => {
}) })
.then(() => { .then(() => {
proxy.$post({ proxy.$post({
url: "/api/project/deleteJsqtzjc", url: "/api/project/deleteTzhpj",
data: { data: {
id: item.id, id: item.id,
}, },
......
This diff is collapsed.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="manage-header"> <div class="manage-header">
<div class="header-left"></div> <div class="header-left"></div>
<div class="header-right"> <div class="header-right">
<el-button type="primary" @click="constructionAdd">新增</el-button> <el-button type="primary" @click="runningPeriodAdd">新增</el-button>
</div> </div>
</div> </div>
<div class="manage-content" v-loading="loading"> <div class="manage-content" v-loading="loading">
...@@ -110,12 +110,12 @@ const handleCurrentPageChange = (page) => { ...@@ -110,12 +110,12 @@ const handleCurrentPageChange = (page) => {
currentPage.value = page; currentPage.value = page;
getStatementData(); getStatementData();
}; };
const constructionAdd = () => { const runningPeriodAdd = () => {
router.push("/constructionAdd"); router.push("/runningPeriodAdd");
}; };
const editStatement = (item) => { const editStatement = (item) => {
router.push({ router.push({
name: "constructionAdd", name: "runningPeriodAdd",
query: { query: {
id: item.id, id: item.id,
}, },
...@@ -123,7 +123,7 @@ const editStatement = (item) => { ...@@ -123,7 +123,7 @@ const editStatement = (item) => {
}; };
const previewStatement = (item) => { const previewStatement = (item) => {
router.push({ router.push({
name: "constructionAdd", name: "runningPeriodAdd",
query: { query: {
isPreview: true, isPreview: true,
id: item.id, id: item.id,
......
...@@ -80,12 +80,12 @@ ...@@ -80,12 +80,12 @@
name="投资(成本)分析会资料" name="投资(成本)分析会资料"
> >
<div class="tab-handle"> <div class="tab-handle">
<el-button type="primary" @click="addjsqtzjcTzfxs" <el-button type="primary" @click="addyyqtzjcTzfxs"
>新增</el-button >新增</el-button
> >
</div> </div>
<el-table <el-table
:data="jsqtzjcTzfxsList" :data="yyqtzjcTzfxsList"
style="width: 100%" style="width: 100%"
empty-text="暂无数据" empty-text="暂无数据"
border border
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
link link
type="danger" type="danger"
size="small" size="small"
@click="deletejsqtzjcTzfxs(scope.$index)" @click="deleteyyqtzjcTzfxs(scope.$index)"
>删除</el-button >删除</el-button
> >
</template> </template>
...@@ -154,12 +154,12 @@ ...@@ -154,12 +154,12 @@
<!-- 专项检查 --> <!-- 专项检查 -->
<el-collapse-item title="专项检查" name="专项检查"> <el-collapse-item title="专项检查" name="专项检查">
<div class="tab-handle"> <div class="tab-handle">
<el-button type="primary" @click="addJsqtzjcZxjcs" <el-button type="primary" @click="addyyqtzjcZxjcs"
>新增</el-button >新增</el-button
> >
</div> </div>
<el-table <el-table
:data="jsqtzjcZxjcsList" :data="yyqtzjcZxjcsList"
style="width: 100%" style="width: 100%"
empty-text="暂无数据" empty-text="暂无数据"
border border
...@@ -210,7 +210,7 @@ ...@@ -210,7 +210,7 @@
link link
type="danger" type="danger"
size="small" size="small"
@click="deleteJsqtzjcZxjcs(scope.$index)" @click="deleteyyqtzjcZxjcs(scope.$index)"
>删除</el-button >删除</el-button
> >
</template> </template>
...@@ -259,34 +259,34 @@ const projectList = ref([]); ...@@ -259,34 +259,34 @@ const projectList = ref([]);
const rcCgqyglId = ref(route.query.id || ""); const rcCgqyglId = ref(route.query.id || "");
// 投资(成本)分析会资料列表 // 投资(成本)分析会资料列表
const jsqtzjcTzfxsList = ref([]); const yyqtzjcTzfxsList = ref([]);
// 专项检查列表 // 专项检查列表
const jsqtzjcZxjcsList = ref([]); const yyqtzjcZxjcsList = ref([]);
// ========== 投资(成本)分析会资料 操作方法 ========== // ========== 投资(成本)分析会资料 操作方法 ==========
const addjsqtzjcTzfxs = () => { const addyyqtzjcTzfxs = () => {
jsqtzjcTzfxsList.value.push({ yyqtzjcTzfxsList.value.push({
jd: "", jd: "",
ycztz: "", ycztz: "",
zbjnbsyl: "", zbjnbsyl: "",
jsqtzjcTzfxs: [], yyqtzjcTzfxs: [],
}); });
}; };
const deletejsqtzjcTzfxs = (index) => { const deleteyyqtzjcTzfxs = (index) => {
ElMessageBox.confirm("确认删除该项?", "提示", { ElMessageBox.confirm("确认删除该项?", "提示", {
confirmButtonText: "确认", confirmButtonText: "确认",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning", type: "warning",
}).then(() => { }).then(() => {
jsqtzjcTzfxsList.value.splice(index, 1); yyqtzjcTzfxsList.value.splice(index, 1);
ElMessage.success("删除成功"); ElMessage.success("删除成功");
}); });
}; };
// ========== 专项检查 操作方法 ========== // ========== 专项检查 操作方法 ==========
const addJsqtzjcZxjcs = () => { const addyyqtzjcZxjcs = () => {
jsqtzjcZxjcsList.value.push({ yyqtzjcZxjcsList.value.push({
zxjcfl: "", zxjcfl: "",
jcjg: "", jcjg: "",
zgcsqd: "", zgcsqd: "",
...@@ -294,13 +294,13 @@ const addJsqtzjcZxjcs = () => { ...@@ -294,13 +294,13 @@ const addJsqtzjcZxjcs = () => {
}); });
}; };
const deleteJsqtzjcZxjcs = (index) => { const deleteyyqtzjcZxjcs = (index) => {
ElMessageBox.confirm("确认删除该项?", "提示", { ElMessageBox.confirm("确认删除该项?", "提示", {
confirmButtonText: "确认", confirmButtonText: "确认",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning", type: "warning",
}).then(() => { }).then(() => {
jsqtzjcZxjcsList.value.splice(index, 1); yyqtzjcZxjcsList.value.splice(index, 1);
ElMessage.success("删除成功"); ElMessage.success("删除成功");
}); });
}; };
...@@ -343,8 +343,8 @@ const getJsqtzjcDetail = () => { ...@@ -343,8 +343,8 @@ const getJsqtzjcDetail = () => {
// 赋值基础表单数据 // 赋值基础表单数据
Object.assign(formData, data); Object.assign(formData, data);
// 赋值列表数据 // 赋值列表数据
jsqtzjcTzfxsList.value = data.jsqtzjcTzfxs || []; yyqtzjcTzfxsList.value = data.yyqtzjcTzfxs || [];
jsqtzjcZxjcsList.value = data.jsqtzjcZxjcs || []; yyqtzjcZxjcsList.value = data.yyqtzjcZxjcs || [];
}, },
}); });
}; };
...@@ -372,8 +372,8 @@ const saveClick = () => { ...@@ -372,8 +372,8 @@ const saveClick = () => {
const submitData = { const submitData = {
...formData, ...formData,
projectId: formData.projectId + "", // 确保为字符串类型 projectId: formData.projectId + "", // 确保为字符串类型
jsqtzjcTzfxs: jsqtzjcTzfxsList.value, yyqtzjcTzfxs: yyqtzjcTzfxsList.value,
jsqtzjcZxjcs: jsqtzjcZxjcsList.value, yyqtzjcZxjcs: yyqtzjcZxjcsList.value,
}; };
proxy.$post({ proxy.$post({
......
...@@ -107,6 +107,23 @@ ...@@ -107,6 +107,23 @@
<el-col :span="24"> <el-col :span="24">
<el-form-item label="风险处置情况" :label-width="100"></el-form-item> <el-form-item label="风险处置情况" :label-width="100"></el-form-item>
<div class="tab-handle"> <div class="tab-handle">
<el-button type="primary" size="small"
@click="exportTableData" :disabled="!fxczqkData.length"
>导出</el-button>
<el-upload
ref="uploadRef"
class="upload-demo"
action=""
:auto-upload="false"
:on-change="importTableData"
:show-file-list="false"
>
<template #trigger>
<el-button type="primary" size="small"
style="margin: 0 12px;"
>导入</el-button>
</template>
</el-upload>
<el-button type="primary" size="small" @click="addFxczqk">新增</el-button> <el-button type="primary" size="small" @click="addFxczqk">新增</el-button>
</div> </div>
<el-table :data="fxczqkData" style="width: 100%" empty-text="暂无数据" border> <el-table :data="fxczqkData" style="width: 100%" empty-text="暂无数据" border>
...@@ -228,6 +245,7 @@ ...@@ -228,6 +245,7 @@
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage, ElMessageBox } from "element-plus";
import { useUserStore } from "@/stores/user.js"; import { useUserStore } from "@/stores/user.js";
import { getTableFileData, exportTableFile } from "../../common/tableFileHandle";
const userStore = useUserStore(); const userStore = useUserStore();
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
...@@ -329,6 +347,67 @@ ...@@ -329,6 +347,67 @@
fxczqkData.value.splice(index, 1); fxczqkData.value.splice(index, 1);
}) })
} }
const tableColumns = [
{
prop: "nd",
label: "年度"
},
{
prop: "mbfj",
label: "目标分解"
},
{
prop: "jzqk",
label: "进展情况"
},
{
prop: "fxdj",
label: "风险等级"
},
{
prop: "fxfl",
label: "风险分类"
},
{
prop: "fxgk",
label: "风险概况"
},
{
prop: "kzcs",
label: "控制措施"
},
{
prop: "czjz",
label: "处置进展"
},
{
prop: "yjzgwcsj",
label: "预计整改完成时间"
},
{
prop: "fxsjje",
label: "风险涉及金额",
type: "number"
},
{
prop: "cxgl",
label: "出险概率"
},
{
prop: "fxfxfs",
label: "风险发现方式"
}
];
const importTableData = (file) => {
getTableFileData(file, tableColumns).then(res => {
fxczqkData.value = fxczqkData.value.concat(res);
});
}
const exportTableData = () => {
exportTableFile(fxczqkData.value, tableColumns, "", "风险处置情况")
};
const backClick = () => { const backClick = () => {
router.back(-1) router.back(-1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment