Browse Source

feat: 检查项默认正常&位置未授权提示

master
liujiangyong 12 months ago
parent
commit
6497f3bd23
  1. 36
      weapp/package/inspectionInput/inspectionInput.js
  2. 5
      weapp/package/inspectionInput/inspectionInput.wxml
  3. 9
      weapp/package/report/report.js
  4. 6
      weapp/package/report/report.wxml

36
weapp/package/inspectionInput/inspectionInput.js

@ -74,7 +74,7 @@ Page({
checkItems: checkItems.map(c => ({
id: `${device.deviceId}-${c.id}`,
name: c.name,
isNormal: null,
isNormal: true,
msgInp: null,
level: null,
imgs: [],
@ -86,7 +86,7 @@ Page({
checkItems: checkItems.map(c => ({
id: c.id,
name: c.name,
isNormal: null,
isNormal: true,
msgInp: null,
level: null,
imgs: [],
@ -152,22 +152,38 @@ Page({
},
fail: (res) => {
wx.hideLoading();
wx.showToast({
title: res.errMsg,
icon: 'none',
duration: 1000
});
if (res.errMsg === 'getLocation:fail auth deny') {
that.toSettingModal('请允许位置权限')
} else {
wx.showToast({
title: res.errMsg,
icon: 'none',
duration: 1000
});
}
}
});
},
toSettingModal() {
wx.showModal({
title: '提示',
confirmText: '去设置',
content: '请允许位置权限',
success: function (res) {
const { confirm } = res || {}
if (confirm) {
wx.openSetting()
}
}
})
},
handleChangeTwo(e) {
const isNormal = e.detail === 'normal';
const { deviceidx, itemidx } = e.currentTarget.dataset;
let nextInspectContentArr = this.data.inspectContentArr;
nextInspectContentArr[deviceidx].checkItems[itemidx].isNormal = isNormal;
if (isNormal) { // 清除异常数据
nextInspectContentArr[deviceidx].checkItems[itemidx].isNormal = e.detail;
if (e.detail) { // 清除异常数据
nextInspectContentArr[deviceidx].checkItems[itemidx].msgInp = null;
nextInspectContentArr[deviceidx].checkItems[itemidx].level = null;
nextInspectContentArr[deviceidx].checkItems[itemidx].imgs = [];

5
weapp/package/inspectionInput/inspectionInput.wxml

@ -59,11 +59,12 @@
data-deviceidx="{{deviceidx}}"
data-itemidx="{{itemidx}}"
bindchange="handleChangeTwo"
value="{{item.isNormal}}"
>
<van-radio style="margin-right: 20px;" class="radio-text" color="#1979ff" name="normal"
<van-radio style="margin-right: 20px;" class="radio-text" color="#1979ff" name="{{true}}"
>正常</van-radio
>
<van-radio class="radio-text" checked-color="#CC0000" name="abnormal">异常</van-radio>
<van-radio class="radio-text" checked-color="#CC0000" name="{{false}}">异常</van-radio>
</van-radio-group>
</view>
<view class="divider" />

9
weapp/package/report/report.js

@ -137,7 +137,7 @@ Page({
checkItems: checkItems.map(c => ({
id: `${device.id}-${c.id}`,
name: c.name,
isNormal: null,
isNormal: true,
msgInp: null,
level: null,
imgs: [],
@ -149,7 +149,7 @@ Page({
checkItems: checkItems.map(c => ({
id: c.id,
name: c.name,
isNormal: null,
isNormal: true,
msgInp: null,
level: null,
imgs: [],
@ -164,12 +164,11 @@ Page({
},
//选择异常或者正常
handleChangeTwo(e) {
const isNormal = e.detail === 'normal';
const { deviceidx, itemidx } = e.currentTarget.dataset;
let nextInspectContentArr = this.data.inspectContentArr;
nextInspectContentArr[deviceidx].checkItems[itemidx].isNormal = isNormal;
if (isNormal) { // 清除异常数据
nextInspectContentArr[deviceidx].checkItems[itemidx].isNormal = e.detail;
if (e.detail) { // 清除异常数据
nextInspectContentArr[deviceidx].checkItems[itemidx].msgInp = null;
nextInspectContentArr[deviceidx].checkItems[itemidx].level = null;
nextInspectContentArr[deviceidx].checkItems[itemidx].imgs = [];

6
weapp/package/report/report.wxml

@ -60,9 +60,9 @@
<view wx:for="{{device.checkItems}}" wx:key="id" wx:for-index="itemidx">
<view class="flex-between">
<view class="item-name">{{item.name}}:</view>
<van-radio-group style="padding:10px 15px;" data-deviceidx="{{deviceidx}}" data-itemidx="{{itemidx}}" bindchange="handleChangeTwo">
<van-radio style="margin-right: 20px;" class="radio-text" color="#1979ff" name="normal">正常</van-radio>
<van-radio class="radio-text" checked-color="#CC0000" name="abnormal">异常</van-radio>
<van-radio-group style="padding:10px 15px;" data-deviceidx="{{deviceidx}}" data-itemidx="{{itemidx}}" bindchange="handleChangeTwo" value="{{item.isNormal}}">
<van-radio style="margin-right: 20px;" class="radio-text" color="#1979ff" name="{{true}}">正常</van-radio>
<van-radio class="radio-text" checked-color="#CC0000" name="{{false}}">异常</van-radio>
</van-radio-group>
</view>
<view class="divider" />

Loading…
Cancel
Save