修改资料库

This commit is contained in:
GGJ
2024-09-18 15:52:50 +08:00
parent 5cf6144763
commit 1a8e5e88a4
11 changed files with 588 additions and 330 deletions

View File

@@ -58,6 +58,27 @@ export const libcaseBeleteyById = (data: any) => {
params: data 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',
})
}
/** /**
* 案例库修改 * 案例库修改
*/ */

View File

@@ -1,9 +1,7 @@
import createAxios from '@/utils/request' import createAxios from '@/utils/request'
const SYSTEM_PREFIX = '/system-boot' const SYSTEM_PREFIX = '/system-boot'
/** /**
* 上传文件 * 上传文件
* @param file * @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) => { export const downloadFile = (filePath: any) => {
let form = new FormData() // let form = new FormData()
form.append('filePath', filePath) // form.append('filePath', filePath)
return createAxios({ return createAxios({
url: SYSTEM_PREFIX + '/file/download', url: SYSTEM_PREFIX + '/file/download',
method: 'GET' method: 'GET',
params: filePath,
responseType: 'blob'
}) })
} }
@@ -61,14 +59,13 @@ export const getFileUrl = (filePath: string) => {
}) })
} }
/** /**
* 根据获取文件的一个短期url及文件名 * 根据获取文件的一个短期url及文件名
*/ */
export const getFileNameAndFilePath = (query: any) => { export const getFileNameAndFilePath = (query: any) => {
return createAxios({ return createAxios({
url:SYSTEM_PREFIX + '/file/getFileVO', url: SYSTEM_PREFIX + '/file/getFileVO',
method: 'GET', method: 'GET',
params:query params: query
}) })
} }

View File

@@ -64,6 +64,7 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
if ( if (
!( !(
config.url == '/system-boot/file/upload' || config.url == '/system-boot/file/upload' ||
config.url == '/harmonic-boot/grid/getAssessOverview' || config.url == '/harmonic-boot/grid/getAssessOverview' ||
config.url == '/system-boot/file/getFileVO' || config.url == '/system-boot/file/getFileVO' ||
config.url == '/harmonic-boot/gridDiagram/getGridDiagramAreaData' config.url == '/harmonic-boot/gridDiagram/getGridDiagramAreaData'
@@ -108,6 +109,7 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
Array.isArray(response.data) || Array.isArray(response.data) ||
response.data.size || response.data.size ||
response.config.url == '/harmonic-boot/exportmodel/exportModelJB' || 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/exportExcelListTemplate' ||
response.config.url == '/harmonic-boot/powerStatistics/exportExcelRangTemplate' response.config.url == '/harmonic-boot/powerStatistics/exportExcelRangTemplate'
// || // ||

View File

@@ -29,6 +29,7 @@
> >
新增 新增
</el-button> </el-button>
<el-button icon="el-icon-Delete" type="primary" @click="deletes">删除</el-button>
</div> </div>
</div> </div>
@@ -64,11 +65,11 @@
<template #default="{ row }"> <template #default="{ row }">
<el-button type="primary" link @click="edit(row)">修改</el-button> <el-button type="primary" link @click="edit(row)">修改</el-button>
<!-- <el-button type="danger" link @click="del(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> <template #reference>
<el-button type="danger" link>删除</el-button> <el-button type="danger" link>删除</el-button>
</template> </template>
</el-popconfirm> </el-popconfirm> -->
</template> </template>
</vxe-column> </vxe-column>
</vxe-table> </vxe-table>
@@ -79,6 +80,24 @@
<addTree ref="addTreeRef" @getTree="treeRef.loadData(dotList.id)" /> <addTree ref="addTreeRef" @getTree="treeRef.loadData(dotList.id)" />
<!-- 弹框 --> <!-- 弹框 -->
<PopupEdit ref="popupEditRef" @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> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -94,6 +113,7 @@ import PopupEdit from './components/form.vue'
import { useMonitoringPoint } from '@/stores/monitoringPoint' 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 } from '@/api/supervision-boot/database/index'
defineOptions({ defineOptions({
name: 'database/algorithm' name: 'database/algorithm'
}) })
@@ -102,10 +122,16 @@ const height = mainHeight(20)
const heightTab = mainHeight(82) const heightTab = mainHeight(82)
const size = ref(0) const size = ref(0)
const addTreeRef = ref() const addTreeRef = ref()
const dialogVisible = ref(false)
const treeRef = ref() const treeRef = ref()
const popupEditRef = ref() const popupEditRef = ref()
const TreeData = ref([])
const TreeValue = ref([])
const TableHeaderRef = ref() const defaultProps = {
label: 'name',
value: 'id'
}
const dotList: any = ref() const dotList: any = ref()
const templatePolicy: any = ref([]) const templatePolicy: any = ref([])
@@ -175,12 +201,33 @@ const handleNodeClick = (data: any, node: any) => {
const onAddTree = () => { const onAddTree = () => {
addTreeRef.value.open('新增') addTreeRef.value.open('新增')
} }
const deletes = () => {
queryAllAlgorithmLibrary().then(res => {
TreeData.value = res.data
})
dialogVisible.value = true
}
// 删除 // 删除
const del = (row: any) => { const del = () => {
deleteyById({ id: row.id }).then(res => { if (TreeValue.value.length == 0) {
return ElMessage.warning('请选择数据')
}
ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteyById({ id: TreeValue.value }).then(res => {
ElMessage.success('删除成功') ElMessage.success('删除成功')
dialogVisible.value = false
treeRef.value.loadData() treeRef.value.loadData()
}) })
})
// if (TreeValue.value.length > 0) {
// ElMessage.warning('请选择数据')
// return
// }
} }
// 修改 // 修改
const edit = (row: any) => { const edit = (row: any) => {

View 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>

View File

@@ -2,34 +2,75 @@
<div> <div>
<el-drawer v-model="drawer" size="1000px"> <el-drawer v-model="drawer" size="1000px">
<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">
<iframe <!-- <el-empty description="暂无数据" class="custom-empty 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" <div :style="`overflow: auto;`" class="iframe">
frameborder="0" <vue-office-docx v-if="url.includes('.doc') || url.includes('.docx')" :src="url" />
></iframe> <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-item>
</el-collapse> </el-collapse>
</el-drawer> </el-drawer>
</div> </div>
</template> </template>
<script setup lang="ts"> <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' import { ref, reactive } from 'vue'
const drawer = ref(false) const drawer = ref(false)
const activeName = ref('2') 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 drawer.value = true
getFileNameAndFilePath({ filePath: row }).then(res => {
url.value = res.data.url
})
} }
defineExpose({ open }) defineExpose({ open })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/* 设置iframe的样式 */ /* 设置iframe的样式 */
iframe { .iframe {
width: 100%; /* 宽度设置为父容器的100% */ width: 100%; /* 宽度设置为父容器的100% */
height: calc(100vh - 210px); /* 高度根据需要设置 */ height: calc(100vh - 110px); /* 高度根据需要设置 */
border: none; /* 移除边框 */ border: none; /* 移除边框 */
transform: scale(1); /* 放大200% */ 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> </style>

View File

@@ -58,11 +58,6 @@
<el-button type="primary">上传</el-button> <el-button type="primary">上传</el-button>
</el-upload> </el-upload>
</el-form-item> </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> </el-form>
<div style="display: flex"> <div style="display: flex">
@@ -91,7 +86,6 @@ const dialogVisible = ref(false)
const title = ref('') const title = ref('')
const formRef = ref() const formRef = ref()
const fileList: any = ref([]) const fileList: any = ref([])
const caseList: any = ref([])
// 注意不要和表单ref的命名冲突 // 注意不要和表单ref的命名冲突
const form = reactive<anyObj>({ const form = reactive<anyObj>({
type: '', type: '',
@@ -119,7 +113,6 @@ const open = (text: string, data?: anyObj) => {
dialogVisible.value = true dialogVisible.value = true
if (data) { if (data) {
fileList.value = [] fileList.value = []
caseList.value = []
// 表单赋值 // 表单赋值
for (let key in form) { for (let key in form) {
form[key] = data[key] 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 { } else {
// 在此处恢复默认表单 // 在此处恢复默认表单
for (let key in form) { for (let key in form) {
@@ -180,32 +164,6 @@ const submit = () => {
form.url = '' 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(() => { setTimeout(() => {
if (title.value === '新增案例') { if (title.value === '新增案例') {
libcaseAdd(form).then(res => { libcaseAdd(form).then(res => {

View File

@@ -4,6 +4,14 @@
<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">新增</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> </template>
</TableHeader> </TableHeader>
<Table ref="tableRef"></Table> <Table ref="tableRef"></Table>
@@ -14,7 +22,9 @@
<span v-html="summary"></span> <span v-html="summary"></span>
</el-dialog> </el-dialog>
<!-- 抽屉 --> <!-- 抽屉 -->
<drawer ref="drawerRef"/> <drawer ref="drawerRef" />
<!-- 文件 -->
<annex ref="annexRef" />
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -25,7 +35,10 @@ import Table from '@/components/table/index.vue'
import PopupEdit from './components/form.vue' import PopupEdit from './components/form.vue'
import { libcaseBeleteyById } from '@/api/supervision-boot/database/index' import { libcaseBeleteyById } from '@/api/supervision-boot/database/index'
import drawer from './components/drawer.vue' import drawer from './components/drawer.vue'
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 { addStandardCase, queryStandardCase } from '@/api/supervision-boot/database/index'
defineOptions({ defineOptions({
name: 'database/case' name: 'database/case'
}) })
@@ -33,6 +46,7 @@ defineOptions({
const popupEditRef = ref() const popupEditRef = ref()
const drawerRef = ref() const drawerRef = ref()
const TableHeaderRef = ref() const TableHeaderRef = ref()
const annexRef = ref()
const dialogVisible = ref(false) const dialogVisible = ref(false)
const summary = ref('') const summary = ref('')
@@ -62,10 +76,6 @@ const tableStore = new TableStore({
title: '治理效果', title: '治理效果',
field: 'effect' field: 'effect'
}, },
// {
// title: '事件简介',
// field: 'summary'
// },
{ {
title: '事件简介', title: '事件简介',
width: '140', width: '140',
@@ -81,24 +91,24 @@ const tableStore = new TableStore({
dialogVisible.value = true dialogVisible.value = true
summary.value = row.summary summary.value = row.summary
} }
},
{
name: 'view',
title: '抽屉',
type: 'primary',
icon: 'el-icon-Plus',
render: 'basicButton',
click: row => {
drawerRef.value.open(row)
}
} }
] ]
}, },
{ {
title: '操作', title: '操作',
width: '140', 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.url)
}
},
{ {
name: 'edit', name: 'edit',
title: '修改', title: '修改',
@@ -143,6 +153,56 @@ const addUser = () => {
provide('tableStore', tableStore) provide('tableStore', tableStore)
onMounted(() => { onMounted(() => {
tableStore.index() 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> </script>
<style lang="scss"></style> <style lang="scss"></style>

View File

@@ -17,6 +17,7 @@
<el-button icon="el-icon-Plus" type="primary" @click="addUser">新增</el-button> <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-Edit" type="primary" @click="editUser">修改</el-button>
<el-button icon="el-icon-Delete" type="primary" @click="deleteEven">删除</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> </div>
<el-empty <el-empty
v-if="url.length == 0" v-if="url.length == 0"
@@ -51,7 +52,7 @@ import { mainHeight } from '@/utils/layout'
import addTree from './components/addTree.vue' import addTree from './components/addTree.vue'
import { useMonitoringPoint } from '@/stores/monitoringPoint' import { useMonitoringPoint } from '@/stores/monitoringPoint'
import { ElMessage, ElMessageBox } from 'element-plus' 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' import '@vue-office/excel/lib/index.css'
//引入VueOfficeDocx组件 //引入VueOfficeDocx组件
@@ -71,7 +72,7 @@ const treeRef = ref()
const addTreeRef = ref() const addTreeRef = ref()
const url = ref('') const url = ref('')
const dotList: any = ref({}) const dotList: any = ref({})
const flag: any = ref(false)
onMounted(() => { onMounted(() => {
const dom = document.getElementById('navigation-splitpanes') const dom = document.getElementById('navigation-splitpanes')
if (dom) { if (dom) {
@@ -82,7 +83,9 @@ onMounted(() => {
const handleNodeClick = (data: any, node: any) => { const handleNodeClick = (data: any, node: any) => {
dotList.value = data dotList.value = data
url.value = '' url.value = ''
flag.value = false
if (data?.url != null && data?.url != '') { if (data?.url != null && data?.url != '') {
flag.value = true
getFileNameAndFilePath({ filePath: data.url }).then(res => { getFileNameAndFilePath({ filePath: data.url }).then(res => {
url.value = res.data.url url.value = res.data.url
}) })
@@ -110,6 +113,38 @@ const addUser = () => {
const editUser = () => { const editUser = () => {
addTreeRef.value.open('修改', dotList.value) 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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.splitpanes.default-theme .splitpanes__pane { .splitpanes.default-theme .splitpanes__pane {

View File

@@ -19,7 +19,7 @@ import TableHeader from '@/components/table/header/index.vue'
import { libtemplateDel } from '@/api/supervision-boot/database/index' import { libtemplateDel } from '@/api/supervision-boot/database/index'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import Table from '@/components/table/index.vue' 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' import PopupEdit from './components/form.vue'
defineOptions({ defineOptions({
name: 'database/stencil' name: 'database/stencil'
@@ -50,7 +50,7 @@ const tableStore = new TableStore({
icon: 'el-icon-Plus', icon: 'el-icon-Plus',
render: 'basicButton', render: 'basicButton',
click: row => { 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 = () => { const addUser = () => {
popupEditRef.value.open('新增模版') popupEditRef.value.open('新增模版')
} }
// 下载报告 // 下载报告
const downloadTheReport = (url: string) => { const downloadTheReport = (url: string) => {
// getFileNameAndFilePath({ filePath: url }).then((res: any) => { let urls = url
// const link = document.createElement('a') let name = url.match(/\/([^/]+)\.(\w+)$/)[1]
// link.href = res.data.url downloadFile({ filePath: url }).then((res: any) => {
// link.download = res.data.name let blob = new Blob([res], {
// document.body.appendChild(link) type: urls.includes('.pdf')
// link.click() ? 'application/pdf'
// document.body.removeChild(link) : 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) provide('tableStore', tableStore)

View File

@@ -3,42 +3,42 @@
<div> <div>
<TableHeader> <TableHeader>
<template v-slot:select> <template v-slot:select>
<!-- <el-form-item label='任务名称'>--> <el-form-item label="搜索">
<!-- <el-input v-model='tableStore.table.params.searchValue' placeholder='请输入任务名称'></el-input>--> <el-input v-model="tableStore.table.params.searchValue" placeholder="请输入搜索内容"></el-input>
<!-- </el-form-item>--> </el-form-item>
<!-- <el-form-item label='任务类型'>--> <!-- <el-form-item label='任务类型'>-->
<!-- <el-select v-model="tableStore.table.params.runF" clearable placeholder="请选择任务类型">--> <!-- <el-select v-model="tableStore.table.params.runF" clearable placeholder="请选择任务类型">-->
<!-- <el-option--> <!-- <el-option-->
<!-- v-for="item in runFlagList"--> <!-- v-for="item in runFlagList"-->
<!-- :key="item.id"--> <!-- :key="item.id"-->
<!-- :label="item.name"--> <!-- :label="item.name"-->
<!-- :value="item.id"--> <!-- :value="item.id"-->
<!-- ></el-option>--> <!-- ></el-option>-->
<!-- </el-select>--> <!-- </el-select>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
</template> </template>
</TableHeader> </TableHeader>
<!--表格--> <!--表格-->
<Table ref='tableRef'></Table> <Table ref="tableRef"></Table>
</div> </div>
</template> </template>
<script setup lang='ts'> <script setup lang="ts">
import TableStore from '@/utils/tableStore' import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue' import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue' import TableHeader from '@/components/table/header/index.vue'
import {onMounted, provide, ref, watch} from 'vue' import { onMounted, provide, ref, watch } from 'vue'
import {useRouter} from 'vue-router' import { useRouter } from 'vue-router'
import {getById} from "@/api/supervision-boot/leaflet"; import { getById } from '@/api/supervision-boot/leaflet'
import {getRunningDeviceById} from "@/api/supervision-boot/device/quitRunningDev"; import { getRunningDeviceById } from '@/api/supervision-boot/device/quitRunningDev'
const router = useRouter() // 路由对象 const router = useRouter() // 路由对象
defineOptions({ defineOptions({
name: 'businessUser' name: 'businessUser'
}) })
const {push, options, currentRoute} = useRouter() const { push, options, currentRoute } = useRouter()
const flag = ref(false) const flag = ref(false)
const tableStore = new TableStore({ 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 return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
} }
}, },
{title: '任务名称', field: 'taskName', minWidth: 200}, { title: '任务名称', field: 'taskName', minWidth: 200 },
{title: '任务内容', field: 'taskContent', minWidth: 300}, { title: '任务内容', field: 'taskContent', minWidth: 300 },
{title: '任务来源', field: 'startUser', minWidth: 120}, { title: '任务来源', field: 'startUser', minWidth: 120 },
{title: '发起时间', field: 'taskCreateTime', minWidth: 180}, { title: '发起时间', field: 'taskCreateTime', minWidth: 180 },
{ {
field: 'source', field: 'source',
title: '流程状态', title: '流程状态',
@@ -123,24 +123,24 @@ const tableStore = new TableStore({
let type = 1 let type = 1
let key = row.businessKey let key = row.businessKey
// 特殊处理预告警单 // 特殊处理预告警单
if(key == 'warn_leaflet'){ if (key == 'warn_leaflet') {
await getById(row.id).then(res => { await getById(row.id).then(res => {
if(res.code == 'A0000'){ if (res.code == 'A0000') {
if(res.data.leafletType == 1){ if (res.data.leafletType == 1) {
type = 0 type = 0
}else { } else {
type = 1 type = 1
} }
} }
}) })
} }
if(key == 'quit_running_device'){ if (key == 'quit_running_device') {
await getRunningDeviceById(row.id).then(res => { await getRunningDeviceById(row.id).then(res => {
if(res.code == 'A0000'){ if (res.code == 'A0000') {
if(res.data.deviceType == 1){ if (res.data.deviceType == 1) {
type = 0 type = 0
}else { } else {
type = 1 type = 1
} }
} }
@@ -150,25 +150,27 @@ const tableStore = new TableStore({
// 特殊处理终端监测点状态切换 // 特殊处理终端监测点状态切换
if ( 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 type = 1
} else if ( } 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 type = 2
} else if ( } else if (
// 监测点联调 // 监测点联调
@@ -225,20 +227,36 @@ const tableStore = new TableStore({
], ],
beforeSearchFun: () => { beforeSearchFun: () => {
for (let key in tableStore.table.params) { for (let key in tableStore.table.params) {
if (tableStore.table.params[key] === '') { if (tableStore.table.params[key] === '' && key != 'searchValue') {
delete tableStore.table.params[key] 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(() => { onMounted(() => {
// 加载数据 // 加载数据
tableStore.index() tableStore.index()
}) })
tableStore.table.params.searchValue = ''
provide('tableStore', tableStore)
/** 处理审批按钮 */ /** 处理审批按钮 */
const handleAudit = (instanceId: string, historyInstanceId: string) => { const handleAudit = (instanceId: string, historyInstanceId: string) => {
push({ push({
@@ -251,7 +269,6 @@ const handleAudit = (instanceId: string, historyInstanceId: string) => {
}) })
} }
watch( watch(
() => currentRoute.value.path, () => currentRoute.value.path,
() => { () => {