change.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <basic-container>
  3. <div style="margin-top: 6px;">
  4. <el-form :inline="true">
  5. <el-form-item label="研发项目名称">
  6. <project-select v-model="params.xmId" @change="handleProjectChange"></project-select>
  7. </el-form-item>
  8. <el-form-item label="研发项目编号">
  9. {{ selProject.xmbh }}
  10. </el-form-item>
  11. </el-form>
  12. </div>
  13. <avue-crud
  14. ref="crud"
  15. v-bind="bindVal"
  16. v-on="onEvent"
  17. v-model="form"
  18. :page.sync="page"
  19. :before-open="handleBeforeOpen"
  20. :permission="permissionList"
  21. >
  22. <template slot="menuLeft">
  23. <el-button type="primary" size="small" icon="el-icon-position" @click="handleAddChange">
  24. 发起变更
  25. </el-button>
  26. <el-button
  27. type="warning"
  28. size="small"
  29. plain
  30. icon="el-icon-download"
  31. @click="handleExport"
  32. >
  33. 导出
  34. </el-button>
  35. <print-table-btn @click="printTable" />
  36. </template>
  37. </avue-crud>
  38. <WideTablePrinter
  39. ref="printWideTable"
  40. :columns="wideTableColumns"
  41. :data="data"
  42. :print-title="printTitle"
  43. :rows-per-page="30"
  44. :default-landscape="true"
  45. />
  46. <el-drawer
  47. title="发起变更"
  48. :visible.sync="drawerVisible"
  49. modal-append-to-body
  50. append-to-body
  51. size="960px"
  52. >
  53. <change-form
  54. v-if="drawerVisible"
  55. :projectId="params.xmId"
  56. :data="changeFormData"
  57. :disabled="isFormReadonly"
  58. @success="handleChangeSucc"
  59. >
  60. </change-form>
  61. </el-drawer>
  62. </basic-container>
  63. </template>
  64. <script>
  65. import {exportBloByPost} from "@/api/common";
  66. import {getToken} from "@/util/auth";
  67. import projectSelect from "@/components/project-select";
  68. import {downloadXls} from "@/util/util";
  69. import changeForm from "./components/change-form.vue";
  70. export default window.$crudCommon({
  71. props: {
  72. projectId: [String, Number]
  73. },
  74. components: {
  75. changeForm,
  76. projectSelect
  77. },
  78. data() {
  79. return {
  80. params: {
  81. xmId: ''
  82. },
  83. selProject: {},
  84. drawerVisible: false,
  85. wideTableColumns: [],
  86. printTitle: "",
  87. changeFormData: {},
  88. isFormReadonly: false,
  89. };
  90. },
  91. watch: {
  92. "params.xmId"() {
  93. this.page.currentPage = 1;
  94. this.getList(this.page);
  95. }
  96. },
  97. created() {
  98. this.params.xmId = this.projectId;
  99. },
  100. methods: {
  101. handleProjectChange(data) {
  102. this.selProject = data;
  103. },
  104. handleExport() {
  105. exportBloByPost(`/api/kd-scientific/xm-bgrz/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
  106. downloadXls(res.data, `${this.selProject.xmmc}项目变更列表.xlsx`);
  107. });
  108. },
  109. /**
  110. * 打印表格
  111. * @param isLandscape 是否横向打印
  112. */
  113. printTable(isLandscape) {
  114. this.wideTableColumns = this.$refs.crud.columnOption;
  115. this.printTitle = `${this.selProject.xmmc}项目变更列表`;
  116. this.$nextTick(() => {
  117. this.$refs.printWideTable.printTable(isLandscape);
  118. })
  119. },
  120. handleAddChange() {
  121. this.drawerVisible = true;
  122. this.isFormReadonly = false;
  123. this.changeFormData = {};
  124. },
  125. handleRowDbClick(data) {
  126. this.drawerVisible = true;
  127. this.isFormReadonly = true;
  128. this.changeFormData = data;
  129. },
  130. handleChangeSucc() {
  131. this.drawerVisible = false;
  132. this.getList();
  133. }
  134. },
  135. }, {
  136. // 模块路径
  137. name: 'projectManage/change',
  138. });
  139. </script>