From 9786886c3f52b82cd772034fa150cd9526e1e3c9 Mon Sep 17 00:00:00 2001 From: pixelmaxQM Date: Fri, 18 Oct 2024 21:23:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9C=A8=E5=AD=98=E5=9C=A8enum?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=E8=87=AA=E5=8A=A8=E5=8C=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=97=B6=E5=80=99=E4=BC=9A=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E5=85=B6=E8=B5=8B=E5=80=BC=E5=B9=B6=E4=B8=94=E5=9C=A8=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=97=B6=E5=80=99=E8=87=AA=E5=8A=A8=E5=8C=85=E8=A3=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/view/systemTools/autoCode/index.vue | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/web/src/view/systemTools/autoCode/index.vue b/web/src/view/systemTools/autoCode/index.vue index 8aef959ab4..62d952f74b 100644 --- a/web/src/view/systemTools/autoCode/index.vue +++ b/web/src/view/systemTools/autoCode/index.vue @@ -1207,6 +1207,20 @@ const enterForm = async(isPreview) => { return false } form.value.humpPackageName = toSQLLine(form.value.packageName) + + form.value.fields.forEach(item => { + if(item.fieldType === 'enum'){ + // 判断一下 item.dataTypeLong 按照,切割后的每个元素是否都使用 '' 包裹,如果没包 则修改为包裹起来的 然后再转为字符串赋值给 item.dataTypeLong + const arr = item.dataTypeLong.split(',') + arr.forEach((ele, index) => { + if(ele.indexOf("'") === -1){ + arr[index] = `'${ele}'` + } + }) + item.dataTypeLong = arr.join(',') + } + }) + delete form.value.primaryField if (isPreview) { const data = await preview(form.value)