|
|
@@ -0,0 +1,162 @@
|
|
|
+<template>
|
|
|
+ <basic-container>
|
|
|
+ <avue-crud
|
|
|
+ ref="crud"
|
|
|
+ v-bind="bindVal"
|
|
|
+ v-on="onEvent"
|
|
|
+ v-model="form"
|
|
|
+ :page.sync="page"
|
|
|
+ >
|
|
|
+ <template slot="menuLeft">
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ plain
|
|
|
+ @click="handleDelete"
|
|
|
+ >
|
|
|
+ 删 除
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ size="small"
|
|
|
+ plain
|
|
|
+ icon="el-icon-download"
|
|
|
+ @click="handleExport"
|
|
|
+ >
|
|
|
+ 导出
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ @click="handleZjyyClick"
|
|
|
+ >
|
|
|
+ 直接引用预算表名单
|
|
|
+ </el-button>
|
|
|
+ <print-table-btn @click="printTable" />
|
|
|
+ <div>
|
|
|
+ <year-month-select v-model="params.yearAndMonth" :showAllYear="false"></year-month-select>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template slot="xmmcSearch">
|
|
|
+ <project-select placeholder="请选择项目名称" v-model="params.xmId"></project-select>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template slot="xmmcForm">
|
|
|
+ <project-select placeholder="请选择项目名称" v-model="form.xmId" @change="handleProjectChange"></project-select>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template slot="nameForm">
|
|
|
+ <el-select placeholder="请选择 参研人员姓名" v-model="form.tenantId" :disabled="!form.xmId">
|
|
|
+ <el-option v-for="item of technicianList" :key="item.id" :value="item.id" :label="item.name"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ </avue-crud>
|
|
|
+
|
|
|
+ <WideTablePrinter
|
|
|
+ ref="printWideTable"
|
|
|
+ :columns="wideTableColumns"
|
|
|
+ :data="data"
|
|
|
+ :print-title="printTitle"
|
|
|
+ :rows-per-page="30"
|
|
|
+ :default-landscape="true"
|
|
|
+ />
|
|
|
+ </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";
|
|
|
+import projectSelect from "@/components/project-select";
|
|
|
+import {getListByProDate} from "@/api/basicResource/technicianRoster";
|
|
|
+import {yyysbmd} from "@/api/techPerson/monthSjcyry"
|
|
|
+
|
|
|
+
|
|
|
+export default window.$crudCommon({
|
|
|
+ components: {
|
|
|
+ YearMonthSelect,
|
|
|
+ projectSelect
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ params: {
|
|
|
+ yearAndMonth: moment(new Date()).format('YYYYMM'),
|
|
|
+ },
|
|
|
+
|
|
|
+ technicianList: [],
|
|
|
+
|
|
|
+ wideTableColumns: [],
|
|
|
+ printTitle: "",
|
|
|
+ };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ 'params.yearAndMonth'(newVal) {
|
|
|
+ this.page.currentPage = 1;
|
|
|
+ this.getList(this.page);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getFormData() {
|
|
|
+ return { ...this.form, yearAndMonth: this.params.yearAndMonth };
|
|
|
+ },
|
|
|
+ handleZjyyClick() {
|
|
|
+ if (!this.params.xmId) {
|
|
|
+ this.$message.error("请设置“研发项目”后,再操作!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ yyysbmd({ xmId: this.params.xmId, yearAndMonth: this.params.yearAndMonth }).then(({ data }) => {
|
|
|
+ if (data.code == 200) {
|
|
|
+ this.$message.success("引用预算表成功");
|
|
|
+ this.page.currentPage = 1;
|
|
|
+ this.getList(this.page);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleProjectChange(data) {
|
|
|
+ this.technicianList = [];
|
|
|
+ let startDate = moment(data.xmkssj).format('yyyyMM');
|
|
|
+ let endDate = moment(data.xmjssj).format('yyyyMM');
|
|
|
+
|
|
|
+ getListByProDate(startDate, endDate).then(({ data }) => {
|
|
|
+ if (data.code == 200) {
|
|
|
+ this.technicianList = data.data.records;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleExport() {
|
|
|
+ this.$confirm("是否导出吗?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ NProgress.start();
|
|
|
+ exportBloByPost(`/api/kd-scientific/technician/xm/monthly/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
|
|
|
+ downloadXls(res.data, `${this.params.yearAndMonth}实际参研人员.xlsx`);
|
|
|
+ NProgress.done();
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ printTable(isLandscape) {
|
|
|
+ this.wideTableColumns = this.$refs.crud.columnOption;
|
|
|
+ this.printTitle = `${this.params.yearAndMonth}实际参研人员`;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.printWideTable.printTable(isLandscape);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+}, {
|
|
|
+ // 模块路径
|
|
|
+ name: 'techPerson/monthSjcyry',
|
|
|
+ res: ({ data }) => {
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+});
|
|
|
+</script>
|