修改资料库
This commit is contained in:
@@ -4,6 +4,14 @@
|
||||
<TableHeader ref="TableHeaderRef" datePicker>
|
||||
<template #operation>
|
||||
<el-button icon="el-icon-Plus" type="primary" @click="addUser">新增</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>
|
||||
<el-button icon="el-icon-Download" type="primary" class="ml10" @click="downloadTheReport">
|
||||
下载标准
|
||||
</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref="tableRef"></Table>
|
||||
@@ -14,7 +22,9 @@
|
||||
<span v-html="summary"></span>
|
||||
</el-dialog>
|
||||
<!-- 抽屉 -->
|
||||
<drawer ref="drawerRef"/>
|
||||
<drawer ref="drawerRef" />
|
||||
<!-- 文件 -->
|
||||
<annex ref="annexRef" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
@@ -25,7 +35,10 @@ import Table from '@/components/table/index.vue'
|
||||
import PopupEdit from './components/form.vue'
|
||||
import { libcaseBeleteyById } from '@/api/supervision-boot/database/index'
|
||||
import drawer from './components/drawer.vue'
|
||||
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'
|
||||
defineOptions({
|
||||
name: 'database/case'
|
||||
})
|
||||
@@ -33,6 +46,7 @@ defineOptions({
|
||||
const popupEditRef = ref()
|
||||
const drawerRef = ref()
|
||||
const TableHeaderRef = ref()
|
||||
const annexRef = ref()
|
||||
const dialogVisible = ref(false)
|
||||
const summary = ref('')
|
||||
|
||||
@@ -62,10 +76,6 @@ const tableStore = new TableStore({
|
||||
title: '治理效果',
|
||||
field: 'effect'
|
||||
},
|
||||
// {
|
||||
// title: '事件简介',
|
||||
// field: 'summary'
|
||||
// },
|
||||
{
|
||||
title: '事件简介',
|
||||
width: '140',
|
||||
@@ -81,24 +91,24 @@ const tableStore = new TableStore({
|
||||
dialogVisible.value = true
|
||||
summary.value = row.summary
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'view',
|
||||
title: '抽屉',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-Plus',
|
||||
render: 'basicButton',
|
||||
click: row => {
|
||||
drawerRef.value.open(row)
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: '140',
|
||||
width: '200',
|
||||
render: 'buttons',
|
||||
buttons: [
|
||||
{
|
||||
name: 'view',
|
||||
title: '下载附件',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-Plus',
|
||||
render: 'basicButton',
|
||||
click: row => {
|
||||
annexRef.value.open(row.url)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '修改',
|
||||
@@ -143,6 +153,56 @@ const addUser = () => {
|
||||
provide('tableStore', tableStore)
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
console.log('🚀 ~ libcaseBeleteyById ~ tableStore:', tableStore)
|
||||
})
|
||||
const checkOutTheCriteria = () => {
|
||||
queryStandardCase().then(res => {
|
||||
drawerRef.value.open(res.data)
|
||||
})
|
||||
}
|
||||
|
||||
// 上传
|
||||
const choose = (e: any) => {
|
||||
ElMessage.info('上传中,请稍等...')
|
||||
uploadFile(e.raw, '/supervision/').then((row: any) => {
|
||||
addStandardCase({ caseUrl: row.data.name }).then(res => {
|
||||
ElMessage.success('上传成功!')
|
||||
})
|
||||
})
|
||||
//
|
||||
}
|
||||
const downloadTheReport = (url: string) => {
|
||||
queryStandardCase().then(res => {
|
||||
let urls = res.data
|
||||
let name = urls.match(/\/([^/]+)\.(\w+)$/)[1]
|
||||
ElMessage.info('下载中,请稍等...')
|
||||
downloadFile({ filePath: urls }).then((res: any) => {
|
||||
let blob = new Blob([res], {
|
||||
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'
|
||||
: ''
|
||||
})
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = name
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
link.remove()
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<style lang="scss"></style>
|
||||
|
||||
Reference in New Issue
Block a user