数据上传、导出模板列表添加预览功能
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"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.370.0",
"@cornerstonejs/calculate-suv": "^1.1.0",
"@cornerstonejs/core": "^1.27.4",
"@cornerstonejs/dicom-image-loader": "^1.27.4",
@ -23,11 +24,13 @@
"@ffmpeg/ffmpeg": "^0.10.1",
"@microsoft/signalr": "^6.0.8",
"@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",
"axios": "0.18.1",
"babel-eslint": "7.2.3",
"copy-webpack-plugin": "^4.5.2",
"@aws-sdk/client-s3": "^3.370.0",
"core-js": "^3.8.3",
"cornerstone-core": "^2.6.1",
"cornerstone-math": "^0.1.10",
@ -65,6 +68,7 @@
"vue-clipboard2": "^0.3.1",
"vue-contextmenujs": "^1.3.13",
"vue-count-to": "^1.0.13",
"vue-demi": "^0.14.6",
"vue-i18n": "^8.7.0",
"vue-pdf": "^4.3.0",
"vue-puzzle-vcode": "^1.1.10",

View File

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

View File

@ -118,6 +118,9 @@
<el-table-column label="Action">
<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>
@ -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() {
this.loading = true
getCommonDocumentList(this.searchData)

View File

@ -7,8 +7,14 @@
:label="item.label"
:name="String(item.value)"
>
<UploadTemplate v-if="activeTab === '1' && item.value == activeTab" />
<ExportTemplate v-if="activeTab === '2' && item.value == activeTab" />
<UploadTemplate
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" />
<CommonTemplate v-if="activeTab === '4' && item.value == activeTab" />
<SignatureTemplate
@ -16,6 +22,33 @@
/>
</el-tab-pane>
</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>
</template>
<script>
@ -24,6 +57,11 @@ import ExportTemplate from './components/ExportTemplate'
import EmailTemplate from './components/EmailTemplate'
import CommonTemplate from './components/CommonTemplate'
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 {
name: 'Attachment',
components: {
@ -32,10 +70,34 @@ export default {
EmailTemplate,
CommonTemplate,
SignatureTemplate,
VueOfficeDocx,
VueOfficeExcel,
PreviewFile,
},
data() {
return {
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() {
@ -51,6 +113,25 @@ export default {
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>