修改资料库
This commit is contained in:
@@ -58,6 +58,27 @@ export const libcaseBeleteyById = (data: any) => {
|
||||
params: data
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 新增标准案例
|
||||
*/
|
||||
export const addStandardCase = (data: any) => {
|
||||
return createAxios({
|
||||
url: '/supervision-boot/libcase/addStandardCase',
|
||||
method: 'POST',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 新增标准案例
|
||||
*/
|
||||
export const queryStandardCase = () => {
|
||||
return createAxios({
|
||||
url: '/supervision-boot/libcase/queryStandardCase',
|
||||
method: 'POST',
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 案例库修改
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import createAxios from '@/utils/request'
|
||||
|
||||
|
||||
const SYSTEM_PREFIX = '/system-boot'
|
||||
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param file
|
||||
@@ -22,7 +20,6 @@ export const uploadFile = (file: any, path: string) => {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*/
|
||||
@@ -36,16 +33,17 @@ export const deleteFile = (filePath: string) => {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
*/
|
||||
export const downloadFile = (filePath: string) => {
|
||||
let form = new FormData()
|
||||
form.append('filePath', filePath)
|
||||
export const downloadFile = (filePath: any) => {
|
||||
// let form = new FormData()
|
||||
// form.append('filePath', filePath)
|
||||
return createAxios({
|
||||
url: SYSTEM_PREFIX + '/file/download',
|
||||
method: 'GET'
|
||||
method: 'GET',
|
||||
params: filePath,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -61,14 +59,13 @@ export const getFileUrl = (filePath: string) => {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据获取文件的一个短期url及文件名
|
||||
*/
|
||||
export const getFileNameAndFilePath = (query: any) => {
|
||||
return createAxios({
|
||||
url:SYSTEM_PREFIX + '/file/getFileVO',
|
||||
url: SYSTEM_PREFIX + '/file/getFileVO',
|
||||
method: 'GET',
|
||||
params:query
|
||||
params: query
|
||||
})
|
||||
}
|
||||
@@ -64,6 +64,7 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
||||
if (
|
||||
!(
|
||||
config.url == '/system-boot/file/upload' ||
|
||||
|
||||
config.url == '/harmonic-boot/grid/getAssessOverview' ||
|
||||
config.url == '/system-boot/file/getFileVO' ||
|
||||
config.url == '/harmonic-boot/gridDiagram/getGridDiagramAreaData'
|
||||
@@ -108,6 +109,7 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
||||
Array.isArray(response.data) ||
|
||||
response.data.size ||
|
||||
response.config.url == '/harmonic-boot/exportmodel/exportModelJB' ||
|
||||
response.config.url == '/system-boot/file/download' ||
|
||||
response.config.url == '/harmonic-boot/powerStatistics/exportExcelListTemplate' ||
|
||||
response.config.url == '/harmonic-boot/powerStatistics/exportExcelRangTemplate'
|
||||
// ||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button icon="el-icon-Delete" type="primary" @click="deletes">删除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -64,11 +65,11 @@
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link @click="edit(row)">修改</el-button>
|
||||
<!-- <el-button type="danger" link @click="del(row)">删除</el-button> -->
|
||||
<el-popconfirm title="确定删除吗?" confirm-button-type='danger' @confirm="del(row)">
|
||||
<!-- <el-popconfirm title="确定删除吗?" confirm-button-type='danger' @confirm="del(row)">
|
||||
<template #reference>
|
||||
<el-button type="danger" link>删除</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</el-popconfirm> -->
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
@@ -79,6 +80,24 @@
|
||||
<addTree ref="addTreeRef" @getTree="treeRef.loadData(dotList.id)" />
|
||||
<!-- 弹框 -->
|
||||
<PopupEdit ref="popupEditRef" @getTree="treeRef.loadData(dotList.id)" />
|
||||
<!-- 删除 -->
|
||||
<el-dialog v-model="dialogVisible" title="请选择需要删除的数据" width="400">
|
||||
<el-tree-select
|
||||
v-model="TreeValue"
|
||||
:data="TreeData"
|
||||
filterable
|
||||
check-strictly
|
||||
:props="defaultProps"
|
||||
:render-after-expand="false"
|
||||
/>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
|
||||
<el-button type="primary" @click="del">删除</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
@@ -94,6 +113,7 @@ import PopupEdit from './components/form.vue'
|
||||
import { useMonitoringPoint } from '@/stores/monitoringPoint'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { deleteyById } from '@/api/supervision-boot/database/index'
|
||||
import { queryAllAlgorithmLibrary } from '@/api/supervision-boot/database/index'
|
||||
defineOptions({
|
||||
name: 'database/algorithm'
|
||||
})
|
||||
@@ -102,10 +122,16 @@ const height = mainHeight(20)
|
||||
const heightTab = mainHeight(82)
|
||||
const size = ref(0)
|
||||
const addTreeRef = ref()
|
||||
const dialogVisible = ref(false)
|
||||
const treeRef = ref()
|
||||
const popupEditRef = ref()
|
||||
const TreeData = ref([])
|
||||
const TreeValue = ref([])
|
||||
|
||||
const TableHeaderRef = ref()
|
||||
const defaultProps = {
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
}
|
||||
const dotList: any = ref()
|
||||
|
||||
const templatePolicy: any = ref([])
|
||||
@@ -175,12 +201,33 @@ const handleNodeClick = (data: any, node: any) => {
|
||||
const onAddTree = () => {
|
||||
addTreeRef.value.open('新增')
|
||||
}
|
||||
const deletes = () => {
|
||||
queryAllAlgorithmLibrary().then(res => {
|
||||
TreeData.value = res.data
|
||||
})
|
||||
dialogVisible.value = true
|
||||
}
|
||||
// 删除
|
||||
const del = (row: any) => {
|
||||
deleteyById({ id: row.id }).then(res => {
|
||||
const del = () => {
|
||||
if (TreeValue.value.length == 0) {
|
||||
return ElMessage.warning('请选择数据')
|
||||
}
|
||||
ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteyById({ id: TreeValue.value }).then(res => {
|
||||
ElMessage.success('删除成功')
|
||||
dialogVisible.value = false
|
||||
treeRef.value.loadData()
|
||||
})
|
||||
})
|
||||
|
||||
// if (TreeValue.value.length > 0) {
|
||||
// ElMessage.warning('请选择数据')
|
||||
// return
|
||||
// }
|
||||
}
|
||||
// 修改
|
||||
const edit = (row: any) => {
|
||||
|
||||
69
src/views/pqs/database/case/components/annex.vue
Normal file
69
src/views/pqs/database/case/components/annex.vue
Normal file
@@ -0,0 +1,69 @@
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" title="附件" width="600">
|
||||
<vxe-table v-bind="defaultAttribute" ref="vxeRef" height="500px" :data="tableData">
|
||||
<vxe-column field="name" title="名称"></vxe-column>
|
||||
<vxe-column title="操作" width="150">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link @click="view(row)">查看</el-button>
|
||||
<el-button type="primary" link @click="download(row)">下载</el-button>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import { defaultAttribute } from '@/components/table/defaultAttribute'
|
||||
import { getFileNameAndFilePath, downloadFile } from '@/api/system-boot/file'
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
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)
|
||||
|
||||
dialogVisible.value = true
|
||||
// console.log('🚀 ~ open ~ row:', row)
|
||||
// url.value = row
|
||||
}
|
||||
const view = (row: any) => {
|
||||
window.open(window.location.origin + '/#/previewFile?' + row.url)
|
||||
}
|
||||
const download = (row: any) => {
|
||||
let url = row.url
|
||||
|
||||
let urls = url
|
||||
let name = url.match(/\/([^/]+)\.(\w+)$/)[1]
|
||||
downloadFile({ filePath: url }).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 })
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -2,34 +2,75 @@
|
||||
<div>
|
||||
<el-drawer v-model="drawer" size="1000px">
|
||||
<el-collapse v-model="activeName" accordion>
|
||||
<el-collapse-item title="典型电能质量干扰源" name="1"></el-collapse-item>
|
||||
<el-collapse-item title="典型干扰源电能质量治理措施" name="2">
|
||||
<iframe
|
||||
src="http://192.168.1.22:9009/excelreport//supervision/%E5%86%80%E5%8C%97%E8%B5%84%E6%96%99%E5%BA%93%E9%9C%80%E6%B1%82%E6%95%B4%E7%90%86-%E6%89%B9%E6%B3%A8.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minio%2F20240913%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240913T013952Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=9f8dc2ccb166d7c5508ecd4e9a94b9af907009a962b1eae299cd08636b9fa3ce"
|
||||
frameborder="0"
|
||||
></iframe>
|
||||
<!-- <el-collapse-item title="典型电能质量干扰源" name="1"></el-collapse-item> -->
|
||||
<el-collapse-item title="国家电网有限公司企业标准" name="2">
|
||||
<!-- <el-empty description="暂无数据" class="custom-empty iframe" /> -->
|
||||
<div :style="`overflow: auto;`" class="iframe">
|
||||
<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-pdf v-if="url.includes('.pdf')" :src="url" />
|
||||
<img
|
||||
v-if="
|
||||
url.includes('.png') ||
|
||||
url.includes('.jpg') ||
|
||||
url.includes('.gif') ||
|
||||
url.includes('.bmp')
|
||||
"
|
||||
:src="url"
|
||||
/>
|
||||
</div>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
//引入相关样式
|
||||
import '@vue-office/excel/lib/index.css'
|
||||
//引入VueOfficeDocx组件
|
||||
import VueOfficeDocx from '@vue-office/docx'
|
||||
import VueOfficeExcel from '@vue-office/excel'
|
||||
//引入VueOfficePdf组件
|
||||
import VueOfficePdf from '@vue-office/pdf'
|
||||
import { ref, reactive } from 'vue'
|
||||
const drawer = ref(false)
|
||||
const activeName = ref('2')
|
||||
const open = () => {
|
||||
const num = ref(0)
|
||||
import { getFileNameAndFilePath, downloadFile } from '@/api/system-boot/file'
|
||||
const url = ref('')
|
||||
const open = (row: any) => {
|
||||
// console.log('🚀 ~ open ~ row:', row)
|
||||
// url.value = row
|
||||
drawer.value = true
|
||||
|
||||
getFileNameAndFilePath({ filePath: row }).then(res => {
|
||||
url.value = res.data.url
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
/* 设置iframe的样式 */
|
||||
iframe {
|
||||
.iframe {
|
||||
width: 100%; /* 宽度设置为父容器的100% */
|
||||
height: calc(100vh - 210px); /* 高度根据需要设置 */
|
||||
height: calc(100vh - 110px); /* 高度根据需要设置 */
|
||||
border: none; /* 移除边框 */
|
||||
transform: scale(1); /* 放大200% */
|
||||
|
||||
}
|
||||
/* 自定义 el-empty 的样式 */
|
||||
:deep(.custom-empty) {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%; /* 调整高度 */
|
||||
padding: 20px; /* 调整内边距 */
|
||||
.el-empty__image {
|
||||
display: none; /* 隐藏默认图片 */
|
||||
}
|
||||
.el-empty__description {
|
||||
font-size: 14px; /* 调整字体大小 */
|
||||
color: var(--vxe-font-color);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -58,11 +58,6 @@
|
||||
<el-button type="primary">上传</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="案例">
|
||||
<el-upload v-model:file-list="caseList" action="" :limit="1" :auto-upload="false" multiple>
|
||||
<el-button type="primary">上传</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div style="display: flex">
|
||||
@@ -91,7 +86,6 @@ const dialogVisible = ref(false)
|
||||
const title = ref('')
|
||||
const formRef = ref()
|
||||
const fileList: any = ref([])
|
||||
const caseList: any = ref([])
|
||||
// 注意不要和表单ref的命名冲突
|
||||
const form = reactive<anyObj>({
|
||||
type: '',
|
||||
@@ -119,7 +113,6 @@ const open = (text: string, data?: anyObj) => {
|
||||
dialogVisible.value = true
|
||||
if (data) {
|
||||
fileList.value = []
|
||||
caseList.value = []
|
||||
// 表单赋值
|
||||
for (let key in form) {
|
||||
form[key] = data[key]
|
||||
@@ -135,15 +128,6 @@ const open = (text: string, data?: anyObj) => {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
if (data.caseUrl.length > 0) {
|
||||
getFileNameAndFilePath({ filePath: data.caseUrl }).then(res => {
|
||||
caseList.value.push({
|
||||
name: res.data.fileName,
|
||||
url: res.data.name
|
||||
})
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// 在此处恢复默认表单
|
||||
for (let key in form) {
|
||||
@@ -180,32 +164,6 @@ const submit = () => {
|
||||
form.url = ''
|
||||
}
|
||||
|
||||
if (caseList.value.length > 0) {
|
||||
const promises = caseList.value.map(async item => {
|
||||
if (caseList.value[0].raw) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uploadFile(item.raw, '/supervision/')
|
||||
.then((res: any) => {
|
||||
resolve(res.data.name)
|
||||
})
|
||||
.catch(reject)
|
||||
})
|
||||
} else {
|
||||
return item.url
|
||||
}
|
||||
})
|
||||
|
||||
try {
|
||||
const fileNames = await Promise.all(promises)
|
||||
form.caseUrl = fileNames.join(',') + ''
|
||||
} catch (error) {
|
||||
console.error('上传文件出错', error)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
form.caseUrl = ''
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
if (title.value === '新增案例') {
|
||||
libcaseAdd(form).then(res => {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<el-button icon="el-icon-Plus" type="primary" @click="addUser">新增</el-button>
|
||||
<el-button icon="el-icon-Edit" type="primary" @click="editUser">修改</el-button>
|
||||
<el-button icon="el-icon-Delete" type="primary" @click="deleteEven">删除</el-button>
|
||||
<el-button icon="el-icon-Download" type="primary" @click="download" v-if="flag">下载</el-button>
|
||||
</div>
|
||||
<el-empty
|
||||
v-if="url.length == 0"
|
||||
@@ -51,7 +52,7 @@ import { mainHeight } from '@/utils/layout'
|
||||
import addTree from './components/addTree.vue'
|
||||
import { useMonitoringPoint } from '@/stores/monitoringPoint'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { getFileNameAndFilePath } from '@/api/system-boot/file'
|
||||
import { getFileNameAndFilePath, downloadFile } from '@/api/system-boot/file'
|
||||
//引入相关样式
|
||||
import '@vue-office/excel/lib/index.css'
|
||||
//引入VueOfficeDocx组件
|
||||
@@ -71,7 +72,7 @@ const treeRef = ref()
|
||||
const addTreeRef = ref()
|
||||
const url = ref('')
|
||||
const dotList: any = ref({})
|
||||
|
||||
const flag: any = ref(false)
|
||||
onMounted(() => {
|
||||
const dom = document.getElementById('navigation-splitpanes')
|
||||
if (dom) {
|
||||
@@ -82,7 +83,9 @@ onMounted(() => {
|
||||
const handleNodeClick = (data: any, node: any) => {
|
||||
dotList.value = data
|
||||
url.value = ''
|
||||
flag.value = false
|
||||
if (data?.url != null && data?.url != '') {
|
||||
flag.value = true
|
||||
getFileNameAndFilePath({ filePath: data.url }).then(res => {
|
||||
url.value = res.data.url
|
||||
})
|
||||
@@ -110,6 +113,38 @@ const addUser = () => {
|
||||
const editUser = () => {
|
||||
addTreeRef.value.open('修改', dotList.value)
|
||||
}
|
||||
// 下载
|
||||
const download = () => {
|
||||
let url = dotList.value.url
|
||||
let urls = url
|
||||
let name = url.match(/\/([^/]+)\.(\w+)$/)[1]
|
||||
downloadFile({ filePath: url }).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" scoped>
|
||||
.splitpanes.default-theme .splitpanes__pane {
|
||||
|
||||
@@ -19,7 +19,7 @@ import TableHeader from '@/components/table/header/index.vue'
|
||||
import { libtemplateDel } from '@/api/supervision-boot/database/index'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import { getFileNameAndFilePath } from '@/api/system-boot/file'
|
||||
import { getFileNameAndFilePath, downloadFile } from '@/api/system-boot/file'
|
||||
import PopupEdit from './components/form.vue'
|
||||
defineOptions({
|
||||
name: 'database/stencil'
|
||||
@@ -50,7 +50,7 @@ const tableStore = new TableStore({
|
||||
icon: 'el-icon-Plus',
|
||||
render: 'basicButton',
|
||||
click: row => {
|
||||
window.open(window.location.origin + '/#/previewFile?' + row.name)
|
||||
window.open(window.location.origin + '/#/previewFile?' + row.url)
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -101,16 +101,27 @@ const tableStore = new TableStore({
|
||||
const addUser = () => {
|
||||
popupEditRef.value.open('新增模版')
|
||||
}
|
||||
|
||||
// 下载报告
|
||||
const downloadTheReport = (url: string) => {
|
||||
// getFileNameAndFilePath({ filePath: url }).then((res: any) => {
|
||||
// const link = document.createElement('a')
|
||||
// link.href = res.data.url
|
||||
// link.download = res.data.name
|
||||
// document.body.appendChild(link)
|
||||
// link.click()
|
||||
// document.body.removeChild(link)
|
||||
// })
|
||||
let urls = url
|
||||
let name = url.match(/\/([^/]+)\.(\w+)$/)[1]
|
||||
downloadFile({ filePath: url }).then((res: any) => {
|
||||
let blob = new Blob([res], {
|
||||
type: urls.includes('.pdf')
|
||||
? 'application/pdf'
|
||||
: urls.includes('.docx')
|
||||
? 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
|
||||
: ''
|
||||
})
|
||||
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()
|
||||
})
|
||||
}
|
||||
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
@@ -3,42 +3,42 @@
|
||||
<div>
|
||||
<TableHeader>
|
||||
<template v-slot:select>
|
||||
<!-- <el-form-item label='任务名称'>-->
|
||||
<!-- <el-input v-model='tableStore.table.params.searchValue' placeholder='请输入任务名称'></el-input>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="搜索">
|
||||
<el-input v-model="tableStore.table.params.searchValue" placeholder="请输入搜索内容"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label='任务类型'>-->
|
||||
<!-- <el-select v-model="tableStore.table.params.runF" clearable placeholder="请选择任务类型">-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="item in runFlagList"-->
|
||||
<!-- :key="item.id"-->
|
||||
<!-- :label="item.name"-->
|
||||
<!-- :value="item.id"-->
|
||||
<!-- ></el-option>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label='任务类型'>-->
|
||||
<!-- <el-select v-model="tableStore.table.params.runF" clearable placeholder="请选择任务类型">-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="item in runFlagList"-->
|
||||
<!-- :key="item.id"-->
|
||||
<!-- :label="item.name"-->
|
||||
<!-- :value="item.id"-->
|
||||
<!-- ></el-option>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
</template>
|
||||
</TableHeader>
|
||||
<!--表格-->
|
||||
<Table ref='tableRef'></Table>
|
||||
<Table ref="tableRef"></Table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang='ts'>
|
||||
<script setup lang="ts">
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import {onMounted, provide, ref, watch} from 'vue'
|
||||
import {useRouter} from 'vue-router'
|
||||
import {getById} from "@/api/supervision-boot/leaflet";
|
||||
import {getRunningDeviceById} from "@/api/supervision-boot/device/quitRunningDev";
|
||||
import { onMounted, provide, ref, watch } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { getById } from '@/api/supervision-boot/leaflet'
|
||||
import { getRunningDeviceById } from '@/api/supervision-boot/device/quitRunningDev'
|
||||
|
||||
const router = useRouter() // 路由对象
|
||||
defineOptions({
|
||||
name: 'businessUser'
|
||||
})
|
||||
|
||||
const {push, options, currentRoute} = useRouter()
|
||||
const { push, options, currentRoute } = useRouter()
|
||||
const flag = ref(false)
|
||||
|
||||
const tableStore = new TableStore({
|
||||
@@ -55,10 +55,10 @@ const tableStore = new TableStore({
|
||||
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
|
||||
}
|
||||
},
|
||||
{title: '任务名称', field: 'taskName', minWidth: 200},
|
||||
{title: '任务内容', field: 'taskContent', minWidth: 300},
|
||||
{title: '任务来源', field: 'startUser', minWidth: 120},
|
||||
{title: '发起时间', field: 'taskCreateTime', minWidth: 180},
|
||||
{ title: '任务名称', field: 'taskName', minWidth: 200 },
|
||||
{ title: '任务内容', field: 'taskContent', minWidth: 300 },
|
||||
{ title: '任务来源', field: 'startUser', minWidth: 120 },
|
||||
{ title: '发起时间', field: 'taskCreateTime', minWidth: 180 },
|
||||
{
|
||||
field: 'source',
|
||||
title: '流程状态',
|
||||
@@ -123,24 +123,24 @@ const tableStore = new TableStore({
|
||||
let type = 1
|
||||
let key = row.businessKey
|
||||
// 特殊处理预告警单
|
||||
if(key == 'warn_leaflet'){
|
||||
if (key == 'warn_leaflet') {
|
||||
await getById(row.id).then(res => {
|
||||
if(res.code == 'A0000'){
|
||||
if(res.data.leafletType == 1){
|
||||
if (res.code == 'A0000') {
|
||||
if (res.data.leafletType == 1) {
|
||||
type = 0
|
||||
}else {
|
||||
} else {
|
||||
type = 1
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if(key == 'quit_running_device'){
|
||||
if (key == 'quit_running_device') {
|
||||
await getRunningDeviceById(row.id).then(res => {
|
||||
if(res.code == 'A0000'){
|
||||
if(res.data.deviceType == 1){
|
||||
if (res.code == 'A0000') {
|
||||
if (res.data.deviceType == 1) {
|
||||
type = 0
|
||||
}else {
|
||||
} else {
|
||||
type = 1
|
||||
}
|
||||
}
|
||||
@@ -150,25 +150,27 @@ const tableStore = new TableStore({
|
||||
// 特殊处理终端监测点状态切换
|
||||
if (
|
||||
// 干扰源建档
|
||||
key == 'build_user_info'
|
||||
key == 'build_user_info' ||
|
||||
// 终端入网检测
|
||||
|| key == 'device_info_add'
|
||||
key == 'device_info_add' ||
|
||||
// 技术监督计划
|
||||
|| key == 'sup_plan_add'
|
||||
key == 'sup_plan_add' ||
|
||||
// 台账管理 干扰源用户台账
|
||||
|| key == 'build_user_info_archivist') {
|
||||
key == 'build_user_info_archivist'
|
||||
) {
|
||||
type = 1
|
||||
} else if (
|
||||
// 干扰源用户常态化管理
|
||||
key == 'user_report_update'
|
||||
key == 'user_report_update' ||
|
||||
// 入网方案申请
|
||||
|| key == 'user_go_net'
|
||||
key == 'user_go_net' ||
|
||||
// 治理工程审核
|
||||
|| key == 'user_treat_check'
|
||||
key == 'user_treat_check' ||
|
||||
// 监测点台账录入
|
||||
|| key == 'line_info_add'
|
||||
key == 'line_info_add' ||
|
||||
// 技术监督计划测试
|
||||
|| key == 'survey_test') {
|
||||
key == 'survey_test'
|
||||
) {
|
||||
type = 2
|
||||
} else if (
|
||||
// 监测点联调
|
||||
@@ -225,20 +227,36 @@ const tableStore = new TableStore({
|
||||
],
|
||||
beforeSearchFun: () => {
|
||||
for (let key in tableStore.table.params) {
|
||||
if (tableStore.table.params[key] === '') {
|
||||
if (tableStore.table.params[key] === '' && key != 'searchValue') {
|
||||
delete tableStore.table.params[key]
|
||||
}
|
||||
}
|
||||
},
|
||||
loadCallback: () => {
|
||||
if (tableStore.table.params.searchValue) {
|
||||
const searchProps = ['taskName', 'taskContent', 'startUser', 'taskCreateTime']
|
||||
const rest = tableStore.table.data.filter(item =>
|
||||
searchProps.some(
|
||||
key => String(item[key]).toLowerCase().indexOf(tableStore.table.params.searchValue) > -1
|
||||
)
|
||||
)
|
||||
tableStore.table.data = rest.map(row => {
|
||||
const item = Object.assign({}, row)
|
||||
|
||||
return item
|
||||
})
|
||||
} else {
|
||||
tableStore.table.data = tableStore.table.data
|
||||
}
|
||||
}
|
||||
})
|
||||
tableStore.table.params.searchValue = ''
|
||||
|
||||
provide('tableStore', tableStore)
|
||||
onMounted(() => {
|
||||
// 加载数据
|
||||
tableStore.index()
|
||||
})
|
||||
tableStore.table.params.searchValue = ''
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
/** 处理审批按钮 */
|
||||
const handleAudit = (instanceId: string, historyInstanceId: string) => {
|
||||
push({
|
||||
@@ -251,7 +269,6 @@ const handleAudit = (instanceId: string, historyInstanceId: string) => {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
watch(
|
||||
() => currentRoute.value.path,
|
||||
() => {
|
||||
|
||||
Reference in New Issue
Block a user