bug调整
This commit is contained in:
@@ -1,34 +1,36 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="default-main" :style="height">
|
<div class='default-main' :style='height'>
|
||||||
<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'>
|
||||||
<PointTree :default-expand-all="false" @node-click="handleNodeClick" @init="handleNodeClick">
|
<PointTree :default-expand-all='false' @node-click='handleNodeClick' @init='handleNodeClick'>
|
||||||
</PointTree>
|
</PointTree>
|
||||||
</pane>
|
</pane>
|
||||||
<pane style="background: #fff" :style="height">
|
<pane style='background: #fff' :style='height'>
|
||||||
<TableHeader ref="TableHeaderRef" datePicker :show-search="false">
|
<TableHeader ref='TableHeaderRef' datePicker :show-search='false'>
|
||||||
<template v-slot:select>
|
<template v-slot:select>
|
||||||
<el-form-item label="客户名称">
|
<el-form-item label='客户名称'>
|
||||||
<el-input v-model="tableStore.table.params.crmName" maxlength="32" show-word-limit clearable placeholder="请输入客户名称" />
|
<el-input v-model='tableStore.table.params.crmName' maxlength='32' show-word-limit clearable
|
||||||
|
placeholder='请输入客户名称' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="报表编号">
|
<el-form-item label='报表编号'>
|
||||||
<el-input v-model="tableStore.table.params.reportNumber" clearable placeholder="请输入报表编号" maxlength="12" show-word-limit />
|
<el-input v-model='tableStore.table.params.reportNumber' clearable
|
||||||
|
placeholder='请输入报表编号' maxlength='12' show-word-limit />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template #operation>
|
<template #operation>
|
||||||
<el-upload :show-file-list="false" ref="uploadRef" action="" accept=".png,.jpg"
|
<el-upload :show-file-list='false' ref='uploadRef' action='' accept='.png,.jpg'
|
||||||
:on-change="choose" :auto-upload="false">
|
:on-change='choose' :auto-upload='false'>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<el-button icon="el-icon-Upload" type="primary" class="mr10 ml10">上传接线图</el-button>
|
<el-button icon='el-icon-Upload' type='primary' class='mr10 ml10'>上传接线图</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<el-button icon="el-icon-Download" type="primary" @click="exportEvent">生成</el-button>
|
<el-button icon='el-icon-Download' type='primary' @click='exportEvent'>生成</el-button>
|
||||||
</template>
|
</template>
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
<div class="box">
|
<div class='box'>
|
||||||
<div id="luckysheet">
|
<div id='luckysheet'>
|
||||||
<img width="100%" :style="`height: calc(${tableStore.table.height} + 40px)`"
|
<img width='100%' :style='`height: calc(${tableStore.table.height} + 40px)`'
|
||||||
src="@/assets/img/jss.png" />
|
src='@/assets/img/jss.png' />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</pane>
|
</pane>
|
||||||
@@ -36,7 +38,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang='ts'>
|
||||||
import { onMounted, ref, provide } from 'vue'
|
import { onMounted, ref, provide } from 'vue'
|
||||||
import 'splitpanes/dist/splitpanes.css'
|
import 'splitpanes/dist/splitpanes.css'
|
||||||
import { Splitpanes, Pane } from 'splitpanes'
|
import { Splitpanes, Pane } from 'splitpanes'
|
||||||
@@ -48,6 +50,7 @@ import { mainHeight } from '@/utils/layout'
|
|||||||
import { exportModel } from '@/api/process-boot/reportForms'
|
import { exportModel } from '@/api/process-boot/reportForms'
|
||||||
import { genFileId, ElMessage, ElNotification } from 'element-plus'
|
import { genFileId, ElMessage, ElNotification } from 'element-plus'
|
||||||
import type { UploadProps, UploadUserFile } from 'element-plus'
|
import type { UploadProps, UploadUserFile } from 'element-plus'
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
// name: 'harmonic-boot/report/word'
|
// name: 'harmonic-boot/report/word'
|
||||||
})
|
})
|
||||||
@@ -63,8 +66,10 @@ const tableStore = new TableStore({
|
|||||||
url: '',
|
url: '',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
column: [],
|
column: [],
|
||||||
beforeSearchFun: () => { },
|
beforeSearchFun: () => {
|
||||||
loadCallback: () => { }
|
},
|
||||||
|
loadCallback: () => {
|
||||||
|
}
|
||||||
})
|
})
|
||||||
provide('tableStore', tableStore)
|
provide('tableStore', tableStore)
|
||||||
|
|
||||||
@@ -73,7 +78,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
|
|
||||||
if (dom) {
|
if (dom) {
|
||||||
|
|
||||||
size.value = Math.round((180 / dom.offsetHeight) * 100)
|
size.value = Math.round((180 / dom.offsetHeight) * 100)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -84,8 +89,8 @@ const handleNodeClick = (data: any, node: any) => {
|
|||||||
}
|
}
|
||||||
// 上传
|
// 上传
|
||||||
const choose = (files: any) => {
|
const choose = (files: any) => {
|
||||||
const isJPG = files.raw.type === 'image/jpg';
|
const isJPG = files.raw.type === 'image/jpg'
|
||||||
const isPNG = files.raw.type === 'image/png';
|
const isPNG = files.raw.type === 'image/png'
|
||||||
if (!isJPG && !isPNG) {
|
if (!isJPG && !isPNG) {
|
||||||
ElMessage.warning('上传文件只能是 JPG/PNG 格式!')
|
ElMessage.warning('上传文件只能是 JPG/PNG 格式!')
|
||||||
return false
|
return false
|
||||||
@@ -99,7 +104,7 @@ const exportEvent = () => {
|
|||||||
if (dotList.value.level != 6) {
|
if (dotList.value.level != 6) {
|
||||||
return ElMessage.warning('请选择监测点进行报告生成!')
|
return ElMessage.warning('请选择监测点进行报告生成!')
|
||||||
}
|
}
|
||||||
ElMessage('生成报告中...')
|
|
||||||
let form = new FormData()
|
let form = new FormData()
|
||||||
form.append('lineIndex', dotList.value.id)
|
form.append('lineIndex', dotList.value.id)
|
||||||
form.append('name', dotList.value.name)
|
form.append('name', dotList.value.name)
|
||||||
@@ -108,20 +113,20 @@ const exportEvent = () => {
|
|||||||
form.append('type', '0')
|
form.append('type', '0')
|
||||||
form.append('startTime', TableHeaderRef.value.datePickerRef.timeValue[0])
|
form.append('startTime', TableHeaderRef.value.datePickerRef.timeValue[0])
|
||||||
form.append('endTime', TableHeaderRef.value.datePickerRef.timeValue[1])
|
form.append('endTime', TableHeaderRef.value.datePickerRef.timeValue[1])
|
||||||
console.log("🚀 ~ exportEvent ~ uploadList.value:", uploadList.value?.raw)
|
console.log('🚀 ~ exportEvent ~ uploadList.value:', uploadList.value?.raw)
|
||||||
|
form.append('file', uploadList.value?.raw || '')
|
||||||
|
// 特殊字符正则表达式
|
||||||
form.append('file', uploadList.value?.raw ||'')
|
const specialCharRegex = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/
|
||||||
|
if (specialCharRegex.test(tableStore.table.params.crmName) || specialCharRegex.test(tableStore.table.params.reportNumber)) {
|
||||||
exportModel(form).then((res: any) => {
|
ElNotification({
|
||||||
if(res.size == 79){
|
type: 'error',
|
||||||
ElNotification({
|
message: '包含特殊字符,请注意修改!'
|
||||||
type: 'error',
|
})
|
||||||
message: '包含特殊字符,请注意修改!'
|
}else{
|
||||||
})
|
ElMessage('生成报告中...')
|
||||||
}else{
|
exportModel(form).then((res: any) => {
|
||||||
let blob = new Blob([res], {
|
let blob = new Blob([res], {
|
||||||
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=UTF-8",
|
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=UTF-8'
|
||||||
})
|
})
|
||||||
// createObjectURL(blob); //创建下载的链接
|
// createObjectURL(blob); //创建下载的链接
|
||||||
const url = window.URL.createObjectURL(blob)
|
const url = window.URL.createObjectURL(blob)
|
||||||
@@ -131,11 +136,12 @@ const exportEvent = () => {
|
|||||||
document.body.appendChild(link)
|
document.body.appendChild(link)
|
||||||
link.click() //执行下载
|
link.click() //执行下载
|
||||||
document.body.removeChild(link)
|
document.body.removeChild(link)
|
||||||
}
|
})
|
||||||
})
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang='scss'>
|
||||||
.splitpanes.default-theme .splitpanes__pane {
|
.splitpanes.default-theme .splitpanes__pane {
|
||||||
background: #eaeef1;
|
background: #eaeef1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user