file-table-listTemplate.vue 4.9 KB

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