字典子项增加排序
continuous-integration/drone/push Build is passing Details

main
wangxiaoshuang 2025-06-19 13:39:12 +08:00
parent 50ae94bf08
commit a41359111f
2 changed files with 33 additions and 67 deletions

View File

@ -418,10 +418,11 @@ export function addOrUpdateBasicDic(param) {
}) })
} }
export function getDictionaryChildList(id) { export function getDictionaryChildList(data) {
return request({ return request({
url: `/Dictionary/getChildList/${id}`, url: `/Dictionary/getChildList`,
method: 'get' method: 'post',
data
}) })
} }

View File

@ -7,74 +7,28 @@
<el-button type="primary" size="mini" @click="handleAdd"></el-button> <el-button type="primary" size="mini" @click="handleAdd"></el-button>
</span> </span>
</div> </div>
<el-table <el-table v-loading="loading" v-adaptive="{ bottomOffset: 45 }" :data="list" stripe size="small" height="100"
v-loading="loading" @sort-change="handleSortByColumn">
v-adaptive="{bottomOffset:45}"
:data="list"
stripe
size="small"
height="100"
>
<el-table-column type="index" width="60" /> <el-table-column type="index" width="60" />
<el-table-column <el-table-column v-if="!~$route.path.indexOf('select')" prop="Code" label="字典键值" min-width="180"
v-if="!~$route.path.indexOf('select')" show-overflow-tooltip sortable='custom' />
prop="Code" <el-table-column prop="ValueCN" label="中文值" min-width="180" show-overflow-tooltip sortable='custom' />
label="字典键值" <el-table-column prop="Value" label="英文值" min-width="180" show-overflow-tooltip sortable='custom' />
min-width="180" <el-table-column prop="ChildGroup" label="分组" min-width="180" show-overflow-tooltip sortable='custom' />
show-overflow-tooltip <el-table-column prop="ShowOrder" label="显示顺序" min-width="180" show-overflow-tooltip sortable='custom' />
/> <el-table-column prop="Description" label="描述" min-width="180" show-overflow-tooltip sortable='custom' />
<el-table-column
prop="ValueCN"
label="中文值"
min-width="180"
show-overflow-tooltip
/>
<el-table-column
prop="Value"
label="英文值"
min-width="180"
show-overflow-tooltip
/>
<el-table-column
prop="ChildGroup"
label="分组"
min-width="180"
show-overflow-tooltip
/>
<el-table-column
prop="ShowOrder"
label="显示顺序"
min-width="180"
show-overflow-tooltip
/>
<el-table-column
prop="Description"
label="描述"
min-width="180"
show-overflow-tooltip
/>
<el-table-column label="是否可用" width="100" fixed="right"> <el-table-column label="是否可用" width="100" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch v-model="scope.row.IsEnable" :active-value="true" :inactive-value="false"
v-model="scope.row.IsEnable" @change="(event) => { return switchChange(event, scope.row) }" />
:active-value="true"
:inactive-value="false"
@change="(event) => {return switchChange(event, scope.row)}"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="150" fixed="right"> <el-table-column label="操作" width="150" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button type="text" @click="handleEdit(scope.row)">
type="text"
@click="handleEdit(scope.row)"
>
编辑 编辑
</el-button> </el-button>
<el-button <el-button type="text" @click="handleDelete(scope.row)">
type="text"
@click="handleDelete(scope.row)"
>
删除 删除
</el-button> </el-button>
</template> </template>
@ -91,7 +45,8 @@ import DictionaryChildAddOrUpdateForm from './DictionaryChildAddOrUpdateForm'
const searchDataDefault = () => { const searchDataDefault = () => {
return { return {
parentId: '' Asc: true,
SortField: 'ShowOrder',
} }
} }
export default { export default {
@ -121,6 +76,17 @@ export default {
this.getList() this.getList()
}, },
methods: { methods: {
//
handleSortByColumn(column) {
if (column.order === 'ascending') {
this.searchData.Asc = true
} else {
this.searchData.Asc = false
}
this.searchData.SortField = column.prop
this.searchData.PageIndex = 1
this.getList()
},
handleChild(row) { handleChild(row) {
this.drawerChild = true this.drawerChild = true
this.getDictionaryChildList(row.Id) this.getDictionaryChildList(row.Id)
@ -172,7 +138,8 @@ export default {
// //
getList() { getList() {
this.loading = true this.loading = true
getDictionaryChildList(this.parent.Id).then(res => { this.searchData.ParentId = this.parent.Id
getDictionaryChildList(this.searchData).then(res => {
this.loading = false this.loading = false
this.list = res.Result this.list = res.Result
}).catch(() => { this.loading = false }) }).catch(() => { this.loading = false })
@ -190,6 +157,4 @@ export default {
} }
</script> </script>
<style scoped> <style scoped></style>
</style>