修改资料库

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

@@ -20,7 +20,7 @@
<el-radio-button v-for="(item, i) in dotList?.childrens" :label="item.name" :value="i" /> <el-radio-button v-for="(item, i) in dotList?.childrens" :label="item.name" :value="i" />
</el-radio-group> </el-radio-group>
</div> </div>
<div> <div v-if="information">
<el-button <el-button
icon="el-icon-Plus" icon="el-icon-Plus"
type="primary" type="primary"
@@ -104,7 +104,6 @@
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button> <el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="del">删除</el-button> <el-button type="primary" @click="del">删除</el-button>
</div> </div>
</template> </template>
@@ -125,6 +124,8 @@ import { useMonitoringPoint } from '@/stores/monitoringPoint'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { deleteyById } from '@/api/supervision-boot/database/index' import { deleteyById } from '@/api/supervision-boot/database/index'
import { queryAllAlgorithmLibrary, updateAlgorithmLibrary } from '@/api/supervision-boot/database/index' import { queryAllAlgorithmLibrary, updateAlgorithmLibrary } from '@/api/supervision-boot/database/index'
import { useAdminInfo } from '@/stores/adminInfo'
const adminInfo = useAdminInfo()
defineOptions({ defineOptions({
name: 'database/algorithm' name: 'database/algorithm'
}) })
@@ -139,6 +140,7 @@ const treeRef = ref()
const popupEditRef = ref() const popupEditRef = ref()
const TreeData = ref([]) const TreeData = ref([])
const TreeValue = ref([]) const TreeValue = ref([])
const information =adminInfo.roleCode.includes('information_info')
const defaultProps = { const defaultProps = {
label: 'name', label: 'name',
@@ -225,7 +227,7 @@ const onAddTree = () => {
addTreeRef.value.open('新增') addTreeRef.value.open('新增')
} }
const deletes = () => { const deletes = () => {
TreeValue.value = '' TreeValue.value = []
queryAllAlgorithmLibrary().then(res => { queryAllAlgorithmLibrary().then(res => {
TreeData.value = res.data TreeData.value = res.data
}) })

View File

@@ -1,40 +1,73 @@
<template> <template>
<el-dialog v-model="dialogVisible" title="附件" width="600"> <el-dialog v-model="dialogVisible" draggable title="详情" width="1300">
<vxe-table v-bind="defaultAttribute" ref="vxeRef" height="500px" :data="tableData">
<el-descriptions :column="2" border>
<el-descriptions-item label="电能质量事件名称">{{ tableData.name }}</el-descriptions-item>
<el-descriptions-item label="事件经过">{{ tableData.process }}</el-descriptions-item>
<el-descriptions-item label="处理措施">{{ tableData.measures }}</el-descriptions-item>
<el-descriptions-item label="治理效果">{{ tableData.effect }}</el-descriptions-item>
<el-descriptions-item label="附件" :span="3">
<div v-for="item in tableData.urlList">
<div style="display: flex;align-items: center;">
<div>{{ item.name }}</div>
<el-icon class="elView" v-if="item.name" @click="view(item)">
<View />
</el-icon>
<el-icon class="elView" v-if="item.name" @click="download(item)">
<Download />
</el-icon>
</div>
</div>
</el-descriptions-item>]
<div>
<el-descriptions-item label="事件简介">
<div v-html="tableData.summary"></div>
</el-descriptions-item>
</div>
</el-descriptions>
<!-- <vxe-table v-bind="defaultAttribute" ref="vxeRef" height="500px" :data="tableData">
<vxe-column field="name" title="名称"></vxe-column> <vxe-column field="name" title="名称"></vxe-column>
<vxe-column title="操作" width="150"> <vxe-column title="操作" width="150">
<template #default="{ row }"> <template #default="{ row }">
<el-button type="primary" link @click="view(row)">查看</el-button> <el-button type="primary" link @click="view(row)">查看</el-button>
<el-button type="primary" link @click="download(row)">下载</el-button> <el-button type="primary" link @click="download(row)">下载</el-button>
</template> </template>
</vxe-column> </vxe-column>
</vxe-table> </vxe-table> -->
</el-dialog> </el-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import { defaultAttribute } from '@/components/table/defaultAttribute' import { defaultAttribute } from '@/components/table/defaultAttribute'
import { getFileNameAndFilePath, downloadFile } from '@/api/system-boot/file' import { getFileNameAndFilePath, downloadFile } from '@/api/system-boot/file'
import { Download, View } from '@element-plus/icons-vue'
const dialogVisible = ref(false) const dialogVisible = ref(false)
const tableData: any = ref([]) const tableData: any = ref({
const open = (row: any) => {
tableData.value = []
row.split(',').map((v: any) => {
tableData.value.push({ name: v.split('/supervision/')[1], url: v })
})
console.log('🚀 ~ row.split ~ tableData.value:', tableData.value)
})
const open = (row: any) => {
tableData.value = {}
tableData.value = row
tableData.value.urlList = []
row.url.split(',').map((v: any) => {
tableData.value.urlList.push({ name: v.split('/supervision/')[1], url: v })
})
dialogVisible.value = true dialogVisible.value = true
// console.log('🚀 ~ open ~ row:', row)
// url.value = row
} }
const view = (row: any) => { const view = (row: any) => {
window.open(window.location.origin + '/#/previewFile?' + row.url) window.open(window.location.origin + '/#/previewFile?' + row.url)
} }
const download = (row: any) => { const download = (row: any) => {
let url = row.url let url = row.url
let urls = url let urls = url
let name = url.match(/\/([^/]+)\.(\w+)$/)[1] let name = url.match(/\/([^/]+)\.(\w+)$/)[1]
downloadFile({ filePath: url }).then((res: any) => { downloadFile({ filePath: url }).then((res: any) => {
@@ -42,18 +75,18 @@ const download = (row: any) => {
type: urls.includes('.pdf') type: urls.includes('.pdf')
? 'application/pdf' ? 'application/pdf'
: urls.includes('.docx') : urls.includes('.docx')
? 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' ? 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
: urls.includes('.xls') : urls.includes('.xls')
? 'application/vnd.ms-excel' ? 'application/vnd.ms-excel'
: urls.includes('.xlsx') : urls.includes('.xlsx')
? 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ? 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
: urls.includes('.png') : urls.includes('.png')
? 'image/png' ? 'image/png'
: urls.includes('.jpeg') : urls.includes('.jpeg')
? 'image/jpeg' ? 'image/jpeg'
: urls.includes('.jpg') : urls.includes('.jpg')
? 'image/jpg' ? 'image/jpg'
: '' : ''
}) })
const url = window.URL.createObjectURL(blob) const url = window.URL.createObjectURL(blob)
const link = document.createElement('a') const link = document.createElement('a')
@@ -66,4 +99,14 @@ const download = (row: any) => {
} }
defineExpose({ open }) defineExpose({ open })
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped>
:deep(.el-descriptions__label) {
width: 160px;
}
.elView {
cursor: pointer;
margin-left: 10px;
color: #0000EE;
}
</style>

View File

@@ -1,6 +1,15 @@
<template> <template>
<div> <div>
<el-drawer v-model="drawer" size="1000px"> <el-drawer v-model="drawer" size="1000px">
<div class="box mt20">
<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>
</div>
<el-collapse v-model="activeName" accordion> <el-collapse v-model="activeName" accordion>
<!-- <el-collapse-item title="典型电能质量干扰源" name="1"></el-collapse-item> --> <!-- <el-collapse-item title="典型电能质量干扰源" name="1"></el-collapse-item> -->
<el-collapse-item title="国家电网有限公司企业标准" name="2"> <el-collapse-item title="国家电网有限公司企业标准" name="2">
@@ -9,15 +18,12 @@
<vue-office-docx v-if="url.includes('.doc') || url.includes('.docx')" :src="url" /> <vue-office-docx v-if="url.includes('.doc') || url.includes('.docx')" :src="url" />
<vue-office-excel v-if="url.includes('.xls') || url.includes('.xlsx')" :src="url" /> <vue-office-excel v-if="url.includes('.xls') || url.includes('.xlsx')" :src="url" />
<vue-office-pdf v-if="url.includes('.pdf')" :src="url" /> <vue-office-pdf v-if="url.includes('.pdf')" :src="url" />
<img <img v-if="
v-if=" url.includes('.png') ||
url.includes('.png') || url.includes('.jpg') ||
url.includes('.jpg') || url.includes('.gif') ||
url.includes('.gif') || url.includes('.bmp')
url.includes('.bmp') " :src="url" />
"
:src="url"
/>
</div> </div>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
@@ -33,11 +39,16 @@ import VueOfficeExcel from '@vue-office/excel'
//引入VueOfficePdf组件 //引入VueOfficePdf组件
import VueOfficePdf from '@vue-office/pdf' import VueOfficePdf from '@vue-office/pdf'
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import { useAdminInfo } from '@/stores/adminInfo'
import { ElMessage } from 'element-plus'
import { uploadFile, getFileNameAndFilePath, downloadFile } from '@/api/system-boot/file'
import { addStandardCase, queryStandardCase } from '@/api/supervision-boot/database/index'
const adminInfo = useAdminInfo()
const drawer = ref(false) const drawer = ref(false)
const activeName = ref('2') const activeName = ref('2')
const num = ref(0) const num = ref(0)
import { getFileNameAndFilePath, downloadFile } from '@/api/system-boot/file'
const url = ref('') const url = ref('')
const information = adminInfo.roleCode.includes('information_info')
const open = (row: any) => { const open = (row: any) => {
// console.log('🚀 ~ open ~ row:', row) // console.log('🚀 ~ open ~ row:', row)
// url.value = row // url.value = row
@@ -47,30 +58,93 @@ const open = (row: any) => {
url.value = res.data.url url.value = res.data.url
}) })
} }
// 上传
const choose = (e: any) => {
ElMessage.info('上传中,请稍等...')
uploadFile(e.raw, '/supervision/').then((row: any) => {
addStandardCase({ caseUrl: row.data.name }).then(res => {
ElMessage.success('上传成功!')
queryStandardCase().then(res => {
open(res.data)
})
})
})
//
}
const downloadTheReport = () => {
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()
})
})
}
defineExpose({ open }) defineExpose({ open })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/* 设置iframe的样式 */ /* 设置iframe的样式 */
.iframe { .iframe {
width: 100%; /* 宽度设置为父容器的100% */ width: 100%;
height: calc(100vh - 110px); /* 高度根据需要设置 */ /* 宽度设置为父容器的100% */
border: none; /* 移除边框 */ height: calc(100vh - 160px);
transform: scale(1); /* 放大200% */ /* 高度根据需要设置 */
border: none;
/* 移除边框 */
transform: scale(1);
/* 放大200% */
} }
/* 自定义 el-empty 的样式 */ /* 自定义 el-empty 的样式 */
:deep(.custom-empty) { :deep(.custom-empty) {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: 100%; /* 调整高度 */ height: 100%;
padding: 20px; /* 调整内边距 */ /* 调整高度 */
padding: 20px;
/* 调整内边距 */
.el-empty__image { .el-empty__image {
display: none; /* 隐藏默认图片 */ display: none;
/* 隐藏默认图片 */
} }
.el-empty__description { .el-empty__description {
font-size: 14px; /* 调整字体大小 */ font-size: 14px;
/* 调整字体大小 */
color: var(--vxe-font-color); color: var(--vxe-font-color);
} }
} }
.box {
position: absolute;
top: 0;
display: flex;
}
</style> </style>

View File

@@ -12,18 +12,18 @@
<el-form-item label="事件名称" prop="name"> <el-form-item label="事件名称" prop="name">
<el-input v-model="form.name" placeholder="请输入事件名称" /> <el-input v-model="form.name" placeholder="请输入事件名称" />
</el-form-item> </el-form-item>
<el-form-item label="发生事件" prop="type"> <!-- <el-form-item label="发生事件" prop="type">
<el-input <el-input
v-model="form.type" v-model="form.type"
placeholder="请输入治理效果" placeholder="请输入治理效果"
:autosize="{ minRows: 2, maxRows: 4 }" :autosize="{ minRows: 2, maxRows: 4 }"
type="textarea" type="textarea"
/> />
</el-form-item> </el-form-item> -->
<el-form-item label="发生地点" prop="location"> <el-form-item label="发生地点" prop="location">
<el-input <el-input
v-model="form.location" v-model="form.location"
placeholder="请输入治理效果" placeholder="请输入发生地点"
:autosize="{ minRows: 2, maxRows: 4 }" :autosize="{ minRows: 2, maxRows: 4 }"
type="textarea" type="textarea"
/> />
@@ -32,7 +32,7 @@
<el-form-item label="事件经过" prop="process"> <el-form-item label="事件经过" prop="process">
<el-input <el-input
v-model="form.process" v-model="form.process"
placeholder="请输入治理效果" placeholder="请输入事件经过"
:autosize="{ minRows: 2, maxRows: 4 }" :autosize="{ minRows: 2, maxRows: 4 }"
type="textarea" type="textarea"
/> />
@@ -88,7 +88,7 @@ const formRef = ref()
const fileList: any = ref([]) const fileList: any = ref([])
// 注意不要和表单ref的命名冲突 // 注意不要和表单ref的命名冲突
const form = reactive<anyObj>({ const form = reactive<anyObj>({
type: '', // type: '',
name: '', name: '',
location: '', location: '',
process: '', process: '',
@@ -100,12 +100,12 @@ const form = reactive<anyObj>({
}) })
const rules = { const rules = {
name: [{ required: true, message: '角色名称不能为空', trigger: 'blur' }], name: [{ required: true, message: '请输入事件名称', trigger: 'blur' }],
type: [{ required: true, message: '角色编码不能为空', trigger: 'blur' }], // type: [{ required: true, message: '角色编码不能为空', trigger: 'blur' }],
location: [{ required: true, message: '角色编码不能为空', trigger: 'blur' }], location: [{ required: true, message: '请输入发生地点', trigger: 'blur' }],
process: [{ required: true, message: '角色编码不能为空', trigger: 'blur' }], process: [{ required: true, message: '请输入事件经过', trigger: 'blur' }],
measures: [{ required: true, message: '角色编码不能为空', trigger: 'blur' }], measures: [{ required: true, message: '请输入处理措施', trigger: 'blur' }],
effect: [{ required: true, message: '角色编码不能为空', trigger: 'blur' }] effect: [{ required: true, message: '请输入治理效果', trigger: 'blur' }]
} }
const open = (text: string, data?: anyObj) => { const open = (text: string, data?: anyObj) => {

View File

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

View File

@@ -20,7 +20,7 @@
<el-input v-model="form.name" placeholder="名称" /> <el-input v-model="form.name" placeholder="名称" />
</el-form-item> </el-form-item>
<el-form-item label="案例" v-if="form.pid?.length > 0"> <el-form-item label="标准" v-if="form.pid?.length > 0">
<el-upload v-model:file-list="urlList" action="" :limit="1" :auto-upload="false" multiple> <el-upload v-model:file-list="urlList" action="" :limit="1" :auto-upload="false" multiple>
<el-button type="primary">上传</el-button> <el-button type="primary">上传</el-button>
</el-upload> </el-upload>

View File

@@ -4,37 +4,28 @@
<splitpanes style="height: 100%" class="default-theme" id="navigation-splitpanes"> <splitpanes style="height: 100%" class="default-theme" id="navigation-splitpanes">
<pane :size="size"> <pane :size="size">
<standardTree <standardTree ref="treeRef"
ref="treeRef"
:default-expanded-keys="monitoringPoint.state.lineId ? [monitoringPoint.state.lineId] : []" :default-expanded-keys="monitoringPoint.state.lineId ? [monitoringPoint.state.lineId] : []"
:current-node-key="monitoringPoint.state.lineId" :current-node-key="monitoringPoint.state.lineId" @node-click="handleNodeClick"
@node-click="handleNodeClick" @init="handleNodeClick"></standardTree>
@init="handleNodeClick"
></standardTree>
</pane> </pane>
<pane style="background: #fff" :style="height"> <pane style="background: #fff" :style="height">
<div class="pd10" style="display: flex; justify-content: end"> <div class="pd10" style="display: flex; justify-content: end">
<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-Edit" type="primary" @click="editUser">修改</el-button> <el-button icon="el-icon-Edit" type="primary" @click="editUser" v-if="information">修改</el-button>
<el-button icon="el-icon-Delete" type="primary" @click="deleteEven">删除</el-button> <el-button icon="el-icon-Delete" type="primary" @click="deleteEven"
v-if="information">删除</el-button>
<el-button icon="el-icon-Download" type="primary" @click="download" v-if="flag">下载</el-button> <el-button icon="el-icon-Download" type="primary" @click="download" v-if="flag">下载</el-button>
</div> </div>
<el-empty <el-empty v-if="url.length == 0" description="暂无数据" class="custom-empty"
v-if="url.length == 0" :style="`height: calc(${height.height} - 60px);`" />
description="暂无数据"
class="custom-empty"
:style="`height: calc(${height.height} - 60px);`"
/>
<div :style="`height: calc(${height.height} - 60px);overflow: auto;`" v-else> <div :style="`height: calc(${height.height} - 60px);overflow: auto;`" v-else>
<vue-office-docx v-if="url.includes('.doc') || url.includes('.docx')" :src="url" /> <vue-office-docx v-if="url.includes('.doc') || url.includes('.docx')" :src="url" />
<vue-office-excel v-if="url.includes('.xls') || url.includes('.xlsx')" :src="url" /> <vue-office-excel v-if="url.includes('.xls') || url.includes('.xlsx')" :src="url" />
<vue-office-pdf v-if="url.includes('.pdf')" :src="url" /> <vue-office-pdf v-if="url.includes('.pdf')" :src="url" />
<img <img v-if="
v-if=" url.includes('.png') || url.includes('.jpg') || url.includes('.gif') || url.includes('.bmp')
url.includes('.png') || url.includes('.jpg') || url.includes('.gif') || url.includes('.bmp') " :src="url" />
"
:src="url"
/>
</div> </div>
</pane> </pane>
</splitpanes> </splitpanes>
@@ -61,7 +52,8 @@ import VueOfficeExcel from '@vue-office/excel'
//引入VueOfficePdf组件 //引入VueOfficePdf组件
import VueOfficePdf from '@vue-office/pdf' import VueOfficePdf from '@vue-office/pdf'
import { deleteyLibstandard } from '@/api/supervision-boot/database/index' import { deleteyLibstandard } from '@/api/supervision-boot/database/index'
import { useAdminInfo } from '@/stores/adminInfo'
const adminInfo = useAdminInfo()
defineOptions({ defineOptions({
name: 'database/standard' name: 'database/standard'
}) })
@@ -73,6 +65,7 @@ const addTreeRef = ref()
const url = ref('') const url = ref('')
const dotList: any = ref({}) const dotList: any = ref({})
const flag: any = ref(false) const flag: any = ref(false)
const information = adminInfo.roleCode.includes('information_info')
onMounted(() => { onMounted(() => {
const dom = document.getElementById('navigation-splitpanes') const dom = document.getElementById('navigation-splitpanes')
if (dom) { if (dom) {
@@ -123,18 +116,18 @@ const download = () => {
type: urls.includes('.pdf') type: urls.includes('.pdf')
? 'application/pdf' ? 'application/pdf'
: urls.includes('.docx') : urls.includes('.docx')
? 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' ? 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
: urls.includes('.xls') : urls.includes('.xls')
? 'application/vnd.ms-excel' ? 'application/vnd.ms-excel'
: urls.includes('.xlsx') : urls.includes('.xlsx')
? 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ? 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
: urls.includes('.png') : urls.includes('.png')
? 'image/png' ? 'image/png'
: urls.includes('.jpeg') : urls.includes('.jpeg')
? 'image/jpeg' ? 'image/jpeg'
: urls.includes('.jpg') : urls.includes('.jpg')
? 'image/jpg' ? 'image/jpg'
: '' : ''
}) })
const url = window.URL.createObjectURL(blob) const url = window.URL.createObjectURL(blob)
const link = document.createElement('a') const link = document.createElement('a')
@@ -150,44 +143,57 @@ const download = () => {
.splitpanes.default-theme .splitpanes__pane { .splitpanes.default-theme .splitpanes__pane {
background: #eaeef1; background: #eaeef1;
} }
.grid-content { .grid-content {
text-align: center; text-align: center;
} }
.divBox { .divBox {
width: 250px; width: 250px;
height: 31px; height: 31px;
margin: auto; margin: auto;
line-height: 32px; line-height: 32px;
border: 1px solid #c9c9c9; border: 1px solid #c9c9c9;
&:hover { &:hover {
border: 1px solid #002255; border: 1px solid #002255;
} }
} }
.box { .box {
padding: 10px; padding: 10px;
// margin-top: 10px; // margin-top: 10px;
overflow-y: auto; overflow-y: auto;
font-size: 15px; font-size: 15px;
} }
.el-divider--horizontal { .el-divider--horizontal {
margin: 10px 0; margin: 10px 0;
} }
.mTop { .mTop {
margin-top: 5px; margin-top: 5px;
margin-bottom: 5px; margin-bottom: 5px;
} }
/* 自定义 el-empty 的样式 */ /* 自定义 el-empty 的样式 */
:deep(.custom-empty) { :deep(.custom-empty) {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: 100%; /* 调整高度 */ height: 100%;
padding: 20px; /* 调整内边距 */ /* 调整高度 */
padding: 20px;
/* 调整内边距 */
.el-empty__image { .el-empty__image {
display: none; /* 隐藏默认图片 */ display: none;
/* 隐藏默认图片 */
} }
.el-empty__description { .el-empty__description {
font-size: 14px; /* 调整字体大小 */ font-size: 14px;
/* 调整字体大小 */
color: var(--vxe-font-color); color: var(--vxe-font-color);
} }
} }

View File

@@ -3,7 +3,7 @@
<!-- 模版 --> <!-- 模版 -->
<TableHeader ref="TableHeaderRef" datePicker> <TableHeader ref="TableHeaderRef" datePicker>
<template #operation> <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> </template>
</TableHeader> </TableHeader>
<Table ref="tableRef"></Table> <Table ref="tableRef"></Table>
@@ -13,7 +13,6 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, provide } from 'vue' import { onMounted, ref, provide } from 'vue'
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import TableHeader from '@/components/table/header/index.vue' import TableHeader from '@/components/table/header/index.vue'
import { libtemplateDel } from '@/api/supervision-boot/database/index' 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 Table from '@/components/table/index.vue'
import { getFileNameAndFilePath, downloadFile } from '@/api/system-boot/file' import { getFileNameAndFilePath, downloadFile } from '@/api/system-boot/file'
import PopupEdit from './components/form.vue' import PopupEdit from './components/form.vue'
import { useAdminInfo } from '@/stores/adminInfo'
const adminInfo = useAdminInfo()
defineOptions({ defineOptions({
name: 'database/stencil' name: 'database/stencil'
}) })
const information = adminInfo.roleCode.includes('information_info')
const popupEditRef = ref() const popupEditRef = ref()
const TableHeaderRef = ref() const TableHeaderRef = ref()
@@ -59,6 +60,7 @@ const tableStore = new TableStore({
type: 'primary', type: 'primary',
icon: 'el-icon-Plus', icon: 'el-icon-Plus',
render: 'basicButton', render: 'basicButton',
click: row => { click: row => {
downloadTheReport(row.url) downloadTheReport(row.url)
} }
@@ -69,6 +71,9 @@ const tableStore = new TableStore({
type: 'primary', type: 'primary',
icon: 'el-icon-Plus', icon: 'el-icon-Plus',
render: 'basicButton', render: 'basicButton',
disabled: row => {
return !information
},
click: row => { click: row => {
popupEditRef.value.open('修改模版', row) popupEditRef.value.open('修改模版', row)
} }
@@ -78,6 +83,9 @@ const tableStore = new TableStore({
type: 'danger', type: 'danger',
icon: 'el-icon-Delete', icon: 'el-icon-Delete',
render: 'confirmButton', render: 'confirmButton',
disabled: row => {
return !information
},
popconfirm: { popconfirm: {
confirmButtonText: '确认', confirmButtonText: '确认',
cancelButtonText: '取消', 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 urls = url
let name = url.match(/\/([^/]+)\.(\w+)$/)[1] let name = url.match(/\/([^/]+)\.(\w+)$/)[1]
downloadFile({ filePath: url }).then((res: any) => { downloadFile({ filePath: url }).then((res: any) => {
@@ -111,8 +119,18 @@ const downloadTheReport = (url: string) => {
type: urls.includes('.pdf') type: urls.includes('.pdf')
? 'application/pdf' ? 'application/pdf'
: urls.includes('.docx') : 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 url = window.URL.createObjectURL(blob)
const link = document.createElement('a') const link = document.createElement('a')