|
@@ -0,0 +1,128 @@
|
|
|
+<template>
|
|
|
+ <div class="page">
|
|
|
+ <el-card shadow="nover">
|
|
|
+ <el-form :model="params" inline ref="queryRef">
|
|
|
+ <el-form-item label="名称搜索" prop="name">
|
|
|
+ <el-input v-model="params.name" placeholder="请输入接口名称" clearable style="width: 180px" @keyup.enter.native="getList(1)" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="状态" prop="status">
|
|
|
+ <el-select v-model="params.status" placeholder="接口状态" clearable style="width: 120px">
|
|
|
+ <el-option label="全部" :value="-1" />
|
|
|
+ <el-option label="启用" :value="1" />
|
|
|
+ <el-option label="禁用" :value="0" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" class="ml10" @click="getList(1)">
|
|
|
+ <el-icon>
|
|
|
+ <ele-Search />
|
|
|
+ </el-icon>
|
|
|
+ 查询
|
|
|
+ </el-button>
|
|
|
+ <el-button type="primary" @click="addOrEdit()" v-auth="'add'">
|
|
|
+ <el-icon>
|
|
|
+ <ele-FolderAdd />
|
|
|
+ </el-icon>
|
|
|
+ 新增租户
|
|
|
+ </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <el-table :data="tableData" @selection-change="handleSelectionChange" style="width: 100%" v-loading="loading" row-key="id">
|
|
|
+ <!-- <el-table-column v-col="'selection'" type="selection" width="55" align="center" /> -->
|
|
|
+ <el-table-column prop="name" label="租户名称" min-width="150" align="center" />
|
|
|
+ <el-table-column prop="code" label="租户编码" min-width="120" align="center" />
|
|
|
+ <el-table-column prop="systemName" label="系统名称" min-width="120" align="center" />
|
|
|
+ <el-table-column prop="systemCopyright" label="系统版权" min-width="120" align="center" />
|
|
|
+ <el-table-column prop="logoMini" label="系统LOGO(小图标)" width="120" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-image v-if="row.logoMini" :src="row.logoMini" style="width: 90px; height: 90px" preview-teleported :preview-src-list="[row.logoMini]" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="logoPic" label="登录展示图" width="120" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-image v-if="row.logoPic" :src="row.logoPic" style="width: 90px; height: 90px" preview-teleported :preview-src-list="[row.logoPic]" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="logo" label="系统LOGO" width="120" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-image v-if="row.logo" :src="row.logo" style="width: 90px; height: 90px" preview-teleported :preview-src-list="[row.logo]" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="status" label="租户状态" width="100" align="center">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-switch v-model="scope.row.status" inline-prompt :active-value="1" :inactive-value="0" active-text="启" inactive-text="禁" @change="handleStatusChange(scope.row)">
|
|
|
+ </el-switch>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="100" align="center" v-col="'handle'">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button size="small" text type="warning" @click="addOrEdit(scope.row)" v-auth="'edit'">修改</el-button>
|
|
|
+ <el-button size="small" text type="info" @click="onDel(scope.row)" v-auth="'del'">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <pagination v-if="params.total" :total="params.total" v-model:page="params.pageNum" v-model:limit="params.pageSize" @pagination="getList()" />
|
|
|
+ </el-card>
|
|
|
+ <EditForm ref="editFormRef" @getList="getList(1)"></EditForm>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup>
|
|
|
+import { ref } from 'vue'
|
|
|
+import EditForm from './edit.vue'
|
|
|
+import api from '/@/api/modules'
|
|
|
+import { ElMessageBox, ElMessage } from 'element-plus'
|
|
|
+import { useSearch } from '/@/hooks/useCommon'
|
|
|
+
|
|
|
+const editFormRef = ref()
|
|
|
+const queryRef = ref()
|
|
|
+const ids = ref<number[]>([])
|
|
|
+
|
|
|
+const { params, tableData, getList, loading } = useSearch(api.tenant.list, 'Data', { name: '', keyWord: '', status: -1 })
|
|
|
+
|
|
|
+getList()
|
|
|
+
|
|
|
+const addOrEdit = async (row?: any) => {
|
|
|
+ if (row) {
|
|
|
+ editFormRef.value.open(row)
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ editFormRef.value.open()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const handleSelectionChange = (selection: any[]) => {
|
|
|
+ ids.value = selection.filter(item => item.types === 2).map((item) => item.id);
|
|
|
+};
|
|
|
+
|
|
|
+const onDel = (row: any) => {
|
|
|
+ ElMessageBox.confirm(`此操作将删除接口:“${row.name}”,是否继续?`, '提示', {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }).then(async () => {
|
|
|
+ await api.tenant.del([row.id as number])
|
|
|
+ ElMessage.success('删除成功')
|
|
|
+ getList()
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+// 状态修改
|
|
|
+const handleStatusChange = (row: any) => {
|
|
|
+ let text = row.status === 1 ? '启用' : '停用';
|
|
|
+ ElMessageBox.confirm('确认要"' + text + '":"' + row.name + '"吗?', '警告', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ .then(function () {
|
|
|
+ return api.tenant.editStatus(row.id, row.status);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ ElMessage.success(text + '成功');
|
|
|
+ })
|
|
|
+ .catch(function () {
|
|
|
+ row.status = row.status === 0 ? 1 : 0;
|
|
|
+ });
|
|
|
+};
|
|
|
+</script>
|