|
|
<template> <div class="customer-css"> <el-dialog :title="titleCon" v-drag v-bind="$attrs" v-on="$listeners" width="200px" style="height: 580px;" class="customer-dialog"> <el-container style="height: 105px;"> <el-form :inline="true" label-position="top" label-width="80px"> <!-- 材料卷号和BOM序号 --> <el-row> <el-col :span="16"> <el-form-item :label="'材料卷号:'"> <el-input ref="rmRollNo" @keyup.native="recordTime" @keyup.enter.native="checkRmRollNo" v-model="pageData.rmRollNo" style="width: 120px"> </el-input> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="16"> <el-form-item :label="'BOM 序号:'"> <el-select v-model="pageData.bomItemNo" :disabled="selectFlag" style="width: 120px"> <el-option v-for="(item, index) in bomList" :key="index" :label="item.itemNo" :value="item.itemNo"> </el-option> </el-select> </el-form-item> </el-col> </el-row> </el-form> </el-container> <span slot="footer" class="dialog-footer"> <el-button type="primary" @click="checkRmRollNo">确定</el-button> <el-button type="primary" @click="closeDialog">关闭</el-button> </span> </el-dialog> </div></template>
<script>import { getBomItemNosByPartNo,} from "@/api/yieldReport/com_produce_material.js";export default { data() { return { titleCon: '材料', sfdcTimeList: [], selectFlag: true, scheduleData: { site: this.$store.state.user.site, userName: this.$store.state.user.name, seqNo: '', orderNo: '', itemNo: 0, partNo: '', workCenterNo: '', workCenterDesc: '', resourceDesc: '', rollNo: '', partDesc: '', planStartTime: '', planFinishTime: '', qtyRequiredOriginal: 0, scheduledDate: '', shiftNo: '', preItemDesc: '', nextItemDesc: '', nextItemNo: 0, operatorId: '', functionName: '', currentRollFlag: false }, timeArray: [], bomList: [], pageData: { site: this.$store.state.user.site, userName: this.$store.state.user.name, seqNo: '', orderNo: '', itemNo: 0, workCenterNo: '', rollNo: '', rmRollNo: '', bomItemNo: '', shiftNo: '', nextItemNo: 0, operatorId: '', closedFlag: 'N' }, operatorData: { site: this.$store.state.user.site, username: this.$store.state.user.name, operatorId: '', operatorName: '', status: '', seqNo: '', showFlag: false }, dataListLoading: false, } }, methods: {
//初始化页面的参数
init(scheduleData, operatorData) { //初始化参数
this.scheduleData = scheduleData; //初始化操作员对象
this.operatorData = JSON.parse(JSON.stringify(operatorData)); //设置页面的参数
this.pageData.orderNo = scheduleData.orderNo; this.pageData.itemNo = scheduleData.itemNo; this.pageData.seqNo = scheduleData.seqNo; this.pageData.rollNo = scheduleData.rollNo; this.pageData.rmRollNo = ''; this.pageData.bomItemNo = ''; this.pageData.closedFlag = 'N'; //自动获取焦点
this.$nextTick(() => { this.$refs.rmRollNo.focus(); }); },
/*关闭modal*/ closeDialog(){ this.$emit('update:visible', false); },
/*记录每一次录入字符串的时间*/ recordTime(){ this.timeArray.push(new Date().getTime()); },
/*检查材料卷号的数据*/ checkRmRollNo() { //首先判断时间是否超过100毫秒
let len = this.timeArray.length; let timeDiff = this.timeArray[len - 1] - this.timeArray[0]; //判断时间是否在范围之内
/*if(timeDiff > 1000){ this.$message.error('请扫码输入!'); }*/ //判断null和空字符串
if (this.pageData.rmRollNo == null || this.pageData.rmRollNo == '') { this.$message.error('材料卷号不能为空!'); return false; }else{ this.pageData.rmRollNo = this.pageData.rmRollNo.trim(); } //处理扫描材料卷号
this.refreshSomItemNos(); },
/*获取BOM行号*/ refreshSomItemNos(){ getBomItemNosByPartNo(this.pageData).then(({data}) => { //判断是否成功
if(data.code == 500){ this.$message.error(data.msg); return false; } this.bomList = data.rows; //首先判断行号是否只有一行
if(this.bomList.length == 1){ //禁用下拉框
this.selectFlag = true; //选中第一个
this.pageData.bomItemNo = data.rows[0].itemNo; }else{ //启用下拉框
this.selectFlag = false; //this.bomList.unshift({'itemNo': '请选择'})
} }); },
/*保存材料上机的记录*/ feedingMaterialRoll(){ //判断卷号是否为空
if (this.pageData.rmRollNo == null || this.pageData.rmRollNo == ''){ this.$message.error('请扫描材料卷号!') return false; } //判断是否选中行号
if(this.pageData.bomItemNo == '请选择' || this.pageData.bomItemNo == ''){ this.$message.error('请选择BOM行号!') return false; }
},
}, created() { // this.factoryList()
// this.getLanguageList()
}}</script>
<style scoped lang="scss">
</style>
|