sparkles: 物料界面修改
Some checks failed
Release / lint (push) Successful in 49s
Release / Release (push) Failing after 52s

This commit is contained in:
my_ong 2025-03-02 15:10:27 +08:00
parent 8953941362
commit fbf3579fa8
5 changed files with 170 additions and 26 deletions

View File

@ -5429,15 +5429,15 @@
{
"dataType": {
"typeArgs": [],
"typeName": "",
"typeName": "boolean",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": ["'LOW_VALUE'", "'HIGH_VALUE'"],
"enum": [],
"typeProperties": []
},
"name": "assignRule",
"description": "赋码规则(2-低值易耗品(不参与赋码) 1-高价值工具类(参与唯一赋码)",
"description": "是否赋码",
"required": false
},
{
@ -5508,6 +5508,20 @@
"description": "名称",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "number",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "price",
"description": "价格",
"required": false
},
{
"dataType": {
"typeArgs": [],

View File

@ -180,8 +180,8 @@ declare namespace material {
*
*/
export interface Material {
/** 赋码规则(2-低值易耗品(不参与赋码) 1-高价值工具类(参与唯一赋码) */
assignRule?: 'LOW_VALUE' | 'HIGH_VALUE'
/** 是否赋码 */
assignRule?: boolean
/** 编码 */
code?: string
@ -198,6 +198,9 @@ declare namespace material {
/** 名称 */
name?: string
/** 价格 */
price?: number
/** 规格 */
spec?: string

View File

@ -1,4 +1,5 @@
import { FormItem, FormConfig } from '@/components/form-render/form-render-types'
import { TreeDataNode } from 'ant-design-vue/es/vc-tree-select/interface'
export const config: FormConfig = {
layout: 'horizontal',
@ -13,7 +14,7 @@ export const config: FormConfig = {
},
}
export const formItems: FormItem[] = [
export const formItems = (types: TreeDataNode[]): FormItem[] => [
{
group: 'form',
type: 'input',
@ -35,21 +36,22 @@ export const formItems: FormItem[] = [
rules: [],
},
{
type: 'tree-select',
group: 'form',
type: 'input',
config: {
autoLink: true,
hasFeedback: false,
label: '物料类型',
name: 'type',
name: 'areaNo',
required: true,
extra: '',
help: '',
htmlFor: 'sgsg',
},
properties: {
size: 'default',
type: 'text',
allowClear: false,
bordered: true,
showCount: false,
placeholder: '请输入物料类型',
treeData: types,
placeholder: '请选择物料类型',
},
rules: [],
},
@ -71,23 +73,35 @@ export const formItems: FormItem[] = [
rules: [],
},
{
type: 'select',
type: 'input-number',
group: 'form',
config: {
autoLink: true,
hasFeedback: false,
label: '赋码规则',
name: 'assignRule',
label: '价格',
name: 'price',
required: true,
},
properties: {
size: 'default',
controls: true,
placeholder: '请填写赋码规则',
options: [
{ label: '低值易耗品', value: 'LOW_VALUE' },
{ label: '高价值工具类', value: 'HIGH_VALUE' },
],
placeholder: '请填写价格',
},
rules: [],
},
{
type: 'switch',
group: 'form',
config: {
autoLink: true,
hasFeedback: false,
label: '是否赋码',
name: 'azry',
required: true,
},
properties: {
size: 'default',
},
rules: [],
},

View File

@ -36,7 +36,7 @@
<!-- 操作按钮列 -->
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'assignRule'">
{{ record.assignRule === 'HIGH_VALUE' ? '高价值工具类' : '低值易耗品' }}
{{ record.assignRule === 'HIGH_VALUE' ? '是' : '否' }}
</template>
<template v-if="column.dataIndex === 'operation'">
<a-button type="link" :style="{ color: token.colorPrimary }" @click="addOrEdit(record)">
@ -100,6 +100,7 @@
import { config, formItems } from './form'
import { FormDataType } from '@/components/form-render/form-render-types'
import printCode from './print-code.vue'
import { TreeDataNode } from 'ant-design-vue/es/vc-tree-select/interface'
const { useToken } = theme
const { token } = useToken()
@ -110,6 +111,21 @@
const materialIdRef = ref<number>()
const printcodeRef = ref()
//
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 loadData = async (page = 1, size = 10) => {
loading.value = true
@ -128,8 +144,8 @@
const columns = [
{
title: '物料序号',
dataIndex: 'id',
// className: 'notshow',
dataIndex: 'key',
customRender: ({ index }: { index: number }) => `${index + 1}`,
},
{
title: '物料编码',
@ -139,6 +155,10 @@
title: '物料名称',
dataIndex: 'name',
},
{
title: '价格',
dataIndex: 'price',
},
{
title: '物料类型',
dataIndex: 'type',
@ -148,7 +168,7 @@
dataIndex: 'spec',
},
{
title: '赋码规则',
title: '是否赋码',
dataIndex: 'assignRule',
},
{
@ -184,7 +204,7 @@
})
//
const items = computed(() => {
return formItems
return formItems(types.value)
})
//

File diff suppressed because one or more lines are too long