From 26d0fa42ea8c63a87e8ef93d0915f75f46fb1f9c Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 24 三月 2022 11:09:53 +0800 Subject: [PATCH] 2022-03-24 --- src/components/normalform/modalform/mkTable/index.jsx | 27 +++++++++++++++++++++++++-- 1 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/components/normalform/modalform/mkTable/index.jsx b/src/components/normalform/modalform/mkTable/index.jsx index 053316f..28dafc3 100644 --- a/src/components/normalform/modalform/mkTable/index.jsx +++ b/src/components/normalform/modalform/mkTable/index.jsx @@ -86,8 +86,8 @@ return <MkEditIcon allowClear/> } else if (inputType === 'select') { return ( - <Select> - {options.map((item, i) => (<Select.Option key={i} value={item.field || item.value}> {item.label || item.text} </Select.Option>))} + <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}> + {options.map((item, i) => (<Select.Option key={i} value={item.field || item.value}>{item.label || item.text}</Select.Option>))} </Select> ) } else if (inputType === 'multiStr') { @@ -297,6 +297,29 @@ }) }) }) + } else if (col.inputType === 'cascader') { + let keys = record[col.dataIndex] + let _options = [] + let rematch = (options, level) => { + options.some(m => { + if (!m.value || m.value !== keys[level]) return false + + _options.push(m) + + if (m.children && keys[level + 1]) { + rematch(m.children, level + 1) + } + return true + }) + } + + rematch(col.options, 0) + + if (_options.length) { + col.extends.forEach(n => { + record[n.value] = _options.map(o => o[n.key]).join(' / ') + }) + } } else { let key = record[col.dataIndex] let option = col.options.filter(m => m.value === key)[0] -- Gitblit v1.8.0