Browse Source

计划外入库

master_hella_20240701
wangyufei 5 months ago
parent
commit
c73b3f7414
  1. 41
      src/components/Detail/src/Detail.vue
  2. 59
      src/views/wms/inventoryjobManage/unplannedreceipt/unplannedreceiptRequestMain/index.vue

41
src/components/Detail/src/Detail.vue

@ -696,7 +696,6 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
const updateList = ()=>{
getList()
}
defineExpose({ openDetail, formRef ,updateList}) // open
//
const getRemarkList = async () => {
@ -859,21 +858,39 @@ const submitForm = async (formType, data) => {
const rs = (await props.detailValidate) ? await props.detailValidate(data) : true
if (!rs) return
if (formType === 'create') {
await props.apiCreate(data)
message.success(t('common.createSuccess'))
if(props.apiCreate){
await props.apiCreate(data)
message.success(t('common.createSuccess'))
}else{
emit('handleSubmitForm',formType, data)
}
} else {
await props.apiUpdate(data)
message.success(t('common.updateSuccess'))
if(props.apiUpdate){
await props.apiUpdate(data)
message.success(t('common.updateSuccess'))
}else{
emit('handleSubmitForm',formType, data)
}
}
if (formType === 'create'&&props.apiCreate||formType === 'update'&&props.apiUpdate) {
emit('handleMainFefresh')
formRef.value.dialogVisible = false
//
await getList()
updateKey.value += 1
}
emit('handleMainFefresh')
formRef.value.dialogVisible = false
//
await getList()
updateKey.value += 1
} finally {
formRef.value.formLoading = false
}
}
//----
const submitUpdateList = async ()=>{
formRef.value.dialogVisible = false
//
await getList()
updateKey.value += 1
}
const searchTableSuccess1 = (formField, searchField, val, formRef) => {
@ -904,6 +921,8 @@ const emit = defineEmits([
'detailBasicFormOnChange',
'formFormDateChange',
'buttonBaseClick',
'handleMainFefresh',
'handleSubmitForm'
])
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
@ -997,6 +1016,8 @@ watch(
getList()
}
)
defineExpose({ openDetail, formRef ,updateList,submitUpdateList}) // open
</script>
<style lang="scss">
.el-drawer__body {

59
src/views/wms/inventoryjobManage/unplannedreceipt/unplannedreceiptRequestMain/index.vue

@ -71,20 +71,22 @@
</BasicForm>
<!-- 详情 -->
<!-- :apiCreate="UnplannedreceiptRequestDetailApi.createUnplannedreceiptRequestDetail" -->
<!-- :apiUpdate="UnplannedreceiptRequestDetailApi.updateUnplannedreceiptRequestDetail" -->
<Detail
ref="detailRef"
:isBasic="false"
:allSchemas="UnplannedreceiptRequestMain.allSchemas"
:detailAllSchemas="UnplannedreceiptRequestDetail.allSchemas"
:detailAllSchemasRules="UnplannedreceiptRequestDetailRules"
:apiCreate="UnplannedreceiptRequestDetailApi.createUnplannedreceiptRequestDetail"
:apiUpdate="UnplannedreceiptRequestDetailApi.updateUnplannedreceiptRequestDetail"
@handleSubmitForm="handleDetailSubmitForm"
:apiPage="UnplannedreceiptRequestDetailApi.getUnplannedreceiptRequestDetailPage"
:apiDelete="UnplannedreceiptRequestDetailApi.deleteUnplannedreceiptRequestDetail"
:Echo="Echo"
@searchTableSuccessDetail="searchTableSuccessDetail"
:detailValidate="detailValidate"
@detailBasicFormOnChange="qtyOnChange"
@detailOpenForm="detailOpenForm"
@onBlur="onBlur"
/>
@ -244,6 +246,20 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
}
})
}
const handleDetailSubmitForm = async (formType, data) => {
let mydata = {...data}
mydata['expireDate'] = data['expireDate'].valueOf()
if (formType === 'create') {
await UnplannedreceiptRequestDetailApi.createUnplannedreceiptRequestDetail(data)
message.success(t('common.createSuccess'))
} else {
await UnplannedreceiptRequestDetailApi.updateUnplannedreceiptRequestDetail(data)
message.success(t('common.updateSuccess'))
}
detailRef.value.submitUpdateList()
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
nextTick(() => {
@ -255,11 +271,12 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
if(formField == 'itemCode'){
setV['itemCode'] = val[0]['code']
setV['uom'] = val[0]['uom']
setV['expireDate'] = val[0]['validityDays']?addDay(val[0]['produceDate'],val[0]['validityDays']):''
setV.batch = formatTime(new Date(), 'yyyyMMdd')
//
setV['validityDays'] = val[0]['validityDays']
setV['expireDate'] = val[0]['validityDays']?addDay(val[0]['produceDate'],val[0]['validityDays']).valueOf():''
setV['batch'] = formatTime(new Date(), 'yyyyMMdd') //
setV['produceDate'] = dayjs().valueOf()
setV['arriveDate'] = dayjs().valueOf()
}
if(formField === 'costcentreCode'){
setV['costcentreCode'] = val[0]['costcentreCode']
@ -723,7 +740,39 @@ const inputNumberChange = (field, index, row, val) => {
row.amount = row.qty * row.singlePrice
}
}
let validityDays = 0
const detailOpenForm = (type, row)=>{
console.log('detailOpenForm',row)
if(type=='update'){
//
ItembasicApi.getItembasicPage({
code:row.itemCode
}).then((res)=>{
res.list.forEach((item,index)=>{
const findItem = tableData.value.find(item1=>item1['itemCode']==row['code'])
if(findItem){
validityDays = findItem['expireTime']
}
})
detailRef.value.formRef.formRef.formModel.expireDate = addDay(detailRef.value.formRef.formRef.formModel.produceDate,validityDays).valueOf()
})
}else{
validityDays = 0
}
}
const qtyOnChange = (field,val) =>{
console.log('qtyOnChange',field,val)
console.log(detailRef.value.formRef.formRef.formModel)
if(field=='produceDate'){
if(detailRef.value.formRef.formRef.formModel.validityDays){
detailRef.value.formRef.formRef.formModel.expireDate = addDay(detailRef.value.formRef.formRef.formModel.produceDate,detailRef.value.formRef.formRef.formModel.validityDays).valueOf()
}else{
detailRef.value.formRef.formRef.formModel.expireDate = addDay(detailRef.value.formRef.formRef.formModel.produceDate,validityDays).valueOf()
}
}
if(field == 'qty' || field == 'singlePrice'){
detailRef.value.formRef.formRef.formModel.amount = detailRef.value.formRef.formRef.formModel.qty * detailRef.value.formRef.formRef.formModel.singlePrice
}

Loading…
Cancel
Save