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 0000000..926da47 Binary files /dev/null and b/src/assets/address.png differ diff --git a/src/store/module/user.js b/src/store/module/user.js index decd8d4..c251e4d 100644 --- a/src/store/module/user.js +++ b/src/store/module/user.js @@ -175,7 +175,6 @@ const actions = { commit('SET_SG_CODE', gw_yc_code) commit('SET_DEPT_ID', dept_id) commit('SET_ENERGY_TYPE', user_category_code) - // commit('GET_USER_LEVEL') resolve(true) } else { resolve(false) diff --git a/src/utils/base64.js b/src/utils/base64.js new file mode 100644 index 0000000..fd91a5e --- /dev/null +++ b/src/utils/base64.js @@ -0,0 +1,29 @@ +export const Base64ToFile = (base64, mime, filename) =>{ + 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"))