torch-develop-annual-report_old1.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <basic-container>
  3. <avue-crud
  4. v-bind="bindVal"
  5. v-on="onEvent"
  6. v-model="form"
  7. >
  8. <template slot="body">
  9. <h3 class="page-title">{{ pageTitle }}</h3>
  10. </template>
  11. <template slot="yearTempUrl" slot-scope="{row}">
  12. <el-link type="primary" @click="handleDownTemp(row)">下载样表 </el-link>
  13. </template>
  14. <template slot="torchDevUrl" slot-scope="{row}">
  15. <el-link
  16. v-for="(item, index) of row.torchDevUrl"
  17. :key="index"
  18. type="primary"
  19. @click="handleDownFile(item)"
  20. :style="{marginRight: index === row.torchDevUrl.length - 1 ? 0 : '16px'}"
  21. >
  22. {{ item.label }}
  23. </el-link>
  24. </template>
  25. </avue-crud>
  26. </basic-container>
  27. </template>
  28. <script>
  29. import { downloadFileByUrl } from "@/util/util";
  30. import { mapGetters } from "vuex";
  31. export default window.$crudCommon({
  32. data() {
  33. return {
  34. };
  35. },
  36. computed: {
  37. ...mapGetters(['tag']),
  38. pageTitle() {
  39. return this.tag.label;
  40. }
  41. },
  42. mounted() {
  43. this.loadData();
  44. },
  45. methods: {
  46. getSearchParams() {
  47. return { yearMin: 2025, yearMax: 2035 }
  48. },
  49. loadData() {
  50. this.loading = true;
  51. this.api.getList(this.getSearchParams()).then(({ data }) => {
  52. if (data.code == 200) {
  53. let list = [];
  54. for (let i=2025; i<2036; i++) {
  55. let dataItem = data.data.find(item => item.yearAndMonth == i);
  56. list.push({ year: i, id: dataItem ? dataItem.id : undefined, torchDevUrl: dataItem ? JSON.parse(dataItem.torchDevUrl || '[]') : [] });
  57. }
  58. this.data = list;
  59. }
  60. this.loading = false;
  61. })
  62. },
  63. handleBeforeOpen(done) {
  64. this.currIndex = this.form.$index + 1;
  65. done();
  66. },
  67. handleDownFile(file) {
  68. downloadFileByUrl(file.value, file.label);
  69. },
  70. handleDownTemp(row) {
  71. this.$message.warning('功能建设中...');
  72. },
  73. getFormData() {
  74. return { id: this.form.id, yearAndMonth: this.form.year, torchDevUrl: JSON.stringify(this.form.torchDevUrl) }
  75. },
  76. },
  77. }, {
  78. // 模块路径
  79. name: 'externalReports/torchDevelopAnnualReport',
  80. });
  81. </script>