From be8a167fd0d26bd3f79c80f355dda71b82339685 Mon Sep 17 00:00:00 2001 From: jiangyinzhi <4617248933@YFZMY.COM> Date: Tue, 3 Sep 2024 15:28:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.production | 2 +- src/api/config.js | 4 +- src/assets/address.png | Bin 0 -> 4468 bytes src/store/module/user.js | 1 - src/utils/base64.js | 29 +++ src/utils/marker.js | 110 +++++++++ src/views/energyEfficiency/TaskFilling.vue | 2 +- .../energyEfficiency/constructionInfo.vue | 4 +- .../common-vue/uploader copy.vue | 215 ++++++++++++++++++ .../components/heatingSystem.vue | 27 ++- .../facilityManage/components/multipleAir.vue | 18 +- src/views/facilityManage/index.vue | 4 +- vue.config.js | 4 +- 13 files changed, 392 insertions(+), 28 deletions(-) create mode 100644 src/assets/address.png create mode 100644 src/utils/base64.js create mode 100644 src/utils/marker.js create mode 100644 src/views/facilityManage/common-vue/uploader copy.vue diff --git a/.env.production b/.env.production index 05754bd..a255385 100644 --- a/.env.production +++ b/.env.production @@ -6,7 +6,7 @@ NODE_ENV=production # 测试0 生产1 VUE_APP_ENV = '1' # 定义变量 -VUE_APP_CITY_TYPE = 'nx' +VUE_APP_CITY_TYPE = 'xj' # base api VUE_APP_BASE_API = '' diff --git a/src/api/config.js b/src/api/config.js index e4e666c..5c56d12 100644 --- a/src/api/config.js +++ b/src/api/config.js @@ -17,8 +17,8 @@ if (process.env.NODE_ENV === 'development') { // 生产环境 // baseURL = '' // 本地 打包以后只需要空路径就行 // baseURL = '/proxy-ah' //安徽 打包以后的路径 - baseURL = '/proxy-nx' //宁夏 打包以后的路径 - // baseURL = '/proxy-xj' //新疆 打包以后的路径 + // baseURL = '/proxy-nx' //宁夏 打包以后的路径 + baseURL = '/proxy-xj' //新疆 打包以后的路径 // baseURL = '/proxy-sx' //山西 打包以后的路径 } diff --git a/src/assets/address.png b/src/assets/address.png new file mode 100644 index 0000000000000000000000000000000000000000..926da4755d47fb3da5b40d766c82616f8af73fb3 GIT binary patch literal 4468 zcmcIo`8yO|7oRPLGG?+SG4^FFrN~muWJb)`_no35Ws3;a%%}{Cv1iQ}gBc8EUz<{y zv4u>^RwPTdl8{vI^hdlu+K40DzE%Io6)Hvi}Vz zA8)R4WflPd2qOzD#xdG^wNPM`=^)l~yE^B8RdN2RLggCS z?l_BNSDIxa-*-!?{kxeE1^k{?eC+t(I;bbi?GdL3JIZOh>GbkJ1f`mDjF_3s}R z{uV75Tzb@biS-f@3fYxE8t?ZBst@{&2qo{VghG_jEP>fK-T!vdp^!Yek0|rwlO0ZH z;i2S+7sJN=7oqx?yqWnLLo!jMOd)0KoSrF5VC2Bb5H12zfIJe`AY6Y4WKF%;a-%8* z`4M8Vym*61Bju9ZcK0-si@-&z-?s-?3V{P_Og$BIqpnAqaE!m?uSletfb2=@?{Cp+*S#zG5t2J;7jobZ z{FvUuy>IeG`X+GPoz|z&J{Pr`spM*&`Vub6LI<2go4MFVNwWz`lu4Sg2|!&ZTbgAZ7~)TTb%xkXeu*g)~%mW4FDK>=KgX zu4GhV0?~LHmuWN`8CY8}E+B6oz=d0Q&MF|oDT>^+2(Bd@VOr~?wW?4&riq{#($kRj zU=?t_^Md9C*dAU+)~`w*hdu#(O}@WdS7N9PUHgoGH3l zI)_tX%$#?Jmc&Z6SuLCg1Md!L2Xto+S67mdLBN~`eDTe}K%i3L!^XR}GOoKBVm48c zA@(mk-yeml{_5@MK2f)Ig##I`ebcSGhj+^tO>&XhNIF0WR6e*9WIeLBN6R}4_(H8SLW>g#S2Q>lT<{x6v6+US% zK`kZ3+!U*oWl1A0Ur$M9eP@{wyW|E4YLHxQs^5+8lr~a4GSn2wF^xY}@IBWay5aZH z)PNK|HH@%DFC~<2OSN_%gg!9|wVex#jnab;@wXdK4kSgARi`RO{Mts7iE(jF+!;4z zit#Hk<4%Ut*GZ--^dT&**^*id;5Q2+MV&uFI!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GV~4#5BUgH}$6kMjq|+lH+u;!ij@Mo&`wL0n#==LWo;Zo#2!chx_>GLT=%p zyAMXW$35|hcG2GB*`k)iu7`%s6%%B6d@bJUK_rpD7u!IoSOYl&BP17ffIMRLtfFU} zMT<8H-r^XM)QB*!mokPWpff3|R;YM;zY?@S8oWCtpo6salX0+G@4FY0-T88rB{fra zs{I&^N3R0s>AIx8eBFVOFSSI}jwIg)Og}7t zYrdg^p81vZIQ-DR$Ur~-IN@~8t~2;ElMz8^!Bf=M9oymbdPRZL_NkDK0_kd$f+r$|S=SnU6`m`W5;oLU*; zI$y~0iNJK=vos#qQ4-;$ zh9zseQp{qrt{ + let arr = base64.split(',') + let type = mime || arr[0].match(/:(.*?);/)[1] + let suffix = mime.split('/')[1] + let fileName = filename || `未命名.${suffix}` + let bstr = atob(arr[1]) + let n = bstr.length + let u8arr = new Uint8Array(n) + while (n--) { + u8arr[n] = bstr.charCodeAt(n) + } + return new File([u8arr], fileName, {type}) +} +// export const BlobtoFile = (data, mime, filename) =>{ +// const blob = new Blob([data], {type: 'text/plain'}) +// const file = new File([blob], '') +// } + +export const base64ToBlob = (dataurl, fileName) => { + let arr = dataurl.split(',') + let mime = arr[0].match(/:(.*?);/)[1] + let bstr = atob(arr[1]) + let n = bstr.length + let u8Arr = new Uint8Array(n) + while(n--){ + u8Arr[n] = bstr.charCodeAt(n) + } + return new Blob([u8Arr], {type: mime}) + } \ No newline at end of file diff --git a/src/utils/marker.js b/src/utils/marker.js new file mode 100644 index 0000000..8929b05 --- /dev/null +++ b/src/utils/marker.js @@ -0,0 +1,110 @@ +/** + * 添加水印 + * @param {blob} file + * @param {string} el + * @returns {Promise} + */ +import { formathms } from '@/utils/timeUtil.js' +import { getLocationMessage , getPosition} from '@/utils/dsbridge' +export async function addWaterMarker(file, type) { + return new Promise(async (resolve, reject) => { + try { + // 将文件blob转换成图片 + console.log('-------------------------addWaterMarker---', file); + let img = await blobToImg(file) + // 创建canvas画布 + let canvas = document.createElement('canvas') + canvas.width = img.naturalWidth + canvas.height = img.naturalHeight + let ctx = canvas.getContext('2d') + + // 填充上传的图片 + ctx.drawImage(img, 0, 0, canvas.width, canvas.height) + + // 加水印文字内容 + let text = await getText() + const markerFontSize = 18 + const markerFontOpacity = 1 + ctx.font = `bold ${markerFontSize}px Yahei` + ctx.fillStyle = '#000' + ctx.globalAlpha = markerFontOpacity + ctx.fillText('时\xa0\xa0\xa0间:'+text.time, canvas.width / 20, canvas.height-50) + ctx.fillText('地\xa0\xa0\xa0点:'+text.address, canvas.width/20, canvas.height-30) + ctx.fillText('经纬度:'+text.lglt, canvas.width/20, canvas.height-10) + // 加线 + let line = canvas.getContext('2d') + line.moveTo(canvas.width / 20 - 10, canvas.height-55) + line.lineTo(canvas.width / 20 - 10, canvas.height-5) + line.lineWidth=3 + line.stroke() + // 加位置图标 + let image = await loadImage() + ctx.drawImage(image, canvas.width/20-20, canvas.height-85, 20, 20) + // 将canvas转换成blob + canvas.toBlob(blob => resolve(blob)) + } catch (error) { + reject(error) + } + + }) + } + function loadImage(){ + return new Promise((resolve, reject) => { + // 加图片 + var image = new Image() + image.crossOrigin = true + image.src=require('@/assets/address.png') + image.onload = ()=> { + resolve(image) + } + }) + } + function blobToImg(blob) { + return new Promise((resolve, reject) => { + let reader = new FileReader() + reader.addEventListener('load', () => { + let img = new Image() + img.src = reader.result + img.addEventListener('load', () => resolve(img)) + }) + reader.readAsDataURL(blob) + }) + } + +// 水印文字获取 + function getText() { + return new Promise((resolve, reject) => { + let obj = { + time: formathms(new Date().getTime()), + address: '江苏南京', + lglt: '118.708980°,31.560001°' + } + getLocationMessage((data) => { + console.log('-------------------------getLocationMessage', data); + if (data) { + obj.address = data + } else { + obj.address = '测试地址' + } + }) + getPosition((data) => { + console.log('-------------------------位置信息', data, typeof(data)); + if (data) { + if(typeof(data) == 'string'){ + let dataArr = data.split(',') + let lglt = dataArr[0].match(/\d+\.\d{2}/)[0]+'°,'+dataArr[1].match(/\d+\.\d{2}/)[0] +'°' + obj.lglt = lglt + }else{ + console.log(data.longitude, 'lgitude位置信息') + let lglt = (data.longitude+'').match(/\d+\.\d{2}/)[0] +'°,'+(data.latitude+'').match(/\d+\.\d{2}/)[0]+'°' + obj.lglt = lglt + } + } else { + Notify({ type: 'warning', message: '未获取到位置信息' }) + } + }) + resolve(obj) + + }) + } + \ No newline at end of file diff --git a/src/views/energyEfficiency/TaskFilling.vue b/src/views/energyEfficiency/TaskFilling.vue index fb1bfb1..c4a4d5d 100644 --- a/src/views/energyEfficiency/TaskFilling.vue +++ b/src/views/energyEfficiency/TaskFilling.vue @@ -634,7 +634,7 @@ export default { }) return } - taskList({ consName: this.item.customerName }).then((res) => { + taskList({ taskId: this.taskId }).then((res) => { this.records = res.data.list[0] if (!this.records.buildId) { this.$notify({ diff --git a/src/views/energyEfficiency/constructionInfo.vue b/src/views/energyEfficiency/constructionInfo.vue index 64ca6ab..0f0b393 100644 --- a/src/views/energyEfficiency/constructionInfo.vue +++ b/src/views/energyEfficiency/constructionInfo.vue @@ -24,7 +24,7 @@
要大于可利用屋面面积或者地下车库面积
-
总建筑面积>可利用屋面面积
+
可利用屋面面积≤0.8*总建筑面积
地下车库面积≤0.5*总建筑面积
@@ -723,7 +723,7 @@ export default { } }, showTips1() { - if(Number(this.formData.availableArea) >= Number(this.formData.totalArea)) { + if(Number(this.formData.availableArea) > 0.8 * Number(this.formData.totalArea)) { this.tips2 = true }else { this.tips2 = false diff --git a/src/views/facilityManage/common-vue/uploader copy.vue b/src/views/facilityManage/common-vue/uploader copy.vue new file mode 100644 index 0000000..206ba41 --- /dev/null +++ b/src/views/facilityManage/common-vue/uploader copy.vue @@ -0,0 +1,215 @@ + + + + \ No newline at end of file diff --git a/src/views/facilityManage/components/heatingSystem.vue b/src/views/facilityManage/components/heatingSystem.vue index 696223e..e05886d 100644 --- a/src/views/facilityManage/components/heatingSystem.vue +++ b/src/views/facilityManage/components/heatingSystem.vue @@ -4,18 +4,20 @@
- + - + - + - + @@ -177,7 +179,17 @@ export default { mixins: [mixin], data() { + let validateisData = (value, rule) => { + if(!rule.required){ + return true + }else if (!value|| value <= 0) { + return false + } else{ + return true + } + } return { + validateisData, typeId: this.$route.query.typeId, tidCid: null, //页面名称 @@ -319,7 +331,7 @@ export default { //修改覆写数据 async editData() { - console.log(this.$store.getters.heatingUnitList); + // console.log(this.$store.getters.heatingUnitList); this.mouSetTimer = setTimeout(async () => { //查询机组 this.searchHeatType() @@ -333,7 +345,7 @@ export default { //问询问题 const searchInfo = this.$store.getters.searchInfo if (searchInfo) { - console.log(this.$store.getters.searchInfo); + // console.log(this.$store.getters.searchInfo); const res = dataMode(searchInfo['sbcn']) this.searchList = res //运营类 @@ -797,14 +809,13 @@ export default { this.form.modifyMode = data.id.join(',') }, handelInput(type, num) { - if(type == 'pumpNum' && !num) { + if(!num) { num = 0 } const data = { type, data: num, } - console.log(type,num); this.$store.commit('search/SET_NUM', data) }, handleClickInput(val) { diff --git a/src/views/facilityManage/components/multipleAir.vue b/src/views/facilityManage/components/multipleAir.vue index 8fedf37..d292007 100644 --- a/src/views/facilityManage/components/multipleAir.vue +++ b/src/views/facilityManage/components/multipleAir.vue @@ -482,22 +482,22 @@ export default { ifType(data, type, num) { if(num == 1) { if (type == 'exteriorImage') { - this.exteriorImage.push(data.attach_id) + // this.exteriorImage.push(data.attach_id) // const list = this.ifObj(this.exteriorImage) - this.form.exteriorImage = this.exteriorImage - this.form.exteriorImage.pop() + this.form.exteriorImage = this.exteriorImage = data + // this.form.exteriorImage.pop() } if (type == 'tagImage') { - this.tagImage.push(data.attach_id) + // this.tagImage.push(data.attach_id) // const list = this.tagImage.join(',') - this.form.tagImage = this.tagImage - this.form.tagImage.pop() + this.form.tagImage = this.tagImage = data + // this.form.tagImage.pop() } if (type == 'markImage') { - this.markImage.push(data.attach_id) + // this.markImage.push(data.attach_id) // const list = this.ifObj(this.markImage) - this.form.markImage = this.markImage - this.form.markImage.pop() + this.form.markImage = this.markImage = data + // this.form.markImage.pop() } } else { if (type == 'exteriorImage') { diff --git a/src/views/facilityManage/index.vue b/src/views/facilityManage/index.vue index d55cf70..b1d8c8e 100644 --- a/src/views/facilityManage/index.vue +++ b/src/views/facilityManage/index.vue @@ -476,9 +476,9 @@ export default { this.commonForm.nxzdUseEnergyEquipDTO.heatMode = store.heatMode - this.commonForm.nxzdUseEnergyEquipDTO.pumpTotalPower = store.pumpTotalPower + this.commonForm.nxzdUseEnergyEquipDTO.pumpTotalPower = store.pumpTotalPower||0 - this.commonForm.nxzdUseEnergyEquipDTO.pumpNum = store.pumpNum + this.commonForm.nxzdUseEnergyEquipDTO.pumpNum = store.pumpNum||0 this.commonForm.nxzdHeatSystemDTO = this.$store.getters.heatingUnitList /** *集中式空调 diff --git a/vue.config.js b/vue.config.js index 13c8a6f..100edd8 100644 --- a/vue.config.js +++ b/vue.config.js @@ -15,7 +15,7 @@ const resolve = dir => path.join(__dirname, dir) const webpack = require('webpack') // eslint-disable-next-line no-unused-vars const pkgInfo = require('./package.json') -const port = 6600 // 端口 +const port = 9527 // 端口 module.exports = { assetsDir: 'asset', @@ -24,7 +24,7 @@ module.exports = { lintOnSave: false, publicPath: '', chainWebpack: config => { - config.plugin('webpack-bundle-analyzer').use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin), + // config.plugin('webpack-bundle-analyzer').use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin), config.plugins.delete('preload') config.plugins.delete('prefetch') // config.module.rule("js").include.add(resolve("./node_modules/resize-detector/esm/index.js","./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./node_modules/cube-ui/src/components/loading/loading.vue?vue&type=script&lang=js&")).add(resolve("src"))