<template>
|
<el-dialog width="60%" title="零件" top="5vh"
|
:visible.sync="innerVisible" append-to-body @close="$emit('update:currshowlist', false)"
|
:show="currshowlist" class="part-dialog">
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="120px" class="l-mes">
|
<el-row>
|
<el-col :span="10">
|
<el-form-item label="零件编号" prop="partFamilyNo">
|
<el-input v-model="dataForm.partNo" placeholder="零件族编号"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="10">
|
<el-form-item label="零件名称" prop="partFamilyName">
|
<el-input v-model="dataForm.partName" placeholder="零件族名称"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="3" :offset="1">
|
<el-button @click="getSelectPart">搜索</el-button>
|
</el-col>
|
</el-row>
|
</el-form>
|
<el-table border
|
v-loading="listLoading"
|
:data="partList"
|
height="300px"
|
@row-dblclick="doubleClick"
|
@row-click = "rowClick"
|
highlight-current-row
|
@current-change="handleCurrentChange"
|
>
|
<el-table-column prop="PART_DESC" label="零件名称" ></el-table-column>
|
<el-table-column prop="UNIT_MEAS" label="单位" ></el-table-column>
|
<el-table-column prop="PART_NO" label="零件号" align="center"></el-table-column>
|
</el-table>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="innerVisible = false">取消</el-button>
|
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
</span>
|
</el-dialog>
|
</template>
|
|
<script>
|
import {getPart} from "../../../api/basic/part";
|
|
export default {
|
props: {
|
currshowlist: {
|
type: Boolean,
|
default: false
|
},
|
multiSelect:{
|
type: Boolean,
|
default: false
|
}
|
},
|
data () {
|
return {
|
partList:[],
|
listLoading: false,
|
currentRow: null,
|
multipleSelection: [],
|
innerVisible:false,
|
visible: false,
|
dataForm: {
|
partNo: '',
|
partName: '',
|
},
|
dataRule: {
|
}
|
}
|
},
|
watch: {
|
currshowlist() {
|
this.innerVisible = this.currshowlist;
|
if(this.currshowlist){
|
}
|
},
|
innerVisible:{
|
handler(newValue, oldValue) {
|
if(newValue) {
|
this.dataForm.partNo=null
|
this.dataForm.partName=null
|
this.partList =[]
|
}
|
},
|
immediate: true
|
}
|
},
|
methods: {
|
//根据搜索条件搜索ERP零件
|
getSelectPart(){
|
let queryParam = {
|
partNo:this.dataForm.partNo,
|
partName:this.dataForm.partName
|
}
|
getPart(queryParam).then(res => {
|
this.partList =res.data.data.data.INVENTORY_PART_INFO
|
})
|
|
},
|
handleCurrentChange(val) {
|
this.currentRow = val;
|
},
|
doubleClick(){
|
this.dataFormSubmit()
|
},
|
rowClick(row){
|
this.currentRow = row;
|
},
|
dataFormSubmit(){
|
if (this.currentRow == null){
|
this.$message.error('请选择零件')
|
return
|
}
|
if(this.multiSelect){
|
this.$emit("handleSelectionChange", this.multipleSelection);
|
}else{
|
this.$emit("listenToPartEvent", this.currentRow);
|
}
|
this.innerVisible = false;
|
},
|
}
|
}
|
</script>
|