| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187 |
- <template>
- <div>
- <fileSearch @search="reload"></fileSearch>
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- height="calc(45vh)"
- tool-class="ele-toolbar-form"
- :initLoad="false"
- row-key="id"
- :current.sync="current"
- :selection.sync="selection"
- highlight-current-row
- :cache-key="cacheKeyUrl"
- @columns-change="onColumnsChange"
- @row-click="rowClick"
- @selection-change="selectionClick"
- @done="done"
- :toolbar="!isPop"
- >
- <!-- 表头工具栏 -->
- <template v-slot:toolbar>
- <!-- <div style="display: contents;"> -->
- <el-dropdown trigger="click" v-if="lcyStatus == 1">
- <el-button type="primary">
- 新建<i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item
- @click.native="
- parenOpen('add', {
- power: 'add',
- dataKey: 'parentData',
- isArr: false
- })
- "
- >新建文件夹</el-dropdown-item
- >
- <el-dropdown-item
- @click.native="
- openEdit('add', '', {
- power: 'add',
- dataKey: 'parentData',
- isArr: false
- })
- "
- >新建文档</el-dropdown-item
- >
- </el-dropdown-menu>
- </el-dropdown>
- <el-dropdown trigger="click" v-if="lcyStatus == 1">
- <el-button type="primary">
- 编辑<i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item
- @click.native="
- parenOpen('edit', {
- power: 'revise',
- dataKey: 'parentData',
- isArr: false
- })
- "
- >修改</el-dropdown-item
- >
- <el-dropdown-item
- @click.native="
- parenOpen('del', {
- power: 'del',
- dataKey: 'parentData',
- isArr: false
- })
- "
- >删除</el-dropdown-item
- >
- </el-dropdown-menu>
- </el-dropdown>
- <el-button
- v-if="lcyStatus == 1"
- type="primary"
- @click.native="
- openEditAll({
- power: 'add',
- dataKey: 'parentData',
- isArr: false
- })
- "
- >
- 批量上传
- </el-button>
- <el-button
- type="primary"
- @click.native="
- checkEnter({
- power: 'checkEnter',
- dataKey: 'current',
- isArr: true
- })
- "
- :disabled="
- !!(selection.filter((item) => item.checkOutStatus != 1).length)
- "
- v-if="lcyStatus == 1"
- >
- 检入
- </el-button>
- <el-button
- type="primary"
- @click.native="
- checkOut({
- power: 'checkOut',
- dataKey: 'current',
- isArr: true
- })
- "
- :disabled="
- !!(selection.filter((item) => item.checkOutStatus == 1).length)
- "
- v-if="lcyStatus == 1"
- >
- 检出
- </el-button>
- <el-popconfirm
- class="ele-action"
- v-if="lcyStatus == 1 && fileType === 0"
- title="归档后文档无法修改,是否确认归档"
- @confirm="
- updateLcyStatus({
- power: 'archive',
- dataKey: 'current',
- isArr: true
- })
- "
- >
- <template v-slot:reference>
- <el-button type="primary"> 归档 </el-button>
- </template>
- </el-popconfirm>
- <el-button
- type="primary"
- v-if="lcyStatus == 2"
- @click="
- noUpdateLcyStatus({
- power: 'cancelArchive',
- dataKey: 'current',
- isArr: true
- })
- "
- >
- <!-- {
- power: 'cancelArchive',
- dataKey: 'current',
- isArr: true
- } -->
- 取消归档
- </el-button>
- <el-button
- type="primary"
- v-if="
- (lcyStatus == 1 || lcyStatus == 2) &&
- (fileType == 0 || fileType == 1)
- "
- @click="
- openSendEdit({
- power: 'release',
- dataKey: 'current',
- isArr: true
- })
- "
- >
- 发布
- </el-button>
- <el-button
- v-if="fileType == 2"
- type="primary"
- @click="processSubmit_template"
- >
- 发布
- </el-button>
- <el-button
- v-if="fileType === 0 && lcyStatus != 4"
- type="primary"
- :disabled="selection.length > 1"
- @click="
- processSubmit({
- power: 'abolish',
- dataKey: 'current',
- isArr: true
- })
- "
- >
- 废止
- </el-button>
- <el-popconfirm
- class="ele-action"
- title="确定要删除选中的文档吗?"
- @confirm="
- removeAll({
- power: 'del',
- dataKey: 'current',
- isArr: true
- })
- "
- >
- <template v-slot:reference>
- <el-button type="danger">批量删除</el-button>
- </template>
- </el-popconfirm>
- <el-button
- v-if="fileType === 0 && lcyStatus != 4"
- type="primary"
- @click="powerOpen"
- >
- 批量设置权限
- </el-button>
- <el-button
- type="primary"
- @click.native="
- getFile({
- power: 'download',
- dataKey: 'current',
- isArr: true
- })
- "
- >
- 下载
- </el-button>
- <el-button
- :disabled="selection.length > 1"
- type="primary"
- v-if="fileType == 1"
- @click.native="move"
- >
- 移动
- </el-button>
- <el-button
- type="primary"
- v-if="lcyStatus == 1 && fileType === 0"
- @click.native="
- moveAll({
- power: 'edit',
- dataKey: 'current',
- isArr: true
- })
- "
- >
- 批量移动
- </el-button>
-
- <!-- </div> -->
- </template>
- <template v-slot:directoryId="{ row }">
- <el-cascader
- style="width: 100%"
- v-model="row.directoryId"
- class="my-cascader"
- :disabled="true"
- :options="folderList"
- :props="{
- value: 'id',
- label: 'name',
- children: 'sonDirectoryList',
- emitPath: false,
- checkStrictly: true
- }"
- ></el-cascader>
- </template>
- <!-- 操作列 -->
- <template v-slot:action="{ row }">
- <el-link
- v-if="
- lcyStatus == 1 &&
- (row.reviewStatus == 0 || row.reviewStatus == 3) &&
- row.status == 0
- "
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- @click.native="
- openEdit('edit', row, {
- power: 'revise',
- dataKey: 'current',
- isArr: false
- })
- "
- >
- 修改
- </el-link>
- <el-popconfirm
- v-if="
- lcyStatus == 1 &&
- (row.reviewStatus == 0 || row.reviewStatus == 3) &&
- row.status == 0
- "
- class="ele-action"
- title="确定要删除此文档吗?"
- @confirm="
- remove(row, {
- power: 'del',
- dataKey: 'current',
- isArr: false
- })
- "
- >
- <template v-slot:reference>
- <el-link type="danger" :underline="false"> 删除 </el-link>
- </template>
- </el-popconfirm>
- </template>
- </ele-pro-table>
- <el-tabs
- type="border-card"
- v-show="!current?.id && parentData?.id"
- style="height: calc(55vh - 260px)"
- >
- <el-tab-pane label="常规">
- <folderInfo :parentId="parentData?.id" :folderList="folderList" />
- </el-tab-pane>
- <el-tab-pane label="操作日志"></el-tab-pane>
- </el-tabs>
- <el-tabs
- v-model="activeName"
- type="border-card"
- v-show="current.id && isPower(current, 'check')"
- style="height: calc(55vh - 260px)"
- @tab-click="tabClick"
- >
- <el-tab-pane label="常规" name="常规">
- <Info :parentId="current.id" :folderList="folderList" />
- </el-tab-pane>
- <el-tab-pane
- label="浏览"
- name="浏览"
- :disabled="!isPower(current, 'browse')"
- >
- <browse ref="browseRef"></browse>
- </el-tab-pane>
- <el-tab-pane label="历史版本" name="VersionRef">
- <Version :parentId="current.id" ref="VersionRef" />
- </el-tab-pane>
- <el-tab-pane label="发布记录" name="IssueRef">
- <Issue :parentId="current.id" ref="IssueRef" />
- </el-tab-pane>
- <el-tab-pane label="回收记录" name="ReceiveRef"
- ><Receive :parentId="current.id" ref="ReceiveRef"></Receive
- ></el-tab-pane>
- <el-tab-pane label="变更记录" name="变更记录" v-if="fileType === 0"
- ><Change :parentId="current.id"
- /></el-tab-pane>
- <!-- <el-tab-pane label="打印记录" name="打印记录"
- ><print></print
- ></el-tab-pane> -->
- <el-tab-pane label="工作流" name="bpmRef"
- ><bpm :parentId="current.id" ref="bpmRef"></bpm
- ></el-tab-pane>
- <el-tab-pane
- label="权限"
- name="权限"
- v-if="isCreateUserId(current) && !isCheckOut(current) && fileType === 0"
- >
- <Power style="" @powerSave="powerSave" ref="PowerRef" />
- </el-tab-pane>
- <el-tab-pane label="操作日志" name="ActionRef"
- ><Action :parentId="current.id" ref="ActionRef"
- /></el-tab-pane>
- </el-tabs>
- <!-- 编辑弹窗 -->
- <file-edit
- ref="fileEditRef"
- :parentId="parentData?.id"
- @done="reload"
- :lcyStatus="lcyStatus"
- :fileType="fileType"
- />
- <move ref="moveRef" @done="reload" />
- <moveAll ref="moveAllRef" @done="reload"></moveAll>
- <file-editAll
- ref="fileEditAllRef"
- :parentId="parentData?.id"
- @done="reload"
- :fileType="fileType"
- :lcyStatus="lcyStatus"
- />
- <sendEdit ref="sendEditRef" @done="reload" :isAdd="false"></sendEdit>
- <process-submit-dialog
- :processSubmitDialogFlag.sync="processSubmitDialogFlag"
- v-if="processSubmitDialogFlag"
- ref="processSubmitDialogRef"
- @reload="reload"
- ></process-submit-dialog>
- <ele-modal
- width="70vw"
- :visible.sync="powerOpenShow"
- :close-on-click-modal="false"
- custom-class="ele-dialog-form"
- :maxable="true"
- append-to-body
- >
- <Power style="" @powerSave="powerSave" ref="PowerRefAll" />
- </ele-modal>
- </div>
- </template>
- <script>
- import fileSearch from './file-search.vue';
- import fileEdit from './file-edit.vue';
- import fileEditAll from './file-editAll.vue';
- import move from './move.vue';
- import moveAll from './moveAll.vue';
- import Info from './info.vue';
- import folderInfo from './folderInfo.vue';
- import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
- import Version from './version.vue';
- import Power from './power/index.vue';
- import Issue from './issue.vue';
- import Action from './action.vue';
- import Change from './change.vue';
- import Receive from './receive.vue';
- import print from './print.vue';
- import bpm from './bpm.vue';
- import browse from './browse.vue';
- import sendEdit from '@/views/doc/issue_doc/components/edit.vue';
- import { isPower, isCheckOut, fileStatus, isCreateUserId } from '../util.js';
- import { getFile } from '@/api/system/file/index.js';
- import tableColumnsMixin from '@/mixins/tableColumnsMixin';
- import {
- fileDeleteAPI,
- filePageAPI,
- checkEnter,
- checkOut,
- fileUpdateAPI,
- updateLcyStatus,
- noUpdateLcyStatus,
- fileUpdateAllAPI
- } from '@/api/doc-manage';
- export default {
- mixins: [tableColumnsMixin],
- components: {
- fileSearch,
- fileEdit,
- Info,
- Version,
- Power,
- Issue,
- Action,
- Change,
- folderInfo,
- processSubmitDialog,
- Receive,
- print,
- fileEditAll,
- bpm,
- sendEdit,
- browse,
- move,moveAll
- },
- props: {
- // 上级
- parentData: {
- type: Object,
- default: () => {}
- },
- // 文件夹数据
- folderList: {
- type: Array,
- default: () => []
- },
- lcyStatus: {
- default: 1
- },
- fileType: '', //0:公共文档 1:个人文档 2:文档模板
- isPop: '',
- disabledTableList: {
- //已选择列表
- default: () => []
- },
- // 列配置远端同步 key:仅在调用方显式传入时启用同步,其他路由不传则完全关闭
- cacheKeyUrl: {
- type: String,
- default: ''
- }
- },
- //add:新建 fileEdit:修改 filePigeonhole:归档 fileUnPigeonhole:取消归档 fileIssue:发布 fileChange:变更 fileDel:删除
- data() {
- return {
- // 关闭 mixin 默认的 getTabColumns(与 ele-pro-table 工具栏共享同一 localStorage key,
- // 混用会破坏缓存结构,由本组件自行接管"远端拉取 + 应用"流程)。
- // 仅在 cacheKeyUrl 非空时才会真正发起同步(见 loadColumnsFromServer / onColumnsChange 的守卫)
- tabMixinsInit: false,
- isPower,
- isCheckOut,
- isCreateUserId,
- powerOpenShow: false,
- selection: [],
- processSubmitDialogFlag: false,
- current: {},
- fileUrl: '',
- activeName: '常规',
- // 表格列配置
- columns: [
- {
- width: 45,
- type: 'selection',
- columnKey: 'selection',
- align: 'center',
- fixed: 'left',
- selectable: (row, index) => {
- return (
- !this.disabledTableList
- .map((item) => item.id)
- .includes(row.id) &&
- row.reviewStatus != 1 &&
- row.status != 1
- );
- }
- },
- {
- label: '文档位置',
- prop: 'directoryId',
- slot: 'directoryId',
- width: 220,
- align: 'center',
- fixed: 'left',
- showOverflowTooltip: true
- },
- {
- label: '编码',
- prop: 'code',
- width: 180,
- align: 'center',
- fixed: 'left',
- showOverflowTooltip: true
- },
- {
- prop: 'name',
- label: '文档名称',
- align: 'center',
- slot: 'name',
- showOverflowTooltip: true,
- minWidth: 200
- },
- {
- prop: 'storagePath',
- label: '文件名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 200,
- formatter: (_row, _column, cellValue) => {
- return cellValue[0]?.name;
- }
- },
- {
- prop: 'version',
- label: '版本',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100
- },
- {
- prop: 'checkOutUserName',
- label: '检出人',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100
- },
- {
- prop: 'checkOutStatus',
- label: '检出状态',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100,
- formatter: (_row, _column, cellValue) => {
- return cellValue == 1 ? '已检出' : '';
- }
- },
- {
- prop: 'checkOutTime',
- label: '检出时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 160
- },
- {
- prop: 'createUserName',
- label: '创建人',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100
- },
- {
- prop: 'createTime',
- label: '创建时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 160
- },
- {
- prop: 'updateUserName',
- label: '修改人',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100
- },
- {
- prop: 'updateTime',
- label: '修改时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 160
- },
- {
- prop: 'sizeUnit',
- label: '文档大小',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100
- },
- {
- prop: 'status',
- label: '状态',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100,
- formatter: (_row, _column, cellValue) => {
- return fileStatus(cellValue);
- }
- },
- {
- align: 'center',
- label: '审核状态',
- prop: 'reviewStatus',
- width: 100,
- formatter: (_row, _column, cellValue) => {
- return cellValue == 0
- ? '未提交'
- : cellValue == 1
- ? '审核中'
- : cellValue == 2
- ? '已审核'
- : '审核不通过';
- }
- },
- {
- columnKey: 'action',
- label: '操作',
- width: 200,
- align: 'center',
- resizable: false,
- slot: 'action',
- showOverflowTooltip: true,
- fixed: 'right'
- }
- ],
- // 是否显示编辑弹窗
- showEditFlag: false
- };
- },
- created() {
- this.loadColumnsFromServer();
- },
- methods: {
- // ele-pro-table 列变化 → 转换为 slim 格式后同步到后端
- // slim 格式与 ele-pro-table 工具栏写入 localStorage 的结构一致,避免缓存互相覆盖
- // 注意:type 为 selection/index/expand 的列被 ele-pro-table 排除在 ⚙️ 工具栏外(见 HIDE_SETTING_TYPES),
- // 不应写入后端和 localStorage,否则下次加载会被 getSettingCols 当作缓存返回,污染工具栏列表
- onColumnsChange(visibleColumns) {
- if (!this.cacheKeyUrl) return;
- // 用户在 ⚙️ 工具栏里改最新 fixed 值(按 columnKey / prop 索引)
- // 源 columns 里的 fixed 是页面初始值,必须以这里为准,否则刷新后丢失
- const fixedMap = new Map();
- visibleColumns.forEach((c) => {
- const key = c.prop || c.columnKey;
- if (key) fixedMap.set(key, c.fixed);
- });
- const visibleIds = new Set(
- visibleColumns.map((c) => c.prop || c.columnKey)
- );
- const merged = this.columns
- .filter(
- (c) =>
- (c.prop || c.columnKey || c.label === '操作') &&
- !['selection', 'index', 'expand'].includes(c.type)
- )
- .map((c) => {
- const key = c.prop || c.columnKey;
- return {
- id: key,
- prop: c.prop,
- columnKey: c.columnKey,
- label: c.label,
- checked: visibleIds.has(key),
- fixed: fixedMap.has(key) ? fixedMap.get(key) : c.fixed
- };
- });
- this.saveColumns(merged);
- },
- // 拉取后端列配置,写入与 ele-pro-table 共享的 localStorage,触发表格重渲染
- // 过滤掉 HIDE_SETTING_TYPES 的列(selection/index/expand),避免污染 ⚙️ 工具栏列表
- async loadColumnsFromServer() {
- if (!this.cacheKeyUrl) return;
- try {
- const res = await this.getByTableId(this.cacheKeyUrl);
- if (res?.columnConfig?.length > 0) {
- const sanitized = res.columnConfig.filter(
- (c) => !['selection', 'index', 'expand'].includes(c.type)
- );
- this.setStorage(this.cacheKeyUrl + 'Cols', sanitized);
- // 触发 ele-pro-table 的 columns watcher 重读缓存
- this.columns = [...this.columns];
- }
- } catch (e) {
- console.error('加载列配置失败:', e);
- }
- },
- /* 表格数据源 */
- datasource({ page, limit, where, order }) {
- if (this.lcyStatus) {
- this.current = {};
- return filePageAPI({
- ...where,
- ...order,
- pageNum: page,
- size: limit,
- directoryId: this.parentData?.id,
- lcyStatus: this.lcyStatus,
- fileType: this.fileType,
- isQueryAll: this.$hasPermission('fm:doc:viewAll') ? 1 : ''
- });
- }
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table &&
- this.$refs.table.reload({ pageNum: 1, where: where });
- },
- processSubmit(powerData) {
- if (this.selection.length == 0 || this.selection.length > 1) {
- this.$message.warning('请选择一条数据');
- return;
- }
- if (this.selection[0].checkOutUserName) {
- this.$message.warning(
- this.selection[0].name +
- '已被' +
- this.selection[0].checkOutUserName +
- '检出 无法废止'
- );
- return;
- }
- if (this.powerFn(powerData)) {
- return;
- }
- if (isCheckOut(this.selection[0])) {
- this.$message.warning(
- this.selection[0].name +
- '已被' +
- this.selection[0].checkOutUserName +
- '检出 无法发起流程'
- );
- return;
- }
- this.processSubmitDialogFlag = true;
- this.$nextTick(() => {
- this.selection[0]['businessKey'] = 'fm_file_repeal_approve';
- this.$refs.processSubmitDialogRef.init(this.selection[0]);
- });
- },
- //发布模板
- processSubmit_template() {
- if (this.selection.length == 0 || this.selection.length > 1) {
- this.$message.warning('请选择一条数据');
- return;
- }
- if (this.selection[0].checkOutUserName) {
- this.$message.warning(
- this.selection[0].name +
- '已被' +
- this.selection[0].checkOutUserName +
- '检出 无法发布'
- );
- return;
- }
- if (this.selection[0].status == 2) {
- this.$message.warning('模板已发布');
- return;
- }
- this.processSubmitDialogFlag = true;
- this.$nextTick(() => {
- this.selection[0]['businessKey'] = 'fm_file_template_approve';
- this.$refs.processSubmitDialogRef.init(this.selection[0]);
- });
- },
- selectionClick(data) {
- this.current = data.reverse()[0] || {};
- this.rowClick(this.current);
- this.$refs.table.setCurrentRow(this.current);
- },
- rowClick(row) {
- this.$nextTick(() => {
- this.$refs.browseRef && this.$refs.browseRef.setFileUrl(row);
- this.$refs.PowerRef &&
- this.$refs.PowerRef.setTableList(row.userAuthority);
- });
- },
- /* 显示编辑 */
- openEdit(type, row = '', powerData) {
- if (type != 'add') {
- if (!row.checkOutUserName) {
- this.$message.warning('请先检出在修改');
- return;
- }
- if (isCheckOut(row)) {
- this.$message.warning(
- row.name + '已被' + row.checkOutUserName + '检出 无法修改'
- );
- return;
- }
- }
- if (this.powerFn(powerData, row)) {
- return;
- }
- this.$refs.fileEditRef.open(type, row, this.folderList);
- },
- /* 显示编辑 */
- openEditAll(powerData) {
- if (this.powerFn(powerData)) {
- return;
- }
- this.$refs.fileEditAllRef.open(this.folderList);
- },
- tabClick(data) {
- if (this.$refs[data.name] && this.$refs[data.name].init) {
- this.$refs[data.name].init();
- }
- },
- parenOpen(type, powerData) {
- if (this.powerFn(powerData)) {
- return;
- }
- this.$emit('parenOpen', type);
- },
- // async success(current) {
- // await this.reload();
- // this.current = current;
- // this.$nextTick(() => {
- // this.$refs.PowerRef &&
- // this.$refs.PowerRef.setTableList(this.current.userAuthority);
- // });
- // },
- //权限判断
- powerFn({ power, dataKey, isArr }, row) {
- let arr = isArr ? this.selection : [];
- if (!isPower(row || this[dataKey], power, arr)) {
- this.$message.warning('抱歉,您没有操作权限!');
- return true;
- }
- },
- powerOpen() {
- if (!this.selection?.length) {
- this.$message.warning('请选择一条数据!');
- return;
- }
- let createUserS = [],
- checkOutS = [];
- this.selection.forEach((item) => {
- if (!isCreateUserId(item)) {
- createUserS.push(item.name);
- }
- if (isCreateUserId(item)) {
- checkOutS.push(item.name);
- }
- });
- if (createUserS.toString()) {
- this.$message.warning(createUserS + '您不是创建人,无权限修改!');
- return;
- }
- if (!checkOutS.toString()) {
- this.$message.warning(checkOutS + '已被检出 无法修改!');
- return;
- }
- this.powerOpenShow = true;
- this.$nextTick(() => {
- this.$refs.PowerRefAll.setTableList([]);
- });
- },
- //权限保存
- powerSave(tableList) {
- if (this.powerOpenShow) {
- let data = this.selection.map((item) => {
- return {
- id: item.id,
- userAuthority: tableList,
- authority: 1
- };
- });
- fileUpdateAllAPI(data).then((msg) => {
- this.reload();
- });
- this.powerOpenShow = false;
- } else {
- fileUpdateAPI({
- id: this.current.id,
- userAuthority: tableList,
- authority: 1
- }).then((msg) => {
- this.reload();
- });
- }
- },
- //检出
- checkOut(powerData) {
- if (this.selection.length == 0) {
- this.$message.warning('请选择一条数据');
- return;
- }
- if (this.powerFn(powerData)) {
- return;
- }
- checkOut(
- this.selection.map((item) => {
- return {
- id: item.id,
- checkOutStatus: 1
- };
- })
- ).then((msg) => {
- this.reload();
- });
- },
- //检入
- checkEnter(powerData) {
- if (this.selection.length == 0) {
- this.$message.warning('请选择一条数据');
- return;
- }
- if (this.powerFn(powerData)) {
- return;
- }
- checkEnter(
- this.selection.map((item) => {
- return {
- id: item.id,
- checkOutStatus: 0
- };
- })
- ).then((msg) => {
- this.reload();
- });
- },
- done() {
- this.$refs.table.reRenderTable();
- this.selection = [];
- },
- //下载
- getFile(powerData) {
- if (this.selection.length == 0) {
- this.$message.warning('请选择一条数据');
- return;
- }
- if (this.powerFn(powerData)) {
- return;
- }
- this.selection.forEach((item) => {
- getFile(
- { objectName: item.stampStoragePath[0].storePath },
- item.stampStoragePath[0].name
- );
- });
- },
- updateLcyStatus(powerData) {
- if (this.selection.length == 0 || this.selection.length.length > 1) {
- this.$message.warning('请选择一条数据');
- return;
- }
- if (this.selection[0].checkOutUserName) {
- this.$message.warning(
- this.selection[0].name +
- '已被' +
- this.selection[0].checkOutUserName +
- '检出 无法归档'
- );
- return;
- }
- if (this.powerFn(powerData)) {
- return;
- }
- updateLcyStatus({ id: this.selection[0].id }).then((res) => {
- this.reload();
- });
- },
- noUpdateLcyStatus(powerData) {
- if (this.selection.length == 0 || this.selection.length > 1) {
- this.$message.warning('请选择一条数据');
- return;
- }
- if (this.powerFn(powerData)) {
- return;
- }
- noUpdateLcyStatus({ id: this.selection[0].id }).then((res) => {
- this.reload();
- });
- },
- // selectionChange( selection){
- // console.log( selection,' selection')
- // let data=selection[selection.length-1]
- // this.current=data||this.current
- // this.rowClick(this.current)
- // },
- /* 删除 */
- removeAll(powerData) {
- let fileNames = [];
- let checkOutUserNames = [];
- if (!this.selection.length) {
- this.$message.warning('请至少选择一条数据');
- return;
- }
- if (this.powerFn(powerData)) {
- return;
- }
- this.selection.forEach((item) => {
- if (!item.checkOutUserName) {
- fileNames.push(item.name + '未检出,请先检出在删除');
- }
- if (isCheckOut(item)) {
- checkOutUserNames.push(
- item.name + '已被' + item.checkOutUserName + '检出 无法删除'
- );
- }
- });
- if (fileNames.length) {
- this.$message.warning(fileNames.toString());
- return;
- }
- if (checkOutUserNames.length) {
- this.$message.warning(checkOutUserNames.toString());
- return;
- }
- const loading = this.$loading({ lock: true });
- fileDeleteAPI(this.selection.map((item) => item.id))
- .then((msg) => {
- loading.close();
- this.$message.success('操作成功');
- this.reload();
- })
- .catch((e) => {
- loading.close();
- // this.$message.error(e.message);
- });
- },
- remove(row, powerData) {
- if (this.powerFn(powerData, row)) {
- return;
- }
- if (!row.checkOutUserName) {
- this.$message.warning('请先检出在删除');
- return;
- }
- if (isCheckOut(row)) {
- this.$message.warning(
- row.name + '已被' + row.checkOutUserName + '检出 无法删除'
- );
- return;
- }
- const loading = this.$loading({ lock: true });
- fileDeleteAPI([row.id])
- .then((msg) => {
- loading.close();
- this.$message.success('操作成功');
- this.reload();
- })
- .catch((e) => {
- loading.close();
- // this.$message.error(e.message);
- });
- },
- //发布
- openSendEdit(powerData) {
- if (this.selection.length == 0) {
- this.$message.warning('请选择一条数据');
- return;
- }
- if (this.selection[0].checkOutUserName) {
- this.$message.warning(
- this.selection[0].name +
- '已被' +
- this.selection[0].checkOutUserName +
- '检出 无法发布'
- );
- return;
- }
- if (this.powerFn(powerData)) {
- return;
- }
- this.$refs.sendEditRef.open('add', '', this.selection, this.fileType);
- },
- //移动
- move() {
- if (this.selection.length == 0) {
- this.$message.warning('请选择一条数据');
- return;
- }
- if (this.selection[0].checkOutUserName) {
- this.$message.warning(
- this.selection[0].name +
- '已被' +
- this.selection[0].checkOutUserName +
- '检出 无法移动'
- );
- return;
- }
- this.$refs.moveRef.open(this.selection[0]);
- },
- moveAll(powerData) {
- let fileNames = [];
- let checkOutUserNames = [];
- if (!this.selection.length) {
- this.$message.warning('请至少选择一条数据');
- return;
- }
- if (this.powerFn(powerData)) {
- return;
- }
- this.selection.forEach((item) => {
- if (isCheckOut(item)) {
- checkOutUserNames.push(
- item.name + '已被' + item.checkOutUserName + '检出 无法移动'
- );
- }
- });
- if (fileNames.length) {
- this.$message.warning(fileNames.toString());
- return;
- }
- if (checkOutUserNames.length) {
- this.$message.warning(checkOutUserNames.toString());
- return;
- }
- this.$refs.moveAllRef.open(this.selection.map(item=>item.id).toString())
- },
- getTableList() {
- return JSON.parse(JSON.stringify(this.selection));
- }
- }
- };
- </script>
- <style scoped lang="scss">
- :deep(.el-tabs__content) {
- height: calc(100% - 39px);
- overflow: auto;
- }
- :deep(.ele-table-tool-title-content) {
- display: contents;
- }
- .my-cascader {
- :deep(.el-input__inner) {
- border: none;
- background: none;
- cursor: inherit;
- }
- :deep(.el-input__suffix) {
- display: none;
- }
- }
- </style>
|