Commit 3ba0f1a7 authored by xioln's avatar xioln

入库申请明细提交

parent 571ff13f
/**
* @Description: 入库明细新增
* @author xioln
* @date 2023-06-21
* @FilePath: applications/dee-mes/src/privateComponents/components/StorageDetailsCreate/index.cue
*/
<template>
<div class="storageDetails-create">
<dee-dialog
:dialog-visible="dialogVisible"
title="采购入库申请创建"
width="90%"
@handleClose="handleClose"
>
<dee-form
ref="form"
:form="form"
:form-data="formFileds"
:rules="rules"
label-width="200px"
form-btn-position="center"
>
<section>
<el-button :disabled="disabled" type="primary" size="medium" @click="save">确定</el-button>
<el-button :disabled="disabled" size="medium" @click="handleClose">取消</el-button>
</section>
</dee-form>
</dee-dialog>
</div>
</template>
<script>
import { post } from '@/utils/http'
export default {
componentName: '采购入库申请创建',
name: 'StorageDetailsCreate', // name写在组件的最前方,自定义组件为必填
components: {},
props: {
basicData: {
type: Object,
default: () => { }
}
},
data() {
return {
dialogVisible: false,
disabled: false,
header: {},
billType: '',
form: {},
formFileds: [
{
split: 3,
data: []
}
],
material: [],
suppliers: [],
// 表单校验
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']
}
],
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']
}
]
// purchaseAmount: [{ required: true, message: '请填写表单信息', trigger: ['blur', 'change'] }],
},
extMaterialId: '',
parentId: null,
operateType: null
}
},
computed: {},
watch: {
basicData: {
handler: function(v) {
console.log('basicData', v)
this.header = v
if (
v.billType === 'AirEquipment' &&
(['标准件', '金属材料', '非金属材料'].includes(v.materialTypeName.label))) {
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']
}
])
}
},
immediate: true
}
// 'form.resCode': {
// handler: function(v) {
// this.resetMaterial(v)
// }
// }
},
created() {
// 初始化数据
},
mounted() {
// this.form.arrivalDate = this.basicData.arrivalDate || ''
},
methods: {
handleOpen(type, row) {
this.form = {}
this.dialogVisible = true
this.operateType = type
this.resetForm()
if (type === 'ADD') {
this.parentId = row.rowId
} else if (type === 'UPDATE') {
console.log('row', row)
this.form = row
this.$set(this.form, 'operator', row.operator || '')
this.$set(this.form, 'resCode', row.extMaterial.resCode || '')
this.$set(this.form, 'resName', row.extMaterial.resName || '')
this.$set(this.form, 'reqUnit', row.extMaterial.extUnit.unitName || '')
this.$set(this.form, 'modelNo', row.extMaterial.modelNo || '')
this.$set(this.form, 'extMaterialId', row.extMaterialId || '')
this.$set(this.form, 'supplier', row.extDxSipplier.supplierFullName || '')
this.$set(this.form, 'withProductMaterial', row.withProductMaterial.split(';'))
this.resetMaterial(row.extMaterial.resCode)
this.changeMaterial(row.extMaterial.resCode)
}
},
handleClose() {
this.dialogVisible = false
},
// 重设表单
resetForm() {
if (!this.header) return
this.$set(this.form, 'supplier', this.header.supplierFullName.label || '')
this.$set(this.form, 'arrivalDate', this.header.arrivalDate)
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,
'remote-method': 'remoteMethod',
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: []
}
},
{
title: '架次',
key: 'sorties',
component: { name: 'el-input', placeholder: '请输入架次' }
},
// { 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-input',
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',
placeholder: '请选择到货日期'
}
},
{
title: '生产日期',
key: 'producedTime',
component: {
clearable: true,
name: 'el-date-picker',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd',
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: []
}
},
{
title: '合同号/框架协议号',
key: 'contractNo',
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,
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',
placeholder: '请输入系列号'
}
},
{
title: '机型',
key: 'airModel',
component: {
clearable: true,
name: 'el-select',
placeholder: '请输入机型',
options: []
}
},
{
title: '架次',
key: 'sorties',
component: { name: 'el-input', placeholder: '请输入架次' }
},
{
title: '入库数量',
key: 'reqAmount',
component: {
clearable: true,
name: 'el-input-number',
min: 1,
disabled: true,
placeholder: '请输入入库数量'
},
handler: {
change: () => this.changeComputed()
}
},
{
title: '供应商',
key: 'supplier',
component: {
name: 'el-input',
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',
placeholder: '请选择到货日期'
}
},
{
title: '生产日期',
key: 'producedTime',
component: {
clearable: true,
name: 'el-date-picker',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd',
placeholder: '请选择生产日期'
}
},
{
title: '产品图号/版本',
key: 'productDwawVer',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入产品图号/版本'
}
},
{
title: 'ATP名称',
key: 'atpName',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入ATP名称'
}
},
{
title: 'ATP编号及版次',
key: 'atpNo',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入ATP编号及版次'
}
},
{
title: '软件构型件号/版次',
key: 'softConfPieceNo',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入软件构型件号/版次',
type: 'textarea',
rows: 3
}
},
{
title: '电子硬件构型件号/版本',
key: 'elecHardwareConfPieceNo',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入电子硬件构型件号/版本',
type: 'textarea',
rows: 3
}
},
{
title: '适航批准标签/批准放行证书',
key: 'approvalCert',
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: 'isNewlyProduct',
component: {
clearable: true,
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,
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: []
}
},
{
title: '合同号/框架协议号',
key: 'contractNo',
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 'OutSource':
this.billType = '外包产品'
this.formFileds[0].data = [
{
title: '物料关键词',
key: 'resCode',
component: {
clearable: true,
name: 'el-select',
placeholder: '请输入物料关键词',
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,
name: 'el-input',
placeholder: '请输入生产序列号'
}
},
{
title: '机型',
key: 'airModel',
component: {
clearable: true,
name: 'el-select',
placeholder: '请输入机型',
options: []
}
},
{
title: '架次',
key: 'sorties',
component: { name: 'el-input', placeholder: '请输入架次' }
},
{
title: '入库数量',
key: 'reqAmount',
component: {
name: 'el-input-number',
min: 0,
placeholder: '请输入入库数量'
},
handler: {
change: () => this.changeComputed()
}
},
{
title: '供应商',
key: 'supplier',
component: {
name: 'el-input',
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',
placeholder: '请选择到货日期'
}
},
{
title: '生产日期',
key: 'producedTime',
component: {
clearable: true,
name: 'el-date-picker',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd',
placeholder: '请选择生产日期'
}
},
{
title: '到货图号',
key: 'arrivedDrawNo',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入到货图号'
}
},
{
title: '到货版次',
key: 'arrivalVer',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入到货版次'
}
},
{
title: '交付规范及版次',
key: 'deliverySpec',
component: {
clearable: true,
name: 'el-input',
placeholder: '请输入交付规范及版次'
}
},
{
title: '适航批准标签/批准放行证书',
key: 'approvalCert',
component: {
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: false },
{ label: '正常', value: true }
]
}
},
{
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: []
}
},
{
title: '合同号/框架协议号',
key: 'contractNo',
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
default:
break
}
// 设置物料类型下拉
this.resetMaterial()
// 设置带出接收仓库
this.defaultStorage()
// 设置带出机型
this.defaultAirModel()
// 设置随产品资料
this.resetProductFiles()
},
// 设置物料类型下拉
async resetMaterial(query) {
if (query && query.length > 1) {
let paramsArr = []
await post(
`/ExtDxProcessResourceType/search`,
{
'pageFrom': 1,
'pageSize': 9999,
'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)
})
await post(
`/ExtDxProcessMaterial/search`,
{
'pageFrom': 1,
'pageSize': 9999,
'searchItems': {
'children': [
{
'items': [
{
'fieldName': 'resType2.id',
'operator': 'IN',
'value': paramsArr
}
],
'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'
}
],
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
}
)
.then((res) => {
this.material = res.items.content
this.formFileds[0].data[0].component.options = res.items.content.map(
(item) => {
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
}
})
})
},
// 根据机型带出架次
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() {
post(
`/ExtDxProductWorkCenter/search`,
{
'pageFrom': 1,
'pageSize': 9999,
'searchItems': {
'children': [
{
'items': [
{
'fieldName': 'extDxProductArea.id',
'operator': 'EQ',
'value': this.basicData.extDxProductAreaId || ''
}
],
'operator': 'AND'
}
],
'items': []
},
'openProps': [],
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
},
)
.then((res) => {
this.form.storageZone =
res.items && res.items.content.length ? res.items.content[0].id : ''
const STORAGE = this.formFileds[0].data.find(
(item) => item.key === 'storageZone'
)
STORAGE.component.options = res.items.content.map((item) => {
return {
label: item.extname,
value: item.id
}
})
// this.form.storageZone = row.storageZoneId
})
.catch((err) => {
console.log(err)
})
},
// 切换物料下拉
changeMaterial(v) {
// 带出物料相关默认值
const SELECT_MATERIAL = this.material.find((item) => item.resCode === v)
console.log('SELECT_MATERIAL', SELECT_MATERIAL)
if (SELECT_MATERIAL) {
this.form.modelNo = SELECT_MATERIAL.modelNo || ''
this.form.techSpec = SELECT_MATERIAL.techSpec || ''
this.form.spec = SELECT_MATERIAL.spec || ''
this.form.supplyStatus = SELECT_MATERIAL.supplyStatus || ''
this.form.reqUnit = SELECT_MATERIAL.extUnit.unitName || ''
this.form.resName = SELECT_MATERIAL.resName || ''
this.extMaterialId = SELECT_MATERIAL.id || ''
this.extUnitId = SELECT_MATERIAL.extUnitId || ''
}
},
// 设置随产品资料
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() {
console.log('this.form', this.form)
this.$refs.form.validate((isok) => {
if (isok) {
console.log('this.form.operator', this.form.operator)
// 校验通过
const newTableData = {
...this.form,
'operator': this.form.operator,
'subTypeName': 'InStoragePurchaseItem',
'rowId': this.form.rowId ? this.form.rowId : this.generateUUID(),
'parentId': this.form.parentId ? this.form.parentId : this.parentId,
'hasParent': this.form.hasParent ? this.form.hasParent : !!this.parentId,
'extMaterialId': this.extMaterialId ? this.extMaterialId : 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,
'extDxSipplierId': this.basicData.extDxSipplierId,
'extDxSipplierIdType': 'ExtDxSipplier',
'manufacturer': this.form.manufacturer,
'arrivalDate': this.form.arrivalDate ? this.form.arrivalDate : null,
'producedTime': this.form.producedTime,
'storageCondition': this.form.storageCondition,
'withProductMaterial': this.form.withProductMaterial ? this.form.withProductMaterial.join(';') : '',
'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,
'storageZoneId': this.form.storageZone,
'storageZoneIdType': 'ExtDxProductWorkCenter',
'inventoryReqId': this.basicData.id,
'inventoryReqIdType': 'InventoryRequest',
'contractNo': this.form.contractNo,
'isRoot': true,
'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,
'reqUnit': this.form.reqUnit,
'remark': this.form.remark,
'operateType': this.operateType,
'MaterialResCode': this.form.resCode
}
this.$emit('addTableData', newTableData)
this.handleClose()
}
})
// post(
// '/InStorageRequestItem/recursion',
// {
// 'operator': 'ADD',
// 'subTypeName': 'InStoragePurchaseItem',
// 'extMaterialId': this.extMaterialId,
// 'extMaterialIdType': 'ExtDxProcessMaterial',
// 'purchaseUnitId': this.extUnitId,
// 'purchaseUnitIdType': 'ExtUnit',
// 'lotNo': this.form.lotNo,
// 'airModel': this.form.airModel,
// 'sorties': this.form.sorties,
// 'reqAmount': this.form.reqAmount,
// 'extDxSipplierId': this.basicData.extDxSipplierId,
// 'extDxSipplierIdType': 'ExtDxSipplier',
// 'manufacturer': this.form.manufacturer,
// 'arrivalDate': this.form.arrivalDate ? this.form.arrivalDate : null,
// 'producedTime': this.form.producedTime ? this.form.producedTime + ' 00:00:00' : null,
// 'storageCondition': this.form.storageCondition,
// 'withProductMaterial': this.form.withProductMaterial ? this.form.withProductMaterial.join(';') : '',
// '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,
// 'storageZoneId': this.form.storageZone,
// 'storageZoneIdType': 'ExtDxProductWorkCenter',
// 'inventoryReqId': this.basicData.id,
// 'inventoryReqIdType': 'InventoryRequest',
// 'contractNo': this.form.contractNo,
// 'isRoot': true,
// '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
// }
// ).then((res) => {
// this.$utils.showMessageSuccess('保存成功')
// this.handleClose()
// })
// .catch((err) => {
// console.log(err)
// })
},
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>
/**
* @Description: 采购入库申请创建编辑
* @author xioln
* @date 2023-07-05
* @FilePath: applications/dee-mes/src/privateComponents/components/purchasingWarehousingNewOrEdit/index.vue
*/
<template>
<div class="className">
<dee-form
ref="form"
label-width="120"
:form="form"
:form-data="formData"
:rules="rules"
@on-submit="submit"
@on-cancel="cancel"
/>
<div class="sub-title"> 采购入库申请明细 </div>
<dee-table
:data="tableData"
:columns="columns"
:options="optionsTree"
:index-row="{ title: '序号', width: '70' }"
>
<div slot="header" class="table-title-wrap">
<dee-tools :tools="tools" mode="normal" />
</div>
</dee-table>
<span style="position: absolute;top: calc(100% - 70px);left: calc(50% + 30px);}">
<el-button type="primary" class="searchBtn" @click="submit">保存</el-button>
</span>
<storage-details ref="storageDetailsCreatOrEdit" :basic-data="detailsPropData" @addTableData="addTableData" />
</div>
</template>
<script>
import { post, del } from '@/utils/http'
import StorageDetails from './component/storageDetailsCreateCom'
export default {
componentName: '采购入库申请创建编辑',
name: 'PurchasingWarehousingNewOrEdit', // name写在组件的最前方,自定义组件为必填
components: { StorageDetails },
props: {
basicData: {
type: Object,
default: () => null
}
},
data() {
return {
form: {},
formData: [{
title: '基本信息',
split: 2,
data: [
{
title: '申请单号',
key: 'reqNo',
component: {
disabled: true,
clearable: true,
placeholder: '自动生成',
name: 'el-input'
}
},
{
title: '验收单类型',
key: 'billType',
component: {
clearable: true,
name: 'el-select',
placeholder: '请选择',
options: []
}
},
{
title: '器材类别',
key: 'materialTypeId',
component: {
clearable: true,
name: 'el-select',
placeholder: '请选择',
options: []
}
},
{
title: '区域',
key: 'extDxProductAreaId',
component: {
clearable: true,
name: 'el-select',
placeholder: '请选择',
options: []
}
},
{
title: '供应商',
key: 'extDxSipplierId',
component: {
clearable: true,
name: 'el-select',
placeholder: '请选择',
options: []
}
},
{
title: '到货日期',
key: 'arrivalDate',
component: {
name: 'el-date-picker',
// type: 'daterange',
clearable: true,
valueFormat: 'yyyy-MM-dd HH:mm:ss'
}
},
{
title: '创建人',
key: 'creator.userName',
component: {
disabled: true,
clearable: true,
placeholder: '自动生成',
name: 'el-input'
}
},
{
title: '创建时间',
key: 'createTime',
component: {
disabled: true,
clearable: true,
placeholder: '自动生成',
name: 'el-input'
}
}
]
}],
buttonTools: [
{
name: '保存',
icon: '/icons/components/new/add.png',
handler: {
click: () => {
}
}
}
],
rules: {
billType: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
materialTypeId: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
arrivalDate: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
extDxProductAreaId: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
],
extDxSipplierId: [
{
required: true,
message: '请填写表单信息',
trigger: ['blur', 'change']
}
]
},
tools: [{
name: '添加入库物料',
icon: '/icons/components/new/add.png',
handler: {
click: () => {
this.$refs.form.validate((isok) => {
console.log('isok', isok)
if (isok) {
// 校验通过
this.$refs.storageDetailsCreatOrEdit.handleOpen('NEW')
} else {
this.$utils.showMessageWarning('请填写基本信息!')
}
})
}
}
}],
optionsTree: {
'row-key': 'rowId', // value值需为可以标识该对象唯一的值
lazy: false,
'tree-props': { children: 'children', hasChildren: 'hasParent' }
},
columns: [
{
title: '操作', minWidth: 120, align: 'center', component: {
name: 'EditTableRow',
show: true,
props: {
btns: [{
operation: '新增',
handleClick: (row, index) => {
row.operator = 'ADD'
this.$refs.storageDetailsCreatOrEdit.handleOpen('ADD', row)
},
icon: '/icons/components/new/add.png',
showFun: (row) => {
if (row.parentId) {
return false
}
return true
}
},
{
operation: '编辑',
handleClick: (row, index) => {
row.operator = 'MODITY'
this.$refs.storageDetailsCreatOrEdit.handleOpen('UPDATE', row)
},
icon: '/icons/components/new/edit.png',
showFun: (row) => {
return true
}
},
{
operation: '移除',
handleClick: (row, index) => {
this.$confirm('确认是否删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const id = row.id
del(`InStorageRequestItem/batch/${id}`).then(res => {
for (const item of this.tableData) {
// 父类修改
if (item.rowId === row.rowId) {
this.tableData.splice(this.tableData.indexOf(item), 1)
break
}
// 子类修改
for (const child of item.children) {
if (child.rowId === row.rowId) {
this.tableData[this.tableData.indexOf(item)].children.splice(item.children.indexOf(child), 1)
break
}
}
}
this.$message({
type: 'success',
message: '删除成功!'
})
}).catch((err) => {
console.log(err)
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
icon: '/icons/c-creatbackups.png',
showFun: (row) => {
return true
}
}]
}
}
},
{ title: '所属设备', key: 'subEquipment', headerAlign: 'center' },
{ title: '物料类型', key: 'typeName', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
const value = row.extMaterial ? row.extMaterial.resType2.typeName : row.materialTypeName
return value
} },
{ title: '编码', key: 'typeCode', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
const value = row.extMaterial ? row.extMaterial.resCode : row.resCode
return value
} },
{ title: '机型', key: 'airModel', headerAlign: 'center' },
{ title: '架次', key: 'sorties', headerAlign: 'center' },
{ title: '计量单位', key: 'unitName', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
const value = row.extMaterial ? row.extMaterial.resType2.unitName : row.reqUnit
return value
} },
{ title: '入库数量', key: 'reqAmount', headerAlign: 'center' },
{ title: '供应商', key: 'supplierFullName', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
const value = row.extMaterial ? row.extMaterial.resType2.supplierFullName : row.supplier
return value
} },
// { title: '是否合格供应商', key: 'extDxSipplier.isValid', headerAlign: 'center' },
{ title: '制造商', key: 'manufacturer', headerAlign: 'center' },
{ title: '到货日期', key: 'arrivalDate', headerAlign: 'center' },
{ title: '生产日期', key: 'producedTime', headerAlign: 'center' },
{ title: '随产品资料', key: 'withProductMaterial', headerAlign: 'center' },
{ title: '紧急程度', key: 'urgency', headerAlign: 'center' },
{ title: '入库单价', key: 'stockUnitPrice', headerAlign: 'center' },
{ title: '入库金额', key: 'stockPrice', headerAlign: 'center' },
{ title: '含税单价', key: 'taxUnitPrice', headerAlign: 'center' },
{ title: '含税金额', key: 'taxPrice', headerAlign: 'center' },
{ title: '税率', key: 'taxRate', headerAlign: 'center' },
{ title: '报检人', key: 'applyUserName', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
const value = row.extMaterial ? row.extMaterial.resType2.applyUserName : row.supplier
return value
} },
{ title: '接受仓库', key: 'extname', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
const value = row.extMaterial ? row.extMaterial.resType2.extname : row.storageZone
return value
} },
{ title: '合同号', key: 'contractNo', headerAlign: 'center' },
{ title: '备注', key: 'remark', headerAlign: 'center' },
{ title: '状态', key: 'state', headerAlign: 'center' },
{ title: '创建时间', key: 'createTime', headerAlign: 'center' }
],
tableData: [],
operator: null
}
},
computed: {
detailsPropData: function() {
return {
materialTypeName: this.formData[0].data.find(item => item.key === 'materialTypeId').component.options.find(item => item.value === this.form.materialTypeId),
supplierFullName: this.formData[0].data.find(item => item.key === 'extDxSipplierId').component.options.find(item => item.value === this.form.extDxSipplierId),
...this.form
}
}
},
created() {
// 初始化数据
this.initData()
console.log('this.basicData', this.basicData)
this.operator = 'ADD'
if (Object.keys(this.basicData).length !== 0) {
this.form = this.basicData
this.searchInStorageRequestItem()
this.operator = 'MODITY'
}
},
methods: {
initData() {
this.getDictData()
this.getExtDxProcessResourceType()
this.getExtDxProductArea()
this.getExtDxSipplier()
},
// 验收单类型 DictData/search
getDictData() {
const param = { 'pageFrom': 1, 'pageSize': 9999, 'searchItems': { 'items': [{ 'fieldName': 'dictState', 'operator': 'EQ', 'value': 'ENABLE' }, { 'fieldName': 'dictCode', 'operator': 'EQ', 'value': 'BillType' }] }, 'sortItem': [{ 'fieldName': 'dictSeq', 'sortOrder': 'asc' }] }
post('DictData/search', param).then(res => {
this.formData[0].data.forEach(item => {
item.key === 'billType' && (item.component.options = res.items.content.map(row => { return { value: row.dictKey, label: row.dictValue } }))
})
}).catch((err) => {
console.log(err)
})
},
// 器材类型/ExtDxProcessResourceType/search
getExtDxProcessResourceType() {
const param = { 'indices': ['DxProcessResourceMaterialType'], 'pageFrom': 1, 'pageSize': 100, 'searchItems': { 'operator': 'AND', 'items': [{ 'fieldName': 'parentId', 'operator': 'ISNULL' }] }}
post('ExtDxProcessResourceType/search', param).then(res => {
const targetItem = this.formData[0].data.find(item => item.key === 'materialTypeId')
if (targetItem) {
targetItem.component.options = res.items.content.map(row => ({ value: row.id, label: row.typeName }))
}
}).catch((err) => {
console.log(err)
})
},
// 区域ExtDxProductArea/search
getExtDxProductArea() {
const param = { 'pageFrom': 1, 'pageSize': 100, 'indices': ['DxProductArea'], 'searchItems': { 'items': [], 'operator': 'AND' }}
post('ExtDxProductArea/search', param).then(res => {
this.formData[0].data.forEach(item => {
item.key === 'extDxProductAreaId' && (item.component.options = res.items.content.map(row => { return { value: row.id, label: row.extname } }))
})
}).catch((err) => {
console.log(err)
})
},
// 供应商ExtDxSipplier/find/recursion
getExtDxSipplier() {
const param = {}
post('ExtDxSipplier/find/recursion', param).then(res => {
this.formData[0].data.forEach(item => {
item.key === 'extDxSipplierId' && (item.component.options = res.items.content.map(row => { return { value: row.id, label: `${row.supplierCode}-${row.supplierName}` } }))
})
}).catch((err) => {
console.log(err)
})
},
// 编辑采购入库明细查询InStorageRequestItem/search
searchInStorageRequestItem() {
const param = {
'pageFrom': 1,
'pageSize': 10,
'searchItems': {
'children': [
{
'items': [
{
'fieldName': 'inventoryReq.id',
'operator': 'EQ',
'value': this.basicData.id
},
{
'fieldName': 'isRoot',
'operator': 'EQ',
'value': 'true'
}
],
'operator': 'AND'
}
],
'items': []
},
'openProps': [{ 'name': 'extMaterial', 'openProps': [{ 'name': 'resType2' }, { 'name': 'extUnit' }] }, { 'name': 'extDxSipplier' }],
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
}
post('InStorageRequestItem/search', param).then(res => {
console.log('res.items.content', res.items.content)
const data = res.items.content.map(item => {
return {
...item,
operator: 'NO_CHANGE'
}
})
this.tableData = data
}).catch((err) => {
console.log(err)
})
},
// 组装表格数据
addTableData(formData) {
console.log('addTableData', formData)
const tableDataItem = {
...formData,
subEquipment: formData.materialTypeName,
// extMaterial: {
// resType2: {
// typeCode: formData.materialTypeName,
// typeName: formData.materialTypeName
// }
// },
// purchaseUnit: { unitName: formData.reqUnit },
// extDxSipplier: {
// supplierFullName: formData.supplier
// },
// inventory: {
// applyUserName: formData.supplier
// },
// storageZone: {
// extname: formData.storageZone
// },
children: []
}
// 根据父子关系添加数据
if (tableDataItem.operateType === 'ADD') {
for (let i = 0; i < this.tableData.length; i++) {
const item = this.tableData[i]
if (tableDataItem.hasParent && !item.children) {
item.children = []
}
if (item.rowId === tableDataItem.parentId) {
item.children.push(tableDataItem)
break
}
}
}
if (tableDataItem.operateType === 'UPDATE') {
for (const item of this.tableData) {
// 父类修改
if (item.id === tableDataItem.id) {
// console.log('item', tableDataItem)
this.tableData.splice(this.tableData.indexOf(item), 1, tableDataItem)
break
}
// 子类修改
for (const child of item.children) {
if (child.id === tableDataItem.id) {
this.tableData[this.tableData.indexOf(item)].children.splice(item.children.indexOf(child), 1, tableDataItem)
break
}
}
}
}
if (tableDataItem.operateType === 'NEW') {
this.tableData.push(tableDataItem)
}
console.log('this.tableData', this.tableData)
},
submit() {
const tableData = this.tableData.slice()
tableData.forEach((obj, i) => {
for (const key in obj) {
if (key === 'storageZone') {
delete tableData[i][key]
}
// if (tableData[i].id) {
// tableData[i].operator = 'MODITY'
// }
}
})
console.log('tableData', tableData)
const param = {
...this.form,
'operator': this.operator,
'materialTypeIdType': 'ExtDxProcessResourceType',
'extDxProductAreaIdType': 'ExtDxProductArea',
'extDxSipplierIdType': 'ExtDxSipplier',
'subTypeName': 'InStoragePurchase',
'reqStatus': 'Apply',
'inStorageRequestItems': tableData
}
// const paramTableData = []
// this.tableData.map(item => {
// for (const key in item) {
// if (typeof item[key] !== 'object' && item[key] !== null) {
// item[key]
// }
// }
// })
post('/InventoryRequest/batch/recursionAdd', param).then(res => {
this.$utils.showMessageSuccess('保存成功')
}).catch((err) => {
console.log(err)
})
},
cancel() {
}
}
}
</script>
<style lang='scss'></style>
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