培训记录
continuous-integration/drone/push Build is passing Details

uat
wangxiaoshuang 2025-03-05 09:26:40 +08:00
parent bcde358584
commit a0594cab96
6 changed files with 1327 additions and 83 deletions

View File

@ -1202,3 +1202,27 @@ export function deleteTrialNormalRecordList(data) {
data
})
}
// 项目文档-培训记录列表
export function getTrialTrianingRecordList(data) {
return request({
url: `/TrialTrianingRecord/getTrialTrianingRecordList`,
method: 'post',
data
})
}
// 项目文档-培训记录新增/修改
export function addOrUpdateTrialTrianingRecord(data) {
return request({
url: `/TrialTrianingRecord/addOrUpdateTrialTrianingRecord`,
method: 'post',
data
})
}
// 项目文档-培训记录批量新增/修改
export function batchAddTrialTrianingRecord(data) {
return request({
url: `/TrialTrianingRecord/batchAddTrialTrianingRecord`,
method: 'post',
data
})
}

View File

@ -99,56 +99,53 @@
{{ $t('common:button:reset') }}
</el-button>
</el-form-item>
<el-form-item v-if="isManage && !viewStatus">
<el-button
type="primary"
:disabled="selectTable.length <= 0"
size="mini"
v-if="hasAccredit && isManage && !viewStatus"
@click.stop="auth"
>
{{ $t('trials:trialDocument:fileRecord:button:accredit') }}
</el-button>
<el-button
type="primary"
size="mini"
v-if="hasEdit && isManage && !viewStatus"
@click.stop="openFile(false)"
>
{{ $t('trials:trialDocument:fileRecord:button:uploadFile') }}
</el-button>
<el-button
type="primary"
size="mini"
v-if="hasEdit && isManage && !viewStatus"
@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 && isManage && !viewStatus"
@click.stop="downLoad"
>
{{ $t('trials:trialDocument:fileRecord:button:downLoad') }}
</el-button>
<el-button
type="primary"
size="mini"
v-if="hasDel && isManage && !viewStatus"
:disabled="selectTable.length <= 0"
@click.stop="delList"
>
{{ $t('trials:trialDocument:fileRecord:button:del') }}
</el-button>
</el-form-item>s
</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

View File

@ -115,39 +115,36 @@
{{ $t('common:button:reset') }}
</el-button>
</el-form-item>
<el-form-item v-if="isManage && !viewStatus">
<el-button
type="primary"
:disabled="selectTable.length <= 0"
size="mini"
v-if="hasAccredit && isManage && !viewStatus"
@click.stop="auth"
>
{{ $t('trials:trialDocument:reportDoc:button:accredit') }}
</el-button>
<el-button
type="primary"
size="mini"
v-if="hasAdd && isManage && !viewStatus"
@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 && isManage && !viewStatus"
@click.stop="downLoad"
>
{{ $t('trials:trialDocument:reportDoc:button:downLoad') }}
</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

View File

@ -0,0 +1,299 @@
<template>
<base-model :config="config">
<div slot="dialog-body">
<el-form
ref="trainRecordForm"
:model="form"
label-width="140px"
size="small"
:rules="rules"
>
<div class="base-dialog-body">
<el-form-item
v-if="!config.upload"
:label="$t('trials:trialDocument:trainRecord:form:TrianingDate')"
prop="TrianingDate"
>
<el-date-picker
v-model="form.TrianingDate"
type="date"
placeholder=""
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
<el-form-item
v-if="!config.upload"
:label="$t('trials:trialDocument:trainRecord:form:TrianingCount')"
prop="TrianingCount"
>
<el-input v-model.number="form.TrianingCount" type="number" />
</el-form-item>
<el-form-item
v-if="!config.upload"
:label="$t('trials:trialDocument:trainRecord:form:TrianingState')"
prop="TrianingState"
>
<el-input v-model="form.TrianingState" type="number" />
</el-form-item>
<el-form-item
v-if="!config.upload"
:label="$t('trials:trialDocument:trainRecord:form:Note')"
prop="Note"
>
<el-input v-model="form.Note" type="number" />
</el-form-item>
<el-form-item
v-if="!config.upload || config.upload === 'Train'"
:label="$t('trials:trialDocument:trainRecord:form:TrialFileRecord')"
prop="TrialFileRecord"
>
<el-upload
class="upload-demo"
action
:before-upload="(param) => beforeUpload(param, 'Trial', '.pdf')"
:http-request="(param) => handleUploadFile(param, 'Trial')"
:on-remove="() => handleRemoveFile('Trial')"
:limit="1"
accept=".pdf"
:file-list="TrialFile"
>
<el-button
size="small"
type="primary"
:disabled="
!!form.TrialFileRecord && !!form.TrialFileRecord.FilePath
"
>{{ $t('common:button:upload') }}
</el-button>
<span slot="tip" class="el-upload__tip">
{{ $t('trials:trialDocument:trainRecord:rule:mustPDF') }}
</span>
</el-upload>
</el-form-item>
<el-form-item
v-if="!config.upload || config.upload === 'History'"
:label="
$t('trials:trialDocument:trainRecord:form:historyFileRecord')
"
>
<el-upload
class="upload-demo"
action
:before-upload="(param) => beforeUpload(param, 'History', '.zip')"
:http-request="(param) => handleUploadFile(param, 'History')"
:on-remove="() => handleRemoveFile('History')"
:limit="1"
accept=".zip"
:file-list="HistoryFile"
>
<el-button
size="small"
type="primary"
:disabled="
!!form.HistoryFileRecord && !!form.HistoryFileRecord.FilePath
"
>{{ $t('common:button:upload') }}
</el-button>
<span slot="tip" class="el-upload__tip">
{{ $t('trials:trialDocument:trainRecord:rule:mustZIP') }}
</span>
</el-upload>
</el-form-item>
</div>
</el-form>
</div>
<div slot="dialog-footer">
<el-button size="small" @click="canel">
{{ $t('trials:trialDocument:trainRecord:button:canel') }}
</el-button>
<el-button size="small" type="primary" :loading="loading" @click="save">
{{ $t('trials:trialDocument:trainRecord:button:save') }}
</el-button>
</div>
</base-model>
</template>
<script>
import baseModel from '@/components/BaseModel'
import { addOrUpdateTrialTrianingRecord } from '@/api/dictionary'
export default {
props: {
config: {
required: true,
default: () => {
return {}
},
},
data: {
required: true,
default: () => {
return {}
},
},
ArchiveTypeEnum: {
type: Number,
default: 0,
},
rowData: {
type: Object,
default: () => {
return {}
},
},
},
components: {
'base-model': baseModel,
},
data() {
return {
form: {
Note: null,
TrianingCount: null,
TrianingDate: null,
TrianingState: null,
IsAuthorizedView: true,
TrialFileRecord: null,
HistoryFileRecord: null,
},
rules: {
TrianingDate: [
{
required: true,
message: this.$t('common:ruleMessage:specify'),
trigger: ['blur', 'change'],
},
],
TrianingCount: [
{
type: 'number',
min: 0,
message: this.$t(
'trials:trialDocument:trainRecord:ruleMessage:TrianingCountPattern'
),
trigger: 'blur',
},
{
validator: (rule, value, callback) => {
if (
value &&
(String(value).includes('.') ||
new RegExp(/\D/g).test(String(value)))
) {
callback(
new Error(
this.$t(
'trials:trialDocument:trainRecord:ruleMessage:TrianingCountPatternS'
)
)
)
} else {
callback()
}
},
trigger: 'blur',
},
],
},
loading: false,
TrialFile: [],
HistoryFile: [],
}
},
created() {
if (this.config.status === 'edit') {
Object.keys(this.form).forEach((key) => {
this.form[key] = this.data[key]
})
let arr = ['Trial', 'History']
arr.forEach((key) => {
if (
this.form[`${key}FileRecord`] &&
this.form[`${key}FileRecord`].FilePath
) {
this[`${key}File`] = []
this[`${key}File`].push({
name: this.form[`${key}FileRecord`].FileName,
url: this.form[`${key}FileRecord`].FilePath,
})
}
})
}
},
methods: {
async save() {
try {
let validate = await this.$refs.trainRecordForm.validate()
if (!validate) return false
this.loading = true
this.form.TrialFileTypeId = this.rowData.Id
if (this.config.status === 'edit') {
this.form.Id = this.data.Id
}
let res = await addOrUpdateTrialTrianingRecord(this.form)
if (res.IsSuccess) {
this.$emit('close')
this.$emit('getList')
}
} catch (err) {
console.log(err)
this.loading = false
}
},
canel() {
this.$emit('close')
},
handleRemoveFile(key) {
this.form[`${key}FileRecord`] = null
this[`${key}File`] = []
},
beforeUpload(param, key, accept) {
if (this[`${key}File`] && this[`${key}File`][0]) {
this.$alert(
this.$t('trials:trialDocument:trainRecord:msg:hasFile')
).catch()
return
}
let extendName = param.name
.substring(param.name.lastIndexOf('.'))
.toLocaleLowerCase()
if (accept !== extendName) {
this.$alert(
this.$t('trials:trialDocument:trainRecord:msg:typeErr')
).catch()
return
}
},
async handleUploadFile(param, key) {
let trialId = this.$route.query.trialId
let extendName = param.file.name
.substring(param.file.name.lastIndexOf('.'))
.toLocaleLowerCase()
if (!trialId)
return this.$alert(
this.$t('trials:trialDocument:trainRecord:msg:noTrialId')
).catch()
this.loading = true
var file = await this.fileToBlob(param.file)
let typeArr = ['', 'Report', 'Doc', 'Record', 'Reviewer', 'Template']
let types = typeArr[this.ArchiveTypeEnum]
let fileNameNoType = param.file.name
.substring(0, param.file.name.lastIndexOf('.'))
.toLocaleLowerCase()
const res = await this.OSSclient.put(
`/${trialId}/Document/${types}/${fileNameNoType}${extendName}`,
file
)
this.form[`${key}FileRecord`] = {
FileName: param.file.name,
FilePath: this.$getObjectName(res.url),
FileSize: param.file.size,
FileFormat: extendName,
}
this.loading = false
},
},
}
</script>

View File

@ -0,0 +1,918 @@
<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:trainRecord: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:trainRecord: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:trainRecord:search:TrianingDate')"
>
<el-date-picker
style="width: 240px"
v-model="TrianingDate"
type="daterange"
:range-separator="$t('baseForm:daterange:rangeSeparator')"
start-placeholder=""
end-placeholder=""
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</el-form-item>
<el-form-item
:label="$t('trials:trialDocument:trainRecord:search:name')"
>
<el-input
v-model="searchData.FileName"
style="width: 100px"
clearable
/>
</el-form-item>
<el-form-item
:label="
$t('trials:trialDocument:trainRecord: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
:label="$t('trials:trialDocument:trainRecord:search:UpdateTime')"
style="margin-bottom: 10px"
>
<el-date-picker
style="width: 240px"
v-model="UpdateTime"
type="daterange"
:range-separator="$t('baseForm:daterange:rangeSeparator')"
start-placeholder=""
end-placeholder=""
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</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-item v-if="isManage && !viewStatus">
<el-button
type="primary"
:disabled="selectTable.length <= 0"
size="mini"
v-if="hasAccredit && isManage && !viewStatus"
@click.stop="auth"
>
{{ $t('trials:trialDocument:trainRecord:button:accredit') }}
</el-button>
<el-button
type="primary"
size="mini"
v-if="hasEdit && isManage && !viewStatus"
@click.stop="openFile(false)"
>
{{ $t('trials:trialDocument:trainRecord:button:uploadFile') }}
</el-button>
<el-button
type="primary"
size="mini"
v-if="hasEdit && isManage && !viewStatus"
@click.stop="openFile(true)"
>
{{ $t('trials:trialDocument:trainRecord:button:uploadFolder') }}
</el-button>
<el-button
type="primary"
size="mini"
v-if="hasAdd && isManage && !viewStatus"
@click.stop="handleAdd"
>
{{ $t('trials:trialDocument:trainRecord:button:add') }}
</el-button>
<el-button
type="primary"
icon="el-icon-bottom"
size="mini"
:disabled="selectTable.length <= 0"
v-if="hasDownLoad && isManage && !viewStatus"
@click.stop="downLoad"
>
{{ $t('trials:trialDocument:trainRecord:button:downLoad') }}
</el-button>
</el-form-item>
</el-form>
</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="TrianingDate"
:label="$t('trials:trialDocument:trainRecord:table:TrianingDate')"
show-overflow-tooltip
sortable="custom"
/>
<el-table-column
prop="TrianingCount"
:label="$t('trials:trialDocument:trainRecord:table:TrianingCount')"
show-overflow-tooltip
sortable="custom"
/>
<el-table-column
prop="TrianingState"
:label="$t('trials:trialDocument:trainRecord:table:TrianingState')"
show-overflow-tooltip
sortable="custom"
/>
<el-table-column
prop="Note"
:label="$t('trials:trialDocument:trainRecord:table:Note')"
show-overflow-tooltip
sortable="custom"
/>
<!--文件名称-->
<el-table-column
prop="FileName"
:label="$t('trials:trialDocument:trainRecord: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')"
/>
</template>
</el-table-column>
<!--历史记录-->
<el-table-column
prop="HistoryFileRecord"
:label="$t('trials:trialDocument:trainRecord: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')"
/>
</template>
</el-table-column>
<el-table-column
prop="IsAuthorizedView"
:label="$t('trials:trialDocument:trainRecord: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:trainRecord:table:updateTime')"
show-overflow-tooltip
sortable="custom"
/>
<el-table-column
prop="CreateTime"
:label="$t('trials:trialDocument:trainRecord: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="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:trainRecord: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:trainRecord: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"
/>
<trainRecord-form
:ArchiveTypeEnum="ArchiveTypeEnum"
:rowData="rowData"
:config="update_config"
:data="selectData"
v-if="update_config.visible"
@close="updateClose"
@getList="getList"
/>
</box-content>
</template>
<script>
import {
addOrUpdateTrialFileType,
getTrialTrianingRecordList,
deleteTrialNormalRecord,
authorizedTTrialNormalRecord,
addOrUpdateTrialTrianingRecord,
batchAddTrialTrianingRecord,
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'
import trainRecordForm from './form.vue'
const searchDataDefault = () => {
return {
IsAuthorizedView: null,
FileName: null,
TrianingDateStartTime: null,
TrianingDateEndTime: null,
UpdateStartTime: null,
UpdateEndTime: null,
PageIndex: 1,
PageSize: 20,
Asc: false,
SortField: 'TrianingDate',
}
}
export default {
name: 'trainRecord',
components: { BoxContent, Pagination, uploadFiles, trainRecordForm },
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: {},
uploadPath: null,
faccept: ['.pdf'],
limitLength: 0,
TrianingDate: [],
UpdateTime: [],
update_config: {
visible: false,
showClose: true,
width: '600px',
title: '',
appendToBody: false,
status: 'add',
upload: null,
},
}
},
methods: {
//
async uplaodFile(list) {
console.log(list, 'list')
try {
if (!list || list.length <= 0) return false
let arr = []
list.forEach((item) => {
let obj = {
TrialId: this.$route.query.trialId,
TrialFileTypeId: this.Id,
IsAuthorizedView: true,
TrialFileRecord: item,
HistoryFileRecord: null,
Note: null,
TrianingCount: null,
TrianingDate: null,
TrianingState: null,
}
arr.push(obj)
})
this.loading = true
let res = await batchAddTrialTrianingRecord({
TrianingRecordList: arr,
})
this.loading = false
if (res.IsSuccess) {
this.getList()
}
} catch (err) {
this.loading = false
console.log(err)
}
},
//
upload(row, key) {
this.selectData = deepClone(row)
this.update_config.title = `${this.$t(
'trials:trialDocument:reportDoc:form:title:upload'
)}
-
${this.isEN ? this.rowData.Name : this.rowData.NameCN}`
this.update_config.status = 'edit'
this.update_config.upload = key
this.update_config.visible = true
},
//
handleAdd() {
this.selectData = {}
this.update_config.title = `${this.$t(
'trials:trialDocument:reportDoc:form:title:add'
)}
-
${this.isEN ? this.rowData.Name : this.rowData.NameCN}`
this.update_config.status = 'add'
this.update_config.upload = null
this.update_config.visible = true
},
//
handleEdit(row) {
this.selectData = deepClone(row)
this.update_config.title = `${this.$t(
'trials:trialDocument:reportDoc:form:title:edit'
)}
-
${this.isEN ? this.rowData.Name : this.rowData.NameCN}`
this.update_config.status = 'edit'
this.update_config.upload = null
this.update_config.visible = true
},
//
async delFile(row, key) {
try {
let confirm = await this.$confirm(
this.$t('trials:trialDocument:trainRecord: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 addOrUpdateTrialTrianingRecord(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:trainRecord: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:trainRecord: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)
})
},
async getList() {
try {
if (!this.Id) return false
this.searchData.TrialFileTypeId = this.Id
this.searchData.TrialId = this.$route.query.trialId
if (this.TrianingDate && this.TrianingDate.length >= 2) {
this.searchData.TrianingDateStartTime = this.TrianingDate[0]
this.searchData.TrianingDateEndTime = this.TrianingDate[1]
} else {
this.searchData.TrianingDateStartTime = null
this.searchData.TrianingDateEndTime = null
}
if (this.UpdateTime && this.UpdateTime.length >= 2) {
this.searchData.UpdateStartTime = this.UpdateTime[0]
this.searchData.UpdateEndTime = this.UpdateTime[1]
} else {
this.searchData.UpdateStartTime = null
this.searchData.UpdateEndTime = null
}
this.loading = true
let res = await getTrialTrianingRecordList(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.TrianingDate = []
this.UpdateTime = []
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
},
updateClose() {
this.update_config.visible = false
},
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:trainRecord: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>

View File

@ -42,7 +42,6 @@
:rowData="rowData"
@getMenu="getMenu"
/>
<!--v-if="[2].includes(SubIdentificationEnum)"-->
<file-record
v-if="[2].includes(SubIdentificationEnum)"
:viewStatus="viewStatus"
@ -51,6 +50,15 @@
:rowData="rowData"
@getMenu="getMenu"
/>
<!--v-if="[4].includes(SubIdentificationEnum)"-->
<train-record
v-if="[4].includes(SubIdentificationEnum)"
:viewStatus="viewStatus"
:Id="Id"
:ArchiveTypeEnum="ArchiveTypeEnum"
:rowData="rowData"
@getMenu="getMenu"
/>
</div>
</div>
</template>
@ -59,9 +67,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'
import trainRecord from './components/trainRecord/index.vue'
export default {
name: 'trialDocument',
components: { BaseContainer, Menu, reportDoc, fileRecord },
components: { BaseContainer, Menu, reportDoc, fileRecord, trainRecord },
data() {
return {
viewStatus: false,