file-table-list.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926
  1. <template>
  2. <div>
  3. <!-- 数据表格 -->
  4. <ele-pro-table
  5. ref="table"
  6. :columns="columns"
  7. :datasource="datasource"
  8. height="calc(45vh)"
  9. tool-class="ele-toolbar-form"
  10. :initLoad="false"
  11. row-key="id"
  12. :current.sync="current"
  13. :selection.sync="selection"
  14. highlight-current-row
  15. @row-click="rowClick"
  16. @selection-change="selectionClick"
  17. @done="done"
  18. :page-size="20"
  19. :toolbar="!isPop"
  20. >
  21. <!-- 表头工具栏 -->
  22. <template v-slot:toolbar>
  23. <div style="display: flex; flex-wrap: wrap; align-items: center">
  24. <div>
  25. <el-dropdown trigger="click" v-if="lcyStatus == 1">
  26. <el-button type="primary">
  27. 新建<i class="el-icon-arrow-down el-icon--right"></i>
  28. </el-button>
  29. <el-dropdown-menu slot="dropdown">
  30. <el-dropdown-item
  31. @click.native="
  32. parenOpen('add', {
  33. power: 'add',
  34. dataKey: 'parentData',
  35. isArr: false
  36. })
  37. "
  38. >新建文件夹</el-dropdown-item
  39. >
  40. <el-dropdown-item
  41. @click.native="
  42. openEdit('add', '', {
  43. power: 'add',
  44. dataKey: 'parentData',
  45. isArr: false
  46. })
  47. "
  48. >新建文档</el-dropdown-item
  49. >
  50. </el-dropdown-menu>
  51. </el-dropdown>
  52. <el-dropdown trigger="click" v-if="lcyStatus == 1">
  53. <el-button type="primary">
  54. 编辑<i class="el-icon-arrow-down el-icon--right"></i>
  55. </el-button>
  56. <el-dropdown-menu slot="dropdown">
  57. <el-dropdown-item
  58. @click.native="
  59. parenOpen('edit', {
  60. power: 'revise',
  61. dataKey: 'parentData',
  62. isArr: false
  63. })
  64. "
  65. >修改</el-dropdown-item
  66. >
  67. <el-dropdown-item
  68. @click.native="
  69. parenOpen('del', {
  70. power: 'del',
  71. dataKey: 'parentData',
  72. isArr: false
  73. })
  74. "
  75. >删除</el-dropdown-item
  76. >
  77. </el-dropdown-menu>
  78. </el-dropdown>
  79. <el-button
  80. v-if="lcyStatus == 1"
  81. type="primary"
  82. @click.native="
  83. openEditAll({
  84. power: 'add',
  85. dataKey: 'parentData',
  86. isArr: false
  87. })
  88. "
  89. >
  90. 批量上传
  91. </el-button>
  92. <el-button
  93. type="primary"
  94. @click.native="
  95. checkEnter({
  96. power: 'checkEnter',
  97. dataKey: 'current',
  98. isArr: true
  99. })
  100. "
  101. :disabled="
  102. selection.length > 1 || selection[0]?.checkOutStatus == 0
  103. "
  104. v-if="lcyStatus == 1"
  105. >
  106. 检入
  107. </el-button>
  108. <el-button
  109. type="primary"
  110. @click.native="
  111. checkOut({
  112. power: 'checkOut',
  113. dataKey: 'current',
  114. isArr: true
  115. })
  116. "
  117. :disabled="
  118. selection.length > 1 || selection[0]?.checkOutStatus == 1
  119. "
  120. v-if="lcyStatus == 1"
  121. >
  122. 检出
  123. </el-button>
  124. <el-popconfirm
  125. class="ele-action"
  126. v-if="lcyStatus == 1 && fileType === 0"
  127. title="归档后文档无法修改,是否确认归档"
  128. @confirm="
  129. updateLcyStatus({
  130. power: 'archive',
  131. dataKey: 'current',
  132. isArr: true
  133. })
  134. "
  135. >
  136. <template v-slot:reference>
  137. <el-button type="primary"> 归档 </el-button>
  138. </template>
  139. </el-popconfirm>
  140. <el-button
  141. type="primary"
  142. v-if="lcyStatus == 2"
  143. @click="
  144. noUpdateLcyStatus({
  145. power: 'cancelArchive',
  146. dataKey: 'current',
  147. isArr: true
  148. })
  149. "
  150. >
  151. 取消归档
  152. </el-button>
  153. <el-button
  154. type="primary"
  155. v-if="
  156. (lcyStatus == 1 || lcyStatus == 2) &&
  157. (fileType == 0 || fileType == 1)
  158. "
  159. @click="
  160. openSendEdit({
  161. power: 'release',
  162. dataKey: 'current',
  163. isArr: true
  164. })
  165. "
  166. >
  167. 发布
  168. </el-button>
  169. <el-button
  170. v-if="fileType == 2"
  171. type="primary"
  172. @click="processSubmit_template"
  173. >
  174. 发布
  175. </el-button>
  176. <el-button
  177. v-if="fileType === 0 && lcyStatus != 4"
  178. type="primary"
  179. :disabled="selection.length > 1"
  180. @click="
  181. processSubmit({
  182. power: 'abolish',
  183. dataKey: 'current',
  184. isArr: true
  185. })
  186. "
  187. >
  188. 废止
  189. </el-button>
  190. <el-button
  191. type="primary"
  192. @click.native="
  193. getFile({
  194. power: 'download',
  195. dataKey: 'current',
  196. isArr: true
  197. })
  198. "
  199. >
  200. 下载
  201. </el-button>
  202. <el-button
  203. :disabled="selection.length > 1"
  204. type="primary"
  205. v-if="fileType == 1"
  206. @click.native="move"
  207. >
  208. 移动
  209. </el-button>
  210. </div>
  211. <div>
  212. <fileSearch
  213. @search="reload"
  214. style="margin-left: 20px; "
  215. ></fileSearch
  216. ></div>
  217. </div>
  218. <!-- </div> -->
  219. </template>
  220. <!-- 操作列 -->
  221. <template v-slot:action="{ row }">
  222. <el-dropdown
  223. trigger="click"
  224. v-if="
  225. lcyStatus == 1 &&
  226. (row.reviewStatus == 0 || row.reviewStatus == 3) &&
  227. row.status == 0
  228. "
  229. >
  230. <el-link type="primary" :underline="false" icon="el-icon-edit">
  231. 编辑
  232. </el-link>
  233. <el-dropdown-menu slot="dropdown">
  234. <el-dropdown-item
  235. @click.native="
  236. openEdit('edit', row, {
  237. power: 'revise',
  238. dataKey: 'current',
  239. isArr: false
  240. })
  241. "
  242. >修改</el-dropdown-item
  243. >
  244. <el-dropdown-item>
  245. <el-popconfirm
  246. class="ele-action"
  247. title="确定要删除此文档吗?"
  248. @confirm="
  249. remove(row, {
  250. power: 'del',
  251. dataKey: 'current',
  252. isArr: false
  253. })
  254. "
  255. >
  256. <template v-slot:reference>
  257. <el-link type="danger" :underline="false"> 删除 </el-link>
  258. </template>
  259. </el-popconfirm>
  260. </el-dropdown-item>
  261. </el-dropdown-menu>
  262. </el-dropdown>
  263. </template>
  264. </ele-pro-table>
  265. <el-tabs
  266. type="border-card"
  267. v-show="!current?.id && parentData?.id"
  268. style="height: calc(55vh - 260px)"
  269. >
  270. <el-tab-pane label="常规">
  271. <folderInfo :parentId="parentData?.id" :folderList="folderList" />
  272. </el-tab-pane>
  273. <el-tab-pane label="操作日志"></el-tab-pane>
  274. </el-tabs>
  275. <el-tabs
  276. v-model="activeName"
  277. type="border-card"
  278. v-show="current.id && isPower(current, 'check')"
  279. style="height: calc(55vh - 260px)"
  280. @tab-click="tabClick"
  281. >
  282. <el-tab-pane label="常规" name="常规">
  283. <Info :parentId="current.id" :folderList="folderList" />
  284. </el-tab-pane>
  285. <el-tab-pane
  286. label="浏览"
  287. name="浏览"
  288. :disabled="!isPower(current, 'browse')"
  289. >
  290. <browse ref="browseRef"></browse>
  291. </el-tab-pane>
  292. <el-tab-pane label="历史版本" name="VersionRef">
  293. <Version :parentId="current.id" ref="VersionRef" />
  294. </el-tab-pane>
  295. <el-tab-pane label="发布记录" name="IssueRef">
  296. <Issue :parentId="current.id" ref="IssueRef" />
  297. </el-tab-pane>
  298. <el-tab-pane label="回收记录" name="ReceiveRef"
  299. ><Receive :parentId="current.id" ref="ReceiveRef"></Receive
  300. ></el-tab-pane>
  301. <el-tab-pane label="变更记录" name="变更记录" v-if="fileType === 0"
  302. ><Change :parentId="current.id"
  303. /></el-tab-pane>
  304. <!-- <el-tab-pane label="打印记录" name="打印记录"
  305. ><print></print
  306. ></el-tab-pane> -->
  307. <el-tab-pane label="工作流" name="bpmRef"
  308. ><bpm :parentId="current.id" ref="bpmRef"></bpm
  309. ></el-tab-pane>
  310. <el-tab-pane
  311. label="权限"
  312. name="权限"
  313. v-if="isCreateUserId(current) && !isCheckOut(current) && fileType === 0"
  314. >
  315. <Power style="" @powerSave="powerSave" ref="PowerRef" />
  316. </el-tab-pane>
  317. <el-tab-pane label="操作日志" name="ActionRef"
  318. ><Action :parentId="current.id" ref="ActionRef"
  319. /></el-tab-pane>
  320. </el-tabs>
  321. <!-- 编辑弹窗 -->
  322. <file-edit
  323. ref="fileEditRef"
  324. :parentId="parentData?.id"
  325. @done="reload"
  326. :lcyStatus="lcyStatus"
  327. :fileType="fileType"
  328. />
  329. <move ref="moveRef" @done="reload" />
  330. <file-editAll
  331. ref="fileEditAllRef"
  332. :parentId="parentData?.id"
  333. @done="reload"
  334. :fileType="fileType"
  335. :lcyStatus="lcyStatus"
  336. />
  337. <sendEdit ref="sendEditRef" @done="reload" :isAdd="false"></sendEdit>
  338. <process-submit-dialog
  339. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  340. v-if="processSubmitDialogFlag"
  341. ref="processSubmitDialogRef"
  342. @reload="reload"
  343. ></process-submit-dialog>
  344. </div>
  345. </template>
  346. <script>
  347. import fileSearch from './file-search.vue';
  348. import fileEdit from './file-edit.vue';
  349. import fileEditAll from './file-editAll.vue';
  350. import move from './move.vue';
  351. import Info from './info.vue';
  352. import folderInfo from './folderInfo.vue';
  353. import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
  354. import Version from './version.vue';
  355. import Power from './power/index.vue';
  356. import Issue from './issue.vue';
  357. import Action from './action.vue';
  358. import Change from './change.vue';
  359. import Receive from './receive.vue';
  360. import print from './print.vue';
  361. import bpm from './bpm.vue';
  362. import browse from './browse.vue';
  363. import sendEdit from '@/views/doc/issue_doc/components/edit.vue';
  364. import { isPower, isCheckOut, fileStatus, isCreateUserId } from '../util.js';
  365. import { getFile } from '@/api/system/file/index.js';
  366. import {
  367. fileDeleteAPI,
  368. filePageAPI,
  369. checkEnter,
  370. checkOut,
  371. fileUpdateAPI,
  372. updateLcyStatus,
  373. noUpdateLcyStatus
  374. } from '@/api/doc-manage';
  375. export default {
  376. components: {
  377. fileSearch,
  378. fileEdit,
  379. Info,
  380. Version,
  381. Power,
  382. Issue,
  383. Action,
  384. Change,
  385. folderInfo,
  386. processSubmitDialog,
  387. Receive,
  388. print,
  389. fileEditAll,
  390. bpm,
  391. sendEdit,
  392. browse,
  393. move
  394. },
  395. props: {
  396. // 上级
  397. parentData: {
  398. type: Object,
  399. default: () => {}
  400. },
  401. // 文件夹数据
  402. folderList: {
  403. type: Array,
  404. default: () => []
  405. },
  406. lcyStatus: {
  407. default: 1
  408. },
  409. fileType: '', //0:公共文档 1:个人文档 2:文档模板
  410. isPop: '',
  411. disabledTableList: {
  412. //已选择列表
  413. default: () => []
  414. }
  415. },
  416. //add:新建 fileEdit:修改 filePigeonhole:归档 fileUnPigeonhole:取消归档 fileIssue:发布 fileChange:变更 fileDel:删除
  417. data() {
  418. return {
  419. isPower,
  420. isCheckOut,
  421. isCreateUserId,
  422. selection: [],
  423. processSubmitDialogFlag: false,
  424. current: {},
  425. fileUrl: '',
  426. activeName: '常规',
  427. // 表格列配置
  428. columns: [
  429. {
  430. width: 45,
  431. type: 'selection',
  432. columnKey: 'selection',
  433. align: 'center',
  434. selectable: (row, index) => {
  435. return (
  436. !this.disabledTableList
  437. .map((item) => item.id)
  438. .includes(row.id) &&
  439. row.reviewStatus != 1 &&
  440. row.status != 1
  441. );
  442. }
  443. },
  444. {
  445. label: '编码',
  446. prop: 'code',
  447. width: 180,
  448. align: 'center',
  449. fixed: 'left',
  450. showOverflowTooltip: true
  451. },
  452. {
  453. prop: 'name',
  454. label: '文档名称',
  455. align: 'center',
  456. slot: 'name',
  457. showOverflowTooltip: true,
  458. minWidth: 200
  459. },
  460. {
  461. prop: 'storagePath',
  462. label: '文件名称',
  463. align: 'center',
  464. showOverflowTooltip: true,
  465. minWidth: 200,
  466. formatter: (_row, _column, cellValue) => {
  467. return cellValue[0]?.name;
  468. }
  469. },
  470. {
  471. prop: 'version',
  472. label: '版本',
  473. align: 'center',
  474. showOverflowTooltip: true,
  475. minWidth: 100
  476. },
  477. {
  478. prop: 'checkOutUserName',
  479. label: '检出人',
  480. align: 'center',
  481. showOverflowTooltip: true,
  482. minWidth: 100
  483. },
  484. {
  485. prop: 'checkOutStatus',
  486. label: '检出状态',
  487. align: 'center',
  488. showOverflowTooltip: true,
  489. minWidth: 100,
  490. formatter: (_row, _column, cellValue) => {
  491. return cellValue == 1 ? '已检出' : '';
  492. }
  493. },
  494. {
  495. prop: 'checkOutTime',
  496. label: '检出时间',
  497. align: 'center',
  498. showOverflowTooltip: true,
  499. minWidth: 160
  500. },
  501. {
  502. prop: 'createUserName',
  503. label: '创建人',
  504. align: 'center',
  505. showOverflowTooltip: true,
  506. minWidth: 100
  507. },
  508. {
  509. prop: 'createTime',
  510. label: '创建时间',
  511. align: 'center',
  512. showOverflowTooltip: true,
  513. minWidth: 160
  514. },
  515. {
  516. prop: 'updateUserName',
  517. label: '修改人',
  518. align: 'center',
  519. showOverflowTooltip: true,
  520. minWidth: 100
  521. },
  522. {
  523. prop: 'updateTime',
  524. label: '修改时间',
  525. align: 'center',
  526. showOverflowTooltip: true,
  527. minWidth: 160
  528. },
  529. {
  530. prop: 'sizeUnit',
  531. label: '文档大小',
  532. align: 'center',
  533. showOverflowTooltip: true,
  534. minWidth: 100
  535. },
  536. {
  537. prop: 'status',
  538. label: '状态',
  539. align: 'center',
  540. showOverflowTooltip: true,
  541. minWidth: 100,
  542. formatter: (_row, _column, cellValue) => {
  543. return fileStatus(cellValue);
  544. }
  545. },
  546. {
  547. align: 'center',
  548. label: '审核状态',
  549. prop: 'reviewStatus',
  550. width: 100,
  551. formatter: (_row, _column, cellValue) => {
  552. return cellValue == 0
  553. ? '未提交'
  554. : cellValue == 1
  555. ? '审核中'
  556. : cellValue == 2
  557. ? '已审核'
  558. : '审核不通过';
  559. }
  560. },
  561. {
  562. columnKey: 'action',
  563. label: '操作',
  564. width: 200,
  565. align: 'center',
  566. resizable: false,
  567. slot: 'action',
  568. showOverflowTooltip: true,
  569. fixed: 'right'
  570. }
  571. ],
  572. // 是否显示编辑弹窗
  573. showEditFlag: false
  574. };
  575. },
  576. created() {},
  577. methods: {
  578. /* 表格数据源 */
  579. datasource({ page, limit, where, order }) {
  580. if (this.lcyStatus) {
  581. this.current = {};
  582. return filePageAPI({
  583. ...where,
  584. ...order,
  585. pageNum: page,
  586. size: limit,
  587. directoryId: this.parentData?.id,
  588. lcyStatus: this.lcyStatus,
  589. fileType: this.fileType,
  590. isQueryAll: this.$hasPermission('fm:doc:viewAll') ? 1 : ''
  591. });
  592. }
  593. },
  594. /* 刷新表格 */
  595. reload(where) {
  596. this.$refs.table &&
  597. this.$refs.table.reload({ pageNum: 1, where: where });
  598. },
  599. processSubmit(powerData) {
  600. if (this.selection.length == 0 || this.selection.length > 1) {
  601. this.$message.warning('请选择一条数据');
  602. return;
  603. }
  604. if (this.selection[0].checkOutUserName) {
  605. this.$message.warning(
  606. this.selection[0].name +
  607. '已被' +
  608. this.selection[0].checkOutUserName +
  609. '检出 无法废止'
  610. );
  611. return;
  612. }
  613. if (this.powerFn(powerData)) {
  614. return;
  615. }
  616. if (isCheckOut(this.selection[0])) {
  617. this.$message.warning(
  618. this.selection[0].name +
  619. '已被' +
  620. this.selection[0].checkOutUserName +
  621. '检出 无法发起流程'
  622. );
  623. return;
  624. }
  625. this.processSubmitDialogFlag = true;
  626. this.$nextTick(() => {
  627. this.selection[0]['businessKey'] = 'fm_file_repeal_approve';
  628. this.$refs.processSubmitDialogRef.init(this.selection[0]);
  629. });
  630. },
  631. //发布模板
  632. processSubmit_template() {
  633. if (this.selection.length == 0 || this.selection.length > 1) {
  634. this.$message.warning('请选择一条数据');
  635. return;
  636. }
  637. if (this.selection[0].checkOutUserName) {
  638. this.$message.warning(
  639. this.selection[0].name +
  640. '已被' +
  641. this.selection[0].checkOutUserName +
  642. '检出 无法发布'
  643. );
  644. return;
  645. }
  646. if (this.selection[0].status == 2) {
  647. this.$message.warning('模板已发布');
  648. return;
  649. }
  650. this.processSubmitDialogFlag = true;
  651. this.$nextTick(() => {
  652. this.selection[0]['businessKey'] = 'fm_file_template_approve';
  653. this.$refs.processSubmitDialogRef.init(this.selection[0]);
  654. });
  655. },
  656. selectionClick(data) {
  657. this.current = data.reverse()[0] || {};
  658. this.rowClick(this.current);
  659. this.$refs.table.setCurrentRow(this.current);
  660. },
  661. rowClick(row) {
  662. this.$nextTick(() => {
  663. this.$refs.browseRef && this.$refs.browseRef.setFileUrl(row);
  664. this.$refs.PowerRef &&
  665. this.$refs.PowerRef.setTableList(row.userAuthority);
  666. });
  667. },
  668. /* 显示编辑 */
  669. openEdit(type, row = '', powerData) {
  670. if (type != 'add') {
  671. if (!row.checkOutUserName) {
  672. this.$message.warning('请先检出在修改');
  673. return;
  674. }
  675. if (isCheckOut(this.current)) {
  676. this.$message.warning(
  677. this.current.name +
  678. '已被' +
  679. this.current.checkOutUserName +
  680. '检出 无法修改'
  681. );
  682. return;
  683. }
  684. }
  685. if (this.powerFn(powerData, row)) {
  686. return;
  687. }
  688. this.$refs.fileEditRef.open(type, row, this.folderList);
  689. },
  690. /* 显示编辑 */
  691. openEditAll(powerData) {
  692. if (this.powerFn(powerData)) {
  693. return;
  694. }
  695. this.$refs.fileEditAllRef.open(this.folderList);
  696. },
  697. tabClick(data) {
  698. if (this.$refs[data.name] && this.$refs[data.name].init) {
  699. this.$refs[data.name].init();
  700. }
  701. },
  702. parenOpen(type, powerData) {
  703. if (this.powerFn(powerData)) {
  704. return;
  705. }
  706. this.$emit('parenOpen', type);
  707. },
  708. // async success(current) {
  709. // await this.reload();
  710. // this.current = current;
  711. // this.$nextTick(() => {
  712. // this.$refs.PowerRef &&
  713. // this.$refs.PowerRef.setTableList(this.current.userAuthority);
  714. // });
  715. // },
  716. //权限判断
  717. powerFn({ power, dataKey, isArr }, row) {
  718. let arr = isArr ? this.selection : [];
  719. if (!isPower(row || this[dataKey], power, arr)) {
  720. this.$message.warning('抱歉,您没有操作权限!');
  721. return true;
  722. }
  723. },
  724. //权限保存
  725. powerSave(tableList) {
  726. fileUpdateAPI({
  727. id: this.current.id,
  728. userAuthority: tableList,
  729. authority: 1
  730. }).then((msg) => {
  731. this.reload();
  732. });
  733. },
  734. //检出
  735. checkOut(powerData) {
  736. if (this.selection.length == 0) {
  737. this.$message.warning('请选择一条数据');
  738. return;
  739. }
  740. if (this.powerFn(powerData)) {
  741. return;
  742. }
  743. checkOut({
  744. id: this.selection[0].id,
  745. checkOutStatus: 1
  746. }).then((msg) => {
  747. this.reload();
  748. });
  749. },
  750. //检入
  751. checkEnter(powerData) {
  752. if (this.selection.length == 0) {
  753. this.$message.warning('请选择一条数据');
  754. return;
  755. }
  756. if (this.powerFn(powerData)) {
  757. return;
  758. }
  759. checkEnter({
  760. id: this.selection[0].id,
  761. checkOutStatus: 0
  762. }).then((msg) => {
  763. this.reload();
  764. });
  765. },
  766. done() {
  767. this.$refs.table.reRenderTable();
  768. this.selection = [];
  769. },
  770. //下载
  771. getFile(powerData) {
  772. if (this.selection.length == 0) {
  773. this.$message.warning('请选择一条数据');
  774. return;
  775. }
  776. if (this.powerFn(powerData)) {
  777. return;
  778. }
  779. this.selection.forEach((item) => {
  780. getFile(
  781. { objectName: item.storagePath[0].storePath },
  782. item.storagePath[0].name
  783. );
  784. });
  785. },
  786. updateLcyStatus(powerData) {
  787. if (this.selection.length == 0 || this.selection.length.length > 1) {
  788. this.$message.warning('请选择一条数据');
  789. return;
  790. }
  791. if (this.selection[0].checkOutUserName) {
  792. this.$message.warning(
  793. this.selection[0].name +
  794. '已被' +
  795. this.selection[0].checkOutUserName +
  796. '检出 无法归档'
  797. );
  798. return;
  799. }
  800. if (this.powerFn(powerData)) {
  801. return;
  802. }
  803. updateLcyStatus({ id: this.selection[0].id }).then((res) => {
  804. this.reload();
  805. });
  806. },
  807. noUpdateLcyStatus(powerData) {
  808. if (this.selection.length == 0 || this.selection.length.length > 1) {
  809. this.$message.warning('请选择一条数据');
  810. return;
  811. }
  812. if (this.powerFn(powerData)) {
  813. return;
  814. }
  815. noUpdateLcyStatus({ id: this.selection[0].id }).then((res) => {
  816. this.reload();
  817. });
  818. },
  819. // selectionChange( selection){
  820. // console.log( selection,' selection')
  821. // let data=selection[selection.length-1]
  822. // this.current=data||this.current
  823. // this.rowClick(this.current)
  824. // },
  825. /* 删除 */
  826. remove(row, powerData) {
  827. if (this.powerFn(powerData, row)) {
  828. return;
  829. }
  830. if (!row.checkOutUserName) {
  831. this.$message.warning('请先检出在删除');
  832. return;
  833. }
  834. if (isCheckOut(this.current)) {
  835. this.$message.warning(
  836. this.current.name +
  837. '已被' +
  838. this.current.checkOutUserName +
  839. '检出 无法删除'
  840. );
  841. return;
  842. }
  843. const loading = this.$loading({ lock: true });
  844. fileDeleteAPI([row.id])
  845. .then((msg) => {
  846. loading.close();
  847. this.$message.success('操作成功');
  848. this.reload();
  849. })
  850. .catch((e) => {
  851. loading.close();
  852. // this.$message.error(e.message);
  853. });
  854. },
  855. //发布
  856. openSendEdit(powerData) {
  857. if (this.selection.length == 0) {
  858. this.$message.warning('请选择一条数据');
  859. return;
  860. }
  861. if (this.selection[0].checkOutUserName) {
  862. this.$message.warning(
  863. this.selection[0].name +
  864. '已被' +
  865. this.selection[0].checkOutUserName +
  866. '检出 无法发布'
  867. );
  868. return;
  869. }
  870. if (this.powerFn(powerData)) {
  871. return;
  872. }
  873. this.$refs.sendEditRef.open('add', '', this.selection, this.fileType);
  874. },
  875. //移动
  876. move() {
  877. if (this.selection.length == 0) {
  878. this.$message.warning('请选择一条数据');
  879. return;
  880. }
  881. if (this.selection[0].checkOutUserName) {
  882. this.$message.warning(
  883. this.selection[0].name +
  884. '已被' +
  885. this.selection[0].checkOutUserName +
  886. '检出 无法移动'
  887. );
  888. return;
  889. }
  890. this.$refs.moveRef.open(this.selection[0]);
  891. },
  892. getTableList() {
  893. return JSON.parse(JSON.stringify(this.selection));
  894. }
  895. }
  896. };
  897. </script>
  898. <style scoped lang="scss">
  899. .el-tabs__content {
  900. height: calc(100% - 39px);
  901. }
  902. :deep(.ele-table-tool-title-content) {
  903. display: contents;
  904. }
  905. </style>