From 365146ee992a1caf463736b70d62d030b19ea7a6 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: Fri, 10 May 2024 13:32:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E5=AF=9F=E4=BA=BA=E5=91=98=E8=BF=94?= =?UTF-8?q?=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../safetyinspection/safetyinspection.js | 77 +++++++++++++++--- .../safetyinspection/safetyinspection.json | 3 +- .../safetyinspection/safetyinspection.wxml | 80 +++++++++---------- .../safetyinspection/safetyinspection.wxss | 11 ++- 4 files changed, 114 insertions(+), 57 deletions(-) diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js index 0f4ba8e..250546e 100644 --- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js +++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.js @@ -7,22 +7,27 @@ Page({ * 页面的初始数据 */ data: { + gridName:'', + array: ['选项1', '选项2', '选项3', '选项4'], // 选择器的数据源 result: ['a', 'b', 'c'], arrlist:[], fileList: [], companyId: '', showPopup: false, // 控制弹出层显示/隐藏的状态 selectedOptions: [], // 选中的复选框项 - Prosecutors:['小王','李四','张三'], //检查人员 + selectedNames:[],//显示检察人员 + // 用于存放复选框选择的结果 + result: [], + // 用于存放输入框的值 + newPassword: '', arr:[ - {value:1,name:'小王'}, - {value:2,name:'李四'}, - {value:3,name:'张三'} + {value:"1",name:'小王'}, + {value:"2",name:'李四'}, + {value:"3",name:'张三'} ], - arr:[ - {value:1,name:'小王'}, - {value:2,name:'李四'}, - {value:3,name:'张三'} + arr1:[ + {value:"1",name:'1.车间一些软件设备出现生锈断裂情况严重'}, + {value:"2",name:'2.还有部分货运车辆已过年检。'}, ] }, @@ -79,7 +84,7 @@ Page({ onChange(event) { console.log(event) this.setData({ - selectedOptions: event.detail + result: event.detail }); // event.detail 为当前输入的值 console.log(this.data.selectedOptions); @@ -129,16 +134,62 @@ Page({ }, onChange1(event) { console.log(event) - const { value } = event.detail; - console.log(event.detail) this.setData({ - arr: value + selectedOptions: event.detail }); + console.log(this.data.selectedOptions) }, confirmSelection() { // 点击确定按钮后触发,处理选中的复选框项 console.log("选中的项:", this.data.selectedOptions); - this.setData({ showPopup: false }); // 关闭弹出层 + console.log(this.data.arr) + console.log(this.data.arr.filter(item => this.data.selectedOptions.includes(item.value)).map(item => item.name)); + console.log(this.data.arr.filter(item => this.data.selectedOptions.includes(item.value))); + const selectedName = this.data.arr.filter(item => this.data.selectedOptions.includes(item.value)).map(item => item.name); + console.log("选中的名称:", selectedName); + this.setData({ + showPopup: false, + selectedNames:selectedName + + }); // 关闭弹出层 + console.log(this.data.selectedNames) }, + changeNewPassword(e){ + console.log("执行了") + this.setData({ + newPassword: e.detail.value + }); + console.log(this.data.newPassword) + }, + addAnother() { + // // 获取输入框的值 + // const newPassword = this.data.newPassword; + // // 将值添加到arr数组中 + // const arr = this.data.arr.concat(newPassword); + // // 更新数据 + // this.setData({ + // arr: arr, + // // 清空输入框的值 + // newPassword: '' + // }); + let newValue = this.data.arr1.length + 1; // 根据数组长度确定新值 + let newArr = this.data.arr1.concat({ value: newValue.toString(), name: this.data.newPassword }); + this.setData({ + arr1: newArr, + newPassword: '', // 清空输入框的值 + }); + console.log('添加后的数组:', this.data.arr1); + }, +pickerChange: function(e) { + // 更新当前选中的索引 + console.log(e.detail.value), + console.log(this.data.array[e.detail.value]) + this.setData({ + gridName: this.data.array[e.detail.value] + }); + console.log(this.data.gridName) + // 在这里可以根据选择的值进行相应的逻辑处理 +} + }) \ No newline at end of file diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.json b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.json index 8236caf..be9c56b 100644 --- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.json +++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.json @@ -5,6 +5,7 @@ "van-checkbox": "@vant/weapp/checkbox/index", "van-checkbox-group": "@vant/weapp/checkbox-group/index", "van-uploader": "@vant/weapp/uploader/index", - "van-popup": "@vant/weapp/popup/index" + "van-popup": "@vant/weapp/popup/index", + "van-picker": "@vant/weapp/picker/index" } } \ No newline at end of file diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml index 3f35ea3..c0062bc 100644 --- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml +++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxml @@ -1,10 +1,10 @@ - + * 检查人员 - {{ selectedOptions }} + {{ selectedNames }} @@ -12,36 +12,36 @@ - - - * - 已整改隐患 + + + * + 已整改隐患 + - - + + + {{item.name}} + + + + + + + + 再添加一条 - - - - 1.车间一些软件设备出现生锈断裂情况严重 - 2.还有部分货运车辆已过年检。 - - - - - - - - 再添加一条 - - + * 检查结论 - 请选择 + + + {{gridName?gridName:'请选择'}} + + - + @@ -49,8 +49,12 @@ * 拟复查时间 - - + + + + {{gridName?gridName:'请选择'}} + + @@ -125,19 +129,11 @@ --> - - + - - {{item.name}} - - - - \ No newline at end of file + + {{item.name}} + + + + \ No newline at end of file diff --git a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxss b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxss index 92e8e20..379bc96 100644 --- a/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxss +++ b/subpages/safetyinspection/pages/safetyinspection/safetyinspection.wxss @@ -23,6 +23,10 @@ page { height: 50rpx; border-bottom: 1px solid #EAEAEA; } +.conclusion{ + display: flex; + flex-direction: row; +} .prosecutors_req{ color: red; margin: 5rpx @@ -40,7 +44,7 @@ page { margin-left: 6rpx; } .prosecutors_name{ - width: 200px; + width: 150px; height: 30rpx; overflow-wrap: break-word; color: rgba(51,51,51,1); @@ -274,4 +278,9 @@ page { .add_img{ width: 40rpx; height: 40rpx; +} +.conclusion_right{ + display: flex; + flex-direction: row; + } \ No newline at end of file