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

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

上级 6102a44c
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: xiejiang * @Author: xiejiang
* @Date: 2024-11-27 15:14:31 * @Date: 2024-11-27 15:14:31
* @LastEditors: xiejiang * @LastEditors: xiejiang
* @LastEditTime: 2024-12-05 17:29:47 * @LastEditTime: 2024-12-11 10:59:29
* @Description: 弹窗 * @Description: 弹窗
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved. * Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
--> -->
...@@ -55,7 +55,11 @@ watch( ...@@ -55,7 +55,11 @@ watch(
}, },
{ immediate: true } { 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 = () => { const closeDialog = () => {
emit('update:dialogVisible', false) emit('update:dialogVisible', false)
emit('close') emit('close')
......
...@@ -51,7 +51,12 @@ const props = withDefaults(defineProps<DrawerProps>(), { ...@@ -51,7 +51,12 @@ const props = withDefaults(defineProps<DrawerProps>(), {
confirmBtnText: '确定' confirmBtnText: '确定'
}) })
const visible = ref(props.drawerVisible) 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 = () => { const closeDrawer = () => {
emit('update:drawerVisible', false) emit('update:drawerVisible', false)
emit('close') emit('close')
......
...@@ -14,9 +14,9 @@ watch( ...@@ -14,9 +14,9 @@ watch(
isCollapse, isCollapse,
(val: boolean) => { (val: boolean) => {
if (!val) { if (!val) {
width.value = window.innerWidth - 232 + 'px' width.value = window.innerWidth - 208 + 'px'
} else { } else {
width.value = window.innerWidth - 64 + 'px' width.value = window.innerWidth - 50 + 'px'
} }
}, },
{ immediate: true } { immediate: true }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: xiejiang * @Author: xiejiang
* @Date: 2024-11-06 09:53:55 * @Date: 2024-11-06 09:53:55
* @LastEditors: xiejiang * @LastEditors: xiejiang
* @LastEditTime: 2024-11-26 11:54:06 * @LastEditTime: 2024-12-11 10:58:57
* @Description: 图片预览 * @Description: 图片预览
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved. * Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
--> -->
...@@ -42,7 +42,11 @@ const props = withDefaults(defineProps<imageVierwer>(), { ...@@ -42,7 +42,11 @@ const props = withDefaults(defineProps<imageVierwer>(), {
isDel: false isDel: false
}) })
const emit = defineEmits(['close', 'onDel']) const emit = defineEmits<{
(e: 'close'): void
(e: 'onDel'): void
}>()
const handleDel = () => { const handleDel = () => {
emit('onDel') emit('onDel')
} }
......
...@@ -2,24 +2,24 @@ ...@@ -2,24 +2,24 @@
* @Author: xiejiang * @Author: xiejiang
* @Date: 2024-11-28 09:24:26 * @Date: 2024-11-28 09:24:26
* @LastEditors: xiejiang * @LastEditors: xiejiang
* @LastEditTime: 2024-12-08 15:47:14 * @LastEditTime: 2024-12-11 10:23:44
* @Description: table操作按钮 * @Description: table操作按钮
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved. * Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
--> -->
<template> <template>
<t-tooltip :content="props.content"> <!-- <t-tooltip :content="props.content"> -->
<t-button <t-button
class="operate-btn" class="operate-btn"
variant="text" variant="text"
@click="handleClick" @click="handleClick"
:disabled="props.disabled" :disabled="props.disabled"
:loading="props.loading" :loading="props.loading"
v-bind="$attrs" v-bind="$attrs"
> >
<template #icon> <slot></slot></template> <template #icon> <slot></slot></template>
{{ props.content }} {{ props.content }}
</t-button> </t-button>
</t-tooltip> <!-- </t-tooltip> -->
</template> </template>
<script lang="ts" setup name="OperateButton"> <script lang="ts" setup name="OperateButton">
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: xiejiang * @Author: xiejiang
* @Date: 2024-11-07 11:19:31 * @Date: 2024-11-07 11:19:31
* @LastEditors: xiejiang * @LastEditors: xiejiang
* @LastEditTime: 2024-12-10 14:16:57 * @LastEditTime: 2024-12-11 11:15:52
* @Description: 表格页面容器组件 * @Description: 表格页面容器组件
--> -->
<template> <template>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: xiejiang * @Author: xiejiang
* @Date: 2023-07-13 10:27:58 * @Date: 2023-07-13 10:27:58
* @LastEditors: xiejiang * @LastEditors: xiejiang
* @LastEditTime: 2024-12-09 17:36:28 * @LastEditTime: 2024-12-11 11:06:17
* @Description: 搜索组件 * @Description: 搜索组件
--> -->
<template> <template>
...@@ -24,7 +24,11 @@ ...@@ -24,7 +24,11 @@
</template> </template>
<script setup name="SearchWithButton" lang="ts"> <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({ const props = defineProps({
modelValue: { modelValue: {
type: String, type: String,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: xiejiang * @Author: xiejiang
* @Date: 2024-11-06 09:53:55 * @Date: 2024-11-06 09:53:55
* @LastEditors: xiejiang * @LastEditors: xiejiang
* @LastEditTime: 2024-11-28 16:44:29 * @LastEditTime: 2024-12-11 11:06:46
* @Description: 系统提示确认 * @Description: 系统提示确认
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved. * Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
--> -->
...@@ -51,7 +51,10 @@ const loading = ref(false) ...@@ -51,7 +51,10 @@ const loading = ref(false)
const visible = ref(props.dialogVisible) const visible = ref(props.dialogVisible)
const emit = defineEmits(['close', 'confirm']) const emit = defineEmits<{
close: []
confirm: []
}>()
const handleConfirm = () => { const handleConfirm = () => {
emit('confirm') emit('confirm')
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: xiejiang * @Author: xiejiang
* @Date: 2024-12-10 15:36:04 * @Date: 2024-12-10 15:36:04
* @LastEditors: xiejiang * @LastEditors: xiejiang
* @LastEditTime: 2024-12-11 09:18:42 * @LastEditTime: 2024-12-11 09:59:56
* @Description: 更新版本弹窗 * @Description: 更新版本弹窗
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved. * Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
--> -->
...@@ -50,8 +50,6 @@ const visible = ref(false) ...@@ -50,8 +50,6 @@ const visible = ref(false)
watch( watch(
() => props.dialogVisible, () => props.dialogVisible,
val => { val => {
console.log(val)
visible.value = val visible.value = val
}, },
{ immediate: true } { 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(() => { ...@@ -96,7 +96,9 @@ const self_disabled = computed(() => {
if (self_disabled.value) nextTick(() => editorRef.value.disable()) if (self_disabled.value) nextTick(() => editorRef.value.disable())
// 富文本的内容监听,触发父组件改变,实现双向数据绑定 // 富文本的内容监听,触发父组件改变,实现双向数据绑定
const emit = defineEmits(['update:value']) const emit = defineEmits<{
'update:value': [value: string]
}>()
const valueHtml = computed({ const valueHtml = computed({
get() { get() {
return props.value return props.value
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
.main { .main {
box-sizing: border-box; box-sizing: border-box;
margin: 12px; margin: 0 12px 12px;
max-height: calc(100% - 52px); max-height: calc(100% - 52px);
max-width: calc(100% - 24px); max-width: calc(100% - 24px);
overflow: auto; overflow: auto;
......
...@@ -53,6 +53,10 @@ ...@@ -53,6 +53,10 @@
background: var(--td-gray-color-1); background: var(--td-gray-color-1);
} }
p {
margin: 8px 0;
}
// 表格 // 表格
.t-table { .t-table {
thead th { thead th {
...@@ -79,7 +83,7 @@ ...@@ -79,7 +83,7 @@
td { td {
border: none; border: none;
font-size: 13px; font-size: 13px;
padding: 8px; padding: 10px 16px;
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: xiejiang * @Author: xiejiang
* @Date: 2024-11-28 15:01:02 * @Date: 2024-11-28 15:01:02
* @LastEditors: xiejiang * @LastEditors: xiejiang
* @LastEditTime: 2024-12-11 09:45:58 * @LastEditTime: 2024-12-11 11:09:12
* @Description: 机构管理 * @Description: 机构管理
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved. * Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
--> -->
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
:loading="loading" :loading="loading"
:pagination="pagination" :pagination="pagination"
@search-change="handleSearch" @search-change="handleSearch"
@clear="handleClear" @clear="handleClear(true)"
@page-change="handlePage" @page-change="handlePage"
> >
<template #header-left> <template #header-left>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
:loading="loading" :loading="loading"
placeholder="机构名称" placeholder="机构名称"
v-model="companyName" v-model="companyName"
@clear="handleClear" @clear="handleClear(null)"
@on-search="handleSearch(searchParams)" @on-search="handleSearch(searchParams)"
/></template> /></template>
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
<script setup lang="tsx" name="institution"> <script setup lang="tsx" name="institution">
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import dayjs from 'dayjs'
import { PrimaryTableCol, MessagePlugin } from 'tdesign-vue-next' import { PrimaryTableCol, MessagePlugin } from 'tdesign-vue-next'
import type { filterItemProp } from '@/components/PageFilters/interface/index' import type { filterItemProp } from '@/components/PageFilters/interface/index'
import type { Pagination } from '@/components/PageContainer/interface/index' import type { Pagination } from '@/components/PageContainer/interface/index'
...@@ -142,11 +143,13 @@ const columns: PrimaryTableCol[] = [ ...@@ -142,11 +143,13 @@ const columns: PrimaryTableCol[] = [
ellipsis: true, ellipsis: true,
cell: (h, { row }) => { cell: (h, { row }) => {
return ( return (
<div class='flex items-center'> <t-tooltip content={`${row.adminUserName}(${row.adminUserMobile})`}>
<span> <div class='ellipsis'>
{row.adminUserName}({row.adminUserMobile}) <span>
</span> {row.adminUserName}({row.adminUserMobile})
</div> </span>
</div>
</t-tooltip>
) )
} }
}, },
...@@ -155,9 +158,17 @@ const columns: PrimaryTableCol[] = [ ...@@ -155,9 +158,17 @@ const columns: PrimaryTableCol[] = [
colKey: 'serviceTerminationTime', colKey: 'serviceTerminationTime',
cell: (h, { row }) => { cell: (h, { row }) => {
return ( return (
<div class={row.serviceStatus == 2 ? 'ellipsis text-[var(--td-error-color-11)]' : 'ellipsis'}> <t-tooltip content={row.serviceTerminationTime}>
{row.serviceTerminationTime} <div
</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[] = [ ...@@ -193,9 +204,11 @@ const columns: PrimaryTableCol[] = [
cell: (h, { row }) => { cell: (h, { row }) => {
return ( return (
<div class='flex items-center justify-between'> <div class='flex items-center justify-between'>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}> <t-tooltip content={row.inputUserName}>
<span class={row.inputUserDelFlag ? 'text-[var(--td-font-gray-3)]' : ''}>{row.inputUserName || '-'}</span> <div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}>
</div> <span>{row.inputUserName || '-'}</span>
</div>
</t-tooltip>
{row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''} {row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''}
</div> </div>
) )
...@@ -233,7 +246,10 @@ const handleSearch = (params: Record<string, any>) => { ...@@ -233,7 +246,10 @@ const handleSearch = (params: Record<string, any>) => {
getData() getData()
} }
const handleClear = () => { const handleClear = (flge: boolean | null) => {
if (flge) {
searchParams.value = {}
}
companyName.value = '' companyName.value = ''
pagination.value.page = 1 pagination.value.page = 1
getData() getData()
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: xiejiang * @Author: xiejiang
* @Date: 2024-11-11 09:38:40 * @Date: 2024-11-11 09:38:40
* @LastEditors: xiejiang * @LastEditors: xiejiang
* @LastEditTime: 2024-12-10 16:03:16 * @LastEditTime: 2024-12-11 11:31:32
* @Description: 系统字典-管理子集 * @Description: 系统字典-管理子集
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved. * Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
--> -->
...@@ -256,6 +256,8 @@ onMounted(() => { ...@@ -256,6 +256,8 @@ onMounted(() => {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import './comm.less';
.table-add { .table-add {
width: 100%; width: 100%;
padding: 13px; padding: 13px;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: xiejiang * @Author: xiejiang
* @Date: 2024-11-11 09:38:40 * @Date: 2024-11-11 09:38:40
* @LastEditors: xiejiang * @LastEditors: xiejiang
* @LastEditTime: 2024-12-11 09:34:26 * @LastEditTime: 2024-12-11 11:28:55
* @Description: 系统字典 * @Description: 系统字典
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved. * Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
--> -->
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
:loading="loading" :loading="loading"
:pagination="pagination" :pagination="pagination"
@search-change="handleSearch" @search-change="handleSearch"
@clear="handleClear" @clear="handleClear(true)"
@page-change="handlePage" @page-change="handlePage"
> >
<template #header-left> <template #header-left>
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
placeholder="搜索字典大类,字典名称" placeholder="搜索字典大类,字典名称"
v-model="categoryNameOrDictName" v-model="categoryNameOrDictName"
@on-search="handleSearch(searchParams)" @on-search="handleSearch(searchParams)"
@clear="handleClear" @clear="handleClear(null)"
/></template> /></template>
<template #header-right> <template #header-right>
...@@ -163,9 +163,11 @@ const columns: PrimaryTableCol[] = [ ...@@ -163,9 +163,11 @@ const columns: PrimaryTableCol[] = [
cell: (h, { row }) => { cell: (h, { row }) => {
return ( return (
<div class='flex items-center justify-between'> <div class='flex items-center justify-between'>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}> <t-tooltip content={row.inputUserName}>
<span class={row.inputUserDelFlag ? 'text-[var(--td-font-gray-3)]' : ''}>{row.inputUserName || '-'}</span> <div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}>
</div> <span>{row.inputUserName || '-'}</span>
</div>
</t-tooltip>
{row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''} {row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''}
</div> </div>
) )
...@@ -222,7 +224,10 @@ const handleSearch = (params: Record<string, any>) => { ...@@ -222,7 +224,10 @@ const handleSearch = (params: Record<string, any>) => {
} }
// 清空搜索条件 // 清空搜索条件
const handleClear = () => { const handleClear = (flge: boolean | null) => {
if (flge) {
searchParams.value = {}
}
categoryNameOrDictName.value = '' categoryNameOrDictName.value = ''
pagination.value.page = 1 pagination.value.page = 1
getData() getData()
......
...@@ -161,7 +161,9 @@ onMounted(() => { ...@@ -161,7 +161,9 @@ onMounted(() => {
GetDictCateItem() GetDictCateItem()
}) })
const emit = defineEmits(['success']) const emit = defineEmits<{
success: []
}>()
defineExpose({ defineExpose({
open, open,
......
...@@ -104,7 +104,9 @@ const handleConfirm = () => { ...@@ -104,7 +104,9 @@ const handleConfirm = () => {
}) })
} }
const emit = defineEmits(['success']) const emit = defineEmits<{
success: []
}>()
defineExpose({ defineExpose({
open, open,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: xiejiang * @Author: xiejiang
* @Date: 2024-11-11 09:38:40 * @Date: 2024-11-11 09:38:40
* @LastEditors: xiejiang * @LastEditors: xiejiang
* @LastEditTime: 2024-12-10 17:52:38 * @LastEditTime: 2024-12-11 11:08:50
* @Description: 菜单管理 * @Description: 菜单管理
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved. * Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
--> -->
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
:show-tree="true" :show-tree="true"
@search-change="handleSearch" @search-change="handleSearch"
@page-change="handlePage" @page-change="handlePage"
@clear="handleClear" @clear="handleClear(true)"
table-maxheight="550px" table-maxheight="550px"
class="max-h-[calc(100%-50px)]" class="max-h-[calc(100%-50px)]"
> >
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
:loading="loading" :loading="loading"
placeholder="搜索菜单名称" placeholder="搜索菜单名称"
v-model="condMenuName" v-model="condMenuName"
@clear="handleClear" @clear="handleClear(null)"
@on-search="handleSearch(searchParams)" @on-search="handleSearch(searchParams)"
/></template> /></template>
<template #header-right> <template #header-right>
...@@ -159,9 +159,11 @@ const columns: PrimaryTableCol[] = [ ...@@ -159,9 +159,11 @@ const columns: PrimaryTableCol[] = [
cell: (h, { row }) => { cell: (h, { row }) => {
return ( return (
<div class='flex items-center justify-between'> <div class='flex items-center justify-between'>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}> <t-tooltip content={row.inputUserName}>
<span class={row.inputUserDelFlag ? 'text-[var(--td-font-gray-3)]' : ''}>{row.inputUserName || '-'}</span> <div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}>
</div> <span>{row.inputUserName || '-'}</span>
</div>
</t-tooltip>
{row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''} {row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''}
</div> </div>
) )
...@@ -188,7 +190,10 @@ const handleSearch = (params: Record<string, any>) => { ...@@ -188,7 +190,10 @@ const handleSearch = (params: Record<string, any>) => {
} }
// 清空搜索条件 // 清空搜索条件
const handleClear = () => { const handleClear = (flge: boolean | null) => {
if (flge) {
searchParams.value = {}
}
condMenuName.value = '' condMenuName.value = ''
pagination.value.page = 1 pagination.value.page = 1
getData() getData()
......
...@@ -183,6 +183,7 @@ const changeMenuLevel = () => { ...@@ -183,6 +183,7 @@ const changeMenuLevel = () => {
} else { } else {
formData.isButton = 0 formData.isButton = 0
} }
formData.parentId = ''
getLevelMenu() getLevelMenu()
} }
...@@ -206,7 +207,9 @@ const handleConfirm = () => { ...@@ -206,7 +207,9 @@ const handleConfirm = () => {
}) })
} }
const emit = defineEmits(['success']) const emit = defineEmits<{
success: []
}>()
defineExpose({ defineExpose({
open, open,
......
...@@ -153,9 +153,11 @@ const columns: PrimaryTableCol[] = [ ...@@ -153,9 +153,11 @@ const columns: PrimaryTableCol[] = [
cell: (h, { row }) => { cell: (h, { row }) => {
return ( return (
<div class='flex items-center justify-between'> <div class='flex items-center justify-between'>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis ' : ''}> <t-tooltip content={row.inputUserName}>
<span>{row.inputUserName || '-'}</span> <div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}>
</div> <span>{row.inputUserName || '-'}</span>
</div>
</t-tooltip>
{row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''} {row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''}
</div> </div>
) )
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<InfoLable class="mb-[20px]" label="当前终端" :value="props.tabType == 1 ? '平台端' : '机构端'" /> <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 ref="formRef" label-align="top" class="form pt-[20px]" :rules="rules" :data="formData">
<t-form-item label="版本号" name="version"> <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>
<t-form-item label="更新说明" name="description"> <t-form-item label="更新说明" name="description">
<WangEditor <WangEditor
...@@ -129,7 +129,9 @@ const handleConfirm = () => { ...@@ -129,7 +129,9 @@ const handleConfirm = () => {
}) })
} }
const emit = defineEmits(['success']) const emit = defineEmits<{
(e: 'success'): void
}>()
defineExpose({ defineExpose({
open, open,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: xiejiang * @Author: xiejiang
* @Date: 2024-11-11 09:38:40 * @Date: 2024-11-11 09:38:40
* @LastEditors: xiejiang * @LastEditors: xiejiang
* @LastEditTime: 2024-12-09 17:44:49 * @LastEditTime: 2024-12-11 10:17:44
* @Description: 权限配置 * @Description: 权限配置
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved. * Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
--> -->
...@@ -69,25 +69,6 @@ ...@@ -69,25 +69,6 @@
v-if="tabValue === 2" v-if="tabValue === 2"
/> />
</div> </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> <FooterFixBtn>
<template #button> <template #button>
<t-button shape="round" variant="outline" class="mr-[16px]" @click="handleClear">{{ <t-button shape="round" variant="outline" class="mr-[16px]" @click="handleClear">{{
...@@ -142,43 +123,6 @@ const handleSearch = () => { ...@@ -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 tabValue = ref(1)
const condMenuName = ref('') const condMenuName = ref('')
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: xiejiang * @Author: xiejiang
* @Date: 2024-12-05 17:16:22 * @Date: 2024-12-05 17:16:22
* @LastEditors: xiejiang * @LastEditors: xiejiang
* @LastEditTime: 2024-12-09 10:15:38 * @LastEditTime: 2024-12-11 10:19:13
* @Description: 功能权限 * @Description: 功能权限
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved. * Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
--> -->
...@@ -142,7 +142,9 @@ const submit = () => { ...@@ -142,7 +142,9 @@ const submit = () => {
}) })
} }
const emit = defineEmits(['loading']) const emit = defineEmits<{
loading: [value: boolean]
}>()
defineExpose({ defineExpose({
submit, submit,
......
...@@ -251,7 +251,10 @@ onMounted(() => { ...@@ -251,7 +251,10 @@ onMounted(() => {
getData() getData()
}) })
const emit = defineEmits(['loading', 'updateMenuId']) const emit = defineEmits<{
loading: [value: boolean]
updateMenuId: [menuId: string]
}>()
defineExpose({ defineExpose({
getData, getData,
submit, submit,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: xiejiang * @Author: xiejiang
* @Date: 2024-11-28 15:01:02 * @Date: 2024-11-28 15:01:02
* @LastEditors: xiejiang * @LastEditors: xiejiang
* @LastEditTime: 2024-12-10 17:52:13 * @LastEditTime: 2024-12-11 11:09:59
* @Description: 角色管理 * @Description: 角色管理
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved. * Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
--> -->
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
:loading="loading" :loading="loading"
:pagination="pagination" :pagination="pagination"
@search-change="handleSearch" @search-change="handleSearch"
@clear="handleClear" @clear="handleClear(true)"
@page-change="handlePage" @page-change="handlePage"
> >
<template #header-left> <template #header-left>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
:loading="loading" :loading="loading"
placeholder="搜索角色名称" placeholder="搜索角色名称"
v-model="roleName" v-model="roleName"
@clear="handleClear" @clear="handleClear(null)"
@on-search="handleSearch(searchParams)" @on-search="handleSearch(searchParams)"
/></template> /></template>
<template #header-right> <template #header-right>
...@@ -132,9 +132,11 @@ const columns: PrimaryTableCol[] = [ ...@@ -132,9 +132,11 @@ const columns: PrimaryTableCol[] = [
cell: (h, { row }) => { cell: (h, { row }) => {
return ( return (
<div class='flex items-center justify-between'> <div class='flex items-center justify-between'>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}> <t-tooltip content={row.inputUserName}>
<span class={row.inputUserDelFlag ? 'text-[var(--td-font-gray-3)]' : ''}>{row.inputUserName || '-'}</span> <div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}>
</div> <span>{row.inputUserName || '-'}</span>
</div>
</t-tooltip>
{row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''} {row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''}
</div> </div>
) )
...@@ -156,7 +158,10 @@ const handleSearch = (params: Record<string, any>) => { ...@@ -156,7 +158,10 @@ const handleSearch = (params: Record<string, any>) => {
} }
// 清空搜索条件 // 清空搜索条件
const handleClear = () => { const handleClear = (flge: boolean | null) => {
if (flge) {
searchParams.value = {}
}
roleName.value = '' roleName.value = ''
pagination.value.page = 1 pagination.value.page = 1
getData() getData()
......
...@@ -89,7 +89,9 @@ const handleConfirm = () => { ...@@ -89,7 +89,9 @@ const handleConfirm = () => {
}) })
} }
const emit = defineEmits(['success']) const emit = defineEmits<{
success: []
}>()
defineExpose({ defineExpose({
open, open,
......
...@@ -24,14 +24,17 @@ ...@@ -24,14 +24,17 @@
:columns="columns" :columns="columns"
:loading="loading" :loading="loading"
@page-change="onPageChange" @page-change="onPageChange"
row-key="ids"
:rowspan-and-colspan="rowspanAndColspan" :rowspan-and-colspan="rowspanAndColspan"
max-height="400px" max-height="400px"
row-key="ids"
:pagination="pagination.total > 10 ? pagination : undefined" :pagination="pagination.total > 10 ? pagination : undefined"
> >
<template v-for="col in columns" #[soltName(col)]="{ row }" :key="col.colKey"> <template v-for="col in columns" #[soltName(col)]="{ row }" :key="col.colKey">
<template v-if="col.colKey == 'dataPermission'"> <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>
<template v-else-if="col.colKey == 'functionPermission'"> <template v-else-if="col.colKey == 'functionPermission'">
<div class="cell-content">{{ functionPermission(row) || '-' }}</div> <div class="cell-content">{{ functionPermission(row) || '-' }}</div>
...@@ -94,32 +97,16 @@ const getData = () => { ...@@ -94,32 +97,16 @@ const getData = () => {
}, },
index: number index: number
) => { ) => {
const lists = e.menuPermission.map((em, i: number) => { let lists = []
return { ...e, ...em, ids: `${index}-${i}`, rowspan: !i ? e.menuPermission.length : 0, serial: index + 1 } 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] 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() tableData.value = tableDatas.flat()
...@@ -132,16 +119,15 @@ const getData = () => { ...@@ -132,16 +119,15 @@ const getData = () => {
const dataPermissions = (row: ResUserList) => { const dataPermissions = (row: ResUserList) => {
const areaPermissions = row.areaPermissions || [] const areaPermissions = row.areaPermissions || []
const rolePermissions = row.rolePermissions || [] const rolePermissions = row.rolePermissions || []
const txt = const areaPermissionsTxt = areaPermissions.map((val: { name: string }) => val.name).join(',') || '-'
areaPermissions.map((val: { name: string }) => val.name).join(',') + const rolePermissionsTxt = rolePermissions.map((val: { name: string }) => val.name).join(',') || '-'
(rolePermissions.length ? '(' + rolePermissions.map((val: { name: string }) => val.name).join(',') + ')' : '')
return txt return { areaPermissionsTxt, rolePermissionsTxt }
} }
const functionPermission = (row: ResUserList) => { const functionPermission = (row: ResUserList) => {
const buttonNames = row.buttonNames || [] const buttonNames = row.buttonNames || []
return row.menuName + (buttonNames.length ? '(' + buttonNames.join(',') + ')' : '') return row.menuName || '-' + (buttonNames.length ? '(' + buttonNames.join(',') + ')' : '')
} }
// 合并单元格 // 合并单元格
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: xiejiang * @Author: xiejiang
* @Date: 2024-11-28 15:01:02 * @Date: 2024-11-28 15:01:02
* @LastEditors: xiejiang * @LastEditors: xiejiang
* @LastEditTime: 2024-12-11 09:35:43 * @LastEditTime: 2024-12-11 11:10:10
* @Description: 用户管理 * @Description: 用户管理
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved. * Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
--> -->
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
:loading="loading" :loading="loading"
:pagination="pagination" :pagination="pagination"
@search-change="handleSearch" @search-change="handleSearch"
@clear="handleClear" @clear="handleClear(true)"
@page-change="handlePage" @page-change="handlePage"
> >
<template #header-left> <template #header-left>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
:loading="loading" :loading="loading"
placeholder="用户姓名/手机号码" placeholder="用户姓名/手机号码"
v-model="mobileOrName" v-model="mobileOrName"
@clear="handleClear" @clear="handleClear(null)"
@on-search="handleSearch(searchParams)" @on-search="handleSearch(searchParams)"
/></template> /></template>
<template #header-right> <template #header-right>
...@@ -153,9 +153,11 @@ const columns: PrimaryTableCol[] = [ ...@@ -153,9 +153,11 @@ const columns: PrimaryTableCol[] = [
cell: (h, { row }) => { cell: (h, { row }) => {
return ( return (
<div class='flex items-center justify-between'> <div class='flex items-center justify-between'>
<div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}> <t-tooltip content={row.inputUserName}>
<span>{row.inputUserName || '-'}</span> <div class={row.inputUserDelFlag ? 'w-[calc(100%-58px)] ellipsis' : ''}>
</div> <span>{row.inputUserName || '-'}</span>
</div>
</t-tooltip>
{row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''} {row.inputUserDelFlag ? <span class='inputUserName-del'>已删除</span> : ''}
</div> </div>
) )
...@@ -193,7 +195,10 @@ const handleSearch = (params: Record<string, any>) => { ...@@ -193,7 +195,10 @@ const handleSearch = (params: Record<string, any>) => {
} }
// 清空搜索条件 // 清空搜索条件
const handleClear = () => { const handleClear = (flge: boolean | null) => {
if (flge) {
searchParams.value = {}
}
mobileOrName.value = '' mobileOrName.value = ''
pagination.value.page = 1 pagination.value.page = 1
getData() getData()
......
...@@ -141,7 +141,9 @@ const handleConfirm = () => { ...@@ -141,7 +141,9 @@ const handleConfirm = () => {
}) })
} }
const emit = defineEmits(['success']) const emit = defineEmits<{
success: []
}>()
// onMounted(() => { // onMounted(() => {
// getRoleListData() // getRoleListData()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论