Explorar o código

Merge remote-tracking branch 'origin/master'

houyaf %!s(int64=3) %!d(string=hai) anos
pai
achega
c1094f9ecc

+ 20 - 13
src/components/GroupSelector/index.vue

@@ -1,5 +1,10 @@
 <script lang="ts" setup name="GroupSelector">
 import { getGroupView } from '@/api/system/groupApi'
+const props = withDefaults(defineProps<{
+  modelValue: number
+}>(), {
+  modelValue: 0,
+})
 const emit = defineEmits(['update:modelValue'])
 interface TreeNode {
   id: number
@@ -14,33 +19,35 @@ const state = reactive({
   dataList: [] as TreeNode[],
 })
 
-const treeRef = ref()
-
 const getData = async () => {
   state.loading = true
   const { data } = await getGroupView()
   state.dataList = data
+  // 初始化第一个给tree
+  // emit('update:modelValue', data[0].groupId)
 }
 
-watch(() => state.groupId, (newValue) => {
-  emit('update:modelValue', newValue)
-})
-
-watch(() => 'modelValue', (newValue) => {
-  // emit('update:modelValue', newValue)
-  window.console.log(newValue)
+const groupId = computed({
+  get: () => {
+    return props.modelValue
+  },
+  set: (val) => {
+    emit('update:modelValue', val)
+  },
 })
-
 onMounted(() => {
   getData ()
-  treeRef.value.currentNodeKey = state.groupId
 })
+const selectProps = {
+  value: 'groupId',
+}
 </script>
 
 <template>
   <el-tree-select
-    ref="treeRef"
-    v-model="state.groupId"
+    v-model="groupId"
+    check-strictly
+    :props="selectProps"
     :data="state.dataList"
     style="width: 100%"
     filterable

+ 2 - 0
src/components/PositionSelector/index.vue

@@ -27,11 +27,13 @@ onMounted(() => {
 
 <template>
   <el-select v-model="state.positionId" v-loading="state.loading" style="width: 100%" filterable placeholder="请选择部门类别" value-key="positionId" @change="onChange">
+    <el-option key="-1" disabled value="0" label="请选择部门类别" />
     <el-option
       v-for="item in state.dataList"
       :key="item.positionId"
       :label="item.positionName"
       :value="item.positionId"
+      :disabled="item.positionId === 0"
     />
   </el-select>
 </template>

+ 26 - 2
src/store/modules/user.ts

@@ -47,9 +47,33 @@ const useUserStore = defineStore(
         })
       })
     }
-
+    interface USER {
+      ocId: string
+      grantGroupId: number
+      grantGroupName: string
+      groupId: number
+      groupName: string
+      mapId: number
+      ocAdminId: number
+      ocGroupId: number
+      ocName: string
+      ocTypeId: number
+      positionId: number
+      positionName: string
+      roleCode: number
+      roleId: number
+      roleName: string
+      roleTypeId: number
+      userAvatar: string
+      userId: number
+      userIntro: string
+      userName: string
+      userPhone: number
+      userPhoto: string
+      userRealName: string
+    }
     function getUserData() {
-      return userData
+      return userData as unknown as USER
     }
 
     // 登出

+ 1 - 2
src/views/system/group/components/User.vue

@@ -53,8 +53,6 @@ const state = reactive({
   actionType: 1,
 })
 
-onMounted(() => {})
-
 const getData = async (groupId: number, accountId: number) => {
   state.loading = true
   const { data } = await getUserById(groupId, accountId)
@@ -121,6 +119,7 @@ defineExpose({
   },
 
 })
+onMounted(() => {})
 </script>
 
 <template>

+ 3 - 0
src/views/system/group/index.vue

@@ -136,6 +136,7 @@ const onPasswordReset = (data?: any) => {
 
 // 修改状态
 const onChangeStatus = async (status: number, row: any) => {
+  alert(status)
   await updateUserStatus(row.accountId, status)
   ElMessage.success({
     message: '修改成功',
@@ -175,6 +176,8 @@ const onCommand = (command: string, row: any) => {
       break
   }
 }
+const getUserList = () => {}
+const getGroupList = () => {}
 </script>
 
 <template>