parent
af61d53211
commit
06b8886855
1 changed files with 129 additions and 112 deletions
@ -1,120 +1,137 @@ |
|||||||
<template> |
<template> |
||||||
<ifrm ref="ifrm"> |
<ifrm ref="ifrm"> |
||||||
<!-- 安全点检 --> |
<!-- 安全点检 --> |
||||||
<uni-forms ref="form" err-show-type="toast"> |
<uni-forms ref="form" err-show-type="toast"> |
||||||
<uni-forms-item><input type="text" v-model="facilityValue" @confirm="facilityConfirm" |
<uni-forms-item> |
||||||
class="uni-input-border" placeholder="设备编码" /></uni-forms-item> |
<input |
||||||
</uni-forms> |
type="text" |
||||||
<checkbox-group @change="checkboxChange"> |
v-model="facilityValue" |
||||||
<uni-table border stripe emptyText="暂无更多数据" class="table"> |
@confirm="facilityConfirm" |
||||||
<uni-tr> |
class="uni-input-border" |
||||||
<uni-th align="center" width="60"></uni-th> |
placeholder="设备编码" |
||||||
<uni-th align="center">检验项</uni-th> |
/> |
||||||
<uni-th align="center">检验条件</uni-th> |
</uni-forms-item> |
||||||
<uni-th align="center">检验结果</uni-th> |
</uni-forms> |
||||||
<uni-th align="center">描述</uni-th> |
<checkbox-group @change="checkboxChange"> |
||||||
</uni-tr> |
<uni-table border stripe emptyText="暂无更多数据" class="table"> |
||||||
<uni-tr v-for="(item, index) in facilityData" :key="index"> |
<uni-tr> |
||||||
<uni-td align="center"> |
<uni-th align="center" width="60"></uni-th> |
||||||
<checkbox :value="item" :checked="item.checked" /> |
<uni-th align="center">检验项</uni-th> |
||||||
</uni-td> |
<uni-th align="center">检验条件</uni-th> |
||||||
<uni-td align="center">{{ item.checkItem }}</uni-td> |
<uni-th align="center">检验结果</uni-th> |
||||||
<uni-td align="center">{{ item.checkCon }}</uni-td> |
<uni-th align="center">描述</uni-th> |
||||||
<uni-td align="center" class="tableRequired"> |
</uni-tr> |
||||||
<picker @change="bindPickerChange($event, index)" :value="item.facilityIndex" :range="array"> |
<uni-tr v-for="(item, index) in facilityData" :key="index"> |
||||||
<view class="uni-input">{{ array[item.facilityIndex] }}</view> |
<uni-td align="center"> |
||||||
</picker> |
<checkbox :value="item" :checked="item.checked" /> |
||||||
</uni-td> |
</uni-td> |
||||||
<uni-td align="center" width="200"><textarea style="width: 260rpx;" auto-height |
<uni-td align="center">{{ item.checkItem }}</uni-td> |
||||||
v-model="item.describe" /></uni-td> |
<uni-td align="center">{{ item.checkCon }}</uni-td> |
||||||
</uni-tr> |
<uni-td align="center" class="tableRequired"> |
||||||
</uni-table> |
<picker |
||||||
</checkbox-group> |
@change="bindPickerChange($event, index)" |
||||||
<view class="buttonBox"><button class="button" type="primary" :disabled="!(facilitySeceteArr.length > 0)" |
:value="item.facilityIndex" |
||||||
@click="submitClick">提交</button></view> |
:range="array" |
||||||
</ifrm> |
> |
||||||
|
<view class="uni-input">{{ array[item.facilityIndex] }}</view> |
||||||
|
</picker> |
||||||
|
</uni-td> |
||||||
|
<uni-td align="center" width="200"> |
||||||
|
<textarea |
||||||
|
style="width: 260rpx" |
||||||
|
auto-height |
||||||
|
v-model="item.describe" |
||||||
|
/> |
||||||
|
</uni-td> |
||||||
|
</uni-tr> |
||||||
|
</uni-table> |
||||||
|
</checkbox-group> |
||||||
|
<view class="buttonBox"> |
||||||
|
<button |
||||||
|
class="button" |
||||||
|
type="primary" |
||||||
|
:disabled="!(facilitySeceteArr.length > 0)" |
||||||
|
@click="submitClick" |
||||||
|
> |
||||||
|
提交 |
||||||
|
</button> |
||||||
|
</view> |
||||||
|
</ifrm> |
||||||
</template> |
</template> |
||||||
|
|
||||||
<script> |
<script> |
||||||
import ifrm from '@/pages/index/ifrm'; |
import ifrm from "@/pages/index/ifrm"; |
||||||
import scan from '../../mixin/scan.js'; |
import scan from "../../mixin/scan.js"; |
||||||
export default { |
export default { |
||||||
mixins: [scan], |
mixins: [scan], |
||||||
components: { |
components: { |
||||||
ifrm |
ifrm, |
||||||
}, |
}, |
||||||
data() { |
data() { |
||||||
return { |
return { |
||||||
facilityValue: '', |
facilityValue: "", |
||||||
array: ['正常', '关机', '异常'], |
array: ["正常", "关机", "异常"], |
||||||
facilityData: [], |
facilityData: [], |
||||||
facilitySeceteArr: [] |
facilitySeceteArr: [], |
||||||
}; |
|
||||||
}, |
|
||||||
methods: { |
|
||||||
checkboxChange(e) { |
|
||||||
this.facilitySeceteArr = e.detail.value; |
|
||||||
}, |
|
||||||
bindPickerChange: function(e, index) { |
|
||||||
this.facilityData[index].facilityIndex = e.target.value; |
|
||||||
}, |
|
||||||
getBarCode(code) { |
|
||||||
this.getData(code); |
|
||||||
}, |
|
||||||
facilityConfirm(e) { |
|
||||||
this.getBarCode(e.target.value); |
|
||||||
}, |
|
||||||
getData(code) { |
|
||||||
if (!code) return; |
|
||||||
this.facilityValue = code; |
|
||||||
this.$ajax.request({ |
|
||||||
url: 'pdaLoad/getSpotCheckByEcCode/' + code, |
|
||||||
method: 'GET', |
|
||||||
success: data => { |
|
||||||
this.facilityValue = ''; |
|
||||||
this.facilityData = []; |
|
||||||
data.forEach(item => { |
|
||||||
this.facilityData.push({ |
|
||||||
...item, |
|
||||||
facilityIndex: 0 |
|
||||||
}); |
|
||||||
}); |
|
||||||
uni.showToast({ |
|
||||||
title: '数据获取成功' |
|
||||||
}); |
|
||||||
} |
|
||||||
}); |
|
||||||
}, |
|
||||||
submitClick() { |
|
||||||
let arr = []; |
|
||||||
this.facilitySeceteArr.forEach(item => { |
|
||||||
arr.push({ |
|
||||||
sscId: item.sscId, |
|
||||||
checkResult: item.facilityIndex, |
|
||||||
describe: item.describe |
|
||||||
}); |
|
||||||
}); |
|
||||||
this.$ajax.request({ |
|
||||||
url: 'pdaSave/saveBySpotCheck', |
|
||||||
method: 'POST', |
|
||||||
data: { |
|
||||||
sscList: arr |
|
||||||
}, |
|
||||||
success: data => { |
|
||||||
uni.showToast({ |
|
||||||
title: '点检成功' |
|
||||||
}); |
|
||||||
this.facilityValue = ''; |
|
||||||
this.facilityData = []; |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
}, |
|
||||||
onNavigationBarButtonTap(btn) { |
|
||||||
this.$refs.ifrm.topMenuClick(btn); |
|
||||||
}, |
|
||||||
onShow() {} |
|
||||||
}; |
}; |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
checkboxChange(e) { |
||||||
|
this.facilitySeceteArr = e.detail.value; |
||||||
|
}, |
||||||
|
bindPickerChange: function (e, index) { |
||||||
|
this.facilityData[index].facilityIndex = e.target.value; |
||||||
|
}, |
||||||
|
getBarCode(code) { |
||||||
|
this.getData(code); |
||||||
|
}, |
||||||
|
facilityConfirm(e) { |
||||||
|
this.getBarCode(e.target.value); |
||||||
|
}, |
||||||
|
getData(code) { |
||||||
|
if (!code) return; |
||||||
|
this.facilityValue = code; |
||||||
|
this.$u.api.getSpotCheckByCode(code).then((data) => { |
||||||
|
this.facilityValue = ""; |
||||||
|
this.facilityData = []; |
||||||
|
data.forEach((item) => { |
||||||
|
this.facilityData.push({ |
||||||
|
...item, |
||||||
|
facilityIndex: 0, |
||||||
|
}); |
||||||
|
}); |
||||||
|
uni.showToast({ |
||||||
|
title: "数据获取成功", |
||||||
|
}); |
||||||
|
}); |
||||||
|
}, |
||||||
|
submitClick() { |
||||||
|
let arr = []; |
||||||
|
this.facilitySeceteArr.forEach((item) => { |
||||||
|
arr.push({ |
||||||
|
sscId: item.sscId, |
||||||
|
checkResult: item.facilityIndex, |
||||||
|
describe: item.describe, |
||||||
|
}); |
||||||
|
}); |
||||||
|
this.$u.api |
||||||
|
.saveSpotCheck({ |
||||||
|
sscList: arr, |
||||||
|
}) |
||||||
|
.then((data) => { |
||||||
|
uni.showToast({ |
||||||
|
title: "点检成功", |
||||||
|
}); |
||||||
|
this.facilityValue = ""; |
||||||
|
this.facilityData = []; |
||||||
|
}); |
||||||
|
}, |
||||||
|
}, |
||||||
|
onNavigationBarButtonTap(btn) { |
||||||
|
this.$refs.ifrm.topMenuClick(btn); |
||||||
|
}, |
||||||
|
onShow() {}, |
||||||
|
}; |
||||||
</script> |
</script> |
||||||
|
|
||||||
<style scoped></style> |
<style scoped></style> |
||||||
Loading…
Reference in new issue