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

View File

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

View File

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

View File

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

File diff suppressed because one or more lines are too long