Commit e63ec0ef by wuqian

入库单初版接口

parent e0b8b1b1
...@@ -4,92 +4,92 @@ import { ...@@ -4,92 +4,92 @@ import {
warehouseSearchForm, warehouseSearchForm,
InterWarehousePage, InterWarehousePage,
InterWarehouseTree, InterWarehouseTree,
InterWarehouseDetail,
InterskuList, InterskuList,
InterWarehouseList, InterWarehouseList,
ILocation, ILocation,
InRecordEditForm, InRecordEditForm,
} from '@/types/api/warehouse' } from '@/types/api/warehouse'
export interface LogListData{ export interface LogListData {
createTime:string createTime: string
description:string description: string
} }
export interface PrintData{ export interface PrintData {
code:string code: string
list:{locationName:string,pickingLocation:string}[] list: { locationName: string; pickingLocation: string }[]
} }
export interface factoryWarehouseInfo { export interface factoryWarehouseInfo {
pageSize: number pageSize: number
currentPage: number currentPage: number
total?: number total?: number
warehouseId?: string; warehouseId?: string
locationName?: string; locationName?: string
remark?: string; remark?: string
} }
export interface WarehouseInventory { export interface WarehouseInventory {
pageSize: number; pageSize: number
currentPage: number; currentPage: number
total?: number; total?: number
warehouseId: string; warehouseId: string
skuName: string; skuName: string
warehouseSku: string; warehouseSku: string
occupyInventory: string; occupyInventory: string
freezeInventory: string; freezeInventory: string
inventory: string; inventory: string
upperLimit: string; upperLimit: string
usableInventoryStart: string; usableInventoryStart: string
usableInventoryEnd: string; usableInventoryEnd: string
occupyInventoryEnd: string; occupyInventoryEnd: string
occupyInventoryStart: string; occupyInventoryStart: string
floorLimit: string; floorLimit: string
} }
export interface UpdateDefaulted { export interface UpdateDefaulted {
id?: number | string; id?: number | string
defaulted: number; defaulted: number
} }
export interface UpdateStatus { export interface UpdateStatus {
id?: number; id?: number
status: number | undefined; status: number | undefined
} }
export interface warehouseInfo { export interface warehouseInfo {
id?: number | string; id?: number | string
name: string; name: string
code: string; code: string
sort: string; sort: string
defaulted: number; defaulted: number
factoryId?: number; factoryId?: number
factoryCode?: string; factoryCode?: string
remarks: string remarks: string
} }
export interface WarehouseWarning { export interface WarehouseWarning {
id: number | string; id: number | string
locationCode: string; locationCode: string
locationName: string; locationName: string
} }
export interface positionInfo { export interface positionInfo {
id?: number; id?: number
warehouseId?: string | number; warehouseId?: string | number
locationName: string; locationName: string
pickingOrder: string; pickingOrder: string
locationCode: string; locationCode: string
warehouseName?: string; warehouseName?: string
status?: number; status?: number
remark: string remark: string
} }
export interface positionFormInfo { export interface positionFormInfo {
id?: number; id?: number
warehouseId?: number | string; warehouseId?: number | string
locationName: string; locationName: string
pickingOrder: string; pickingOrder: string
locationCode: string; locationCode: string
warehouseName: string; warehouseName: string
remark: string remark: string
status: number status: number
} }
...@@ -152,10 +152,10 @@ export function factoryLogWarehouseLog(id: number | string | undefined) { ...@@ -152,10 +152,10 @@ export function factoryLogWarehouseLog(id: number | string | undefined) {
) )
} }
export function factoryWarehouseInfoPrint(data:PrintData) { export function factoryWarehouseInfoPrint(data: PrintData) {
return axios.post<never, BaseRespData<LogListData[]>>( return axios.post<never, BaseRespData<LogListData[]>>(
'/factoryWarehouseInfo/print', '/factoryWarehouseInfo/print',
data data,
) )
} }
...@@ -249,18 +249,24 @@ export function warehouseInRecordListPageApi( ...@@ -249,18 +249,24 @@ export function warehouseInRecordListPageApi(
} }
export function addInRecordApi(form: InRecordEditForm) { export function addInRecordApi(form: InRecordEditForm) {
return axios.post<never, BaseRespData<never>>('factory/warehouseInRecord/add', { return axios.post<never, BaseRespData<never>>(
...form, 'factory/warehouseInRecord/add',
}) {
...form,
},
)
} }
export function updateInRecordApi(form: InRecordEditForm) { export function updateInRecordApi(form: InRecordEditForm) {
return axios.post<never, BaseRespData<never>>('factory/warehouseInRecord/update', { return axios.post<never, BaseRespData<never>>(
...form, 'factory/warehouseInRecord/update',
}) {
...form,
},
)
} }
export function getWarehouseInRecordDetailApi(id: number) { export function getWarehouseInRecordDetailApi(id: number) {
return axios.get<never, BaseRespData<never>>( return axios.get<never, BaseRespData<InterWarehouseDetail[]>>(
'factory/warehouseInRecord/get', 'factory/warehouseInRecord/get',
{ {
params: { params: {
...@@ -280,7 +286,10 @@ export function getBySkuApi(warehouseId: number, sku: string | null) { ...@@ -280,7 +286,10 @@ export function getBySkuApi(warehouseId: number, sku: string | null) {
}, },
) )
} }
export function getByWareHouseIdAndCodeApi(wareHouseId: number, code: string | null) { export function getByWareHouseIdAndCodeApi(
wareHouseId: number,
code: string | null,
) {
return axios.get<never, BaseRespData<ILocation[]>>( return axios.get<never, BaseRespData<ILocation[]>>(
'factoryWarehouseLocation/getByWareHouseIdAndCode', 'factoryWarehouseLocation/getByWareHouseIdAndCode',
{ {
...@@ -302,6 +311,13 @@ export function getWarehouseListApi() { ...@@ -302,6 +311,13 @@ export function getWarehouseListApi() {
'factoryWarehouseInfo/getAll', 'factoryWarehouseInfo/getAll',
) )
} }
interface WarehouseParams {
id: number
dataVersion: number
}
export function auditOrderApi(url: string, data: WarehouseParams[]) {
return axios.post(url, data)
}
export function deleteWarehouseInRecordApi(ids: string) { export function deleteWarehouseInRecordApi(ids: string) {
return axios.get<never, BaseRespData<never>>( return axios.get<never, BaseRespData<never>>(
'factory/warehouseInRecord/delete', 'factory/warehouseInRecord/delete',
...@@ -310,6 +326,11 @@ export function deleteWarehouseInRecordApi(ids: string) { ...@@ -310,6 +326,11 @@ export function deleteWarehouseInRecordApi(ids: string) {
}, },
) )
} }
export function getInRecordLogApi(inRecordId?: number) {
return axios.get<never, BaseRespData<LogListData[]>>(
`factory/warehouseInRecord/log/${inRecordId}`,
)
}
// 出库单 // 出库单
export function getOutRecordStatusTree() { export function getOutRecordStatusTree() {
return axios.get<never, BaseRespData<InterWarehouseTree[]>>( return axios.get<never, BaseRespData<InterWarehouseTree[]>>(
...@@ -337,4 +358,4 @@ export function deleteWarehouseOutRecordApi(ids: string) { ...@@ -337,4 +358,4 @@ export function deleteWarehouseOutRecordApi(ids: string) {
params: { ids }, params: { ids },
}, },
) )
} }
\ No newline at end of file
<template> <template>
<div <div
class="image-view"
ref="imageViewRef" ref="imageViewRef"
class="image-view"
@mouseover="(ev) => mouseoverImg(ev, src)" @mouseover="(ev) => mouseoverImg(ev, src)"
@mouseleave="mouseleaveImg" @mouseleave="mouseleaveImg"
> >
......
...@@ -7,8 +7,23 @@ export interface warehouseSearchForm { ...@@ -7,8 +7,23 @@ export interface warehouseSearchForm {
sku?: string sku?: string
warehouseId?: number warehouseId?: number
} }
// 主表列表ts,看新增时是不是一样 export interface InterProductList {
export interface InterWarehousePage { createTime?: string
id?: number
inId?: number
productNo?: string | null //custom的货号
buyStored?: number | null
remark?: string | null
skuImage?: string
skuName?: string
costPrice?: number | null
totalPrice?: number | null
updateTime?: string
warehouseSku?: string
locationId?: number | null
locationCode?: string | null
}
export interface InterWarehouseBase {
id: number id: number
factoryId?: number factoryId?: number
factoryCode?: string factoryCode?: string
...@@ -16,28 +31,20 @@ export interface InterWarehousePage { ...@@ -16,28 +31,20 @@ export interface InterWarehousePage {
warehouseName?: string warehouseName?: string
inNo?: string inNo?: string
shipmentNumber?: string shipmentNumber?: string
skuAmount?: string skuAmount?: number
total?: number total?: number
totalPrice?: number totalPrice?: number
billStatus?: string billStatus?: string
remark?: string remark?: string | null
productList?: InterProductList[] dataVersion?: number
createTime?: string | null
updateTime?: string | null
} }
export interface InterWarehouseDetail { // 主表列表ts
id?: string export interface InterWarehousePage extends InterWarehouseBase {}
inId?: string // 子表列表ts
productNo?: string export interface InterWarehouseDetail extends InterWarehouseBase {
warehouseSku?: string productList: InterProductList[]
skuImage?: string
skuName?: string
buyStored?: string
totalPrice?: number
rejectsAmount?: string
rejectsReason?: string
remark?: string
factoryId?: number
createTime?: string
updateTime?: string
} }
export interface InterWarehouseTree { export interface InterWarehouseTree {
id: number id: number
...@@ -49,14 +56,13 @@ export interface InterWarehouseTree { ...@@ -49,14 +56,13 @@ export interface InterWarehouseTree {
} }
export interface InterProductList { export interface InterProductList {
createTime?: string createTime?: string
factoryId?: number
id?: number id?: number
inId?: number inId?: number
productNo?: string | null //货号 productNo?: string | null //货号
buyStored?: number | null //入库数量 buyStored?: number | null //入库数量
rejectsAmount?: number // rejectsAmount?: number
rejectsReason?: string // rejectsReason?: string
remark?: string remark?: string | null
skuImage?: string skuImage?: string
skuName?: string skuName?: string
costPrice?: number | null costPrice?: number | null
......
...@@ -10,8 +10,34 @@ export default function useImagePreview() { ...@@ -10,8 +10,34 @@ export default function useImagePreview() {
img.style.width = '300px' img.style.width = '300px'
div.appendChild(img) div.appendChild(img)
document.body.appendChild(div) document.body.appendChild(div)
let currentTarget: HTMLElement | null = null
const mousemoveHandler = (ev: MouseEvent) => {
if (!currentTarget) return
const rect = currentTarget.getBoundingClientRect()
const inOrigin =
ev.clientX >= rect.left &&
ev.clientX <= rect.right &&
ev.clientY >= rect.top &&
ev.clientY <= rect.bottom
const divRect = div.getBoundingClientRect()
const inPreview =
ev.clientX >= divRect.left &&
ev.clientX <= divRect.right &&
ev.clientY >= divRect.top &&
ev.clientY <= divRect.bottom
if (!inOrigin && !inPreview) {
div.style.display = 'none'
show.value = false
window.removeEventListener('mousemove', mousemoveHandler)
currentTarget = null
}
}
const mouseoverImg = (ev: MouseEvent, url: string) => { const mouseoverImg = (ev: MouseEvent, url: string) => {
console.log(url, ev.clientY, ev.clientX)
ev.preventDefault() ev.preventDefault()
if (show.value === true) return if (show.value === true) return
img.src = url img.src = url
...@@ -30,12 +56,16 @@ export default function useImagePreview() { ...@@ -30,12 +56,16 @@ export default function useImagePreview() {
div.style.top = y + 'px' div.style.top = y + 'px'
div.style.display = 'block' div.style.display = 'block'
show.value = true show.value = true
currentTarget = ev.currentTarget as HTMLElement
window.addEventListener('mousemove', mousemoveHandler)
} }
} }
const mouseleaveImg = () => { const mouseleaveImg = () => {
if (show.value === false) return if (show.value === false) return
div.style.display = 'none' div.style.display = 'none'
show.value = false show.value = false
} }
return { mouseoverImg, mouseleaveImg } return { mouseoverImg, mouseleaveImg }
} }
...@@ -884,7 +884,7 @@ const { ...@@ -884,7 +884,7 @@ const {
warehouseOutRecordListPage( warehouseOutRecordListPage(
{ {
...searchForm.value, ...searchForm.value,
// status: nodeId.value === -1 ? null : nodeId.value, billStatus: nodeId.value === -1 ? null : nodeId.value,
createTimeStart: tradingTime.value && tradingTime.value[0], createTimeStart: tradingTime.value && tradingTime.value[0],
createTimeEnd: tradingTime.value && tradingTime.value[1], createTimeEnd: tradingTime.value && tradingTime.value[1],
}, },
......
...@@ -97,22 +97,64 @@ ...@@ -97,22 +97,64 @@
</ElForm> </ElForm>
</div> </div>
<div class="btn-list"> <div class="btn-list">
<el-button type="primary" @click="addDialog(1)"> 新增 </el-button> <el-button
<el-button type="danger" @click="rejectOrder"> 驳回 </el-button> v-if="nodeCode === 'PENDING_SUBMIT'"
<el-button type="danger" @click="handleBatchDelete"> type="primary"
@click="addDialog(1)"
>
新增
</el-button>
<el-button
v-if="nodeCode === 'PENDING_AUDIT'"
type="danger"
@click="auditOrder('rejected')"
>
驳回
</el-button>
<el-button
v-if="nodeCode === 'PENDING_SUBMIT'"
type="danger"
@click="handleBatchDelete"
>
删除 删除
</el-button> </el-button>
<el-button type="warning" @click="importExcel"> 导入 </el-button> <el-button
<el-button type="success" @click="exportExcel"> 导出 </el-button> v-if="nodeCode === 'PENDING_SUBMIT'"
type="warning"
@click="importExcel"
>
导入
</el-button>
<el-button type="success" @click="handleExport"> 导出 </el-button>
<el-button type="primary" @click="exportExcel"> <el-button type="primary" @click="exportExcel">
打印SKU标签 打印SKU标签
</el-button> </el-button>
<el-button type="warning" @click="exportExcel"> 审核 </el-button> <el-button
<el-button type="success" @click="exportExcel"> v-if="nodeCode === 'PENDING_AUDIT'"
type="warning"
@click="auditOrder('audit')"
>
审核
</el-button>
<el-button
v-if="nodeCode === 'PENDING_SUBMIT'"
type="success"
@click="auditOrder('submitAudit')"
>
提交审核 提交审核
</el-button> </el-button>
<el-button type="danger" @click="rejectOrder"> 作废 </el-button> <el-button
<el-button type="success" @click="auditOrder('archive')"> v-if="nodeCode === 'PENDING_AUDIT'"
type="danger"
@click="auditOrder('invalid')"
>
作废
</el-button>
<el-button
v-if="nodeCode === 'COMPLETED'"
type="success"
@click="auditOrder('archiving')"
>
归档 归档
</el-button> </el-button>
</div> </div>
...@@ -149,15 +191,14 @@ ...@@ -149,15 +191,14 @@
label="入库单号" label="入库单号"
show-overflow-tooltip show-overflow-tooltip
prop="inNo" prop="inNo"
width="110" width="130"
header-align="center" header-align="center"
align="center" align="center"
></ElTableColumn> ></ElTableColumn>
<ElTableColumn <ElTableColumn
label="单据状态" label="单据状态"
show-overflow-tooltip width="130"
prop="billStatus" prop="billStatus"
width="80"
header-align="center" header-align="center"
align="center" align="center"
></ElTableColumn> ></ElTableColumn>
...@@ -165,7 +206,7 @@ ...@@ -165,7 +206,7 @@
label="仓库名称" label="仓库名称"
show-overflow-tooltip show-overflow-tooltip
prop="warehouseName" prop="warehouseName"
min-width="100" width="130"
header-align="center" header-align="center"
align="center" align="center"
></ElTableColumn> ></ElTableColumn>
...@@ -173,7 +214,7 @@ ...@@ -173,7 +214,7 @@
label="工厂编号" label="工厂编号"
show-overflow-tooltip show-overflow-tooltip
prop="factoryCode" prop="factoryCode"
min-width="100" width="90"
header-align="center" header-align="center"
align="center" align="center"
></ElTableColumn> ></ElTableColumn>
...@@ -197,7 +238,7 @@ ...@@ -197,7 +238,7 @@
label="SKU数量" label="SKU数量"
header-align="center" header-align="center"
prop="skuAmount" prop="skuAmount"
width="130" width="90"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
> >
...@@ -206,7 +247,7 @@ ...@@ -206,7 +247,7 @@
label="总数量" label="总数量"
header-align="center" header-align="center"
prop="total" prop="total"
width="120" width="90"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
> >
...@@ -214,7 +255,6 @@ ...@@ -214,7 +255,6 @@
<ElTableColumn <ElTableColumn
label="备注" label="备注"
show-overflow-tooltip show-overflow-tooltip
width="240"
prop="remark" prop="remark"
header-align="center" header-align="center"
align="center" align="center"
...@@ -261,14 +301,15 @@ ...@@ -261,14 +301,15 @@
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
width="100"
label="SKU图片" label="SKU图片"
prop="factory_order_number" prop="factory_order_number"
> >
<template #default="{ row }"> <template #default="{ row }">
<ImageView <ImageView
:src="row.skuImage" :src="row.skuImage"
width="80px" width="40px"
height="80px" height="40px"
/> />
</template> </template>
</ElTableColumn> </ElTableColumn>
...@@ -295,12 +336,18 @@ ...@@ -295,12 +336,18 @@
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="总成本(¥)" label="成本价(¥)"
prop="buyStored" prop="costPrice"
/> />
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="总成本(¥)"
prop="totalPrice"
/>
<!-- <ElTableColumn
show-overflow-tooltip
align="center"
label="不良品数量" label="不良品数量"
prop="rejectsAmount" prop="rejectsAmount"
/> />
...@@ -309,7 +356,7 @@ ...@@ -309,7 +356,7 @@
align="center" align="center"
label="不良品原因" label="不良品原因"
prop="rejectsAeason" prop="rejectsAeason"
/> /> -->
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
...@@ -332,7 +379,7 @@ ...@@ -332,7 +379,7 @@
</ElTable> </ElTable>
</div> </div>
<ElPagination <!-- <ElPagination
v-model:current-page="detailPager.page" v-model:current-page="detailPager.page"
v-model:page-size="detailPager.rows" v-model:page-size="detailPager.rows"
:page-sizes="[100, 200, 300, 400, 500]" :page-sizes="[100, 200, 300, 400, 500]"
...@@ -342,9 +389,9 @@ ...@@ -342,9 +389,9 @@
style="margin: 10px auto 0; text-align: right" style="margin: 10px auto 0; text-align: right"
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
></ElPagination> ></ElPagination> -->
</el-tab-pane> </el-tab-pane>
<!-- <el-tab-pane name="1" label="操作日志"> <el-tab-pane name="1" label="操作日志">
<ul <ul
style=" style="
color: #333; color: #333;
...@@ -367,24 +414,6 @@ ...@@ -367,24 +414,6 @@
</li> </li>
</ul> </ul>
</el-tab-pane> </el-tab-pane>
<el-tab-pane name="2" label="物流轨迹">
<ul
v-if="logisticsData.length > 0"
style="
color: #333;
font-size: 12px;
height: 100%;
overflow: auto;
"
>
<li v-for="(item, index) in logisticsData" :key="index">
<span class="log-desc">
{{ item.time + ' ' + item.context }}
</span>
</li>
</ul>
<div v-else class="empty">{{ $t('暂无数据') }}</div>
</el-tab-pane> -->
</el-tabs> </el-tabs>
</template> </template>
</splitDiv> </splitDiv>
...@@ -432,6 +461,9 @@ ...@@ -432,6 +461,9 @@
<ElFormItem label="入库单号" prop="account"> <ElFormItem label="入库单号" prop="account">
<ElInput v-model="editForm.inNo" clearable disabled /> <ElInput v-model="editForm.inNo" clearable disabled />
</ElFormItem> </ElFormItem>
<ElFormItem label="工厂:" prop="factoryCode">
<span>{{ editForm.factoryCode }}</span>
</ElFormItem>
<ElFormItem label="仓库" prop="warehouseId" required> <ElFormItem label="仓库" prop="warehouseId" required>
<ElSelect <ElSelect
v-model="editForm.warehouseId" v-model="editForm.warehouseId"
...@@ -447,9 +479,6 @@ ...@@ -447,9 +479,6 @@
></ElOption> ></ElOption>
</ElSelect> </ElSelect>
</ElFormItem> </ElFormItem>
<ElFormItem label="工厂:" prop="factoryCode">
<span>{{ editForm.factoryCode }}</span>
</ElFormItem>
<ElFormItem label="备注" prop="remark" style="width: 45%"> <ElFormItem label="备注" prop="remark" style="width: 45%">
<ElInput <ElInput
v-model="editForm.remark" v-model="editForm.remark"
...@@ -520,18 +549,6 @@ ...@@ -520,18 +549,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 align="center" label="库位" prop="loacationCode"> <ElTableColumn align="center" label="库位" prop="loacationCode">
<template #default="{ row }"> <template #default="{ row }">
<!-- +后有就正常展示,没有则通过搜索接口自己添加 --> <!-- +后有就正常展示,没有则通过搜索接口自己添加 -->
...@@ -691,6 +708,31 @@ ...@@ -691,6 +708,31 @@
</div> </div>
</template> </template>
</ElDialog> </ElDialog>
<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-item label="">
<el-checkbox v-model="exportForm.delivery"> 包含详情 </el-checkbox>
</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> </template>
<script setup lang="ts"> <script setup lang="ts">
...@@ -700,12 +742,7 @@ import splitDiv from '@/components/splitDiv/splitDiv.vue' ...@@ -700,12 +742,7 @@ 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 { useValue } from '@/utils/hooks/useValue' import { useValue } from '@/utils/hooks/useValue'
import { import { exportExcelApi } from '@/api/order'
auditOrderApi,
rejectOrderApi,
getLogListApi,
exportExcelApi,
} from '@/api/order'
import { import {
getInRecordStatusTree, getInRecordStatusTree,
warehouseInRecordListPageApi, warehouseInRecordListPageApi,
...@@ -716,6 +753,8 @@ import { ...@@ -716,6 +753,8 @@ import {
addInRecordApi, addInRecordApi,
updateInRecordApi, updateInRecordApi,
deleteWarehouseInRecordApi, deleteWarehouseInRecordApi,
auditOrderApi,
getInRecordLogApi,
} from '@/api/warehouse' } from '@/api/warehouse'
import BigNumber from 'bignumber.js' import BigNumber from 'bignumber.js'
import { ref, onMounted, watch, nextTick } from 'vue' import { ref, onMounted, watch, nextTick } from 'vue'
...@@ -724,7 +763,6 @@ import { LogList } from '@/types/api/billOrder.ts' ...@@ -724,7 +763,6 @@ import { LogList } from '@/types/api/billOrder.ts'
import { import {
warehouseSearchForm, warehouseSearchForm,
InterWarehousePage, InterWarehousePage,
InterWarehouseDetail,
InterWarehouseTree, InterWarehouseTree,
InterProductList, InterProductList,
InterskuList, InterskuList,
...@@ -860,7 +898,7 @@ const [searchForm, resetSearchForm] = useValue<warehouseSearchForm>({}) ...@@ -860,7 +898,7 @@ const [searchForm, resetSearchForm] = useValue<warehouseSearchForm>({})
const tradingTime = ref<string[]>([]) const tradingTime = ref<string[]>([])
const selections = ref<InterWarehousePage[]>([]) const selections = ref<InterWarehousePage[]>([])
const detailList = ref<InterWarehouseDetail[]>([]) const detailList = ref<InterProductList[]>([])
const tabsValue = ref<string>('0') const tabsValue = ref<string>('0')
const singleTableRef = ref<InstanceType<typeof ElTable>>() const singleTableRef = ref<InstanceType<typeof ElTable>>()
const currentRow = ref<InterWarehousePage | null>(null) const currentRow = ref<InterWarehousePage | null>(null)
...@@ -868,7 +906,7 @@ const logList = ref<LogList[]>([]) ...@@ -868,7 +906,7 @@ const logList = ref<LogList[]>([])
const rules = { const rules = {
warehouseId: [{ required: true, message: '请选择仓库', trigger: 'change' }], warehouseId: [{ required: true, message: '请选择仓库', trigger: 'change' }],
} }
const nodeId = ref<number | string>(10) const nodeCode = ref<string | null>('all')
const treeRef = ref<InstanceType<typeof ElTree>>() const treeRef = ref<InstanceType<typeof ElTree>>()
const { const {
...@@ -884,7 +922,7 @@ const { ...@@ -884,7 +922,7 @@ const {
warehouseInRecordListPageApi( warehouseInRecordListPageApi(
{ {
...searchForm.value, ...searchForm.value,
// status: nodeId.value === -1 ? null : nodeId.value, billStatus: nodeCode.value == 'all' ? 'all' : nodeCode.value,
createTimeStart: tradingTime.value && tradingTime.value[0], createTimeStart: tradingTime.value && tradingTime.value[0],
createTimeEnd: tradingTime.value && tradingTime.value[1], createTimeEnd: tradingTime.value && tradingTime.value[1],
}, },
...@@ -905,21 +943,125 @@ const setCostPrice = (item: InterProductList) => { ...@@ -905,21 +943,125 @@ const setCostPrice = (item: InterProductList) => {
const getTreeNum = async () => { const getTreeNum = async () => {
try { try {
const res = await getInRecordStatusTree() const res = await getInRecordStatusTree()
res.data = [{ code: -1, name: '全部', children: res.data }] res.data = [{ code: 'all', name: '全部', children: res.data }]
treeData.value = res.data treeData.value = res.data
await nextTick(() => { await nextTick(() => {
treeRef.value!.setCurrentKey(nodeId.value, true) treeRef.value!.setCurrentKey(nodeCode.value, true)
}) })
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
} }
const exportVisible = ref(false)
const exportForm = ref({
delivery: false,
resource: '',
})
const handleExport = () => {
exportVisible.value = true
// exportForm.value.delivery = false
// exportForm.value.resource = ''
}
// 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()
// })
// }
const getWarehouseList = async () => { const getWarehouseList = async () => {
try { try {
const res = await getWarehouseListApi() const res = await getWarehouseListApi()
warehouseList.value = res.data warehouseList.value = res.data
await nextTick(() => { await nextTick(() => {
treeRef.value!.setCurrentKey(nodeId.value, true) treeRef.value!.setCurrentKey(nodeCode.value, true)
}) })
} catch (e) { } catch (e) {
console.error(e) console.error(e)
...@@ -938,7 +1080,6 @@ const selectbySku = async () => { ...@@ -938,7 +1080,6 @@ const selectbySku = async () => {
try { try {
const res = await getBySkuApi(editForm.value.warehouseId, selectSku.value) const res = await getBySkuApi(editForm.value.warehouseId, selectSku.value)
skuData.value = res.data || [] skuData.value = res.data || []
fetchLocationList('') //获取该仓库下的所有库位
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
...@@ -963,7 +1104,7 @@ const skudblclick = (val: InterskuList) => { ...@@ -963,7 +1104,7 @@ const skudblclick = (val: InterskuList) => {
productNo, productNo,
locationCode: locationCode ?? '', // 确保空值处理 locationCode: locationCode ?? '', // 确保空值处理
locationId: locationId ?? '', // 确保空值处理 locationId: locationId ?? '', // 确保空值处理
costPrice: factoryPrice, ////添加时成本价字段是啥?要提交吗? costPrice: factoryPrice,
buyStored: null, buyStored: null,
totalPrice: null, totalPrice: null,
}, },
...@@ -987,8 +1128,6 @@ const tabsClick = async () => { ...@@ -987,8 +1128,6 @@ const tabsClick = async () => {
searchDetail() searchDetail()
} else if (tabsValue.value === '1') { } else if (tabsValue.value === '1') {
getLogList() getLogList()
} else {
getLogisticsData()
} }
} }
const [editForm, resetEditForm] = useValue({ const [editForm, resetEditForm] = useValue({
...@@ -1006,11 +1145,8 @@ const otherPurchaseData = ref<InterProductList[]>([]) ...@@ -1006,11 +1145,8 @@ const otherPurchaseData = ref<InterProductList[]>([])
const addDialog = async (i: number, v: InterWarehousePage) => { const addDialog = async (i: number, v: InterWarehousePage) => {
if (i === 2) { if (i === 2) {
if (v) formId.value = v.id if (v) formId.value = v.id
// getProduct(v.id) getProduct(v.id)
if (!formId.value) return ElMessage('请勾选至少一条记录') if (!formId.value) return ElMessage('请勾选至少一条记录')
// v.inWarehouseId = v.warehouseId
// v.inType = v.type
// v.handleUserId = v.makerUserId
editForm.value = JSON.parse(JSON.stringify(v)) editForm.value = JSON.parse(JSON.stringify(v))
} else { } else {
await nextTick() await nextTick()
...@@ -1029,20 +1165,17 @@ const addDialog = async (i: number, v: InterWarehousePage) => { ...@@ -1029,20 +1165,17 @@ const addDialog = async (i: number, v: InterWarehousePage) => {
otherPurchaseData.value = [] otherPurchaseData.value = []
formId.value = undefined formId.value = undefined
} }
fetchLocationList('') //获取该仓库下的所有库位
newDialogVisible.value = true newDialogVisible.value = true
} }
// const getProduct = (id: number) => { const getProduct = async (id: number) => {
// let url = `otherInWarehouseProductDetails/getProductList?otherOutWarehouseId=${id}` try {
// get(url).then((res) => { const res = await getWarehouseInRecordDetailApi(id)
// if (res.code == 200) { otherPurchaseData.value = res.data.productList || []
// otherPurchaseData.value = res.data; } catch (e) {
// } else { console.error(e)
// this.$alert(res.message, this.$t('错误提示'), { }
// dangerouslyUseHTMLString: true, }
// })
// }
// })
// }
const handleSelectionChange = (v: InterWarehousePage[]) => { const handleSelectionChange = (v: InterWarehousePage[]) => {
selections.value = v selections.value = v
} }
...@@ -1054,54 +1187,75 @@ const auditOrder = (key: string) => { ...@@ -1054,54 +1187,75 @@ const auditOrder = (key: string) => {
let url = '' let url = ''
let text = '' let text = ''
switch (key) { switch (key) {
case 'pay': case 'rejected':
url = 'reconciliation/payment' url = 'factory/warehouseInRecord/turnDown'
text = '确认付款' text = '驳回'
break
case 'invalid':
url = 'factory/warehouseInRecord/invalid'
text = '作废'
break
case 'archiving':
url = 'factory/warehouseInRecord/archive'
text = '归档'
break
case 'submitAudit':
url = 'factory/warehouseInRecord/submitAudit'
text = '提交审核'
break break
case 'archive': case 'audit':
url = 'reconciliation/archiving' url = 'factory/warehouseInRecord/audit'
text = '确认归档' text = '审核'
break break
} }
if (selections.value.length === 0) { if (selections.value.length === 0) {
return ElMessage.warning('请选择要操作的数据') return ElMessage.warning('请选择要操作的数据')
} }
ElMessageBox.confirm(`${text}对账单?`, '重要提示', { const confimText =
key === 'audit'
? '确定进行审核?点“确定”将会直接更改库存数量,请在审核前确认数量是否正确。'
: `确定对选中的信息进行${text}?`
ElMessageBox.confirm(confimText, '重要提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'warning', type: 'warning',
}).then(async () => { }).then(async () => {
const ids = selections.value.map((el) => el.id).join(',') const data = selections.value.map(
await auditOrderApi(url, ids) ({ id, dataVersion }: InterWarehousePage) => ({
id,
dataVersion,
}),
)
await auditOrderApi(url, data)
ElMessage.success('操作成功') ElMessage.success('操作成功')
search() search()
await getTreeNum() await getTreeNum()
}) })
} }
const rejectOrder = () => { // const rejectOrder = () => {
if (selections.value.length === 0) { // if (selections.value.length === 0) {
return ElMessage.warning('请选择要操作的数据') // return ElMessage.warning('请选择要操作的数据')
} // }
ElMessageBox.prompt('请输入驳回原因', '提示', { // ElMessageBox.prompt('请输入驳回原因', '提示', {
confirmButtonText: '确定', // confirmButtonText: '确定',
cancelButtonText: '取消', // cancelButtonText: '取消',
type: 'warning', // type: 'warning',
inputPattern: /.+/, // inputPattern: /.+/,
customClass: 'reject', // customClass: 'reject',
inputErrorMessage: '请输入驳回原因', // inputErrorMessage: '请输入驳回原因',
inputPlaceholder: '驳回原因', // inputPlaceholder: '驳回原因',
}).then(async ({ value }) => { // }).then(async ({ value }) => {
const ids = selections.value.map((el) => el.id).join(',') // const ids = selections.value.map((el) => el.id).join(',')
try { // try {
await rejectOrderApi({ ids: ids, description: value, pass: 0 }) // await rejectOrderApi({ ids: ids, description: value, pass: 0 })
ElMessage.success('操作成功') // ElMessage.success('操作成功')
search() // search()
await getTreeNum() // await getTreeNum()
} catch (e) { // } catch (e) {
console.error(e) // console.error(e)
} // }
}) // })
} // }
watch( watch(
() => tableData.value, () => tableData.value,
() => { () => {
...@@ -1249,7 +1403,7 @@ const handleBatchDelete = async () => { ...@@ -1249,7 +1403,7 @@ const handleBatchDelete = async () => {
await search() await search()
} }
const nodeClick = (data: InterWarehouseTree) => { const nodeClick = (data: InterWarehouseTree) => {
nodeId.value = data.code ?? '' nodeCode.value = data.code ?? ''
search() search()
} }
const detailPager = ref({ const detailPager = ref({
...@@ -1260,29 +1414,20 @@ const detailPager = ref({ ...@@ -1260,29 +1414,20 @@ const detailPager = ref({
const searchDetail = async () => { const searchDetail = async () => {
try { try {
const res = await getWarehouseInRecordDetailApi(currentRow.value?.id) const res = await getWarehouseInRecordDetailApi(currentRow.value?.id)
detailList.value = res.data.records || [] detailList.value = res.data.productList || []
detailPager.value.total = res.data.total // detailPager.value.total = res.data.total
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
} }
const getLogList = async () => { const getLogList = async () => {
try { try {
const res = await getLogListApi(currentRow.value?.id) const res = await getInRecordLogApi(currentRow.value?.id)
logList.value = res.data logList.value = res.data
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
} }
// const logisticsData = ref([])
const getLogisticsData = async () => {
// try {
// const res = await getLogisticsDataApi(currentRow.value?.id)
// logisticsData.value = res.data
// } catch (e) {
// console.error(e)
// }
}
const importDialogVisible = ref(false) const importDialogVisible = ref(false)
const importedFileUrl = ref('') const importedFileUrl = ref('')
......
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