From f98cdb168979996be866aec84f0f6cb0d3520de0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=AF=E5=B0=8F=E7=8E=8B=E5=91=80=5C24601?= <819653817@qq.com> Date: Thu, 25 Jul 2024 18:15:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InspectionReport/InspectionReport.js | 174 +++++++++++------- .../InspectionReport/InspectionReport.wxml | 21 ++- .../InspectionReport/InspectionReport.wxss | 46 +++++ utils/api_BACKUP_859.js | 8 +- utils/config.js | 4 +- 5 files changed, 174 insertions(+), 79 deletions(-) diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js index 06cdc09..6a0166c 100644 --- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js +++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.js @@ -18,10 +18,8 @@ Page({ */ data: { orderDate:"", - inspectIf:false, selectedEnterpriseNames:[], EnterpriseName:[], - index: 0, companyList:[], showtime:false, checkboxOptions:[], @@ -75,8 +73,8 @@ Page({ currentDate: new Date().getTime(), minDate: new Date(2020, 0, 1).getTime(), maxDate: new Date(2030, 11, 31).getTime(), - checkboxValue:[], - searchKeyword:"" + searchKeyword:"", + showscroll:false }, /** * 生命周期函数--监听页面加载 @@ -99,7 +97,9 @@ Page({ }, inputChange(val){ console.log(val.detail.value); - this.data.searchKeyword = val.detail.value.trim(); + this.setData({ + searchKeyword: val.detail.value // 更新搜索关键词 + }); let parm = { name: this.data.searchKeyword, pageSize:this.data.pageSize, @@ -109,15 +109,12 @@ Page({ console.log(res.data.list); this.setData({ companyList:res.data.list, - showqiye:true + // showqiye:true }) console.log( this.data.companyList); - let names = [] - res.data.list.forEach(item=>{ - names.push(item.name) - }) - console.log(names); - this.data.EnterpriseName=names + + + }) // clearTimeout(this.data.timer); // this.data.timer = setTimeout(() => { @@ -135,14 +132,15 @@ Page({ }); console.log(this.data.addHiddenDangeList); }, - showRecordData() { + async showRecordData() { + console.log(this.data.checkboxOptions); this.setData({ checkboxOptions:[] }) let parm = { id: this.data.companyId } - showRecord(parm).then(res => { + await showRecord(parm).then(res => { if(res.data[0].hiddenDangeList){ let checkboxOptions = res.data[0].hiddenDangeList.filter(item=>item.hazardStatus === 0).map(item=>({hazardDesc:item.hazardDesc,hazardStatus:0})); this.setData({ @@ -150,6 +148,7 @@ Page({ beforeFlag: res.data[0].checkResultFlag }) console.log(this.data.beforeFlag); + console.log(this.data.checkboxOptions); }else{ this.setData({ beforeFlag: res.data[0].checkResultFlag @@ -157,6 +156,7 @@ Page({ console.log(this.data.beforeFlag) } }) + console.log(this.data.checkboxOptions); }, getCurrentDateTime() { const now = new Date(); @@ -205,18 +205,18 @@ Page({ }) return false } - if (this.data.checkboxOptions) { - console.log(this.data.checkboxOptions) - this.data.checkboxOptions.forEach(item => { - console.log(item) - console.log(this.data.checkboxValue) - if(this.data.checkboxValue.findIndex(itemC=>itemC === item.value) == -1){ - item.hazardStatus = '1'; - }else{ - item.hazardStatus = '0'; - } - }) - } + // if (this.data.checkboxOptions) { + // console.log(this.data.checkboxOptions) + // this.data.checkboxOptions.forEach(item => { + // console.log(item) + // console.log(this.data.checkboxValue) + // if(this.data.checkboxValue.findIndex(itemC=>itemC === item.value) == -1){ + // item.hazardStatus = '1'; + // }else{ + // item.hazardStatus = '0'; + // } + // }) + // } if (this.data.newContent) { @@ -344,10 +344,22 @@ Page({ onShareAppMessage() {}, onChange(event) { console.log(event); + console.log(event.detail); + console.log(this.data.checkboxOptions); + this.data.checkboxOptions.forEach((item,index)=>{ + if(event.detail.findIndex(item=>item==index) != -1){ + console.log(item,"还是0"); + item.hazardStatus = 0 + }else{ + console.log(item,"皆苦额了"); + item.hazardStatus = 1 + } + }) + console.log(this.data.checkboxOptions); this.setData({ - checkboxValue: event.detail - }); - console.log(this.data.checkboxValue); + checkboxValue:event.detail, + }) + console.log(this.data.checkboxOptions); }, afterRead(event) { const { @@ -410,36 +422,65 @@ Page({ }); }, - onChange2(event) { - console.log(event); + handleBlur(){ this.setData({ - selectedEnterpriseNames: event.detail, - searchKeyword:event.detail[0] - }); - console.log(event.detail); - console.log(this.data.companyList); - this.data.companyList.forEach(item=>{ - if(this.data.searchKeyword==item.name){ - this.data.companyId=item.companyId - this.data.orderDate=item.orderDate - } - + showscroll:false, + companyList:[] }) - const currentDate = new Date(); - const currentMonth = currentDate.getMonth() + 1; - const targetMonth = parseInt(this.data.orderDate.substring(5, 7), 10); - console.log(this.data.companyId,); - if (targetMonth === currentMonth) { - this.setData({ - inspectIf:true - }) - console.log( this.data.inspectIf); - } else { - this.setData({ - inspectIf:false - }) - } + }, + handleFocus(){ + console.log(this.data.showscroll); + this.setData({ + showscroll:true + }) + let parm = { + name: this.data.searchKeyword, + pageSize:this.data.pageSize, + pageNo:this.data.pageNo + } + Enterpriseambiguity(parm).then(res => { + console.log(res.data.list); + this.setData({ + companyList:res.data.list, + // showqiye:true + }) + console.log( this.data.companyList); + this.data.companyList.forEach(item=>{ + this.data.orderDate=item.orderDate; + const currentDate = new Date(); + const currentMonth = currentDate.getMonth() + 1; + const targetMonth = parseInt(item.orderDate.substring(5, 7), 10); + console.log(currentMonth,targetMonth); + if (targetMonth === currentMonth) { + console.log("turedv"); + item.inspectIf=true + } else { + item.inspectIf=false + } + + }) + console.log(this.data.companyList); + // let names = [] + // res.data.list.forEach(item=>{ + // names.push(item.name) + // }) + // console.log(names); + // this.data.EnterpriseName=names + }) + // this.onChange2() + }, + onChange2(event) { + let item = event.currentTarget.dataset.item; + console.log(item); + this.setData({ + searchKeyword:item.name, + companyList:item, + companyId:item.companyId, + showscroll:false, + companyList:[] + }); + this.showRecordData() }, confirmSelection() { @@ -498,15 +539,15 @@ Page({ console.log(this.data.getData) // 在这里可以根据选择的值进行相应的逻辑处理 }, - pickerChange2: function (e) { - // 更新当前选中的索引 - this.setData({ - gridNName: this.data.companyList[e.detail.value].name, - companyId:this.data.companyList[e.detail.value].id, - checkboxValue:[] - }); - this.showRecordData() - }, + // pickerChange2: function (e) { + // // 更新当前选中的索引 + // this.setData({ + // gridNName: this.data.companyList[e.detail.value].name, + // companyId:this.data.companyList[e.detail.value].id, + // checkboxValue:[] + // }); + // this.showRecordData() + // }, bindRemarkInput(e) { this.setData({ remarks: e.detail.value @@ -800,5 +841,8 @@ Page({ onCancel() { this.setData({ showtime: false }); + }, + input122(event){ + console.log(event); } }) \ No newline at end of file diff --git a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml index 4948450..4dbc7ed 100644 --- a/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml +++ b/subpages/InspectionReport/pages/InspectionReport/InspectionReport.wxml @@ -17,8 +17,17 @@ 企业名称 -
- +
+ + + +
+ {{item.name}} + {{item.name}} +
+
+
+ - + +