list.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <div class="full-height full-width flex flex-col">
  3. <div class="white-bg flex flex-align-center padding">
  4. <!-- <el-select-->
  5. <!-- v-model="keyWords"-->
  6. <!-- class="mt-10 ml-10"-->
  7. <!-- clearable-->
  8. <!-- placeholder="排列方式"-->
  9. <!-- />-->
  10. <div class="flex flex-align-center tip mt-10">
  11. <el-icon class="ml-20" color="#ECAB56">
  12. <WarningFilled />
  13. </el-icon>
  14. <span class="ml-5">共找到相关资料{{ page.total }}份</span>
  15. </div>
  16. </div>
  17. <div class="crud">
  18. <avue-crud
  19. ref="crud"
  20. v-model="form"
  21. v-model:page="page"
  22. :before-open="beforeOpen"
  23. :data="data"
  24. :option="option"
  25. :table-loading="loading"
  26. @row-del="rowDel"
  27. @current-change="currentChange"
  28. @size-change="sizeChange"
  29. @refresh-change="refreshChange"
  30. @on-load="onLoad"
  31. >
  32. </avue-crud>
  33. </div>
  34. <el-dialog v-model="showInfo" append-to-body width="45%">
  35. <dialog-info :id="id" />
  36. </el-dialog>
  37. </div>
  38. </template>
  39. <script>
  40. import dialogInfo from './dialog_info.vue'
  41. export default {
  42. name: 'list',
  43. components: { dialogInfo },
  44. data() {
  45. return {
  46. showInfo: false,
  47. keyWords: '',
  48. loading: false,
  49. data: [],
  50. form: {},
  51. option: {
  52. calcHeight: 30,
  53. refreshBtn: false,
  54. tip: false,
  55. columnBtn: false,
  56. searchShow: true,
  57. editBtn: false,
  58. addBtn: false,
  59. delBtn: false,
  60. border: true,
  61. index: true,
  62. align: 'center',
  63. viewBtn: true,
  64. dialogClickModal: false,
  65. column: [
  66. {
  67. label: '文件名称',
  68. prop: 'title',
  69. width: 340
  70. },
  71. {
  72. label: '所属项目',
  73. prop: 'projectName',
  74. width: 240
  75. },
  76. {
  77. label: '文件格式',
  78. prop: 'suffix'
  79. },
  80. {
  81. label: '上传人',
  82. prop: 'createUserName'
  83. },
  84. {
  85. label: '上传时间',
  86. prop: 'createTime',
  87. width: 200
  88. }
  89. ]
  90. },
  91. page: {
  92. current: 1,
  93. size: 10,
  94. total: 0
  95. },
  96. id: ''
  97. }
  98. },
  99. created() {
  100. this.$bus.on('serachFile', res => {
  101. this.onLoad(res)
  102. })
  103. },
  104. methods: {
  105. onLoad(query = {}) {
  106. this.page.current = this.page.currentPage
  107. this.page.size = this.page.pageSize
  108. const data = { ...query, ...this.page }
  109. this.loading = true
  110. this.$api.database.fileList(data).then(res => {
  111. this.loading = false
  112. if (res.code === 200) {
  113. this.data = res.data.records
  114. this.page.total = res.data.total
  115. }
  116. })
  117. },
  118. currentChange(currentPage) {
  119. this.page.current = currentPage
  120. },
  121. sizeChange(pageSize) {
  122. this.page.size = pageSize
  123. },
  124. refreshChange() {
  125. this.onLoad(this.page, this.query)
  126. },
  127. beforeOpen(done, type) {
  128. if (['view'].includes(type)) {
  129. this.showInfo = true
  130. console.log(this.showInfo)
  131. this.id = this.form.id
  132. } else if (type === 'edit') {
  133. this.$router.push({
  134. path: '/home/details',
  135. query: { id: this.form.id, type: '1' }
  136. })
  137. }
  138. },
  139. rowDel(row) {
  140. this.$confirm('确定删除选择的项目?', {
  141. confirmButtonText: '确定',
  142. cancelButtonText: '取消',
  143. type: 'warning'
  144. }).then(() => {
  145. this.$api.database.fileRemove({ ids: row.id }).then(res => {
  146. if (res.code === 200) {
  147. this.$message.success(res.msg)
  148. this.onLoad()
  149. } else {
  150. this.$message.error(res.msg)
  151. }
  152. })
  153. })
  154. },
  155. choise(index) {
  156. this.active = index
  157. }
  158. }
  159. }
  160. </script>
  161. <style lang="scss" scoped>
  162. .crud {
  163. :deep(.avue-crud__menu) {
  164. min-height: 5px;
  165. }
  166. }
  167. .tip {
  168. width: 260px;
  169. height: 32px;
  170. background-color: #fbf6ed;
  171. color: #ecab56;
  172. font-weight: 500;
  173. flex-wrap: nowrap;
  174. margin-left: 20px;
  175. }
  176. </style>