添加周期
This commit is contained in:
@@ -25,3 +25,12 @@ export function terminalCheckPage(data:any) {
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function userCheckUpload(data:any) {
|
||||
return request({
|
||||
url: '/device-boot/userReport/userCheckUpload',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
@@ -34,27 +34,85 @@
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
<el-button icon="el-icon-Plus" type="primary" @click="addFormModel">新增定检记录</el-button>
|
||||
<el-button icon="el-icon-Delete" type="primary" @click="deleteEven">批量删除</el-button>
|
||||
<!-- <el-button icon="el-icon-Plus" type="primary" @click="addFormModel">新增定检记录</el-button>-->
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref="tableRef" />
|
||||
|
||||
<!-- 详情弹窗 -->
|
||||
<el-dialog title="定检详情" width="1000px" v-model="dialogShow" v-if="dialogShow"></el-dialog>
|
||||
<!-- 共用dialogShow弹窗,区分详情/上传报告 -->
|
||||
<el-dialog
|
||||
:title="dialogMode === 'detail' ? '定检详情' : '上传周期检测报告'"
|
||||
:width="dialogMode === 'detail' ? '1000px' : '600px'"
|
||||
v-model="dialogShow"
|
||||
v-if="dialogShow"
|
||||
>
|
||||
<!-- 详情区域 -->
|
||||
<div v-if="dialogMode === 'detail'">
|
||||
</div>
|
||||
<!-- 上传报告表单区域 -->
|
||||
<div v-if="dialogMode === 'upload'">
|
||||
<el-form ref="uploadFormRef" :model="uploadForm" label-width="120px">
|
||||
|
||||
<el-form-item label="定检日期" prop="thisCheckTime" rules="[{ required: true, message: '请选择定检日期', trigger: 'change' }]">
|
||||
<el-date-picker
|
||||
v-model="uploadForm.thisCheckTime"
|
||||
type="date"
|
||||
placeholder="请选择定检日期"
|
||||
@change="calcNextCheckTime"
|
||||
style="width:100%"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="下次定检日期" prop="nextCheckTime">
|
||||
<el-date-picker v-model="uploadForm.nextCheckTime" type="date" style="width:100%" value-format="YYYY-MM-DD" />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
class="uploadFile"
|
||||
for="-"
|
||||
label="设备检测报告:"
|
||||
prop="checkUrl"
|
||||
>
|
||||
<el-upload
|
||||
v-model:file-list="uploadForm.checkUrl"
|
||||
ref="uploadRef"
|
||||
action=""
|
||||
:accept="acceptType"
|
||||
:limit="1"
|
||||
:on-change="(file) => choose(file, 'checkUrl')"
|
||||
:auto-upload="false"
|
||||
:on-remove="removeFile('checkUrl')"
|
||||
>
|
||||
<template #trigger>
|
||||
<el-button type="primary" >上传文件</el-button>
|
||||
</template>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<!-- footer 放到所有v-if外层,解决编译报错 -->
|
||||
<template #footer>
|
||||
<el-button v-if="dialogMode === 'upload'" @click="dialogShow = false">取消</el-button>
|
||||
<el-button v-if="dialogMode === 'upload'" type="primary" @click="submitUploadReport">提交</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, provide, reactive, watch } from 'vue'
|
||||
|
||||
import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import type { UploadFile, UploadInstance, UploadProps, UploadRawFile } from 'element-plus'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { genFileId, ElMessage } from 'element-plus'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
import { terminalCheckPage } from '@/api/device-boot/device'
|
||||
import { uploadFile } from '@/api/system-boot/file'
|
||||
import { userCheckUpload } from '@/api/device-boot/device'
|
||||
|
||||
const acceptType = '.pdf,.docx'
|
||||
defineOptions({
|
||||
name: 'terminal/terminaCkeck'
|
||||
})
|
||||
@@ -69,6 +127,129 @@ const areaOptionList = dictData.getBasicData('jibei_area')
|
||||
// 详情弹窗
|
||||
const detailId = ref('')
|
||||
const dialogShow = ref(false)
|
||||
// 弹窗模式:detail=详情 upload=上传报告
|
||||
const dialogMode = ref<'detail' | 'upload'>('detail')
|
||||
const submitLoading = ref()
|
||||
|
||||
// ========== 上传报告表单补充变量 ==========
|
||||
const uploadFormRef = ref()
|
||||
const fileList = ref<any[]>([])
|
||||
const uploadForm = reactive({
|
||||
thisCheckTime: '',
|
||||
nextCheckTime: '',
|
||||
checkUrl: [],
|
||||
devId:'',
|
||||
objId:''
|
||||
})
|
||||
// 电能质量检测报告
|
||||
const checkUrlFile = ref('')
|
||||
|
||||
|
||||
// 选择定检日期,自动往后推3年
|
||||
const calcNextCheckTime = (dateVal: string) => {
|
||||
if (!dateVal) {
|
||||
uploadForm.nextCheckTime = ''
|
||||
return
|
||||
}
|
||||
const date = new Date(dateVal)
|
||||
date.setFullYear(date.getFullYear() + 3)
|
||||
// 格式化为 YYYY-MM-DD 字符串
|
||||
const y = date.getFullYear()
|
||||
const m = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const d = String(date.getDate()).padStart(2, '0')
|
||||
uploadForm.nextCheckTime = `${y}-${m}-${d}`
|
||||
}
|
||||
|
||||
|
||||
// 表单校验
|
||||
const uploadRules = reactive({
|
||||
thisCheckTime: [{ required: true, message: '请选择定检日期', trigger: 'change' }],
|
||||
checkUrl: [{ required: true, message: '请上传设备检测报告', trigger: 'change' }]
|
||||
})
|
||||
|
||||
const resetForm = () => {
|
||||
uploadForm.thisCheckTime = ''
|
||||
uploadForm.nextCheckTime = ''
|
||||
uploadForm.checkUrl = []
|
||||
}
|
||||
|
||||
|
||||
const submitUploadReport = async () => {
|
||||
await uploadFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (!valid) return
|
||||
if (!uploadForm.checkUrl) return ElMessage.warning('请先上传检测报告文件')
|
||||
submitLoading.value = true
|
||||
try {
|
||||
const params = {
|
||||
devId: uploadForm.devId,
|
||||
objId: uploadForm.objId,
|
||||
thisCheckTime: uploadForm.thisCheckTime,
|
||||
nextCheckTime: uploadForm.nextCheckTime,
|
||||
checkUrl: checkUrlFile.value
|
||||
}
|
||||
const res = await userCheckUpload(params)
|
||||
if (res.code === 'A0000') {
|
||||
ElMessage.success('提交成功')
|
||||
dialogShow.value = false
|
||||
// 刷新表格
|
||||
tableStore.index()
|
||||
}
|
||||
} catch (err: any) {
|
||||
ElMessage.error(err.msg || '提交失败')
|
||||
} finally {
|
||||
submitLoading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 打开上传弹窗,重置表单
|
||||
const openUploadDialog = (row: any) => {
|
||||
uploadForm.thisCheckTime = ''
|
||||
uploadForm.nextCheckTime = ''
|
||||
uploadForm.checkUrl = []
|
||||
uploadForm.devId = row.devId
|
||||
uploadForm.objId = row.objId
|
||||
fileList.value = []
|
||||
uploadFormRef.value?.clearValidate()
|
||||
dialogMode.value = 'upload'
|
||||
dialogShow.value = true
|
||||
}
|
||||
|
||||
|
||||
// 处理上传文件回显
|
||||
const fileRaw = (row: any, key: string) => {
|
||||
const fileFields = ['checkUrl', 'assessUrl']
|
||||
for (const field of fileFields) {
|
||||
const filePath = row[key]?.[field] ?? row[field]
|
||||
if (filePath != null && filePath.length > 0) {
|
||||
uploadForm[field] = [{ name: filePath.split('/')[2] }]
|
||||
} else {
|
||||
uploadForm[field] = []
|
||||
}
|
||||
}
|
||||
uploadFormRef.value = row[key]?.checkUrl ?? row.checkUrl ?? ''
|
||||
}
|
||||
|
||||
|
||||
//移除文件上传
|
||||
const removeFile = (val: string) => {
|
||||
return (_file: UploadFile, fileList: UploadFile[]) => {
|
||||
if (val === 'checkUrl') {
|
||||
checkUrlFile.value = ''
|
||||
}
|
||||
uploadForm[val] = fileList
|
||||
}
|
||||
}
|
||||
const choose = (e: any, field: string) => {
|
||||
uploadFile(e.raw, '/supervision/').then(res => {
|
||||
if (field === 'checkUrl') {
|
||||
checkUrlFile.value = res.data.name
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
|
||||
// TableStore 表格配置(仅修改字段映射,其余不动)
|
||||
const tableStore = new TableStore({
|
||||
@@ -136,7 +317,7 @@ const tableStore = new TableStore({
|
||||
return h('span', { style: { color, fontWeight: 'bold' } }, text)
|
||||
}
|
||||
},
|
||||
{ field: 'nextCheckTime', title: '周期检测报告', minWidth: 120 },
|
||||
{ field: 'checkUrl', title: '周期检测报告', minWidth: 120 },
|
||||
|
||||
// 操作列固定右侧
|
||||
{
|
||||
@@ -161,7 +342,9 @@ const tableStore = new TableStore({
|
||||
type: 'primary',
|
||||
icon: 'el-icon-Open',
|
||||
render: 'basicButton',
|
||||
click: row => {}
|
||||
click: row => {
|
||||
openUploadDialog(row)
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -184,30 +367,7 @@ const openDetail = (id: string) => {
|
||||
dialogShow.value = true
|
||||
}
|
||||
|
||||
// 新增按钮
|
||||
const addFormModel = () => {}
|
||||
|
||||
// 批量删除
|
||||
const deleteEven = () => {
|
||||
if (tableStore.table.selection.length == 0) {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '请选择要删除的定检数据'
|
||||
})
|
||||
return
|
||||
}
|
||||
ElMessageBox.confirm('此操作将永久删除选中记录, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
// 批量传devId数组
|
||||
deletePqCheck(tableStore.table.selection.map(item => item.devId)).then(() => {
|
||||
ElMessage.success('删除成功')
|
||||
tableStore.index()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 路由跳转带ID回显编辑(复用你原有路由传参逻辑)
|
||||
const props = defineProps({
|
||||
|
||||
@@ -212,7 +212,7 @@
|
||||
<el-form-item for="-" v-if="form.userType != '0' && form.userType != '1'" label="PCC点:">
|
||||
<el-input v-model.trim="form.pccPoint" autocomplete="off" placeholder="请输入PCC点" />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
<!-- <el-form-item
|
||||
for="-"
|
||||
v-if="form.userType == '2' || form.userType == '3' || form.userType == '4' || form.userType == '5'"
|
||||
label="基准短路容量:"
|
||||
@@ -273,7 +273,7 @@
|
||||
>
|
||||
<template #append>MVA</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form-item>-->
|
||||
<el-form-item for="-" v-if="form.userType == '6'" label="行业:">
|
||||
<el-select v-model="form.industry" placeholder="请选择行业">
|
||||
<el-option v-for="(item, index) in industryList" :label="item.name" :value="item.id" :key="index" />
|
||||
@@ -371,18 +371,18 @@
|
||||
<el-form-item
|
||||
class="uploadFile"
|
||||
for="-"
|
||||
label="电能质量检测报告:"
|
||||
prop="detection"
|
||||
label="设备检测报告:"
|
||||
prop="checkUrl"
|
||||
>
|
||||
<el-upload
|
||||
v-model:file-list="form.detection"
|
||||
v-model:file-list="form.checkUrl"
|
||||
ref="uploadRef"
|
||||
action=""
|
||||
:accept="acceptType"
|
||||
:limit="1"
|
||||
:on-change="(file) => choose(file, 'detection')"
|
||||
:on-change="(file) => choose(file, 'checkUrl')"
|
||||
:auto-upload="false"
|
||||
:on-remove="removeFile('detection')"
|
||||
:on-remove="removeFile('checkUrl')"
|
||||
>
|
||||
<template #trigger>
|
||||
<el-button type="primary" >上传文件</el-button>
|
||||
@@ -396,14 +396,14 @@
|
||||
prop="evaluation"
|
||||
>
|
||||
<el-upload
|
||||
v-model:file-list="form.evaluation"
|
||||
v-model:file-list="form.assessUrl"
|
||||
ref="uploadRef"
|
||||
action=""
|
||||
:accept="acceptType"
|
||||
:limit="1"
|
||||
:on-change="(file) => choose(file, 'evaluation')"
|
||||
:on-change="(file) => choose(file, 'assessUrl')"
|
||||
:auto-upload="false"
|
||||
:on-remove="removeFile('evaluation')"
|
||||
:on-remove="removeFile('assessUrl')"
|
||||
>
|
||||
<template #trigger>
|
||||
<el-button type="primary">上传文件</el-button>
|
||||
@@ -576,7 +576,7 @@ const nonlinearDeviceTypeList: any = ref('')
|
||||
//获取登陆用户姓名和部门
|
||||
const adminInfo = useAdminInfo()
|
||||
// 电能质量检测报告
|
||||
const detectionFile = ref('')
|
||||
const checkUrlFile = ref('')
|
||||
// 电能质量评估报告
|
||||
const evaluationFile = ref('')
|
||||
const resetForm = () => {
|
||||
@@ -605,8 +605,8 @@ const resetForm = () => {
|
||||
pccPoint: '', //PCC点 1
|
||||
evaluationType: evaluationTypeList[0].id, //评估类型 1
|
||||
evaluationChekDept: '', //预测评估审单位 1
|
||||
detection: [], //电能质量检测报告
|
||||
evaluation: [], //电能质量评估报告
|
||||
checkUrl: [], //电能质量检测报告
|
||||
assessUrl: [], //电能质量评估报告
|
||||
minShortCircuitCapacity: '', //系统最小短路容量(MVA) 1
|
||||
userAgreementCapacity: '', //用户用电协议容量(MVA) 1
|
||||
needGovernance: 0, //是否需要治理 1
|
||||
@@ -630,7 +630,7 @@ const resetForm = () => {
|
||||
delete form.value.loadLevel
|
||||
delete form.value.powerSupplyInfo
|
||||
}
|
||||
detectionFile.value = ''
|
||||
checkUrlFile.value = ''
|
||||
evaluationFile.value = ''
|
||||
}
|
||||
//初始化数据
|
||||
@@ -951,9 +951,9 @@ const open = async (row: any) => {
|
||||
} else {
|
||||
resendId.value = ''
|
||||
form.value.userType = userTypeList.value[0].value
|
||||
detectionFile.value = ''
|
||||
checkUrlFile.value = ''
|
||||
evaluationFile.value = ''
|
||||
form.value.detection = []
|
||||
form.value.checkUrl = []
|
||||
form.value.evaluation = []
|
||||
}
|
||||
await getSubstationSelect().then(res => {
|
||||
@@ -989,7 +989,7 @@ async function handleResponse(data: any) {
|
||||
|
||||
// 处理上传文件回显
|
||||
const fileRaw = (row: any, key: string) => {
|
||||
const fileFields = ['detection', 'evaluation']
|
||||
const fileFields = ['checkUrl', 'assessUrl']
|
||||
for (const field of fileFields) {
|
||||
const filePath = row[key]?.[field] ?? row[field]
|
||||
if (filePath != null && filePath.length > 0) {
|
||||
@@ -998,8 +998,8 @@ const fileRaw = (row: any, key: string) => {
|
||||
form.value[field] = []
|
||||
}
|
||||
}
|
||||
detectionFile.value = row[key]?.detection ?? row.detection ?? ''
|
||||
evaluationFile.value = row[key]?.evaluation ?? row.evaluation ?? ''
|
||||
checkUrlFile.value = row[key]?.checkUrl ?? row.checkUrl ?? ''
|
||||
evaluationFile.value = row[key]?.assessUrl ?? row.assessUrl ?? ''
|
||||
}
|
||||
|
||||
const close = () => {
|
||||
@@ -1023,9 +1023,9 @@ const handleExceed: UploadProps['onExceed'] = files => {
|
||||
//移除文件上传
|
||||
const removeFile = (val: string) => {
|
||||
return (_file: UploadFile, fileList: UploadFile[]) => {
|
||||
if (val === 'detection') {
|
||||
detectionFile.value = ''
|
||||
} else if (val === 'evaluation') {
|
||||
if (val === 'checkUrl') {
|
||||
checkUrlFile.value = ''
|
||||
} else if (val === 'assessUrl') {
|
||||
evaluationFile.value = ''
|
||||
}
|
||||
form.value[val] = fileList
|
||||
@@ -1033,9 +1033,9 @@ const removeFile = (val: string) => {
|
||||
}
|
||||
const choose = (e: any, field: string) => {
|
||||
uploadFile(e.raw, '/supervision/').then(res => {
|
||||
if (field === 'detection') {
|
||||
detectionFile.value = res.data.name
|
||||
} else if (field === 'evaluation') {
|
||||
if (field === 'checkUrl') {
|
||||
checkUrlFile.value = res.data.name
|
||||
} else if (field === 'assessUrl') {
|
||||
evaluationFile.value = res.data.name
|
||||
}
|
||||
})
|
||||
@@ -1065,16 +1065,16 @@ const confirmForm = async (flag: boolean) => {
|
||||
subForm.value.reporter = adminInfo.$state.id
|
||||
subForm.value.orgId = adminInfo.$state.deptId
|
||||
let confirmFormData = JSON.parse(JSON.stringify(subForm.value))
|
||||
confirmFormData.detection = detectionFile.value
|
||||
confirmFormData.evaluation = evaluationFile.value
|
||||
confirmFormData.checkUrl = checkUrlFile.value
|
||||
confirmFormData.assessUrl = evaluationFile.value
|
||||
//1.判断是否上传
|
||||
if (subForm.value.userType == '0' || subForm.value.userType == '1') {
|
||||
{
|
||||
//其他报告非必填
|
||||
confirmFormData.userReportProjectPO = {
|
||||
...confirmFormData.userReportProjectPO,
|
||||
detection: detectionFile.value,
|
||||
evaluation: evaluationFile.value
|
||||
checkUrl: checkUrlFile.value,
|
||||
assessUrl: evaluationFile.value
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1088,8 +1088,8 @@ const confirmForm = async (flag: boolean) => {
|
||||
{
|
||||
confirmFormData.userReportSubstationPO = {
|
||||
...confirmFormData.userReportSubstationPO,
|
||||
detection: detectionFile.value,
|
||||
evaluation: evaluationFile.value
|
||||
checkUrl: checkUrlFile.value,
|
||||
assessUrl: evaluationFile.value
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1099,8 +1099,8 @@ const confirmForm = async (flag: boolean) => {
|
||||
confirmFormData.userReportSensitivePO = {
|
||||
...confirmFormData.userReportSensitivePO,
|
||||
energyQualityIndex: confirmFormData.userReportSensitivePO.energyQualityIndex.join(', '),
|
||||
detection: detectionFile.value,
|
||||
evaluation: evaluationFile.value
|
||||
checkUrl: checkUrlFile.value,
|
||||
assessUrl: evaluationFile.value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,11 +90,11 @@ const tableStore = new TableStore({
|
||||
},
|
||||
{ field: 'city', title: '所在地市', minWidth: 80 },
|
||||
/* { field: 'substation', title: '厂站名称', minWidth: 100 },*/
|
||||
{ field: 'projectName', title: '项目名称', minWidth: 170 },
|
||||
{ field: 'projectName', title: '项目名称', minWidth: 150 },
|
||||
{
|
||||
field: 'userType',
|
||||
title: '用户性质',
|
||||
minWidth: 150,
|
||||
minWidth: 120,
|
||||
formatter: (obj: any) => {
|
||||
const userType = obj.row.userType
|
||||
return getUserTypeName(userType)
|
||||
@@ -102,10 +102,11 @@ const tableStore = new TableStore({
|
||||
},
|
||||
|
||||
// { field: 'responsibleDepartment', title: '归口管理部门', minWidth: 130 },
|
||||
{ field: 'ratePower', title: '装机容量(MW)', minWidth: 130 },
|
||||
{ field: 'stationId', title: '所属电站', minWidth: 130 },
|
||||
{ field: 'stationId', title: '电能质量检测报告', minWidth: 130 },
|
||||
{ field: 'stationId', title: '电能质量评估报告', minWidth: 130 },
|
||||
{ field: 'ratePower', title: '装机容量(MW)', minWidth: 80 },
|
||||
{ field: 'stationId', title: '所属电站', minWidth: 100 },
|
||||
{ field: 'checkUrl', title: '电能质量设备检测报告', minWidth: 170 },
|
||||
{ field: 'assessUrl', title: '电能质量评估报告', minWidth: 170 },
|
||||
|
||||
/* {
|
||||
field: 'createBy',
|
||||
title: '创建人',
|
||||
|
||||
Reference in New Issue
Block a user