稽查文档管理
continuous-integration/drone/push Build is failing Details

main
wangxiaoshuang 2025-04-03 17:35:25 +08:00
parent 31c9db368c
commit a9edab9227
4 changed files with 262 additions and 71 deletions

View File

@ -4027,3 +4027,27 @@ export function updateAuditDocument(data) {
data
})
}
// 工作台-删除稽查文档
export function deleteAuditDocument(data) {
return request({
url: `/AuditDocument/deleteAuditDocument`,
method: 'post',
data
})
}
// 工作台-稽查文档获取历史版本
export function getHistoricalVersion(data) {
return request({
url: `/AuditDocument/getHistoricalVersion`,
method: 'post',
data
})
}
// 工作台-稽查文档设置当前版本
export function setCurrentVersion(data) {
return request({
url: `/AuditDocument/setCurrentVersion`,
method: 'post',
data
})
}

View File

@ -11,7 +11,7 @@
<i class="icon icon_download" />
<span>{{ $t('trials:trials-workbench:auditDocument:menu:download') }}</span>
</div>
<template v-if="type === 'file'">
<template v-if="['file', 'files', 'folder'].includes(type)">
<div class="line"></div>
<div class="contextmenu__item" @click="handleMenu('copy')">
<i class="icon icon_copy" />
@ -32,9 +32,9 @@
</template>
<template v-if="checkList.length <= 1 && type === 'file'">
<div class="line"></div>
<div class="contextmenu__item" @click="handleMenu('Stats')">
<div class="contextmenu__item" @click="handleMenu('version')">
<i class="icon el-icon-warning-outline icon_Stats" />
<span>{{ $t('trials:trials-workbench:auditDocument:menu:Stats') }}</span>
<span>{{ $t('trials:trials-workbench:auditDocument:menu:version') }}</span>
</div>
</template>
<template v-if="type === 'version' || type === 'c_version'">
@ -43,7 +43,7 @@
<i class="icon el-icon-document-checked icon_Stats" />
<span>{{ $t('trials:trials-workbench:auditDocument:menu:setVersion') }}</span>
</div>
<div class="contextmenu__item" @click="handleMenu('delVersion')">
<div class="contextmenu__item" @click="handleMenu('delVersion')" v-if="type === 'version'">
<i class="icon el-icon-delete icon_Stats" />
<span>{{ $t('trials:trials-workbench:auditDocument:menu:delVersion') }}</span>
</div>
@ -70,11 +70,13 @@ export default {
return {
visible: false,
type: 'file',
zIndex: 9
zIndex: 9,
rowData: {}
};
},
methods: {
init(event, row, type, zIndex = 9) {
this.rowData = row
this.type = type
this.zIndex = zIndex
//
@ -102,7 +104,7 @@ export default {
this.$emit("foo");
},
handleMenu(item) {
this.$emit("handleMenu", item);
this.$emit("handleMenu", { key: item, row: this.rowData });
},
},
};

View File

@ -4,81 +4,79 @@
<div class="auditDocumentDetail">
<div class="header">
<div class="file_icon">
<i class="name_docx"></i>
<i class="name_folder" v-if="!rowData.AuditDocumentTypeEnum"></i>
<i :class="`name_${rowData.FileFormat}`" v-else></i>
</div>
<div class="file_name">
<div class="name">
<span class="name-text">但是决定把尖酸刻薄的喀巴水电局咯不到就案板白沙卡萨丁你卢卡斯拿到了看到了上的尽快把世界第八款不打瞌睡的</span>
<span class="name-text">{{ rowData.Name }}</span>
</div>
<div class="desc">
<span class="size">100kb</span>
<span>, </span>
<span class="time">2025-03-31 15:36</span>
<span class="size">{{ formatFileSize(rowData) }}</span>
<span v-if="rowData.AuditDocumentTypeEnum">, </span>
<span class="time">{{ rowData.UpdateTime }}</span>
</div>
</div>
</div>
<div class="main">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane :label="$t('trials:trials-workbench:auditDocument:detail:tabs:Stats')" name="Stats">
<div class="p">
<div class="title">{{ $t('trials:trials-workbench:auditDocument:detail:title:path') }}</div>
<div class="content">{shareItem:8}/周会/20250324-工作总结及后续工作.pptx</div>
</div>
<div class="p">
<div class="title">{{ $t('trials:trials-workbench:auditDocument:detail:title:contain') }}
</div>
<div class="content">4 (2文件, 2文件夹)</div>
</div>
<div class="p">
<div class="title">{{ $t('trials:trials-workbench:auditDocument:detail:title:size') }}</div>
<div class="content">123333</div>
</div>
<div class="p">
<div class="title">{{ $t('trials:trials-workbench:auditDocument:detail:title:updateTime') }}
</div>
<div class="content">123333</div>
</div>
</el-tab-pane>
<el-tab-pane :label="$t('trials:trials-workbench:auditDocument:detail:tabs:versions')"
name="versions">
name="versions" v-if="rowData.AuditDocumentTypeEnum === 1">
<div class="versions_top">
<div class="title">{{
$t('trials:trials-workbench:auditDocument:detail:title:historicalVersion') }}
</div>
<div class="btnBox">
<el-button icon="el-icon-refresh" circle size="small" />
<el-button icon="el-icon-upload2" plain size="small">{{
<el-button icon="el-icon-refresh" circle size="small"
@click.stop="getHistoricalVersion" />
<el-button icon="el-icon-upload2" plain size="small" @click.stop="openFile">{{
$t('trials:trials-workbench:auditDocument:detail:title:uploadNewVersion')
}}</el-button>
</div>
</div>
<div class="versions_content">
<div class="item">
<div class="versions_content" v-loading="loading">
<div class="item" v-for="item of versionList" :key="item.Id">
<div class="item_line">
<div class="version current_version">
<div class="version current_version" v-if="item.IsCurrentVersion">
<span>{{
$t('trials:trials-workbench:auditDocument:detail:title:currentVersion')
}}</span>
</div>
<div class="mtime">2025-03-31 15:36</div>
<div class="size">375KB</div>
<div class="add_desc" @click.stop="openMenu($event, {}, 'c_version')">
<div class="version" v-else>
<span>v{{ item.Version }}</span>
</div>
<div class="mtime">{{ item.CreateTime }}</div>
<div class="size">{{ formatFileSize(item) }}</div>
<div class="add_desc" @click.stop="openMenu($event, item, 'c_version')"
v-if="item.IsCurrentVersion">
<i class="el-icon-more" />
</div>
<div class="add_desc" @click.stop="openMenu($event, item, 'version')" v-else>
<i class="el-icon-more" />
</div>
</div>
</div>
<div class="item">
<div class="item_line">
<div class="version">
<span>v1</span>
</div>
<div class="mtime">2025-03-31 15:36</div>
<div class="size">375KB</div>
<div class="add_desc" @click.stop="openMenu($event, {}, 'version')">
<i class="el-icon-more" />
</div>
</div>
</div>
</el-tab-pane>
<el-tab-pane :label="$t('trials:trials-workbench:auditDocument:detail:tabs:Stats')" name="Stats"
v-if="false">
<div class="p">
<div class="title">{{ $t('trials:trials-workbench:auditDocument:detail:title:path') }}</div>
<div class="content">{shareItem:8}/周会/20250324-工作总结及后续工作.pptx</div>
</div>
<div class="p" v-if="!rowData.AuditDocumentTypeEnum">
<div class="title">{{ $t('trials:trials-workbench:auditDocument:detail:title:contain') }}
</div>
<div class="content">4 (2文件, 2文件夹)</div>
</div>
<div class="p" v-else>
<div class="title">{{ $t('trials:trials-workbench:auditDocument:detail:title:size') }}</div>
<div class="content">{{ formatFileSize(rowData) }}</div>
</div>
<div class="p">
<div class="title">{{ $t('trials:trials-workbench:auditDocument:detail:title:updateTime') }}
</div>
<div class="content">{{ rowData.UpdateTime }}</div>
</div>
</el-tab-pane>
</el-tabs>
@ -87,6 +85,7 @@
</el-dialog>
</template>
<script>
import { getHistoricalVersion } from '@/api/trials'
export default {
name: "auditDocumentDetail",
props: {
@ -103,7 +102,21 @@ export default {
},
data() {
return {
activeName: 'Stats'
activeName: 'versions',
versionList: [],
loading: false
}
},
// mounted() {
// this.getHistoricalVersion()
// },
watch: {
rowData: {
handler() {
this.getHistoricalVersion()
},
deep: true,
immediate: true
}
},
methods: {
@ -113,7 +126,54 @@ export default {
},
handleClose() {
this.$emit("update:visible", false)
}
},
delAll() {
let ids = []
this.versionList.forEach(item => {
if (!item.IsCurrentVersion) {
ids.push(item.Id)
}
})
this.$emit('delData', ids)
},
//
async getHistoricalVersion() {
if (!this.rowData || !this.rowData.Id) return false
try {
let data = {
Id: this.rowData.Id
}
this.loading = true
let res = await getHistoricalVersion(data)
this.loading = false
if (res.IsSuccess) {
this.versionList = res.Result
}
} catch (err) {
this.loading = false
console.log(err)
}
},
openFile() {
let faccept = `.${this.rowData.FileFormat}`
this.$emit('openFileNewVersion', faccept)
},
//
formatFileSize(row) {
if (!row.FileSize) return ''
if (row.FileSize < 1000) {
return row.FileSize + "B"
}
if (row.FileSize < 1000 * 1024) {
return (row.FileSize / 1024).toFixed(2) + "KB"
}
if (row.FileSize < 1000 * 1000 * 1024) {
return (row.FileSize / 1000 / 1024).toFixed(2) + "MB"
}
if (row.FileSize < 1000 * 1000 * 1000 * 1024) {
return (row.FileSize / 1000 / 1000 / 1024).toFixed(2) + "GB"
}
},
}
}
</script>
@ -132,7 +192,7 @@ export default {
.auditDocumentDetail {
.header {
padding: 0 20px;
padding: 0 10px 10px;
display: flex;
align-items: center;
border-bottom: 1px solid #f6f8ff;
@ -198,13 +258,17 @@ export default {
word-break: break-word;
display: table-cell;
vertical-align: middle;
height: 60px;
max-height: 60px;
line-height: 18px;
margin-top: 7px;
width: calc(100% - 170px);
display: flex;
align-items: center;
flex-wrap: wrap;
.name {
max-height: 35px;
width: 100%;
line-height: 18px;
overflow: hidden;
text-overflow: ellipsis;

View File

@ -46,8 +46,8 @@
</el-form>
<div class="catalogue">
<span>{{ $t('trials:trials-workbench:auditDocument:catalogue:title') }}</span>
<el-button icon="el-icon-top" class="last_catalogue" :disabled="!Id"
@click.stop="toCatalogue(false)"></el-button>
<el-button icon="el-icon-top" class="last_catalogue" :disabled="!Id" @click.stop="toCatalogue(false)"
:title="$t('trials:trials-workbench:auditDocument:catalogue:lastCatalogue')"></el-button>
<el-breadcrumb separator-class="el-icon-arrow-right" class="catalogue_name_box">
<el-breadcrumb-item v-for="item of catalogueData" :key="item.Id">
<span class="catalogue_name" @click.stop="toCatalogue(item)">{{ item.Name }}</span>
@ -68,7 +68,7 @@
<span class="name_box">
<i class="icon icon_folder" v-if="!scope.row.AuditDocumentTypeEnum" />
<i v-else :class="`icon icon_file icon_${scope.row.FileFormat}`" />
<span class="name">{{ scope.row.Name }}</span>
<span class="name" :title="scope.row.Name">{{ scope.row.Name }}</span>
<i class="el-icon-edit icon_edit" v-if="hoverId === scope.row.Id"
@click="addRenameId(scope.row)"
:title="$t('trials:trials-workbench:auditDocument:icon:rename')" />
@ -100,11 +100,12 @@
<contextmenu ref="contextmenu" :checkList="checkList" @handleMenu="handleMenu" />
<upload-files :config="config" :faccept="faccept" :uploadPath="uploadPath" :limitLength="limitLength"
v-if="config.visible" @close="close" @uplaodFile="uplaodFile" />
<detail v-if="visible" :visible.sync="visible" :rowData="rowData" @openContextmenu="openContextmenu" />
<detail ref="versionDetail" v-if="visible" :visible.sync="visible" :rowData="rowData"
@openContextmenu="openContextmenu" @openFileNewVersion="openFileNewVersion" @delData="delData" />
</div>
</template>
<script>
import { getAuditDocumentData, addAuditDocument, getBreadcrumbData, updateAuditDocument } from '@/api/trials'
import { getAuditDocumentData, addAuditDocument, getBreadcrumbData, updateAuditDocument, deleteAuditDocument, setCurrentVersion } from '@/api/trials'
import Pagination from '@/components/Pagination'
import contextmenu from './contextmenu.vue'
import uploadFiles from '@/views/trials/trials-panel/trial-summary/trial-document/components/uploadFiles.vue'
@ -147,6 +148,7 @@ export default {
title: '',
appendToBody: false,
isFolder: false,
isVersion: false
},
uploadPath: '/System/AuditDocument',
faccept: ['.pdf'],
@ -177,23 +179,38 @@ export default {
}
} catch (err) { console.log(err) }
},
async getList() {
async getList(id) {
try {
this.searchData.Id = this.Id
this.loading = true
let res = await getAuditDocumentData(this.searchData)
this.loading = false
if (res.IsSuccess) {
this.tableData = res.Result.CurrentPageData
this.total = res.Result.TotalCount
if (this.$refs.versionDetail) {
this.checkList = [id]
this.rowData = this.getData(this.tableData, id)
}
}
} catch (err) {
this.loading = false
console.log(err)
}
},
getData(list, Id) {
let data = {}
for (let i = 0; i < list.length; i++) {
let item = list[i]
if (item.Id === Id) {
data = item
}
if (item.Children && item.Children.length > 0) {
data = this.getData(item.Children, Id)
}
}
return data
},
handleSearch() {
this.getList()
},
@ -217,7 +234,6 @@ export default {
this.updateData(row)
},
handleExpandChange(row, expanded) {
console.log(this.expandedRows)
if (expanded && !this.expandedRows.find(Id => Id === row.Id)) {
this.expandedRows.push(row.Id)
}
@ -253,6 +269,37 @@ export default {
this.getList()
this.getBreadcrumbData()
},
//
async setCurrentVersion(Id) {
try {
let data = {
Id
}
let res = await setCurrentVersion(data)
if (res.IsSuccess) {
this.getList(Id)
}
} catch (err) {
console.log(err)
}
},
//
async delData(Ids) {
try {
let data = { Ids }
let res = await deleteAuditDocument(data)
if (res.IsSuccess) {
this.checkList = []
this.getList(this.rowData.Id)
if (this.$refs.versionDetail) {
// this.$refs.versionDetail.getHistoricalVersion()
this.checkList = [this.rowData.Id]
}
}
} catch (err) {
console.log(err)
}
},
//
async updateData(row) {
try {
@ -275,12 +322,28 @@ export default {
},
//
async uplaodFile(list) {
let data = this.formatData(list)
console.log(data, 'data')
let data = []
if (this.config.isVersion) {
data.push({
ParentId: this.rowData.ParentId,
Name: this.rowData.Name,
IsAuthorization: this.rowData.IsAuthorization,
FileSize: list[0].FileSize,
filePath: list[0].FilePath,
FileFormat: list[0].FileFormat,
AuditDocumentTypeEnum: 1
})
} else {
data = this.formatData(list)
}
try {
let res = await addAuditDocument(JSON.stringify(data))
if (res.IsSuccess) {
this.getList()
let id = res.Result ? res.Result[0] : null
this.getList(id)
// if (this.$refs.versionDetail) {
// this.$refs.versionDetail.getHistoricalVersion()
// }
}
} catch (err) {
console.log(err)
@ -370,7 +433,8 @@ export default {
if (!row.AuditDocumentTypeEnum) {
return this.$t('trials:trials-workbench:auditDocument:fileType:folder')
} else {
return `${row.FileFormat}${this.$t('trials:trials-workbench:auditDocument:fileType:file')}`
return row.FileFormat
// return `${row.FileFormat}${this.$t('trials:trials-workbench:auditDocument:fileType:file')}`
}
},
//
@ -389,6 +453,16 @@ export default {
return (row.FileSize / 1000 / 1000 / 1024).toFixed(2) + "GB"
}
},
openFileNewVersion(faccept) {
this.faccept = [faccept]
this.limitLength = 1
this.config.title = this.$t(
'trials:trials-workbench:auditDocument:form:title:uploadFile'
)
this.config.visible = true
this.config.isVersion = true
this.config.isFolder = false
},
openFile(isFolder = false) {
this.faccept = [
'.jpg',
@ -408,6 +482,7 @@ export default {
'trials:trials-workbench:auditDocument:form:title:uploadFile'
)
this.config.visible = true
this.config.isVersion = false
this.config.isFolder = isFolder
},
close() {
@ -424,6 +499,8 @@ export default {
handleRowContextmenu(row, column, e) {
e.preventDefault();
if (!this.checkList.includes(row.Id)) this.handleRowClick(row)
if (this.checkList.length > 1) return this.$refs.contextmenu.init(e, row, 'files')
if (!row.AuditDocumentTypeEnum) return this.$refs.contextmenu.init(e, row, 'folder')
this.$refs.contextmenu.init(e, row, 'file')
},
//
@ -437,6 +514,7 @@ export default {
},
//
handleRowClick(row) {
this.rowData = row
if (this.ctrlKey) {
this.checkList.push(row.Id)
} else {
@ -451,15 +529,38 @@ export default {
// hover
handleCellMouseLeave() { this.hoverId = null },
//
handleMenu(key) {
handleMenu(data) {
let { key, row } = data
console.log(key, row)
this.type = key;
if (key === 'rename') {
this.renameId = this.checkList[0]
}
if (key === 'Stats') {
this.rowData = this.tableData.find(item => item.Id === this.checkList[0])
if (key === 'version') {
this.visible = true
}
if (key === 'open') {
if (!this.rowData.AuditDocumentTypeEnum) {
this.Id = this.rowData.Id
this.resetOpt()
this.getList()
this.getBreadcrumbData()
}
}
if (key === 'del') {
this.delData(this.checkList)
}
if (key === 'delVersion') {
this.delData([row.Id])
}
if (key === 'delAllVersion') {
if (this.$refs.versionDetail) {
this.$refs.versionDetail.delAll()
}
}
if (key === 'setVersion') {
this.setCurrentVersion(row.Id)
}
},
setRowStyle({ row, rowIndex }) {
if (this.checkList.includes(row.Id)) {