Skip to content

Commit deb32fa

Browse files
author
piexlmax(奇淼
committed
fixed:#1659 调整table中sort驼峰对应不到数据库字段的问题
1 parent f17a738 commit deb32fa

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

server/resource/autocode_template/web/table.vue.tpl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,22 @@ const searchInfo = ref({})
452452
{{- if .NeedSort}}
453453
// 排序
454454
const sortChange = ({ prop, order }) => {
455-
searchInfo.value.sort = prop
455+
const sortMap = {
456+
{{- range .Fields}}
457+
{{- if and .Sort}}
458+
{{- if not (eq .ColumnName "")}}
459+
{{.FieldJson}}: '{{.ColumnName}}',
460+
{{- end}}
461+
{{- end}}
462+
{{- end}}
463+
}
464+
465+
let sort = sortMap[prop]
466+
if(!sort){
467+
sort = prop.replace(/[A-Z]/g, match => _${match.toLowerCase()})
468+
}
469+
470+
searchInfo.value.sort = sort
456471
searchInfo.value.order = order
457472
getTableData()
458473
}

0 commit comments

Comments
 (0)