sparkles: ✨ 出入库查询
This commit is contained in:
parent
04afb056c3
commit
d4447eaf55
@ -3472,25 +3472,10 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "物料编码",
|
||||
"description": "编码/名称",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"name": "code",
|
||||
"dataType": {
|
||||
"typeArgs": [],
|
||||
"typeName": "string",
|
||||
"isDefsType": false,
|
||||
"templateIndex": -1,
|
||||
"compileTemplateKeyword": "#/definitions/",
|
||||
"enum": [],
|
||||
"typeProperties": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "物料名称",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"name": "name",
|
||||
"name": "key",
|
||||
"dataType": {
|
||||
"typeArgs": [],
|
||||
"typeName": "string",
|
||||
@ -3667,7 +3652,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "物料编码",
|
||||
"description": "编码/名称",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"name": "code",
|
||||
@ -3680,21 +3665,6 @@
|
||||
"enum": [],
|
||||
"typeProperties": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "物料名称",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"name": "name",
|
||||
"dataType": {
|
||||
"typeArgs": [],
|
||||
"typeName": "string",
|
||||
"isDefsType": false,
|
||||
"templateIndex": -1,
|
||||
"compileTemplateKeyword": "#/definitions/",
|
||||
"enum": [],
|
||||
"typeProperties": []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -8,10 +8,8 @@ export interface Params {
|
||||
applyType: number
|
||||
/** 物料类型 */
|
||||
type?: string
|
||||
/** 物料编码 */
|
||||
/** 编码/名称 */
|
||||
code?: string
|
||||
/** 物料名称 */
|
||||
name?: string
|
||||
}
|
||||
|
||||
export default async function (
|
||||
|
@ -1,37 +1,35 @@
|
||||
/**
|
||||
* @desc 分页查询申请列表
|
||||
*/
|
||||
import { defaultSuccess, defaultError, http } from '@/plugins/axios';
|
||||
import type { AxiosResponse } from 'axios';
|
||||
import type { IPage } from '@/api/api';
|
||||
import { defaultSuccess, defaultError, http } from '@/plugins/axios'
|
||||
import type { AxiosResponse } from 'axios'
|
||||
import type { IPage } from '@/api/api'
|
||||
export interface Params {
|
||||
/** 申请类型(1入库 3出库 4盘点) */
|
||||
applyType: number;
|
||||
/** 页码 */
|
||||
page?: number;
|
||||
/** 页面大小 */
|
||||
size?: number;
|
||||
/** 物料类型 */
|
||||
type?: string;
|
||||
/** 物料编码 */
|
||||
code?: string;
|
||||
/** 物料名称 */
|
||||
name?: string;
|
||||
/** 申请类型(1入库 3出库 4盘点) */
|
||||
applyType: number
|
||||
/** 页码 */
|
||||
page?: number
|
||||
/** 页面大小 */
|
||||
size?: number
|
||||
/** 物料类型 */
|
||||
type?: string
|
||||
/** 编码/名称 */
|
||||
key?: string
|
||||
}
|
||||
|
||||
export default async function (
|
||||
params: Params,
|
||||
success: (data: IPage<material.ApplyDTO>) => void = defaultSuccess,
|
||||
fail: (error: { code: string; error?: string }) => void = defaultError,
|
||||
params: Params,
|
||||
success: (data: IPage<material.ApplyDTO>) => void = defaultSuccess,
|
||||
fail: (error: { code: string; error?: string }) => void = defaultError,
|
||||
): Promise<void> {
|
||||
return http({
|
||||
method: 'get',
|
||||
url: `/applies`,
|
||||
return http({
|
||||
method: 'get',
|
||||
url: `/applies`,
|
||||
|
||||
params,
|
||||
})
|
||||
.then((data: AxiosResponse<IPage<material.ApplyDTO>, unknown>) => {
|
||||
success(data.data);
|
||||
})
|
||||
.catch((error: { code: string; error?: string }) => fail(error));
|
||||
params,
|
||||
})
|
||||
.then((data: AxiosResponse<IPage<material.ApplyDTO>, unknown>) => {
|
||||
success(data.data)
|
||||
})
|
||||
.catch((error: { code: string; error?: string }) => fail(error))
|
||||
}
|
||||
|
@ -2,15 +2,29 @@
|
||||
<page-container>
|
||||
<!-- 页面操作栏 -->
|
||||
<template #ops>
|
||||
<a-row>
|
||||
<a-col :span="18">
|
||||
<a-row style="width: 600px">
|
||||
<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
|
||||
v-model:value="searchKey"
|
||||
:placeholder="`名称/编码/类型`"
|
||||
:placeholder="`名称/编码`"
|
||||
allow-clear
|
||||
enter-button
|
||||
@search="loadData()"
|
||||
></a-input-search>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-button type="primary" @click="downloadData()">导出</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@ -40,10 +54,12 @@
|
||||
import api from '@/api'
|
||||
import { IPage } from '@/api/api'
|
||||
import { http } from '@/settings/http'
|
||||
import { TreeDataNode } from 'ant-design-vue/es/vc-tree-select/interface'
|
||||
|
||||
const searchKey = ref('')
|
||||
const pagedata = ref<IPage<material.ApplyDTO>>()
|
||||
const loading = ref(false)
|
||||
const typeVal = ref<string>() // 物料类型选择值
|
||||
|
||||
// 加载数据的方法
|
||||
const loadData = async (page = 1, size = 10) => {
|
||||
@ -53,9 +69,8 @@
|
||||
page: page,
|
||||
size: size,
|
||||
applyType: 1,
|
||||
type: searchKey.value,
|
||||
code: searchKey.value,
|
||||
name: searchKey.value,
|
||||
type: typeVal.value,
|
||||
key: searchKey.value,
|
||||
},
|
||||
(data) => {
|
||||
pagedata.value = data
|
||||
@ -69,7 +84,8 @@
|
||||
//导出数据
|
||||
const downloadData = () => {
|
||||
// 调用后端接口下载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)
|
||||
}
|
||||
//表格列
|
||||
@ -91,6 +107,10 @@
|
||||
title: '物料编码',
|
||||
dataIndex: 'code',
|
||||
},
|
||||
{
|
||||
title: '物料型号',
|
||||
dataIndex: 'typeName',
|
||||
},
|
||||
{
|
||||
title: '入库类型',
|
||||
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>
|
||||
|
@ -2,15 +2,29 @@
|
||||
<page-container>
|
||||
<!-- 页面操作栏 -->
|
||||
<template #ops>
|
||||
<a-row>
|
||||
<a-col :span="18">
|
||||
<a-row style="width: 600px">
|
||||
<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
|
||||
v-model:value="searchKey"
|
||||
:placeholder="`请输入`"
|
||||
:placeholder="`名称/编码`"
|
||||
allow-clear
|
||||
enter-button
|
||||
@search="loadData()"
|
||||
></a-input-search>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-button type="primary" @click="downloadData()">导出</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@ -80,10 +94,12 @@
|
||||
import { IPage } from '@/api/api'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { http } from '@/settings/http'
|
||||
import { TreeDataNode } from 'ant-design-vue/es/vc-tree-select/interface'
|
||||
|
||||
const searchKey = ref('')
|
||||
const pagedata = ref<IPage<material.ApplyDTO>>()
|
||||
const loading = ref(false)
|
||||
const typeVal = ref<string>() // 物料类型选择值
|
||||
|
||||
const userStore = useUserStore()
|
||||
// 加载数据的方法
|
||||
@ -94,9 +110,8 @@
|
||||
page: page,
|
||||
size: size,
|
||||
applyType: 3,
|
||||
type: searchKey.value,
|
||||
code: searchKey.value,
|
||||
name: searchKey.value,
|
||||
type: typeVal.value,
|
||||
key: searchKey.value,
|
||||
},
|
||||
(data) => {
|
||||
pagedata.value = data
|
||||
@ -110,7 +125,7 @@
|
||||
//导出数据
|
||||
const downloadData = () => {
|
||||
// 调用后端接口下载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)
|
||||
}
|
||||
|
||||
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user