diff --git a/src/views/pqs/supervise/terminalNetworkDetection/components/terminainal/addForm.vue b/src/views/pqs/supervise/terminalNetworkDetection/components/terminainal/addForm.vue index a8cc7e05..ebf27092 100644 --- a/src/views/pqs/supervise/terminalNetworkDetection/components/terminainal/addForm.vue +++ b/src/views/pqs/supervise/terminalNetworkDetection/components/terminainal/addForm.vue @@ -158,9 +158,10 @@ clearable style="width: 100%" placeholder="请选择所属供电公司" + @change="findSubstationVoltageLevel" > - + * - + * - + * { + getAreaList().then(res => { + powerCompanyList.value = res.data[0].children[0].children + form.value.powerCompany = powerCompanyList.value[0]?.id + }) +} +getPowerCompanyList() +//根据所选供电公司查询所选获取变电站与变电站电压等级 +const substationList = ref([]) +const findSubstationVoltageLevel = () => { + getSubstationVoltageLevel({ orgIds: [form.value.powerCompany] }).then(res => { + substationList.value = res.data + form.value.substation = substationList.value[0]?.id + form.value.substationVoltageLevel = substationList.value[0]?.voltageLevel + }) +} +//变电站选择的时候切换变电站电压等级 +const changeSubstation = () => { + let obj = substationList.value.find(item => item.id == form.value.substation) + form.value.substationVoltageLevel = obj?.voltageLevel +} +findSubstationVoltageLevel() +changeSubstation() const resetForm = () => { form.value = { reporter: '', //填报人 @@ -965,7 +992,7 @@ const resetForm = () => { monitoringTerminalName: '', //监测终端名称 neutralPointWiringMethod: neutralPointWiringMethodList[0].id, // 中性点接线方式 nextTerminalInspectionTime: '', // 下次终端定检时间 - powerCompany: areaOptionList[0].id, //所属供电公司 + powerCompany: powerCompanyList[0]?.value.id, //所属供电公司 simCardNumber: '', //SIM卡号 substation: '', // 所属变电站 substationVoltageLevel: voltageLevelList[0].id, // 变电站电压等级 @@ -1028,7 +1055,7 @@ const devReportForm = ref({ monitoringTerminalName: '', //监测终端名称 neutralPointWiringMethod: neutralPointWiringMethodList[0].id, // 中性点接线方式 nextTerminalInspectionTime: '', // 下次终端定检时间 - powerCompany: areaOptionList[0].id, //所属供电公司 + powerCompany: powerCompanyList.value[0]?.id, //所属供电公司 simCardNumber: '', //SIM卡号 substation: '', // 所属变电站 substationVoltageLevel: voltageLevelList[0].id, // 变电站电压等级 @@ -1321,7 +1348,7 @@ watch( (val, oldVal) => { //form数据变化时处理格式,根据tab切换判断处理的对象实体 //终端信息 - if (selectFormType.value == '0' && val) { + if (val) { for (let key in val) { if (devReportForm.value.hasOwnProperty(key)) { devReportForm.value[key] = val[key] // 对相同的key进行赋值 @@ -1331,7 +1358,6 @@ watch( } //处理填报日期时间格式 devReportForm.value.reportDate = window.XEUtils.toDateString(form.value.reportDate, 'yyyy-MM-dd') - // console.log('处理好的表单++++++++++>',devReportForm.value) } //监测点信息 else { @@ -1357,13 +1383,6 @@ onMounted(() => { console.log() }) -//获取变电站与电压等级 -const findSubstationVoltageLevel = () => { - getSubstationVoltageLevel({ orgIds: [adminInfo.$state.deptId] }).then(res => { - console.log(res, '获取变电站电压等级') - }) -} -findSubstationVoltageLevel() // 上传报告 const uploadRef = ref() const handleExceed: UploadProps['onExceed'] = files => { @@ -1443,99 +1462,81 @@ const disabledDate = time => { const activeName = ref('0') //提交 const confirmForm = () => { - console.log(form.value, '打印form对象') - // 先判断提交终端信息与监测点信息 - // 提交终端信息 - if (selectFormType.value == '0') { - ruleFormRef.value.validate(valid => { - if (valid) { - //整理上传文件的数据 - // userType==0,1 - devReportForm.value.reporter = adminInfo.$state.id - devReportForm.value.orgId = adminInfo.$state.deptId - let confirmFormData = JSON.parse(JSON.stringify(devReportForm.value)) + ruleFormRef.value.validate(valid => { + if (valid) { + //整理上传文件的数据 + devReportForm.value.reporter = adminInfo.$state.id + devReportForm.value.orgId = adminInfo.$state.deptId + let confirmFormData = JSON.parse(JSON.stringify(devReportForm.value)) - //1.判断是否上传 - // if (!deviceFilePath.value) { - // activeName.value = '1' - // return ElMessage({ - // message: '请上传终端台账信息', - // type: 'warning' - // }) - // } - // if (!lineFilePath.value) { - // activeName.value = '2' - // return ElMessage({ - // message: '请上传监测点台账信息', - // type: 'warning' - // }) - // } - if (!acceptanceInspectionReportSingle.value) { - return ElMessage({ - message: '请上传验收检验报告单', - type: 'warning' - }) - } - if (!acceptanceInspectionReport.value) { - return ElMessage({ - message: '请上传验收检验报告', - type: 'warning' - }) - } - if (!typeExperimentReport.value) { - return ElMessage({ - message: '请上传型式实验报告', - type: 'warning' - }) - } - if (!factoryInspectionReport.value) { - return ElMessage({ - message: '请上传出厂检验报告', - type: 'warning' - }) - } - if (!performanceTestReport.value) { - return ElMessage({ - message: '请上传性能检测报告', - type: 'warning' - }) - } - if (!informationSecurityTestReport.value) { - return ElMessage({ - message: '请上传信息安全检测报告', - type: 'warning' - }) - } - //提交终端信息 - confirmFormData = { - ...confirmFormData, - acceptanceInspectionReport: acceptanceInspectionReport.value, //验收检验报告 - acceptanceInspectionReportSingle: acceptanceInspectionReportSingle.value, //验收检验报告单 - deviceFilePath: deviceFilePath?.value, //终端台账信息 - factoryInspectionReport: factoryInspectionReport.value, //出厂检验报告 - informationSecurityTestReport: informationSecurityTestReport.value, //信息安全检测报告 - lineFilePath: lineFilePath?.value, //监测点台账信息 - performanceTestReport: performanceTestReport.value, //性能检测报告 - typeExperimentReport: typeExperimentReport.value, //型式实验报告 - otherAttachments: otherAttachments?.value //其他附件 - } - console.log(confirmFormData, '打印提交表单111111111111') - addTerminalFormData(confirmFormData).then(res => { - console.log(res, '打印提交结果222222222222+++++++++') - ruleFormRef.value.resetFields() - resetForm() - close() + //1.判断是否上传 + // if (!deviceFilePath.value) { + // activeName.value = '1' + // return ElMessage({ + // message: '请上传终端台账信息', + // type: 'warning' + // }) + // } + if (!acceptanceInspectionReportSingle.value) { + return ElMessage({ + message: '请上传验收检验报告单', + type: 'warning' }) - } else { - console.log('表单验证失败') - return false } - }) - } - //提交监测点信息 - else { - } + if (!acceptanceInspectionReport.value) { + return ElMessage({ + message: '请上传验收检验报告', + type: 'warning' + }) + } + if (!typeExperimentReport.value) { + return ElMessage({ + message: '请上传型式实验报告', + type: 'warning' + }) + } + if (!factoryInspectionReport.value) { + return ElMessage({ + message: '请上传出厂检验报告', + type: 'warning' + }) + } + if (!performanceTestReport.value) { + return ElMessage({ + message: '请上传性能检测报告', + type: 'warning' + }) + } + if (!informationSecurityTestReport.value) { + return ElMessage({ + message: '请上传信息安全检测报告', + type: 'warning' + }) + } + //提交终端信息 + confirmFormData = { + ...confirmFormData, + acceptanceInspectionReport: acceptanceInspectionReport.value, //验收检验报告 + acceptanceInspectionReportSingle: acceptanceInspectionReportSingle.value, //验收检验报告单 + deviceFilePath: deviceFilePath?.value, //终端台账信息 + factoryInspectionReport: factoryInspectionReport.value, //出厂检验报告 + informationSecurityTestReport: informationSecurityTestReport.value, //信息安全检测报告 + lineFilePath: lineFilePath?.value, //监测点台账信息 + performanceTestReport: performanceTestReport.value, //性能检测报告 + typeExperimentReport: typeExperimentReport.value, //型式实验报告 + otherAttachments: otherAttachments?.value //其他附件 + } + addTerminalFormData(confirmFormData).then(res => { + ruleFormRef.value.resetFields() + resetForm() + close() + }) + } else { + console.log('表单验证失败') + return false + } + }) } defineExpose({ open }) @@ -1591,14 +1592,14 @@ defineExpose({ open }) margin-top: 8px; color: #f56c6c; margin-left: 20px; - margin-right:10px; + margin-right: 10px; } - .required_icon_white{ + .required_icon_white { color: #fff; position: absolute; left: -10px; - padding-left:10px; - margin:8px 10px 0 10px; + padding-left: 10px; + margin: 8px 10px 0 10px; } .required_text { // padding-left: 20px; diff --git a/src/views/pqs/supervise/terminalNetworkDetection/components/terminainal/index.vue b/src/views/pqs/supervise/terminalNetworkDetection/components/terminainal/index.vue index 015a7ea9..56e1d558 100644 --- a/src/views/pqs/supervise/terminalNetworkDetection/components/terminainal/index.vue +++ b/src/views/pqs/supervise/terminalNetworkDetection/components/terminainal/index.vue @@ -1,6 +1,6 @@