|
|
@ -28,6 +28,8 @@ |
|
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
|
<BasicForm ref="formRef" @success="getList" |
|
|
|
:isOpenSearchTable="true" |
|
|
|
:indexTableColumn="1" |
|
|
|
:rules="PurchasePlanMainRules" |
|
|
|
:formAllSchemas="PurchasePlanMain.allSchemas" |
|
|
|
:tableAllSchemas="PurchasePlanDetail.allSchemas" |
|
|
@ -72,6 +74,7 @@ |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import * as PurchaseDetailApi from '@/api/wms/purchaseDetail' |
|
|
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
|
|
|
import { PurchaseDetail } from '../purchaseMain/purchaseMain.data' |
|
|
|
|
|
|
|
// 要货计划 |
|
|
|
defineOptions({ name: 'PurchasePlanMain' }) |
|
|
@ -91,28 +94,39 @@ |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
|
|
|
console.log('searchTableSuccess', formField, searchField, val, formRef, type, row) |
|
|
|
nextTick(async () => { |
|
|
|
if (type == 'tableForm') { |
|
|
|
// 明细查询页赋值 |
|
|
|
row[formField] = val[0][searchField] |
|
|
|
row['itemCode'] = val[0]['code'] |
|
|
|
row['poNumber'] = val[0]['number'] |
|
|
|
row['poLine'] = val[0]['lineNumber'] |
|
|
|
val.forEach(item=>{ |
|
|
|
if(tableData.value.find(item1=>item1['id'] == item['id'])) return |
|
|
|
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...row})) |
|
|
|
|
|
|
|
newRow[formField] = item[searchField] |
|
|
|
newRow['itemCode'] = item['code'] |
|
|
|
newRow['poNumber'] = item['number'] |
|
|
|
newRow['poLine'] = item['lineNumber'] |
|
|
|
if (formField == 'poLine') { |
|
|
|
row['itemCode'] = val[0]['itemCode'] |
|
|
|
row['uom'] = val[0]['uom'] |
|
|
|
row['orderQty'] = val[0]['orderQty'] |
|
|
|
row['planQty'] = val[0]['orderQty']-val[0]['plannedQty'] |
|
|
|
row['available'] = val[0]['available'] |
|
|
|
} |
|
|
|
//添加费用明细--点击确定 |
|
|
|
newRow['itemCode'] = item['itemCode'] |
|
|
|
newRow['uom'] = item['uom'] |
|
|
|
newRow['orderQty'] = item['orderQty'] |
|
|
|
newRow['planQty'] = item['orderQty']-item['plannedQty'] |
|
|
|
newRow['available'] = item['available'] |
|
|
|
} |
|
|
|
tableData.value.push(newRow) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
setV['itemCode'] = val[0]['code'] |
|
|
|
setV['poNumber'] = val[0]['number'] |
|
|
|
setV['poLine'] = val[0]['lineNumber'] |
|
|
|
|
|
|
|
if(formField == 'supplierCode'){ |
|
|
|
setV['supplierCode'] = val[0]['code'] |
|
|
|
setV['contacts'] = val[0]['contacts'] |
|
|
|
setV['phone'] = val[0]['phone'] |
|
|
|
await PurchasePlanMainApi.queryPurchasePlan(val[0]['code']).then(res => { |
|
|
|
let beginTime = res.beginTime |
|
|
|
var ms = beginTime.substring(0, 2) |
|
|
@ -123,6 +137,7 @@ |
|
|
|
var me = endTime.substring(3) |
|
|
|
setV['endTime'] = new Date(2024, 1, 1, Number(ms), Number(me)) |
|
|
|
}) |
|
|
|
tableData.value = [] |
|
|
|
} |
|
|
|
if (formField == 'poLine') { |
|
|
|
setV['itemCode'] = val[0]['itemCode'] |
|
|
@ -132,9 +147,46 @@ |
|
|
|
setV['available'] = val[0]['available'] |
|
|
|
} |
|
|
|
formRef.setValues(setV) |
|
|
|
console.log('formModel',formRef.formModel) |
|
|
|
if(formField == 'poNumber') { |
|
|
|
//新增--采购订单-- |
|
|
|
// 请求明细数据 |
|
|
|
getSearchTableData(val[0]['number'],formField,searchField) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const getSearchTableData = async (number,formField,searchField)=>{ |
|
|
|
const {tableObject ,tableMethods} = useTable({ |
|
|
|
defaultParams:{number}, |
|
|
|
getListApi: PurchaseDetailApi.getPurchaseDetailPagePoNumber // 分页接口 |
|
|
|
}) |
|
|
|
// 获得表格的各种操作 |
|
|
|
const { getList:getList1 } = tableMethods |
|
|
|
await getList1() |
|
|
|
const tableColumns = PurchaseDetail.allSchemas.tableFormColumns |
|
|
|
tableColumns.forEach((item) => { |
|
|
|
item.width = item.table?.width || 150 |
|
|
|
}) |
|
|
|
tableData.value = [] |
|
|
|
tableObject.tableList.forEach(row=>{ |
|
|
|
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...row})) |
|
|
|
// 明细查询页赋值 |
|
|
|
newRow[formField] = row[searchField] |
|
|
|
newRow['itemCode'] = row['itemCode'] |
|
|
|
newRow['poNumber'] = row['number'] |
|
|
|
newRow['poLine'] = row['lineNumber'] |
|
|
|
if (formField == 'poLine') { |
|
|
|
newRow['itemCode'] = row['itemCode'] |
|
|
|
newRow['uom'] = row['uom'] |
|
|
|
newRow['orderQty'] = row['orderQty'] |
|
|
|
newRow['planQty'] = row['orderQty']-row['plannedQty'] |
|
|
|
newRow['available'] = row['available'] |
|
|
|
} |
|
|
|
tableData.value.push(newRow) |
|
|
|
}) |
|
|
|
} |
|
|
|
// 查询页面返回——详情 |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(async () => { |
|
|
|