From 91ade8e3bb5a3e1220823579ddd609f29d61c2e2 Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Fri, 17 Feb 2023 11:04:39 +0800 Subject: [PATCH] =?UTF-8?q?(*)=20=E6=9B=B4=E6=8D=A2picker=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E8=87=AA=E5=8A=A8=E5=BC=B9=E5=87=BA=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=B7=A1=E6=A3=80=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + weapp/package.json | 15 ++++++++ .../startInspection/startInspection.js | 35 +++++++++++++++---- .../startInspection/startInspection.json | 9 ++++- .../startInspection/startInspection.wxml | 12 +++---- .../startInspection/startInspection.wxss | 9 +++-- 6 files changed, 64 insertions(+), 17 deletions(-) create mode 100644 weapp/package.json diff --git a/.gitignore b/.gitignore index e96f7ce..c3957c6 100644 --- a/.gitignore +++ b/.gitignore @@ -148,3 +148,4 @@ web/log # weapp project.private.config.json +miniprogram_npm diff --git a/weapp/package.json b/weapp/package.json new file mode 100644 index 0000000..140a828 --- /dev/null +++ b/weapp/package.json @@ -0,0 +1,15 @@ +{ + "name": "xunjian-weapp", + "version": "1.0.0", + "description": "", + "main": ".eslintrc.js", + "dependencies": { + "tdesign-miniprogram": "^1.0.0-rc.2" + }, + "devDependencies": {}, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC" +} diff --git a/weapp/package/startInspection/startInspection.js b/weapp/package/startInspection/startInspection.js index 49b561a..3c31413 100644 --- a/weapp/package/startInspection/startInspection.js +++ b/weapp/package/startInspection/startInspection.js @@ -17,7 +17,7 @@ Page({ data: { scenePointId: null, planList: null, - index: null, + planListVisible: true, dataList: '', imgs: [], //上传图片 imgUrl: getApp().globalData.imgUrl, @@ -28,11 +28,17 @@ Page({ address: '', //当前位置 }, - bindPickerChange: function (e) { + onPickerChange(e) { + const { key } = e.currentTarget.dataset; + const { value } = e.detail; + this.setData({ - index: e.detail.value - }) - const curPlan = this.data.planList[e.detail.value]; + [`${key}Visible`]: false, + [`${key}Value`]: value, + [`${key}Text`]: value.join(' '), + }); + + const curPlan = this.data.planList[e.detail.columns[0].index]; let points = curPlan.points.map(e => { return e.name }).join('、') @@ -45,6 +51,17 @@ Page({ this.getPatrolRecord(); }, + onPickerCancel(e) { + const { key } = e.currentTarget.dataset; + this.setData({ + [`${key}Visible`]: false, + }); + }, + + onPlanListPicker() { + this.setData({ planListVisible: true }); + }, + handleChangeTwo(e) { this.setData({ changeTwo: e.detail.value @@ -398,14 +415,18 @@ Page({ const userInfo = wx.getStorageSync('userInfo'); Request.get(getPatrolPlan(), { userId: userInfo.id }).then(res => { wx.hideLoading(); - const pointPlan = res.rows.filter(plan => { + let pointPlan = res.rows.filter(plan => { for (const point of plan.points) { if (point.id == scenePointId) { return true; } } return false; - }) + }).map(p => ({ + label: p.name, + value: p.name, + ...p + })) if (!pointPlan.length) { wx.showModal({ title: '提示', diff --git a/weapp/package/startInspection/startInspection.json b/weapp/package/startInspection/startInspection.json index 40e7348..46db035 100644 --- a/weapp/package/startInspection/startInspection.json +++ b/weapp/package/startInspection/startInspection.json @@ -2,5 +2,12 @@ "navigationBarBackgroundColor": "#1979ff", "navigationBarTextStyle": "white", "navigationBarTitleText": "开始巡检", - "enablePullDownRefresh": false + "enablePullDownRefresh": false, + "component": true, + "usingComponents": { + "t-cell-group": "tdesign-miniprogram/cell-group/cell-group", + "t-cell": "tdesign-miniprogram/cell/cell", + "t-picker": "tdesign-miniprogram/picker/picker", + "t-picker-item": "tdesign-miniprogram/picker-item/picker-item" + } } \ No newline at end of file diff --git a/weapp/package/startInspection/startInspection.wxml b/weapp/package/startInspection/startInspection.wxml index 9291725..f234771 100644 --- a/weapp/package/startInspection/startInspection.wxml +++ b/weapp/package/startInspection/startInspection.wxml @@ -1,12 +1,10 @@ - - - - {{index===null ? '请选择巡检计划:' : '巡检计划:'}}{{planList[index].name}} - - - + + + + + 巡检要求 diff --git a/weapp/package/startInspection/startInspection.wxss b/weapp/package/startInspection/startInspection.wxss index a5000e2..044f87c 100644 --- a/weapp/package/startInspection/startInspection.wxss +++ b/weapp/package/startInspection/startInspection.wxss @@ -5,8 +5,9 @@ padding: 30rpx 0; } -.picker { - margin-bottom: 40rpx; +.plan-list { + margin-bottom: 30rpx; + } .titleFirst { @@ -109,4 +110,8 @@ .upload { width: 160rpx; height: 160rpx; +} + +.block { + display: block; } \ No newline at end of file