file-supplement.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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.yearAndMonth" :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. export default window.$crudCommon({
  64. components: {
  65. YearMonthSelect,
  66. },
  67. data() {
  68. return {
  69. params: {
  70. yearAndMonth: "",
  71. },
  72. isSelAnnual: false,
  73. wideTableColumns: [],
  74. printTitle: "",
  75. currIndex: 0
  76. };
  77. },
  78. watch: {
  79. 'params.yearAndMonth'() {
  80. this.getList();
  81. },
  82. },
  83. computed: {
  84. ...mapGetters(['tag']),
  85. pageTitle() {
  86. let yearCN = this.params.yearAndMonth ? moment(this.params.yearAndMonth).format('yyyy年') : ''
  87. return `${yearCN}${this.tag.label}`
  88. }
  89. },
  90. created() {
  91. this.option.column.forEach(item => {
  92. if (item.prop == 'fileList') {
  93. item.uploadBefore = (file, done, loading) => {
  94. if (this.form.fileList.some(item => item.label == file.name)) {
  95. this.$message.error(`${file.name}文件已存在!`);
  96. return;
  97. }
  98. done();
  99. }
  100. }
  101. })
  102. },
  103. methods: {
  104. loadData() {
  105. this.loading = true;
  106. const params = { ...this.getSearchParams(), year: this.params.yearAndMonth };
  107. delete params.yearAndMonth;
  108. this.api.getList(params).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. rowIndex: 'd1'
  115. }, {
  116. id: data.data.id,
  117. fileName: '加计扣除项目技术鉴定资料',
  118. fileList: JSON.parse(data.data.d2 || '[]'),
  119. rowIndex: 'd2'
  120. }, {
  121. id: data.data.id,
  122. fileName: '高新技术企业认定资料',
  123. fileList: JSON.parse(data.data.d3 || '[]'),
  124. rowIndex: 'd3'
  125. }, {
  126. id: data.data.id,
  127. fileName: '研发立项决议文件',
  128. fileList: JSON.parse(data.data.d13 || '[]'),
  129. rowIndex: 'd13'
  130. }, {
  131. id: data.data.id,
  132. fileName: '年度主要产品(服务)发挥核心支持作用的技术属于《国家重点支持的高新技术领域》规定范围的说明',
  133. fileList: JSON.parse(data.data.d4 || '[]'),
  134. rowIndex: 'd4'
  135. }, {
  136. id: data.data.id,
  137. fileName: '高新技术产品(服务)及对应收入资料',
  138. fileList: JSON.parse(data.data.d5 || '[]'),
  139. rowIndex: 'd5'
  140. }, {
  141. id: data.data.id,
  142. fileName: '年度职工和科技人员情况说明',
  143. fileList: JSON.parse(data.data.d6 || '[]'),
  144. rowIndex: 'd6'
  145. }, {
  146. id: data.data.id,
  147. fileName: '当年和前两个会计年度研发费用总额及占同期销售收入比例的说明',
  148. fileList: JSON.parse(data.data.d7 || '[]'),
  149. rowIndex: 'd7'
  150. }, {
  151. id: data.data.id,
  152. fileName: '研发管理制度',
  153. fileList: JSON.parse(data.data.d8 || '[]'),
  154. rowIndex: 'd8'
  155. }, {
  156. id: data.data.id,
  157. fileName: '研发费用结构明细表',
  158. fileList: JSON.parse(data.data.d9 || '[]'),
  159. rowIndex: 'd9'
  160. }, {
  161. id: data.data.id,
  162. fileName: '加计扣除情况说明',
  163. fileList: JSON.parse(data.data.d10 || '[]'),
  164. rowIndex: 'd10'
  165. }, {
  166. id: data.data.id,
  167. fileName: '其他高新备查资料',
  168. fileList: JSON.parse(data.data.d11 || '[]'),
  169. rowIndex: 'd11'
  170. }, {
  171. id: data.data.id,
  172. fileName: '其他加计扣除备查资料',
  173. fileList: JSON.parse(data.data.d12 || '[]'),
  174. rowIndex: 'd12'
  175. }];
  176. this.data = list;
  177. }
  178. this.loading = false;
  179. })
  180. },
  181. handleBeforeOpen(done, form) {
  182. this.currIndex = this.form.$index + 1;
  183. done();
  184. },
  185. handleDownFile(file) {
  186. downloadFileByUrl(file.value, file.label);
  187. },
  188. handleDownAll() {
  189. let downParams = { year: this.params.yearAndMonth };
  190. const loading = this.$loading({
  191. lock: true,
  192. text: '文件正在下载中,请耐心等待...',
  193. spinner: 'el-icon-loading',
  194. background: 'rgba(0, 0, 0, 0.7)'
  195. });
  196. exportBlob(`/api/kd-scientific/archive/fjbczl/download?${this.website.tokenHeader}=${getToken()}`, downParams, (progress) => {
  197. // console.log(progress)
  198. }).then(res => {
  199. loading.close();
  200. downloadXls(res.data, `${this.pageTitle}.zip`);
  201. }).catch(() => {
  202. loading.close();
  203. });
  204. },
  205. handleRowDown(row) {
  206. this.$message.warning("功能建设中...");
  207. // console.log(row)
  208. // if (row.fileList.length) {
  209. // const promiseArr = row.fileList.map(item => {
  210. // return exportBlob('')
  211. // });
  212. // Promise.all(promiseArr).then((res) => {
  213. // // zip
  214. // console.log(res)
  215. // })
  216. // }
  217. },
  218. getFormData() {
  219. return { id: this.form.id, yearAndMonth: this.params.yearAndMonth, [`${this.form.rowIndex}`]: JSON.stringify(this.form.fileList) }
  220. },
  221. handleDownTemp(templateKey) {
  222. getDictValueByKey('fjbczl-template', templateKey).then(({ data }) => {
  223. if (data.code == 200) {
  224. if (typeof data.data === 'object') {
  225. this.$message.error('暂未配置模板');
  226. return;
  227. }
  228. let tempObj = {
  229. 'template1': '当年和前两个会计年度研发费用总额及占同期销售收入比例的说明.doc',
  230. 'template2': '年度职工和科技人员情况说明.doc',
  231. 'template3': '年度主要产品(服务)发挥核心支持作用的技术属于《国家重点支持的高新技术领域》规定范围的说明.doc',
  232. 'template4': '研发费用结构明细表.xls'
  233. };
  234. downloadFileByUrl(data.data, tempObj[templateKey]);
  235. }
  236. })
  237. },
  238. },
  239. }, {
  240. // 模块路径
  241. name: 'achiveManage/fileSupplement',
  242. });
  243. </script>
  244. <style lang="scss" scoped>
  245. .file-temp-list {
  246. margin-top: 20px;
  247. .row {
  248. line-height: 24px;
  249. }
  250. }
  251. </style>