| | |
| | | </div>
|
| | | </u-swipe-action-item>
|
| | | </u-swipe-action>
|
| | | <view class="" style="height: 88rpx;"></view>
|
| | | <u-safe-bottom></u-safe-bottom>
|
| | | <div class="tl_footer">
|
| | | <button class="tl_footer_submit" v-preventReClick @click="submit">提交</button>
|
| | | </div>
|
| | | <SelectMaterial ref="selectMaterial" @selectAction="getValue" />
|
| | | <!-- <SelectMultipleMaterial ref="selectMultipleMaterial" @selected="getMaterails"/> -->
|
| | | </view>
|
| | |
| | | this.materialList[index].num = ''
|
| | | }
|
| | | },
|
| | | getValue(v) {
|
| | | getValue(item) {
|
| | | for (let i = 0; i < this.materialList.length; i++) {
|
| | | if (item.id === this.materialList[i].id) {
|
| | | uni.$u.toast({
|
| | |
| | | this.materialList[this.index].qualityType = item.qualityType
|
| | | this.materialList[this.index].unitAttribute = item.unitAttribute
|
| | | },
|
| | | // getMaterails({materials}) {
|
| | | // console.log(item);
|
| | | // }
|
| | | submit() {
|
| | | let temp = this.materialList.findIndex(item => !item.id || !item.num)
|
| | | if (temp != -1) {
|
| | | uni.$u.toast(`请先完善第${temp + 1}条投料信息`)
|
| | | return
|
| | | }
|
| | | let total = this.materialList.reduce((accumulator, currentValue) => accumulator + Number(currentValue.num),
|
| | | 0)
|
| | | console.log(total);
|
| | | if (this.info.bomType != 1 && this.info.hasBom != 1) {
|
| | | if (total > this.info.planNum) {
|
| | | uni.$u.toast(`投料数量不能大于计划数量`)
|
| | | return
|
| | | }
|
| | | }
|
| | | let recordList = this.materialList.map(item => {
|
| | | return {
|
| | | wstockId: item.id,
|
| | | num: item.num
|
| | | }
|
| | | })
|
| | | createMaterialStandard({
|
| | | id: this.workorderId,
|
| | | recordList
|
| | | }).then(res => {
|
| | | if (res.code === 200) {
|
| | | // Toast.success({ message: '投料成功', duration: 2000, forbidClick: true })
|
| | | // setTimeout(() => {
|
| | | // router.go(-1)
|
| | | // }, 2000) |
| | | uni.$u.toast(`投料成功`) |
| | | uni.$emit('addMaterial') |
| | | uni.navigateBack()
|
| | | }
|
| | | })
|
| | | }
|
| | | }
|
| | | }
|
| | | </script>
|
| | |
| | | width: 100%;
|
| | | position: fixed;
|
| | | bottom: 0;
|
| | | left: 0;
|
| | | padding: 0 30rpx 68rpx 30rpx;
|
| | | padding: 0 30rpx calc(env(safe-area-inset-bottom) + 20rpx);
|
| | | box-sizing: border-box;
|
| | | z-index: 999;
|
| | | background-color: #fff;
|
| | |
|
| | | .tl_footer_submit {
|
| | | width: 690rpx;
|