list.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036
  1. <!-- 设备管理 -->
  2. <template>
  3. <TableView class="product"
  4. @body-height-change="bodyHeightChange">
  5. <template slot="header">
  6. <BaseHeaderLayout>
  7. <template slot="left">
  8. <!-- 上传按钮 -->
  9. <span v-if="permissionIf('cloudDisk.dataManager.manage')">
  10. <ws-button v-if="!treeNode.name"
  11. class="buttonClass"
  12. type="primary"
  13. @click="uploadError">{{ $t('system.fileManagement.button.upload') }}</ws-button>
  14. <ws-upload v-else
  15. oss-key="dataManagement"
  16. table-name="common_appendix"
  17. :comp-id="compId"
  18. :remark-word="word"
  19. :appendix-ids="appendixIds"
  20. @onChange="uploadSuccess"
  21. @uploadSuccess="uploadSuccessInfo"
  22. ref="upload"
  23. style="display: inline-flex;padding:0; marginRight:10px">
  24. </ws-upload>
  25. </span>
  26. <!-- 批量下载按钮 -->
  27. <ws-button class="buttonClass"
  28. :disabled="disabled"
  29. v-if="permissionIf('cloudDisk.dataManager.download')"
  30. @click="batchDown('')">{{ $t('button.download') }}</ws-button>
  31. <!-- 删除按钮 -->
  32. <ws-button class="buttonClass"
  33. :disabled="disabled"
  34. style="margin-left: 0 !important;"
  35. v-if="permissionIf('cloudDisk.dataManager.manage')"
  36. @click="batchDelete">{{ $t('button.delete') }}</ws-button>
  37. </template>
  38. <template slot="right">
  39. <ws-dropdown trigger="click"
  40. class="dropdown"
  41. style="margin-right:10px;"
  42. @command="filterFileTypeList">
  43. <span class="el-dropdown-link">
  44. {{ filterFileType||getLanguage }}
  45. <i class="iconfont iconxiajiantou"
  46. style="font-size:12px"></i>
  47. </span>
  48. <ws-dropdown-menu slot="dropdown"
  49. style="max-width:200px;overflow-x: auto">
  50. <ws-dropdown-item v-for="(item,index) in fileTypeList"
  51. :key="index"
  52. :command="item"
  53. style="word-break: break-all;white-space: nowrap;">
  54. {{ $t(item) }}
  55. </ws-dropdown-item>
  56. </ws-dropdown-menu>
  57. </ws-dropdown>
  58. <!-- 过滤 -->
  59. <!-- <ws-button type="text"
  60. @click="dialogFormVisible = true">
  61. <i class="iconfont iconfilter" />
  62. <span>{{ $t('zs.common.sizer') }}</span>
  63. </ws-button>
  64. <span class="filter-total">{{ $t('zs.common.thereAre')
  65. }}{{ tableData.total ? tableData.total : 0
  66. }}{{ $t('cg.queryresults') }}</span> -->
  67. <BaseHeaderFilter :total="tableData.total"
  68. @click="dialogFormVisible = true" />
  69. <BaseInputSearch v-model="page.fileName"
  70. :placeholder="$t('dataManage.screeningTips')"
  71. @search="handleFilter('title')" />
  72. </template>
  73. </BaseHeaderLayout>
  74. </template>
  75. <template slot="body">
  76. <div class="data-manage">
  77. <ws-row style="height:calc(100% - 40px)">
  78. <ws-col :span="5">
  79. <div class="ShipEquipmentTreeBody">
  80. <div class="ShipEquipmentTreeTitle">
  81. <span>{{ $t('dataManage.dataFolder') }}</span>
  82. <yh-operaction class="fr"
  83. :lable="treeTitleLable"
  84. @skip="skipTreeTitle" />
  85. </div>
  86. <div style="width: 100%;height: calc(100vh - 161px);overflow: auto">
  87. <div class="treeClass">
  88. <ws-tree class="filter-tree"
  89. v-if="TreeData && TreeData.length > 0"
  90. :data="TreeData"
  91. :props="defaultProps"
  92. :highlight-current="true"
  93. node-key="id"
  94. :default-expanded-keys="defaultExpandedKeys"
  95. @node-click="clickNode">
  96. <div class="custom-tree-node"
  97. slot-scope="{ node, data }">
  98. <span>
  99. <el-tooltip class="item"
  100. effect="dark"
  101. :content="node.label"
  102. :disabled="node.label.length<10"
  103. placement="top">
  104. <span v-if="!data.addFlag && !data.editFlag"
  105. class="tree-label">{{ node.label }}</span>
  106. </el-tooltip>
  107. <ws-input v-if="data.addFlag"
  108. v-model="data.name"
  109. size="small"
  110. maxlength="100"
  111. @keyup.enter.native="$event.target.blur"
  112. @blur="saveFloder(data)" />
  113. <ws-input v-if="data.editFlag"
  114. v-model="data.name"
  115. size="small"
  116. maxlength="100"
  117. :clearable="false"
  118. @keyup.enter.native="$event.target.blur"
  119. @blur="renameFloder(data)" />
  120. </span>
  121. <div @click.stop="clickOperation">
  122. <operaction-new v-if="!data.addFlag && !data.editFlag"
  123. class="fr"
  124. :lable="treeLable"
  125. :data="data"
  126. :node="node"
  127. @skip="skipTree" />
  128. </div>
  129. <!-- <i class="iconfont iconsavey"
  130. v-if="data.addFlag"
  131. @click="saveFloder(data)"
  132. style="margin: 0 5px;font-size: 14px;margin-top: 4px;" />
  133. <i class="iconfont iconsavey"
  134. v-if="data.editFlag"
  135. @click="renameFloder(data)"
  136. style="margin: 0 5px;font-size: 14px;margin-top: 4px;" /> -->
  137. <!-- <span v-if="data.addFlag"
  138. @click="cancelFloder(node, data)"><i class="el-icon-close"
  139. style="font-size: 15px;margin-top: 5px;"></i></span>
  140. <span v-if="data.editFlag"
  141. @click="cancelFloder(node, data)"><i class="el-icon-close"
  142. style="font-size: 15px;margin-top: 5px;"></i></span> -->
  143. </div>
  144. </ws-tree>
  145. </div>
  146. </div>
  147. </div>
  148. </ws-col>
  149. <ws-col :span="19">
  150. <div class="main-list"
  151. style="padding-right: 0px">
  152. <ws-normal-table :data="tableData.records"
  153. @cell-click="showDialog"
  154. @selection-change="handleSelectionChange"
  155. @sort-change="sortChange"
  156. highlight-current-row
  157. style="width: 100%;"
  158. :height="tableViewBodyHeight - 67">
  159. <ws-table-column type="selection"
  160. width="30"></ws-table-column>
  161. <ws-table-column type="index"
  162. width="50"
  163. align="center"
  164. :label="$t('common.num')">
  165. <template slot-scope="scope">{{ scope.$index + 1 }}</template>
  166. </ws-table-column>
  167. <ws-table-column width="80"
  168. :label="$t('dataManage.table.thumbnail')">
  169. <template slot-scope="scope">
  170. <winsea-picture-view v-if="isImage(scope.row.fileInfoType ? scope.row.fileInfoType.replace('文件', '').replace('.', ''): '')"
  171. class="mypicture"
  172. :pic-small-list="$store.getters.baseInfo.fileUrl + scope.row.filePath"
  173. :pic-list="$store.getters.baseInfo.fileUrl + scope.row.filePath"
  174. :hover-view="true"
  175. :width="40"
  176. :height="40" />
  177. <i v-else
  178. class="iconfont"
  179. :class="getIconClass(scope.row.fileInfoType ? scope.row.fileInfoType.replace('文件', '').replace('.', ''): '')"></i>
  180. </template>
  181. </ws-table-column>
  182. <ws-table-column prop="fileName"
  183. sortable="custom"
  184. min-width="200"
  185. show-overflow-tooltip
  186. :label="$t('dataManage.table.fileName')">
  187. <template slot-scope="scope">
  188. <span v-if="!scope.row.renameFlag"
  189. @click="preview(scope.row)">{{
  190. scope.row.fileName +
  191. (scope.row.fileInfoType
  192. ? scope.row.fileInfoType.replace('文件', '')
  193. : '')
  194. }}</span>
  195. <span v-else
  196. style="display: flex">
  197. <ws-input v-model="scope.row.fileNameClone" />
  198. <i class="iconfont iconsavey"
  199. @click="saveName(scope.row)"
  200. style="margin: 0 5px;font-size: 14px;margin-top: 4px;" />
  201. <span @click="scope.row.renameFlag = false"><i class="el-icon-close"
  202. style="font-size: 15px;margin-top: 7px;"></i></span>
  203. </span>
  204. </template>
  205. </ws-table-column>
  206. <ws-table-column prop="createDate"
  207. sortable="custom"
  208. width="180"
  209. :label="$t('dataManage.uploadTime')">
  210. <template slot-scope="scope">{{
  211. scope.row.createDate
  212. }}</template>
  213. </ws-table-column>
  214. <ws-table-column prop="fileInfoType"
  215. width="120"
  216. :label="$t('dataManage.table.type')">
  217. <template slot-scope="scope">{{
  218. scope.row.fileInfoType
  219. ? scope.row.fileInfoType
  220. .replace('文件', '')
  221. .replace('.', '')
  222. : ''
  223. }}</template>
  224. </ws-table-column>
  225. <ws-table-column prop="fileSize"
  226. sortable="custom"
  227. width="100"
  228. align="right"
  229. :label="$t('dataManage.table.size')">
  230. <template slot-scope="scope">{{
  231. scope.row.fileSize
  232. }}</template>
  233. </ws-table-column>
  234. <ws-table-column prop="statusFlag"
  235. :label="$t('common.operate')"
  236. align="center"
  237. width="80">
  238. <template slot-scope="scope">
  239. <operaction-new :lable="lable"
  240. :status-flag="scope.row.statusFlag"
  241. :data="scope"
  242. @skip="skipPage" />
  243. </template>
  244. </ws-table-column>
  245. </ws-normal-table>
  246. <pagination v-if="tableData.total > 0"
  247. :total="tableData.total"
  248. :page.sync="page.currentPage"
  249. :limit.sync="page.pageSize"
  250. @pagination="getList" />
  251. </div>
  252. </ws-col>
  253. </ws-row>
  254. <!-- 过滤dialog -->
  255. <div class="nav-search">
  256. <div class="searchTwo">
  257. <ws-dialog :title="$t('button.filtration')"
  258. :visible.sync="dialogFormVisible"
  259. width="341px"
  260. :modal="false"
  261. style="top: -40px;"
  262. class="dialog"
  263. :close-on-click-modal="false">
  264. <ws-form ref="spclearsplistqueryForm"
  265. :model="page"
  266. label-width="80px"
  267. label-position="left">
  268. <!-- 上传时间 -->
  269. <div class="selectTitle">
  270. <span>{{ $t('dataManage.uploadTime') }}</span>
  271. </div>
  272. <!-- <ws-form-item :label=""> -->
  273. <ws-date-picker v-model="uploadDate"
  274. :placeholder="$t('common.selected')"
  275. type="daterange"
  276. :range-separator="$t('common.to')"
  277. :start-placeholder="$t('common.startDate')"
  278. :end-placeholder="$t('common.endDate')"
  279. value-format="yyyy-MM-dd"></ws-date-picker>
  280. <!-- </ws-form-item> -->
  281. </ws-form>
  282. <div slot="footer"
  283. class="dialog-footer">
  284. <ws-button @click="clearfiltQuery">{{
  285. $t('button.reset')
  286. }}</ws-button>
  287. <ws-button type="primary"
  288. @click="handleFilter">{{
  289. $t('button.filtration')
  290. }}</ws-button>
  291. </div>
  292. </ws-dialog>
  293. </div>
  294. </div>
  295. <!-- 移动文件 -->
  296. <WinseaContentModal v-model='dialogSortVisible'
  297. :title="$t('dataManage.moveFile')">
  298. <ws-tree class="filter-tree"
  299. v-if="TreeData && TreeData.length > 0"
  300. :data="TreeData"
  301. :props="defaultProps"
  302. :highlight-current="true"
  303. @node-click="clickFileNode" />
  304. <template slot="footer"
  305. class="dialog-footer">
  306. <ws-button @click="dialogSortVisible = false">{{
  307. $t('button.cancel')
  308. }}</ws-button>
  309. <ws-button type="primary"
  310. @click="moveFloder">{{
  311. $t('button.confirm')
  312. }}</ws-button>
  313. </template>
  314. </WinseaContentModal>
  315. <!-- </ws-dialog> -->
  316. </div>
  317. </template>
  318. <!-- pdf在线预览 -->
  319. <BaseDialog width="70%"
  320. :title="pdfFileName"
  321. :visible.sync="isShowPdf"
  322. :appendToBody="true">
  323. <pdf :loadUrl="pdfUrl"
  324. v-if="isShowPdf"></pdf>
  325. </BaseDialog>
  326. </TableView>
  327. </template>
  328. <script>
  329. import { zipDown } from '../../utils/batchDown'
  330. import Pagination from '@/components/Pagination'
  331. import WsUpload from '@/components/WsUpload/index'
  332. import yhOperaction from '@/components/WinseaCom/operaction.vue'
  333. import operactionNew from '@/components/WinseaCom/operaction-new.vue'
  334. import { getHp } from '@/utils/getHasPermission'
  335. import { map, cloneDeep } from 'lodash'
  336. import TableView from '@/layout/TableView'
  337. import TableViewMix from '@/layout/mixin/TableViewMix'
  338. import {
  339. findTreeList,
  340. findFileUnderFolder,
  341. removeAll,
  342. addInfo,
  343. findFileType,
  344. fileRename,
  345. changeInfo,
  346. addFile,
  347. moveFile,
  348. removeInfo
  349. } from '@/model/dataManageMent'
  350. import pdf from '@/components/pdf/pdf'
  351. import { getFileList } from '@/model/upload'
  352. import { EventBus } from 'base-core-lib'
  353. export default {
  354. mixins: [TableViewMix],
  355. components: {
  356. Pagination,
  357. WsUpload,
  358. yhOperaction,
  359. operactionNew,
  360. TableView,
  361. pdf
  362. },
  363. data () {
  364. return {
  365. pdfFileName: '',//pdf
  366. isShowPdf: false,
  367. pdfUrl: '',
  368. filterFileType: '',
  369. defaultExpandedKeys: [],
  370. dialogSortVisible: false,
  371. treeNodeId: '',
  372. treeNode: {},
  373. // listLoading: false,
  374. compId: localStorage.getItem('ws-pf_compId'),
  375. word: false,
  376. // 附件
  377. appendixIds: '',
  378. historyAppendixIds: '',
  379. disabled: true,
  380. defaultProps: {
  381. children: 'children',
  382. label: 'name'
  383. },
  384. tableData: {
  385. total: 0
  386. },
  387. fileTypeList: [],
  388. moveFolderObj: {},
  389. page: {
  390. folderId: '',
  391. fileName: '',
  392. fileInfoType: '',
  393. updateTimeStart: '',
  394. updateTimeEnd: '',
  395. orderColunm: '',
  396. order: '',
  397. currentPage: 1,
  398. pageSize: 10
  399. },
  400. uploadDate: [],
  401. selectedIds: '',
  402. selectedAppendixIds: '',
  403. // vesselList: [],
  404. activeName: '1',
  405. // 过滤显示设置Dialog
  406. dialogFormVisible: false,
  407. // 左侧树
  408. TreeData: [],
  409. parentId: '',
  410. uploadUrl: '', //config.getUploadPath('systemOperation', localStorage.getItem('ws-pf_compId'))
  411. filePath: ''
  412. }
  413. },
  414. created () {
  415. // this.vesselList = JSON.parse(localStorage.getItem('ws-pf_vessels'))
  416. this.getSystemFolderList()
  417. this.getFileTypeList()
  418. },
  419. computed: {
  420. getLanguage () {
  421. return this.$t('gg.allTypeName')
  422. },
  423. lable () {
  424. return [
  425. {
  426. lab: this.$t('button.download'),
  427. click: 'download',
  428. hp: getHp('cloudDisk.dataManager.download')
  429. },
  430. {
  431. lab: this.$t('button.delete'),
  432. click: 'delete',
  433. hp: getHp('cloudDisk.dataManager.manage')
  434. },
  435. {
  436. lab: this.$t('button.move'),
  437. click: 'move',
  438. hp: getHp('cloudDisk.dataManager.manage')
  439. },
  440. {
  441. lab: this.$t('button.rename'),
  442. click: 'rename',
  443. hp: getHp('cloudDisk.dataManager.manage')
  444. }
  445. ]
  446. },
  447. treeLable () {
  448. return [
  449. {
  450. lab: this.$t('button.newFolder'),
  451. click: 'newFolder',
  452. hp: getHp('cloudDisk.dataManager.manage')
  453. },
  454. {
  455. lab: this.$t('button.rename'),
  456. click: 'rename',
  457. hp: getHp('cloudDisk.dataManager.manage')
  458. },
  459. {
  460. lab: this.$t('button.delete'),
  461. click: 'delete',
  462. hp: getHp('cloudDisk.dataManager.manage')
  463. }
  464. ]
  465. },
  466. treeTitleLable () {
  467. return [
  468. {
  469. lab: this.$t('button.newFolder'),
  470. click: 'newFolder',
  471. hp: getHp('cloudDisk.dataManager.manage')
  472. }
  473. ]
  474. },
  475. },
  476. methods: {
  477. preview () { },
  478. showDialog (row) {
  479. if (row.fileInfoType === '.pdf文件') {
  480. getFileList({
  481. appendixIds: row.appendixId,
  482. }).toPromise().then(res => {
  483. let path = res[0] ? res[0].appendixPath : ''
  484. let filePath = this.$store.getters.baseInfo.fileUrl + '/' + path
  485. this.pdfUrl = filePath
  486. this.pdfFileName = row.fileName
  487. this.isShowPdf = true
  488. })
  489. }
  490. },
  491. // 文件类型数据
  492. async getFileTypeList () {
  493. await findFileType({ compId: localStorage.getItem('ws-pf_compId') }).toPromise().then(
  494. res => {
  495. this.fileTypeList = res
  496. .filter(item => (item != ''))
  497. this.fileTypeList.unshift('gg.allTypeName')
  498. }
  499. )
  500. this.getList()
  501. },
  502. //文件类型筛选
  503. filterFileTypeList (selFileType) {
  504. if (selFileType === 'gg.allTypeName') {
  505. this.filterFileType = ''
  506. this.page.fileInfoType = ''
  507. } else {
  508. this.filterFileType = this.$t(selFileType)
  509. this.page.fileInfoType = selFileType
  510. }
  511. this.getList()
  512. },
  513. isImage (type) {
  514. const imageType = ['png', 'jpg', 'jpeg', 'gif', 'PNG', 'JPG', 'JPEG', 'GIF']
  515. return imageType.includes(type)
  516. },
  517. getIconClass (type) {
  518. const iconClass = {
  519. docx: 'iconword',
  520. doc: 'iconword',
  521. zip: 'iconrary',
  522. xlsx: 'iconexcely',
  523. xls: 'iconexcely',
  524. ppt: 'iconppty',
  525. pptx: 'iconppty',
  526. pdf: 'iconpdf3',
  527. txt: 'icontxt1',
  528. rar: 'iconyasuo'
  529. }
  530. // font-size: 35px;
  531. return iconClass[type] + ' otherClass otherClass__' + type || 'iconemly'
  532. },
  533. uploadError () {
  534. EventBus.$emit('error', this.$t('dataManage.message.message1'))
  535. },
  536. // 文件重命名
  537. async saveName (row) {
  538. const file = this.tableData.records.find(item => item.fileId === row.fileId)
  539. if (file.fileNameClone === file.fileName) {
  540. row.fileNameClone = row.fileNameClone.substr(0, 50)
  541. }
  542. if (row.fileNameClone && row.fileNameClone.length > 50) {
  543. EventBus.$emit('error', '文件名称不能超过50个字,请重新编辑')
  544. } else {
  545. // this.elLoading()
  546. // this.listLoading = true
  547. const data = {
  548. fileId: row.fileId,
  549. fileName: row.fileNameClone
  550. }
  551. await fileRename(data).toPromise().then(res => {
  552. EventBus.$emit('success', this.$t('message.message1'))
  553. row.renameFlag = false
  554. this.getList()
  555. // this.elLoading('end')
  556. })
  557. }
  558. },
  559. async saveFloder (data) {
  560. if (data.name.length > 0) {
  561. await addInfo({ name: data.name, parentFolderId: this.parentId }).toPromise().then(
  562. res => {
  563. this.$set(data, 'id', res)
  564. this.$set(data, 'addFlag', false)
  565. EventBus.$emit('success', this.$t('message.message1'))
  566. this.page.folderId = res
  567. // this.getList()
  568. this.getSystemFolderList(this.parentId) // 陈小龙提1020979号bug说保存后不能影响其他展开的节点
  569. }
  570. )
  571. } else {
  572. this.cancelFloder()
  573. // EventBus.$emit('error', this.$t('workNotification.startPlaceholder'))
  574. }
  575. },
  576. // 重命名
  577. async renameFloder (data) {
  578. if (data.name.length > 0 && data.name !== data.oldName) {
  579. await changeInfo({
  580. name: data.name,
  581. folderId: data.folderId,
  582. parentFolderId: data.parentFolderId
  583. }).toPromise().then(res => {
  584. EventBus.$emit('success', this.$t('message.message1'))
  585. data.editFlag = false
  586. this.getSystemFolderList(data.parentFolderId) // 陈小龙提1020979号bug说保存后不能影响其他展开的节点
  587. })
  588. } else {
  589. this.cancelFloder()
  590. }
  591. },
  592. cancelFloder (node, data) {
  593. this.getSystemFolderList()
  594. },
  595. // 新建文件夹
  596. skipTreeTitle () {
  597. this.TreeData.push({
  598. children: [],
  599. name: '',
  600. addFlag: true
  601. })
  602. this.parentId = ''
  603. },
  604. // 文件夹操作
  605. async skipTree (val) {
  606. const { msg, data, node } = val
  607. if (msg === 'newFolder') {
  608. data.children.push({
  609. children: [],
  610. name: '',
  611. addFlag: true
  612. })
  613. this.parentId = data.id
  614. this.defaultExpandedKeys = [data.id]
  615. } else if (msg === 'rename') {
  616. data.editFlag = true
  617. this.parentId = data.id
  618. } else if (msg === 'delete') {
  619. let message =
  620. data.children.length === 0
  621. ? this.$t('showMessage.delate')
  622. : this.$t('dataManage.message.message4')
  623. this.$confirm(message, this.$t('showMessage.hint'), {
  624. confirmButtonText: this.$t('button.confirm'),
  625. cancelButtonText: this.$t('button.cancel'),
  626. type: 'warning'
  627. })
  628. .then(() => {
  629. removeInfo({ folderId: data.id }).toPromise()
  630. .then(response => {
  631. const parent = node.parent
  632. const children = parent.data.children || parent.data
  633. const index = children.findIndex(d => d.id === data.id)
  634. children.splice(index, 1)
  635. EventBus.$emit('success', this.$t('showMessage.successfullyDelete'))
  636. })
  637. .catch(() => {
  638. EventBus.$emit('error', this.$t('showMessage.deleteFailed'))
  639. })
  640. })
  641. .catch(() => {
  642. EventBus.$emit('info', this.$t('showMessage.cancelledDelete'))
  643. })
  644. }
  645. },
  646. clickOperation () {
  647. // console.log('mmm')
  648. },
  649. async skipPage (val) {
  650. if (val.msg === 'delete') {
  651. this.$confirm(
  652. this.$t('dataManage.message.message3'),
  653. this.$t('showMessage.hint'),
  654. {
  655. confirmButtonText: this.$t('button.confirm'),
  656. cancelButtonText: this.$t('button.cancel'),
  657. type: 'warning'
  658. }
  659. )
  660. .then(() => {
  661. removeAll([{ fileId: val.data.row.fileId }]).toPromise()
  662. .then(response => {
  663. this.getList()
  664. EventBus.$emit('success', this.$t('showMessage.successfullyDelete'))
  665. })
  666. .catch(() => {
  667. EventBus.$emit('error', this.$t('showMessage.deleteFailed'))
  668. })
  669. })
  670. .catch(() => {
  671. EventBus.$emit('info', this.$t('showMessage.cancelledDelete'))
  672. })
  673. } else if (val.msg === 'move') {
  674. this.moveFolderObj.fileId = val.data.row.fileId
  675. this.dialogSortVisible = true
  676. } else if (val.msg === 'rename') {
  677. this.$set(this.tableData.records[val.data.$index], 'renameFlag', true)
  678. } else if (val.msg === 'download') {
  679. this.batchDown(val.data.row.appendixId)
  680. // getFileList({ appendixIds: val.data.row.appendixId}).then((res) => {
  681. // window.open(res.data[0].appendixPath)
  682. // })
  683. }
  684. },
  685. // 批量下载
  686. batchDown (val) {
  687. zipDown({
  688. appendixIds: val.length !== 0 ? val : this.selectedAppendixIds,
  689. baseUrl: this.$store.getters.baseInfo.fileUrl
  690. })
  691. },
  692. // 文件夹一览查询
  693. async getSystemFolderList (defaultId = '') {
  694. // this.elLoading()
  695. // this.listLoading = true
  696. await findTreeList({ compId: localStorage.getItem('ws-pf_compId') }).toPromise().then(
  697. response => {
  698. this.TreeData = response
  699. this.getTreeChildren(this.TreeData)
  700. this.treeNode = {}
  701. if (defaultId) {
  702. this.defaultExpandedKeys = [defaultId]
  703. }
  704. this.getList()
  705. }
  706. )
  707. },
  708. getTreeChildren (child) {
  709. for (var i in child) {
  710. this.$set(child[i], 'oldName', child[i].name)
  711. if (child[i].children) {
  712. this.getTreeChildren(child[i].children)
  713. }
  714. }
  715. },
  716. uploadSuccessInfo (item) {
  717. this.filePath = item.appendixPath
  718. },
  719. // 文件上传
  720. uploadSuccess () {
  721. this.$refs.upload
  722. .handleSaveBill()
  723. .then(async response => {
  724. await addFile({
  725. appendixIds: response.split(','),
  726. folderId: this.treeNodeId,
  727. compId: localStorage.getItem('ws-pf_compId'),
  728. filePath: this.filePath
  729. }).toPromise()
  730. .catch(res => {
  731. EventBus.$emit('error', (JSON.parse(res) || {}).message)
  732. this.$refs.upload.clearFiles()
  733. })
  734. this.getList()
  735. this.$refs.upload.clearFiles()
  736. })
  737. .catch(res => {
  738. EventBus.$emit('error', (JSON.parse(res) || {}).message)
  739. this.$refs.upload.clearFiles()
  740. })
  741. },
  742. // table多选
  743. handleSelectionChange (val) {
  744. this.disabled = !(val.length > 0)
  745. this.selectedIds = []
  746. for (let i of val) {
  747. this.selectedIds.push({
  748. fileId: i.fileId
  749. })
  750. }
  751. this.selectedAppendixIds = map(val, 'appendixId').join(',')
  752. },
  753. // sortChange 排序
  754. sortChange (val) {
  755. this.page.order = val.order
  756. this.page.orderColunm = val.prop
  757. this.getList()
  758. },
  759. async batchDelete () {
  760. this.$confirm(
  761. this.$t('dataManage.message.message2'),
  762. this.$t('showMessage.hint'),
  763. {
  764. confirmButtonText: this.$t('button.confirm'),
  765. cancelButtonText: this.$t('button.cancel'),
  766. type: 'warning'
  767. }
  768. )
  769. .then(() => {
  770. removeAll(this.selectedIds).toPromise().then(res => {
  771. EventBus.$emit('success', this.$t('showMessage.successfullyDelete'))
  772. this.page.currentPage = 1
  773. this.getList()
  774. EventBus.$emit('success', this.$t('showMessage.successfullyDelete'))
  775. .catch(() => {
  776. EventBus.$emit('error', this.$t('showMessage.deleteFailed'))
  777. })
  778. })
  779. })
  780. .catch(() => {
  781. EventBus.$emit('info', this.$t('showMessage.cancelledDelete'))
  782. })
  783. },
  784. // 点击树节点
  785. clickNode (obj, node) {
  786. if (obj.addFlag || obj.editFlag) {
  787. return
  788. }
  789. this.treeNodeId = obj.id
  790. this.treeNode = obj
  791. this.page.folderId = obj.id
  792. this.page.currentPage = 1
  793. this.getList()
  794. },
  795. // 移动
  796. clickFileNode (obj, node) {
  797. this.moveFolderObj.folderId = obj.folderId
  798. },
  799. // 移动文件-确定
  800. async moveFloder () {
  801. await moveFile(this.moveFolderObj).toPromise()
  802. .then(res => {
  803. this.getFileTypeList()
  804. this.getList()
  805. this.dialogSortVisible = false
  806. EventBus.$emit('success', this.$t('message.message1'))
  807. })
  808. .catch(res => {
  809. EventBus.$emit('error', res.message)
  810. })
  811. },
  812. // 模板文件列表
  813. async getList () {
  814. if (!this.listLoading) {
  815. // this.elLoading()
  816. // this.listLoading = true
  817. }
  818. await findFileUnderFolder(this.page).toPromise().then(res => {
  819. let tableObj = res
  820. for (const i in res.records) {
  821. tableObj.records[i].renameFlag = false
  822. tableObj.records[i].fileNameClone = cloneDeep(
  823. res.records[i].fileName
  824. )
  825. }
  826. console.log(tableObj, 33339)
  827. this.tableData = tableObj
  828. // this.listLoading = false
  829. // this.elLoading('end')
  830. })
  831. },
  832. resetSearch () {
  833. this.page.fileName = ''
  834. this.getList()
  835. },
  836. // 过滤
  837. handleFilter () {
  838. // 2020.05.25【资料管理】过滤条件,根据文档类型搜索,点击过滤按钮,弹出框不消失
  839. this.page.updateTimeStart = ''
  840. this.page.updateTimeEnd = ''
  841. if (this.uploadDate && this.uploadDate.length > 0) {
  842. this.page.updateTimeStart = this.uploadDate[0]
  843. this.page.updateTimeEnd = this.uploadDate[1]
  844. }
  845. this.getList()
  846. this.dialogFormVisible = false
  847. },
  848. // 过滤重置/过滤关闭X
  849. clearfiltQuery () {
  850. // this.page.fileInfoType = ''
  851. this.page.updateTimeStart = ''
  852. this.page.updateTimeEnd = ''
  853. this.page.updateTimeEnd = ''
  854. this.uploadDate = []
  855. this.dialogFormVisible = false
  856. this.getList()
  857. }
  858. }
  859. }
  860. </script>
  861. <style lang="scss" scoped>
  862. .otherClass {
  863. font-size: 34px;
  864. &__doc,
  865. &__docx {
  866. color: rgb(108, 203, 255);
  867. }
  868. &__zip {
  869. color: rgb(74, 141, 255);
  870. }
  871. // zip
  872. &__xlsx,
  873. &__xls {
  874. color: rgb(0, 192, 144);
  875. }
  876. &__ppt,
  877. &__pptx {
  878. color: rgb(255, 120, 97);
  879. }
  880. &__pdf {
  881. color: rgb(255, 72, 103);
  882. }
  883. &__txt {
  884. // color: rgb(108, 203, 255);
  885. font-size: 25px;
  886. }
  887. &__rar {
  888. color: rgb(226, 215, 66);
  889. }
  890. }
  891. .mypicture {
  892. ::v-deep ul {
  893. padding-inline-start: 0px;
  894. margin-block-start: 0px;
  895. margin-block-end: 0px;
  896. }
  897. }
  898. .content {
  899. float: right;
  900. line-height: 47px;
  901. width: 92%;
  902. }
  903. .data-manage {
  904. height: calc(100vh - 60px);
  905. .tree-label {
  906. margin-right: 10px;
  907. }
  908. .custom-tree-node {
  909. flex: 1;
  910. display: flex;
  911. align-items: center;
  912. justify-content: space-between;
  913. font-size: 14px;
  914. .el-input--small /deep/ .el-input__inner {
  915. height: 26px !important;
  916. line-height: 26px !important;
  917. }
  918. .tree-label {
  919. display: inline-block;
  920. white-space: nowrap;
  921. max-width: 160px;
  922. overflow: hidden;
  923. text-overflow: ellipsis;
  924. }
  925. }
  926. .el-tree-small .el-tree-node__label {
  927. font-size: 14px;
  928. }
  929. .topBtn {
  930. margin-bottom: 5px;
  931. text-align: left;
  932. }
  933. .selectBtn {
  934. float: left;
  935. text-align: left;
  936. }
  937. .selectInput {
  938. float: right;
  939. width: 225px;
  940. margin-left: 15px;
  941. }
  942. .searchIcon {
  943. font-size: 32px;
  944. position: absolute;
  945. top: 0;
  946. right: 0;
  947. }
  948. .filter-total {
  949. font-size: 14px;
  950. float: right;
  951. margin-top: 10px;
  952. margin-left: 10px;
  953. }
  954. /deep/ .myDialogDiv .el-dialog {
  955. position: fixed;
  956. top: 0px;
  957. right: 15%;
  958. overflow: auto;
  959. margin: 0;
  960. width: 25em !important;
  961. }
  962. /deep/ .el-dialog .el-dialog__footer {
  963. height: 50px;
  964. line-height: 50px;
  965. padding: 0 20px 0 0;
  966. }
  967. /deep/ .el-table-column--selection .cell {
  968. padding-left: 10px;
  969. padding-right: 10px;
  970. }
  971. .el-row {
  972. .el-col:last-child {
  973. .el-form-item {
  974. border-bottom: 0px;
  975. border-right: 0px;
  976. .el-form-item__label {
  977. border-bottom: 0;
  978. }
  979. }
  980. }
  981. }
  982. .ShipEquipmentTreeBody {
  983. background-color: white;
  984. border: 1px #cccccc solid;
  985. width: 100%;
  986. height: calc(100vh - 120px);
  987. overflow: auto;
  988. }
  989. .ShipEquipmentTreeTitle {
  990. padding: 10px;
  991. background-color: white;
  992. border-bottom: 1px #cccccc solid;
  993. font-weight: bold;
  994. font-size: 16px;
  995. }
  996. .treeClass {
  997. padding: 10px;
  998. /*overflow-y: scroll;*/
  999. /*overflow-x: scroll;*/
  1000. width: max-content;
  1001. min-width: 100%;
  1002. }
  1003. /deep/ .el-upload-list--picture-card {
  1004. display: none;
  1005. }
  1006. }
  1007. .dropdown {
  1008. line-height: 30px;
  1009. float: right;
  1010. }
  1011. /deep/ .searchTwo .yhElDialog {
  1012. right: 17vh;
  1013. position: absolute;
  1014. top: 19px !important;
  1015. margin: 0;
  1016. }
  1017. .buttonClass {
  1018. margin-right: 10px;
  1019. }
  1020. .product {
  1021. /deep/ .el-upload-list__item {
  1022. display: none;
  1023. }
  1024. }
  1025. </style>