字典、配置
This commit is contained in:
parent
37be5e9b01
commit
5b6f32b732
@ -5,12 +5,6 @@ export const columns = [
|
|||||||
{
|
{
|
||||||
type: 'selection',
|
type: 'selection',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: 'ID',
|
|
||||||
prop: 'id',
|
|
||||||
fixed: 'left',
|
|
||||||
width: 50,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: '配置名称',
|
label: '配置名称',
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
|
@ -88,7 +88,7 @@
|
|||||||
*/
|
*/
|
||||||
const actionColumn = reactive({
|
const actionColumn = reactive({
|
||||||
width: 200,
|
width: 200,
|
||||||
lable: '操作',
|
label: '操作',
|
||||||
prop: 'action',
|
prop: 'action',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
render(record) {
|
render(record) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<PageWrapper>
|
<PageWrapper>
|
||||||
<el-row :gutter="10" class="mt-3">
|
<el-row :gutter="10" class="mt-3">
|
||||||
<el-col :xs="24" :sm="24" :md="7" :lg="7" :xl="7">
|
<el-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8" class="mb-4">
|
||||||
<el-card shadow="hover" class="border-0">
|
<el-card shadow="hover" class="border-0">
|
||||||
<template #header>
|
<template #header>
|
||||||
<el-space>
|
<el-space>
|
||||||
@ -12,200 +12,129 @@
|
|||||||
</el-icon>
|
</el-icon>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<el-button
|
<el-button type="primary" @click="reloadTable" icon="Search"> 查询 </el-button>
|
||||||
type="primary"
|
|
||||||
icon="Search"
|
|
||||||
@click="
|
|
||||||
pager.page = 1;
|
|
||||||
loadDataTable();
|
|
||||||
"
|
|
||||||
>
|
|
||||||
查询
|
|
||||||
</el-button>
|
|
||||||
</el-space>
|
</el-space>
|
||||||
<div style="margin-top: 15px">
|
<div style="margin-top:15px;">
|
||||||
<el-button type="primary" icon="Plus" @click="handleAdd" v-perm="['sys:config:add']"
|
<el-button type="primary" @click="addConfig" icon="Plus">新建</el-button>
|
||||||
>新建</el-button
|
<el-button type="danger" :disabled="!selectionData.length" @click="handleDelete()" icon="Delete">删除</el-button>
|
||||||
>
|
|
||||||
<el-button type="warning" icon="Edit" @click="handleEdit" v-perm="['sys:config:edit']"
|
|
||||||
>编辑</el-button
|
|
||||||
>
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
icon="Delete"
|
|
||||||
@click="handleDelete()"
|
|
||||||
v-perm="['sys:config:delete']"
|
|
||||||
>删除</el-button
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div :style="{ height: fwbHeight + 'px' }" class="dict-list-box">
|
<BasicTable :columns="columns" :showTableSetting="false" :request="loadDataTable" :row-key="(row) => row.id"
|
||||||
<div
|
ref="tableRef" :actionColumn="actionColumn" @selection-change="onSelectionChange" highlight-current-row
|
||||||
v-for="(item, index) in configDataList"
|
@row-click="onCheckedRow" :pagination="{ small: true, layout: 'total,prev, pager, next,jumper' }"/>
|
||||||
:key="index"
|
|
||||||
@click="onCheckedRow(item)"
|
|
||||||
class="dict-item"
|
|
||||||
:class="item.id == configId ? 'active' : ''"
|
|
||||||
>
|
|
||||||
<span class="t1"
|
|
||||||
>{{ item.name }}<span class="t2">({{ item.code }})</span></span
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<pagination
|
|
||||||
style="justify-content: flex-end"
|
|
||||||
class="mt-10 flex"
|
|
||||||
@change="loadDataTable"
|
|
||||||
v-model="pager"
|
|
||||||
layout="total, prev, pager, next"
|
|
||||||
/>
|
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="24" :md="17" :lg="17" :xl="17">
|
<el-col :xs="24" :sm="24" :md="16" :lg="16" :xl="16" class="mb-4">
|
||||||
<el-card shadow="hover" class="mb-4 border-0 proCard">
|
<el-card shadow="hover" class="mb-4 border-0 proCard">
|
||||||
<configItem :configId="configId" v-if="configItemShow" />
|
<configItem :configId="configId" v-if="configItemShow"></configItem>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<editDialog
|
<editDialog v-if="editVisible" :configId="configId" v-model:visible="editVisible" @success="reloadTable">
|
||||||
v-if="editVisible"
|
</editDialog>
|
||||||
:configId="configId"
|
|
||||||
v-model:visible="editVisible"
|
|
||||||
@success="loadDataTable()"
|
|
||||||
/>
|
|
||||||
</PageWrapper>
|
</PageWrapper>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, nextTick, defineAsyncComponent, onMounted } from 'vue';
|
import { ref, reactive, h, nextTick, defineAsyncComponent } from 'vue';
|
||||||
import { SearchOutlined } from '@vicons/antd';
|
import { SearchOutlined } from '@vicons/antd';
|
||||||
import { getConfigList, configDelete } from '@/api/data/config';
|
import { TableAction } from '@/components/Table';
|
||||||
import configItem from './configItem.vue';
|
import { getConfigList, configDelete, configBatchDelete } from '@/api/data/config';
|
||||||
import { message, confirm } from '@/utils/auth';
|
import { columns } from './columns';
|
||||||
const editDialog = defineAsyncComponent(() => import('./edit.vue'));
|
import configItem from './configItem.vue';
|
||||||
const configId = ref(0);
|
import { message, confirm } from "@/utils/auth";
|
||||||
const configItemShow = ref(false);
|
const editDialog = defineAsyncComponent(() =>
|
||||||
const tableRef = ref();
|
import('./edit.vue')
|
||||||
const editVisible = ref(false);
|
)
|
||||||
|
const configId = ref(0)
|
||||||
/**
|
const configItemShow = ref(false)
|
||||||
* 定义查询参数
|
const tableRef = ref();
|
||||||
*/
|
const editVisible = ref(false)
|
||||||
const params = ref({
|
const selectionData = ref([])
|
||||||
|
const params = ref({
|
||||||
name: '',
|
name: '',
|
||||||
});
|
});
|
||||||
const configDataList = ref([]);
|
|
||||||
|
|
||||||
/**
|
const actionColumn = reactive({
|
||||||
* 定义分页参数
|
width: 200,
|
||||||
*/
|
label: '操作',
|
||||||
const pager = ref({
|
prop: 'action',
|
||||||
page: 1,
|
fixed: 'right',
|
||||||
size: 10,
|
render(record) {
|
||||||
count: configDataList.value.length,
|
return h(TableAction as any, {
|
||||||
|
style: 'text',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
label: '编辑',
|
||||||
|
icon:'Edit',
|
||||||
|
type: 'warning',
|
||||||
|
onClick: handleEdit.bind(null, record),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '删除',
|
||||||
|
icon:'Delete',
|
||||||
|
type: 'danger',
|
||||||
|
onClick: handleDelete.bind(null, record),
|
||||||
|
}
|
||||||
|
],
|
||||||
});
|
});
|
||||||
const fwbHeight = document.body.clientHeight - 360;
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* 执行添加
|
//新建字典
|
||||||
*/
|
const addConfig = async () => {
|
||||||
const handleAdd = async () => {
|
configId.value=0
|
||||||
configId.value = 0;
|
|
||||||
await nextTick();
|
await nextTick();
|
||||||
editVisible.value = true;
|
editVisible.value=true
|
||||||
};
|
};
|
||||||
|
//编辑字典
|
||||||
|
const handleEdit = async (record: Recordable) => {
|
||||||
|
configId.value=record.row.id
|
||||||
|
await nextTick();
|
||||||
|
editVisible.value=true
|
||||||
|
};
|
||||||
|
//选择字典项
|
||||||
|
function onCheckedRow(row) {
|
||||||
|
configId.value = row.id
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
//刷新字典项值列表
|
||||||
* 执行编辑
|
function reloadTable() {
|
||||||
*/
|
tableRef.value.reload({ pageNo: 1 });
|
||||||
const handleEdit = () => {
|
}
|
||||||
editVisible.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
//加载字典项值列表;
|
||||||
* 选中行事件
|
const loadDataTable = async (res) => {
|
||||||
* @param row 参数
|
const result = await getConfigList({ ...params.value, ...res });
|
||||||
*/
|
configId.value = result?.records[0]?.id
|
||||||
function onCheckedRow(row) {
|
configItemShow.value = true
|
||||||
configId.value = row.id;
|
nextTick(() => {
|
||||||
|
const tables = tableRef.value.getTableRef();
|
||||||
|
tables.setCurrentRow(result?.records[0])
|
||||||
|
})
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
//删除字典项
|
||||||
|
async function handleDelete(record: Recordable) {
|
||||||
|
let ids = []
|
||||||
|
if (!record) {
|
||||||
|
ids = selectionData.value.map(({ id }) => id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 加载数据列表
|
|
||||||
*/
|
|
||||||
const loadDataTable = async () => {
|
|
||||||
const result = await getConfigList({
|
|
||||||
...params.value,
|
|
||||||
pageNo: pager.value.page,
|
|
||||||
pageSize: pager.value.size,
|
|
||||||
});
|
|
||||||
configId.value = result?.records[0]?.id;
|
|
||||||
configItemShow.value = true;
|
|
||||||
configDataList.value = result.records;
|
|
||||||
pager.value.count = result.total;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 执行删除
|
|
||||||
*/
|
|
||||||
async function handleDelete() {
|
|
||||||
await confirm('确定要删除?');
|
await confirm('确定要删除?');
|
||||||
await configDelete(configId.value);
|
record ? await configDelete(record.row.id) : await configBatchDelete(ids);
|
||||||
message('删除成功');
|
message("删除成功");
|
||||||
pager.value.page = 1;
|
reloadTable()
|
||||||
loadDataTable();
|
}
|
||||||
}
|
function onSelectionChange(value) {
|
||||||
|
selectionData.value = value
|
||||||
/**
|
}
|
||||||
* 钩子函数
|
|
||||||
*/
|
|
||||||
onMounted(() => {
|
|
||||||
loadDataTable();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.card-header {
|
.card-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dict-list-box {
|
|
||||||
overflow: auto;
|
|
||||||
.dict-item {
|
|
||||||
height: 40px;
|
|
||||||
line-height: 40px;
|
|
||||||
padding: 0 6px;
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
.t1 {
|
|
||||||
font-size: 14px;
|
|
||||||
display: block;
|
|
||||||
font-weight: 700;
|
|
||||||
.t2 {
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.active {
|
|
||||||
background-color: #e8f1ff;
|
|
||||||
border-radius: 3px;
|
|
||||||
|
|
||||||
.t1 {
|
|
||||||
color: #1677ff;
|
|
||||||
}
|
|
||||||
.t2 {
|
|
||||||
color: rgb(22, 119, 255, 0.8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-badge__content.is-fixed {
|
|
||||||
top: 20px;
|
|
||||||
right: calc(-10px + var(--el-badge-size) / 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -2,12 +2,6 @@ export const columns = [
|
|||||||
{
|
{
|
||||||
type: 'selection',
|
type: 'selection',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: 'ID',
|
|
||||||
prop: 'id',
|
|
||||||
fixed: 'left',
|
|
||||||
width: 50,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: '字典名称',
|
label: '字典名称',
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
|
@ -88,7 +88,7 @@
|
|||||||
*/
|
*/
|
||||||
const actionColumn = reactive({
|
const actionColumn = reactive({
|
||||||
width: 200,
|
width: 200,
|
||||||
lable: '操作',
|
label: '操作',
|
||||||
prop: 'action',
|
prop: 'action',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
render(record) {
|
render(record) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<PageWrapper>
|
<PageWrapper>
|
||||||
<el-row :gutter="10" class="mt-3">
|
<el-row :gutter="10" class="mt-3">
|
||||||
<el-col :xs="24" :sm="24" :md="7" :lg="7" :xl="7">
|
<el-col :xs="24" :sm="24" :md="8" :lg="8" :xl="8" class="mb-4">
|
||||||
<el-card shadow="hover" class="border-0">
|
<el-card shadow="hover" class="border-0">
|
||||||
<template #header>
|
<template #header>
|
||||||
<el-space>
|
<el-space>
|
||||||
@ -12,221 +12,138 @@
|
|||||||
</el-icon>
|
</el-icon>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<el-button
|
<el-button type="primary" icon="Search" @click="reloadTable"> 查询 </el-button>
|
||||||
type="primary"
|
|
||||||
icon="Search"
|
|
||||||
@click="
|
|
||||||
pager.page = 1;
|
|
||||||
loadDataTable();
|
|
||||||
"
|
|
||||||
>查询</el-button
|
|
||||||
>
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
icon="RefreshRight"
|
|
||||||
@click="dictRefresh"
|
|
||||||
v-perm="['sys:dict:cache']"
|
|
||||||
>刷新缓存</el-button
|
|
||||||
>
|
|
||||||
</el-space>
|
</el-space>
|
||||||
<div style="margin-top: 15px">
|
<div style="margin-top:15px;">
|
||||||
<el-button type="primary" icon="Plus" @click="handleAdd" v-perm="['sys:dict:add']"
|
<el-button type="primary" @click="dictRefresh" icon="RefreshRight" v-perm="['sys:dict:cache']">刷新缓存</el-button>
|
||||||
>新建</el-button
|
<el-button type="primary" @click="addDict" icon="Plus" v-perm="['sys:dict:add']">新建</el-button>
|
||||||
>
|
<el-button type="danger" v-perm="['sys:dict:delete']" icon="Delete" :disabled="!selectionData.length" @click="handleDelete()">删除</el-button>
|
||||||
<el-button type="warning" icon="Edit" @click="handleEdit" v-perm="['sys:dict:edit']"
|
|
||||||
>编辑</el-button
|
|
||||||
>
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
icon="Delete"
|
|
||||||
v-perm="['sys:dict:delete']"
|
|
||||||
@click="handleDelete()"
|
|
||||||
>删除</el-button
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div :style="{ height: fwbHeight + 'px' }" class="dict-list-box">
|
<BasicTable :columns="columns" :showTableSetting="false" :request="loadDataTable" :row-key="(row) => row.id"
|
||||||
<div
|
ref="tableRef" :actionColumn="actionColumn" @selection-change="onSelectionChange" highlight-current-row
|
||||||
v-for="(item, index) in dictDataList"
|
@row-click="onCheckedRow" :pagination="{ small: true, layout: 'total,prev, pager, next,jumper' }" />
|
||||||
:key="index"
|
|
||||||
@click="onCheckedRow(item)"
|
|
||||||
class="dict-item"
|
|
||||||
:class="item.id == dictId ? 'active' : ''"
|
|
||||||
>
|
|
||||||
<span class="t1"
|
|
||||||
>{{ item.name }}<span class="t2">({{ item.code }})</span></span
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<pagination
|
|
||||||
style="justify-content: flex-end"
|
|
||||||
class="mt-10 flex"
|
|
||||||
@change="loadDataTable"
|
|
||||||
v-model="pager"
|
|
||||||
layout="total, prev, pager, next"
|
|
||||||
/>
|
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="24" :md="17" :lg="17" :xl="17">
|
<el-col :xs="24" :sm="24" :md="16" :lg="16" :xl="16" class="mb-4">
|
||||||
<el-card shadow="hover" class="mb-4 border-0 proCard">
|
<el-card shadow="hover" class="mb-4 border-0 proCard">
|
||||||
<dictItem :dictId="dictId" v-if="dictItemShow" />
|
<dictItem :dictId="dictId" v-if="dictItemShow"></dictItem>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<editDialog
|
<editDialog v-if="editVisible" :dictId="dictId" v-model:visible="editVisible" @success="reloadTable">
|
||||||
v-if="editVisible"
|
</editDialog>
|
||||||
:dictId="dictId"
|
|
||||||
v-model:visible="editVisible"
|
|
||||||
@success="loadDataTable()"
|
|
||||||
/>
|
|
||||||
</PageWrapper>
|
</PageWrapper>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, ref, nextTick, defineAsyncComponent } from 'vue';
|
import { ref, reactive, h, nextTick, defineAsyncComponent } from 'vue';
|
||||||
import { SearchOutlined } from '@vicons/antd';
|
import { SearchOutlined } from '@vicons/antd';
|
||||||
import { getDictList, refreshCache, dictDelete } from '@/api/data/dictionary';
|
import { TableAction } from '@/components/Table';
|
||||||
import dictItem from './dictItem.vue';
|
import { getDictList, refreshCache, dictDelete, dictBatchDelete } from '@/api/data/dictionary';
|
||||||
import { message, confirm } from '@/utils/auth';
|
import { columns } from './columns';
|
||||||
|
import dictItem from './dictItem.vue';
|
||||||
/**
|
import { message, confirm } from "@/utils/auth";
|
||||||
* 导入组件
|
const editDialog = defineAsyncComponent(() =>
|
||||||
*/
|
import('./edit.vue')
|
||||||
const editDialog = defineAsyncComponent(() => import('./edit.vue'));
|
)
|
||||||
|
const dictId = ref(0)
|
||||||
/**
|
const dictItemShow = ref(false)
|
||||||
* 定义参数变量
|
const tableRef = ref();
|
||||||
*/
|
const selectedKey = ref('');
|
||||||
const dictId = ref(0);
|
const rowKeysName = ref('');
|
||||||
const dictItemShow = ref(false);
|
const currentRow = ref();
|
||||||
const dictDataList = ref([]);
|
const editVisible = ref(false)
|
||||||
const editVisible = ref(false);
|
const selectionData = ref([])
|
||||||
|
const params = ref({
|
||||||
/**
|
|
||||||
* 定义查询参数
|
|
||||||
*/
|
|
||||||
const params = ref({
|
|
||||||
name: '',
|
name: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
const actionColumn = reactive({
|
||||||
*定义分页参数
|
width: 200,
|
||||||
*/
|
label: '操作',
|
||||||
const pager = ref({
|
prop: 'action',
|
||||||
page: 1,
|
fixed: 'right',
|
||||||
size: 20,
|
render(record) {
|
||||||
count: dictDataList.value.length,
|
return h(TableAction as any, {
|
||||||
|
style: 'text',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
label: '编辑',
|
||||||
|
icon:'Edit',
|
||||||
|
type: 'warning',
|
||||||
|
onClick: handleEdit.bind(null, record),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '删除',
|
||||||
|
icon:'Delete',
|
||||||
|
type: 'danger',
|
||||||
|
onClick: handleDelete.bind(null, record),
|
||||||
|
}
|
||||||
|
],
|
||||||
});
|
});
|
||||||
const fwbHeight = document.body.clientHeight - 360;
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* 执行添加
|
//新建字典
|
||||||
*/
|
const addDict = async () => {
|
||||||
const handleAdd = async () => {
|
dictId.value=0
|
||||||
dictId.value = 0;
|
|
||||||
await nextTick();
|
await nextTick();
|
||||||
editVisible.value = true;
|
editVisible.value=true
|
||||||
};
|
};
|
||||||
|
//编辑字典
|
||||||
|
const handleEdit = async (record: Recordable) => {
|
||||||
|
dictId.value=record.row.id
|
||||||
|
await nextTick();
|
||||||
|
editVisible.value=true
|
||||||
|
};
|
||||||
|
//选择字典项
|
||||||
|
function onCheckedRow(row) {
|
||||||
|
dictId.value = row.id
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
//刷新字典项值列表
|
||||||
* 执行编辑
|
function reloadTable() {
|
||||||
*/
|
tableRef.value.reload({ pageNo: 1 });
|
||||||
const handleEdit = () => {
|
}
|
||||||
editVisible.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
//加载字典项值列表;
|
||||||
* 字典数据选中事件
|
const loadDataTable = async (res) => {
|
||||||
* @param row 参数
|
const result = await getDictList({ ...params.value, ...res });
|
||||||
*/
|
dictId.value = result?.records[0]?.id
|
||||||
function onCheckedRow(row) {
|
dictItemShow.value = true
|
||||||
dictId.value = row.id;
|
nextTick(() => {
|
||||||
}
|
const tables = tableRef.value.getTableRef();
|
||||||
|
tables.setCurrentRow(result?.records[0])
|
||||||
|
})
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
//刷新缓存
|
||||||
* 加载字典项值列表
|
async function dictRefresh() {
|
||||||
*/
|
|
||||||
const loadDataTable = async () => {
|
|
||||||
const result = await getDictList({
|
|
||||||
...params.value,
|
|
||||||
pageNo: pager.value.page,
|
|
||||||
pageSize: pager.value.size,
|
|
||||||
});
|
|
||||||
dictId.value = result?.records[0]?.id;
|
|
||||||
dictItemShow.value = true;
|
|
||||||
dictDataList.value = result.records;
|
|
||||||
pager.value.count = result.total;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 刷新缓存
|
|
||||||
*/
|
|
||||||
async function dictRefresh() {
|
|
||||||
await refreshCache();
|
await refreshCache();
|
||||||
message('刷新成功');
|
message("刷新成功");
|
||||||
|
}
|
||||||
|
//删除字典项
|
||||||
|
async function handleDelete(record: Recordable) {
|
||||||
|
let ids = []
|
||||||
|
if (!record) {
|
||||||
|
ids = selectionData.value.map(({ id }) => id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除字典项
|
|
||||||
*/
|
|
||||||
async function handleDelete() {
|
|
||||||
await confirm('确定要删除?');
|
await confirm('确定要删除?');
|
||||||
await dictDelete(dictId.value);
|
record ? await dictDelete(record.row.id) : await dictBatchDelete(ids);
|
||||||
message('删除成功');
|
message("删除成功");
|
||||||
pager.value.page = 1;
|
reloadTable()
|
||||||
loadDataTable();
|
}
|
||||||
}
|
function onSelectionChange(value) {
|
||||||
|
selectionData.value = value
|
||||||
/**
|
}
|
||||||
* 钩子函数
|
|
||||||
*/
|
|
||||||
onMounted(() => {
|
|
||||||
loadDataTable();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.card-header {
|
.card-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dict-list-box {
|
|
||||||
overflow: auto;
|
|
||||||
.dict-item {
|
|
||||||
height: 40px;
|
|
||||||
line-height: 40px;
|
|
||||||
padding: 0 6px;
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
.t1 {
|
|
||||||
font-size: 14px;
|
|
||||||
display: block;
|
|
||||||
font-weight: 700;
|
|
||||||
.t2 {
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.active {
|
|
||||||
background-color: #e8f1ff;
|
|
||||||
border-radius: 3px;
|
|
||||||
|
|
||||||
.t1 {
|
|
||||||
color: #1677ff;
|
|
||||||
}
|
|
||||||
.t2 {
|
|
||||||
color: rgb(22, 119, 255, 0.8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.el-badge__content.is-fixed {
|
|
||||||
top: 20px;
|
|
||||||
right: calc(-10px + var(--el-badge-size) / 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user