Merge branch 'main' of https://gitea.frp.extimaging.com/XCKJ/irc_web into main
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
b5b5830b1f
|
@ -1155,3 +1155,50 @@ export function deleteTrialFinalRecord(id) {
|
|||
method: 'delete',
|
||||
})
|
||||
}
|
||||
// 项目文档-一般文件记录列表
|
||||
export function getTrialNormalRecordList(data) {
|
||||
return request({
|
||||
url: `/TrialNormalRecord/getTrialNormalRecordList`,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
// 项目文档-一般文件记录授权
|
||||
export function authorizedTTrialNormalRecord(data) {
|
||||
return request({
|
||||
url: `/TrialNormalRecord/authorizedTTrialNormalRecord`,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
// 项目文档-一般文件记录批量新增
|
||||
export function batchAddTrialNormalRecord(data) {
|
||||
return request({
|
||||
url: `/TrialNormalRecord/batchAddTrialNormalRecord`,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
// 项目文档-一般文件记录新增/修改
|
||||
export function addOrUpdateTrialNormalRecord(data) {
|
||||
return request({
|
||||
url: `/TrialNormalRecord/addOrUpdateTrialNormalRecord`,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
// 项目文档-删除一般文件记录
|
||||
export function deleteTrialNormalRecord(id) {
|
||||
return request({
|
||||
url: `/TrialNormalRecord/deleteTrialNormalRecord/${id}`,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
// 项目文档-批量删除一般文件记录
|
||||
export function deleteTrialNormalRecordList(data) {
|
||||
return request({
|
||||
url: `/TrialNormalRecord/deleteTrialNormalRecordList`,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
|
|
@ -41,7 +41,13 @@ async function ossGenerateSTS() {
|
|||
let _vm = router.default.app
|
||||
if (_vm._route.path !== '/trials/trials-panel/visit/crc-upload') {
|
||||
var objectItem = objectName.split('/')
|
||||
objectItem[objectItem.length - 1] = new Date().getTime() + '_' + objectItem[objectItem.length - 1]
|
||||
// objectItem[objectItem.length - 1] = new Date().getTime() + '_' + objectItem[objectItem.length - 1]
|
||||
objectItem[objectItem.length - 1] = `${objectItem[objectItem.length - 1].substring(
|
||||
0,
|
||||
objectItem[objectItem.length - 1].lastIndexOf('.')
|
||||
)}__${new Date().getTime()}${objectItem[objectItem.length - 1].substring(
|
||||
objectItem[objectItem.length - 1].lastIndexOf('.')
|
||||
).toLocaleLowerCase()}`
|
||||
objectName = objectItem.join('/')
|
||||
}
|
||||
let res = await OSSclient.put(objectName, object)
|
||||
|
@ -78,7 +84,13 @@ async function ossGenerateSTS() {
|
|||
let _vm = router.default.app
|
||||
if (_vm._route.path !== '/trials/trials-panel/visit/crc-upload') {
|
||||
var objectItem = data.path.split('/')
|
||||
objectItem[objectItem.length - 1] = new Date().getTime() + '_' + objectItem[objectItem.length - 1]
|
||||
// objectItem[objectItem.length - 1] = new Date().getTime() + '_' + objectItem[objectItem.length - 1]
|
||||
objectItem[objectItem.length - 1] = `${objectItem[objectItem.length - 1].substring(
|
||||
0,
|
||||
objectItem[objectItem.length - 1].lastIndexOf('.')
|
||||
)}__${new Date().getTime()}${objectItem[objectItem.length - 1].substring(
|
||||
objectItem[objectItem.length - 1].lastIndexOf('.')
|
||||
).toLocaleLowerCase()}`
|
||||
data.path = objectItem.join('/')
|
||||
}
|
||||
let res = await customerHttp(OSSclient, data, progress);
|
||||
|
@ -185,7 +197,13 @@ function uploadAWS(aws, data, progress) {
|
|||
let _vm = router.default.app
|
||||
if (_vm._route.path !== '/trials/trials-panel/visit/crc-upload') {
|
||||
var objectItem = data.path.split('/')
|
||||
objectItem[objectItem.length - 1] = new Date().getTime() + '_' + objectItem[objectItem.length - 1]
|
||||
// objectItem[objectItem.length - 1] = new Date().getTime() + '_' + objectItem[objectItem.length - 1]
|
||||
objectItem[objectItem.length - 1] = `${objectItem[objectItem.length - 1].substring(
|
||||
0,
|
||||
objectItem[objectItem.length - 1].lastIndexOf('.')
|
||||
)}__${new Date().getTime()}${objectItem[objectItem.length - 1].substring(
|
||||
objectItem[objectItem.length - 1].lastIndexOf('.')
|
||||
).toLocaleLowerCase()}`
|
||||
data.path = objectItem.join('/')
|
||||
}
|
||||
let bucketName = data.path.split("/")[1] || Vue.prototype.OSSclientConfig.bucket
|
||||
|
|
|
@ -58,7 +58,7 @@ async function updateFile(file, name) {
|
|||
try {
|
||||
store.dispatch('trials/setUnLock', true)
|
||||
const fileOutputStream = streamSaver.createWriteStream(name);
|
||||
file = decodeUtf8(file);
|
||||
// file = decodeUtf8(file);
|
||||
let res = await fetch(file);
|
||||
res.body.pipeTo(fileOutputStream).then(() => {
|
||||
store.dispatch('trials/setUnLock', true)
|
||||
|
|
|
@ -0,0 +1,850 @@
|
|||
<template>
|
||||
<box-content>
|
||||
<div class="title">
|
||||
{{ TITLE }}
|
||||
</div>
|
||||
<el-form :inline="true" size="mini" class="base-search-form">
|
||||
<el-form-item
|
||||
:label="$t('trials:trialDocument:fileRecord:form:isConfirmRecord')"
|
||||
v-if="isManage && hasEdit && !viewStatus"
|
||||
>
|
||||
<el-radio-group
|
||||
v-model="rowData.IsConfirmRecord"
|
||||
:disabled="rowBtnStatus === 'edit'"
|
||||
>
|
||||
<el-radio
|
||||
:label="item.value"
|
||||
v-for="item in $d.YesOrNo"
|
||||
:key="item.id"
|
||||
>{{ item.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('trials:trialDocument:fileRecord:form:isEnable')"
|
||||
v-if="isManage && hasEdit && !viewStatus"
|
||||
>
|
||||
<el-radio-group
|
||||
v-model="rowData.IsEnable"
|
||||
:disabled="rowBtnStatus === 'edit'"
|
||||
>
|
||||
<el-radio
|
||||
:label="item.value"
|
||||
v-for="item in $d.YesOrNo"
|
||||
:key="item.id"
|
||||
>{{ item.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="isManage && hasEdit && !viewStatus">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="rowBtnStatus = 'save'"
|
||||
v-if="rowBtnStatus === 'edit'"
|
||||
>
|
||||
{{ $t('common:button:edit') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
:loading="rowBtnLoading"
|
||||
@click="saveRowData"
|
||||
v-if="rowBtnStatus === 'save'"
|
||||
>
|
||||
{{ $t('common:button:save') }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 搜索框 -->
|
||||
<div class="search" style="position: relative">
|
||||
<el-form :inline="true" size="mini" class="base-search-form">
|
||||
<el-form-item
|
||||
:label="$t('trials:trialDocument:fileRecord:search:name')"
|
||||
>
|
||||
<el-input
|
||||
v-model="searchData.FileName"
|
||||
style="width: 100px"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('trials:trialDocument:fileRecord:search:isAuthorizedView')"
|
||||
v-if="isManage && !viewStatus"
|
||||
>
|
||||
<el-select
|
||||
v-if="!viewStatus"
|
||||
v-model="searchData.IsAuthorizedView"
|
||||
style="width: 100px"
|
||||
placeholder=""
|
||||
>
|
||||
<el-option
|
||||
v-for="item in $d.YesOrNo"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleSearch">
|
||||
{{ $t('common:button:search') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-refresh-left"
|
||||
@click="handleReset"
|
||||
>
|
||||
{{ $t('common:button:reset') }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div
|
||||
v-if="isManage && !viewStatus"
|
||||
style="position: absolute; top: 0; right: 0"
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="selectTable.length <= 0"
|
||||
size="mini"
|
||||
v-if="hasAccredit"
|
||||
@click.stop="auth"
|
||||
>
|
||||
{{ $t('trials:trialDocument:fileRecord:button:accredit') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
v-if="hasEdit"
|
||||
@click.stop="openFile(false)"
|
||||
>
|
||||
{{ $t('trials:trialDocument:fileRecord:button:uploadFile') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
v-if="hasEdit"
|
||||
@click.stop="openFile(true)"
|
||||
>
|
||||
{{ $t('trials:trialDocument:fileRecord:button:uploadFolder') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-bottom"
|
||||
size="mini"
|
||||
:disabled="selectTable.length <= 0"
|
||||
v-if="hasDownLoad"
|
||||
@click.stop="downLoad"
|
||||
>
|
||||
{{ $t('trials:trialDocument:fileRecord:button:downLoad') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
v-if="hasDel"
|
||||
:disabled="selectTable.length <= 0"
|
||||
@click.stop="delList"
|
||||
>
|
||||
{{ $t('trials:trialDocument:fileRecord:button:del') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
v-adaptive="{ bottomOffset: 75 }"
|
||||
:data="list"
|
||||
stripe
|
||||
height="100"
|
||||
style="width: 100%"
|
||||
@sort-change="handleSortByColumn"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
|
||||
<!--名称-->
|
||||
<el-table-column
|
||||
prop="FileName"
|
||||
:label="$t('trials:trialDocument:fileRecord:table:name')"
|
||||
show-overflow-tooltip
|
||||
sortable="custom"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<div
|
||||
v-if="
|
||||
scope.row.TrialFileRecord &&
|
||||
scope.row.TrialFileRecord.TrialFileTypeId
|
||||
"
|
||||
style="display: flex; align-items: center"
|
||||
>
|
||||
<span class="fileName">{{
|
||||
scope.row.TrialFileRecord.FileName
|
||||
}}</span>
|
||||
<div v-if="isManage && !viewStatus" class="fileBtnBox">
|
||||
<i
|
||||
class="el-icon-view"
|
||||
@click.stop="preview(scope.row.TrialFileRecord)"
|
||||
/>
|
||||
<i
|
||||
class="el-icon-download"
|
||||
v-if="hasDownLoad"
|
||||
@click.stop="downLoad(false, scope.row.TrialFileRecord, 'file')"
|
||||
/>
|
||||
<i
|
||||
class="el-icon-delete"
|
||||
v-if="hasDel"
|
||||
@click.stop="delFile(scope.row, 'Trial')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<i
|
||||
v-else-if="isManage && !viewStatus && hasEdit"
|
||||
class="el-icon-upload2"
|
||||
style="cursor: pointer; color: #409eff"
|
||||
@click.stop="upload(scope.row, 'Trial', ['.pdf'])"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="fileType"
|
||||
:label="$t('trials:trialDocument:fileRecord:table:fileType')"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.TrialFileRecord">{{
|
||||
scope.row.TrialFileRecord.FileFormat
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="fileType"
|
||||
:label="$t('trials:trialDocument:fileRecord:table:fileSize')"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.TrialFileRecord">{{
|
||||
scope.row.TrialFileRecord.FileSize
|
||||
? fileSizeFormatter(scope.row.TrialFileRecord.FileSize)
|
||||
: ''
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!--历史记录-->
|
||||
<el-table-column
|
||||
prop="HistoryFileRecord"
|
||||
:label="$t('trials:trialDocument:fileRecord:table:historyFileRecord')"
|
||||
show-overflow-tooltip
|
||||
sortable="custom"
|
||||
v-if="isManage && !viewStatus"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<div
|
||||
v-if="
|
||||
scope.row.HistoryFileRecord &&
|
||||
scope.row.HistoryFileRecord.TrialFileTypeId
|
||||
"
|
||||
style="display: flex; align-items: center"
|
||||
>
|
||||
<span class="fileName">{{
|
||||
scope.row.HistoryFileRecord.FileName
|
||||
}}</span>
|
||||
<div v-if="isManage && !viewStatus" class="fileBtnBox">
|
||||
<i
|
||||
class="el-icon-download"
|
||||
v-if="hasDownLoad"
|
||||
@click.stop="
|
||||
downLoad(false, scope.row.HistoryFileRecord, 'file')
|
||||
"
|
||||
/>
|
||||
<i
|
||||
class="el-icon-delete"
|
||||
v-if="hasDel"
|
||||
@click.stop="delFile(scope.row, 'History')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<i
|
||||
v-else-if="isManage && !viewStatus"
|
||||
class="el-icon-upload2"
|
||||
style="cursor: pointer; color: #409eff"
|
||||
@click.stop="upload(scope.row, 'History', ['.zip'])"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="IsAuthorizedView"
|
||||
:label="$t('trials:trialDocument:fileRecord:table:isAuthorizedView')"
|
||||
show-overflow-tooltip
|
||||
sortable="custom"
|
||||
v-if="isManage && !viewStatus"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
v-if="isManage && !viewStatus && hasEdit"
|
||||
v-model="scope.row.IsAuthorizedView"
|
||||
@change="(val) => auth(false, scope.row, val)"
|
||||
:active-value="true"
|
||||
:inactive-value="false"
|
||||
:active-text="$fd('YesOrNo', true)"
|
||||
:inactive-text="$fd('YesOrNo', false)"
|
||||
>
|
||||
</el-switch>
|
||||
<span v-else>{{ $fd('YesOrNo', scope.row.IsAuthorizedView) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="UpdateTime"
|
||||
:label="$t('trials:trialDocument:fileRecord:table:updateTime')"
|
||||
show-overflow-tooltip
|
||||
sortable="custom"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="CreateTime"
|
||||
:label="$t('trials:trialDocument:fileRecord:table:createTime')"
|
||||
show-overflow-tooltip
|
||||
sortable="custom"
|
||||
/>
|
||||
<el-table-column
|
||||
:label="$t('common:action:action')"
|
||||
width="200"
|
||||
fixed="right"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
icon="el-icon-view"
|
||||
:title="$t('common:button:view')"
|
||||
size="mini"
|
||||
circle
|
||||
:disabled="
|
||||
!scope.row.TrialFileRecord || !scope.row.TrialFileRecord.FilePath
|
||||
"
|
||||
@click.stop="preview(scope.row.TrialFileRecord)"
|
||||
/>
|
||||
<el-button
|
||||
v-if="hasDownLoad && isManage && !viewStatus"
|
||||
icon="el-icon-download"
|
||||
:title="$t('trials:trialDocument:fileRecord:button:download')"
|
||||
size="mini"
|
||||
circle
|
||||
@click.stop="downLoad(false, scope.row.TrialFileRecord, 'file')"
|
||||
/>
|
||||
<el-button
|
||||
v-if="hasDel && isManage && !viewStatus"
|
||||
icon="el-icon-delete"
|
||||
:title="$t('trials:trialDocument:fileRecord:button:delete')"
|
||||
size="mini"
|
||||
circle
|
||||
@click.stop="handleDel(scope.row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<pagination
|
||||
class="page"
|
||||
:total="total"
|
||||
:page.sync="searchData.PageIndex"
|
||||
:limit.sync="searchData.PageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<upload-files
|
||||
:config="config"
|
||||
:faccept="faccept"
|
||||
:uploadPath="uploadPath"
|
||||
:limitLength="limitLength"
|
||||
v-if="config.visible"
|
||||
@close="close"
|
||||
@uplaodFile="uplaodFile"
|
||||
/>
|
||||
</box-content>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
addOrUpdateTrialFileType,
|
||||
getTrialNormalRecordList,
|
||||
deleteTrialNormalRecord,
|
||||
authorizedTTrialNormalRecord,
|
||||
addOrUpdateTrialNormalRecord,
|
||||
batchAddTrialNormalRecord,
|
||||
deleteTrialNormalRecordList,
|
||||
} from '@/api/dictionary'
|
||||
import { downLoadFile } from '@/utils/stream.js'
|
||||
import { deepClone } from '@/utils/index.js'
|
||||
import Pagination from '@/components/Pagination'
|
||||
import BoxContent from '@/components/BoxContent'
|
||||
import uploadFiles from '../uploadFiles.vue'
|
||||
const searchDataDefault = () => {
|
||||
return {
|
||||
IsAuthorizedView: null,
|
||||
FileName: null,
|
||||
PageIndex: 1,
|
||||
PageSize: 20,
|
||||
Asc: false,
|
||||
SortField: 'FileName',
|
||||
}
|
||||
}
|
||||
export default {
|
||||
name: 'fileRecord',
|
||||
components: { BoxContent, Pagination, uploadFiles },
|
||||
props: {
|
||||
viewStatus: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
ArchiveTypeEnum: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
Id: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
rowData: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
rowBtnStatus: 'edit', // edit 编辑 save 保存
|
||||
rowBtnLoading: false,
|
||||
searchData: searchDataDefault(),
|
||||
loading: false,
|
||||
list: [],
|
||||
total: 0,
|
||||
selectTable: [],
|
||||
config: {
|
||||
visible: false,
|
||||
showClose: true,
|
||||
width: '800px',
|
||||
title: '',
|
||||
appendToBody: false,
|
||||
isFolder: false,
|
||||
},
|
||||
selectData: {},
|
||||
selectKey: null,
|
||||
uploadPath: null,
|
||||
faccept: ['.pdf'],
|
||||
limitLength: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 新增列表数据
|
||||
async uplaodFile(list) {
|
||||
console.log(list, 'list')
|
||||
try {
|
||||
if (!list || list.length <= 0) return false
|
||||
if (this.selectKey) {
|
||||
this.selectData[`${this.selectKey}FileRecord`] = list[0]
|
||||
this.loading = true
|
||||
let res = await addOrUpdateTrialNormalRecord(this.selectData)
|
||||
this.loading = false
|
||||
if (res.IsSuccess) {
|
||||
this.getList()
|
||||
}
|
||||
return false
|
||||
}
|
||||
let arr = []
|
||||
list.forEach((item) => {
|
||||
let obj = {
|
||||
TrialId: this.$route.query.trialId,
|
||||
TrialFileTypeId: this.Id,
|
||||
IsAuthorizedView: true,
|
||||
TrialFileRecord: item,
|
||||
HistoryFileRecord: null,
|
||||
}
|
||||
arr.push(obj)
|
||||
})
|
||||
this.loading = true
|
||||
let res = await batchAddTrialNormalRecord({
|
||||
TrialNormalRecordList: arr,
|
||||
})
|
||||
this.loading = false
|
||||
if (res.IsSuccess) {
|
||||
this.getList()
|
||||
}
|
||||
} catch (err) {
|
||||
this.loading = false
|
||||
console.log(err)
|
||||
}
|
||||
},
|
||||
// 上传单个文件
|
||||
upload(row, key, faccept = []) {
|
||||
this.faccept = faccept
|
||||
this.selectData = deepClone(row)
|
||||
this.config.title = this.$t(
|
||||
'trials:trialDocument:fileRecord:form:title:uploadFile'
|
||||
)
|
||||
this.limitLength = 1
|
||||
this.selectKey = key
|
||||
this.config.visible = true
|
||||
this.config.isFolder = false
|
||||
},
|
||||
// 删除文件
|
||||
async delFile(row, key) {
|
||||
try {
|
||||
let confirm = await this.$confirm(
|
||||
this.$t('trials:trialDocument:fileRecord:message:deleteFile'),
|
||||
{
|
||||
type: 'warning',
|
||||
distinguishCancelAndClose: true,
|
||||
}
|
||||
)
|
||||
if (confirm !== 'confirm') return false
|
||||
let data = deepClone(row)
|
||||
data[`${key}FileRecord`] = null
|
||||
this.loading = true
|
||||
let res = await addOrUpdateTrialNormalRecord(data)
|
||||
this.loading = false
|
||||
if (res.IsSuccess) {
|
||||
this.$message.success(this.$t('common:message:deletedSuccessfully'))
|
||||
this.getList()
|
||||
}
|
||||
} catch (err) {
|
||||
this.loading = false
|
||||
console.log(err)
|
||||
}
|
||||
},
|
||||
// 下载
|
||||
async downLoad(isArray = true, row, type = 'zip') {
|
||||
try {
|
||||
if (type === 'file') {
|
||||
return await downLoadFile(
|
||||
this.OSSclientConfig.basePath + row.FilePath,
|
||||
row.FileName
|
||||
)
|
||||
}
|
||||
let { files, name } = this.formatDownloadFile(isArray, row)
|
||||
let res = await downLoadFile(files, name, type)
|
||||
// if (res && this.downloadId) {
|
||||
// this.downloadImageSuccess()
|
||||
// }
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
},
|
||||
// 格式化下载文件路径
|
||||
formatDownloadFile(isArray = true, row) {
|
||||
let files = [],
|
||||
name = `${this.TITLE}_${new Date().getTime()}.zip`,
|
||||
arr = ['Trial', 'History']
|
||||
if (!isArray) {
|
||||
name = `${row.Name}_${row.Version}_${new Date().getTime()}.zip`
|
||||
arr.forEach((key) => {
|
||||
if (row[`${key}FileRecord`] && row[`${key}FileRecord`].FilePath) {
|
||||
let obj = {
|
||||
name: `${row[`${key}FileRecord`].FileName.substring(
|
||||
0,
|
||||
row[`${key}FileRecord`].FileName.lastIndexOf('.')
|
||||
)}__${row.Version}${row[`${key}FileRecord`].FileName.substring(
|
||||
row[`${key}FileRecord`].FileName.lastIndexOf('.')
|
||||
).toLocaleLowerCase()}`,
|
||||
url:
|
||||
this.OSSclientConfig.basePath +
|
||||
row[`${key}FileRecord`].FilePath,
|
||||
}
|
||||
files.push(obj)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.selectTable.forEach((item) => {
|
||||
arr.forEach((key) => {
|
||||
if (item[`${key}FileRecord`] && item[`${key}FileRecord`].FilePath) {
|
||||
let obj = {
|
||||
name: `${item[`${key}FileRecord`].FileName.substring(
|
||||
0,
|
||||
item[`${key}FileRecord`].FileName.lastIndexOf('.')
|
||||
)}__${new Date().getTime()}${item[
|
||||
`${key}FileRecord`
|
||||
].FileName.substring(
|
||||
item[`${key}FileRecord`].FileName.lastIndexOf('.')
|
||||
).toLocaleLowerCase()}`,
|
||||
url:
|
||||
this.OSSclientConfig.basePath +
|
||||
item[`${key}FileRecord`].FilePath,
|
||||
}
|
||||
files.push(obj)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
return { files, name }
|
||||
},
|
||||
// 授权
|
||||
async auth(isArray = true, row, IsAuthorizedView) {
|
||||
try {
|
||||
let data = {}
|
||||
if (isArray) {
|
||||
data = {
|
||||
Ids: this.selectTable.map((item) => item.Id),
|
||||
IsAuthorizedView: true,
|
||||
}
|
||||
} else {
|
||||
data = {
|
||||
Ids: [row.Id],
|
||||
IsAuthorizedView,
|
||||
}
|
||||
}
|
||||
this.loading = true
|
||||
let res = await authorizedTTrialNormalRecord(data)
|
||||
this.loading = false
|
||||
if (res.IsSuccess) {
|
||||
this.$t('trials:trialDocument:fileRecord:message:authSuccessfully')
|
||||
if (isArray) {
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
this.loading = false
|
||||
if (!isArray) {
|
||||
row.IsAuthorizedView = !row.IsAuthorizedView
|
||||
}
|
||||
console.log(err)
|
||||
}
|
||||
},
|
||||
// 删除列表数据
|
||||
handleDel(row) {
|
||||
this.$confirm(
|
||||
this.$t('trials:trialDocument:fileRecord:message:deleteMessage'),
|
||||
{
|
||||
type: 'warning',
|
||||
distinguishCancelAndClose: true,
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
this.loading = true
|
||||
deleteTrialNormalRecord(row.Id)
|
||||
.then((res) => {
|
||||
this.loading = false
|
||||
if (res.IsSuccess) {
|
||||
this.getList()
|
||||
this.$message.success(
|
||||
this.$t('common:message:deletedSuccessfully')
|
||||
)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
this.loading = false
|
||||
console.log(err)
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
this.loading = false
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
// 批量删除列表数据
|
||||
delList() {
|
||||
this.$confirm(
|
||||
this.$t('trials:trialDocument:fileRecord:message:deleteMessage'),
|
||||
{
|
||||
type: 'warning',
|
||||
distinguishCancelAndClose: true,
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
let data = {
|
||||
Ids: this.selectTable.map((item) => item.Id),
|
||||
}
|
||||
this.loading = true
|
||||
deleteTrialNormalRecordList(data)
|
||||
.then((res) => {
|
||||
this.loading = false
|
||||
if (res.IsSuccess) {
|
||||
this.getList()
|
||||
this.$message.success(
|
||||
this.$t('common:message:deletedSuccessfully')
|
||||
)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
this.loading = false
|
||||
console.log(err)
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
this.loading = false
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
async getList() {
|
||||
try {
|
||||
if (!this.Id) return false
|
||||
this.searchData.TrialFileTypeId = this.Id
|
||||
this.searchData.TrialId = this.$route.query.trialId
|
||||
this.loading = true
|
||||
let res = await getTrialNormalRecordList(this.searchData)
|
||||
this.loading = false
|
||||
if (res.IsSuccess) {
|
||||
this.list = res.Result.CurrentPageData
|
||||
this.total = res.Result.TotalCount
|
||||
}
|
||||
} catch (err) {
|
||||
this.loading = false
|
||||
console.log(err)
|
||||
}
|
||||
},
|
||||
// 查询
|
||||
handleSearch() {
|
||||
this.searchData.PageIndex = 1
|
||||
this.getList()
|
||||
},
|
||||
// 重置
|
||||
handleReset() {
|
||||
this.searchData = searchDataDefault()
|
||||
this.getList()
|
||||
},
|
||||
// 排序
|
||||
handleSortByColumn(column) {
|
||||
if (column.order === 'ascending') {
|
||||
this.searchData.Asc = true
|
||||
} else {
|
||||
this.searchData.Asc = false
|
||||
}
|
||||
this.searchData.SortField = column.prop
|
||||
this.searchData.PageIndex = 1
|
||||
this.getList()
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.selectTable = val
|
||||
},
|
||||
// 保存菜单数据
|
||||
async saveRowData() {
|
||||
try {
|
||||
this.rowBtnLoading = true
|
||||
let res = await addOrUpdateTrialFileType(this.rowData)
|
||||
this.rowBtnLoading = false
|
||||
if (res.IsSuccess) {
|
||||
this.rowBtnStatus = 'edit'
|
||||
this.$emit('getMenu')
|
||||
this.$message.success(this.$t('common:message:savedSuccessfully'))
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
this.rowBtnLoading = false
|
||||
}
|
||||
},
|
||||
// 预览
|
||||
preview(row) {
|
||||
if (!row.FilePath) return false
|
||||
this.$preview({
|
||||
path: row.FilePath || row.fullPath,
|
||||
type: 'pdf',
|
||||
title: row.FileName,
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.config.visible = false
|
||||
// this.selectData = {}
|
||||
// this.selectKey = null
|
||||
this.faccept = ['.pdf']
|
||||
this.limitLength = 0
|
||||
},
|
||||
fileSizeFormatter(size) {
|
||||
if (!size) return
|
||||
return (size / Math.pow(1024, 2)).toFixed(3) + 'M'
|
||||
},
|
||||
openFile(isFolder = false) {
|
||||
this.selectData = {}
|
||||
this.selectKey = null
|
||||
this.faccept = ['.pdf']
|
||||
this.limitLength = 0
|
||||
this.config.title = this.$t(
|
||||
'trials:trialDocument:fileRecord:form:title:uploadFile'
|
||||
)
|
||||
this.config.visible = true
|
||||
this.config.isFolder = isFolder
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
Id: {
|
||||
handler() {
|
||||
this.getList()
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
created() {
|
||||
let typeArr = ['', 'Report', 'Doc', 'Record', 'Reviewer', 'Template']
|
||||
let types = typeArr[this.ArchiveTypeEnum]
|
||||
this.uploadPath = `/${this.$route.query.trialId}/Document/${types}`
|
||||
console.log(this.uploadPath, this.ArchiveTypeEnum)
|
||||
},
|
||||
computed: {
|
||||
isEN() {
|
||||
return this.$i18n.locale !== 'zh'
|
||||
},
|
||||
isInspect() {
|
||||
return this.hasPermi([
|
||||
'trials:trials-panel:trial-summary:trial-document:inspect',
|
||||
])
|
||||
},
|
||||
isManage() {
|
||||
return this.hasPermi([
|
||||
'trials:trials-panel:trial-summary:trial-document:manage',
|
||||
])
|
||||
},
|
||||
hasAdd() {
|
||||
return this.hasPermi([
|
||||
'trials:trials-panel:trial-summary:trial-document:add',
|
||||
])
|
||||
},
|
||||
hasEdit() {
|
||||
return this.hasPermi([
|
||||
'trials:trials-panel:trial-summary:trial-document:edit',
|
||||
])
|
||||
},
|
||||
hasDel() {
|
||||
return this.hasPermi([
|
||||
'trials:trials-panel:trial-summary:trial-document:del',
|
||||
])
|
||||
},
|
||||
hasDownLoad() {
|
||||
return this.hasPermi([
|
||||
'trials:trials-panel:trial-summary:trial-document:downLoad',
|
||||
])
|
||||
},
|
||||
hasAccredit() {
|
||||
return this.hasPermi([
|
||||
'trials:trials-panel:trial-summary:trial-document:accredit',
|
||||
])
|
||||
},
|
||||
TITLE() {
|
||||
return `${this.$fd('ArchiveType', this.ArchiveTypeEnum)} — ${
|
||||
this.isEN ? this.rowData.Name : this.rowData.NameCN
|
||||
}`
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
line-height: 40px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.fileName {
|
||||
display: inline-block;
|
||||
max-width: calc(100% - 60px);
|
||||
white-space: nowrap; /* 文本不换行 */
|
||||
overflow: hidden; /* 超出部分隐藏 */
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.fileBtnBox {
|
||||
display: inline-block;
|
||||
width: 50px;
|
||||
i {
|
||||
cursor: pointer;
|
||||
color: #409eff;
|
||||
margin-right: 3px;
|
||||
&:last-child {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -168,7 +168,6 @@
|
|||
<script>
|
||||
import baseModel from '@/components/BaseModel'
|
||||
import { addOrUpdateTrialFinalRecord } from '@/api/dictionary'
|
||||
import { config } from 'process'
|
||||
export default {
|
||||
props: {
|
||||
config: {
|
||||
|
@ -360,7 +359,8 @@ export default {
|
|||
).catch()
|
||||
this.loading = true
|
||||
var file = await this.fileToBlob(param.file)
|
||||
let types = this.ArchiveTypeEnum === 1 ? 'Report' : 'Doc'
|
||||
let typeArr = ['', 'Report', 'Doc', 'Record', 'Reviewer', 'Template']
|
||||
let types = typeArr[this.ArchiveTypeEnum]
|
||||
let fileNameNoType = param.file.name
|
||||
.substring(0, param.file.name.lastIndexOf('.'))
|
||||
.toLocaleLowerCase()
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('trials:trialDocument:reportDoc:search:isAuthorizedView')"
|
||||
v-if="isManage && !viewStatus"
|
||||
>
|
||||
<el-select
|
||||
v-if="!viewStatus"
|
||||
|
@ -206,7 +207,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<i
|
||||
v-else-if="isManage && !viewStatus"
|
||||
v-else-if="isManage && !viewStatus && hasEdit"
|
||||
class="el-icon-upload2"
|
||||
style="cursor: pointer; color: #409eff"
|
||||
@click.stop="upload(scope.row, 'PDF')"
|
||||
|
@ -246,7 +247,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<i
|
||||
v-else-if="isManage && !viewStatus"
|
||||
v-else-if="isManage && !viewStatus && hasEdit"
|
||||
class="el-icon-upload2"
|
||||
style="cursor: pointer; color: #409eff"
|
||||
@click.stop="upload(scope.row, 'Word')"
|
||||
|
@ -290,7 +291,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<i
|
||||
v-else-if="isManage && !viewStatus"
|
||||
v-else-if="isManage && !viewStatus && hasEdit"
|
||||
class="el-icon-upload2"
|
||||
style="cursor: pointer; color: #409eff"
|
||||
@click.stop="upload(scope.row, 'Sign')"
|
||||
|
@ -332,7 +333,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<i
|
||||
v-else-if="isManage && !viewStatus"
|
||||
v-else-if="isManage && !viewStatus && hasEdit"
|
||||
class="el-icon-upload2"
|
||||
style="cursor: pointer; color: #409eff"
|
||||
@click.stop="upload(scope.row, 'History')"
|
||||
|
@ -496,7 +497,7 @@ export default {
|
|||
showClose: true,
|
||||
width: '600px',
|
||||
title: '',
|
||||
appendToBody: true,
|
||||
appendToBody: false,
|
||||
status: 'add',
|
||||
upload: null,
|
||||
},
|
||||
|
@ -675,14 +676,20 @@ export default {
|
|||
)
|
||||
.then(() => {
|
||||
this.loading = true
|
||||
deleteTrialFinalRecord(row.Id).then((res) => {
|
||||
if (res.IsSuccess) {
|
||||
this.getMenu()
|
||||
this.$message.success(
|
||||
this.$t('common:message:deletedSuccessfully')
|
||||
)
|
||||
}
|
||||
})
|
||||
deleteTrialFinalRecord(row.Id)
|
||||
.then((res) => {
|
||||
this.loading = false
|
||||
if (res.IsSuccess) {
|
||||
this.getList()
|
||||
this.$message.success(
|
||||
this.$t('common:message:deletedSuccessfully')
|
||||
)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
this.loading = false
|
||||
console.log(err)
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
this.loading = false
|
||||
|
@ -822,7 +829,7 @@ export default {
|
|||
}
|
||||
.fileName {
|
||||
display: inline-block;
|
||||
max-width: calc(100% - 55px);
|
||||
max-width: calc(100% - 60px);
|
||||
white-space: nowrap; /* 文本不换行 */
|
||||
overflow: hidden; /* 超出部分隐藏 */
|
||||
text-overflow: ellipsis;
|
||||
|
@ -833,6 +840,10 @@ export default {
|
|||
i {
|
||||
cursor: pointer;
|
||||
color: #409eff;
|
||||
margin-right: 3px;
|
||||
&:last-child {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,502 @@
|
|||
<template>
|
||||
<base-model :config="config">
|
||||
<div slot="dialog-body">
|
||||
<!-- 多文件上传 -->
|
||||
<form id="inputForm" ref="uploadForm">
|
||||
<el-divider content-position="left">{{
|
||||
$t('trials:trialDocument:label:fileType').replace(
|
||||
'xxx',
|
||||
faccept.join('/')
|
||||
)
|
||||
}}</el-divider>
|
||||
<div class="form-group">
|
||||
<div
|
||||
class="upload"
|
||||
style="margin-right: 10px"
|
||||
:disabled="limitLength"
|
||||
>
|
||||
<input
|
||||
multiple="multiple"
|
||||
webkitdirectory=""
|
||||
directory
|
||||
accept="*/*"
|
||||
type="file"
|
||||
name="uploadFolder"
|
||||
class="select-file"
|
||||
title=""
|
||||
@change="beginScanFiles($event)"
|
||||
v-if="!loading && (!limitLength || fileList.length < limitLength)"
|
||||
/>
|
||||
<div class="btn-select">
|
||||
{{ $t('trials:trialDocument:button:selectFolder') }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="upload">
|
||||
<input
|
||||
class="select-file"
|
||||
multiple=""
|
||||
:accept="faccept.join(',')"
|
||||
type="file"
|
||||
name="uploadFile"
|
||||
title=""
|
||||
@change="beginScanFiles($event)"
|
||||
v-if="!loading && (!limitLength || fileList.length < limitLength)"
|
||||
/>
|
||||
<div class="btn-select">
|
||||
{{ $t('trials:trialDocument:button:select') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- 文件列表 -->
|
||||
<el-table
|
||||
ref="filesTable"
|
||||
:data="fileList"
|
||||
class="dicomFiles-table"
|
||||
height="300"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column
|
||||
type="selection"
|
||||
width="55"
|
||||
:selectable="(row, index) => row.status !== 2 && !loading"
|
||||
/>
|
||||
<el-table-column type="index" width="50" />
|
||||
<!-- 文件名称 -->
|
||||
<el-table-column
|
||||
prop="name"
|
||||
:label="$t('trials:trialDocument:table:fileName')"
|
||||
min-width="100"
|
||||
/>
|
||||
<!-- 文件大小 -->
|
||||
<el-table-column
|
||||
prop="size"
|
||||
:label="$t('trials:trialDocument:table:fileSize')"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{
|
||||
scope.row.size && scope.row.size > 0
|
||||
? `${(scope.row.size / 1024 / 1024).toFixed(2)}MB`
|
||||
: ''
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 文件类型 -->
|
||||
<el-table-column
|
||||
prop="type"
|
||||
:label="$t('trials:trialDocument:table:fileType')"
|
||||
/>
|
||||
<!-- 上传状态 -->
|
||||
<el-table-column
|
||||
prop="status"
|
||||
:label="$t('trials:trialDocument:table:uploadStatus')"
|
||||
min-width="100"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-tag
|
||||
:type="['warning', 'info', 'success', 'danger'][scope.row.status]"
|
||||
v-if="scope.row.status || scope.row.status === 0"
|
||||
>{{ $fd('NoneDicomUploadStatus', scope.row.status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="$t('trials:trialDocument:table:failedFileCount')"
|
||||
min-width="150"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-progress
|
||||
color="#409eff"
|
||||
:percentage="
|
||||
((scope.row.uploadFileSize * 100) / scope.row.size).toFixed(2) *
|
||||
1
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('common:action:action')">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
icon="el-icon-delete"
|
||||
circle
|
||||
:disabled="loading"
|
||||
:title="$t('trials:trialDocument:action:delete')"
|
||||
@click="handleRemoveFile(scope.row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div slot="dialog-footer">
|
||||
<div style="text-align: right; padding: 10px 0px">
|
||||
<span style="margin-right: 10px">{{
|
||||
$store.state.trials.uploadTip
|
||||
}}</span>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
:disabled="selectArr.length == 0"
|
||||
:loading="loading"
|
||||
@click="beginUpload"
|
||||
>
|
||||
{{ $t('trials:trialDocument:action:upload') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</base-model>
|
||||
</template>
|
||||
<script>
|
||||
import baseModel from '@/components/BaseModel'
|
||||
import { deepClone } from '@/utils/index.js'
|
||||
import store from '@/store'
|
||||
export default {
|
||||
name: 'uploadFiles',
|
||||
props: {
|
||||
config: {
|
||||
required: true,
|
||||
default: () => {
|
||||
return {
|
||||
visible: false,
|
||||
}
|
||||
},
|
||||
},
|
||||
faccept: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
},
|
||||
},
|
||||
uploadPath: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
limitLength: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
components: {
|
||||
'base-model': baseModel,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
fileList: [],
|
||||
selectArr: [],
|
||||
isFail: false,
|
||||
successFileList: [],
|
||||
fileInput: null,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 获取待上传文件信息
|
||||
handleSelectionChange(selection) {
|
||||
this.selectArr = selection
|
||||
},
|
||||
// 扫描待上传文件
|
||||
beginScanFiles(e) {
|
||||
if (this.fileInput) {
|
||||
this.fileInput = null
|
||||
}
|
||||
var files = [...e.target.files]
|
||||
if (this.limitLength && this.fileList.length >= this.limitLength)
|
||||
return this.$message.warning(
|
||||
this.$t('trials:trialDocument:message:limitLength')
|
||||
)
|
||||
var sameFiles = []
|
||||
files.forEach((file) => {
|
||||
var extendName = file.name
|
||||
.substring(file.name.lastIndexOf('.'))
|
||||
.toLocaleLowerCase()
|
||||
if (
|
||||
this.faccept.indexOf(extendName) !== -1 &&
|
||||
this.fileList.findIndex((v) => v.name === file.name) > -1
|
||||
) {
|
||||
sameFiles.push(file.name)
|
||||
}
|
||||
})
|
||||
var scope = this
|
||||
if (sameFiles.length > 0) {
|
||||
const h = this.$createElement
|
||||
var msg = this.$t('trials:trialDocument:message:exsitSameFile').replace(
|
||||
'xxx',
|
||||
sameFiles.join(', ')
|
||||
)
|
||||
this.$msgbox({
|
||||
message: h('div', { style: 'maxHeight:300px;overflow: auto;' }, [
|
||||
h('p', null, msg),
|
||||
h(
|
||||
'p',
|
||||
null,
|
||||
this.$t('trials:trialDocument:message:isContinueUpload')
|
||||
),
|
||||
]),
|
||||
type: 'warning',
|
||||
showCancelButton: true,
|
||||
})
|
||||
.then(() => {
|
||||
scope.pendingUploadQuene(files)
|
||||
})
|
||||
.catch(() => {
|
||||
scope.resetUploadForm()
|
||||
})
|
||||
} else {
|
||||
scope.pendingUploadQuene(files)
|
||||
}
|
||||
},
|
||||
pendingUploadQuene(files) {
|
||||
for (var i = 0; i < files.length; ++i) {
|
||||
const fileName = files[i].name
|
||||
var extendName = fileName
|
||||
.substring(fileName.lastIndexOf('.'))
|
||||
.toLocaleLowerCase()
|
||||
if (this.faccept.indexOf(extendName) !== -1) {
|
||||
files[i].id = `${files[i].lastModified}${files[i].name}`
|
||||
let obj = {
|
||||
name: files[i].name,
|
||||
size: files[i].size,
|
||||
type: extendName.split('.')[1],
|
||||
status: 0,
|
||||
file: files[i],
|
||||
id: `${files[i].lastModified}${files[i].name}`,
|
||||
fileType: files[i].type,
|
||||
uploadFileSize: 0,
|
||||
}
|
||||
this.fileList.push(obj)
|
||||
this.$refs.filesTable.toggleRowSelection(obj, true)
|
||||
}
|
||||
}
|
||||
this.resetUploadForm()
|
||||
},
|
||||
resetUploadForm() {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.uploadForm.reset()
|
||||
})
|
||||
},
|
||||
handleRemoveFile(row) {
|
||||
this.$confirm(this.$t('trials:trialDocument:message:delete'), {
|
||||
type: 'warning',
|
||||
distinguishCancelAndClose: true,
|
||||
})
|
||||
.then(() => {
|
||||
this.fileList.splice(
|
||||
this.fileList.findIndex((item) => item.id === row.id),
|
||||
1
|
||||
)
|
||||
let flag = this.successFileList.some((item) => item.id === row.id)
|
||||
if (flag) {
|
||||
this.successFileList.splice(
|
||||
this.successFileList.findIndex((item) => item.id === row.id),
|
||||
1
|
||||
)
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
// 开始上传文件
|
||||
async beginUpload() {
|
||||
this.loading = true
|
||||
this.isFail = false
|
||||
const fileMaxSize = 1024 * 1024 * 1024 * 2 // 1G
|
||||
var currentFilesSize = 0
|
||||
this.selectArr.forEach((item) => {
|
||||
currentFilesSize += item.size
|
||||
})
|
||||
if (currentFilesSize / fileMaxSize > 1) {
|
||||
// 'Upload file size cannot exceed 1G'
|
||||
this.$alert(this.$t('trials:trialDocument:message:uploadSize'))
|
||||
this.loading = false
|
||||
} else {
|
||||
this.selectArr.forEach((item) => (item.status = 0))
|
||||
let num = this.selectArr.length > 6 ? 6 : this.selectArr.length
|
||||
let funArr = []
|
||||
for (let i = 0; i < num; i++) {
|
||||
funArr.push(this.handleUploadTask(this.selectArr, i))
|
||||
}
|
||||
if (funArr.length > 0) {
|
||||
let res = await Promise.all(funArr)
|
||||
}
|
||||
}
|
||||
},
|
||||
// 并发上传
|
||||
async handleUploadTask(arr, index) {
|
||||
if (!this.config.visible) return
|
||||
let file = this.fileList.filter((item) => item.id === arr[index].id)[0]
|
||||
file.status = 1
|
||||
let fileType = file.name
|
||||
.substring(file.name.lastIndexOf('.'))
|
||||
.toLocaleLowerCase()
|
||||
let fileName = file.name
|
||||
.substring(0, file.name.lastIndexOf('.'))
|
||||
.toLocaleLowerCase()
|
||||
let path = `${this.uploadPath}/${fileName}${fileType}`
|
||||
file.curPath = path
|
||||
const fileData = await this.fileToBlob(file.file)
|
||||
let res = await this.fileToOss(path, fileData, file)
|
||||
if (res) {
|
||||
file.status = 2
|
||||
this.successFileList.push({
|
||||
FileName: file.name,
|
||||
FilePath: this.$getObjectName(res.url),
|
||||
FileSize: file.size,
|
||||
FileFormat: fileType,
|
||||
})
|
||||
let flag = arr.every((item) => item.status === 2)
|
||||
if (flag) {
|
||||
return this.submitFile(this.successFileList)
|
||||
}
|
||||
} else {
|
||||
file.status = 3
|
||||
}
|
||||
let flag = arr.every((item) => item.status > 1)
|
||||
if (flag) {
|
||||
let failFileList = arr.filter((item) => item.status === 3)
|
||||
if (failFileList && failFileList.length > 0) {
|
||||
this.$refs.filesTable.clearSelection()
|
||||
failFileList.forEach((row) => {
|
||||
row.uploadFileSize = 0
|
||||
this.$refs.filesTable.toggleRowSelection(row)
|
||||
})
|
||||
this.isFail = true
|
||||
this.submitFile(this.successFileList, true)
|
||||
return false
|
||||
}
|
||||
}
|
||||
let ind = arr.findIndex((item) => item.status === 0)
|
||||
if (ind >= 0) {
|
||||
return this.handleUploadTask(arr, ind)
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
// file上传到oss
|
||||
async fileToOss(path, file, item) {
|
||||
try {
|
||||
let res = await this.OSSclient.multipartUpload(
|
||||
{
|
||||
path,
|
||||
file,
|
||||
speed: true,
|
||||
},
|
||||
(percentage, checkpoint, lastPer) => {
|
||||
item.uploadFileSize += checkpoint.size * (percentage - lastPer)
|
||||
if (item.uploadFileSize > file.fileSize) {
|
||||
item.uploadFileSize = file.fileSize
|
||||
}
|
||||
}
|
||||
)
|
||||
if (res) {
|
||||
return res
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
return false
|
||||
}
|
||||
},
|
||||
submitFile(list, isReLoad = false) {
|
||||
if (!this.config.visible) return
|
||||
if (!isReLoad) {
|
||||
this.reset()
|
||||
}
|
||||
let arr = deepClone(list)
|
||||
this.$emit('uplaodFile', arr)
|
||||
},
|
||||
reset() {
|
||||
this.loading = false
|
||||
this.selectArr = []
|
||||
this.successFileList = []
|
||||
this.OSSclient.close()
|
||||
this.$emit('close')
|
||||
},
|
||||
openFile(isFolder = false) {
|
||||
this.fileInput = document.createElement('input')
|
||||
this.fileInput.type = 'file'
|
||||
this.fileInput.addEventListener('change', this.beginScanFiles)
|
||||
if (isFolder) {
|
||||
this.fileInput.accept = '*/*'
|
||||
//webkitdirectory directory
|
||||
this.fileInput.webkitdirectory = 'webkitdirectory'
|
||||
this.fileInput.directory = 'directory'
|
||||
} else {
|
||||
this.fileInput.accept = this.faccept.join(',')
|
||||
}
|
||||
console.log(this.fileInput)
|
||||
this.fileInput.click()
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
isFail() {
|
||||
if (this.isFail) {
|
||||
this.$confirm(this.$t('trials:trialDocument:failUpload'), {
|
||||
type: 'warning',
|
||||
distinguishCancelAndClose: true,
|
||||
confirmButtonText: this.$t('common:button:confirm'),
|
||||
cancelButtonText: this.$t('common:button:cancel'),
|
||||
})
|
||||
.then(() => {
|
||||
this.beginUpload()
|
||||
})
|
||||
.catch((err) => {
|
||||
this.loading = false
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
},
|
||||
loading() {
|
||||
store.dispatch('trials/setUnLock', this.loading)
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.openFile(this.config.isFolder)
|
||||
},
|
||||
beforeDestroy() {
|
||||
store.dispatch('trials/setUnLock', false)
|
||||
this.OSSclient.close()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.upload {
|
||||
display: inline-block;
|
||||
height: 30px;
|
||||
width: 90px;
|
||||
padding: 2px 10px;
|
||||
line-height: 23px;
|
||||
position: relative;
|
||||
text-decoration: none;
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
background: #428bca;
|
||||
border-color: #428bca;
|
||||
color: #fff;
|
||||
.select-file {
|
||||
height: 30px;
|
||||
width: 90px;
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
left: 0;
|
||||
top: 0;
|
||||
opacity: 0;
|
||||
font-size: 0;
|
||||
}
|
||||
.btn-select {
|
||||
//给显示在页面上的按钮写样式
|
||||
width: 90px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
border-radius: 24px;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
pointer-events: none; //pointer-events:none用来控制该标签的点击穿透事件
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -34,7 +34,6 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="main">
|
||||
<!--v-if="[0, 1].includes(SubIdentificationEnum)"-->
|
||||
<report-doc
|
||||
v-if="[0, 1].includes(SubIdentificationEnum)"
|
||||
:viewStatus="viewStatus"
|
||||
|
@ -43,6 +42,15 @@
|
|||
:rowData="rowData"
|
||||
@getMenu="getMenu"
|
||||
/>
|
||||
<!--v-if="[2].includes(SubIdentificationEnum)"-->
|
||||
<file-record
|
||||
v-if="[2].includes(SubIdentificationEnum)"
|
||||
:viewStatus="viewStatus"
|
||||
:Id="Id"
|
||||
:ArchiveTypeEnum="ArchiveTypeEnum"
|
||||
:rowData="rowData"
|
||||
@getMenu="getMenu"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -50,9 +58,10 @@
|
|||
import BaseContainer from '@/components/BaseContainer'
|
||||
import Menu from './components/menu.vue'
|
||||
import reportDoc from './components/report_doc/index.vue'
|
||||
import fileRecord from './components/fileRecord/index.vue'
|
||||
export default {
|
||||
name: 'trialDocument',
|
||||
components: { BaseContainer, Menu, reportDoc },
|
||||
components: { BaseContainer, Menu, reportDoc, fileRecord },
|
||||
data() {
|
||||
return {
|
||||
viewStatus: false,
|
||||
|
|
Loading…
Reference in New Issue