退料-增加完好,损坏数量
This commit is contained in:
parent
3459699fcf
commit
bd255a7012
|
|
@ -66,7 +66,11 @@
|
|||
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 10px;">
|
||||
<uni-col :span="6">外观判定:</uni-col>
|
||||
<uni-col :span="16">
|
||||
<uni-easyinput placeholder="请输入内容" v-model="apDetection"/>
|
||||
<!-- <uni-easyinput placeholder="请输入内容" v-model="apDetection"/> -->
|
||||
<radio-group v-model="apDetection" @change="changeRadio">
|
||||
<radio value="完好" checked style="margin-right: 5px;">完好</radio>
|
||||
<radio value="损坏">损坏</radio>
|
||||
</radio-group>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 10px;">
|
||||
|
|
@ -99,10 +103,15 @@ const typeName = ref("")//物资类型
|
|||
const materialName = ref("") //规格型号
|
||||
const typeId = ref("") //类型id
|
||||
const maStatusName = ref("") //状态
|
||||
const apDetection = ref("") //外观判定
|
||||
const apDetection = ref("完好") //外观判定
|
||||
const imgBeseUrl = ref("") //图片展示
|
||||
const bmFileInfos = ref([])//图片数组
|
||||
|
||||
const changeRadio = (e) => {
|
||||
console.log(e.detail.value)
|
||||
apDetection.value = e.detail.value
|
||||
}
|
||||
|
||||
//根据编码获取设备类型
|
||||
const getMaInfo = () => {
|
||||
console.log(maCode.value)
|
||||
|
|
@ -213,6 +222,8 @@ const submitCode = () => {
|
|||
"maCode":maCode.value,
|
||||
"typeId":typeId.value,
|
||||
"apDetection":apDetection.value,
|
||||
goodNum: apDetection.value == '完好' ? 1 : 0,
|
||||
badNum: apDetection.value == '损坏' ? 1 : 0,
|
||||
"bmFileInfos":bmFileInfos.value
|
||||
}
|
||||
let param = {
|
||||
|
|
@ -230,7 +241,7 @@ const submitCode = () => {
|
|||
maId.value=""
|
||||
maCode.value=""
|
||||
typeId.value=""
|
||||
apDetection.value=""
|
||||
apDetection.value="完好"
|
||||
bmFileInfos.value=[]
|
||||
// uni.navigateBack({
|
||||
// delta: 1 // 返回到已存在的页面
|
||||
|
|
@ -295,7 +306,11 @@ onLoad((options)=>{
|
|||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .uni-radio-input {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
.accept {
|
||||
padding: 24rpx;
|
||||
height: 95vh;
|
||||
|
|
|
|||
|
|
@ -189,6 +189,8 @@ const submitCode = () => {
|
|||
maCode: maInfo.value.maCode,
|
||||
typeId: maInfo.value.typeId,
|
||||
apDetection: apDetection.value,
|
||||
goodNum: apDetection.value == '完好' ? 1 : 0,
|
||||
badNum: apDetection.value == '损坏' ? 1 : 0,
|
||||
bmFileInfos: bmFileInfos.value,
|
||||
preNum: 1,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@
|
|||
<uni-td style="font-size: 24rpx;text-align: center;">{{item.maCode}}</uni-td>
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">
|
||||
<!-- <span>{{item.apDetection}}</span> -->
|
||||
<uni-easyinput placeholder="外观" v-model="item.apDetection"/>
|
||||
<!-- <uni-easyinput placeholder="外观" v-model="item.apDetection"/> -->
|
||||
<span>{{ item.goodNum == 1 ? '完好' : '损坏' }}</span>
|
||||
</uni-td>
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">{{item.createBy}}</uni-td>
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">{{item.createTime}}</uni-td>
|
||||
|
|
|
|||
|
|
@ -57,7 +57,9 @@
|
|||
<uni-th width="100px" style="font-size: 24rpx;" align="center">规格型号</uni-th>
|
||||
<uni-th width="60px" style="font-size: 24rpx;" align="center">在用数</uni-th>
|
||||
<uni-th width="90px" style="font-size: 24rpx;" align="center">退料数</uni-th>
|
||||
<uni-th width="90px" style="font-size: 24rpx;" align="center">外观</uni-th>
|
||||
<!-- <uni-th width="90px" style="font-size: 24rpx;" align="center">外观</uni-th> -->
|
||||
<uni-th width="90px" style="font-size: 24rpx;" align="center">完好数量</uni-th>
|
||||
<uni-th width="90px" style="font-size: 24rpx;" align="center">损坏数量</uni-th>
|
||||
<uni-th width="70px" style="font-size: 24rpx;" align="center">操作</uni-th>
|
||||
</uni-tr>
|
||||
<!-- 表格数据行 -->
|
||||
|
|
@ -72,16 +74,38 @@
|
|||
type="number"
|
||||
:clearable="false"
|
||||
@input="onChangeNumber(item)"
|
||||
styles="width: 100rpx"
|
||||
:styles="{width: '100rpx'}"
|
||||
/>
|
||||
</uni-td>
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">
|
||||
<uni-easyinput
|
||||
placeholder="外观"
|
||||
v-model="item.apDetection"
|
||||
styles="width: 100rpx"
|
||||
placeholder="完好数量"
|
||||
v-model="item.goodNum"
|
||||
type="number"
|
||||
:clearable="false"
|
||||
@change="changeNum(item)"
|
||||
:styles="{width: '100rpx'}"
|
||||
:disabled="!item.preNum"
|
||||
/>
|
||||
</uni-td>
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">
|
||||
<uni-easyinput
|
||||
placeholder="损坏数量"
|
||||
v-model="item.badNum"
|
||||
type="number"
|
||||
:clearable="false"
|
||||
@change="changeNum(item)"
|
||||
:styles="{width: '100rpx'}"
|
||||
:disabled="!item.preNum"
|
||||
/>
|
||||
</uni-td>
|
||||
<!-- <uni-td style="font-size: 24rpx;text-align: center;">
|
||||
<uni-easyinput
|
||||
placeholder="外观"
|
||||
v-model="item.apDetection"
|
||||
:styles="{width: '100rpx'}"
|
||||
/>
|
||||
</uni-td> -->
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">
|
||||
<view class="uni-group">
|
||||
<view class="action-btn" @click="uploadImg(item)">
|
||||
|
|
@ -167,6 +191,24 @@ const selectMaCode = (e) => {
|
|||
const submitNum = () => {
|
||||
console.log(taskInfo.value)
|
||||
console.log(typeList.value)
|
||||
// 校验 preNum 必须大于 0
|
||||
if (typeList.value.length === 0) {
|
||||
console.log('🚀 ~ submitNum ~ typeList.value:', typeList.value)
|
||||
uni.showToast({
|
||||
title: '请添加退料物资',
|
||||
icon: 'none',
|
||||
})
|
||||
return
|
||||
}
|
||||
for (let i = 0; i < typeList.value.length; i++) {
|
||||
if (typeList.value[i].preNum <= 0 || !typeList.value[i].preNum) {
|
||||
uni.showToast({
|
||||
title: '退料数不能为空或等于0',
|
||||
icon: 'none',
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
let obj = {
|
||||
"backApplyInfo":taskInfo.value,
|
||||
"backApplyDetailsList":typeList.value
|
||||
|
|
@ -257,6 +299,30 @@ const onChangeNumber = (item) => {
|
|||
}
|
||||
},500)
|
||||
}
|
||||
const changeNum = (row) => {
|
||||
console.log('🚀 ~ changeNum ~ row:', row)
|
||||
// 将badNum 和 goodNum 向上取整
|
||||
// 只能输入正整数 过滤掉除正整数外的东西
|
||||
if (row.badNum) {
|
||||
row.badNum = Math.ceil(String(row.badNum).replace(/[^\d]/g, ''))
|
||||
console.log('🚀 ~ changeNum ~ row.badNum:', row.badNum)
|
||||
}
|
||||
if (row.goodNum) {
|
||||
console.log('🚀 ~ changeNum ~ row.goodNum:', row.goodNum)
|
||||
row.goodNum = Math.ceil(String(row.goodNum).replace(/[^\d]/g, ''))
|
||||
}
|
||||
// 不能大于preNum
|
||||
if (Number(row.badNum) + Number(row.goodNum) > row.preNum) {
|
||||
console.log('🚀 ~ changeNum ~ row.badNum + row.goodNum > row.preNum:', row.badNum , row.goodNum)
|
||||
// this.$message.error('完好数量和损坏数量之和不能大于退料数量')
|
||||
uni.showToast({
|
||||
title: '完好数量和损坏数量之和不能大于退料数量',
|
||||
icon: 'none',
|
||||
})
|
||||
row.badNum = 0
|
||||
row.goodNum = 0
|
||||
}
|
||||
}
|
||||
|
||||
onLoad((options)=>{
|
||||
console.log(options)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@
|
|||
<uni-th width="100px" style="font-size: 24rpx;" align="center">规格型号</uni-th>
|
||||
<uni-th width="80px" style="font-size: 24rpx;" align="center">在用数</uni-th>
|
||||
<uni-th width="80px" style="font-size: 24rpx;" align="center">退料数</uni-th>
|
||||
<uni-th width="100px" style="font-size: 24rpx;" align="center">外观</uni-th>
|
||||
<!-- <uni-th width="100px" style="font-size: 24rpx;" align="center">外观</uni-th> -->
|
||||
<uni-th width="100px" style="font-size: 24rpx;" align="center">完好数量</uni-th>
|
||||
<uni-th width="100px" style="font-size: 24rpx;" align="center">损坏数量</uni-th>
|
||||
</uni-tr>
|
||||
<!-- 表格数据行 -->
|
||||
<uni-tr v-for="(item,index) in typeList" :key="item.id">
|
||||
|
|
@ -48,8 +50,14 @@
|
|||
<uni-td style="font-size: 24rpx;text-align: center;">
|
||||
<span>{{item.preNum}}</span>
|
||||
</uni-td>
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">
|
||||
<!-- <uni-td style="font-size: 24rpx;text-align: center;">
|
||||
<span>{{item.apDetection}}</span>
|
||||
</uni-td> -->
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">
|
||||
<span>{{item.goodNum}}</span>
|
||||
</uni-td>
|
||||
<uni-td style="font-size: 24rpx;text-align: center;">
|
||||
<span>{{item.badNum}}</span>
|
||||
</uni-td>
|
||||
</uni-tr>
|
||||
</uni-table>
|
||||
|
|
|
|||
Loading…
Reference in New Issue