Commit e63ec0ef by wuqian

入库单初版接口

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