Commit 944fc8cd by wuqian

Merge branch 'dev'

parents 6c6bdec2 b5a0d179
......@@ -10,7 +10,13 @@ import {
} from '@/types/api/podUsOrder'
import axios from './axios'
import { PodMakeOrderData } from '@/types/api/podMakeOrder'
export interface LogisticsData {
logisticsWayName: string; // 物流名称
warehouseName: string; // 发货仓库
status: boolean;
logisticsWayCode: string; // 物流编码
partition: string; // 所在分区
}
export function getOrderTabData() {
return axios.get<never, BaseRespData<Tab[]>>(
'/factory/podJomallOrderUs/findStateGroupList',
......@@ -44,11 +50,13 @@ export function getCardOrderList(
},
)
}
export function confirmOrderApi(data: number[], productionClient: string) {
export function confirmOrderApi(data: number[], productionClient: string,type:string,logisticsTrialCalculation?:LogisticsData) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderUs/confirmOrders',
{
ids: data.join(','),
type,
logisticsTrialCalculation,
productionClient,
},
)
......@@ -226,6 +234,13 @@ export function updateRemarkApi(id: number, content: string) {
{ id, content },
)
}
export function getLogisticsCalculation(id: number) {
return axios.get<never, BaseRespData<never>>(
'factory/podJomallOrderUs/getLogisticsCalculation',
{ params:{id} },
)
}
export function loadWarehouseListApi() {
return axios.get<never, BaseRespData<WarehouseListData[]>>(
'factoryWarehouseInfo/getAll',
......
......@@ -8,6 +8,7 @@ import {
InterskuList,
InterWarehouseList,
ILocation,
AnyObject,
} from '@/types/api/warehouse'
export interface LogListData {
createTime: string
......@@ -350,7 +351,9 @@ export function exportOrder(ids: number[], status: string | number) {
{ ids: ids, status },
)
}
export function updateInRecordApi(form: InterWarehouseDetail) {
export function updateInRecordApi(
form: InterWarehouseDetail | AnyObject | null,
) {
return axios.post<never, BaseRespData<never>>(
'factory/warehouseInRecord/update',
{
......@@ -368,7 +371,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[]>>(
'customProductItem/getBySku',
{
......@@ -380,7 +383,7 @@ export function getBySkuApi(warehouseId: number | string, sku: string | null) {
)
}
export function getByWareHouseIdAndCodeApi(
wareHouseId: number | string | undefined,
wareHouseId: number | null | undefined,
code: string | null,
) {
return axios.get<never, BaseRespData<ILocation[]>>(
......
......@@ -27,7 +27,7 @@ import WarehouseManage from '@/views/warehouse/manage.vue'
import WarehouseWarning from '@/views/warehouse/warning.vue'
import WarehousePosition from '@/views/warehouse/position.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({
history: createWebHistory(),
routes: [
......@@ -134,13 +134,13 @@ const router = createRouter({
},
component: receiptDoc,
},
{
path: '/warehouse/issue-doc',
meta: {
title: '出库单',
},
component: issueDoc,
},
// {
// path: '/warehouse/issue-doc',
// meta: {
// title: '出库单',
// },
// component: issueDoc,
// },
{
path: '/warehouse/warning',
meta: {
......
......@@ -31,11 +31,11 @@ const menu: MenuItem[] = [
id: 123,
label: '入库单',
},
{
index: '/warehouse/issue-doc',
id: 124,
label: '出库单',
},
// {
// index: '/warehouse/issue-doc',
// id: 124,
// label: '出库单',
// },
{
index: '/warehouse/manage',
......
export type AnyObject = {
[propName: string]: string | number | boolean | undefined | unknown
}
export interface warehouseSearchForm {
billStatus?: string
batchNumber?: string
......@@ -5,7 +8,7 @@ export interface warehouseSearchForm {
createTimeStart?: string
orderNumber?: string
sku?: string
warehouseId?: number
warehouseId?: number | null
id?: number
}
export interface InterProductList {
......@@ -29,8 +32,8 @@ export interface InterWarehouseBase {
id?: number
factoryId?: number
factoryCode?: string
warehouseId?: number | string
warehouseName?: string
warehouseId?: number | null
warehouseName?: string | null
inNo?: string
shipmentNumber?: string
skuAmount?: number
......
// 允许通用对象类型
export type AnyObject = { [key: string]: unknown }
export type AnyObject = {
[propName: string]: string | number | boolean | undefined | unknown
}
type IdType = string | number
function itemIsArray(obj: AnyObject): boolean {
......@@ -16,40 +16,50 @@ function isChange(arr: AnyObject[], arr1: AnyObject[]): boolean {
if (!arr1) return true
if (arr.length !== arr1.length) return true
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
}
return false
}
/**
* 更新参数处理 只提交更新的
* @param {UpdateParams} newParams 新的数据
* @param {UpdateParams} oldParams 旧的数据
* @param {string} id 数组唯一值
* @param {Record<string, string>} other 其他属性
* @param {boolean} bool 是否为布尔值
*/
export function checkUpdateParams(
newParams: AnyObject,
oldParams: AnyObject,
id: string = 'id',
other: Record<string, string> = {},
bool: boolean = false
bool: boolean = false,
): AnyObject | null {
oldParams = JSON.parse(JSON.stringify(oldParams))
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 = {
id: (newParams as { id?: unknown }).id
[id]: newParams[id],
}
for (const key in newParams) {
if (typeof newParams[key] === 'object') {
if (Array.isArray(newParams[key])) {
const arr: AnyObject[] = newParams[key] as AnyObject[]
const arr1: AnyObject[] = (oldParams[key] as AnyObject[]) || []
const arr = newParams[key] as AnyObject[]
const arr1 = (oldParams[key] as AnyObject[]) || []
const addList: AnyObject[] = []
const updateList: AnyObject[] = []
let removeList: IdType[] = []
const list: AnyObject[] = []
const keyname: string = other[key] || id
const keyname = other[key] || id
for (const iterator of arr) {
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)
if (index !== -1) {
const item = arr1[index]
......@@ -57,7 +67,12 @@ export function checkUpdateParams(
for (const key1 in iterator) {
if (key1 === keyname) continue
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]
}
} else if (iterator[key1] !== item[key1]) {
......@@ -69,13 +84,13 @@ export function checkUpdateParams(
list.push({
[keyname]: iterator[keyname],
...obj,
id: item.id
id: item.id,
})
} else {
updateList.push({
[keyname]: iterator[keyname],
...obj,
id: item.id
id: item.id,
})
}
}
......@@ -88,20 +103,20 @@ export function checkUpdateParams(
}
}
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')
params[key_name] = {}
if (addList.length > 0) {
(params[key_name] as AnyObject).addList = addList
;(params[key_name] as AnyObject).addList = addList
}
if (updateList.length > 0) {
(params[key_name] as AnyObject).updateList = updateList
;(params[key_name] as AnyObject).updateList = updateList
}
if (removeList.length > 0) {
(params[key_name] as AnyObject).removeList = removeList
;(params[key_name] as AnyObject).removeList = removeList
}
if (list.length > 0) {
params[key_name] = list
......@@ -112,13 +127,11 @@ export function checkUpdateParams(
}
} else {
// 基础信息
// if (newParams[key] !== oldParams[key]) {
params[key] = newParams[key]
// }
}
}
if (Object.keys(params).length === 1) {
return null
}
return params
}
\ No newline at end of file
}
......@@ -224,8 +224,10 @@
{{ item.baseSku }}
</span>
<el-icon class="icon" @click="copy(item.baseSku || '')"
><DocumentCopy
/></el-icon>
>
<DocumentCopy
/>
</el-icon>
</div>
<div class="goods-item-info-item">
<span class="goods-item-info-item-label">变体SKU:</span>
......@@ -233,8 +235,10 @@
{{ item.variantSku }}
</span>
<el-icon class="icon" @click="copy(item.variantSku || '')"
><DocumentCopy
/></el-icon>
>
<DocumentCopy
/>
</el-icon>
</div>
<div class="goods-item-info-item">
<span class="goods-item-info-item-label">工艺:</span>
......@@ -255,8 +259,10 @@
class="icon"
style="color: #e6a23c"
@click="handleUpdateRemark(item)"
><EditPen
/></el-icon>
>
<EditPen
/>
</el-icon>
</div>
</div>
<div class="goods-item-info">
......@@ -271,12 +277,14 @@
<el-icon
class="icon"
@click="copy(item.factorySubOrderNumber || '')"
><DocumentCopy
/></el-icon>
>
<DocumentCopy
/>
</el-icon>
</div>
<div class="goods-item-info-item">
<span class="goods-item-info-item-label"
>第三方生产单号:</span
>第三方生产单号:</span
>
<span
class="goods-item-info-item-value"
......@@ -287,8 +295,10 @@
<el-icon
class="icon"
@click="copy(item.thirdSubOrderNumber || '')"
><DocumentCopy
/></el-icon>
>
<DocumentCopy
/>
</el-icon>
</div>
<div class="goods-item-info-item">
<span class="goods-item-info-item-label">工厂:</span>
......@@ -331,19 +341,19 @@
<div class="goods-item-info-item">
<span class="goods-item-info-item-label">{{
status === 'TO_BE_CONFIRMED'
? '未生产数量:'
: status === 'EXCEPTION_ORDER'
? '数量:'
: '已生产数量:'
}}</span>
status === 'TO_BE_CONFIRMED'
? '未生产数量:'
: status === 'EXCEPTION_ORDER'
? '数量:'
: '已生产数量:'
}}</span>
<span class="goods-item-info-item-value">
{{
status === 'TO_BE_CONFIRMED'
? item.notPassNum
: status === 'EXCEPTION_ORDER'
? item.num
: item.passNum
? item.num
: item.passNum
}}
</span>
</div>
......@@ -365,8 +375,10 @@
<el-icon
class="icon"
@click="copy(row.factoryOrderNumber || '')"
><DocumentCopy
/></el-icon>
>
<DocumentCopy
/>
</el-icon>
</div>
<div class="order-detail-item">
<span class="order-detail-item-label">第三方订单号:</span>
......@@ -377,8 +389,10 @@
{{ row.thirdOrderNumber }}
</span>
<el-icon class="icon" @click="copy(row.thirdOrderNumber || '')"
><DocumentCopy
/></el-icon>
>
<DocumentCopy
/>
</el-icon>
</div>
<div class="order-detail-item">
<span class="order-detail-item-label">店铺单号:</span>
......@@ -386,8 +400,10 @@
{{ row.shopNumber }}
</span>
<el-icon class="icon" @click="copy(row.shopNumber || '')"
><DocumentCopy
/></el-icon>
>
<DocumentCopy
/>
</el-icon>
</div>
<div class="order-detail-item">
<span class="order-detail-item-label">收货人:</span>
......@@ -483,6 +499,13 @@
<ElButton
link
type="primary"
@click="confirm(row)"
>
确认
</ElButton>
<ElButton
link
type="primary"
@click="operationLog(row.id, null)"
>
操作日志
......@@ -562,7 +585,7 @@
<div class="grid-container">
<div class="grid-item" title="商品名称">
<span class="grid-item-value"
>{{ cardItem?.productName }}
>{{ cardItem?.productName }}
</span>
</div>
<div class="grid-item" title="未生产数量">
......@@ -630,7 +653,46 @@
</div>
</div>
<right-menu ref="rightMenuRef" @change="rightChange" />
<el-dialog v-model="confirmDialogShow" :close-on-click-modal="false" title="确认">
<div class="production-client" style="margin-bottom:10px;display: flex;align-items: center;gap: 8px">
<label style="white-space: nowrap;" for="">生产端:</label>
<ElSelect
v-model="productionClientValue"
clearable
placeholder="请选择生产端"
>
<ElOption
v-for="(item, index) in productionClient"
:key="index"
:value="item.code"
:label="`${item.remark}(${item.code})`"
></ElOption>
</ElSelect>
</div>
<el-table @selection-change="selectionChange" height="400px" :data="confirmData" border>
<el-table-column label="" width="60" align="center" type="selection"></el-table-column>
<el-table-column label="序号" width="60" align="center" type="index"></el-table-column>
<el-table-column label="物流名称" align="center" prop="logisticsWayName"></el-table-column>
<el-table-column label="发货仓库" align="center" prop="warehouseName"></el-table-column>
<el-table-column label="物流编码" align="center" prop="logisticsWayCode"></el-table-column>
<el-table-column label="所在分区" align="center" prop="partition"></el-table-column>
<el-table-column label="状态" align="center">
<template #default="{row}">
<b v-if="row.status" style="color: green">成功</b>
<b v-else-if="!row.status" style="color: red">失败</b>
</template>
</el-table-column>
<el-table-column label="预计运费($)" align="center" prop="payFreight">
<!-- <template #default="{row}">-->
<!-- {{row.payFreight || '0.00'}}-->
<!-- </template>-->
</el-table-column>
</el-table>
<template #footer>
<el-button @click="confirmDialogShow=false">取消</el-button>
<el-button type="primary" @click="handleConfirm">确定</el-button>
</template>
</el-dialog>
<el-dialog
v-model="logVisible"
title="操作日志"
......@@ -660,7 +722,18 @@
width="600px"
:close-on-click-modal="false"
>
<div class="production-client">
<template #header>
<div class="dialog-header">
<span style="margin-right: 8px;font-size: 18px">确认</span>
<el-tooltip content="默认最低运费分派">
<el-icon color="red">
<WarningFilled />
</el-icon>
</el-tooltip>
</div>
</template>
<div class="production-client" style="display: flex;align-items: center;gap: 8px">
<label style="white-space: nowrap;" for="">生产端:</label>
<ElSelect
v-model="productionClientValue"
clearable
......@@ -684,6 +757,7 @@
</template>
<script setup lang="ts">
import { getUserMarkList } from '@/api/common'
import { WarningFilled } from '@element-plus/icons-vue'
import {
getCardOrderList,
getOrderList,
......@@ -702,7 +776,7 @@ import {
printPrintOrderApi,
stockOutCheckApi,
toBeConfirmedApi,
loadWarehouseListApi,
loadWarehouseListApi, getLogisticsCalculation, LogisticsData,
} from '@/api/podUsOrder'
import TableView from '@/components/TableView.vue'
import {
......@@ -727,20 +801,26 @@ import PodMakeOrder from './PodMakeOrder.vue'
import { OrderData } from '@/types/api/podMakeOrder'
import useLodop, { LODOPObject } from '@/utils/hooks/useLodop'
import dayjs from 'dayjs'
declare global {
interface Window {
ActiveXObject: {
new (type: string): XMLHttpRequest
new(type: string): XMLHttpRequest
}
VBS_BinaryToArray: {
(data: unknown): { toArray(): number[] }
}
}
interface XMLHttpRequest {
responseBody?: unknown
}
}
const tabsNav = ref<Tab[]>()
const confirmDialogShow = ref(false)
const confirmData = ref([])
const confirmSelectionData = ref<LogisticsData[]>([])
const confirmRowData = ref<ProductList | null>(null)
const status = ref('TO_BE_CONFIRMED')
const detailData = ref({})
const [searchForm] = useValue<SearchForm>({
......@@ -970,6 +1050,36 @@ const {
}
},
})
const confirm = async (row: ProductList) => {
confirmDialogShow.value = true
productionClientValue.value = ''
confirmRowData.value = row
confirmData.value = []
confirmSelectionData.value = []
const { data } = await getLogisticsCalculation(row.id)
confirmData.value = data
}
const selectionChange = (data:LogisticsData[]) => {
confirmSelectionData.value = data
}
const handleConfirm = async () => {
if (!productionClientValue.value) {
return ElMessage.warning('请选择生产端')
}
if (confirmSelectionData.value.length!==1) {
return ElMessage.warning('请选择一条物流方式')
}
if(confirmSelectionData.value.some(el=>!el.status)){
return ElMessage.warning('请选择状态为成功的物流方式')
}
const id = confirmRowData.value?.id
const res = await confirmOrderApi([Number(id)], productionClientValue.value, 'customize',confirmSelectionData.value[0])
if (res.code !== 200) return
ElMessage.success('操作成功')
confirmDialogShow.value = false
search()
loadTabData()
}
const copy = (text: string) => {
navigator.clipboard.writeText(text)
ElMessage.success('复制成功')
......@@ -1028,7 +1138,7 @@ const submit = async () => {
const submitConfirm = async () => {
const ids = selection.value.map((item) => item.id)
try {
const res = await confirmOrderApi(ids, productionClientValue.value)
const res = await confirmOrderApi(ids, productionClientValue.value, 'minimumCost')
if (res.code !== 200) return
ElMessage.success('操作成功')
productionClientVisible.value = false
......@@ -1568,6 +1678,7 @@ onMounted(() => {
margin-bottom: 10px;
}
}
.tabs {
display: flex;
align-items: center;
......@@ -1593,6 +1704,7 @@ onMounted(() => {
font-weight: 600;
}
}
.goods-item {
display: grid;
grid-template-columns: 100px 1fr minmax(180px, 1fr) 140px;
......@@ -1601,16 +1713,19 @@ onMounted(() => {
.goods-item-img {
width: 100px;
height: 100px;
img {
width: 100%;
}
}
&:not(:last-child) {
padding-bottom: 10px;
margin-bottom: 10px;
border-bottom: 1px solid #eee;
}
}
.goods-item-info-item {
display: flex;
align-items: center;
......@@ -1623,6 +1738,7 @@ onMounted(() => {
white-space: nowrap;
}
}
.order-detail-item {
display: flex;
align-items: center;
......@@ -1635,6 +1751,7 @@ onMounted(() => {
white-space: nowrap;
}
}
.card-list {
display: grid;
grid-template-columns: repeat(6, 1fr);
......@@ -1643,6 +1760,7 @@ onMounted(() => {
height: 100%;
overflow-y: auto;
}
.empty {
height: 100%;
display: flex;
......@@ -1650,17 +1768,21 @@ onMounted(() => {
justify-content: center;
color: #999;
}
.card-list-item {
cursor: pointer;
}
.images-position {
display: flex;
gap: 5px;
.item-image {
cursor: pointer;
border: 1px solid #eee;
}
}
.grid-container {
display: grid;
grid-template-columns: repeat(2, 1fr);
......@@ -1668,6 +1790,7 @@ onMounted(() => {
font-size: 12px;
margin-top: 10px;
}
.factory-sub-order-number {
font-size: 12px;
}
......
......@@ -125,10 +125,10 @@
>
删除
</el-button>
<el-button type="success" @click="handleExport"> 导出 </el-button>
<!-- <el-button type="success" @click="handleExport"> 导出 </el-button>
<el-button type="primary" @click="printProductTag">
打印商品SKU标签
</el-button>
</el-button> -->
<el-button
v-if="nodeCode === 'PENDING_AUDIT'"
type="warning"
......@@ -481,6 +481,7 @@
clearable
placeholder="请选择仓库"
style="width: 160px"
@change="handleWarehouseChange(editForm.warehouseId)"
>
<ElOption
v-for="item in warehouseList"
......@@ -565,8 +566,7 @@
<!-- +后有就正常展示,没有则通过搜索接口自己添加 -->
<!-- remote
:remote-method="(query) => handleLocationSearch(query, row)"
:loading="locationLoading"
@change="(val) => handleLocationChange(val, row)" -->
:loading="locationLoading"-->
<span v-if="row.loacationCode">{{ row.loacationCode }}</span>
<ElSelect
v-else
......@@ -797,7 +797,7 @@ import { CirclePlusFilled } from '@element-plus/icons-vue'
import splitDiv from '@/components/splitDiv/splitDiv.vue'
import { ElTable } from 'element-plus'
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 {
getInRecordStatusTree,
......@@ -990,6 +990,7 @@ const {
pageSize,
).then((res) => res.data) as never,
})
const setCostPrice = (item: InterProductList) => {
if (!item.costPrice) {
ElMessage.warning('商品成本价为空,请完善商品成本价')
......@@ -1015,15 +1016,15 @@ const getTreeNum = async () => {
}
}
const showPrintDialog = ref(false)
const printProductTag = async () => {
if (!selections.value.length) {
return ElMessage.warning('请选择要删除的数据')
}
showPrintDialog.value = true
// selections.value.forEach((el:InterWarehousePage) => {
// el.number = ''
// })
}
// const printProductTag = async () => {
// if (!selections.value.length) {
// return ElMessage.warning('请选择要操作的数据')
// }
// showPrintDialog.value = true
// selections.value.forEach((el:InterWarehousePage) => {
// el.number = ''
// })
// }
async function handlePrintProductTag() {
// const flag = selections.value.every((el:InterWarehousePage) => el.number && el.number != '0')
// if (!flag) {
......@@ -1088,11 +1089,9 @@ const exportForm = ref({
delivery: false,
resource: '',
})
const handleExport = () => {
exportVisible.value = true
// exportForm.value.delivery = false
// exportForm.value.resource = ''
}
// const handleExport = () => {
// exportVisible.value = true
// }
const submitExportForm = () => {
// if (exportForm.value.resource === '') {
// return ElMessage.error('请选择导出类型')
......@@ -1270,7 +1269,8 @@ const tabsClick = async () => {
}
const [editForm, resetEditForm] = useValue<InterWarehouseDetail>({
inNo: '',
warehouseId: '',
warehouseId: null,
warehouseName: '',
remark: '',
factoryCode: '',
factoryId: 0,
......@@ -1310,7 +1310,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => {
const getProduct = async (id: number | undefined) => {
try {
const res = await getWarehouseInRecordDetailApi(id)
editForm2.value = res.data
editForm.value = JSON.parse(JSON.stringify(res.data))
otherPurchaseData.value = res.data?.productList || []
} catch (e) {
console.error(e)
......@@ -1349,7 +1349,7 @@ const auditOrder = (key: string) => {
}
const confimText =
key === 'audit'
? '确定进行审核?点“确定”将会直接更改库存数量,请在审核前确认数量是否正确。'
? '确定进行审核?点"确定"将会直接更改库存数量,请在审核前确认数量是否正确。'
: `确定对选中的信息进行${text}?`
ElMessageBox.confirm(confimText, '重要提示', {
confirmButtonText: '确定',
......@@ -1413,7 +1413,7 @@ watch(
watch(
() => editForm.value.warehouseId,
(newVal: number | string | undefined) => {
(newVal: number | null | undefined) => {
if (newVal) {
fetchLocationList('')
}
......@@ -1512,13 +1512,17 @@ const addSection = async () => {
}
const upSection = async () => {
const params = { ...editForm.value }
params.productList = otherPurchaseData.value
// const result = checkUpdateParams(params, editForm2.value, '', {
// productList: 'value',
// })
// console.log(result, params, editForm2.value)
// params.productList = otherPurchaseData.value
const result = checkUpdateParams(
{ ...params, productList: otherPurchaseData.value },
editForm.value as unknown as AnyObject,
'id',
{
productList: 'warehouseSku',
},
)
try {
await updateInRecordApi(params)
await updateInRecordApi(result)
newDialogVisible.value = false
ElMessage.success('修改成功')
search()
......@@ -1592,6 +1596,7 @@ const fetchLocationList = async (query: string) => {
// locationList.value = []
// return
// }
if (!editForm.value.warehouseId) return
locationLoading.value = true
try {
const res = await getByWareHouseIdAndCodeApi(
......@@ -1619,6 +1624,12 @@ const handleLocationChange = (val: number, row: InterProductList) => {
)
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(() => {
getTreeNum()
getWarehouseList()
......
......@@ -125,10 +125,10 @@
>
删除
</el-button>
<el-button type="success" @click="handleExport"> 导出 </el-button>
<!-- <el-button type="success" @click="handleExport"> 导出 </el-button>
<el-button type="primary" @click="printProductTag">
打印商品SKU标签
</el-button>
</el-button> -->
<el-button
v-if="nodeCode === 'PENDING_AUDIT'"
type="warning"
......@@ -481,6 +481,7 @@
clearable
placeholder="请选择仓库"
style="width: 160px"
@change="handleWarehouseChange(editForm.warehouseId)"
>
<ElOption
v-for="item in warehouseList"
......@@ -565,8 +566,7 @@
<!-- +后有就正常展示,没有则通过搜索接口自己添加 -->
<!-- remote
:remote-method="(query) => handleLocationSearch(query, row)"
:loading="locationLoading"
@change="(val) => handleLocationChange(val, row)" -->
:loading="locationLoading"-->
<span v-if="row.loacationCode">{{ row.loacationCode }}</span>
<ElSelect
v-else
......@@ -797,7 +797,7 @@ import { CirclePlusFilled } from '@element-plus/icons-vue'
import splitDiv from '@/components/splitDiv/splitDiv.vue'
import { ElTable } from 'element-plus'
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 {
getInRecordStatusTree,
......@@ -990,6 +990,7 @@ const {
pageSize,
).then((res) => res.data) as never,
})
const setCostPrice = (item: InterProductList) => {
if (!item.costPrice) {
ElMessage.warning('商品成本价为空,请完善商品成本价')
......@@ -1015,15 +1016,15 @@ const getTreeNum = async () => {
}
}
const showPrintDialog = ref(false)
const printProductTag = async () => {
if (!selections.value.length) {
return ElMessage.warning('请选择要删除的数据')
}
showPrintDialog.value = true
// selections.value.forEach((el:InterWarehousePage) => {
// el.number = ''
// })
}
// const printProductTag = async () => {
// if (!selections.value.length) {
// return ElMessage.warning('请选择要操作的数据')
// }
// showPrintDialog.value = true
// selections.value.forEach((el:InterWarehousePage) => {
// el.number = ''
// })
// }
async function handlePrintProductTag() {
// const flag = selections.value.every((el:InterWarehousePage) => el.number && el.number != '0')
// if (!flag) {
......@@ -1088,11 +1089,9 @@ const exportForm = ref({
delivery: false,
resource: '',
})
const handleExport = () => {
exportVisible.value = true
// exportForm.value.delivery = false
// exportForm.value.resource = ''
}
// const handleExport = () => {
// exportVisible.value = true
// }
const submitExportForm = () => {
// if (exportForm.value.resource === '') {
// return ElMessage.error('请选择导出类型')
......@@ -1270,7 +1269,8 @@ const tabsClick = async () => {
}
const [editForm, resetEditForm] = useValue<InterWarehouseDetail>({
inNo: '',
warehouseId: '',
warehouseId: null,
warehouseName: '',
remark: '',
factoryCode: '',
factoryId: 0,
......@@ -1310,7 +1310,7 @@ const addDialog = async (i: number, v: InterWarehousePage | null) => {
const getProduct = async (id: number | undefined) => {
try {
const res = await getWarehouseInRecordDetailApi(id)
editForm2.value = res.data
editForm.value = JSON.parse(JSON.stringify(res.data))
otherPurchaseData.value = res.data?.productList || []
} catch (e) {
console.error(e)
......@@ -1349,7 +1349,7 @@ const auditOrder = (key: string) => {
}
const confimText =
key === 'audit'
? '确定进行审核?点“确定”将会直接更改库存数量,请在审核前确认数量是否正确。'
? '确定进行审核?点"确定"将会直接更改库存数量,请在审核前确认数量是否正确。'
: `确定对选中的信息进行${text}?`
ElMessageBox.confirm(confimText, '重要提示', {
confirmButtonText: '确定',
......@@ -1413,7 +1413,7 @@ watch(
watch(
() => editForm.value.warehouseId,
(newVal: number | string | undefined) => {
(newVal: number | null | undefined) => {
if (newVal) {
fetchLocationList('')
}
......@@ -1512,13 +1512,17 @@ const addSection = async () => {
}
const upSection = async () => {
const params = { ...editForm.value }
params.productList = otherPurchaseData.value
// const result = checkUpdateParams(params, editForm2.value, '', {
// productList: 'value',
// })
// console.log(result, params, editForm2.value)
// params.productList = otherPurchaseData.value
const result = checkUpdateParams(
{ ...params, productList: otherPurchaseData.value },
editForm.value as unknown as AnyObject,
'id',
{
productList: 'warehouseSku',
},
)
try {
await updateInRecordApi(params)
await updateInRecordApi(result)
newDialogVisible.value = false
ElMessage.success('修改成功')
search()
......@@ -1592,6 +1596,7 @@ const fetchLocationList = async (query: string) => {
// locationList.value = []
// return
// }
if (!editForm.value.warehouseId) return
locationLoading.value = true
try {
const res = await getByWareHouseIdAndCodeApi(
......@@ -1619,6 +1624,12 @@ const handleLocationChange = (val: number, row: InterProductList) => {
)
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(() => {
getTreeNum()
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