You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1128 lines
36 KiB

<script>
import {
removeExternalPart,
saveExternalPart,
selectExternalPartList, selectExternalPartAndCustomerPage,
selectUnitList,
updateExternalPart
} from '../../../api/part/external'
import dayjs from 'dayjs'
import PictureModule from './picture/picture.vue'
import LinkedCustomer from './customer/linkedCustomer.vue'
import {getExternalPartCustomerList} from '../../../api/part/externalPartCustomer'
import {getExternalPartPictureList} from '../../../api/part/externalPartPicture'
import LinkedManufacturer from './manufacturer/linkedManufacturer.vue'
import {getExternalPartManufacturerList} from '../../../api/part/externalPartManufacturer'
import {getTableDefaultListLanguage, getTableUserListLanguage} from '../../../api/table'
import {Decimal} from 'decimal.js'
import {getCategoryList} from '../../../api/category/category'
import {countryList} from '../../../api/dict/country'
import {getSiteDetail} from '../../../api/factory/site'
import LabelTemplate from './template/labelTemplate.vue'
let part = {
site:'',
partNo:'',
partDesc:'',
umId:'',
freeInfo:'',
freeInfo2:'',
rev:'',
active:'',
tradingMark:'N',
packingWeight:undefined,
weightUmId:undefined,
moldCode:'',
category:'',
qtyPerCarton:0,
qtyPerRoll:0,
rollsPerCarton:0,
printStr1:'',
printStr2:'',
printStr3:'',
customerNo:'',
customerName:'',
}
export default {
name: "ExternalPart",
components: {LabelTemplate, LinkedManufacturer, LinkedCustomer, PictureModule},
props:{
height:{
type:Number,
default: 310
},
ofComponents: {
type:Boolean,
default: false
}
},
data(){
return{
no:1,
size:50,
total:0,
part: {
...part
},
savePart:{
...part,
active:'Y',
},
partCategoryList:[
],
category:{},
partRules:{
partNo: [{ required: true, message: 'Please input Part No', trigger: ['blur','change'] }],
partDesc: [{ required: true, message: 'Please input Part Description', trigger: ['blur','change'] }],
umId: [{ required: true, message: 'Please select UM', trigger: ['blur','change'] }],
rev: [{ required: true, message: 'Please select Rev No', trigger: ['blur','change'] }],
moldCode: [{ required: true, message: 'Please select Mold Code', trigger: ['blur','change'] }],
qtyPerCarton: [{ required: true, message: 'Please input Qty Per Carton', trigger: ['blur','change'] }],
qtyPerRoll: [{ required: true, message: 'Please input Qty Per Roll', trigger: ['blur','change'] }],
rollsPerCarton: [{ required: true, message: 'Please input Rolls Per Carton', trigger: ['blur','change'] }],
freeInfo2: [{ required: true, message: 'Please select OOC', trigger: ['blur','change'] }],
},
savePartVisible:false,
partTableLoading:false,
partList:[],
unitList:[],
columnList:[
{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TablePartNo',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "partNo",
headerAlign: "center",
align: "left",
columnLabel: "Part No",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 80
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TablePartDesc',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "partDesc",
headerAlign: "center",
align: "left",
columnLabel: "Part Description",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 140
},
{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableCustomerNo',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "customerNo",
headerAlign: "center",
align: "left",
columnLabel: "Customer No",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 80
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableCustomerName',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "customerName",
headerAlign: "center",
align: "left",
columnLabel: "Customer Name",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 140
},
{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableRev',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "rev",
headerAlign: "center",
align: "left",
columnLabel: "REV No",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 80
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableCategory',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "category",
headerAlign: "center",
align: "left",
columnLabel: "Part Category",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 140
},
{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableUmName',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "moldCode",
headerAlign: "center",
align: "left",
columnLabel: "Mold Code",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 80
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableUmName',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "umName",
headerAlign: "center",
align: "left",
columnLabel: "UM",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 60
},
{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableQtyPerRoll',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "qtyPerRoll",
headerAlign: "center",
align: "left",
columnLabel: "Qty Per Roll",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 120
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableRollsPerCarton',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "rollsPerCarton",
headerAlign: "center",
align: "left",
columnLabel: "Rolls Per Carton",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 120
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableQtyPerCarton',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "qtyPerCarton",
headerAlign: "center",
align: "left",
columnLabel: "Qty Per Carton",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 120
},
{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableFreeInfo',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "freeInfo",
headerAlign: "center",
align: "left",
columnLabel: "Free Info",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 120
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableFreeInfo2',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "freeInfo2",
headerAlign: "center",
align: "left",
columnLabel: "Free Info2",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 120
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableTradingMark',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "tradingMark",
headerAlign: "center",
align: "left",
columnLabel: "Trading Mark",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 120
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TablePackingWeight',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "packingWeight",
headerAlign: "center",
align: "left",
columnLabel: "Packing Weight",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 120
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableWeightUM',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "weightUmName",
headerAlign: "center",
align: "left",
columnLabel: "Weight UM",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 120
},
{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableActive',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "active",
headerAlign: "center",
align: "left",
columnLabel: "Active",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 80
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableCreateBy',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "createBy",
headerAlign: "center",
align: "left",
columnLabel: "Created By",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 80
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableCreateTime',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "createTime",
headerAlign: "center",
align: "left",
columnLabel: "Created Time",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 140
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableUpdateBy',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "updateBy",
headerAlign: "center",
align: "left",
columnLabel: "Updated By",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 80
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004TableUpdateTime',
tableId: "10004Table",
tableName: "Part Table",
columnProp: "updateTime",
headerAlign: "center",
align: "left",
columnLabel: "Updated Time",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 140
},
],
manufacturerColumnList:[
{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004Table4ManufacturerNo',
tableId: "10004Table4",
tableName: "外部料号供应商信息表",
columnProp: "manufacturerNo",
headerAlign: "center",
align: "left",
columnLabel: "Manufacturer No",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 80
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004Table4ManufacturerName',
tableId: "10004Table4",
tableName: "外部料号供应商信息表",
columnProp: "manufacturerName",
headerAlign: "center",
align: "left",
columnLabel: "Manufacturer Name",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 120
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004Table4CreateTime',
tableId: "10004Table4",
tableName: "外部料号供应商信息表",
columnProp: "createTime",
headerAlign: "center",
align: "center",
columnLabel: "Created Time",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 140
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004Table4CreateBy',
tableId: "10004Table4",
tableName: "外部料号供应商信息表",
columnProp: "createBy",
headerAlign: "center",
align: "left",
columnLabel: "Created By",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 80
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004Table4UpdateTime',
tableId: "10004Table4",
tableName: "外部料号供应商信息表",
columnProp: "updateTime",
headerAlign: "center",
align: "center",
columnLabel: "Updated Time",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 140
},{
userId: this.$store.state.user.name,
functionId: 10004,
serialNumber: '10004Table4UpdateBy',
tableId: "10004Table4",
tableName: "外部料号供应商信息表",
columnProp: "updateBy",
headerAlign: "center",
align: "left",
columnLabel: "Updated By",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 10,
status: true,
fixed: '',
columnWidth: 80
},
],
activeName:'linkedManufacturer',
currentPart:{},
externalPartCustomerList:[],
pictureList:[],
externalPartManufacturerList:[],
base64List:[],
countryList:[],
}
},
watch:{
currentPart(newVal,oldVal){
if (!this.ofComponents){
// 调用 子组件信息查询
this.getExternalPartManufacturerList();
}
},
"savePart.partNo"(newVal,oldVal){
this.savePart.partNo = newVal.toUpperCase()
},
"savePart.category"(newVal,oldVal){
const category = this.partCategoryList.find((item)=>item.categoryValue === newVal);
if (category){
// this.savePart.manufacturerRequired = category.manufacturerRequired;
// this.savePart.moldCodeRequired = category.moldCodeRequired;
// this.savePart.serialNumberRequired = category.serialNumberRequired;
// this.savePart.rollLabelRequired = category.rollLabelRequired;
// if (this.savePart.serialNumberRequired === 'Y'){
// this.savePart.qtyPerRoll = 1;
// this.savePart.rollsPerCarton = 1;
// }
// if (category.showCartonQtyPerRoll === 'N'){
// this.savePart.qtyPerRoll = 1;
// }
// if (category.showCartonRollsPerCarton === 'N'){
// this.savePart.rollsPerCarton = 1;
// }
// this.partRules.rollsPerCarton[0].message = `Please input ${category.qtyPerRollPart}`
// this.savePart.qtyPerCarton = this.qtyPerCarton();
this.category = JSON.parse(JSON.stringify(category))
}
},
"part.partNo"(newVal,oldVal){
this.part.partNo = newVal.toUpperCase()
},
"savePart.qtyPerRoll"(newVal,oldVal){
this.savePart.qtyPerCarton = this.qtyPerCarton();
},
"savePart.rollsPerCarton"(newVal,oldVal){
this.savePart.qtyPerCarton = this.qtyPerCarton();
},
},
methods:{
// getExternalPartPictureList(val){
// let params = {
// partNo: this.currentPart.partNo,
// site: this.currentPart.site,
// pictureClassify:'BoxPicture',
// }
// getExternalPartPictureList(params).then(({data})=>{
// if (data && data.code === 0){
// this.pictureList = data.rows;
// if (val === true){
// this.$nextTick(()=>{
// this.$refs.picture.handleBasePictureList();
// })
// }
// }else {
// this.$message.warning(data.msg)
// }
// }).catch((error)=>{
// this.$message.error(error)
// })
// },
rowPartStyle({row}){
if (row.customerNo === this.currentPart.customerNo && row.partNo === this.currentPart.partNo){
return {
background: 'rgb(232,246,246)',
}
}
},
selectUnitList(){
selectUnitList().then(({data})=>{
if (data && data.code === 0){
this.unitList = data.rows;
if (this.unitList.length > 0){
this.savePart.umId = this.unitList[0].umId;
}
}else {
this.$message.warning(data.msg)
}
}).catch((error)=>{
this.$message.error(error)
})
},
selectExternalPartList(){
let params = {
...this.part,
site: this.$store.state.user.site,
}
selectExternalPartList(params).then(({data})=>{
if (data && data.code === 0){
this.partList = data.rows;
if (this.partList.length > 0 && !this.ofComponents){
this.currentPart = {...this.partList[0]}
}
}else {
this.$message.warning(data.msg)
}
}).catch((error)=>{
this.$message.error(error)
})
},
// handleSave(){
// if (this.savePartVisible){
// if ((this.savePart.packingWeight || this.savePart.packingWeight == 0) && !this.savePart.weightUmId){
// this.$message.warning('Please select Weight UM')
// return
// }
// this.$refs.savePartForm.validate((valid,obj) => {
// if (valid) {
// if (this.savePart.qtyPerCarton === 0){
// this.$message.warning('Qty Per Carton can not be 0')
// return
// }
// let params = {
// ...this.savePart,
// site: this.$store.state.user.site,
// createBy: this.$store.state.user.name,
// createTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
// }
// saveExternalPart(params).then(({data})=>{
// if (data && data.code === 0){
// this.handleSelectExternalPartAndCustomerPage()
// this.savePartVisible = false
// this.$message.success(data.msg)
// }else {
// this.$message.warning(data.msg)
// }
// }).catch((error)=>{
// this.$message.error(error)
// })
// }else {
// for (let i = 0; i < Object.keys(obj).length; i++) {
// this.$message.warning(obj[Object.keys(obj)[i]][0].message)
// break
// }
// }
// })
// }else {
// this.savePart = {
// ...part,
// active: 'Y',
// umId: this.unitList.length > 0 ? this.unitList[0].umId : '',
// category: '',
// manufacturerRequired: 'N',
// moldCodeRequired: 'N',
// serialNumberRequired: 'N',
// }
// this.getCountryList();
// this.savePart.freeInfo2 = this.defaultCountry
// this.savePart.category = this.partCategoryList.length > 0 ? this.partCategoryList[0].categoryValue : ''
// this.savePartVisible = true;
// }
// },
// closeSavePart(){
// this.savePart = {
// ...part,
// active: 'Y',
// }
// if (this.unitList.length > 0){
// this.savePart.umId = this.unitList[0].umId;
// }
// this.$refs.savePartForm.resetFields()
// },
// removeExternalPart(row){
// removeExternalPart(row).then(({data})=>{
// if (data && data.code === 0){
// this.selectExternalPartList()
// this.$message.success(data.msg)
// }else {
// this.$message.warning(data.msg)
// }
// }).catch((error)=>{
// this.$message.error(error)
// })
// },
handleRowClick(row, column, event,type){
this.currentPart = {...row}
if (type === 0){
this.getCountryList();
this.savePart = {...row}
this.savePartVisible = true;
}
},
handleDblRowClick(row, column, event,type){
if (this.ofComponents){
this.$emit('rowClick',row)
}else {
this.currentPart = {...row}
if (type === 0){
this.savePart = {...row}
this.savePartVisible = true;
}
}
},
// handleUpdate(){
// if ((this.savePart.packingWeight || this.savePart.packingWeight == 0) && !this.savePart.weightUmId){
// this.$message.warning('Please select Weight UM')
// return
// }
// this.$refs.savePartForm.validate((valid,obj) => {
// if (valid) {
// if (this.savePart.qtyPerCarton === 0){
// this.$message.warning('Qty Per Carton can not be 0')
// return
// }
// let params = {
// ...this.savePart,
// site: this.$store.state.user.site,
// createBy: undefined,
// createTime: undefined,
// updateBy: this.$store.state.user.name,
// updateTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
// }
// updateExternalPart(params).then(({data})=>{
// if (data && data.code === 0){
// this.handleSelectExternalPartAndCustomerPage()
// this.savePartVisible = false
// this.$message.success(data.msg)
// }else {
// this.$message.warning(data.msg)
// }
// }).catch((error)=>{
// this.$message.error(error)
// })
// }else {
// for (let i = 0; i < Object.keys(obj).length; i++) {
// this.$message.warning(obj[Object.keys(obj)[i]][0].message)
// break
// }
// }
// })
// },
// getExternalPartCustomerList(){
// let params = {
// partNo: this.currentPart.partNo,
// site: this.currentPart.site,
// }
// getExternalPartCustomerList(params).then(({data})=>{
// if (data && data.code === 0){
// this.externalPartCustomerList = data.rows;
// }else {
// this.$message.warning(data.msg)
// }
// }).catch((error)=>{
// this.$message.error(error)
// })
// },
getExternalPartManufacturerList(){
let params = {
partNo: this.currentPart.partNo,
site: this.currentPart.site,
}
getExternalPartManufacturerList(params).then(({data})=>{
if (data && data.code === 0){
this.externalPartManufacturerList = data.rows;
}else {
this.$message.warning(data.msg)
}
}).catch((error)=>{
this.$message.error(error)
})
},
async convertToBase64(fileUrls) {
this.base64List = []
for (const fileUrl of fileUrls) {
const base64Url = await this.getFileAsBase64(fileUrl);
this.base64List.push(base64Url);
}
},
getFileAsBase64(fileUrl) {
return new Promise((resolve, reject) => {
const img = new Image();
img.crossOrigin = 'Anonymous';
img.src = fileUrl;
img.onload = () => {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
canvas.width = img.width;
canvas.height = img.height;
ctx.drawImage(img, 0, 0);
const base64data = canvas.toDataURL('image/jpeg');
resolve(base64data);
};
img.onerror = (error) => {
reject(error);
};
});
},
async getTableUserColumn (tableId, columnId) {
let queryTableUser = {
userId: this.$store.state.user.name,
functionId: this.$route.meta.menuId,
tableId: tableId,
status: true,
languageCode: this.$i18n.locale
}
await getTableUserListLanguage(queryTableUser).then(({data}) => {
if (data.rows.length > 0) {
this.caseTable(data.rows,columnId)
} else {
this.getColumnList(tableId, columnId)
}
})
},
// 获取 tableDefault 列
async getColumnList (tableId, columnId) {
let queryTable = {
functionId: this.$route.meta.menuId,
tableId: tableId,
languageCode: this.$i18n.locale
}
await getTableDefaultListLanguage(queryTable).then(({data}) => {
if (!data.rows.length === 0) {
this.caseTable(data.rows,columnId)
} else {
}
})
},
caseTable(list,columnId){
if (list.length > 0){
switch (columnId) {
case 1:
this.columnList = list
break;
case 2:
this.pictureColumnList = list
break;
case 3:
this.customerColumnList = list
break;
case 4:
this.manufacturerColumnList = list
break;
}
}
},
qtyPerCarton(){
return new Decimal(this.savePart.qtyPerRoll).mul(this.savePart.rollsPerCarton).toNumber();
},
getCategoryList(){
let params = {};
getCategoryList(params).then(({data})=>{
if (data && data.code === 0){
this.partCategoryList = data.rows;
}else {
this.$message.warning(data.msg)
}
}).catch((error)=>{
this.$message.error(error)
})
},
changeQtyRollCarton(){
this.savePart.qtyPerRoll = this.savePart.qtyPerCarton;
},
getCountryList(){
let params = {
}
countryList(params).then(({data})=>{
if (data && data.code === 0){
this.countryList = data.rows
}else {
this.$message.warning(data.msg)
}
}).catch((error)=>{
this.$message.error(error)
})
},
getUserSiteDefaultCountry(){
let params = this.$store.state.user.site
getSiteDetail(params).then(({data})=>{
if (data && data.code === 0){
if (data.row && data.row.defaultCountry){
this.defaultCountry = data.row.defaultCountry
}
}else {
this.$message.warning(data.msg)
}
}).catch((error)=>{
this.$message.error(error)
})
},
handleSelectExternalPartAndCustomerPage(){
let params = {
...this.part,
site: this.$store.state.user.site,
no:this.no,
size:this.size,
}
selectExternalPartAndCustomerPage(params).then(({data})=>{
if (data && data.code === 0){
this.partList = data.rows;
if (this.partList.length > 0 && !this.ofComponents){
this.currentPart = {...this.partList[0]}
}
this.total = data.total;
this.getExternalPartManufacturerList();
}else {
this.$message.warning(data.msg)
}
}).catch((error)=>{
this.$message.error(error)
})
},
handleSizeChange(val){
this.size = val;
this.handleSelectExternalPartAndCustomerPage();
},
handleCurrentChange(val){
this.no = val;
this.handleSelectExternalPartAndCustomerPage();
},
changeCategory(val){
const category = this.partCategoryList.find((item)=>item.categoryValue === val);
if (category){
this.savePart.manufacturerRequired = category.manufacturerRequired;
this.savePart.moldCodeRequired = category.moldCodeRequired;
this.savePart.serialNumberRequired = category.serialNumberRequired;
this.savePart.rollLabelRequired = category.rollLabelRequired;
if (this.savePart.serialNumberRequired === 'Y'){
this.savePart.qtyPerRoll = 1;
this.savePart.rollsPerCarton = 1;
}
if (category.showCartonQtyPerRoll === 'N'){
this.savePart.qtyPerRoll = 1;
}
if (category.showCartonRollsPerCarton === 'N'){
this.savePart.rollsPerCarton = 1;
}
this.partRules.rollsPerCarton[0].message = `Please input ${category.qtyPerRollPart}`
this.savePart.qtyPerCarton = this.qtyPerCarton();
this.category = JSON.parse(JSON.stringify(category))
}
},
/**
* 当前值发生变化的时候修改
* @param row
* @param oldRow
*/
changeCurrentRow (row, oldRow) {
// 判断是否是获取焦点的事件
if (row) {
this.currentPart = JSON.parse(JSON.stringify(row))
this.getExternalPartManufacturerList();
}
},
toMes (row) {
this.$router.push({ path: 'part-external', query: { site: row.site , partNo:row.partNo}})
},
},
computed:{
},
created () {
this.selectUnitList();
this.getCategoryList();
// this.getCountryList();
// this.selectExternalPartList();
this.handleSelectExternalPartAndCustomerPage();
this.getUserSiteDefaultCountry();
this.getTableUserColumn("10004Table", 1)
this.getTableUserColumn("10004Table2", 2)
this.getTableUserColumn("10004Table3", 3)
this.getTableUserColumn("10004Table4", 4)
}
}
</script>
<template>
<div>
<el-form :inline="true" label-position="top" :model="part" label-width="100px">
<el-form-item label="Part No">
<el-input v-model="part.partNo"></el-input>
</el-form-item>
<el-form-item label="Part Description">
<el-input v-model="part.partDesc"></el-input>
</el-form-item>
<el-form-item label="Part Category">
<el-select v-model="part.category" placeholder="">
<el-option label="All" value=""></el-option>
<el-option :label="item.categoryName" :value="item.categoryValue" :key="item.id" v-for="item in partCategoryList"></el-option>
</el-select>
</el-form-item>
<el-form-item label="Active">
<el-select v-model="part.active" placeholder="">
<el-option label="All" value=""></el-option>
<el-option label="Active" value="Y"></el-option>
<el-option label="Not Active" value="N"></el-option>
</el-select>
</el-form-item>
<el-form-item label="Customer No">
<el-input v-model="part.customerNo"></el-input>
</el-form-item>
<el-form-item label="Customer Name">
<el-input v-model="part.customerName"></el-input>
</el-form-item>
<el-form-item label=" ">
<!-- <el-button type="primary" @click="selectExternalPartList">Query</el-button>-->
<el-button type="primary" @click="handleSelectExternalPartAndCustomerPage">Query</el-button>
</el-form-item>
</el-form>
<el-table :data="partList" :height="height" :row-style="rowPartStyle" @row-click="handleRowClick" @row-dblclick="handleDblRowClick" @current-change="changeCurrentRow" :loading="partTableLoading" border style="width: 100%;margin-top: 5px">
<el-table-column v-if="!ofComponents"
header-align="center"
align="center"
width="100"
fixed="left"
label="Actions">
<template slot-scope="scope">
<a type="text" size="small" @click="toMes(scope.row)">Part Info</a>
</template>
</el-table-column>
<el-table-column
v-for="(item,index) in columnList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed==''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="no"
:page-sizes="[50,100, 200, 300, 400]"
:page-size="size"
layout="sizes, prev, pager, next,total"
:total="total">
</el-pagination>
<el-tabs v-model="activeName" v-if="!ofComponents">
<el-tab-pane label="Linked Manufacturer" name="linkedManufacturer">
<linked-manufacturer :column-list="manufacturerColumnList" :part="currentPart" :data-list="externalPartManufacturerList" @refresh="getExternalPartManufacturerList" :visible="false"></linked-manufacturer>
</el-tab-pane>
</el-tabs>
<div v-show="false">
<img :src="item" v-for="(item,index) in base64List" :key="index" style="display: none">
</div>
</div>
</template>
<style scoped>
</style>