From 6b5cb9058495b03f0a3ad36e0169c1c2e5dbabc4 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 27 四月 2023 16:55:57 +0800 Subject: [PATCH] 2023-04-27 --- src/templates/zshare/modalform/index.jsx | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-) diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx index 043f984..05f4698 100644 --- a/src/templates/zshare/modalform/index.jsx +++ b/src/templates/zshare/modalform/index.jsx @@ -808,6 +808,52 @@ return fields } + transfer = (options) => { + if (options.length === 0) return options + + let isNumber = true + options.forEach(item => { + if (!/^([0-9]|[1-9]\d{0,2})$/.test(item.Value)) { + isNumber = false + } + }) + + if (isNumber) { + return options.map(item => { + item.Value = +item.Value + return item + }) + } else { + return options.map(item => { + item.Value = item.Value + '' + return item + }) + } + } + + transferCard = (options) => { + if (options.length === 0) return options + + let isNumber = true + options.forEach(item => { + if (!/^([0-9]|[1-9]\d{0,2})$/.test(item.$value)) { + isNumber = false + } + }) + + if (isNumber) { + return options.map(item => { + item.$value = +item.$value + return item + }) + } else { + return options.map(item => { + item.$value = item.$value + '' + return item + }) + } + } + handleConfirm = () => { // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� return new Promise((resolve, reject) => { @@ -823,6 +869,8 @@ if (values.type === 'radio' && values.linkField) { type = 'link' } + + values.options = this.transfer(values.options) if (values.options.filter(op => op.Text === '').length > 0) { notification.warning({ @@ -877,6 +925,8 @@ return m }) + values.options = this.transferCard(values.options) + let type = values.type if (values.linkField) { type = 'link' -- Gitblit v1.8.0