项目文档增加附件
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
8e01f3af87
commit
c1f10036b0
|
@ -4134,6 +4134,29 @@ export function publishTrialDocument(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) {
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
<!-- v-else-if="fileType.indexOf('pdf') !== -1"-->
|
||||
<!-- :src="`/static/pdfjs/web/viewer.html?file=${filePath}`">-->
|
||||
<!-- </pdf>-->
|
||||
<video :src="`${OSSclientConfig.basePath}${filePath}`" style="width: 100%;height: 99%;" autoplay controls
|
||||
v-else-if="fileType.indexOf('mp4') !== -1"></video>
|
||||
<iframe v-else
|
||||
: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" />
|
||||
|
@ -51,7 +53,6 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
documentType() {
|
||||
console.log(DOCUMENTTYPE[`.${this.fileType}`], 'documentType')
|
||||
return DOCUMENTTYPE[`.${this.fileType}`]
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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;
|
|
@ -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;
|
||||
};
|
|
@ -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>
|
|
@ -56,6 +56,8 @@ import Preview from '@/components/Preview/index'
|
|||
Vue.use(Preview)
|
||||
import Onlyoffice from '@/components/Preview_onlyoffice/index'
|
||||
Vue.use(Onlyoffice)
|
||||
import Video from '@/components/Preview_video/index'
|
||||
Vue.use(Video)
|
||||
import MFA from '@/components/MFA/index'
|
||||
Vue.use(MFA)
|
||||
import FB from '@/components/feedBack/index'
|
||||
|
@ -311,9 +313,9 @@ async function VueInit() {
|
|||
})
|
||||
}
|
||||
let CompanyInfo = JSON.parse(localStorage.getItem('CompanyInfo'))
|
||||
if(CompanyInfo&&CompanyInfo.SystemShortName){
|
||||
if (CompanyInfo && CompanyInfo.SystemShortName) {
|
||||
let test = new RegExp('IRC', 'ig')
|
||||
text = text.replace(test, CompanyInfo.SystemShortName)
|
||||
text = text.replace(test, CompanyInfo.SystemShortName)
|
||||
}
|
||||
// return i18n.t(key)
|
||||
return text;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<el-form-item :label="$t('dictionary:signature:form:File')">
|
||||
<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"
|
||||
:show-file-list="true" :file-list="fileList" :limit="1" :on-exceed="handleExceed"
|
||||
:disabled="form.Type === ''">
|
||||
|
@ -229,7 +229,7 @@ export default {
|
|||
this.$message.warning(this.$t('upload:rule:maxFile1'))
|
||||
},
|
||||
checkFileSuffix(fileName) {
|
||||
var typeArr = ['pdf']
|
||||
var typeArr = ['pdf', 'mp4']
|
||||
var extendName = fileName
|
||||
.substring(fileName.lastIndexOf('.') + 1)
|
||||
.toLocaleLowerCase()
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
:http-request="handleUploadFile" :on-preview="handlePreview" :on-remove="handleRemoveFile"
|
||||
:show-file-list="true" :file-list="fileList" :limit="1" :on-exceed="handleExceed">
|
||||
<el-button size="small" type="primary" :loading="btnLoading">{{ $t('common:button:check')
|
||||
}}</el-button>
|
||||
}}</el-button>
|
||||
<span slot="tip" style="margin-left: 10px" class="el-upload__tip">
|
||||
({{ $t('trials:signature:label:type').replace("xxx", this.accept.join(", ")) }})
|
||||
</span>
|
||||
|
@ -82,7 +82,8 @@ export default {
|
|||
'.doc',
|
||||
'.docx',
|
||||
'.xls',
|
||||
'.xlsx']
|
||||
'.xlsx',
|
||||
'.mp4']
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -172,18 +173,7 @@ export default {
|
|||
this.$message.warning(this.$t('upload:rule:maxFile1'))
|
||||
},
|
||||
checkFileSuffix(fileName) {
|
||||
var typeArr = [
|
||||
'jpg',
|
||||
'jpeg',
|
||||
'png',
|
||||
'pdf',
|
||||
'ppt',
|
||||
'pptx',
|
||||
'doc',
|
||||
'docx',
|
||||
'xls',
|
||||
'xlsx',
|
||||
]
|
||||
var typeArr = this.accept.map(item => item.split('.')[1])
|
||||
var extendName = fileName
|
||||
.substring(fileName.lastIndexOf('.') + 1)
|
||||
.toLocaleLowerCase()
|
||||
|
|
|
@ -46,16 +46,16 @@
|
|||
<!-- 新增/编辑附件 -->
|
||||
<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" :SystemDocumentId="SystemDocumentId"
|
||||
<attachmentForm v-if="visible" :data="rowDATA" :SystemDocumentId="SystemDocumentId"
|
||||
@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">
|
||||
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" />
|
||||
<img v-show="false" :src="`${OSSclientConfig.basePath}${rowDATA.FilePath}`" alt="Image" />
|
||||
</viewer>
|
||||
<!-- <attachmentPreview :SystemDocumentId="SystemDocumentId" :visible.sync="perview_visible"
|
||||
v-if="perview_visible" /> -->
|
||||
|
@ -113,7 +113,7 @@ export default {
|
|||
visible: false,
|
||||
title: null,
|
||||
list: [],
|
||||
rowData: {},
|
||||
rowDATA: {},
|
||||
loading: false,
|
||||
viewerOptions: {
|
||||
toolbar: {
|
||||
|
@ -167,7 +167,7 @@ export default {
|
|||
if (!row.Id) {
|
||||
this.title = this.$t('dictionary:signature:attachmentForm:title:add')
|
||||
}
|
||||
this.rowData = Object.assign({}, row)
|
||||
this.rowDATA = Object.assign({}, row)
|
||||
this.visible = true
|
||||
},
|
||||
async getList() {
|
||||
|
@ -207,7 +207,7 @@ export default {
|
|||
},
|
||||
preview(data) {
|
||||
// return this.perview_visible = true
|
||||
this.rowData = Object.assign({}, data)
|
||||
this.rowDATA = Object.assign({}, data)
|
||||
if (['.ppt',
|
||||
'.pptx',
|
||||
'.doc',
|
||||
|
@ -234,6 +234,13 @@ export default {
|
|||
title: data.Name,
|
||||
})
|
||||
}
|
||||
if (['.mp4'].includes(`.${data.FileFormat.toLowerCase()}`)) {
|
||||
this.$video({
|
||||
path: data.Path || data.FilePath,
|
||||
type: 'mp4',
|
||||
title: data.Name,
|
||||
})
|
||||
}
|
||||
},
|
||||
// 排序
|
||||
handleSortByColumn(column) {
|
||||
|
|
|
@ -73,6 +73,7 @@ import xlsx from '@/assets/file_icon/xlsx.png'
|
|||
import PreviewFile from '@/components/PreviewFile'
|
||||
import imageViewer from './image-viewer'
|
||||
import { getSystemDocumentAttachmentList } from '@/api/dictionary'
|
||||
import { getTrialDocumentAttachmentList } from '@/api/trials'
|
||||
const defaultSearchData = () => {
|
||||
return {
|
||||
PageIndex: 1,
|
||||
|
@ -100,6 +101,10 @@ export default {
|
|||
isView: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isTrial: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -140,11 +145,20 @@ export default {
|
|||
try {
|
||||
if (!this.SystemDocumentId) return false
|
||||
this.loading = true
|
||||
this.searchData.SystemDocumentId = this.SystemDocumentId
|
||||
if (!this.isTrial) {
|
||||
this.searchData.SystemDocumentId = this.SystemDocumentId
|
||||
} else {
|
||||
this.searchData.TrialDocumentId = this.SystemDocumentId
|
||||
}
|
||||
if (this.isView) {
|
||||
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
|
||||
if (res.IsSuccess) {
|
||||
this.list = res.Result.CurrentPageData
|
||||
|
|
|
@ -130,10 +130,12 @@
|
|||
<SignForm :is-system-doc="currentRow.IsSystemDoc" :document-id="currentRow.Id" :file-name="fileName"
|
||||
:trial-id="trialId" @closeDialog="closeSignDialog" />
|
||||
</el-dialog>
|
||||
<attachmentList v-if="config.visible" :config="config" :rowData="currentRow" :SystemDocumentId="SystemDocumentId"
|
||||
:isView="true" @getList="getList" />
|
||||
<attachmentPreview :SystemDocumentId="SystemDocumentId" :visible.sync="perview_visible" :isView="true"
|
||||
v-if="perview_visible" />
|
||||
<attachmentList2 v-if="config.visible && !currentRow.IsSystemDoc" :config="config" :rowData="currentRow"
|
||||
:TrialDocumentId="TrialDocumentId" :isView="true" @getList="getList" />
|
||||
<attachmentList v-if="config.visible && currentRow.IsSystemDoc" :config="config" :rowData="currentRow"
|
||||
:SystemDocumentId="TrialDocumentId" :isView="true" @getList="getList" />
|
||||
<attachmentPreview :SystemDocumentId="TrialDocumentId" :isTrial="!currentRow.IsSystemDoc"
|
||||
:visible.sync="perview_visible" :isView="true" v-if="perview_visible" />
|
||||
</BaseContainer>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -145,6 +147,7 @@ import SignForm from './components/SignForm'
|
|||
import store from '@/store'
|
||||
import attachmentPreview from '@/views/dictionary/attachment/components/SignatureTemplate/attachmentPreview'
|
||||
import attachmentList from '@/views/dictionary/attachment/components/SignatureTemplate/attachmentList'
|
||||
import attachmentList2 from '@/views/trials/trials-panel/setting/attachment/components/attachmentList'
|
||||
const searchDataDefault = () => {
|
||||
return {
|
||||
FileTypeId: '',
|
||||
|
@ -158,7 +161,7 @@ const searchDataDefault = () => {
|
|||
}
|
||||
export default {
|
||||
name: 'TrialAttachments',
|
||||
components: { BaseContainer, Pagination, PreviewFile, SignForm, attachmentPreview, attachmentList },
|
||||
components: { BaseContainer, Pagination, PreviewFile, SignForm, attachmentPreview, attachmentList, attachmentList2 },
|
||||
data() {
|
||||
return {
|
||||
searchData: searchDataDefault(),
|
||||
|
@ -180,7 +183,7 @@ export default {
|
|||
currentUser: zzSessionStorage.getItem('userName'),
|
||||
typeOptions: [],
|
||||
trialId: this.$route.query.trialId,
|
||||
SystemDocumentId: null,
|
||||
TrialDocumentId: null,
|
||||
perview_visible: null,
|
||||
config: {
|
||||
visible: false,
|
||||
|
@ -205,7 +208,7 @@ export default {
|
|||
methods: {
|
||||
openAttachment(row, isList = false) {
|
||||
if (!row.AttachmentCount) return false
|
||||
this.SystemDocumentId = row.Id
|
||||
this.TrialDocumentId = row.Id
|
||||
this.currentRow = { ...row }
|
||||
if (!isList) {
|
||||
this.perview_visible = true
|
||||
|
|
|
@ -1,288 +1,213 @@
|
|||
<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"
|
||||
: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>
|
||||
<el-form ref="attachmentFrom" v-loading="loading" :model="form" label-width="190px" size="small" :rules="rules"
|
||||
class="upload-temporary-file">
|
||||
<div class="base-dialog-body">
|
||||
<el-form-item :label="$t('trials:attachment:form:FileName')" prop="Name">
|
||||
<el-input v-model="form.Name" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('trials:attachment:form:OffLine')" prop="OffLine">
|
||||
<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">
|
||||
<el-upload class="upload-demo" action :accept="this.accept.join(',')" :before-upload="beforeUpload"
|
||||
:http-request="handleUploadFile" :on-preview="handlePreview" :on-remove="handleRemoveFile"
|
||||
:show-file-list="true" :file-list="fileList" :limit="1" :on-exceed="handleExceed">
|
||||
<el-button size="small" type="primary" :loading="btnLoading">{{ $t('common:button:check')
|
||||
}}</el-button>
|
||||
<span slot="tip" style="margin-left: 10px" class="el-upload__tip">
|
||||
({{ $t('trials:signature:label:type').replace("xxx", this.accept.join(", ")) }})
|
||||
</span>
|
||||
</el-upload>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</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: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>
|
||||
<div class="base-dialog-footer" style="text-align: right; margin-top: 10px">
|
||||
<el-form-item style="text-align: right">
|
||||
<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'
|
||||
import { addOrUpdateTrialDocumentAttachment } from '@/api/trials'
|
||||
export default {
|
||||
name: 'TrialAttachmentFrom',
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default() { return {} }
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
Id: '',
|
||||
TrialId: '',
|
||||
FileTypeId: '',
|
||||
Name: '',
|
||||
Path: '',
|
||||
IsDeleted: false,
|
||||
SignViewMinimumMinutes: null,
|
||||
Description: '',
|
||||
NeedConfirmedUserTypeIdList: []
|
||||
},
|
||||
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
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {}
|
||||
},
|
||||
},
|
||||
TrialDocumentId: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
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,
|
||||
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
Id: '',
|
||||
Name: null,
|
||||
FileFormat: null,
|
||||
FileName: null,
|
||||
FilePath: null,
|
||||
FileSize: null,
|
||||
OffLine: false,
|
||||
TrialDocumentId: null,
|
||||
},
|
||||
rules: {
|
||||
Name: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t('common:ruleMessage:specify'),
|
||||
trigger: ['change'],
|
||||
},
|
||||
],
|
||||
},
|
||||
fileList: [],
|
||||
btnLoading: false,
|
||||
saveBtnLoading: false,
|
||||
loading: false,
|
||||
accept: ['.jpg',
|
||||
'.jpeg',
|
||||
'.png',
|
||||
'.pdf',
|
||||
'.ppt',
|
||||
'.pptx',
|
||||
'.doc',
|
||||
'.docx',
|
||||
'.xls',
|
||||
'.xlsx',
|
||||
".mp4"]
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initForm()
|
||||
},
|
||||
methods: {
|
||||
async initForm() {
|
||||
this.loading = true
|
||||
if (this.data && this.data.Id) {
|
||||
Object.keys(this.form).forEach(key => {
|
||||
this.form[key] = this.data[key]
|
||||
})
|
||||
this.fileList = [
|
||||
{
|
||||
name: this.data.FileName,
|
||||
url: this.data.FilePath,
|
||||
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
|
||||
},
|
||||
// 获取文件类型下拉框数据
|
||||
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'))
|
||||
this.loading = false
|
||||
},
|
||||
beforeUpload(file) {
|
||||
// 检测文件类型是否符合要求
|
||||
if (this.checkFileSuffix(file.name)) {
|
||||
this.fileList = []
|
||||
return true
|
||||
} else {
|
||||
this.$alert(this.$t('trials:signature:label:type').replace("xxx", this.accept.join(", ")))
|
||||
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
},
|
||||
async handleUploadFile(param) {
|
||||
this.loading = true
|
||||
var file = await this.fileToBlob(param.file)
|
||||
const res = await this.OSSclient.put(
|
||||
`/${this.$route.query.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.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
|
||||
},
|
||||
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() {
|
||||
this.fileList = []
|
||||
this.form.FilePath = ''
|
||||
this.form.FileSize = ''
|
||||
this.form.FileFormat = ''
|
||||
this.form.FileName = ''
|
||||
},
|
||||
handlePreview(file) {
|
||||
if (file.fullPath) {
|
||||
window.open(file.fullPath, '_blank')
|
||||
}
|
||||
},
|
||||
handleExceed(files, fileList) {
|
||||
this.$message.warning(this.$t('upload:rule:maxFile1'))
|
||||
},
|
||||
checkFileSuffix(fileName) {
|
||||
var typeArr = this.accept.map(item => item.split('.')[1])
|
||||
var extendName = fileName
|
||||
.substring(fileName.lastIndexOf('.') + 1)
|
||||
.toLocaleLowerCase()
|
||||
if (typeArr.indexOf(extendName) !== -1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
},
|
||||
// 上传文件
|
||||
async handleUploadFile(param) {
|
||||
this.loading = true
|
||||
var file = await this.fileToBlob(param.file)
|
||||
const trialId = this.$route.query.trialId
|
||||
console.log(this.OSSclient.put)
|
||||
const res = await this.OSSclient.put(`/${trialId}/DocumentToSign/${param.file.name}`, 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']
|
||||
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;
|
||||
.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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -5,17 +5,8 @@
|
|||
<el-form :inline="true" class="base-search-form">
|
||||
<!-- 文件类型 -->
|
||||
<el-form-item :label="$t('trials:attachment:table:fileType')">
|
||||
<el-select
|
||||
v-model="searchData.FileTypeId"
|
||||
clearable
|
||||
style="width: 150px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item of $d.Trial_Document"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.id"
|
||||
/>
|
||||
<el-select v-model="searchData.FileTypeId" 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-form-item>
|
||||
<!-- 文件名称 -->
|
||||
|
@ -24,40 +15,20 @@
|
|||
</el-form-item>
|
||||
<!-- 培训状态 -->
|
||||
<el-form-item :label="$t('trials:attachment:table:isDeleted')">
|
||||
<el-select
|
||||
clearable
|
||||
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 clearable 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-form-item>
|
||||
<!-- 培训角色 -->
|
||||
<el-form-item :label="$t('trials:attachment:table:userType')">
|
||||
<el-select
|
||||
v-model="searchData.UserTypeId"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<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"
|
||||
>
|
||||
<el-select v-model="searchData.UserTypeId" clearable style="width: 100%">
|
||||
<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>
|
||||
|
@ -69,71 +40,52 @@
|
|||
{{ $t('common:button:search') }}
|
||||
</el-button>
|
||||
<!-- 重置 -->
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-refresh-left"
|
||||
@click="handleReset"
|
||||
>
|
||||
<el-button type="primary" icon="el-icon-refresh-left" @click="handleReset">
|
||||
{{ $t('common:button:reset') }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span style="margin-left: auto">
|
||||
<!-- 新增 -->
|
||||
<el-button
|
||||
v-hasPermi="['trials:trials-panel:setting:attachment:add']"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="handleAdd"
|
||||
>
|
||||
<el-button v-hasPermi="['trials:trials-panel:setting:attachment:add']" type="primary" icon="el-icon-plus"
|
||||
@click="handleAdd">
|
||||
{{ $t('common:button:add') }}
|
||||
</el-button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- 系统文件列表 -->
|
||||
<el-table
|
||||
ref="attachmentList"
|
||||
v-loading="loading"
|
||||
v-adaptive="{ bottomOffset: 60 }"
|
||||
:data="list"
|
||||
stripe
|
||||
height="100"
|
||||
@sort-change="handleSortByColumn"
|
||||
>
|
||||
<el-table ref="attachmentList" 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
|
||||
prop="FileType"
|
||||
:label="$t('trials:attachment:table:fileType')"
|
||||
show-overflow-tooltip
|
||||
sortable="custom"
|
||||
min-width="160"
|
||||
/>
|
||||
<el-table-column prop="FileType" :label="$t('trials:attachment:table:fileType')" show-overflow-tooltip
|
||||
sortable="custom" min-width="160" />
|
||||
<!-- 文件名称 -->
|
||||
<el-table-column
|
||||
prop="Name"
|
||||
:label="$t('trials:attachment:table:fileName')"
|
||||
show-overflow-tooltip
|
||||
sortable="custom"
|
||||
min-width="160"
|
||||
/>
|
||||
<el-table-column prop="Name" :label="$t('trials:attachment:table:fileName')" show-overflow-tooltip
|
||||
sortable="custom" min-width="160" />
|
||||
<!--附件-->
|
||||
<el-table-column prop="AttachmentCount" :label="$t('trials:attachment:table:AttachmentCount')"
|
||||
show-overflow-tooltip sortable="custom" min-width="150px">
|
||||
<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
|
||||
prop="SignViewMinimumMinutes"
|
||||
:label="$t('trials:attachment:table:min')"
|
||||
show-overflow-tooltip
|
||||
sortable="custom"
|
||||
min-width="150"
|
||||
/>
|
||||
<el-table-column prop="SignViewMinimumMinutes" :label="$t('trials:attachment:table:min')" show-overflow-tooltip
|
||||
sortable="custom" min-width="150" />
|
||||
<!-- 已有成员(分钟) -->
|
||||
<el-table-column prop="CurrentStaffTrainDays" :label="$t('trials:attachment:table:CurrentStaffTrainDays')"
|
||||
show-overflow-tooltip sortable="custom" 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
|
||||
prop="IsDeleted"
|
||||
:label="$t('trials:attachment:table:isDeleted')"
|
||||
show-overflow-tooltip
|
||||
sortable="custom"
|
||||
min-width="100"
|
||||
>
|
||||
<el-table-column prop="IsDeleted" :label="$t('trials:attachment:table:isDeleted')" show-overflow-tooltip
|
||||
sortable="custom" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.IsDeleted" type="danger">{{
|
||||
$fd('TrainingStatus', scope.row.IsDeleted)
|
||||
|
@ -143,13 +95,18 @@
|
|||
}}</el-tag>
|
||||
</template>
|
||||
</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
|
||||
prop="NeedConfirmedUserTypes"
|
||||
:label="$t('trials:attachment:table:userType')"
|
||||
show-overflow-tooltip
|
||||
min-width="100"
|
||||
>
|
||||
<el-table-column prop="NeedConfirmedUserTypes" :label="$t('trials:attachment:table:userType')"
|
||||
show-overflow-tooltip min-width="100">
|
||||
<template slot-scope="scope">
|
||||
{{
|
||||
scope.row.NeedConfirmedUserTypes
|
||||
|
@ -174,91 +131,52 @@
|
|||
min-width="160"
|
||||
/> -->
|
||||
<!--创建时间-->
|
||||
<el-table-column
|
||||
prop="CreateTime"
|
||||
:label="$t('trials:attachment:table:CreateTime')"
|
||||
show-overflow-tooltip
|
||||
sortable="custom"
|
||||
min-width="160"
|
||||
/>
|
||||
<el-table-column
|
||||
:label="$t('common:action:action')"
|
||||
min-width="140"
|
||||
fixed="right"
|
||||
>
|
||||
<el-table-column prop="CreateTime" :label="$t('trials:attachment:table:CreateTime')" show-overflow-tooltip
|
||||
sortable="custom" min-width="160" />
|
||||
<el-table-column :label="$t('common:action:action')" min-width="200" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<!-- 预览 -->
|
||||
<el-button
|
||||
icon="el-icon-view"
|
||||
circle
|
||||
:title="$t('trials:attachment:action:preview')"
|
||||
@click="handlePreview(scope.row)"
|
||||
/>
|
||||
<el-button icon="el-icon-view" circle :title="$t('trials:attachment:action:preview')"
|
||||
@click="handlePreview(scope.row)" />
|
||||
<!-- 编辑 -->
|
||||
<el-button
|
||||
v-hasPermi="['trials:trials-panel:setting:attachment:edit']"
|
||||
circle
|
||||
:title="$t('trials:attachment:action:edit')"
|
||||
icon="el-icon-edit-outline"
|
||||
:disabled="scope.row.IsSomeUserSigned || scope.row.IsDeleted"
|
||||
@click="handleEdit(scope.row)"
|
||||
/>
|
||||
<el-button v-hasPermi="['trials:trials-panel:setting:attachment:edit']" circle
|
||||
:title="$t('trials:attachment:action:edit')" icon="el-icon-edit-outline"
|
||||
:disabled="scope.row.IsSomeUserSigned || scope.row.IsDeleted" @click="handleEdit(scope.row)" />
|
||||
<el-button :disabled="scope.row.IsPublish" circle icon="el-icon-position"
|
||||
:title="$t('dictionary:signature:button:publish')" @click="publishTrialDocument([scope.row])">
|
||||
</el-button>
|
||||
<!-- 废除 -->
|
||||
<el-button
|
||||
v-hasPermi="['trials:trials-panel:setting:attachment:abolish']"
|
||||
:disabled="scope.row.IsDeleted"
|
||||
circle
|
||||
:title="$t('trials:attachment:action:apolish')"
|
||||
icon="el-icon-delete"
|
||||
@click="handleRepeal(scope.row)"
|
||||
/>
|
||||
<el-button v-hasPermi="['trials:trials-panel:setting:attachment:abolish']" :disabled="scope.row.IsDeleted"
|
||||
circle :title="$t('trials:attachment:action:apolish')" icon="el-icon-delete"
|
||||
@click="handleRepeal(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<pagination
|
||||
class="page"
|
||||
:total="total"
|
||||
:page.sync="searchData.PageIndex"
|
||||
:limit.sync="searchData.PageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<pagination class="page" :total="total" :page.sync="searchData.PageIndex" :limit.sync="searchData.PageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 新增/编辑 -->
|
||||
<el-dialog
|
||||
v-if="editVisible"
|
||||
:visible.sync="editVisible"
|
||||
:close-on-click-modal="false"
|
||||
:title="title"
|
||||
width="800px"
|
||||
custom-class="base-dialog-wrapper"
|
||||
>
|
||||
<AttachmentForm
|
||||
:data="currentRow"
|
||||
@closeDialog="closeDialog"
|
||||
@getList="getList"
|
||||
/>
|
||||
<el-dialog v-if="editVisible" :visible.sync="editVisible" :close-on-click-modal="false" :title="title" width="800px"
|
||||
custom-class="base-dialog-wrapper">
|
||||
<templateForm :data="currentRow" @closeDialog="closeDialog" @getList="getList" />
|
||||
</el-dialog>
|
||||
|
||||
<!--附件列表-->
|
||||
<attachmentList v-if="config.visible" :config="config" :rowData="currentRow" :TrialDocumentId="TrialDocumentId"
|
||||
@getList="getList" />
|
||||
<!-- 预览文件 -->
|
||||
<el-dialog
|
||||
v-if="previewVisible"
|
||||
:visible.sync="previewVisible"
|
||||
:title="$t('trials:attachment:dialogTitle:preview')"
|
||||
:fullscreen="true"
|
||||
append-to-body
|
||||
custom-class="base-dialog-wrapper"
|
||||
>
|
||||
<div
|
||||
class="base-modal-body"
|
||||
style="border: 2px solid #ccc; padding: 10px"
|
||||
>
|
||||
<PreviewFile
|
||||
v-if="previewVisible"
|
||||
:file-path="currentPath"
|
||||
:file-type="currentType"
|
||||
/>
|
||||
<attachmentPreview :SystemDocumentId="TrialDocumentId" :isTrial="true" :visible.sync="perview_visible"
|
||||
:isView="true" v-if="perview_visible" />
|
||||
<!-- 预览文件 -->
|
||||
<el-dialog v-if="previewVisible" :visible.sync="previewVisible" :title="$t('trials:attachment:dialogTitle:preview')"
|
||||
:fullscreen="true" append-to-body custom-class="base-dialog-wrapper">
|
||||
<span style="position: fixed; left: 16px; top: 45px;cursor: pointer;font-size: 18px;color:#409EFF"
|
||||
@click.stop="openAttachment(currentRow)" v-if="currentRow.AttachmentCount">{{
|
||||
$t('trials:attachment:table:AttachmentCount') }} ({{
|
||||
currentRow.AttachmentCount }})</span>
|
||||
<div class="base-modal-body" style="border: 2px solid #ccc; padding: 10px">
|
||||
<PreviewFile v-if="previewVisible" :file-path="currentPath" :file-type="currentType" />
|
||||
</div>
|
||||
</el-dialog>
|
||||
</box-content>
|
||||
|
@ -268,11 +186,14 @@ import {
|
|||
getTrialDocumentList,
|
||||
userAbandonDoc,
|
||||
getTrialUserTypeList,
|
||||
publishTrialDocument
|
||||
} from '@/api/trials'
|
||||
import BoxContent from '@/components/BoxContent'
|
||||
import Pagination from '@/components/Pagination'
|
||||
import AttachmentForm from './components/attachmentForm'
|
||||
import templateForm from './components/templateForm'
|
||||
import PreviewFile from './components/previewFile'
|
||||
import attachmentList from './components/attachmentList'
|
||||
import attachmentPreview from '@/views/dictionary/attachment/components/SignatureTemplate/attachmentPreview'
|
||||
const searchDataDefault = () => {
|
||||
return {
|
||||
FileTypeId: '',
|
||||
|
@ -287,7 +208,7 @@ const searchDataDefault = () => {
|
|||
}
|
||||
export default {
|
||||
name: 'TrialAttachmentList',
|
||||
components: { BoxContent, Pagination, AttachmentForm, PreviewFile },
|
||||
components: { BoxContent, Pagination, templateForm, PreviewFile, attachmentList, attachmentPreview },
|
||||
dicts: ['Trial_Document'],
|
||||
data() {
|
||||
return {
|
||||
|
@ -303,6 +224,13 @@ export default {
|
|||
currentType: '',
|
||||
trialId: '',
|
||||
userTypeOptions: [],
|
||||
TrialDocumentId: null,
|
||||
perview_visible: false,
|
||||
config: {
|
||||
visible: false,
|
||||
title: this.$t('dictionary:signature:attachmentList:title'),
|
||||
width: '800px',
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -311,6 +239,39 @@ export default {
|
|||
this.getUserType()
|
||||
},
|
||||
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() {
|
||||
this.loading = true
|
||||
|
@ -361,6 +322,7 @@ export default {
|
|||
this.currentType = row.Name
|
||||
? Name.substring(Name.lastIndexOf('.') + 1).toLocaleLowerCase()
|
||||
: ''
|
||||
this.currentRow = Object.assign({}, row)
|
||||
this.previewVisible = true
|
||||
},
|
||||
// 编辑
|
||||
|
@ -391,7 +353,7 @@ export default {
|
|||
this.loading = false
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
.catch(() => { })
|
||||
},
|
||||
// 关闭编辑弹窗
|
||||
closeDialog() {
|
||||
|
|
|
@ -762,6 +762,7 @@ export default {
|
|||
},
|
||||
getModuleTypeDescriptionList(v) {
|
||||
this.searchData.Description = null
|
||||
if (!v) return false
|
||||
let params = {
|
||||
moduleTypeId: v,
|
||||
trialId: this.$route.query.trialId
|
||||
|
|
Loading…
Reference in New Issue