file-supplement.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <basic-container>
  3. <avue-crud
  4. v-bind="bindVal"
  5. v-on="onEvent"
  6. v-model="form"
  7. :before-open="handleBeforeOpen"
  8. >
  9. <template slot="menuLeft">
  10. <el-button
  11. type="primary"
  12. size="small"
  13. icon="el-icon-download"
  14. @click="handleDownAll"
  15. >
  16. 一键下载
  17. </el-button>
  18. <el-button
  19. type="warning"
  20. size="small"
  21. plain
  22. icon="el-icon-download"
  23. @click="handleExport"
  24. >
  25. 一键导出
  26. </el-button>
  27. <div style="display: flex; align-items: center;">
  28. <year-month-select v-model="params.year" :showMonth="false"></year-month-select>
  29. </div>
  30. </template>
  31. <template slot="menu" slot-scope="{row}">
  32. <el-button type="text" icon="el-icon-download" size="mini" @click="handleRowDown(row)">下载</el-button>
  33. </template>
  34. <template slot="fileList" slot-scope="{row}">
  35. <el-link
  36. v-for="(item, index) of row.fileList"
  37. :key="index"
  38. type="primary"
  39. @click="handleDownFile(item)"
  40. :style="{marginRight: index === row.fileList.length - 1 ? 0 : '16px'}"
  41. >
  42. {{ item.label }}
  43. </el-link>
  44. </template>
  45. </avue-crud>
  46. <div class="file-temp-list">
  47. <div class="row"><el-link @click="handleDownTemp('template1')">模板:当年和前两个会计年度研发费用总额及占同期销售收入比例的说明.doc</el-link></div>
  48. <div class="row"><el-link @click="handleDownTemp('template2')">模板:年度职工和科技人员情况说明.doc</el-link></div>
  49. <div class="row"><el-link @click="handleDownTemp('template3')">模板:年度主要产品(服务)发挥核心支持作用的技术属于《国家重点支持的高新技术领域》规定范围的说明.doc</el-link></div>
  50. <div class="row"><el-link @click="handleDownTemp('template4')">模版:研发费用结构明细表.xls</el-link></div>
  51. </div>
  52. </basic-container>
  53. </template>
  54. <script>
  55. import YearMonthSelect from "@/components/year-month-select";
  56. import {exportBlob} from "@/api/common";
  57. import {getToken} from "@/util/auth";
  58. import {downloadXls} from "@/util/util";
  59. import moment from "moment";
  60. import { getDictValueByKey } from '@/api/system/dict';
  61. export default window.$crudCommon({
  62. components: {
  63. YearMonthSelect,
  64. },
  65. data() {
  66. return {
  67. params: {
  68. year: moment(new Date()).format('YYYY'),
  69. },
  70. isSelAnnual: false,
  71. wideTableColumns: [],
  72. printTitle: "",
  73. currIndex: 0
  74. };
  75. },
  76. watch: {
  77. 'params.year'() {
  78. this.getList();
  79. },
  80. },
  81. methods: {
  82. loadData() {
  83. this.loading = true;
  84. this.api.getList(this.getSearchParams()).then(({ data }) => {
  85. if (data.code == 200) {
  86. let list = [{
  87. id: data.data.id,
  88. fileName: '高新项目技术鉴定资料',
  89. fileList: JSON.parse(data.data.d1 || '[]')
  90. }, {
  91. id: data.data.id,
  92. fileName: '加计扣除项目技术鉴定资料',
  93. fileList: JSON.parse(data.data.d2 || '[]')
  94. }, {
  95. id: data.data.id,
  96. fileName: '高新技术企业认定资料',
  97. fileList: JSON.parse(data.data.d3 || '[]')
  98. }, {
  99. id: data.data.id,
  100. fileName: '年度主要产品(服务)发挥核心支持作用的技术属于《国家重点支持的高新技术领域》规定范围的说明',
  101. fileList: JSON.parse(data.data.d4 || '[]')
  102. }, {
  103. id: data.data.id,
  104. fileName: '高新技术产品(服务)及对应收入资料',
  105. fileList: JSON.parse(data.data.d5 || '[]')
  106. }, {
  107. id: data.data.id,
  108. fileName: '年度职工和科技人员情况说明',
  109. fileList: JSON.parse(data.data.d6 || '[]')
  110. }, {
  111. id: data.data.id,
  112. fileName: '当年和前两个会计年度研发费用总额及占同期销售收入比例的说明',
  113. fileList: JSON.parse(data.data.d7 || '[]')
  114. }, {
  115. id: data.data.id,
  116. fileName: '研发管理制度',
  117. fileList: JSON.parse(data.data.d8 || '[]')
  118. }, {
  119. id: data.data.id,
  120. fileName: '研发费用结构明细表',
  121. fileList: JSON.parse(data.data.d9 || '[]')
  122. }, {
  123. id: data.data.id,
  124. fileName: '加计扣除情况说明',
  125. fileList: JSON.parse(data.data.d10 || '[]')
  126. }, {
  127. id: data.data.id,
  128. fileName: '其他高新备查资料',
  129. fileList: JSON.parse(data.data.d11 || '[]')
  130. }, {
  131. id: data.data.id,
  132. fileName: '其他加计扣除备查资料',
  133. fileList: JSON.parse(data.data.d12 || '[]')
  134. }];
  135. this.data = list;
  136. }
  137. this.loading = false;
  138. })
  139. },
  140. handleBeforeOpen(done) {
  141. this.currIndex = this.form.$index + 1;
  142. done();
  143. },
  144. handleExport() {
  145. exportBlob(`/api/kd-scientific/fjbczl/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
  146. downloadXls(res.data, `${this.params.year}附件补充.xlsx`);
  147. });
  148. },
  149. handleDownFile(file) {
  150. let urlObj = new URL(file.value);
  151. const link = document.createElement('a');
  152. link.href = window.location.origin + '/oss' + urlObj.pathname;
  153. link.download = file.label; // 设置下载文件名
  154. link.click();
  155. },
  156. handleDownAll() {
  157. this.$message.warning("功能建设中...");
  158. },
  159. handleRowDown() {
  160. this.$message.warning("功能建设中...");
  161. },
  162. getFormData() {
  163. return { id: this.form.id, yearAndMonth: this.params.year, [`d${this.currIndex}`]: JSON.stringify(this.form.fileList) }
  164. },
  165. handleDownTemp(templateKey) {
  166. getDictValueByKey('fjbczl-template', templateKey).then(({ data }) => {
  167. if (data.code == 200) {
  168. if (typeof data.data === 'object') {
  169. this.$message.error('暂未配置模板');
  170. return;
  171. }
  172. let tempObj = {
  173. 'template1': '当年和前两个会计年度研发费用总额及占同期销售收入比例的说明.doc',
  174. 'template2': '年度职工和科技人员情况说明.doc',
  175. 'template3': '年度主要产品(服务)发挥核心支持作用的技术属于《国家重点支持的高新技术领域》规定范围的说明.doc',
  176. 'template4': '研发费用结构明细表.xls'
  177. };
  178. let urlObj = new URL(data.data);
  179. const link = document.createElement('a');
  180. link.href = window.location.origin + urlObj.pathname;
  181. link.download = tempObj[templateKey]; // 设置下载文件名
  182. link.click();
  183. }
  184. })
  185. },
  186. },
  187. }, {
  188. // 模块路径
  189. name: 'achiveManage/fileSupplement',
  190. });
  191. </script>
  192. <style lang="scss" scoped>
  193. .file-temp-list {
  194. margin-top: 20px;
  195. .row {
  196. line-height: 24px;
  197. }
  198. }
  199. </style>