Commit 2d1979df by linjinhong

Merge remote-tracking branch 'origin/master' into linjinhong

parents 29e68692 84eb78ce
......@@ -8,10 +8,16 @@ import {
ProductionClient,
WarehouseListData,
LogisticsData,
ExportParams
} from '@/types/api/podUsOrder'
import axios from './axios'
import { PodMakeOrderData } from '@/types/api/podMakeOrder'
export function exportPodUSInfo(data: ExportParams) {
return axios.post<never, BasePaginationData<never>>(
'factory/podJomallOrderUs/exportPodUsOrder',
data,
)
}
// 同步收货地址
export function syncReceiverAddress(data: number[]) {
return axios.post<never, BaseRespData<never>>(
......
......@@ -64,6 +64,14 @@ export interface factoryLocation {
locationId?: string
idList?: string | number[]
}
export interface productNo {
productNo?: string
idList?: string | number[]
}
export interface customSku {
customSku?: string
idList?: string | number[]
}
export interface ExportFactoryWarehouseInfo {
pageSize?: number
currentPage?: number
......@@ -124,6 +132,8 @@ export interface WarehouseWarning {
number: string
locationName: string
warehouseId: string | number
customSku?: string
productNo?: string
}
export interface positionInfo {
......@@ -182,12 +192,28 @@ export function getFactoryLocation(data: factoryWarehouseInfo) {
data,
)
}
// 修改库位
export function updateLocationApi(data: factoryLocation) {
return axios.post<never, BasePaginationData<never>>(
'factoryWarehouseInventory/updateLocation',
data,
)
}
// 修改款号
export function updateProductNoApi(data: productNo) {
return axios.post<never, BasePaginationData<never>>(
'factoryWarehouseInventory/updateProductNo',
data,
)
}
// 修改自定义sku
export function updateCustomSkuApi(data: customSku) {
return axios.post<never, BasePaginationData<never>>(
'factoryWarehouseInventory/updateCustomSku',
data,
)
}
export function exportWarehouseInfo(data: ExportFactoryWarehouseInfo) {
return axios.post<never, BasePaginationData<positionInfo>>(
'factoryWarehouseInventory/inventory',
......
......@@ -3,30 +3,34 @@ export interface Tab {
statusName?: string
quantity?: number
}
export interface ExportParams extends SearchForm {
idList?: number[]
exportAll: boolean
}
export interface SearchForm {
timeType: number | null
shopNumber: string
shipmentType: string
userMark: string
processNumber: string
baseSku: string
factoryOrderNumber: string
sku: string
factorySubOrderNumber: string
status: string
customizedQuantity: string
multi: boolean | null
startTime: string | null
endTime: string | null
exceptionHandling: number | undefined
platform: string
productionClient: string
warehouseId: string | number
thirdSkuCode: string
supplierProductNo: string
batchArrangeNumber: string
craftCode: string
thirdStockSku: string
timeType?: number | null
shopNumber?: string
shipmentType?: string
userMark?: string
processNumber?: string
baseSku?: string
factoryOrderNumber?: string
sku?: string
factorySubOrderNumber?: string
status?: string
customizedQuantity?: string
multi?: boolean | null
startTime?: string | null
endTime?: string | null
exceptionHandling?: number | undefined
platform?: string
productionClient?: string
warehouseId?: string | number
thirdSkuCode?: string
supplierProductNo?: string
batchArrangeNumber?: string
craftCode?: string
thirdStockSku?: string
}
export interface PodUsOrderListData {
id: number
......
......@@ -470,6 +470,14 @@
刷新素材
</ElButton>
</span>
<span v-if="status === 'COMPLETE'" class="item">
<ElButton
:loading="exportLoading"
type="success"
@click="exportData"
>导出</ElButton
>
</span>
</ElFormItem>
</ElForm>
</div>
......@@ -1803,9 +1811,33 @@
<el-button type="primary" @click="logisticsSubmit"> 确定</el-button>
</template>
</el-dialog>
<!-- 导出 -->
<ElDialog
v-model="exportVisible"
title="导出选项"
width="500px"
:close-on-click-modal="false"
>
<el-form :model="exportForm" label-width="80px">
<el-form-item label="" prop="resource">
<el-radio-group v-model="exportForm.resource">
<el-radio :label="0">导出本页</el-radio>
<el-radio :label="1">导出选中</el-radio>
<el-radio :label="2">全部</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="exportVisible = false">取消</el-button>
<el-button type="primary" @click="submitExportForm">确认</el-button>
</span>
</template>
</ElDialog>
</template>
<script setup lang="ts">
import { getUserMarkList } from '@/api/common'
// import { AnyObject } from '@/types/api/warehouse'
import {
ArrowDown,
CaretBottom,
......@@ -1861,6 +1893,7 @@ import {
batchDownloadDeleteApi,
batchDownloadRecomposingApi,
updateToWaitShipmentApi,
exportPodUSInfo,
} from '@/api/podUsOrder'
import { BaseRespData } from '@/types/api'
......@@ -1882,6 +1915,7 @@ import {
LogisticsData,
LogisticsFormData,
CraftListData,
ExportParams,
} from '@/types/api/podUsOrder'
import usePageList from '@/utils/hooks/usePageList'
import { useValue } from '@/utils/hooks/useValue'
......@@ -1928,7 +1962,54 @@ const currentRow = ref<AddressInfo>({
receiverAddress2: '',
receiverPostCode: '',
})
const exportLoading = ref(false)
const exportVisible = ref(false)
const exportForm = ref({
resource: '',
})
const exportData = () => {
exportVisible.value = true
}
const submitExportForm = async () => {
if (exportForm.value.resource === '') {
return ElMessage.error('请选择导出类型')
}
exportLoading.value = true
const resourceType = Number(exportForm.value.resource)
const params: ExportParams = {
exportAll: false,
idList: [],
}
// 使用函数封装映射逻辑
const mapIds = (items: PodUsOrderListData[]) =>
items.map((el) => Number(el.id))
switch (resourceType) {
case 0:
params.idList = mapIds(tableData.value as PodUsOrderListData[])
break
case 1:
params.idList = mapIds(selection.value)
break
case 2:
params.exportAll = true
params.idList = undefined
break
default:
console.error('未知的资源类型:', resourceType)
}
try {
const res = await exportPodUSInfo({
...params,
...(resourceType === 2 ? searchForm.value : {}),
})
window.open(filePath + res.message, '_blank')
exportVisible.value = false
exportLoading.value = false
} catch (e) {
exportVisible.value = false
exportLoading.value = false
}
}
const updateAddVisible = ref(false)
const initPageSize = ref(50)
const logisticsVisible = ref(false)
......
......@@ -4,6 +4,8 @@ import {
warehouseInfo,
warehouseInfoGetAll,
updateLocationApi,
updateProductNoApi,
updateCustomSkuApi,
LocationInfoGetAll,
getWarehouseInventoryInfo,
factoryLogWarehouseLog,
......@@ -11,7 +13,7 @@ import {
WarehouseWarning,
factoryWarehouseInventoryPrint,
exportWarehouseInfo,
loactionData
loactionData,
} from '@/api/warehouse.ts'
import { AnyObject } from '@/types/api/warehouse'
import { ref, computed } from 'vue'
......@@ -50,6 +52,10 @@ const isSameWarehouse = computed(() => {
)
})
const modifyLocationDialog = ref(false)
const modifyProductNoDialog = ref(false)
const modifyCustomSkuDialog = ref(false)
/** 修改库位 */
const locationForm = ref({
warehouseId: '',
})
......@@ -76,6 +82,83 @@ const modifyStorageLocation = async () => {
const { data } = await LocationInfoGetAll(selections.value[0]?.warehouseId)
LocationList.value = data
}
/** 修改款号 */
const productNoForm = ref({
productNo: '',
})
const productNoRules = {
productNo: [{ required: true, message: '款号不能为空', trigger: 'change' }],
}
const productNoFormRef = ref()
const modifyProductNo = async () => {
productNoForm.value.productNo = ''
productNoFormRef.value?.resetFields()
modifyProductNoDialog.value = true
}
const submitProductNoForm = async () => {
productNoFormRef.value?.validate(async (valid: boolean) => {
if (!valid) return
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
const idList = selections.value.map((el: WarehouseWarning) => Number(el.id))
await updateProductNoApi({
idList: idList,
productNo: productNoForm.value.productNo,
})
.then(() => {
modifyProductNoDialog.value = false
ElMessage.success('修改成功')
getData()
})
.finally(() => {
loading.close()
})
})
}
/** 修改自定义SKU */
const customSkuForm = ref({
customSku: '',
})
const customSkuRules = {
customSku: [
{ required: true, message: '自定义SKU不能为空', trigger: 'change' },
],
}
const customSkuFormRef = ref()
const modifyCustomSku = async () => {
customSkuForm.value.customSku = selections.value[0].customSku || ''
customSkuFormRef.value?.resetFields()
modifyCustomSkuDialog.value = true
}
const submitCustomSkuForm = async () => {
customSkuFormRef.value?.validate(async (valid: boolean) => {
if (!valid) return
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
const idList = selections.value.map((el: WarehouseWarning) => Number(el.id))
updateCustomSkuApi({
idList: idList,
customSku: customSkuForm.value.customSku,
})
.then(() => {
modifyCustomSkuDialog.value = false
ElMessage.success('修改成功')
getData()
})
.finally(() => {
loading.close()
})
})
}
const showPrintDialog = ref(false)
const exportLoading = ref(false)
const clickItem = (row: WarehouseWarning) => {
......@@ -372,6 +455,22 @@ getWarehouse()
>修改库位</el-button
>
</el-form-item>
<el-form-item style="margin-top: 5px">
<el-button
type="warning"
:disabled="!selections.length"
@click="modifyProductNo"
>修改款号
</el-button>
</el-form-item>
<el-form-item style="margin-top: 5px">
<el-button
type="warning"
:disabled="selections.length !== 1"
@click="modifyCustomSku"
>修改自定义sku</el-button
>
</el-form-item>
</el-form>
</el-card>
</template>
......@@ -401,7 +500,7 @@ getWarehouse()
align="center"
prop="warehouseName"
label="图片"
width="100"
width="80"
>
<template #default="scope">
<el-image
......@@ -416,31 +515,37 @@ getWarehouse()
align="center"
prop="warehouseName"
label="仓库名称"
width="180"
width="140"
></el-table-column>
<el-table-column
align="center"
prop="locationCode"
label="库位"
width="160"
width="100"
></el-table-column>
<el-table-column
align="center"
prop="warehouseSku"
label="库存SKU"
width="180"
min-width="180"
></el-table-column>
<el-table-column
align="center"
prop="customSku"
label="自定义SKU"
min-width="180"
></el-table-column>
<el-table-column
align="center"
prop="skuName"
label="商品名称"
width="250"
min-width="230"
></el-table-column>
<el-table-column
align="center"
prop="productNo"
label="款号"
width="150"
width="180"
></el-table-column>
<el-table-column
align="center"
......@@ -451,32 +556,32 @@ getWarehouse()
<el-table-column
align="center"
prop="price"
label="商品成本价()"
width="160"
label="商品成本价($)"
width="140"
></el-table-column>
<el-table-column
align="center"
prop="usableInventory"
label="可用数量"
width="120"
width="90"
></el-table-column>
<el-table-column
align="center"
prop="inventory"
label="库存数量"
width="120"
width="90"
></el-table-column>
<el-table-column
align="center"
prop="occupyInventory"
label="占用数量"
width="120"
width="90"
></el-table-column>
<el-table-column
align="center"
prop="freezeInventory"
label="冻结数量"
width="120"
width="90"
></el-table-column>
</el-table>
</div>
......@@ -520,6 +625,8 @@ getWarehouse()
</div>
</template>
</split-div>
<!-- 导出 -->
<ElDialog
v-model="exportVisible"
title="导出选项"
......@@ -542,6 +649,8 @@ getWarehouse()
</span>
</template>
</ElDialog>
<!-- 修改库位 -->
<ElDialog
v-model="modifyLocationDialog"
title="修改库位"
......@@ -572,6 +681,68 @@ getWarehouse()
</span>
</template>
</ElDialog>
<!-- 修改款号 -->
<ElDialog
v-model="modifyProductNoDialog"
title="修改款号"
width="500px"
:close-on-click-modal="false"
>
<el-form
ref="productNoFormRef"
:model="productNoForm"
:rules="productNoRules"
label-width="80px"
@submit.prevent
>
<el-form-item label="款号" prop="productNo">
<el-input
v-model="productNoForm.productNo"
style="width: 100%"
placeholder="请输入款号"
clearable
></el-input>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="modifyProductNoDialog = false">取消</el-button>
<el-button type="primary" @click="submitProductNoForm">确认</el-button>
</span>
</template>
</ElDialog>
<!-- 修改自定义sku -->
<ElDialog
v-model="modifyCustomSkuDialog"
title="修改自定义sku"
width="500px"
:close-on-click-modal="false"
>
<el-form
ref="customSkuFormRef"
:model="customSkuForm"
:rules="customSkuRules"
label-width="100px"
@submit.prevent
>
<el-form-item label="自定义sku" prop="customSku">
<el-input
v-model="customSkuForm.customSku"
style="width: 100%"
placeholder="请输入自定义sku"
clearable
></el-input>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="modifyCustomSkuDialog = false">取消</el-button>
<el-button type="primary" @click="submitCustomSkuForm">确认</el-button>
</span>
</template>
</ElDialog>
</template>
<style scoped lang="scss">
......
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