Commit abaa5ecd authored by jingnan's avatar jingnan 👀

验收入库申请批量可以编辑

parent 095926bc
/**
* @Description: 批量签审入库明细编辑
* @author gjn
* @date 2024-01-16
*/
<template>
<div class="batchSignEditInstorageItems">
<dee-form
ref="form"
:form="form"
:form-data="formFileds"
:rules="rules"
label-width="200px"
form-btn-position="center"
:form-buttons="formButtons"
@on-submit="save"
@on-cancel="handleClose"
/>
</div>
</template>
<script>
import { post } from '@/utils/http'
export default {
name: 'BatchSignEditInstorageItems', // name写在组件的最前方,自定义组件为必填
components: {},
props: {
basicData: {
type: Object,
default: () => { }
}
},
data() {
return {
dialogVisibleDetails: false,
disabled: false,
saveLoading: false,
header: {},
billType: '',
form: {},
formFileds: [
{
split: 3,
data: []
}
],
formButtons: [
{
text: '提交',
type: 'submit',
component: {
type: 'primary',
loading: false
}
},
{
text: '取消',
type: 'cancel'
}
],
material: [],
suppliers: [],
isChild: false,
// 表单校验
rules: {
resCode: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
resName: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
airModel: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
reqUnit: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
reqAmount: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
supplier: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
arrivalDate: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
withProductMaterial: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
urgency: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
isSupplierY: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
lotNo: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
storageCondition: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
arrivalVer: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
producedTime: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
modelNo: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
sorties: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
serialNo: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
arrivedDrawNo: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
contractNo: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
taxRate: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
taxUnitPrice: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
isVirtual: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
smallType: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
storageZone: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
]
// purchaseAmount: [{ required: true, message: '请填写表单信息', trigger: ['blur', 'change'] }],
},
extMaterialId: '',
parentId: null,
operateType: null,
parentRowId: ''
}
},
computed: {
},
watch: {
// 'form.resCode': {
// handler: function(v) {
// this.resetMaterial(v)
// }
// }
'basicData': {
immediate: true,
deep: true,
handler: function(row) {
row.materialTypeName = {
label: row.extMaterial.resType2.typeName
}
row.supplierFullName = row.extDxSipplier && row.extDxSipplier.supplierFullName
this.handleOpen('MODIFY', row)
}
},
'form.airModel': {
handler: function(val) {
val && this.changeSorties()
}
},
// 1.父级明细不是虚拟件时,含税单价及税率必填,子明细非必填,如果添加子明细时,子明细税率及单价禁用,取值取父级上的
// 2.父级明细是虚拟件时,含税单价及税率为0且禁用,子明细必填,子明细上的税率及单价也必填
// 3.子明细添加时查询物料不作限制
'form.isVirtual': {
immediate: true,
handler: function(val) {
if (this.isChild) return
let isVirtualFlag = false
if (val) { // 父级明细是虚拟件时,含税单价及税率为0且禁用
isVirtualFlag = true
this.$set(this.form, 'taxRate', 0)
this.$set(this.form, 'taxUnitPrice', 0)
} else {
isVirtualFlag = false
}
const targetArr = this.formFileds[0].data.filter(item => item.title === '税率' || item.title === '含税单价')
targetArr.forEach(item => (item.component.disabled = isVirtualFlag))
}
},
isChild: {
immediate: true,
handler(val) {
if (val) return
let isVirtualFlag = false
if (this.form.isVirtual) { // 父级明细是虚拟件时,含税单价及税率为0且禁用
isVirtualFlag = true
this.$set(this.form, 'taxRate', 0)
this.$set(this.form, 'taxUnitPrice', 0)
} else {
isVirtualFlag = false
}
const targetArr = this.formFileds[0].data.filter(item => item.title === '税率' || item.title === '含税单价')
targetArr.forEach(item => (item.component.disabled = isVirtualFlag))
}
}
},
created() {
// 初始化数据
},
mounted() {
// this.form.arrivalDate = this.basicData.arrivalDate || ''
},
methods: {
handleOpen(type, row) {
// this.basicData = basicData
this.form = { 'reqAmount': 1 }
// this.dialogVisibleDetails = true
this.operateType = type
// if (type === 'NEW') {
// this.$set(this.form, 'operator', 'ADD')
// } else if (type === 'ADD') {
// this.parentId = row.id || null
// this.parentRowId = row.rowId ? row.rowId : row.id
// this.$set(this.form, 'operator', 'ADD')
// delete row.id
// this.form = JSON.parse(JSON.stringify(row))
// this.$set(this.form, 'supplier', row.extDxSipplierId)
// this.$set(this.form, 'withProductMaterial', Array.isArray(row.withProductMaterial) ? row.withProductMaterial : row.withProductMaterial && row.withProductMaterial.split(';') || [])
// this.resetMaterial(row.extMaterial ? row.extMaterial.resCode : '')
// this.changeMaterial(row.extMaterial ? row.extMaterial.resCode : '')
// this.$set(this.form, 'resCode', '')
// this.$set(this.form, 'resName', '')
// this.$set(this.form, 'reqUnit', '')
// this.$set(this.form, 'modelNo', '')
// } else if (type === 'MODIFY') {
this.dispalyData(row)
// }
this.resetForm()
},
// 回显数据
dispalyData(row) {
this.form = JSON.parse(JSON.stringify(row))
this.$set(this.form, 'operator', 'MODIFY')
row.billType === 'AirEquipment' && this.$set(this.form, 'reqAmount', 1)
this.$set(this.form, 'resCode', row.extMaterial && row.extMaterial.resCode || row.resCode || '')
this.$set(this.form, 'resName', row.extMaterial && row.extMaterial.resName || row.resName || '')
this.$set(this.form, 'reqUnit', row.extMaterial && row.extMaterial.extUnit && row.extMaterial.extUnit.unitName || row.reqUnit || '')
this.$set(this.form, 'modelNo', row.extMaterial && row.extMaterial.modelNo || row.modelNo || '')
this.$set(this.form, 'extMaterialId', row.extMaterialId || '')
this.$set(this.form, 'supplier', row.extDxSipplier && row.extDxSipplier.supplierFullName || row.supplier || '')
this.$set(this.form, 'withProductMaterial', Array.isArray(row.withProductMaterial) ? row.withProductMaterial : row.withProductMaterial && row.withProductMaterial.split(';') || [])
this.resetMaterial(row.extMaterial ? row.extMaterial.resCode : row.resCode || '')
this.changeMaterial(row.extMaterial ? row.extMaterial.resCode : row.resCode || '')
},
handleClose() {
this.$emit('cancel')
},
getBasicData() {
const v = this.basicData
if (
v.billType === 'AirEquipment' &&
(['标准件', '金属材料', '非金属材料'].includes(v.materialTypeName.label)) &&
this.formFileds[0].data.find(item => item.title !== '所属设备')
) {
this.formFileds[0].data.unshift({
title: '所属设备',
key: 'subEquipment',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入所属设备'
}
})
this.$set(this.rules, 'subEquipment', [
{
required: true,
message: '请输入所属设备',
trigger: ['blur', 'change']
}
])
}
},
// 重设表单
resetForm() {
this.header = this.basicData
if (!this.header) return
this.$set(this.form, 'supplier', this.header.extDxSipplier && this.header.extDxSipplier.supplierFullName || '')
this.$set(this.form, 'arrivalDate', this.header.arrivalDate)
const childrenAddOrEdit = this.header.materialTypeName.label === '外购成品' && (this.operateType === 'ADD' || (this.operateType === 'MODIFY' && !this.form.isRoot))
const parentIsVirtual = this.form.isVirtual
switch (this.header.billType) {
case '器材':
case 'Material':
this.billType = '器材'
this.formFileds[0].data = [
{
title: '物料关键词',
key: 'resCode',
component: {
clearable: true,
name: 'el-select',
placeholder: '请输入物料关键词',
remote: true,
filterable: true,
disabled: this.form.callBackReason !== '设计更改' && this.form.subTypeName === 'InStorageRecallItem',
'remote-method': this.resetMaterial,
options: []
},
handler: {
change: (v) => this.changeMaterial(v)
}
},
{
title: '物料编码',
key: 'resCode',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入物料名称'
}
},
{
title: '物料名称',
key: 'resName',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入物料编码'
}
},
{
title: '计量单位',
key: 'reqUnit',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入计量单位'
}
},
// { title: '物料类型', key: 'subTypeName', component: { name: 'el-input', disabled: true, placeholder: '请输入物料类型' }},
// { title: '名称', key: 'resName', component: { name: 'el-input', disabled: true, placeholder: '请输入名称' }},
// { title: '编号', key: 'number', component: { name: 'el-input', disabled: true, placeholder: '请输入编号' }},
{
title: '牌号/型号/件号',
key: 'modelNo',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入牌号/型号/件号'
}
},
{
title: '技术条件',
key: 'techSpec',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入技术条件'
}
},
{
title: '规格',
key: 'spec',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入规格'
}
},
{
title: '供应状态',
key: 'supplyStatus',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入供应状态'
}
},
{
title: '炉/批号',
key: 'lotNo',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入炉/批号'
}
},
{
title: '机型',
key: 'airModel',
component: {
clearable: true,
name: 'el-select',
placeholder: '请输入机型',
options: []
},
change: (v) => {
v && this.changeSorties()
}
},
{
title: '架次',
key: 'sorties',
component: {
clearable: true,
name: 'el-select',
'allow-create': true,
placeholder: '请输入架次',
options: []
}
},
// { title: '采购数量/重量', key: 'purchaseAmount', component: { name: 'el-input-number', placeholder: '请输入采购数量/重量' }},
// { title: '采购单位', key: 'purchaseUnit', component: { name: 'el-select', placeholder: '请输入采购单位' }},
{
title: '入库数量',
key: 'reqAmount',
component: {
clearable: true,
name: 'el-input-number',
min: 0,
placeholder: '请输入入库数量'
},
handler: {
change: () => this.changeComputed()
}
},
{
title: '供应商',
key: 'supplier',
component: {
name: 'el-select',
disabled: true,
placeholder: '请输入供应商'
},
handler: {
}
},
// {
// title: '是否合格供应商',
// key: 'isSupplierY',
// component: {
// clearable: true,
// name: 'el-select',
// disabled: true,
// placeholder: '请选择是否合格供应商',
// options: [
// { label: '是', value: true },
// { label: '否', value: false }
// ]
// }
// },
{
title: '制造商',
key: 'manufacturer',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入制造商'
}
},
{
title: '到货日期',
key: 'arrivalDate',
component: {
clearable: true,
name: 'el-date-picker',
// disabled: true,
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
placeholder: '请选择到货日期'
}
},
{
title: '生产日期',
key: 'producedTime',
component: {
clearable: true,
name: 'el-date-picker',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
placeholder: '请选择生产日期'
}
},
{
title: '贮存条件',
key: 'storageCondition',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入贮存条件'
}
},
{
title: '随产品资料',
key: 'withProductMaterial',
component: {
clearable: true,
name: 'el-select',
multiple: true,
placeholder: '请选择随产品资料',
options: []
}
},
{
title: '紧急程度',
key: 'urgency',
component: {
clearable: true,
name: 'el-select',
placeholder: '请选择紧急程度',
options: [
{ label: '紧急', value: true },
{ label: '正常', value: false }
]
}
},
{
title: '到货标准',
key: 'arrivedDrawNo',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入到货标准'
}
},
{
title: '到货版次',
key: 'arrivalVer',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入到货版次'
}
},
{
title: '入库单价',
key: 'stockUnitPrice',
component: {
clearable: true,
disabled: true,
name: 'el-input',
placeholder: '请输入入库单价'
}
},
{
title: '税率',
key: 'taxRate',
component: {
clearable: true,
name: 'el-input-number',
min: 0,
placeholder: '请输入税率'
},
handler: {
change: () => this.changeComputed()
}
},
{
title: '入库金额',
key: 'stockPrice',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入入库金额'
}
},
{
title: '含税单价',
key: 'taxUnitPrice',
component: {
clearable: true,
name: 'el-input-number',
placeholder: '请输入含税单价'
},
handler: {
change: () => this.changeComputed()
}
},
{
title: '含税金额',
key: 'taxPrice',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入含税金额'
}
},
// { title: '报检人', key: 'userName', component: { name: 'el-input', disabled: true, placeholder: '请输入报检人' }},
{
title: '接收仓库',
key: 'storageZone',
component: {
clearable: true,
name: 'el-select',
placeholder: '请输入接收仓库',
options: []
},
handler: {
change: (v) => {
const STORAGE = this.formFileds[0].data.find(
(item) => item.key === 'storageZone'
)
const label = STORAGE.component.options.find(item => item.value === v).label
this.form.storageZoneName = label
}
}
},
{
title: '合同号/框架协议号',
key: 'contractNo',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入合同号'
}
},
{
title: '制造偏离单号',
key: 'deviationNo',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入制造偏离单号'
}
},
// { title: '订货单号', key: 'purchaseOrderNo', component: { name: 'el-input', placeholder: '请输入订货单号' }},
{
title: '备注',
key: 'remark',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入备注'
}
}
]
break
case '机载设备':
case 'AirEquipment':
this.billType = '机载设备'
this.formFileds[0].data = [
{
title: '物料关键词',
key: 'resCode',
component: {
clearable: true,
name: 'el-select',
placeholder: '请输入物料关键词',
remote: true,
disabled: this.form.callBackReason !== '设计更改' && this.form.subTypeName === 'InStorageRecallItem',
filterable: true,
'remote-method': this.resetMaterial,
options: []
},
handler: {
change: (v) => this.changeMaterial(v)
}
},
// { title: '物料编码', key: 'resCode', component: { name: 'el-select', placeholder: '请输入物料编码', remote: true, filterable: true, 'remote-method': this.resetMaterial, options: [] }, handler: {
// change: v => this.changeMaterial(v)
// }},
{
title: '物料编码',
key: 'resCode',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入物料名称'
}
},
{
title: '物料名称',
key: 'resName',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入物料编码'
}
},
{
title: '计量单位',
key: 'reqUnit',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入计量单位'
}
},
// { title: '物料类型', key: 'resType2.typeName', component: { name: 'el-input', disabled: true, placeholder: '请输入物料类型' }},
// { title: '名称', key: 'resName', component: { name: 'el-input', disabled: true, placeholder: '请输入名称' }},
{
title: '牌号/型号/件号',
key: 'modelNo',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入牌号/型号/件号'
}
},
{
title: '系列号',
key: 'serialNo',
component: {
clearable: true,
name: 'el-input',
disabled: childrenAddOrEdit,
placeholder: '请输入系列号'
}
},
{
title: '机型',
key: 'airModel',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请输入机型',
options: []
},
change: (v) => {
v && this.changeSorties()
}
},
{
title: '架次',
key: 'sorties',
component: {
clearable: true,
'allow-create': true,
name: 'el-select',
placeholder: '请输入架次',
options: []
}
},
{
title: '入库数量',
key: 'reqAmount',
component: {
clearable: true,
name: 'el-input-number',
min: 1,
disabled: false,
placeholder: '请输入入库数量'
},
handler: {
change: (v) => {
this.changeComputed()
}
}
},
{
title: '供应商',
key: 'supplier',
component: {
name: 'el-select',
disabled: true,
placeholder: '请输入供应商'
},
handler: {
}
},
// {
// title: '是否合格供应商',
// key: 'isSupplierY',
// component: {
// clearable: true,
// name: 'el-select',
// disabled: true,
// placeholder: '请选择是否合格供应商',
// options: [
// { label: '是', value: true },
// { label: '否', value: false }
// ]
// }
// },
{
title: '制造商',
key: 'manufacturer',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入制造商'
}
},
{
title: '到货日期',
key: 'arrivalDate',
component: {
clearable: true,
name: 'el-date-picker',
// disabled: true,
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
placeholder: '请选择到货日期'
}
},
{
title: '生产日期',
key: 'producedTime',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-date-picker',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
placeholder: '请选择生产日期'
}
},
{
title: '产品图号/版本',
key: 'productDwawVer',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入产品图号/版本'
}
},
{
title: 'ATP名称',
key: 'atpName',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入ATP名称'
}
},
{
title: 'ATP编号及版次',
key: 'atpNo',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入ATP编号及版次'
}
},
{
title: '软件构型件号/版次',
key: 'softConfPieceNo',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入软件构型件号/版次',
type: 'textarea',
rows: 3
}
},
{
title: '电子硬件构型件号/版本',
key: 'elecHardwareConfPieceNo',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入电子硬件构型件号/版本',
type: 'textarea',
rows: 3
}
},
{
title: '适航批准标签/批准放行证书',
key: 'approvalCert',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入适航批准标签/批准放行证书'
}
},
{
title: '随产品资料',
key: 'withProductMaterial',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
multiple: true,
placeholder: '请选择随产品资料',
options: []
}
},
{
title: '紧急程度',
key: 'urgency',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请选择紧急程度',
options: [
{ label: '紧急', value: true },
{ label: '正常', value: false }
]
}
},
{
title: '是否新研产品',
key: 'isNewlyProduct',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请选择是否新研产品',
options: [
{ label: '是', value: true },
{ label: '否', value: false }
]
}
},
{
title: '入库单价',
key: 'stockUnitPrice',
component: {
clearable: true,
disabled: true,
name: 'el-input',
placeholder: '请输入入库单价'
}
},
{
title: '税率',
key: 'taxRate',
component: {
clearable: true,
disabled: childrenAddOrEdit && !parentIsVirtual,
name: 'el-input-number',
min: 0,
placeholder: '请输入税率'
},
handler: {
change: () => this.changeComputed()
}
},
{
title: '入库金额',
key: 'stockPrice',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入入库金额'
}
},
{
title: '含税单价',
key: 'taxUnitPrice',
component: {
clearable: true,
disabled: childrenAddOrEdit && !parentIsVirtual,
name: 'el-input-number',
placeholder: '请输入含税单价'
},
handler: {
change: () => this.changeComputed()
}
},
{
title: '含税金额',
key: 'taxPrice',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入含税金额'
}
},
// { title: '报检人', key: 'userName', component: { name: 'el-input', disabled: true, placeholder: '请输入报检人' }},
{
title: '接收仓库',
key: 'storageZone',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请输入接收仓库',
options: []
},
handler: {
change: (v) => {
const STORAGE = this.formFileds[0].data.find(
(item) => item.key === 'storageZone'
)
const label = STORAGE.component.options.find(item => item.value === v).label
this.form.storageZoneName = label
}
}
},
{
title: '合同号/框架协议号',
key: 'contractNo',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入合同号/框架协议号'
}
},
{
title: '制造偏离单号',
key: 'deviationNo',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入制造偏离单号'
}
},
// { title: '订货单号', key: 'purchaseOrderNo', component: { name: 'el-input', placeholder: '请输入订货单号' }},
{
title: '备注',
key: 'remark',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入备注'
}
}
]
break
case '外包产品':
case 'OutSource':
this.billType = '外包产品'
this.formFileds[0].data = [
{
title: '物料关键词',
key: 'resCode',
component: {
clearable: true,
name: 'el-select',
placeholder: '请输入物料关键词',
disabled: this.form.callBackReason !== '设计更改' && this.form.subTypeName === 'InStorageRecallItem',
remote: true,
filterable: true,
'remote-method': this.resetMaterial,
options: []
},
handler: {
change: (v) => this.changeMaterial(v)
}
},
// { title: '物料编码', key: 'resCode', component: { name: 'el-select', placeholder: '请输入物料编码', remote: true, filterable: true, 'remote-method': this.resetMaterial, options: [] }, handler: {
// change: v => this.changeMaterial(v)
// }},
{
title: '物料编码',
key: 'resCode',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入物料编码'
}
},
{
title: '物料名称',
key: 'resName',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入物料名称'
}
},
{
title: '计量单位',
key: 'reqUnit',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入计量单位'
}
},
// { title: '物料类型', key: 'subTypeName', component: { name: 'el-input', disabled: true, placeholder: '请输入物料类型' }},
// { title: '名称', key: 'resName', component: { name: 'el-input', disabled: true, placeholder: '请输入名称' }},
{
title: '牌号/型号/件号',
key: 'modelNo',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入牌号/型号/件号'
}
},
{
title: '生产序列号',
key: 'serialNo',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入生产序列号'
}
},
{
title: '机型',
key: 'airModel',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请输入机型',
options: []
},
handler: {
change: (v) => {
v && this.changeSorties()
}
}
},
{
title: '架次',
key: 'sorties',
component: {
clearable: true,
'allow-create': true,
name: 'el-select',
placeholder: '请输入架次',
options: []
}
},
{
title: '入库数量',
key: 'reqAmount',
component: {
name: 'el-input-number',
disabled: childrenAddOrEdit,
min: 0,
placeholder: '请输入入库数量'
},
handler: {
change: () => this.changeComputed()
}
},
{
title: '供应商',
key: 'supplier',
component: {
name: 'el-select',
disabled: true,
placeholder: '请输入供应商'
},
handler: {
}
},
// {
// title: '是否合格供应商',
// key: 'isSupplierY',
// component: {
// clearable: true,
// name: 'el-select',
// disabled: true,
// placeholder: '请选择是否合格供应商',
// options: [
// { label: '是', value: true },
// { label: '否', value: false }
// ]
// }
// },
{
title: '制造商',
key: 'manufacturer',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入制造商'
}
},
{
title: '到货日期',
key: 'arrivalDate',
component: {
clearable: true,
name: 'el-date-picker',
// disabled: true,
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
placeholder: '请选择到货日期'
}
},
{
title: '生产日期',
key: 'producedTime',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-date-picker',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd hh:mm:ss',
placeholder: '请选择生产日期'
}
},
{
title: '到货图号',
key: 'arrivedDrawNo',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入到货图号'
}
},
{
title: '到货版次',
key: 'arrivalVer',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入到货版次'
}
},
{
title: '交付规范及版次',
key: 'deliverySpec',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入交付规范及版次'
}
},
{
title: '适航批准标签/批准放行证书',
key: 'approvalCert',
component: {
name: 'el-input',
disabled: childrenAddOrEdit,
placeholder: '请输入适航批准标签/批准放行证书'
}
},
{
title: '随产品资料',
key: 'withProductMaterial',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
multiple: true,
placeholder: '请选择随产品资料',
options: []
}
},
{
title: '紧急程度',
key: 'urgency',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请选择紧急程度',
options: [
{ label: '紧急', value: false },
{ label: '正常', value: true }
]
}
},
{
title: '入库单价',
key: 'stockUnitPrice',
component: {
clearable: true,
disabled: true,
name: 'el-input',
placeholder: '请输入入库单价'
}
},
{
title: '税率',
key: 'taxRate',
component: {
clearable: true,
disabled: childrenAddOrEdit && !parentIsVirtual,
name: 'el-input-number',
min: 0,
placeholder: '请输入税率'
},
handler: {
change: () => this.changeComputed()
}
},
{
title: '入库金额',
key: 'stockPrice',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入入库金额'
}
},
{
title: '含税单价',
key: 'taxUnitPrice',
component: {
clearable: true,
disabled: childrenAddOrEdit && !parentIsVirtual,
name: 'el-input-number',
placeholder: '请输入含税单价'
},
handler: {
change: () => this.changeComputed()
}
},
{
title: '含税金额',
key: 'taxPrice',
component: {
clearable: true,
name: 'el-input',
disabled: true,
placeholder: '请输入含税金额'
}
},
// { title: '报检人', key: 'userName', component: { name: 'el-input', disabled: true, placeholder: '请输入报检人' }},
{
title: '接收仓库',
key: 'storageZone',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-select',
placeholder: '请输入接收仓库',
options: []
},
handler: {
change: (v) => {
const STORAGE = this.formFileds[0].data.find(
(item) => item.key === 'storageZone'
)
const label = STORAGE.component.options.find(item => item.value === v).label
this.form.storageZoneName = label
}
}
},
{
title: '合同号/框架协议号',
key: 'contractNo',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入合同号'
}
},
{
title: '制造偏离单号',
key: 'deviationNo',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入制造偏离单号'
}
},
// { title: '订货单号', key: 'purchaseOrderNo', component: { name: 'el-input', placeholder: '请输入订货单号' }},
{
title: '备注',
key: 'remark',
component: {
clearable: true,
disabled: childrenAddOrEdit,
name: 'el-input',
placeholder: '请输入备注'
}
}
]
break
default:
break
}
// 外购成品添加明细时
if (this.header.materialTypeName.label === '外购成品' && !childrenAddOrEdit) {
this.isChild = false
this.formFileds[0].data.unshift(
{
title: '是否虚拟件',
key: 'isVirtual',
component: {
clearable: true,
name: 'el-select',
disabled: true,
placeholder: '请选择是否虚拟件',
options: [
{ label: '否', value: false },
{ label: '是', value: true }
]
}
}
)
}
// 添加子明细时
if (childrenAddOrEdit) {
this.isChild = true
this.formFileds[0].data.push(
{
title: '批次号',
key: 'lotNo',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入批次号'
}
},
{
title: '子件附件',
key: 'smallType',
component: {
clearable: true,
name: 'el-select',
placeholder: '请选择子件附件',
options: [
{ label: '子件', value: '子件' },
{ label: '附件', value: '附件' }
]
}
}
)
}
this.getBasicData()
// 设置物料类型下拉
this.resetMaterial()
// 设置带出接收仓库
this.defaultStorage()
// 设置带出机型
this.defaultAirModel()
// 设置随产品资料
this.resetProductFiles()
// 设置供应商
this.getExtDxSipplier()
},
// 设置物料类型下拉
async resetMaterial(query) {
if (query && query.length > 1) {
let paramsArr = []
await post(
`/ExtDxProcessResourceType/search`,
{
'pageFrom': 1,
'pageSize': 20,
'searchItems': {
'children': [
{
'items': [
{
'fieldName': 'parentId',
'operator': 'EQ',
'value': this.basicData.materialTypeId
}
],
'operator': 'AND'
}
],
'items': [],
'operator': 'AND'
},
'openProps': [],
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
}
)
.then((res) => {
paramsArr = res.items.content.map(item => {
return item.id
})
paramsArr.push(this.basicData.materialTypeId)
})
.catch((err) => {
console.log(err)
})
let parentIdItems = []
if (!this.isChild) {
parentIdItems = [
{
'fieldName': 'resType2.id',
'operator': 'IN',
'value': paramsArr
}
]
} else {
parentIdItems = []
}
await post(
`/ExtDxProcessMaterial/search`,
{
'pageFrom': 1,
'pageSize': 20,
'searchItems': {
'children': [
{
'items': parentIdItems,
'operator': 'AND'
},
{
'items': [
{
'fieldName': 'resCode',
'operator': 'LIKE',
'value': query
},
{
'fieldName': 'resName',
'operator': 'LIKE',
'value': query
},
{
'fieldName': 'modelNo',
'operator': 'LIKE',
'value': query
},
{
'fieldName': 'spec',
'operator': 'LIKE',
'value': query
},
{
'fieldName': 'techSpec',
'operator': 'LIKE',
'value': query
}
],
'operator': 'OR'
}
],
'items': []
},
'openProps': [
{
'name': 'extUnit'
},
{
'name': 'resType2'
}
],
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
}
)
.then((res) => {
this.material = res.items.content
const keywordField = this.formFileds[0].data.find(field => field.title === '物料关键词')
if (keywordField) {
keywordField.component.options = res.items.content.map(item => {
const labelParts = []
if (item.resName) labelParts.push(item.resName + '/')
if (item.modelNo) labelParts.push(item.modelNo + '/')
if (item.techSpec) labelParts.push(item.techSpec + '/')
if (item.spec) labelParts.push(item.spec + '/')
if (item.supplyStatus) labelParts.push(item.supplyStatus + '/')
if (item.supplierName) labelParts.push(item.supplierName + '/')
const label = labelParts.join('')
return {
label,
value: item.resCode,
disabled: ((this.operateType === 'MODIFY' && !this.form.isRoot) || this.operateType === 'ADD') && (this.form.extMaterial && item.resCode === this.form.extMaterial.resCode)
}
})
}
// this.formFileds[0].data.forEach(filed => {
// if (filed.title === '物料关键词') {
// filed.component.options = res.items.content.map(
// (item) => {
// // 新增或编辑子产品时和父产品物料类型不能一致
// if (((this.operateType === 'MODIFY' && !this.form.isRoot) || this.operateType === 'ADD') && item.resCode === this.form.extMaterial.resCode) {
// return {
// label: `${item.resName ? item.resName + '/' : ''}${item.modelNo ? item.modelNo + '/' : ''
// }${item.techSpec ? item.techSpec + '/' : ''}${item.spec ? item.spec + '/' : ''
// }${item.supplyStatus ? item.supplyStatus + '/' : ''}${item.supplierName ? item.supplierName + '/' : ''
// }`,
// value: item.resCode,
// disabled: true
// }
// } else {
// return {
// label: `${item.resName ? item.resName + '/' : ''}${item.modelNo ? item.modelNo + '/' : ''
// }${item.techSpec ? item.techSpec + '/' : ''}${item.spec ? item.spec + '/' : ''
// }${item.supplyStatus ? item.supplyStatus + '/' : ''}${item.supplierName ? item.supplierName + '/' : ''
// }`,
// value: item.resCode
// }
// }
// }
// )
// }
// })
})
.catch((err) => {
console.log(err)
})
}
},
// 默认带出机型
defaultAirModel() {
const params = {
searchItems: {
'operator': 'AND',
'items': [
// {
// 'fieldName': 'name',
// 'operator': 'EQ',
// 'value': ''
// }
]
}
}
this.$api.searchApi('AircraftType', params).then(res => {
const AIRMODEL = this.formFileds[0].data.find(
(item) => item.key === 'airModel'
)
AIRMODEL.component.options = res.items.content.map((item) => {
return {
label: item.defName,
value: item.defCode
}
})
this.$set(this.form, 'airModel', AIRMODEL.component.options[0].label)
})
},
// 根据机型带出架次
changeSorties() {
const params = {
searchItems: {
'operator': 'AND',
'items': [
{
'fieldName': 'aircraftType.defCode',
'operator': 'EQ',
'value': this.form.airModel
}
]
}
}
this.$api.searchApi('AircraftSorties', params).then(res => {
const SORTIES = this.formFileds[0].data.find(
(item) => item.key === 'sorties'
)
SORTIES.component.options = res.items.content.map((item) => {
return {
label: item.defName,
value: item.defCode
}
})
})
},
// material display
materialDisplay(id) {
post(
`/ExtDxProcessResourceType/search`,
{
'pageFrom': 1,
'pageSize': 9999,
'searchItems': {
'children': [
{
'items': [
{
'fieldName': 'id',
'operator': 'EQ',
'value': id || ''
}
],
'operator': 'AND'
}
],
'items': []
},
'openProps': [],
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
},
)
.then((res) => {
console.log('materialDisplay', res)
})
.catch((err) => {
console.log(err)
})
},
// 默认带出接收仓库
defaultStorage() {
const params = {
'pageFrom': 1,
'pageSize': 9999,
'searchItems': {
'children': [
{
'items': [{
'fieldName': 'targetId',
'operator': 'EQ',
'value': this.basicData.materialTypeId || ''
},
{
'fieldName': 'source.extDxProductAreaId',
'operator': 'EQ',
'value': this.basicData.extDxProductAreaId || ''
}
],
'operator': 'AND'
}
],
'items': [],
'operator': 'AND'
},
'openProps': [{ 'name': 'source' }]
}
post(`ExtCenterResourceTypeLink/search`, params)
.then((res) => {
const STORAGE = this.formFileds[0].data.find(
(item) => item.key === 'storageZone'
)
STORAGE.component.options = res.items.content.map((item) => {
return {
label: item.source && item.source.extname,
value: item.source && item.source.id
}
})
})
.catch((err) => {
console.log(err)
})
},
// 切换物料下拉
changeMaterial(v) {
// 带出物料相关默认值
const SELECT_MATERIAL = this.material.find((item) => item.resCode === v)
if (SELECT_MATERIAL) {
this.$set(this.form, 'modelNo', SELECT_MATERIAL.modelNo || '/')
this.$set(this.form, 'techSpec', SELECT_MATERIAL.techSpec || '/')
this.$set(this.form, 'spec', SELECT_MATERIAL.spec || '/')
this.$set(this.form, 'supplyStatus', SELECT_MATERIAL.supplyStatus || '/')
this.$set(this.form, 'reqUnit', SELECT_MATERIAL.extUnit && SELECT_MATERIAL.extUnit.unitName || '/')
this.$set(this.form, 'resName', SELECT_MATERIAL.resName)
this.$set(this.form, 'extMaterial', SELECT_MATERIAL)
// this.extMaterialId = SELECT_MATERIAL.id || ''
this.extUnitId = SELECT_MATERIAL.extUnitId || ''
}
},
// 供应商ExtDxSipplier/find/recursion
getExtDxSipplier() {
const param = {}
post('ExtDxSipplier/find/recursion', param).then(res => {
this.formFileds[0].data.forEach(item => {
item.key === 'supplier' && (item.component.options = res.items.content.map(row => { return { value: row.id, label: `${row.supplierCode}-${row.supplierName}` } }))
})
}).catch((err) => {
console.log(err)
})
},
// 设置随产品资料
resetProductFiles(value) {
const PRODUCT = this.formFileds[0].data.find(
(item) => item.key === 'withProductMaterial'
)
switch (this.header.billType) {
case 'Material':
PRODUCT.component.options = [
{ label: '合格证', value: '合格证' },
{ label: '试验报告', value: '试验报告' },
{ label: '其他资料', value: '其他资料' }
]
break
case 'AirEquipment':
PRODUCT.component.options = [
{ label: '装箱单/发货清单', value: '装箱单/发货清单' },
{ label: '交付资料清单', value: '交付资料清单' },
{ label: '合格证', value: '合格证' },
{ label: '履历本', value: '履历本' },
{
label: '适航批准标签/批准放行证书',
value: '适航批准标签/批准放行证书'
},
{ label: '不合格品审理单清单', value: '不合格品审理单清单' },
{ label: '不合格品审理单复印件', value: '不合格品审理单复印件' },
{ label: '器材代用单清单', value: '器材代用单清单' },
{ label: '器材代用单复印件', value: '器材代用单复印件' },
{ label: '配套清单及合格证', value: '配套清单及合格证' },
{ label: '备件清单及合格证', value: '备件清单及合格证' },
{ label: '工具清单及合格证', value: '工具清单及合格证' },
{ label: '使用说明书', value: '使用说明书' },
{ label: '维护手册', value: '维护手册' },
{ label: '光盘', value: '光盘' },
{ label: '其他资料', value: '其他资料' }
]
break
case 'OutSource':
PRODUCT.component.options = [
{ label: '装箱单/发货清单', value: '装箱单/发货清单' },
{ label: '合格证', value: '合格证' },
{
label: '适航批准标签/批准放行证书',
value: '适航批准标签/批准放行证书'
},
{ label: '器材合格证', value: '器材合格证' },
{ label: '测量报告/尺寸数据报告', value: '测量报告/尺寸数据报告' },
{ label: '试验报告', value: '试验报告' },
{ label: '器材代用单清单', value: '器材代用单清单' },
{ label: '不合格品审理单清单', value: '不合格品审理单清单' },
{ label: '多余物声明', value: '多余物声明' },
{ label: '光盘', value: '光盘' },
{ label: '其他资料', value: '其他资料' }
]
break
default:
break
}
if (value) this.$set(this.form, 'withProductMaterial', value)
},
// 计算金额
changeComputed() {
// 含税金额=含税单价 * 入库数量
if (this.form.taxUnitPrice && this.form.reqAmount) {
this.form = Object.assign({}, this.form, {
taxPrice: (this.form.taxUnitPrice * this.form.reqAmount).toFixed(2)
})
} else {
this.form = Object.assign({}, this.form, { taxPrice: '' })
}
// 入库单价=含税单价/(1+税率/100)
if (
this.form.taxUnitPrice &&
(this.form.taxRate || this.form.taxRate === 0)
) {
this.form = Object.assign({}, this.form, {
stockUnitPrice: (
this.form.taxUnitPrice /
(1 + this.form.taxRate / 100)
).toFixed(8)
})
} else {
this.form = Object.assign({}, this.form, { stockUnitPrice: '' })
}
// 入库金额=含税单价/(1+税率/100)* 入库数量
if (
this.form.taxUnitPrice &&
(this.form.taxRate || this.form.taxRate === 0) &&
this.form.reqAmount
) {
this.form = Object.assign({}, this.form, {
stockPrice: (
(this.form.taxUnitPrice / (1 + this.form.taxRate / 100)) *
this.form.reqAmount
).toFixed(2)
})
} else {
this.form = Object.assign({}, this.form, { stockPrice: '' })
}
},
save() {
this.$set(this.formButtons[0].component, 'loading', true)
this.$refs.form.validate((isok) => {
if (isok) {
// 校验通过
const newTableData = {
...this.form,
'operator': 'MODIFY',
// 'subTypeName': 'InStoragePurchaseItem',
'rowId': this.form.id || this.generateUUID(),
// 'parentId': this.isChild ? this.parentId || this.form.parentId : null,
// 'parentRowId': this.parentRowId,
// 'extMaterialId': this.form.extMaterial ? this.form.extMaterial.id : this.form.extMaterialId,
// 'extMaterialIdType': 'ExtDxProcessMaterial',
// 'materialTypeName': this.basicData.materialTypeName.label,
// 'purchaseUnitId': this.extUnitId,
// 'purchaseUnitIdType': 'ExtUnit',
// 'lotNo': this.form.lotNo,
// 'airModel': this.form.airModel,
// 'sorties': this.form.sorties,
// 'reqAmount': this.form.reqAmount || 0,
// 'extDxSipplierId': this.basicData.extDxSipplierId || '',
// 'extDxSipplierIdType': 'ExtDxSipplier',
// 'manufacturer': this.form.manufacturer || '/',
// 'arrivalDate': this.form.arrivalDate,
// 'producedTime': this.form.producedTime,
// 'storageCondition': this.form.storageCondition || '/',
'withProductMaterial': Array.isArray(this.form.withProductMaterial) ? this.form.withProductMaterial.join(';') : this.form.withProductMaterial || '/',
// 'urgency': this.form.urgency,
// 'arrivedDrawNo': this.form.arrivedDrawNo || '/',
// 'arrivalVer': this.form.arrivalVer || '/',
// 'stockUnitPrice': this.form.stockUnitPrice,
// 'taxRate': this.form.taxRate,
// 'stockPrice': this.form.stockPrice,
// 'taxUnitPrice': this.form.taxUnitPrice,
// 'taxPrice': this.form.taxPrice,
// 'storageZoneName': this.form.storageZoneName,
'storageZoneId': typeof (this.form.storageZone) === 'object' ? this.form.storageZone.id : this.form.storageZone,
// 'storageZoneIdType': 'ExtDxProductWorkCenter',
// 'inventoryReqId': this.basicData.id,
// 'inventoryReqIdType': 'InventoryRequest',
// 'contractNo': this.form.contractNo,
// 'deviationNo': this.form.deviationNo || '/',
// 'isRoot': !this.isChild,
// 'subEquipment': this.form.subEquipment || '/',
// 'productDwawVer': this.form.productDwawVer || '/',
// 'atpName': this.form.atpName || '/',
// 'atpNo': this.form.atpNo || '/',
// 'softConfPieceNo': this.form.softConfPieceNo || '/',
// 'elecHardwareConfPieceNo': this.form.elecHardwareConfPieceNo || '/',
// 'approvalCert': this.form.approvalCert || '/',
// 'isNewlyProduct': this.form.isNewlyProduct || false,
// 'reqUnit': this.form.reqUnit || '/',
// 'remark': this.form.remark || '/',
'operateType': this.operateType
// 'MaterialResCode': this.form.resCode
// 'deliverySpec': this.basicData.deliverySpec || '/'
}
post(
'/InStorageRequestItem/recursion',
newTableData
).then((res) => {
this.$utils.showMessageSuccess('保存成功')
this.$bus.$emit('refreshInstorageItem')
this.handleClose()
}).catch((err) => {
console.log(err)
}).finally(() => {
this.$set(this.formButtons[0].component, 'loading', false)
})
}
})
},
generateUUID() {
let d = new Date().getTime()
const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = (d + Math.random() * 16) % 16 | 0
d = Math.floor(d / 16)
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16)
})
return uuid
}
}
}
</script>
<style lang='scss'></style>
......@@ -90,6 +90,13 @@ export default {
created() {
},
mounted() {
this.$bus.$on('refreshInstorageItem', () => {
this.$nextTick(() => {
if (this.$refs[this.active + 'Table']) {
this.$refs[this.active + 'Table'].$refs.asCom.getData(this.searchItems)
}
})
})
},
// 组件方法
methods: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment