init project
This commit is contained in:
109
pages/esop/esopPwo.vue
Normal file
109
pages/esop/esopPwo.vue
Normal file
@@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-row>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="工位编码" :labelWidth='90' name="stationCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar" v-model="formData.stationCode"
|
||||
type="text" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
<uni-col :span="24">
|
||||
<uni-forms-item label="作业编码" :labelWidth='90' name="pwoJobCode">
|
||||
<uni-easyinput suffixIcon="scan" @iconClick="scanBar1" v-model="formData.pwoJobCode"
|
||||
type="text" />
|
||||
</uni-forms-item>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-forms>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listStation,
|
||||
listPwoJob,
|
||||
addCustomizeEsop
|
||||
} from "@/api/esop/esop.js";
|
||||
export default {
|
||||
mounted() {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
pwoJobCode: null,
|
||||
stationCode: null,
|
||||
|
||||
},
|
||||
rules: {
|
||||
pwoJobCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入作业编码!'
|
||||
}]
|
||||
},
|
||||
stationCode: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '请输入工位编码!'
|
||||
}]
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
scanBar() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.stationCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
scanBar1() {
|
||||
const _this = this;
|
||||
uni.scanCode({
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
_this.formData.pwoJobCode = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
this.$refs["form"].validate().then(valid => {
|
||||
if (this.formData.stationCode) {
|
||||
let obj = {
|
||||
stationCode: this.formData.stationCode
|
||||
}
|
||||
listStation(obj).then(res => {
|
||||
this.formData.stationId = res.rows[0].id;
|
||||
let pwoJobCd = {
|
||||
code: this.formData.pwoJobCode
|
||||
}
|
||||
listPwoJob(pwoJobCd).then(res => {
|
||||
this.formData.pwoJobId = res.rows[0].id;
|
||||
this.$modal.loading('提交中')
|
||||
addCustomizeEsop(this.formData).then(response => {
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgSuccess("提交成功!");
|
||||
setTimeout(() => {
|
||||
this.$tab.switchTab("/pages/work/index");
|
||||
}, 500);
|
||||
});
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user