Commit 8fec7b8f by wuqian

修复入库单bug

parent 090b4085
...@@ -8,6 +8,7 @@ import { ...@@ -8,6 +8,7 @@ import {
InterskuList, InterskuList,
InterWarehouseList, InterWarehouseList,
ILocation, ILocation,
AnyObject,
} from '@/types/api/warehouse' } from '@/types/api/warehouse'
export interface LogListData { export interface LogListData {
createTime: string createTime: string
...@@ -319,7 +320,9 @@ export function exportOrder(ids: number[], status: string | number) { ...@@ -319,7 +320,9 @@ export function exportOrder(ids: number[], status: string | number) {
{ ids: ids, status }, { ids: ids, status },
) )
} }
export function updateInRecordApi(form: InterWarehouseDetail) { export function updateInRecordApi(
form: InterWarehouseDetail | AnyObject | null,
) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
'factory/warehouseInRecord/update', 'factory/warehouseInRecord/update',
{ {
...@@ -337,7 +340,7 @@ export function getWarehouseInRecordDetailApi(id: number | undefined) { ...@@ -337,7 +340,7 @@ export function getWarehouseInRecordDetailApi(id: number | undefined) {
}, },
) )
} }
export function getBySkuApi(warehouseId: number | string, sku: string | null) { export function getBySkuApi(warehouseId: number | null | undefined, sku: string | null) {
return axios.get<never, BaseRespData<InterskuList[]>>( return axios.get<never, BaseRespData<InterskuList[]>>(
'customProductItem/getBySku', 'customProductItem/getBySku',
{ {
...@@ -349,7 +352,7 @@ export function getBySkuApi(warehouseId: number | string, sku: string | null) { ...@@ -349,7 +352,7 @@ export function getBySkuApi(warehouseId: number | string, sku: string | null) {
) )
} }
export function getByWareHouseIdAndCodeApi( export function getByWareHouseIdAndCodeApi(
wareHouseId: number | string | undefined, wareHouseId: number | null | undefined,
code: string | null, code: string | null,
) { ) {
return axios.get<never, BaseRespData<ILocation[]>>( return axios.get<never, BaseRespData<ILocation[]>>(
......
export type AnyObject = {
[propName: string]: string | number | boolean | undefined | unknown
}
export interface warehouseSearchForm { export interface warehouseSearchForm {
billStatus?: string billStatus?: string
batchNumber?: string batchNumber?: string
...@@ -5,7 +8,7 @@ export interface warehouseSearchForm { ...@@ -5,7 +8,7 @@ export interface warehouseSearchForm {
createTimeStart?: string createTimeStart?: string
orderNumber?: string orderNumber?: string
sku?: string sku?: string
warehouseId?: number warehouseId?: number | null
id?: number id?: number
} }
export interface InterProductList { export interface InterProductList {
...@@ -29,8 +32,8 @@ export interface InterWarehouseBase { ...@@ -29,8 +32,8 @@ export interface InterWarehouseBase {
id?: number id?: number
factoryId?: number factoryId?: number
factoryCode?: string factoryCode?: string
warehouseId?: number | string warehouseId?: number | null
warehouseName?: string warehouseName?: string | null
inNo?: string inNo?: string
shipmentNumber?: string shipmentNumber?: string
skuAmount?: number skuAmount?: number
......
export type AnyObject = {
// 允许通用对象类型 [propName: string]: string | number | boolean | undefined | unknown
export type AnyObject = { [key: string]: unknown } }
type IdType = string | number type IdType = string | number
function itemIsArray(obj: AnyObject): boolean { function itemIsArray(obj: AnyObject): boolean {
...@@ -16,40 +16,50 @@ function isChange(arr: AnyObject[], arr1: AnyObject[]): boolean { ...@@ -16,40 +16,50 @@ function isChange(arr: AnyObject[], arr1: AnyObject[]): boolean {
if (!arr1) return true if (!arr1) return true
if (arr.length !== arr1.length) return true if (arr.length !== arr1.length) return true
for (const iterator of arr) { for (const iterator of arr) {
const item = arr1.find((item: AnyObject) => item.id === iterator.id) const item = arr1.find((item) => item.id === iterator.id)
if (!item) return true if (!item) return true
} }
return false return false
} }
/**
* 更新参数处理 只提交更新的
* @param {UpdateParams} newParams 新的数据
* @param {UpdateParams} oldParams 旧的数据
* @param {string} id 数组唯一值
* @param {Record<string, string>} other 其他属性
* @param {boolean} bool 是否为布尔值
*/
export function checkUpdateParams( export function checkUpdateParams(
newParams: AnyObject, newParams: AnyObject,
oldParams: AnyObject, oldParams: AnyObject,
id: string = 'id', id: string = 'id',
other: Record<string, string> = {}, other: Record<string, string> = {},
bool: boolean = false bool: boolean = false,
): AnyObject | null { ): AnyObject | null {
oldParams = JSON.parse(JSON.stringify(oldParams)) oldParams = JSON.parse(JSON.stringify(oldParams))
if (!oldParams) return newParams if (!oldParams) return newParams
if ((newParams as { id?: unknown })?.id !== (oldParams as { id?: unknown })?.id) return newParams if (newParams[id] !== oldParams?.[id]) return newParams
const params: AnyObject = { const params: AnyObject = {
id: (newParams as { id?: unknown }).id [id]: newParams[id],
} }
for (const key in newParams) { for (const key in newParams) {
if (typeof newParams[key] === 'object') { if (typeof newParams[key] === 'object') {
if (Array.isArray(newParams[key])) { if (Array.isArray(newParams[key])) {
const arr: AnyObject[] = newParams[key] as AnyObject[] const arr = newParams[key] as AnyObject[]
const arr1: AnyObject[] = (oldParams[key] as AnyObject[]) || [] const arr1 = (oldParams[key] as AnyObject[]) || []
const addList: AnyObject[] = [] const addList: AnyObject[] = []
const updateList: AnyObject[] = [] const updateList: AnyObject[] = []
let removeList: IdType[] = [] let removeList: IdType[] = []
const list: AnyObject[] = [] const list: AnyObject[] = []
const keyname: string = other[key] || id const keyname = other[key] || id
for (const iterator of arr) { for (const iterator of arr) {
const obj: AnyObject = {} const obj: AnyObject = {}
const index = arr1.findIndex((item: AnyObject) => item[keyname] === iterator[keyname]) const index = arr1.findIndex(
(item: AnyObject) => item[keyname] === iterator[keyname],
)
const isArray = itemIsArray(iterator) const isArray = itemIsArray(iterator)
if (index !== -1) { if (index !== -1) {
const item = arr1[index] const item = arr1[index]
...@@ -57,7 +67,12 @@ export function checkUpdateParams( ...@@ -57,7 +67,12 @@ export function checkUpdateParams(
for (const key1 in iterator) { for (const key1 in iterator) {
if (key1 === keyname) continue if (key1 === keyname) continue
if (Array.isArray(iterator[key1])) { if (Array.isArray(iterator[key1])) {
if (isChange(iterator[key1] as AnyObject[], item[key1] as AnyObject[])) { if (
isChange(
iterator[key1] as AnyObject[],
item[key1] as AnyObject[],
)
) {
obj[key1] = iterator[key1] obj[key1] = iterator[key1]
} }
} else if (iterator[key1] !== item[key1]) { } else if (iterator[key1] !== item[key1]) {
...@@ -69,13 +84,13 @@ export function checkUpdateParams( ...@@ -69,13 +84,13 @@ export function checkUpdateParams(
list.push({ list.push({
[keyname]: iterator[keyname], [keyname]: iterator[keyname],
...obj, ...obj,
id: item.id id: item.id,
}) })
} else { } else {
updateList.push({ updateList.push({
[keyname]: iterator[keyname], [keyname]: iterator[keyname],
...obj, ...obj,
id: item.id id: item.id,
}) })
} }
} }
...@@ -88,20 +103,20 @@ export function checkUpdateParams( ...@@ -88,20 +103,20 @@ export function checkUpdateParams(
} }
} }
if (arr1.length > 0) { if (arr1.length > 0) {
removeList = arr1.map((item: AnyObject) => item['id'] as IdType) removeList = arr1.map((item) => item['id'] as IdType)
} }
const key_name = key.replace('List', 'Change') const key_name = key.replace('List', 'Change')
params[key_name] = {} params[key_name] = {}
if (addList.length > 0) { if (addList.length > 0) {
(params[key_name] as AnyObject).addList = addList ;(params[key_name] as AnyObject).addList = addList
} }
if (updateList.length > 0) { if (updateList.length > 0) {
(params[key_name] as AnyObject).updateList = updateList ;(params[key_name] as AnyObject).updateList = updateList
} }
if (removeList.length > 0) { if (removeList.length > 0) {
(params[key_name] as AnyObject).removeList = removeList ;(params[key_name] as AnyObject).removeList = removeList
} }
if (list.length > 0) { if (list.length > 0) {
params[key_name] = list params[key_name] = list
...@@ -112,13 +127,11 @@ export function checkUpdateParams( ...@@ -112,13 +127,11 @@ export function checkUpdateParams(
} }
} else { } else {
// 基础信息 // 基础信息
// if (newParams[key] !== oldParams[key]) {
params[key] = newParams[key] params[key] = newParams[key]
// }
} }
} }
if (Object.keys(params).length === 1) { if (Object.keys(params).length === 1) {
return null return null
} }
return params return params
} }
\ No newline at end of file
...@@ -125,10 +125,10 @@ ...@@ -125,10 +125,10 @@
> >
删除 删除
</el-button> </el-button>
<el-button type="success" @click="handleExport"> 导出 </el-button> <!-- <el-button type="success" @click="handleExport"> 导出 </el-button>
<el-button type="primary" @click="printProductTag"> <el-button type="primary" @click="printProductTag">
打印商品SKU标签 打印商品SKU标签
</el-button> </el-button> -->
<el-button <el-button
v-if="nodeCode === 'PENDING_AUDIT'" v-if="nodeCode === 'PENDING_AUDIT'"
type="warning" type="warning"
...@@ -481,6 +481,7 @@ ...@@ -481,6 +481,7 @@
clearable clearable
placeholder="请选择仓库" placeholder="请选择仓库"
style="width: 160px" style="width: 160px"
@change="handleWarehouseChange(editForm.warehouseId)"
> >
<ElOption <ElOption
v-for="item in warehouseList" v-for="item in warehouseList"
...@@ -565,8 +566,7 @@ ...@@ -565,8 +566,7 @@
<!-- +后有就正常展示,没有则通过搜索接口自己添加 --> <!-- +后有就正常展示,没有则通过搜索接口自己添加 -->
<!-- remote <!-- remote
:remote-method="(query) => handleLocationSearch(query, row)" :remote-method="(query) => handleLocationSearch(query, row)"
:loading="locationLoading" :loading="locationLoading"-->
@change="(val) => handleLocationChange(val, row)" -->
<span v-if="row.loacationCode">{{ row.loacationCode }}</span> <span v-if="row.loacationCode">{{ row.loacationCode }}</span>
<ElSelect <ElSelect
v-else v-else
...@@ -797,7 +797,7 @@ import { CirclePlusFilled } from '@element-plus/icons-vue' ...@@ -797,7 +797,7 @@ import { CirclePlusFilled } from '@element-plus/icons-vue'
import splitDiv from '@/components/splitDiv/splitDiv.vue' import splitDiv from '@/components/splitDiv/splitDiv.vue'
import { ElTable } from 'element-plus' import { ElTable } from 'element-plus'
import usePageList from '@/utils/hooks/usePageList' import usePageList from '@/utils/hooks/usePageList'
// import { checkUpdateParams } from '@/utils/hooks/commonUtil' import { checkUpdateParams, AnyObject } from '@/utils/hooks/commonUtil'
import { useValue } from '@/utils/hooks/useValue' import { useValue } from '@/utils/hooks/useValue'
import { import {
getInRecordStatusTree, getInRecordStatusTree,
...@@ -990,6 +990,7 @@ const { ...@@ -990,6 +990,7 @@ const {
pageSize, pageSize,
).then((res) => res.data) as never, ).then((res) => res.data) as never,
}) })
const setCostPrice = (item: InterProductList) => { const setCostPrice = (item: InterProductList) => {
if (!item.costPrice) { if (!item.costPrice) {
ElMessage.warning('商品成本价为空,请完善商品成本价') ElMessage.warning('商品成本价为空,请完善商品成本价')
...@@ -1015,15 +1016,15 @@ const getTreeNum = async () => { ...@@ -1015,15 +1016,15 @@ const getTreeNum = async () => {
} }
} }
const showPrintDialog = ref(false) const showPrintDialog = ref(false)
const printProductTag = async () => { // const printProductTag = async () => {
if (!selections.value.length) { // if (!selections.value.length) {
return ElMessage.warning('请选择要删除的数据') // return ElMessage.warning('请选择要操作的数据')
} // }
showPrintDialog.value = true // showPrintDialog.value = true
// selections.value.forEach((el:InterWarehousePage) => { // selections.value.forEach((el:InterWarehousePage) => {
// el.number = '' // el.number = ''
// }) // })
} // }
async function handlePrintProductTag() { async function handlePrintProductTag() {
// const flag = selections.value.every((el:InterWarehousePage) => el.number && el.number != '0') // const flag = selections.value.every((el:InterWarehousePage) => el.number && el.number != '0')
// if (!flag) { // if (!flag) {
...@@ -1088,11 +1089,9 @@ const exportForm = ref({ ...@@ -1088,11 +1089,9 @@ const exportForm = ref({
delivery: false, delivery: false,
resource: '', resource: '',
}) })
const handleExport = () => { // const handleExport = () => {
exportVisible.value = true // exportVisible.value = true
// exportForm.value.delivery = false // }
// exportForm.value.resource = ''
}
const submitExportForm = () => { const submitExportForm = () => {
// if (exportForm.value.resource === '') { // if (exportForm.value.resource === '') {
// return ElMessage.error('请选择导出类型') // return ElMessage.error('请选择导出类型')
...@@ -1270,7 +1269,8 @@ const tabsClick = async () => { ...@@ -1270,7 +1269,8 @@ const tabsClick = async () => {
} }
const [editForm, resetEditForm] = useValue<InterWarehouseDetail>({ const [editForm, resetEditForm] = useValue<InterWarehouseDetail>({
inNo: '', inNo: '',
warehouseId: '', warehouseId: null,
warehouseName: '',
remark: '', remark: '',
factoryCode: '', factoryCode: '',
factoryId: 0, factoryId: 0,
...@@ -1310,7 +1310,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => { ...@@ -1310,7 +1310,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => {
const getProduct = async (id: number | undefined) => { const getProduct = async (id: number | undefined) => {
try { try {
const res = await getWarehouseInRecordDetailApi(id) const res = await getWarehouseInRecordDetailApi(id)
editForm2.value = res.data editForm.value = JSON.parse(JSON.stringify(res.data))
otherPurchaseData.value = res.data?.productList || [] otherPurchaseData.value = res.data?.productList || []
} catch (e) { } catch (e) {
console.error(e) console.error(e)
...@@ -1349,7 +1349,7 @@ const auditOrder = (key: string) => { ...@@ -1349,7 +1349,7 @@ const auditOrder = (key: string) => {
} }
const confimText = const confimText =
key === 'audit' key === 'audit'
? '确定进行审核?点“确定”将会直接更改库存数量,请在审核前确认数量是否正确。' ? '确定进行审核?点"确定"将会直接更改库存数量,请在审核前确认数量是否正确。'
: `确定对选中的信息进行${text}?` : `确定对选中的信息进行${text}?`
ElMessageBox.confirm(confimText, '重要提示', { ElMessageBox.confirm(confimText, '重要提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
...@@ -1413,7 +1413,7 @@ watch( ...@@ -1413,7 +1413,7 @@ watch(
watch( watch(
() => editForm.value.warehouseId, () => editForm.value.warehouseId,
(newVal: number | string | undefined) => { (newVal: number | null | undefined) => {
if (newVal) { if (newVal) {
fetchLocationList('') fetchLocationList('')
} }
...@@ -1512,13 +1512,17 @@ const addSection = async () => { ...@@ -1512,13 +1512,17 @@ const addSection = async () => {
} }
const upSection = async () => { const upSection = async () => {
const params = { ...editForm.value } const params = { ...editForm.value }
params.productList = otherPurchaseData.value // params.productList = otherPurchaseData.value
// const result = checkUpdateParams(params, editForm2.value, '', { const result = checkUpdateParams(
// productList: 'value', { ...params, productList: otherPurchaseData.value },
// }) editForm.value as unknown as AnyObject,
// console.log(result, params, editForm2.value) 'id',
{
productList: 'warehouseSku',
},
)
try { try {
await updateInRecordApi(params) await updateInRecordApi(result)
newDialogVisible.value = false newDialogVisible.value = false
ElMessage.success('修改成功') ElMessage.success('修改成功')
search() search()
...@@ -1592,6 +1596,7 @@ const fetchLocationList = async (query: string) => { ...@@ -1592,6 +1596,7 @@ const fetchLocationList = async (query: string) => {
// locationList.value = [] // locationList.value = []
// return // return
// } // }
if (!editForm.value.warehouseId) return
locationLoading.value = true locationLoading.value = true
try { try {
const res = await getByWareHouseIdAndCodeApi( const res = await getByWareHouseIdAndCodeApi(
...@@ -1619,6 +1624,12 @@ const handleLocationChange = (val: number, row: InterProductList) => { ...@@ -1619,6 +1624,12 @@ const handleLocationChange = (val: number, row: InterProductList) => {
) )
row.locationCode = found ? found.locationCode : '' row.locationCode = found ? found.locationCode : ''
} }
const handleWarehouseChange = (val: number | null | undefined) => {
const found = warehouseList.value.find(
(item: InterWarehouseList) => item.id === val,
)
editForm.value.warehouseName = found ? found.name : ''
}
onMounted(() => { onMounted(() => {
getTreeNum() getTreeNum()
getWarehouseList() getWarehouseList()
......
...@@ -125,10 +125,10 @@ ...@@ -125,10 +125,10 @@
> >
删除 删除
</el-button> </el-button>
<el-button type="success" @click="handleExport"> 导出 </el-button> <!-- <el-button type="success" @click="handleExport"> 导出 </el-button>
<el-button type="primary" @click="printProductTag"> <el-button type="primary" @click="printProductTag">
打印商品SKU标签 打印商品SKU标签
</el-button> </el-button> -->
<el-button <el-button
v-if="nodeCode === 'PENDING_AUDIT'" v-if="nodeCode === 'PENDING_AUDIT'"
type="warning" type="warning"
...@@ -481,6 +481,7 @@ ...@@ -481,6 +481,7 @@
clearable clearable
placeholder="请选择仓库" placeholder="请选择仓库"
style="width: 160px" style="width: 160px"
@change="handleWarehouseChange(editForm.warehouseId)"
> >
<ElOption <ElOption
v-for="item in warehouseList" v-for="item in warehouseList"
...@@ -565,8 +566,7 @@ ...@@ -565,8 +566,7 @@
<!-- +后有就正常展示,没有则通过搜索接口自己添加 --> <!-- +后有就正常展示,没有则通过搜索接口自己添加 -->
<!-- remote <!-- remote
:remote-method="(query) => handleLocationSearch(query, row)" :remote-method="(query) => handleLocationSearch(query, row)"
:loading="locationLoading" :loading="locationLoading"-->
@change="(val) => handleLocationChange(val, row)" -->
<span v-if="row.loacationCode">{{ row.loacationCode }}</span> <span v-if="row.loacationCode">{{ row.loacationCode }}</span>
<ElSelect <ElSelect
v-else v-else
...@@ -797,7 +797,7 @@ import { CirclePlusFilled } from '@element-plus/icons-vue' ...@@ -797,7 +797,7 @@ import { CirclePlusFilled } from '@element-plus/icons-vue'
import splitDiv from '@/components/splitDiv/splitDiv.vue' import splitDiv from '@/components/splitDiv/splitDiv.vue'
import { ElTable } from 'element-plus' import { ElTable } from 'element-plus'
import usePageList from '@/utils/hooks/usePageList' import usePageList from '@/utils/hooks/usePageList'
// import { checkUpdateParams } from '@/utils/hooks/commonUtil' import { checkUpdateParams, AnyObject } from '@/utils/hooks/commonUtil'
import { useValue } from '@/utils/hooks/useValue' import { useValue } from '@/utils/hooks/useValue'
import { import {
getInRecordStatusTree, getInRecordStatusTree,
...@@ -990,6 +990,7 @@ const { ...@@ -990,6 +990,7 @@ const {
pageSize, pageSize,
).then((res) => res.data) as never, ).then((res) => res.data) as never,
}) })
const setCostPrice = (item: InterProductList) => { const setCostPrice = (item: InterProductList) => {
if (!item.costPrice) { if (!item.costPrice) {
ElMessage.warning('商品成本价为空,请完善商品成本价') ElMessage.warning('商品成本价为空,请完善商品成本价')
...@@ -1015,15 +1016,15 @@ const getTreeNum = async () => { ...@@ -1015,15 +1016,15 @@ const getTreeNum = async () => {
} }
} }
const showPrintDialog = ref(false) const showPrintDialog = ref(false)
const printProductTag = async () => { // const printProductTag = async () => {
if (!selections.value.length) { // if (!selections.value.length) {
return ElMessage.warning('请选择要删除的数据') // return ElMessage.warning('请选择要操作的数据')
} // }
showPrintDialog.value = true // showPrintDialog.value = true
// selections.value.forEach((el:InterWarehousePage) => { // selections.value.forEach((el:InterWarehousePage) => {
// el.number = '' // el.number = ''
// }) // })
} // }
async function handlePrintProductTag() { async function handlePrintProductTag() {
// const flag = selections.value.every((el:InterWarehousePage) => el.number && el.number != '0') // const flag = selections.value.every((el:InterWarehousePage) => el.number && el.number != '0')
// if (!flag) { // if (!flag) {
...@@ -1088,11 +1089,9 @@ const exportForm = ref({ ...@@ -1088,11 +1089,9 @@ const exportForm = ref({
delivery: false, delivery: false,
resource: '', resource: '',
}) })
const handleExport = () => { // const handleExport = () => {
exportVisible.value = true // exportVisible.value = true
// exportForm.value.delivery = false // }
// exportForm.value.resource = ''
}
const submitExportForm = () => { const submitExportForm = () => {
// if (exportForm.value.resource === '') { // if (exportForm.value.resource === '') {
// return ElMessage.error('请选择导出类型') // return ElMessage.error('请选择导出类型')
...@@ -1270,7 +1269,8 @@ const tabsClick = async () => { ...@@ -1270,7 +1269,8 @@ const tabsClick = async () => {
} }
const [editForm, resetEditForm] = useValue<InterWarehouseDetail>({ const [editForm, resetEditForm] = useValue<InterWarehouseDetail>({
inNo: '', inNo: '',
warehouseId: '', warehouseId: null,
warehouseName: '',
remark: '', remark: '',
factoryCode: '', factoryCode: '',
factoryId: 0, factoryId: 0,
...@@ -1310,7 +1310,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => { ...@@ -1310,7 +1310,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => {
const getProduct = async (id: number | undefined) => { const getProduct = async (id: number | undefined) => {
try { try {
const res = await getWarehouseInRecordDetailApi(id) const res = await getWarehouseInRecordDetailApi(id)
editForm2.value = res.data editForm.value = JSON.parse(JSON.stringify(res.data))
otherPurchaseData.value = res.data?.productList || [] otherPurchaseData.value = res.data?.productList || []
} catch (e) { } catch (e) {
console.error(e) console.error(e)
...@@ -1349,7 +1349,7 @@ const auditOrder = (key: string) => { ...@@ -1349,7 +1349,7 @@ const auditOrder = (key: string) => {
} }
const confimText = const confimText =
key === 'audit' key === 'audit'
? '确定进行审核?点“确定”将会直接更改库存数量,请在审核前确认数量是否正确。' ? '确定进行审核?点"确定"将会直接更改库存数量,请在审核前确认数量是否正确。'
: `确定对选中的信息进行${text}?` : `确定对选中的信息进行${text}?`
ElMessageBox.confirm(confimText, '重要提示', { ElMessageBox.confirm(confimText, '重要提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
...@@ -1413,7 +1413,7 @@ watch( ...@@ -1413,7 +1413,7 @@ watch(
watch( watch(
() => editForm.value.warehouseId, () => editForm.value.warehouseId,
(newVal: number | string | undefined) => { (newVal: number | null | undefined) => {
if (newVal) { if (newVal) {
fetchLocationList('') fetchLocationList('')
} }
...@@ -1512,13 +1512,17 @@ const addSection = async () => { ...@@ -1512,13 +1512,17 @@ const addSection = async () => {
} }
const upSection = async () => { const upSection = async () => {
const params = { ...editForm.value } const params = { ...editForm.value }
params.productList = otherPurchaseData.value // params.productList = otherPurchaseData.value
// const result = checkUpdateParams(params, editForm2.value, '', { const result = checkUpdateParams(
// productList: 'value', { ...params, productList: otherPurchaseData.value },
// }) editForm.value as unknown as AnyObject,
// console.log(result, params, editForm2.value) 'id',
{
productList: 'warehouseSku',
},
)
try { try {
await updateInRecordApi(params) await updateInRecordApi(result)
newDialogVisible.value = false newDialogVisible.value = false
ElMessage.success('修改成功') ElMessage.success('修改成功')
search() search()
...@@ -1592,6 +1596,7 @@ const fetchLocationList = async (query: string) => { ...@@ -1592,6 +1596,7 @@ const fetchLocationList = async (query: string) => {
// locationList.value = [] // locationList.value = []
// return // return
// } // }
if (!editForm.value.warehouseId) return
locationLoading.value = true locationLoading.value = true
try { try {
const res = await getByWareHouseIdAndCodeApi( const res = await getByWareHouseIdAndCodeApi(
...@@ -1619,6 +1624,12 @@ const handleLocationChange = (val: number, row: InterProductList) => { ...@@ -1619,6 +1624,12 @@ const handleLocationChange = (val: number, row: InterProductList) => {
) )
row.locationCode = found ? found.locationCode : '' row.locationCode = found ? found.locationCode : ''
} }
const handleWarehouseChange = (val: number | null | undefined) => {
const found = warehouseList.value.find(
(item: InterWarehouseList) => item.id === val,
)
editForm.value.warehouseName = found ? found.name : ''
}
onMounted(() => { onMounted(() => {
getTreeNum() getTreeNum()
getWarehouseList() getWarehouseList()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment