You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
120 lines
4.6 KiB
120 lines
4.6 KiB
<template> |
|
<ifrm ref="ifrm"> |
|
<!-- 安全点检 --> |
|
<uni-forms ref="form" err-show-type="toast"> |
|
<uni-forms-item><input type="text" v-model="facilityValue" @confirm="facilityConfirm" |
|
class="uni-input-border" placeholder="设备编码" /></uni-forms-item> |
|
</uni-forms> |
|
<checkbox-group @change="checkboxChange"> |
|
<uni-table border stripe emptyText="暂无更多数据" class="table"> |
|
<uni-tr> |
|
<uni-th align="center" width="60"></uni-th> |
|
<uni-th align="center">检验项</uni-th> |
|
<uni-th align="center">检验条件</uni-th> |
|
<uni-th align="center">检验结果</uni-th> |
|
<uni-th align="center">描述</uni-th> |
|
</uni-tr> |
|
<uni-tr v-for="(item, index) in facilityData" :key="index"> |
|
<uni-td align="center"> |
|
<checkbox :value="item" :checked="item.checked" /> |
|
</uni-td> |
|
<uni-td align="center">{{ item.checkItem }}</uni-td> |
|
<uni-td align="center">{{ item.checkCon }}</uni-td> |
|
<uni-td align="center" class="tableRequired"> |
|
<picker @change="bindPickerChange($event, index)" :value="item.facilityIndex" :range="array"> |
|
<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> |
|
|
|
<script> |
|
import ifrm from '@/pages/index/ifrm'; |
|
import scan from '../../mixin/scan.js'; |
|
export default { |
|
mixins: [scan], |
|
components: { |
|
ifrm |
|
}, |
|
data() { |
|
return { |
|
facilityValue: '', |
|
array: ['正常', '关机', '异常'], |
|
facilityData: [], |
|
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() {} |
|
}; |
|
</script> |
|
|
|
<style scoped></style> |