稽查文档排序、新增文件夹更换接口
continuous-integration/drone/push Build is passing Details

uat
wangxiaoshuang 2025-04-10 13:27:10 +08:00
parent 0d446746e6
commit ab058d6659
2 changed files with 116 additions and 75 deletions

View File

@ -4102,3 +4102,11 @@ export function setIsAuthorization(data) {
data data
}) })
} }
// 工作台-稽查文档新增文件夹
export function addFolder(data) {
return request({
url: `/AuditDocument/addFolder`,
method: 'post',
data
})
}

View File

@ -61,11 +61,11 @@
<el-table id="auditDocumentTable" ref="auditDocumentTable" :data="tableData" style="width: 99%" row-key="Id" <el-table id="auditDocumentTable" ref="auditDocumentTable" :data="tableData" style="width: 99%" row-key="Id"
:loading="loading" :row-style="setRowStyle" v-adaptive="{ bottomOffset: 75 }" height="100" :border="true" :loading="loading" :row-style="setRowStyle" v-adaptive="{ bottomOffset: 75 }" height="100" :border="true"
:expand-row-keys="expandedRows" :tree-props="{ children: 'Children', hasChildren: 'hasChildren' }" :expand-row-keys="expandedRows" :tree-props="{ children: 'Children', hasChildren: 'hasChildren' }"
@expand-change="handleExpandChange" @row-click="handleRowClick" @cell-mouse-enter="handleCellMouseEnter" @sort-change="handleSortByColumn" @expand-change="handleExpandChange" @row-click="handleRowClick"
@cell-mouse-leave="handleCellMouseLeave" @row-contextmenu="handleRowContextmenu" @cell-mouse-enter="handleCellMouseEnter" @cell-mouse-leave="handleCellMouseLeave"
@row-dblclick="handleRowDblclick"> @row-contextmenu="handleRowContextmenu" @row-dblclick="handleRowDblclick">
<el-table-column prop="date" :label="$t('trials:trials-workbench:auditDocument:table:name')" sortable <el-table-column prop="Name" :label="$t('trials:trials-workbench:auditDocument:table:name')"
min-width="300" class-name="catalogue_box"> sortable="custom" min-width="300" class-name="catalogue_box">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="name_layout_box"> <div class="name_layout_box">
<div class="name_layout" v-if="renameId !== scope.row.Id"> <div class="name_layout" v-if="renameId !== scope.row.Id">
@ -100,7 +100,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="IsAuthorization" <el-table-column prop="IsAuthorization"
:label="$t('trials:trials-workbench:auditDocument:table:IsAuthorization')" show-overflow-tooltip :label="$t('trials:trials-workbench:auditDocument:table:IsAuthorization')" show-overflow-tooltip
sortable="custom" v-if="isManage"> v-if="isManage">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch v-model="scope.row.IsAuthorization" @change="(val) => auth(false, scope.row, val)" <el-switch v-model="scope.row.IsAuthorization" @change="(val) => auth(false, scope.row, val)"
:active-value="true" :inactive-value="false" :active-text="$fd('YesOrNo', true)" :active-value="true" :inactive-value="false" :active-text="$fd('YesOrNo', true)"
@ -130,7 +130,7 @@
</div> </div>
</template> </template>
<script> <script>
import { getAuditDocumentData, addAuditDocument, getBreadcrumbData, updateAuditDocument, deleteAuditDocument, setCurrentVersion, movieFileOrFolder, copyFileOrFolder, setIsAuthorization } from '@/api/trials' import { getAuditDocumentData, addAuditDocument, getBreadcrumbData, updateAuditDocument, deleteAuditDocument, setCurrentVersion, movieFileOrFolder, copyFileOrFolder, setIsAuthorization, addFolder } 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'
@ -139,10 +139,10 @@ import { downLoadFile } from '@/utils/stream.js'
const searchDataDefault = () => { const searchDataDefault = () => {
return { return {
Name: null, Name: null,
pageIndex: 1, PageIndex: 1,
pageSize: 20, PageSize: 20,
asc: false, Asc: false,
sortField: '' SortField: ''
} }
} }
export default { export default {
@ -240,7 +240,7 @@ export default {
// //
addFolder() { addFolder() {
if (!this.isManage) return false if (!this.isManage) return false
let parentData = {}, data = { let data = {
ParentId: null, ParentId: null,
repeat: 0, repeat: 0,
Type: "addFolder", Type: "addFolder",
@ -250,58 +250,68 @@ export default {
Id: `addFolder_${Date.now()}`, Id: `addFolder_${Date.now()}`,
Children: [] Children: []
} }
if (!this.rowData || !this.rowData.Id) { data.ParentId = this.Id
data.ParentId = this.Id this.tableData.forEach(item => {
this.tableData.forEach(item => { if (item.Name === data.Name) {
if (item.Name === data.Name) { data.repeat++;
data.repeat++; data.Name = `${this.$t("trials:trials-workbench:auditDocument:opt:addFloder")}(${data.repeat})`
data.Name = `${this.$t("trials:trials-workbench:auditDocument:opt:addFloder")}(${data.repeat})`
}
})
this.tableData.unshift(data)
this.addRenameId(data)
} else {
if (!this.rowData.AuditDocumentTypeEnum) {
parentData = this.getData(this.tableData, this.rowData.Id)
data.ParentId = parentData.Id
parentData.Children.forEach(item => {
if (item.Name === data.Name) {
data.repeat++;
data.Name = `${this.$t("trials:trials-workbench:auditDocument:opt:addFloder")}(${data.repeat})`
}
})
if (!this.expandedRows.includes(parentData.Id)) {
this.expandedRows.push(parentData.Id)
this.$refs.auditDocumentTable.toggleRowExpansion(parentData, true)
}
parentData.Children.unshift(data)
this.addRenameId(data)
} else {
let fileData = this.getData(this.tableData, this.rowData.Id)
if (fileData.ParentId === this.Id) {
data.ParentId = this.Id
this.tableData.forEach(item => {
if (item.Name === data.Name) {
data.repeat++;
data.Name = `${this.$t("trials:trials-workbench:auditDocument:opt:addFloder")}(${data.repeat})`
}
})
this.tableData.unshift(data)
this.addRenameId(data)
} else {
parentData = this.getData(this.tableData, this.fileData.ParentId)
data.ParentId = parentData.Id
parentData.Children.forEach(item => {
if (item.Name === data.Name) {
data.repeat++;
data.Name = `${this.$t("trials:trials-workbench:auditDocument:opt:addFloder")}(${data.repeat})`
}
})
parentData.Children.unshift(data)
this.addRenameId(data)
}
} }
} })
this.tableData.unshift(data)
this.addRenameId(data)
// let parentData = {}
// if (!this.rowData || !this.rowData.Id) {
// data.ParentId = this.Id
// this.tableData.forEach(item => {
// if (item.Name === data.Name) {
// data.repeat++;
// data.Name = `${this.$t("trials:trials-workbench:auditDocument:opt:addFloder")}(${data.repeat})`
// }
// })
// this.tableData.unshift(data)
// this.addRenameId(data)
// } else {
// if (!this.rowData.AuditDocumentTypeEnum) {
// parentData = this.getData(this.tableData, this.rowData.Id)
// data.ParentId = parentData.Id
// parentData.Children.forEach(item => {
// if (item.Name === data.Name) {
// data.repeat++;
// data.Name = `${this.$t("trials:trials-workbench:auditDocument:opt:addFloder")}(${data.repeat})`
// }
// })
// if (!this.expandedRows.includes(parentData.Id)) {
// this.expandedRows.push(parentData.Id)
// this.$refs.auditDocumentTable.toggleRowExpansion(parentData, true)
// }
// parentData.Children.unshift(data)
// this.addRenameId(data)
// } else {
// let fileData = this.getData(this.tableData, this.rowData.Id)
// if (fileData.ParentId === this.Id) {
// data.ParentId = this.Id
// this.tableData.forEach(item => {
// if (item.Name === data.Name) {
// data.repeat++;
// data.Name = `${this.$t("trials:trials-workbench:auditDocument:opt:addFloder")}(${data.repeat})`
// }
// })
// this.tableData.unshift(data)
// this.addRenameId(data)
// } else {
// parentData = this.getData(this.tableData, this.fileData.ParentId)
// data.ParentId = parentData.Id
// parentData.Children.forEach(item => {
// if (item.Name === data.Name) {
// data.repeat++;
// data.Name = `${this.$t("trials:trials-workbench:auditDocument:opt:addFloder")}(${data.repeat})`
// }
// })
// parentData.Children.unshift(data)
// this.addRenameId(data)
// }
// }
// }
}, },
// //
async getBreadcrumbData() { async getBreadcrumbData() {
@ -340,6 +350,16 @@ export default {
console.log(err) console.log(err)
} }
}, },
//
handleSortByColumn(column) {
if (column.order === 'ascending') {
this.searchData.asc = true
} else {
this.searchData.asc = false
}
this.searchData.sortField = column.prop
this.getList()
},
// //
async downLoad(list) { async downLoad(list) {
if (!this.isManage) return false if (!this.isManage) return false
@ -532,11 +552,15 @@ export default {
async rename(row) { async rename(row) {
if (!this.isManage) return false if (!this.isManage) return false
try { try {
if (!row.Name) {
this.$message.warning(this.$t("trials:trials-workbench:auditDocument:noFolderName"))
return this.addRenameId(row)
}
this.renameId = null this.renameId = null
if (row.Type === 'addFolder') { if (row.Type === 'addFolder') {
delete row.Id delete row.Id
let data = [row] let data = row
let res = await addAuditDocument(JSON.stringify(data)) let res = await addFolder(data)
if (res.IsSuccess) { if (res.IsSuccess) {
this.getList() this.getList()
} }
@ -544,7 +568,10 @@ export default {
this.updateData(row) this.updateData(row)
} }
} catch (err) { } catch (err) {
console.log(rtt) if (row.Type === 'addFolder') {
this.getList()
}
console.log(err)
} }
}, },
@ -696,13 +723,13 @@ export default {
} else { } else {
data = this.formatData(list) data = this.formatData(list)
let ParentId = this.Id let ParentId = this.Id
if (this.rowData && this.rowData.Id) { // if (this.rowData && this.rowData.Id) {
if (this.rowData.AuditDocumentTypeEnum) { // if (this.rowData.AuditDocumentTypeEnum) {
ParentId = this.rowData.ParentId // ParentId = this.rowData.ParentId
} else { // } else {
ParentId = this.rowData.Id // ParentId = this.rowData.Id
} // }
} // }
data.forEach(item => { data.forEach(item => {
item.ParentId = ParentId item.ParentId = ParentId
}) })
@ -866,8 +893,7 @@ export default {
}, },
// //
perview(data) { perview(data) {
if (['.pdf', if (['.ppt',
'.ppt',
'.pptx', '.pptx',
'.doc', '.doc',
'.docx', '.docx',
@ -884,6 +910,13 @@ export default {
'.png'].includes(`.${data.FileFormat.toLowerCase()}`)) { '.png'].includes(`.${data.FileFormat.toLowerCase()}`)) {
this.$refs['picture_perview'].$viewer.show() this.$refs['picture_perview'].$viewer.show()
} }
if (['.pdf'].includes(`.${data.FileFormat.toLowerCase()}`)) {
this.$preview({
path: data.Path || data.FilePath,
type: 'pdf',
title: data.Name,
})
}
}, },
// //