入库 新增编辑修改

入库 新增编辑修改
pull/1/head
siontion 9 months ago
parent 9fb9a95df7
commit 5891e89a87

@ -60,8 +60,8 @@
<el-row>
<el-col :span="24">
<el-form-item prop="level" label="入库仓库">
<el-select v-model="formData.whId" placeholder="下拉选择" clearable class="!w-400px">
<el-option v-for="dict in warehouseList" :key="dict.value" :label="dict.label" :value="dict.value" />
<el-select v-model="formData.whId" placeholder="下拉选择" clearable class="!w-400px" @change="handleWh">
<el-option v-for="dict in warehouseList" :key="dict.id" :label="dict.whName" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
@ -91,59 +91,68 @@
</el-col>
<el-table :data="formData.productBomItemDOList" class="hl-table" @cell-click="handleCellClick"
@cell-blur="handleCellBlur">
<el-table-column prop="" label="序号" />
<el-table-column prop="projectName" label="物料编码">
<el-table-column prop="id" label="序号" :width="80" />
<el-table-column prop="matCode" label="物料编码" required>
<template #default="scope">
<el-input v-model="scope.row.projectName" :disabled="!scope.row.editable" />
<el-select v-model="scope.row.matCode" placeholder="物料编码" :remote-method="remoteMatCodeSearch"
remote-show-suffix remote clearable reserve-keyword filterable :loading="matSelectLoading" @change="handleMatCode(scope)"
class="!w-180px">
<el-option v-for="item in matList" :key="item.id" :label="item.code" :value="item.id" />
</el-select>
</template>
</el-table-column>
<el-table-column prop="name" label="物料名称">
<template #default="scope">
<el-input v-model="scope.row.name" @click="openshoopname(scope.$index)"
<el-table-column prop="matName" label="物料名称" >
<!-- <template #default="scope">
<el-input v-model="scope.row.matName"
:disabled="!scope.row.editable" />
</template>
<el-select v-model="scope.row.matName" placeholder="物料名称" :remote-method="remoteMatSearch"
remote-show-suffix remote clearable reserve-keyword filterable :loading="matSelectLoading" @click="handleMatName"
class="!w-180px">
<el-option v-for="item in matList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</template> -->
</el-table-column>
<el-table-column prop="inventoryType" label="物料类型">
<el-table-column prop="matType" label="物料类型">
<template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_TYPE" :value="scope.row.inventoryType" />
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_TYPE" :value="scope.row.matType" />
</template>
</el-table-column>
<el-table-column prop="spec" label="规格/型号" />
<el-table-column prop="matSpec" label="规格/型号" />
<el-table-column prop="inventoryUnitId" label="系统单位">
<el-table-column prop="matUnit" label="系统单位">
<template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_UNIT" :value="scope.row.inventoryUnitId" />
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_UNIT" :value="scope.row.matUnit" />
</template>
</el-table-column>
<el-table-column prop="unit" width="120" label="入库库区">
<el-table-column prop="rgid" width="140" label="入库库区" required>
<template #default="scope">
<el-select v-model="scope.row.unit" placeholder="" style="width: 100%">
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.PRODUCT_INVENTORY_UNIT_ID)" :key="dict.value"
:label="dict.label" :value="dict.value.toString()" />
<el-select v-model="scope.row.rgid" placeholder="" style="width: 100%" @change="handleRg(scope)">
<el-option v-for="dict in rgList" :key="dict.id" :label="dict.rgName" :value="dict.id" />
</el-select>
</template>
</el-table-column>
<el-table-column prop="unit" width="120" label="入库库位">
<el-table-column prop="pnid" width="140" label="入库库位" required>
<template #default="scope">
<el-select v-model="scope.row.unit" placeholder="" style="width: 100%">
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.PRODUCT_INVENTORY_UNIT_ID)" :key="dict.value"
:label="dict.label" :value="dict.value.toString()" />
<el-select v-model="scope.row.pnid" placeholder="" style="width: 100%">
<el-option v-for="dict in pnList" :key="dict.id" :label="dict.pnName" :value="dict.id" />
</el-select>
</template>
</el-table-column>
<el-table-column prop="proportionNum" width="120" label="本次入库数量">
<el-table-column prop="storageOkQty" width="120" label="入库数量" required>
<template #default="scope">
<el-input v-model="scope.row.proportionNum" :disabled="!scope.row.editable" />
<el-input v-model="scope.row.storageOkQty" />
</template>
</el-table-column>
<el-table-column prop="proportionNum" width="120" label="批次号">
<el-table-column prop="lotNo" width="120" label="批次号">
<template #default="scope">
<el-input v-model="scope.row.proportionNum" :disabled="!scope.row.editable" />
<el-input v-model="scope.row.lotNo" />
</template>
</el-table-column>
<el-table-column prop="proportionNum" width="150" label="备注">
<el-table-column prop="description" width="150" label="备注">
<template #default="scope">
<el-input v-model="scope.row.proportionNum" :disabled="!scope.row.editable" />
<el-input v-model="scope.row.description" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="240">
@ -252,8 +261,8 @@
<div class="text-center hl-footer">
<el-button @click="goback" size="large"> </el-button>
<el-button @click="submitForm" type="success" :disabled="formLoading" size="large"> </el-button>
<el-button @click="submitForm" type="primary" :disabled="formLoading" size="large"> </el-button>
<el-button @click="submitForm" type="danger" :disabled="formLoading" size="large"> </el-button>
<el-button @click="submitForm" v-if="isShow" type="primary" :disabled="formLoading" size="large"> </el-button>
<el-button @click="submitForm" v-if="isShow" type="danger" :disabled="formLoading" size="large"> </el-button>
</div>
</el-card>
</template>
@ -264,9 +273,12 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import type { UploadProps, UploadUserFile } from 'element-plus'
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import * as MouldTypeApi from '@/api/heli/mouldtype'
import * as MaterialApi from '@/api/heli/material'
import * as WarehouseApi from '@/api/heli/warehouse'
import * as RgApi from '@/api/heli/rg'
import * as PnApi from '@/api/heli/pn'
import { ITEM_RENDER_EVT } from 'element-plus/es/components/virtual-list/src/defaults'
const { t } = useI18n() //
const message = useMessage() //
@ -358,22 +370,29 @@ const resetForm = () => {
formRef.value?.resetFields()
}
var matCount = 1
const onAddItem = () => {
const newData = {
//
projectName: '',
name: '',
productStatus: '',
spec: '',
inventoryUnitId: '',
inventoryType: '',
barCode: '',
productTypeId: '',
unit: [],
editable: true,
id : matCount,
matId: '',
matName: '',
matCode: '',
matType :'',
matSpec: '',
matUnit: '',
whid: '',
rgid: '',
pnid: '',
pnlist : ref([]),
storageOkQty: '',
lotNo: '',
description: '',
productBomItemValueDOList: []
}
matCount = matCount+ 1
formData.value.productBomItemDOList.push(newData)
}
//
@ -383,20 +402,26 @@ const handlefuke = (index, item) => {
//
const newData: any = {
...data,
projectName: item.projectName,
name: item.name,
productStatus: item.productStatus,
spec: item.spec,
inventoryUnitId: item.inventoryUnitId,
inventoryType: item.spec,
barCode: item.spec,
productTypeId: item.spec,
unit: [],
editable: true,
id : matCount,
matId: item.matId,
matName: item.matName,
matCode: item.matCode,
matType : item.matType,
matSpec: item.matSpec,
matUnit: item.matUnit,
whid: item.whid,
rgid: item.rgid,
pnid: item.pnid,
pnlist : item.pnlist,
storageOkQty: item.storageOkQty,
lotNo: item.lotNo,
description: item.description,
productBomItemValueDOList: []
}
matCount = matCount+ 1
//
formData.value.productBomItemDOList.splice(index + 1, 0, newData)
}
// / input
@ -488,62 +513,103 @@ const handleDelete = (index: number) => {
//
const warehouseList = ref([])
//
const rgList = ref([])
var rgList = ref([])
//
const pnList = ref([])
/** 初始化 **/
onMounted(async () => {
const router = useRoute();
dialogTitle.value = t('action.' + router.query.type)
isShow.value =router.query.type == "create"?false: true
//-------------------
const queryParamsWarehouse = reactive({
pageNo: 1,
pageSize: 99,
whStatus :1
})
const data = await WarehouseApi.getWarehousePage(queryParamsWarehouse)
data.list.forEach(element => {
element.label = element.whName
element.value = element.id
});
warehouseList.value = data.list
//-------------------
var pnList = ref([])
const handleWh = (async (wid) => {
//-------------------
const queryParamsRg = reactive({
pageNo: 1,
pageSize: 99,
rgStatus : 1
whId: wid
})
const dataRg = await RgApi.getRgPage(queryParamsRg)
dataRg.list.forEach(element => {
element.label = element.rgName
element.value = element.id
});
rgList.value = []
pnList.value = []
rgList.value = dataRg.list
formData.value.productBomItemDOList.forEach( item =>{
item.rgid = ''
item.pnid = ''
item.pnlist = []
})
//-------------------
})
const handleRg = (async (scope) => {
//-------------------
const queryParamsRPn = reactive({
pageNo: 1,
pageSize: 99,
rgId: scope.row.rgid,
pnStatus: 1
})
const dataPn = await PnApi.getPnPage(queryParamsRPn)
pnList.value = []
pnList.value = dataPn.list
scope.row.pnlist = dataPn.list
//-------------------
})
dataRg.list.forEach(element => {
element.label = element.rgName
element.value = element.id
});
pnList.value = dataPn.list
const matList = ref<MaterialApi.MaterialVO[]>([]) //
const matSelectLoading = ref(false);
const remoteMatSearch = async (query) => {
matSelectLoading.value= true
//
let matParams = {
pageNo: 1,
pageSize: 10,
name : query,
status: "1"
}
const dataMat = await MaterialApi.getMaterialPage(matParams)
matList.value = []
matList.value = dataMat.list
matSelectLoading.value= false
}
const remoteMatCodeSearch = async (query) => {
matSelectLoading.value= true
//
let matParams = {
pageNo: 1,
pageSize: 10,
code : query,
status: "1"
}
const dataMat = await MaterialApi.getMaterialPage(matParams)
matList.value = []
matList.value = dataMat.list
matSelectLoading.value= false
}
const handleMatCode = async (scope) =>{
if(scope.row.matCode){
const matVo = await MaterialApi.getMaterial(scope.row.matCode)
scope.row.matId = matVo.id
scope.row.matName = matVo.name
scope.row.matSpec = matVo.spec
scope.row.matType = matVo.materialType
scope.row.matUnit = matVo.unit
}
}
/** 初始化 **/
onMounted(async () => {
const router = useRoute();
dialogTitle.value = t('action.' + router.query.type)
isShow.value = router.query.type == "create" ? false : true
//-------------------
const data = await WarehouseApi.getWarehouseSimpList()
warehouseList.value = data
//-------------------
})
</script>
<style>

Loading…
Cancel
Save