soft-works.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <basic-container>
  3. <avue-crud
  4. v-bind="bindVal"
  5. v-on="onEvent"
  6. v-model="form"
  7. :page.sync="page"
  8. >
  9. <template slot="menuLeft">
  10. <el-button
  11. type="danger"
  12. size="small"
  13. icon="el-icon-delete"
  14. plain
  15. @click="handleDelete"
  16. >
  17. 删 除
  18. </el-button>
  19. <el-button
  20. type="success"
  21. size="small"
  22. plain
  23. icon="el-icon-upload2"
  24. @click="handleImport"
  25. >
  26. 导入
  27. </el-button>
  28. <el-button
  29. type="warning"
  30. size="small"
  31. plain
  32. icon="el-icon-download"
  33. @click="handleExport"
  34. >
  35. 导出
  36. </el-button>
  37. <el-button
  38. size="small"
  39. type="primary"
  40. icon="el-icon-printer"
  41. @click="printTable"
  42. >
  43. 打印
  44. </el-button>
  45. <div class="tip">提示:企业可自行上传全部历史专利信息和资料,如专利与系统中已建档的研究项目无关,则研发项目编号和研发项目名称非必填。</div>
  46. </template>
  47. <template slot="kfwcrqSearch">
  48. <span>开发完成时间:</span>
  49. <el-date-picker
  50. v-model="extraParams.kfwcrq"
  51. type="daterange"
  52. range-separator="至"
  53. start-placeholder="开始日期"
  54. end-placeholder="结束日期"
  55. value-format="yyyy-MM-dd"
  56. style="width: 220px !important;"
  57. >
  58. </el-date-picker>
  59. </template>
  60. <template slot="scfbrqSearch">
  61. <span>首次发布时间:</span>
  62. <el-date-picker
  63. v-model="extraParams.scfbrq"
  64. type="daterange"
  65. range-separator="至"
  66. start-placeholder="开始日期"
  67. end-placeholder="结束日期"
  68. value-format="yyyy-MM-dd"
  69. style="width: 220px !important;"
  70. >
  71. </el-date-picker>
  72. </template>
  73. <template slot="djpzrqSearch">
  74. <span>登记批准日期:</span>
  75. <el-date-picker
  76. v-model="extraParams.djpzrq"
  77. type="daterange"
  78. range-separator="至"
  79. start-placeholder="开始日期"
  80. end-placeholder="结束日期"
  81. value-format="yyyy-MM-dd"
  82. style="width: 220px !important;"
  83. >
  84. </el-date-picker>
  85. </template>
  86. <template slot="xmIdForm">
  87. <project-select v-model="form.xmId" @change="handleProjectChange"></project-select>
  88. </template>
  89. <template slot="attachment" slot-scope="{ row }">
  90. <div v-for="(file, index) of row.attachment" :key="index">
  91. <el-link @click="handleDownFile(file)">{{ file.label }}</el-link>
  92. </div>
  93. </template>
  94. </avue-crud>
  95. <upload-excel-dialog ref="uploadExcelDialog" :uploadAfter="uploadAfter"/>
  96. <WideTablePrinter
  97. ref="printWideTable"
  98. :columns="wideTableColumns"
  99. :data="data"
  100. :print-title="printTitle"
  101. :rows-per-page="30"
  102. :default-landscape="true"
  103. />
  104. </basic-container>
  105. </template>
  106. <script>
  107. import {exportBlob} from "@/api/common";
  108. import UploadExcelDialog from "@/components/upload-excel-dialog";
  109. import NProgress from 'nprogress';
  110. import 'nprogress/nprogress.css';
  111. import {getToken} from "@/util/auth";
  112. import {downloadXls} from "@/util/util";
  113. import projectSelect from "@/components/project-select";
  114. export default window.$crudCommon({
  115. components: {
  116. UploadExcelDialog,
  117. projectSelect
  118. },
  119. data() {
  120. return {
  121. wideTableColumns: [],
  122. printTitle: "",
  123. };
  124. },
  125. methods: {
  126. getSearchParams() {
  127. const newParams = { ...this.params, ...this.extraParams };
  128. if (newParams.kfwcrq && newParams.kfwcrq.length) {
  129. newParams.kfwcrqMin = newParams.kfwcrq[0];
  130. newParams.kfwcrqMax = newParams.kfwcrq[1];
  131. }
  132. if (newParams.scfbrq && newParams.scfbrq.length) {
  133. newParams.scfbrqMin = newParams.scfbrq[0];
  134. newParams.scfbrqMax = newParams.scfbrq[1];
  135. }
  136. if (newParams.djpzrq && newParams.djpzrq.length) {
  137. newParams.djpzrqMin = newParams.djpzrq[0];
  138. newParams.djpzrqMax = newParams.djpzrq[1];
  139. }
  140. delete newParams.kfwcrq;
  141. delete newParams.scfbrq;
  142. delete newParams.djpzrq;
  143. return newParams;
  144. },
  145. getFormData() {
  146. let newFormData = { ...this.form };
  147. if (!!newFormData.attachment) {
  148. newFormData.attachment = JSON.stringify(newFormData.attachment);
  149. }
  150. return newFormData;
  151. },
  152. handleProjectChange(data){
  153. this.form = {
  154. ...this.form,
  155. xmmc: data.xmmc,
  156. xmbh: data.xmbh
  157. }
  158. },
  159. handleImport() {
  160. this.$refs.uploadExcelDialog.open('/api/kd-scientific/kycg/rjzzq/import', {});
  161. },
  162. uploadAfter() {
  163. this.page.currentPage = 1;
  164. this.getList(this.page);
  165. },
  166. handleExport() {
  167. exportBlob(`/api/kd-scientific/kycg/rjzzq/export?${this.website.tokenHeader}=${getToken()}`, {}).then(res => {
  168. downloadXls(res.data, `软件著作列表.xlsx`);
  169. NProgress.done();
  170. })
  171. },
  172. printTable() {
  173. this.wideTableColumns = this.$refs.crud.columnOption;
  174. this.printTitle = `软件著作列表`;
  175. this.$nextTick(() => {
  176. this.$refs.printWideTable.printTable(false);
  177. })
  178. },
  179. handleDownFile(file) {
  180. window.open(file.value, "_blank");
  181. }
  182. },
  183. }, {
  184. // 模块路径
  185. name: 'achievement/softWorks',
  186. res: ({ data }) => {
  187. data.records = data.records.map(item => {
  188. item.xmId = item.xmId === 0 ? '' : item.xmId;
  189. item.attachment = !!item.attachment ? JSON.parse(item.attachment) : [];
  190. return item;
  191. });
  192. return data;
  193. },
  194. });
  195. </script>