From deb32fa0fa32fe695ae09da1c92231fbbbe95151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?piexlmax=EF=BC=88=E5=A5=87=E6=B7=BC?= Date: Fri, 1 Mar 2024 11:04:52 +0800 Subject: [PATCH] =?UTF-8?q?fixed:#1659=20=E8=B0=83=E6=95=B4table=E4=B8=ADs?= =?UTF-8?q?ort=E9=A9=BC=E5=B3=B0=E5=AF=B9=E5=BA=94=E4=B8=8D=E5=88=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E5=AD=97=E6=AE=B5=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../autocode_template/web/table.vue.tpl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/server/resource/autocode_template/web/table.vue.tpl b/server/resource/autocode_template/web/table.vue.tpl index e585521ef..a2661377f 100644 --- a/server/resource/autocode_template/web/table.vue.tpl +++ b/server/resource/autocode_template/web/table.vue.tpl @@ -452,7 +452,22 @@ const searchInfo = ref({}) {{- if .NeedSort}} // 排序 const sortChange = ({ prop, order }) => { - searchInfo.value.sort = prop + const sortMap = { + {{- range .Fields}} + {{- if and .Sort}} + {{- if not (eq .ColumnName "")}} + {{.FieldJson}}: '{{.ColumnName}}', + {{- end}} + {{- end}} + {{- end}} + } + + let sort = sortMap[prop] + if(!sort){ + sort = prop.replace(/[A-Z]/g, match => _${match.toLowerCase()}) + } + + searchInfo.value.sort = sort searchInfo.value.order = order getTableData() }