update 文档拆分

This commit is contained in:
赵霄
2023-10-12 17:42:03 +08:00
parent 505c07fd88
commit 999ca5f719
15 changed files with 388 additions and 62 deletions
@@ -42,12 +42,14 @@
<!--拆分已入库文本-->
<a-button icon="plus" type="primary" @click="handleModule" v-has="'split:sarFileSplitInfo:splitFile'">{{ $t('docTool.split.splitText') }}
</a-button>
<!--导入拆分结果-->
<!--TODO 导入拆分结果-->
<a-button icon="download" type="primary" ghost @click="handleExport" v-has="'split:sarFileSplitInfo:splitResult'">
{{ $t('docTool.split.importResults') }}
</a-button>
<!--批量删除-->
<a-button type="primary" icon="delete" ghost @click="batchDel" v-has="'split:sarFileSplitInfo:deleteBatch'">{{ $t('batchDelete') }}</a-button>
<!--更改权限-->
<a-button type="primary" icon="sync" ghost @click="handleChangePermission">{{ $t('docTool.split.changePermissions') }}</a-button>
</div>
<div>
<j-table
@@ -59,28 +61,9 @@
:pagination="ipagination"
:scroll="{x: '100%'}"
:loading="loading"
@change="handleTableChange">
<template v-slot:operation="{text, record}">
<a @click="operationClick(operationList[0],record)">{{ operationList[0].text }}</a>
<a-divider type="vertical" />
<a-dropdown placement="bottomCenter">
<a-icon type="more" class="operate-icon-btn operate-icon-more" />
<a-menu slot="overlay">
<a-menu-item v-for="(operation, index) in operationList.slice(operateMaxNum)" :key="index">
<a @click="operationClick(operation,record)">
<div class="operate-btn">
<!-- 编辑图标-->
<i class="iconfont icon-bianji operate-btn-icon" v-if="operation.text === $t('edit')" />
<!-- 删除图标-->
<i class="iconfont icon-shanchu_ operate-btn-icon" v-if="operation.text === $t('delete')" />
{{ operation.text }}
</div>
</a>
</a-menu-item>
</a-menu>
</a-dropdown>
</template>
:operation-list="operationList"
@change="handleTableChange"
@operationClick="operationClick">
</j-table>
</div>
@@ -89,6 +72,8 @@
<split-text ref="splitText" @ok="modalFormOk" />
<!--导入拆分结果-->
<import-split-result-modal ref="importResultModal" @ok="modalFormOk" />
<!--更改权限-->
<user-select-modal ref="userSelectModal" check-required @change="continueChangePermission" />
</a-card>
</template>
@@ -97,21 +82,39 @@ import '../../../assets/less/common.less'
import JTable from '../../../components/jero/JTable.vue'
import SplitText from './modules/SplitText.vue'
import { JeroListMixin } from '../../../mixins/JeroListMixin.js'
import { releaseSplitStandard } from '../../../api/documentToolApi.js'
import { releaseSplitStandard, changePermission, withdraw } from '../../../api/documentToolApi.js'
import ImportSplitResultModal from './modules/ImportSplitResultModal.vue'
import UserSelectModal from '../../../components/selection/UserSelectModal.vue'
import { SplitStatus } from '../../../enums/commonEnums.js'
import { mapState } from 'vuex'
export default {
name: 'DocumentSplit',
components: { JTable, SplitText, ImportSplitResultModal },
components: { JTable, SplitText, ImportSplitResultModal, UserSelectModal },
mixins: [JeroListMixin],
data () {
return {
userInfo: this.$store.getters.userInfo,
operationList: [
// 发布
{
text: this.$t('release'),
clickEvent: 'handleRelease',
has: 'split:sarFileSplitInfo:release'
has: 'split:sarFileSplitInfo:release',
show: (record) => {
// 创建人(更改权限更改的是这个字段)是当前登录人,且状态为编辑中可以发布
return record.createBy === this.userInfo.username && record.splitStatus === SplitStatus.EDITING.value
}
},
// 撤回
{
text: this.$t('withdraw'),
clickEvent: 'handleWithdraw',
has: 'split:sarFileSplitInfo:release',
show: (record) => {
// 创建人(更改权限更改的是这个字段)是当前登录人,且状态为已发布可以撤回
return record.createBy === this.userInfo.username && record.splitStatus === SplitStatus.RELEASED.value
}
},
// 查看
{
@@ -123,25 +126,33 @@ export default {
{
text: this.$t('edit'),
clickEvent: 'handleEdit',
has: 'split:sarFileSplitItems:edit'
has: 'split:sarFileSplitItems:edit',
show: (record) => {
// 创建人(更改权限更改的是这个字段)是当前登录人,且状态为编辑中可以编辑
return record.createBy === this.userInfo.username && record.splitStatus === SplitStatus.EDITING.value
}
},
// 删除
{
text: this.$t('delete'),
clickEvent: 'handleDelete',
has: 'split:sarFileSplitInfo:delete'
has: 'split:sarFileSplitInfo:delete',
show: (record) => {
// 创建人(更改权限更改的是这个字段)是当前登录人,且状态为编辑中可以删除
return record.createBy === this.userInfo.username && record.splitStatus === SplitStatus.EDITING.value
}
}
],
columns: [
// 标准号
{
dataIndex: 'standardNumber',
dataIndex: 'serialNumber',
title: this.$t('standardSelect.standardNumber'),
width: 150
},
// 标准名称
{
dataIndex: 'standardName',
dataIndex: 'title',
title: this.$t('standardSelect.standardName'),
width: 150
},
@@ -155,17 +166,17 @@ export default {
{
dataIndex: 'fileName',
title: this.$t('fileName'),
width: 150
width: 180
},
// 拆分状态
{
dataIndex: '5',
dataIndex: 'splitStatus_dictText',
title: this.$t('docTool.split.splitState'),
width: 150
},
// 编辑人
{
dataIndex: '6',
dataIndex: 'author',
title: this.$t('docTool.split.editor'),
width: 150
},
@@ -187,18 +198,15 @@ export default {
title: this.$t('operation'),
fixed: 'right',
width: 150,
scopedSlots: { customRender: 'operation' }
scopedSlots: { customRender: 'action' }
}
],
url: {
list: '/split/sarFileSplitInfo/page', // 表格数据
deleteBatch: '', // 批量删除
deleteUrl: '',
deleteBatch: '/split/sarFileSplitInfo/deleteBatch', // 批量删除
deleteUrl: '/split/sarFileSplitInfo/delete',
backDocument: '' // 回传至文档库
},
dataSource: [
{ id: 1 }
]
}
}
},
methods: {
@@ -232,6 +240,29 @@ export default {
}
})
},
/**
* TODO 撤回
* @param id
*/
handleWithdraw ({ id }) {
this.$confirm({
title: this.$t('confirmWithdraw'),
content: this.$t('confirmWithdrawContent'),
onOk: () => {
this.loading = true
withdraw({ id }).then(res => {
if (res.success) {
this.$message.success(res.message)
this.modalFormOk()
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.loading = false
})
}
})
},
// 编辑
handleEdit (record) {
this.$router.push({
@@ -262,6 +293,33 @@ export default {
if (num === 1) {
this.$refs.tableData.$emit('searchGetData')
}
},
/**
* 更改权限
*/
handleChangePermission () {
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
this.$message.warning(this.$t('selectARecord'))
return
}
this.$refs.userSelectModal.open()
},
continueChangePermission (id) {
this.loading = true
const params = {
ids: this.selectedRowKeys.join(','),
createBy: id
}
changePermission(params).then(res => {
if (res.success) {
this.$message.success(res.message)
this.modalFormOk()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
}
}
}