联调 过程监督
This commit is contained in:
@@ -85,7 +85,8 @@ export function batchTerminal(file) {
|
||||
return createAxios({
|
||||
url: '/process-boot/process/pmsTerminalDetection/batchTerminal',
|
||||
method: 'post',
|
||||
data: form
|
||||
data: form,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
// 上传文件
|
||||
|
||||
@@ -38,7 +38,7 @@ const initChart = () => {
|
||||
color: '#000',
|
||||
fontSize: 18
|
||||
},
|
||||
...(props.options.title || null)
|
||||
...(props.options?.title || null)
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
@@ -57,7 +57,7 @@ const initChart = () => {
|
||||
},
|
||||
backgroundColor: 'rgba(0,0,0,0.35)',
|
||||
borderWidth: 0,
|
||||
...(props.options.tooltip || null)
|
||||
...(props.options?.tooltip || null)
|
||||
},
|
||||
legend: {
|
||||
right: 20,
|
||||
@@ -70,19 +70,19 @@ const initChart = () => {
|
||||
},
|
||||
itemWidth: 15,
|
||||
itemHeight: 10,
|
||||
...(props.options.legend || null)
|
||||
...(props.options?.legend || null)
|
||||
},
|
||||
grid: {
|
||||
top: '50px',
|
||||
left: '10px',
|
||||
right: '60px',
|
||||
bottom: props.options.options?.dataZoom === null ? '10px' : '40px',
|
||||
bottom: props.options?.options?.dataZoom === null ? '10px' : '40px',
|
||||
containLabel: true,
|
||||
...(props.options.grid || null)
|
||||
...(props.options?.grid || null)
|
||||
},
|
||||
xAxis: props.options.xAxis ? handlerXAxis() : null,
|
||||
yAxis: props.options.yAxis ? handlerYAxis() : null,
|
||||
dataZoom: props.options.dataZoom || [
|
||||
xAxis: props.options?.xAxis ? handlerXAxis() : null,
|
||||
yAxis: props.options?.yAxis ? handlerYAxis() : null,
|
||||
dataZoom: props.options?.dataZoom || [
|
||||
{
|
||||
type: 'inside',
|
||||
height: 13,
|
||||
@@ -97,9 +97,9 @@ const initChart = () => {
|
||||
end: 100
|
||||
}
|
||||
],
|
||||
color: props.options.color || color,
|
||||
series: props.options.series,
|
||||
...props.options.options
|
||||
color: props.options?.color || color,
|
||||
series: props.options?.series,
|
||||
...props.options?.options
|
||||
}
|
||||
handlerBar(options)
|
||||
// 处理柱状图
|
||||
@@ -120,8 +120,8 @@ const handlerBar = (options: any) => {
|
||||
if (params.value == 0 || params.value == 3.14159) {
|
||||
return '#ccc'
|
||||
} else {
|
||||
return props.options.color
|
||||
? props.options.color[params.seriesIndex]
|
||||
return props.options?.color
|
||||
? props.options?.color[params.seriesIndex]
|
||||
: color[params.seriesIndex]
|
||||
}
|
||||
}
|
||||
@@ -135,6 +135,7 @@ const handlerBar = (options: any) => {
|
||||
const handlerYAxis = () => {
|
||||
let temp = {
|
||||
type: 'value',
|
||||
nameGap: 15,
|
||||
nameTextStyle: {
|
||||
color: '#000'
|
||||
},
|
||||
@@ -158,9 +159,9 @@ const handlerYAxis = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
// props.options.xAxis 是数组还是对象
|
||||
if (Array.isArray(props.options.yAxis)) {
|
||||
return props.options.yAxis.map((item: any) => {
|
||||
// props.options?.xAxis 是数组还是对象
|
||||
if (Array.isArray(props.options?.yAxis)) {
|
||||
return props.options?.yAxis.map((item: any) => {
|
||||
return {
|
||||
...item,
|
||||
...temp
|
||||
@@ -169,7 +170,7 @@ const handlerYAxis = () => {
|
||||
} else {
|
||||
return {
|
||||
...temp,
|
||||
...props.options.yAxis
|
||||
...props.options?.yAxis
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -190,9 +191,9 @@ const handlerXAxis = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
// props.options.xAxis 是数组还是对象
|
||||
if (Array.isArray(props.options.xAxis)) {
|
||||
return props.options.xAxis.map((item: any) => {
|
||||
// props.options?.xAxis 是数组还是对象
|
||||
if (Array.isArray(props.options?.xAxis)) {
|
||||
return props.options?.xAxis.map((item: any) => {
|
||||
return {
|
||||
...temp,
|
||||
...item
|
||||
@@ -201,7 +202,7 @@ const handlerXAxis = () => {
|
||||
} else {
|
||||
return {
|
||||
...temp,
|
||||
...props.options.xAxis
|
||||
...props.options?.xAxis
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" :title="title" style="width: 800px">
|
||||
<el-dialog v-model="dialogVisible" :title="title" style="width: 800px" :before-close="handleClose">
|
||||
<el-form :model="form" :rules="rules" class="form-style" ref="elform" label-width="120px">
|
||||
<el-form-item label="终端编号:" prop="id">
|
||||
<el-input
|
||||
clearable
|
||||
:disabled="title == `修改`"
|
||||
:disabled="title == `编辑`"
|
||||
v-model="form.id"
|
||||
placeholder="请输入终端编号"
|
||||
></el-input>
|
||||
@@ -37,7 +37,7 @@
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="原始数据报告:" prop="fileList">
|
||||
<el-form-item label="原始数据报告:">
|
||||
<el-upload
|
||||
v-model:file-list="form.fileList"
|
||||
ref="uploadRef"
|
||||
@@ -56,7 +56,7 @@
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="submit">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
@@ -65,7 +65,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { upload, insertTerminal } from '@/api/process-boot/terminal'
|
||||
import { upload, insertTerminal, updateTerminal } from '@/api/process-boot/terminal'
|
||||
import type { UploadInstance, UploadProps, UploadRawFile } from 'element-plus'
|
||||
|
||||
import { genFileId, ElMessage } from 'element-plus'
|
||||
@@ -73,8 +73,8 @@ const emit = defineEmits(['onsubmit'])
|
||||
const dictData = useDictData()
|
||||
const manufactorList = dictData.getBasicData('Dev_Manufacturers')
|
||||
const dialogVisible = ref(false)
|
||||
const title = ref('')
|
||||
const form = ref({
|
||||
const title: any = ref('')
|
||||
const form: any = ref({
|
||||
id: '',
|
||||
inspectionUnit: '',
|
||||
inspectionTime: '',
|
||||
@@ -103,11 +103,15 @@ const submit = () => {
|
||||
if (title.value == '新增') {
|
||||
insertTerminal(form.value).then(res => {
|
||||
ElMessage.success('新增成功!')
|
||||
dialogVisible.value = false
|
||||
handleClose()
|
||||
emit('onsubmit')
|
||||
|
||||
})
|
||||
} else {
|
||||
updateTerminal(form.value).then(res => {
|
||||
ElMessage.success('修改成功!')
|
||||
handleClose()
|
||||
emit('onsubmit')
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -122,13 +126,23 @@ const handleExceed: UploadProps['onExceed'] = files => {
|
||||
const choose = (e: any) => {
|
||||
upload(e.raw).then(res => {
|
||||
form.value.originalReport = res.data
|
||||
form.value.originalName = e.name
|
||||
})
|
||||
}
|
||||
|
||||
const open = (row: any) => {
|
||||
title.value = row.title
|
||||
if (row.title == '编辑') {
|
||||
row.row ? (form.value = JSON.parse(JSON.stringify(row.row))) : ''
|
||||
form.value.orgNo = dictData.state.area[0].id
|
||||
form.value.fileList = [{ name: form.value.originalName, status: 'ready', uid: form.value.id }]
|
||||
}
|
||||
dialogVisible.value = true
|
||||
}
|
||||
const handleClose = () => {
|
||||
elform.value.resetFields()
|
||||
dialogVisible.value = false
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
|
||||
79
src/views/pqs/supervise/terminal/components/cycleEch.vue
Normal file
79
src/views/pqs/supervise/terminal/components/cycleEch.vue
Normal file
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<div>
|
||||
<TableHeader area datePicker></TableHeader>
|
||||
<div style="display: flex" v-loading="tableStore.table.loading" :style="{ height: height }">
|
||||
<MyEchart :options="options1" />
|
||||
<MyEchart :options="options2" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import MyEchart from '@/components/echarts/MyEchart.vue'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
import { ref, provide, onMounted } from 'vue'
|
||||
const options1 = ref()
|
||||
const options2 = ref()
|
||||
const tableStore = new TableStore({
|
||||
url: '/process-boot/process/pmsTerminalDetection/getCycleStatistics',
|
||||
method: 'POST',
|
||||
column: [],
|
||||
beforeSearchFun: () => {
|
||||
tableStore.table.params.id = tableStore.table.params.deptIndex
|
||||
},
|
||||
loadCallback: () => {
|
||||
options1.value = {
|
||||
legend: {
|
||||
data: ['已展开', '未展开']
|
||||
},
|
||||
xAxis: {
|
||||
data: tableStore.table.data.dateStatistics.map(item => item.orgName)
|
||||
},
|
||||
yAxis: {
|
||||
name: '台'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '已展开',
|
||||
type: 'bar',
|
||||
|
||||
data: tableStore.table.data.dateStatistics.map(item => item.expanded)
|
||||
},
|
||||
{
|
||||
name: '未展开',
|
||||
type: 'bar',
|
||||
|
||||
data: tableStore.table.data.dateStatistics.map(item => item.notExpanded)
|
||||
}
|
||||
]
|
||||
}
|
||||
options2.value = {
|
||||
legend: {
|
||||
data: ['检测终端数量']
|
||||
},
|
||||
xAxis: {
|
||||
data: tableStore.table.data.orgStatistics.map(item => item.orgName)
|
||||
},
|
||||
yAxis: {
|
||||
name: '台'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '检测终端数量',
|
||||
type: 'bar',
|
||||
|
||||
data: tableStore.table.data.orgStatistics.map(item => item.count)
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
})
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
const height = mainHeight(160).height
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -4,32 +4,41 @@
|
||||
<TableHeader area ref="TableHeaderRef">
|
||||
<template #select>
|
||||
<el-form-item label="终端名称">
|
||||
<el-select v-model="tableStore.table.params.searchState" placeholder="请选择终端名称">
|
||||
<el-option
|
||||
v-for="item in uploadData"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
<el-input
|
||||
v-model="tableStore.table.params.name"
|
||||
clearable
|
||||
placeholder="请输入终端名称"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="生产厂家">
|
||||
<el-select v-model="tableStore.table.params.searchStat1e" placeholder="请选择生产厂家">
|
||||
<el-select
|
||||
v-model="tableStore.table.params.manufacture"
|
||||
placeholder="请选择生产厂家"
|
||||
multiple
|
||||
collapse-tags
|
||||
clearable
|
||||
class="select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in uploadData"
|
||||
v-for="item in manufactorList"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="检测结果">
|
||||
<el-select v-model="tableStore.table.params.searchState3" placeholder="请输入检测结果">
|
||||
<el-select
|
||||
v-model="tableStore.table.params.testResults"
|
||||
placeholder="请选择检测结果"
|
||||
clearable
|
||||
class="select"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in uploadData"
|
||||
v-for="item in testResultsList"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
@@ -37,10 +46,54 @@
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button icon="el-icon-Download" type="primary">导出</el-button>
|
||||
<el-button icon="el-icon-Upload" type="primary">上传检测报告</el-button>
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
action=""
|
||||
accept=".xls"
|
||||
:on-change="choose"
|
||||
:show-file-list="false"
|
||||
:auto-upload="false"
|
||||
>
|
||||
<template #trigger>
|
||||
<el-button
|
||||
icon="el-icon-Upload"
|
||||
type="primary"
|
||||
style="margin-left: 12px; margin-right: 12px"
|
||||
>
|
||||
excel导入
|
||||
</el-button>
|
||||
</template>
|
||||
</el-upload>
|
||||
<el-button icon="el-icon-Upload" type="primary" @click="UploadOriginal">上传检测报告</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref="tableRef" />
|
||||
<!-- 上传检测报告 -->
|
||||
<el-dialog
|
||||
title="上传检测报告__支持批量上传"
|
||||
v-model="showBatchUpload"
|
||||
width="30%"
|
||||
:before-close="handleClose"
|
||||
>
|
||||
<el-upload
|
||||
multiple
|
||||
action=""
|
||||
:auto-upload="false"
|
||||
:limit="999"
|
||||
accept=".doc,.docx"
|
||||
:file-list="fileList"
|
||||
:on-remove="handleRemove"
|
||||
:on-change="chooseBatch"
|
||||
ref="upload"
|
||||
>
|
||||
<el-button type="primary" icon="el-icon-Upload">选择文件</el-button>
|
||||
<span :style="`color:#f58003`"> (*传入的检测报告文件格式(终端编号-检测报告(yyyy-MM-dd).docx))</span>
|
||||
</el-upload>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取 消</el-button>
|
||||
<el-button type="primary" @click="BatchUpload">上 传</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -50,48 +103,75 @@ import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
import { DownloadExport, reportDownload, batchTerminal, delTerminal ,importReport} from '@/api/process-boot/terminal'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { addUse, updateUse, removeUse } from '@/api/advance-boot/bearingCapacity'
|
||||
|
||||
const dictData = useDictData()
|
||||
const uploadData = [
|
||||
const manufactorList = dictData.getBasicData('Dev_Manufacturers')
|
||||
const testResultsList = [
|
||||
{
|
||||
id: 0,
|
||||
|
||||
label: '未上传'
|
||||
name: '未展开'
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
|
||||
label: '已上传'
|
||||
name: '已展开'
|
||||
}
|
||||
]
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const TableHeaderRef = ref()
|
||||
const title = ref('')
|
||||
|
||||
const showBatchUpload = ref(false)
|
||||
const ruleFormRef = ref()
|
||||
const fileList: any = ref([])
|
||||
const tableStore = new TableStore({
|
||||
url: '/system-boot/area/areaSelect',
|
||||
url: '/process-boot/process/pmsTerminalDetection/getTerminalPage',
|
||||
publicHeight: 85,
|
||||
method: 'POST',
|
||||
column: [
|
||||
{ width: '60', type: 'checkbox' },
|
||||
|
||||
{ field: 'id', title: '终端编号' },
|
||||
{ field: 'name', title: '上产厂家' },
|
||||
{ field: 'orgName', title: '安装位置' },
|
||||
{
|
||||
field: 'manufacture',
|
||||
title: '生产厂家',
|
||||
formatter(row: any) {
|
||||
return manufactorList.filter(item => item.id == row.cellValue)[0]?.name
|
||||
}
|
||||
},
|
||||
{ field: 'installPlace', title: '安装位置' },
|
||||
{ field: 'inspectionUnit', title: '送检单位' },
|
||||
{ field: 'testResults', title: '检测结果' },
|
||||
{ field: 'nextInspectionTime', title: '下次监测时间' },
|
||||
{ field: 'nextInspectionTime', title: '下次检测时间' },
|
||||
{
|
||||
title: '操作',
|
||||
width: '180',
|
||||
width: '250',
|
||||
render: 'buttons',
|
||||
fixed: 'right',
|
||||
buttons: [
|
||||
{
|
||||
name: 'edit',
|
||||
title: '编辑',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
click: row => {}
|
||||
},
|
||||
{
|
||||
title: '删除',
|
||||
type: 'danger',
|
||||
icon: 'el-icon-Delete',
|
||||
render: 'confirmButton',
|
||||
popconfirm: {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
confirmButtonType: 'danger',
|
||||
title: '确定删除吗?'
|
||||
},
|
||||
click: row => {
|
||||
delTerminal([row.id]).then(() => {
|
||||
ElMessage.success('删除成功')
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '下载原始数据报告',
|
||||
@@ -101,7 +181,9 @@ const tableStore = new TableStore({
|
||||
disabled: row => {
|
||||
return row.originalReport == null
|
||||
},
|
||||
click: row => {}
|
||||
click: row => {
|
||||
download(row, 0)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
@@ -112,26 +194,114 @@ const tableStore = new TableStore({
|
||||
disabled: row => {
|
||||
return row.inspectionReport == null
|
||||
},
|
||||
click: row => {}
|
||||
click: row => {
|
||||
download(row, 1)
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
loadCallback: () => {
|
||||
tableStore.table.data = [
|
||||
{
|
||||
status: 2
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
tableStore.table.params.searchState = ''
|
||||
tableStore.table.params.searchValue = ''
|
||||
tableStore.table.params.type = ''
|
||||
tableStore.table.params.name = ''
|
||||
tableStore.table.params.id = dictData.state.area[0].id
|
||||
tableStore.table.params.testResults = ''
|
||||
tableStore.table.params.manufacture = []
|
||||
tableStore.table.params.type = 1
|
||||
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
// 关闭弹窗查询
|
||||
const onsubmit = () => {}
|
||||
// 下载模版
|
||||
const Export = () => {
|
||||
DownloadExport().then(res => {
|
||||
let blob = new Blob([res], {
|
||||
type: 'application/vnd.ms-excel'
|
||||
})
|
||||
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a') // 创建a标签
|
||||
link.href = url
|
||||
link.download = '终端入网检测录入模板' // 设置下载的文件名
|
||||
document.body.appendChild(link)
|
||||
link.click() //执行下载
|
||||
})
|
||||
}
|
||||
// 下载报告
|
||||
const download = (row: any, type: number) => {
|
||||
reportDownload({
|
||||
id: row.id,
|
||||
type: type
|
||||
}).then(res => {
|
||||
let blob = new Blob([res], {
|
||||
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=UTF-8'
|
||||
})
|
||||
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a') // 创建a标签
|
||||
link.href = url
|
||||
link.download = type == 1 ? row.inspectionName : row.originalName // 设置下载的文件名
|
||||
document.body.appendChild(link)
|
||||
link.click() //执行下载
|
||||
})
|
||||
}
|
||||
// excel导入
|
||||
const choose = (e: any) => {
|
||||
batchTerminal(e.raw).then((res: any) => {
|
||||
if (res.type == 'application/json') {
|
||||
ElMessage.success('上传成功,无错误数据!')
|
||||
tableStore.index()
|
||||
} else {
|
||||
ElMessage.warning('上传成功,有错误数据 自动下载 请查看')
|
||||
let blob = new Blob([res], {
|
||||
type: 'application/vnd.ms-excel'
|
||||
})
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a') // 创建a标签
|
||||
link.href = url
|
||||
link.download = '模板错误信息' // 设置下载的文件名
|
||||
document.body.appendChild(link)
|
||||
link.click() //执行下载
|
||||
}
|
||||
})
|
||||
}
|
||||
// 上传原始报告
|
||||
const UploadOriginal = () => {
|
||||
showBatchUpload.value = true
|
||||
}
|
||||
// 上传
|
||||
const BatchUpload = () => {
|
||||
let form = new FormData()
|
||||
form.append('type', 1)
|
||||
fileList.value.forEach(item => {
|
||||
form.append('files', item.raw)
|
||||
})
|
||||
importReport(form)
|
||||
.then(res => {
|
||||
if (res.type == 'application/json') {
|
||||
ElMessage.success('上传成功!')
|
||||
handleClose()
|
||||
tableStore.index()
|
||||
} else {
|
||||
ElMessage.error('上传失败!')
|
||||
}
|
||||
})
|
||||
.catch(response => {
|
||||
// console.log(response);
|
||||
})
|
||||
// fileList.value
|
||||
}
|
||||
const chooseBatch = (e: any) => {
|
||||
fileList.value.push(e)
|
||||
}
|
||||
const handleRemove = (e: any) => {
|
||||
fileList.value = fileList.value.filter(item => item.uid !== e.uid)
|
||||
}
|
||||
const handleClose = () => {
|
||||
fileList.value = []
|
||||
showBatchUpload.value = false
|
||||
}
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
})
|
||||
|
||||
73
src/views/pqs/supervise/terminal/components/networkEch.vue
Normal file
73
src/views/pqs/supervise/terminal/components/networkEch.vue
Normal file
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<div>
|
||||
<TableHeader area datePicker></TableHeader>
|
||||
<div style="display: flex" v-loading="tableStore.table.loading" :style="{ height: height }">
|
||||
<MyEchart :options="options1" />
|
||||
<MyEchart :options="options2" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import MyEchart from '@/components/echarts/MyEchart.vue'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
import { ref, provide, onMounted } from 'vue'
|
||||
const options1 = ref()
|
||||
const options2 = ref()
|
||||
const tableStore = new TableStore({
|
||||
url: '/process-boot/process/pmsTerminalDetection/getStatistics',
|
||||
method: 'POST',
|
||||
column: [],
|
||||
beforeSearchFun: () => {
|
||||
tableStore.table.params.id = tableStore.table.params.deptIndex
|
||||
},
|
||||
loadCallback: () => {
|
||||
options1.value = {
|
||||
legend: {
|
||||
data: ['日检测终端数量']
|
||||
},
|
||||
xAxis: {
|
||||
data: tableStore.table.data.dateStatistics.map(item => item.statisticsDate)
|
||||
},
|
||||
yAxis: {
|
||||
name: '台'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '日检测终端数量',
|
||||
type: 'bar',
|
||||
|
||||
data: tableStore.table.data.dateStatistics.map(item => item.count)
|
||||
}
|
||||
]
|
||||
}
|
||||
options2.value = {
|
||||
legend: {
|
||||
data: ['检测终端数量']
|
||||
},
|
||||
xAxis: {
|
||||
data: tableStore.table.data.orgStatistics.map(item => item.orgName)
|
||||
},
|
||||
yAxis: {
|
||||
name: '台'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '检测终端数量',
|
||||
type: 'bar',
|
||||
|
||||
data: tableStore.table.data.orgStatistics.map(item => item.count)
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
})
|
||||
provide('tableStore', tableStore)
|
||||
|
||||
const height = mainHeight(160).height
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -46,16 +46,13 @@
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button icon="el-icon-Plus" type="primary" @click="add">新增</el-button>
|
||||
<el-button icon="el-icon-Edit" type="primary">修改</el-button>
|
||||
<el-button icon="el-icon-Delete" type="primary">删除</el-button>
|
||||
<el-button icon="el-icon-Download" type="primary">导出</el-button>
|
||||
|
||||
<el-button icon="el-icon-Download" type="primary" @click="exportEvent">导出</el-button>
|
||||
<el-button icon="el-icon-Download" type="primary" @click="Export">下载模板</el-button>
|
||||
<!-- <el-button icon="el-icon-Upload" type="primary">excel导入</el-button> -->
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
action=""
|
||||
accept=".xls"
|
||||
:limit="1"
|
||||
:on-change="choose"
|
||||
:show-file-list="false"
|
||||
:auto-upload="false"
|
||||
@@ -70,12 +67,38 @@
|
||||
</el-button>
|
||||
</template>
|
||||
</el-upload>
|
||||
<el-button icon="el-icon-Upload" type="primary">上传原始报告</el-button>
|
||||
<el-button icon="el-icon-Upload" type="primary" @click="UploadOriginal">上传原始报告</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref="tableRef" />
|
||||
<!-- 新增 -->
|
||||
<newlyIncreased ref="addRef" @onsubmit="tableStore.index()" />
|
||||
<!-- 上传原始报告 -->
|
||||
<el-dialog
|
||||
title="上传原始报告__支持批量上传"
|
||||
v-model="showBatchUpload"
|
||||
width="30%"
|
||||
:before-close="handleClose"
|
||||
>
|
||||
<el-upload
|
||||
multiple
|
||||
action=""
|
||||
:auto-upload="false"
|
||||
:limit="999"
|
||||
accept=".doc,.docx"
|
||||
:file-list="fileList"
|
||||
:on-remove="handleRemove"
|
||||
:on-change="chooseBatch"
|
||||
ref="upload"
|
||||
>
|
||||
<el-button type="primary" icon="el-icon-Upload">选择文件</el-button>
|
||||
<span :style="`color:#f58003`"> (*传入的原始数据文件格式(终端编号-原始数据报告.docx))</span>
|
||||
</el-upload>
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取 消</el-button>
|
||||
<el-button type="primary" @click="BatchUpload">上 传</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -86,7 +109,14 @@ import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import newlyIncreased from './add.vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { DownloadExport, reportDownload, batchTerminal } from '@/api/process-boot/terminal'
|
||||
import {
|
||||
DownloadExport,
|
||||
reportDownload,
|
||||
batchTerminal,
|
||||
delTerminal,
|
||||
getTerminalPage,
|
||||
importReport
|
||||
} from '@/api/process-boot/terminal'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
|
||||
const dictData = useDictData()
|
||||
@@ -102,9 +132,11 @@ const testResultsList = [
|
||||
}
|
||||
]
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const fileList: any = ref([])
|
||||
const TableHeaderRef = ref()
|
||||
const addRef = ref()
|
||||
const showBatchUpload = ref(false)
|
||||
const tableRef = ref()
|
||||
|
||||
const ruleFormRef = ref()
|
||||
const tableStore = new TableStore({
|
||||
@@ -112,7 +144,7 @@ const tableStore = new TableStore({
|
||||
publicHeight: 85,
|
||||
method: 'POST',
|
||||
column: [
|
||||
{ width: '60', type: 'checkbox' },
|
||||
// { width: '60', type: 'checkbox' },
|
||||
|
||||
{ field: 'orgName', title: '所属单位' },
|
||||
{ field: 'id', title: '终端编号' },
|
||||
@@ -126,15 +158,52 @@ const tableStore = new TableStore({
|
||||
},
|
||||
{ field: 'installPlace', title: '安装位置' },
|
||||
{ field: 'inspectionUnit', title: '送检单位' },
|
||||
{ field: 'testResults', title: '检测结果' },
|
||||
{
|
||||
field: 'testResults',
|
||||
title: '检测结果',
|
||||
formatter(row: any) {
|
||||
return row.cellValue == 0 ? '未展开' : '已展开'
|
||||
}
|
||||
},
|
||||
{ field: 'inspectionTime', title: '检测时间' },
|
||||
{ field: 'nextInspectionTime', title: '下次检测时间' },
|
||||
{
|
||||
title: '操作',
|
||||
width: '180',
|
||||
width: '250',
|
||||
render: 'buttons',
|
||||
fixed: 'right',
|
||||
buttons: [
|
||||
{
|
||||
name: 'edit',
|
||||
title: '编辑',
|
||||
type: 'primary',
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
click: row => {
|
||||
addRef.value.open({
|
||||
title: '编辑',
|
||||
row: row
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '删除',
|
||||
type: 'danger',
|
||||
icon: 'el-icon-Delete',
|
||||
render: 'confirmButton',
|
||||
popconfirm: {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
confirmButtonType: 'danger',
|
||||
title: '确定删除吗?'
|
||||
},
|
||||
click: row => {
|
||||
delTerminal([row.id]).then(() => {
|
||||
ElMessage.success('删除成功')
|
||||
tableStore.index()
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: '下载原始数据报告',
|
||||
@@ -179,8 +248,7 @@ const add = () => {
|
||||
title: '新增'
|
||||
})
|
||||
}
|
||||
// 关闭弹窗查询
|
||||
const onsubmit = () => {}
|
||||
|
||||
// 下载模版
|
||||
const Export = () => {
|
||||
DownloadExport().then(res => {
|
||||
@@ -216,9 +284,77 @@ const download = (row: any, type: number) => {
|
||||
}
|
||||
// excel导入
|
||||
const choose = (e: any) => {
|
||||
batchTerminal(e.raw).then(res => {
|
||||
console.log('🚀 ~ batchTerminal ~ res:', res)
|
||||
batchTerminal(e.raw).then((res: any) => {
|
||||
if (res.type == 'application/json') {
|
||||
ElMessage.success('上传成功,无错误数据!')
|
||||
tableStore.index()
|
||||
} else {
|
||||
ElMessage.warning('上传成功,有错误数据 自动下载 请查看')
|
||||
let blob = new Blob([res], {
|
||||
type: 'application/vnd.ms-excel'
|
||||
})
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a') // 创建a标签
|
||||
link.href = url
|
||||
link.download = '模板错误信息' // 设置下载的文件名
|
||||
document.body.appendChild(link)
|
||||
link.click() //执行下载
|
||||
}
|
||||
})
|
||||
}
|
||||
// 导出
|
||||
const exportEvent = () => {
|
||||
let form = JSON.parse(JSON.stringify(tableStore.table.params))
|
||||
form.pageNum = 1
|
||||
form.pageSize = tableStore.table.total
|
||||
getTerminalPage(form).then(res => {
|
||||
tableRef.value.getRef().exportData({
|
||||
filename: '终端入网检测', // 文件名字
|
||||
sheetName: 'Sheet1',
|
||||
type: 'xlsx', //导出文件类型 xlsx 和 csv
|
||||
useStyle: true,
|
||||
data: res.data.records, // 数据源 // 过滤那个字段导出
|
||||
columnFilterMethod: function (column: any) {
|
||||
return !(column.$columnIndex === 0)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
// 上传原始报告
|
||||
const UploadOriginal = () => {
|
||||
showBatchUpload.value = true
|
||||
}
|
||||
// 上传
|
||||
const BatchUpload = () => {
|
||||
let form = new FormData()
|
||||
form.append('type', 0)
|
||||
fileList.value.forEach(item => {
|
||||
form.append('files', item.raw)
|
||||
})
|
||||
importReport(form)
|
||||
.then(res => {
|
||||
if (res.type == 'application/json') {
|
||||
ElMessage.success('上传成功!')
|
||||
handleClose()
|
||||
tableStore.index()
|
||||
} else {
|
||||
ElMessage.error('上传失败!')
|
||||
}
|
||||
})
|
||||
.catch(response => {
|
||||
// console.log(response);
|
||||
})
|
||||
// fileList.value
|
||||
}
|
||||
const chooseBatch = (e: any) => {
|
||||
fileList.value.push(e)
|
||||
}
|
||||
const handleRemove = (e: any) => {
|
||||
fileList.value = fileList.value.filter(item => item.uid !== e.uid)
|
||||
}
|
||||
const handleClose = () => {
|
||||
fileList.value = []
|
||||
showBatchUpload.value = false
|
||||
}
|
||||
onMounted(() => {
|
||||
tableStore.index()
|
||||
|
||||
@@ -5,16 +5,21 @@
|
||||
<!-- <network v-if="activeName == '1'" /> -->
|
||||
<el-tabs v-model="network" type="border-card" style="height: 100%" tab-position="left">
|
||||
<el-tab-pane label="列表" name="1">
|
||||
<networkTab v-if="activeName == '1' && network == '1'" />
|
||||
<networkTab />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="图表" name="2">
|
||||
<networkEch />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="图表" name="2">Config</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="终端周期检测" name="2">
|
||||
<!-- <cycle v-if="activeName == '2'" /> -->
|
||||
<el-tabs v-model="cycle" type="border-card" style="height: 100%" tab-position="left">
|
||||
<el-tab-pane label="列表" name="1"><cycleTab v-if="activeName == '2' && cycle == '1'"/></el-tab-pane>
|
||||
<el-tab-pane label="图表" name="2">Config</el-tab-pane>
|
||||
<el-tab-pane label="列表" name="1">
|
||||
<cycleTab />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="图表" name="2">
|
||||
<cycleEch />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@@ -24,7 +29,9 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref, provide } from 'vue'
|
||||
import networkTab from './components/networkTab.vue'
|
||||
import networkEch from './components/networkEch.vue'
|
||||
import cycleTab from './components/cycleTab.vue'
|
||||
import cycleEch from './components/cycleEch.vue'
|
||||
import { mainHeight } from '@/utils/layout'
|
||||
defineOptions({
|
||||
name: 'Processsupervision/Terminaldetection'
|
||||
|
||||
Reference in New Issue
Block a user