Commit e212c47d by qinjianhui

feat: 审核功能开发

parent 6dbe6fd5
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
StockingOrderProduct, StockingOrderProduct,
InternalMemoList, InternalMemoList,
RelatedDocumentList, RelatedDocumentList,
LogListData LogListData,
} from '@/types/api/supply/stockingOrder' } from '@/types/api/supply/stockingOrder'
export function getStockingOrderListApi( export function getStockingOrderListApi(
...@@ -72,3 +72,12 @@ export function getStockingOrderLogListByIdApi(id: number) { ...@@ -72,3 +72,12 @@ export function getStockingOrderLogListByIdApi(id: number) {
`factory/supply/stockingUpManageLog/getStockingUpManageLog?manageId=${id}`, `factory/supply/stockingUpManageLog/getStockingUpManageLog?manageId=${id}`,
) )
} }
export function submitStockingOrderAuditApi(ids: string) {
return axios.get<never, BaseRespData<void>>(
'factory/supply/stockingUpManage/submission',
{
params: { ids },
},
)
}
<template> <template>
<ElDialog <ElDialog
v-model="visible" v-model="visible"
:title="!editId ? '新增备货单' : '编辑备货单'" :title="
editOrderType === 'add'
? '新增备货单'
: editOrderType === 'edit'
? '编辑备货单'
: '审核备货单'
"
width="1400px" width="1400px"
top="15vh" top="15vh"
:close-on-click-modal="false" :close-on-click-modal="false"
destroy-on-close destroy-on-close
> >
<div class=" n "> <div class="add-stocking-order">
<div class="form-section"> <div class="form-section">
<ElForm <ElForm
ref="formRef" ref="formRef"
...@@ -31,6 +37,7 @@ ...@@ -31,6 +37,7 @@
placeholder="请选择" placeholder="请选择"
filterable filterable
clearable clearable
:disabled="editOrderType === 'audit'"
style="width: 100%" style="width: 100%"
@change="handleSupplierChange" @change="handleSupplierChange"
> >
...@@ -51,6 +58,7 @@ ...@@ -51,6 +58,7 @@
v-model="formData.stockingUpUserId" v-model="formData.stockingUpUserId"
placeholder="请选择" placeholder="请选择"
filterable filterable
:disabled="editOrderType === 'audit'"
clearable clearable
style="width: 100%" style="width: 100%"
> >
...@@ -67,6 +75,7 @@ ...@@ -67,6 +75,7 @@
v-model="formData.warehouseId" v-model="formData.warehouseId"
placeholder="请选择" placeholder="请选择"
filterable filterable
:disabled="editOrderType === 'audit'"
clearable clearable
style="width: 100%" style="width: 100%"
> >
...@@ -138,6 +147,7 @@ ...@@ -138,6 +147,7 @@
<ElInput <ElInput
v-model="row.buyAmount" v-model="row.buyAmount"
clearable clearable
:disabled="editOrderType === 'audit'"
size="small" size="small"
style="width: 80px" style="width: 80px"
@blur="validateField(row, 'buyAmount')" @blur="validateField(row, 'buyAmount')"
...@@ -150,6 +160,7 @@ ...@@ -150,6 +160,7 @@
<ElInput <ElInput
v-model="row.price" v-model="row.price"
clearable clearable
:disabled="editOrderType === 'audit'"
size="small" size="small"
style="width: 80px" style="width: 80px"
:class="{ 'is-error': row._priceError }" :class="{ 'is-error': row._priceError }"
...@@ -162,7 +173,10 @@ ...@@ -162,7 +173,10 @@
</TableView> </TableView>
</div> </div>
<div class="add-sku-section"> <div
v-if="editOrderType === 'add' || editOrderType === 'edit'"
class="add-sku-section"
>
<span class="label">添加SKU</span> <span class="label">添加SKU</span>
<ElInput <ElInput
v-model="productSku" v-model="productSku"
...@@ -210,12 +224,31 @@ ...@@ -210,12 +224,31 @@
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<ElButton size="large" @click="handleCancel">取消</ElButton> <ElButton size="large" @click="handleCancel">取消</ElButton>
<ElButton size="large" type="primary" @click="handleSave" <ElButton
v-if="editOrderType === 'add' || editOrderType === 'edit'"
size="large"
type="primary"
@click="handleSave"
>保存</ElButton >保存</ElButton
> >
<ElButton size="large" type="success" @click="handleSaveAndSubmit"> <ElButton
v-if="editOrderType === 'add' || editOrderType === 'edit'"
size="large"
type="success"
@click="handleSaveAndSubmit"
>
保存并提交审核 保存并提交审核
</ElButton> </ElButton>
<ElButton
v-if="editOrderType === 'audit'"
size="large"
type="success"
@click="handleSave"
>审核通过</ElButton
>
<ElButton v-if="editOrderType === 'audit'" size="large" type="danger"
>审核驳回</ElButton
>
</div> </div>
</template> </template>
</ElDialog> </ElDialog>
...@@ -254,6 +287,7 @@ const props = defineProps<{ ...@@ -254,6 +287,7 @@ const props = defineProps<{
warehouseList: WarehouseListData[] warehouseList: WarehouseListData[]
currencyList: CurrencyCodeData[] currencyList: CurrencyCodeData[]
editId: number | undefined editId: number | undefined
editOrderType: string
}>() }>()
const emit = defineEmits<{ const emit = defineEmits<{
...@@ -520,9 +554,12 @@ const handleSave = async () => { ...@@ -520,9 +554,12 @@ const handleSave = async () => {
const stockingUpUserName = props.stockKeeperList.find( const stockingUpUserName = props.stockKeeperList.find(
(item) => item.id === stockingUpUserId, (item) => item.id === stockingUpUserId,
)?.account )?.account
const url = !props.editId const url =
props.editOrderType === 'add'
? 'factory/supply/stockingUpManage/add' ? 'factory/supply/stockingUpManage/add'
: `factory/supply/stockingUpManage/update` : props.editOrderType === 'edit'
? `factory/supply/stockingUpManage/update`
: `factory/supply/stockingUpManage/examine`
const loading = ElLoading.service({ const loading = ElLoading.service({
lock: true, lock: true,
text: '加载中...', text: '加载中...',
......
...@@ -47,7 +47,6 @@ import { ...@@ -47,7 +47,6 @@ import {
TableData, TableData,
} from '@/types/api/supply/stockingOrder' } from '@/types/api/supply/stockingOrder'
import ImageView from '@/components/ImageView.vue' import ImageView from '@/components/ImageView.vue'
import { BigNumber } from 'bignumber.js'
import { import {
getStockingOrderDetailListByIdApi, getStockingOrderDetailListByIdApi,
getStockingOrderInternalMemoListByIdApi, getStockingOrderInternalMemoListByIdApi,
...@@ -68,6 +67,7 @@ const relatedDocumentsColumns = computed(() => { ...@@ -68,6 +67,7 @@ const relatedDocumentsColumns = computed(() => {
{ {
label: '制单人', label: '制单人',
width: 120, width: 120,
prop:"createUserName",
}, },
{ {
label: '制单时间', label: '制单时间',
...@@ -148,19 +148,6 @@ const stockProductsColumns = computed(() => { ...@@ -148,19 +148,6 @@ const stockProductsColumns = computed(() => {
align: 'right', align: 'right',
}, },
{ {
label: '未发货数量',
prop: 'unshippedQuantity',
width: 120,
align: 'right',
render: (item: StockingOrderProduct) => (
<span>
{new BigNumber(item.buyAmount ?? 0)
.minus(item.shipmentQuantity ?? 0)
.toString()}
</span>
),
},
{
label: '已发货数量', label: '已发货数量',
prop: 'shipmentQuantity', prop: 'shipmentQuantity',
width: 120, width: 120,
......
<template>
<ElDialog
v-model="visible"
title="供应商发货"
width="1400px"
top="15vh"
:close-on-click-modal="false"
destroy-on-close
>
<div
class="supplier-dispatch-order-page card h-100 flex overflow-hidden"
></div>
</ElDialog>
</template>
<script setup lang="tsx">
const props = defineProps<{
visible: boolean
}>()
const emit = defineEmits<{
(e: 'update:visible', value: boolean): void
(e: 'refresh'): void
}>()
const visible = computed({
get: () => props.visible,
set: (val) => emit('update:visible', val),
})
</script>
...@@ -161,12 +161,6 @@ ...@@ -161,12 +161,6 @@
>提交审核</ElButton >提交审核</ElButton
> >
</span> </span>
<span v-if="status === 'PENDING_AUDIT'" class="item">
<ElButton type="primary">审核</ElButton>
</span>
<span v-if="status === 'STOCKING_UP'" class="item">
<ElButton type="primary">供应商发货</ElButton>
</span>
<span v-if="status === 'STOCKING_UP'" class="item"> <span v-if="status === 'STOCKING_UP'" class="item">
<ElButton type="warning">备货完成</ElButton> <ElButton type="warning">备货完成</ElButton>
</span> </span>
...@@ -223,17 +217,27 @@ ...@@ -223,17 +217,27 @@
:stock-keeper-list="stockKeeperList" :stock-keeper-list="stockKeeperList"
:warehouse-list="warehouseList" :warehouse-list="warehouseList"
:currency-list="currencyList" :currency-list="currencyList"
:edit-id="editId" :edit-order-type="editOrderType"
@refresh="search" :edit-id="selectedRow?.id"
@refresh="onRefresh"
/>
<SupplierDispatchOrder
v-model:visible="supplierDispatchOrderVisible"
:selected-row="selectedRow"
@refresh="onRefresh"
/> />
</div> </div>
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
import { getStockingOrderListApi } from '@/api/stockingOrder' import {
getStockingOrderListApi,
submitStockingOrderAuditApi,
} from '@/api/stockingOrder'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import StockingOrderDetailTabs from './StockingOrderDetailTabs.vue' import StockingOrderDetailTabs from './StockingOrderDetailTabs.vue'
import AddStockingOrderDialog from './AddStockingOrderDialog.vue' import AddStockingOrderDialog from './AddStockingOrderDialog.vue'
import SupplierDispatchOrder from './SupplierDispatchOrder.vue'
import { import {
TreeData, TreeData,
SearchForm, SearchForm,
...@@ -390,17 +394,39 @@ const tableColumns = computed(() => { ...@@ -390,17 +394,39 @@ const tableColumns = computed(() => {
{ {
label: '操作', label: '操作',
prop: 'operation', prop: 'operation',
width: 100, width: 140,
align: 'center', align: 'center',
fixed: 'right', fixed: 'right',
render: (row: TableData) => { render: (row: TableData) => {
return ( return (
<span> <span>
{row.status === 'PENDING_SUBMIT' && ( {row.status === 'PENDING_SUBMIT' && (
<ElButton link type="warning" onClick={() => handleEdit(row)}> <ElButton
link
type="warning"
onClick={() => handleOrder(row, 'edit')}
>
编辑 编辑
</ElButton> </ElButton>
)} )}
{row.status === 'PENDING_AUDIT' && (
<ElButton
link
type="success"
onClick={() => handleOrder(row, 'audit')}
>
审核
</ElButton>
)}
{row.status === 'STOCKING_UP' && (
<ElButton
link
type="primary"
onClick={() => handleSupplierDispatchOrder(row)}
>
供应商发货
</ElButton>
)}
</span> </span>
) )
}, },
...@@ -421,12 +447,13 @@ const deliveryStatusList = ref([ ...@@ -421,12 +447,13 @@ const deliveryStatusList = ref([
{ label: '部分发货', value: 'partial' }, { label: '部分发货', value: 'partial' },
{ label: '全部发货', value: 'completed' }, { label: '全部发货', value: 'completed' },
]) ])
const editId = ref<number | undefined>(undefined) const editOrderType = ref<string>('add')
const selection = ref<TableData[]>([]) const selection = ref<TableData[]>([])
const rangeTime = ref<string[]>([]) const rangeTime = ref<string[]>([])
const [searchForm, resetSearchForm] = useValue<SearchForm>({} as SearchForm) const [searchForm, resetSearchForm] = useValue<SearchForm>({} as SearchForm)
const treeRef = ref() const treeRef = ref()
const tableRef = ref() const tableRef = ref()
const supplierDispatchOrderVisible = ref(false)
const loadWarehouseList = async () => { const loadWarehouseList = async () => {
try { try {
const res = await loadWarehouseListApi() const res = await loadWarehouseListApi()
...@@ -526,22 +553,52 @@ const handleRowClick = (row: TableData) => { ...@@ -526,22 +553,52 @@ const handleRowClick = (row: TableData) => {
} }
} }
const handleEdit = (row: TableData) => { const handleOrder = (row: TableData, type: string) => {
editId.value = row.id as number selectedRow.value = row
editOrderType.value = type
addDialogVisible.value = true addDialogVisible.value = true
} }
const handleSupplierDispatchOrder = (row: TableData) => {
selectedRow.value = row
supplierDispatchOrderVisible.value = true
}
// 新增备货单弹窗 // 新增备货单弹窗
const addDialogVisible = ref(false) const addDialogVisible = ref(false)
const handleAddOrder = () => { const handleAddOrder = () => {
editId.value = undefined selectedRow.value = null
editOrderType.value = 'add'
addDialogVisible.value = true addDialogVisible.value = true
} }
const handleSubmitAudit = () => { const handleSubmitAudit = async () => {
if (selection.value.length === 0) { if (selection.value.length === 0) {
return ElMessage.warning('请选择要操作的数据') return ElMessage.warning('请选择要操作的数据')
} }
try {
await ElMessageBox.confirm('确定要提交审核吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
try {
const res = await submitStockingOrderAuditApi(
selection.value.map((el) => el.id).join(','),
)
if (res.code !== 200) return
ElMessage.success('提交审核成功')
search()
loadTreeData()
} catch (e) {
console.error(e)
}
}
const onRefresh = () => {
search()
loadTreeData()
} }
onMounted(() => { onMounted(() => {
......
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