const { getProjectByArea, getCompany, API_BASE_URL, IMG_BASE_URL, getElectricPlanAll, findAllPlan, saveOrEditCustomerEntry, entryDetail, getAddressByLonLat, getAddressLonLat, createQrcode, getFormSet, DEV, findTypeReferenceListNew, bankCardPage, surveyToDesign, getAllDictionarySelect, updateCustomerEntry,auditBack,getKcFormSet,getPressureLevel } = require('../../../api/api') const utilAddWatermark = require('../../../utils/addWatermark') const utilAddWatermark2 = require('../../../utils/addWatermark2') const utilGetLocation = require('../../../utils/getLocation') const utils = require('../../../utils/util') Page({ data: { API_BASE_URL: API_BASE_URL, IMG_BASE_URL: IMG_BASE_URL, DEV: DEV, capture: ['camera', 'album'], //拍摄模式 standardSolutionsList: [{ type: "", //方案类型 name: "", //方案名称 id: "", //方案ID code: "", //方案编号 drawing: "", //参考图纸 }], //标准方案初始数量 combinedSolutionsList: [{ type: "", //方案类型 name: "", //方案名称 id: "", //方案ID code: "", //方案编号 pickerIndex: 0, //方案类型选择下标 drawing: "", //参考图纸 addType: 1, //显示新增方案按钮 }], //组合方案初始数量 data: { name: "" }, photo: { fwImg1: [], fwImg2: [], fwImg3: [], fwImg4: [], fwImg5: [], flyImgs: [], //无人机航拍图 roofPhotoOne: [], //安装区域整体照片 roofPhotoTwo: [], //安装区域东南角照片 roofPhotoThree: [], //安装区域西南角照片 roofPhotoFour: [], //安装区域正南照片 roofPhotoFive: [], //安装区域细节照片 roofPhotoFacade: [], //房屋内部结构照片 roofPhotoInterior: [], //房屋内部环境照片 detailSupplementOne: [], //逆变器、配电箱预安装位置照片 houseSupplementOne: [], //房屋其他障碍物照片 surveyVideo: [], //踏勘补充证明视频 surveyFiles: [], //踏勘记录表 houseOwnership: [],//房产证 vrRoofOne: [], //房屋整体图 vrRoofTwo: [], //房屋整体俯视图 vrRoofThree: [], //房屋内部结构图 vrRoofFour: [], //入户全景照片 houseOutlinePhoto:[], //房屋轮廓照片 // phoneVideo: [], //屋顶视频 // filingDocumentPhoto: [], //备案文件 //踏勘记录表 // surveyPhoneOne: [], //踏勘记录表1 // surveyPhoneTwo: [], //踏勘记录表2 //房屋照片 // roofPhotoSix:[],//补充2 // houseSupplementTwo:[],//房屋补充2 //细节照片 // roofPhotoSeven:[],//障碍物照片 // dimensionsPhotoThickness:[],//楼顶厚度/围墙 // detailSupplementTwo:[],//细节补充2 //方案信息 designDrawings: [], //设计图纸 zjpbImg: [], //组件排布图 zjzxImg: [], // 组件走线图 zjcsImg: [], //支架侧视图 zjhsImg: [], //电气图 // nbqwzImg: [], //逆变器位置 // pdxwzImg: [], //配电箱位置 dzImgs: [], //组合图 }, photoTips: [ //越秀 { showKey: 'fly_imgs', key: 'flyImgs', num: 9, minNum: 3, title: '无人机航拍图', },{ showKey: 'roof_photo_one', key: 'roofPhotoOne', num: 9, minNum: 2, title: '安装区域整体照片', }, { showKey: 'roof_photo_two', key: 'roofPhotoTwo', num: 9, minNum: 1, title: '安装区域东南角照片', }, { showKey: 'roof_photo_four', key: 'roofPhotoFour', num: 9, minNum: 1, title: '安装区域正南照片', }, { showKey: 'roof_photo_three', key: 'roofPhotoThree', num: 9, minNum: 1, title: '安装区域西南角照片', }, { showKey: 'roof_photo_five', key: 'roofPhotoFive', num: 9, minNum: 1, title: '安装区域细节照片', }, { showKey: 'roof_photo_interior', key: 'roofPhotoInterior', num: 9, minNum: 2, title: '房屋内部环境照片', }, { showKey: 'roof_photo_facade', key: 'roofPhotoFacade', num: 9, minNum: 2, title: '房屋内部结构照片', }, { showKey: 'detail_supplement_one', key: 'detailSupplementOne', num: 9, minNum: 1, title: '逆变器、配电箱预安装位置照片', },{ showKey: 'house_outline_photo', key: 'houseOutlinePhoto', num: 9, minNum: 1, title: '房屋轮廓照片', }, { showKey: 'house_supplement_one', key: 'houseSupplementOne', num: 9, minNum: 1, title: '房屋其他障碍物照片', }, { showKey: 'survey_files', key: 'surveyFiles', num: 4, title: '踏勘记录表', },{ showKey: 'roof_photo_one_03', key: 'roofPhotoOne', num: 9, minNum: 2, title: '房屋屋顶照片', },{ showKey: 'roof_photo_two_03', key: 'roofPhotoTwo', num: 9, minNum: 1, title: '房屋屋顶东侧图片', },{ showKey: 'roof_photo_three_03', key: 'roofPhotoThree', num: 9, minNum: 1, title: '房屋屋顶西侧图片', },{ showKey: 'roof_photo_four_03', key: 'roofPhotoFour', num: 9, minNum: 1, title: '房屋屋顶南侧图片', },{ showKey: 'fw_img3', key: 'fwImg3', num: 9, minNum: 1, title: '房屋屋顶东南侧图片', },{ showKey: 'fw_img4', key: 'fwImg4', num: 9, minNum: 1, title: '房屋屋顶西南侧图片', },{ showKey: 'fw_img5', key: 'fwImg5', num: 9, minNum: 1, title: '遮阴物与房屋距离、高度', },{ showKey: 'survey_video', key: 'surveyVideo', num: 8, minNum: 1, title: '踏勘补充证明视频', },{ showKey: 'house_ownership', key: 'houseOwnership', num: 8, minNum: 1, title: '房产证明', },{ showKey: 'survey_files_03', key: 'surveyFiles', num: 9, minNum: 1, title: '户用勘察记录表(附平面草图)', },{ showKey: 'fw_img1', key: 'fwImg1', num: 9, minNum: 1, title: '房屋整体图', },{ showKey: 'vr_roof_one', key: 'vrRoofOne', num: 9, minNum: 1, title: '房屋整体图(VR全景)', },{ showKey: 'vr_roof_two', key: 'vrRoofTwo', num: 9, minNum: 1, title: '房屋整体俯视图(无人机)', },{ showKey: 'vr_roof_three', key: 'vrRoofThree', num: 9, minNum: 1, title: '房屋内部结构图(VR)', },{ showKey: 'fw_img2', key: 'fwImg2', num: 9, minNum: 1, title: '房屋内部结构图', },{ showKey: 'vr_roof_four', key: 'vrRoofFour', num: 9, minNum: 1, title: '入户全景照片(VR)', },{ showKey: 'fly_imgs_04', key: 'flyImgs', num: 9, minNum: 3, title: '屋顶高空俯视照片', },{ showKey: 'roof_photo_two_04', key: 'roofPhotoTwo', num: 9, minNum: 1, title: '屋顶东南照片', },{ showKey: 'roof_photo_four_04', key: 'roofPhotoFour', num: 9, minNum: 1, title: '屋顶正南照片', },{ showKey: 'roof_photo_three_04', key: 'roofPhotoThree', num: 9, minNum: 1, title: '屋顶西南照片', },{ showKey: 'vr_roof_four_04', key: 'vrRoofFour', num: 9, minNum: 1, title: '入户全景照片', },{ showKey: 'survey_files_04', key: 'surveyFiles', num: 4, title: '现场勘测表', }], //房屋信息 roofType: "平屋顶", //默认为平屋顶 sealRoof: '', //是否封屋顶 schemeType: 1, //默认为标准方案 shootType: 1, //默认为无人机拍摄 azimuth: 1, //方位角默认为正南 gender: 1, //默认为男 repaymentMethod: 1, //划转方式默认为二类卡 projectId: '', insuranceList: ["控制投放及续保", "控制投放", "其他"], filingList: ['农户备案', '项目公司备案'], isComplement: false, //默认不需要填写共签人信息 userObj: {}, //业主信息 formSetObj: {}, //自定义字段 verifyFields: [], //校验字段 caseImgArr: [], //示例图数据 productZj: 0, //产品默认的组件值 companyList: [], //对应产品的项目公司列表数据 auditStatus: '1', nodeType: '1', gridType: '0', gfRoofTypeList: [], //广发--屋顶类型 roofTypeAllColumn: {},//选中的屋顶类型 }, /** input数值输入控制 **/ onInput(e) { let value = e.detail.value; let name = e.currentTarget.dataset.name; // 将输入值的小数点替换为一个字符,确保只有两位小数 value = value.replace(/^(\-)*(\d+)\.(\d{2}).*$/, '$1$2.$3'); // 设置输入框的值 this.setData({ [`${name}`]: value }); }, //只能输入整数 onInput2(e) { let value = e.detail.value; let name = e.currentTarget.dataset.name; value = value.replace(/[^\d]/g,''); this.setData({ [`${name}`]: value }); }, onLoad(e) { if (e.navTitle) { wx.setNavigationBarTitle({ title: e.navTitle, }) } const projectId = e.projectId; //有projectId说明从列表进去,可能是修改或者是暂存过 const type = e.type const surveyType = e.surveyType if (projectId) { this.setData({ projectId, entryId: projectId, traderId: wx.getStorageSync('traderId'), }) } this.setData({ type, surveyType, disabledYear:(new Date()).getFullYear() }) this.findAllPlan(); this.getCaseImg(); }, onReady() { const query = wx.createSelectorQuery() query.select('#Canvas') .fields({ node: true, size: true }) .exec(async (res) => { const canvas = res[0].node this.setData({ canvas, }) }) }, onShow() {}, /*** 获取字典 */ getDictionaryList(partner, callback) { getAllDictionarySelect({ capitalId: partner, }).then((res) => { if(res.data){ this.setData({ roofTypeList: res.data.roof_type.map(item=>item.columns), //屋顶类型 angleAzimuthSel: res.data.angle_azimuth.map(item=>item.columns), //方位角 voltageClassesSel: res.data.voltage_classes.map(item=>item.columns), //并网电压等级 structureTypeSel: res.data.structure_type.map(item=>item.columns), //结构类型 groundTypeSel: res.data.ground_type.map(item=>item.columns), //地面类型 }) } if(callback) callback(res.data) }) }, /** 获取自定义字段 */ getFormSet(partner) { getFormSet({ stage: '02', //01:信息登记,02:踏勘设计,03:电站安装,04:电站并网 partner: partner, }).then((res) => { this.setData({ formSetObj: res.data.columns, }) }) if(partner == '03'){ getKcFormSet().then((res) => { if(res.data){ this.setData({ gfRoofTypeList: res.data, //广发--屋顶类型数据集合 }) } }) } }, /** 获取示例图 */ getCaseImg() { findTypeReferenceListNew({ typeId: '02', //勘测 }).then((res) => { if (res.data) { this.setData({ caseImgArr: res.data, }) } }) }, /** 示图图片放大 **/ viewPic(e) { wx.previewImage({ current: e.currentTarget.dataset.item.map(itm => IMG_BASE_URL + itm.imgsValue)[e.currentTarget.dataset.index], // 当前显示图片的 http 链接 urls: e.currentTarget.dataset.item.map(itm => IMG_BASE_URL + itm.imgsValue) // 需要预览的图片 http 链接列表 }) }, /** 获取电站详情 **/ entryDetail(e) { let that = this wx.showLoading({ title: "加载中" }) entryDetail({ userId: wx.getStorageSync('userId'), entryId: e.projectId }).then((res) => { wx.hideLoading() var componentNum = 0; //设计安装容量 // 组件,1逆变器,并网箱,4支架 if (res.componentList.length > 0) { var componentList = []; var converterList = []; var cagesList = []; var supportList = []; for (let i = 0; i < res.componentList.length; i++) { const element = res.componentList[i]; var OB = { id: "", num: "", //数量 model: "", //名称 addType: 0, } if (element.item_type == 3) { OB.id = element.item_id; OB.num = element.num; OB.model = element.model; OB.material_model = element.material_model; componentNum = (element.num * element.model + componentNum) componentList.push(OB) } else if (element.item_type == 1) { OB.id = element.item_id; OB.num = element.num; OB.model = element.model; OB.material_model = element.material_model; converterList.push(OB) } else if (element.item_type == 2) { OB.id = element.item_id; OB.num = element.num; OB.model = element.model; cagesList.push(OB) } else if (element.item_type == 4) { OB.id = element.item_id; OB.num = element.num; OB.model = element.model; supportList.push(OB) } } //维持默认数组第一addType为1,用以显示新增按钮 if (componentList.length > 0) { componentList[0].addType = 1; this.setData({ componentList: componentList }) } else { this.setData({ componentList: [{ id: res.modeId ? res.modeId : '', //默认产品信息中的组件规格id num: '', //数量 model: res.modeId ? res.assemblySpecs : '', //名称,默认产品信息中的组件规格 addType: 1, }], //组件初始数量 }) } if (converterList.length > 0) { converterList[0].addType = 1; this.setData({ converterList: converterList }) } else { this.setData({ converterList: [{ id: "", num: "", //数量 model: "", //名称 addType: 1, }], //逆变器初始数量 }) } if (cagesList.length > 0) { cagesList[0].addType = 1; this.setData({ cagesList: cagesList }) } else { this.setData({ cagesList: [{ id: "", num: "", //数量 model: "", //名称 addType: 1, }], //并网箱初始数量 }) } if (supportList.length > 0) { supportList[0].addType = 1; this.setData({ supportList: supportList }) } else { this.setData({ supportList: [{ id: "", num: "", //数量 model: "", //名称 addType: 1, }], //支架初始数量 }) } } else { this.setData({ componentList: [{ id: res.modeId ? res.modeId : '', //默认产品信息中的组件规格id num: "", //数量 model: res.modeId ? res.assemblySpecs : '', //名称,默认产品信息中的组件规格 addType: 1, }], //组件初始数量 converterList: [{ id: "", num: "", //数量 model: "", //名称 addType: 1, }], //逆变器初始数量 cagesList: [{ id: "", num: "", //数量 model: "", //名称 addType: 1, }], //并网箱初始数量 supportList: [{ id: "", num: "", //数量 model: "", //名称 addType: 1, }], //支架初始数量 }) } this.setData({ productZj: res.assemblySpecs ? Number(res.assemblySpecs) : 0, //产品默认的组件值 componentNum: (componentNum / 1000).toFixed(3), }) //预计投放日默认当前时间后60天 let date = new Date(); //这里的60就是你要加的天数,减也可以。年、月会相应加上去,值得注意的是date.getMonth()得到的月份比实际月份小1,所以实际月份是(date.getMonth()+1) date.setDate(date.getDate() + 60); var leaseDate = utils.formatTime2(date); // var leaseDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate(); this.setData({ detail: res, id: res.id, //修改数据的时候传此ID bankFlag:res.bankFlag,//开卡按钮标记:1.可开卡 2.不可开卡 projectId: res.project_id, projectCode: res.projectCode, projectName: res.projectName, tenant_type: res.tenant_type == '1' ? '个人' : '单位', //1.个人,2单位 capitalId: res.zfId, //资方 capitalName: res.zfName, //资方 roofType: res.roof_type, shootType: res.shoot_type ? res.shoot_type : 1, // capture:res.shoot_type&&(res.shoot_type == 1) ? ['album', 'camera'] : ['camera'],//1.无人机拍摄 2.手机拍摄 azimuth: res.azimuth ? res.azimuth : '', //方位角 directionDeg: res.angle, //方位角 repaymentMethod: res.repayment_method ? res.repayment_method : 1, //如果租金划转方式是二类卡,那么二类卡的信息 显示这个 secCardName: res.secCardName ? res.secCardName : '', //二类卡账户名 secCardNo: res.secCardNo ? res.secCardNo : '', //二类卡账号 secBankNumber: res.secBankNumber ? res.secBankNumber : '', //二类卡联行号 distance: res.distance, //配电箱至并网点距离 buildingHeight: res.building_height, //建筑高度 ewLength: res.ew_length, //东西长 nsWide: res.ns_wide, //南北宽 remark: res.remarks, schemeType: res.scheme_type ? res.scheme_type : 1, solutionRemark: res.scheme_remarks, paycycle: res.pay_cycle, companyName: res.project_company_name, companyId: res.project_company_id, insuranceFlag: res.insurance_flag, // 保险购买情况:1.控制投放及续保 2.控制投放 3.其他 filingType: res.filing_type, // 备案类型:1.农户备案 2.项目公司备案 leaseDate: res.lease_date ? res.lease_date : leaseDate, //预计投放日 filingDocumentCode: res.filing_document_code, //项目备案代码 /********/ sealRoof: res.seal_roof, //是否封屋顶,1是,2.否 completionYear: res.completion_year ? res.completion_year : '', //房屋建成年份 slopeGradient: res.slope_gradient, //屋面坡度 purlineInterval: res.purline_interval, //檀条间距 waterproof: res.waterproof, //屋顶防水情况 sourcePollution: res.source_pollution, //是否有污染源 opsCondition: res.ops_condition, //是否具备运维空间 voltageClasses: res.voltage_classes, //并网电压等级 transformerCapacity: res.transformer_capacity, //变压器容量 restrictFlag: res.restrict_flag, //是否符合变压器容量限制要求 dipAngle: res.dip_angle, //组件倾角 roofArea: res.roof_area, //屋顶面积 //业主信息参数 name: res.tenant_name, phone: res.mobile, idCard: res.id_code, regno: res.regno, provinceName: res.province, cityName: res.city, areaName: res.area, address: res.address, longitude: res.longitude, latitude: res.latitude, age: res.age, gender: res.gender == "MALE" ? "1" : "2", //性别 bankName: res.bank_name ? res.bank_name : '', //卡账号名称 bankCode: res.bank_code ? res.bank_code : '', //卡账号 tssBankNum: res.tss_bank_num ? res.tss_bank_num : '', //卡开户行 tssBankNumName: res.tss_bank_num_name, //卡开户行名称 bankCard: res.bank_card, //银行卡照片 idCardFront: res.id_card_front, //身份证正面 idCardBack: res.id_card_back, //身份证反面 residenceBooklet: res.residence_booklet, //户口本复印件 estimateCapacity: res.estimate_capacity, //预估组件 //共签人信息,年龄大于65岁需要共签人 bpName: res.bp_name, //共签人名称 bpRelation: res.bp_relation, //共签人与业主关系 bpIdCard: res.bp_id_card, //共签人证件号码,不能与租户身份证号码相同 bpMobile: res.bp_mobile, //共签人手机号 bpCardFront: res.bp_card_front, // 共签人身份证正面 bpCardBack: res.bp_card_back, // 共签人身份证反面 bpFile: res.bp_file, // 共签人子女证明材料 auditRemarks: res.zs_audit_remarks, //审核意见 auditStatus: res.zs_flag?res.zs_flag: '1', //审核结果 nodeType: res.node_type?res.node_type:'1', //驳回节点 roofFaceThickness: res.roof_face_thickness,//屋面板厚度 structureType: res.structure_type,//结构类型 siteSlope: res.site_slope,//场地坡度 groundType: res.ground_type,//地面类型 geologicalCondition: res.geological_condition,//地质情况 fenceHeight: res.fence_height,//围墙高度 windPressure: res.wind_pressure, //风压 snowPressure: res.snow_pressure, //雪压 pressureLevel: res.pressure_level, //风雪压等级 }) //并网方式处理 if(res.recordBoxHistory){ if(res.recordBoxHistory ==''){//并网方式没选择过,默认‘单户并网’ this.setData({ // gridType: '0',//并网方式 boxTotalCount: '', //总数 boxGroupNum: '', //编号 boxGroupName: '', //名称 }) }else{ this.setData({ gridType: res.recordBoxHistory.type,//并网方式 gridStatus: res.recordBoxHistory.status,//状态为1不能编辑 boxTotalCount: res.recordBoxHistory.total_count, boxGroupNum: res.recordBoxHistory.group_number, boxGroupName: res.recordBoxHistory.group_name, boxGroupId: res.recordBoxHistory.box_group_id, }) } } if (res.insurance_flag == 1) { this.setData({ insurance: "控制投放及续保" }) } else if (res.insurance_flag == 2) { this.setData({ insurance: "控制投放" }) } else if (res.insurance_flag == 3) { this.setData({ insurance: "其他" }) } if (res.filing_type == 1) { //如果是农户备案。只能选择二类卡 this.setData({ filingName: "农户备案", repaymentMethod: 1 }) } else if (res.filing_type == 2) { this.setData({ filingName: "项目公司备案", repaymentMethod: 0 }) } //当业主年龄大于65岁时,共签人信息必填 if (res.age >= 65) { this.setData({ isComplement: true }) } if (res.longitude && res.latitude) { this.setData({ longitudeAndLongitude: res.longitude + "," + res.latitude }) } if (res.scheme_type == 1) { for (let i = 0; i < that.data.planList.length; i++) { const element = that.data.planList[i]; if (res.scheme_type_id && (res.scheme_type_id == element.id)) { this.setData({ standardSolutionsListIndex: i, }) } } this.setData({ [`standardSolutionsList[0].id`]: res.scheme_id ? res.scheme_id : '', [`standardSolutionsList[0].type`]: res.scheme_type_name ? res.scheme_type_name : '', [`standardSolutionsList[0].typeId`]: res.scheme_type_id ? res.scheme_type_id : '', [`standardSolutionsList[0].name`]: res.scheme_name ? res.scheme_name : "", }) } else if (res.scheme_type == 2) { if (res.composePlanList.length > 0) { var combinedSolutionsList = [] for (let i = 0; i < res.composePlanList.length; i++) { var combinedSolutionsListOB = {} const element = res.composePlanList[i]; if (i == 0) { combinedSolutionsListOB.addType = 1; } combinedSolutionsListOB.code = element.code; combinedSolutionsListOB.id = element.planId; combinedSolutionsListOB.name = element.name; combinedSolutionsListOB.type = element.planType; combinedSolutionsListOB.planTypeId = element.planTypeId; for (let i = 0; i < that.data.planList.length; i++) { const planTypeObj = that.data.planList[i]; if (planTypeObj.allPlan.length > 0) { for (let j = 0; j < planTypeObj.allPlan.length; j++) { const plan = planTypeObj.allPlan[j]; if (plan.id == element.planId) { combinedSolutionsListOB.pickerIndex = i } } } } combinedSolutionsList.push(combinedSolutionsListOB) } this.setData({ combinedSolutionsList: combinedSolutionsList }) } } // 添加图片 this.setData({ [`photo.flyImgs`]: res.fly_imgs ? res.fly_imgs.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm } }) : [], //无人机航拍图 [`photo.roofPhotoOne`]: res.roof_photo_one ? res.roof_photo_one.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm } }) : [], //安装区域整体照片 [`photo.roofPhotoTwo`]: res.roof_photo_two ? res.roof_photo_two.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm } }) : [], //安装区域东南角照片 [`photo.roofPhotoThree`]: res.roof_photo_three ? res.roof_photo_three.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm } }) : [], //安装区域西南角照片 [`photo.roofPhotoFour`]: res.roof_photo_four ? res.roof_photo_four.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm } }) : [], //安装区域正南照片 [`photo.roofPhotoFive`]: res.roof_photo_five ? res.roof_photo_five.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm } }) : [], //安装区域细节照片 [`photo.roofPhotoInterior`]: res.roof_photo_interior ? res.roof_photo_interior.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm } }) : [], //房屋内部环境照片 [`photo.roofPhotoFacade`]: res.roof_photo_facade ? res.roof_photo_facade.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm } }) : [], //房屋内部结构照片 [`photo.detailSupplementOne`]: res.detail_supplement_one ? res.detail_supplement_one.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm } }) : [], //逆变器、配电箱预安装位置照片 [`photo.houseSupplementOne`]: res.house_supplement_one ? res.house_supplement_one.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm } }) : [], //房屋其他障碍物照片 [`photo.surveyVideo`]: res.survey_video ? res.survey_video.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm } }) : [], //踏勘补充证明视频 [`photo.surveyFiles`]: res.survey_files ? res.survey_files.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm}}) : [], //踏勘记录表 [`photo.houseOwnership`]: res.house_ownership ? res.house_ownership.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm}}) : [], //房产证 [`photo.vrRoofOne`]: res.vr_roof_one ? res.vr_roof_one.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm}}) : [], //房屋整体图(VR全景) [`photo.vrRoofTwo`]: res.vr_roof_two ? res.vr_roof_two.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm}}) : [], //房屋整体俯视图(VR) [`photo.vrRoofThree`]: res.vr_roof_three ? res.vr_roof_three.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm}}) : [], //房屋内部结构图(VR) [`photo.vrRoofFour`]: res.vr_roof_four ? res.vr_roof_four.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm}}) : [], //入户全景照片(VR) [`photo.houseOutlinePhoto`]: res.house_outline_photo ? res.house_outline_photo.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm}}) : [], //房屋轮廓照片 // [`photo.phoneVideo`]:res.roof_value ? [{name:res.roof_value,url:IMG_BASE_URL + res.roof_value}] : [],//屋顶视频 // [`photo.phoneHouse`]:res.house_ownership ? this.data.photo.phoneHouse: [],//房产证 // [`photo.filingDocumentPhoto`]:res.filing_document_photo ? [{name:res.filing_document_photo,url:IMG_BASE_URL + res.filing_document_photo}] : [],//备案文件 //房屋照片 // [`photo.roofPhotoSix`]:res.roof_photo_six ? [{name:res.roof_photo_six,url:IMG_BASE_URL + res.roof_photo_six}] : [],//补充2 // [`photo.houseSupplementTwo`]:res.house_supplement_two ? [{name:res.house_supplement_two,url:IMG_BASE_URL + res.house_supplement_two}] : [],//房屋补充2 //细节照片 // [`photo.roofPhotoSeven`]:res.roof_photo_seven ? [{name:res.roof_photo_seven,url:IMG_BASE_URL + res.roof_photo_seven}] : [],//障碍物照片 // [`photo.dimensionsPhotoThickness`]:res.dimensions_photo_thickness ? [{name:res.dimensions_photo_thickness,url:IMG_BASE_URL + res.dimensions_photo_thickness}] : [],//楼顶厚度/围墙 // [`photo.detailSupplementTwo`]:res.detail_supplement_two ? [{name:res.detail_supplement_two,url:IMG_BASE_URL + res.detail_supplement_two}] : [],//细节补充2 //踏勘记录表 // [`photo.surveyPhoneOne`]:res.survey_record ? [{name:res.survey_record,url:IMG_BASE_URL + res.survey_record}] : [],//踏勘记录表 // [`photo.surveyPhoneTwo`]:res.survey_record2 ? [{name:res.survey_record2,url:IMG_BASE_URL + res.survey_record2}] : [],//踏勘记录表2 //方案信息 'photo.designDrawings': res.design_drawings ? res.design_drawings.split(",").map(itm => { return { name: itm, url: IMG_BASE_URL + itm } }) : [], //设计图纸 'photo.zjpbImg': res.zjpb_img ? res.zjpb_img.split(",").map(itm => {return {name: itm,url: IMG_BASE_URL + itm}}) : [], //组件排布图 'photo.zjzxImg': res.zjzx_img ? res.zjzx_img.split(",").map(itm => {return {name: itm,url: IMG_BASE_URL + itm}}) : [], //组件接线图 'photo.zjcsImg': res.zjcs_img ? res.zjcs_img.split(",").map(itm => {return {name: itm,url: IMG_BASE_URL + itm}}) : [], //组件支架图 'photo.zjhsImg': res.zjhs_img ? res.zjhs_img.split(",").map(itm => {return {name: itm,url: IMG_BASE_URL + itm}}) : [], //电气图 //2024-9-4 广发 'photo.fwImg1': res.fw_img1 ? res.fw_img1.split(",").map(itm => {return {name: itm,url: IMG_BASE_URL + itm}}) : [], //房屋整体图 'photo.fwImg2': res.fw_img2 ? res.fw_img2.split(",").map(itm => {return {name: itm,url: IMG_BASE_URL + itm}}) : [], //房屋内部结构图 'photo.fwImg3': res.fw_img3 ? res.fw_img3.split(",").map(itm => {return {name: itm,url: IMG_BASE_URL + itm}}) : [], //房屋屋顶东南侧图片 'photo.fwImg4': res.fw_img4 ? res.fw_img4.split(",").map(itm => {return {name: itm,url: IMG_BASE_URL + itm}}) : [], //房屋屋顶西南侧图片 'photo.fwImg5': res.fw_img5 ? res.fw_img5.split(",").map(itm => {return {name: itm,url: IMG_BASE_URL + itm}}) : [], //遮阴物与房屋距离、高度 // [`photo.nbqwzImg`]: res.nbqwz_img ? [{name:res.nbqwz_img,url:IMG_BASE_URL + res.nbqwz_img}] : [],//逆变器位置图 // [`photo.pdxwzImg`]: res.pdxwz_img ? [{name:res.pdxwz_img,url:IMG_BASE_URL + res.pdxwz_img}] : [],//配电箱位置图 // [`photo.dzImgs`]: res.dz_imgs ? res.dz_imgs.split(",").map(itm=>{return {name:itm, url:IMG_BASE_URL + itm}}) : [],//组合图 }); this.getFormSet(res.management); //设置的参数 //下拉字典 this.getDictionaryList(res.management, (res2)=>{ if(res2.angle_azimuth){ let angleList = res2.angle_azimuth.map(item=>item.columns); if(res.azimuth){ let azimuthName = angleList.find(itm => itm.dict_key === res.azimuth).dict_value; this.setData({ azimuthName }) } } }); setTimeout(()=>{ if(res.management == '03' && res.roof_type !=''){ this.roofTypeToColumn(res.roof_type) } },500) this.getProjectList(); this.getElectricPlanAll(); this.getCompanyList(); }) }, /** 获取产品编号 **/ getProjectList(e) { getProjectByArea({ province: this.data.provinceName, city: this.data.cityName, area: this.data.areaName, userId: wx.getStorageSync('userId'), type: 1, tenantType: this.data.tenant_type == '单位' ? '2' : '1', //租户类型:1.个人,2单位 filType: this.data.tenant_type == '单位' ? '2' : '1', //租户类型:1.个人,2单位 projectId: this.data.capitalId, filingType: this.data.filingType, //备案类型:1.农户,2项目公司 }).then((res) => { this.setData({ projectList: res.data && res.data.length ? res.data.map(itm => itm.columns) : [] }) }) }, /** 获取项目公司列表数据 **/ getCompanyList(e) { getCompany({ traderId: wx.getStorageSync('traderId'), projectId: this.data.projectId, province: this.data.provinceName, city: this.data.cityName, area: this.data.areaName, partner: this.data.capitalId, //资方 filingType: this.data.filingType?this.data.filingType:'', //备案类型 }).then((res) => { this.setData({ companyList: res.data && res.data.length ? res.data.map(itm => itm.columns) : [] }) }) }, /* 获取风雪压等级*/ getPressure(province,city,area) { getPressureLevel({ province: this.data.provinceName, city: this.data.cityName, area: this.data.areaName, }).then((res) => { if(res.code == 200){ if(res.data){ this.setData({ windPressure: res.data.columns.wind_pressure, //风压 snowPressure: res.data.columns.snow_pressure, //雪压 pressureLevel: res.data.columns.pressure_level, //风雪压等级 }) } } }) }, /** 获取组件、逆变器、并网箱、支架列表 **/ getElectricPlanAll(e) { getElectricPlanAll({ partnerId: this.data.capitalId,//资方 }).then((res) => { var AllComponentApiList = []; var converterApiList = []; var cagesApiList = []; var supportApiList = []; for (let i = 0; i < res.zjs.length; i++) { const element = res.zjs[i].columns; AllComponentApiList.push(element) } for (let j = 0; j < res.inverters.length; j++) { const element = res.inverters[j].columns; converterApiList.push(element) } for (let k = 0; k < res.boxs.length; k++) { const element = res.boxs[k].columns; cagesApiList.push(element) } for (let m = 0; m < res.zhij.length; m++) { const element = res.zhij[m].columns; supportApiList.push(element) } let componentApiList = AllComponentApiList.length ? AllComponentApiList.filter(itm => Number(itm.model) >= this.data.productZj) : []; //过滤大于等于productZj的组件列表 this.setData({ AllComponentApiList: AllComponentApiList, componentApiList: componentApiList, //组件 [`componentList[${0}].material_model`]: componentApiList.length && (this.data.componentList[0].id == '') ? componentApiList[0].material_model : this.data.componentList[0].material_model, [`componentList[${0}].model`]: componentApiList.length && (this.data.componentList[0].id == '') ? componentApiList[0].model : this.data.componentList[0].model, [`componentList[${0}].id`]: componentApiList.length && (this.data.componentList[0].id == '') ? componentApiList[0].id : this.data.componentList[0].id, converterApiList: converterApiList, //逆变器 cagesApiList: cagesApiList, //并网箱 supportApiList: supportApiList, //支架 }) }) }, /** 获取方案类型和方案名称 **/ findAllPlan(e) { let that = this findAllPlan({ }).then((res) => { for (let i = 0; i < res.length; i++) { if (res[i].allPlan) { res[i].allPlan = JSON.parse(res[i].allPlan) for (let j = 0; j < res[i].allPlan.length; j++) { var element = res[i].allPlan[j].columns; res[i].allPlan[j] = element } } } that.setData({ planList: res, }) if (that.data.projectId) { that.entryDetail({ projectId: that.data.projectId }) } else { this.setData({ componentList: [{ id: "", num: "", //数量 model: "", //名称 addType: 1, }], //组件初始数量 converterList: [{ id: "", num: "", //数量 model: "", //名称 addType: 1, }], //逆变器初始数量 cagesList: [{ id: "", num: "", //数量 model: "", //名称 addType: 1, }], //并网箱初始数量 supportList: [{ id: "", num: "", //数量 model: "", //名称 addType: 1, }], //支架初始数量 componentNum: 0, //设置安装容量 }) } }) }, /** 暂存提交数据 **/ submitFrom(e) { var that = this var type = e.currentTarget.dataset.type var flag = e.currentTarget.dataset.flag // console.log("3:初勘 4.初勘暂存",type); // return wx.showLoading({ title: '提交中', mask: true }) var composePlanList = []; // 标准方案或组合方案 // if (this.data.schemeType == 2) { //组合 // this.data.combinedSolutionsList.forEach(element => { // var composePlanListOB = {} // if (element.planTypeId) { // composePlanListOB.code = element.code; // composePlanListOB.name = element.name; // composePlanListOB.planType = element.type; // composePlanListOB.planId = element.id; // composePlanListOB.planTypeId = element.planTypeId; // composePlanList.push(composePlanListOB) // } // }); // } var itemList = []; //组件 逆变器 并网箱 支架 this.data.componentList.forEach(element => { //组件 if (element.id) { var component = {} component.itemType = 3; component.itemId = element.id; component.num = element.num itemList.push(component) } }); this.data.converterList.forEach(element => { //逆变器 if (element.id) { var component = {} component.itemType = 1; component.itemId = element.id; component.num = element.num; itemList.push(component) } }); this.data.cagesList.forEach(element => { //并网箱 if (element.id) { var component = {} component.itemType = 2; component.itemId = element.id; component.num = element.num; itemList.push(component) } }); this.data.supportList.forEach(element => { //支架 if (element.id) { var support = {} support.itemType = 4; support.itemId = element.id; support.num = element.num; itemList.push(support) } }); //接口数据 var userId = wx.getStorageSync('userId') var CustomerEntry = { type: type, //0:暂存 1:提交 3:初勘 4.初勘暂存 composePlanLists: composePlanList.length > 0 ? composePlanList : [], itemList: itemList.length > 0 ? itemList : [], projectId: this.data.projectId, //项目ID projectCode: this.data.projectCode, //产品编号 projectName: this.data.projectName, //产品名称 company: this.data.companyId, //项目公司id filingType: this.data.filingType ? this.data.filingType : "", //备案类型 1.农户备案 2.项目公司备案 // insuranceFlag: this.data.insuranceFlag ? this.data.insuranceFlag : "", // 保险购买情况:1.控制投放及续保 2.控制投放 3.其他 insuranceFlag: "1", // 保险购买情况:1.控制投放及续保 2.控制投放 3.其他 leaseDate: this.data.leaseDate ? this.data.leaseDate : "", //预计投放日 repaymentMethod: this.data.repaymentMethod, //划转方式 // filingDocumentCode: this.data.filingDocumentCode ? this.data.filingDocumentCode : "", //项目备案代码 //共签人信息 // bpCardFront: this.data.bpCardFront, //共签人身份证正面 // bpCardBack: this.data.bpCardBack, //共签人身份证反面 // bpFile: this.data.bpFile, //共签人子女证明材料 // bpName: this.data.bpName ? this.data.bpName : "", //共签人名称 // bpRelation: this.data.bpRelation ? this.data.bpRelation : "", //共签人与业主关系 // bpIdCard: this.data.bpIdCard ? this.data.bpIdCard : "", //共签人证件号码,不能与租户身份证号码相同 // bpMobile: this.data.bpMobile ? this.data.bpMobile : "", //共签人手机号 //业主信息 // tenantName: this.data.name, //业主姓名 // mobile: this.data.phone ? this.data.phone : "", //联系方式 // gender: this.data.gender == 1 ? "MALE" : "FEMALE", //性别 // age: this.data.age ? this.data.age : "", //年龄 // bankName: this.data.bankName ? this.data.bankName : "", //账号名称 // bankCode: this.data.bankCode ? this.data.bankCode : "", //账号 // tssBankNum: this.data.tssBankNum ? this.data.tssBankNum : "", //开户行 // tssBankNumName:this.data.tssBankNumName ? this.data.tssBankNumName : "", //开户行名称 // estimateCapacity: this.data.estimateCapacity, //预估组件 // bankCard: this.data.bankCard, //银行卡照片 // idCardFront: this.data.idCardFront, //身份证正面 // idCardBack: this.data.idCardBack, //身份证反面 // idCode: this.data.idCard ? this.data.idCard : "", //身份证卡号 // residenceBooklet: this.data.residenceBooklet, //户口本复印件 province: this.data.provinceName ? this.data.provinceName : "", //省 city: this.data.cityName ? this.data.cityName : "", //市 area: this.data.areaName ? this.data.areaName : "", //区 address: this.data.address ? this.data.address.trim() : "", //详细地址 longitude: this.data.longitude ? this.data.longitude : "", //经度 latitude: this.data.latitude ? this.data.latitude : "", //纬度 //房屋信息 roofType: this.data.roofType, //屋顶类型 sealRoof: this.data.sealRoof, //是否封屋顶 completionYear: this.data.completionYear, //房屋建成年份 azimuth: this.data.azimuth, //方位角 angle: this.data.azimuth!=1 && this.data.azimuth!=10 && this.data.azimuth!=11 && this.data.azimuth!=12 ? this.data.directionDeg : "", //方位角角度 buildingHeight: this.data.buildingHeight ? this.data.buildingHeight : "", //建筑高度 ewLength: this.data.ewLength ? this.data.ewLength : "", //东西长 nsWide: this.data.nsWide ? this.data.nsWide : "", //南北宽 slopeGradient: this.data.roofType == '斜屋顶' ? this.data.slopeGradient : '', //屋面坡度 purlineInterval: this.data.roofType == '斜屋顶' ? this.data.purlineInterval : '', //檀条间距 waterproof: this.data.waterproof, //屋顶防水情况 sourcePollution: this.data.sourcePollution, //是否有污染源 opsCondition: this.data.opsCondition, //是否具备运维空间 voltageClasses: this.data.voltageClasses, //并网电压等级 transformerCapacity: this.data.transformerCapacity, //变压器容量 restrictFlag: this.data.restrictFlag, //是否符合变压器容量限制要求 distance: this.data.distance ? this.data.distance : "", //配电箱至并网点距离 dipAngle: this.data.dipAngle ? this.data.dipAngle : "", //组件倾角 roofArea: this.data.roofArea ? this.data.roofArea : "", //屋顶面积 // shootType: this.data.shootType, //拍摄方式 // houseOwnership: this.data.photo.phoneHouse.length > 0 ? this.data.photo.phoneHouse.map(itm=>itm.name).join(",") : "", //房产证照片 // surveyRecord: this.data.photo.surveyPhoneOne.length > 0 ? this.data.photo.surveyPhoneOne[0].name : "", //踏勘记录表1 // surveyRecord2: this.data.photo.surveyPhoneTwo.length > 0 ? this.data.photo.surveyPhoneTwo[0].name : "", //踏勘记录表2 // roofValue: this.data.photo.phoneVideo.length > 0 ? this.data.photo.phoneVideo[0].name : "", //屋顶视频 //房屋照片 fwImg1: this.data.photo.fwImg1.length > 0 ? this.data.photo.fwImg1.map(itm => itm.name).join(",") : "", //房屋整体图 fwImg2: this.data.photo.fwImg2.length > 0 ? this.data.photo.fwImg2.map(itm => itm.name).join(",") : "", //房屋内部结构图 fwImg3: this.data.photo.fwImg3.length > 0 ? this.data.photo.fwImg3.map(itm => itm.name).join(",") : "", //房屋屋顶东南侧图片 fwImg4: this.data.photo.fwImg4.length > 0 ? this.data.photo.fwImg4.map(itm => itm.name).join(",") : "", //房屋屋顶西南侧图片 fwImg5: this.data.photo.fwImg5.length > 0 ? this.data.photo.fwImg5.map(itm => itm.name).join(",") : "", //遮阴物与房屋距离、高度 flyImgs: this.data.photo.flyImgs.length > 0 ? this.data.photo.flyImgs.map(itm => itm.name).join(",") : "", //无人机航拍图 roofPhotoOne: this.data.photo.roofPhotoOne.length > 0 ? this.data.photo.roofPhotoOne.map(itm => itm.name).join(",") : "", //安装区域整体照片 roofPhotoTwo: this.data.photo.roofPhotoTwo.length > 0 ? this.data.photo.roofPhotoTwo.map(itm => itm.name).join(",") : "", //安装区域东南角照片 roofPhotoThree: this.data.photo.roofPhotoThree.length > 0 ? this.data.photo.roofPhotoThree.map(itm => itm.name).join(",") : "", //安装区域西南角照片 roofPhotoFour: this.data.photo.roofPhotoFour.length > 0 ? this.data.photo.roofPhotoFour.map(itm => itm.name).join(",") : "", //安装区域正南照片 roofPhotoFive: this.data.photo.roofPhotoFive.length > 0 ? this.data.photo.roofPhotoFive.map(itm => itm.name).join(",") : "", //安装区域细节照片 roofPhotoFacade: this.data.photo.roofPhotoFacade.length > 0 ? this.data.photo.roofPhotoFacade.map(itm => itm.name).join(",") : "", //房屋内部结构照片; roofPhotoInterior: this.data.photo.roofPhotoInterior.length > 0 ? this.data.photo.roofPhotoInterior.map(itm => itm.name).join(",") : "", //房屋内部环境照片; detailSupplementOne: this.data.photo.detailSupplementOne.length > 0 ? this.data.photo.detailSupplementOne.map(itm => itm.name).join(",") : "", //逆变器、配电箱预安装位置照片 houseSupplementOne: this.data.photo.houseSupplementOne.length > 0 ? this.data.photo.houseSupplementOne.map(itm => itm.name).join(",") : "", //房屋其他障碍物照片 surveyVideo: this.data.photo.surveyVideo.length > 0 ? this.data.photo.surveyVideo.map(itm => itm.name).join(",") : "", //踏勘补充证明视频 surveyFiles: this.data.photo.surveyFiles.length > 0 ? this.data.photo.surveyFiles.map(itm => itm.name).join(",") : "", //踏勘记录表 houseOwnership: this.data.photo.houseOwnership.length > 0 ? this.data.photo.houseOwnership.map(itm => itm.name).join(",") : "", //房产证 vrRoofOne: this.data.photo.vrRoofOne.length > 0 ? this.data.photo.vrRoofOne.map(itm => itm.name).join(",") : "", //房屋整体图(VR全景) vrRoofTwo: this.data.photo.vrRoofTwo.length > 0 ? this.data.photo.vrRoofTwo.map(itm => itm.name).join(",") : "", //房屋整体俯视图(VR) vrRoofThree: this.data.photo.vrRoofThree.length > 0 ? this.data.photo.vrRoofThree.map(itm => itm.name).join(",") : "", //房屋内部结构图(VR) vrRoofFour: this.data.photo.vrRoofFour.length > 0 ? this.data.photo.vrRoofFour.map(itm => itm.name).join(",") : "", //入户全景照片(VR) houseOutlinePhoto: this.data.photo.houseOutlinePhoto.length > 0 ? this.data.photo.houseOutlinePhoto.map(itm => itm.name).join(",") : "", //房屋轮廓照片(VR) // roofPhotoSix: this.data.photo.roofPhotoSix.length > 0 ? this.data.photo.roofPhotoSix[0].name : "", //补充2 // houseSupplementTwo: this.data.photo.houseSupplementTwo.length > 0 ? this.data.photo.houseSupplementTwo[0].name : "", //房屋补充2 //细节照片 // roofPhotoSeven: this.data.photo.roofPhotoSeven.length > 0 ? this.data.photo.roofPhotoSeven[0].name : "", //障碍物照片 // dimensionsPhotoThickness: this.data.photo.dimensionsPhotoThickness.length > 0 ? this.data.photo.dimensionsPhotoThickness[0].name : "", //楼顶厚度/围墙 // detailSupplementTwo: this.data.photo.detailSupplementTwo.length > 0 ? this.data.photo.detailSupplementTwo[0].name : "", //细节补充2 // filingDocumentPhoto: this.data.photo.filingDocumentPhoto.length > 0 ? this.data.photo.filingDocumentPhoto[0].name : "", //备案文件 // remarks: this.data.remark ? this.data.remark : "", //备注 //方案信息 designDrawings: this.data.photo.designDrawings.length > 0 ? this.data.photo.designDrawings.map(itm => itm.name).join(",") : "", //设计图纸, zjpbImg: this.data.photo.zjpbImg.length > 0 ? this.data.photo.zjpbImg.map(itm => itm.name).join(",") : "", //组件排布图, zjzxImg: this.data.photo.zjzxImg.length > 0 ? this.data.photo.zjzxImg.map(itm => itm.name).join(",") : "", //组件支架图, zjcsImg: this.data.photo.zjcsImg.length > 0 ? this.data.photo.zjcsImg.map(itm => itm.name).join(",") : "", //组件接线图, zjhsImg: this.data.photo.zjhsImg.length > 0 ? this.data.photo.zjhsImg.map(itm => itm.name).join(",") : "", //电气图, // nbqwzImg: this.data.photo.nbqwzImg.length > 0 ? this.data.photo.nbqwzImg[0].name : "", //逆变器位置 // pdxwzImg: this.data.photo.pdxwzImg.length > 0 ? this.data.photo.pdxwzImg[0].name : "", //配电箱位置 // dzImgs: this.data.photo.dzImgs.length > 0 ? this.data.photo.dzImgs.map(itm=>itm.name).join(",") : "", //组合图 schemeType: this.data.schemeType, //设计方案 schemeTypeId: this.data.schemeType == 1 ? this.data.standardSolutionsList[0].typeId ? this.data.standardSolutionsList[0].typeId : "" : "", //当设计方案为标准方案时,传参 schemeTypeName: this.data.schemeType == 1 ? this.data.standardSolutionsList[0].type ? this.data.standardSolutionsList[0].type : "" : "", schemeId: this.data.schemeType == 1 ? this.data.standardSolutionsList[0].id ? this.data.standardSolutionsList[0].id : "" : "", schemeName: this.data.schemeType == 1 ? this.data.standardSolutionsList[0].name ? this.data.standardSolutionsList[0].name : "" : "", schemeRemarks: this.data.solutionRemark ? this.data.solutionRemark : "", //方案备注 zsFlag: this.data.auditStatus ? this.data.auditStatus : "", //审核结果 1通过 2驳回 nodeType: this.data.nodeType ? this.data.nodeType : "",//驳回节点 1勘测 2设计 zsAuditRemarks: this.data.auditRemarks ? this.data.auditRemarks : "",//审核意见 mergeType: this.data.gridType, boxTotalCount: this.data.boxTotalCount, boxGroupId: this.data.boxGroupId, roofFaceThickness: this.data.roofFaceThickness ? this.data.roofFaceThickness : "", //屋面板厚度 structureType: this.data.structureType ? this.data.structureType : "", //结构类型 siteSlope: this.data.siteSlope ? this.data.siteSlope : "", //场地坡度 groundType: this.data.groundType ? this.data.groundType : "", //地面类型 geologicalCondition: this.data.geologicalCondition ? this.data.geologicalCondition : "", //地质情况 fenceHeight: this.data.fenceHeight ? this.data.fenceHeight : "", //围墙高度 windPressure: this.data.windPressure?this.data.windPressure:'', //风压 snowPressure: this.data.snowPressure?this.data.snowPressure:'', //雪压 pressureLevel: this.data.pressureLevel?this.data.pressureLevel:'', //风雪压等级 } if (this.data.id) { CustomerEntry.id = this.data.id } var data = { userId: userId, CustomerEntry: CustomerEntry, } //设计自审暂存 if(flag =='zs'){ if(this.data.auditStatus =='1' || type =='0'){//审核通过或者暂存 updateCustomerEntry(data).then(res=>{ wx.hideLoading(); if (res.code == 200) { wx.showToast({ title: res.msg || "操作成功", icon: 'none', success: function () { setTimeout(function () { //延时返回上一页面 wx.navigateBack() }, 1800) //延迟时间 } }) } else { wx.showToast({ title: res.errMsg, icon: 'none' }) } }); } if(this.data.auditStatus =='2' && type =='1'){//审核驳回并且是保存 if(!this.data.auditRemarks){ wx.showToast({ title: '请输入审核意见', icon: 'none' }) return } auditBack({ userId: userId, id: this.data.id, zsAuditRemarks: that.data.auditRemarks, type: that.data.nodeType, //驳回节点:1.待勘测 2.待设计 }).then((res) => { wx.hideLoading() if (res.code == 200) { wx.showToast({ title: "操作成功", icon: 'none', success: function () { setTimeout(function () { //延时返回上一页面 wx.navigateBack() }, 1800) //延迟时间 } }) } else { wx.showToast({ title: res.errMsg, icon: 'none' }) } }) } return } // wx.hideLoading() console.log("勘测暂存", data) // return //提交设计 if(type == '5'){ surveyToDesign(data).then(res=>{ wx.hideLoading(); if (res.code == 200) { wx.showToast({ title: res.msg || "操作成功", icon: 'none', success: function () { setTimeout(function () { //延时返回上一页面 wx.navigateBack() }, 1800) //延迟时间 } }) } else { wx.showToast({ title: res.errMsg, icon: 'none' }) } }); return } //暂存或提交审核 saveOrEditCustomerEntry(data).then((res) => { wx.hideLoading() if (res.code == 200) { wx.showToast({ title: type == '1' ? res.msg : "操作成功", icon: 'none', success: function () { setTimeout(function () { //延时返回上一页面 wx.navigateBack() }, 1800) //延迟时间 } }) } else { wx.showToast({ title: res.errMsg, icon: 'none' }) } }) }, /** 取消 **/ cancel(e) { wx.showModal({ title: '提示', content: '确定取消?', complete: (res) => { if (res.cancel) {} if (res.confirm) { wx.navigateBack() } } }) }, /** 判断方位角方向 **/ getDirection: function (rotate) { // 计算应偏移度数 let that = this; var area = parseInt(rotate / 90) var detailArea = rotate % 90 if (area == 0) { that.setData({ areaTT: "西偏北", detailAreaTT: 90 - detailArea }) } else if (area == 1) { that.setData({ areaTT: "西偏南", detailAreaTT: detailArea }) } else if (area == 2) { that.setData({ areaTT: "东偏南", detailAreaTT: 90 - detailArea }) } else { that.setData({ areaTT: "东偏北", detailAreaTT: detailArea }) } return that.data.areaTT + that.data.detailAreaTT; }, /** 上传图片之前 **/ beforeRead(e) { const water = e.currentTarget.dataset.water, that = this; const { callback } = e.detail; console.log("上传前", e); // callback(true); // return if (water == '水印') { let that = this; wx.getSystemInfoAsync({ success(rep) { if (rep.platform == 'devtools') { callback(true); } else { callback(true); //指南针监听,手机拍摄 wx.onCompassChange(function (res) { console.log("指针", res); var rotate = 360 - res.direction.toFixed(0) let direction = that.getDirection(rotate) + '°'; that.setData({ direction: direction }); }); setTimeout(() => { wx.stopCompass(); }, 200); } } }); } else { callback(true); } }, /** 上传图片 **/ afteruploadPhotoRead(e) { var that = this; const choseType = Array.isArray(e.detail.file) ? (e.detail.file[0].choseType || undefined) : (e.detail.file.choseType || undefined); //camera相机 album相册 const water = e.currentTarget.dataset.water const name = e.currentTarget.dataset.name console.log("上传后", this.data.direction, choseType, e); // 细节照片添加水印 if (water == '水印') { if (!this.data.name) { wx.showToast({ title: '请输入业主姓名', icon: 'none' }) return } if (!this.data.phone) { wx.showToast({ title: '请输入业主联系电话', icon: 'none' }) return } this.data.data.name = this.data.name this.data.data.phone = this.data.phone if (choseType == 'camera') { //当从相机拍照时,图片添加水印 this.getLocation(e) return } } //身份证明水印 if (water == '身份证明水印') { const tempFilePath = e.detail.file[0].url; //图片路径 const photoName = e.currentTarget.dataset.name; //图片名称 utilAddWatermark2.addWatermark(tempFilePath, this.data).then((src) => { this.data.photo[photoName].push(src) this.setData({ [`photo.${photoName}`]: this.data.photo[photoName] }) }); return; } //无水印上传 if (Array.isArray(e.detail.file)) { //多张 var count = 0; this.afteruploadPhotoReadS(e, count) return } const { file } = e.detail; wx.showLoading({ title: '上传中', }) wx.uploadFile({ url: that.data.API_BASE_URL + 'common/weChat/uploadImage', filePath: file.url, name: 'file', complete: function (res) { console.log("上传图片", res) wx.hideLoading() if (res.statusCode == 200) { wx.showToast({ title: '选择成功', icon: 'none', }) var item = { url: "", name: "", } item.url = file.url; item.name = res.data; that.data.photo[name].push(item) that.setData({ [`photo.${name}`]: that.data.photo[name] }) } else { wx.showToast({ title: '选择失败', icon: 'error' }) } } }) }, /** 上传多张图片递归 **/ afteruploadPhotoReadS(e, count) { let ob = { name: '', url: '', } const name = e.currentTarget.dataset.name wx.showLoading({ title: '加载第' + (count + 1) + '张照片中', mask: true, }) const element = e.detail.file[count]; var that = this; wx.uploadFile({ url: that.data.API_BASE_URL + 'common/weChat/uploadImage', filePath: element.url, name: 'file', success(res) { wx.hideLoading() if (res.statusCode == 200) { count = count + 1; ob.name = res.data ob.url = element.url that.data.photo[name].push(ob); that.setData({ [`photo.${name}`]: that.data.photo[name] }) if (count == e.detail.file.length) { wx.showToast({ title: '选择成功', icon: 'none' }) } else { that.afteruploadPhotoReadS(e, count) } } else { wx.showToast({ title: '选择失败', icon: 'error' }) } } }) }, /** 文件上传多张递归 **/ afteruploadPhotoReadFile(e, file, count, type) { let ob = { name: '', url: '', } const name = e.currentTarget.dataset.name wx.showLoading({ title: '加载第' + (count + 1) + '张照片中', mask: true, }) const element = file[count]; var that = this; var url = '' if(type =='file'){ //获取文件后缀 let suffix = element.path.substring(element.path.lastIndexOf('.') + 1) if (suffix.search(/pdf|dwg/) == -1&&name=='designDrawings') { wx.showToast({ title: '文件格式不正确', icon: 'none' }) return } else if (suffix.search(/jpg|png|jpeg|pdf/) == -1 && name!='designDrawings') { wx.showToast({ title: '只能上传jpg、png、jpeg、pdf文件', icon: 'none' }) return } url = API_BASE_URL + 'common/uploadFile_Name?fileName='+ element.name }else{ url = API_BASE_URL + 'common/weChat/uploadImage' } wx.uploadFile({ url: url, filePath: type =='file'?element.path:element.tempFilePath, name: 'file', success(res) { wx.hideLoading() if (res.statusCode == 200) { count = count + 1; ob.name = type =='file'?JSON.parse(res.data).path: res.data, ob.url = type =='file'?JSON.parse(res.data).path:element.tempFilePath that.data.photo[name].push(ob); that.setData({ [`photo.${name}`]: that.data.photo[name] }) if (count == file.length) { wx.showToast({ title: '选择成功', icon: 'none' }) } else { that.afteruploadPhotoReadFile(e, file, count, type) } } else { wx.showToast({ title: '选择失败', icon: 'error' }) } } }) }, /** 删除图片 **/ deleteImg(e) { const name = e.currentTarget.dataset.name const index = (name != 'surveyFiles' && name != 'designDrawings') ? e.detail.index : e.currentTarget.dataset.index //删除图片的下标 this.data.photo[name].splice(index, 1); this.setData({ [`photo.${name}`]: this.data.photo[name] }) }, /** 上传pdf或图片 **/ upload(e) { var that = this; let name = e.currentTarget.dataset.name; let maxcount = e.currentTarget.dataset.maxcount; console.log(989889889,maxcount, this.data.photo[name].length, maxcount - this.data.photo[name].length) wx.chooseMessageFile({ count: maxcount - this.data.photo[name].length, type: 'all', success(res) { if (Array.isArray(res.tempFiles)) { //多张 var count = 0; that.afteruploadPhotoReadFile(e, res.tempFiles, count, 'file') return } //获取文件后缀/jpg|png|jpeg|pdf|dwg let suffix = res.tempFiles[0].path.substring(res.tempFiles[0].path.lastIndexOf('.') + 1) console.log(989898, name) if (suffix.search(/pdf|dwg/) == -1&&name=='designDrawings') { wx.showToast({ title: '文件格式不正确', icon: 'none' }) return }else if(suffix.search(/jpg|png|jpeg|pdf/) == -1){ wx.showToast({ title: '只能上传jpg、png、jpeg、pdf文件', icon: 'none' }) return } wx.showLoading({ title: '选择中', }) wx.uploadFile({ // url: that.data.API_BASE_URL + 'common/weChat/uploadImage', url: that.data.API_BASE_URL + 'common/uploadFile_Name?fileName=' + res.tempFiles[0].name, filePath: res.tempFiles[0].path, name: 'file', complete: function (res) { wx.hideLoading() if (res.statusCode == 200) { wx.showToast({ title: '选择成功', icon: 'none' }) that.data.photo[name].push({ name: JSON.parse(res.data).path, url: IMG_BASE_URL + JSON.parse(res.data).path }); that.setData({ [`photo.${name}`]: that.data.photo[name] }) } else { wx.showToast({ title: '选择失败', icon: 'none' }) } } }) } }) }, //选择产品编号 bindprojectList(e) { let productZj = this.data.projectList[e.detail.value].assembly_specs ? Number(this.data.projectList[e.detail.value].assembly_specs) : 0; //默认组件值 let componentApiList = this.data.AllComponentApiList.length ? this.data.AllComponentApiList.filter(itm => Number(itm.model) >= productZj) : []; //过滤大于等于productZj的组件列表 this.setData({ projectCode: this.data.projectList[e.detail.value].code, projectName: this.data.projectList[e.detail.value].name, projectId: this.data.projectList[e.detail.value].id, companyName: '', companyId: '', paycycle: this.data.projectList[e.detail.value].pay_cycle, productZj: productZj, //默认组件值 componentApiList: componentApiList, [`componentList[${0}].material_model`]: componentApiList.length ? componentApiList[0].material_model : '', [`componentList[${0}].model`]: componentApiList.length ? componentApiList[0].model : '', [`componentList[${0}].id`]: componentApiList.length ? componentApiList[0].id : '', }) if (this.data.projectList[e.detail.value].filing_type == 1) { this.setData({ filingName: "农户备案", filingType: 1, repaymentMethod: 1, }) } else if (this.data.projectList[e.detail.value].filing_type == 2) { this.setData({ filingName: "项目公司备案", filingType: 2, repaymentMethod: 0, }) } this.getCompanyList(); }, //选择项目公司 bindcompanyList(e) { this.setData({ companyId: this.data.companyList[e.detail.value].id, companyName: this.data.companyList[e.detail.value].name, }) }, //选择备案类型 bindfilingList(e) { this.setData({ filingName: this.data.filingList[e.detail.value], filingType: parseInt(e.detail.value) + 1 }) if (this.data.filingName == "农户备案") { this.setData({ repaymentMethod: 1 }) } }, //选择标准方案类型 bindPlanChange(e) { const index = e.detail.value; //选择第几个 this.data.standardSolutionsList[0].type = this.data.planList[index].name; //方案类型 this.data.standardSolutionsList[0].typeId = this.data.planList[index].id; //方案类型id this.data.standardSolutionsList[0].name = ""; //方案名称 this.data.standardSolutionsList[0].code = ""; //方案编号 this.data.standardSolutionsList[0].nameId = ""; //方案名称Id this.data.standardSolutionsList[0].id = ""; this.setData({ standardSolutionsList: this.data.standardSolutionsList, standardSolutionsListIndex: index, //选择方案类型的下标用以渲染方案名称picker选择器 }) }, //选择标准方案名称 bindPlanNameChange(e) { if (!this.data.standardSolutionsListIndex.toString()) { wx.showToast({ title: '请先选择标准方案类型', icon: 'none' }) return } const index = e.detail.value; //选择第几个 this.data.standardSolutionsList[0].name = this.data.planList[this.data.standardSolutionsListIndex].allPlan[index].name; //方案名称 this.data.standardSolutionsList[0].id = this.data.planList[this.data.standardSolutionsListIndex].allPlan[index].id; //方案名称Id this.setData({ standardSolutionsList: this.data.standardSolutionsList, }) }, //选择组合方案类型 bindCombinationPlanChange(e) { const pickerIndex = e.detail.value; //选择器选择第几个 const index = e.currentTarget.dataset.index; //选择第几个 this.setData({ [`combinedSolutionsList[${index}].type`]: this.data.planList[pickerIndex].name, [`combinedSolutionsList[${index}].planTypeId`]: this.data.planList[pickerIndex].id, [`combinedSolutionsList[${index}].pickerIndex`]: pickerIndex, //选择方案类型的下标用以渲染方案名称picker选择器 [`combinedSolutionsList[${index}].name`]: "", [`combinedSolutionsList[${index}].code`]: "", [`combinedSolutionsList[${index}].id`]: "", }) }, //选择组合方案名称 bindCombinationPlanNameChange(e) { const pickerIndex = e.detail.value; //选择器选择第几个 const cindex = e.currentTarget.dataset.cindex; //选择第几个 const index = e.currentTarget.dataset.index; //选择第几个 for (let i = 0; i < this.data.combinedSolutionsList.length; i++) { const element = this.data.combinedSolutionsList[i]; if (index == i && !element.type) { wx.showToast({ title: '请先选择当前组合方案类型', icon: 'none' }) return } } this.setData({ [`combinedSolutionsList[${index}].id`]: this.data.planList[cindex].allPlan[pickerIndex].id, [`combinedSolutionsList[${index}].name`]: this.data.planList[cindex].allPlan[pickerIndex].name, [`combinedSolutionsList[${index}].code`]: this.data.planList[cindex].allPlan[pickerIndex].code, }) }, //选择组件 bindComponentChange(e) { const pickerIndex = e.detail.value; //选择器选择第几个 const index = e.currentTarget.dataset.index; //选择第几个 var componentNum = 0 componentNum = this.data.componentList[0].num * this.data.componentApiList[pickerIndex].model this.setData({ [`componentList[${index}].material_model`]: this.data.componentApiList[pickerIndex].material_model, [`componentList[${index}].model`]: this.data.componentApiList[pickerIndex].model, [`componentList[${index}].id`]: this.data.componentApiList[pickerIndex].id, componentNum: (componentNum / 1000).toFixed(3) }) }, //选择逆变器 bindConverterChange(e) { const pickerIndex = e.detail.value; //选择器选择第几个 const index = e.currentTarget.dataset.index; //选择第几个 this.setData({ [`converterList[${index}].material_model`]: this.data.converterApiList[pickerIndex].material_model, [`converterList[${index}].model`]: this.data.converterApiList[pickerIndex].model, [`converterList[${index}].id`]: this.data.converterApiList[pickerIndex].id, }) }, //选择并网箱 bindCagesChange(e) { const pickerIndex = e.detail.value; //选择器选择第几个 const index = e.currentTarget.dataset.index; //选择第几个 this.setData({ [`cagesList[${index}].model`]: this.data.cagesApiList[pickerIndex].model, [`cagesList[${index}].id`]: this.data.cagesApiList[pickerIndex].id, }) }, //选择支架 bindSupportChange(e) { const pickerIndex = e.detail.value; //选择器选择第几个 const index = e.currentTarget.dataset.index; //选择第几个 this.setData({ [`supportList[${index}].model`]: this.data.supportApiList[pickerIndex].model, [`supportList[${index}].id`]: this.data.supportApiList[pickerIndex].id, }) }, /** * 选择设计方案 * @param {*} e 1:标准方案 2:组合方案 */ radioChangeSolution(e) { this.setData({ schemeType: e.detail.value == 1 ? 1 : 2, }) }, //审核结果 radioAuditResult(e) { this.setData({ auditStatus: e.detail.value, }) }, //驳回节点 radioRejectNode(e) { this.setData({ nodeType: e.detail.value, }) }, //保险购买情况 bindInsuranceFlag(e) { let index = Number(e.detail.value); this.setData({ insurance: this.data.insuranceList[index], insuranceFlag: index + 1 }) }, //选择预计投放日 bindLeaseDate(e) { this.setData({ leaseDate: e.detail.value }) }, //选择房屋建成年份 bindCompletionYearDate(e) { this.setData({ completionYear: e.detail.value }) }, //选择并网电压等级 bindVoltageClasses(e) { this.setData({ voltageClasses: e.detail.value == 0 ? 220 : 380 }) }, //选择屋顶类型 radioChangeRoofType(e) { this.setData({ roofType: e.detail.value, }) }, //下拉选择 changeSelectVal(e) { let dval = e.detail.value let key = e.currentTarget.dataset.key let list = e.currentTarget.dataset.list this.setData({ [key]: this.data[list][dval].dict_value, }) if(key == 'azimuthName'){ //方位角 this.setData({ azimuth: this.data[list][dval].dict_key, }) } if(this.data.capitalId == '03' && key == 'roofType'){ this.roofTypeToColumn(this.data[list][dval].dict_value) } }, //屋顶类型对应显示字段 roofTypeToColumn(name){ this.data.gfRoofTypeList.forEach(item=>{ if(name == item.roofType){ let selectRoofType = item.forms.map(itm=>{return itm.columns}); let roofTypeAllColumn = {} selectRoofType.forEach(item2=>{ roofTypeAllColumn[item2.column_key] = { status: 1, must_fill_flag: item2.must_fill_flag } }) // console.log(555, roofTypeAllColumn) this.setData({ roofTypeAllColumn }) } }) }, //选择是否封屋顶 radioSealRoof(e) { this.setData({ sealRoof: e.detail.value, }) }, //选择屋顶防水情况 radioWaterproof(e) { this.setData({ waterproof: e.detail.value, }) }, //选择是否有污染源 radioSourcePollution(e) { this.setData({ sourcePollution: e.detail.value, }) }, //选择是否具备运维空间 radioOpsCondition(e) { this.setData({ opsCondition: e.detail.value, }) }, //选择是否符合变压器容量限制要求 radioRestrictFlag(e) { this.setData({ restrictFlag: e.detail.value, }) }, //选择拍摄方式 // radioChangeShooting(e) { // this.setData({ // shootType: e.detail.value == 1 ? 1 : 2, // capture:e.detail.value == 1 ? ['album', 'camera'] : ['camera'],//1.无人机拍摄 2.手机拍摄 // }) // }, //选择方位角 // radioChangeAzimuth(e) { // if (e.detail.value == 1) { // this.setData({ // azimuth: 1 // }) // } else if (e.detail.value == 2) { // this.setData({ // azimuth: 2 // }) // } else if (e.detail.value == 3) { // this.setData({ // azimuth: 3 // }) // } // }, //选择划转方式 radioChangeRepaymentMethod(e) { this.setData({ repaymentMethod: e.detail.value }) }, /** * 输入组件,逆变器,并网箱的数量 * @param {*} e 1:组件 2:逆变器 3:并网箱 */ inputNum(e) { switch (e.currentTarget.dataset.type) { case "1": this.setData({ [`componentList[${e.currentTarget.dataset.index}].num`]: e.detail.value, }) var componentNum = 0 for (let i = 0; i < this.data.componentList.length; i++) { const element = this.data.componentList[i]; componentNum = element.num * element.model } this.setData({ componentNum: (componentNum / 1000).toFixed(2) }) break; case "2": this.setData({ [`converterList[${e.currentTarget.dataset.index}].num`]: e.detail.value, }) break; case "3": this.setData({ [`cagesList[${e.currentTarget.dataset.index}].num`]: e.detail.value, }) break; case "4": this.setData({ [`supportList[${e.currentTarget.dataset.index}].num`]: e.detail.value, }) break; } }, //新增方案 addSolution(e) { const list = [{ type: "", //方案类型 name: "", //方案名称 id: "", //方案ID code: "", //方案编号 pickerIndex: 0, //方案类型选择下标 drawing: "", //参考图纸 }] var demo = this.data.combinedSolutionsList.concat(list) this.setData({ [`combinedSolutionsList[${demo.length-1}]`]: demo[demo.length - 1] }) }, //删除方案 deleteSolution(e) { wx.showModal({ title: '提示', content: '确定删除当前方案?', complete: (res) => { if (res.confirm) { this.data.combinedSolutionsList.splice(e.currentTarget.dataset.index, 1) this.setData({ combinedSolutionsList: this.data.combinedSolutionsList }) } } }) }, /** * 新增型号 * @param {*} e 1:组件 2:逆变器 3:并网箱 */ add(e) { const list = { id: "", num: "", name: "", } switch (e.currentTarget.dataset.type) { case "1": this.setData({ componentList: this.data.componentList.concat(list) }) break; case "2": this.setData({ converterList: this.data.converterList.concat(list) }) break; case "3": this.setData({ cagesList: this.data.cagesList.concat(list) }) case "4": this.setData({ supportList: this.data.supportList.concat(list) }) break; } }, /** * 删除型号 * @param {*} e 1:组件 2:逆变器 3:并网箱 */ delete(e) { wx.showModal({ title: '提示', content: '确定删除?', complete: (res) => { if (res.confirm) { switch (e.currentTarget.dataset.type) { case "1": this.data.componentList.splice(e.currentTarget.dataset.index, 1) this.setData({ componentList: this.data.componentList }) break; case "2": this.data.converterList.splice(e.currentTarget.dataset.index, 1) this.setData({ converterList: this.data.converterList, }) break; case "3": this.data.cagesList.splice(e.currentTarget.dataset.index, 1) this.setData({ cagesList: this.data.cagesList, }) case "4": this.data.supportList.splice(e.currentTarget.dataset.index, 1) this.setData({ supportList: this.data.supportList, }) break; } } } }) }, //获取用户当前地理位置后为照片添加水印 getLocation(e) { if (this.data.customerAddress && this.data.imageCodeImg) { //有地址,有导航二维码图,直接绘制图片 this.chooseImages(e); return; } utilGetLocation.getLocationAddress().then((res) => { res.res.data = res.res.data.slice(res.res.data.lastIndexOf('省') + 1) this.setData({ customerAddress: res.res.data, canvasLongitude: res.resLocation.longitude, canvasLatitude: res.resLocation.latitude, }); //获取小程序二维码 let lonLat = res.resLocation.longitude + ',' + res.resLocation.latitude; createQrcode({ content: lonLat }).then(ret => { // let codeImg ="data:image/png;base64," + ret; let codeImg = IMG_BASE_URL + ret; this.setData({ imageCodeImg: codeImg }); this.chooseImages(e) }); }) }, //获取当前位置信息 位置信息转经纬度 getNowLocationDetails: utils.debounce(function (e) { var that = this if (that.data.provinceName && that.data.address) { wx.showModal({ content: '即将获取您当前所在位置的经纬度,请确认您已到达电站安装位置。', complete: (res) => { if (res.confirm) { that.getNowLocation() } } }) } }), /** * * 获取当前位置信息 经纬度转位置信息 * * @param {*} e */ getNowLocation(e) { var that = this wx.getLocation({ type: 'wgs84', isHighAccuracy: true, success(res) { console.log("获取经纬", res) wx.showLoading({ title: '获取定位中', }) if(res.longitude && res.latitude){ wx.hideLoading() that.setData({ longitude: res.longitude.toFixed(6), latitude: res.latitude.toFixed(6), longitudeAndLongitude: res.longitude.toFixed(6) + "," + res.latitude.toFixed(6) }) } }, fail(res) { wx.showModal({ title: '提示', content: '请授权当前小程序定位权限', cancelText: "取消", confirmText: "确定", success(res) { if (res.confirm) { wx.openSetting({ withSubscriptions: true, }) } } }) } }) }, //根据地址获取经纬度 getAddressLonLat() { var that = this wx.showLoading({ title: '加载中', }) getAddressLonLat({ address: that.data.region[0] + that.data.region[1] + that.data.region[2] + that.data.address }).then((res) => { wx.hideLoading() if (res.code == 200) { if (res.data) { var data = res.data.split(",") that.setData({ longitude: data[0], latitude: data[1], longitudeAndLongitude: data[0] + "," + data[1] }) } } else { wx.showToast({ title: '获取经纬度失败', icon: 'none' }) } }) }, //选择图片为图片添加水印 async chooseImages(e) { const photoName = e.currentTarget.dataset.name; //图片名称 const tempFilePath = e.detail.file.url || e.detail.file[0].url //图片路径 const canvasWidth = wx.getSystemInfoSync().screenWidth; // 获取图片信息 await wx.getImageInfo({ src: tempFilePath, }).then(async res => { let watermarkScale = res.width / canvasWidth; this.setData({ canvasHeight: Math.round(res.height / watermarkScale), canvasWidth: canvasWidth, }) await utilAddWatermark.addWatermark(tempFilePath, photoName, this.data).then((res) => { this.data.photo[photoName].push(res) this.setData({ [`photo.${photoName}`]: this.data.photo[photoName] }) }) }) }, //打开pdf文件或者大图查看图片 openDocument(res) { let path = res.currentTarget.dataset.path if (path) { let suffix = path.substring(path.lastIndexOf('.') + 1) //获取文件后缀 if(suffix=='mp4'){// 开始预览多媒体内容 wx.previewMedia({ sources: [{ url :IMG_BASE_URL + path, type: 'video' }], // 需要预览的资源列表 }); }else if(suffix != 'jpg' && suffix != 'png' && suffix != 'gif' && suffix != 'jpeg') { wx.showLoading({ title: '加载中', }) wx.downloadFile({ url: IMG_BASE_URL + path, complete: function (res) { wx.hideLoading() const filePath = res.tempFilePath wx.openDocument({ filePath: filePath, fileType: suffix, showMenu: true, success: function (res) {} }) } }) }else{ wx.previewImage({ urls: [IMG_BASE_URL + path] // 需要预览的图片http链接列表 }) } } }, //拨打业主联系电话 phoneFn(e) { const phone = e.currentTarget.dataset.phone; if (!phone) { wx.showToast({ title: '暂无联系方式', icon: 'none' }) return } wx.makePhoneCall({ phoneNumber: phone, }) }, //业主信息 userFn(e) { wx.navigateTo({ url: '/home/pages/ownerForm/ownerForm?projectId=' + this.data.entryId + '&type=3', }) }, /** 填充所有图片 **/ imageAll(e) { var that = this wx.showModal({ title: '提示', content: '确定选取图片后填充所有图片?', complete: (res) => { if (res.confirm) { wx.chooseMedia({ count: 1, mediaType: ['image'], success(resImage) { wx.showLoading({ title: '选择中', }) wx.uploadFile({ url: API_BASE_URL + 'common/weChat/uploadImage', filePath: resImage.tempFiles[0].tempFilePath, name: 'file', complete: function (res) { wx.hideLoading() if (res.statusCode == 200) { for (let i in that.data.photo) { let arr = []; arr.push({ name: res.data, url: IMG_BASE_URL + res.data }); that.setData({ [`photo.${i}`]: arr, }) } wx.showToast({ title: '填充成功', icon: 'none' }) } else { wx.showToast({ title: '填充失败', icon: 'none' }) } } }) } }) } } }) }, /** 打开省市区弹框 **/ bindRegionChange(e) { this.setData({ showRegion: true }) }, /** 选择的地址 **/ chooseRegion(e) { this.setData({ provinceName: e.detail.provinceName, cityName: e.detail.cityName, areaName: e.detail.areaName, address: "", projectId: '', projectCode: '', projectName: '', paycycle: '', filingName: '', companyName: '', companyId: '', companyList:[] }) this.getProjectList(); this.getCompanyList(); this.getPressure(e.detail.provinceName, e.detail.cityName, e.detail.areaName) //获取风雪压等级 }, /** 开卡 **/ bankCardPage(e) { //bankFlag 开卡标记:1.可开卡 2.不可开卡 wx.showLoading({ title: '加载中', }) bankCardPage({ entryId: this.data.entryId }).then((resApi) => { wx.hideLoading() console.log("开卡web", resApi) if (resApi.code == 200) { wx.navigateTo({ url: '../webView/webView', success: function (res) { // 通过eventChannel向被打开页面传送数据 res.eventChannel.emit('acceptDataFromOpenerPage', { data: resApi.data.gdUrl }) } }) } else { wx.showToast({ title: resApi.errMsg, icon: 'none' }) } }) }, /** 文件或图片上传选择-对话框 **/ selectUplosd(e){ var that = this; let name = e.currentTarget.dataset.name; let maxcount = e.currentTarget.dataset.maxcount; wx.showActionSheet({ itemList: ['文件', '图片'], success: function (res) { if (!res.cancel) { if (res.tapIndex == 0) {//文件 that.upload(e); } else if (res.tapIndex == 1) {//图片 wx.chooseMedia({ count: maxcount - that.data.photo[name].length, mediaType: ['image'], sourceType: ['album'], success: function (rep) { if (Array.isArray(rep.tempFiles)) { //多张 var count = 0; that.afteruploadPhotoReadFile(e, rep.tempFiles, count) return } wx.showLoading({ title: '选择中', }) wx.uploadFile({ url: API_BASE_URL + 'common/weChat/uploadImage', filePath: rep.tempFiles[0].tempFilePath, name: 'file', complete: function (res) { wx.hideLoading() if (res.statusCode == 200) { wx.showToast({ title: '选择成功', icon: 'none', }) var item = { url: "", name: "", } item.url = rep.tempFiles[0].tempFilePath; item.name = res.data; that.data.photo[name].push(item) that.setData({ [`photo.${name}`]: that.data.photo[name] }) } else { wx.showToast({ title: '选择失败', icon: 'error' }) } } }) }, fail: function(){}, }); } } } }); }, //选择并网方式 radioChangeGridType(e) { let detail = this.data.detail this.setData({ gridType: e.detail.value, }) if(e.detail.value == '1'){//一户多站选项 if(detail.recordBoxHistory && detail.recordBoxHistory != ''){//有历史记录取历史数据 if(detail.recordBoxHistory.type == '1'){//判断是不是一户多站的数据,type=1 this.setData({ boxTotalCount: detail.recordBoxHistory.total_count?detail.recordBoxHistory.total_count:'', boxGroupNum: detail.recordBoxHistory.group_number?detail.recordBoxHistory.group_number:'', boxGroupName: detail.recordBoxHistory.group_name?detail.recordBoxHistory.group_name:'', }) }else{//type不是1,则取一户多站字段 this.setData({ boxTotalCount: detail.oneToAnyBoxSet.total_count?detail.oneToAnyBoxSet.total_count:'', boxGroupNum: detail.oneToAnyBoxSet.group_number?detail.oneToAnyBoxSet.group_number:'', boxGroupName: detail.oneToAnyBoxSet.group_name?detail.oneToAnyBoxSet.group_name:'', boxGroupId: detail.oneToAnyBoxSet.id?detail.oneToAnyBoxSet.id:'', }) } }else{//没有历史记录,oneToAnyBoxSet取原有数据 this.setData({ boxTotalCount: detail.oneToAnyBoxSet.total_count?detail.oneToAnyBoxSet.total_count:'', boxGroupNum: detail.oneToAnyBoxSet.group_number?detail.oneToAnyBoxSet.group_number:'', boxGroupName: detail.oneToAnyBoxSet.group_name?detail.oneToAnyBoxSet.group_name:'', boxGroupId: detail.oneToAnyBoxSet.id?detail.oneToAnyBoxSet.id:'', }) } }else if(e.detail.value == '2' && detail.recordBoxHistory != ''){//整村汇流选项 if(detail.recordBoxHistory && detail.recordBoxHistory != '' && detail.recordBoxHistory.type == '2'){//有历史数据 this.setData({ boxTotalCount: detail.recordBoxHistory.total_count?detail.recordBoxHistory.total_count:'', boxGroupNum: detail.recordBoxHistory.group_number?detail.recordBoxHistory.group_number:'', boxGroupName: detail.recordBoxHistory.group_name?detail.recordBoxHistory.group_name:'', }) }else{//没有历史数据,全清空 this.setData({ boxTotalCount: '', boxGroupNum: '', boxGroupName: '', }) } }else{//单户并网选项 this.setData({ boxTotalCount: '', boxGroupNum: '', boxGroupName: '', }) } }, //打开选择汇流组 goConverge(e){ wx.navigateTo({ url: '/home/pages/converge/converge?projectId='+this.data.entryId, }) } })