|
|
@@ -1,29 +1,56 @@
|
|
|
<template>
|
|
|
<div class="p-2">
|
|
|
+ <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
|
|
+ <div v-show="showSearch" class="mb-[10px]">
|
|
|
+ <el-card shadow="hover">
|
|
|
+ <el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
|
|
+ <el-form-item label="导航名称" prop="navigationName">
|
|
|
+ <el-input v-model="queryParams.navigationName" placeholder="请输入导航名称" clearable @keyup.enter="handleQuery" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="是否启用" prop="isEnable">
|
|
|
+ <el-select v-model="queryParams.isEnable" placeholder="请选择" clearable>
|
|
|
+ <el-option label="是" value="0" />
|
|
|
+ <el-option label="否" value="1" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
+ <el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+ </transition>
|
|
|
+
|
|
|
<el-card shadow="hover">
|
|
|
<template #header>
|
|
|
- <div class="card-header">
|
|
|
- <span class="title">底部导航信息列表</span>
|
|
|
- <div>
|
|
|
- <el-button type="primary" @click="handleAdd" v-hasPermi="['system:navigation:add']">+ 新增</el-button>
|
|
|
- <el-button @click="getList">刷新</el-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:navigation:add']">新增</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:navigation:remove']">删除</el-button>
|
|
|
+ </el-col>
|
|
|
+ <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
</template>
|
|
|
|
|
|
- <el-table v-loading="loading" :data="dataList" border>
|
|
|
- <el-table-column label="导航标题" prop="navigationName" align="center" />
|
|
|
- <el-table-column label="链接地址" prop="url" align="center" show-overflow-tooltip />
|
|
|
- <el-table-column label="排序" prop="sort" width="100" align="center" />
|
|
|
- <el-table-column label="是否显示" prop="isEnable" width="100" align="center">
|
|
|
+ <el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column label="导航名称" prop="navigationName" />
|
|
|
+ <el-table-column label="链接地址" prop="url" show-overflow-tooltip />
|
|
|
+ <el-table-column label="排序" prop="sort" width="80" />
|
|
|
+ <el-table-column label="是否启用" prop="isEnable" width="100">
|
|
|
<template #default="scope">
|
|
|
- {{ scope.row.isEnable === '0' ? '显示' : '不显示' }}
|
|
|
+ <el-tag :type="scope.row.isEnable === '0' ? 'success' : 'danger'">
|
|
|
+ {{ scope.row.isEnable === '0' ? '是' : '否' }}
|
|
|
+ </el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" width="150" align="center">
|
|
|
<template #default="scope">
|
|
|
- <el-button link type="primary" @click="handleUpdate(scope.row)" v-hasPermi="['system:navigation:edit']">编辑</el-button>
|
|
|
- <el-button link type="danger" @click="handleDelete(scope.row)" v-hasPermi="['system:navigation:remove']">删除</el-button>
|
|
|
+ <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:navigation:edit']">修改</el-button>
|
|
|
+ <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:navigation:remove']">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -32,39 +59,27 @@
|
|
|
</el-card>
|
|
|
|
|
|
<!-- 添加或修改对话框 -->
|
|
|
- <el-dialog :title="dialog.title" v-model="dialog.visible" width="600px" append-to-body>
|
|
|
- <el-form ref="formRef" :model="form" :rules="rules" label-width="80px">
|
|
|
- <el-row :gutter="20">
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="导航标题" prop="navigationName">
|
|
|
- <el-input v-model="form.navigationName" placeholder="请输入导航标题" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="导航链接" prop="url">
|
|
|
- <el-input v-model="form.url" placeholder="请输入导航链接" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row :gutter="20">
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="排序" prop="sort">
|
|
|
- <el-input-number v-model="form.sort" :min="0" controls-position="right" style="width: 100%" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="是否启用" prop="isEnable">
|
|
|
- <el-switch v-model="form.isEnable" active-value="0" inactive-value="1" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-form-item label="描述" prop="remark">
|
|
|
- <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
|
|
+ <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
|
|
+ <el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
|
|
+ <el-form-item label="导航名称" prop="navigationName">
|
|
|
+ <el-input v-model="form.navigationName" placeholder="请输入导航名称" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="链接地址" prop="url">
|
|
|
+ <el-input v-model="form.url" placeholder="请输入链接地址" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="排序" prop="sort">
|
|
|
+ <el-input-number v-model="form.sort" :min="0" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="是否启用" prop="isEnable">
|
|
|
+ <el-radio-group v-model="form.isEnable">
|
|
|
+ <el-radio value="0">是</el-radio>
|
|
|
+ <el-radio value="1">否</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitForm">确 认</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -81,8 +96,13 @@ const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
|
const dataList = ref([]);
|
|
|
const loading = ref(true);
|
|
|
+const showSearch = ref(true);
|
|
|
+const ids = ref<Array<number | string>>([]);
|
|
|
+const single = ref(true);
|
|
|
+const multiple = ref(true);
|
|
|
const total = ref(0);
|
|
|
|
|
|
+const queryFormRef = ref<FormInstance>();
|
|
|
const formRef = ref<FormInstance>();
|
|
|
|
|
|
const dialog = reactive({ visible: false, title: '' });
|
|
|
@@ -92,13 +112,15 @@ const data = reactive({
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
- navType: 'footer'
|
|
|
+ navType: 'footer',
|
|
|
+ navigationName: undefined,
|
|
|
+ isEnable: undefined
|
|
|
},
|
|
|
rules: {
|
|
|
navigationName: [{ required: true, message: '导航名称不能为空', trigger: 'blur' }],
|
|
|
url: [{ required: true, message: '链接地址不能为空', trigger: 'blur' }],
|
|
|
sort: [{ required: true, message: '排序不能为空', trigger: 'blur' }],
|
|
|
- isEnable: [{ required: true, message: '请选择是否显示', trigger: 'change' }]
|
|
|
+ isEnable: [{ required: true, message: '请选择是否启用', trigger: 'change' }]
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -112,6 +134,22 @@ const getList = async () => {
|
|
|
loading.value = false;
|
|
|
};
|
|
|
|
|
|
+const handleQuery = () => {
|
|
|
+ queryParams.value.pageNum = 1;
|
|
|
+ getList();
|
|
|
+};
|
|
|
+
|
|
|
+const resetQuery = () => {
|
|
|
+ queryFormRef.value.resetFields();
|
|
|
+ handleQuery();
|
|
|
+};
|
|
|
+
|
|
|
+const handleSelectionChange = (selection: any[]) => {
|
|
|
+ ids.value = selection.map(item => item.id);
|
|
|
+ single.value = selection.length !== 1;
|
|
|
+ multiple.value = !selection.length;
|
|
|
+};
|
|
|
+
|
|
|
const reset = () => {
|
|
|
form.value = {
|
|
|
id: undefined,
|
|
|
@@ -119,8 +157,7 @@ const reset = () => {
|
|
|
navigationName: undefined,
|
|
|
url: undefined,
|
|
|
sort: 0,
|
|
|
- isEnable: '0',
|
|
|
- remark: undefined
|
|
|
+ isEnable: '0'
|
|
|
};
|
|
|
formRef.value?.resetFields();
|
|
|
};
|
|
|
@@ -128,12 +165,13 @@ const reset = () => {
|
|
|
const handleAdd = () => {
|
|
|
reset();
|
|
|
dialog.visible = true;
|
|
|
- dialog.title = '新增底部导航';
|
|
|
+ dialog.title = '添加底部导航';
|
|
|
};
|
|
|
|
|
|
const handleUpdate = async (row: any) => {
|
|
|
reset();
|
|
|
- const res = await getNavigation(row.id);
|
|
|
+ const id = row.id || ids.value[0];
|
|
|
+ const res = await getNavigation(id);
|
|
|
Object.assign(form.value, res.data);
|
|
|
dialog.visible = true;
|
|
|
dialog.title = '修改底部导航';
|
|
|
@@ -155,9 +193,10 @@ const submitForm = () => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-const handleDelete = async (row: any) => {
|
|
|
+const handleDelete = async (row?: any) => {
|
|
|
+ const deleteIds = row?.id || ids.value;
|
|
|
await proxy?.$modal.confirm('是否确认删除?');
|
|
|
- await delNavigation(row.id);
|
|
|
+ await delNavigation(deleteIds);
|
|
|
proxy?.$modal.msgSuccess('删除成功');
|
|
|
getList();
|
|
|
};
|
|
|
@@ -169,15 +208,3 @@ const cancel = () => {
|
|
|
|
|
|
getList();
|
|
|
</script>
|
|
|
-
|
|
|
-<style scoped>
|
|
|
-.card-header {
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- align-items: center;
|
|
|
-}
|
|
|
-.card-header .title {
|
|
|
- font-size: 16px;
|
|
|
- font-weight: bold;
|
|
|
-}
|
|
|
-</style>
|