联调 过程监督
This commit is contained in:
@@ -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,10 +284,78 @@ 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()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user