file-table-list.vue 27 KB

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