2024-03-12 16:15:45 +08:00
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<div>
|
|
|
|
|
<TableHeader area ref="TableHeaderRef">
|
|
|
|
|
<template #select>
|
|
|
|
|
<el-form-item label="终端名称">
|
2024-03-18 19:43:55 +08:00
|
|
|
<el-input
|
|
|
|
|
v-model="tableStore.table.params.name"
|
|
|
|
|
clearable
|
|
|
|
|
placeholder="请输入终端名称"
|
|
|
|
|
></el-input>
|
2024-03-12 16:15:45 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="生产厂家">
|
2024-03-18 19:43:55 +08:00
|
|
|
<el-select
|
|
|
|
|
v-model="tableStore.table.params.manufacture"
|
|
|
|
|
placeholder="请选择生产厂家"
|
|
|
|
|
multiple
|
|
|
|
|
collapse-tags
|
|
|
|
|
clearable
|
|
|
|
|
class="select"
|
|
|
|
|
>
|
2024-03-12 16:15:45 +08:00
|
|
|
<el-option
|
2024-03-18 19:43:55 +08:00
|
|
|
v-for="item in manufactorList"
|
2024-03-12 16:15:45 +08:00
|
|
|
:key="item.id"
|
2024-03-18 19:43:55 +08:00
|
|
|
:label="item.name"
|
2024-03-12 16:15:45 +08:00
|
|
|
:value="item.id"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="检测结果">
|
2024-03-18 19:43:55 +08:00
|
|
|
<el-select
|
|
|
|
|
v-model="tableStore.table.params.testResults"
|
|
|
|
|
placeholder="请选择检测结果"
|
|
|
|
|
clearable
|
|
|
|
|
class="select"
|
|
|
|
|
>
|
2024-03-12 16:15:45 +08:00
|
|
|
<el-option
|
2024-03-18 19:43:55 +08:00
|
|
|
v-for="item in testResultsList"
|
2024-03-12 16:15:45 +08:00
|
|
|
:key="item.id"
|
2024-03-18 19:43:55 +08:00
|
|
|
:label="item.name"
|
2024-03-12 16:15:45 +08:00
|
|
|
:value="item.id"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</template>
|
|
|
|
|
<template #operation>
|
2024-03-15 16:31:06 +08:00
|
|
|
<el-button icon="el-icon-Plus" type="primary" @click="add">新增</el-button>
|
2024-03-12 16:15:45 +08:00
|
|
|
<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>
|
2024-03-18 19:43:55 +08:00
|
|
|
<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"
|
|
|
|
|
>
|
|
|
|
|
<template #trigger>
|
|
|
|
|
<el-button
|
|
|
|
|
icon="el-icon-Upload"
|
|
|
|
|
type="primary"
|
|
|
|
|
style="margin-left: 12px; margin-right: 12px"
|
|
|
|
|
>
|
|
|
|
|
excel导入
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-upload>
|
2024-03-12 16:15:45 +08:00
|
|
|
<el-button icon="el-icon-Upload" type="primary">上传原始报告</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</TableHeader>
|
|
|
|
|
<Table ref="tableRef" />
|
2024-03-15 16:31:06 +08:00
|
|
|
<!-- 新增 -->
|
2024-03-18 19:43:55 +08:00
|
|
|
<newlyIncreased ref="addRef" @onsubmit="tableStore.index()" />
|
2024-03-12 16:15:45 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref, onMounted, provide, nextTick } from 'vue'
|
|
|
|
|
import TableStore from '@/utils/tableStore'
|
|
|
|
|
import Table from '@/components/table/index.vue'
|
|
|
|
|
import TableHeader from '@/components/table/header/index.vue'
|
2024-03-15 16:31:06 +08:00
|
|
|
import newlyIncreased from './add.vue'
|
2024-03-12 16:15:45 +08:00
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
2024-03-18 19:43:55 +08:00
|
|
|
import { DownloadExport, reportDownload, batchTerminal } from '@/api/process-boot/terminal'
|
2024-03-12 16:15:45 +08:00
|
|
|
import { useDictData } from '@/stores/dictData'
|
|
|
|
|
|
|
|
|
|
const dictData = useDictData()
|
2024-03-18 19:43:55 +08:00
|
|
|
const manufactorList = dictData.getBasicData('Dev_Manufacturers')
|
|
|
|
|
const testResultsList = [
|
2024-03-12 16:15:45 +08:00
|
|
|
{
|
|
|
|
|
id: 0,
|
2024-03-18 19:43:55 +08:00
|
|
|
name: '未展开'
|
2024-03-12 16:15:45 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 1,
|
2024-03-18 19:43:55 +08:00
|
|
|
name: '已展开'
|
2024-03-12 16:15:45 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
const dialogVisible = ref(false)
|
|
|
|
|
const TableHeaderRef = ref()
|
2024-03-15 16:31:06 +08:00
|
|
|
const addRef = ref()
|
2024-03-12 16:15:45 +08:00
|
|
|
|
|
|
|
|
const ruleFormRef = ref()
|
|
|
|
|
const tableStore = new TableStore({
|
2024-03-18 19:43:55 +08:00
|
|
|
url: '/process-boot/process/pmsTerminalDetection/getTerminalPage',
|
2024-03-12 16:15:45 +08:00
|
|
|
publicHeight: 85,
|
|
|
|
|
method: 'POST',
|
|
|
|
|
column: [
|
|
|
|
|
{ width: '60', type: 'checkbox' },
|
2024-03-15 16:31:06 +08:00
|
|
|
|
2024-03-12 16:15:45 +08:00
|
|
|
{ field: 'orgName', title: '所属单位' },
|
|
|
|
|
{ field: 'id', title: '终端编号' },
|
|
|
|
|
{ field: 'name', title: '终端名称' },
|
2024-03-18 19:43:55 +08:00
|
|
|
{
|
|
|
|
|
field: 'manufacture',
|
|
|
|
|
title: '生产厂家',
|
|
|
|
|
formatter(row: any) {
|
|
|
|
|
return manufactorList.filter(item => item.id == row.cellValue)[0]?.name
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-03-12 16:15:45 +08:00
|
|
|
{ field: 'installPlace', title: '安装位置' },
|
|
|
|
|
{ field: 'inspectionUnit', title: '送检单位' },
|
|
|
|
|
{ field: 'testResults', title: '检测结果' },
|
|
|
|
|
{ field: 'inspectionTime', title: '检测时间' },
|
|
|
|
|
{ field: 'nextInspectionTime', title: '下次检测时间' },
|
|
|
|
|
{
|
|
|
|
|
title: '操作',
|
|
|
|
|
width: '180',
|
|
|
|
|
render: 'buttons',
|
|
|
|
|
fixed: 'right',
|
|
|
|
|
buttons: [
|
|
|
|
|
{
|
|
|
|
|
name: 'edit',
|
|
|
|
|
title: '下载原始数据报告',
|
|
|
|
|
type: 'primary',
|
|
|
|
|
icon: 'el-icon-EditPen',
|
|
|
|
|
render: 'basicButton',
|
|
|
|
|
disabled: row => {
|
|
|
|
|
return row.originalReport == null
|
|
|
|
|
},
|
2024-03-18 19:43:55 +08:00
|
|
|
click: row => {
|
|
|
|
|
download(row, 0)
|
|
|
|
|
}
|
2024-03-12 16:15:45 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'edit',
|
|
|
|
|
title: '下载检测报告',
|
|
|
|
|
type: 'primary',
|
|
|
|
|
icon: 'el-icon-EditPen',
|
|
|
|
|
render: 'basicButton',
|
|
|
|
|
disabled: row => {
|
|
|
|
|
return row.inspectionReport == null
|
|
|
|
|
},
|
2024-03-18 19:43:55 +08:00
|
|
|
click: row => {
|
|
|
|
|
download(row, 1)
|
|
|
|
|
}
|
2024-03-12 16:15:45 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
2024-03-18 19:43:55 +08:00
|
|
|
]
|
2024-03-12 16:15:45 +08:00
|
|
|
})
|
|
|
|
|
|
2024-03-18 19:43:55 +08:00
|
|
|
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 = 0
|
2024-03-12 16:15:45 +08:00
|
|
|
|
|
|
|
|
provide('tableStore', tableStore)
|
2024-03-15 16:31:06 +08:00
|
|
|
|
|
|
|
|
const add = () => {
|
|
|
|
|
addRef.value.open({
|
|
|
|
|
title: '新增'
|
|
|
|
|
})
|
|
|
|
|
}
|
2024-03-18 19:43:55 +08:00
|
|
|
// 关闭弹窗查询
|
|
|
|
|
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'
|
|
|
|
|
})
|
2024-03-15 16:31:06 +08:00
|
|
|
|
2024-03-18 19:43:55 +08:00
|
|
|
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 => {
|
|
|
|
|
console.log('🚀 ~ batchTerminal ~ res:', res)
|
|
|
|
|
})
|
|
|
|
|
}
|
2024-03-12 16:15:45 +08:00
|
|
|
onMounted(() => {
|
|
|
|
|
tableStore.index()
|
|
|
|
|
})
|
|
|
|
|
</script>
|