mirror of
https://gitee.com/log4j/pig-ui.git
synced 2025-01-03 23:42:23 +08:00
Merge remote-tracking branch 'origin/hui_dev' into leng_dev
This commit is contained in:
commit
71b5086840
@ -1,66 +1,82 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="layout-padding">
|
<div class="layout-padding">
|
||||||
<div class="layout-padding-auto layout-padding-view">
|
<div class="layout-padding-auto layout-padding-view">
|
||||||
<el-row v-show="showSearch" class="mb8">
|
<el-row class="mb8" v-show="showSearch">
|
||||||
<el-form :model="state.queryForm" ref="queryRef" :inline="true" @keyup.enter="getDataList">
|
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||||
<el-form-item :label="$t('sysdict.dictType')" prop="dictType">
|
<el-form-item :label="$t('sysdict.dictType')" prop="dictType">
|
||||||
<el-input :placeholder="$t('sysdict.inputDictTypeTip')" v-model="state.queryForm.dictType" style="max-width: 180px" />
|
<el-input :placeholder="$t('sysdict.inputDictTypeTip')" style="max-width: 180px"
|
||||||
|
v-model="state.queryForm.dictType"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('sysdict.systemFlag')" prop="systemFlag">
|
<el-form-item :label="$t('sysdict.systemFlag')" prop="systemFlag">
|
||||||
<el-select v-model="state.queryForm.systemFlag" clearable>
|
<el-select clearable v-model="state.queryForm.systemFlag">
|
||||||
<el-option v-for="(item, index) in dict_type" :label="item.label" :value="item.value" :key="index"></el-option>
|
<el-option :key="index" :label="item.label" :value="item.value"
|
||||||
|
v-for="(item, index) in dict_type"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item class="ml2">
|
<el-form-item class="ml2">
|
||||||
<el-button icon="search" type="primary" @click="getDataList">
|
<el-button @click="getDataList" icon="search" type="primary">
|
||||||
{{ $t('common.queryBtn') }}
|
{{ $t('common.queryBtn') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button icon="Refresh" @click="resetQuery">{{ $t('common.resetBtn') }}</el-button>
|
<el-button @click="resetQuery" icon="Refresh">{{ $t('common.resetBtn') }}</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<div class="mb8" style="width: 100%">
|
<div class="mb8" style="width: 100%">
|
||||||
<el-button icon="folder-add" type="primary" class="ml10" @click="dicDialogRef.openDialog()">
|
<el-button @click="dicDialogRef.openDialog()" class="ml10" icon="folder-add" type="primary">
|
||||||
{{ $t('common.addBtn') }}
|
{{ $t('common.addBtn') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button :disabled="multiple" icon="Delete" type="primary" class="ml10" v-auth="'sys_dict_del'" @click="handleDelete(selectObjs)">
|
<el-button :disabled="multiple" @click="handleDelete(selectObjs)" class="ml10" icon="Delete" type="primary"
|
||||||
|
v-auth="'sys_dict_del'">
|
||||||
{{ $t('common.delBtn') }}
|
{{ $t('common.delBtn') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button class="ml10" icon="refresh-left" type="primary" @click="handleRefreshCache()">
|
<el-button @click="handleRefreshCache()" class="ml10" icon="refresh-left" type="primary">
|
||||||
{{ $t('common.refreshCacheBtn') }}
|
{{ $t('common.refreshCacheBtn') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button @click="exportExcel" class="ml10" icon="Download" type="primary">
|
||||||
|
{{ $t('common.exportBtn') }}
|
||||||
|
</el-button>
|
||||||
<right-toolbar
|
<right-toolbar
|
||||||
v-model:showSearch="showSearch"
|
@queryTable="getDataList"
|
||||||
class="ml10"
|
class="ml10"
|
||||||
style="float: right; margin-right: 20px"
|
style="float: right; margin-right: 20px"
|
||||||
@queryTable="getDataList"
|
v-model:showSearch="showSearch"
|
||||||
></right-toolbar>
|
></right-toolbar>
|
||||||
</div>
|
</div>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-table :data="state.dataList" v-loading="state.loading" style="width: 100%" @selection-change="handleSelectionChange">
|
<el-table :data="state.dataList" @selection-change="handleSelectionChange" style="width: 100%"
|
||||||
<el-table-column align="center" type="selection" :selectable="handleSelectable" width="50"> </el-table-column>
|
v-loading="state.loading">
|
||||||
<el-table-column type="index" :label="$t('sysdict.index')" width="80" />
|
<el-table-column :selectable="handleSelectable" align="center" type="selection"
|
||||||
|
width="50"></el-table-column>
|
||||||
|
<el-table-column :label="$t('sysdict.index')" type="index" width="80"/>
|
||||||
<el-table-column :label="$t('sysdict.dictType')" show-overflow-tooltip>
|
<el-table-column :label="$t('sysdict.dictType')" show-overflow-tooltip>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button text type="primary" @click="showDictITem(scope.row)">{{ scope.row.dictType }}</el-button>
|
<el-button @click="showDictITem(scope.row)" text type="primary">{{ scope.row.dictType }}
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="description" :label="$t('sysdict.description')" show-overflow-tooltip sortable></el-table-column>
|
<el-table-column :label="$t('sysdict.description')" prop="description" show-overflow-tooltip
|
||||||
<el-table-column prop="systemFlag" :label="$t('sysdict.systemFlag')" show-overflow-tooltip>
|
sortable></el-table-column>
|
||||||
|
<el-table-column :label="$t('sysdict.systemFlag')" prop="systemFlag" show-overflow-tooltip>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :options="dict_type" :value="scope.row.systemFlag"></dict-tag>
|
<dict-tag :options="dict_type" :value="scope.row.systemFlag"></dict-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="remarks" :label="$t('sysdict.remarks')" show-overflow-tooltip></el-table-column>
|
<el-table-column :label="$t('sysdict.remarks')" prop="remarks" show-overflow-tooltip></el-table-column>
|
||||||
<el-table-column prop="createTime" :label="$t('sysdict.createTime')" show-overflow-tooltip sortable></el-table-column>
|
<el-table-column :label="$t('sysdict.createTime')" prop="createTime" show-overflow-tooltip
|
||||||
|
sortable></el-table-column>
|
||||||
<el-table-column :label="$t('common.action')" width="200">
|
<el-table-column :label="$t('common.action')" width="200">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button text type="primary" @click="showDictITem(scope.row)">{{ $t('sysdict.dictItem') }}</el-button>
|
<el-button @click="showDictITem(scope.row)" text type="primary">{{ $t('sysdict.dictItem') }}
|
||||||
<el-button text type="primary" @click="onOpenEditDic('edit', scope.row)">{{ $t('common.editBtn') }} </el-button>
|
</el-button>
|
||||||
<el-tooltip :content="$t('sysdict.deleteDisabledTip')" :disabled="scope.row.systemFlag === 1" placement="top">
|
<el-button @click="onOpenEditDic('edit', scope.row)" text type="primary">{{ $t('common.editBtn')
|
||||||
|
}}
|
||||||
|
</el-button>
|
||||||
|
<el-tooltip :content="$t('sysdict.deleteDisabledTip')" :disabled="scope.row.systemFlag === 1"
|
||||||
|
placement="top">
|
||||||
<span style="margin-left: 12px">
|
<span style="margin-left: 12px">
|
||||||
<el-button text type="primary" :disabled="scope.row.systemFlag !== 1" @click="handleDelete([scope.row.id])">
|
<el-button :disabled="scope.row.systemFlag !== 1" @click="handleDelete([scope.row.id])" text
|
||||||
|
type="primary">
|
||||||
{{ $t('common.delBtn') }}
|
{{ $t('common.delBtn') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
@ -68,79 +84,84 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle"
|
||||||
|
v-bind="state.pagination"/>
|
||||||
</div>
|
</div>
|
||||||
<DicDialog ref="dicDialogRef" @refresh="getDataList()" />
|
<DicDialog @refresh="getDataList()" ref="dicDialogRef"/>
|
||||||
<dict-item-dialog ref="dictItemDialogRef"></dict-item-dialog>
|
<dict-item-dialog ref="dictItemDialogRef"></dict-item-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="systemDic">
|
<script lang="ts" name="systemDic" setup>
|
||||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
import {BasicTableProps, useTable} from '/@/hooks/table';
|
||||||
import { delObj, fetchList, refreshCache } from '/@/api/admin/dict';
|
import {delObj, fetchList, refreshCache} from '/@/api/admin/dict';
|
||||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
import {useMessage, useMessageBox} from '/@/hooks/message';
|
||||||
import { useDict } from '/@/hooks/dict';
|
import {useDict} from '/@/hooks/dict';
|
||||||
import { useI18n } from 'vue-i18n';
|
import {useI18n} from 'vue-i18n';
|
||||||
|
import {downBlobFile} from "/@/utils/other";
|
||||||
|
|
||||||
const { dict_type } = useDict('dict_type');
|
const {dict_type} = useDict('dict_type');
|
||||||
// 引入组件
|
// 引入组件
|
||||||
const DicDialog = defineAsyncComponent(() => import('./form.vue'));
|
const DicDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||||
const DictItemDialog = defineAsyncComponent(() => import('./dictItem/index.vue'));
|
const DictItemDialog = defineAsyncComponent(() => import('./dictItem/index.vue'));
|
||||||
const { t } = useI18n();
|
const {t} = useI18n();
|
||||||
// 定义变量内容
|
// 定义变量内容
|
||||||
const dicDialogRef = ref();
|
const dicDialogRef = ref();
|
||||||
const dictItemDialogRef = ref();
|
const dictItemDialogRef = ref();
|
||||||
const queryRef = ref();
|
const queryRef = ref();
|
||||||
const showSearch = ref(true);
|
const showSearch = ref(true);
|
||||||
// 多选变量
|
// 多选变量
|
||||||
const selectObjs = ref([]) as any;
|
const selectObjs = ref([]) as any;
|
||||||
const multiple = ref(true);
|
const multiple = ref(true);
|
||||||
|
|
||||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||||
queryForm: {},
|
queryForm: {},
|
||||||
pageList: fetchList,
|
pageList: fetchList,
|
||||||
descs: ['create_time'],
|
descs: ['create_time'],
|
||||||
});
|
});
|
||||||
const { getDataList, currentChangeHandle, sizeChangeHandle } = useTable(state);
|
const {getDataList, currentChangeHandle, sizeChangeHandle} = useTable(state);
|
||||||
|
|
||||||
// 打开修改字典弹窗
|
// 打开修改字典弹窗
|
||||||
const onOpenEditDic = (type: string, row: any) => {
|
const onOpenEditDic = (type: string, row: any) => {
|
||||||
dicDialogRef.value.openDialog(type, row);
|
dicDialogRef.value.openDialog(type, row);
|
||||||
};
|
};
|
||||||
|
|
||||||
const showDictITem = (row: any) => {
|
const showDictITem = (row: any) => {
|
||||||
dictItemDialogRef.value.open(row);
|
dictItemDialogRef.value.open(row);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 清空搜索条件
|
// 清空搜索条件
|
||||||
const resetQuery = () => {
|
const resetQuery = () => {
|
||||||
queryRef.value.resetFields();
|
queryRef.value.resetFields();
|
||||||
state.queryForm = {};
|
state.queryForm = {};
|
||||||
getDataList();
|
getDataList();
|
||||||
};
|
};
|
||||||
|
const exportExcel = () => {
|
||||||
|
downBlobFile("/admin/dict/export", state.queryForm, "dict.xlsx")
|
||||||
|
}
|
||||||
|
|
||||||
// 是否可以多选
|
// 是否可以多选
|
||||||
const handleSelectable = (row: any) => {
|
const handleSelectable = (row: any) => {
|
||||||
// 系统类不可多选删除
|
// 系统类不可多选删除
|
||||||
return row.systemFlag !== '1';
|
return row.systemFlag !== '1';
|
||||||
};
|
};
|
||||||
|
|
||||||
// 多选事件
|
// 多选事件
|
||||||
const handleSelectionChange = (objs: any) => {
|
const handleSelectionChange = (objs: any) => {
|
||||||
objs.forEach((val: any) => {
|
objs.forEach((val: any) => {
|
||||||
selectObjs.value.push(val.id);
|
selectObjs.value.push(val.id);
|
||||||
});
|
});
|
||||||
multiple.value = !objs.length;
|
multiple.value = !objs.length;
|
||||||
};
|
};
|
||||||
//刷新缓存
|
//刷新缓存
|
||||||
const handleRefreshCache = () => {
|
const handleRefreshCache = () => {
|
||||||
refreshCache().then(() => {
|
refreshCache().then(() => {
|
||||||
useMessage().success('同步成功');
|
useMessage().success('同步成功');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 删除操作
|
// 删除操作
|
||||||
const handleDelete = (ids: string[]) => {
|
const handleDelete = (ids: string[]) => {
|
||||||
useMessageBox()
|
useMessageBox()
|
||||||
.confirm(t('common.delConfirmText'))
|
.confirm(t('common.delConfirmText'))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -153,5 +174,5 @@ const handleDelete = (ids: string[]) => {
|
|||||||
useMessage().error(err.msg);
|
useMessage().error(err.msg);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user