211 lines
5.9 KiB
Vue
211 lines
5.9 KiB
Vue
<template>
|
|
<view class="zd_container">
|
|
<!-- <nav-bar title="管芯备货"></nav-bar> -->
|
|
<nav-bar :title="title"></nav-bar>
|
|
<view class="zd_content">
|
|
<view class="zd_wrapper">
|
|
<view class="filter_item is-required">
|
|
<view class="filter_label">{{$t('filter.area')}}</view>
|
|
<view class="filter_input_wraper">
|
|
<uni-data-select v-model="index1" :placeholder="$t('uni.dataSelect.placeholder')" :emptyTips="$t('uni.dataSelect.emptyTips')" :localdata="options1" @change="selectChange1"></uni-data-select>
|
|
</view>
|
|
</view>
|
|
<view class="filter_item is-required">
|
|
<view class="filter_label_wraper">
|
|
<span class="filter_label">{{$t('filter.corespecifications')}}</span>
|
|
</view>
|
|
<view class="filter_input_wraper">
|
|
<uni-data-select v-model="index2" :placeholder="$t('uni.dataSelect.placeholder')" :emptyTips="$t('uni.dataSelect.emptyTips')" :localdata="options2" @change="selectChange2"></uni-data-select>
|
|
</view>
|
|
</view>
|
|
<view class="filter_item is-required">
|
|
<view class="filter_label">{{$t('filter.quantity')}}</view>
|
|
<view class="filter_input_wraper">
|
|
<NumberInput
|
|
v-model="val1"
|
|
input-class="filter_input"
|
|
mode="integer"
|
|
/>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd_wrapper grid-wraper">
|
|
<view class="slide_new">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>{{$t('grid.select')}}</th>
|
|
<th>{{$t('grid.number')}}</th>
|
|
<th class="th_2">{{$t('filter.pallet-number')}}</th>
|
|
<th>{{$t('grid.coretype')}}</th>
|
|
<th>{{$t('grid.corename')}}</th>
|
|
<th>{{$t('filter.quantity')}}</th>
|
|
<th>{{$t('grid.signnum')}}</th>
|
|
<th>{{$t('filter.point')}}</th>
|
|
<th>{{$t('filter.area')}}</th>
|
|
<th>{{$t('grid.areaname')}}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="(e, i) in dataList" :key="i" :class="{'checked': e.checked}" @tap="toCheck(e)">
|
|
<td><span class="iconfont icon_unchecked" :class="{'icon_checked': e.checked}"></span></td>
|
|
<td>{{Number(i) + 1}}</td>
|
|
<td class="td_2">{{e.vehicle_code}}</td>
|
|
<td>{{e.material_code}}</td>
|
|
<td>{{e.material_name}}</td>
|
|
<td>{{e.total_num}}</td>
|
|
<td>{{e.sign_num}}</td>
|
|
<td>{{e.point_code}}</td>
|
|
<td>{{e.product_area}}</td>
|
|
<td>{{e.product_area_name}}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row submitbar">
|
|
<button class="zd-col-5 btn-submit btn-default letter-30" @tap="clearUp">{{$t('button.clear')}}</button>
|
|
<button class="zd-col-8 btn-submit btn-success letter-30" :class="{'btn-info': !val1 || !index1 || !index2}" :disabled="disabled" @tap="handleConfirm">{{$t('button.stockup')}}</button>
|
|
<button class="zd-col-8 btn-submit btn-success" @tap="_showPapervehicleView">{{$t('button.refresh')}}</button>
|
|
</view>
|
|
<up-top ref="UT" :scrollTop="top"></up-top>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import NavBar from '@/components/NavBar.vue'
|
|
import SearchBox from '@/components/SearchBox.vue'
|
|
import NumberInput from '@/components/NumberInput.vue'
|
|
import { confirmAction } from '@/utils/utils.js'
|
|
import {showPapervehicleView, moveStock, queryProductArea, queryPaperMaterial} from '@/utils/getData4.js'
|
|
export default {
|
|
components: {
|
|
NavBar,
|
|
SearchBox,
|
|
NumberInput
|
|
},
|
|
data() {
|
|
return {
|
|
val1: '',
|
|
pkId: '',
|
|
pkObj: {},
|
|
// val3: '',
|
|
title: '',
|
|
top: 0,
|
|
options1: [],
|
|
index1: '',
|
|
options2: [],
|
|
index2: '',
|
|
disabled: false,
|
|
checkArr: [],
|
|
dataList: []
|
|
};
|
|
},
|
|
onLoad (options) {
|
|
this.title = options.title
|
|
this._queryProductArea()
|
|
this._queryPaperMaterial()
|
|
this._showPapervehicleView()
|
|
},
|
|
onPageScroll(e) {
|
|
this.$refs.UT.topData(e.scrollTop)
|
|
},
|
|
methods: {
|
|
/** 区域下拉框查询 */
|
|
async _queryProductArea () {
|
|
let res = await queryProductArea()
|
|
this.options1 = [...res.rows]
|
|
},
|
|
selectChange1(e) {
|
|
this.index1 = e
|
|
if (e) {
|
|
this._queryPaperMaterial(e)
|
|
} else {
|
|
this.index2 = ''
|
|
}
|
|
},
|
|
/** 管芯规格下拉框 */
|
|
async _queryPaperMaterial (e) {
|
|
let res = await queryPaperMaterial(e)
|
|
this.options2 = [...res.rows]
|
|
},
|
|
selectChange2(e) {
|
|
this.index2 = e
|
|
},
|
|
// toCheck (e) {
|
|
// this.pkId = this.pkId === e.material_code ? '' : e.material_code
|
|
// this.pkObj = this.pkId === e.material_code ? e : {}
|
|
// },
|
|
toCheck (e) {
|
|
e.checked = !e.checked
|
|
this.checkArr = this.dataList.filter(i => { return i.checked })
|
|
},
|
|
async _paperQueryPaperMaterial () {
|
|
let res = await paperQueryPaperMaterial()
|
|
this.dataList = [...res.rows]
|
|
},
|
|
async handleConfirm() {
|
|
if (this.val1 || !this.index1 || !this.index2) {
|
|
return
|
|
}
|
|
const isConfirmed = await confirmAction(this.$t('toast.prompt'), this.$t('toast.sure-perform-operation'))
|
|
if (isConfirmed) {
|
|
this._moveStock()
|
|
}
|
|
},
|
|
async _moveStock () {
|
|
this.disabled = true
|
|
try {
|
|
let res = await moveStock(this.checkArr)
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
this.disabled = false
|
|
this.pkId = ''
|
|
this.pkObj = {}
|
|
this.dataList = []
|
|
} catch (e) {
|
|
this.disabled = false
|
|
}
|
|
},
|
|
clearUp () {
|
|
this.index1 = ''
|
|
this.index2 = ''
|
|
this.options2 = []
|
|
this.upL = ''
|
|
this.upR = ''
|
|
this.lowL = ''
|
|
this.lowR = ''
|
|
this.disabled = false
|
|
},
|
|
async _showPapervehicleView () {
|
|
let res = await showPapervehicleView(this.index1, this.index2, this.val1)
|
|
if (res) {
|
|
this.dataList = [...res.rows]
|
|
if (this.dataList.length) {
|
|
this.dataList.map(el => {
|
|
this.$set(el, 'checked', false)
|
|
if (el.sign_num > 0) {
|
|
el.checked = true
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style>
|
|
.custom-input {
|
|
border: 1px solid #ccc;
|
|
border-radius: 4px;
|
|
/* padding: 8px 12px; */
|
|
font-size: 16px;
|
|
width: 100%;
|
|
height: 30px;
|
|
line-height: 30px;
|
|
}
|
|
</style>
|