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

uat
wangxiaoshuang 2025-04-07 18:00:10 +08:00
parent fa71af24ad
commit b76d157fca
4 changed files with 307 additions and 26 deletions

View File

@ -4050,4 +4050,20 @@ export function setCurrentVersion(data) {
method: 'post', method: 'post',
data data
}) })
}
// 工作台-稽查文档移动
export function movieFileOrFolder(data) {
return request({
url: `/AuditDocument/movieFileOrFolder`,
method: 'post',
data
})
}
// 工作台-稽查文档复制
export function copyFileOrFolder(data) {
return request({
url: `/AuditDocument/copyFileOrFolder`,
method: 'post',
data
})
} }

BIN
src/assets/stickup.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -7,7 +7,7 @@
<i class="icon el-icon-right icon_open" /> <i class="icon el-icon-right icon_open" />
<span>{{ $t('trials:trials-workbench:auditDocument:menu:open') }}</span> <span>{{ $t('trials:trials-workbench:auditDocument:menu:open') }}</span>
</div> </div>
<div class="contextmenu__item" @click="handleMenu('download')"> <div class="contextmenu__item" @click="handleMenu('downLoad')">
<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>
@ -21,11 +21,15 @@
<i class="icon icon_shear" /> <i class="icon icon_shear" />
<span>{{ $t('trials:trials-workbench:auditDocument:menu:shear') }}</span> <span>{{ $t('trials:trials-workbench:auditDocument:menu:shear') }}</span>
</div> </div>
<div class="contextmenu__item" @click="handleMenu('stickup')" v-if="checkList.length <= 1 && isCopy">
<i class="icon icon_stickup" />
<span>{{ $t('trials:trials-workbench:auditDocument:menu:stickup') }}</span>
</div>
<div class="contextmenu__item" @click="handleMenu('rename')" v-show="checkList.length <= 1"> <div class="contextmenu__item" @click="handleMenu('rename')" v-show="checkList.length <= 1">
<i class="icon icon_rename" /> <i class="icon icon_rename" />
<span>{{ $t('trials:trials-workbench:auditDocument:menu:rename') }}</span> <span>{{ $t('trials:trials-workbench:auditDocument:menu:rename') }}</span>
</div> </div>
<div class="contextmenu__item" @click="handleMenu('del')"> <div class="contextmenu__item" @click="getDataPath('del')">
<i class="icon icon_del" /> <i class="icon icon_del" />
<span>{{ $t('trials:trials-workbench:auditDocument:menu:del') }}</span> <span>{{ $t('trials:trials-workbench:auditDocument:menu:del') }}</span>
</div> </div>
@ -65,6 +69,10 @@ export default {
return [] return []
} }
}, },
isCopy: {
type: Boolean,
default: false
}
}, },
data() { data() {
return { return {
@ -245,4 +253,16 @@ export default {
.icon_Stats { .icon_Stats {
color: #1890ff; color: #1890ff;
} }
/*粘贴*/
.icon_stickup {
color: #1890ff;
display: inline-block;
background-image: url(@/assets/stickup.png);
background-position: 0 0;
background-size: 16px 16px;
background-repeat: no-repeat;
height: 16px;
margin-right: 8px;
}
</style> </style>

View File

@ -36,10 +36,10 @@
<el-button type="primary" @click.stop="openFile(true)"> <el-button type="primary" @click.stop="openFile(true)">
{{ $t('trials:trials-workbench:auditDocument:button:uploadFolder') }} {{ $t('trials:trials-workbench:auditDocument:button:uploadFolder') }}
</el-button> </el-button>
<el-button type="primary"> <el-button type="primary" :disabled="checkList.length <= 0" @click.stop="downLoad(checkList)">
{{ $t('trials:trials-workbench:auditDocument:button:download') }} {{ $t('trials:trials-workbench:auditDocument:button:download') }}
</el-button> </el-button>
<el-button type="primary"> <el-button type="primary" :disabled="checkList.length <= 0" @click.stop="delData(checkList)">
{{ $t('trials:trials-workbench:auditDocument:button:del') }} {{ $t('trials:trials-workbench:auditDocument:button:del') }}
</el-button> </el-button>
</el-form-item> </el-form-item>
@ -54,10 +54,10 @@
</el-breadcrumb-item> </el-breadcrumb-item>
</el-breadcrumb> </el-breadcrumb>
</div> </div>
<el-table :data="tableData" style="width: 99%" row-key="Id" :loading="loading" :row-style="setRowStyle" <el-table id="auditDocumentTable" :data="tableData" style="width: 99%" row-key="Id" :loading="loading"
v-adaptive="{ bottomOffset: 75 }" height="100" :border="true" :expand-row-keys="expandedRows" :row-style="setRowStyle" v-adaptive="{ bottomOffset: 75 }" height="100" :border="true"
:tree-props="{ children: 'Children', hasChildren: 'hasChildren' }" @expand-change="handleExpandChange" :expand-row-keys="expandedRows" :tree-props="{ children: 'Children', hasChildren: 'hasChildren' }"
@row-click="handleRowClick" @cell-mouse-enter="handleCellMouseEnter" @expand-change="handleExpandChange" @row-click="handleRowClick" @cell-mouse-enter="handleCellMouseEnter"
@cell-mouse-leave="handleCellMouseLeave" @row-contextmenu="handleRowContextmenu" @cell-mouse-leave="handleCellMouseLeave" @row-contextmenu="handleRowContextmenu"
@row-dblclick="handleRowDblclick"> @row-dblclick="handleRowDblclick">
<el-table-column prop="date" :label="$t('trials:trials-workbench:auditDocument:table:name')" sortable <el-table-column prop="date" :label="$t('trials:trials-workbench:auditDocument:table:name')" sortable
@ -97,7 +97,7 @@
<el-table-column prop="CreateTime" :label="$t('trials:trials-workbench:auditDocument:table:createTime')"> <el-table-column prop="CreateTime" :label="$t('trials:trials-workbench:auditDocument:table:createTime')">
</el-table-column> </el-table-column>
</el-table> </el-table>
<contextmenu ref="contextmenu" :checkList="checkList" @handleMenu="handleMenu" /> <contextmenu ref="contextmenu" :isCopy="isCopy" :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 ref="versionDetail" v-if="visible" :visible.sync="visible" :rowData="rowData" <detail ref="versionDetail" v-if="visible" :visible.sync="visible" :rowData="rowData"
@ -105,11 +105,12 @@
</div> </div>
</template> </template>
<script> <script>
import { getAuditDocumentData, addAuditDocument, getBreadcrumbData, updateAuditDocument, deleteAuditDocument, setCurrentVersion } from '@/api/trials' import { getAuditDocumentData, addAuditDocument, getBreadcrumbData, updateAuditDocument, deleteAuditDocument, setCurrentVersion, movieFileOrFolder, copyFileOrFolder } 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'
import detail from './detail.vue' import detail from './detail.vue'
import { downLoadFile } from '@/utils/stream.js'
const searchDataDefault = () => { const searchDataDefault = () => {
return { return {
Name: null, Name: null,
@ -128,6 +129,11 @@ export default {
default: false default: false
} }
}, },
computed: {
isCopy() {
return (this.copyList && this.copyList.length > 0) || this.shearList && this.shearList.length > 0
}
},
data() { data() {
return { return {
searchData: searchDataDefault(), searchData: searchDataDefault(),
@ -198,19 +204,168 @@ export default {
console.log(err) console.log(err)
} }
}, },
getData(list, Id) { //
let data = {} async downLoad(list) {
for (let i = 0; i < list.length; i++) { try {
let item = list[i] let arr = this.filterExternalIds(this.tableData, list)
if (item.Id === Id) { if (arr && arr.length === 1) {
data = item let data = this.getData(this.tableData, arr[0])
if (data.AuditDocumentTypeEnum) {
return await downLoadFile(
this.OSSclientConfig.basePath + data.FilePath,
data.Name
)
} else {
let dataArray = this.getDataPath([data])
let files = this.formatDownloadFile(dataArray)
console.log(files, 'files')
let name = `${data.Name}_${new Date().getTime()}.zip`
return await downLoadFile(files, name, 'zip')
}
} else {
let name = null
let id = this.findDeepestCommonParent(this.tableData, arr)
if (id) {
let d = this.getData(this.tableData, id)
name = `${d.Name}_${new Date().getTime()}.zip`
} else {
name = `AuditDocument_${new Date().getTime()}.zip`
}
let data = arr.map(id => this.getData(this.tableData, id))
let dataArray = this.getDataPath(data)
let files = this.formatDownloadFile(dataArray)
return await downLoadFile(files, name, 'zip')
} }
if (item.Children && item.Children.length > 0) { } catch (err) {
data = this.getData(item.Children, Id) console.log(err)
}
},
formatDownloadFile(list) {
let files = []
for (const item of list) {
let obj = {
name: item.Name.split('.')[1] ? item.Path : `${item.Path}.${item.FileFormat}`,
url: this.OSSclientConfig.basePath + item.FilePath
}
files.push(obj)
}
return files
},
findDeepestCommonParent(rootNodes, ids) {
// ID
const nodeMap = new Map();
function buildMap(nodes) {
for (const node of nodes) {
nodeMap.set(node.Id, node);
if (node.Children && node.Children.length > 0) {
buildMap(node.Children);
}
} }
} }
buildMap(rootNodes);
// ID
const paths = [];
for (const id of ids) {
const path = [];
let currentNode = nodeMap.get(id);
if (!currentNode) continue; // ID
//
while (currentNode) {
path.unshift(currentNode.Id); //
const parentId = currentNode.ParentId;
if (parentId === null) break; //
currentNode = nodeMap.get(parentId);
}
paths.push(path);
}
if (paths.length === 0) return null; // ID
//
const findLongestCommonPrefix = (paths) => {
if (paths.length === 0) return [];
let common = paths[0];
for (let i = 1; i < paths.length; i++) {
const currentPath = paths[i];
let j = 0;
while (j < common.length && j < currentPath.length && common[j] === currentPath[j]) {
j++;
}
common = common.slice(0, j);
if (common.length === 0) break;
}
return common;
};
const lcp = findLongestCommonPrefix(paths);
return lcp.length > 0 ? lcp[lcp.length - 1] : null;
},
getDataPath(list, str = '', ARRAY = []) {
for (const item of list) {
console.log(item.AuditDocumentTypeEnum, str)
if (!str) {
item.Path = item.Name
} else {
item.Path = str + '/' + item.Name
}
if (item.AuditDocumentTypeEnum) {
ARRAY.push(item)
continue
} else {
if (item.Children && item.Children.length > 0) {
this.getDataPath(item.Children, item.Path, ARRAY)
}
}
}
return ARRAY
},
getData(list, Id, data = {}) {
for (const item of list) {
if (item.Id === Id) {
data = item
break
} else {
if (item.Children && item.Children.length > 0) {
data = this.getData(item.Children, Id, data)
}
}
}
return data return data
}, },
filterExternalIds(tree, ids) {
if (!tree || tree.length === 0 || !ids || ids.length === 0) return [];
const parentMap = this.buildParentMap(tree);
const idSet = new Set(ids);
const externalIds = new Set();
for (const id of ids) {
let currentId = parentMap.get(id);
while (currentId !== null) {
if (idSet.has(currentId)) {
externalIds.add(currentId);
}
currentId = parentMap.get(currentId);
}
}
return ids.filter(id => !externalIds.has(id));
},
buildParentMap(tree) {
const parentMap = new Map();
const traverse = (node, parentId) => {
parentMap.set(node.Id, parentId);
for (const child of node.Children) {
traverse(child, node.Id);
}
};
for (const root of tree) {
traverse(root, null);
}
return parentMap;
},
handleSearch() { handleSearch() {
this.getList() this.getList()
}, },
@ -219,7 +374,13 @@ export default {
this.getList() this.getList()
}, },
addCheck(row) { addCheck(row) {
this.checkList.push(row.Id) let index = this.checkList.indexOf(row.Id)
if (!!~index) {
this.checkList.splice(index, 1)
} else {
this.checkList.push(row.Id)
}
}, },
addRenameId(row) { addRenameId(row) {
this.renameId = row.Id this.renameId = row.Id
@ -283,6 +444,42 @@ export default {
console.log(err) console.log(err)
} }
}, },
//
async copyData(list) {
try {
let DATA = this.getData(this.tableData, this.checkList[0])
let Ids = this.filterExternalIds(this.tableData, list)
let data = {
Ids: Ids,
ParentId: DATA.AuditDocumentTypeEnum ? DATA.ParentId : DATA.Id
}
let res = await copyFileOrFolder(data)
if (res.IsSuccess) {
this.getList()
this.copyList = []
}
} catch (err) {
console.log(err)
}
},
//
async moveData(list) {
try {
let DATA = this.getData(this.tableData, this.checkList[0])
let Ids = this.filterExternalIds(this.tableData, list)
let data = {
Ids: Ids,
ParentId: DATA.AuditDocumentTypeEnum ? DATA.ParentId : DATA.Id
}
let res = await movieFileOrFolder(data)
if (res.IsSuccess) {
this.getList()
this.shearList = []
}
} catch (err) {
console.log(err)
}
},
// //
async delData(Ids) { async delData(Ids) {
try { try {
@ -498,7 +695,7 @@ 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, {}, e)
if (this.checkList.length > 1) return this.$refs.contextmenu.init(e, row, 'files') if (this.checkList.length > 1) return this.$refs.contextmenu.init(e, row, 'files')
if (!row.AuditDocumentTypeEnum) return this.$refs.contextmenu.init(e, row, 'folder') 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')
@ -513,14 +710,30 @@ export default {
} }
}, },
// //
handleRowClick(row) { handleRowClick(row, column, e) {
e.stopPropagation();
this.rowData = row this.rowData = row
let index = this.checkList.indexOf(row.Id)
if (this.ctrlKey) { if (this.ctrlKey) {
this.checkList.push(row.Id) if (!!~index) {
this.checkList.splice(index, 1)
} else {
this.checkList.push(row.Id)
}
} else { } else {
this.checkList = [row.Id] if (this.checkList.length > 1 || this.checkList.length <= 0) {
this.checkList = [row.Id]
} else {
if (!!~index) {
this.checkList.splice(index, 1)
} else {
this.checkList = [row.Id]
}
}
} }
}, },
// hover // hover
handleCellMouseEnter(row) { handleCellMouseEnter(row) {
@ -561,6 +774,18 @@ export default {
if (key === 'setVersion') { if (key === 'setVersion') {
this.setCurrentVersion(row.Id) this.setCurrentVersion(row.Id)
} }
if (key === 'copy') {
this.copy()
}
if (key === 'shear') {
this.shear()
}
if (key === 'stickup') {
this.stickup()
}
if (key === 'downLoad') {
this.downLoad(this.checkList)
}
}, },
setRowStyle({ row, rowIndex }) { setRowStyle({ row, rowIndex }) {
if (this.checkList.includes(row.Id)) { if (this.checkList.includes(row.Id)) {
@ -570,11 +795,26 @@ export default {
} }
}, },
// //
copy() { }, copy() {
if (!this.checkList || this.checkList.length <= 0) return this.$message.warning(this.$t("trials:trials-workbench:auditDocument:message:nothingCopy"))
this.copyList = [...this.checkList]
this.shearList = []
this.$message.success(this.$t("trials:trials-workbench:auditDocument:message:copySuccess"))
},
// //
shear() { }, shear() {
if (!this.checkList || this.checkList.length <= 0) return this.$message.warning(this.$t("trials:trials-workbench:auditDocument:message:nothingShear"))
this.shearList = [...this.checkList]
this.copyList = []
this.$message.success(this.$t("trials:trials-workbench:auditDocument:message:shearSuccess"))
},
// //
stickup() { }, stickup() {
if (this.checkList.length > 1) return this.$message.warning(this.$t("trials:trials-workbench:auditDocument:message:stickupCheckDataMore"))
if (this.shearList && this.shearList.length > 0) return this.moveData(this.shearList)
if (this.copyList && this.copyList.length > 0) return this.copyData(this.copyList)
},
// //
keydown(e) { keydown(e) {
this.ctrlKey = e.ctrlKey this.ctrlKey = e.ctrlKey
@ -600,11 +840,16 @@ export default {
// //
keyup(e) { keyup(e) {
this.ctrlKey = e.ctrlKey this.ctrlKey = e.ctrlKey
},
docClick() {
this.checkList = []
} }
}, },
mounted() { mounted() {
document.addEventListener('keydown', this.keydown); document.addEventListener('keydown', this.keydown);
document.addEventListener('keyup', this.keyup); document.addEventListener('keyup', this.keyup);
let table = document.getElementById("auditDocumentTable")
table.addEventListener('click', this.docClick);
this.getList() this.getList()
this.getBreadcrumbData() this.getBreadcrumbData()
}, },