sparkles: 修改人工盘点样式业务逻辑
All checks were successful
Release / lint (push) Successful in 1m11s
Release / Release (push) Successful in 4m22s

This commit is contained in:
my_ong 2025-03-29 21:49:22 +08:00
parent 208e58c1f6
commit c8b45e7477
10 changed files with 94 additions and 399 deletions

View File

@ -3655,7 +3655,7 @@
"description": "编码/名称",
"required": false,
"in": "query",
"name": "code",
"name": "key",
"dataType": {
"typeArgs": [],
"typeName": "string",
@ -3977,6 +3977,48 @@
}
]
},
{
"description": "查询人工盘点选中物料的待核查数据",
"name": "getManualCheckData",
"method": "get",
"path": "/manual/check-data/{applyId}",
"response": {
"typeArgs": [
{
"typeArgs": [],
"typeName": "Material",
"isDefsType": true,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
],
"typeName": "Array",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"parameters": [
{
"description": "申请单ID",
"required": true,
"in": "path",
"name": "applyId",
"dataType": {
"typeArgs": [],
"typeName": "number",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
}
]
},
{
"description": "获取人工盘点数据",
"name": "getManualStock",
@ -4987,6 +5029,7 @@
"typeProperties": []
},
"name": "assignRule",
"description": "是否需要赋码",
"required": false
},
{

View File

@ -59,7 +59,7 @@ declare namespace material {
/** 申请单ID */
applyId?: number
/** assignRule */
/** 是否需要赋码 */
assignRule?: boolean
/** 确认数量 */

View File

@ -9,7 +9,7 @@ export interface Params {
/** 物料类型 */
type?: string
/** 编码/名称 */
code?: string
key?: string
}
export default async function (

View File

@ -0,0 +1,21 @@
/**
* @desc
*/
import { defaultSuccess, defaultError, http } from '@/plugins/axios'
import type { AxiosResponse } from 'axios'
export default async function (
/** 申请单ID */
applyId: number,
success: (data: Array<material.Material>) => void = defaultSuccess,
fail: (error: { code: string; error?: string }) => void = defaultError,
): Promise<void> {
return http({
method: 'get',
url: `/manual/check-data/${applyId}`,
})
.then((data: AxiosResponse<Array<material.Material>, unknown>) => {
success(data.data)
})
.catch((error: { code: string; error?: string }) => fail(error))
}

View File

@ -12,6 +12,7 @@ import auditApply from './auditApply'
import getComparisonRes from './getComparisonRes'
import updateReviewResult from './updateReviewResult'
import submitManualStock from './submitManualStock'
import getManualCheckData from './getManualCheckData'
import getManualStock from './getManualStock'
import saveScanData from './saveScanData'
import submitScrapOutReview from './submitScrapOutReview'
@ -30,6 +31,7 @@ export default {
getComparisonRes,
updateReviewResult,
submitManualStock,
getManualCheckData,
getManualStock,
saveScanData,
submitScrapOutReview,

View File

@ -1,33 +1,4 @@
<template>
<a-form name="basic" layout="horizontal" label-wrap>
<a-form-item label="选择物料" name="selected">
<div style="display: flex; justify-content: space-between">
<a-tree-select
v-model:value="typeVal"
show-search
style="width: 49%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
placeholder="请选择物料类型"
allow-clear
:tree-data="types"
tree-node-filter-prop="label"
/>
<a-select
v-model:value="slectedList"
mode="multiple"
bordered
placeholder="请选择物料"
style="width: 49%"
show-search
:options="options"
:filter-option="filterOption"
@deselect="removeEvent($event)"
@select="insertEvent($event)"
></a-select>
</div>
</a-form-item>
</a-form>
<!-- vxe-table -->
<div>
<vxe-table
@ -83,11 +54,8 @@
<script lang="ts" setup>
import api from '@/api'
import { TreeDataNode } from 'ant-design-vue/es/vc-tree-select/interface'
import dayjs, { Dayjs } from 'dayjs'
import { VxeTableInstance } from 'vxe-table'
import { LabeledValue, DefaultOptionType } from 'ant-design-vue/es/select'
import { SelectHandler } from 'ant-design-vue/es/vc-select/Select'
//
@ -116,48 +84,6 @@
}
defineExpose({ getTableData })
const typeVal = ref('')
const slectedList = ref<number[]>([])
//
const options = ref<{ label: string; value: number }[]>([])
const materialList = ref<material.Material[]>([])
const getMaterialList = async () => {
await api.materialApi.material.all({ type: typeVal.value, assignRule: false }, (data) => {
materialList.value = data
})
options.value = materialList.value.map((item) => {
return { label: item.name ? item.name : '未知', value: item.id ? item.id : -1 }
})
}
watch(
typeVal,
(newVal) => {
if (newVal !== '') {
getMaterialList()
}
},
{ immediate: true, deep: true },
)
//
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,
}))
}
//
const filterOption = (input: string, option: { label: string; value: number }) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
// vxe-table
export interface RowVO {
id: number
@ -179,6 +105,30 @@
// vxe-table
const tableData = ref<Array<RowVO>>([])
//
const fetchData = () => {
api.materialApi.apply.getManualCheckData(props.applyId, (data) => {
tableData.value = data.map((item) => {
return {
id: item.id ? item.id : 0,
name: item.name ? item.name : '',
code: item.code ? item.code : '',
spec: item.spec ? item.spec : '',
type: item.type ? item.type : '',
typeName: item.typeName ? item.typeName : '',
stock: item.stock ? item.stock : 0,
manualStock: 0,
disabled: false,
checked: false,
price: item.price ? item.price : 0,
assignRule: false,
msg: '',
}
})
})
}
fetchData()
window.console.log(11111)
interface FormData {
applicant: string //
@ -208,42 +158,4 @@
$table.remove(row)
}
}
// table
type Insert = SelectHandler<LabeledValue, DefaultOptionType> | undefined
const removeEvent = (value: Insert) => {
const $table = tableRef.value
// value
if ($table) {
$table.getTableData().fullData.forEach((item) => {
if (item.id === value) {
$table.remove(item)
}
})
}
}
const insertEvent = (value: Insert) => {
// value
const m = materialList.value.find((item) => item.id === value)
if (m) {
const row: RowVO = {
id: m.id ? m.id : -1,
name: m.name ? m.name : '',
code: m.code ? m.code : '',
spec: m.spec ? m.spec : '',
typeName: m.typeName ? m.typeName : '',
type: m.type ? m.type : '',
price: m.price ? m.price : 0,
stock: m.stock ? m.stock : 0,
manualStock: 0,
assignRule: m.assignRule ? m.assignRule : false,
disabled: false,
checked: false,
msg: '',
}
const $table = tableRef.value
if ($table) {
$table.insertAt(row, -1)
}
}
}
</script>

View File

@ -177,7 +177,7 @@
materialList.value = data.map((item) => {
return {
value: item?.id + '',
label: item?.name,
label: item?.name + '(' + item.spec + ')',
}
})
})

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long