<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-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" />
|
</el-dialog>
|
</template>
|
<script>
|
import partDialog from '@/views/common/part.vue'
|
import { validateSixDecimalPositive } from '../../../util/validate'
|
|
export default {
|
props: {
|
currshowlist: {
|
type: Boolean,
|
default: false
|
},
|
nodeParam: {
|
type: Object,
|
default: () => {
|
return {}
|
},
|
required: true
|
}
|
},
|
data() {
|
return {
|
showPart: false,
|
innerVisible: false,
|
options: [],
|
partInfo: {
|
bomId: null,
|
id: null,
|
partId: null,
|
partNo: null,
|
partName: null,
|
qpa: null,
|
drawingNumber: null,
|
unit: null
|
},
|
dataRule: {
|
partName: [
|
{ required: true, message: '零件不能为空', trigger: 'blur' }
|
],
|
qpa: [
|
{ required: true, message: '数量不能为空', trigger: 'blur' },
|
{ validator: validateSixDecimalPositive, trigger: 'blur' }
|
]
|
}
|
}
|
},
|
components: {
|
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.partId = param.id
|
this.partInfo.partNo = param.partNo
|
this.partInfo.partName = param.partName
|
this.partInfo.drawingNumber = param.drawingNumber
|
this.partInfo.unit = param.unit
|
}
|
}
|
},
|
watch: {
|
currshowlist() {
|
this.innerVisible = this.currshowlist
|
if (this.currshowlist) {
|
this.partInfo.id = this.nodeParam.id
|
this.partInfo.bomId = this.nodeParam.bomId
|
this.partInfo.partId = this.nodeParam.partId
|
this.partInfo.partNo = this.nodeParam.partNo
|
this.partInfo.partName = this.nodeParam.partName
|
this.partInfo.qpa = this.nodeParam.qpa
|
this.partInfo.drawingNumber = this.nodeParam.drawingNumber
|
this.partInfo.unit = this.nodeParam.unit
|
}
|
}
|
}
|
}
|
</script>
|