From 94f7054d43df7fcd65dc1b88a626b3b43567dbd9 Mon Sep 17 00:00:00 2001 From: jiminglei <836545853@qq.com> Date: Thu, 22 Feb 2024 19:21:31 +0800 Subject: [PATCH] key --- psdc-ui/src/main.js | 2 + psdc-ui/src/views/bigview/index.vue | 4 +- psdc-ui/src/views/system/model/index.vue | 209 +++++++++++++---------- 3 files changed, 127 insertions(+), 88 deletions(-) diff --git a/psdc-ui/src/main.js b/psdc-ui/src/main.js index 0de6b5e..a393ce0 100644 --- a/psdc-ui/src/main.js +++ b/psdc-ui/src/main.js @@ -11,6 +11,7 @@ import App from './App' import store from './store' import router from './router' import directive from './directive' // directive +import JsonViewer from 'vue-json-viewer' // 注册指令 import plugins from './plugins' // plugins @@ -65,6 +66,7 @@ app.component('ImagePreview', ImagePreview) app.component('RightToolbar', RightToolbar) app.use(router) +app.use(JsonViewer) app.use(store) app.use(plugins) app.use(elementIcons) diff --git a/psdc-ui/src/views/bigview/index.vue b/psdc-ui/src/views/bigview/index.vue index 37fa405..25da69b 100644 --- a/psdc-ui/src/views/bigview/index.vue +++ b/psdc-ui/src/views/bigview/index.vue @@ -15,8 +15,8 @@
cpuid:
- - + +
diff --git a/psdc-ui/src/views/system/model/index.vue b/psdc-ui/src/views/system/model/index.vue index 23903eb..a1d1e8c 100644 --- a/psdc-ui/src/views/system/model/index.vue +++ b/psdc-ui/src/views/system/model/index.vue @@ -1,6 +1,21 @@ @@ -323,11 +340,12 @@ import {ElMessage, ElMessageBox} from 'element-plus' import {ref, reactive, watch, onMounted} from "vue"; import {modelTest,getDevList} from '../../../api/emonitor/api' +const textarea = ref('') const open = ref(true) const arr = ref([1]) const point = ref(3.7) const point1 = ref('78') -const show1 = ref(false) +const show1 = ref(true) const test1 = ref(null) const test2= ref(null) const test3 = ref(null) @@ -474,10 +492,10 @@ const rules = reactive({ { required: true, message: '请选择技术类型', trigger: 'change' }, ], devPower: [ - { required: true, message: '请输入设备功率', trigger: 'blur' }, + { required: true, message: '请输入效率占比', trigger: 'blur' }, ], devPrice: [ - { required: true, message: '请输入设备单价', trigger: 'blur' }, + { required: true, message: '请输入成本占比', trigger: 'blur' }, ], devSubstituteLaborCost: [ { required: true, message: '请输入电替代设备年人工费用', trigger: 'blur' }, @@ -527,13 +545,13 @@ const rules = reactive({ }) const addForm = reactive({ id: null, - key:null, + key:"0lE4R+SpaJ/eoTXTZWDmSxYF22DKuKHLrIQKLwSQgRaiMSwBEJTC89V1mly7DR3FgpyutYamHKEa11/7GWHRPfE/X4Md4+7oUx7snfSAi58qNb86KAllSUsAM78+JHLM", devType: null,//电锅炉or热泵 devSubType: null, devTechType: null, heatEfficiency: null, - devPower: null, - devPrice: null, + devPower: 0.8, + devPrice: 0.2, devSubstituteLaborCost: null, laborCost: null, devReferenceArea: null, @@ -564,6 +582,8 @@ const result = ref({ startCost:'', yearCost:'', yearRunCost:'', + safety:'', + deviceList:'', }) watch(() => addForm.devType, (newVale, oldValue) => { if (addForm.devType === 1) { @@ -630,54 +650,73 @@ const submitForm = () => { } }); setTimeout(()=>{ - if (role1.value&&role2.value&&role3.value){ - console.log('表单验证通过') - modelTest( - { - "param": { - "electricityPrice": "20.26", - "hotDevicePower": "20.26", - "buildInfo": { - "lastYearFee":addForm.lastYearFee, - "heatingArea":addForm.heatingArea, - "days":addForm.days - }, - "hotMedium": "1", - "type":"0101", - "yearEnergy": "20.26", - "distInfo": { - "lastYearNeed": addForm.lastYearNeed, - "runCapacity": addForm.runCapacity + addForm.devPower= +addForm.devPower + addForm.devPrice= +addForm.devPrice + console.log(addForm.devPower,addForm.devPrice,addForm.devPower+addForm.devPrice) + if(addForm.devPower+addForm.devPrice==1){ + if (role1.value&&role2.value&&role3.value){ + console.log('表单验证通过') + modelTest( + { + "param": { + "electricityPrice": "20.26", + "hotDevicePower": "20.26", + "buildInfo": { + "lastYearFee":addForm.lastYearFee, + "heatingArea":addForm.heatingArea, + "days":addForm.days + }, + "type": "0101", + "costRatio":addForm.devPrice, + "effRatio":addForm.devPower, + "distInfo": { + "lastYearNeed": addForm.lastYearNeed, + "runCapacity": addForm.runCapacity + }, + "exportTemperature": 28 }, - "exportTemperature": 28 - }, - "key": addForm.key - } - ).then((res)=>{ - console.log(res) - if(res.report==null){ - ElMessage({ - message: '产品库至少需要两种不同类型的设备!', - type: 'error', - }) - }else{ - for(let i in res.report.matchedDeviceList) - { - res.report.matchedDeviceList[i].rat = res.report.matchedDeviceList[i].rating/20 + "key": addForm.key + } + ).then((res)=>{ + console.log(res) + if(res.report.message){ + ElMessage({ + message: res.report.message, + type: 'error', + }) + }else{ + if(res.report===null || res.report==={}){ + ElMessage({ + message: '计算失败,请检查密钥是否准确', + type: 'error', + }) + }else{ + for(let i in res.report.matchedDeviceList) + { + res.report.matchedDeviceList[i].rat = res.report.matchedDeviceList[i].rating/20 + } + let num = res.report.matchedDeviceList.reduce((prev, curr) => { + return curr.rat > prev.rat ? curr : prev; + }); + res.report.planName = num.planName + res.report.environment = "本次改造方案减排"+res.report.calculate+"吨" + result.value=res.report + textarea.value=res.report + show1.value = true + } } - let num = res.report.matchedDeviceList.reduce((prev, curr) => { - return curr.rat > prev.rat ? curr : prev; - }); - res.report.planName = num.planName - res.report.environment = "本次改造方案减排"+res.report.calculate+"吨" - result.value=res.report - show1.value = true - } - }) + }) + + }else{ + console.log('表表单验证失败') + } }else{ - console.log('表表单验证失败') + ElMessage({ + message: '效率占比和成本占比相加必须为1', + type: 'error', + }) } },1000) }; @@ -692,9 +731,9 @@ function cancel() { addForm.devTechType = null addForm.devSubstituteLaborCost = null addForm.devReferenceArea = null - addForm.devPower = null + addForm.devPower = 0.8 addForm.devSubType = null - addForm.devPrice = null + addForm.devPrice = 0.2 addForm.devServiceLife = null addForm.laborCost = null addForm.lastYearFee = null @@ -761,8 +800,6 @@ function cancel() { } .info { - height: 400px; - .card { margin-top: 20px; }