ERP:增加入库单的审批功能

This commit is contained in:
YunaiV
2024-02-06 23:28:48 +08:00
parent 5bdf0fc0ff
commit 115c30ea40
4 changed files with 107 additions and 23 deletions

View File

@ -127,13 +127,29 @@
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
<el-button
type="danger"
plain
@click="handleDelete(selectionList.map((item) => item.id))"
v-hasPermi="['erp:stock-in:delete']"
:disabled="selectionList.length === 0"
>
<Icon icon="ep:delete" class="mr-5px" /> 删除
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table
v-loading="loading"
:data="list"
:stripe="true"
:show-overflow-tooltip="true"
@selection-change="handleSelectionChange"
>
<el-table-column width="30" label="选择" type="selection" />
<el-table-column label="入库单号" align="center" prop="no" />
<el-table-column label="产品信息" align="center" prop="productNames" min-width="200" />
<el-table-column label="供应商" align="center" prop="supplierName" />
@ -146,14 +162,21 @@
/>
<el-table-column label="创建人" align="center" prop="creatorName" />
<el-table-column label="数量" align="center" prop="totalCount" />
<el-table-column label="金额合计" align="center" prop="totalPrice" />
<el-table-column label="金额" align="center" prop="totalPrice" />
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<dict-tag :type="DICT_TYPE.ERP_AUDIT_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<el-table-column label="操作" align="center" min-width="150">
<template #default="scope">
<el-button
link
@click="openForm('detail', scope.row.id)"
v-hasPermi="['erp:stock-in:query']"
>
详情
</el-button>
<el-button
link
type="primary"
@ -162,10 +185,28 @@
>
编辑
</el-button>
<el-button
link
type="primary"
@click="handleUpdateStatus(scope.row.id, 20)"
v-hasPermi="['erp:stock-in:update']"
v-if="scope.row.status === 10"
>
审批
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
@click="handleUpdateStatus(scope.row.id, 10)"
v-hasPermi="['erp:stock-in:update']"
v-else
>
反审批
</el-button>
<el-button
link
type="danger"
@click="handleDelete([scope.row.id])"
v-hasPermi="['erp:stock-in:delete']"
>
删除
@ -197,6 +238,7 @@ import { WarehouseApi, WarehouseVO } from '@/api/erp/stock/warehouse'
import { SupplierApi, SupplierVO } from '@/api/erp/purchase/supplier'
import { UserVO } from '@/api/system/user'
import * as UserApi from '@/api/system/user'
import * as BusinessApi from '@/api/crm/business'
/** ERP 其它入库单 列表 */
defineOptions({ name: 'ErpStockIn' })
@ -255,15 +297,29 @@ const openForm = (type: string, id?: number) => {
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
const handleDelete = async (ids: number[]) => {
try {
// 删除的二次确认
await message.delConfirm()
// 发起删除
await StockInApi.deleteStockIn(id)
await StockInApi.deleteStockIn(ids)
message.success(t('common.delSuccess'))
// 刷新列表
await getList()
selectionList.value = selectionList.value.filter((item) => !ids.includes(item.id))
} catch {}
}
/** 审批/反审批操作 */
const handleUpdateStatus = async (id: number, status: number) => {
try {
// 审批的二次确认
await message.confirm(`确定${status === 20 ? '审批' : '反审批'}该入库单吗?`)
// 发起审批
await StockInApi.updateStockInStatus(id, status)
message.success(`${status === 20 ? '审批' : '反审批'}成功`)
// 刷新列表
await getList()
} catch {}
}
@ -282,6 +338,12 @@ const handleExport = async () => {
}
}
/** 选中操作 */
const selectionList = ref<StockInVO[]>([])
const handleSelectionChange = (rows: StockInVO[]) => {
selectionList.value = rows
}
/** 初始化 **/
onMounted(async () => {
await getList()
@ -291,4 +353,6 @@ onMounted(async () => {
supplierList.value = await SupplierApi.getSupplierSimpleList()
userList.value = await UserApi.getSimpleUserList()
})
// TODO 芋艿:可优化功能:列表界面,支持导入
// TODO 芋艿:可优化功能:详情界面,支持打印
</script>