index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <!-- 搜索表单 -->
  5. <!-- <index-search :typeList="typeList" @search="reload" /> -->
  6. <!-- 数据表格 -->
  7. <ele-pro-table
  8. ref="table"
  9. height="calc(100vh - 325px)"
  10. :columns="columns"
  11. :datasource="datasource"
  12. :selection.sync="selection"
  13. row-key="id"
  14. :pageSize="this.$store.state.tablePageSize"
  15. >
  16. <!-- 表头工具栏 -->
  17. <template v-slot:toolbar>
  18. <el-button
  19. size="small"
  20. type="primary"
  21. icon="el-icon-plus"
  22. class="ele-btn-icon"
  23. @click="openEdit('', 'add')"
  24. v-if="$hasPermission('main:version:save')"
  25. >
  26. 新建
  27. </el-button>
  28. </template>
  29. <template v-slot:fileUrl="{ row }">
  30. <el-link
  31. size="mini"
  32. type="text"
  33. @click="downloadFile(row)"
  34. v-if="row.fileUrl"
  35. >
  36. 下载
  37. </el-link>
  38. </template>
  39. </ele-pro-table>
  40. </el-card>
  41. <!-- 新增/编辑/详情弹窗 -->
  42. <add-or-edit-dialog
  43. :addOrEditDialogFlag.sync="addOrEditDialogFlag"
  44. v-if="addOrEditDialogFlag"
  45. ref="addOrEditDialogRef"
  46. @reload="reload"
  47. />
  48. </div>
  49. </template>
  50. <script>
  51. import addOrEditDialog from './components/addOrEditDialog.vue';
  52. import { getFile } from '@/api/system/file';
  53. import { getTableList, addInformation } from '@/api/appUpdate';
  54. export default {
  55. name: 'technologyProduction',
  56. components: {
  57. addOrEditDialog
  58. },
  59. data() {
  60. return {
  61. // 表格列配置
  62. columns: [
  63. {
  64. label: '序号',
  65. type: 'index',
  66. width: 55,
  67. align: 'center'
  68. },
  69. {
  70. prop: 'versionCode',
  71. label: '版本号',
  72. showOverflowTooltip: true,
  73. align: 'center'
  74. },
  75. {
  76. prop: 'releaseNotes',
  77. label: '发布说明',
  78. showOverflowTooltip: true,
  79. align: 'center'
  80. },
  81. {
  82. slot: 'fileUrl',
  83. prop: 'fileUrl',
  84. label: '下载安装包',
  85. showOverflowTooltip: true,
  86. align: 'center'
  87. },
  88. {
  89. prop: 'createTime',
  90. label: '发布时间',
  91. showOverflowTooltip: true,
  92. align: 'center'
  93. },
  94. {
  95. columnKey: 'action',
  96. label: '操作',
  97. width: 150,
  98. align: 'center',
  99. resizable: false,
  100. slot: 'action',
  101. showOverflowTooltip: true
  102. }
  103. ],
  104. // 是否显示编辑弹窗
  105. addOrEditDialogFlag: false
  106. };
  107. },
  108. computed: {},
  109. methods: {
  110. /* 表格数据源 */
  111. async datasource({ page, limit, where, order }) {
  112. return await getTableList({
  113. ...where,
  114. ...order,
  115. pageNum: page,
  116. size: limit
  117. });
  118. },
  119. downloadFile(file) {
  120. getFile({ objectName: file.fileStorePath }, '智慧工厂');
  121. },
  122. /* 刷新表格 */
  123. reload(where) {
  124. this.$refs.table.reload({ page: 1, where: where });
  125. },
  126. /* 打开编辑弹窗 */
  127. openEdit(row = {}, type) {
  128. this.addOrEditDialogFlag = true;
  129. this.$nextTick(() => {
  130. this.$refs.addOrEditDialogRef.init(type, { ...row });
  131. });
  132. }
  133. }
  134. };
  135. </script>