From a34acfc9181792e2c4a6fa113bd9e21780c5224d Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期五, 25 十月 2024 16:00:05 +0800
Subject: [PATCH] 后台修改

---
 src/views/project/yw/systemManage/userMgr/optDlg/OptDlg.vue |    5 +
 src/api/login/UserMenuData.ts                               |   22 ++++
 src/views/project/yw/systemManage/userMgr/UserMgr.vue       |    6 
 customer_list/yw/static/config/route.js                     |    7 +
 src/views/project/yw/systemManage/chatLog/ChatLog.vue       |  174 +++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 207 insertions(+), 7 deletions(-)

diff --git a/customer_list/yw/static/config/route.js b/customer_list/yw/static/config/route.js
index 8036c9a..27aa503 100644
--- a/customer_list/yw/static/config/route.js
+++ b/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,
diff --git a/src/api/login/UserMenuData.ts b/src/api/login/UserMenuData.ts
index f08878f..5a6e8ed 100644
--- a/src/api/login/UserMenuData.ts
+++ b/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,
diff --git a/src/views/project/yw/systemManage/chatLog/ChatLog.vue b/src/views/project/yw/systemManage/chatLog/ChatLog.vue
new file mode 100644
index 0000000..1b015f7
--- /dev/null
+++ b/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 ====================== 琛ㄦ牸鏁版嵁锛宼able 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>
diff --git a/src/views/project/yw/systemManage/userMgr/UserMgr.vue b/src/views/project/yw/systemManage/userMgr/UserMgr.vue
index a81a862..8607db2 100644
--- a/src/views/project/yw/systemManage/userMgr/UserMgr.vue
+++ b/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'));
diff --git a/src/views/project/yw/systemManage/userMgr/optDlg/OptDlg.vue b/src/views/project/yw/systemManage/userMgr/optDlg/OptDlg.vue
index 7a88ced..b2aa6e5 100644
--- a/src/views/project/yw/systemManage/userMgr/optDlg/OptDlg.vue
+++ b/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);

--
Gitblit v1.9.3