项目文档
continuous-integration/drone/push Build is passing Details

uat
wangxiaoshuang 2025-02-27 10:34:06 +08:00
parent 00a7e8e609
commit 6b331ab6f6
6 changed files with 1712 additions and 7 deletions

View File

@ -1093,3 +1093,65 @@ export function deleteSysFileType(id) {
method: 'delete' method: 'delete'
}) })
} }
// 项目文档-获取项目菜单
export function getTrialFileTypeData(data) {
return request({
url: `/TrialFileType/getTrialFileTypeData`,
method: 'post',
data
})
}
// 项目文档-修改项目菜单启用
export function setAuthorizedView(data) {
return request({
url: `/TrialFileType/setAuthorizedView`,
method: 'post',
data
})
}
// 项目文档-新增/修改项目菜单
export function addOrUpdateTrialFileType(data) {
return request({
url: `/TrialFileType/addOrUpdateTrialFileType`,
method: 'post',
data
})
}
// 项目文档-删除项目菜单
export function deleteTrialFileType(id) {
return request({
url: `/TrialFileType/deleteTrialFileType/${id}`,
method: 'delete',
})
}
// 项目文档-报告/文档列表
export function getTrialFinalRecordList(data) {
return request({
url: `/TrialFinalRecord/getTrialFinalRecordList`,
method: 'post',
data
})
}
// 项目文档-报告/文档授权
export function authorizedTrialFinalRecord(data) {
return request({
url: `/TrialFinalRecord/authorizedTrialFinalRecord`,
method: 'post',
data
})
}
// 项目文档-报告/文档新增/修改
export function addOrUpdateTrialFinalRecord(data) {
return request({
url: `/TrialFinalRecord/addOrUpdateTrialFinalRecord`,
method: 'post',
data
})
}
// 项目文档-删除报告/文档
export function deleteTrialFinalRecord(id) {
return request({
url: `/TrialFinalRecord/deleteTrialFinalRecord/${id}`,
method: 'delete',
})
}

View File

@ -60,3 +60,67 @@ export function param2Obj(url) {
) )
} }
export function deepClone(target) {
const map = new WeakMap()
function isObject(target) {
return (typeof target === 'object' && target) || typeof target === 'function'
}
function clone(data) {
if (!isObject(data)) {
return data
}
if ([Date, RegExp].includes(data.constructor)) {
return new data.constructor(data)
}
if (typeof data === 'function') {
return new Function('return ' + data.toString())()
}
const exist = map.get(data)
if (exist) {
return exist
}
if (data instanceof Map) {
const result = new Map()
map.set(data, result)
data.forEach((val, key) => {
if (isObject(val)) {
result.set(key, clone(val))
} else {
result.set(key, val)
}
})
return result
}
if (data instanceof Set) {
const result = new Set()
map.set(data, result)
data.forEach(val => {
if (isObject(val)) {
result.add(clone(val))
} else {
result.add(val)
}
})
return result
}
const keys = Reflect.ownKeys(data)
const allDesc = Object.getOwnPropertyDescriptors(data)
const result = Object.create(Object.getPrototypeOf(data), allDesc)
map.set(data, result)
keys.forEach(key => {
const val = data[key]
if (isObject(val)) {
result[key] = clone(val)
} else {
result[key] = val
}
})
return result
}
return clone(target)
}

View File

@ -0,0 +1,413 @@
<template>
<div class="trialDocumentMenu">
<div class="menuBox" v-for="item in menu" :key="item.ArchiveTypeEnum">
<div class="top">
<i class="el-icon-folder-opened"></i>
<span>{{ $fd('ArchiveType', item.ArchiveTypeEnum) }}</span>
<i
class="el-icon-circle-plus menuAdd"
:title="$t('trials:trialDocument:menu:add')"
@click.stop="addMenu(item.ArchiveTypeEnum)"
v-if="isManage && hasAdd && !viewStatus && item.ArchiveTypeEnum !== 5"
></i>
</div>
<div
:class="{ menu: true, selected: Id === data.Id }"
v-for="data in item.TrialFileTypeList"
:key="data.SysFileTypeId"
@click.stop="handleSelect(data, item.ArchiveTypeEnum)"
>
<i class="el-icon-s-order" style="margin-left: 5px"></i>
<span class="menuItem">{{ isEN ? data.Name : data.NameCN }}</span>
<div
@click="NATIVE"
class="menuBtnBox"
v-if="isManage && hasEdit && !viewStatus"
>
<i
v-if="data.IsSelfDefine"
class="el-icon-edit-outline"
:title="$t('trials:trialDocument:menu:edit')"
@click.stop="editMenu(item.ArchiveTypeEnum, data)"
/>
<i
v-if="data.IsSelfDefine"
class="el-icon-delete"
:title="$t('trials:trialDocument:menu:del')"
@click.stop="delMenu(data)"
/>
<el-switch
class="menuSwitch"
@change="(val) => changeIsEnble(val, data)"
v-model="data.IsEnable"
:active-value="true"
:inactive-value="false"
>
</el-switch>
</div>
</div>
</div>
<base-model :config="config">
<div slot="dialog-body">
<el-form
ref="menuForm"
:model="form"
label-width="100px"
size="small"
:rules="rules"
>
<div class="base-dialog-body">
<el-form-item
:label="$t('trials:trialDocument:form:ArchiveTypeEnum')"
prop="ArchiveTypeEnum"
>
<el-select
v-model="form.ArchiveTypeEnum"
disabled
placeholder=""
style="width: 100%"
>
<el-option
v-for="item in $d.ArchiveType"
:key="item.id"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
:label="$t('trials:trialDocument:form:Name')"
prop="Name"
>
<el-input v-model="form.Name" />
</el-form-item>
</div>
</el-form>
</div>
<div slot="dialog-footer">
<el-button size="small" @click="canel">
{{ $t('trials:trialDocument:button:canel') }}
</el-button>
<el-button size="small" type="primary" :loading="loading" @click="save">
{{ $t('trials:trialDocument:button:save') }}
</el-button>
</div>
</base-model>
</div>
</template>
<script>
import {
getTrialFileTypeData,
setAuthorizedView,
addOrUpdateTrialFileType,
deleteTrialFileType,
} from '@/api/dictionary'
import baseModel from '@/components/BaseModel'
const defaultForm = () => {
return {
ArchiveTypeEnum: null,
Name: null,
NameCN: null,
FirstFinalDate: null,
IsConfirmRecord: true,
IsEnable: true,
IsSelfDefine: true,
SubIdentificationEnum: null,
SysFileTypeId: null,
TrialId: null,
Id: null,
}
}
export default {
name: 'trialDocumentMenu',
props: {
viewStatus: {
type: Boolean,
default: true,
},
Id: {
type: String,
default: '',
},
SubIdentificationEnum: {
type: Number,
default: 0,
},
ArchiveTypeEnum: {
type: Number,
default: 0,
},
rowData: {
type: Object,
default: () => {
return {}
},
},
},
data() {
return {
loading: false,
menu: [],
config: {
visible: false,
showClose: true,
width: '400px',
title: '',
appendToBody: true,
status: 'add',
},
form: defaultForm(),
rules: {
Name: [
{
required: true,
message: this.$t('common:ruleMessage:specify'),
trigger: ['blur', 'change'],
},
],
},
}
},
components: {
'base-model': baseModel,
},
watch: {
viewStatus: {
handler() {
this.getMenu()
},
immediate: true,
},
},
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',
])
},
},
methods: {
//
async getMenu() {
try {
let data = {
TrialId: this.$route.query.trialId,
IsEnable: this.viewStatus,
}
this.loading = true
let res = await getTrialFileTypeData(data)
this.loading = false
if (res.IsSuccess) {
this.menu = res.Result.TrialFileTypeDataList
}
} catch (err) {
this.loading = false
console.log(err)
}
},
//
async changeIsEnble(val, item) {
try {
let data = {
Id: item.Id,
IsEnable: val,
}
this.loading = true
let res = await setAuthorizedView(data)
this.loading = false
} catch (err) {
this.loading = false
item.IsEnable = !item.IsEnable
console.log(err)
}
},
//
handleSelect(data, ArchiveTypeEnum) {
this.$emit('update:Id', data.Id)
this.$emit('update:SubIdentificationEnum', data.SubIdentificationEnum)
this.$emit('update:ArchiveTypeEnum', ArchiveTypeEnum)
this.$emit('update:rowData', data)
},
//
addMenu(ArchiveTypeEnum) {
this.config.title = this.$t('trials:trialDocument:title:add')
this.form = defaultForm()
this.form.ArchiveTypeEnum = ArchiveTypeEnum
this.form.TrialId = this.$route.query.trialId
switch (ArchiveTypeEnum) {
case 1: {
this.form.SubIdentificationEnum = 0
break
}
case 2: {
this.form.SubIdentificationEnum = 1
break
}
case 3: {
this.form.SubIdentificationEnum = 2
break
}
case 4: {
this.form.SubIdentificationEnum = 2
break
}
}
this.config.visible = true
},
//
editMenu(ArchiveTypeEnum, item) {
this.config.title = this.$t('trials:trialDocument:title:edit')
this.form = defaultForm()
Object.keys(this.form).forEach((key) => {
this.form[key] = item[key]
})
this.form.ArchiveTypeEnum = ArchiveTypeEnum
this.config.visible = true
},
//
delMenu(row) {
this.$confirm(this.$t('trials:trialDocument:message:deleteMessage'), {
type: 'warning',
distinguishCancelAndClose: true,
})
.then(() => {
this.loading = true
deleteTrialFileType(row.Id).then((res) => {
if (res.IsSuccess) {
this.getMenu()
this.$message.success(
this.$t('common:message:deletedSuccessfully')
)
}
})
})
.catch((err) => {
this.loading = false
console.log(err)
})
},
async save() {
try {
let validate = await this.$refs.menuForm.validate()
if (!validate) return false
this.form.NameCN = this.form.Name
this.loading = true
let res = await addOrUpdateTrialFileType(this.form)
if (res.IsSuccess) {
this.config.visible = false
this.getMenu()
}
} catch (err) {
console.log(err)
this.loading = false
}
},
canel() {
this.config.visible = false
},
NATIVE(event) {
event.stopPropagation()
},
},
}
</script>
<style lang="scss" scoped>
.trialDocumentMenu {
padding: 0 10px;
.menuBox {
border-bottom: 1px solid rgb(238, 238, 238);
&:last-child {
border: none;
}
.top {
color: #303133;
line-height: 48px;
width: 100%;
position: relative;
i {
margin-right: 5px;
}
.menuAdd {
margin: 0;
position: absolute;
top: 15px;
right: 0;
cursor: pointer;
}
}
.menu {
font-size: 14px;
margin-bottom: 12px;
padding: 0 12px 0 20px;
cursor: pointer;
min-height: 36px;
display: flex;
align-items: center;
border-radius: 5px;
position: relative;
i {
margin-right: 5px;
}
.menuBtnBox {
position: absolute;
top: 7px;
right: 5px;
display: flex;
align-items: center;
}
.menuItem {
width: 70%;
white-space: nowrap; /* 文本不换行 */
overflow: hidden; /* 超出部分隐藏 */
text-overflow: ellipsis;
}
}
.menu:hover {
background: #f5f5f5;
}
.menu.selected {
color: #6698ff;
background: rgba(102, 152, 255, 0.1);
}
}
.menuSwitch {
::v-deep.el-switch__core {
height: 14px;
width: 28px !important;
&::after {
width: 12px;
height: 12px;
top: 0;
}
}
}
.el-switch.is-checked {
::v-deep.el-switch__core {
height: 14px;
width: 28px !important;
&::after {
margin-left: -12px;
}
}
}
}
</style>

View File

@ -0,0 +1,214 @@
<template>
<base-model :config="config">
<div slot="dialog-body">
<el-form
ref="browserForm"
:model="form"
label-width="140px"
size="small"
:rules="rules"
>
<div class="base-dialog-body">
<el-form-item
:label="$t('dictionary:browser:form:title')"
prop="Title"
>
<el-input v-model="form.Title" />
</el-form-item>
<el-form-item
:label="$t('dictionary:browser:form:exploreType')"
prop="ExploreType"
>
<el-input v-model="form.ExploreType" />
</el-form-item>
<el-form-item
:label="$t('dictionary:browser:form:version')"
prop="Version"
>
<el-input v-model="form.Version" type="textarea" rows="5" />
</el-form-item>
<el-form-item
:label="$t('dictionary:browser:form:downloadUrl')"
prop="DownloadUrl"
>
<el-input v-model="form.DownloadUrl" />
</el-form-item>
<el-form-item :label="$t('dictionary:browser:form:addFile')">
<el-upload
class="upload-demo"
action
:before-upload="beforeUpload"
:http-request="handleUploadFile"
:on-preview="handlePreview"
:on-remove="handleRemoveFile"
:show-file-list="true"
:limit="1"
:file-list="fileList"
>
<el-button
size="small"
type="primary"
:disabled="fileList.length > 0"
>{{ $t('common:button:upload') }}</el-button
>
</el-upload>
</el-form-item>
<el-form-item :label="$t('dictionary:browser:form:isDeleted')">
<el-switch
v-model="form.IsDeleted"
:active-value="false"
:inactive-value="true"
>
</el-switch>
</el-form-item>
</div>
</el-form>
</div>
<div slot="dialog-footer">
<el-button size="small" @click="canel">
{{ $t('dictionary:browser:button:canel') }}
</el-button>
<el-button size="small" type="primary" :loading="loading" @click="save">
{{ $t('dictionary:browser:button:save') }}
</el-button>
</div>
</base-model>
</template>
<script>
import baseModel from '@/components/BaseModel'
import { addOrUpdateExploreRecommend } from '@/api/dictionary'
export default {
props: {
config: {
required: true,
default: () => {
return {}
},
},
data: {
required: true,
default: () => {
return {}
},
},
},
components: {
'base-model': baseModel,
},
data() {
return {
form: {
Version: null,
Title: null,
IsDeleted: true,
ExploreType: null,
DownloadUrl: null,
Path: null,
FileName: null,
},
rules: {
Title: [
{
required: true,
message: this.$t('common:ruleMessage:specify'),
trigger: ['blur', 'change'],
},
],
ExploreType: [
{
required: true,
message: this.$t('common:ruleMessage:specify'),
trigger: ['blur', 'change'],
},
],
Version: [
{
required: true,
message: this.$t('common:ruleMessage:specify'),
trigger: ['blur', 'change'],
},
],
DownloadUrl: [
{
required: true,
message: this.$t('common:ruleMessage:specify'),
trigger: ['blur', 'change'],
},
],
},
fileList: [],
loading: false,
}
},
created() {
if (this.config.status === 'edit') {
Object.keys(this.form).forEach((key) => {
this.form[key] = this.data[key]
})
if (this.form.FileName) {
this.fileList[0] = {
name: this.form.FileName,
path: this.form.Path,
fullPath: this.form.Path,
}
}
}
},
methods: {
async save() {
try {
let validate = await this.$refs.browserForm.validate()
if (!validate) return false
this.loading = true
if (this.config.status === 'edit') {
this.form.Id = this.data.Id
}
let res = await addOrUpdateExploreRecommend(this.form)
if (res.IsSuccess) {
this.$emit('close')
this.$emit('getList')
}
} catch (err) {
console.log(err)
this.loading = false
}
},
canel() {
this.$emit('close')
},
handleRemoveFile() {
this.form.FileName = null
this.form.Path = null
this.fileList = []
},
beforeUpload() {
if (this.fileList.length > 0) {
this.$alert(this.$t('trials:trialDocument:reportDoc:msg:message1'))
return
}
},
handlePreview(row, r2) {
if (row.fullPath) {
window.open(row.fullPath, '_blank')
}
},
async handleUploadFile(param) {
this.loading = true
var file = await this.fileToBlob(param.file)
const res = await this.OSSclient.put(
`/System/Browser/${param.file.name}`,
file
)
this.fileList.push({
name: param.file.name,
path: this.$getObjectName(res.url),
fullPath: this.$getObjectName(res.url),
url: this.$getObjectName(res.url),
})
this.form.Path = this.$getObjectName(res.url)
this.form.FileName = param.file.name
this.loading = false
},
},
}
</script>

View File

@ -0,0 +1,819 @@
<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:reportDoc:form:firstFinalDate')"
>
<el-date-picker
:disabled="!isManage || rowBtnStatus === 'edit'"
v-model="rowData.FirstFinalDate"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder=""
>
</el-date-picker>
</el-form-item>
<el-form-item
:label="$t('trials:trialDocument:reportDoc: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:reportDoc: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:reportDoc:search:name')">
<el-input v-model="searchData.Name" style="width: 100px" clearable />
</el-form-item>
<el-form-item
:label="$t('trials:trialDocument:reportDoc:search:version')"
>
<el-input
v-model="searchData.Version"
style="width: 100px"
clearable
/>
</el-form-item>
<el-form-item
:label="$t('trials:trialDocument:reportDoc:search:isAuthorizedView')"
>
<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:reportDoc:button:accredit') }}
</el-button>
<el-button
type="primary"
size="mini"
v-if="hasAdd"
@click.stop="handleAdd"
>
{{ $t('trials:trialDocument:reportDoc:button:add') }}
</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:reportDoc:button:downLoad') }}
</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="Name"
:label="$t('trials:trialDocument:reportDoc:table:name')"
sortable="custom"
show-overflow-tooltip
/>
<el-table-column
prop="Version"
:label="$t('trials:trialDocument:reportDoc:table:version')"
show-overflow-tooltip
sortable="custom"
/>
<!--定稿PDF-->
<el-table-column
prop="PdfFileRecord"
:label="$t('trials:trialDocument:reportDoc:table:pdfFileRecord')"
show-overflow-tooltip
sortable="custom"
>
<template slot-scope="scope">
<div
v-if="
scope.row.PdfFileRecord && scope.row.PdfFileRecord.TrialFileTypeId
"
style="display: flex; align-items: center"
>
<span class="fileName">{{ scope.row.PdfFileRecord.FileName }}</span>
<div v-if="isManage && !viewStatus" class="fileBtnBox">
<i
class="el-icon-view"
@click.stop="preview(scope.row.PdfFileRecord)"
/>
<i
class="el-icon-download"
v-if="hasDownLoad"
@click.stop="downLoad(false, scope.row.PdfFileRecord, 'file')"
/>
<i
class="el-icon-delete"
v-if="hasDel"
@click.stop="delFile(scope.row, 'Pdf')"
/>
</div>
</div>
<i
v-else-if="isManage && !viewStatus"
class="el-icon-upload2"
style="cursor: pointer; color: #409eff"
/>
</template>
</el-table-column>
<!--定稿WORD-->
<el-table-column
prop="WordFileRecord"
:label="$t('trials:trialDocument:reportDoc:table:wordFileRecord')"
show-overflow-tooltip
sortable="custom"
v-if="isManage && !viewStatus"
>
<template slot-scope="scope">
<div
v-if="
scope.row.WordFileRecord &&
scope.row.WordFileRecord.TrialFileTypeId
"
style="display: flex; align-items: center"
>
<span class="fileName">{{
scope.row.WordFileRecord.FileName
}}</span>
<div v-if="isManage && !viewStatus" class="fileBtnBox">
<i
class="el-icon-download"
v-if="hasDownLoad"
@click.stop="downLoad(false, scope.row.WordFileRecord, 'file')"
/>
<i
class="el-icon-delete"
v-if="hasDel"
@click.stop="delFile(scope.row, 'Word')"
/>
</div>
</div>
<i
v-else-if="isManage && !viewStatus"
class="el-icon-upload2"
style="cursor: pointer; color: #409eff"
/>
</template>
</el-table-column>
<!--签字页-->
<el-table-column
prop="SignFileRecord"
:label="$t('trials:trialDocument:reportDoc:table:signFileRecord')"
show-overflow-tooltip
sortable="custom"
v-if="isManage && !viewStatus"
>
<template slot-scope="scope">
<div
v-if="
scope.row.SignFileRecord &&
scope.row.SignFileRecord.TrialFileTypeId
"
style="display: flex; align-items: center"
>
<span class="fileName">{{
scope.row.SignFileRecord.FileName
}}</span>
<div v-if="isManage && !viewStatus" class="fileBtnBox">
<i
class="el-icon-view"
@click.stop="preview(scope.row.SignFileRecord)"
/>
<i
class="el-icon-download"
v-if="hasDownLoad"
@click.stop="downLoad(false, scope.row.SignFileRecord, 'file')"
/>
<i
class="el-icon-delete"
v-if="hasDel"
@click.stop="delFile(scope.row, 'Sign')"
/>
</div>
</div>
<i
v-else-if="isManage && !viewStatus"
class="el-icon-upload2"
style="cursor: pointer; color: #409eff"
/>
</template>
</el-table-column>
<!--历史记录-->
<el-table-column
prop="HistoryFileRecord"
:label="$t('trials:trialDocument:reportDoc: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"
/>
</template>
</el-table-column>
<el-table-column
prop="IsAuthorizedView"
:label="$t('trials:trialDocument:reportDoc:table:isAuthorizedView')"
show-overflow-tooltip
sortable="custom"
>
<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:reportDoc:table:updateTime')"
show-overflow-tooltip
sortable="custom"
/>
<el-table-column
prop="CreateTime"
:label="$t('trials:trialDocument:reportDoc: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.PdfFileRecord || !scope.row.PdfFileRecord.FilePath
"
@click.stop="preview(scope.row.PdfFileRecord)"
/>
<el-button
v-if="hasEdit && isManage && !viewStatus"
icon="el-icon-edit-outline"
:title="$t('common:button:edit')"
size="mini"
circle
@click.stop="handleEdit(scope.row)"
/>
<el-button
v-if="hasDownLoad && isManage && !viewStatus"
icon="el-icon-download"
:title="$t('trials:trialDocument:reportDoc:button:download')"
size="mini"
circle
@click.stop="downLoad(false, scope.row)"
/>
<el-button
v-if="hasDel && isManage && !viewStatus"
icon="el-icon-delete"
:title="$t('trials:trialDocument:reportDoc: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"
/>
<reportDoc-form
:config="config"
:data="selectData"
v-if="config.visible"
@close="close"
@getList="getList"
/>
</box-content>
</template>
<script>
import {
addOrUpdateTrialFileType,
getTrialFinalRecordList,
deleteTrialFinalRecord,
authorizedTrialFinalRecord,
addOrUpdateTrialFinalRecord,
} 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 reportDocForm from './form.vue'
const searchDataDefault = () => {
return {
IsAuthorizedView: null,
Name: null,
Version: null,
PageIndex: 1,
PageSize: 20,
Asc: false,
SortField: null,
}
}
export default {
name: 'reportDoc',
components: { BoxContent, Pagination, reportDocForm },
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: '600px',
title: '',
appendToBody: true,
status: 'add',
},
selectData: {},
}
},
methods: {
//
handleAdd() {
this.selectData = {}
this.config.title =
this.$t('trials:trialDocument:reportDoc:form:title:add') +
'-' +
this.isEN
? this.rowData.Name
: this.rowData.NameCN
this.config.status = 'add'
// this.config.visible = true
},
//
handleEdit(row) {
this.selectData = deepClone(row)
this.config.title =
this.$t('trials:trialDocument:reportDoc:form:title:edit') +
'-' +
this.isEN
? this.rowData.Name
: this.rowData.NameCN
this.config.status = 'edit'
this.config.visible = true
},
//
async delFile(row, key) {
try {
let confirm = await this.$confirm(
this.$t('trials:trialDocument:reportDoc: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 addOrUpdateTrialFinalRecord(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 = ['Pdf', 'Word', 'Sign', '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.Name}_${item.Version}/${item[
`${key}FileRecord`
].FileName.substring(
0,
item[`${key}FileRecord`].FileName.lastIndexOf('.')
)}__${item.Version}${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 authorizedTrialFinalRecord(data)
this.loading = false
if (res.IsSuccess) {
this.$t('trials:trialDocument:reportDoc:message:authSuccessfully')
if (isArray) {
this.getList()
}
}
} catch (err) {
this.loading = false
if (!isArray) {
row.IsAuthorizedView = !row.IsAuthorizedView
}
console.log(err)
}
},
//
handleDel() {
this.$confirm(
this.$t('trials:trialDocument:reportDoc:message:deleteMessage'),
{
type: 'warning',
distinguishCancelAndClose: true,
}
)
.then(() => {
this.loading = true
deleteTrialFinalRecord(row.Id).then((res) => {
if (res.IsSuccess) {
this.getMenu()
this.$message.success(
this.$t('common:message:deletedSuccessfully')
)
}
})
})
.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 getTrialFinalRecordList(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
},
},
watch: {
Id: {
handler() {
this.getList()
},
immediate: true,
},
},
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% - 100px);
white-space: nowrap; /* 文本不换行 */
overflow: hidden; /* 超出部分隐藏 */
text-overflow: ellipsis;
}
.fileBtnBox {
display: inline-block;
width: 50px;
i {
cursor: pointer;
color: #409eff;
}
}
</style>

View File

@ -0,0 +1,133 @@
<template>
<div class="trialDocument">
<div class="left">
<div class="top" v-if="isManage">
<div class="viewCheck">
<span>{{ $t('trials:trialDocument:view') }}</span>
<el-switch
v-model="viewStatus"
active-color="#13ce66"
inactive-color="#409eff"
:active-value="false"
:inactive-value="true"
:active-text="$t('trials:trialDocument:viewStatus:manage')"
:inactive-text="$t('trials:trialDocument:viewStatus:inspect')"
@change="handleChange"
>
</el-switch>
</div>
</div>
<div
:class="{
menuBox: true,
noTop: !isManage,
}"
>
<Menu
ref="Menu"
:viewStatus="viewStatus"
:Id.sync="Id"
:SubIdentificationEnum.sync="SubIdentificationEnum"
:ArchiveTypeEnum.sync="ArchiveTypeEnum"
:rowData.sync="rowData"
/>
</div>
</div>
<div class="main">
<!--v-if="[0, 1].includes(SubIdentificationEnum)"-->
<report-doc
v-if="[0, 1].includes(SubIdentificationEnum)"
:viewStatus="viewStatus"
:Id="Id"
:ArchiveTypeEnum="ArchiveTypeEnum"
:rowData="rowData"
@getMenu="getMenu"
/>
</div>
</div>
</template>
<script>
import BaseContainer from '@/components/BaseContainer'
import Menu from './components/menu.vue'
import reportDoc from './components/report_doc/index.vue'
export default {
name: 'trialDocument',
components: { BaseContainer, Menu, reportDoc },
data() {
return {
viewStatus: false,
Id: null,
SubIdentificationEnum: null,
ArchiveTypeEnum: null,
rowData: {},
}
},
computed: {
isInspect() {
return this.hasPermi([
'trials:trials-panel:trial-summary:trial-document:inspect',
])
},
isManage() {
return this.hasPermi([
'trials:trials-panel:trial-summary:trial-document:manage',
])
},
},
methods: {
handleChange() {
this.Id = null
this.SubIdentificationEnum = null
this.ArchiveTypeEnum = null
this.rowData = {}
},
getMenu() {
this.$refs.Menu.getMenu()
},
},
}
</script>
<style lang="scss" scoped>
.trialDocument {
width: 100%;
height: 100%;
background-color: #fff;
display: flex;
align-items: center;
.left {
width: 300px;
height: 100%;
box-sizing: border-box;
border-right: 1px solid #e4e7ed;
.top {
width: 100%;
max-height: 75px;
display: flex;
flex-wrap: wrap;
padding: 0 15px;
margin-bottom: 5px;
.viewCheck {
width: 100%;
line-height: 30px;
margin-bottom: 10px;
}
}
.menuBox {
width: 100%;
height: calc(100% - 80px);
overflow-y: auto;
&::-webkit-scrollbar {
display: none; /* Chrome Safari */
}
}
.noTop {
height: 100%;
}
}
.main {
width: calc(100% - 300px);
height: 100%;
padding: 10px;
}
}
</style>