diff --git a/index.html b/index.html index 0f5a974..d9b3969 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,7 @@ rel="stylesheet" href="http://223.220.58.86:6081/arcgis_js_v329_api/arcgis_js_api/library/3.29/3.29/esri/css/esri.css" /> - + diff --git a/index.html b/index.html index 0f5a974..d9b3969 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,7 @@ rel="stylesheet" href="http://223.220.58.86:6081/arcgis_js_v329_api/arcgis_js_api/library/3.29/3.29/esri/css/esri.css" /> - + diff --git a/src/components/ConfigManager/RtuConfig.vue b/src/components/ConfigManager/RtuConfig.vue index 79d6aab..2ef7853 100644 --- a/src/components/ConfigManager/RtuConfig.vue +++ b/src/components/ConfigManager/RtuConfig.vue @@ -1,17 +1,20 @@ + @@ -421,8 +446,11 @@ data() { return { querySite:'', - rtuCode:'', + stCode:'', + rtuHistoryId:'', + hexRtuCode:'', querySiteList:[], + rtuHistoryList:[], siteNameList:['遥测站设置','中心站设置','传感器型号选择','气象传感通信设置','工业相机设置','水文传感通信','从机设置', '数据滤波','水位计','雨量计','流量计','蒸发皿','土壤沉降仪','4-20mA设置','其他设置'], formAll:[], @@ -432,38 +460,206 @@ rules: {} }; }, - mounted() {}, - watch:{ - 'formAll': { - handler(newValue, oldValue) { - console.log(newValue,newValue[0].form1.rtuhour,'obj.a changed'); - if(newValue[0].form1.rtuhour){ - // rtuStationType - this.formAllBody['1'].data.forEach((item,index,arr)=>{ - if(item.fieldIdentifier === 'rtuStationType'){ - console.log(555) - // arr[index].selectOption='河道' - } - }) - } - }, - deep: true - } + // computed:{ + // rtuDtu(){ + // return this.formAll[0].form1.rtuOutDtu; + // } + // }, + // watch:{ + // 'rtuDtu':{ + // handler(newValue, oldValue) { + // console.log('this.formAll[0].form1.rtuOutDtu') + // }, + // deep:true + // } + // }, + mounted() { + // console.log(this.formAll,this.formAllBody,'this.formAll[0]') + //// 第一个函数就是处理你要监听的属性,只要将其return出去就行 + this.$watch( + function () { + return this.formAll[0].form1.rtuOutDtu; + }, + function (newVal, oldVal) { + this.formAllBody['1'].forEach((item,index,arr)=>{ + if(item.name === '外置DTU设置'){ + arr[index].isShow =newVal; + } + }) + // switch(newVal){ + // case false: + // console.log(11); + // break; + // case true: + // console.log(22); + // break; + // } + } + ) + this.$watch( + function () { + return this.formAll[0].form1.rtuInnerMode; + }, + function (newVal, oldVal) { + this.formAllBody['1'].forEach((item,index,arr)=>{ + if(item.name === '内置LoRa相关配置'){ + arr[index].isShow = newVal === 'LORA' ? true : false; + } + }) + this.formAllBody['2'].forEach((item,index,arr)=>{ + if(item.name === '中心站1'){ + arr[index].isShow = newVal === 'GPRS' ? true : false; + } + if(item.name === '中心站2'){ + arr[index].isShow = newVal === 'GPRS' ? true : false; + } + if(item.name === '中心站3'){ + arr[index].isShow = newVal === 'GPRS' ? true : false; + } + if(item.name === '中心站4(备份站)'){ + arr[index].isShow = newVal === 'GPRS' ? true : false; + } + }) + } + ) + // this.$watch( + // function () { + // return this.formAll[0].form1.rtuother_dtu_type; + // }, + // function (newVal, oldVal) { + // let targetArr = [[true,true,true,false,false],[true,true,false,false,false],[false,false,false,false,true],[false,false,false,false,false]] + // // let select= ['JoinEUI','频率格式','上行频率','下行频率','电信NB服务ID'] + // let strArr= ['JoinEUI','频率格式','上行频率','下行频率','电信NB服务ID'] + // let _this = this + // let caseFun = function(newValIndex,strArr,targetArr){ + // console.log(_this.formAllBody['1'],88888) + // _this.formAllBody['0'].form1.forEach((item,index,arr)=>{ + // if(item.name === '外置DTU设置'){ + // item.data.forEach((item,index,arr)=>{ + // for(let i = 0;i{ + // // // if(item.name && item.name === '外置DTU设置'){ + // // // item.data.forEach((item,index,arr)=>{ + // // // for(let i = 0;i{ + // // if(item.name === '内置LoRa相关配置'){ + // // arr[index].isShow = newVal === 'LORA' ? true : false; + // // } + // // }) + // } + // ) + // bottom }, + // watch:{ + // // 'formAll[0].form1.rtuOutDtu':{ + // // handler(){ + // // console.log(888) + // // }, + // // deep:true + // // }, + // // 'formAll': { + // // handler(newValue, oldValue) { + // // console.log(newValue,this.formAllBody,'obj.a changed'); + // // if(newValue[0].form1.rtuOutDtu ===true){ + // // // rtuStationType + // // // console.log(this.formAllBody['1'][0].data,555) + // // this.formAllBody['1'][0].data.forEach((item,index,arr)=>{ + // // if(item.fieldIdentifier === 'rtuStationType'){ + // // // console.log(555) + // // arr[index].selectOption='降水,河道,水库(湖泊),闸坝,泵站,潮汐,墒情,地下水,水质,取水口,排水口' + // // } + // // }) + // // this.formAllBody['1'].forEach((item,index,arr)=>{ + // // if(item.name === '外置DTU设置'){ + // // // console.log(555) + // // arr[index].isBlock= newValue[0].form1.rtuOutDtu; + // // } + // // }) + // // }else if(newValue[0].form1.rtuOutDtu === false){ + // // this.formAllBody['1'][0].data.forEach((item,index,arr)=>{ + // // if(item.fieldIdentifier === 'rtuStationType'){ + // // // console.log(555) + // // arr[index].selectOption='水质,取水口,排水口' + // // } + // // }) + // // this.formAllBody['1'].forEach((item,index,arr)=>{ + // // if(item.name === '外置DTU设置'){ + // // // console.log(555) + // // arr[index].isBlock= newValue[0].form1.rtuOutDtu; + // // } + // // }) + // // // arr[index].selectOption='降水,河道,水库(湖泊),闸坝,泵站,潮汐,墒情,地下水,水质,取水口,排水口' + // // // console.log(666) + // // } + // // }, + // // deep: true + // // } + // }, methods: { switchChange(val){ - console.log(val,this.formAll[0].form1,'change') + // console.log(val,this.formAll[0].form1,'change') }, switchClick(val){ console.log(val,'click') }, echoClick() { + // 根据站点回显 this.formAll = []; this.activeIndex = "0"; + this.getSiteList(); this.initPage(this.querySite); // this.handleSelect(0) // console.log(this.activeIndex) }, + echoRtuHistory() { + // 根据站点和历史id,回显 + this.formAll = []; + this.activeIndex = "0"; + this.initPage2(); + // this.handleSelect(0) + // console.log(this.activeIndex) + }, temStorageEcho() { // this.activeIndex = '0' if(localStorage.getItem(name)){ @@ -493,7 +689,7 @@ if (valid) { successCount++; } else { - // this.$message({message: `${this.siteNameList[i]} 校验失败,请查看`,type: "warning"}); + this.$message({message: `${this.siteNameList[i]} 校验失败,请查看`,type: "warning"}); // alert(`${this.siteNameList[i]} 校验失败,请查看`); // this.$notify({ // title: '警告', @@ -504,10 +700,11 @@ // return false; } }); - // if(successFlag){ - // return false - // } + if(successFlag){ + return false + } } + console.log(this.stCode,'form6Inputform6Input9999999') if (successCount === this.siteNameList.length) { this.$message({ message: "表单全部校验成功", type: "success" }); } else { @@ -516,7 +713,8 @@ // 组装数据需要的属性,暂时是死值,也可以循环出来 const parmas = { data: { - rtuCode: this.rtuCode, + stCode: this.stCode, + hexRtuCode: this.hexRtuCode, rtuTelemeteringStationSetting: this.formAll[0].form1, rtuCentreSetting: this.formAll[1].form2, rtuSenseTypeSetting: this.formAll[2].form3, @@ -574,9 +772,9 @@ "rtushuiwen_chenjiangarrboolean" ); dealInputSwitch("rtushuiwen_zhaweiarrInt", "rtushuiwen_zhaweiarrboolean"); - let rtuAddUpTimes = parmas.data["rtuTelemeteringStationSetting"][ - "rtuAddUpTimes" - ].sort((item1, item2) => item1 - item2); + // let rtuAddUpTimes = parmas.data["rtuTelemeteringStationSetting"][ + // "rtuAddUpTimes" + // ].sort((item1, item2) => item1 - item2); let rtucamera_jiabao = parmas.data["rtuIndustrialCameraSetting"][ "rtucamera_jiabao" ].sort((item1, item2) => item1 - item2); @@ -584,25 +782,25 @@ let rtucamera_jiabaoNew = []; // console.log(rtuAddUpTimes,'rtuAddUpTimes') for (var i = 0; i < 24; i++) { - rtuAddUpTimesNew.push(0); + // rtuAddUpTimesNew.push(0); rtucamera_jiabaoNew.push(0); } - rtuAddUpTimes.forEach((item, index) => { - rtuAddUpTimesNew[item] = 1; - }); + // rtuAddUpTimes.forEach((item, index) => { + // rtuAddUpTimesNew[item] = 1; + // }); rtucamera_jiabao.forEach((item, index) => { rtucamera_jiabaoNew[item] = 1; }); - parmas.data["rtuTelemeteringStationSetting"][ - "rtuAddUpTimes" - ] = rtuAddUpTimesNew; + // parmas.data["rtuTelemeteringStationSetting"][ + // "rtuAddUpTimes" + // ] = rtuAddUpTimesNew; parmas.data["rtuIndustrialCameraSetting"][ "rtucamera_jiabao" ] = rtucamera_jiabaoNew; - // this.$http.post(`${this.nozzle.rTUSettingServiceUpdate}`,parmas).then(res=>{ - // // console.log(res,'rTUSettingServiceUpdate') - // this.echoClick() - // }) + this.$http.post(`${this.nozzle.rTUSettingServiceUpdate}`,parmas).then(res=>{ + // console.log(res,'rTUSettingServiceUpdate') + this.echoClick() + }) // console.log(parmas,'form6Inputform6Input') // this.formAll=[] // this.initPage(this.querySiteList[1]) @@ -642,11 +840,18 @@ selectChange(val) { // console.log(val,'val') this.echoClick(val); + this.getRtuHistoryList() + }, + selectRtuHistoryId(val) { + console.log(val,'selectRtuHistoryId') + // this.echoClick(val); }, async initPage(site) { + // 切换站点后去请求历史下拉框 + this.getRtuHistoryList() // 回显接口请求数据 将水文传感里面3处特殊的控件需要的值,用请求数据遍历生成表单需要的字段,因为这3处的动态表单使用的是死的字段,其他的对应的表单数据赋值给对应表单就能回显了、 let resFirst = await this.$http.post( - `${this.nozzle.rTUSettingServiceQueryById}?code=${site}` + `${this.nozzle.rTUSettingServiceQueryById}?stCode=${site}` ); let resData = resFirst.data.data; let formArr = [ @@ -666,9 +871,10 @@ "rtu4To20Setting", "rtuOtherSetting" ]; - console.log(this.formAll,resData,'ressssss') + // console.log(this.formAll,resData,'ressssss') // this.formAll={} - this.rtuCode = resData.rtuCode; + this.stCode = resData.stCode; + this.hexRtuCode = resData.hexRtuCode; for (let i = 1; i <= 15; i++) { let obj = {}; // 水文传感里是第6个表单 @@ -742,7 +948,110 @@ } // 表单数据赋值完成,控制表单切换的formshow,也放在一起了 this.formAll.push(obj); - // console.log(this.formAll,this.rtuCode,'this.formAll') + // console.log(this.formAll,this.stCode,'this.formAll') + } + }, + async initPage2() { + // 回显接口请求数据 将水文传感里面3处特殊的控件需要的值,用请求数据遍历生成表单需要的字段,因为这3处的动态表单使用的是死的字段,其他的对应的表单数据赋值给对应表单就能回显了、 + let resFirst = await this.$http.post( + `${this.nozzle.RTUVersionRevert}?stCode=${this.querySite}&id=${this.rtuHistoryId}` + ); + let resData = resFirst.data.data; + let formArr = [ + "rtuTelemeteringStationSetting", + "rtuCentreSetting", + "rtuSenseTypeSetting", + "rtuMeteorologicalSensingCommunicationSetting", + "rtuIndustrialCameraSetting", + "rtuHydrologicSensingCommunication", + "rtuSlaveSetting", + "rtuDataFilter", + "rtuWaterLevelSetting", + "rtuRainSetting", + "rtuFlowmeterSetting", + "rtuEvaporatingDishSetting", + "rtuSoilSettler", + "rtu4To20Setting", + "rtuOtherSetting" + ]; + console.log(this.formAll,resData,'ressssss') + // this.formAll={} + this.stCode = resData.stCode; + this.hexRtuCode = resData.hexRtuCode; + for (let i = 1; i <= 15; i++) { + let obj = {}; + // 水文传感里是第6个表单 + if (i !== 6 && i !== 5) { + obj[`form${i}`] = resData[formArr[i - 1]]; + } + // else if (i === 1) { + // var formObj = Object.assign({},resData[formArr[i - 1]]); + // var rtuAddUpTimesNew = []; + // if (!formObj.hasOwnProperty("rtuAddUpTimes")) { + // return; + // } + // formObj.rtuAddUpTimes.forEach((res, index) => { + // if (res === 1) { + // rtuAddUpTimesNew.push(index); + // } + // }); + // // form1Obj.hasOwnProperty('rtuAddUpTimes') + // formObj.rtuAddUpTimes = rtuAddUpTimesNew; + // // console.log(form1Obj,'form1Obj') + // obj[`form${i}`] = formObj; + // } + else if (i === 5) { + let formObj = Object.assign({},resData[formArr[i - 1]]); + let rtucamera_jiabaoNew = []; + if (!formObj.hasOwnProperty("rtucamera_jiabao")) { + return; + } + formObj.rtucamera_jiabao.forEach((res, index) => { + if (res === 1) { + rtucamera_jiabaoNew.push(index); + } + }); + formObj.rtucamera_jiabao = rtucamera_jiabaoNew; + // console.log(form1Obj,'form1Obj') + obj[`form${i}`] = formObj; + } else if (i === 6) { + var form6Obj = resData[formArr[i - 1]]; + // 每一处需要input switch各8个共16个模拟字段,只处理第6个表单 + function creatInputSwitch(str, strBool) { + if ( + form6Obj.hasOwnProperty(str) && + form6Obj.hasOwnProperty(strBool) + ) { + for (let i = 0; i < 8; i++) { + form6Obj[`${str}input${i}`] = form6Obj[str][i]; + form6Obj[`${str}switch${i}`] = form6Obj[strBool][i]; + } + delete form6Obj[str]; + delete form6Obj[strBool]; + } + } + creatInputSwitch( + "rtushuiwen_shangqingarrInt", + "rtushuiwen_shangqingarrboolean" + ); + creatInputSwitch( + "rtushuiwen_chenjiangarrInt", + "rtushuiwen_chenjiangarrboolean" + ); + creatInputSwitch( + "rtushuiwen_zhaweiarrInt", + "rtushuiwen_zhaweiarrboolean" + ); + obj[`form${i}`] = form6Obj; + } + if (i !== 1) { + obj[`form${i}Show`] = false; + } else { + obj[`form${i}Show`] = true; + } + // 表单数据赋值完成,控制表单切换的formshow,也放在一起了 + this.formAll.push(obj); + // console.log(this.formAll,this.stCode,'this.formAll') } }, validatorAll(rule, value, callback, type, sug, alart) { @@ -864,7 +1173,7 @@ var newObj = []; // 根据小标题去重 uniq(sub_titleList).forEach(item => { - var obj = { name: item, data: [] }; + var obj = { name: item, data: [], isShow:true, isBlock:true }; var data = dataRes[i].forEach(l => { if ( l.subTitle === item && @@ -894,14 +1203,27 @@ .then(res => { // console.log(res.data.data,'resss') this.querySiteList = res.data.data; - this.querySite = this.querySiteList[0]; + this.querySite = this.querySiteList[0].rtuStationCode; + }); + }, + async getRtuHistoryList() { + await this.$http + //`${this.nozzle.queryRTUSettingHistory}?stCode=${this.querySite}` + .post(`${this.nozzle.queryRTUSettingHistory}?stCode=${this.querySite}`) + .then(res => { + // console.log(res.data,'resss') + this.rtuHistoryList = res.data.data; + // this.querySite = this.querySiteList[0].rtuStationCode; }); } }, created(){ this.getSiteList().then(res=>{ - this.initPage(this.querySiteList[0]); + // this.querySiteList[0].rtuStationCode + this.initPage(this.querySite); + this.getRtuHistoryList() }); + this.formControl(); // console.log(666) }, @@ -931,6 +1253,15 @@ width: 100%; /* background-color: #fff; */ } + .filter-content{ + text-align:left;padding:10px;position:relative; + .rtu-history-box{ + padding: 10px 0 0 0; + position: absolute; + right: 100px; + top: 0; + } + } .switchContent { // color: rgb(99, 96, 96); color: red; @@ -938,7 +1269,7 @@ /* background-color: #fff; */ // color: white !important; - padding: 2%; + padding: 2% 0 0 0; /deep/ .el-form{ .el-col{ height: 51px!important; @@ -1030,8 +1361,30 @@ } } + .rowClass:nth-child(2n+1){ + background-color: rgba( 245,222,179,0.3); + box-shadow: rgba(144,147,153, 0.32) 0px 2px 4px 0px; + } .rowClass:nth-child(2n){ background-color: rgba(144,147,153,0.3); + box-shadow: rgba(144,147,153, 0.32) 0px 2px 4px 0px; + } + .rowClass.control-show{ + // background-color: #fff; + // cursor: pointer; + background-color: #ccc; + pointer-events: none; + border: 1px solid pink; + box-sizing: border-box; + // .control-show{ + // } + } + .stop { + background-color: #ccc; + pointer-events: none; + .el-input__suffix-inner{ + pointer-events: none; + } } } diff --git a/index.html b/index.html index 0f5a974..d9b3969 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,7 @@ rel="stylesheet" href="http://223.220.58.86:6081/arcgis_js_v329_api/arcgis_js_api/library/3.29/3.29/esri/css/esri.css" /> - + diff --git a/src/components/ConfigManager/RtuConfig.vue b/src/components/ConfigManager/RtuConfig.vue index 79d6aab..2ef7853 100644 --- a/src/components/ConfigManager/RtuConfig.vue +++ b/src/components/ConfigManager/RtuConfig.vue @@ -1,17 +1,20 @@ + @@ -421,8 +446,11 @@ data() { return { querySite:'', - rtuCode:'', + stCode:'', + rtuHistoryId:'', + hexRtuCode:'', querySiteList:[], + rtuHistoryList:[], siteNameList:['遥测站设置','中心站设置','传感器型号选择','气象传感通信设置','工业相机设置','水文传感通信','从机设置', '数据滤波','水位计','雨量计','流量计','蒸发皿','土壤沉降仪','4-20mA设置','其他设置'], formAll:[], @@ -432,38 +460,206 @@ rules: {} }; }, - mounted() {}, - watch:{ - 'formAll': { - handler(newValue, oldValue) { - console.log(newValue,newValue[0].form1.rtuhour,'obj.a changed'); - if(newValue[0].form1.rtuhour){ - // rtuStationType - this.formAllBody['1'].data.forEach((item,index,arr)=>{ - if(item.fieldIdentifier === 'rtuStationType'){ - console.log(555) - // arr[index].selectOption='河道' - } - }) - } - }, - deep: true - } + // computed:{ + // rtuDtu(){ + // return this.formAll[0].form1.rtuOutDtu; + // } + // }, + // watch:{ + // 'rtuDtu':{ + // handler(newValue, oldValue) { + // console.log('this.formAll[0].form1.rtuOutDtu') + // }, + // deep:true + // } + // }, + mounted() { + // console.log(this.formAll,this.formAllBody,'this.formAll[0]') + //// 第一个函数就是处理你要监听的属性,只要将其return出去就行 + this.$watch( + function () { + return this.formAll[0].form1.rtuOutDtu; + }, + function (newVal, oldVal) { + this.formAllBody['1'].forEach((item,index,arr)=>{ + if(item.name === '外置DTU设置'){ + arr[index].isShow =newVal; + } + }) + // switch(newVal){ + // case false: + // console.log(11); + // break; + // case true: + // console.log(22); + // break; + // } + } + ) + this.$watch( + function () { + return this.formAll[0].form1.rtuInnerMode; + }, + function (newVal, oldVal) { + this.formAllBody['1'].forEach((item,index,arr)=>{ + if(item.name === '内置LoRa相关配置'){ + arr[index].isShow = newVal === 'LORA' ? true : false; + } + }) + this.formAllBody['2'].forEach((item,index,arr)=>{ + if(item.name === '中心站1'){ + arr[index].isShow = newVal === 'GPRS' ? true : false; + } + if(item.name === '中心站2'){ + arr[index].isShow = newVal === 'GPRS' ? true : false; + } + if(item.name === '中心站3'){ + arr[index].isShow = newVal === 'GPRS' ? true : false; + } + if(item.name === '中心站4(备份站)'){ + arr[index].isShow = newVal === 'GPRS' ? true : false; + } + }) + } + ) + // this.$watch( + // function () { + // return this.formAll[0].form1.rtuother_dtu_type; + // }, + // function (newVal, oldVal) { + // let targetArr = [[true,true,true,false,false],[true,true,false,false,false],[false,false,false,false,true],[false,false,false,false,false]] + // // let select= ['JoinEUI','频率格式','上行频率','下行频率','电信NB服务ID'] + // let strArr= ['JoinEUI','频率格式','上行频率','下行频率','电信NB服务ID'] + // let _this = this + // let caseFun = function(newValIndex,strArr,targetArr){ + // console.log(_this.formAllBody['1'],88888) + // _this.formAllBody['0'].form1.forEach((item,index,arr)=>{ + // if(item.name === '外置DTU设置'){ + // item.data.forEach((item,index,arr)=>{ + // for(let i = 0;i{ + // // // if(item.name && item.name === '外置DTU设置'){ + // // // item.data.forEach((item,index,arr)=>{ + // // // for(let i = 0;i{ + // // if(item.name === '内置LoRa相关配置'){ + // // arr[index].isShow = newVal === 'LORA' ? true : false; + // // } + // // }) + // } + // ) + // bottom }, + // watch:{ + // // 'formAll[0].form1.rtuOutDtu':{ + // // handler(){ + // // console.log(888) + // // }, + // // deep:true + // // }, + // // 'formAll': { + // // handler(newValue, oldValue) { + // // console.log(newValue,this.formAllBody,'obj.a changed'); + // // if(newValue[0].form1.rtuOutDtu ===true){ + // // // rtuStationType + // // // console.log(this.formAllBody['1'][0].data,555) + // // this.formAllBody['1'][0].data.forEach((item,index,arr)=>{ + // // if(item.fieldIdentifier === 'rtuStationType'){ + // // // console.log(555) + // // arr[index].selectOption='降水,河道,水库(湖泊),闸坝,泵站,潮汐,墒情,地下水,水质,取水口,排水口' + // // } + // // }) + // // this.formAllBody['1'].forEach((item,index,arr)=>{ + // // if(item.name === '外置DTU设置'){ + // // // console.log(555) + // // arr[index].isBlock= newValue[0].form1.rtuOutDtu; + // // } + // // }) + // // }else if(newValue[0].form1.rtuOutDtu === false){ + // // this.formAllBody['1'][0].data.forEach((item,index,arr)=>{ + // // if(item.fieldIdentifier === 'rtuStationType'){ + // // // console.log(555) + // // arr[index].selectOption='水质,取水口,排水口' + // // } + // // }) + // // this.formAllBody['1'].forEach((item,index,arr)=>{ + // // if(item.name === '外置DTU设置'){ + // // // console.log(555) + // // arr[index].isBlock= newValue[0].form1.rtuOutDtu; + // // } + // // }) + // // // arr[index].selectOption='降水,河道,水库(湖泊),闸坝,泵站,潮汐,墒情,地下水,水质,取水口,排水口' + // // // console.log(666) + // // } + // // }, + // // deep: true + // // } + // }, methods: { switchChange(val){ - console.log(val,this.formAll[0].form1,'change') + // console.log(val,this.formAll[0].form1,'change') }, switchClick(val){ console.log(val,'click') }, echoClick() { + // 根据站点回显 this.formAll = []; this.activeIndex = "0"; + this.getSiteList(); this.initPage(this.querySite); // this.handleSelect(0) // console.log(this.activeIndex) }, + echoRtuHistory() { + // 根据站点和历史id,回显 + this.formAll = []; + this.activeIndex = "0"; + this.initPage2(); + // this.handleSelect(0) + // console.log(this.activeIndex) + }, temStorageEcho() { // this.activeIndex = '0' if(localStorage.getItem(name)){ @@ -493,7 +689,7 @@ if (valid) { successCount++; } else { - // this.$message({message: `${this.siteNameList[i]} 校验失败,请查看`,type: "warning"}); + this.$message({message: `${this.siteNameList[i]} 校验失败,请查看`,type: "warning"}); // alert(`${this.siteNameList[i]} 校验失败,请查看`); // this.$notify({ // title: '警告', @@ -504,10 +700,11 @@ // return false; } }); - // if(successFlag){ - // return false - // } + if(successFlag){ + return false + } } + console.log(this.stCode,'form6Inputform6Input9999999') if (successCount === this.siteNameList.length) { this.$message({ message: "表单全部校验成功", type: "success" }); } else { @@ -516,7 +713,8 @@ // 组装数据需要的属性,暂时是死值,也可以循环出来 const parmas = { data: { - rtuCode: this.rtuCode, + stCode: this.stCode, + hexRtuCode: this.hexRtuCode, rtuTelemeteringStationSetting: this.formAll[0].form1, rtuCentreSetting: this.formAll[1].form2, rtuSenseTypeSetting: this.formAll[2].form3, @@ -574,9 +772,9 @@ "rtushuiwen_chenjiangarrboolean" ); dealInputSwitch("rtushuiwen_zhaweiarrInt", "rtushuiwen_zhaweiarrboolean"); - let rtuAddUpTimes = parmas.data["rtuTelemeteringStationSetting"][ - "rtuAddUpTimes" - ].sort((item1, item2) => item1 - item2); + // let rtuAddUpTimes = parmas.data["rtuTelemeteringStationSetting"][ + // "rtuAddUpTimes" + // ].sort((item1, item2) => item1 - item2); let rtucamera_jiabao = parmas.data["rtuIndustrialCameraSetting"][ "rtucamera_jiabao" ].sort((item1, item2) => item1 - item2); @@ -584,25 +782,25 @@ let rtucamera_jiabaoNew = []; // console.log(rtuAddUpTimes,'rtuAddUpTimes') for (var i = 0; i < 24; i++) { - rtuAddUpTimesNew.push(0); + // rtuAddUpTimesNew.push(0); rtucamera_jiabaoNew.push(0); } - rtuAddUpTimes.forEach((item, index) => { - rtuAddUpTimesNew[item] = 1; - }); + // rtuAddUpTimes.forEach((item, index) => { + // rtuAddUpTimesNew[item] = 1; + // }); rtucamera_jiabao.forEach((item, index) => { rtucamera_jiabaoNew[item] = 1; }); - parmas.data["rtuTelemeteringStationSetting"][ - "rtuAddUpTimes" - ] = rtuAddUpTimesNew; + // parmas.data["rtuTelemeteringStationSetting"][ + // "rtuAddUpTimes" + // ] = rtuAddUpTimesNew; parmas.data["rtuIndustrialCameraSetting"][ "rtucamera_jiabao" ] = rtucamera_jiabaoNew; - // this.$http.post(`${this.nozzle.rTUSettingServiceUpdate}`,parmas).then(res=>{ - // // console.log(res,'rTUSettingServiceUpdate') - // this.echoClick() - // }) + this.$http.post(`${this.nozzle.rTUSettingServiceUpdate}`,parmas).then(res=>{ + // console.log(res,'rTUSettingServiceUpdate') + this.echoClick() + }) // console.log(parmas,'form6Inputform6Input') // this.formAll=[] // this.initPage(this.querySiteList[1]) @@ -642,11 +840,18 @@ selectChange(val) { // console.log(val,'val') this.echoClick(val); + this.getRtuHistoryList() + }, + selectRtuHistoryId(val) { + console.log(val,'selectRtuHistoryId') + // this.echoClick(val); }, async initPage(site) { + // 切换站点后去请求历史下拉框 + this.getRtuHistoryList() // 回显接口请求数据 将水文传感里面3处特殊的控件需要的值,用请求数据遍历生成表单需要的字段,因为这3处的动态表单使用的是死的字段,其他的对应的表单数据赋值给对应表单就能回显了、 let resFirst = await this.$http.post( - `${this.nozzle.rTUSettingServiceQueryById}?code=${site}` + `${this.nozzle.rTUSettingServiceQueryById}?stCode=${site}` ); let resData = resFirst.data.data; let formArr = [ @@ -666,9 +871,10 @@ "rtu4To20Setting", "rtuOtherSetting" ]; - console.log(this.formAll,resData,'ressssss') + // console.log(this.formAll,resData,'ressssss') // this.formAll={} - this.rtuCode = resData.rtuCode; + this.stCode = resData.stCode; + this.hexRtuCode = resData.hexRtuCode; for (let i = 1; i <= 15; i++) { let obj = {}; // 水文传感里是第6个表单 @@ -742,7 +948,110 @@ } // 表单数据赋值完成,控制表单切换的formshow,也放在一起了 this.formAll.push(obj); - // console.log(this.formAll,this.rtuCode,'this.formAll') + // console.log(this.formAll,this.stCode,'this.formAll') + } + }, + async initPage2() { + // 回显接口请求数据 将水文传感里面3处特殊的控件需要的值,用请求数据遍历生成表单需要的字段,因为这3处的动态表单使用的是死的字段,其他的对应的表单数据赋值给对应表单就能回显了、 + let resFirst = await this.$http.post( + `${this.nozzle.RTUVersionRevert}?stCode=${this.querySite}&id=${this.rtuHistoryId}` + ); + let resData = resFirst.data.data; + let formArr = [ + "rtuTelemeteringStationSetting", + "rtuCentreSetting", + "rtuSenseTypeSetting", + "rtuMeteorologicalSensingCommunicationSetting", + "rtuIndustrialCameraSetting", + "rtuHydrologicSensingCommunication", + "rtuSlaveSetting", + "rtuDataFilter", + "rtuWaterLevelSetting", + "rtuRainSetting", + "rtuFlowmeterSetting", + "rtuEvaporatingDishSetting", + "rtuSoilSettler", + "rtu4To20Setting", + "rtuOtherSetting" + ]; + console.log(this.formAll,resData,'ressssss') + // this.formAll={} + this.stCode = resData.stCode; + this.hexRtuCode = resData.hexRtuCode; + for (let i = 1; i <= 15; i++) { + let obj = {}; + // 水文传感里是第6个表单 + if (i !== 6 && i !== 5) { + obj[`form${i}`] = resData[formArr[i - 1]]; + } + // else if (i === 1) { + // var formObj = Object.assign({},resData[formArr[i - 1]]); + // var rtuAddUpTimesNew = []; + // if (!formObj.hasOwnProperty("rtuAddUpTimes")) { + // return; + // } + // formObj.rtuAddUpTimes.forEach((res, index) => { + // if (res === 1) { + // rtuAddUpTimesNew.push(index); + // } + // }); + // // form1Obj.hasOwnProperty('rtuAddUpTimes') + // formObj.rtuAddUpTimes = rtuAddUpTimesNew; + // // console.log(form1Obj,'form1Obj') + // obj[`form${i}`] = formObj; + // } + else if (i === 5) { + let formObj = Object.assign({},resData[formArr[i - 1]]); + let rtucamera_jiabaoNew = []; + if (!formObj.hasOwnProperty("rtucamera_jiabao")) { + return; + } + formObj.rtucamera_jiabao.forEach((res, index) => { + if (res === 1) { + rtucamera_jiabaoNew.push(index); + } + }); + formObj.rtucamera_jiabao = rtucamera_jiabaoNew; + // console.log(form1Obj,'form1Obj') + obj[`form${i}`] = formObj; + } else if (i === 6) { + var form6Obj = resData[formArr[i - 1]]; + // 每一处需要input switch各8个共16个模拟字段,只处理第6个表单 + function creatInputSwitch(str, strBool) { + if ( + form6Obj.hasOwnProperty(str) && + form6Obj.hasOwnProperty(strBool) + ) { + for (let i = 0; i < 8; i++) { + form6Obj[`${str}input${i}`] = form6Obj[str][i]; + form6Obj[`${str}switch${i}`] = form6Obj[strBool][i]; + } + delete form6Obj[str]; + delete form6Obj[strBool]; + } + } + creatInputSwitch( + "rtushuiwen_shangqingarrInt", + "rtushuiwen_shangqingarrboolean" + ); + creatInputSwitch( + "rtushuiwen_chenjiangarrInt", + "rtushuiwen_chenjiangarrboolean" + ); + creatInputSwitch( + "rtushuiwen_zhaweiarrInt", + "rtushuiwen_zhaweiarrboolean" + ); + obj[`form${i}`] = form6Obj; + } + if (i !== 1) { + obj[`form${i}Show`] = false; + } else { + obj[`form${i}Show`] = true; + } + // 表单数据赋值完成,控制表单切换的formshow,也放在一起了 + this.formAll.push(obj); + // console.log(this.formAll,this.stCode,'this.formAll') } }, validatorAll(rule, value, callback, type, sug, alart) { @@ -864,7 +1173,7 @@ var newObj = []; // 根据小标题去重 uniq(sub_titleList).forEach(item => { - var obj = { name: item, data: [] }; + var obj = { name: item, data: [], isShow:true, isBlock:true }; var data = dataRes[i].forEach(l => { if ( l.subTitle === item && @@ -894,14 +1203,27 @@ .then(res => { // console.log(res.data.data,'resss') this.querySiteList = res.data.data; - this.querySite = this.querySiteList[0]; + this.querySite = this.querySiteList[0].rtuStationCode; + }); + }, + async getRtuHistoryList() { + await this.$http + //`${this.nozzle.queryRTUSettingHistory}?stCode=${this.querySite}` + .post(`${this.nozzle.queryRTUSettingHistory}?stCode=${this.querySite}`) + .then(res => { + // console.log(res.data,'resss') + this.rtuHistoryList = res.data.data; + // this.querySite = this.querySiteList[0].rtuStationCode; }); } }, created(){ this.getSiteList().then(res=>{ - this.initPage(this.querySiteList[0]); + // this.querySiteList[0].rtuStationCode + this.initPage(this.querySite); + this.getRtuHistoryList() }); + this.formControl(); // console.log(666) }, @@ -931,6 +1253,15 @@ width: 100%; /* background-color: #fff; */ } + .filter-content{ + text-align:left;padding:10px;position:relative; + .rtu-history-box{ + padding: 10px 0 0 0; + position: absolute; + right: 100px; + top: 0; + } + } .switchContent { // color: rgb(99, 96, 96); color: red; @@ -938,7 +1269,7 @@ /* background-color: #fff; */ // color: white !important; - padding: 2%; + padding: 2% 0 0 0; /deep/ .el-form{ .el-col{ height: 51px!important; @@ -1030,8 +1361,30 @@ } } + .rowClass:nth-child(2n+1){ + background-color: rgba( 245,222,179,0.3); + box-shadow: rgba(144,147,153, 0.32) 0px 2px 4px 0px; + } .rowClass:nth-child(2n){ background-color: rgba(144,147,153,0.3); + box-shadow: rgba(144,147,153, 0.32) 0px 2px 4px 0px; + } + .rowClass.control-show{ + // background-color: #fff; + // cursor: pointer; + background-color: #ccc; + pointer-events: none; + border: 1px solid pink; + box-sizing: border-box; + // .control-show{ + // } + } + .stop { + background-color: #ccc; + pointer-events: none; + .el-input__suffix-inner{ + pointer-events: none; + } } } diff --git a/src/components/index.vue b/src/components/index.vue index 2ac1f4a..3873be8 100644 --- a/src/components/index.vue +++ b/src/components/index.vue @@ -41,7 +41,7 @@ --> @@ -50,7 +50,7 @@ :key="index" :command="item.command" > - {{item.key}} + {{ item.key }} @@ -162,7 +162,9 @@ 服务监控 - 服务器管理 + 服务器管理 - 服务器管理 + 服务器管理