<template>
|
<el-dialog
|
width="60%"
|
title="销售件"
|
top="10vh"
|
:visible.sync="innerVisible"
|
append-to-body
|
@close="$emit('update:currshowlist', false)"
|
:show="currshowlist"
|
class="part-dialog"
|
>
|
<el-form
|
:model="dataForm"
|
:rules="dataRule"
|
ref="dataForm"
|
label-width="120px"
|
class="l-mes"
|
>
|
<el-row>
|
<el-col :span="10">
|
<el-form-item label="销售件号" prop="salesPartNo" label-width="60px">
|
<el-input
|
v-model="dataForm.salesPartNo"
|
placeholder="销售件号"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="10">
|
<el-form-item
|
label="销售件描述"
|
prop="salesPartName"
|
label-width="80px"
|
>
|
<el-input
|
v-model="dataForm.salesPartName"
|
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="salesPartList"
|
height="300px"
|
highlight-current-row
|
@current-change="handleCurrentChange"
|
>
|
<el-table-column
|
prop="salesPartNo"
|
label="销售件号"
|
align="center"
|
></el-table-column>
|
<el-table-column
|
prop="salesPartName"
|
label="销售件描述"
|
align="center"
|
show-overflow-tooltip
|
></el-table-column>
|
<el-table-column
|
prop="partNo"
|
label="库存件"
|
align="center"
|
></el-table-column>
|
<el-table-column
|
prop="partName"
|
label="库存件描述"
|
show-overflow-tooltip
|
align="center"
|
></el-table-column>
|
<el-table-column
|
prop="ifsSalesUnit"
|
label="销售计量单位"
|
align="center"
|
></el-table-column>
|
<el-table-column
|
prop="ifsConvFactor"
|
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 {
|
querySalesPartStd,
|
batchUpdateSalePartNo,
|
queryPartPropertiesStd
|
} from '@/api/plan/customerorder'
|
|
export default {
|
props: {
|
currshowlist: {
|
type: Boolean,
|
default: false
|
},
|
multiSelect: {
|
type: Boolean,
|
default: false
|
},
|
customerOrderList: {
|
type: Array,
|
default: () => {
|
return []
|
}
|
}
|
},
|
data() {
|
return {
|
salesPartList: [],
|
listLoading: false,
|
currentRow: null,
|
innerVisible: false,
|
dataForm: {
|
salesPartNo: '',
|
salesPartName: '',
|
voltageLevel: null,
|
specifications: null,
|
modelNumber: null
|
},
|
dataRule: {},
|
voltageLevelLoading: false,
|
voltageLevelOptions: [],
|
modelNumberLoading: false,
|
modelNumberOptions: [],
|
specificationsLoading: false,
|
specificationsOptions: []
|
}
|
},
|
watch: {
|
currshowlist() {
|
this.innerVisible = this.currshowlist
|
if (this.currshowlist) {
|
}
|
},
|
innerVisible: {
|
handler(newValue, oldValue) {
|
if (newValue) {
|
this.dataForm.salesPartNo = null
|
this.dataForm.salesPartName = null
|
this.salesPartList = []
|
}
|
},
|
immediate: true
|
}
|
},
|
methods: {
|
remoteModelNumberMethod(query) {
|
// this.dataForm.modelNumber = null
|
if (query !== '') {
|
this.modelNumberLoading = true
|
const modelNumberParam = {
|
key: '型号',
|
value: query
|
}
|
queryPartPropertiesStd(modelNumberParam).then((response) => {
|
this.modelNumberLoading = false
|
this.modelNumberOptions = response.data.data
|
})
|
} else {
|
this.modelNumberOptions = []
|
}
|
},
|
remoteSpecificationsMethod(query) {
|
// this.dataForm.specifications = null
|
if (query !== '') {
|
this.specificationsLoading = true
|
const specificationsParam = {
|
key: '规格',
|
value: query
|
}
|
queryPartPropertiesStd(specificationsParam).then((response) => {
|
this.specificationsLoading = false
|
this.specificationsOptions = response.data.data
|
})
|
} else {
|
this.specificationsOptions = []
|
}
|
},
|
remoteVoltageLevelMethod(query) {
|
// this.dataForm.voltageLevel = null
|
if (query !== '') {
|
this.voltageLevelLoading = true
|
const voltageLevelParam = {
|
key: '电压等级',
|
value: query
|
}
|
queryPartPropertiesStd(voltageLevelParam).then((response) => {
|
this.voltageLevelLoading = false
|
this.voltageLevelOptions = response.data.data
|
})
|
} else {
|
this.voltageLevelOptions = []
|
}
|
},
|
// 根据搜索条件搜索ERP零件
|
getSelectPart() {
|
/* let salesDesc = ''
|
if (
|
this.dataForm.salesPartName != null &&
|
this.dataForm.salesPartName != ''
|
) {
|
salesDesc = '%' + this.dataForm.salesPartName + '%'
|
}
|
const queryParam = {
|
CATALOG_NO: this.dataForm.salesPartNo,
|
CATALOG_DESC: salesDesc
|
} */
|
const queryParam = {
|
salesPartNo:
|
this.dataForm.salesPartNo == null ? '' : this.dataForm.salesPartNo,
|
salesPartDesc:
|
this.dataForm.salesPartName == null ||
|
this.dataForm.salesPartName == ''
|
? ''
|
: '%' + this.dataForm.salesPartName + '%'
|
}
|
querySalesPartStd(queryParam).then((res) => {
|
this.salesPartList = []
|
const resData = res.data
|
if (resData.code === 0) {
|
const sales = resData.data
|
if (sales) {
|
let salesPart
|
sales.forEach((item) => {
|
salesPart = {
|
salesPartNo: item.CATALOG_NO,
|
salesPartName: item.CATALOG_DESC,
|
partNo: item.PART_NO,
|
partName: item.PART_DESC,
|
ifsSalesUnit: item.SALES_UNIT_MEAS,
|
ifsConvFactor: item.CONV_FACTOR,
|
unit: item.UNIT_MEAS
|
}
|
this.salesPartList.push(salesPart)
|
})
|
}
|
} else {
|
this.$message.error('销售件查询出错')
|
}
|
})
|
},
|
handleCurrentChange(val) {
|
this.currentRow = val
|
},
|
dataFormSubmit() {
|
if (this.currentRow == null) {
|
this.$message.error('请选择销售件')
|
} else {
|
const ids = []
|
this.customerOrderList.forEach((item) => {
|
ids.push(item.id)
|
})
|
const setDataForm = {
|
partNo: this.currentRow.partNo,
|
salesPartNo: this.currentRow.salesPartNo,
|
salesPartName: this.currentRow.salesPartName,
|
ifsSalesUnit: this.currentRow.ifsSalesUnit,
|
ifsConvFactor: this.currentRow.ifsConvFactor,
|
unit: this.currentRow.unit,
|
updateIds: ids
|
}
|
batchUpdateSalePartNo(setDataForm).then((response) => {
|
const reaData = response.data
|
if (reaData.code === 0) {
|
this.$emit('refreshCustomerOrder')
|
this.innerVisible = false
|
this.$message.success('设置销售件成功')
|
} else {
|
this.$message.error('设置销售件失败')
|
}
|
})
|
}
|
}
|
}
|
}
|
</script>
|