Commit 9f9aa652 by wuqian

初版出库单

parent 79c91be7
...@@ -6,9 +6,9 @@ import { ...@@ -6,9 +6,9 @@ import {
InterWarehouseTree, InterWarehouseTree,
InterWarehouseDetail, InterWarehouseDetail,
InterskuList, InterskuList,
InterWarehouseList,
ILocation, ILocation,
AnyObject, AnyObject,
InterProductList,
} from '@/types/api/warehouse' } from '@/types/api/warehouse'
export interface LogListData { export interface LogListData {
createTime: string createTime: string
...@@ -17,26 +17,26 @@ export interface LogListData { ...@@ -17,26 +17,26 @@ export interface LogListData {
} }
export interface Address { export interface Address {
id: number; // 主键,自动递增 id: number // 主键,自动递增
shipperName: string; // 发货人姓名 shipperName: string // 发货人姓名
addressLine1: string; // 地址 1 addressLine1: string // 地址 1
addressLine2?: string | null; // 地址 2 addressLine2?: string | null // 地址 2
addressLine3?: string | null; // 地址 3 addressLine3?: string | null // 地址 3
city: string; // 城市 city: string // 城市
cityCode?: string | null; // 城市编码 cityCode?: string | null // 城市编码
district?: string | null; // 区 district?: string | null // 区
districtCode?: string | null; // 区编码 districtCode?: string | null // 区编码
cspAccount?: string | null; // CSP账号 cspAccount?: string | null // CSP账号
stateProvince?: string | null; // 州/省 stateProvince?: string | null // 州/省
stateProvinceAbbr?: string | null; // 州/省简称 stateProvinceAbbr?: string | null // 州/省简称
postalCode?: string | null; // 邮编 postalCode?: string | null // 邮编
countryName: string; // 国家名称 countryName: string // 国家名称
countryCode?: string | null; // 国家代码 countryCode?: string | null // 国家代码
phoneNumber?: string | null; // 电话 phoneNumber?: string | null // 电话
rfcTaxId?: string | null; // RFC税号 rfcTaxId?: string | null // RFC税号
swDefault?: number | null; // 是否默认 1是,0不是 swDefault?: number | null // 是否默认 1是,0不是
createTime: string; // 创建时间 createTime: string // 创建时间
updateTime: string; // 更新时间 updateTime: string // 更新时间
} }
export interface PrintData { export interface PrintData {
...@@ -257,7 +257,7 @@ export function updateWarehouseApi(data: positionInfo | UpdateDefaulted) { ...@@ -257,7 +257,7 @@ export function updateWarehouseApi(data: positionInfo | UpdateDefaulted) {
export function logisticsAddressGetAllList() { export function logisticsAddressGetAllList() {
return axios.get<never, BaseRespData<Address[]>>( return axios.get<never, BaseRespData<Address[]>>(
'/logisticsAddress/getAllList' '/logisticsAddress/getAllList',
) )
} }
...@@ -371,7 +371,10 @@ export function getWarehouseInRecordDetailApi(id: number | undefined) { ...@@ -371,7 +371,10 @@ export function getWarehouseInRecordDetailApi(id: number | undefined) {
}, },
) )
} }
export function getBySkuApi(warehouseId: number | null | undefined, sku: string | null) { export function getBySkuApi(
warehouseId: number | string | undefined,
sku: string | null,
) {
return axios.get<never, BaseRespData<InterskuList[]>>( return axios.get<never, BaseRespData<InterskuList[]>>(
'customProductItem/getBySku', 'customProductItem/getBySku',
{ {
...@@ -383,7 +386,7 @@ export function getBySkuApi(warehouseId: number | null | undefined, sku: string ...@@ -383,7 +386,7 @@ export function getBySkuApi(warehouseId: number | null | undefined, sku: string
) )
} }
export function getByWareHouseIdAndCodeApi( export function getByWareHouseIdAndCodeApi(
wareHouseId: number | null | undefined, wareHouseId: number | string | undefined,
code: string | null, code: string | null,
) { ) {
return axios.get<never, BaseRespData<ILocation[]>>( return axios.get<never, BaseRespData<ILocation[]>>(
...@@ -402,11 +405,6 @@ export function getInRecordStatusTree() { ...@@ -402,11 +405,6 @@ export function getInRecordStatusTree() {
) )
} }
export function getWarehouseListApi() {
return axios.get<never, BaseRespData<InterWarehouseList[]>>(
'factoryWarehouseInfo/getAll',
)
}
interface WarehouseParams { interface WarehouseParams {
id?: number id?: number
dataVersion?: number dataVersion?: number
...@@ -433,6 +431,78 @@ export function getOutRecordStatusTree() { ...@@ -433,6 +431,78 @@ export function getOutRecordStatusTree() {
'factory/warehouseOutRecord/status_tree', 'factory/warehouseOutRecord/status_tree',
) )
} }
export function getBySkuAndWarehouseIdApi(
warehouseId: number | string | undefined,
sku: string | null,
) {
return axios.get<never, BaseRespData<InterskuList[]>>(
'factoryWarehouseInventory/getBySkuAndWarehouseId',
{
params: {
warehouseId,
sku,
},
},
)
}
export function rejectOutRecordApi({
list,
rejectReason,
}: {
list: WarehouseParams[]
rejectReason: string
}) {
return axios.post<never, BaseRespData<never>>(
'factory/warehouseOutRecord/reject',
{
list,
rejectReason,
},
)
}
export function getItemListByIdApi(id: number | undefined) {
return axios.get<never, BaseRespData<InterProductList[]>>(
'factory/warehouseOutRecord/getItemListById',
{
params: {
id,
},
},
)
}
export function getWarehouseOutRecordDetailApi(id: number | undefined) {
return axios.get<never, BaseRespData<InterWarehouseDetail>>(
'factory/warehouseOutRecord/get',
{
params: {
id,
},
},
)
}
export function addOutRecordApi(form: InterWarehouseDetail) {
return axios.post<never, BaseRespData<never>>(
'factory/warehouseOutRecord/add',
{
...form,
},
)
}
export function updateOutRecordApi(
form: InterWarehouseDetail | AnyObject | null,
) {
return axios.post<never, BaseRespData<never>>(
'factory/warehouseOutRecord/update',
{
...form,
},
)
}
export function getOutRecordLogApi(id?: number) {
return axios.get<never, BaseRespData<LogListData[]>>(
`factory/warehouseOutRecord/getLogById?id=${id}`,
)
}
export function warehouseOutRecordListPage( export function warehouseOutRecordListPage(
data: warehouseSearchForm, data: warehouseSearchForm,
currentPage: number, currentPage: number,
......
...@@ -27,7 +27,7 @@ import WarehouseManage from '@/views/warehouse/manage.vue' ...@@ -27,7 +27,7 @@ import WarehouseManage from '@/views/warehouse/manage.vue'
import WarehouseWarning from '@/views/warehouse/warning.vue' import WarehouseWarning from '@/views/warehouse/warning.vue'
import WarehousePosition from '@/views/warehouse/position.vue' import WarehousePosition from '@/views/warehouse/position.vue'
import receiptDoc from '@/views/warehouse/receiptDoc.vue' import receiptDoc from '@/views/warehouse/receiptDoc.vue'
// import issueDoc from '@/views/warehouse/issueDoc.vue' import issueDoc from '@/views/warehouse/issueDoc.vue'
const router = createRouter({ const router = createRouter({
history: createWebHistory(), history: createWebHistory(),
routes: [ routes: [
...@@ -134,13 +134,13 @@ const router = createRouter({ ...@@ -134,13 +134,13 @@ const router = createRouter({
}, },
component: receiptDoc, component: receiptDoc,
}, },
// { {
// path: '/warehouse/issue-doc', path: '/warehouse/issue-doc',
// meta: { meta: {
// title: '出库单', title: '出库单',
// }, },
// component: issueDoc, component: issueDoc,
// }, },
{ {
path: '/warehouse/warning', path: '/warehouse/warning',
meta: { meta: {
......
...@@ -31,11 +31,11 @@ const menu: MenuItem[] = [ ...@@ -31,11 +31,11 @@ const menu: MenuItem[] = [
id: 123, id: 123,
label: '入库单', label: '入库单',
}, },
// { {
// index: '/warehouse/issue-doc', index: '/warehouse/issue-doc',
// id: 124, id: 124,
// label: '出库单', label: '出库单',
// }, },
{ {
index: '/warehouse/manage', index: '/warehouse/manage',
......
...@@ -8,7 +8,7 @@ export interface warehouseSearchForm { ...@@ -8,7 +8,7 @@ export interface warehouseSearchForm {
createTimeStart?: string createTimeStart?: string
orderNumber?: string orderNumber?: string
sku?: string sku?: string
warehouseId?: number | null warehouseId?: number | string
id?: number id?: number
} }
export interface InterProductList { export interface InterProductList {
...@@ -16,7 +16,8 @@ export interface InterProductList { ...@@ -16,7 +16,8 @@ export interface InterProductList {
id?: number id?: number
inId?: number inId?: number
productNo?: string | null //custom的货号 productNo?: string | null //custom的货号
buyStored?: number | null buyStored?: number | null //入库数量
outCount?: number | null //出库数量
remark?: string | null remark?: string | null
skuImage?: string skuImage?: string
skuName?: string skuName?: string
...@@ -32,9 +33,10 @@ export interface InterWarehouseBase { ...@@ -32,9 +33,10 @@ export interface InterWarehouseBase {
id?: number id?: number
factoryId?: number factoryId?: number
factoryCode?: string factoryCode?: string
warehouseId?: number | null warehouseId?: number | string
warehouseName?: string | null warehouseName?: string | null
inNo?: string inNo?: string
outNo?: string
shipmentNumber?: string shipmentNumber?: string
skuAmount?: number skuAmount?: number
total?: number total?: number
...@@ -66,6 +68,8 @@ export interface InterProductList { ...@@ -66,6 +68,8 @@ export interface InterProductList {
inId?: number inId?: number
productNo?: string | null //货号 productNo?: string | null //货号
buyStored?: number | null //入库数量 buyStored?: number | null //入库数量
outCount?: number | null //出库数量
usableInventory?: number | null //可用库存数量
// rejectsAmount?: number // rejectsAmount?: number
// rejectsReason?: string // rejectsReason?: string
remark?: string | null remark?: string | null
...@@ -84,20 +88,14 @@ export interface InterskuList { ...@@ -84,20 +88,14 @@ export interface InterskuList {
sku?: string sku?: string
skuName?: string skuName?: string
image?: string image?: string
factoryPrice?: number factoryPrice?: number | null
productNo?: string | null //货号 productNo?: string | null //货号
productNumber?: string | null //出库单货号
locationId?: number | null locationId?: number | null
locationCode?: string | null locationCode?: string | null
} price?: number | null //出库单的
export interface InterWarehouseList { usableInventory?: number | null
id: number warehouseSku?: string
name: string
code?: string
sort?: number
defaulted?: number
factoryId?: number
factoryCode?: string
remarks?: string | null
} }
export interface ILocation { export interface ILocation {
id?: number id?: number
......
...@@ -29,6 +29,7 @@ function isChange(arr: AnyObject[], arr1: AnyObject[]): boolean { ...@@ -29,6 +29,7 @@ function isChange(arr: AnyObject[], arr1: AnyObject[]): boolean {
* @param {string} id 数组唯一值 * @param {string} id 数组唯一值
* @param {Record<string, string>} other 其他属性 * @param {Record<string, string>} other 其他属性
* @param {boolean} bool 是否为布尔值 * @param {boolean} bool 是否为布尔值
* @param {boolean} isBackKeyName 是否将结果返回到xxChange里,针对只有一个list的情况
*/ */
export function checkUpdateParams( export function checkUpdateParams(
newParams: AnyObject, newParams: AnyObject,
...@@ -36,6 +37,7 @@ export function checkUpdateParams( ...@@ -36,6 +37,7 @@ export function checkUpdateParams(
id: string = 'id', id: string = 'id',
other: Record<string, string> = {}, other: Record<string, string> = {},
bool: boolean = false, bool: boolean = false,
isBackKeyName: boolean = true,
): AnyObject | null { ): AnyObject | null {
oldParams = JSON.parse(JSON.stringify(oldParams)) oldParams = JSON.parse(JSON.stringify(oldParams))
if (!oldParams) return newParams if (!oldParams) return newParams
...@@ -105,9 +107,16 @@ export function checkUpdateParams( ...@@ -105,9 +107,16 @@ export function checkUpdateParams(
if (arr1.length > 0) { if (arr1.length > 0) {
removeList = arr1.map((item) => item['id'] as IdType) removeList = arr1.map((item) => item['id'] as IdType)
} }
if (isBackKeyName) {
// 将列表直接添加到 params 顶层
if (addList.length > 0) params['addList'] = addList || undefined
if (updateList.length > 0)
params['updateList'] = updateList || undefined
if (removeList.length > 0)
params['removeList'] = removeList || undefined
if (list.length > 0) params['list'] = list || undefined
} else {
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
...@@ -125,6 +134,7 @@ export function checkUpdateParams( ...@@ -125,6 +134,7 @@ export function checkUpdateParams(
delete params[key_name] delete params[key_name]
} }
} }
}
} else { } else {
// 基础信息 // 基础信息
params[key] = newParams[key] params[key] = newParams[key]
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
></ElOption> ></ElOption>
</ElSelect> </ElSelect>
</ElFormItem> </ElFormItem>
<ElFormItem label="库时间"> <ElFormItem label="库时间">
<el-date-picker <el-date-picker
v-model="tradingTime" v-model="tradingTime"
:shortcuts="pickerOptions.shortcuts" :shortcuts="pickerOptions.shortcuts"
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<ElInput <ElInput
v-model="searchForm.orderNumber" v-model="searchForm.orderNumber"
clearable clearable
placeholder="请输入库单号" placeholder="请输入库单号"
style="width: 160px" style="width: 160px"
/> />
</ElFormItem> </ElFormItem>
...@@ -188,9 +188,9 @@ ...@@ -188,9 +188,9 @@
align="center" align="center"
></ElTableColumn> ></ElTableColumn>
<ElTableColumn <ElTableColumn
label="库单号" label="库单号"
show-overflow-tooltip show-overflow-tooltip
prop="inNo" prop="outNo"
width="130" width="130"
header-align="center" header-align="center"
align="center" align="center"
...@@ -295,7 +295,7 @@ ...@@ -295,7 +295,7 @@
</template> </template>
<template #bottom> <template #bottom>
<el-tabs v-model="tabsValue" @tab-click="tabsClick"> <el-tabs v-model="tabsValue" @tab-click="tabsClick">
<el-tab-pane name="0" label="库商品"> <el-tab-pane name="0" label="库商品">
<div class="table-wrap"> <div class="table-wrap">
<ElTable size="small" :data="detailList" height="100%" border> <ElTable size="small" :data="detailList" height="100%" border>
<ElTableColumn <ElTableColumn
...@@ -337,8 +337,8 @@ ...@@ -337,8 +337,8 @@
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="库数量" label="库数量"
prop="buyStored" prop="outCount"
/> />
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
...@@ -352,18 +352,6 @@ ...@@ -352,18 +352,6 @@
label="总成本(¥)" label="总成本(¥)"
prop="totalPrice" prop="totalPrice"
/> />
<!-- <ElTableColumn
show-overflow-tooltip
align="center"
label="不良品数量"
prop="rejectsAmount"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
label="不良品原因"
prop="rejectsAeason"
/> -->
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
...@@ -385,18 +373,6 @@ ...@@ -385,18 +373,6 @@
/> />
</ElTable> </ElTable>
</div> </div>
<!-- <ElPagination
v-model:current-page="detailPager.page"
v-model:page-size="detailPager.rows"
:page-sizes="[100, 200, 300, 400, 500]"
background
layout="total, sizes, prev, pager, next, jumper"
:total="detailPager.total"
style="margin: 10px auto 0; text-align: right"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
></ElPagination> -->
</el-tab-pane> </el-tab-pane>
<el-tab-pane name="1" label="操作日志"> <el-tab-pane name="1" label="操作日志">
<ul <ul
...@@ -434,12 +410,6 @@ ...@@ -434,12 +410,6 @@
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<div class="import-dialog"> <div class="import-dialog">
<!-- <div class="import-header">
<el-button type="primary" link @click="downloadTemplate">
<el-icon><Download /></el-icon>
下载模板
</el-button>
</div> -->
<div class="import-content"> <div class="import-content">
<UploadExcel <UploadExcel
v-model="importedFileUrl" v-model="importedFileUrl"
...@@ -448,12 +418,6 @@ ...@@ -448,12 +418,6 @@
/> />
</div> </div>
</div> </div>
<!-- <template #footer>
<span class="dialog-footer">
<el-button @click="importDialogVisible = false">取消</el-button>
<el-button type="primary" @click="packedData">确认</el-button>
</span>
</template> -->
</ElDialog> </ElDialog>
<ElDialog <ElDialog
v-model="newDialogVisible" v-model="newDialogVisible"
...@@ -469,8 +433,8 @@ ...@@ -469,8 +433,8 @@
inline inline
label-width="90px" label-width="90px"
> >
<ElFormItem label="库单号" prop="account"> <ElFormItem label="库单号" prop="account">
<ElInput v-model="editForm.inNo" clearable disabled /> <ElInput v-model="editForm.outNo" clearable disabled />
</ElFormItem> </ElFormItem>
<ElFormItem label="工厂:" prop="factoryCode"> <ElFormItem label="工厂:" prop="factoryCode">
<span>{{ editForm.factoryCode }}</span> <span>{{ editForm.factoryCode }}</span>
...@@ -479,6 +443,7 @@ ...@@ -479,6 +443,7 @@
<ElSelect <ElSelect
v-model="editForm.warehouseId" v-model="editForm.warehouseId"
clearable clearable
:disabled="formId"
placeholder="请选择仓库" placeholder="请选择仓库"
style="width: 160px" style="width: 160px"
@change="handleWarehouseChange(editForm.warehouseId)" @change="handleWarehouseChange(editForm.warehouseId)"
...@@ -536,12 +501,17 @@ ...@@ -536,12 +501,17 @@
label="SKU名称" label="SKU名称"
prop="skuName" prop="skuName"
/> />
<ElTableColumn
<ElTableColumn align="center" label="入库数量" prop="buyStored"> show-overflow-tooltip
align="center"
label="可用库存数量"
prop="usableInventory"
/>
<ElTableColumn align="center" label="出库数量" prop="outCount">
<template #default="{ row }"> <template #default="{ row }">
<el-input <el-input
v-model.number="row.buyStored" v-model.number="row.outCount"
placeholder="库数量" placeholder="库数量"
style="width: 120px" style="width: 120px"
clearable clearable
size="small" size="small"
...@@ -561,13 +531,9 @@ ...@@ -561,13 +531,9 @@
label="总成本(¥)" label="总成本(¥)"
prop="totalPrice" prop="totalPrice"
/> />
<ElTableColumn align="center" label="库位" prop="loacationCode"> <ElTableColumn align="center" label="库位" prop="locationCode">
<template #default="{ row }"> <template #default="{ row }">
<!-- +后有就正常展示,没有则通过搜索接口自己添加 --> <span v-if="row.locationCode">{{ row.locationCode }}</span>
<!-- remote
:remote-method="(query) => handleLocationSearch(query, row)"
:loading="locationLoading"-->
<span v-if="row.loacationCode">{{ row.loacationCode }}</span>
<ElSelect <ElSelect
v-else v-else
v-model="row.locationId" v-model="row.locationId"
...@@ -592,7 +558,11 @@ ...@@ -592,7 +558,11 @@
width="240" width="240"
label="备注" label="备注"
prop="remark" prop="remark"
/> >
<template #default="{ row }">
<ElInput v-model="row.remark" clearable size="small" />
</template>
</ElTableColumn>
</ElTable> </ElTable>
</div> </div>
<template #footer> <template #footer>
...@@ -639,7 +609,7 @@ ...@@ -639,7 +609,7 @@
align="center" align="center"
width="200" width="200"
label="SKU名称" label="SKU名称"
prop="sku" prop="warehouseSku"
/> />
<ElTableColumn <ElTableColumn
...@@ -647,13 +617,13 @@ ...@@ -647,13 +617,13 @@
align="center" align="center"
label="成本价(¥)" label="成本价(¥)"
width="100" width="100"
prop="factoryPrice" prop="price"
/> />
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="库位" label="库位"
prop="loacationCode" prop="locationCode"
/> />
<ElTableColumn <ElTableColumn
width="100" width="100"
...@@ -680,14 +650,14 @@ ...@@ -680,14 +650,14 @@
</el-button> </el-button>
</template> </template>
</el-popover> </el-popover>
<el-button <!-- <el-button
style="margin-left: 6px" style="margin-left: 6px"
type="success" type="success"
size="small" size="small"
@click="addPurchase" @click="addPurchase"
> >
批量新增 批量新增
</el-button> </el-button> -->
<el-button <el-button
type="danger" type="danger"
style="margin-left: 10px" style="margin-left: 10px"
...@@ -800,19 +770,21 @@ import usePageList from '@/utils/hooks/usePageList' ...@@ -800,19 +770,21 @@ import usePageList from '@/utils/hooks/usePageList'
import { checkUpdateParams, AnyObject } 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, getOutRecordStatusTree,
warehouseInRecordListPageApi, warehouseOutRecordListPage,
getWarehouseInRecordDetailApi, getWarehouseOutRecordDetailApi,
getBySkuApi, getItemListByIdApi,
getWarehouseListApi, getBySkuAndWarehouseIdApi,
warehouseInfoGetAll,
getByWareHouseIdAndCodeApi, getByWareHouseIdAndCodeApi,
addInRecordApi, addOutRecordApi,
updateInRecordApi, updateOutRecordApi,
deleteWarehouseInRecordApi, deleteWarehouseOutRecordApi,
auditOrderApi, auditOrderApi,
getInRecordLogApi, getOutRecordLogApi,
rejectInRecordApi, rejectOutRecordApi,
LogListData, LogListData,
warehouseInfo,
} from '@/api/warehouse' } from '@/api/warehouse'
// factoryWarehouseInventoryPrint, // factoryWarehouseInventoryPrint,
// import { filePath } from '@/api/axios.ts' // import { filePath } from '@/api/axios.ts'
...@@ -825,14 +797,13 @@ import { ...@@ -825,14 +797,13 @@ import {
InterWarehouseTree, InterWarehouseTree,
InterProductList, InterProductList,
InterskuList, InterskuList,
InterWarehouseList,
ILocation, ILocation,
InterWarehouseDetail, InterWarehouseDetail,
} from '@/types/api/warehouse' } from '@/types/api/warehouse'
import ImageView from '@/components/ImageView.vue' import ImageView from '@/components/ImageView.vue'
import UploadExcel from '@/components/UploadExcel.vue' import UploadExcel from '@/components/UploadExcel.vue'
// import { debounce } from 'lodash-es' // import { debounce } from 'lodash-es'
const warehouseList = ref<InterWarehouseList[]>([]) const warehouseList = ref<warehouseInfo[]>([])
const pickerOptions = { const pickerOptions = {
shortcuts: [ shortcuts: [
{ {
...@@ -979,7 +950,7 @@ const { ...@@ -979,7 +950,7 @@ const {
onPageSizeChange: handleSizeChange, onPageSizeChange: handleSizeChange,
} = usePageList({ } = usePageList({
query: (page, pageSize) => query: (page, pageSize) =>
warehouseInRecordListPageApi( warehouseOutRecordListPage(
{ {
...searchForm.value, ...searchForm.value,
billStatus: nodeCode.value == 'all' ? 'all' : nodeCode.value, billStatus: nodeCode.value == 'all' ? 'all' : nodeCode.value,
...@@ -997,15 +968,15 @@ const setCostPrice = (item: InterProductList) => { ...@@ -997,15 +968,15 @@ const setCostPrice = (item: InterProductList) => {
return return
} }
if (item) { if (item) {
const buyStored = item.buyStored ?? 0 const outCount = item.outCount ?? 0
const costPrice = item.costPrice ?? 0 const costPrice = item.costPrice ?? 0
const amount = new BigNumber(buyStored).multipliedBy(costPrice).toFixed(2) const amount = new BigNumber(outCount).multipliedBy(costPrice).toFixed(2)
item.totalPrice = Number(amount) item.totalPrice = Number(amount)
} }
} }
const getTreeNum = async () => { const getTreeNum = async () => {
try { try {
const res = await getInRecordStatusTree() const res = await getOutRecordStatusTree()
res.data = [{ code: 'all', name: '全部', children: res.data }] res.data = [{ code: 'all', name: '全部', children: res.data }]
treeData.value = res.data treeData.value = res.data
await nextTick(() => { await nextTick(() => {
...@@ -1051,7 +1022,8 @@ const excelFieldMap: Record<string, keyof InterProductList> = { ...@@ -1051,7 +1022,8 @@ const excelFieldMap: Record<string, keyof InterProductList> = {
SKU图片: 'skuImage', SKU图片: 'skuImage',
商品SKU: 'warehouseSku', 商品SKU: 'warehouseSku',
SKU名称: 'skuName', SKU名称: 'skuName',
入库数量: 'buyStored', 出库数量: 'outCount',
可用库存数量: 'usableInventory',
'成本价(¥)': 'costPrice', '成本价(¥)': 'costPrice',
'总成本(¥)': 'totalPrice', '总成本(¥)': 'totalPrice',
库位: 'locationCode', 库位: 'locationCode',
...@@ -1071,7 +1043,7 @@ const handleLocalImport = ({ ...@@ -1071,7 +1043,7 @@ const handleLocalImport = ({
const field = excelFieldMap[excelKey] as keyof InterProductList const field = excelFieldMap[excelKey] as keyof InterProductList
const value = item[excelKey] const value = item[excelKey]
// // 类型转换和默认值 // // 类型转换和默认值
// if (['buyStored', 'costPrice', 'totalPrice'].includes(field)) { // if (['outCount', 'costPrice', 'totalPrice'].includes(field)) {
// value = value == null || value === '' ? 0 : Number(value) // value = value == null || value === '' ? 0 : Number(value)
// } else { // } else {
// value = value == null ? '' : value // value = value == null ? '' : value
...@@ -1092,110 +1064,10 @@ const exportForm = ref({ ...@@ -1092,110 +1064,10 @@ const exportForm = ref({
// const handleExport = () => { // const handleExport = () => {
// exportVisible.value = true // exportVisible.value = true
// } // }
const submitExportForm = () => { const submitExportForm = () => {}
// if (exportForm.value.resource === '') {
// return ElMessage.error('请选择导出类型')
// }
// let purchaseIds = [],
// otherIds = [],
// total = 0,
// params = {}
// if (exportForm.value.resource === 0) {
// purchaseIds = userData.value
// .filter((el) => el.dataType === 0)
// .map((el) => el.id)
// .join(',')
// otherIds = userData.value
// .filter((el) => el.dataType === 1)
// .map((el) => el.id)
// .join(',')
// } else if (exportForm.value.resource === 1) {
// purchaseIds = selections.value
// .filter((el) => el.dataType === 0)
// .map((el) => el.id)
// .join(',')
// otherIds = selections.value
// .filter((el) => el.dataType === 1)
// .map((el) => el.id)
// .join(',')
// } else {
// purchaseIds = ''
// otherIds = ''
// // total = this.paginationOptions.total
// }
// params = {
// purchaseIds,
// otherIds,
// total,
// }
// if (exportForm.value.resource !== 2) {
// delete params.total
// } else {
// // params.billStatus = this.billStatus
// // params.type = this.treeType || ''
// // params.otherStatus = this.otherStatus
// if (
// this.treeLabel.indexOf(this.$t('待入库')) !== -1 ||
// this.treeLabel.indexOf(this.$t('已入库')) !== -1
// ) {
// params.purchaseAll = true
// params.otherAll = true
// }
// if (
// this.treeLabel.indexOf(this.$t('采购')) !== -1 ||
// this.treeLabel.indexOf(this.$t('生产')) !== -1
// ) {
// params.purchaseAll = true
// }
// if (this.treeLabel.indexOf(this.$t('其他')) !== -1) {
// params.otherAll = true
// }
// if (this.treeLabel.indexOf(this.$t('归档')) !== -1) {
// params.purchaseAll = true
// }
// if (this.treeLabel.indexOf(this.$t('作废')) !== -1) {
// params.purchaseAll = true
// params.otherAll = true
// }
// }
// const loading = this.$loading({
// background: 'rgba(0, 0, 0, 0.3)',
// })
// Axios.post(
// window.apiHostSetting.VUE_APP_API_URL +
// 'api/purchaseStoreBill/exportPurchaseExcel',
// {
// includeSku: exportForm.value.delivery,
// ...params,
// ...this.searchForm,
// },
// {
// headers: {
// 'jwt-token': localStorage.getItem('token'),
// },
// },
// )
// .then((res) => {
// console.log(filePath)
// window.open(filePath + res.data.message)
// exportVisible.value = false
// })
// .finally(() => {
// loading.close()
// })
// try {
// const res = await exportOrder({
// ids: selection.value.map((el) => el.id),
// status: statusCode.value,
// })
// window.open(filePath + res.message)
// } catch (e) {
// // showError(e)
// }
}
const getWarehouseList = async () => { const getWarehouseList = async () => {
try { try {
const res = await getWarehouseListApi() const res = await warehouseInfoGetAll()
warehouseList.value = res.data warehouseList.value = res.data
await nextTick(() => { await nextTick(() => {
treeRef.value!.setCurrentKey(nodeCode.value, true) treeRef.value!.setCurrentKey(nodeCode.value, true)
...@@ -1215,7 +1087,10 @@ const skuData = ref<InterskuList[]>([]) ...@@ -1215,7 +1087,10 @@ const skuData = ref<InterskuList[]>([])
const selectbySku = async () => { const selectbySku = async () => {
if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库') if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
try { try {
const res = await getBySkuApi(editForm.value.warehouseId, selectSku.value) const res = await getBySkuAndWarehouseIdApi(
editForm.value.warehouseId,
selectSku.value,
)
skuData.value = res.data || [] skuData.value = res.data || []
} catch (e) { } catch (e) {
console.error(e) console.error(e)
...@@ -1225,25 +1100,27 @@ const skudblclick = (val: InterskuList) => { ...@@ -1225,25 +1100,27 @@ const skudblclick = (val: InterskuList) => {
// 使用可选链和空值合并运算符处理可能的null值 // 使用可选链和空值合并运算符处理可能的null值
const { const {
locationCode = '', locationCode = '',
factoryPrice = 0, price = null,
productNo = '', productNumber = '',
sku = '', warehouseSku = '',
skuName = '', skuName = '',
image = '', image = '',
locationId = null, locationId = null,
usableInventory = null,
} = val || {} } = val || {}
otherPurchaseData.value = [ otherPurchaseData.value = [
...otherPurchaseData.value, ...otherPurchaseData.value,
{ {
skuImage: image, skuImage: image,
warehouseSku: sku, warehouseSku,
skuName, skuName,
productNo, productNo: productNumber,
locationCode: locationCode ?? '', // 确保空值处理 locationCode: locationCode ?? '', // 确保空值处理
locationId: locationId ?? null, // 确保空值处理 locationId: locationId ?? null, // 确保空值处理
costPrice: factoryPrice, costPrice: price,
buyStored: null, outCount: null, //出库数量
totalPrice: null, totalPrice: null,
usableInventory, //可用库存数量
}, },
] ]
// 使用filter代替forEach+splice,时间复杂度从O(n^2)降到O(n) // 使用filter代替forEach+splice,时间复杂度从O(n^2)降到O(n)
...@@ -1251,7 +1128,7 @@ const skudblclick = (val: InterskuList) => { ...@@ -1251,7 +1128,7 @@ const skudblclick = (val: InterskuList) => {
otherPurchaseData.value.map((item: InterProductList) => item.warehouseSku), otherPurchaseData.value.map((item: InterProductList) => item.warehouseSku),
) )
skuData.value = skuData.value.filter( skuData.value = skuData.value.filter(
(item: InterskuList) => !skuSet.has(item.sku), (item: InterskuList) => !skuSet.has(item.warehouseSku),
) )
} }
const tabsClick = async () => { const tabsClick = async () => {
...@@ -1268,8 +1145,8 @@ const tabsClick = async () => { ...@@ -1268,8 +1145,8 @@ const tabsClick = async () => {
} }
} }
const [editForm, resetEditForm] = useValue<InterWarehouseDetail>({ const [editForm, resetEditForm] = useValue<InterWarehouseDetail>({
inNo: '', outNo: '',
warehouseId: null, warehouseId: '',
warehouseName: '', warehouseName: '',
remark: '', remark: '',
factoryCode: '', factoryCode: '',
...@@ -1286,7 +1163,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => { ...@@ -1286,7 +1163,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => {
if (v) formId.value = v.id if (v) formId.value = v.id
if (v) getProduct(v.id) if (v) getProduct(v.id)
if (!formId.value) return ElMessage('请勾选至少一条记录') if (!formId.value) return ElMessage('请勾选至少一条记录')
editForm.value = JSON.parse(JSON.stringify(v)) // editForm.value = JSON.parse(JSON.stringify(v))
} else { } else {
await nextTick() await nextTick()
editForm.value = JSON.parse(JSON.stringify(editForm2.value)) editForm.value = JSON.parse(JSON.stringify(editForm2.value))
...@@ -1297,6 +1174,13 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => { ...@@ -1297,6 +1174,13 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => {
const userData = JSON.parse(userJson) const userData = JSON.parse(userJson)
editForm.value.factoryCode = userData.factoryCode || '' editForm.value.factoryCode = userData.factoryCode || ''
editForm.value.factoryId = userData.factoryId || 0 editForm.value.factoryId = userData.factoryId || 0
const defaultWarehouse = warehouseList.value.find(
(item: warehouseInfo) => item.defaulted === 1,
)
if (defaultWarehouse) {
editForm.value.warehouseId = defaultWarehouse.id
editForm.value.warehouseName = defaultWarehouse.name
}
} catch { } catch {
// ignore // ignore
} }
...@@ -1309,7 +1193,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => { ...@@ -1309,7 +1193,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 getWarehouseOutRecordDetailApi(id)
editForm.value = JSON.parse(JSON.stringify(res.data)) editForm.value = JSON.parse(JSON.stringify(res.data))
otherPurchaseData.value = res.data?.productList || [] otherPurchaseData.value = res.data?.productList || []
} catch (e) { } catch (e) {
...@@ -1331,19 +1215,19 @@ const auditOrder = (key: string) => { ...@@ -1331,19 +1215,19 @@ const auditOrder = (key: string) => {
let text = '' let text = ''
switch (key) { switch (key) {
case 'invalid': case 'invalid':
url = 'factory/warehouseInRecord/invalid' url = 'factory/warehouseOutRecord/invalid'
text = '作废' text = '作废'
break break
case 'archiving': case 'archiving':
url = 'factory/warehouseInRecord/archive' url = 'factory/warehouseOutRecord/archive'
text = '归档' text = '归档'
break break
case 'submitAudit': case 'submitAudit':
url = 'factory/warehouseInRecord/submitAudit' url = 'factory/warehouseOutRecord/submitAudit'
text = '提交审核' text = '提交审核'
break break
case 'audit': case 'audit':
url = 'factory/warehouseInRecord/audit' url = 'factory/warehouseOutRecord/audit'
text = '审核' text = '审核'
break break
} }
...@@ -1387,7 +1271,7 @@ const rejectedInRecord = () => { ...@@ -1387,7 +1271,7 @@ const rejectedInRecord = () => {
}), }),
) )
try { try {
await rejectInRecordApi({ list: data, rejectReason: value }) await rejectOutRecordApi({ list: data, rejectReason: value })
ElMessage.success('操作成功') ElMessage.success('操作成功')
search() search()
await getTreeNum() await getTreeNum()
...@@ -1413,7 +1297,7 @@ watch( ...@@ -1413,7 +1297,7 @@ watch(
watch( watch(
() => editForm.value.warehouseId, () => editForm.value.warehouseId,
(newVal: number | null | undefined) => { (newVal: number | string | undefined) => {
if (newVal) { if (newVal) {
fetchLocationList('') fetchLocationList('')
} }
...@@ -1431,8 +1315,13 @@ const addOtherCurrency = async () => { ...@@ -1431,8 +1315,13 @@ const addOtherCurrency = async () => {
return return
} }
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
if (!arr[i].buyStored) { if (!arr[i].outCount) {
ElMessage.error('请输入入库数量') ElMessage.error('请输入出库数量')
return
}
const usableInventory = arr[i].usableInventory || 0
if ((arr[i].outCount as number) > usableInventory) {
ElMessage.error('出库数量不能大于可用库存数量')
return return
} }
if (!arr[i].locationId) { if (!arr[i].locationId) {
...@@ -1475,7 +1364,7 @@ const addSection = async () => { ...@@ -1475,7 +1364,7 @@ const addSection = async () => {
const params = { ...editForm.value } const params = { ...editForm.value }
params.productList = otherPurchaseData.value params.productList = otherPurchaseData.value
try { try {
await addInRecordApi(params) await addOutRecordApi(params)
ElMessage.success('保存成功') ElMessage.success('保存成功')
newDialogVisible.value = false newDialogVisible.value = false
search() search()
...@@ -1512,7 +1401,6 @@ const addSection = async () => { ...@@ -1512,7 +1401,6 @@ const addSection = async () => {
} }
const upSection = async () => { const upSection = async () => {
const params = { ...editForm.value } const params = { ...editForm.value }
// params.productList = otherPurchaseData.value
const result = checkUpdateParams( const result = checkUpdateParams(
{ ...params, productList: otherPurchaseData.value }, { ...params, productList: otherPurchaseData.value },
editForm.value as unknown as AnyObject, editForm.value as unknown as AnyObject,
...@@ -1522,7 +1410,7 @@ const upSection = async () => { ...@@ -1522,7 +1410,7 @@ const upSection = async () => {
}, },
) )
try { try {
await updateInRecordApi(result) await updateOutRecordApi(result)
newDialogVisible.value = false newDialogVisible.value = false
ElMessage.success('修改成功') ElMessage.success('修改成功')
search() search()
...@@ -1531,9 +1419,9 @@ const upSection = async () => { ...@@ -1531,9 +1419,9 @@ const upSection = async () => {
console.error(e) console.error(e)
} }
} }
const addPurchase = async () => { // const addPurchase = async () => {
if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库') // if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
} // }
const deleteOtherWarehousing = () => { const deleteOtherWarehousing = () => {
const arr = otherWarehouseSelection.value const arr = otherWarehouseSelection.value
if (arr.length === 0) return if (arr.length === 0) return
...@@ -1558,9 +1446,10 @@ const handleBatchDelete = async () => { ...@@ -1558,9 +1446,10 @@ const handleBatchDelete = async () => {
type: 'warning', type: 'warning',
}) })
const str = selections.value.map((el: InterWarehousePage) => el.id).join(',') const str = selections.value.map((el: InterWarehousePage) => el.id).join(',')
await deleteWarehouseInRecordApi(str) await deleteWarehouseOutRecordApi(str)
ElMessage.success('删除成功') ElMessage.success('删除成功')
await search() search()
await getTreeNum()
} }
const nodeClick = (data: InterWarehouseTree) => { const nodeClick = (data: InterWarehouseTree) => {
nodeCode.value = data.code ?? '' nodeCode.value = data.code ?? ''
...@@ -1574,15 +1463,15 @@ const nodeClick = (data: InterWarehouseTree) => { ...@@ -1574,15 +1463,15 @@ const nodeClick = (data: InterWarehouseTree) => {
// }) // })
const searchDetail = async () => { const searchDetail = async () => {
try { try {
const res = await getWarehouseInRecordDetailApi(currentRow.value?.id) const res = await getItemListByIdApi(currentRow.value?.id)
detailList.value = res.data?.productList || [] detailList.value = res.data || []
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
} }
const getLogList = async () => { const getLogList = async () => {
try { try {
const res = await getInRecordLogApi(currentRow.value?.id) const res = await getOutRecordLogApi(currentRow.value?.id)
logList.value = res.data logList.value = res.data
} catch (e) { } catch (e) {
console.error(e) console.error(e)
...@@ -1624,9 +1513,9 @@ const handleLocationChange = (val: number, row: InterProductList) => { ...@@ -1624,9 +1513,9 @@ const handleLocationChange = (val: number, row: InterProductList) => {
) )
row.locationCode = found ? found.locationCode : '' row.locationCode = found ? found.locationCode : ''
} }
const handleWarehouseChange = (val: number | null | undefined) => { const handleWarehouseChange = (val: number | string | undefined) => {
const found = warehouseList.value.find( const found = warehouseList.value.find(
(item: InterWarehouseList) => item.id === val, (item: warehouseInfo) => item.id === val,
) )
editForm.value.warehouseName = found ? found.name : '' editForm.value.warehouseName = found ? found.name : ''
} }
......
...@@ -479,6 +479,7 @@ ...@@ -479,6 +479,7 @@
<ElSelect <ElSelect
v-model="editForm.warehouseId" v-model="editForm.warehouseId"
clearable clearable
:disabled="formId"
placeholder="请选择仓库" placeholder="请选择仓库"
style="width: 160px" style="width: 160px"
@change="handleWarehouseChange(editForm.warehouseId)" @change="handleWarehouseChange(editForm.warehouseId)"
...@@ -561,13 +562,13 @@ ...@@ -561,13 +562,13 @@
label="总成本(¥)" label="总成本(¥)"
prop="totalPrice" prop="totalPrice"
/> />
<ElTableColumn align="center" label="库位" prop="loacationCode"> <ElTableColumn align="center" label="库位" prop="locationCode">
<template #default="{ row }"> <template #default="{ row }">
<!-- +后有就正常展示,没有则通过搜索接口自己添加 --> <!-- +后有就正常展示,没有则通过搜索接口自己添加 -->
<!-- remote <!-- remote
:remote-method="(query) => handleLocationSearch(query, row)" :remote-method="(query) => handleLocationSearch(query, row)"
:loading="locationLoading"--> :loading="locationLoading"-->
<span v-if="row.loacationCode">{{ row.loacationCode }}</span> <span v-if="row.locationCode">{{ row.locationCode }}</span>
<ElSelect <ElSelect
v-else v-else
v-model="row.locationId" v-model="row.locationId"
...@@ -592,7 +593,11 @@ ...@@ -592,7 +593,11 @@
width="240" width="240"
label="备注" label="备注"
prop="remark" prop="remark"
/> >
<template #default="{ row }">
<ElInput v-model="row.remark" clearable size="small" />
</template>
</ElTableColumn>
</ElTable> </ElTable>
</div> </div>
<template #footer> <template #footer>
...@@ -653,7 +658,7 @@ ...@@ -653,7 +658,7 @@
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="库位" label="库位"
prop="loacationCode" prop="locationCode"
/> />
<ElTableColumn <ElTableColumn
width="100" width="100"
...@@ -680,14 +685,14 @@ ...@@ -680,14 +685,14 @@
</el-button> </el-button>
</template> </template>
</el-popover> </el-popover>
<el-button <!-- <el-button
style="margin-left: 6px" style="margin-left: 6px"
type="success" type="success"
size="small" size="small"
@click="addPurchase" @click="addPurchase"
> >
批量新增 批量新增
</el-button> </el-button> -->
<el-button <el-button
type="danger" type="danger"
style="margin-left: 10px" style="margin-left: 10px"
...@@ -804,7 +809,7 @@ import { ...@@ -804,7 +809,7 @@ import {
warehouseInRecordListPageApi, warehouseInRecordListPageApi,
getWarehouseInRecordDetailApi, getWarehouseInRecordDetailApi,
getBySkuApi, getBySkuApi,
getWarehouseListApi, warehouseInfoGetAll,
getByWareHouseIdAndCodeApi, getByWareHouseIdAndCodeApi,
addInRecordApi, addInRecordApi,
updateInRecordApi, updateInRecordApi,
...@@ -813,6 +818,7 @@ import { ...@@ -813,6 +818,7 @@ import {
getInRecordLogApi, getInRecordLogApi,
rejectInRecordApi, rejectInRecordApi,
LogListData, LogListData,
warehouseInfo,
} from '@/api/warehouse' } from '@/api/warehouse'
// factoryWarehouseInventoryPrint, // factoryWarehouseInventoryPrint,
// import { filePath } from '@/api/axios.ts' // import { filePath } from '@/api/axios.ts'
...@@ -825,14 +831,13 @@ import { ...@@ -825,14 +831,13 @@ import {
InterWarehouseTree, InterWarehouseTree,
InterProductList, InterProductList,
InterskuList, InterskuList,
InterWarehouseList,
ILocation, ILocation,
InterWarehouseDetail, InterWarehouseDetail,
} from '@/types/api/warehouse' } from '@/types/api/warehouse'
import ImageView from '@/components/ImageView.vue' import ImageView from '@/components/ImageView.vue'
import UploadExcel from '@/components/UploadExcel.vue' import UploadExcel from '@/components/UploadExcel.vue'
// import { debounce } from 'lodash-es' // import { debounce } from 'lodash-es'
const warehouseList = ref<InterWarehouseList[]>([]) const warehouseList = ref<warehouseInfo[]>([])
const pickerOptions = { const pickerOptions = {
shortcuts: [ shortcuts: [
{ {
...@@ -1195,7 +1200,7 @@ const submitExportForm = () => { ...@@ -1195,7 +1200,7 @@ const submitExportForm = () => {
} }
const getWarehouseList = async () => { const getWarehouseList = async () => {
try { try {
const res = await getWarehouseListApi() const res = await warehouseInfoGetAll()
warehouseList.value = res.data warehouseList.value = res.data
await nextTick(() => { await nextTick(() => {
treeRef.value!.setCurrentKey(nodeCode.value, true) treeRef.value!.setCurrentKey(nodeCode.value, true)
...@@ -1225,7 +1230,7 @@ const skudblclick = (val: InterskuList) => { ...@@ -1225,7 +1230,7 @@ const skudblclick = (val: InterskuList) => {
// 使用可选链和空值合并运算符处理可能的null值 // 使用可选链和空值合并运算符处理可能的null值
const { const {
locationCode = '', locationCode = '',
factoryPrice = 0, factoryPrice = null,
productNo = '', productNo = '',
sku = '', sku = '',
skuName = '', skuName = '',
...@@ -1269,7 +1274,7 @@ const tabsClick = async () => { ...@@ -1269,7 +1274,7 @@ const tabsClick = async () => {
} }
const [editForm, resetEditForm] = useValue<InterWarehouseDetail>({ const [editForm, resetEditForm] = useValue<InterWarehouseDetail>({
inNo: '', inNo: '',
warehouseId: null, warehouseId: '',
warehouseName: '', warehouseName: '',
remark: '', remark: '',
factoryCode: '', factoryCode: '',
...@@ -1286,7 +1291,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => { ...@@ -1286,7 +1291,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => {
if (v) formId.value = v.id if (v) formId.value = v.id
if (v) getProduct(v.id) if (v) getProduct(v.id)
if (!formId.value) return ElMessage('请勾选至少一条记录') if (!formId.value) return ElMessage('请勾选至少一条记录')
editForm.value = JSON.parse(JSON.stringify(v)) // editForm.value = JSON.parse(JSON.stringify(v))
} else { } else {
await nextTick() await nextTick()
editForm.value = JSON.parse(JSON.stringify(editForm2.value)) editForm.value = JSON.parse(JSON.stringify(editForm2.value))
...@@ -1297,6 +1302,13 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => { ...@@ -1297,6 +1302,13 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => {
const userData = JSON.parse(userJson) const userData = JSON.parse(userJson)
editForm.value.factoryCode = userData.factoryCode || '' editForm.value.factoryCode = userData.factoryCode || ''
editForm.value.factoryId = userData.factoryId || 0 editForm.value.factoryId = userData.factoryId || 0
const defaultWarehouse = warehouseList.value.find(
(item: warehouseInfo) => item.defaulted === 1,
)
if (defaultWarehouse) {
editForm.value.warehouseId = defaultWarehouse.id
editForm.value.warehouseName = defaultWarehouse.name
}
} catch { } catch {
// ignore // ignore
} }
...@@ -1413,7 +1425,7 @@ watch( ...@@ -1413,7 +1425,7 @@ watch(
watch( watch(
() => editForm.value.warehouseId, () => editForm.value.warehouseId,
(newVal: number | null | undefined) => { (newVal: number | string | undefined) => {
if (newVal) { if (newVal) {
fetchLocationList('') fetchLocationList('')
} }
...@@ -1531,9 +1543,9 @@ const upSection = async () => { ...@@ -1531,9 +1543,9 @@ const upSection = async () => {
console.error(e) console.error(e)
} }
} }
const addPurchase = async () => { // const addPurchase = async () => {
if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库') // if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
} // }
const deleteOtherWarehousing = () => { const deleteOtherWarehousing = () => {
const arr = otherWarehouseSelection.value const arr = otherWarehouseSelection.value
if (arr.length === 0) return if (arr.length === 0) return
...@@ -1560,7 +1572,8 @@ const handleBatchDelete = async () => { ...@@ -1560,7 +1572,8 @@ const handleBatchDelete = async () => {
const str = selections.value.map((el: InterWarehousePage) => el.id).join(',') const str = selections.value.map((el: InterWarehousePage) => el.id).join(',')
await deleteWarehouseInRecordApi(str) await deleteWarehouseInRecordApi(str)
ElMessage.success('删除成功') ElMessage.success('删除成功')
await search() search()
await getTreeNum()
} }
const nodeClick = (data: InterWarehouseTree) => { const nodeClick = (data: InterWarehouseTree) => {
nodeCode.value = data.code ?? '' nodeCode.value = data.code ?? ''
...@@ -1624,9 +1637,9 @@ const handleLocationChange = (val: number, row: InterProductList) => { ...@@ -1624,9 +1637,9 @@ const handleLocationChange = (val: number, row: InterProductList) => {
) )
row.locationCode = found ? found.locationCode : '' row.locationCode = found ? found.locationCode : ''
} }
const handleWarehouseChange = (val: number | null | undefined) => { const handleWarehouseChange = (val: number | string | undefined) => {
const found = warehouseList.value.find( const found = warehouseList.value.find(
(item: InterWarehouseList) => item.id === val, (item: warehouseInfo) => item.id === val,
) )
editForm.value.warehouseName = found ? found.name : '' editForm.value.warehouseName = found ? found.name : ''
} }
......
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