Parcourir la source

feat: 用户增加职位

wanggaokun il y a 3 semaines
Parent
commit
9f2154884f

+ 5 - 5
src/api/interface/system/position.ts

@@ -22,11 +22,11 @@ export interface PositionVO extends BaseEntity {
  * 传入后端的表单信息
  */
 export interface PositionBO {
-  positionId: string
-  orgId: string
-  name: string
-  category: string
-  orderNum: number
+  positionId?: string
+  orgId?: string
+  name?: string
+  category?: string
+  orderNum?: number
   remark?: string
   status?: string
 }

+ 5 - 2
src/api/interface/system/user.ts

@@ -21,8 +21,10 @@ export interface UserQuery extends PageQuery {
  * 接收后端返回信息
  */
 export interface UserVO extends BaseEntity {
-  userId: string | number
-  orgId: string
+  userId: string
+  orgName: string
+  positionId: string
+  positionName: string
   account: string
   userName: string
   nickName: string
@@ -43,6 +45,7 @@ export interface UserVO extends BaseEntity {
 export interface UserBO {
   userId: string | number
   orgId: string
+  positionId: string
   account: string
   userName: string
   nickName: string

+ 16 - 1
src/views/system/user/components/UserDrawer.vue

@@ -20,7 +20,13 @@
           :render-after-expand="false"
           clearable
           :default-expand-all="true"
-          :props="treeProps" />
+          :props="treeProps"
+          @change="loadPosition" />
+      </el-form-item>
+      <el-form-item label="职位" prop="positionId">
+        <el-select v-model="drawerProps.row.positionId" placeholder="请选择职位">
+          <el-option v-for="item in positionData" :key="item.positionId" :label="item.name" :value="item.positionId" />
+        </el-select>
       </el-form-item>
       <el-form-item label="账号" prop="account">
         <el-input v-model="drawerProps.row.account" :disabled="drawerProps.title == '编辑'" placeholder="请填写账号" clearable />
@@ -69,10 +75,12 @@
 <script setup lang="ts" name="OrgForm">
 import { UserBO } from '@/api/interface/system/user'
 import OrgApi from '@/api/module/system/org'
+import PositionApi from '@/api/module/system/position'
 import { ResultEnum } from '@/enums/HttpEnum'
 import { FormInstance } from 'element-plus'
 import { useDictOptions } from '@/hooks'
 import { OrgTreeVO } from '@/api/interface/system/org'
+import { PositionVO } from '@/api/interface/system/position'
 
 const commonStatus = useDictOptions('COMMON_STATUS')
 const genders = useDictOptions('USER_GENDER')
@@ -92,6 +100,7 @@ interface EcoDrawerProps {
 }
 
 const treeData = ref<OrgTreeVO[]>([])
+const positionData = ref<PositionVO[]>([])
 const treeProps = {
   label: 'name',
   value: 'orgId'
@@ -112,6 +121,7 @@ const acceptParams = (params: EcoDrawerProps) => {
   drawerProps.value = params
   drawerVisible.value = true
   loadTree()
+  loadPosition()
   drawerProps.value.row.status = drawerProps.value.row.status || '1'
   drawerProps.value.row.userType = drawerProps.value.row.userType || 'pc_user'
 }
@@ -128,6 +138,11 @@ const loadTree = () => {
     ]
   })
 }
+const loadPosition = () => {
+  PositionApi.list({ orgId: drawerProps.value.row.orgId }).then(res => {
+    positionData.value = res.data
+  })
+}
 
 // 提交数据(新增/编辑)
 const ruleFormRef = ref<FormInstance>()

+ 3 - 1
vite.config.ts

@@ -81,7 +81,9 @@ export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => {
         'element-plus/es/components/radio-group/style/css',
         'element-plus/es/components/radio-button/style/css',
         'element-plus/es/components/input-number/style/css',
-        'element-plus/es/components/tree-select/style/css'
+        'element-plus/es/components/tree-select/style/css',
+        'element-plus/es/components/select/style/css',
+        'element-plus/es/components/option/style/css'
       ]
     }
   }