index.vue 4.0 KB

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