diff --git a/mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageForm.vue b/mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageForm.vue index 1d9f6d03..83cf290f 100644 --- a/mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageForm.vue +++ b/mes-ui/mes-ui-admin-vue3/src/views/heli/storage/StorageForm.vue @@ -60,8 +60,8 @@ - - + + @@ -91,59 +91,68 @@ - - + + - - @@ -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() // 消息弹窗 @@ -286,8 +298,8 @@ const formData = ref({ description: undefined, status: undefined, whId: undefined, - creator :undefined, - createTime :undefined, + creator: undefined, + createTime: undefined, keeper: undefined, keeperTime: undefined, outbound: undefined, @@ -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({ + const queryParamsRPn = reactive({ pageNo: 1, pageSize: 99, - pnStatus : 1 + 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([]) // 用户列表 +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 //------------------- + })