index.vue 3.4 KB

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