项目文档增加附件
continuous-integration/drone/push Build is passing Details

main
wangxiaoshuang 2025-06-04 17:15:45 +08:00
parent 8e01f3af87
commit c1f10036b0
16 changed files with 992 additions and 476 deletions

View File

@ -4134,6 +4134,29 @@ export function publishTrialDocument(data) {
data data
}) })
} }
// 配置-获取项目文档附件列表
export function getTrialDocumentAttachmentList(data) {
return request({
url: `/TrialDocument/getTrialDocumentAttachmentList`,
method: 'post',
data
})
}
// 配置-新增或修改项目文档附件
export function addOrUpdateTrialDocumentAttachment(data) {
return request({
url: `/TrialDocument/addOrUpdateTrialDocumentAttachment`,
method: 'post',
data
})
}
// 配置-删除项目文档附件
export function deleteTrialDocumentAttachment(data) {
return request({
url: `/TrialDocument/deleteTrialDocumentAttachment/${data}`,
method: 'delete',
})
}
// 配置-获取稽查管理列表 // 配置-获取稽查管理列表
export function getTrialShowInspection(data) { export function getTrialShowInspection(data) {

View File

@ -11,6 +11,8 @@
<!-- v-else-if="fileType.indexOf('pdf') !== -1"--> <!-- v-else-if="fileType.indexOf('pdf') !== -1"-->
<!-- :src="`/static/pdfjs/web/viewer.html?file=${filePath}`">--> <!-- :src="`/static/pdfjs/web/viewer.html?file=${filePath}`">-->
<!-- </pdf>--> <!-- </pdf>-->
<video :src="`${OSSclientConfig.basePath}${filePath}`" style="width: 100%;height: 99%;" autoplay controls
v-else-if="fileType.indexOf('mp4') !== -1"></video>
<iframe v-else <iframe v-else
:src="`/static/onlyOffice/viewer.html?url=${OSSclientConfig.basePath}${filePath}?onlyOffice_url=${onlyOffice_url}&type=${fileType}&title=${title}&documentType=${documentType}&userName=${currentUser}`" :src="`/static/onlyOffice/viewer.html?url=${OSSclientConfig.basePath}${filePath}?onlyOffice_url=${onlyOffice_url}&type=${fileType}&title=${title}&documentType=${documentType}&userName=${currentUser}`"
width="100%" height="100%" frameborder="0" crossorigin="anonymous" /> width="100%" height="100%" frameborder="0" crossorigin="anonymous" />
@ -51,7 +53,6 @@ export default {
}, },
computed: { computed: {
documentType() { documentType() {
console.log(DOCUMENTTYPE[`.${this.fileType}`], 'documentType')
return DOCUMENTTYPE[`.${this.fileType}`] return DOCUMENTTYPE[`.${this.fileType}`]
} }
}, },

View File

@ -0,0 +1,23 @@
import Vue from "vue";
import Video from "./index.vue";
const PreviewConstructor = Vue.extend(Video);
const video = options => {
const { path, type, title } = options;
if (!path) throw `path is requred.but ${path}`
const id = `OnlyOffice_${new Date().getTime()}`;
const instance = new PreviewConstructor();
instance.id = id;
instance.vm = instance.$mount();
if (instance.vm.visible) return;
document.body.appendChild(instance.vm.$el);
instance.vm.open(path, type, title);
instance.vm.$on("closed", () => {
instance.vm.docEditor = null
document.body.removeChild(instance.vm.$el);
instance.vm.$destroy();
});
return instance.vm;
}
export default video;

View File

@ -0,0 +1,7 @@
import Video from "./index.vue";
import video from "./fun";
export default Vue => {
Vue.component(Video.name, Video);
Vue.prototype.$video = video;
};

View File

@ -0,0 +1,38 @@
<template>
<el-dialog v-if="visible" :visible.sync="visible" :title="title" :fullscreen="true" append-to-body
custom-class="base-dialog-wrapper" @close="handleClose">
<div class="base-modal-body" style="border: 2px solid #ccc; padding: 10px">
<video :src="path" style="width: 100%;height: 99%;" autoplay controls></video>
</div>
</el-dialog>
</template>
<script>
export default {
name: "Video",
data() {
return {
visible: false,
path: null,
type: null,
title: null,
};
},
methods: {
open(path, type, title) {
this.path = this.OSSclientConfig.basePath + path;
this.title = title;
this.visible = true;
},
handleClose() {
this.$emit("closed");
},
},
};
</script>
<style lang="scss" scoped>
#placeholder {
width: 100%;
height: 100%;
}
</style>

View File

@ -56,6 +56,8 @@ import Preview from '@/components/Preview/index'
Vue.use(Preview) Vue.use(Preview)
import Onlyoffice from '@/components/Preview_onlyoffice/index' import Onlyoffice from '@/components/Preview_onlyoffice/index'
Vue.use(Onlyoffice) Vue.use(Onlyoffice)
import Video from '@/components/Preview_video/index'
Vue.use(Video)
import MFA from '@/components/MFA/index' import MFA from '@/components/MFA/index'
Vue.use(MFA) Vue.use(MFA)
import FB from '@/components/feedBack/index' import FB from '@/components/feedBack/index'

View File

@ -10,7 +10,7 @@
<el-form-item :label="$t('dictionary:signature:form:File')"> <el-form-item :label="$t('dictionary:signature:form:File')">
<div class="upload-container"> <div class="upload-container">
<el-upload class="upload-demo" action accept=".pdf" :before-upload="beforeUpload" <el-upload class="upload-demo" action accept=".pdf,.mp4" :before-upload="beforeUpload"
:http-request="handleUploadFile" :on-preview="handlePreview" :on-remove="handleRemoveFile" :http-request="handleUploadFile" :on-preview="handlePreview" :on-remove="handleRemoveFile"
:show-file-list="true" :file-list="fileList" :limit="1" :on-exceed="handleExceed" :show-file-list="true" :file-list="fileList" :limit="1" :on-exceed="handleExceed"
:disabled="form.Type === ''"> :disabled="form.Type === ''">
@ -229,7 +229,7 @@ export default {
this.$message.warning(this.$t('upload:rule:maxFile1')) this.$message.warning(this.$t('upload:rule:maxFile1'))
}, },
checkFileSuffix(fileName) { checkFileSuffix(fileName) {
var typeArr = ['pdf'] var typeArr = ['pdf', 'mp4']
var extendName = fileName var extendName = fileName
.substring(fileName.lastIndexOf('.') + 1) .substring(fileName.lastIndexOf('.') + 1)
.toLocaleLowerCase() .toLocaleLowerCase()

View File

@ -82,7 +82,8 @@ export default {
'.doc', '.doc',
'.docx', '.docx',
'.xls', '.xls',
'.xlsx'] '.xlsx',
'.mp4']
} }
}, },
mounted() { mounted() {
@ -172,18 +173,7 @@ export default {
this.$message.warning(this.$t('upload:rule:maxFile1')) this.$message.warning(this.$t('upload:rule:maxFile1'))
}, },
checkFileSuffix(fileName) { checkFileSuffix(fileName) {
var typeArr = [ var typeArr = this.accept.map(item => item.split('.')[1])
'jpg',
'jpeg',
'png',
'pdf',
'ppt',
'pptx',
'doc',
'docx',
'xls',
'xlsx',
]
var extendName = fileName var extendName = fileName
.substring(fileName.lastIndexOf('.') + 1) .substring(fileName.lastIndexOf('.') + 1)
.toLocaleLowerCase() .toLocaleLowerCase()

View File

@ -46,16 +46,16 @@
<!-- 新增/编辑附件 --> <!-- 新增/编辑附件 -->
<el-dialog :visible.sync="visible" :close-on-click-modal="false" :append-to-body="true" :title="title" <el-dialog :visible.sync="visible" :close-on-click-modal="false" :append-to-body="true" :title="title"
width="800px" custom-class="base-dialog-wrapper"> width="800px" custom-class="base-dialog-wrapper">
<attachmentForm v-if="visible" :data="rowData" :SystemDocumentId="SystemDocumentId" <attachmentForm v-if="visible" :data="rowDATA" :SystemDocumentId="SystemDocumentId"
@closeDialog="closeDialog" @getList="getAllList" /> @closeDialog="closeDialog" @getList="getAllList" />
</el-dialog> </el-dialog>
</template> </template>
</base-model> </base-model>
<viewer ref="picture_perview2" style="margin: 0 10px" <viewer ref="picture_perview2" style="margin: 0 10px"
v-if="rowData.FileFormat && ['png', 'jpg', 'jpeg'].includes(rowData.FileFormat.toLowerCase())" v-if="rowDATA.FileFormat && ['png', 'jpg', 'jpeg'].includes(rowDATA.FileFormat.toLowerCase())"
:images="[`${OSSclientConfig.basePath}${rowData.FilePath}`]" :options="viewerOptions"> :images="[`${OSSclientConfig.basePath}${rowDATA.FilePath}`]" :options="viewerOptions">
<img v-show="false" :src="`${OSSclientConfig.basePath}${rowData.FilePath}`" alt="Image" /> <img v-show="false" :src="`${OSSclientConfig.basePath}${rowDATA.FilePath}`" alt="Image" />
</viewer> </viewer>
<!-- <attachmentPreview :SystemDocumentId="SystemDocumentId" :visible.sync="perview_visible" <!-- <attachmentPreview :SystemDocumentId="SystemDocumentId" :visible.sync="perview_visible"
v-if="perview_visible" /> --> v-if="perview_visible" /> -->
@ -113,7 +113,7 @@ export default {
visible: false, visible: false,
title: null, title: null,
list: [], list: [],
rowData: {}, rowDATA: {},
loading: false, loading: false,
viewerOptions: { viewerOptions: {
toolbar: { toolbar: {
@ -167,7 +167,7 @@ export default {
if (!row.Id) { if (!row.Id) {
this.title = this.$t('dictionary:signature:attachmentForm:title:add') this.title = this.$t('dictionary:signature:attachmentForm:title:add')
} }
this.rowData = Object.assign({}, row) this.rowDATA = Object.assign({}, row)
this.visible = true this.visible = true
}, },
async getList() { async getList() {
@ -207,7 +207,7 @@ export default {
}, },
preview(data) { preview(data) {
// return this.perview_visible = true // return this.perview_visible = true
this.rowData = Object.assign({}, data) this.rowDATA = Object.assign({}, data)
if (['.ppt', if (['.ppt',
'.pptx', '.pptx',
'.doc', '.doc',
@ -234,6 +234,13 @@ export default {
title: data.Name, title: data.Name,
}) })
} }
if (['.mp4'].includes(`.${data.FileFormat.toLowerCase()}`)) {
this.$video({
path: data.Path || data.FilePath,
type: 'mp4',
title: data.Name,
})
}
}, },
// //
handleSortByColumn(column) { handleSortByColumn(column) {

View File

@ -73,6 +73,7 @@ import xlsx from '@/assets/file_icon/xlsx.png'
import PreviewFile from '@/components/PreviewFile' import PreviewFile from '@/components/PreviewFile'
import imageViewer from './image-viewer' import imageViewer from './image-viewer'
import { getSystemDocumentAttachmentList } from '@/api/dictionary' import { getSystemDocumentAttachmentList } from '@/api/dictionary'
import { getTrialDocumentAttachmentList } from '@/api/trials'
const defaultSearchData = () => { const defaultSearchData = () => {
return { return {
PageIndex: 1, PageIndex: 1,
@ -100,6 +101,10 @@ export default {
isView: { isView: {
type: Boolean, type: Boolean,
default: false default: false
},
isTrial: {
type: Boolean,
default: false
} }
}, },
data() { data() {
@ -140,11 +145,20 @@ export default {
try { try {
if (!this.SystemDocumentId) return false if (!this.SystemDocumentId) return false
this.loading = true this.loading = true
if (!this.isTrial) {
this.searchData.SystemDocumentId = this.SystemDocumentId this.searchData.SystemDocumentId = this.SystemDocumentId
} else {
this.searchData.TrialDocumentId = this.SystemDocumentId
}
if (this.isView) { if (this.isView) {
this.searchData.OffLine = false this.searchData.OffLine = false
} }
let res = await getSystemDocumentAttachmentList(this.searchData) let res = null
if (!this.isTrial) {
res = await getSystemDocumentAttachmentList(this.searchData)
} else {
res = await getTrialDocumentAttachmentList(this.searchData)
}
this.loading = false this.loading = false
if (res.IsSuccess) { if (res.IsSuccess) {
this.list = res.Result.CurrentPageData this.list = res.Result.CurrentPageData

View File

@ -130,10 +130,12 @@
<SignForm :is-system-doc="currentRow.IsSystemDoc" :document-id="currentRow.Id" :file-name="fileName" <SignForm :is-system-doc="currentRow.IsSystemDoc" :document-id="currentRow.Id" :file-name="fileName"
:trial-id="trialId" @closeDialog="closeSignDialog" /> :trial-id="trialId" @closeDialog="closeSignDialog" />
</el-dialog> </el-dialog>
<attachmentList v-if="config.visible" :config="config" :rowData="currentRow" :SystemDocumentId="SystemDocumentId" <attachmentList2 v-if="config.visible && !currentRow.IsSystemDoc" :config="config" :rowData="currentRow"
:isView="true" @getList="getList" /> :TrialDocumentId="TrialDocumentId" :isView="true" @getList="getList" />
<attachmentPreview :SystemDocumentId="SystemDocumentId" :visible.sync="perview_visible" :isView="true" <attachmentList v-if="config.visible && currentRow.IsSystemDoc" :config="config" :rowData="currentRow"
v-if="perview_visible" /> :SystemDocumentId="TrialDocumentId" :isView="true" @getList="getList" />
<attachmentPreview :SystemDocumentId="TrialDocumentId" :isTrial="!currentRow.IsSystemDoc"
:visible.sync="perview_visible" :isView="true" v-if="perview_visible" />
</BaseContainer> </BaseContainer>
</template> </template>
<script> <script>
@ -145,6 +147,7 @@ import SignForm from './components/SignForm'
import store from '@/store' import store from '@/store'
import attachmentPreview from '@/views/dictionary/attachment/components/SignatureTemplate/attachmentPreview' import attachmentPreview from '@/views/dictionary/attachment/components/SignatureTemplate/attachmentPreview'
import attachmentList from '@/views/dictionary/attachment/components/SignatureTemplate/attachmentList' import attachmentList from '@/views/dictionary/attachment/components/SignatureTemplate/attachmentList'
import attachmentList2 from '@/views/trials/trials-panel/setting/attachment/components/attachmentList'
const searchDataDefault = () => { const searchDataDefault = () => {
return { return {
FileTypeId: '', FileTypeId: '',
@ -158,7 +161,7 @@ const searchDataDefault = () => {
} }
export default { export default {
name: 'TrialAttachments', name: 'TrialAttachments',
components: { BaseContainer, Pagination, PreviewFile, SignForm, attachmentPreview, attachmentList }, components: { BaseContainer, Pagination, PreviewFile, SignForm, attachmentPreview, attachmentList, attachmentList2 },
data() { data() {
return { return {
searchData: searchDataDefault(), searchData: searchDataDefault(),
@ -180,7 +183,7 @@ export default {
currentUser: zzSessionStorage.getItem('userName'), currentUser: zzSessionStorage.getItem('userName'),
typeOptions: [], typeOptions: [],
trialId: this.$route.query.trialId, trialId: this.$route.query.trialId,
SystemDocumentId: null, TrialDocumentId: null,
perview_visible: null, perview_visible: null,
config: { config: {
visible: false, visible: false,
@ -205,7 +208,7 @@ export default {
methods: { methods: {
openAttachment(row, isList = false) { openAttachment(row, isList = false) {
if (!row.AttachmentCount) return false if (!row.AttachmentCount) return false
this.SystemDocumentId = row.Id this.TrialDocumentId = row.Id
this.currentRow = { ...row } this.currentRow = { ...row }
if (!isList) { if (!isList) {
this.perview_visible = true this.perview_visible = true

View File

@ -1,115 +1,50 @@
<template> <template>
<el-form <el-form ref="attachmentFrom" v-loading="loading" :model="form" label-width="190px" size="small" :rules="rules"
ref="trialAttachmentFrom" class="upload-temporary-file">
v-loading="loading"
:model="form"
label-width="240px"
size="small"
:rules="rules"
class="upload-temporary-file"
>
<div class="base-dialog-body"> <div class="base-dialog-body">
<!-- 文件类型 --> <el-form-item :label="$t('trials:attachment:form:FileName')" prop="Name">
<el-form-item :label="$t('trials:attachment:table:fileType')" prop="FileTypeId"> <el-input v-model="form.Name" clearable></el-input>
<el-select
v-model="form.FileTypeId"
style="width:100%;"
size="small"
>
<el-option
v-for="item of dictionaryList.Trial_Document"
:key="item.Id"
:label="item.Value"
:value="item.Id"
/>
</el-select>
</el-form-item> </el-form-item>
<!-- 文件 --> <el-form-item :label="$t('trials:attachment:form:OffLine')" prop="OffLine">
<el-form-item :label="$t('trials:attachment:form:file')"> <el-switch v-model="form.OffLine" :active-value="true" :inactive-value="false"
:active-text="$fd('YesOrNo', true)" :inactive-text="$fd('YesOrNo', false)">
</el-switch>
</el-form-item>
<el-form-item :label="$t('trials:attachment:form:File')">
<div class="upload-container"> <div class="upload-container">
<el-upload <el-upload class="upload-demo" action :accept="this.accept.join(',')" :before-upload="beforeUpload"
class="upload-demo" :http-request="handleUploadFile" :on-preview="handlePreview" :on-remove="handleRemoveFile"
action :show-file-list="true" :file-list="fileList" :limit="1" :on-exceed="handleExceed">
accept=".pdf" <el-button size="small" type="primary" :loading="btnLoading">{{ $t('common:button:check')
:before-upload="beforeUpload" }}</el-button>
:http-request="handleUploadFile" <span slot="tip" style="margin-left: 10px" class="el-upload__tip">
:on-remove="handleRemoveFile" ({{ $t('trials:signature:label:type').replace("xxx", this.accept.join(", ")) }})
:show-file-list="true"
:file-list="fileList"
:limit="1"
:on-exceed="handleExceed"
:disabled="form.FileTypeId === ''"
>
<el-button size="small" type="primary" :disabled="form.FileTypeId === '' || saveBtnLoading" :loading="btnLoading">
{{ $t('trials:attachment:button:select') }}
</el-button>
<span
slot="tip"
style="margin-left:10px;"
class="el-upload__tip"
>
{{ $t('system:tip:file:pdf') }}
</span> </span>
</el-upload> </el-upload>
</div> </div>
</el-form-item> </el-form-item>
<!-- 需要签署的用户类型 -->
<el-form-item :label="$t('trials:attachment:table:userType')" prop="NeedConfirmedUserTypeIdList">
<el-select
v-model="form.NeedConfirmedUserTypeIdList"
style="width:100%;"
multiple
>
<el-option
v-for="item of userTypeOptions"
v-show="item.UserTypeEnum !== 1 && item.UserTypeEnum !== 8 && item.UserTypeEnum !== 20 && item.UserTypeEnum !== 26 && item.UserTypeEnum !== 27 && item.UserTypeEnum !== 31"
:key="item.Id"
:label="item.UserTypeShortName"
:value="item.Id"
>
<span>{{ item.UserType }}</span>
</el-option>
</el-select>
</el-form-item>
<!-- 查看最短时间分钟 -->
<el-form-item :label="$t('trials:attachment:table:min')" prop="SignViewMinimumMinutes">
<el-input-number
v-model="form.SignViewMinimumMinutes"
controls-position="right"
:min="1"
:max="50"
/>
</el-form-item>
<!-- 描述 -->
<el-form-item :label="$t('trials:attachment:table:description')" prop="Description">
<el-input
v-model="form.Description"
type="textarea"
:autosize="{ minRows: 5, maxRows: 6}"
maxlength="500"
show-word-limit
/>
</el-form-item>
</div> </div>
<div class="base-dialog-footer" style="text-align:right;margin-top:10px;"> <div class="base-dialog-footer" style="text-align: right; margin-top: 10px">
<el-form-item style="text-align:right;"> <el-form-item style="text-align: right">
<!-- Save --> <el-button size="small" type="primary" :disabled="form.FileTypeId === '' || form.Name === ''"
<el-button size="small" type="primary" :disabled="form.FileTypeId === '' || form.Name === ''" :loading="saveBtnLoading" @click="handleSave"> :loading="saveBtnLoading" @click="handleSave">{{ $t('common:button:save') }}</el-button>
{{ $t('common:button:save') }}
</el-button>
</el-form-item> </el-form-item>
</div> </div>
</el-form> </el-form>
</template> </template>
<script> <script>
import { addOrUpdateTrialDocument, uploadTrialDoc, getTrialUserTypeList } from '@/api/trials' import { addOrUpdateTrialDocumentAttachment } from '@/api/trials'
import { getBasicDataSelects } from '@/api/dictionary/dictionary'
export default { export default {
name: 'TrialAttachmentFrom',
props: { props: {
data: { data: {
type: Object, type: Object,
default() { return {} } default() {
return {}
},
},
TrialDocumentId: {
type: String,
default: ''
} }
}, },
@ -117,150 +52,138 @@ export default {
return { return {
form: { form: {
Id: '', Id: '',
TrialId: '', Name: null,
FileTypeId: '', FileFormat: null,
Name: '', FileName: null,
Path: '', FilePath: null,
IsDeleted: false, FileSize: null,
SignViewMinimumMinutes: null, OffLine: false,
Description: '', TrialDocumentId: null,
NeedConfirmedUserTypeIdList: []
}, },
rules: { rules: {
FileTypeId: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: ['blur', 'change'] }], Name: [
SignViewMinimumMinutes: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: ['change'] }], {
NeedConfirmedUserTypeIdList: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: ['blur', 'change'] }], required: true,
Description: [{ max: 500, message: `${this.$t('common:ruleMessage:maxLength')} 500`, trigger: ['blur', 'change'] }] message: this.$t('common:ruleMessage:specify'),
trigger: ['change'],
},
],
}, },
fileList: [], fileList: [],
userTypeOptions: [],
btnLoading: false, btnLoading: false,
saveBtnLoading: false, saveBtnLoading: false,
loading: false, loading: false,
dictionaryList: {} accept: ['.jpg',
'.jpeg',
'.png',
'.pdf',
'.ppt',
'.pptx',
'.doc',
'.docx',
'.xls',
'.xlsx',
".mp4"]
} }
}, },
mounted() { mounted() {
this.initForm() this.initForm()
}, },
methods: { methods: {
//
handleSave() {
this.$refs.trialAttachmentFrom.validate(valid => {
if (!valid) return
if (!this.form.Name) {
this.$alert(this.$t('trials:attachment:message:selectFile'))
return
}
if (this.form.TrialId === '') {
this.form.TrialId = this.$route.query.trialId
}
this.saveBtnLoading = true
addOrUpdateTrialDocument(this.form).then(res => {
this.saveBtnLoading = false
this.$emit('closeDialog')
this.$emit('getList')
if (this.form.Id) {
this.$message.success(this.$t('common:message:savedSuccessfully'))
} else {
this.$message.success(this.$t('common:message:addedSuccessfully'))
}
// this.$message.success(this.$t('common:message:savedSuccessfully'))
}).catch(() => {
this.saveBtnLoading = false
})
})
},
async initForm() { async initForm() {
this.loading = true this.loading = true
await this.getDicData() if (this.data && this.data.Id) {
await this.getUserType() Object.keys(this.form).forEach(key => {
if (Object.keys(this.data).length > 0) { this.form[key] = this.data[key]
if (this.data.Path) { })
this.fileList = [ this.fileList = [
{ {
name: this.data.Name, name: this.data.FileName,
path: this.data.Path, url: this.data.FilePath,
url: this.data.Path, path: this.data.FilePath,
} },
] ]
} }
this.form.Id = this.data.Id
this.form.FileTypeId = this.data.FileTypeId
this.form.Name = this.data.Name
this.form.Path = this.data.Path
this.form.IsDeleted = this.data.IsDeleted
this.form.Description = this.data.Description
this.form.SignViewMinimumMinutes = this.data.SignViewMinimumMinutes
}
this.loading = false this.loading = false
}, },
//
getDicData() {
getBasicDataSelects(['Trial_Document']).then(res => {
this.dictionaryList = { ...res.Result }
})
},
//
getUserType() {
getTrialUserTypeList().then(res => {
this.userTypeOptions = res.Result
if (this.form.Id) {
this.form.NeedConfirmedUserTypeIdList = this.data.NeedConfirmedUserTypeeIds
}
}).catch(() => { this.loading = false })
},
handleViewableUserTypeChange(valArr) {
this.form.NeedConfirmedUserTypeIdList = []
this.needConfirmedUserTypeOptions = []
valArr.forEach((val) => {
const i = this.userTypeOptions.findIndex(userType => { return userType.Id === val })
this.needConfirmedUserTypeOptions.push(this.userTypeOptions[i])
})
},
//
beforeUpload(file) { beforeUpload(file) {
//
if (this.checkFileSuffix(file.name)) { if (this.checkFileSuffix(file.name)) {
this.fileList = [] this.fileList = []
return true return true
} else { } else {
this.$alert(this.$t('trials:attachment:message:pdf')) this.$alert(this.$t('trials:signature:label:type').replace("xxx", this.accept.join(", ")))
return false return false
} }
}, },
//
async handleUploadFile(param) { async handleUploadFile(param) {
this.loading = true this.loading = true
var file = await this.fileToBlob(param.file) var file = await this.fileToBlob(param.file)
const trialId = this.$route.query.trialId const res = await this.OSSclient.put(
console.log(this.OSSclient.put) `/${this.$route.query.trialId}/DocumentToSign/${param.file.name}${new Date().getTime()}`,
const res = await this.OSSclient.put(`/${trialId}/DocumentToSign/${param.file.name}`, file) file
this.fileList.push({ name: param.file.name, path: this.$getObjectName(res.url), url: this.$getObjectName(res.url) }) )
this.form.Path = this.$getObjectName(res.url) this.fileList.push({
name: param.file.name,
path: this.$getObjectName(res.url),
url: this.$getObjectName(res.url),
})
this.form.Name = param.file.name this.form.Name = param.file.name
this.form.FileName = param.file.name
this.form.FilePath = this.$getObjectName(res.url)
this.form.FileSize = param.file.size
this.form.FileFormat = param.file.name
.substring(param.file.name.lastIndexOf('.'))
.toLocaleLowerCase().split('.')[1]
this.loading = false this.loading = false
}, },
// handleSave() {
this.$refs.attachmentFrom.validate((valid) => {
if (!valid) return false
if (!this.form.FilePath)
return this.$alert(this.$t('trials:signature:message:selectFile'))
this.saveBtnLoading = true
if (this.TrialDocumentId) this.form.TrialDocumentId = this.TrialDocumentId
addOrUpdateTrialDocumentAttachment(this.form)
.then((res) => {
this.saveBtnLoading = false
this.$emit('closeDialog')
this.$emit('getList')
this.$message.success(this.$t('common:message:updatedSuccessfully'))
})
.catch(() => {
this.saveBtnLoading = false
})
})
},
handleRemoveFile() { handleRemoveFile() {
this.fileList = [] this.fileList = []
this.form.Path = '' this.form.FilePath = ''
this.form.Name = '' this.form.FileSize = ''
this.form.FileFormat = ''
this.form.FileName = ''
},
handlePreview(file) {
if (file.fullPath) {
window.open(file.fullPath, '_blank')
}
}, },
handleExceed(files, fileList) { handleExceed(files, fileList) {
this.$message.warning(this.$t('trials:attachment:message:uploadFile')) this.$message.warning(this.$t('upload:rule:maxFile1'))
}, },
// pdf
checkFileSuffix(fileName) { checkFileSuffix(fileName) {
var typeArr = ['pdf'] var typeArr = this.accept.map(item => item.split('.')[1])
var extendName = fileName.substring(fileName.lastIndexOf('.') + 1).toLocaleLowerCase() var extendName = fileName
.substring(fileName.lastIndexOf('.') + 1)
.toLocaleLowerCase()
if (typeArr.indexOf(extendName) !== -1) { if (typeArr.indexOf(extendName) !== -1) {
return true return true
} else { } else {
return false return false
} }
} },
} },
} }
</script> </script>
@ -271,18 +194,20 @@ export default {
width: 80px; width: 80px;
height: 40px; height: 40px;
} }
.upload-container .el-input--small { .upload-container .el-input--small {
margin-bottom: 5px; margin-bottom: 5px;
} }
.upload-container .el-icon-circle-check { .upload-container .el-icon-circle-check {
color: #428bca; color: #428bca;
font-size: 13px; font-size: 13px;
} }
.account_item_clear { .account_item_clear {
.el-tag__close { .el-tag__close {
display: none !important; display: none !important;
} }
} }
} }
</style> </style>

View File

@ -0,0 +1,265 @@
<template>
<div v-if="config.visible">
<base-model :config="config">
<template slot="dialog-body">
<el-form ref="form" :model="rowData" label-width="80px" style="width: 80%;display: inline-block;">
<el-form-item :label="`${$t('trials:attachment:table:Name')}: `">
<span class="name text-ellipsis" :title="rowData.Name">{{ rowData.Name }}</span>
</el-form-item>
</el-form>
<el-button size="mini" type="primary" style="float:right" @click.stop="edit({})" v-if="!isView">
{{ $t('common:button:add') }}</el-button>
<el-table :data="list" style="width: 100%" max-height="300px" v-loading="loading"
@sort-change="handleSortByColumn">
<el-table-column type="index" width="60" />
<el-table-column prop="Name" :label="$t('trials:attachment:attachmentList:FileName')"
sortable="custom" />
<el-table-column prop="OffLine" :label="$t('trials:attachment:attachmentList:OffLine')"
sortable="custom" v-if="!isView">
<template slot-scope="scope">
<el-switch v-model="scope.row.OffLine" @change="(val) => OffLine(scope.row, val)"
:active-value="true" :inactive-value="false" :active-text="$fd('YesOrNo', true)"
:inactive-text="$fd('YesOrNo', false)">
</el-switch>
</template>
</el-table-column>
<el-table-column prop="CreateTime" :label="$t('trials:attachment:attachmentList:CreateTime')"
sortable="custom" />
<el-table-column :label="$t('common:action:action')" min-width="120px">
<template slot-scope="scope">
<el-button size="mini" type="text" @click.stop="preview(scope.row)">
{{ $t('common:button:preview') }}
</el-button>
<el-button size="mini" type="text" @click.stop="edit(scope.row)" v-if="!isView">
{{ $t('common:button:edit') }}
</el-button>
<!-- <el-button size="mini" type="text" @click.stop="OffLine(scope.row, true)"
:disabled="scope.row.OffLine">
{{ $t('trials:attachment:attachmentList:OffLine') }}
</el-button> -->
<el-button size="mini" type="text" @click.stop="del(scope.row)" v-if="!isView">
{{ $t('common:button:delete') }}
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 新增/编辑附件 -->
<el-dialog :visible.sync="visible" :close-on-click-modal="false" :append-to-body="true" :title="title"
width="800px" custom-class="base-dialog-wrapper">
<attachmentForm v-if="visible" :data="rowDATA" :TrialDocumentId="TrialDocumentId"
@closeDialog="closeDialog" @getList="getAllList" />
</el-dialog>
</template>
</base-model>
<viewer ref="picture_perview2" style="margin: 0 10px"
v-if="rowData.FileFormat && ['png', 'jpg', 'jpeg'].includes(rowDATA.FileFormat.toLowerCase())"
:images="[`${OSSclientConfig.basePath}${rowDATA.FilePath}`]" :options="viewerOptions">
<img v-show="false" :src="`${OSSclientConfig.basePath}${rowDATA.FilePath}`" alt="Image" />
</viewer>
<!-- <attachmentPreview :TrialDocumentId="TrialDocumentId" :visible.sync="perview_visible"
v-if="perview_visible" /> -->
</div>
</template>
<script>
import BaseModel from '@/components/BaseModel'
import attachmentForm from './attachmentForm'
// import attachmentPreview from './attachmentPreview'
import { addOrUpdateTrialDocumentAttachment, getTrialDocumentAttachmentList, deleteTrialDocumentAttachment } from '@/api/trials'
const defaultSearchData = () => {
return {
PageIndex: 1,
PageSize: 1000,
Asc: false,
OffLine: null,
SortField: null
}
}
export default {
components: {
BaseModel,
attachmentForm,
// attachmentPreview
},
props: {
config: {
type: Object,
default: () => {
return {
visible: false,
title: this.$t('trials:attachment:attachmentList:title'),
width: '800px',
}
}
},
isView: {
type: Boolean,
default: false
},
rowData: {
type: Object,
default: () => {
return {}
}
},
TrialDocumentId: {
type: String,
default: ''
}
},
data() {
return {
searchData: defaultSearchData(),
visible: false,
title: null,
list: [],
rowDATA: {},
loading: false,
viewerOptions: {
toolbar: {
zoomIn: true,
zoomOut: true,
reset: true,
prev: false,
next: false,
rotateLeft: true,
rotateRight: true,
flipHorizontal: true,
flipVertical: true,
}
},
// perview_visible: false
}
},
watch: {
TrialDocumentId: {
handler() {
this.getList()
},
immediate: true,
}
},
methods: {
closeDialog() {
this.visible = false
},
getAllList() {
this.getList()
this.$emit("getList")
},
async del(row) {
try {
let confirm = await this.$confirm(this.$t("trials:attachment:attachmentList:message:del"))
if (!confirm) return false
this.loading = true
let res = await deleteTrialDocumentAttachment(row.Id)
this.loading = false
if (res.IsSuccess) {
this.getAllList()
}
} catch (err) {
console.log(err)
this.loading = false
}
},
edit(row) {
this.title = this.$t('trials:attachment:attachmentForm:title:update')
if (!row.Id) {
this.title = this.$t('trials:attachment:attachmentForm:title:add')
}
this.rowDATA = Object.assign({}, row)
this.visible = true
},
async getList() {
try {
if (!this.TrialDocumentId) return false
this.loading = true
this.searchData.TrialDocumentId = this.TrialDocumentId
if (this.isView) {
this.searchData.OffLine = false
}
let res = await getTrialDocumentAttachmentList(this.searchData)
this.loading = false
if (res.IsSuccess) {
this.list = res.Result.CurrentPageData
}
} catch (err) {
this.loading = false
console.log(err)
}
},
async OffLine(row, val) {
try {
let data = Object.assign({}, row)
data.OffLine = val
this.loading = true
let res = await addOrUpdateTrialDocumentAttachment(data)
this.loading = false
if (res.IsSuccess) {
this.$t('trials:attachment:attachmentList:updateSuccessfully')
this.getList()
}
} catch (err) {
this.loading = false
row.OffLine = !row.OffLine
console.log(err)
}
},
preview(data) {
// return this.perview_visible = true
this.rowDATA = Object.assign({}, data)
if (['.ppt',
'.pptx',
'.doc',
'.docx',
'.xls',
'.xlsx'].includes(`.${data.FileFormat.toLowerCase()}`)) {
this.$onlyOffice({
path: data.FilePath,
type: data.FileFormat,
title: data.Name
})
}
if (['.jpg',
'.jpeg',
'.png'].includes(`.${data.FileFormat.toLowerCase()}`)) {
this.$nextTick(() => {
this.$refs['picture_perview2'].$viewer.show()
})
}
if (['.pdf'].includes(`.${data.FileFormat.toLowerCase()}`)) {
this.$preview({
path: data.Path || data.FilePath,
type: 'pdf',
title: data.Name,
})
}
if (['.mp4'].includes(`.${data.FileFormat.toLowerCase()}`)) {
this.$video({
path: data.Path || data.FilePath,
type: 'mp4',
title: data.Name,
})
}
},
//
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()
},
}
}
</script>
<style lang="scss" scoped>
.name {
display: block;
width: 90%;
}
</style>

View File

@ -0,0 +1,255 @@
<template>
<el-form ref="trialAttachmentFrom" v-loading="loading" :model="form" label-width="240px" size="small" :rules="rules"
class="upload-temporary-file">
<div class="base-dialog-body">
<!-- 文件类型 -->
<el-form-item :label="$t('trials:attachment:table:fileType')" prop="FileTypeId">
<el-select v-model="form.FileTypeId" style="width:100%;" size="small">
<el-option v-for="item of dictionaryList.Trial_Document" :key="item.Id" :label="item.Value"
:value="item.Id" />
</el-select>
</el-form-item>
<!-- 文件 -->
<el-form-item :label="$t('trials:attachment:form:file')">
<div class="upload-container">
<el-upload class="upload-demo" action accept=".pdf,.mp4" :before-upload="beforeUpload"
:http-request="handleUploadFile" :on-remove="handleRemoveFile" :show-file-list="true" :file-list="fileList"
:limit="1" :on-exceed="handleExceed" :disabled="form.FileTypeId === ''">
<el-button size="small" type="primary" :disabled="form.FileTypeId === '' || saveBtnLoading"
:loading="btnLoading">
{{ $t('trials:attachment:button:select') }}
</el-button>
<span slot="tip" style="margin-left:10px;" class="el-upload__tip">
{{ $t('system:tip:file:pdf') }}
</span>
</el-upload>
</div>
</el-form-item>
<!-- 需要签署的用户类型 -->
<el-form-item :label="$t('trials:attachment:table:userType')" prop="NeedConfirmedUserTypeIdList">
<el-select v-model="form.NeedConfirmedUserTypeIdList" style="width:100%;" multiple>
<el-option v-for="item of userTypeOptions"
v-show="item.UserTypeEnum !== 1 && item.UserTypeEnum !== 8 && item.UserTypeEnum !== 20 && item.UserTypeEnum !== 26 && item.UserTypeEnum !== 27 && item.UserTypeEnum !== 31"
:key="item.Id" :label="item.UserTypeShortName" :value="item.Id">
<span>{{ item.UserType }}</span>
</el-option>
</el-select>
</el-form-item>
<!-- 查看最短时间分钟 -->
<el-form-item :label="$t('trials:attachment:table:min')" prop="SignViewMinimumMinutes">
<el-input-number v-model="form.SignViewMinimumMinutes" controls-position="right" :min="1" :max="50" />
</el-form-item>
<el-form-item :label="$t('trials:attachment:form:CurrentStaffTrainDays')" prop="CurrentStaffTrainDays">
<el-input-number v-model="form.CurrentStaffTrainDays" controls-position="right" :min="0" :max="1000" />
</el-form-item>
<el-form-item :label="$t('trials:attachment:form:NewStaffTrainDays')" prop="NewStaffTrainDays">
<el-input-number v-model="form.NewStaffTrainDays" controls-position="right" :min="0" :max="1000" />
</el-form-item>
<!-- 描述 -->
<el-form-item :label="$t('trials:attachment:table:description')" prop="Description">
<el-input v-model="form.Description" type="textarea" :autosize="{ minRows: 5, maxRows: 6 }" maxlength="500"
show-word-limit />
</el-form-item>
</div>
<div class="base-dialog-footer" style="text-align:right;margin-top:10px;">
<el-form-item style="text-align:right;">
<!-- Save -->
<el-button size="small" type="primary" :disabled="form.FileTypeId === '' || form.Name === ''"
:loading="saveBtnLoading" @click="handleSave">
{{ $t('common:button:save') }}
</el-button>
</el-form-item>
</div>
</el-form>
</template>
<script>
import { addOrUpdateTrialDocument, uploadTrialDoc, getTrialUserTypeList } from '@/api/trials'
import { getBasicDataSelects } from '@/api/dictionary/dictionary'
export default {
name: 'TrialAttachmentFrom',
props: {
data: {
type: Object,
default() { return {} }
}
},
data() {
return {
form: {
Id: '',
TrialId: '',
FileTypeId: '',
Name: '',
Path: '',
IsDeleted: false,
SignViewMinimumMinutes: null,
Description: '',
NeedConfirmedUserTypeIdList: [],
CurrentStaffTrainDays: 1,
NewStaffTrainDays: 14,
},
rules: {
FileTypeId: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: ['blur', 'change'] }],
SignViewMinimumMinutes: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: ['change'] }],
NeedConfirmedUserTypeIdList: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: ['blur', 'change'] }],
Description: [{ max: 500, message: `${this.$t('common:ruleMessage:maxLength')} 500`, trigger: ['blur', 'change'] }]
},
fileList: [],
userTypeOptions: [],
btnLoading: false,
saveBtnLoading: false,
loading: false,
dictionaryList: {}
}
},
mounted() {
this.initForm()
},
methods: {
//
handleSave() {
this.$refs.trialAttachmentFrom.validate(valid => {
if (!valid) return
if (!this.form.Name) {
this.$alert(this.$t('trials:attachment:message:selectFile'))
return
}
if (this.form.TrialId === '') {
this.form.TrialId = this.$route.query.trialId
}
this.saveBtnLoading = true
addOrUpdateTrialDocument(this.form).then(res => {
this.saveBtnLoading = false
this.$emit('closeDialog')
this.$emit('getList')
if (this.form.Id) {
this.$message.success(this.$t('common:message:savedSuccessfully'))
} else {
this.$message.success(this.$t('common:message:addedSuccessfully'))
}
// this.$message.success(this.$t('common:message:savedSuccessfully'))
}).catch(() => {
this.saveBtnLoading = false
})
})
},
async initForm() {
this.loading = true
await this.getDicData()
await this.getUserType()
if (Object.keys(this.data).length > 0) {
if (this.data.Path) {
this.fileList = [
{
name: this.data.Name,
path: this.data.Path,
url: this.data.Path,
}
]
}
this.form.Id = this.data.Id
this.form.FileTypeId = this.data.FileTypeId
this.form.Name = this.data.Name
this.form.Path = this.data.Path
this.form.IsDeleted = this.data.IsDeleted
this.form.Description = this.data.Description
this.form.SignViewMinimumMinutes = this.data.SignViewMinimumMinutes
this.form.CurrentStaffTrainDays = this.data.CurrentStaffTrainDays
this.form.NewStaffTrainDays = this.data.NewStaffTrainDays
}
this.loading = false
},
//
getDicData() {
getBasicDataSelects(['Trial_Document']).then(res => {
this.dictionaryList = { ...res.Result }
})
},
//
getUserType() {
getTrialUserTypeList().then(res => {
this.userTypeOptions = res.Result
if (this.form.Id) {
this.form.NeedConfirmedUserTypeIdList = this.data.NeedConfirmedUserTypeeIds
}
}).catch(() => { this.loading = false })
},
handleViewableUserTypeChange(valArr) {
this.form.NeedConfirmedUserTypeIdList = []
this.needConfirmedUserTypeOptions = []
valArr.forEach((val) => {
const i = this.userTypeOptions.findIndex(userType => { return userType.Id === val })
this.needConfirmedUserTypeOptions.push(this.userTypeOptions[i])
})
},
//
beforeUpload(file) {
if (this.checkFileSuffix(file.name)) {
this.fileList = []
return true
} else {
this.$alert(this.$t('trials:attachment:message:pdf'))
return false
}
},
//
async handleUploadFile(param) {
this.loading = true
var file = await this.fileToBlob(param.file)
const trialId = this.$route.query.trialId
const res = await this.OSSclient.put(`/${trialId}/DocumentToSign/${param.file.name}${new Date().getTime()}`, file)
this.fileList.push({ name: param.file.name, path: this.$getObjectName(res.url), url: this.$getObjectName(res.url) })
this.form.Path = this.$getObjectName(res.url)
this.form.Name = param.file.name
this.loading = false
},
//
handleRemoveFile() {
this.fileList = []
this.form.Path = ''
this.form.Name = ''
},
handleExceed(files, fileList) {
this.$message.warning(this.$t('trials:attachment:message:uploadFile'))
},
// pdf
checkFileSuffix(fileName) {
var typeArr = ['pdf', 'mp4']
var extendName = fileName.substring(fileName.lastIndexOf('.') + 1).toLocaleLowerCase()
if (typeArr.indexOf(extendName) !== -1) {
return true
} else {
return false
}
}
}
}
</script>
<style lang="scss">
.upload-temporary-file {
.upload-container .el-upload--text {
border: none;
width: 80px;
height: 40px;
}
.upload-container .el-input--small {
margin-bottom: 5px;
}
.upload-container .el-icon-circle-check {
color: #428bca;
font-size: 13px;
}
.account_item_clear {
.el-tag__close {
display: none !important;
}
}
}
</style>

View File

@ -5,17 +5,8 @@
<el-form :inline="true" class="base-search-form"> <el-form :inline="true" class="base-search-form">
<!-- 文件类型 --> <!-- 文件类型 -->
<el-form-item :label="$t('trials:attachment:table:fileType')"> <el-form-item :label="$t('trials:attachment:table:fileType')">
<el-select <el-select v-model="searchData.FileTypeId" clearable style="width: 150px">
v-model="searchData.FileTypeId" <el-option v-for="item of $d.Trial_Document" :key="item.id" :label="item.label" :value="item.id" />
clearable
style="width: 150px"
>
<el-option
v-for="item of $d.Trial_Document"
:key="item.id"
:label="item.label"
:value="item.id"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 文件名称 --> <!-- 文件名称 -->
@ -24,40 +15,20 @@
</el-form-item> </el-form-item>
<!-- 培训状态 --> <!-- 培训状态 -->
<el-form-item :label="$t('trials:attachment:table:isDeleted')"> <el-form-item :label="$t('trials:attachment:table:isDeleted')">
<el-select <el-select clearable v-model="searchData.IsDeleted" style="width: 150px">
clearable <el-option v-for="item of $d.TrainingStatus" :key="item.value" :label="item.label" :value="item.value" />
v-model="searchData.IsDeleted"
style="width: 150px"
>
<el-option
v-for="item of $d.TrainingStatus"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 培训角色 --> <!-- 培训角色 -->
<el-form-item :label="$t('trials:attachment:table:userType')"> <el-form-item :label="$t('trials:attachment:table:userType')">
<el-select <el-select v-model="searchData.UserTypeId" clearable style="width: 100%">
v-model="searchData.UserTypeId" <el-option v-for="item of userTypeOptions" v-show="item.UserTypeEnum !== 1 &&
clearable
style="width: 100%"
>
<el-option
v-for="item of userTypeOptions"
v-show="
item.UserTypeEnum !== 1 &&
item.UserTypeEnum !== 8 && item.UserTypeEnum !== 8 &&
item.UserTypeEnum !== 20 && item.UserTypeEnum !== 20 &&
item.UserTypeEnum !== 26 && item.UserTypeEnum !== 26 &&
item.UserTypeEnum !== 27 && item.UserTypeEnum !== 27 &&
item.UserTypeEnum !== 31 item.UserTypeEnum !== 31
" " :key="item.Id" :label="item.UserTypeShortName" :value="item.Id">
:key="item.Id"
:label="item.UserTypeShortName"
:value="item.Id"
>
<span>{{ item.UserType }}</span> <span>{{ item.UserType }}</span>
</el-option> </el-option>
</el-select> </el-select>
@ -69,71 +40,52 @@
{{ $t('common:button:search') }} {{ $t('common:button:search') }}
</el-button> </el-button>
<!-- 重置 --> <!-- 重置 -->
<el-button <el-button type="primary" icon="el-icon-refresh-left" @click="handleReset">
type="primary"
icon="el-icon-refresh-left"
@click="handleReset"
>
{{ $t('common:button:reset') }} {{ $t('common:button:reset') }}
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span style="margin-left: auto"> <span style="margin-left: auto">
<!-- 新增 --> <!-- 新增 -->
<el-button <el-button v-hasPermi="['trials:trials-panel:setting:attachment:add']" type="primary" icon="el-icon-plus"
v-hasPermi="['trials:trials-panel:setting:attachment:add']" @click="handleAdd">
type="primary"
icon="el-icon-plus"
@click="handleAdd"
>
{{ $t('common:button:add') }} {{ $t('common:button:add') }}
</el-button> </el-button>
</span> </span>
</div> </div>
<!-- 系统文件列表 --> <!-- 系统文件列表 -->
<el-table <el-table ref="attachmentList" v-loading="loading" v-adaptive="{ bottomOffset: 60 }" :data="list" stripe
ref="attachmentList" height="100" @sort-change="handleSortByColumn">
v-loading="loading"
v-adaptive="{ bottomOffset: 60 }"
:data="list"
stripe
height="100"
@sort-change="handleSortByColumn"
>
<el-table-column type="index" width="40" /> <el-table-column type="index" width="40" />
<!-- 文件类型 --> <!-- 文件类型 -->
<el-table-column <el-table-column prop="FileType" :label="$t('trials:attachment:table:fileType')" show-overflow-tooltip
prop="FileType" sortable="custom" min-width="160" />
:label="$t('trials:attachment:table:fileType')"
show-overflow-tooltip
sortable="custom"
min-width="160"
/>
<!-- 文件名称 --> <!-- 文件名称 -->
<el-table-column <el-table-column prop="Name" :label="$t('trials:attachment:table:fileName')" show-overflow-tooltip
prop="Name" sortable="custom" min-width="160" />
:label="$t('trials:attachment:table:fileName')" <!--附件-->
show-overflow-tooltip <el-table-column prop="AttachmentCount" :label="$t('trials:attachment:table:AttachmentCount')"
sortable="custom" show-overflow-tooltip sortable="custom" min-width="150px">
min-width="160" <template slot-scope="scope">
/> <el-button type="text" @click.stop="openAttachment(scope.row, true)">
{{ scope.row.AttachmentCount }}
<i class="el-icon-upload2" />
</el-button>
</template>
</el-table-column>
<!-- 查看最短时间(分钟) --> <!-- 查看最短时间(分钟) -->
<el-table-column <el-table-column prop="SignViewMinimumMinutes" :label="$t('trials:attachment:table:min')" show-overflow-tooltip
prop="SignViewMinimumMinutes" sortable="custom" min-width="150" />
:label="$t('trials:attachment:table:min')" <!-- 已有成员(分钟) -->
show-overflow-tooltip <el-table-column prop="CurrentStaffTrainDays" :label="$t('trials:attachment:table:CurrentStaffTrainDays')"
sortable="custom" show-overflow-tooltip sortable="custom" min-width="150" />
min-width="150" <!-- 新加入成员(分钟) -->
/> <el-table-column prop="NewStaffTrainDays" :label="$t('trials:attachment:table:NewStaffTrainDays')"
show-overflow-tooltip sortable="custom" min-width="150" />
<!-- 是否废除 --> <!-- 是否废除 -->
<el-table-column <el-table-column prop="IsDeleted" :label="$t('trials:attachment:table:isDeleted')" show-overflow-tooltip
prop="IsDeleted" sortable="custom" min-width="100">
:label="$t('trials:attachment:table:isDeleted')"
show-overflow-tooltip
sortable="custom"
min-width="100"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.IsDeleted" type="danger">{{ <el-tag v-if="scope.row.IsDeleted" type="danger">{{
$fd('TrainingStatus', scope.row.IsDeleted) $fd('TrainingStatus', scope.row.IsDeleted)
@ -143,13 +95,18 @@
}}</el-tag> }}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<!--发布状态-->
<el-table-column prop="IsPublish" :label="$t('trials:attachment:table:IsPublish')" show-overflow-tooltip
sortable="custom" min-width="120px">
<template slot-scope="scope">
<el-tag :type="scope.row.IsPublish ? 'primary' : 'danger'">{{
$fd('AttachmentPublishStatus', scope.row.IsPublish)
}}</el-tag>
</template>
</el-table-column>
<!-- 需要签署的用户类型 --> <!-- 需要签署的用户类型 -->
<el-table-column <el-table-column prop="NeedConfirmedUserTypes" :label="$t('trials:attachment:table:userType')"
prop="NeedConfirmedUserTypes" show-overflow-tooltip min-width="100">
:label="$t('trials:attachment:table:userType')"
show-overflow-tooltip
min-width="100"
>
<template slot-scope="scope"> <template slot-scope="scope">
{{ {{
scope.row.NeedConfirmedUserTypes scope.row.NeedConfirmedUserTypes
@ -174,91 +131,52 @@
min-width="160" min-width="160"
/> --> /> -->
<!--创建时间--> <!--创建时间-->
<el-table-column <el-table-column prop="CreateTime" :label="$t('trials:attachment:table:CreateTime')" show-overflow-tooltip
prop="CreateTime" sortable="custom" min-width="160" />
:label="$t('trials:attachment:table:CreateTime')" <el-table-column :label="$t('common:action:action')" min-width="200" fixed="right">
show-overflow-tooltip
sortable="custom"
min-width="160"
/>
<el-table-column
:label="$t('common:action:action')"
min-width="140"
fixed="right"
>
<template slot-scope="scope"> <template slot-scope="scope">
<!-- 预览 --> <!-- 预览 -->
<el-button <el-button icon="el-icon-view" circle :title="$t('trials:attachment:action:preview')"
icon="el-icon-view" @click="handlePreview(scope.row)" />
circle
:title="$t('trials:attachment:action:preview')"
@click="handlePreview(scope.row)"
/>
<!-- 编辑 --> <!-- 编辑 -->
<el-button <el-button v-hasPermi="['trials:trials-panel:setting:attachment:edit']" circle
v-hasPermi="['trials:trials-panel:setting:attachment:edit']" :title="$t('trials:attachment:action:edit')" icon="el-icon-edit-outline"
circle :disabled="scope.row.IsSomeUserSigned || scope.row.IsDeleted" @click="handleEdit(scope.row)" />
:title="$t('trials:attachment:action:edit')" <el-button :disabled="scope.row.IsPublish" circle icon="el-icon-position"
icon="el-icon-edit-outline" :title="$t('dictionary:signature:button:publish')" @click="publishTrialDocument([scope.row])">
:disabled="scope.row.IsSomeUserSigned || scope.row.IsDeleted" </el-button>
@click="handleEdit(scope.row)"
/>
<!-- 废除 --> <!-- 废除 -->
<el-button <el-button v-hasPermi="['trials:trials-panel:setting:attachment:abolish']" :disabled="scope.row.IsDeleted"
v-hasPermi="['trials:trials-panel:setting:attachment:abolish']" circle :title="$t('trials:attachment:action:apolish')" icon="el-icon-delete"
:disabled="scope.row.IsDeleted" @click="handleRepeal(scope.row)" />
circle
:title="$t('trials:attachment:action:apolish')"
icon="el-icon-delete"
@click="handleRepeal(scope.row)"
/>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 分页组件 --> <!-- 分页组件 -->
<pagination <pagination class="page" :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize"
class="page" @pagination="getList" />
:total="total"
:page.sync="searchData.PageIndex"
:limit.sync="searchData.PageSize"
@pagination="getList"
/>
<!-- 新增/编辑 --> <!-- 新增/编辑 -->
<el-dialog <el-dialog v-if="editVisible" :visible.sync="editVisible" :close-on-click-modal="false" :title="title" width="800px"
v-if="editVisible" custom-class="base-dialog-wrapper">
:visible.sync="editVisible" <templateForm :data="currentRow" @closeDialog="closeDialog" @getList="getList" />
:close-on-click-modal="false"
:title="title"
width="800px"
custom-class="base-dialog-wrapper"
>
<AttachmentForm
:data="currentRow"
@closeDialog="closeDialog"
@getList="getList"
/>
</el-dialog> </el-dialog>
<!--附件列表-->
<attachmentList v-if="config.visible" :config="config" :rowData="currentRow" :TrialDocumentId="TrialDocumentId"
@getList="getList" />
<!-- 预览文件 --> <!-- 预览文件 -->
<el-dialog <attachmentPreview :SystemDocumentId="TrialDocumentId" :isTrial="true" :visible.sync="perview_visible"
v-if="previewVisible" :isView="true" v-if="perview_visible" />
:visible.sync="previewVisible" <!-- 预览文件 -->
:title="$t('trials:attachment:dialogTitle:preview')" <el-dialog v-if="previewVisible" :visible.sync="previewVisible" :title="$t('trials:attachment:dialogTitle:preview')"
:fullscreen="true" :fullscreen="true" append-to-body custom-class="base-dialog-wrapper">
append-to-body <span style="position: fixed; left: 16px; top: 45px;cursor: pointer;font-size: 18px;color:#409EFF"
custom-class="base-dialog-wrapper" @click.stop="openAttachment(currentRow)" v-if="currentRow.AttachmentCount">{{
> $t('trials:attachment:table:AttachmentCount') }} ({{
<div currentRow.AttachmentCount }})</span>
class="base-modal-body" <div class="base-modal-body" style="border: 2px solid #ccc; padding: 10px">
style="border: 2px solid #ccc; padding: 10px" <PreviewFile v-if="previewVisible" :file-path="currentPath" :file-type="currentType" />
>
<PreviewFile
v-if="previewVisible"
:file-path="currentPath"
:file-type="currentType"
/>
</div> </div>
</el-dialog> </el-dialog>
</box-content> </box-content>
@ -268,11 +186,14 @@ import {
getTrialDocumentList, getTrialDocumentList,
userAbandonDoc, userAbandonDoc,
getTrialUserTypeList, getTrialUserTypeList,
publishTrialDocument
} from '@/api/trials' } from '@/api/trials'
import BoxContent from '@/components/BoxContent' import BoxContent from '@/components/BoxContent'
import Pagination from '@/components/Pagination' import Pagination from '@/components/Pagination'
import AttachmentForm from './components/attachmentForm' import templateForm from './components/templateForm'
import PreviewFile from './components/previewFile' import PreviewFile from './components/previewFile'
import attachmentList from './components/attachmentList'
import attachmentPreview from '@/views/dictionary/attachment/components/SignatureTemplate/attachmentPreview'
const searchDataDefault = () => { const searchDataDefault = () => {
return { return {
FileTypeId: '', FileTypeId: '',
@ -287,7 +208,7 @@ const searchDataDefault = () => {
} }
export default { export default {
name: 'TrialAttachmentList', name: 'TrialAttachmentList',
components: { BoxContent, Pagination, AttachmentForm, PreviewFile }, components: { BoxContent, Pagination, templateForm, PreviewFile, attachmentList, attachmentPreview },
dicts: ['Trial_Document'], dicts: ['Trial_Document'],
data() { data() {
return { return {
@ -303,6 +224,13 @@ export default {
currentType: '', currentType: '',
trialId: '', trialId: '',
userTypeOptions: [], userTypeOptions: [],
TrialDocumentId: null,
perview_visible: false,
config: {
visible: false,
title: this.$t('dictionary:signature:attachmentList:title'),
width: '800px',
},
} }
}, },
mounted() { mounted() {
@ -311,6 +239,39 @@ export default {
this.getUserType() this.getUserType()
}, },
methods: { methods: {
openAttachment(row, isList = false) {
this.TrialDocumentId = row.Id
this.currentRow = { ...row }
if (!isList) {
this.perview_visible = true
} else {
this.config.visible = true
}
},
//
async publishTrialDocument(list) {
try {
let confirm = await this.$confirm(this.$t('trials:attachment:confirm:publishFile'), {
type: 'warning',
distinguishCancelAndClose: true,
})
if (!confirm) return false
let arr = list.filter(item => !item.IsPublish)
if (arr.length <= 0) return this.getList()
let data = {
ids: arr.map(item => item.Id)
}
this.loading = true
let res = await publishTrialDocument(data)
this.loading = false
if (res.IsSuccess) {
this.getList()
}
} catch (err) {
this.loading = false
console.log(err)
}
},
// //
getList() { getList() {
this.loading = true this.loading = true
@ -361,6 +322,7 @@ export default {
this.currentType = row.Name this.currentType = row.Name
? Name.substring(Name.lastIndexOf('.') + 1).toLocaleLowerCase() ? Name.substring(Name.lastIndexOf('.') + 1).toLocaleLowerCase()
: '' : ''
this.currentRow = Object.assign({}, row)
this.previewVisible = true this.previewVisible = true
}, },
// //

View File

@ -762,6 +762,7 @@ export default {
}, },
getModuleTypeDescriptionList(v) { getModuleTypeDescriptionList(v) {
this.searchData.Description = null this.searchData.Description = null
if (!v) return false
let params = { let params = {
moduleTypeId: v, moduleTypeId: v,
trialId: this.$route.query.trialId trialId: this.$route.query.trialId