index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <div>
  3. <tips-custom>
  4. <template #default>
  5. <div class="flex flex-center">
  6. <span class="mr-10 nowrap">项目阶段</span>
  7. <el-select
  8. v-model="folderInfo.stageId"
  9. remote
  10. filterable
  11. clearable
  12. placeholder="筛选项目阶段"
  13. style="width: 100%"
  14. @change="folderResult"
  15. >
  16. <el-option
  17. v-for="item in stage"
  18. :key="item.id"
  19. :label="item.name"
  20. :value="item.id"
  21. >
  22. </el-option>
  23. </el-select>
  24. </div>
  25. </template>
  26. </tips-custom>
  27. <!-- content-->
  28. <el-card shadow="hover" class="content">
  29. <div>
  30. <div class="full-width flex flex-center flex-justify-between">
  31. <div class="full-width flex flex-justify-start flex-center">
  32. <upload-file v-if="!top" @on-success="uploadSuccess" />
  33. <el-button
  34. class="ml-10"
  35. type="primary"
  36. icon="Folder"
  37. :plain="!top"
  38. @click="showDialog(1)"
  39. >新建文件夹
  40. </el-button>
  41. <el-button type="primary" plain icon="User">批量授权</el-button>
  42. <filepicker
  43. class="ml-10"
  44. :project-id="folderInfo.projectId"
  45. :stage-id="folderInfo.stageId"
  46. />
  47. </div>
  48. <div class="flex flex-center">
  49. <span class="nowrap mr-10">文件搜索</span>
  50. <el-input
  51. v-model="folderInfo.keyword"
  52. placeholder="输入文件关键字"
  53. style="width: 100%"
  54. />
  55. </div>
  56. </div>
  57. <el-breadcrumb separator-icon="ArrowRight" class="mt-20 main-color">
  58. <el-breadcrumb-item>
  59. <div class="pointer" @click="getFolderList">全部文件</div>
  60. </el-breadcrumb-item>
  61. </el-breadcrumb>
  62. <xtable
  63. :data="data"
  64. :option="top ? option : option2"
  65. :loading="loading"
  66. :total="page.total"
  67. @row-click="getFileList"
  68. @current-change="currentChange"
  69. >
  70. </xtable>
  71. </div>
  72. </el-card>
  73. <el-dialog v-model="show" :title="title" :width="width">
  74. <floder
  75. v-if="showType === 1"
  76. :info="folderInfo"
  77. @close="closeDialog"
  78. ></floder>
  79. </el-dialog>
  80. </div>
  81. </template>
  82. <route>
  83. {
  84. name: '资料管理',
  85. meta: { 'show': false }
  86. }
  87. </route>
  88. <script>
  89. import tipsCustom from '@/components/tips-custom/index.vue'
  90. import xtable from '@/views/resource/component/xtable.vue'
  91. import floder from '@/views/resource/component/floder.vue'
  92. import uploadFile from '@/components/upload-file/index.vue'
  93. import filepicker from '@/components/filepicker/index.vue'
  94. export default {
  95. components: {
  96. tipsCustom,
  97. xtable,
  98. floder,
  99. uploadFile,
  100. filepicker
  101. },
  102. data() {
  103. return {
  104. show: false,
  105. showType: 1,
  106. width: 380,
  107. title: '新建文件夹',
  108. top: true,
  109. loading: false,
  110. currentFolder: null,
  111. data: [],
  112. option: {
  113. column: [
  114. {
  115. label: '名称',
  116. prop: 'title',
  117. display: false,
  118. width: 270
  119. },
  120. {
  121. label: '所属阶段',
  122. prop: 'stageName'
  123. },
  124. {
  125. label: '创建时间',
  126. prop: 'createTime'
  127. },
  128. {
  129. label: '归档位置',
  130. prop: 'roleName'
  131. },
  132. {
  133. label: '创建人',
  134. prop: 'createUserName'
  135. }
  136. ]
  137. },
  138. option2: {
  139. column: [
  140. {
  141. label: '名称2',
  142. prop: 'title',
  143. display: false
  144. },
  145. {
  146. label: '创建人',
  147. prop: 'createUserName'
  148. }
  149. ]
  150. },
  151. stage: [],
  152. folderInfo: {
  153. projectId: '',
  154. stageId: ''
  155. },
  156. page: {
  157. current: 1,
  158. size: 10,
  159. total: 0
  160. },
  161. total: ''
  162. }
  163. },
  164. created() {
  165. this.folderInfo.projectId = this.$route.query.id
  166. this.getStage()
  167. },
  168. methods: {
  169. showDialog(type) {
  170. this.showType = type
  171. this.show = true
  172. },
  173. folderAdd() {
  174. this.$api.resource.folderAddUpdate().then(res => {
  175. if (res.code === 200) {
  176. console.log(res)
  177. }
  178. })
  179. },
  180. closeDialog() {
  181. this.show = false
  182. if (this.top) {
  183. this.getFolderList()
  184. } else {
  185. this.getFileList()
  186. }
  187. },
  188. getFolderList() {
  189. const data = {
  190. stageId: this.folderInfo.stageId,
  191. dictKey: 1,
  192. current: this.page.current,
  193. size: this.page.size
  194. }
  195. this.loading = true
  196. this.top = true
  197. this.$api.resource.folderList(data).then(res => {
  198. this.loading = false
  199. if (res.code === 200) {
  200. this.data = res.data.records
  201. this.page.total = res.data.total
  202. this.total = res.data.total
  203. }
  204. })
  205. },
  206. getFileList(row) {
  207. this.folderInfo = Object.assign(this.folderInfo, row)
  208. this.top = !this.top
  209. const data = {
  210. id: row.id,
  211. current: this.page.current,
  212. size: this.page.size
  213. }
  214. this.loading = true
  215. this.$api.resource.fileList(data).then(res => {
  216. this.loading = false
  217. if (res.code === 200) {
  218. this.data = res.data.records
  219. } else {
  220. this.$message.error(res.msg)
  221. }
  222. })
  223. },
  224. /**
  225. * 获取项目阶段
  226. */
  227. getStage() {
  228. this.$api.project
  229. .includeStage({ projectId: this.folderInfo.projectId })
  230. .then(res => {
  231. if (res.code === 200) {
  232. this.stage = res.data
  233. const tmp = this.stage.find(ele => ele.isLastSelect === 1)
  234. if (tmp) {
  235. this.folderInfo.stageId = tmp.id
  236. } else {
  237. this.folderInfo.stageId = this.stage[0].id
  238. }
  239. this.getFolderList()
  240. }
  241. })
  242. },
  243. folderResult(res) {
  244. this.loading = true
  245. this.stageId = res
  246. this.getFolderList()
  247. },
  248. uploadSuccess(files) {
  249. console.log('refresh')
  250. },
  251. refreshData() {
  252. if (this.top) {
  253. this.getFolderList()
  254. } else {
  255. this.getFileList()
  256. }
  257. },
  258. currentChange(current) {
  259. this.page.current = current
  260. this.refreshData()
  261. }
  262. }
  263. }
  264. </script>
  265. <style lang="scss" scoped>
  266. .content {
  267. height: calc(100vh - 180px);
  268. }
  269. </style>