提交 442c6fd6 authored 作者: xiejiang's avatar xiejiang

fix: 修改页面,以及优化表格

上级 6102a44c
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-27 15:14:31
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-05 17:29:47
* @LastEditTime: 2024-12-11 10:59:29
* @Description: 弹窗
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -55,7 +55,11 @@ watch(
},
{ immediate: true }
)
const emit = defineEmits(['update:dialogVisible', 'close', 'confirm'])
const emit = defineEmits<{
(e: 'update:dialogVisible', value: Boolean): void
(e: 'close'): void
(e: 'confirm'): void
}>()
const closeDialog = () => {
emit('update:dialogVisible', false)
emit('close')
......
......@@ -51,7 +51,12 @@ const props = withDefaults(defineProps<DrawerProps>(), {
confirmBtnText: '确定'
})
const visible = ref(props.drawerVisible)
const emit = defineEmits(['update:drawerVisible', 'close', 'confirm'])
// const emit = defineEmits(['update:drawerVisible', 'close', 'confirm'])
const emit = defineEmits<{
'update:drawerVisible': [value: boolean]
close: []
confirm: []
}>()
const closeDrawer = () => {
emit('update:drawerVisible', false)
emit('close')
......
......@@ -14,9 +14,9 @@ watch(
isCollapse,
(val: boolean) => {
if (!val) {
width.value = window.innerWidth - 232 + 'px'
width.value = window.innerWidth - 208 + 'px'
} else {
width.value = window.innerWidth - 64 + 'px'
width.value = window.innerWidth - 50 + 'px'
}
},
{ immediate: true }
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-06 09:53:55
* @LastEditors: xiejiang
* @LastEditTime: 2024-11-26 11:54:06
* @LastEditTime: 2024-12-11 10:58:57
* @Description: 图片预览
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -42,7 +42,11 @@ const props = withDefaults(defineProps<imageVierwer>(), {
isDel: false
})
const emit = defineEmits(['close', 'onDel'])
const emit = defineEmits<{
(e: 'close'): void
(e: 'onDel'): void
}>()
const handleDel = () => {
emit('onDel')
}
......
......@@ -2,24 +2,24 @@
* @Author: xiejiang
* @Date: 2024-11-28 09:24:26
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-08 15:47:14
* @LastEditTime: 2024-12-11 10:23:44
* @Description: table操作按钮
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
<template>
<t-tooltip :content="props.content">
<t-button
class="operate-btn"
variant="text"
@click="handleClick"
:disabled="props.disabled"
:loading="props.loading"
v-bind="$attrs"
>
<template #icon> <slot></slot></template>
{{ props.content }}
</t-button>
</t-tooltip>
<!-- <t-tooltip :content="props.content"> -->
<t-button
class="operate-btn"
variant="text"
@click="handleClick"
:disabled="props.disabled"
:loading="props.loading"
v-bind="$attrs"
>
<template #icon> <slot></slot></template>
{{ props.content }}
</t-button>
<!-- </t-tooltip> -->
</template>
<script lang="ts" setup name="OperateButton">
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-07 11:19:31
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-10 14:16:57
* @LastEditTime: 2024-12-11 11:15:52
* @Description: 表格页面容器组件
-->
<template>
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2023-07-13 10:27:58
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-09 17:36:28
* @LastEditTime: 2024-12-11 11:06:17
* @Description: 搜索组件
-->
<template>
......@@ -24,7 +24,11 @@
</template>
<script setup name="SearchWithButton" lang="ts">
const emit = defineEmits(['update:modelValue', 'onSearch', 'clear'])
const emit = defineEmits<{
'update:modelValue': [value: string]
onSearch: [value: string]
clear: []
}>()
const props = defineProps({
modelValue: {
type: String,
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-06 09:53:55
* @LastEditors: xiejiang
* @LastEditTime: 2024-11-28 16:44:29
* @LastEditTime: 2024-12-11 11:06:46
* @Description: 系统提示确认
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -51,7 +51,10 @@ const loading = ref(false)
const visible = ref(props.dialogVisible)
const emit = defineEmits(['close', 'confirm'])
const emit = defineEmits<{
close: []
confirm: []
}>()
const handleConfirm = () => {
emit('confirm')
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-12-10 15:36:04
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-11 09:18:42
* @LastEditTime: 2024-12-11 09:59:56
* @Description: 更新版本弹窗
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -50,8 +50,6 @@ const visible = ref(false)
watch(
() => props.dialogVisible,
val => {
console.log(val)
visible.value = val
},
{ immediate: true }
......
<!--
* @Author: xiejiang
* @Date: 2024-11-05 10:14:56
* @LastEditors: xiejiang
* @LastEditTime: 2024-11-11 10:13:11
* @Description: 上传图片组件
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
<template>
<div class="upload-box">
<t-upload theme="image" :multiple="false" :disabled="disabled" :sizeLimit="{
size: fileSize, unit: 'MB', message: `图片大小不超过${fileSize} MB`
}" :requestMethod="handleHttpUpload" :onSuccess="uploadSuccess" :onFail="uploadError" :draggable="drag"
:accept="fileType.join(',')">
</t-upload>
</div>
</template>
<script setup lang="ts" name="UploadImg">
import axios from 'axios'
import { generateUUID } from '@/utils'
import { signature } from '@/api/modules/upload'
import { NotifyPlugin } from 'tdesign-vue-next';
import type { UploadFile, RequestMethodResponse } from 'tdesign-vue-next'
interface UploadFileProps {
imageUrl: string // 图片地址 ==> 必传
drag?: boolean // 是否支持拖拽上传 ==> 非必传(默认为 true)
disabled?: boolean // 是否禁用上传组件 ==> 非必传(默认为 false)
fileSize?: number // 图片大小限制 ==> 非必传(默认为 5M)
fileType?: File.ImageMimeType[] // 图片类型限制 ==> 非必传(默认为 ["image/jpeg", "image/png", "image/gif"])
height?: string // 组件高度 ==> 非必传(默认为 150px)
width?: string // 组件宽度 ==> 非必传(默认为 150px)
borderRadius?: string // 组件边框圆角 ==> 非必传(默认为 8px)
}
// 接受父组件参数
const props = withDefaults(defineProps<UploadFileProps>(), {
imageUrl: '',
drag: true,
disabled: false,
fileSize: 5,
fileType: () => ['image/jpeg', 'image/png', 'image/gif'],
height: '150px',
width: '150px',
borderRadius: '8px'
})
// 生成组件唯一id
const uuid = ref('id-' + generateUUID())
/**
* @description 图片上传
* @param options upload 所有配置项
* */
interface UploadEmits {
(e: 'update:imageUrl', value: string): void
}
const emit = defineEmits<UploadEmits>()
// 获取上传签名
const getSignature = (name: string) => {
return signature(name)
}
interface SignatureData {
accessId: string;
policy: string;
signature: string;
dir: string;
host: string;
}
const handleHttpUpload = async (file: UploadFile): Promise<RequestMethodResponse> => {
let requestMethodResponse: RequestMethodResponse = { status: 'fail', error: '未知错误', response: {} }
const fileName = uuid.value + file.name
let signatureData = {} as SignatureData
try {
const { data } = await getSignature(fileName)
signatureData = data
} catch (error) {
requestMethodResponse = { status: 'fail', error: '获取签名失败', response: {} }
}
const formData = new FormData()
formData.append('OSSAccessKeyId', signatureData.accessId)
formData.append('policy', signatureData.policy)
formData.append('Signature', signatureData.signature)
formData.append('success_action_status', '200')
formData.append('key', signatureData.dir! + '/' + fileName)
formData.append('file', file.raw!)
try {
await axios({
url: signatureData.host,
method: 'post',
headers: {
'Content-Type': 'multipart/form-data'
},
data: formData
}).then(() => {
const imageUrl = `${signatureData.host}/${signatureData.dir}/${fileName}`
emit('update:imageUrl', imageUrl)
requestMethodResponse = { status: 'success', response: { url: imageUrl, name: file.name } }
})
} catch (error) {
requestMethodResponse = { status: 'fail', error: '上传失败', response: {} }
}
// 添加默认返回值
return requestMethodResponse
}
/**
* @description 图片上传成功
* */
const uploadSuccess = () => {
NotifyPlugin.success({
title: '温馨提示',
content: '图片上传成功!'
})
}
/**
* @description 图片上传错误
* */
const uploadError = () => {
NotifyPlugin('error', {
title: '温馨提示',
content: '图片上传失败,请您重新上传!'
})
}
</script>
<style scoped lang="less"></style>
......@@ -96,7 +96,9 @@ const self_disabled = computed(() => {
if (self_disabled.value) nextTick(() => editorRef.value.disable())
// 富文本的内容监听,触发父组件改变,实现双向数据绑定
const emit = defineEmits(['update:value'])
const emit = defineEmits<{
'update:value': [value: string]
}>()
const valueHtml = computed({
get() {
return props.value
......
......@@ -7,7 +7,7 @@
.main {
box-sizing: border-box;
margin: 12px;
margin: 0 12px 12px;
max-height: calc(100% - 52px);
max-width: calc(100% - 24px);
overflow: auto;
......
......@@ -53,6 +53,10 @@
background: var(--td-gray-color-1);
}
p {
margin: 8px 0;
}
// 表格
.t-table {
thead th {
......@@ -79,7 +83,7 @@
td {
border: none;
font-size: 13px;
padding: 8px;
padding: 10px 16px;
}
}
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-28 15:01:02
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-11 09:45:58
* @LastEditTime: 2024-12-11 11:09:12
* @Description: 机构管理
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -15,7 +15,7 @@
:loading="loading"
:pagination="pagination"
@search-change="handleSearch"
@clear="handleClear"
@clear="handleClear(true)"
@page-change="handlePage"
>
<template #header-left>
......@@ -23,7 +23,7 @@
:loading="loading"
placeholder="机构名称"
v-model="companyName"
@clear="handleClear"
@clear="handleClear(null)"
@on-search="handleSearch(searchParams)"
/></template>
......@@ -49,6 +49,7 @@
<script setup lang="tsx" name="institution">
import { useRouter } from 'vue-router'
import dayjs from 'dayjs'
import { PrimaryTableCol, MessagePlugin } from 'tdesign-vue-next'
import type { filterItemProp } from '@/components/PageFilters/interface/index'
import type { Pagination } from '@/components/PageContainer/interface/index'
......@@ -142,11 +143,13 @@ const columns: PrimaryTableCol[] = [
ellipsis: true,
cell: (h, { row }) => {
return (
<div class='flex items-center'>
<span>
{row.adminUserName}({row.adminUserMobile})
</span>
</div>
<t-tooltip content={`${row.adminUserName}(${row.adminUserMobile})`}>
<div class='ellipsis'>
<span>
{row.adminUserName}({row.adminUserMobile})
</span>
</div>
</t-tooltip>
)
}
},
......@@ -155,9 +158,17 @@ const columns: PrimaryTableCol[] = [
colKey: 'serviceTerminationTime',
cell: (h, { row }) => {
return (
<div class={row.serviceStatus == 2 ? 'ellipsis text-[var(--td-error-color-11)]' : 'ellipsis'}>
{row.serviceTerminationTime}
</div>
<t-tooltip content={row.serviceTerminationTime}>
<div
class={
dayjs(row.serviceTerminationTime).isBefore(dayjs())
? 'ellipsis text-[var(--td-error-color-11)]'
: 'ellipsis'
}
>
{row.serviceTerminationTime}
</div>
</t-tooltip>
)
}
},
......@@ -193,9 +204,11 @@ const columns: PrimaryTableCol[] = [
cell: (h, { row }) => {
return (
<div class='flex items-center justify-between'>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}>
<span class={row.inputUserDelFlag ? 'text-[var(--td-font-gray-3)]' : ''}>{row.inputUserName || '-'}</span>
</div>
<t-tooltip content={row.inputUserName}>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}>
<span>{row.inputUserName || '-'}</span>
</div>
</t-tooltip>
{row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''}
</div>
)
......@@ -233,7 +246,10 @@ const handleSearch = (params: Record<string, any>) => {
getData()
}
const handleClear = () => {
const handleClear = (flge: boolean | null) => {
if (flge) {
searchParams.value = {}
}
companyName.value = ''
pagination.value.page = 1
getData()
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-11 09:38:40
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-10 16:03:16
* @LastEditTime: 2024-12-11 11:31:32
* @Description: 系统字典-管理子集
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -256,6 +256,8 @@ onMounted(() => {
</script>
<style lang="less" scoped>
@import './comm.less';
.table-add {
width: 100%;
padding: 13px;
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-11 09:38:40
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-11 09:34:26
* @LastEditTime: 2024-12-11 11:28:55
* @Description: 系统字典
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -15,7 +15,7 @@
:loading="loading"
:pagination="pagination"
@search-change="handleSearch"
@clear="handleClear"
@clear="handleClear(true)"
@page-change="handlePage"
>
<template #header-left>
......@@ -24,7 +24,7 @@
placeholder="搜索字典大类,字典名称"
v-model="categoryNameOrDictName"
@on-search="handleSearch(searchParams)"
@clear="handleClear"
@clear="handleClear(null)"
/></template>
<template #header-right>
......@@ -163,9 +163,11 @@ const columns: PrimaryTableCol[] = [
cell: (h, { row }) => {
return (
<div class='flex items-center justify-between'>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}>
<span class={row.inputUserDelFlag ? 'text-[var(--td-font-gray-3)]' : ''}>{row.inputUserName || '-'}</span>
</div>
<t-tooltip content={row.inputUserName}>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}>
<span>{row.inputUserName || '-'}</span>
</div>
</t-tooltip>
{row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''}
</div>
)
......@@ -222,7 +224,10 @@ const handleSearch = (params: Record<string, any>) => {
}
// 清空搜索条件
const handleClear = () => {
const handleClear = (flge: boolean | null) => {
if (flge) {
searchParams.value = {}
}
categoryNameOrDictName.value = ''
pagination.value.page = 1
getData()
......
......@@ -161,7 +161,9 @@ onMounted(() => {
GetDictCateItem()
})
const emit = defineEmits(['success'])
const emit = defineEmits<{
success: []
}>()
defineExpose({
open,
......
......@@ -104,7 +104,9 @@ const handleConfirm = () => {
})
}
const emit = defineEmits(['success'])
const emit = defineEmits<{
success: []
}>()
defineExpose({
open,
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-11 09:38:40
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-10 17:52:38
* @LastEditTime: 2024-12-11 11:08:50
* @Description: 菜单管理
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -23,7 +23,7 @@
:show-tree="true"
@search-change="handleSearch"
@page-change="handlePage"
@clear="handleClear"
@clear="handleClear(true)"
table-maxheight="550px"
class="max-h-[calc(100%-50px)]"
>
......@@ -32,7 +32,7 @@
:loading="loading"
placeholder="搜索菜单名称"
v-model="condMenuName"
@clear="handleClear"
@clear="handleClear(null)"
@on-search="handleSearch(searchParams)"
/></template>
<template #header-right>
......@@ -159,9 +159,11 @@ const columns: PrimaryTableCol[] = [
cell: (h, { row }) => {
return (
<div class='flex items-center justify-between'>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}>
<span class={row.inputUserDelFlag ? 'text-[var(--td-font-gray-3)]' : ''}>{row.inputUserName || '-'}</span>
</div>
<t-tooltip content={row.inputUserName}>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}>
<span>{row.inputUserName || '-'}</span>
</div>
</t-tooltip>
{row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''}
</div>
)
......@@ -188,7 +190,10 @@ const handleSearch = (params: Record<string, any>) => {
}
// 清空搜索条件
const handleClear = () => {
const handleClear = (flge: boolean | null) => {
if (flge) {
searchParams.value = {}
}
condMenuName.value = ''
pagination.value.page = 1
getData()
......
......@@ -183,6 +183,7 @@ const changeMenuLevel = () => {
} else {
formData.isButton = 0
}
formData.parentId = ''
getLevelMenu()
}
......@@ -206,7 +207,9 @@ const handleConfirm = () => {
})
}
const emit = defineEmits(['success'])
const emit = defineEmits<{
success: []
}>()
defineExpose({
open,
......
......@@ -153,9 +153,11 @@ const columns: PrimaryTableCol[] = [
cell: (h, { row }) => {
return (
<div class='flex items-center justify-between'>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis ' : ''}>
<span>{row.inputUserName || '-'}</span>
</div>
<t-tooltip content={row.inputUserName}>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}>
<span>{row.inputUserName || '-'}</span>
</div>
</t-tooltip>
{row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''}
</div>
)
......
......@@ -12,7 +12,7 @@
<InfoLable class="mb-[20px]" label="当前终端" :value="props.tabType == 1 ? '平台端' : '机构端'" />
<t-form ref="formRef" label-align="top" class="form pt-[20px]" :rules="rules" :data="formData">
<t-form-item label="版本号" name="version">
<t-input maxlength="20" v-model="formData.version" placeholder="请输入版本姓名"> </t-input>
<t-input maxlength="20" v-model="formData.version" placeholder="请输入版本"> </t-input>
</t-form-item>
<t-form-item label="更新说明" name="description">
<WangEditor
......@@ -129,7 +129,9 @@ const handleConfirm = () => {
})
}
const emit = defineEmits(['success'])
const emit = defineEmits<{
(e: 'success'): void
}>()
defineExpose({
open,
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-11 09:38:40
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-09 17:44:49
* @LastEditTime: 2024-12-11 10:17:44
* @Description: 权限配置
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -69,25 +69,6 @@
v-if="tabValue === 2"
/>
</div>
<!-- 添加角色 -->
<!-- <Dialog :dialog-visible="dialogVisible" width="480px" title="添加角色" :footer="true" @close="close">
<template #body>
<t-form ref="formRef" label-align="top" :rules="rules" :data="formData">
<t-form-item label="角色名称" name="roleName">
<t-input maxlength="20" v-model="formData.roleName" placeholder="请输入内容"> </t-input>
</t-form-item>
<t-form-item label="角色描述" name="description">
<t-textarea maxlength="200" v-model="formData.description" placeholder="请输入内容"> </t-textarea>
</t-form-item> </t-form
></template>
<template #footer>
<div class="flex items-center justify-center">
<t-button shape="round" variant="outline" @click="close">取消</t-button>
<t-button shape="round" @click="handleConfirm" :loading="submitLoading">保存</t-button>
</div>
</template>
</Dialog> -->
<FooterFixBtn>
<template #button>
<t-button shape="round" variant="outline" class="mr-[16px]" @click="handleClear">{{
......@@ -142,43 +123,6 @@ const handleSearch = () => {
})
}
// 添加角色
// const dialogVisible = ref(false)
// const submitLoading = ref(false)
// const formRef = useTemplateRef<FormInstanceFunctions>('formRef')
// const formData: FormProps<ReqRole>['data'] = reactive({
// description: '',
// roleName: ''
// })
// const rules: FormProps['rules'] = {
// roleName: [
// {
// required: true,
// message: '请填写角色名称!',
// trigger: 'blur'
// }
// ]
// }
// const close = () => {
// formRef.value?.reset()
// dialogVisible.value = false
// }
// const handleConfirm = () => {
// submitLoading.value = true
// postRoleAddUpd(formData)
// .then(() => {
// close()
// handleSearch()
// })
// .finally(() => {
// submitLoading.value = false
// })
// }
// 右边相关
const tabValue = ref(1)
const condMenuName = ref('')
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-12-05 17:16:22
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-09 10:15:38
* @LastEditTime: 2024-12-11 10:19:13
* @Description: 功能权限
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -142,7 +142,9 @@ const submit = () => {
})
}
const emit = defineEmits(['loading'])
const emit = defineEmits<{
loading: [value: boolean]
}>()
defineExpose({
submit,
......
......@@ -251,7 +251,10 @@ onMounted(() => {
getData()
})
const emit = defineEmits(['loading', 'updateMenuId'])
const emit = defineEmits<{
loading: [value: boolean]
updateMenuId: [menuId: string]
}>()
defineExpose({
getData,
submit,
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-28 15:01:02
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-10 17:52:13
* @LastEditTime: 2024-12-11 11:09:59
* @Description: 角色管理
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -15,7 +15,7 @@
:loading="loading"
:pagination="pagination"
@search-change="handleSearch"
@clear="handleClear"
@clear="handleClear(true)"
@page-change="handlePage"
>
<template #header-left>
......@@ -23,7 +23,7 @@
:loading="loading"
placeholder="搜索角色名称"
v-model="roleName"
@clear="handleClear"
@clear="handleClear(null)"
@on-search="handleSearch(searchParams)"
/></template>
<template #header-right>
......@@ -132,9 +132,11 @@ const columns: PrimaryTableCol[] = [
cell: (h, { row }) => {
return (
<div class='flex items-center justify-between'>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}>
<span class={row.inputUserDelFlag ? 'text-[var(--td-font-gray-3)]' : ''}>{row.inputUserName || '-'}</span>
</div>
<t-tooltip content={row.inputUserName}>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}>
<span>{row.inputUserName || '-'}</span>
</div>
</t-tooltip>
{row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''}
</div>
)
......@@ -156,7 +158,10 @@ const handleSearch = (params: Record<string, any>) => {
}
// 清空搜索条件
const handleClear = () => {
const handleClear = (flge: boolean | null) => {
if (flge) {
searchParams.value = {}
}
roleName.value = ''
pagination.value.page = 1
getData()
......
......@@ -89,7 +89,9 @@ const handleConfirm = () => {
})
}
const emit = defineEmits(['success'])
const emit = defineEmits<{
success: []
}>()
defineExpose({
open,
......
......@@ -24,14 +24,17 @@
:columns="columns"
:loading="loading"
@page-change="onPageChange"
row-key="ids"
:rowspan-and-colspan="rowspanAndColspan"
max-height="400px"
row-key="ids"
:pagination="pagination.total > 10 ? pagination : undefined"
>
<template v-for="col in columns" #[soltName(col)]="{ row }" :key="col.colKey">
<template v-if="col.colKey == 'dataPermission'">
<div class="cell-content">{{ dataPermissions(row) || '-' }}</div>
<div class="cell-content">
<p>地区:{{ dataPermissions(row).areaPermissionsTxt }}</p>
<p>角色:{{ dataPermissions(row).rolePermissionsTxt }}</p>
</div>
</template>
<template v-else-if="col.colKey == 'functionPermission'">
<div class="cell-content">{{ functionPermission(row) || '-' }}</div>
......@@ -94,32 +97,16 @@ const getData = () => {
},
index: number
) => {
const lists = e.menuPermission.map((em, i: number) => {
return { ...e, ...em, ids: `${index}-${i}`, rowspan: !i ? e.menuPermission.length : 0, serial: index + 1 }
})
let lists = []
if (e.menuPermission.length) {
lists = e.menuPermission.map((em, i: number) => {
return { ...e, ...em, ids: `${index}-${i}`, rowspan: !i ? e.menuPermission.length : 0, serial: index + 1 }
})
} else {
lists = [{ ...e, serial: index + 1, ids: `${index}-1` }]
}
return [...lists]
// 匹配对应格式
// let functionPermission: string[] = []
// let dataPermission: string[] = []
// e.menuPermission.map(
// (em: {
// menuName: string
// buttonNames: string[]
// areaPermissions: { name: string }[]
// rolePermissions: { name: string }[]
// }) => {
// const buttonNames = em.buttonNames || []
// const areaPermissions = em.areaPermissions || []
// const rolePermissions = em.rolePermissions || []
// functionPermission.push(em.menuName + buttonNames.join(','))
// dataPermission.push(
// areaPermissions.map((val: { name: string }) => val.name).join(',') +
// '-' +
// rolePermissions.map((val: { name: string }) => val.name).join(',')
// )
// }
// )
// return { ...e, functionPermission: functionPermission.join(';'), dataPermission: dataPermission.join(';') }
}
)
tableData.value = tableDatas.flat()
......@@ -132,16 +119,15 @@ const getData = () => {
const dataPermissions = (row: ResUserList) => {
const areaPermissions = row.areaPermissions || []
const rolePermissions = row.rolePermissions || []
const txt =
areaPermissions.map((val: { name: string }) => val.name).join(',') +
(rolePermissions.length ? '(' + rolePermissions.map((val: { name: string }) => val.name).join(',') + ')' : '')
const areaPermissionsTxt = areaPermissions.map((val: { name: string }) => val.name).join(',') || '-'
const rolePermissionsTxt = rolePermissions.map((val: { name: string }) => val.name).join(',') || '-'
return txt
return { areaPermissionsTxt, rolePermissionsTxt }
}
const functionPermission = (row: ResUserList) => {
const buttonNames = row.buttonNames || []
return row.menuName + (buttonNames.length ? '(' + buttonNames.join(',') + ')' : '')
return row.menuName || '-' + (buttonNames.length ? '(' + buttonNames.join(',') + ')' : '')
}
// 合并单元格
......
......@@ -2,7 +2,7 @@
* @Author: xiejiang
* @Date: 2024-11-28 15:01:02
* @LastEditors: xiejiang
* @LastEditTime: 2024-12-11 09:35:43
* @LastEditTime: 2024-12-11 11:10:10
* @Description: 用户管理
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
-->
......@@ -15,7 +15,7 @@
:loading="loading"
:pagination="pagination"
@search-change="handleSearch"
@clear="handleClear"
@clear="handleClear(true)"
@page-change="handlePage"
>
<template #header-left>
......@@ -23,7 +23,7 @@
:loading="loading"
placeholder="用户姓名/手机号码"
v-model="mobileOrName"
@clear="handleClear"
@clear="handleClear(null)"
@on-search="handleSearch(searchParams)"
/></template>
<template #header-right>
......@@ -153,9 +153,11 @@ const columns: PrimaryTableCol[] = [
cell: (h, { row }) => {
return (
<div class='flex items-center justify-between'>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}>
<span>{row.inputUserName || '-'}</span>
</div>
<t-tooltip content={row.inputUserName}>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}>
<span>{row.inputUserName || '-'}</span>
</div>
</t-tooltip>
{row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''}
</div>
)
......@@ -193,7 +195,10 @@ const handleSearch = (params: Record<string, any>) => {
}
// 清空搜索条件
const handleClear = () => {
const handleClear = (flge: boolean | null) => {
if (flge) {
searchParams.value = {}
}
mobileOrName.value = ''
pagination.value.page = 1
getData()
......
......@@ -141,7 +141,9 @@ const handleConfirm = () => {
})
}
const emit = defineEmits(['success'])
const emit = defineEmits<{
success: []
}>()
// onMounted(() => {
// getRoleListData()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论