🆕 盘点列表查询

This commit is contained in:
my_ong 2024-12-07 21:27:03 +08:00
parent 83ad52c793
commit d18fbd21e9
12 changed files with 674 additions and 34 deletions

View File

@ -0,0 +1,18 @@
/**
* @desc
*/
import { defaultSuccess, defaultError, http } from '@/plugins/axios';
import type { AxiosResponse } from 'axios';
export default async function (
success: (data: Array<acl.User>) => void = defaultSuccess,
fail: (error: { code: string; error?: string }) => void = defaultError,
): Promise<void> {
return http({
method: 'get',
url: `/user-all`,
})
.then((data: AxiosResponse<Array<acl.User>, unknown>) => {
success(data.data);
})
.catch((error: { code: string; error?: string }) => fail(error));
}

View File

@ -3,6 +3,7 @@
*
*/
import saveOrUpdateUser from './saveOrUpdateUser';
import all from './all';
import sexes from './sexes';
import detail from './detail';
import deleteUser from './deleteUser';
@ -16,6 +17,7 @@ import users from './users';
export default {
saveOrUpdateUser,
all,
sexes,
detail,
deleteUser,

View File

@ -1190,6 +1190,32 @@
}
]
},
{
"description": "所有用户",
"name": "all",
"method": "get",
"path": "/user-all",
"response": {
"typeArgs": [
{
"typeArgs": [],
"typeName": "User",
"isDefsType": true,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
],
"typeName": "Array",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"parameters": []
},
{
"description": "用户性别",
"name": "sexes",
@ -3513,7 +3539,7 @@
},
"parameters": [
{
"description": "类型",
"description": "申请单ID",
"required": true,
"in": "path",
"name": "applyId",
@ -3636,13 +3662,45 @@
"enum": [
"'PASS'",
"'UN_PASS'",
"'WAIT'",
"'REJECT'"
"'WAIT_AUDIT'",
"'REJECT'",
"'WAIT_CHECK'"
],
"typeProperties": []
}
}
]
},
{
"description": "提交盘点申请单",
"name": "auditApply",
"method": "post",
"path": "/audit-apply",
"response": {
"typeArgs": [],
"typeName": "",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"parameters": [
{
"required": true,
"in": "body",
"name": "requestBody",
"dataType": {
"typeArgs": [],
"typeName": "AuditApplyInfo",
"isDefsType": true,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
}
]
}
]
},
@ -4283,13 +4341,14 @@
"enum": [
"'PASS'",
"'UN_PASS'",
"'WAIT'",
"'REJECT'"
"'WAIT_AUDIT'",
"'REJECT'",
"'WAIT_CHECK'"
],
"typeProperties": []
},
"name": "reviewResult",
"description": "审核结果(1-通过 2-不通过 3-待审核 4-退回重新盘点)",
"description": "审核结果(1-通过 2-不通过 3-待审核 4-退回重新盘点 5-待盘点)",
"required": false
},
{
@ -4422,6 +4481,249 @@
}
]
},
{
"description": "申请单",
"name": "AuditApplyInfo",
"templateArgs": [],
"properties": [
{
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "applicant",
"description": "申请人",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "applyDate",
"description": "申请日期",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [
"'ALL'",
"'PARTIAL'"
],
"typeProperties": []
},
"name": "auditType",
"description": "盘点类型1: 全盘 2: 部分盘点)",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "createdTime",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "exception",
"description": "异常原因",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [
"'NO_ACTION'",
"'IGNORE_AND_SAVE'",
"'REPLENISH'",
"'OTHER'"
],
"typeProperties": []
},
"name": "handle",
"description": "处理方式(1-无需处理 2-忽略并修改库存 3-补充库存 4-其他)",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "number",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "id",
"required": false
},
{
"dataType": {
"typeArgs": [
{
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
],
"typeName": "Array",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "ids",
"description": "物料ids",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "boolean",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "isConfirm",
"description": "是否确认0: 未确认 1: 已确认)",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "result",
"description": "结果(系统自动生成)",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [
"'PASS'",
"'UN_PASS'",
"'WAIT_AUDIT'",
"'REJECT'",
"'WAIT_CHECK'"
],
"typeProperties": []
},
"name": "reviewResult",
"description": "审核结果(1-通过 2-不通过 3-待审核 4-退回重新盘点 5-待盘点)",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "reviewer",
"description": "盘点审核人",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "taker",
"description": "盘点人",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [
"'PURCHASE_RECEIPT'",
"'RETURN_RECEIPT'",
"'LOAN_OUT'",
"'AUDIT'"
],
"typeProperties": []
},
"name": "type",
"description": "类型1: 采购入库申请 2: 归还入库申请 3: 出库外借申请 4: 盘点申请)",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "updatedTime",
"required": false
}
]
},
{
"description": "全局错误",
"name": "GlobalError",

View File

@ -97,8 +97,8 @@ declare namespace material {
/** 结果(系统自动生成) */
result?: string;
/** 审核结果(1-通过 2-不通过 3-待审核 4-退回重新盘点) */
reviewResult?: 'PASS' | 'UN_PASS' | 'WAIT' | 'REJECT';
/** 审核结果(1-通过 2-不通过 3-待审核 4-退回重新盘点 5-待盘点) */
reviewResult?: 'PASS' | 'UN_PASS' | 'WAIT_AUDIT' | 'REJECT' | 'WAIT_CHECK';
/** 盘点审核人 */
reviewer?: string;
@ -127,6 +127,56 @@ declare namespace material {
detailList?: Array<material.MaterialStockDetail>;
}
/**
*
*/
export interface AuditApplyInfo {
/** 申请人 */
applicant?: string;
/** 申请日期 */
applyDate?: string;
/** 盘点类型1: 全盘 2: 部分盘点) */
auditType?: 'ALL' | 'PARTIAL';
/** createdTime */
createdTime?: string;
/** 异常原因 */
exception?: string;
/** 处理方式(1-无需处理 2-忽略并修改库存 3-补充库存 4-其他) */
handle?: 'NO_ACTION' | 'IGNORE_AND_SAVE' | 'REPLENISH' | 'OTHER';
/** id */
id?: number;
/** 物料ids */
ids?: Array<string>;
/** 是否确认0: 未确认 1: 已确认) */
isConfirm?: boolean;
/** 结果(系统自动生成) */
result?: string;
/** 审核结果(1-通过 2-不通过 3-待审核 4-退回重新盘点 5-待盘点) */
reviewResult?: 'PASS' | 'UN_PASS' | 'WAIT_AUDIT' | 'REJECT' | 'WAIT_CHECK';
/** 盘点审核人 */
reviewer?: string;
/** 盘点人 */
taker?: string;
/** 类型1: 采购入库申请 2: 归还入库申请 3: 出库外借申请 4: 盘点申请) */
type?: 'PURCHASE_RECEIPT' | 'RETURN_RECEIPT' | 'LOAN_OUT' | 'AUDIT';
/** updatedTime */
updatedTime?: string;
}
/**
*
*/

View File

@ -0,0 +1,22 @@
/**
* @desc
*/
import { defaultSuccess, defaultError, http } from '@/plugins/axios';
import type { AxiosResponse } from 'axios';
export default async function (
/** 请求体 */
requestBody: material.AuditApplyInfo,
success: (data: void) => void = defaultSuccess,
fail: (error: { code: string; error?: string }) => void = defaultError,
): Promise<void> {
return http({
method: 'post',
url: `/audit-apply`,
data: requestBody,
})
.then((data: AxiosResponse<void, unknown>) => {
success(data.data);
})
.catch((error: { code: string; error?: string }) => fail(error));
}

View File

@ -4,7 +4,7 @@
import { defaultSuccess, defaultError, http } from '@/plugins/axios';
import type { AxiosResponse } from 'axios';
export default async function (
/** 类型 */
/** 申请单ID */
applyId: number,
success: (data: material.ApplyInfo) => void = defaultSuccess,

View File

@ -6,10 +6,12 @@ import searchPage from './searchPage';
import saveApply from './saveApply';
import detail from './detail';
import searchAuditPage from './searchAuditPage';
import auditApply from './auditApply';
export default {
searchPage,
saveApply,
detail,
searchAuditPage,
auditApply,
};

View File

@ -16,7 +16,7 @@ export interface Params {
/** 创建日期 */
createDate?: string;
/** 审核状态 */
reviewResult?: 'PASS' | 'UN_PASS' | 'WAIT' | 'REJECT';
reviewResult?: 'PASS' | 'UN_PASS' | 'WAIT_AUDIT' | 'REJECT' | 'WAIT_CHECK';
}
export default async function (

View File

@ -8,9 +8,9 @@
<a-form-item label="申请类型" name="applyType">
<a-radio-group v-model:value="formData.applyType" button-style="solid" style="width: 40%;">
<a-radio-button value='1' v-if="applyType === 'PURCHASE_RECEIPT'">采购入库</a-radio-button>
<a-radio-button value='2' v-if="applyType === 'RETURN_RECEIPT'">归还入库</a-radio-button>
<a-radio-button value='3' v-if="applyType === 'LOAN_OUT'">出库外借</a-radio-button>
<a-radio-button value='PURCHASE_RECEIPT' v-if="applyType === 'PURCHASE_RECEIPT'">采购入库</a-radio-button>
<a-radio-button value='RETURN_RECEIPT' v-if="applyType === 'PURCHASE_RECEIPT'">归还入库</a-radio-button>
<a-radio-button value='LOAN_OUT' v-if="applyType === 'LOAN_OUT'">出库外借</a-radio-button>
</a-radio-group>
</a-form-item>
<a-form-item label="申请日期" name="applyDate" style="width: 40%;">

View File

@ -12,32 +12,53 @@
<!-- 页面表格内容 -->
<div style="min-height: calc(100vh - 305px)">
<!-- 表格行 -->
<a-table :columns="columns" :data-source="auditPage?.records" bordered :pagination="pagination"
:loading="loading" row-key="key">
<a-table :columns="columns" :data-source="auditPage?.records" bordered :pagination="pagination" :loading="loading"
row-key="key">
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'auditType'">
{{ record.auditType === 'ALL' ? '全部盘点' : '部分盘点' }}
</template>
<template v-if="column.dataIndex === 'reviewResult'">
<template v-if="record.reviewResult === 'WAIT_CHECK'"> 待盘点</template>
<template v-if="record.reviewResult === 'PASS'"> 通过</template>
<template v-if="record.reviewResult === 'REJECT'"> 拒绝 </template>
<template v-if="record.reviewResult === 'UN_PASS'"> 未通过</template>
<template v-if="record.reviewResult === 'WAIT_AUDIT'"> 待审核</template>
</template>
</template>
</a-table>
</div>
</page-container>
</template>
<script setup lang="ts">
import api from '@/api';
import { IPage } from '@/api/api'
const searchKey = ref('')
import { useUserStore } from '@/stores/user'
const searchKey = ref('')
const auditPage = ref<IPage<material.ApplyForm>>()
const loading = ref(false)
const userStore = useUserStore()
//
const loadData = async (page = 1, size = 10) => {
loading.value = true
api.materialApi.apply.searchAuditPage(
{
page: page,
size: size
size: size,
taker: userStore.userName,
reviewResult: 'WAIT_CHECK',
}, (data) => {
auditPage.value = data
loading.value = false
});
});
}
//
loadData()
@ -49,21 +70,39 @@ const columns = [
dataIndex: 'auditType',
},
{
title: '盘点人',
title: '申请人',
dataIndex: 'applicant',
},
{
title: '盘点审核人',
dataIndex: 'reviewer',
},
{
title: '盘点人',
dataIndex: 'taker',
},
{
title: '任务状态',
dataIndex: 'reviewResult',
},
{
title: '盘点审核人',
dataIndex: 'reviewer',
},
{
title: '创建时间',
dataIndex: 'createdTime',
},
{
title: '盘点结果(系统生成)',
dataIndex: 'result',
},
{
title: '异常原因',
dataIndex: 'exception',
},
{
title: '处理方式',
dataIndex: 'handle',
},
]
//
@ -78,4 +117,5 @@ const pagination = computed(() => {
}
})
</script>

View File

@ -0,0 +1,97 @@
import { FormItem, FormConfig } from '@/components/form-render/form-render-types'
export const config: FormConfig = {
layout: 'horizontal',
colon: true,
hideRequiredMark: false,
labelAlign: 'right',
scrollToFirstError: false,
validateOnRuleChange: true,
labelCol: {
span: 4,
offset: 0,
},
}
export const formItems = (materialOptions: Array<{ value: string | undefined, label: string | undefined }>,
required : Ref<boolean>,
persons: Array<{ value: string | undefined, label: string | undefined }>): FormItem[] => [
{
group: 'form',
type: 'radio',
config: {
autoLink: true,
hasFeedback: false,
label: '盘点类型',
name: 'auditType',
required: true,
},
properties: {
size: 'default',
optionType: 'button',
buttonStyle: 'solid',
defaultValue: "ALL",
options: [{ value: "ALL", label: "全部盘点" }, { value: "PARTIAL", label: "部分盘点" }]
},
rules: [],
},
{
group: 'form',
type: 'select',
hidden: true,
config: {
autoLink: true,
hasFeedback: false,
label: '物料选择',
name: 'ids',
},
properties: {
size: 'default',
mode: 'multiple',
required: required.value,
placeholder: '请选择物料',
options: materialOptions,
},
rules: [],
},
{
group: 'form',
type: 'select',
config: {
autoLink: true,
hasFeedback: false,
label: '盘点人员',
name: 'taker',
required: true,
},
properties: {
size: 'default',
type: 'text',
allowClear: false,
bordered: true,
showCount: false,
options: persons,
placeholder: '请输入盘点人员',
},
rules: [],
},
{
type: 'select',
group: 'form',
config: {
autoLink: true,
hasFeedback: false,
label: '审核人员',
name: 'reviewer',
required: true,
},
properties: {
size: 'default',
controls: true,
placeholder: '请填写审核人员',
options: persons,
},
rules: [],
}
]

View File

@ -8,7 +8,7 @@
@search="loadData()"></a-input-search>
</a-col>
<a-col :span="6">
<a-button type="primary" style="margin-left: 10px">
<a-button type="primary" style="margin-left: 10px" @click="formDrawer?.show()">
<template #icon>
<icon-font type="icon-plus" />
</template>
@ -20,32 +20,115 @@
<!-- 页面表格内容 -->
<div style="min-height: calc(100vh - 305px)">
<!-- 表格行 -->
<a-table :columns="columns" :data-source="auditPage?.records" bordered :pagination="pagination"
:loading="loading" row-key="key">
<a-table :columns="columns" :data-source="auditPage?.records" bordered :pagination="pagination" :loading="loading"
row-key="key">
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'auditType'">
{{ record.auditType === 'ALL' ? '全部盘点' : '部分盘点' }}
</template>
<template v-if="column.dataIndex === 'reviewResult'">
<template v-if="record.reviewResult === 'WAIT_CHECK'"> 待盘点</template>
<template v-if="record.reviewResult === 'PASS'"> 通过</template>
<template v-if="record.reviewResult === 'REJECT'"> 拒绝 </template>
<template v-if="record.reviewResult === 'UN_PASS'"> 未通过</template>
<template v-if="record.reviewResult === 'WAIT_AUDIT'"> 待审核</template>
</template>
<template v-if="column.dataIndex === 'operation'">
<a-button type="link">
<template #icon>
<icon-font type="icon-edit" />
</template>
盘点作业
</a-button>
</template>
</template>
</a-table>
</div>
</page-container>
<form-drawer ref="formDrawer" v-model="applyForm" :form-items="items" :config="formConfig"
:disabled-fields=disabledFields @ok="doSave" title="盘点申请" />
</template>
<script setup lang="ts">
import api from '@/api';
import { IPage } from '@/api/api'
const searchKey = ref('')
import FormDrawer from '@/components/form-render/form-drawer.vue'
import { config, formItems } from './form'
import { notification } from 'ant-design-vue'
import dayjs from 'dayjs';
import { useUserStore } from '@/stores/user'
const searchKey = ref('')
const userStore = useUserStore()
const applyForm = ref<Partial<material.AuditApplyInfo>>({
auditType: 'ALL',
applicant: userStore.userName,
type: 'AUDIT',
applyDate: dayjs()+'',
isConfirm : false,
reviewResult: 'WAIT_CHECK'
})
const auditPage = ref<IPage<material.ApplyForm>>()
const loading = ref(false)
const materialList = ref<Array<{ value: string | undefined, label: string | undefined }>>([])
const personList = ref<Array<{ value: string | undefined, label: string | undefined }>>([])
const required = ref(false)
//
api.materialApi.material.all((data) => {
materialList.value = data.map(item => {
return {
value: item?.id + '',
label: item?.name
}
})
})
api.aclApi.user.all((data) => {
personList.value = data.map(item => {
return {
value: item?.name,
label: item?.fullName
}
})
})
const disabledFields = computed(() => {
if (applyForm.value?.auditType !== 'ALL') {
required.value = true
}
return applyForm.value?.auditType === 'ALL' ? ['materials'] : []
})
//
const formDrawer = ref<typeof FormDrawer>()
const formConfig = computed(() => {
return config
})
//
const items = computed(() => {
return formItems(materialList.value, required, personList.value)
})
//
const loadData = async (page = 1, size = 10) => {
loading.value = true
api.materialApi.apply.searchAuditPage(
{
page: page,
size: size
size: size,
taker: userStore.userName,
reviewResult: 'WAIT_CHECK',
}, (data) => {
auditPage.value = data
loading.value = false
});
});
}
//
loadData()
@ -57,21 +140,31 @@ const columns = [
dataIndex: 'auditType',
},
{
title: '盘点人',
title: '申请人',
dataIndex: 'applicant',
},
{
title: '盘点审核人',
dataIndex: 'reviewer',
},
{
title: '盘点人',
dataIndex: 'taker',
},
{
title: '任务状态',
dataIndex: 'reviewResult',
},
{
title: '盘点审核人',
dataIndex: 'reviewer',
},
{
title: '创建时间',
dataIndex: 'createdTime',
},
{
title: '操作',
dataIndex: 'operation',
width: 400,
}
]
//
@ -86,4 +179,18 @@ const pagination = computed(() => {
}
})
const doSave = (_data: material.AuditApplyInfo) => {
api.materialApi.apply.auditApply(_data, () => {
formDrawer.value?.close()
notification.success({
message: '操作成功',
description: '盘点申请保存成功,页面将自动刷新!',
onClose: () => {
loadData(1)
},
})
})
}
</script>