数据上传、导出模板列表添加预览功能
continuous-integration/drone/push Build is passing Details

uat_us
DESKTOP-6C3NK6N\WXS 2024-10-11 14:39:36 +08:00
parent d114690114
commit bc70c64898
5 changed files with 2114 additions and 66 deletions

1951
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,7 @@
"i18n:en": "node i18nGenerate.js lang=en keyCol=5 valCol=7" "i18n:en": "node i18nGenerate.js lang=en keyCol=5 valCol=7"
}, },
"dependencies": { "dependencies": {
"@aws-sdk/client-s3": "^3.370.0",
"@cornerstonejs/calculate-suv": "^1.1.0", "@cornerstonejs/calculate-suv": "^1.1.0",
"@cornerstonejs/core": "^1.27.4", "@cornerstonejs/core": "^1.27.4",
"@cornerstonejs/dicom-image-loader": "^1.27.4", "@cornerstonejs/dicom-image-loader": "^1.27.4",
@ -23,11 +24,13 @@
"@ffmpeg/ffmpeg": "^0.10.1", "@ffmpeg/ffmpeg": "^0.10.1",
"@microsoft/signalr": "^6.0.8", "@microsoft/signalr": "^6.0.8",
"@riophae/vue-treeselect": "0.4.0", "@riophae/vue-treeselect": "0.4.0",
"@vue-office/docx": "^1.6.2",
"@vue-office/excel": "^1.7.11",
"@vue/composition-api": "^1.7.2",
"ali-oss": "^6.17.1", "ali-oss": "^6.17.1",
"axios": "0.18.1", "axios": "0.18.1",
"babel-eslint": "7.2.3", "babel-eslint": "7.2.3",
"copy-webpack-plugin": "^4.5.2", "copy-webpack-plugin": "^4.5.2",
"@aws-sdk/client-s3": "^3.370.0",
"core-js": "^3.8.3", "core-js": "^3.8.3",
"cornerstone-core": "^2.6.1", "cornerstone-core": "^2.6.1",
"cornerstone-math": "^0.1.10", "cornerstone-math": "^0.1.10",
@ -65,6 +68,7 @@
"vue-clipboard2": "^0.3.1", "vue-clipboard2": "^0.3.1",
"vue-contextmenujs": "^1.3.13", "vue-contextmenujs": "^1.3.13",
"vue-count-to": "^1.0.13", "vue-count-to": "^1.0.13",
"vue-demi": "^0.14.6",
"vue-i18n": "^8.7.0", "vue-i18n": "^8.7.0",
"vue-pdf": "^4.3.0", "vue-pdf": "^4.3.0",
"vue-puzzle-vcode": "^1.1.10", "vue-puzzle-vcode": "^1.1.10",

View File

@ -26,7 +26,7 @@
<el-form-item> <el-form-item>
<!-- 查询 --> <!-- 查询 -->
<el-button type="primary" icon="el-icon-search" @click="handleSearch"> <el-button type="primary" icon="el-icon-search" @click="handleSearch">
{{ $t("common:button:search") }} {{ $t('common:button:search') }}
</el-button> </el-button>
<!-- 重置 --> <!-- 重置 -->
<el-button <el-button
@ -34,7 +34,7 @@
icon="el-icon-refresh-left" icon="el-icon-refresh-left"
@click="handleReset" @click="handleReset"
> >
{{ $t("common:button:reset") }} {{ $t('common:button:reset') }}
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-button <el-button
@ -44,7 +44,7 @@
size="small" size="small"
@click="handleAdd" @click="handleAdd"
> >
{{ $t("common:button:new") }} {{ $t('common:button:new') }}
</el-button> </el-button>
</el-form> </el-form>
</template> </template>
@ -74,7 +74,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
{{ {{
$fd( $fd(
"Common_File_BusinessScenario", 'Common_File_BusinessScenario',
scope.row.BusinessScenarioEnum scope.row.BusinessScenarioEnum
) )
}} }}
@ -106,10 +106,10 @@
> >
<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("YesOrNo", scope.row.IsDeleted) $fd('YesOrNo', scope.row.IsDeleted)
}}</el-tag> }}</el-tag>
<el-tag v-else type="primary">{{ <el-tag v-else type="primary">{{
$fd("YesOrNo", scope.row.IsDeleted) $fd('YesOrNo', scope.row.IsDeleted)
}}</el-tag> }}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
@ -122,14 +122,17 @@
<el-table-column :label="$t('common:action:action')"> <el-table-column :label="$t('common:action:action')">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="PreviewFile(scope.row)">
{{ $t('common:button:preview') }}
</el-button>
<el-button type="text" @click="handleDownload(scope.row)"> <el-button type="text" @click="handleDownload(scope.row)">
{{ $t("common:button:download") }} {{ $t('common:button:download') }}
</el-button> </el-button>
<el-button type="text" @click="handleEdit(scope.row)"> <el-button type="text" @click="handleEdit(scope.row)">
{{ $t("common:button:edit") }} {{ $t('common:button:edit') }}
</el-button> </el-button>
<el-button type="text" @click="handleDelete(scope.row)"> <el-button type="text" @click="handleDelete(scope.row)">
{{ $t("common:button:delete") }} {{ $t('common:button:delete') }}
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -166,22 +169,22 @@ import {
getCommonDocumentList, getCommonDocumentList,
DownloadCommonDoc, DownloadCommonDoc,
deleteCommonDocument, deleteCommonDocument,
} from "@/api/dictionary"; } from '@/api/dictionary'
import BaseContainer from "@/components/BaseContainer"; import BaseContainer from '@/components/BaseContainer'
import Pagination from "@/components/Pagination"; import Pagination from '@/components/Pagination'
import TemplateForm from "./TemplateForm"; import TemplateForm from './TemplateForm'
const FileTypeEnum = 2; const FileTypeEnum = 2
const searchDataDefault = () => { const searchDataDefault = () => {
return { return {
FileTypeEnum: FileTypeEnum, FileTypeEnum: FileTypeEnum,
BusinessScenarioEnum: null, BusinessScenarioEnum: null,
Name: "", Name: '',
PageIndex: 1, PageIndex: 1,
PageSize: 20, PageSize: 20,
}; }
}; }
export default { export default {
name: "ExportTemplate", name: 'ExportTemplate',
components: { BaseContainer, Pagination, TemplateForm }, components: { BaseContainer, Pagination, TemplateForm },
data() { data() {
return { return {
@ -189,86 +192,97 @@ export default {
list: [], list: [],
total: 0, total: 0,
currentRow: {}, currentRow: {},
editDialog: { title: "", visible: false }, editDialog: { title: '', visible: false },
loading: false, loading: false,
}; }
}, },
mounted() { mounted() {
this.getList(); this.getList()
}, },
methods: { methods: {
PreviewFile(row) {
let basePath = window.location.origin
if (window.location.protocol !== 'https:') {
basePath = 'https://irc.test.extimaging.com'
}
let data = {
name: row.NameCN,
path: basePath + row.Path,
}
this.$emit('PreviewFile', data)
},
handleDelete(row) { handleDelete(row) {
this.$confirm( this.$confirm(
this.$t("dictionary:attachment:export:confirm:delete") this.$t('dictionary:attachment:export:confirm:delete')
).then(() => { ).then(() => {
deleteCommonDocument(row.Id).then(() => { deleteCommonDocument(row.Id).then(() => {
this.$message.success(this.$t("common:message:deletedSuccessfully")); this.$message.success(this.$t('common:message:deletedSuccessfully'))
this.getList(); this.getList()
}); })
}); })
}, },
getList() { getList() {
this.loading = true; this.loading = true
getCommonDocumentList(this.searchData) getCommonDocumentList(this.searchData)
.then((res) => { .then((res) => {
this.loading = false; this.loading = false
this.list = res.Result.CurrentPageData; this.list = res.Result.CurrentPageData
this.total = res.Result.TotalCount; this.total = res.Result.TotalCount
}) })
.catch(() => { .catch(() => {
this.loading = false; this.loading = false
}); })
}, },
// //
handleAdd() { handleAdd() {
this.editDialog.title = "Add"; this.editDialog.title = 'Add'
this.currentRow = { FileTypeEnum: FileTypeEnum }; this.currentRow = { FileTypeEnum: FileTypeEnum }
this.editDialog.visible = true; this.editDialog.visible = true
}, },
// //
handleDownload(row) { handleDownload(row) {
this.loading = true; this.loading = true
DownloadCommonDoc(row.Code) DownloadCommonDoc(row.Code)
.then((data) => { .then((data) => {
this.loading = false; this.loading = false
}) })
.catch(() => { .catch(() => {
this.loading = false; this.loading = false
}); })
}, },
// //
handleEdit(row) { handleEdit(row) {
this.editDialog.title = "Edit"; this.editDialog.title = 'Edit'
this.currentRow = { ...row }; this.currentRow = { ...row }
this.editDialog.visible = true; this.editDialog.visible = true
}, },
handleSearch() { handleSearch() {
this.searchData.PageIndex = 1; this.searchData.PageIndex = 1
this.getList(); this.getList()
}, },
handleReset() { handleReset() {
this.searchData = searchDataDefault(); this.searchData = searchDataDefault()
this.getList(); this.getList()
}, },
closeDialog() { closeDialog() {
this.editDialog.visible = false; this.editDialog.visible = false
}, },
// //
handleSortChange(column) { handleSortChange(column) {
if (column.order === "ascending") { if (column.order === 'ascending') {
this.searchData.Asc = true; this.searchData.Asc = true
} else { } else {
this.searchData.Asc = false; this.searchData.Asc = false
} }
this.searchData.SortField = column.prop; this.searchData.SortField = column.prop
this.searchData.PageIndex = 1; this.searchData.PageIndex = 1
this.getList(); this.getList()
}, },
}, },
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .search{ ::v-deep .search {
display: block; display: block;
} }
</style> </style>

View File

@ -118,6 +118,9 @@
<el-table-column label="Action"> <el-table-column label="Action">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="PreviewFile(scope.row)">
{{ $t('common:button:preview') }}
</el-button>
<el-button type="text" @click="handleDownload(scope.row)"> <el-button type="text" @click="handleDownload(scope.row)">
下载 下载
</el-button> </el-button>
@ -201,6 +204,17 @@ export default {
}) })
}) })
}, },
PreviewFile(row) {
let basePath = window.location.origin
if (window.location.protocol !== 'https:') {
basePath = 'https://irc.test.extimaging.com'
}
let data = {
name: row.NameCN,
path: basePath + row.Path,
}
this.$emit('PreviewFile', data)
},
getList() { getList() {
this.loading = true this.loading = true
getCommonDocumentList(this.searchData) getCommonDocumentList(this.searchData)

View File

@ -7,8 +7,14 @@
:label="item.label" :label="item.label"
:name="String(item.value)" :name="String(item.value)"
> >
<UploadTemplate v-if="activeTab === '1' && item.value == activeTab" /> <UploadTemplate
<ExportTemplate v-if="activeTab === '2' && item.value == activeTab" /> v-if="activeTab === '1' && item.value == activeTab"
@PreviewFile="PreviewFile"
/>
<ExportTemplate
v-if="activeTab === '2' && item.value == activeTab"
@PreviewFile="PreviewFile"
/>
<EmailTemplate v-if="activeTab === '3' && item.value == activeTab" /> <EmailTemplate v-if="activeTab === '3' && item.value == activeTab" />
<CommonTemplate v-if="activeTab === '4' && item.value == activeTab" /> <CommonTemplate v-if="activeTab === '4' && item.value == activeTab" />
<SignatureTemplate <SignatureTemplate
@ -16,6 +22,33 @@
/> />
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<!-- 预览 -->
<el-dialog
v-if="Preview.visible"
:visible.sync="Preview.visible"
:close-on-click-modal="false"
:fullscreen="true"
:title="Preview.title"
width="600px"
custom-class="base-dialog-wrapper"
>
<vue-office-docx
v-if="docxTypes.includes(Preview.type)"
:src="Preview.path"
style="height: 80vh"
@rendered="renderedHandler"
@error="errorHandler"
/>
<vue-office-excel
v-else-if="excelTypes.includes(Preview.type)"
:src="Preview.path"
:options="options"
style="height: 80vh"
@rendered="renderedHandler"
@error="errorHandler"
/>
<PreviewFile v-else :file-path="Preview.path" :file-type="Preview.type" />
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
@ -24,6 +57,11 @@ import ExportTemplate from './components/ExportTemplate'
import EmailTemplate from './components/EmailTemplate' import EmailTemplate from './components/EmailTemplate'
import CommonTemplate from './components/CommonTemplate' import CommonTemplate from './components/CommonTemplate'
import SignatureTemplate from './components/SignatureTemplate' import SignatureTemplate from './components/SignatureTemplate'
import VueOfficeDocx from '@vue-office/docx'
import '@vue-office/docx/lib/index.css'
import VueOfficeExcel from '@vue-office/excel'
import '@vue-office/excel/lib/index.css'
import PreviewFile from '@/components/PreviewFile/index'
export default { export default {
name: 'Attachment', name: 'Attachment',
components: { components: {
@ -32,10 +70,34 @@ export default {
EmailTemplate, EmailTemplate,
CommonTemplate, CommonTemplate,
SignatureTemplate, SignatureTemplate,
VueOfficeDocx,
VueOfficeExcel,
PreviewFile,
}, },
data() { data() {
return { return {
activeTab: null, activeTab: null,
Preview: {
visible: false,
title: '',
type: null,
path: null,
},
excelTypes: ['xlsx', 'xls'],
docxTypes: ['docx', 'doc'],
options: {
xls: false, //xlsxfalsexlstrue
minColLength: 0, // excelxlsx0.
minRowLength: 0, // excelxlsx0.
widthOffset: 10, // Npx
heightOffset: 10, // Npx
beforeTransformData: (workbookData) => {
return workbookData
}, //exceljsexcelexcelvalue
transformData: (workbookData) => {
return workbookData
}, //exceltransformDatatext
},
} }
}, },
mounted() { mounted() {
@ -51,6 +113,25 @@ export default {
path: `/dictionary/attachment?tabActive=${tab.name}`, path: `/dictionary/attachment?tabActive=${tab.name}`,
}) })
}, },
PreviewFile(data) {
if (!data.path) return false
let type = data.path
.substring(data.path.lastIndexOf('.') + 1)
.toLocaleLowerCase()
this.Preview.path = data.path
this.Preview.type = type
this.Preview.title = data.name
if (this.excelTypes.includes(type)) {
this.options.xls = type === 'xls'
}
this.Preview.visible = true
},
renderedHandler() {
console.log('渲染完成')
},
errorHandler() {
console.log('渲染失败')
},
}, },
} }
</script> </script>