From 25fada4674f64064a5c7641c926dd4eaae7b50ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=95=E9=87=91=E6=B3=BD?= <1098696801@qq.com> Date: Tue, 5 Apr 2022 23:07:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=97=E5=85=B8=E9=A1=B9=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E7=A7=BB=E4=B8=8B=E7=A7=BB=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/magic-api/api/系统管理/数据字典/列表.ms | 4 +- .../api/系统管理/数据字典/字典项/上移.ms | 46 +++++++++++++++++++ .../api/系统管理/数据字典/字典项/下移.ms | 46 +++++++++++++++++++ .../api/系统管理/数据字典/字典项/列表.ms | 4 +- .../api/系统管理/数据字典/获取排序号.ms | 25 ---------- .../src/components/magic/basic/mb-search.vue | 4 +- .../src/components/magic/basic/mb-table.vue | 5 +- .../components/magic/form/mb-inputrange.vue | 9 +++- .../src/views/system/dict/dict-items.vue | 35 ++++++++++++++ .../src/views/system/dict/dict-list.vue | 25 ++-------- .../src/views/system/menu/menu-list.vue | 2 +- .../src/views/system/office/office-list.vue | 4 +- 12 files changed, 150 insertions(+), 59 deletions(-) create mode 100644 data/magic-api/api/系统管理/数据字典/字典项/上移.ms create mode 100644 data/magic-api/api/系统管理/数据字典/字典项/下移.ms delete mode 100644 data/magic-api/api/系统管理/数据字典/获取排序号.ms diff --git a/data/magic-api/api/系统管理/数据字典/列表.ms b/data/magic-api/api/系统管理/数据字典/列表.ms index 950a2df..95c3b9e 100644 --- a/data/magic-api/api/系统管理/数据字典/列表.ms +++ b/data/magic-api/api/系统管理/数据字典/列表.ms @@ -5,7 +5,7 @@ "groupId" : "c7ce65f5b3cf4aaa913f6fec7d35d176", "name" : "列表", "createTime" : null, - "updateTime" : 1646552464246, + "updateTime" : 1649169225411, "lock" : "0", "createBy" : null, "updateBy" : null, @@ -119,7 +119,7 @@ } ================================ return db.page(""" - select id,dict_type,desc_ribe,type,remarks,sort from sys_dict + select id,dict_type,desc_ribe,type,remarks,create_date from sys_dict where is_del = 0 ?{type, and type like concat('%',#{type},'%')} ?{dictType, and dict_type = #{dictType}} diff --git a/data/magic-api/api/系统管理/数据字典/字典项/上移.ms b/data/magic-api/api/系统管理/数据字典/字典项/上移.ms new file mode 100644 index 0000000..a17755d --- /dev/null +++ b/data/magic-api/api/系统管理/数据字典/字典项/上移.ms @@ -0,0 +1,46 @@ +{ + "properties" : { }, + "id" : "08f29d784ed94b318ea2209997b6d426", + "script" : null, + "groupId" : "376f26eb43a44a3daeafd27020a96f48", + "name" : "上移", + "createTime" : null, + "updateTime" : 1649170147768, + "lock" : null, + "createBy" : null, + "updateBy" : null, + "path" : "/sort/up", + "method" : "GET", + "parameters" : [ ], + "options" : [ ], + "requestBody" : "", + "headers" : [ ], + "paths" : [ ], + "responseBody" : null, + "description" : null, + "requestBodyDefinition" : null, + "responseBodyDefinition" : null +} +================================ +var top = db.selectOne(""" + SELECT + id, + sort + FROM + sys_dict_items + WHERE + is_del = 0 + and dict_id = #{dictId} + AND sort < ( SELECT sort FROM sys_dict_items WHERE is_del = 0 AND id = #{id} ) + ORDER BY + sort DESC + LIMIT 1 +""") +if(top){ + db.update(""" + update sys_dict_items set sort = #{top.sort} where id = #{id} + """) + db.update(""" + update sys_dict_items set sort = #{sort} where id = #{top.id} + """) +} \ No newline at end of file diff --git a/data/magic-api/api/系统管理/数据字典/字典项/下移.ms b/data/magic-api/api/系统管理/数据字典/字典项/下移.ms new file mode 100644 index 0000000..fdb0ee4 --- /dev/null +++ b/data/magic-api/api/系统管理/数据字典/字典项/下移.ms @@ -0,0 +1,46 @@ +{ + "properties" : { }, + "id" : "3cc33992bf1b4ad38223da5ae302ce79", + "script" : null, + "groupId" : "376f26eb43a44a3daeafd27020a96f48", + "name" : "下移", + "createTime" : null, + "updateTime" : 1649170144718, + "lock" : null, + "createBy" : null, + "updateBy" : null, + "path" : "/sort/down", + "method" : "GET", + "parameters" : [ ], + "options" : [ ], + "requestBody" : "", + "headers" : [ ], + "paths" : [ ], + "responseBody" : null, + "description" : null, + "requestBodyDefinition" : null, + "responseBodyDefinition" : null +} +================================ +var top = db.selectOne(""" + SELECT + id, + sort + FROM + sys_dict_items + WHERE + is_del = 0 + and dict_id = #{dictId} + AND sort > ( SELECT sort FROM sys_dict_items WHERE is_del = 0 AND id = #{id} ) + ORDER BY + sort + LIMIT 1 +""") +if(top){ + db.update(""" + update sys_dict_items set sort = #{top.sort} where id = #{id} + """) + db.update(""" + update sys_dict_items set sort = #{sort} where id = #{top.id} + """) +} \ No newline at end of file diff --git a/data/magic-api/api/系统管理/数据字典/字典项/列表.ms b/data/magic-api/api/系统管理/数据字典/字典项/列表.ms index a99e042..9757c97 100644 --- a/data/magic-api/api/系统管理/数据字典/字典项/列表.ms +++ b/data/magic-api/api/系统管理/数据字典/字典项/列表.ms @@ -5,7 +5,7 @@ "groupId" : "376f26eb43a44a3daeafd27020a96f48", "name" : "列表", "createTime" : null, - "updateTime" : 1646552463663, + "updateTime" : 1649169185265, "lock" : "0", "createBy" : null, "updateBy" : null, @@ -232,5 +232,5 @@ return db.page(""" ?{label, and label like concat('%',#{label},'%')} ?{dictId, and dict_id = #{dictId}} ?{value, and value like concat('%',#{value},'%')} - order by create_date desc + order by sort """) \ No newline at end of file diff --git a/data/magic-api/api/系统管理/数据字典/获取排序号.ms b/data/magic-api/api/系统管理/数据字典/获取排序号.ms deleted file mode 100644 index 4b71931..0000000 --- a/data/magic-api/api/系统管理/数据字典/获取排序号.ms +++ /dev/null @@ -1,25 +0,0 @@ -{ - "properties" : { }, - "id" : "247133030553488a8871aa47b9f5e76c", - "script" : null, - "groupId" : "c7ce65f5b3cf4aaa913f6fec7d35d176", - "name" : "获取排序号", - "createTime" : 1646490239435, - "updateTime" : 1634735056733, - "lock" : "0", - "createBy" : null, - "updateBy" : null, - "path" : "/sort", - "method" : "GET", - "parameters" : [ ], - "options" : [ ], - "requestBody" : "", - "headers" : [ ], - "paths" : [ ], - "responseBody" : null, - "description" : null, - "requestBodyDefinition" : null, - "responseBodyDefinition" : null -} -================================ -return db.selectInt("""select max(sort) + 10 from sys_dict where is_del = '0'""") || 10; \ No newline at end of file diff --git a/magic-boot-ui/src/components/magic/basic/mb-search.vue b/magic-boot-ui/src/components/magic/basic/mb-search.vue index 73b885c..3be6090 100644 --- a/magic-boot-ui/src/components/magic/basic/mb-search.vue +++ b/magic-boot-ui/src/components/magic/basic/mb-search.vue @@ -17,9 +17,7 @@ :placeholder="it.type.startsWith('datetime') ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'" > - - - + diff --git a/magic-boot-ui/src/components/magic/basic/mb-table.vue b/magic-boot-ui/src/components/magic/basic/mb-table.vue index f4d2813..6b1b0c1 100644 --- a/magic-boot-ui/src/components/magic/basic/mb-table.vue +++ b/magic-boot-ui/src/components/magic/basic/mb-table.vue @@ -277,11 +277,14 @@ defineExpose({ reload, exportExcel }) diff --git a/magic-boot-ui/src/views/system/dict/dict-items.vue b/magic-boot-ui/src/views/system/dict/dict-items.vue index b20611f..a971cba 100644 --- a/magic-boot-ui/src/views/system/dict/dict-items.vue +++ b/magic-boot-ui/src/views/system/dict/dict-items.vue @@ -87,6 +87,41 @@ const tableOptions = reactive({ field: 'sort', label: '排序' }, + { + label: '排序', + type: 'btns', + width: 150, + btns: [ + { + label: '上移', + type: 'text', + icon: 'ElSortUp', + click: (row) => { + proxy.$get('/system/dict/items/sort/up',{ + id: row.id, + sort: row.sort, + dictId: props.dictId + }).then(() => { + reloadTable() + }) + } + }, + { + label: '下移', + type: 'text', + icon: 'ElSortDown', + click: (row) => { + proxy.$get('/system/dict/items/sort/down',{ + id: row.id, + sort: row.sort, + dictId: props.dictId + }).then(() => { + reloadTable() + }) + } + } + ] + }, { field: 'remarks', label: '备注' diff --git a/magic-boot-ui/src/views/system/dict/dict-list.vue b/magic-boot-ui/src/views/system/dict/dict-list.vue index 4e401bc..e6c4cf8 100644 --- a/magic-boot-ui/src/views/system/dict/dict-list.vue +++ b/magic-boot-ui/src/views/system/dict/dict-list.vue @@ -27,18 +27,11 @@ - - - - - - - @@ -99,16 +92,15 @@ const tableOptions = reactive({ width: 200, dictType: 'dict_type' }, + { + field: 'createDate', + label: '创建时间' + }, { field: 'remarks', label: '备注', width: 200 }, - { - field: 'sort', - label: '排序', - width: 100 - }, { label: '操作', type: 'btns', @@ -161,7 +153,6 @@ const dialogTitle = ref('') const rules = reactive({ dictType: [{ required: true, message: '请输入标签', trigger: 'change' }], type: [{ required: true, message: '请输入类型', trigger: 'change' }], - sort: [{ required: true, message: '请输入排序', trigger: 'change' }], descRibe: [{ required: true, message: '请输入描述', trigger: 'change' }] }) const table = ref() @@ -174,7 +165,6 @@ function getTemp() { id: '', dictType: '', type: '', - sort: 0, descRibe: '', remarks: '' } @@ -184,15 +174,8 @@ function reloadTable() { table.value.reload() } -function getSort() { - proxy.$get('/system/dict/sort').then(res => { - temp.value.sort = res.data - }) -} - function handleCreate() { temp.value = getTemp() - getSort() dialogTitle.value = '添加' dictDialog.value.show() nextTick(() => { diff --git a/magic-boot-ui/src/views/system/menu/menu-list.vue b/magic-boot-ui/src/views/system/menu/menu-list.vue index 9d5a304..6fc7b01 100644 --- a/magic-boot-ui/src/views/system/menu/menu-list.vue +++ b/magic-boot-ui/src/views/system/menu/menu-list.vue @@ -84,7 +84,7 @@ const tableOptions = reactive({ }, { field: 'sort', - label: '序号', + label: '排序', width: 60 }, { diff --git a/magic-boot-ui/src/views/system/office/office-list.vue b/magic-boot-ui/src/views/system/office/office-list.vue index 50a76f8..9aa7fd1 100644 --- a/magic-boot-ui/src/views/system/office/office-list.vue +++ b/magic-boot-ui/src/views/system/office/office-list.vue @@ -10,7 +10,7 @@
- + @@ -114,7 +114,7 @@ const tableOptions = reactive({ }, { field: 'sort', - label: '序号', + label: '排序', width: 60 }, {