修改资料库

This commit is contained in:
GGJ
2024-09-24 11:21:54 +08:00
parent 5e0307e3a9
commit b1a88a7cda
8 changed files with 323 additions and 163 deletions

View File

@@ -3,7 +3,7 @@
<!-- 模版 -->
<TableHeader ref="TableHeaderRef" datePicker>
<template #operation>
<el-button icon="el-icon-Plus" type="primary" @click="addUser">新增</el-button>
<el-button icon="el-icon-Plus" type="primary" @click="addUser" v-if="information">新增</el-button>
</template>
</TableHeader>
<Table ref="tableRef"></Table>
@@ -13,7 +13,6 @@
</template>
<script setup lang="ts">
import { onMounted, ref, provide } from 'vue'
import TableStore from '@/utils/tableStore'
import TableHeader from '@/components/table/header/index.vue'
import { libtemplateDel } from '@/api/supervision-boot/database/index'
@@ -21,10 +20,12 @@ import { ElMessage } from 'element-plus'
import Table from '@/components/table/index.vue'
import { getFileNameAndFilePath, downloadFile } from '@/api/system-boot/file'
import PopupEdit from './components/form.vue'
import { useAdminInfo } from '@/stores/adminInfo'
const adminInfo = useAdminInfo()
defineOptions({
name: 'database/stencil'
})
const information = adminInfo.roleCode.includes('information_info')
const popupEditRef = ref()
const TableHeaderRef = ref()
@@ -59,6 +60,7 @@ const tableStore = new TableStore({
type: 'primary',
icon: 'el-icon-Plus',
render: 'basicButton',
click: row => {
downloadTheReport(row.url)
}
@@ -69,6 +71,9 @@ const tableStore = new TableStore({
type: 'primary',
icon: 'el-icon-Plus',
render: 'basicButton',
disabled: row => {
return !information
},
click: row => {
popupEditRef.value.open('修改模版', row)
}
@@ -78,6 +83,9 @@ const tableStore = new TableStore({
type: 'danger',
icon: 'el-icon-Delete',
render: 'confirmButton',
disabled: row => {
return !information
},
popconfirm: {
confirmButtonText: '确认',
cancelButtonText: '取消',
@@ -94,7 +102,7 @@ const tableStore = new TableStore({
]
}
],
loadCallback: () => {}
loadCallback: () => { }
})
// 弹框
@@ -103,7 +111,7 @@ const addUser = () => {
}
// 下载报告
const downloadTheReport = (url: string) => {
const downloadTheReport = (url: any) => {
let urls = url
let name = url.match(/\/([^/]+)\.(\w+)$/)[1]
downloadFile({ filePath: url }).then((res: any) => {
@@ -111,8 +119,18 @@ const downloadTheReport = (url: string) => {
type: urls.includes('.pdf')
? 'application/pdf'
: urls.includes('.docx')
? 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
: ''
? 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
: urls.includes('.xls')
? 'application/vnd.ms-excel'
: urls.includes('.xlsx')
? 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
: urls.includes('.png')
? 'image/png'
: urls.includes('.jpeg')
? 'image/jpeg'
: urls.includes('.jpg')
? 'image/jpg'
: ''
})
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')