稽查文档管理
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 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" /> <i class="icon icon_download" />
<span>{{ $t('trials:trials-workbench:auditDocument:menu:download') }}</span> <span>{{ $t('trials:trials-workbench:auditDocument:menu:download') }}</span>
</div> </div>
<template v-if="type === 'file'"> <template v-if="['file', 'files', 'folder'].includes(type)">
<div class="line"></div> <div class="line"></div>
<div class="contextmenu__item" @click="handleMenu('copy')"> <div class="contextmenu__item" @click="handleMenu('copy')">
<i class="icon icon_copy" /> <i class="icon icon_copy" />
@ -32,9 +32,9 @@
</template> </template>
<template v-if="checkList.length <= 1 && type === 'file'"> <template v-if="checkList.length <= 1 && type === 'file'">
<div class="line"></div> <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" /> <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> </div>
</template> </template>
<template v-if="type === 'version' || type === 'c_version'"> <template v-if="type === 'version' || type === 'c_version'">
@ -43,7 +43,7 @@
<i class="icon el-icon-document-checked icon_Stats" /> <i class="icon el-icon-document-checked icon_Stats" />
<span>{{ $t('trials:trials-workbench:auditDocument:menu:setVersion') }}</span> <span>{{ $t('trials:trials-workbench:auditDocument:menu:setVersion') }}</span>
</div> </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" /> <i class="icon el-icon-delete icon_Stats" />
<span>{{ $t('trials:trials-workbench:auditDocument:menu:delVersion') }}</span> <span>{{ $t('trials:trials-workbench:auditDocument:menu:delVersion') }}</span>
</div> </div>
@ -70,11 +70,13 @@ export default {
return { return {
visible: false, visible: false,
type: 'file', type: 'file',
zIndex: 9 zIndex: 9,
rowData: {}
}; };
}, },
methods: { methods: {
init(event, row, type, zIndex = 9) { init(event, row, type, zIndex = 9) {
this.rowData = row
this.type = type this.type = type
this.zIndex = zIndex this.zIndex = zIndex
// //
@ -102,7 +104,7 @@ export default {
this.$emit("foo"); this.$emit("foo");
}, },
handleMenu(item) { 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="auditDocumentDetail">
<div class="header"> <div class="header">
<div class="file_icon"> <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>
<div class="file_name"> <div class="file_name">
<div class="name"> <div class="name">
<span class="name-text">但是决定把尖酸刻薄的喀巴水电局咯不到就案板白沙卡萨丁你卢卡斯拿到了看到了上的尽快把世界第八款不打瞌睡的</span> <span class="name-text">{{ rowData.Name }}</span>
</div> </div>
<div class="desc"> <div class="desc">
<span class="size">100kb</span> <span class="size">{{ formatFileSize(rowData) }}</span>
<span>, </span> <span v-if="rowData.AuditDocumentTypeEnum">, </span>
<span class="time">2025-03-31 15:36</span> <span class="time">{{ rowData.UpdateTime }}</span>
</div> </div>
</div> </div>
</div> </div>
<div class="main"> <div class="main">
<el-tabs v-model="activeName" @tab-click="handleClick"> <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')" <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="versions_top">
<div class="title">{{ <div class="title">{{
$t('trials:trials-workbench:auditDocument:detail:title:historicalVersion') }} $t('trials:trials-workbench:auditDocument:detail:title:historicalVersion') }}
</div> </div>
<div class="btnBox"> <div class="btnBox">
<el-button icon="el-icon-refresh" circle size="small" /> <el-button icon="el-icon-refresh" circle size="small"
<el-button icon="el-icon-upload2" plain 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') $t('trials:trials-workbench:auditDocument:detail:title:uploadNewVersion')
}}</el-button> }}</el-button>
</div> </div>
</div> </div>
<div class="versions_content"> <div class="versions_content" v-loading="loading">
<div class="item"> <div class="item" v-for="item of versionList" :key="item.Id">
<div class="item_line"> <div class="item_line">
<div class="version current_version"> <div class="version current_version" v-if="item.IsCurrentVersion">
<span>{{ <span>{{
$t('trials:trials-workbench:auditDocument:detail:title:currentVersion') $t('trials:trials-workbench:auditDocument:detail:title:currentVersion')
}}</span> }}</span>
</div> </div>
<div class="mtime">2025-03-31 15:36</div> <div class="version" v-else>
<div class="size">375KB</div> <span>v{{ item.Version }}</span>
<div class="add_desc" @click.stop="openMenu($event, {}, 'c_version')"> </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" /> <i class="el-icon-more" />
</div> </div>
</div> </div>
</div> </div>
<div class="item">
<div class="item_line">
<div class="version">
<span>v1</span>
</div> </div>
<div class="mtime">2025-03-31 15:36</div> </el-tab-pane>
<div class="size">375KB</div> <el-tab-pane :label="$t('trials:trials-workbench:auditDocument:detail:tabs:Stats')" name="Stats"
<div class="add_desc" @click.stop="openMenu($event, {}, 'version')"> v-if="false">
<i class="el-icon-more" /> <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>
<div class="p" v-if="!rowData.AuditDocumentTypeEnum">
<div class="title">{{ $t('trials:trials-workbench:auditDocument:detail:title:contain') }}
</div> </div>
<div class="content">4 (2文件, 2文件夹)</div>
</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> </div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
@ -87,6 +85,7 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { getHistoricalVersion } from '@/api/trials'
export default { export default {
name: "auditDocumentDetail", name: "auditDocumentDetail",
props: { props: {
@ -103,7 +102,21 @@ export default {
}, },
data() { data() {
return { return {
activeName: 'Stats' activeName: 'versions',
versionList: [],
loading: false
}
},
// mounted() {
// this.getHistoricalVersion()
// },
watch: {
rowData: {
handler() {
this.getHistoricalVersion()
},
deep: true,
immediate: true
} }
}, },
methods: { methods: {
@ -113,7 +126,54 @@ export default {
}, },
handleClose() { handleClose() {
this.$emit("update:visible", false) 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> </script>
@ -132,7 +192,7 @@ export default {
.auditDocumentDetail { .auditDocumentDetail {
.header { .header {
padding: 0 20px; padding: 0 10px 10px;
display: flex; display: flex;
align-items: center; align-items: center;
border-bottom: 1px solid #f6f8ff; border-bottom: 1px solid #f6f8ff;
@ -198,13 +258,17 @@ export default {
word-break: break-word; word-break: break-word;
display: table-cell; display: table-cell;
vertical-align: middle; vertical-align: middle;
height: 60px; max-height: 60px;
line-height: 18px; line-height: 18px;
margin-top: 7px; margin-top: 7px;
width: calc(100% - 170px); width: calc(100% - 170px);
display: flex;
align-items: center;
flex-wrap: wrap;
.name { .name {
max-height: 35px; max-height: 35px;
width: 100%;
line-height: 18px; line-height: 18px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;

View File

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