file-supplement.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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. </template>
  28. <template slot="body">
  29. <h3 class="page-title">{{ pageTitle }}</h3>
  30. <year-month-select v-model="params.year" :showMonth="false"></year-month-select>
  31. </template>
  32. <!-- <template slot="menu" slot-scope="{row}">
  33. <el-button type="text" icon="el-icon-download" size="mini" @click="handleRowDown(row)">下载</el-button>
  34. </template> -->
  35. <template slot="fileList" slot-scope="{row}">
  36. <el-link
  37. v-for="(item, index) of row.fileList"
  38. :key="index"
  39. type="primary"
  40. @click="handleDownFile(item)"
  41. :style="{marginRight: index === row.fileList.length - 1 ? 0 : '16px'}"
  42. >
  43. {{ item.label }}
  44. </el-link>
  45. </template>
  46. </avue-crud>
  47. <div class="file-temp-list">
  48. <div class="row"><el-link @click="handleDownTemp('template1')">模板:当年和前两个会计年度研发费用总额及占同期销售收入比例的说明.doc</el-link></div>
  49. <div class="row"><el-link @click="handleDownTemp('template2')">模板:年度职工和科技人员情况说明.doc</el-link></div>
  50. <div class="row"><el-link @click="handleDownTemp('template3')">模板:年度主要产品(服务)发挥核心支持作用的技术属于《国家重点支持的高新技术领域》规定范围的说明.doc</el-link></div>
  51. <div class="row"><el-link @click="handleDownTemp('template4')">模版:研发费用结构明细表.xls</el-link></div>
  52. </div>
  53. </basic-container>
  54. </template>
  55. <script>
  56. import YearMonthSelect from "@/components/year-month-select";
  57. import {exportBlob} from "@/api/common";
  58. import {getToken} from "@/util/auth";
  59. import {downloadXls, downloadFileByUrl} from "@/util/util";
  60. import moment from "moment";
  61. import { getDictValueByKey } from '@/api/system/dict';
  62. import { mapGetters } from "vuex";
  63. import JSZip from "jszip";
  64. import FileSaver from "file-saver";
  65. export default window.$crudCommon({
  66. components: {
  67. YearMonthSelect,
  68. },
  69. data() {
  70. return {
  71. params: {
  72. year: "",
  73. },
  74. isSelAnnual: false,
  75. wideTableColumns: [],
  76. printTitle: "",
  77. currIndex: 0
  78. };
  79. },
  80. watch: {
  81. 'params.year'() {
  82. this.getList();
  83. },
  84. },
  85. computed: {
  86. ...mapGetters(['tag']),
  87. pageTitle() {
  88. let yearCN = this.params.year ? moment(this.params.year).format('yyyy年') : ''
  89. return `${yearCN}${this.tag.label}`
  90. }
  91. },
  92. created() {
  93. this.option.column.forEach(item => {
  94. if (item.prop == 'fileList') {
  95. item.uploadBefore = (file, done, loading) => {
  96. if (this.form.fileList.some(item => item.label == file.name)) {
  97. this.$message.error(`${file.name}文件已存在!`);
  98. return;
  99. }
  100. done();
  101. }
  102. }
  103. })
  104. },
  105. methods: {
  106. loadData() {
  107. this.loading = true;
  108. this.api.getList(this.getSearchParams()).then(({ data }) => {
  109. if (data.code == 200) {
  110. let list = [{
  111. id: data.data.id,
  112. fileName: '高新项目技术鉴定资料',
  113. fileList: JSON.parse(data.data.d1 || '[]')
  114. }, {
  115. id: data.data.id,
  116. fileName: '加计扣除项目技术鉴定资料',
  117. fileList: JSON.parse(data.data.d2 || '[]')
  118. }, {
  119. id: data.data.id,
  120. fileName: '高新技术企业认定资料',
  121. fileList: JSON.parse(data.data.d3 || '[]')
  122. }, {
  123. id: data.data.id,
  124. fileName: '年度主要产品(服务)发挥核心支持作用的技术属于《国家重点支持的高新技术领域》规定范围的说明',
  125. fileList: JSON.parse(data.data.d4 || '[]')
  126. }, {
  127. id: data.data.id,
  128. fileName: '高新技术产品(服务)及对应收入资料',
  129. fileList: JSON.parse(data.data.d5 || '[]')
  130. }, {
  131. id: data.data.id,
  132. fileName: '年度职工和科技人员情况说明',
  133. fileList: JSON.parse(data.data.d6 || '[]')
  134. }, {
  135. id: data.data.id,
  136. fileName: '当年和前两个会计年度研发费用总额及占同期销售收入比例的说明',
  137. fileList: JSON.parse(data.data.d7 || '[]')
  138. }, {
  139. id: data.data.id,
  140. fileName: '研发管理制度',
  141. fileList: JSON.parse(data.data.d8 || '[]')
  142. }, {
  143. id: data.data.id,
  144. fileName: '研发费用结构明细表',
  145. fileList: JSON.parse(data.data.d9 || '[]')
  146. }, {
  147. id: data.data.id,
  148. fileName: '加计扣除情况说明',
  149. fileList: JSON.parse(data.data.d10 || '[]')
  150. }, {
  151. id: data.data.id,
  152. fileName: '其他高新备查资料',
  153. fileList: JSON.parse(data.data.d11 || '[]')
  154. }, {
  155. id: data.data.id,
  156. fileName: '其他加计扣除备查资料',
  157. fileList: JSON.parse(data.data.d12 || '[]')
  158. }];
  159. this.data = list;
  160. }
  161. this.loading = false;
  162. })
  163. },
  164. handleBeforeOpen(done) {
  165. this.currIndex = this.form.$index + 1;
  166. done();
  167. },
  168. // handleExport() {
  169. // exportBlob(`/api/kd-scientific/fjbczl/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
  170. // downloadXls(res.data, `${this.params.year}附件补充.xlsx`);
  171. // });
  172. // },
  173. handleDownFile(file) {
  174. downloadFileByUrl(file.value, file.label);
  175. },
  176. handleDownAll() {
  177. let downParams = { year: this.params.year };
  178. exportBlob(`/api/kd-scientific/archive/fjbczl/download?${this.website.tokenHeader}=${getToken()}`, downParams).then(res => {
  179. downloadXls(res.data, `${this.pageTitle}.zip`);
  180. });
  181. },
  182. handleRowDown(row) {
  183. this.$message.warning("功能建设中...");
  184. // console.log(row)
  185. // if (row.fileList.length) {
  186. // const promiseArr = row.fileList.map(item => {
  187. // return exportBlob('')
  188. // });
  189. // Promise.all(promiseArr).then((res) => {
  190. // // zip
  191. // console.log(res)
  192. // })
  193. // }
  194. },
  195. getFormData() {
  196. return { id: this.form.id, yearAndMonth: this.params.year, [`d${this.currIndex}`]: JSON.stringify(this.form.fileList) }
  197. },
  198. handleDownTemp(templateKey) {
  199. getDictValueByKey('fjbczl-template', templateKey).then(({ data }) => {
  200. if (data.code == 200) {
  201. if (typeof data.data === 'object') {
  202. this.$message.error('暂未配置模板');
  203. return;
  204. }
  205. let tempObj = {
  206. 'template1': '当年和前两个会计年度研发费用总额及占同期销售收入比例的说明.doc',
  207. 'template2': '年度职工和科技人员情况说明.doc',
  208. 'template3': '年度主要产品(服务)发挥核心支持作用的技术属于《国家重点支持的高新技术领域》规定范围的说明.doc',
  209. 'template4': '研发费用结构明细表.xls'
  210. };
  211. downloadFileByUrl(data.data, tempObj[templateKey]);
  212. }
  213. })
  214. },
  215. },
  216. }, {
  217. // 模块路径
  218. name: 'achiveManage/fileSupplement',
  219. });
  220. </script>
  221. <style lang="scss" scoped>
  222. .file-temp-list {
  223. margin-top: 20px;
  224. .row {
  225. line-height: 24px;
  226. }
  227. }
  228. </style>