Browse Source

修改用户管理

HuRongxin 6 days ago
parent
commit
32fa927f68

+ 1 - 1
.env.development

@@ -1,5 +1,5 @@
 # 页面标题
-VITE_APP_TITLE = 优易达-OMS订单管理系统
+VITE_APP_TITLE = 优易达-总控平台
 VITE_APP_LOGO_TITLE = RuoYi-Vue-Plus
 
 # 开发环境配置

+ 2 - 0
src/api/system/dept/types.ts

@@ -26,6 +26,7 @@ export interface DeptVO extends BaseEntity {
   delFlag: string;
   ancestors: string;
   menuId: string | number;
+  platformCode: string;
 }
 
 /**
@@ -57,4 +58,5 @@ export interface DeptForm {
   status?: string;
   delFlag?: string;
   ancestors?: string;
+  platformCode?: string;
 }

+ 3 - 2
src/api/system/user/types.ts

@@ -20,7 +20,8 @@ export interface UserQuery extends PageQuery {
   status?: string;
   deptId?: string | number;
   roleId?: string | number;
-  userIds?:  string | number | (string | number)[] | undefined;
+  platformCode?: string;
+  userIds?: string | number | (string | number)[] | undefined;
 }
 
 /**
@@ -68,7 +69,7 @@ export interface UserForm {
   postIds: string[];
   roleIds: string[];
   // 新增:所属平台(仅总控平台显示)
- platformCode: string;
+  platformCode: string;
 }
 
 export interface UserInfoVO {

+ 21 - 2
src/views/system/dept/index.vue

@@ -130,6 +130,16 @@
             </el-form-item>
           </el-col>
         </el-row>
+        <el-row>
+          <el-col :span="24">
+            <!-- 仅当是总控平台时显示 -->
+            <el-form-item v-if="isMainPlatform" label="所属平台" prop="platformCode">
+              <el-select v-model="form.platformCode" placeholder="请选择平台">
+                <el-option v-for="dict in sys_platform_code" :key="dict.value" :label="dict.label" :value="dict.value" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
       </el-form>
       <template #footer>
         <div class="dialog-footer">
@@ -146,6 +156,7 @@ import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild }
 import { DeptForm, DeptQuery, DeptVO } from '@/api/system/dept/types';
 import { UserVO } from '@/api/system/user/types';
 import { listUserByDeptId } from '@/api/system/user';
+import { getPlatformCode } from '@/utils/platform';
 
 interface DeptOptionsType {
   deptId: number | string;
@@ -154,7 +165,7 @@ interface DeptOptionsType {
 }
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
-const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
+const { sys_normal_disable, sys_platform_code } = toRefs<any>(proxy?.useDict('sys_normal_disable', 'sys_platform_code'));
 
 const deptList = ref<DeptVO[]>([]);
 const loading = ref(true);
@@ -162,6 +173,8 @@ const showSearch = ref(true);
 const deptOptions = ref<DeptOptionsType[]>([]);
 const isExpandAll = ref(true);
 const deptUserList = ref<UserVO[]>([]);
+const currentPlatform = getPlatformCode();
+const isMainPlatform = computed(() => currentPlatform === 'main');
 
 const dialog = reactive<DialogOption>({
   visible: false,
@@ -181,7 +194,8 @@ const initFormData: DeptForm = {
   leader: undefined,
   phone: undefined,
   email: undefined,
-  status: '0'
+  status: '0',
+  platformCode: ''
 };
 const initData: PageData<DeptForm, DeptQuery> = {
   form: { ...initFormData },
@@ -196,6 +210,7 @@ const initData: PageData<DeptForm, DeptQuery> = {
     parentId: [{ required: true, message: '上级部门不能为空', trigger: 'blur' }],
     deptName: [{ required: true, message: '部门名称不能为空', trigger: 'blur' }],
     orderNum: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }],
+    platformCode: [{ required: true, message: '所属平台不能为空', trigger: 'blur' }],
     email: [{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }],
     phone: [{ pattern: /^1[3456789][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' }]
   }
@@ -267,6 +282,10 @@ const handleAdd = async (row?: DeptVO) => {
     if (row && row.deptId) {
       form.value.parentId = row?.deptId;
     }
+    if (row && row.platformCode) {
+      form.value.platformCode = row?.platformCode;
+    }
+    console.log(row);
     dialog.visible = true;
     dialog.title = '添加部门';
   }

+ 3 - 2
src/views/system/role/index.vue

@@ -390,14 +390,15 @@ const handleAdd = () => {
 };
 /** 修改角色 */
 const handleUpdate = async (row?: RoleVO) => {
+  console.log(row);
   reset();
   const roleId = row?.roleId || ids.value[0];
   const { data } = await getRole(roleId);
   Object.assign(form.value, data);
   form.value.roleSort = Number(form.value.roleSort);
   // 使用角色数据中的平台代码
-  if (data.platformCode) {
-    currentPlatform.value = data.platformCode;
+  if (row.platformCode) {
+    currentPlatform.value = row.platformCode;
   }
   const res = await getRoleMenuTreeselect(roleId, currentPlatform.value);
   dialog.title = '修改角色';

+ 1 - 1
src/views/system/user/index.vue

@@ -364,7 +364,7 @@ const userFormRef = ref<ElFormInstance>();
 const uploadRef = ref<ElUploadInstance>();
 const formDialogRef = ref<ElDialogInstance>();
 
-const currentPlatform = getPlatformCode(); // 示例
+const currentPlatform = getPlatformCode(); //当前平台
 const isMainPlatform = computed(() => currentPlatform === 'main');
 
 const dialog = reactive<DialogOption>({