|
|
@@ -0,0 +1,167 @@
|
|
|
+<template>
|
|
|
+ <basic-container>
|
|
|
+ <avue-crud
|
|
|
+ v-bind="bindVal"
|
|
|
+ v-on="onEvent"
|
|
|
+ v-model="form"
|
|
|
+ :page.sync="page"
|
|
|
+ :before-open="handleBeforeOpen"
|
|
|
+ :permission="permissionList"
|
|
|
+ >
|
|
|
+ <template slot="menuLeft">
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ size="small"
|
|
|
+ plain
|
|
|
+ icon="el-icon-upload2"
|
|
|
+ @click="handleImport"
|
|
|
+ >
|
|
|
+ 导入
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ size="small"
|
|
|
+ plain
|
|
|
+ icon="el-icon-download"
|
|
|
+ @click="handleExport"
|
|
|
+ >
|
|
|
+ 导出
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ plain
|
|
|
+ @click="handleDelete"
|
|
|
+ >
|
|
|
+ 删 除
|
|
|
+ </el-button>
|
|
|
+ <div>
|
|
|
+ <year-month-select v-model="params.yearAndMonth" :showMonth="false"></year-month-select>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ </avue-crud>
|
|
|
+
|
|
|
+ <el-dialog title="年度高新科技人员导入"
|
|
|
+ append-to-body
|
|
|
+ :visible.sync="excelBox"
|
|
|
+ width="555px"
|
|
|
+ >
|
|
|
+ <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
|
|
|
+ <template slot="excelTemplate">
|
|
|
+ <el-button type="primary" @click="handleTemplate">
|
|
|
+ 点击下载<i class="el-icon-download el-icon--right"></i>
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </avue-form>
|
|
|
+ </el-dialog>
|
|
|
+ </basic-container>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import {exportBloByPost} from "@/api/common";
|
|
|
+import YearMonthSelect from "@/components/year-month-select";
|
|
|
+import moment from "moment";
|
|
|
+import NProgress from 'nprogress';
|
|
|
+import 'nprogress/nprogress.css';
|
|
|
+import {getToken} from "@/util/auth";
|
|
|
+import {downloadXls} from "@/util/util";
|
|
|
+
|
|
|
+
|
|
|
+export default window.$crudCommon({
|
|
|
+ components: {
|
|
|
+ YearMonthSelect,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ params: {
|
|
|
+ yearAndMonth: moment(new Date()).format('YYYY'),
|
|
|
+ },
|
|
|
+ excelBox: false,
|
|
|
+ excelForm: {},
|
|
|
+
|
|
|
+ isSelAnnual: false, // 是否选择全年
|
|
|
+ };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ 'params.yearAndMonth'(newVal) {
|
|
|
+ this.page.currentPage = 1;
|
|
|
+ this.getList(this.page);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ excelOption() {
|
|
|
+ return {
|
|
|
+ submitBtn: false,
|
|
|
+ emptyBtn: false,
|
|
|
+ column: [
|
|
|
+ {
|
|
|
+ label: '模板上传',
|
|
|
+ prop: 'excelFile',
|
|
|
+ type: 'upload',
|
|
|
+ drag: true,
|
|
|
+ loadText: '模板上传中,请稍等',
|
|
|
+ span: 24,
|
|
|
+ propsHttp: {
|
|
|
+ res: 'data'
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ yearAndMonth: this.params.yearAndMonth,
|
|
|
+ },
|
|
|
+ tip: '请上传 .xls,.xlsx 标准格式文件',
|
|
|
+ action: '/api/kd-scientific/technician/import'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '模板下载',
|
|
|
+ prop: 'excelTemplate',
|
|
|
+ formslot: true,
|
|
|
+ span: 24,
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleImport() {
|
|
|
+ this.excelBox = true;
|
|
|
+ this.excelForm.yearAndMonth = this.params.yearAndMonth;
|
|
|
+ },
|
|
|
+ uploadAfter(res, done, loading, column) {
|
|
|
+ this.excelBox = false;
|
|
|
+ this.page.currentPage = 1;
|
|
|
+ this.getList(this.page);
|
|
|
+ done();
|
|
|
+ },
|
|
|
+ handleExport() {
|
|
|
+ this.$confirm("是否导出?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ NProgress.start();
|
|
|
+ exportBloByPost(`/api/kd-scientific/technician/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
|
|
|
+ downloadXls(res.data, `${this.params.yearAndMonth}年度高新科技人员汇总表.xlsx`);
|
|
|
+ NProgress.done();
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleTemplate() {
|
|
|
+ this.$message.warning("暂未配置模板");
|
|
|
+ // exportBlob(`/api/kd-system/region/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => {
|
|
|
+ // downloadXls(res.data, "技术人员花名册.xlsx");
|
|
|
+ // });
|
|
|
+ },
|
|
|
+ },
|
|
|
+}, {
|
|
|
+ // 模块路径
|
|
|
+ name: 'highTechPersonSumList',
|
|
|
+ res: ({ data }) => {
|
|
|
+ data.records = data.records.map(item => {
|
|
|
+ item.gender = item.gender ? String(item.gender) : '';
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ return data;
|
|
|
+ },
|
|
|
+});
|
|
|
+</script>
|