131 lines
3.3 KiB
Vue
131 lines
3.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>
|
|
</view>
|
|
<view class="zd-col-17 filter_select">
|
|
<view class="filter_input">压制区域</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row border-bottom">
|
|
<view class="zd-col-7">
|
|
<span class="filter_label">点位</span>
|
|
</view>
|
|
<view class="zd-col-17 filter_select">
|
|
<uni-data-select v-model="index2" :localdata="options2"></uni-data-select>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row border-bottom">
|
|
<view class="zd-col-7">
|
|
<span class="filter_label">条码</span>
|
|
</view>
|
|
<view class="zd-col-17 filter_select">
|
|
<search-box
|
|
v-model="val1"
|
|
/>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row border-bottom">
|
|
<view class="zd-col-7">
|
|
<span class="filter_label">重量</span>
|
|
</view>
|
|
<view class="zd-col-17 filter_select">
|
|
<input type="number" class="filter_input" v-model="val2">
|
|
</view>
|
|
</view>
|
|
<view class="zd-row border-bottom">
|
|
<view class="zd-col-7">
|
|
<span class="filter_label">数量</span>
|
|
</view>
|
|
<view class="zd-col-17 filter_select">
|
|
<input type="number" class="filter_input" v-model="val3">
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row submit-bar">
|
|
<button class="zd-col-6 button-default" @tap="clearUp">清空</button>
|
|
<button class="zd-col-15 button-primary" :class="{'button-info': !index2 || !val1 || !val2 || !val3}" :disabled="disabled" @tap="_mlTask">满料搬运</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import NavBar from '@/components/NavBar.vue'
|
|
import SearchBox from '@/components/SearchBox.vue'
|
|
import {mlTask} from '@/utils/getData2.js'
|
|
|
|
export default {
|
|
components: {
|
|
NavBar,
|
|
SearchBox
|
|
},
|
|
data() {
|
|
return {
|
|
title: '',
|
|
options2: this.generateArray(),
|
|
index2: '',
|
|
val1: '',
|
|
val2: '',
|
|
val3: '',
|
|
disabled: false
|
|
};
|
|
},
|
|
onLoad (options) {
|
|
this.title = options.title
|
|
},
|
|
methods: {
|
|
generateArray(prefix, suffix) {
|
|
const array = []
|
|
const baseText = '压制机'
|
|
const baseValue = 'YJ'
|
|
const maxMachines = 10
|
|
const maxPositions = 2
|
|
|
|
for (let machine = 1; machine <= maxMachines; machine++) {
|
|
for (let position = 1; position <= maxPositions; position++) {
|
|
array.push({
|
|
value: `${baseValue}${String(machine).padStart(2, '0')}XLW${String(position).padStart(2, '0')}`,
|
|
text: `${baseText}${String(machine).padStart(2, '0')}下料位${String(position).padStart(2, '0')}`
|
|
});
|
|
}
|
|
}
|
|
return array
|
|
},
|
|
change (e) {
|
|
this.options1.map((el, i) => {
|
|
if (e === i) {
|
|
this.options2 = el.point
|
|
}
|
|
})
|
|
},
|
|
clearUp () {
|
|
this.index2 = ''
|
|
this.val1 = ''
|
|
this.val2 = ''
|
|
this.val3 = ''
|
|
},
|
|
async _mlTask () {
|
|
this.disabled = true
|
|
if (!this.index2 || !this.val1 || !this.val2 || !this.val3) {
|
|
this.disabled = false
|
|
return
|
|
}
|
|
try {
|
|
let res = await mlTask(this.index2, this.val1, this.val2, this.val3)
|
|
this.disabled = false
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
} catch (e) {
|
|
this.disabled = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script> |