|
@@ -31,6 +31,9 @@
|
|
|
<el-option v-for="item in storageTypeDic" :key="item" :label="item" :value="item"></el-option>
|
|
<el-option v-for="item in storageTypeDic" :key="item" :label="item" :value="item"></el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <el-form-item label="填报时间">
|
|
|
|
|
+ <el-date-picker v-model="createTime" type="daterange" value-format="YYYY-MM-DD" range-separator="-" start-placeholder="开始时间" end-placeholder="结束时间"></el-date-picker>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
|
<el-button type="primary" icon="search" @click="reloadTable">搜索</el-button>
|
|
<el-button type="primary" icon="search" @click="reloadTable">搜索</el-button>
|
|
@@ -43,32 +46,22 @@
|
|
|
<div class="tjm_card_tools">
|
|
<div class="tjm_card_tools">
|
|
|
<div class="tjm_card_tools_left">
|
|
<div class="tjm_card_tools_left">
|
|
|
<el-button type="primary" icon="plus" @click="table_add">新增</el-button>
|
|
<el-button type="primary" icon="plus" @click="table_add">新增</el-button>
|
|
|
- <el-button type="primary" icon="upload">导入</el-button>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
<div class="tjm_card_tools_right">
|
|
<div class="tjm_card_tools_right">
|
|
|
- <el-button icon="upload-filled">导出</el-button>
|
|
|
|
|
|
|
+ <el-upload class="import-upload" action="" accept=".xlsx, .xls" :limit="1" :show-file-list="false" :http-request="table_import" :on-success="import_success">
|
|
|
|
|
+ <el-button icon="upload-filled">导入</el-button>
|
|
|
|
|
+ </el-upload>
|
|
|
|
|
+ <el-button icon="download" @click="table_export">导出</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="tjm_card_table">
|
|
<div class="tjm_card_table">
|
|
|
<el-table v-loading="loading" row-key="id" header-cell-class-name="tjm_card_table_header" height="400" :data="tableData" border>
|
|
<el-table v-loading="loading" row-key="id" header-cell-class-name="tjm_card_table_header" height="400" :data="tableData" border>
|
|
|
<el-table-column type="index" width="50"></el-table-column>
|
|
<el-table-column type="index" width="50"></el-table-column>
|
|
|
- <el-table-column label="政策编号" prop="businessNo" width="180"></el-table-column>
|
|
|
|
|
- <el-table-column label="状态" width="100">
|
|
|
|
|
- <template #default="scope">{{ formatStatus(scope.row.status) }}</template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- <el-table-column label="政策名称" prop="name" width="180"></el-table-column>
|
|
|
|
|
- <el-table-column label="政策等级" prop="zcLevel" width="100"></el-table-column>
|
|
|
|
|
- <el-table-column label="政策类别" prop="zcType" width="100"></el-table-column>
|
|
|
|
|
- <el-table-column label="政策文号" prop="docNo" width="180"></el-table-column>
|
|
|
|
|
- <el-table-column label="填报人" prop="createName" width="180"></el-table-column>
|
|
|
|
|
- <el-table-column label="填报单位" prop="companyName" width="180"></el-table-column>
|
|
|
|
|
- <el-table-column label="填报时间" prop="createTime" width="180"></el-table-column>
|
|
|
|
|
- <el-table-column label="联系方式" prop="contactPhone" width="180"></el-table-column>
|
|
|
|
|
- <el-table-column label="考核评分" prop="score" width="100"></el-table-column>
|
|
|
|
|
- <el-table-column label="是否入库" width="100">
|
|
|
|
|
- <template #default="scope">{{ formatInWh(scope.row.isInWh) }}</template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- <el-table-column label="入库类别" prop="inWhType" width="100"></el-table-column>
|
|
|
|
|
|
|
+ <template v-for="(item, index) in columns" :key="index">
|
|
|
|
|
+ <el-table-column :label="item.label" :prop="item.props" :width="item.width || 180">
|
|
|
|
|
+ <template #default="scope">{{ columnFormat(scope.row, item.props) }}</template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </template>
|
|
|
<el-table-column label="操作" fixed="right" width="180">
|
|
<el-table-column label="操作" fixed="right" width="180">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<template v-if="scope.row.status == 'active' || scope.row.status == 'inactive'">
|
|
<template v-if="scope.row.status == 'active' || scope.row.status == 'inactive'">
|
|
@@ -92,7 +85,9 @@
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import API from "@/api/policy/share"
|
|
import API from "@/api/policy/share"
|
|
|
-import { levelDic, typeDic, statusDic, inWHDic, storageTypeDic } from "./main";
|
|
|
|
|
|
|
+import Folder from "@/api/folder.js";
|
|
|
|
|
+import { exportExcel } from "@/utils/exportExcel";
|
|
|
|
|
+import { columns, levelDic, typeDic, storageTypeDic, inWHDic, statusDic } from "./main";
|
|
|
import yhPagination from "@/components/Pagination/index.vue";
|
|
import yhPagination from "@/components/Pagination/index.vue";
|
|
|
import policyDetail from "./dialog.vue";
|
|
import policyDetail from "./dialog.vue";
|
|
|
|
|
|
|
@@ -104,9 +99,10 @@ export default {
|
|
|
|
|
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- levelDic, typeDic, statusDic, inWHDic, storageTypeDic,
|
|
|
|
|
|
|
+ columns, levelDic, typeDic, storageTypeDic, inWHDic, statusDic,
|
|
|
|
|
|
|
|
loading: false,
|
|
loading: false,
|
|
|
|
|
+ createTime: [],
|
|
|
params: {
|
|
params: {
|
|
|
page: 1,
|
|
page: 1,
|
|
|
size: 10
|
|
size: 10
|
|
@@ -124,16 +120,16 @@ export default {
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
- formatStatus(value) {
|
|
|
|
|
- return statusDic[value] || "";
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- formatInWh (value) {
|
|
|
|
|
- return inWHDic[value] || "";
|
|
|
|
|
|
|
+ columnFormat(row, props) {
|
|
|
|
|
+ if (props == "status") return statusDic[row[props]] || "";
|
|
|
|
|
+ if (props == "isInWh") return inWHDic[row[props]] || "";
|
|
|
|
|
+ return row[props];
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
reloadTable(mode = "add") {
|
|
reloadTable(mode = "add") {
|
|
|
if (mode == "add") this.params.page = 1;
|
|
if (mode == "add") this.params.page = 1;
|
|
|
|
|
+ this.params.beginCreateTime = this.createTime && this.createTime.length && this.createTime[0] + " 00:00:00" || null;
|
|
|
|
|
+ this.params.endCreateTime = this.createTime && this.createTime.length && this.createTime[1] + " 23:59:59" || null;
|
|
|
|
|
|
|
|
this.loading = true;
|
|
this.loading = true;
|
|
|
API.get(this.params).then(res => {
|
|
API.get(this.params).then(res => {
|
|
@@ -146,6 +142,7 @@ export default {
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
reset() {
|
|
reset() {
|
|
|
|
|
+ this.createTime = [];
|
|
|
for (const key in this.params) {
|
|
for (const key in this.params) {
|
|
|
if (key == "page") this.params[key] = 1;
|
|
if (key == "page") this.params[key] = 1;
|
|
|
else if (key == "size") this.params[key] = 10;
|
|
else if (key == "size") this.params[key] = 10;
|
|
@@ -198,7 +195,57 @@ export default {
|
|
|
closed(e) {
|
|
closed(e) {
|
|
|
e && this.reloadTable();
|
|
e && this.reloadTable();
|
|
|
this.dialog = false;
|
|
this.dialog = false;
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ table_export() {
|
|
|
|
|
+ const header = columns.map(c => c.label);
|
|
|
|
|
+ const data = this.tableData.map(v => columns.map(c => c.props).map(j => this.columnFormat(v, j)));
|
|
|
|
|
+
|
|
|
|
|
+ exportExcel(header, data, [], `${this.$route.name}.xlsx`);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ table_import(param) {
|
|
|
|
|
+ const importLoading = ElLoading.service({
|
|
|
|
|
+ lock: true,
|
|
|
|
|
+ text: "上传中请等待…",
|
|
|
|
|
+ spinner: "el-icon-loading",
|
|
|
|
|
+ background: "rgba(0, 0, 0, 0.7)"
|
|
|
|
|
+ });
|
|
|
|
|
+ const data = new FormData();
|
|
|
|
|
+ data.append(param.filename, param.file);
|
|
|
|
|
+
|
|
|
|
|
+ Folder.up(data).then(res => {
|
|
|
|
|
+ importLoading.close();
|
|
|
|
|
+ if (res.code == 200) param.onSuccess(res.data.link);
|
|
|
|
|
+ else ElMessage.error(res.msg || "未知错误");
|
|
|
|
|
+ }).catch(() => importLoading.close());
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ import_success(excelUrl) {
|
|
|
|
|
+ const importLoading = ElLoading.service({
|
|
|
|
|
+ lock: true,
|
|
|
|
|
+ text: "导入中请等待…",
|
|
|
|
|
+ spinner: "el-icon-loading",
|
|
|
|
|
+ background: "rgba(0, 0, 0, 0.7)"
|
|
|
|
|
+ })
|
|
|
|
|
+ API.import({ excelUrl }).then(res => {
|
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
|
+ importLoading.close();
|
|
|
|
|
+ ElMessage.success(res.data);
|
|
|
|
|
+ this.reloadTable();
|
|
|
|
|
+ } else ElMessage.error(res.msg);
|
|
|
|
|
+ }).catch(() => importLoading.close());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-</script>
|
|
|
|
|
|
|
+</script>
|
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
|
+.tjm_card_style_custom .tjm_card_tools .tjm_card_tools_right {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+
|
|
|
|
|
+ .import-upload {
|
|
|
|
|
+ margin-right: 12px;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|