修改资料库

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,15 +3,16 @@
<!-- 案例库 -->
<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>
<el-button icon="el-icon-View" type="primary" @click="checkOutTheCriteria">查看标准</el-button>
<el-upload :show-file-list="false" action="" :auto-upload="false" class="ml10" :on-change="choose">
<el-button icon="el-icon-Top" type="primary">上传标准</el-button>
<!-- <el-upload :show-file-list="false" action="" :auto-upload="false" class="ml10" :on-change="choose"
v-if="information">
<el-button icon="el-icon-Top" type="primary">上传常见治理措施</el-button>
</el-upload>
<el-button icon="el-icon-Download" type="primary" class="ml10" @click="downloadTheReport">
下载标准
</el-button>
下载常见治理措施
</el-button> -->
</template>
</TableHeader>
<Table ref="tableRef"></Table>
@@ -39,6 +40,8 @@ import annex from './components/annex.vue'
import { ElMessage } from 'element-plus'
import { uploadFile, getFileNameAndFilePath, downloadFile } from '@/api/system-boot/file'
import { addStandardCase, queryStandardCase } from '@/api/supervision-boot/database/index'
import { useAdminInfo } from '@/stores/adminInfo'
const adminInfo = useAdminInfo()
defineOptions({
name: 'database/case'
})
@@ -49,56 +52,65 @@ const TableHeaderRef = ref()
const annexRef = ref()
const dialogVisible = ref(false)
const summary = ref('')
const information = adminInfo.roleCode.includes('information_info')
const tableStore = new TableStore({
url: '/supervision-boot/libcase/pageQuery',
method: 'POST',
column: [
{ title: '电能质量事件名称', field: 'name' },
{
title: '发生事件',
field: 'type'
},
{
title: '事件经过',
field: 'process'
},
{
title: '发生地点',
field: 'location'
},
{
title: '处理措施',
field: 'measures'
},
{
title: '治理效果',
field: 'effect'
},
{
title: '事件简介',
width: '140',
render: 'buttons',
buttons: [
{
name: 'view',
title: '查看',
type: 'primary',
icon: 'el-icon-Plus',
render: 'basicButton',
click: row => {
dialogVisible.value = true
summary.value = row.summary
}
}
]
},
// {
// title: '发生事件',
// field: 'type'
// },
// {
// title: '事件经过',
// field: 'process'
// },
// {
// title: '处理措施',
// field: 'measures'
// },
// {
// title: '治理效果',
// field: 'effect'
// },
// {
// title: '事件简介',
// width: '140',
// render: 'buttons',
// buttons: [
// {
// name: 'view',
// title: '查看',
// type: 'primary',
// icon: 'el-icon-Plus',
// render: 'basicButton',
// click: row => {
// dialogVisible.value = true
// summary.value = row.summary
// }
// }
// ]
// },
{
title: '操作',
width: '200',
render: 'buttons',
buttons: [
{
name: 'view',
title: '详情',
type: 'primary',
icon: 'el-icon-Plus',
render: 'basicButton',
click: row => {
annexRef.value.open(row)
}
},
{
name: 'view',
title: '下载附件',
@@ -113,7 +125,9 @@ const tableStore = new TableStore({
name: 'edit',
title: '修改',
type: 'primary',
disabled: row => {
return !information
},
icon: 'el-icon-Plus',
render: 'basicButton',
click: row => {
@@ -126,6 +140,9 @@ const tableStore = new TableStore({
type: 'danger',
icon: 'el-icon-Delete',
render: 'confirmButton',
disabled: row => {
return !information
},
popconfirm: {
confirmButtonText: '确认',
cancelButtonText: '取消',
@@ -142,7 +159,7 @@ const tableStore = new TableStore({
]
}
],
loadCallback: () => {}
loadCallback: () => { }
})
// 弹框
@@ -171,7 +188,7 @@ const choose = (e: any) => {
})
//
}
const downloadTheReport = (url: string) => {
const downloadTheReport = () => {
queryStandardCase().then(res => {
let urls = res.data
let name = urls.match(/\/([^/]+)\.(\w+)$/)[1]
@@ -181,18 +198,18 @@ const downloadTheReport = (url: string) => {
type: urls.includes('.pdf')
? 'application/pdf'
: urls.includes('.docx')
? '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'
: ''
? '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')