From 853e2784fa72f599806b7777daab92e572118f8a Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期五, 23 八月 2024 16:34:05 +0800
Subject: [PATCH] 调整
---
src/api/platform/report.js | 21 +++++++
src/views/system/report/index.vue | 146 ++++++++++++++++++++++++++++++------------------
2 files changed, 111 insertions(+), 56 deletions(-)
diff --git a/src/api/platform/report.js b/src/api/platform/report.js
index 731f5d8..32f3558 100644
--- a/src/api/platform/report.js
+++ b/src/api/platform/report.js
@@ -26,6 +26,18 @@
})
}
+// 鏂板鎶ュ
+export function importReport(data) {
+ return request({
+ url: '/report/import',
+ method: 'post',
+ headers: {
+ 'Content-Type':'multipart/form-data'
+ },
+ data: data
+ })
+}
+
// 淇敼鎶ュ
export function updateReport(data) {
return request({
@@ -43,6 +55,15 @@
})
}
+// 瀹℃牳
+export function audit(data) {
+ return request({
+ url: '/report/auditing/',
+ method: 'get',
+ data: data
+ })
+}
+
// 鍒犻櫎鎶ュ
export function delReport(id) {
return request({
diff --git a/src/views/system/report/index.vue b/src/views/system/report/index.vue
index bc1fd23..b0a46b1 100644
--- a/src/views/system/report/index.vue
+++ b/src/views/system/report/index.vue
@@ -1,11 +1,8 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
- <el-form-item label="杩愮淮浜哄憳" prop="peopleId">
- <el-input v-model="queryParams.peopleId" placeholder="杩愮淮浜哄憳濮撳悕" clearable @keyup.enter.native="handleQuery" />
- </el-form-item>
- <el-form-item label="鐐逛綅" prop="pointId">
- <el-input v-model="queryParams.pointId" placeholder="鐐逛綅" clearable @keyup.enter.native="handleQuery" />
+ <el-form-item label="鍏抽敭瀛�" prop="peopleId">
+ <el-input v-model="queryParams.keyword" placeholder="璇疯緭鍏ュ叧閿瓧" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="鎶ュ绫诲瀷" prop="reportType">
<el-select v-model="queryParams.reportType" @change="handleQuery" placeholder="鎶ュ绫诲瀷" clearable>
@@ -32,16 +29,9 @@
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['system:report:add']">鏂板</el-button>
</el-col>
- <!-- <el-col :span="1.5">-->
- <!-- <el-button-->
- <!-- type="success"-->
- <!-- plain-->
- <!-- icon="el-icon-edit"-->
- <!-- size="mini"-->
- <!-- :disabled="single"-->
- <!-- @click="handleUpdate"-->
- <!-- >淇敼</el-button>-->
- <!-- </el-col>-->
+ <el-col :span="1.5">
+ <el-button type="success" plain icon="el-icon-upload" size="mini" @click="handleImport">瀵煎叆</el-button>
+ </el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
v-hasPermi="['system:report:remove']">鍒犻櫎</el-button>
@@ -83,21 +73,15 @@
<el-table-column label="鎶ュ绫诲瀷" align="center" prop="reportType" />
<el-table-column label="涓婃姤鏃堕棿" width="200" align="center" prop="createTime" />
<el-table-column label="鏁呴殰绫诲瀷" align="center" prop="errorType" />
- <el-table-column label="瀹℃牳缁撴灉" align="center" prop="status" :formatter="formatStatus"/>
+ <el-table-column label="瀹℃牳缁撴灉" align="center" prop="status" :formatter="formatStatus" />
<el-table-column label="鎿嶄綔" fixed="right" width="250" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['system:report:edit']"
- v-if="scope.row.status === 2 || scope.row.status === 0"
- >淇敼</el-button>
+ <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
+ v-hasPermi="['system:report:edit']" v-if="scope.row.status === 2 || scope.row.status === 0">淇敼</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleAuditing(scope.row)"
v-hasPermi="['system:report:edit']" v-if="scope.row.status === 0">瀹℃牳</el-button>
<el-button size="mini" type="text" icon="el-icon-s-check" @click="handleAuditingRecord(scope.row.id)"
- v-hasPermi="['system:report:record']">瀹℃牳璁板綍</el-button>
+ v-hasPermi="['system:report:record']">瀹℃牳璁板綍</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['system:report:remove']">鍒犻櫎</el-button>
</template>
@@ -110,12 +94,25 @@
<!-- 娣诲姞鎴栦慨鏀规姤澶囧璇濇 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
- <el-form-item label="鐐逛綅" prop="pointId">
+ <el-form-item label="鐐逛綅" prop="pointId" v-if="addOrImport === 'add'">
<el-select v-model="form.pointId" filterable remote reserve-keyword placeholder="璇烽�夋嫨鐐逛綅"
:remote-method="remoteGetPoints" :loading="selectLoading">
<el-option v-for="item in pointList" :key="item.id" :label="item.value" :value="item.id">
</el-option>
</el-select>
+ </el-form-item>
+ <el-form-item label="鐐逛綅瀵煎叆" v-if="addOrImport === 'import'">
+ <el-upload accept=".xlsx, .xls" :limit="1" :action="url" drag :before-upload="beforeUpload" :file-list="fileList">
+ <i class="el-icon-upload"></i>
+ <div class="el-upload__text">
+ 灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em>
+ </div>
+ <div class="el-upload__tip" slot="tip">
+ <span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span>
+ <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
+ @click="importTemplate">涓嬭浇妯℃澘</el-link>
+ </div>
+ </el-upload>
</el-form-item>
<el-form-item label="鎶ュ绫诲瀷" prop="reportType">
<el-select v-model="form.reportType">
@@ -124,10 +121,8 @@
</el-select>
</el-form-item>
<el-form-item label="鏁呴殰绫诲瀷" prop="errorType">
- <el-select v-model="form.errorType">
- <el-option label="甯傛斂鏂藉伐" value="甯傛斂鏂藉伐" />
- <el-option label="璁惧鏁呴殰" value="璁惧鏁呴殰" />
- <el-option label="璁惧閬楀け" value="璁惧閬楀け" />
+ <el-select v-model="form.errorType" multiple>
+ <el-option v-for="dict in dict.type.error_type" :value="dict.value" :key="dict.value" :label="dict.label" />
</el-select>
</el-form-item>
<el-form-item label="鎶ュ鏃堕棿">
@@ -155,20 +150,22 @@
<el-timeline-item :timestamp="record.createTime" placement="top">
<el-card>
<el-descriptions title="鎻愪氦鏁版嵁" :column="3" border>
- <el-descriptions-item label="鐐逛綅" label-class-name="my-label" content-class-name="my-content">{{record.pointName}}</el-descriptions-item>
- <el-descriptions-item label="鎶ュ绫诲瀷">{{record.reportType}}</el-descriptions-item>
- <el-descriptions-item label="鏁呴殰绫诲瀷">{{record.errorType}}</el-descriptions-item>
- <el-descriptions-item label="瀹℃牳缁撴灉">{{formatStatus(record)}}</el-descriptions-item>
- <el-descriptions-item label="瀹℃牳鎰忚">{{record.auditOpinion}}</el-descriptions-item>
- <el-descriptions-item label="瀹℃牳鏃堕棿">{{record.auditingTime}}</el-descriptions-item>
+ <el-descriptions-item label="鐐逛綅" label-class-name="my-label" content-class-name="my-content">{{
+ record.pointName }}</el-descriptions-item>
+ <el-descriptions-item label="鎶ュ绫诲瀷">{{ record.reportType }}</el-descriptions-item>
+ <el-descriptions-item label="鏁呴殰绫诲瀷">{{ record.errorType }}</el-descriptions-item>
+ <el-descriptions-item label="瀹℃牳缁撴灉">{{ formatStatus(record) }}</el-descriptions-item>
+ <el-descriptions-item label="瀹℃牳鎰忚">{{ record.auditOpinion }}</el-descriptions-item>
+ <el-descriptions-item label="瀹℃牳鏃堕棿">{{ record.auditingTime }}</el-descriptions-item>
<el-descriptions-item label="鎶ュ鍐呭">
<div class="content" v-html="getHtmlContent(record.reportContent)"></div>
</el-descriptions-item>
<el-descriptions-item label="涓婃姤鏉愭枡">
<el-link
v-for="item in record.reportMaterials != null ? record.reportMaterials.split(',') : record.reportMaterials"
- :underline="false" type="primary" :key="item" @click="handleDownload(item)">{{ item.substring(item.lastIndexOf("/") + 1)
- }}</el-link>
+ :underline="false" type="primary" :key="item" @click="handleDownload(item)">
+ {{ item.substring(item.lastIndexOf("/") + 1) }}
+ </el-link>
</el-descriptions-item>
</el-descriptions>
</el-card>
@@ -179,7 +176,7 @@
</el-dialog>
<!-- 瀹℃牳鎶ュ -->
- <el-dialog title="鎶ュ瀹℃牳" :visible.sync="auditingOpen" width="500px" append-to-body>
+ <el-dialog title="鎶ュ瀹℃牳" :visible.sync="auditingOpen" width="900px" append-to-body>
<el-form ref="form" :model="auditingForm" :rules="auditingRules" label-width="80px">
<el-form-item label="鐐逛綅">
<el-input v-model="auditingForm.pointName" disabled />
@@ -208,8 +205,9 @@
<el-form-item label="涓婃姤鏉愭枡">
<el-link
v-for="item in auditingForm.reportMaterials != null ? auditingForm.reportMaterials.split(',') : auditingForm.reportMaterials"
- :underline="false" type="primary" :key="item" @click="handleDownload(item)">{{ item.substring(item.lastIndexOf("/") + 1)
- }}</el-link>
+ :underline="false" type="primary" :key="item" @click="handleDownload(item)">
+ {{ item.substring(item.lastIndexOf("/") + 1) }}
+ </el-link>
</el-form-item>
<el-form-item label="瀹℃牳缁撴灉">
<el-radio-group v-model="auditingForm.auditingResult">
@@ -231,13 +229,17 @@
</template>
<script>
-import { listReport, getReport, delReport, addReport, updateReport, auditing } from "@/api/platform/report";
+import { listReport, getReport, delReport, addReport, updateReport, auditing, importReport } from "@/api/platform/report";
import { pointSelectData } from "@/api/platform/point";
export default {
+ dicts: ['error_type'],
name: "Report",
data() {
return {
+ fileList: [],
+ url: process.env.VUE_APP_BASE_API + '/report/import',
+ addOrImport: 'add',
fileType: ["doc", "xls", "xlsx", "ppt", "txt", "pdf", "png", "jpg"],
auditingRecordList: [],
// 鐐逛綅list
@@ -285,13 +287,10 @@
queryParams: {
pageNum: 1,
pageSize: 10,
- unitId: null,
- peopleId: null,
- pointId: null,
- createTime: null,
- auditingTime: null,
+ keyword: null,
errorType: null,
- status: 0
+ status: 0,
+ reportType: null
},
// 琛ㄥ崟鍙傛暟
form: {},
@@ -443,8 +442,20 @@
/** 鏂板鎸夐挳鎿嶄綔 */
handleAdd() {
this.reset();
+ this.addOrImport = 'add'
this.open = true;
this.title = "娣诲姞鎶ュ";
+ },
+ /** 瀵煎叆鎸夐挳鎿嶄綔 */
+ handleImport() {
+ this.reset();
+ this.addOrImport = 'import'
+ this.open = true;
+ this.title = "瀵煎叆鎶ュ";
+ },
+ beforeUpload(file) {
+ this.fileList = [file];
+ return false;
},
/** 淇敼鎸夐挳鎿嶄綔 */
handleUpdate(row) {
@@ -453,6 +464,7 @@
getReport(id).then(response => {
this.daterangeCreateTime = [response.data.beginCreateTime, response.data.endCreateTime]
this.form = response.data;
+ this.form.errorType = this.form.errorType.split(',');
this.open = true;
this.title = "淇敼鎶ュ";
});
@@ -484,21 +496,42 @@
if (valid) {
this.form.beginCreateTime = this.daterangeCreateTime[0]
this.form.endCreateTime = this.daterangeCreateTime[1]
- if (this.form.id != null) {
- updateReport(this.form).then(response => {
- this.$modal.msgSuccess("淇敼鎴愬姛");
+ if (this.addOrImport === 'import') {
+ let formData = new FormData();
+ formData.append("importPointId", this.fileList[0]);
+ formData.append("pointId", this.form.importPointId);
+ formData.append("reportType", this.form.reportType);
+ formData.append("errorType", this.form.errorType);
+ formData.append("reportContent", this.form.reportContent);
+ formData.append("reportMaterials", this.form.reportMaterials);
+ formData.append("expirTime", this.form.expirTime);
+ importReport(formData).then(() => {
+ this.$modal.msgSuccess("鎴愬姛瀵煎叆鎶ュ");
this.open = false;
this.getList();
});
} else {
- addReport(this.form).then(response => {
- this.$modal.msgSuccess("鎴愬姛鎻愪氦鎶ュ");
- this.open = false;
- this.getList();
- });
+ this.form.errorType = this.form.errorType.join(',');
+ if (this.form.id != null) {
+ updateReport(this.form).then(() => {
+ this.$modal.msgSuccess("淇敼鎴愬姛");
+ this.open = false;
+ this.getList();
+ });
+ } else {
+ addReport(this.form).then(() => {
+ this.$modal.msgSuccess("鎴愬姛鎻愪氦鎶ュ");
+ this.open = false;
+ this.getList();
+ });
+ }
}
}
});
+ },
+ /** 涓嬭浇妯℃澘鎿嶄綔 */
+ importTemplate() {
+ this.download("report/importTemplate", {}, `鎶ュ-鐐逛綅瀵煎叆妯℃澘.xlsx`);
},
/** 鍒犻櫎鎸夐挳鎿嶄綔 */
handleDelete(row) {
@@ -538,6 +571,7 @@
max-height: 300px;
overflow-y: auto;
}
+
.info-container {
width: 100%;
max-height: 400px;
--
Gitblit v1.8.0