file-supplement.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. export default window.$crudCommon({
  64. components: {
  65. YearMonthSelect,
  66. },
  67. data() {
  68. return {
  69. params: {
  70. year: "",
  71. },
  72. isSelAnnual: false,
  73. wideTableColumns: [],
  74. printTitle: "",
  75. currIndex: 0
  76. };
  77. },
  78. watch: {
  79. 'params.year'() {
  80. this.getList();
  81. },
  82. },
  83. computed: {
  84. ...mapGetters(['tag']),
  85. pageTitle() {
  86. let yearCN = this.params.year ? moment(this.params.year).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. this.api.getList(this.getSearchParams()).then(({ data }) => {
  107. if (data.code == 200) {
  108. let list = [{
  109. id: data.data.id,
  110. fileName: '高新项目技术鉴定资料',
  111. fileList: JSON.parse(data.data.d1 || '[]')
  112. }, {
  113. id: data.data.id,
  114. fileName: '加计扣除项目技术鉴定资料',
  115. fileList: JSON.parse(data.data.d2 || '[]')
  116. }, {
  117. id: data.data.id,
  118. fileName: '高新技术企业认定资料',
  119. fileList: JSON.parse(data.data.d3 || '[]')
  120. }, {
  121. id: data.data.id,
  122. fileName: '年度主要产品(服务)发挥核心支持作用的技术属于《国家重点支持的高新技术领域》规定范围的说明',
  123. fileList: JSON.parse(data.data.d4 || '[]')
  124. }, {
  125. id: data.data.id,
  126. fileName: '高新技术产品(服务)及对应收入资料',
  127. fileList: JSON.parse(data.data.d5 || '[]')
  128. }, {
  129. id: data.data.id,
  130. fileName: '年度职工和科技人员情况说明',
  131. fileList: JSON.parse(data.data.d6 || '[]')
  132. }, {
  133. id: data.data.id,
  134. fileName: '当年和前两个会计年度研发费用总额及占同期销售收入比例的说明',
  135. fileList: JSON.parse(data.data.d7 || '[]')
  136. }, {
  137. id: data.data.id,
  138. fileName: '研发管理制度',
  139. fileList: JSON.parse(data.data.d8 || '[]')
  140. }, {
  141. id: data.data.id,
  142. fileName: '研发费用结构明细表',
  143. fileList: JSON.parse(data.data.d9 || '[]')
  144. }, {
  145. id: data.data.id,
  146. fileName: '加计扣除情况说明',
  147. fileList: JSON.parse(data.data.d10 || '[]')
  148. }, {
  149. id: data.data.id,
  150. fileName: '其他高新备查资料',
  151. fileList: JSON.parse(data.data.d11 || '[]')
  152. }, {
  153. id: data.data.id,
  154. fileName: '其他加计扣除备查资料',
  155. fileList: JSON.parse(data.data.d12 || '[]')
  156. }];
  157. this.data = list;
  158. }
  159. this.loading = false;
  160. })
  161. },
  162. handleBeforeOpen(done) {
  163. this.currIndex = this.form.$index + 1;
  164. done();
  165. },
  166. // handleExport() {
  167. // exportBlob(`/api/kd-scientific/fjbczl/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
  168. // downloadXls(res.data, `${this.params.year}附件补充.xlsx`);
  169. // });
  170. // },
  171. handleDownFile(file) {
  172. downloadFileByUrl(file.value, file.label);
  173. },
  174. handleDownAll() {
  175. let downParams = { year: this.params.year };
  176. exportBlob(`/api/kd-scientific/archive/fjbczl/download?${this.website.tokenHeader}=${getToken()}`, downParams).then(res => {
  177. downloadXls(res.data, `${this.pageTitle}.zip`);
  178. });
  179. },
  180. handleRowDown() {
  181. this.$message.warning("功能建设中...");
  182. },
  183. getFormData() {
  184. return { id: this.form.id, yearAndMonth: this.params.year, [`d${this.currIndex}`]: JSON.stringify(this.form.fileList) }
  185. },
  186. handleDownTemp(templateKey) {
  187. getDictValueByKey('fjbczl-template', templateKey).then(({ data }) => {
  188. if (data.code == 200) {
  189. if (typeof data.data === 'object') {
  190. this.$message.error('暂未配置模板');
  191. return;
  192. }
  193. let tempObj = {
  194. 'template1': '当年和前两个会计年度研发费用总额及占同期销售收入比例的说明.doc',
  195. 'template2': '年度职工和科技人员情况说明.doc',
  196. 'template3': '年度主要产品(服务)发挥核心支持作用的技术属于《国家重点支持的高新技术领域》规定范围的说明.doc',
  197. 'template4': '研发费用结构明细表.xls'
  198. };
  199. downloadFileByUrl(data.data, tempObj[templateKey]);
  200. }
  201. })
  202. },
  203. },
  204. }, {
  205. // 模块路径
  206. name: 'achiveManage/fileSupplement',
  207. });
  208. </script>
  209. <style lang="scss" scoped>
  210. .file-temp-list {
  211. margin-top: 20px;
  212. .row {
  213. line-height: 24px;
  214. }
  215. }
  216. </style>