Kaynağa Gözat

功能调整

houyaf 3 yıl önce
ebeveyn
işleme
416ddb088e

+ 5 - 4
src/settings.ts

@@ -5,9 +5,10 @@ const globalSettings: Settings.all = {
   base: {
     // 服务API地址
     serverUrl: 'http://192.168.1.214:8080', // 正式环境
-    devServerUrl: 'http://1.15.92.205:8080/', // 开发环境
+    // devServerUrl: 'http://1.15.92.205:8080/', // 开发环境
     // devServerUrl: 'http://113.141.88.27:8000', // 开发环境
     // devServerUrl: 'http://192.168.3.253:8000',
+    devServerUrl: 'http://127.0.0.1:8000',
     /**
      * websocket 地址
      * dev 开发环境
@@ -85,9 +86,9 @@ const globalSettings: Settings.all = {
   },
   copyright: {
     enable: true,
-    dates: '2020-2023',
-    company: 'Fantastic-admin',
-    website: 'https://hooray.gitee.io/fantastic-admin/',
+    dates: '2018-2023',
+    company: '智慧云创',
+    website: 'xazhyc.com',
     beian: '',
   },
 }

+ 5 - 1
src/store/modules/user.ts

@@ -48,6 +48,10 @@ const useUserStore = defineStore(
       })
     }
 
+    function getUserData() {
+      return userData
+    }
+
     // 登出
     async function logout() {
       await signOut()
@@ -85,7 +89,7 @@ const useUserStore = defineStore(
 
     return {
       account,
-      userData,
+      getUserData,
       token,
       permissions,
       isLogin,

+ 14 - 6
src/types/system.d.ts

@@ -4,11 +4,19 @@ export type UserLoginType = {
 }
 
 export type UserType = {
+  ocId: number
+  ocName: string
+  userId: number
   username: string
-  password: string
-  role: string
-  roleId: string
-  permissions: string | string[]
-  accessToken: string
-  user: object
+  userAvatar: string
+  userIntro: string
+  userPhoto: string
+  userPhone: string
+  userRealName: string
+  positionId: number
+  positionName: string
+  groupId: number
+  groupName: string
+  grantGroupId: number
+  grantGroupName: string
 }

+ 2 - 2
src/utils/composables/usePagination.ts

@@ -12,12 +12,12 @@ export default function usePagination() {
   function getParams(params = {}) {
     const baseParams: {
       [key: string]: any
-      from: number
+      page: number
       limit: number
       sort?: string
       order?: string
     } = {
-      from: (pagination.value.page - 1) * pagination.value.size,
+      page: pagination.value.page <= 1 ? 1 : pagination.value.page - 1,
       limit: pagination.value.size,
     }
     if (pagination.value.sort && pagination.value.order) {

+ 52 - 13
src/views/app_center/apps/index.vue

@@ -3,40 +3,79 @@ meta:
   enabled: false
 </route>
 
+<script lang="ts" setup>
+import App from './components/App.vue'
+import { getAppByList } from '@/api/apps/appApi'
+
+const state = reactive({
+  title: '',
+  dialogVisible: false,
+  loading: false,
+  dataList: {},
+  actionType: 1,
+})
+
+const getData = async () => {
+  state.loading = true
+  const { data } = await getAppByList({})
+  state.loading = false
+  state.dataList = data
+}
+
+onMounted(() => {
+  getData()
+})
+
+const appRef = ref()
+
+const onAppEdit = (data: any) => {
+  const appId = data.appId
+  appRef.value.showEditModel(appId)
+}
+
+const onAppPermit = (data: any) => {
+
+}
+</script>
+
 <template>
   <div>
-    <page-header title="应用中心" content="便捷管理应用软件或应用服务" />
+    <page-header title="应用中心">
+      <template #content>
+        <div>
+          便捷管理应用软件或应用服务
+        </div>
+      </template>
+    </page-header>
+
     <el-row :gutter="20" style="margin: 0 10px;">
-      <el-col v-for="(item, index) in 12" :key="index" :lg="6" :md="8" :sm="12">
+      <el-col v-for="(item, index) in state.dataList" :key="index" :lg="6" :md="8" :sm="12">
         <el-card shadow="hover" class="action-card">
           <div class="content">
             <div class="item">
-              <el-avatar size="default">
-                <el-icon>
-                  <svg-icon name="i-ep:user-filled" />
-                </el-icon>
-              </el-avatar>
+              <img src="item.appLogo" style="width: 80%;">
             </div>
             <div class="item">
               <div class="name">
-                Hooray
+                {{ item.appTitle }}
               </div>
               <div class="intro">
-                前端开发工程师,10年+开发经验,可开发 Web / H5 / 小程序 等应用。前端开发工程师,10年+开发经验,可开发 Web / H5 / 小程序 等应用
+                {{ item.appDesc }}
               </div>
             </div>
           </div>
           <div class="action-bar">
-            <el-button text>
-              操作一
+            <el-button text @click="onAppEdit(item)">
+              编辑
             </el-button>
-            <el-button text>
-              操作二
+            <el-button text @click="onAppPermit(item)">
+              权限配置
             </el-button>
           </div>
         </el-card>
       </el-col>
     </el-row>
+    <App ref="appRef" @success="getDataList" />
   </div>
 </template>
 

+ 8 - 4
src/views/daas/model/index.vue

@@ -215,11 +215,15 @@ const onEntityDelete = (row: any) => {
           </tool-bar>
 
           <el-table ref="entityTableRef" v-loading="state.loading" class="list-table" :data="state.entityList" border stripe highlight-current-row height="100%">
-            <el-table-column type="index" label="序号" width="50" header-align="center" align="center" />
-            <el-table-column prop="entityTitle" label="名称" header-align="center" align="center" />
-            <el-table-column prop="entityCode" label="编码" />
+            <el-table-column type="index" label="序号" header-align="center" align="center" width="70" />
+
+            <el-table-column prop="entityTitle" label="名称" header-align="center" align="center" width="200" />
+
+            <el-table-column prop="entityCode" label="编码" header-align="center" align="center" width="150" />
+
             <el-table-column prop="entityComment" label="说明" header-align="center" align="left" />
-            <el-table-column label="操作" width="200" align="center">
+
+            <el-table-column label="操作" header-align="center" align="center" width="200">
               <template #default="scope">
                 <el-button type="primary" size="small" plain @click="onEntityEdit(scope.row)">
                   编辑

+ 5 - 1
src/views/system/group/components/Group.vue

@@ -27,6 +27,7 @@ const state = reactive({
   formData: {
     groupId: 0,
     groupName: '',
+    parentId: 0,
     parentName: '',
     groupDesc: '',
     groupCatId: 0,
@@ -73,17 +74,20 @@ function resetFormData() {
     groupId: 0,
     groupName: '',
     groupDesc: '',
+    parentId: 0,
     parentName: '',
     groupCatId: 0,
   }
 }
 
 defineExpose({
-  showAddModel() {
+  showAddModel(parentId: number, parentName: string) {
     resetFormData()
     state.title = '新增部门'
     state.actionType = 1
     state.dialogVisible = true
+    state.formData.parentId = parentId
+    state.formData.parentName = parentName
   },
   showEditModel(groupId: number) {
     resetFormData()

+ 5 - 3
src/views/system/group/components/User.vue

@@ -48,6 +48,7 @@ const state = reactive({
     accountPhone: '', // 手机号
     positionId: 0, // 岗位,
     accountIntro: '',
+    isFixed: 0,
   },
   actionType: 1,
 })
@@ -100,19 +101,20 @@ function resetFormData() {
     accountPhone: '', // 手机号
     positionId: 0, // 岗位,
     accountIntro: '',
+    isFixed: 0,
   }
 }
 
 defineExpose({
   showAddModel() {
     resetFormData()
-    state.title = '新增部门'
+    state.title = '新增账号'
     state.actionType = 1
     state.dialogVisible = true
   },
   showEditModel(groupId: number, accountId: number) {
     resetFormData()
-    state.title = '编辑部门'
+    state.title = '编辑账号'
     state.actionType = 2
     state.dialogVisible = true
     getData(groupId, accountId)
@@ -135,7 +137,7 @@ defineExpose({
           </el-form-item>
 
           <el-form-item label="密码">
-            <span style="color: #eeeeee">初始化密码为 888888</span>
+            <span style="color: #eee">初始化密码为 888888</span>
           </el-form-item>
 
           <el-form-item label="姓名" prop="accountRealName">

+ 115 - 57
src/views/system/group/index.vue

@@ -4,20 +4,22 @@ import type Node from 'element-plus/es/components/tree/src/model/node'
 import Group from './components/Group.vue'
 import User from './components/User.vue'
 import { deleteGroupById, getGroupByList } from '@/api/system/groupApi'
-import { getUserByPage } from '@/api/system/userApi'
+import { deleteUserById, getUserByPage, resetPassword, updateUserStatus } from '@/api/system/userApi'
 import { packageTreeData } from '@/utils/tool'
+import useUserStore from '@/store/modules/user'
+
+const userStore = useUserStore()
 const { pagination, getParams, onSizeChange, onCurrentChange } = usePagination()
+const userData = userStore.getUserData()
 
 interface TreeNode {
   label: string
-  isLeaf: boolean
   groupId: number
   children?: TreeNode[]
 }
 
 const state = reactive({
   loading: false,
-  keywords: '',
   curGroupId: 0,
   groups: [] as TreeNode[],
   userList: [],
@@ -26,26 +28,15 @@ const state = reactive({
   },
 })
 
-const menu = ref([])
-const getGroupList = async () => {
-  const { data } = await getGroupByList()
+const groupTreeRef = ref()
 
-  menu.value = packageTreeData({
-    data,
-    id: 'groupId',
-  })
-  if (data && data.length > 0) {
-    state.curGroupId = data[0].groupId
-    const res = await getUserByPage({ groupId: state.curGroupId })
-    state.userList = res.data
-  }
-}
-
-const getUserList = async () => {
+// 查询帐号列表
+const getUserData = async () => {
   const params = getParams()
   const curGroupId = state.curGroupId
   if (curGroupId > 0) {
     params.groupId = curGroupId
+    params.keywords = state.search.keywords
     state.loading = true
     const { data } = await getUserByPage(params)
     state.loading = false
@@ -54,77 +45,137 @@ const getUserList = async () => {
   }
 }
 
+// 查询部门数据
+const getGroupData = async () => {
+  const { data } = await getGroupByList()
+
+  state.groups = packageTreeData({
+    data,
+    id: 'groupId',
+  })
+  if (data && data.length > 0) {
+    state.curGroupId = data[0].groupId
+    await getUserData()
+  }
+}
+
+onMounted(() => {
+  getGroupData()
+})
+
 // 每页数量切换
 function sizeChange(size: number) {
-  onSizeChange(size).then(() => getUserList())
+  onSizeChange(size).then(() => getUserData())
 }
 
 // 当前页码切换(翻页)
 function currentChange(page = 1) {
-  onCurrentChange(page).then(() => getUserList())
+  onCurrentChange(page).then(() => getUserData())
 }
 
+// 部门点击
 const onTreeNodeClick = (node: TreeNode) => {
-  if (node.isLeaf) {
-    state.curGroupId = node.groupId
-    getUserList()
-  }
+  state.curGroupId = node.groupId
+  getUserData()
 }
 
 const groupRef = ref()
+
+// 新增部门
 const onGroupAdd = (data: any) => {
-  groupRef.value.showAddModel(data)
+  const { groupId, groupName } = data
+  groupRef.value.showAddModel(groupId, groupName)
 }
 
+// 编辑部门
 const onGroupEdit = (data?: any) => {
-  groupRef.value.showAddModel(data)
+  const { groupId } = data
+  groupRef.value.showEditModel(groupId)
 }
+
+// 删除部门
 const onGroupDelete = (node: Node, data: any) => {
   ElMessageBox.confirm(`确认删除「${data.label}」吗?`, '确认信息').then(async () => {
     await deleteGroupById(data.groupId)
-    await getGroupList()
+    await getGroupData()
     ElMessage.success({
       message: '删除成功',
       center: true,
     })
-  })
+  }).catch(() => {})
 }
 
+const accountTableRef = ref()
+const userRef = ref()
+
+// 查询
 const onSearch = () => {
-  getUserList()
+  getUserData()
 }
 
-const accountTableRef = ref()
+// 新增账号
+const onUserAdd = () => {
+  userRef.value.showAddModel()
+}
 
-const onChangeStatus = (row: any) => {
-  window.console.log(row)
+// 修改账号
+const onUserEdit = (row: any) => {
+  userRef.value.showEditModel(row.groupId, row.accountId)
 }
+
+// 密码重置
+const onPasswordReset = (data?: any) => {
+  ElMessageBox.confirm('温馨提示:系统默认重置密码为 888888?', '确认').then(async () => {
+    await resetPassword(data.accountId)
+    ElMessage.success({
+      message: '密码重置成功',
+      center: true,
+    })
+  }).catch(() => {})
+}
+
+// 修改状态
+const onChangeStatus = async (row: any) => {
+  const status = row.status === 1 ? 0 : 1
+  await updateUserStatus(row.accountId, status)
+  ElMessage.success({
+    message: '修改成功',
+    center: true,
+  })
+}
+
+// 删除用户账号
+const onUserDelete = (row: any) => {
+  ElMessageBox.confirm('温馨提示:系统默认重置密码为 888888?', '确认').then(async () => {
+    await deleteUserById(row.accountId)
+    ElMessage.success({
+      message: '删除',
+      center: true,
+    })
+  }).catch(() => {})
+}
+
+// "更多"处理
 const onCommand = (command: string, row: any) => {
   switch (command) {
     case 'GrantGroupAdd':
       window.console.log(row)
       break
+
     case 'GrantGroupEdit':
       break
+
     case 'GrantGroupDelete':
       break
+
     case 'ResetPwd':
+      onPasswordReset(row)
       break
+
     case 'Permit':
       break
   }
 }
-const userRef = ref('userRef')
-const onUserEdit = (row: any) => {
-  window.console.log(row)
-}
-const onUserDelete = (row: any) => {
-  window.console.log(row)
-}
-
-onMounted(() => {
-  getGroupList()
-})
 </script>
 
 <template>
@@ -134,13 +185,10 @@ onMounted(() => {
       <LayoutContainer left-side-width="300px" hide-left-side-toggle>
         <template #leftSide>
           <el-scrollbar class="tree">
-            <ElTree ref="menuRef" :data="menu" default-expand-all @node-click="onTreeNodeClick">
+            <ElTree ref="groupTreeRef" :data="state.groups" :current-node-key="state.curGroupId" default-expand-all @node-click="onTreeNodeClick">
               <template #default="{ node, data }">
                 <div class="custom-tree-node">
                   <div class="label" :title="node.label">
-                    <el-icon v-if="data.isLeaf" size="16px" style="margin-right: 5px;">
-                      <svg-icon name="uim:box" />
-                    </el-icon>
                     <div class="text">
                       {{ data.groupName }}
                     </div>
@@ -154,6 +202,7 @@ onMounted(() => {
                           </el-icon>
                         </template>
                       </el-button>
+
                       <el-button type="info" plain size="small" @click.stop="onGroupEdit(data)">
                         <template #icon>
                           <el-icon>
@@ -161,7 +210,8 @@ onMounted(() => {
                           </el-icon>
                         </template>
                       </el-button>
-                      <el-button type="danger" plain size="small" @click.stop="onGroupDelete(node, data)">
+
+                      <el-button v-if="data.groupId !== userData.ocId" type="danger" plain size="small" @click.stop="onGroupDelete(node, data)">
                         <template #icon>
                           <el-icon>
                             <svg-icon name="i-ep:delete" />
@@ -178,6 +228,10 @@ onMounted(() => {
 
         <div class="container">
           <tool-bar>
+            <template #left>
+              <span />
+            </template>
+
             <template #right>
               <el-input v-model="state.search.keywords" placeholder="请输入名称,支持模糊查询" style="padding-right: 10px;" clearable />
               <el-button type="primary" @click="onSearch">
@@ -187,13 +241,17 @@ onMounted(() => {
                   </el-icon>
                 </template>
               </el-button>
+
+              <el-button type="primary" @click="onUserAdd">
+                新增用户
+              </el-button>
             </template>
           </tool-bar>
 
           <el-table ref="accountTableRef" v-loading="state.loading" class="list-table" :data="state.userList" border stripe highlight-current-row>
-            <el-table-column type="index" align="center" label="序号" width="70" />
+            <el-table-column type="index" align="center" label="序号" width="60" />
 
-            <el-table-column align="center" header-align="center" label="头像" width="100">
+            <el-table-column align="center" header-align="center" label="头像" width="60">
               <template #default="{ row }">
                 <el-avatar :size="30" :src="row.accountAvatar" />
               </template>
@@ -205,19 +263,19 @@ onMounted(() => {
               </template>
             </el-table-column>
 
-            <el-table-column align="center" width="100" label="姓名">
+            <el-table-column align="center" width="90" label="姓名">
               <template #default="{ row }">
                 <span>{{ row.accountRealName }}</span>
               </template>
             </el-table-column>
 
-            <el-table-column align="center" width="100" label="工号">
+            <el-table-column align="center" width="80" label="工号">
               <template #default="{ row }">
                 <span>{{ row.accountStaffNo }}</span>
               </template>
             </el-table-column>
 
-            <el-table-column align="center" width="120" label="联系方式">
+            <el-table-column align="center" width="125" label="联系方式">
               <template #default="{ row }">
                 <span>{{ row.accountPhone }}</span>
               </template>
@@ -235,7 +293,7 @@ onMounted(() => {
               </template>
             </el-table-column>
 
-            <el-table-column align="center" label="状态" width="140">
+            <el-table-column align="center" label="状态" width="80">
               <template #default="scope">
                 <div v-if="scope.row.isFixed !== 1">
                   <el-switch v-model="scope.row.status" :loading="scope.row.loading" inline-prompt active-text="启用" inactive-text="禁用" @before-change="() => onChangeStatus(scope.row)" />
@@ -243,9 +301,9 @@ onMounted(() => {
               </template>
             </el-table-column>
 
-            <el-table-column label="操作" header-align="center" align="center" width="310">
+            <el-table-column label="操作" header-align="center" align="center" width="220">
               <template #default="scope">
-                <el-button size="small" @click="onUserEdit(scope.row)">
+                <el-button size="small" type="primary" @click="onUserEdit(scope.row)">
                   修改
                 </el-button>
                 <el-button v-if="scope.row.isFixed !== 1" size="small" type="danger" @click="onUserDelete(scope.row)">
@@ -253,7 +311,7 @@ onMounted(() => {
                 </el-button>
                 <el-dropdown v-if="scope.row.isFixed !== 1" @command="onCommand($event, scope.row)">
                   <el-button size="small">
-                    更多操作
+                    更多
                     <el-icon class="el-icon--right">
                       <svg-icon name="i-ep:arrow-down" />
                     </el-icon>

+ 0 - 1
src/views/system/role/components/Role.vue

@@ -87,7 +87,6 @@ defineExpose({
     state.dialogVisible = true
     getData(roleId)
   },
-
 })
 </script>