wujingjing
2024-10-25 a34acfc9181792e2c4a6fa113bd9e21780c5224d
后台修改
已修改4个文件
已添加1个文件
214 ■■■■■ 文件已修改
customer_list/yw/static/config/route.js 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/login/UserMenuData.ts 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/project/yw/systemManage/chatLog/ChatLog.vue 174 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/project/yw/systemManage/userMgr/UserMgr.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/project/yw/systemManage/userMgr/optDlg/OptDlg.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
customer_list/yw/static/config/route.js
@@ -1,5 +1,12 @@
window.route = [
    {
        name: 'ChatLog',
        isKeepAlive: true,
        isAffix: false,
        path: '/chatLog',
        component: '/project/yw/systemManage/chatLog/ChatLog.vue',
    },
    {
        name: 'RoleMgr',
        isKeepAlive: true,
        isAffix: false,
src/api/login/UserMenuData.ts
@@ -345,6 +345,22 @@
                SortCode: 2,
                Description: '',
            },
            {
                Children: [],
                ID: '333-2',
                ParentID: '3',
                Type: 2,
                Name: '对话日志',
                Path: '/chatLog',
                Permission: '',
                Icon: 'ywifont ywicon-wendang',
                IsIframe: false,
                OutLink: '',
                IsHide: false,
                Weight: 0,
                SortCode: 2,
                Description: '',
            },
        ],
    },
    {
@@ -370,7 +386,7 @@
                Name: '角色管理',
                Path: '/authCenter/roleMgr',
                Permission: '',
                Icon: 'ywifont ywicon-shujuguanli',
                Icon: 'ywifont ywicon-jiaose',
                IsIframe: false,
                IsHide: false,
                Weight: 0,
@@ -385,7 +401,7 @@
                Name: '用户管理',
                Path: '/authCenter/userMgr',
                Permission: '',
                Icon: 'ywifont ywicon-shujuguanli',
                Icon: 'ywifont ywicon-wode',
                IsIframe: false,
                IsHide: false,
                Weight: 0,
@@ -400,7 +416,7 @@
                Name: '操作日志',
                Path: '/authCenter/operateLog',
                Permission: '',
                Icon: 'ywifont ywicon-shujuguanli',
                Icon: 'ywifont ywicon-wendang',
                IsIframe: false,
                IsHide: false,
                Weight: 0,
src/views/project/yw/systemManage/chatLog/ChatLog.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,174 @@
<template>
    <HMContainer type="card">
        <template #header>
            <el-form ref="queryFormRef" :inline="true" :model="queryParams">
                <el-form-item label="日期范围" prop="timeRange">
                    <TimeRange v-model="queryParams.timeRange" :quickActive="TimeRangeEnum.CurrentDay" @change="handleQueryTable" />
                </el-form-item>
                <el-form-item label="操作类型" prop="type">
                    <el-input v-model="queryParams.type" style="width: 226.4px" placeholder="操作类型" clearable @input="debounceQueryTable" />
                </el-form-item>
                <el-form-item label="操作人员" prop="user">
                    <el-input v-model="queryParams.user" style="width: 226.4px" placeholder="操作人员" clearable @input="debounceQueryTable" />
                </el-form-item>
            </el-form>
        </template>
        <template #main>
            <div class="h-full" ref="chatDragContainerRef">
                <el-table
                    v-loading="tableLoading"
                    ref="draggableTableRef"
                    class="h100"
                    border
                    :row-class-name="isDragStatus ? 'cursor-move' : 'cursor-pointer'"
                    :data="tableData"
                    highlight-current-row
                >
                    <el-table-column prop="time" label="时间" width="185" fixed="left" show-overflow-tooltip> </el-table-column>
                    <el-table-column label="用户" prop="user" width="70" show-overflow-tooltip> </el-table-column>
                    <el-table-column label="类型" prop="type" show-overflow-tooltip> </el-table-column>
                </el-table>
            </div>
        </template>
    </HMContainer>
</template>
<script setup lang="ts">
import { debounce, getItemMap } from '/@/utils/util';
import { onMounted, ref } from 'vue';
import * as userApi from '/@/api/auth/user';
import { getRoleInfoListByPost } from '/@/api/auth/role';
import HMContainer from '/@/components/layout/HMContainer.vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import { computed } from 'vue';
import TimeRange from '/@/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue';
import { TimeRangeEnum } from '/@/components/chat/chatComponents/summaryCom/components/recordSet/components/types';
import { getOperateLog } from '/@/api/auth/log';
import { nextTick } from 'vue';
//#region ====================== è¡¨æ ¼æ•°æ®ï¼Œtable init ======================
const tableLoading = ref(false);
const tableData = ref([]);
const isDragStatus = ref(false);
//#endregion
//#region ====================== è¡¨æ ¼æŸ¥è¯¢ã€æŽ’序,search form init ======================
const queryParams = ref({
    timeRange: [],
    type: '',
    user: '',
});
const handleQueryTable = async () => {
    const res = await getOperateLog({
        start_time: queryParams.value.timeRange[0],
        end_time: queryParams.value.timeRange[1],
        type: queryParams.value.type,
        user: queryParams.value.user,
    });
    tableData.value = res?.values ?? [];
};
const debounceQueryTable = debounce(handleQueryTable, 400);
//#endregion
//#region ====================== æ·»åŠ ä¿®æ”¹æ“ä½œ ======================
const optDlgIsShow = ref(false);
const optDlgMapRow = ref(null);
const openOptDlg = (row?: any) => {
    optDlgMapRow.value = row;
    optDlgIsShow.value = true;
};
const updateOpt = (formValue) => {
    const foundIndex = tableData.value.findIndex((item) => item.user_id === formValue.user_id);
    if (foundIndex > -1) {
        tableData.value[foundIndex] = {
            ...tableData.value[foundIndex],
            ...formValue,
        };
    }
};
const insertOpt = (newData) => {
    tableData.value.push({ ...newData });
};
//#endregion
const deleteCurrentRow = (row: any) => {
    ElMessageBox.confirm(`确定删除用户:【${row.user_name}】?`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
    }).then(async () => {
        const res = await userApi.deleteUserInfoByPost({
            user_id: row.user_id,
        });
        const foundIndex = tableData.value.findIndex((item) => item === row);
        foundIndex > -1 && tableData.value.splice(foundIndex, 1);
        ElMessage.success('删除用户成功');
    });
};
//#region ====================== ä¿®æ”¹å¯†ç æ“ä½œ ======================
const optPasswordDlgIsShow = ref(false);
const optPasswordDlgMapRow = ref(null);
const openOptPasswordDlg = (row?: any) => {
    optPasswordDlgMapRow.value = row;
    optPasswordDlgIsShow.value = true;
};
const updatePasswordOpt = (formValue) => {
    const foundIndex = tableData.value.findIndex((item) => item.user_id === formValue.user_id);
    if (foundIndex > -1) {
        tableData.value[foundIndex] = {
            ...tableData.value[foundIndex],
            ...formValue,
        };
    }
};
//#endregion
//#region ====================== ä¿®æ”¹è§’色操作 ======================
const optRoleDlgIsShow = ref(false);
const optRoleDlgMapRow = ref(null);
const openOptRoleDlg = (row?: any) => {
    optRoleDlgMapRow.value = row;
    optRoleDlgIsShow.value = true;
};
const updateRoleOpt = (formValue) => {
    const foundIndex = tableData.value.findIndex((item) => item.user_id === formValue.user_id);
    if (foundIndex > -1) {
        tableData.value[foundIndex] = {
            ...tableData.value[foundIndex],
            ...formValue,
        };
    }
};
//#endregion
const roleList = ref([]);
const roleMap = computed(() => getItemMap(roleList.value, 'id'));
const getRoleList = async () => {
    const res = await getRoleInfoListByPost();
    roleList.value = res?.values ?? [];
};
onMounted(async () => {
    nextTick(() => {
        handleQueryTable();
    });
});
</script>
<style scoped lang="scss"></style>
src/views/project/yw/systemManage/userMgr/UserMgr.vue
@@ -23,7 +23,7 @@
                    highlight-current-row
                >
                    <el-table-column prop="user_name" label="用户名" width="120" fixed="left" show-overflow-tooltip> </el-table-column>
                    <el-table-column label="中文名" prop="real_name" width="90" show-overflow-tooltip> </el-table-column>
                    <el-table-column label="姓名" prop="real_name" width="90" show-overflow-tooltip> </el-table-column>
                    <el-table-column label="性别" prop="sex" width="70" show-overflow-tooltip> </el-table-column>
                    <el-table-column label="角色" prop="user_roles" width="250" show-overflow-tooltip>
                        <template #default="{ row }">
@@ -36,7 +36,7 @@
                    <el-table-column label="手机号" prop="phone" width="120" show-overflow-tooltip> </el-table-column>
                    <el-table-column label="邮件" prop="email" width="190" show-overflow-tooltip> </el-table-column>
                    <el-table-column label="创建时间" prop="create_time" width="105" show-overflow-tooltip> </el-table-column>
                    <el-table-column prop="note" label="说明" show-overflow-tooltip />
                    <el-table-column label="操作" width="180" fixed="right" show-overflow-tooltip>
@@ -117,6 +117,7 @@
        email: item.email,
        note: item.note,
        user_roles: item.roles,
        create_time: item.create_time?.slice(0, 10),
    }));
};
//#endregion
@@ -226,7 +227,6 @@
};
//#endregion
const roleList = ref([]);
const roleMap = computed(() => getItemMap(roleList.value, 'id'));
src/views/project/yw/systemManage/userMgr/optDlg/OptDlg.vue
@@ -85,6 +85,7 @@
import { userSexMap } from '../types';
import * as userApi from '/@/api/auth/user';
import { formatDate } from '/@/utils/formatTime';
const props = defineProps(['item', 'roleList']);
const emit = defineEmits(['update', 'insert']);
@@ -145,6 +146,7 @@
const submitFormValue = async () => {
    const valid = await dialogFormRef.value.validate().catch(() => {});
    if (!valid) return;
    const updateTime = formatDate(new Date());
    if (isEditDialog.value) {
        const res = await userApi.updateUserInfoByPost(dialogFormValue.value);
@@ -157,8 +159,9 @@
        const res = await userApi.addUserInfoByPost(sendForm);
        const newData = {
            id: res.user_id,
            user_id: res.user_id,
            ...dialogFormValue.value,
            create_time: updateTime.slice(0, 10),
        };
        emit('insert', newData);
        // tableData.value.push(newData);