字典项 添加上移下移功能,修复样式

This commit is contained in:
吕金泽 2022-04-05 23:07:50 +08:00
parent f85efa67d0
commit 25fada4674
12 changed files with 150 additions and 59 deletions

View File

@ -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}}

View File

@ -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}
""")
}

View File

@ -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}
""")
}

View File

@ -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
""")

View File

@ -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;

View File

@ -17,9 +17,7 @@
:placeholder="it.type.startsWith('datetime') ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'"
>
</el-date-picker>
<span v-if="it.type == 'inputrange'">
<mb-inputrange v-model="it.value" />
</span>
<mb-inputrange v-model="it.value" v-else-if="it.type == 'inputrange'" />
<component v-else :is="it.type" v-model="it.value" v-bind="it.properties" />
</el-form-item>
</span>

View File

@ -277,11 +277,14 @@ defineExpose({ reload, exportExcel })
</script>
<style scoped>
.el-image >>> .el-image__inner {
.el-table :deep(.el-image .el-image__inner) {
max-height: 100px;
width: auto;
height: auto;
}
.el-table :deep(.el-table__cell){
z-index: auto;
}
</style>
<style>

View File

@ -1,5 +1,7 @@
<template>
<el-input v-model="input1" /> - <el-input v-model="input2" />
<el-input v-model="input1" />
<span>-</span>
<el-input v-model="input2" />
</template>
<script setup>
@ -26,6 +28,9 @@ watch([input1, input2], () => {
<style scoped>
.el-input{
display: inline-block;
width: 48%;
width: 47%;
}
span{
margin: 0px 8px;
}
</style>

View File

@ -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: '备注'

View File

@ -27,18 +27,11 @@
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="排序" prop="sort">
<el-input v-model="temp.sort" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="描述" prop="descRibe">
<el-input v-model="temp.descRibe" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="备注" prop="remarks">
<el-input v-model="temp.remarks" />
@ -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(() => {

View File

@ -84,7 +84,7 @@ const tableOptions = reactive({
},
{
field: 'sort',
label: '',
label: '序',
width: 60
},
{

View File

@ -10,7 +10,7 @@
<div class="filter-container">
<el-form :inline="true">
<el-form-item label="机构搜索">
<el-input v-model="searchValue" @input="searchOffice" placeholder="机构名称、链接、权限标识"></el-input>
<el-input v-model="searchValue" @input="searchOffice" placeholder="机构名称、机构编码"></el-input>
</el-form-item>
<el-form-item>
<el-button class="filter-item" type="primary" icon="ElSearch" @click="searchOffice">
@ -114,7 +114,7 @@ const tableOptions = reactive({
},
{
field: 'sort',
label: '',
label: '序',
width: 60
},
{