file-table-listTemplate.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <div>
  3. <!-- 数据表格 -->
  4. <ele-pro-table
  5. ref="table"
  6. :columns="columns"
  7. :datasource="datasource"
  8. tool-class="ele-toolbar-form"
  9. :needPage="false"
  10. row-key="id"
  11. :selection.sync="selection"
  12. :toolbar="false"
  13. >
  14. <!-- 操作列 -->
  15. <template v-slot:action="{ row }">
  16. <el-link
  17. type="primary"
  18. :underline="false"
  19. icon="el-icon-edit"
  20. @click="browseOpen(row)"
  21. >
  22. 浏览
  23. </el-link>
  24. </template>
  25. </ele-pro-table>
  26. <browse ref="browseRef"></browse>
  27. </div>
  28. </template>
  29. <script>
  30. import { filePageAPI } from './api';
  31. import browse from './browse.vue';
  32. export default {
  33. components: { browse },
  34. props: {
  35. // 上级
  36. parentData: {
  37. type: Object,
  38. default: () => {}
  39. },
  40. disabledTableList: {
  41. //已选择列表
  42. default: () => []
  43. }
  44. },
  45. data() {
  46. return {
  47. selection: [],
  48. columns: [
  49. {
  50. width: 45,
  51. type: 'selection',
  52. columnKey: 'selection',
  53. align: 'center',
  54. selectable: (row, index) => {
  55. return !this.disabledTableList
  56. .map((item) => item.id)
  57. .includes(row.id);
  58. }
  59. },
  60. {
  61. label: '编码',
  62. prop: 'code',
  63. width: 180,
  64. align: 'center',
  65. fixed: 'left',
  66. showOverflowTooltip: true
  67. },
  68. {
  69. prop: 'name',
  70. label: '文档名称',
  71. align: 'center',
  72. slot: 'name',
  73. showOverflowTooltip: true,
  74. minWidth: 200
  75. },
  76. {
  77. prop: 'storagePath',
  78. label: '文件名称',
  79. align: 'center',
  80. showOverflowTooltip: true,
  81. minWidth: 200,
  82. formatter: (_row, _column, cellValue) => {
  83. return cellValue[0]?.name;
  84. }
  85. },
  86. {
  87. prop: 'version',
  88. label: '版本',
  89. align: 'center',
  90. showOverflowTooltip: true,
  91. minWidth: 100
  92. },
  93. {
  94. prop: 'checkOutUserName',
  95. label: '检出人',
  96. align: 'center',
  97. showOverflowTooltip: true,
  98. minWidth: 100
  99. },
  100. {
  101. prop: 'checkOutStatus',
  102. label: '检出状态',
  103. align: 'center',
  104. showOverflowTooltip: true,
  105. minWidth: 100,
  106. formatter: (_row, _column, cellValue) => {
  107. return cellValue == 1 ? '已检出' : '';
  108. }
  109. },
  110. {
  111. prop: 'checkOutTime',
  112. label: '检出时间',
  113. align: 'center',
  114. showOverflowTooltip: true,
  115. minWidth: 160
  116. },
  117. {
  118. prop: 'createUserName',
  119. label: '创建人',
  120. align: 'center',
  121. showOverflowTooltip: true,
  122. minWidth: 100
  123. },
  124. {
  125. prop: 'createTime',
  126. label: '创建时间',
  127. align: 'center',
  128. showOverflowTooltip: true,
  129. minWidth: 160,
  130. formatter: (_row, _column, cellValue) => {
  131. return this.$util.toDateString(cellValue);
  132. }
  133. },
  134. {
  135. prop: 'updateUserName',
  136. label: '修改人',
  137. align: 'center',
  138. showOverflowTooltip: true,
  139. minWidth: 100
  140. },
  141. {
  142. prop: 'updateTime',
  143. label: '修改时间',
  144. align: 'center',
  145. showOverflowTooltip: true,
  146. minWidth: 160
  147. },
  148. {
  149. prop: 'sizeUnit',
  150. label: '文档大小',
  151. align: 'center',
  152. showOverflowTooltip: true,
  153. minWidth: 100
  154. },
  155. {
  156. columnKey: 'action',
  157. label: '操作',
  158. width: 150,
  159. align: 'center',
  160. resizable: false,
  161. slot: 'action',
  162. showOverflowTooltip: true,
  163. fixed: 'right'
  164. }
  165. ]
  166. };
  167. },
  168. created() {},
  169. methods: {
  170. /* 表格数据源 */
  171. datasource({ page, limit, where, order }) {
  172. return filePageAPI({
  173. ...where,
  174. ...order,
  175. pageNum: page,
  176. size: limit,
  177. directoryId: this.parentData?.id
  178. });
  179. },
  180. /* 刷新表格 */
  181. reload(where) {
  182. this.$refs.table.reload({ pageNum: 1, where: where });
  183. },
  184. browseOpen(row) {
  185. this.$refs.browseRef.open(row);
  186. },
  187. getTableList() {
  188. return JSON.parse(JSON.stringify(this.selection));
  189. }
  190. }
  191. };
  192. </script>