<template>
|
<el-dialog
|
width="50%"
|
title="节点"
|
:visible.sync="innerVisible" append-to-body @close="$emit('update:currshowlist', false)" :show="currshowlist" >
|
<div class="app-container">
|
<el-form :model="partInfo" :rules="dataRule" ref="partInfo"
|
label-width="80px" class="l-mes">
|
<el-row type="flex" justify="space-around">
|
<el-col :span="10">
|
<div style="margin-bottom:20px">
|
<el-form-item label="零件" prop="partName">
|
<el-input class="innerClass" v-model="partInfo.partName" placeholder="请选择零件" :readonly="true" style="width: 90%">
|
<el-button slot="append" icon="el-icon-search" @click="openPartDialog()"></el-button>
|
</el-input>
|
</el-form-item>
|
</div>
|
</el-col>
|
<el-col :span="10">
|
<div style="margin-bottom:20px">
|
<el-form-item label="数量" prop="qpa">
|
<el-input v-model="partInfo.qpa" style="width: 80%"></el-input>
|
</el-form-item>
|
</div>
|
</el-col>
|
</el-row>
|
<el-row type="flex" justify="space-around">
|
<el-col :span="10">
|
<div style="margin-bottom:20px">
|
<el-form-item label="工序" prop="operationName">
|
<el-input class="innerClass" v-model="partInfo.operationName" placeholder="请选择工序" :readonly="true" style="width: 90%">
|
<el-button slot="append" icon="el-icon-search" @click="openOperationDialog()"></el-button>
|
</el-input>
|
</el-form-item>
|
</div>
|
</el-col>
|
<el-col :span="10">
|
<div style="margin-bottom:20px">
|
</div>
|
</el-col>
|
</el-row>
|
</el-form>
|
</div>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="innerVisible=false">取 消</el-button>
|
<el-button type="primary" @click="saveSelectRow">确 定</el-button>
|
</div>
|
<partDialog :currshowlist.sync="showPart" @listenToPartEvent="selectPart"/>
|
<operationDialog :currshowlist.sync="showOperation" :queryParam="routingOperateParam" @listenToRoutingOperateEvent="selectOperation"/>
|
</el-dialog>
|
|
</template>
|
<script>
|
import operationDialog from './routing-operation.vue';
|
import partDialog from '@/views/common/part.vue';
|
import {validateSixDecimalPositive} from "../../../util/validate";
|
|
export default {
|
props: {
|
currshowlist: {
|
type: Boolean,
|
default: false
|
},
|
routingOperateParam: {
|
type: Object,
|
default: () => {
|
return {}
|
},
|
required: true
|
}
|
},
|
data() {
|
return {
|
showPart:false,
|
innerVisible:false,
|
loading:false,
|
parts:[],
|
options: [],
|
partInfo: {id:null,partNo:null,partName:null,qpa:null,operationName:null,operationId:null,drawingNumber:null,ean:null,unit:null},
|
dataRule: {
|
partName: [
|
{required: true, message: '零件不能为空', trigger: 'blur'}
|
],
|
qpa:[
|
{required: true, message: '数量不能为空', trigger: 'blur'},
|
{validator: validateSixDecimalPositive, trigger: 'blur'}
|
],
|
operationName:[
|
{required: true, message: '工序不能为空', trigger: 'blur'}
|
]
|
},
|
showOperation:false
|
}
|
},
|
components: {
|
operationDialog,
|
partDialog
|
},
|
methods: {
|
saveSelectRow(){
|
this.$refs['partInfo'].validate((valid) => {
|
if (valid) {
|
this.$emit("listenToPartInfoEvent", this.partInfo);
|
this.innerVisible = false;
|
}
|
});
|
},
|
openPartDialog() {
|
this.showPart = true;
|
},
|
selectPart(param){
|
if (typeof (param) != "undefined") {
|
this.partInfo.id=param.id;
|
this.partInfo.partNo=param.partNo;
|
this.partInfo.partName=param.partName;
|
this.partInfo.drawingNumber=param.drawingNumber;
|
this.partInfo.ean=param.ean;
|
this.partInfo.unit=param.unit;
|
}
|
},
|
openOperationDialog(){
|
this.showOperation=true;
|
},
|
selectOperation(param) {
|
if (typeof(param) != "undefined") {
|
this.partInfo.operationName=param.operationName;
|
this.partInfo.operationId=param.id;
|
}
|
},
|
},
|
watch: {
|
currshowlist() {
|
this.innerVisible = this.currshowlist;
|
if(this.currshowlist){
|
Object.assign(this.$data.partInfo, this.$options.data().partInfo)
|
}
|
}
|
}
|
}
|
</script>
|