| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- <template>
- <basic-container>
- <div style="margin-top: 6px;">
- <el-form :inline="true">
- <el-form-item label="研发项目名称">
- <project-select v-model="params.xmId" @change="handleProjectChange"></project-select>
- </el-form-item>
- <el-form-item label="研发项目编号">
- {{ selProject.xmbh }}
- </el-form-item>
- </el-form>
- </div>
- <avue-crud
- ref="crud"
- v-bind="bindVal"
- v-on="onEvent"
- v-model="form"
- :page.sync="page"
- :before-open="handleBeforeOpen"
- :permission="permissionList"
- @row-dblclick="handleRowDbClick"
- >
- <template slot="menuLeft">
- <el-button type="primary" size="small" icon="el-icon-plus" @click="handleAdd">
- 新增
- </el-button>
- <el-button
- type="warning"
- size="small"
- plain
- icon="el-icon-download"
- @click="handleExport"
- >
- 导出
- </el-button>
- <print-table-btn @click="printTable" />
- </template>
- <template slot-scope="{row, index}" slot="menu">
- <el-button type="text" icon="el-icon-edit" @click="rowEdit(row)" style="margin-right: 12px;">编辑</el-button>
- <el-button type="text" icon="el-icon-delete" style="margin-left: 0;" @click="rowDel(row, index)">删除</el-button>
- </template>
-
- </avue-crud>
- <WideTablePrinter
- ref="printWideTable"
- :columns="wideTableColumns"
- :data="data"
- :print-title="printTitle"
- :rows-per-page="30"
- :default-landscape="true"
- />
- <el-drawer
- v-if="drawerVisible"
- :title="drawerTitle"
- :visible.sync="drawerVisible"
- modal-append-to-body
- append-to-body
- size="960px"
- >
-
- <implement-form
- :projectId="params.xmId"
- :data="implementFormData"
- :disabled="isFormReadonly"
- @success="handleImplementSucc"
- >
- </implement-form>
- </el-drawer>
- </basic-container>
- </template>
- <script>
- import {exportBloByPost} from "@/api/common";
- import {getToken} from "@/util/auth";
- import projectSelect from "@/components/project-select";
- import {downloadXls} from "@/util/util";
- import implementForm from "./components/implement-form.vue";
- export default window.$crudCommon({
- props: {
- projectId: [String, Number]
- },
- components: {
- implementForm,
- projectSelect
- },
- data() {
- return {
- params: {
- xmId: ''
- },
- selProject: {},
- drawerTitle: "",
- drawerVisible: false,
- wideTableColumns: [],
- printTitle: "",
- implementFormData: {},
- isFormReadonly: false,
- };
- },
- watch: {
- "params.xmId"() {
- this.getList();
- }
- },
- created() {
- this.params.xmId = this.projectId;
- },
- methods: {
- handleImplementSucc() {
- this.drawerVisible = false;
- this.loadData();
- },
- loadData() {
- if (!this.params.xmId) {
- return;
- }
- this.loading = true;
- this.api[this.option.list || 'getList'](this.params.xmId).then(({ data }) => {
- this.data = data.data.map(item => {
- item.xmmc = item.xmEntity ? item.xmEntity.xmmc : '';
- item.xmbh = item.xmEntity ? item.xmEntity.xmbh : '';
- item.xmsqdw = item.xmEntity ? item.xmEntity.xmsqdw : '';
- item.xmfzrxm = item.xmEntity ? item.xmEntity.xmfzrxm : '';
- return item;
- });
- this.loading = false;
- });
-
- },
- handleProjectChange(data) {
- this.selProject = data;
- },
- handleExport() {
- exportBloByPost(`/api/kd-scientific/xm-bgrz/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
- downloadXls(res.data, `${this.selProject.xmmc}阶段性报告列表.xlsx`);
- });
- },
- /**
- * 打印表格
- * @param isLandscape 是否横向打印
- */
- printTable(isLandscape) {
- this.wideTableColumns = this.$refs.crud.columnOption;
- this.printTitle = `${this.selProject.xmmc}阶段性报告列表`;
- this.$nextTick(() => {
- this.$refs.printWideTable.printTable(isLandscape);
- })
- },
- handleAdd() {
- this.drawerVisible = true;
- this.isFormReadonly = false;
- this.drawerTitle = "新增阶段性报告";
- this.implementFormData = {};
- },
- rowEdit(data) {
- this.drawerVisible = true;
- this.isFormReadonly = false;
- this.drawerTitle = "编辑阶段性报告";
- this.implementFormData = {
- ...data,
- attachment: data.attachment ? JSON.parse(data.attachment) : []
- };
- },
- handleRowDbClick(data) {
- this.drawerVisible = true;
- this.isFormReadonly = true;
- this.drawerTitle = "阶段性报告详情";
- this.implementFormData = {
- ...data,
- attachment: data.attachment ? JSON.parse(data.attachment) : []
- };
- },
- handleChangeSucc() {
- this.drawerVisible = false;
- this.getList();
- }
- },
- }, {
- // 模块路径
- name: 'projectManage/implement',
- });
- </script>
|