From e9060cf8f241536a896d69d0044769bd3b0e8d49 Mon Sep 17 00:00:00 2001 From: yangyin <1850366751@qq.com> Date: 星期五, 25 十月 2024 09:25:49 +0800 Subject: [PATCH] Merge branch 'test' of http://47.103.154.90:83/r/WI/Web.Admin.V1.0 into test --- src/api/auth/log.ts | 19 ++ vite.config.ts | 2 src/api/login/UserMenuData.ts | 4 src/views/project/yw/systemManage/roleMgr/RoleMgr.vue | 209 +++++++++++++++++++++++++ package-lock.json | 8 src/views/project/yw/systemManage/userMgr/UserMgr.vue | 35 ---- package.json | 2 src/views/project/yw/systemManage/accessLog/AccessLog.vue | 172 +++++++++++++++++++++ customer_list/yw/static/config/route.js | 2 src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue | 22 ++ 10 files changed, 425 insertions(+), 50 deletions(-) diff --git a/customer_list/yw/static/config/route.js b/customer_list/yw/static/config/route.js index e8b2885..8036c9a 100644 --- a/customer_list/yw/static/config/route.js +++ b/customer_list/yw/static/config/route.js @@ -17,7 +17,7 @@ name: 'AccessLog', isKeepAlive: true, isAffix: false, - path: '/authCenter/accessLog', + path: '/authCenter/operateLog', component: '/project/yw/systemManage/accessLog/AccessLog.vue', }, { diff --git a/package-lock.json b/package-lock.json index 172d23a..96130b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -78,7 +78,7 @@ "vite-plugin-compression": "^0.5.1", "vite-plugin-vue-setup-extend-plus": "^0.1.0", "vue-eslint-parser": "^9.1.0", - "yw-deploy-cli": "^1.0.3" + "yw-deploy-cli": "^1.0.4" }, "engines": { "node": ">=16.0.0", @@ -8545,9 +8545,9 @@ } }, "node_modules/yw-deploy-cli": { - "version": "1.0.3", - "resolved": "https://registry.npmmirror.com/yw-deploy-cli/-/yw-deploy-cli-1.0.3.tgz", - "integrity": "sha512-bRqCsyeSCvl9DQ8s3tIHtXVg/OMe0gShcv9OHTen5yRKDuvvNhugfmvpxK54PTck7FY3H4179ZocETw5qe8mTg==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/yw-deploy-cli/-/yw-deploy-cli-1.0.4.tgz", + "integrity": "sha512-B4Cd2+1KhejdebuQj66uNRMTrTAKfV4770wdwUp14WhAcCyeyed/+mSTOtFSw6MMTyqXfYGlq4h80tWDPhwVAg==", "dev": true, "dependencies": { "archiver": "^3.1.1", diff --git a/package.json b/package.json index a2c1e8a..59d8845 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "vite-plugin-compression": "^0.5.1", "vite-plugin-vue-setup-extend-plus": "^0.1.0", "vue-eslint-parser": "^9.1.0", - "yw-deploy-cli": "^1.0.3" + "yw-deploy-cli": "^1.0.4" }, "browserslist": [ "> 1%", diff --git a/src/api/auth/log.ts b/src/api/auth/log.ts new file mode 100644 index 0000000..0b8caad --- /dev/null +++ b/src/api/auth/log.ts @@ -0,0 +1,19 @@ +import request, { ExtraConfig } from '/@/utils/request'; + +/** + * @description 鑾峰彇鏃ュ織淇℃伅 + * @param {FormData} params + **/ +export const getOperateLog = ( + params, + + extraData: ExtraConfig = {} +) => + request({ + url: `/admin/log/get_operate_log`, + method: 'post', + params: {}, + data: params, + + ...extraData, + }); diff --git a/src/api/login/UserMenuData.ts b/src/api/login/UserMenuData.ts index ad3d41e..b924dd5 100644 --- a/src/api/login/UserMenuData.ts +++ b/src/api/login/UserMenuData.ts @@ -397,8 +397,8 @@ ID: '333-3', ParentID: '1742436890822447105', Type: 2, - Name: '璁块棶鏃ュ織', - Path: '/authCenter/accessLog', + Name: '鎿嶄綔鏃ュ織', + Path: '/authCenter/operateLog', Permission: '', Icon: 'ywifont ywicon-shujuguanli', IsIframe: false, diff --git a/src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue b/src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue index 96d24d5..74da627 100644 --- a/src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue +++ b/src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue @@ -47,7 +47,7 @@ <script setup lang="ts"> import { ElDatePicker } from 'element-plus'; import { definePropType } from 'element-plus/es/utils/vue/props/runtime'; -import { ref, type PropType, computed, watch, nextTick } from 'vue'; +import { ref, type PropType, computed, watch, nextTick, onMounted } from 'vue'; import type { TimeRangeParam } from '../types'; import type { TimeRangeEnum } from './types'; import { timeRangeEnumMapTitle, timeRangeEnumMapValue } from './types'; @@ -71,6 +71,11 @@ type: Boolean, default: false, }, + + quickActive: { + type: Number as PropType<TimeRangeEnum>, + required: false, + }, }); const dateValue = defineModel({ type: definePropType<[string, string]>(Array), @@ -91,11 +96,16 @@ quickPickValue.value = null; }; const quickPickValue = ref<TimeRangeEnum>(null); -const quickPickRangeClick = (val: TimeRangeEnum) => { - if (quickPickValue.value === val) return; +const pickQuickRange = (val: TimeRangeEnum) => { + if(val==undefined) return; quickPickValue.value = val; dateValue.value = timeRangeEnumMapValue[val]().map((item) => formatDate(item)) as [string, string]; +}; +const quickPickRangeClick = (val: TimeRangeEnum) => { + if (quickPickValue.value === val) return; + pickQuickRange(val); + dateChange(); }; @@ -121,6 +131,12 @@ dateChange(); }; +onMounted(() => { + if(props.quickActive !=null){ + pickQuickRange(props.quickActive); + } +}); + defineExpose({ formatDateValue: dateValue, }); diff --git a/src/views/project/yw/systemManage/accessLog/AccessLog.vue b/src/views/project/yw/systemManage/accessLog/AccessLog.vue index 940e3f3..1b015f7 100644 --- a/src/views/project/yw/systemManage/accessLog/AccessLog.vue +++ b/src/views/project/yw/systemManage/accessLog/AccessLog.vue @@ -1,6 +1,174 @@ <template> - <div>AccessLog</div> + <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"></script> +<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/roleMgr/RoleMgr.vue b/src/views/project/yw/systemManage/roleMgr/RoleMgr.vue index 7fdef45..7d97d16 100644 --- a/src/views/project/yw/systemManage/roleMgr/RoleMgr.vue +++ b/src/views/project/yw/systemManage/roleMgr/RoleMgr.vue @@ -1,6 +1,211 @@ <template> - <div>RoleMgr</div> + <HMContainer type="card"> + <template #header> + <el-form ref="queryFormRef" :inline="true" :model="queryParams"> + <el-form-item label="鍚嶇О" prop="title"> + <el-input v-model="queryParams.title" style="width: 226.4px" placeholder="鍚嶇О" clearable @input="debounceQueryTable" /> + </el-form-item> + + <!-- <el-form-item> + <el-button icon="ele-Plus" @click="openOptDlg()" type="primary"> 娣诲姞 </el-button> + </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="displayTableData" + highlight-current-row + > + <el-table-column prop="title" label="鍚嶇О" fixed="left" show-overflow-tooltip> </el-table-column> + <!-- <el-table-column label="瑙掕壊缂栫爜" prop="value" width="90" show-overflow-tooltip> </el-table-column> --> + + + <!-- <el-table-column label="鎿嶄綔" width="180" fixed="right" show-overflow-tooltip> + <template #default="scope"> + <div class="space-x-3 items-center flex"> + <el-tooltip effect="dark" content="缂栬緫" placement="top"> + <i class="ywifont ywicon-bianji !text-[15px] text-blue-400 cursor-pointer" @click="openOptDlg(scope.row)"></i> + </el-tooltip> + <el-tooltip effect="dark" content="淇敼瀵嗙爜" placement="top"> + <i + class="ywifont ywicon-mima !text-[15px] text-blue-400 cursor-pointer font-bold" + @click="openOptPasswordDlg(scope.row)" + ></i> + </el-tooltip> + <el-tooltip effect="dark" content="淇敼瑙掕壊" placement="top"> + <i + class="ywifont ywicon-jiaose !text-[15px] text-blue-400 cursor-pointer font-bold" + @click="openOptRoleDlg(scope.row)" + ></i> + </el-tooltip> + <el-tooltip effect="dark" content="鍒犻櫎" placement="top"> + <i class="ywifont ywicon-shanchu !text-[17px] text-red-400 cursor-pointer" @click="deleteCurrentRow(scope.row)"></i> + </el-tooltip> + </div> + </template> + </el-table-column> --> + </el-table> + </div> + </template> + + <!-- <OptDlg v-model="optDlgIsShow" :item="optDlgMapRow" @insert="insertOpt" @update="updateOpt" :roleList="roleList"></OptDlg> + <OptPasswordDlg + v-model="optPasswordDlgIsShow" + :item="optPasswordDlgMapRow" + @update="updatePasswordOpt" + :roleList="roleList" + ></OptPasswordDlg> + <OptRoleDlg v-model="optRoleDlgIsShow" :item="optRoleDlgMapRow" @update="updateRoleOpt" :roleList="roleList"></OptRoleDlg> --> + + <!-- <MetricPrompt v-model="infoDlgIsShow" :metricItem="infoDlgMapRow"></MetricPrompt> + <MetricName v-model="metricNameIsShow" :metricItem="metricNameMapRow"></MetricName> --> + </HMContainer> </template> -<script setup lang="ts"></script> +<script setup lang="ts"> +import { debounce, getItemMap } from '/@/utils/util'; + +import { onMounted, ref } from 'vue'; +import { usePageDisplay } from '/@/hooks/usePageDisplay'; +import { useQueryTable } from '/@/hooks/useQueryTable'; +// import { useTableSort } from '/@/hooks/useTableSort'; +// import { useValidateUniqueness } from '/@/hooks/useValidateUniqueness'; +import OptDlg from './optDlg/OptDlg.vue'; +import OptPasswordDlg from './optDlg/OptPasswordDlg.vue'; +import OptRoleDlg from './optDlg/OptRoleDlg.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'; + +//#region ====================== 琛ㄦ牸鏁版嵁锛宼able init ====================== +const tableLoading = ref(false); +const tableData = ref([]); +const isDragStatus = ref(false); +const getTableData = async () => { + const res = await getRoleInfoListByPost(); + + tableData.value = res?.values ?? []; +}; +//#endregion + +//#region ====================== 琛ㄦ牸鏌ヨ銆佹帓搴忥紝search form init ====================== + +const queryParams = ref({ + title: '', +}); +const { resetQuery, handleQueryTable, displayTableData } = useQueryTable(tableData, queryParams, () => { + displayTableData.value = tableData.value; +}); +const debounceQueryTable = debounce(handleQueryTable, 400); + +//#endregion + +//#region ====================== 鏌ヨ蹇嵎閿� ====================== +const queryFormRef = ref(null); +const pressEnterSearch = (ev: KeyboardEvent) => { + if (ev.key === 'Enter') { + handleQueryTable(); + } +}; +usePageDisplay( + () => { + queryFormRef.value?.$el?.addEventListener('keypress', pressEnterSearch); + }, + () => { + queryFormRef.value?.$el?.removeEventListener('keypress', pressEnterSearch); + } +); +//#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 + +onMounted(async () => { + getTableData(); +}); +</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 c418dc8..a81a862 100644 --- a/src/views/project/yw/systemManage/userMgr/UserMgr.vue +++ b/src/views/project/yw/systemManage/userMgr/UserMgr.vue @@ -7,8 +7,7 @@ </el-form-item> <el-form-item> - <el-button icon="ele-Refresh" @click="resetQuery">閲嶇疆 </el-button> - <el-button icon="ele-Plus" @click="openOptDlg()"> 娣诲姞 </el-button> + <el-button icon="ele-Plus" @click="openOptDlg()" type="primary"> 娣诲姞 </el-button> </el-form-item> </el-form> </template> @@ -228,38 +227,6 @@ //#endregion -//#region ====================== 鏀瑰彉鍙戝竷鐘舵�� ====================== -// const publishStatusChange = async (published: SupervisorPublished, id, index) => { -// const res = await updatePublishStatus( -// { -// id: id, -// publish: published, -// }, -// { -// loading: false, -// } -// ); -// const origin = published === SupervisorPublished.Y ? SupervisorPublished.N : SupervisorPublished.Y; -// const final = res.publish ?? origin; -// if (final === origin) { -// ElMessage.warning('鎿嶄綔澶辫触' + (res.fail_msg ? `锛�${res.fail_msg}` : '')); -// return; -// } - -// tableData.value[index].published = final; - -// published === SupervisorPublished.Y ? ElMessage.success('鍙戝竷鎴愬姛') : ElMessage.info('宸插彇娑堝彂甯�'); -// }; -//#endregion - -//#region ====================== 鏇存柊鍙戝竷鐘舵�� ====================== -// useUpdateData({ -// event: 'supervisor.publish', -// updateFun({ id, published }) { -// updatePublishedById(id, published); -// }, -// }); -//#endregion const roleList = ref([]); const roleMap = computed(() => getItemMap(roleList.value, 'id')); diff --git a/vite.config.ts b/vite.config.ts index 5b25f9d..91ced05 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -39,7 +39,7 @@ host: '0.0.0.0', port: env.VITE_PORT as unknown as number, open: JSON.parse(env.VITE_OPEN), - hmr: true, + hmr: false, proxy: { '/gitee': { target: 'https://gitee.com', -- Gitblit v1.9.3