153 lines
4.7 KiB
Vue
153 lines
4.7 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_wraper">
|
|
<span class="filter_label">{{$t('filter.pallet-number')}}</span>
|
|
</view>
|
|
<view class="filter_input_wraper">
|
|
<search-box v-model="val1" />
|
|
</view>
|
|
</view>
|
|
<view class="filter_item is-required">
|
|
<view class="filter_label_wraper">
|
|
<span class="filter_label">{{$t('filter.tubecode')}}</span>
|
|
</view>
|
|
<view class="filter_input_wraper">
|
|
<search-box v-model="val3" />
|
|
</view>
|
|
</view>
|
|
<view class="filter_item is-required">
|
|
<view class="filter_label">{{$t('filter.rownum')}}</view>
|
|
<view class="filter_input_wraper">
|
|
<uni-data-select v-model="index1" :placeholder="$t('uni.dataSelect.placeholder')" :localdata="options1" @change="selectChange1"></uni-data-select>
|
|
</view>
|
|
</view>
|
|
<view class="filter_item is-required">
|
|
<view class="filter_label">{{$t('filter.colnum')}}</view>
|
|
<view class="filter_input_wraper">
|
|
<uni-data-select v-model="index2" :placeholder="$t('uni.dataSelect.placeholder')" :localdata="options2" @change="selectChange2"></uni-data-select>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row">
|
|
<view class="zd-col-19">
|
|
</view>
|
|
<view class="zd-col-4">
|
|
<button class="mini-btn" size="mini" style="display: block;" type="primary" @tap="handleAdd02">{{$t('button.add')}}</button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd_wrapper grid-wraper">
|
|
<view class="slide_new slide">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th width="30%">{{$t('filter.pallet-number')}}</th>
|
|
<th width="30%">{{$t('filter.tubecode')}}</th>
|
|
<th width="20%">{{$t('filter.rownum')}}</th>
|
|
<th width="20%">{{$t('filter.colnum')}}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="(e, i) in dataList" :key="i">
|
|
<td>{{e.vehicle_code}}</td>
|
|
<td>{{e.paper_code}}</td>
|
|
<td>{{e.row_num}}</td>
|
|
<td>{{e.col_num}}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row submitbar">
|
|
<button class="zd-col-5 btn-submit btn-default" @tap="clearUp">{{$t('button.clear')}}</button>
|
|
<button class="zd-col-8 btn-submit btn-success" :class="{'btn-info': !dataList.length}" :disabled="disabled" @tap="handleConfirm('1')">{{$t('button.bind')}}</button>
|
|
<button class="zd-col-8 btn-submit btn-success" :class="{'btn-info': !dataList.length}" :disabled="disabled" @tap="handleConfirm('2')">{{$t('button.cleanup')}}</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import NavBar from '@/components/NavBar.vue'
|
|
import SearchBox from '@/components/SearchBox.vue'
|
|
import { confirmAction } from '@/utils/utils.js'
|
|
import {queryPaperMaterial} from '@/utils/getData2.js'
|
|
import {operateIvt} from '@/utils/getData3.js'
|
|
export default {
|
|
components: {
|
|
NavBar,
|
|
SearchBox
|
|
},
|
|
data() {
|
|
return {
|
|
title: '',
|
|
val1: '',
|
|
val3: '',
|
|
options1: [{value: '1', text: '1'}, {value: '2', text: '2'}, {value: '3', text: '3'}, {value: '4', text: '4'}, {value: '5', text: '5'}],
|
|
index1: '',
|
|
options2: [{value: '1', text: '1'}, {value: '2', text: '2'}, {value: '3', text: '3'}, {value: '4', text: '4'}, {value: '5', text: '5'}],
|
|
index2: '',
|
|
dataList: [],
|
|
disabled: false
|
|
};
|
|
},
|
|
onLoad (options) {
|
|
this.title = options.title
|
|
},
|
|
methods: {
|
|
/** 选择器 */
|
|
selectChange1 (e) {
|
|
this.index1 = e
|
|
},
|
|
selectChange2 (e) {
|
|
this.index2 = e
|
|
},
|
|
handleAdd02 () {
|
|
if (!this.val1 || !this.index1 || !this.index2 || !this.val3) {
|
|
return
|
|
}
|
|
if (this.dataList.length > 0 && (this.index1 !== this.dataList[0].row_num)) {
|
|
return
|
|
}
|
|
if (this.dataList.length > 4) {
|
|
return
|
|
}
|
|
this.dataList.push({vehicle_code: this.val1, row_num: this.index1, col_num: this.index2, paper_code: this.val3})
|
|
},
|
|
async handleConfirm(type) {
|
|
if (!this.dataList.length) {
|
|
return
|
|
}
|
|
const isConfirmed = await confirmAction("确认操作", "确定要执行此操作吗?")
|
|
if (isConfirmed) {
|
|
this._operateIvt(type)
|
|
}
|
|
},
|
|
async _operateIvt (type) {
|
|
this.disabled = true
|
|
try {
|
|
let res = await operateIvt(type, this.dataList)
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
this.clearUp()
|
|
this.disabled = false
|
|
} catch (e) {
|
|
this.disabled = false
|
|
}
|
|
},
|
|
clearUp () {
|
|
this.val1 = ''
|
|
this.val3 = ''
|
|
this.index1 = ''
|
|
this.index2 = ''
|
|
this.dataList = []
|
|
}
|
|
}
|
|
}
|
|
</script> |