222 lines
6.3 KiB
Vue
222 lines
6.3 KiB
Vue
<template>
|
|
<view class="zd_container">
|
|
<!-- 产线下料 -->
|
|
<nav-bar :title="title"></nav-bar>
|
|
<view class="zd_content">
|
|
<view class="zd_wrapper">
|
|
<view class="zd-row border-bottom">
|
|
<view class="zd-col-7">
|
|
<!-- <span class="filter_label">点位</span> -->
|
|
<span class="filter_label">{{$t('filter.point')}}</span>
|
|
</view>
|
|
<view class="zd-col-24 filter_select">
|
|
<search-box
|
|
v-model="val1"
|
|
@handleChange="handleChange1"
|
|
/>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row border-bottom">
|
|
<view class="zd-col-9">
|
|
<!-- <span class="filter_label">送往区域</span> -->
|
|
<span class="filter_label">{{$t('filter.send-area')}}</span>
|
|
</view>
|
|
<view class="zd-col-24 filter_select">
|
|
<uni-data-select v-model="index" :localdata="options" placeholder="" @change="selectChange"></uni-data-select>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd_wrapper grid-wraper">
|
|
<view class="slide_new">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<!-- <th>序号</th>
|
|
<th>卷号</th>
|
|
<th>物料编码</th>
|
|
<th>物料品种</th>
|
|
<th>数量</th>
|
|
<th>单位</th> -->
|
|
<th>{{$t('grid.number')}}</th>
|
|
<th>{{$t('grid.roll-number')}}</th>
|
|
<th>{{$t('grid.material-code')}}</th>
|
|
<th>{{$t('grid.material-name')}}</th>
|
|
<th>{{$t('grid.quantity')}}</th>
|
|
<th>{{$t('grid.unit')}}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="(e, i) in dataList" :key="i" :class="{'checked': e.mid === pkId}">
|
|
<td @tap="toCheck(e)">{{i+1}}</td>
|
|
<td><input type="text" class="sin_input" style="width: 135px;" v-model="e.container_code"></td>
|
|
<td @tap="toJump(e)">{{e.material_code}}</td>
|
|
<td>{{e.material_name}}</td>
|
|
<td><input type="number" class="sin_input" v-model="e.qty" @blur="handleBlur(e)"></td>
|
|
<td>{{e.measure_unit_id}}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row submit-bar">
|
|
<!-- <button class="zd-col-22 button-primary" :class="{'button-info': !val1 || !dataList.length || !index}" :disabled="disabled" @tap="_productBlanking">{{$t('button.confirm-down-material')}}</button> -->
|
|
<button class="zd-col-7 button-primary" :class="{'button-info': !val1 || !dataList.length}" :disabled="disabled" @tap="handleConfirm('1')">{{$t('button.scxl')}}</button>
|
|
<button class="zd-col-8 button-default" :class="{'button-info': !val1 || !dataList.length}" :disabled="disabled" @tap="handleConfirm('2')">{{$t('button.zjps')}}</button>
|
|
<button class="zd-col-8 button-default" :class="{'button-info': !val1 || !index || !dataList.length}" :disabled="disabled" @tap="handleConfirm('3')">{{$t('button.zjxl')}}</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import NavBar from '@/components/NavBar.vue'
|
|
import SearchBox from '@/components/SearchBox.vue'
|
|
import { confirmAction } from '@/utils/utils.js'
|
|
import {getNextRegionsByPoint, getMaterialInfoByPoint, productBlanking} from '@/utils/getData4.js'
|
|
export default {
|
|
components: {
|
|
NavBar,
|
|
SearchBox
|
|
},
|
|
data() {
|
|
return {
|
|
title: '',
|
|
val1: '',
|
|
dataList: [],
|
|
pkId: '',
|
|
pkObj: {},
|
|
currentData: {},
|
|
options: [],
|
|
index: '',
|
|
disabled: false
|
|
};
|
|
},
|
|
onLoad (options) {
|
|
this.title = options.title
|
|
},
|
|
onShow() {
|
|
// if (this.$store.getters.publicObj !== '') {
|
|
// this.currentData = this.$store.getters.publicObj
|
|
// this.pkId = ''
|
|
// this.dataList.map((item) => {
|
|
// if (this.pkObj.mid === item.mid) {
|
|
// item.material_name = this.currentData.material_name
|
|
// item.material_code = this.currentData.material_code
|
|
// item.measure_unit_id = this.currentData.measure_unit_id
|
|
// }
|
|
// })
|
|
// this.$store.dispatch('setPublicObj', '')
|
|
// }
|
|
},
|
|
created () {
|
|
},
|
|
methods: {
|
|
handleChange1 (e) {
|
|
if (e) {
|
|
this._getMaterialInfoByPoint()
|
|
this._getNextRegionsByPoint()
|
|
}
|
|
},
|
|
async _getNextRegionsByPoint () {
|
|
try {
|
|
let res = await getNextRegionsByPoint(this.val1)
|
|
if (res) {
|
|
this.options = res.data
|
|
} else {
|
|
this.options =[]
|
|
}
|
|
} catch (e) {
|
|
this.options = []
|
|
}
|
|
},
|
|
async _getMaterialInfoByPoint () {
|
|
let res = await getMaterialInfoByPoint(this.val1)
|
|
this.dataList = res.data
|
|
// this.totalCount = res.totalElements
|
|
// if (res.totalElements > 0) {
|
|
// const dataMap = res.data
|
|
// this.dataList = this.reload ? dataMap : this.dataList.concat(dataMap)
|
|
// this.reload = false
|
|
// } else {
|
|
// this.dataList = []
|
|
// }
|
|
// if (this.totalCount == this.dataList.length) {
|
|
// this.reload = false
|
|
// this.status = 'noMore'
|
|
// }
|
|
},
|
|
selectChange (e) {
|
|
this.index = e
|
|
},
|
|
toCheck (e) {
|
|
this.pkId = this.pkId === e.mid ? '' : e.mid
|
|
this.pkObj = this.pkId === e.mid ? e : {}
|
|
},
|
|
handleBlur (e) {
|
|
if (e.qty) {
|
|
if (e.qty < 0) {
|
|
e.qty = 0
|
|
} else {
|
|
e.qty = e.qty.replace(/[^0-9]/g, '')
|
|
e.qty = e.qty.replace(/^0+/, '') || '0'
|
|
}
|
|
} else {
|
|
// uni.showToast({
|
|
// title: '数量必填',
|
|
// icon: 'none'
|
|
// })
|
|
}
|
|
},
|
|
toJump (e) {
|
|
this.pkId = this.pkId === e.mid ? '' : e.mid
|
|
this.pkObj = this.pkId === e.mid ? e : {}
|
|
this.pkId = ''
|
|
uni.navigateTo({
|
|
url: '/pages/ftdlDTY/mater-list0?title=查询物料'
|
|
})
|
|
},
|
|
clearUp () {
|
|
this.val1 = ''
|
|
this.index = ''
|
|
this.dataList = []
|
|
this.pkId = ''
|
|
this.pkObj = {}
|
|
this.currentData = {}
|
|
this.disabled = false
|
|
},
|
|
async handleConfirm(type) {
|
|
if (type === '3') {
|
|
if (!this.val1 || !this.dataList.length || !this.index) {
|
|
return
|
|
}
|
|
} else {
|
|
if (!this.val1 || !this.dataList.length) {
|
|
return
|
|
}
|
|
}
|
|
const isConfirmed = await confirmAction("确认操作", "确定要执行此操作吗?")
|
|
if (isConfirmed) {
|
|
this._productBlanking(type)
|
|
}
|
|
},
|
|
async _productBlanking (type) {
|
|
this.disabled = true
|
|
try {
|
|
let res = await productBlanking(this.val1, this.dataList, this.index, type)
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
this.clearUp()
|
|
this.disabled = false
|
|
} catch (e) {
|
|
this.disabled = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style lang="stylus">
|
|
.checked
|
|
background #ff0
|
|
</style> |