sparkles: 出入库查询
Some checks failed
Release / lint (push) Successful in 45s
Release / Release (push) Failing after 54s

This commit is contained in:
my_ong 2025-03-23 10:38:55 +08:00
parent 04afb056c3
commit d4447eaf55
5 changed files with 105 additions and 77 deletions

View File

@ -3472,25 +3472,10 @@
} }
}, },
{ {
"description": "物料编码", "description": "编码/名称",
"required": false, "required": false,
"in": "query", "in": "query",
"name": "code", "name": "key",
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
},
{
"description": "物料名称",
"required": false,
"in": "query",
"name": "name",
"dataType": { "dataType": {
"typeArgs": [], "typeArgs": [],
"typeName": "string", "typeName": "string",
@ -3667,7 +3652,7 @@
} }
}, },
{ {
"description": "物料编码", "description": "编码/名称",
"required": false, "required": false,
"in": "query", "in": "query",
"name": "code", "name": "code",
@ -3680,21 +3665,6 @@
"enum": [], "enum": [],
"typeProperties": [] "typeProperties": []
} }
},
{
"description": "物料名称",
"required": false,
"in": "query",
"name": "name",
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
} }
] ]
}, },

View File

@ -8,10 +8,8 @@ export interface Params {
applyType: number applyType: number
/** 物料类型 */ /** 物料类型 */
type?: string type?: string
/** 物料编码 */ /** 编码/名称 */
code?: string code?: string
/** 物料名称 */
name?: string
} }
export default async function ( export default async function (

View File

@ -1,37 +1,35 @@
/** /**
* @desc * @desc
*/ */
import { defaultSuccess, defaultError, http } from '@/plugins/axios'; import { defaultSuccess, defaultError, http } from '@/plugins/axios'
import type { AxiosResponse } from 'axios'; import type { AxiosResponse } from 'axios'
import type { IPage } from '@/api/api'; import type { IPage } from '@/api/api'
export interface Params { export interface Params {
/** 申请类型(1入库 3出库 4盘点) */ /** 申请类型(1入库 3出库 4盘点) */
applyType: number; applyType: number
/** 页码 */ /** 页码 */
page?: number; page?: number
/** 页面大小 */ /** 页面大小 */
size?: number; size?: number
/** 物料类型 */ /** 物料类型 */
type?: string; type?: string
/** 物料编码 */ /** 编码/名称 */
code?: string; key?: string
/** 物料名称 */
name?: string;
} }
export default async function ( export default async function (
params: Params, params: Params,
success: (data: IPage<material.ApplyDTO>) => void = defaultSuccess, success: (data: IPage<material.ApplyDTO>) => void = defaultSuccess,
fail: (error: { code: string; error?: string }) => void = defaultError, fail: (error: { code: string; error?: string }) => void = defaultError,
): Promise<void> { ): Promise<void> {
return http({ return http({
method: 'get', method: 'get',
url: `/applies`, url: `/applies`,
params, params,
}) })
.then((data: AxiosResponse<IPage<material.ApplyDTO>, unknown>) => { .then((data: AxiosResponse<IPage<material.ApplyDTO>, unknown>) => {
success(data.data); success(data.data)
}) })
.catch((error: { code: string; error?: string }) => fail(error)); .catch((error: { code: string; error?: string }) => fail(error))
} }

View File

@ -2,15 +2,29 @@
<page-container> <page-container>
<!-- 页面操作栏 --> <!-- 页面操作栏 -->
<template #ops> <template #ops>
<a-row> <a-row style="width: 600px">
<a-col :span="18"> <a-col :span="8">
<a-tree-select
v-model:value="typeVal"
show-search
style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
placeholder="请选择物料类型"
allow-clear
:tree-data="types"
tree-node-filter-prop="label"
/>
</a-col>
<a-col :span="8">
<a-input-search <a-input-search
v-model:value="searchKey" v-model:value="searchKey"
:placeholder="`名称/编码/类型`" :placeholder="`名称/编码`"
allow-clear allow-clear
enter-button enter-button
@search="loadData()" @search="loadData()"
></a-input-search> ></a-input-search>
</a-col>
<a-col :span="8">
<a-button type="primary" @click="downloadData()">导出</a-button> <a-button type="primary" @click="downloadData()">导出</a-button>
</a-col> </a-col>
</a-row> </a-row>
@ -40,10 +54,12 @@
import api from '@/api' import api from '@/api'
import { IPage } from '@/api/api' import { IPage } from '@/api/api'
import { http } from '@/settings/http' import { http } from '@/settings/http'
import { TreeDataNode } from 'ant-design-vue/es/vc-tree-select/interface'
const searchKey = ref('') const searchKey = ref('')
const pagedata = ref<IPage<material.ApplyDTO>>() const pagedata = ref<IPage<material.ApplyDTO>>()
const loading = ref(false) const loading = ref(false)
const typeVal = ref<string>() //
// //
const loadData = async (page = 1, size = 10) => { const loadData = async (page = 1, size = 10) => {
@ -53,9 +69,8 @@
page: page, page: page,
size: size, size: size,
applyType: 1, applyType: 1,
type: searchKey.value, type: typeVal.value,
code: searchKey.value, key: searchKey.value,
name: searchKey.value,
}, },
(data) => { (data) => {
pagedata.value = data pagedata.value = data
@ -69,7 +84,8 @@
// //
const downloadData = () => { const downloadData = () => {
// excel // excel
const url = `${http.prefix}/apply/download-excel?applyType=1&type=${searchKey.value}&code=${searchKey.value}&name=${searchKey.value}` const url = `${http.prefix}/apply/download-excel?applyType=1
&type=${typeVal.value}&key=${searchKey.value}`
window.open(url) window.open(url)
} }
// //
@ -91,6 +107,10 @@
title: '物料编码', title: '物料编码',
dataIndex: 'code', dataIndex: 'code',
}, },
{
title: '物料型号',
dataIndex: 'typeName',
},
{ {
title: '入库类型', title: '入库类型',
dataIndex: 'applyTypeInfo', dataIndex: 'applyTypeInfo',
@ -129,4 +149,18 @@
}, },
} }
}) })
//
const types = ref<Array<TreeDataNode>>([])
api.materialApi.type.trees((data) => {
types.value = children(data)
})
const children = (res: Array<material.TypeTree>): Array<TreeDataNode> => {
return res.map((areaTree) => ({
label: areaTree.label,
value: areaTree.value,
children: areaTree.children ? children(areaTree.children) : [],
key: areaTree.value,
}))
}
</script> </script>

View File

@ -2,15 +2,29 @@
<page-container> <page-container>
<!-- 页面操作栏 --> <!-- 页面操作栏 -->
<template #ops> <template #ops>
<a-row> <a-row style="width: 600px">
<a-col :span="18"> <a-col :span="8">
<a-tree-select
v-model:value="typeVal"
show-search
style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
placeholder="请选择物料类型"
allow-clear
:tree-data="types"
tree-node-filter-prop="label"
/>
</a-col>
<a-col :span="8">
<a-input-search <a-input-search
v-model:value="searchKey" v-model:value="searchKey"
:placeholder="`请输入`" :placeholder="`名称/编码`"
allow-clear allow-clear
enter-button enter-button
@search="loadData()" @search="loadData()"
></a-input-search> ></a-input-search>
</a-col>
<a-col :span="8">
<a-button type="primary" @click="downloadData()">导出</a-button> <a-button type="primary" @click="downloadData()">导出</a-button>
</a-col> </a-col>
</a-row> </a-row>
@ -80,10 +94,12 @@
import { IPage } from '@/api/api' import { IPage } from '@/api/api'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
import { http } from '@/settings/http' import { http } from '@/settings/http'
import { TreeDataNode } from 'ant-design-vue/es/vc-tree-select/interface'
const searchKey = ref('') const searchKey = ref('')
const pagedata = ref<IPage<material.ApplyDTO>>() const pagedata = ref<IPage<material.ApplyDTO>>()
const loading = ref(false) const loading = ref(false)
const typeVal = ref<string>() //
const userStore = useUserStore() const userStore = useUserStore()
// //
@ -94,9 +110,8 @@
page: page, page: page,
size: size, size: size,
applyType: 3, applyType: 3,
type: searchKey.value, type: typeVal.value,
code: searchKey.value, key: searchKey.value,
name: searchKey.value,
}, },
(data) => { (data) => {
pagedata.value = data pagedata.value = data
@ -110,7 +125,7 @@
// //
const downloadData = () => { const downloadData = () => {
// excel // excel
const url = `${http.prefix}/apply/download-excel?applyType=3&type=${searchKey.value}&code=${searchKey.value}&name=${searchKey.value}` const url = `${http.prefix}/apply/download-excel?applyType=3&type=${typeVal.value}&key=${searchKey.value}`
window.open(url) window.open(url)
} }
@ -216,4 +231,17 @@
}, },
) )
} }
//
const types = ref<Array<TreeDataNode>>([])
api.materialApi.type.trees((data) => {
types.value = children(data)
})
const children = (res: Array<material.TypeTree>): Array<TreeDataNode> => {
return res.map((areaTree) => ({
label: areaTree.label,
value: areaTree.value,
children: areaTree.children ? children(areaTree.children) : [],
key: areaTree.value,
}))
}
</script> </script>