refactor: 优化字典选中效果
This commit is contained in:
parent
8a02401a24
commit
3fd0c08b80
continew-admin-system/src/main/java/top/charles7c/cnadmin/system/model/vo
continew-admin-ui/src/views/system/dict
@ -57,4 +57,9 @@ public class DictVO extends BaseVO {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "是否为系统内置数据", example = "true")
|
@Schema(description = "是否为系统内置数据", example = "true")
|
||||||
private Boolean isSystem;
|
private Boolean isSystem;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean getDisabled() {
|
||||||
|
return this.getIsSystem();
|
||||||
|
}
|
||||||
}
|
}
|
@ -110,18 +110,25 @@
|
|||||||
@row-click="handleSelect"
|
@row-click="handleSelect"
|
||||||
>
|
>
|
||||||
<template #columns>
|
<template #columns>
|
||||||
<a-table-column title="序号" :width="60">
|
<a-table-column
|
||||||
|
title="序号"
|
||||||
|
:width="60"
|
||||||
|
:body-cell-style="bodyCellStyle"
|
||||||
|
>
|
||||||
<template #cell="{ rowIndex }">
|
<template #cell="{ rowIndex }">
|
||||||
{{ rowIndex + 1 + (queryParams.page - 1) * queryParams.size }}
|
{{ rowIndex + 1 + (queryParams.page - 1) * queryParams.size }}
|
||||||
</template>
|
</template>
|
||||||
</a-table-column>
|
</a-table-column>
|
||||||
<a-table-column title="字典名称" data-index="name" :width="100" />
|
<a-table-column
|
||||||
|
title="字典名称"
|
||||||
|
data-index="name"
|
||||||
|
:width="100"
|
||||||
|
:body-cell-style="bodyCellStyle"
|
||||||
|
/>
|
||||||
<a-table-column
|
<a-table-column
|
||||||
title="字典编码"
|
title="字典编码"
|
||||||
data-index="code"
|
data-index="code"
|
||||||
ellipsis
|
:body-cell-style="bodyCellStyle"
|
||||||
tooltip
|
|
||||||
:width="100"
|
|
||||||
/>
|
/>
|
||||||
<a-table-column
|
<a-table-column
|
||||||
title="描述"
|
title="描述"
|
||||||
@ -129,6 +136,7 @@
|
|||||||
ellipsis
|
ellipsis
|
||||||
tooltip
|
tooltip
|
||||||
:width="100"
|
:width="100"
|
||||||
|
:body-cell-style="bodyCellStyle"
|
||||||
/>
|
/>
|
||||||
<a-table-column
|
<a-table-column
|
||||||
v-if="
|
v-if="
|
||||||
@ -136,6 +144,7 @@
|
|||||||
"
|
"
|
||||||
title="操作"
|
title="操作"
|
||||||
align="center"
|
align="center"
|
||||||
|
:body-cell-style="bodyCellStyle"
|
||||||
>
|
>
|
||||||
<template #cell="{ record }">
|
<template #cell="{ record }">
|
||||||
<a-button
|
<a-button
|
||||||
@ -188,7 +197,11 @@
|
|||||||
<a-input v-model="form.name" placeholder="请输入字典名称" />
|
<a-input v-model="form.name" placeholder="请输入字典名称" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="字典编码" field="code">
|
<a-form-item label="字典编码" field="code">
|
||||||
<a-input v-model="form.code" placeholder="请输入字典编码" :disabled="form.isSystem" />
|
<a-input
|
||||||
|
v-model="form.code"
|
||||||
|
placeholder="请输入字典编码"
|
||||||
|
:disabled="form.isSystem"
|
||||||
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="描述" field="description">
|
<a-form-item label="描述" field="description">
|
||||||
<a-textarea
|
<a-textarea
|
||||||
@ -235,6 +248,16 @@
|
|||||||
const exportLoading = ref(false);
|
const exportLoading = ref(false);
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
const dictId = ref();
|
const dictId = ref();
|
||||||
|
const lastSelectDict = ref<TableData>();
|
||||||
|
const bodyCellStyle = (record: TableData) => {
|
||||||
|
if (record.click) {
|
||||||
|
return {
|
||||||
|
color: 'rgb(var(--arcoblue-6))',
|
||||||
|
cursor: 'pointer',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return { cursor: 'pointer' };
|
||||||
|
};
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
// 查询参数
|
// 查询参数
|
||||||
@ -260,8 +283,11 @@
|
|||||||
* @param record 所选行记录
|
* @param record 所选行记录
|
||||||
*/
|
*/
|
||||||
const handleSelect = (record: TableData) => {
|
const handleSelect = (record: TableData) => {
|
||||||
proxy.$refs.tableRef.selectAll(false);
|
if (lastSelectDict.value) {
|
||||||
proxy.$refs.tableRef.select(record.id);
|
delete lastSelectDict.value.click;
|
||||||
|
}
|
||||||
|
lastSelectDict.value = record;
|
||||||
|
record.click = true;
|
||||||
dictId.value = record.id;
|
dictId.value = record.id;
|
||||||
proxy.$refs.dictItemRef.getList(record.id);
|
proxy.$refs.dictItemRef.getList(record.id);
|
||||||
};
|
};
|
||||||
@ -272,7 +298,6 @@
|
|||||||
* @param params 查询参数
|
* @param params 查询参数
|
||||||
*/
|
*/
|
||||||
const getList = (params: ListParam = { ...queryParams.value }) => {
|
const getList = (params: ListParam = { ...queryParams.value }) => {
|
||||||
dictId.value = null;
|
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
list(params)
|
list(params)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@ -393,9 +418,6 @@
|
|||||||
ids.value = rowKeys;
|
ids.value = rowKeys;
|
||||||
single.value = rowKeys.length !== 1;
|
single.value = rowKeys.length !== 1;
|
||||||
multiple.value = !rowKeys.length;
|
multiple.value = !rowKeys.length;
|
||||||
if (!rowKeys.length) {
|
|
||||||
dictId.value = null;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -454,8 +476,4 @@
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less"></style>
|
||||||
:deep(.dictTable .arco-table-td) {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user