Browse Source

Merge branch 'hella_online_20240803' of http://dev.ccwin-in.com:3000/sfms3.0/sfms3.0-ui into hella_online_20240803

hella_online_20240816
wangyufei 3 months ago
parent
commit
6966218777
  1. 38
      src/views/qms/inspectionQ3/index.vue
  2. 324
      src/views/wms/inventoryjobManage/scrap/scrapRequestMain/index.vue

38
src/views/qms/inspectionQ3/index.vue

@ -450,31 +450,25 @@ const submitForm = async (formType, submitData) => {
} }
data.responUser = userStore.getUser.nickname data.responUser = userStore.getUser.nickname
data.subList = tableData.value // data.subList = tableData.value //
if (tableData.value.find((item) => item.qty <= 0)) { try {
message.warning('数量必须大于0') if (formType === 'create') {
formRef.value.formLoading = false if(data.subList.length == 0){
message.warning("请添加子列表数据")
return;
}
let flag = false;
console.log(1111)
data.subList.forEach((item) => {
if(item.qty == 0){
message.warning("数量不能为0")
flag = true;
return;
}
})
if(flag){
return return
} }
// 线
// if (tableData.value.length > 0) {
// let productionLineCode = tableData.value[0].productionLineCode
// let workStationCode = tableData.value[0].workStationCode
// for(var i=0;i<tableData.value.length;i++) {
// if(productionLineCode !== tableData.value[i].productionLineCode){
// message.warning('线')
// formRef.value.formLoading = false
// return;
// }
// if(workStationCode !== tableData.value[i].workStationCode){
// message.warning('')
// formRef.value.formLoading = false
// return;
// }
// }
// }
formRef.value.formLoading = true formRef.value.formLoading = true
try {
if (formType === 'create') {
await InspectionQ3MainApi.createInspectionQ3Main(data) await InspectionQ3MainApi.createInspectionQ3Main(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {

324
src/views/wms/inventoryjobManage/scrap/scrapRequestMain/index.vue

@ -1,7 +1,14 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="[...ScrapRequestMain.allSchemas.searchSchema,...ScrapRequestDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" /> <Search
:schema="[
...ScrapRequestMain.allSchemas.searchSchema,
...ScrapRequestDetail.allSchemas.searchSchema
]"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
@ -17,7 +24,8 @@
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table v-clientTable <Table
v-clientTable
:columns="tableColumns" :columns="tableColumns"
:data="tableObject.tableList" :data="tableObject.tableList"
:loading="tableObject.loading" :loading="tableObject.loading"
@ -28,13 +36,16 @@
v-model:currentPage="tableObject.currentPage" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
> >
<template #number="{row}"> <template #number="{ row }">
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> <el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
<span>{{ row.number }}</span> <span>{{ row.number }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row,$index }"> <template #action="{ row, $index }">
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase
:Butttondata="butttondata(row, $index)"
@button-base-click="buttonTableClick($event, row)"
/>
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -61,6 +72,7 @@
@inputNumberChange="inputNumberChange" @inputNumberChange="inputNumberChange"
@submitForm="submitForm" @submitForm="submitForm"
@tableFormSelectOnBlur="tableFormSelectOnBlur" @tableFormSelectOnBlur="tableFormSelectOnBlur"
@clearSearchInput="clearSearchInput"
/> />
<!-- 详情 --> <!-- 详情 -->
@ -82,14 +94,26 @@
/> />
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/scrap-request-main/import" :importTemplateData="importTemplateData" <ImportForm
@success="importSuccess" :updateIsDisable="true" :coverIsDisable="true" :mode="2" /> ref="importFormRef"
url="/wms/scrap-request-main/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
:updateIsDisable="true"
:coverIsDisable="true"
:mode="2"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import { ScrapRequestMain,ScrapRequestMainRules,ScrapRequestDetail,ScrapRequestDetailRules } from './scrapRequestMain.data' import {
ScrapRequestMain,
ScrapRequestMainRules,
ScrapRequestDetail,
ScrapRequestDetailRules
} from './scrapRequestMain.data'
import * as ScrapRequestMainApi from '@/api/wms/scrapRequestMain' import * as ScrapRequestMainApi from '@/api/wms/scrapRequestMain'
import * as ScrapRequestDetailApi from '@/api/wms/scrapRequestDetail' import * as ScrapRequestDetailApi from '@/api/wms/scrapRequestDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
@ -105,8 +129,10 @@ const { t } = useI18n() // 国际化
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref([...ScrapRequestMain.allSchemas.tableColumns,...ScrapRequestDetail.allSchemas.tableMainColumns]) const tableColumns = ref([
...ScrapRequestMain.allSchemas.tableColumns,
...ScrapRequestDetail.allSchemas.tableMainColumns
])
// //
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
@ -114,7 +140,7 @@ const updataTableColumns = (val) => {
} }
// //
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(() => { nextTick(() => {
if (type == 'tableForm') { if (type == 'tableForm') {
// //
@ -129,21 +155,28 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
// tableData.value.push(newRow) // tableData.value.push(newRow)
// }) // })
// //
if(formField == 'packingNumber'){ if (formField == 'packingNumber') {
val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']&&item1['packingNumber']==item['packingNumber'])) val = val.filter(
if(val.length==0) return (item) =>
let param = {'itemCodes':val.map(item=>item.itemCode).join(',') as string} !tableData.value.find(
StdcostpriceApi.queryStdcostpriceByItemCode(param).then(res => { (item1) =>
val.forEach(item=>{ item1['itemCode'] == item['itemCode'] &&
const itemCode = res.find(item1=>item1['itemCode']==item['itemCode']) item1['packingNumber'] == item['packingNumber']
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) )
)
if (val.length == 0) return
let param = { itemCodes: val.map((item) => item.itemCode).join(',') as string }
StdcostpriceApi.queryStdcostpriceByItemCode(param).then((res) => {
val.forEach((item) => {
const itemCode = res.find((item1) => item1['itemCode'] == item['itemCode'])
const newRow = JSON.parse(JSON.stringify({ ...tableFormKeys, ...item }))
newRow[formField] = item[searchField] newRow[formField] = item[searchField]
newRow['packingNumber'] = item['packingNumber'] newRow['packingNumber'] = item['packingNumber']
newRow['batch'] = item['batch'] newRow['batch'] = item['batch']
newRow['fromLocationCode'] = item['locationCode'] newRow['fromLocationCode'] = item['locationCode']
newRow['itemCode'] = item['itemCode'] newRow['itemCode'] = item['itemCode']
newRow['uom'] = item['uom'] newRow['uom'] = item['uom']
newRow['singlePrice'] = itemCode?itemCode['price']:'' newRow['singlePrice'] = itemCode ? itemCode['price'] : ''
tableData.value.push(newRow) tableData.value.push(newRow)
}) })
// row['singlePrice'] = res.price // row['singlePrice'] = res.price
@ -151,16 +184,71 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
} else { } else {
row[formField] = val[0][searchField] row[formField] = val[0][searchField]
} }
} else { } else {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
formRef.setValues(setV) formRef.setValues(setV)
if (formField == 'q1Number') {
ScrapRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'q2Number' || item.field == 'q3Number') {
item.componentProps.enterSearch = false
item.componentProps.isSearchList = false
item.componentProps.disabled = true
}
})
}
if (formField == 'q2Number') {
ScrapRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'q1Number' || item.field == 'q3Number') {
item.componentProps.enterSearch = false
item.componentProps.isSearchList = false
item.componentProps.disabled = true
}
})
}
if (formField == 'q3Number') {
ScrapRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'q1Number' || item.field == 'q2Number') {
item.componentProps.enterSearch = false
item.componentProps.isSearchList = false
item.componentProps.disabled = true
}
})
}
} }
}) })
} }
const clearSearchInput = (field) => {
if (field == 'q1Number') {
ScrapRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'q2Number' || item.field == 'q3Number') {
item.componentProps.enterSearch = true
item.componentProps.isSearchList = true
item.componentProps.disabled = false
}
})
}
if (field == 'q2Number') {
ScrapRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'q1Number' || item.field == 'q3Number') {
item.componentProps.enterSearch = true
item.componentProps.isSearchList = true
item.componentProps.disabled = false
}
})
}
if (field == 'q3Number') {
ScrapRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'q1Number' || item.field == 'q1Number') {
item.componentProps.enterSearch = true
item.componentProps.isSearchList = true
item.componentProps.disabled = false
}
})
}
}
// //
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(() => { nextTick(() => {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
@ -170,9 +258,9 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
setV['itemCode'] = val[0]['itemCode'] setV['itemCode'] = val[0]['itemCode']
setV['uom'] = val[0]['uom'] setV['uom'] = val[0]['uom']
// //
let param = {'itemCodes':val[0]['itemCode'] as string} let param = { itemCodes: val[0]['itemCode'] as string }
StdcostpriceApi.queryStdcostpriceByItemCode(param).then(res => { StdcostpriceApi.queryStdcostpriceByItemCode(param).then((res) => {
if(res&&res.length>0){ if (res && res.length > 0) {
setV['singlePrice'] = res[0].price setV['singlePrice'] = res[0].price
} }
}) })
@ -193,12 +281,12 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:scrap-request-main:create'}), // defaultButtons.defaultAddBtn({ hasPermi: 'wms:scrap-request-main:create' }), //
defaultButtons.defaultImportBtn({hasPermi:'wms:scrap-request-main:import'}), // defaultButtons.defaultImportBtn({ hasPermi: 'wms:scrap-request-main:import' }), //
defaultButtons.defaultExportBtn({hasPermi:'wms:scrap-request-main:export'}), // defaultButtons.defaultExportBtn({ hasPermi: 'wms:scrap-request-main:export' }), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null) //
// { // {
// label: '', // label: '',
// name: 'zdy', // name: 'zdy',
@ -211,28 +299,34 @@ const HeadButttondata = [
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') {
//
openForm('create') openForm('create')
} else if (val == 'import') { // } else if (val == 'import') {
//
handleImport() handleImport()
} else if (val == 'export') { // } else if (val == 'export') {
//
handleExport() handleExport()
} else if (val == 'refresh') { // } else if (val == 'refresh') {
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { //
if (tableObject.params.filters && tableObject.params.filters.length > 0) {
searchFormClick({ searchFormClick({
filters: tableObject.params.filters filters: tableObject.params.filters
}) })
} else { } else {
getList() getList()
} }
} else if (val == 'filtrate') { // } else if (val == 'filtrate') {
} else { // //
} else {
//
console.log('其他按钮', item) console.log('其他按钮', item)
} }
} }
// //
const isShowMainButton = (row,val) => { const isShowMainButton = (row, val) => {
if (val.indexOf(row.status) > -1) { if (val.indexOf(row.status) > -1) {
return false return false
} else { } else {
@ -241,45 +335,76 @@ const isShowMainButton = (row,val) => {
} }
// - // -
const butttondata = (row,$index) => { const butttondata = (row, $index) => {
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 const findIndex = row['masterId']
if(findIndex>-1&&findIndex<$index){ ? tableObject.tableList.findIndex((item) => item['masterId'] == row['masterId'])
: -1
if (findIndex > -1 && findIndex < $index) {
return [] return []
} }
return [ return [
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['1','2','3','4','6']),hasPermi:'wms:scrap-request-main:close'}), // defaultButtons.mainListCloseBtn({
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['5']),hasPermi:'wms:scrap-request-main:reAdd'}), // hide: isShowMainButton(row, ['1', '2', '3', '4', '6']),
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:scrap-request-main:submit'}), // hasPermi: 'wms:scrap-request-main:close'
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:scrap-request-main:refused'}), // }), //
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:scrap-request-main:agree'}), // defaultButtons.mainListReAddBtn({
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:scrap-request-main:handle'}), // hide: isShowMainButton(row, ['5']),
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:scrap-request-main:update'}), // hasPermi: 'wms:scrap-request-main:reAdd'
}), //
defaultButtons.mainListSubmitBtn({
hide: isShowMainButton(row, ['1']),
hasPermi: 'wms:scrap-request-main:submit'
}), //
defaultButtons.mainListTurnDownBtn({
hide: isShowMainButton(row, ['2']),
hasPermi: 'wms:scrap-request-main:refused'
}), //
defaultButtons.mainListApproveBtn({
hide: isShowMainButton(row, ['2']),
hasPermi: 'wms:scrap-request-main:agree'
}), //
defaultButtons.mainListHandleBtn({
hide: isShowMainButton(row, ['3']),
hasPermi: 'wms:scrap-request-main:handle'
}), //
defaultButtons.mainListEditBtn({
hide: isShowMainButton(row, ['1']),
hasPermi: 'wms:scrap-request-main:update'
}) //
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:scrap-request-main:delete'}), // // defaultButtons.mainListDeleteBtn({hasPermi:'wms:scrap-request-main:delete'}), //
] ]
} }
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'mainClose') { // if (val == 'mainClose') {
//
console.log('列表-操作按钮事件-关闭') console.log('列表-操作按钮事件-关闭')
handleClose(row.masterId) handleClose(row.masterId)
} else if (val == 'mainReAdd') { // } else if (val == 'mainReAdd') {
//
console.log('列表-操作按钮事件-重新添加') console.log('列表-操作按钮事件-重新添加')
handleReAdd(row.masterId) handleReAdd(row.masterId)
} else if (val == 'mainSubmit') { // } else if (val == 'mainSubmit') {
//
console.log('列表-操作按钮事件-提交审批') console.log('列表-操作按钮事件-提交审批')
handleSubmit(row.masterId) handleSubmit(row.masterId)
} else if (val == 'mainTurnDown') { // } else if (val == 'mainTurnDown') {
//
console.log('列表-操作按钮事件-驳回') console.log('列表-操作按钮事件-驳回')
handleRefused(row.masterId) handleRefused(row.masterId)
} else if (val == 'mainApprove') { // } else if (val == 'mainApprove') {
//
console.log('列表-操作按钮事件-审批通过') console.log('列表-操作按钮事件-审批通过')
handleAgree(row.masterId) handleAgree(row.masterId)
} else if (val == 'mainHandle') { // } else if (val == 'mainHandle') {
//
handleHandle(row.masterId) handleHandle(row.masterId)
} else if (val == 'edit') { // } else if (val == 'edit') {
//
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') {
//
handleDelete(row.masterId) handleDelete(row.masterId)
} }
} }
@ -292,7 +417,7 @@ const handleClose = async (id: number) => {
await ScrapRequestMainApi.closeScrapRequestMain(id) await ScrapRequestMainApi.closeScrapRequestMain(id)
message.success(t('common.closeSuccess')) message.success(t('common.closeSuccess'))
tableObject.loading = false tableObject.loading = false
buttonBaseClick('refresh',null) buttonBaseClick('refresh', null)
} catch {} } catch {}
} }
@ -304,7 +429,7 @@ const handleReAdd = async (id: number) => {
await ScrapRequestMainApi.reAddScrapRequestMain(id) await ScrapRequestMainApi.reAddScrapRequestMain(id)
message.success(t('common.reAddSuccess')) message.success(t('common.reAddSuccess'))
tableObject.loading = false tableObject.loading = false
buttonBaseClick('refresh',null) buttonBaseClick('refresh', null)
} catch {} } catch {}
} }
@ -316,7 +441,7 @@ const handleSubmit = async (id: number) => {
await ScrapRequestMainApi.submitScrapRequestMain(id) await ScrapRequestMainApi.submitScrapRequestMain(id)
message.success(t('common.submitSuccess')) message.success(t('common.submitSuccess'))
tableObject.loading = false tableObject.loading = false
buttonBaseClick('refresh',null) buttonBaseClick('refresh', null)
} catch {} } catch {}
} }
@ -328,7 +453,7 @@ const handleRefused = async (id: number) => {
await ScrapRequestMainApi.refusedScrapRequestMain(id) await ScrapRequestMainApi.refusedScrapRequestMain(id)
message.success(t('common.refusedSuccess')) message.success(t('common.refusedSuccess'))
tableObject.loading = false tableObject.loading = false
buttonBaseClick('refresh',null) buttonBaseClick('refresh', null)
} catch {} } catch {}
} }
@ -340,7 +465,7 @@ const handleAgree = async (id: number) => {
await ScrapRequestMainApi.agreeScrapRequestMain(id) await ScrapRequestMainApi.agreeScrapRequestMain(id)
message.success(t('common.agreeSuccess')) message.success(t('common.agreeSuccess'))
tableObject.loading = false tableObject.loading = false
buttonBaseClick('refresh',null) buttonBaseClick('refresh', null)
} catch {} } catch {}
} }
@ -352,13 +477,20 @@ const handleHandle = async (id: number) => {
await ScrapRequestMainApi.handleScrapRequestMain(id) await ScrapRequestMainApi.handleScrapRequestMain(id)
message.success(t('common.handleSuccess')) message.success(t('common.handleSuccess'))
tableObject.loading = false tableObject.loading = false
buttonBaseClick('refresh',null) buttonBaseClick('refresh', null)
} catch {} } catch {}
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const formRef = ref()
const openForm =async (type: string, row?: number) => { const openForm = async (type: string, row?: number) => {
ScrapRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'q1Number' || item.field == 'q2Number' || item.field == 'q3Number') {
item.componentProps.enterSearch = true
item.componentProps.isSearchList = true
item.componentProps.disabled = false
}
})
tableData.value = [] // tableData.value = [] //
formRef.value.open(type, row) formRef.value.open(type, row)
} }
@ -368,9 +500,11 @@ const { wsCache } = useCache()
/** 详情操作 */ /** 详情操作 */
const detailRef = ref() const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => { const openDetail = (row: any, titleName: any, titleValue: any) => {
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name const departmentCode = wsCache
.get(CACHE_KEY.DEPT)
.find((account) => account.id == row.departmentCode)?.name
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode)) if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode))
detailRef.value.openDetail(row, titleName, titleValue,'requestScrapMain') detailRef.value.openDetail(row, titleName, titleValue, 'requestScrapMain')
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
@ -384,7 +518,7 @@ const handleDelete = async (id: number) => {
tableObject.loading = false tableObject.loading = false
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
buttonBaseClick('refresh',null) buttonBaseClick('refresh', null)
} catch {} } catch {}
} }
@ -407,9 +541,9 @@ const handleExport = async () => {
/** /**
* tableForm方法 * tableForm方法
*/ */
const tableFormKeys = {} const tableFormKeys = {}
ScrapRequestDetail.allSchemas.tableFormColumns.forEach(item => { ScrapRequestDetail.allSchemas.tableFormColumns.forEach((item) => {
tableFormKeys[item.field] = item.default ? item.default : '' tableFormKeys[item.field] = item.default ? item.default : ''
}) })
const tableData = ref([]) const tableData = ref([])
@ -421,36 +555,36 @@ const handleAddTable = () => {
// //
const handleDeleteTable = (item, index) => { const handleDeleteTable = (item, index) => {
let itemIndex = tableData.value.indexOf(item) let itemIndex = tableData.value.indexOf(item)
if(itemIndex>-1){ if (itemIndex > -1) {
tableData.value.splice(itemIndex, 1) tableData.value.splice(itemIndex, 1)
} }
} }
const tableSelectionDelete = (selection) => { const tableSelectionDelete = (selection) => {
tableData.value = tableData.value.filter(item => !selection.includes(item)) tableData.value = tableData.value.filter((item) => !selection.includes(item))
} }
// //
const submitForm = async (formType, submitData) => { const submitForm = async (formType, submitData) => {
let data = {...submitData} let data = { ...submitData }
if(data.masterId){ if (data.masterId) {
data.id = data.masterId data.id = data.masterId
} }
data.subList = tableData.value // data.subList = tableData.value //
try { try {
if (formType === 'create') { if (formType === 'create') {
console.log("【报废出库子列表】",data.subList) console.log('【报废出库子列表】', data.subList)
if(data.subList.length == 0){ if (data.subList.length == 0) {
message.warning("请添加子列表数据") message.warning('请添加子列表数据')
return; return
} }
let flag = false; let flag = false
data.subList.forEach((item) => { data.subList.forEach((item) => {
if(item.qty == 0){ if (item.qty == 0) {
message.warning("数量不能为0") message.warning('数量不能为0')
flag = true; flag = true
return; return
} }
}) })
if(flag){ if (flag) {
return return
} }
formRef.value.formLoading = true formRef.value.formLoading = true
@ -465,8 +599,8 @@ const submitForm = async (formType, submitData) => {
// //
if (formType === 'create') { if (formType === 'create') {
getList() getList()
}else{ } else {
buttonBaseClick('refresh',null) buttonBaseClick('refresh', null)
} }
} finally { } finally {
formRef.value.formLoading = false formRef.value.formLoading = false
@ -475,14 +609,14 @@ const submitForm = async (formType, submitData) => {
// / // /
const detailValidate = (data) => { const detailValidate = (data) => {
let tag = false; let tag = false
if(data.qty <= 0){ if (data.qty <= 0) {
message.warning('数量必须大于0') message.warning('数量必须大于0')
tag = false; tag = false
return tag; return tag
}else { } else {
tag = true; tag = true
return tag; return tag
} }
} }
@ -525,14 +659,16 @@ const tableFormSelectOnBlur = (field, val, row, index) => {
} }
const inputNumberChange = (field, index, row, val) => { const inputNumberChange = (field, index, row, val) => {
if(field == 'qty' || field == 'singlePrice'){ if (field == 'qty' || field == 'singlePrice') {
row.amount = row.qty * row.singlePrice row.amount = row.qty * row.singlePrice
} }
} }
const qtyOnChange = (field,val) =>{ const qtyOnChange = (field, val) => {
if(field == 'qty' || field == 'singlePrice'){ if (field == 'qty' || field == 'singlePrice') {
detailRef.value.formRef.formRef.formModel.amount = detailRef.value.formRef.formRef.formModel.qty * detailRef.value.formRef.formRef.formModel.singlePrice detailRef.value.formRef.formRef.formModel.amount =
detailRef.value.formRef.formRef.formModel.qty *
detailRef.value.formRef.formRef.formModel.singlePrice
} }
} }

Loading…
Cancel
Save