解决ai编码options空的问题

This commit is contained in:
神仙都没用 2024-08-05 14:26:38 +08:00
parent f3b3bd7e8d
commit 3ada755dcc

View File

@ -226,7 +226,7 @@ export function useCode() {
// 字典
const dict = item.component?.options || column.dict;
if (dict) {
if (!isEmpty(dict)) {
options[item.prop] = dict;
const str = `$$options.${item.prop}$$`;
@ -326,13 +326,17 @@ export function useCode() {
// 筛选
const clFilter = fieldEq
.map((field) => {
const item = upsert.items.find((e) => e.prop == field);
if (item) {
return `<!-- 筛选${item.label} -->\n<cl-filter label="${item.label}">\n<cl-select prop="${field}" :options="options.${field}" />\n</cl-filter>`;
} else {
if (isEmpty(options[field])) {
return "";
}
const item = upsert.items.find((e) => e.prop == field);
if (!item) {
return "";
}
return `<!-- 筛选${item.label} -->\n<cl-filter label="${item.label}">\n<cl-select prop="${field}" :options="options.${field}" />\n</cl-filter>`;
})
.filter(Boolean)
.join("\n");