mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-11-04 12:18:43 +08:00 
			
		
		
		
	Merge branch 'dev' of https://gitee.com/fessor/yudao-ui-admin-vue3 into dev
This commit is contained in:
		@@ -130,7 +130,7 @@ const queryFormRef = ref() // 搜索的表单
 | 
			
		||||
const exportLoading = ref(false) // 导出的加载中
 | 
			
		||||
const dicts = ref<DictTypeApi.DictTypeVO[]>() // 字典类型的列表
 | 
			
		||||
 | 
			
		||||
/** 查询参数列表 */
 | 
			
		||||
/** 查询列表 */
 | 
			
		||||
const getList = async () => {
 | 
			
		||||
  loading.value = true
 | 
			
		||||
  try {
 | 
			
		||||
 
 | 
			
		||||
@@ -123,7 +123,7 @@ const queryParams = reactive({
 | 
			
		||||
const queryFormRef = ref() // 搜索的表单
 | 
			
		||||
const exportLoading = ref(false) // 导出的加载中
 | 
			
		||||
 | 
			
		||||
/** 查询参数列表 */
 | 
			
		||||
/** 查询列表 */
 | 
			
		||||
const getList = async () => {
 | 
			
		||||
  loading.value = true
 | 
			
		||||
  try {
 | 
			
		||||
 
 | 
			
		||||
@@ -126,7 +126,7 @@ const queryFormRef = ref() // 搜索的表单
 | 
			
		||||
const isExpandAll = ref(false) // 是否展开,默认全部折叠
 | 
			
		||||
const refreshTable = ref(true) // 重新渲染表格状态
 | 
			
		||||
 | 
			
		||||
/** 查询参数列表 */
 | 
			
		||||
/** 查询列表 */
 | 
			
		||||
const getList = async () => {
 | 
			
		||||
  loading.value = true
 | 
			
		||||
  try {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										64
									
								
								src/views/system/notify/message/NotifyMessageDetail.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								src/views/system/notify/message/NotifyMessageDetail.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <Dialog title="详情" v-model="modelVisible" :scroll="true" :max-height="500">
 | 
			
		||||
    <el-descriptions border :column="1">
 | 
			
		||||
      <el-descriptions-item label="编号" min-width="120">
 | 
			
		||||
        {{ detailData.id }}
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
      <el-descriptions-item label="用户类型">
 | 
			
		||||
        <dict-tag :type="DICT_TYPE.USER_TYPE" :value="detailData.userType" />
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
      <el-descriptions-item label="用户编号">
 | 
			
		||||
        {{ detailData.userId }}
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
      <el-descriptions-item label="模版编号">
 | 
			
		||||
        {{ detailData.templateId }}
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
      <el-descriptions-item label="模板编码">
 | 
			
		||||
        {{ detailData.templateCode }}
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
      <el-descriptions-item label="发送人名称">
 | 
			
		||||
        {{ detailData.templateNickname }}
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
      <el-descriptions-item label="模版内容">
 | 
			
		||||
        {{ detailData.templateContent }}
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
      <el-descriptions-item label="模版参数">
 | 
			
		||||
        {{ detailData.templateParams }}
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
      <el-descriptions-item label="模版类型">
 | 
			
		||||
        <dict-tag :type="DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE" :value="detailData.templateType" />
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
      <el-descriptions-item label="是否已读">
 | 
			
		||||
        <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="detailData.readStatus" />
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
      <el-descriptions-item label="阅读时间">
 | 
			
		||||
        {{ formatDate(detailData.readTime) }}
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
      <el-descriptions-item label="创建时间">
 | 
			
		||||
        {{ formatDate(detailData.createTime) }}
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
    </el-descriptions>
 | 
			
		||||
  </Dialog>
 | 
			
		||||
</template>
 | 
			
		||||
<script setup lang="ts">
 | 
			
		||||
import { DICT_TYPE } from '@/utils/dict'
 | 
			
		||||
import { formatDate } from '@/utils/formatTime'
 | 
			
		||||
import * as NotifyMessageApi from '@/api/system/notify/message'
 | 
			
		||||
 | 
			
		||||
const modelVisible = ref(false) // 弹窗的是否展示
 | 
			
		||||
const detailLoading = ref(false) // 表单的加载中
 | 
			
		||||
const detailData = ref() // 详情数据
 | 
			
		||||
 | 
			
		||||
/** 打开弹窗 */
 | 
			
		||||
const open = async (data: NotifyMessageApi.NotifyMessageVO) => {
 | 
			
		||||
  modelVisible.value = true
 | 
			
		||||
  // 设置数据
 | 
			
		||||
  detailLoading.value = true
 | 
			
		||||
  try {
 | 
			
		||||
    detailData.value = data
 | 
			
		||||
  } finally {
 | 
			
		||||
    detailLoading.value = false
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
 | 
			
		||||
</script>
 | 
			
		||||
@@ -1,67 +1,208 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <ContentWrap>
 | 
			
		||||
    <!-- 列表 -->
 | 
			
		||||
    <XTable @register="registerTable">
 | 
			
		||||
      <template #actionbtns_default="{ row }">
 | 
			
		||||
        <!-- 操作:详情 -->
 | 
			
		||||
        <XTextButton
 | 
			
		||||
          preIcon="ep:view"
 | 
			
		||||
          :title="t('action.detail')"
 | 
			
		||||
          v-hasPermi="['system:notify-message:query']"
 | 
			
		||||
          @click="handleDetail(row.id)"
 | 
			
		||||
  <content-wrap>
 | 
			
		||||
    <!-- 搜索工作栏 -->
 | 
			
		||||
    <el-form
 | 
			
		||||
      class="-mb-15px"
 | 
			
		||||
      :model="queryParams"
 | 
			
		||||
      ref="queryFormRef"
 | 
			
		||||
      :inline="true"
 | 
			
		||||
      label-width="68px"
 | 
			
		||||
    >
 | 
			
		||||
      <el-form-item label="用户编号" prop="userId">
 | 
			
		||||
        <el-input
 | 
			
		||||
          v-model="queryParams.userId"
 | 
			
		||||
          placeholder="请输入用户编号"
 | 
			
		||||
          clearable
 | 
			
		||||
          @keyup.enter="handleQuery"
 | 
			
		||||
          class="!w-240px"
 | 
			
		||||
        />
 | 
			
		||||
      </template>
 | 
			
		||||
    </XTable>
 | 
			
		||||
  </ContentWrap>
 | 
			
		||||
  <!-- 弹窗 -->
 | 
			
		||||
  <XModal id="messageModel" :loading="modelLoading" v-model="modelVisible" :title="modelTitle">
 | 
			
		||||
    <!-- 表单:详情 -->
 | 
			
		||||
    <Descriptions
 | 
			
		||||
      v-if="actionType === 'detail'"
 | 
			
		||||
      :schema="allSchemas.detailSchema"
 | 
			
		||||
      :data="detailData"
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="用户类型" prop="userType">
 | 
			
		||||
        <el-select
 | 
			
		||||
          v-model="queryParams.userType"
 | 
			
		||||
          placeholder="请选择用户类型"
 | 
			
		||||
          clearable
 | 
			
		||||
          class="!w-240px"
 | 
			
		||||
        >
 | 
			
		||||
          <el-option
 | 
			
		||||
            v-for="dict in getIntDictOptions(DICT_TYPE.USER_TYPE)"
 | 
			
		||||
            :key="dict.value"
 | 
			
		||||
            :label="dict.label"
 | 
			
		||||
            :value="dict.value"
 | 
			
		||||
          />
 | 
			
		||||
        </el-select>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="模板编码" prop="templateCode">
 | 
			
		||||
        <el-input
 | 
			
		||||
          v-model="queryParams.templateCode"
 | 
			
		||||
          placeholder="请输入模板编码"
 | 
			
		||||
          clearable
 | 
			
		||||
          @keyup.enter="handleQuery"
 | 
			
		||||
          class="!w-240px"
 | 
			
		||||
        />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="模版类型" prop="templateType">
 | 
			
		||||
        <el-select
 | 
			
		||||
          v-model="queryParams.templateType"
 | 
			
		||||
          placeholder="请选择模版类型"
 | 
			
		||||
          clearable
 | 
			
		||||
          class="!w-240px"
 | 
			
		||||
        >
 | 
			
		||||
          <el-option
 | 
			
		||||
            v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE)"
 | 
			
		||||
            :key="dict.value"
 | 
			
		||||
            :label="dict.label"
 | 
			
		||||
            :value="dict.value"
 | 
			
		||||
          />
 | 
			
		||||
        </el-select>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="创建时间" prop="createTime">
 | 
			
		||||
        <el-date-picker
 | 
			
		||||
          v-model="queryParams.createTime"
 | 
			
		||||
          value-format="YYYY-MM-DD HH:mm:ss"
 | 
			
		||||
          type="daterange"
 | 
			
		||||
          start-placeholder="开始日期"
 | 
			
		||||
          end-placeholder="结束日期"
 | 
			
		||||
          :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
 | 
			
		||||
          class="!w-240px"
 | 
			
		||||
        />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item>
 | 
			
		||||
        <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
 | 
			
		||||
        <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
    </el-form>
 | 
			
		||||
  </content-wrap>
 | 
			
		||||
 | 
			
		||||
  <!-- 列表 -->
 | 
			
		||||
  <content-wrap>
 | 
			
		||||
    <el-table v-loading="loading" :data="list">
 | 
			
		||||
      <el-table-column label="编号" align="center" prop="id" />
 | 
			
		||||
      <el-table-column label="用户类型" align="center" prop="userType">
 | 
			
		||||
        <template #default="scope">
 | 
			
		||||
          <dict-tag :type="DICT_TYPE.USER_TYPE" :value="scope.row.userType" />
 | 
			
		||||
        </template>
 | 
			
		||||
      </el-table-column>
 | 
			
		||||
      <el-table-column label="用户编号" align="center" prop="userId" width="80" />
 | 
			
		||||
      <el-table-column label="模板编码" align="center" prop="templateCode" width="80" />
 | 
			
		||||
      <el-table-column label="发送人名称" align="center" prop="templateNickname" width="180" />
 | 
			
		||||
      <el-table-column
 | 
			
		||||
        label="模版内容"
 | 
			
		||||
        align="center"
 | 
			
		||||
        prop="templateContent"
 | 
			
		||||
        width="200"
 | 
			
		||||
        show-overflow-tooltip
 | 
			
		||||
      />
 | 
			
		||||
      <el-table-column
 | 
			
		||||
        label="模版参数"
 | 
			
		||||
        align="center"
 | 
			
		||||
        prop="templateParams"
 | 
			
		||||
        width="180"
 | 
			
		||||
        show-overflow-tooltip
 | 
			
		||||
      >
 | 
			
		||||
        <template #default="scope"> {{ scope.row.templateParams }}</template>
 | 
			
		||||
      </el-table-column>
 | 
			
		||||
      <el-table-column label="模版类型" align="center" prop="templateType" width="120">
 | 
			
		||||
        <template #default="scope">
 | 
			
		||||
          <dict-tag :type="DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE" :value="scope.row.templateType" />
 | 
			
		||||
        </template>
 | 
			
		||||
      </el-table-column>
 | 
			
		||||
      <el-table-column label="是否已读" align="center" prop="readStatus" width="100">
 | 
			
		||||
        <template #default="scope">
 | 
			
		||||
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.readStatus" />
 | 
			
		||||
        </template>
 | 
			
		||||
      </el-table-column>
 | 
			
		||||
      <el-table-column
 | 
			
		||||
        label="阅读时间"
 | 
			
		||||
        align="center"
 | 
			
		||||
        prop="readTime"
 | 
			
		||||
        width="180"
 | 
			
		||||
        :formatter="dateFormatter"
 | 
			
		||||
      />
 | 
			
		||||
      <el-table-column
 | 
			
		||||
        label="创建时间"
 | 
			
		||||
        align="center"
 | 
			
		||||
        prop="createTime"
 | 
			
		||||
        width="180"
 | 
			
		||||
        :formatter="dateFormatter"
 | 
			
		||||
      />
 | 
			
		||||
      <el-table-column label="操作" align="center" fixed="right">
 | 
			
		||||
        <template #default="scope">
 | 
			
		||||
          <el-button
 | 
			
		||||
            link
 | 
			
		||||
            type="primary"
 | 
			
		||||
            @click="openDetail(scope.row)"
 | 
			
		||||
            v-hasPermi="['system:notify-message:query']"
 | 
			
		||||
          >
 | 
			
		||||
            详情
 | 
			
		||||
          </el-button>
 | 
			
		||||
        </template>
 | 
			
		||||
      </el-table-column>
 | 
			
		||||
    </el-table>
 | 
			
		||||
    <!-- 分页 -->
 | 
			
		||||
    <Pagination
 | 
			
		||||
      :total="total"
 | 
			
		||||
      v-model:page="queryParams.pageNo"
 | 
			
		||||
      v-model:limit="queryParams.pageSize"
 | 
			
		||||
      @pagination="getList"
 | 
			
		||||
    />
 | 
			
		||||
    <template #footer>
 | 
			
		||||
      <!-- 按钮:关闭 -->
 | 
			
		||||
      <XButton :loading="actionLoading" :title="t('dialog.close')" @click="modelVisible = false" />
 | 
			
		||||
    </template>
 | 
			
		||||
  </XModal>
 | 
			
		||||
  </content-wrap>
 | 
			
		||||
 | 
			
		||||
  <!-- 表单弹窗:详情 -->
 | 
			
		||||
  <NotifyMessageDetail ref="detailRef" />
 | 
			
		||||
</template>
 | 
			
		||||
<script setup lang="ts" name="NotifyMessage">
 | 
			
		||||
// 业务相关的 import
 | 
			
		||||
import { allSchemas } from './message.data'
 | 
			
		||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
 | 
			
		||||
import { dateFormatter } from '@/utils/formatTime'
 | 
			
		||||
import * as NotifyMessageApi from '@/api/system/notify/message'
 | 
			
		||||
import NotifyMessageDetail from './NotifyMessageDetail.vue'
 | 
			
		||||
 | 
			
		||||
const { t } = useI18n() // 国际化
 | 
			
		||||
 | 
			
		||||
// 列表相关的变量
 | 
			
		||||
const [registerTable] = useXTable({
 | 
			
		||||
  allSchemas: allSchemas,
 | 
			
		||||
  topActionSlots: false,
 | 
			
		||||
  getListApi: NotifyMessageApi.getNotifyMessagePageApi
 | 
			
		||||
const loading = ref(true) // 列表的加载中
 | 
			
		||||
const total = ref(0) // 列表的总页数
 | 
			
		||||
const list = ref([]) // 列表的数据
 | 
			
		||||
const queryParams = reactive({
 | 
			
		||||
  pageNo: 1,
 | 
			
		||||
  pageSize: 10,
 | 
			
		||||
  userType: undefined,
 | 
			
		||||
  userId: undefined,
 | 
			
		||||
  templateCode: undefined,
 | 
			
		||||
  templateType: undefined,
 | 
			
		||||
  createTime: []
 | 
			
		||||
})
 | 
			
		||||
const queryFormRef = ref() // 搜索的表单
 | 
			
		||||
 | 
			
		||||
// 弹窗相关的变量
 | 
			
		||||
const modelVisible = ref(false) // 是否显示弹出层
 | 
			
		||||
const modelTitle = ref('edit') // 弹出层标题
 | 
			
		||||
const modelLoading = ref(false) // 弹出层loading
 | 
			
		||||
const actionType = ref('') // 操作按钮的类型
 | 
			
		||||
const actionLoading = ref(false) // 按钮 Loading
 | 
			
		||||
const detailData = ref() // 详情 Ref
 | 
			
		||||
 | 
			
		||||
// 设置标题
 | 
			
		||||
const setDialogTile = (type: string) => {
 | 
			
		||||
  modelLoading.value = true
 | 
			
		||||
  modelTitle.value = t('action.' + type)
 | 
			
		||||
  actionType.value = type
 | 
			
		||||
  modelVisible.value = true
 | 
			
		||||
/** 查询列表 */
 | 
			
		||||
const getList = async () => {
 | 
			
		||||
  loading.value = true
 | 
			
		||||
  try {
 | 
			
		||||
    const data = await NotifyMessageApi.getNotifyMessagePage(queryParams)
 | 
			
		||||
    list.value = data.list
 | 
			
		||||
    total.value = data.total
 | 
			
		||||
  } finally {
 | 
			
		||||
    loading.value = false
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 详情操作
 | 
			
		||||
const handleDetail = async (rowId: number) => {
 | 
			
		||||
  setDialogTile('detail')
 | 
			
		||||
  const res = await NotifyMessageApi.getNotifyMessageApi(rowId)
 | 
			
		||||
  detailData.value = res
 | 
			
		||||
  modelLoading.value = false
 | 
			
		||||
/** 搜索按钮操作 */
 | 
			
		||||
const handleQuery = () => {
 | 
			
		||||
  queryParams.pageNo = 1
 | 
			
		||||
  getList()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 重置按钮操作 */
 | 
			
		||||
const resetQuery = () => {
 | 
			
		||||
  queryFormRef.value.resetFields()
 | 
			
		||||
  handleQuery()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 详情操作 */
 | 
			
		||||
const detailRef = ref()
 | 
			
		||||
const openDetail = (data: NotifyMessageApi.NotifyMessageVO) => {
 | 
			
		||||
  detailRef.value.open(data)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 初始化 **/
 | 
			
		||||
onMounted(() => {
 | 
			
		||||
  getList()
 | 
			
		||||
})
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,101 +0,0 @@
 | 
			
		||||
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
 | 
			
		||||
 | 
			
		||||
// CrudSchema
 | 
			
		||||
const crudSchemas = reactive<VxeCrudSchema>({
 | 
			
		||||
  primaryKey: 'id', // 默认的主键ID
 | 
			
		||||
  primaryTitle: '编号', // 默认显示的值
 | 
			
		||||
  primaryType: 'id', // 默认为seq,序号模式
 | 
			
		||||
  action: true,
 | 
			
		||||
  actionWidth: '200', // 3个按钮默认200,如有删减对应增减即可
 | 
			
		||||
  columns: [
 | 
			
		||||
    {
 | 
			
		||||
      title: '用户编号',
 | 
			
		||||
      field: 'userId',
 | 
			
		||||
      isSearch: true
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      title: '用户类型',
 | 
			
		||||
      field: 'userType',
 | 
			
		||||
      dictType: DICT_TYPE.USER_TYPE,
 | 
			
		||||
      dictClass: 'string',
 | 
			
		||||
      isSearch: true,
 | 
			
		||||
      table: {
 | 
			
		||||
        width: 80
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      title: '模版编号',
 | 
			
		||||
      field: 'templateId'
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      title: '模板编码',
 | 
			
		||||
      field: 'templateCode',
 | 
			
		||||
      isSearch: true,
 | 
			
		||||
      table: {
 | 
			
		||||
        width: 80
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      title: '发送人名称',
 | 
			
		||||
      field: 'templateNickname',
 | 
			
		||||
      table: {
 | 
			
		||||
        width: 120
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      title: '模版内容',
 | 
			
		||||
      field: 'templateContent',
 | 
			
		||||
      table: {
 | 
			
		||||
        width: 200
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      title: '模版类型',
 | 
			
		||||
      field: 'templateType',
 | 
			
		||||
      dictType: DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE,
 | 
			
		||||
      dictClass: 'number',
 | 
			
		||||
      isSearch: true,
 | 
			
		||||
      table: {
 | 
			
		||||
        width: 80
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      title: '模版参数',
 | 
			
		||||
      field: 'templateParams',
 | 
			
		||||
      isTable: false
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      title: '是否已读',
 | 
			
		||||
      field: 'readStatus',
 | 
			
		||||
      dictType: DICT_TYPE.INFRA_BOOLEAN_STRING,
 | 
			
		||||
      dictClass: 'boolean',
 | 
			
		||||
      table: {
 | 
			
		||||
        width: 80
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      title: '阅读时间',
 | 
			
		||||
      field: 'readTime',
 | 
			
		||||
      formatter: 'formatDate',
 | 
			
		||||
      table: {
 | 
			
		||||
        width: 180
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      title: '创建时间',
 | 
			
		||||
      field: 'createTime',
 | 
			
		||||
      isForm: false,
 | 
			
		||||
      formatter: 'formatDate',
 | 
			
		||||
      search: {
 | 
			
		||||
        show: true,
 | 
			
		||||
        itemRender: {
 | 
			
		||||
          name: 'XDataTimePicker'
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      table: {
 | 
			
		||||
        width: 180
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
})
 | 
			
		||||
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
 | 
			
		||||
							
								
								
									
										46
									
								
								src/views/system/notify/my/MyNotifyMessageDetail.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								src/views/system/notify/my/MyNotifyMessageDetail.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,46 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <Dialog title="消息详情" v-model="modelVisible" :scroll="true" :max-height="500">
 | 
			
		||||
    <el-descriptions border :column="1">
 | 
			
		||||
      <el-descriptions-item label="发送人">
 | 
			
		||||
        {{ detailData.templateNickname }}
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
      <el-descriptions-item label="发送时间">
 | 
			
		||||
        {{ formatDate(detailData.createTime, 'YYYY-MM-DD HH:mm:ss') }}
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
      <el-descriptions-item label="消息类型">
 | 
			
		||||
        <dict-tag :type="DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE" :value="detailData.templateType" />
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
      <el-descriptions-item label="是否已读">
 | 
			
		||||
        <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="detailData.readStatus" />
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
      <el-descriptions-item label="阅读时间" v-if="detailData.readStatus">
 | 
			
		||||
        {{ formatDate(detailData.readTime, 'YYYY-MM-DD HH:mm:ss') }}
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
      <el-descriptions-item label="内容">
 | 
			
		||||
        {{ detailData.templateContent }}
 | 
			
		||||
      </el-descriptions-item>
 | 
			
		||||
    </el-descriptions>
 | 
			
		||||
  </Dialog>
 | 
			
		||||
</template>
 | 
			
		||||
<script setup lang="ts">
 | 
			
		||||
import { DICT_TYPE } from '@/utils/dict'
 | 
			
		||||
import { formatDate } from '@/utils/formatTime'
 | 
			
		||||
import * as NotifyMessageApi from '@/api/system/notify/message'
 | 
			
		||||
 | 
			
		||||
const modelVisible = ref(false) // 弹窗的是否展示
 | 
			
		||||
const detailLoading = ref(false) // 表单的加载中
 | 
			
		||||
const detailData = ref() // 详情数据
 | 
			
		||||
 | 
			
		||||
/** 打开弹窗 */
 | 
			
		||||
const open = async (data: NotifyMessageApi.NotifyMessageVO) => {
 | 
			
		||||
  modelVisible.value = true
 | 
			
		||||
  // 设置数据
 | 
			
		||||
  detailLoading.value = true
 | 
			
		||||
  try {
 | 
			
		||||
    detailData.value = data
 | 
			
		||||
  } finally {
 | 
			
		||||
    detailLoading.value = false
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
 | 
			
		||||
</script>
 | 
			
		||||
@@ -1,58 +1,213 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <ContentWrap>
 | 
			
		||||
    <!-- 列表 -->
 | 
			
		||||
    <XTable @register="registerTable">
 | 
			
		||||
      <template #toolbar_buttons>
 | 
			
		||||
        <!-- 操作:标记已读 -->
 | 
			
		||||
        <XButton type="primary" preIcon="ep:zoom-in" title="标记已读" @click="handleUpdateList" />
 | 
			
		||||
        <!-- 操作:全部已读 -->
 | 
			
		||||
        <XButton type="primary" preIcon="ep:zoom-in" title="全部已读" @click="handleUpdateAll" />
 | 
			
		||||
      </template>
 | 
			
		||||
      <template #actionbtns_default="{ row }">
 | 
			
		||||
        <!-- 操作:已读 -->
 | 
			
		||||
        <XTextButton
 | 
			
		||||
          preIcon="ep:view"
 | 
			
		||||
          title="已读"
 | 
			
		||||
          v-hasPermi="['system:notify-message:query']"
 | 
			
		||||
          v-if="!row.readStatus"
 | 
			
		||||
          @click="handleUpdate([row.id])"
 | 
			
		||||
  <content-wrap>
 | 
			
		||||
    <!-- 搜索工作栏 -->
 | 
			
		||||
    <el-form
 | 
			
		||||
      class="-mb-15px"
 | 
			
		||||
      :model="queryParams"
 | 
			
		||||
      ref="queryFormRef"
 | 
			
		||||
      :inline="true"
 | 
			
		||||
      label-width="68px"
 | 
			
		||||
    >
 | 
			
		||||
      <el-form-item label="是否已读" prop="readStatus">
 | 
			
		||||
        <el-select
 | 
			
		||||
          v-model="queryParams.readStatus"
 | 
			
		||||
          placeholder="请选择状态"
 | 
			
		||||
          clearable
 | 
			
		||||
          class="!w-240px"
 | 
			
		||||
        >
 | 
			
		||||
          <el-option
 | 
			
		||||
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
 | 
			
		||||
            :key="dict.value"
 | 
			
		||||
            :label="dict.label"
 | 
			
		||||
            :value="dict.value"
 | 
			
		||||
          />
 | 
			
		||||
        </el-select>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="发送时间" prop="createTime">
 | 
			
		||||
        <el-date-picker
 | 
			
		||||
          v-model="queryParams.createTime"
 | 
			
		||||
          value-format="YYYY-MM-DD HH:mm:ss"
 | 
			
		||||
          type="daterange"
 | 
			
		||||
          start-placeholder="开始日期"
 | 
			
		||||
          end-placeholder="结束日期"
 | 
			
		||||
          :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
 | 
			
		||||
          class="!w-240px"
 | 
			
		||||
        />
 | 
			
		||||
      </template>
 | 
			
		||||
    </XTable>
 | 
			
		||||
  </ContentWrap>
 | 
			
		||||
</template>
 | 
			
		||||
<script setup lang="ts" name="MyNotifyMessage">
 | 
			
		||||
// 业务相关的 import
 | 
			
		||||
import { allSchemas } from './my.data'
 | 
			
		||||
import * as NotifyMessageApi from '@/api/system/notify/message'
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item>
 | 
			
		||||
        <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
 | 
			
		||||
        <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
 | 
			
		||||
        <el-button @click="handleUpdateList">
 | 
			
		||||
          <Icon icon="ep:reading" class="mr-5px" /> 标记已读
 | 
			
		||||
        </el-button>
 | 
			
		||||
        <el-button @click="handleUpdateAll">
 | 
			
		||||
          <Icon icon="ep:reading" class="mr-5px" /> 全部已读
 | 
			
		||||
        </el-button>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
    </el-form>
 | 
			
		||||
  </content-wrap>
 | 
			
		||||
 | 
			
		||||
  <content-wrap>
 | 
			
		||||
    <!-- 列表 -->
 | 
			
		||||
    <el-table
 | 
			
		||||
      v-loading="loading"
 | 
			
		||||
      :data="list"
 | 
			
		||||
      ref="tableRef"
 | 
			
		||||
      row-key="id"
 | 
			
		||||
      @selection-change="handleSelectionChange"
 | 
			
		||||
    >
 | 
			
		||||
      <el-table-column type="selection" :selectable="selectable" :reserve-selection="true" />
 | 
			
		||||
      <el-table-column label="发送人" align="center" prop="templateNickname" width="180" />
 | 
			
		||||
      <el-table-column
 | 
			
		||||
        label="发送时间"
 | 
			
		||||
        align="center"
 | 
			
		||||
        prop="createTime"
 | 
			
		||||
        width="200"
 | 
			
		||||
        :formatter="dateFormatter"
 | 
			
		||||
      />
 | 
			
		||||
      <el-table-column label="类型" align="center" prop="templateType" width="180">
 | 
			
		||||
        <template #default="scope">
 | 
			
		||||
          <dict-tag :type="DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE" :value="scope.row.templateType" />
 | 
			
		||||
        </template>
 | 
			
		||||
      </el-table-column>
 | 
			
		||||
      <el-table-column
 | 
			
		||||
        label="消息内容"
 | 
			
		||||
        align="center"
 | 
			
		||||
        prop="templateContent"
 | 
			
		||||
        show-overflow-tooltip
 | 
			
		||||
      />
 | 
			
		||||
      <el-table-column label="是否已读" align="center" prop="readStatus" width="160">
 | 
			
		||||
        <template #default="scope">
 | 
			
		||||
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.readStatus" />
 | 
			
		||||
        </template>
 | 
			
		||||
      </el-table-column>
 | 
			
		||||
      <el-table-column
 | 
			
		||||
        label="阅读时间"
 | 
			
		||||
        align="center"
 | 
			
		||||
        prop="readTime"
 | 
			
		||||
        width="200"
 | 
			
		||||
        :formatter="dateFormatter"
 | 
			
		||||
      />
 | 
			
		||||
      <el-table-column label="操作" align="center" width="160">
 | 
			
		||||
        <template #default="scope">
 | 
			
		||||
          <el-button
 | 
			
		||||
            link
 | 
			
		||||
            :type="scope.row.readStatus ? 'primary' : 'warning'"
 | 
			
		||||
            @click="openDetail(scope.row)"
 | 
			
		||||
          >
 | 
			
		||||
            {{ scope.row.readStatus ? '详情' : '已读' }}
 | 
			
		||||
          </el-button>
 | 
			
		||||
        </template>
 | 
			
		||||
      </el-table-column>
 | 
			
		||||
    </el-table>
 | 
			
		||||
    <!-- 分页 -->
 | 
			
		||||
    <Pagination
 | 
			
		||||
      :total="total"
 | 
			
		||||
      v-model:page="queryParams.pageNo"
 | 
			
		||||
      v-model:limit="queryParams.pageSize"
 | 
			
		||||
      @pagination="getList"
 | 
			
		||||
    />
 | 
			
		||||
  </content-wrap>
 | 
			
		||||
 | 
			
		||||
  <!-- 表单弹窗:详情 -->
 | 
			
		||||
  <MyNotifyMessageDetail ref="detailRef" />
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup lang="ts" name="MyNotifyMessage">
 | 
			
		||||
import { DICT_TYPE, getBoolDictOptions } from '@/utils/dict'
 | 
			
		||||
import { dateFormatter } from '@/utils/formatTime'
 | 
			
		||||
import * as NotifyMessageApi from '@/api/system/notify/message'
 | 
			
		||||
import MyNotifyMessageDetail from './MyNotifyMessageDetail.vue'
 | 
			
		||||
const message = useMessage() // 消息
 | 
			
		||||
 | 
			
		||||
// 列表相关的变量
 | 
			
		||||
const [registerTable, { reload, getCheckboxRecords }] = useXTable({
 | 
			
		||||
  allSchemas: allSchemas,
 | 
			
		||||
  getListApi: NotifyMessageApi.getMyNotifyMessagePage
 | 
			
		||||
const loading = ref(true) // 列表的加载中
 | 
			
		||||
const total = ref(0) // 列表的总页数
 | 
			
		||||
const list = ref([]) // 列表的数据
 | 
			
		||||
const queryParams = reactive({
 | 
			
		||||
  pageNo: 1,
 | 
			
		||||
  pageSize: 10,
 | 
			
		||||
  readStatus: undefined,
 | 
			
		||||
  createTime: []
 | 
			
		||||
})
 | 
			
		||||
const queryFormRef = ref() // 搜索的表单
 | 
			
		||||
const tableRef = ref() // 表格的 Ref
 | 
			
		||||
const selectedIds = ref<number[]>([]) // 表格的选中 ID 数组
 | 
			
		||||
 | 
			
		||||
const handleUpdateList = async () => {
 | 
			
		||||
  const list = getCheckboxRecords() as any as any[]
 | 
			
		||||
  if (list.length === 0) {
 | 
			
		||||
    return
 | 
			
		||||
/** 查询列表 */
 | 
			
		||||
const getList = async () => {
 | 
			
		||||
  loading.value = true
 | 
			
		||||
  try {
 | 
			
		||||
    const data = await NotifyMessageApi.getMyNotifyMessagePage(queryParams)
 | 
			
		||||
    list.value = data.list
 | 
			
		||||
    total.value = data.total
 | 
			
		||||
  } finally {
 | 
			
		||||
    loading.value = false
 | 
			
		||||
  }
 | 
			
		||||
  await handleUpdate(list.map((v) => v.id))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 标记指定 id 已读
 | 
			
		||||
const handleUpdate = async (ids) => {
 | 
			
		||||
  await NotifyMessageApi.updateNotifyMessageRead(ids)
 | 
			
		||||
  message.success('标记已读成功!')
 | 
			
		||||
  reload()
 | 
			
		||||
/** 搜索按钮操作 */
 | 
			
		||||
const handleQuery = () => {
 | 
			
		||||
  queryParams.pageNo = 1
 | 
			
		||||
  getList()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 标记全部已读
 | 
			
		||||
/** 重置按钮操作 */
 | 
			
		||||
const resetQuery = () => {
 | 
			
		||||
  queryFormRef.value.resetFields()
 | 
			
		||||
  tableRef.value.clearSelection()
 | 
			
		||||
  handleQuery()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 详情操作 */
 | 
			
		||||
const detailRef = ref()
 | 
			
		||||
const openDetail = (data: NotifyMessageApi.NotifyMessageVO) => {
 | 
			
		||||
  if (!data.readStatus) {
 | 
			
		||||
    handleReadOne(data.id)
 | 
			
		||||
  }
 | 
			
		||||
  detailRef.value.open(data)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 标记一条站内信已读 */
 | 
			
		||||
const handleReadOne = async (id) => {
 | 
			
		||||
  await NotifyMessageApi.updateNotifyMessageRead(id)
 | 
			
		||||
  await getList()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 标记全部站内信已读 **/
 | 
			
		||||
const handleUpdateAll = async () => {
 | 
			
		||||
  await NotifyMessageApi.updateAllNotifyMessageRead()
 | 
			
		||||
  message.success('全部已读成功!')
 | 
			
		||||
  reload()
 | 
			
		||||
  tableRef.value.clearSelection()
 | 
			
		||||
  await getList()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 标记一些站内信已读 **/
 | 
			
		||||
const handleUpdateList = async () => {
 | 
			
		||||
  if (selectedIds.value.length === 0) {
 | 
			
		||||
    return
 | 
			
		||||
  }
 | 
			
		||||
  await NotifyMessageApi.updateNotifyMessageRead(selectedIds.value)
 | 
			
		||||
  message.success('批量已读成功!')
 | 
			
		||||
  tableRef.value.clearSelection()
 | 
			
		||||
  await getList()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 某一行,是否允许选中 */
 | 
			
		||||
const selectable = (row) => {
 | 
			
		||||
  return !row.readStatus
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 当表格选择项发生变化时会触发该事件  */
 | 
			
		||||
const handleSelectionChange = (array: NotifyMessageApi.NotifyMessageVO[]) => {
 | 
			
		||||
  selectedIds.value = []
 | 
			
		||||
  if (!array) {
 | 
			
		||||
    return
 | 
			
		||||
  }
 | 
			
		||||
  array.forEach((row) => selectedIds.value.push(row.id))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 初始化 **/
 | 
			
		||||
onMounted(() => {
 | 
			
		||||
  getList()
 | 
			
		||||
})
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,58 +0,0 @@
 | 
			
		||||
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
 | 
			
		||||
 | 
			
		||||
// CrudSchema
 | 
			
		||||
const crudSchemas = reactive<VxeCrudSchema>({
 | 
			
		||||
  primaryKey: 'id',
 | 
			
		||||
  primaryTitle: ' ',
 | 
			
		||||
  primaryType: 'checkbox',
 | 
			
		||||
  action: true,
 | 
			
		||||
  actionWidth: '200', // 3个按钮默认200,如有删减对应增减即可
 | 
			
		||||
  columns: [
 | 
			
		||||
    {
 | 
			
		||||
      title: '发送人名称',
 | 
			
		||||
      field: 'templateNickname',
 | 
			
		||||
      table: {
 | 
			
		||||
        width: 120
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      title: '发送时间',
 | 
			
		||||
      field: 'createTime',
 | 
			
		||||
      isForm: false,
 | 
			
		||||
      formatter: 'formatDate',
 | 
			
		||||
      search: {
 | 
			
		||||
        show: true,
 | 
			
		||||
        itemRender: {
 | 
			
		||||
          name: 'XDataTimePicker'
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      table: {
 | 
			
		||||
        width: 180
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      title: '类型',
 | 
			
		||||
      field: 'templateType',
 | 
			
		||||
      dictType: DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE,
 | 
			
		||||
      dictClass: 'number',
 | 
			
		||||
      table: {
 | 
			
		||||
        width: 80
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      title: '内容',
 | 
			
		||||
      field: 'templateContent'
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      title: '是否已读',
 | 
			
		||||
      field: 'readStatus',
 | 
			
		||||
      dictType: DICT_TYPE.INFRA_BOOLEAN_STRING,
 | 
			
		||||
      dictClass: 'boolean',
 | 
			
		||||
      table: {
 | 
			
		||||
        width: 80
 | 
			
		||||
      },
 | 
			
		||||
      isSearch: true
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
})
 | 
			
		||||
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
 | 
			
		||||
@@ -115,7 +115,7 @@ const queryParams = reactive({
 | 
			
		||||
})
 | 
			
		||||
const queryFormRef = ref() // 搜索的表单
 | 
			
		||||
 | 
			
		||||
/** 查询参数列表 */
 | 
			
		||||
/** 查询列表 */
 | 
			
		||||
const getList = async () => {
 | 
			
		||||
  loading.value = true
 | 
			
		||||
  try {
 | 
			
		||||
 
 | 
			
		||||
@@ -156,7 +156,7 @@ const queryParams = reactive({
 | 
			
		||||
const queryFormRef = ref() // 搜索的表单
 | 
			
		||||
const exportLoading = ref(false) // 导出的加载中
 | 
			
		||||
 | 
			
		||||
/** 查询参数列表 */
 | 
			
		||||
/** 查询列表 */
 | 
			
		||||
const getList = async () => {
 | 
			
		||||
  loading.value = true
 | 
			
		||||
  try {
 | 
			
		||||
 
 | 
			
		||||
@@ -168,7 +168,7 @@ const queryFormRef = ref() // 搜索的表单
 | 
			
		||||
const exportLoading = ref(false) // 导出的加载中
 | 
			
		||||
const tagList = ref([]) // 标签数组
 | 
			
		||||
 | 
			
		||||
/** 查询参数列表 */
 | 
			
		||||
/** 查询列表 */
 | 
			
		||||
const getList = async () => {
 | 
			
		||||
  loading.value = true
 | 
			
		||||
  try {
 | 
			
		||||
 
 | 
			
		||||
@@ -146,7 +146,7 @@ const queryParams = reactive({
 | 
			
		||||
  createTime: []
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
/** 查询参数列表 */
 | 
			
		||||
/** 查询列表 */
 | 
			
		||||
const getList = async () => {
 | 
			
		||||
  loading.value = true
 | 
			
		||||
  try {
 | 
			
		||||
 
 | 
			
		||||
@@ -191,7 +191,7 @@ const queryFormRef = ref() // 搜索的表单
 | 
			
		||||
const exportLoading = ref(false) // 导出的加载中
 | 
			
		||||
const packageList = ref([]) //租户套餐列表
 | 
			
		||||
 | 
			
		||||
/** 查询参数列表 */
 | 
			
		||||
/** 查询列表 */
 | 
			
		||||
const getList = async () => {
 | 
			
		||||
  loading.value = true
 | 
			
		||||
  try {
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
 | 
			
		||||
    {
 | 
			
		||||
      title: t('form.remark'),
 | 
			
		||||
      field: 'remark',
 | 
			
		||||
      isTable: false,
 | 
			
		||||
      isTable: true,
 | 
			
		||||
      isSearch: true,
 | 
			
		||||
      form: {
 | 
			
		||||
        component: 'Input',
 | 
			
		||||
 
 | 
			
		||||
@@ -8,12 +8,12 @@
 | 
			
		||||
        <el-input v-model="formData.nickname" :disabled="true" />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="角色">
 | 
			
		||||
        <el-select v-model="formData.roleIds" multiple placeholder="请选择">
 | 
			
		||||
        <el-select v-model="formData.roleIds" multiple placeholder="请选择角色">
 | 
			
		||||
          <el-option
 | 
			
		||||
            v-for="item in roleOptions"
 | 
			
		||||
            :key="parseInt(item.id)"
 | 
			
		||||
            :key="item.id"
 | 
			
		||||
            :label="item.name"
 | 
			
		||||
            :value="parseInt(item.id)"
 | 
			
		||||
            :value="item.id"
 | 
			
		||||
          />
 | 
			
		||||
        </el-select>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
@@ -28,6 +28,7 @@
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup lang="ts">
 | 
			
		||||
// TODO el-dialog 用 Dialog 组件
 | 
			
		||||
import { assignUserRoleApi, PermissionAssignUserRoleReqVO } from '@/api/system/permission'
 | 
			
		||||
 | 
			
		||||
interface Props {
 | 
			
		||||
@@ -86,5 +87,3 @@ const submit = async () => {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style></style>
 | 
			
		||||
 
 | 
			
		||||
@@ -269,6 +269,7 @@
 | 
			
		||||
import type { ElTree } from 'element-plus'
 | 
			
		||||
import { handleTree, defaultProps } from '@/utils/tree'
 | 
			
		||||
// 原vue3版本api方法都是Api结尾觉得见名知义,个人觉得这个可以形成规范
 | 
			
		||||
// TODO 使用 DeptApi 这种形式哈
 | 
			
		||||
import { getSimpleDeptList as getSimpleDeptListApi } from '@/api/system/dept'
 | 
			
		||||
import { getSimplePostList as getSimplePostListApi, PostVO } from '@/api/system/post'
 | 
			
		||||
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
 | 
			
		||||
@@ -279,16 +280,15 @@ import {
 | 
			
		||||
  updateUserStatusApi,
 | 
			
		||||
  UserVO
 | 
			
		||||
} from '@/api/system/user'
 | 
			
		||||
import { parseTime } from './utils'
 | 
			
		||||
import AddForm from './AddForm.vue'
 | 
			
		||||
import ImportForm from './ImportForm.vue'
 | 
			
		||||
import RoleForm from './RoleForm.vue'
 | 
			
		||||
import { parseTime } from './utils' // TODO 可以使用 formatTime 里的方法
 | 
			
		||||
import AddForm from './AddForm.vue' // TODO 改成 UserForm
 | 
			
		||||
import ImportForm from './ImportForm.vue' // TODO 改成 UserImportForm
 | 
			
		||||
import RoleForm from './RoleForm.vue' // TODO 改成 UserAssignRoleForm
 | 
			
		||||
import { getUserApi, getUserPageApi } from '@/api/system/user'
 | 
			
		||||
import { getSimpleRoleList as getSimpleRoleListApi } from '@/api/system/role'
 | 
			
		||||
import { listUserRolesApi } from '@/api/system/permission'
 | 
			
		||||
import { CommonStatusEnum } from '@/utils/constants'
 | 
			
		||||
import download from '@/utils/download'
 | 
			
		||||
 | 
			
		||||
const message = useMessage() // 消息弹窗
 | 
			
		||||
const { t } = useI18n() // 国际化
 | 
			
		||||
 | 
			
		||||
@@ -304,10 +304,11 @@ const queryParams = reactive({
 | 
			
		||||
const showSearch = ref(true)
 | 
			
		||||
const showAddDialog = ref(false)
 | 
			
		||||
 | 
			
		||||
// 数据字典-
 | 
			
		||||
// 数据字典- // TODO 可以直接 vue 那 getIntDictOptions,这样一方面少个变量,也可以 getIntDictOptions
 | 
			
		||||
const statusDictDatas = getDictOptions(DICT_TYPE.COMMON_STATUS)
 | 
			
		||||
 | 
			
		||||
// ========== 创建部门树结构 ==========
 | 
			
		||||
// TODO 要不把部门树拆成一个左侧的组件,然后点击后触发 handleDeptNodeClick
 | 
			
		||||
const deptName = ref('')
 | 
			
		||||
watch(
 | 
			
		||||
  () => deptName.value,
 | 
			
		||||
@@ -375,6 +376,7 @@ const resetQuery = () => {
 | 
			
		||||
// 添加或编辑
 | 
			
		||||
const addEditFormRef = ref()
 | 
			
		||||
// 添加用户
 | 
			
		||||
// TODO 可以参考别的模块哈,openForm;然后 tree 和 position 可以里面在加载下,让组件自己维护自己哈。
 | 
			
		||||
const handleAdd = () => {
 | 
			
		||||
  addEditFormRef?.value.resetForm()
 | 
			
		||||
  // 获得下拉数据
 | 
			
		||||
@@ -389,6 +391,7 @@ const handleImport = () => {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 用户导出
 | 
			
		||||
// TODO 改成 await 的风格;
 | 
			
		||||
const exportLoading = ref(false)
 | 
			
		||||
const handleExport = () => {
 | 
			
		||||
  message
 | 
			
		||||
@@ -432,6 +435,7 @@ const handleCommand = (command: string, index: number, row: UserVO) => {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 用户状态修改
 | 
			
		||||
// TODO 改成 await 的风格;
 | 
			
		||||
const handleStatusChange = (row: UserVO) => {
 | 
			
		||||
  let text = row.status === CommonStatusEnum.ENABLE ? '启用' : '停用'
 | 
			
		||||
  message
 | 
			
		||||
@@ -466,6 +470,7 @@ const handleUpdate = (row: UserVO) => {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 删除用户
 | 
			
		||||
// TODO 改成 await 的风格;
 | 
			
		||||
const handleDelete = (row: UserVO) => {
 | 
			
		||||
  const ids = row.id
 | 
			
		||||
  message
 | 
			
		||||
@@ -481,6 +486,7 @@ const handleDelete = (row: UserVO) => {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 重置密码
 | 
			
		||||
// TODO 改成 await 的风格;
 | 
			
		||||
const handleResetPwd = (row: UserVO) => {
 | 
			
		||||
  message.prompt('请输入"' + row.username + '"的新密码', t('common.reminder')).then(({ value }) => {
 | 
			
		||||
    resetUserPwdApi(row.id, value)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user