|
@@ -1,7 +1,14 @@
|
|
|
<template>
|
|
|
- <div class="bm-main-box">
|
|
|
- <div class="flex items-center">
|
|
|
- <div class="ml-auto flex items-center gap-2.5">
|
|
|
+ <CzrContent
|
|
|
+ v-model:tableHead="state.query.head"
|
|
|
+ @handleReset="onReset"
|
|
|
+ @handleSearch="onSearch"
|
|
|
+ >
|
|
|
+ <template #tableTitle>
|
|
|
+ <div class="flex gap-2.5"></div>
|
|
|
+ </template>
|
|
|
+ <template #buttons>
|
|
|
+ <div class="flex items-center gap-2.5">
|
|
|
<CzrForm class="bm-filter" label-width="0px" @handleEnter="onSearch">
|
|
|
<CzrFormColumn
|
|
|
width="19rem"
|
|
@@ -14,13 +21,13 @@
|
|
|
placeholder="租户启用时间"
|
|
|
/>
|
|
|
<CzrFormColumn
|
|
|
- width="23rem"
|
|
|
+ width="19rem"
|
|
|
class="__czr-table-form-column"
|
|
|
:span="24"
|
|
|
label-width="0px"
|
|
|
v-model:param="state.query.form.time2"
|
|
|
- link="datetime"
|
|
|
- type="datetimerange"
|
|
|
+ link="date"
|
|
|
+ type="daterange"
|
|
|
placeholder="租户到期时间"
|
|
|
/>
|
|
|
<CzrFormColumn
|
|
@@ -45,139 +52,50 @@
|
|
|
<CzrButton type="add" @click="onAdd" />
|
|
|
</CzrForm>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="mt-4 flex-1 overflow-hidden" v-loading="state.query.loading">
|
|
|
- <CzrTableCard
|
|
|
- class="table-card"
|
|
|
+ </template>
|
|
|
+ <template #table>
|
|
|
+ <CzrTable
|
|
|
+ v-loading="state.query.loading"
|
|
|
+ v-model:data="state.query.result.data"
|
|
|
+ :head="state.query.head"
|
|
|
+ :total="state.query.result.total"
|
|
|
:page="state.query.page.pageNum"
|
|
|
:pageSize="state.query.page.pageSize"
|
|
|
- :total="state.query.result.total"
|
|
|
- :data="state.query.result.data"
|
|
|
@handlePage="onPage"
|
|
|
- :col="4"
|
|
|
+ @handleSort="onSort"
|
|
|
+ v-model:selected="state.query.selected"
|
|
|
>
|
|
|
- <template #model="{ row, index }">
|
|
|
- <div
|
|
|
- class="model __hover"
|
|
|
- @click="
|
|
|
- $router.push({
|
|
|
- name: 'e16b6e20-4ea1-4160-9624-e775949b0c32',
|
|
|
- params: {
|
|
|
- id: row.id,
|
|
|
- },
|
|
|
- })
|
|
|
- "
|
|
|
- >
|
|
|
- <div class="flex">
|
|
|
- <template v-if="row.icon">
|
|
|
- <img :src="row.icon" class="mr-2.5 h-[3.25rem] w-[3.25rem]" />
|
|
|
- </template>
|
|
|
- <template v-else>
|
|
|
- <img
|
|
|
- src="@/assets/images/app/app-default-logo.png"
|
|
|
- class="mr-2.5 h-[3.25rem] w-[3.25rem]"
|
|
|
- />
|
|
|
- </template>
|
|
|
- <div class="flex flex-1 flex-col overflow-hidden">
|
|
|
- <div class="flex">
|
|
|
- <template v-if="row.status == 0">
|
|
|
- <div
|
|
|
- class="rounded-xs bg-[#A7ADB9] px-2.5 py-1 text-xs text-white"
|
|
|
- >
|
|
|
- 草稿
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <template v-else-if="row.status == 1">
|
|
|
- <div
|
|
|
- class="rounded-xs bg-[#5AD8A6] px-2.5 py-1 text-xs text-white"
|
|
|
- >
|
|
|
- 已发布
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <template v-if="row.type == 0">
|
|
|
- <div
|
|
|
- class="ml-auto rounded-2xl bg-gradient-to-r from-[#C3E3FC] to-[#86C4FF] px-3 py-1 text-xs text-[#0876FF]"
|
|
|
- >
|
|
|
- 简洁
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <template v-else-if="row.type == 1">
|
|
|
- <div
|
|
|
- class="ml-auto rounded-2xl bg-gradient-to-r from-[#E0DAFF] to-[#BABCFF] px-3 py-1 text-xs text-[#1E3F92]"
|
|
|
- >
|
|
|
- 高级
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- class="mt-1.5 text-xl font-bold text-[#2E3238]"
|
|
|
- style="line-height: 1.3"
|
|
|
- v-title
|
|
|
- >
|
|
|
- {{ row.name }}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- class="mt-3 flex items-center gap-2.5 text-[0.75rem] text-[#6F7889]"
|
|
|
- >
|
|
|
- <div>{{ row.userNickName }}</div>
|
|
|
- <div>|</div>
|
|
|
- <div>{{ YMDHms(row.updateTime) }}</div>
|
|
|
- <div class="ml-auto">
|
|
|
- <el-dropdown :teleported="true">
|
|
|
- <SvgIcon name="omit" />
|
|
|
- <template #dropdown>
|
|
|
- <el-dropdown-menu>
|
|
|
- <el-dropdown-item @click="onCopy(row)">
|
|
|
- 创建副本
|
|
|
- </el-dropdown-item>
|
|
|
- <el-dropdown-item @click="onEdit(row)">
|
|
|
- 设置
|
|
|
- </el-dropdown-item>
|
|
|
- <el-dropdown-item @click="onDel(row)">
|
|
|
- 删除
|
|
|
- </el-dropdown-item>
|
|
|
- <template v-if="row.status == 1">
|
|
|
- <el-dropdown-item @click="onMonitor(row)">
|
|
|
- 监测
|
|
|
- </el-dropdown-item>
|
|
|
- </template>
|
|
|
- </el-dropdown-menu>
|
|
|
- </template>
|
|
|
- </el-dropdown>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <template #caozuo-column-value="{ scope }">
|
|
|
+ <div class="__czr-table-operations">
|
|
|
+ <CzrButton type="table" title="编辑" @click="onEdit(scope.row)" />
|
|
|
+ <CzrButton type="table-del" @click="onDel(scope.row)" />
|
|
|
</div>
|
|
|
</template>
|
|
|
- </CzrTableCard>
|
|
|
- </div>
|
|
|
- <!-- <detailCom-->
|
|
|
- <!-- v-model:show="state.detail.show"-->
|
|
|
- <!-- :transfer="state.detail.transfer"-->
|
|
|
- <!-- @refresh="onSearch"-->
|
|
|
- <!-- />-->
|
|
|
- </div>
|
|
|
+ </CzrTable>
|
|
|
+ </template>
|
|
|
+ </CzrContent>
|
|
|
+ <detailCom
|
|
|
+ v-model:show="state.detail.show"
|
|
|
+ :transfer="state.detail.transfer"
|
|
|
+ @refresh="onSearch"
|
|
|
+ />
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { getCurrentInstance, onMounted, reactive, ref, watch } from 'vue'
|
|
|
+import {
|
|
|
+ computed,
|
|
|
+ getCurrentInstance,
|
|
|
+ onMounted,
|
|
|
+ reactive,
|
|
|
+ ref,
|
|
|
+ watch,
|
|
|
+} from 'vue'
|
|
|
import { Search } from '@element-plus/icons-vue'
|
|
|
import { debounce } from 'lodash'
|
|
|
import { useAppStore, useDialogStore, useDictionaryStore } from '@/stores'
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
-// import detailCom from './detail.vue'
|
|
|
-import {
|
|
|
- pluginDel,
|
|
|
- pluginGetInstanceList,
|
|
|
- pluginUpdateStatus,
|
|
|
-} from '@/api/modules/model'
|
|
|
-import { YMDHms } from '@/utils/czr-util'
|
|
|
-import SvgIcon from '@/components/SvgIcon/index.vue'
|
|
|
-import { useRouter } from 'vue-router'
|
|
|
-import { appDel, appSearch } from '@/api/modules/app'
|
|
|
+import detailCom from './detail.vue'
|
|
|
|
|
|
-const router = useRouter()
|
|
|
const AppStore = useAppStore()
|
|
|
const DialogStore = useDialogStore()
|
|
|
const DictionaryStore = useDictionaryStore()
|
|
@@ -189,16 +107,49 @@ const state: any = reactive({
|
|
|
query: {
|
|
|
init: false,
|
|
|
loading: false,
|
|
|
+ head: [
|
|
|
+ { value: 'name', label: '租户名称', show: true },
|
|
|
+ { value: 'name', label: '租户编号', show: true },
|
|
|
+ { value: 'name', label: '用户配额', show: true },
|
|
|
+ { value: 'name', label: '租户状态', show: true },
|
|
|
+ { value: 'name', label: '用户数量', show: true, sort: true },
|
|
|
+ {
|
|
|
+ value: 'createTime',
|
|
|
+ label: '租户启用时间',
|
|
|
+ show: true,
|
|
|
+ width: 180,
|
|
|
+ datetime: true,
|
|
|
+ sort: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'updateTime',
|
|
|
+ label: '租户停用时间',
|
|
|
+ show: true,
|
|
|
+ width: 180,
|
|
|
+ datetime: true,
|
|
|
+ sort: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 'caozuo',
|
|
|
+ label: '操作',
|
|
|
+ show: true,
|
|
|
+ width: 200,
|
|
|
+ fixed: 'right',
|
|
|
+ popover: false,
|
|
|
+ },
|
|
|
+ ],
|
|
|
page: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 20,
|
|
|
},
|
|
|
form: {},
|
|
|
formReal: {},
|
|
|
+ sort: {},
|
|
|
result: {
|
|
|
total: 0,
|
|
|
data: [],
|
|
|
},
|
|
|
+ selected: [],
|
|
|
},
|
|
|
detail: {
|
|
|
show: false,
|
|
@@ -223,6 +174,10 @@ watch(
|
|
|
},
|
|
|
{ deep: true },
|
|
|
)
|
|
|
+const onSort = ({ key, value }) => {
|
|
|
+ state.query.sort[key] = value
|
|
|
+ onSearch()
|
|
|
+}
|
|
|
const onPage = (pageNum, pageSize) => {
|
|
|
setTimeout(() => {
|
|
|
state.query.init = true
|
|
@@ -241,16 +196,20 @@ const onPage = (pageNum, pageSize) => {
|
|
|
params[k] = v
|
|
|
}
|
|
|
}
|
|
|
- state.query.loading = true
|
|
|
- appSearch(params)
|
|
|
- .then(({ data }: any) => {
|
|
|
- state.query.result.total = data.total
|
|
|
- state.query.result.data = data.records
|
|
|
- })
|
|
|
- .catch(() => {})
|
|
|
- .finally(() => {
|
|
|
- state.query.loading = false
|
|
|
- })
|
|
|
+
|
|
|
+ // 添加排序参数
|
|
|
+ for (const [k, v] of Object.entries(state.query.sort)) {
|
|
|
+ }
|
|
|
+ // state.query.loading = true
|
|
|
+ // appSearch(params)
|
|
|
+ // .then(({ data }: any) => {
|
|
|
+ // state.query.result.total = data.total
|
|
|
+ // state.query.result.data = data.records
|
|
|
+ // })
|
|
|
+ // .catch(() => {})
|
|
|
+ // .finally(() => {
|
|
|
+ // state.query.loading = false
|
|
|
+ // })
|
|
|
}
|
|
|
const onSearch = () => {
|
|
|
state.query.formReal = JSON.parse(JSON.stringify(state.query.form))
|
|
@@ -262,6 +221,7 @@ const onReset = () => {
|
|
|
pageSize: 20,
|
|
|
}
|
|
|
state.query.form = {}
|
|
|
+ state.query.sort = {}
|
|
|
onSearch()
|
|
|
}
|
|
|
const onAdd = () => {
|
|
@@ -270,13 +230,6 @@ const onAdd = () => {
|
|
|
}
|
|
|
state.detail.show = true
|
|
|
}
|
|
|
-const onCopy = (row) => {
|
|
|
- state.detail.transfer = {
|
|
|
- mode: 'copy',
|
|
|
- id: row.id,
|
|
|
- }
|
|
|
- state.detail.show = true
|
|
|
-}
|
|
|
const onEdit = (row) => {
|
|
|
state.detail.transfer = {
|
|
|
mode: 'edit',
|
|
@@ -289,22 +242,14 @@ const onDel = (row: any) => {
|
|
|
title: '删除确认',
|
|
|
content: `请确认是否删除`,
|
|
|
onSubmit: () => {
|
|
|
- appDel(row.id)
|
|
|
- .then(() => {
|
|
|
- ElMessage.success('删除成功!')
|
|
|
- })
|
|
|
- .catch(() => {})
|
|
|
- .finally(() => {
|
|
|
- onSearch()
|
|
|
- })
|
|
|
- },
|
|
|
- })
|
|
|
-}
|
|
|
-const onMonitor = (row) => {
|
|
|
- router.push({
|
|
|
- name: 'a36ccd46-f399-4bf6-8db9-157ca8d3e8c8',
|
|
|
- params: {
|
|
|
- id: row.id,
|
|
|
+ // appDel(row.id)
|
|
|
+ // .then(() => {
|
|
|
+ // ElMessage.success('删除成功!')
|
|
|
+ // })
|
|
|
+ // .catch(() => {})
|
|
|
+ // .finally(() => {
|
|
|
+ // onSearch()
|
|
|
+ // })
|
|
|
},
|
|
|
})
|
|
|
}
|