86 lines
1.7 KiB
Vue
86 lines
1.7 KiB
Vue
|
|
<template>
|
||
|
|
<view>
|
||
|
|
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||
|
|
<uni-row>
|
||
|
|
<uni-col :span="24">
|
||
|
|
<uni-forms-item label="物料件号" :labelWidth='90' name="pieceNo">
|
||
|
|
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.pieceNo" type="text" />
|
||
|
|
</uni-forms-item>
|
||
|
|
</uni-col>
|
||
|
|
</uni-row>
|
||
|
|
</uni-forms>
|
||
|
|
<u-button type="primary" @click="submit">提交</u-button>
|
||
|
|
|
||
|
|
</view>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
import {
|
||
|
|
addPiece
|
||
|
|
} from "@/api/mes/jobReport.js";
|
||
|
|
|
||
|
|
export default {
|
||
|
|
mounted() {
|
||
|
|
|
||
|
|
},
|
||
|
|
data() {
|
||
|
|
return {
|
||
|
|
formData: {
|
||
|
|
pieceNo: null,
|
||
|
|
},
|
||
|
|
|
||
|
|
rules: {
|
||
|
|
pieceNo: {
|
||
|
|
rules: [{
|
||
|
|
required: true,
|
||
|
|
errorMessage: '请输入件号!'
|
||
|
|
}]
|
||
|
|
},
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
scanBar() {
|
||
|
|
const _this = this;
|
||
|
|
uni.scanCode({
|
||
|
|
scanType: ['qrCode', 'barCode'],
|
||
|
|
success: function(res) {
|
||
|
|
_this.formData.pieceNo = res.result;
|
||
|
|
_this.scanBarCode(_this.formData.pieceNo);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
},
|
||
|
|
submit() {
|
||
|
|
const _this = this;
|
||
|
|
this.$refs.form.validate().then(res => {
|
||
|
|
uni.showModal({
|
||
|
|
title: '提示',
|
||
|
|
content: '您确定转入吗?',
|
||
|
|
success: function(res) {
|
||
|
|
if (res.confirm) {
|
||
|
|
console.log(_this.formData.pieceNo);
|
||
|
|
_this.$modal.loading('提交中')
|
||
|
|
addPiece(_this.formData.pieceNo).then(res => {
|
||
|
|
_this.$modal.closeLoading();
|
||
|
|
_this.$modal.msgSuccess("件号转入成功!");
|
||
|
|
setTimeout(() => {
|
||
|
|
_this.$tab.switchTab("/pages/work/index");
|
||
|
|
}, 500);
|
||
|
|
});
|
||
|
|
|
||
|
|
} else if (res.cancel) {
|
||
|
|
console.log('用户点击取消');
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
},
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style>
|
||
|
|
|
||
|
|
|
||
|
|
</style>
|