Bläddra i källkod

中康养新需求

lishuangjiang@potevio.com 1 år sedan
förälder
incheckning
f759f75261

+ 23 - 0
sso-module-system/sso-module-system-biz/src/main/java/com/poteviohealth/cgp/sso/module/system/controller/admin/dept/vo/dept/DeptUpdateStatusReqVO.java

@@ -0,0 +1,23 @@
+package com.poteviohealth.cgp.sso.module.system.controller.admin.dept.vo.dept;
+
+import com.poteviohealth.cgp.sso.framework.common.enums.CommonStatusEnum;
+import com.poteviohealth.cgp.sso.framework.common.validation.InEnum;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+@Schema(description = "管理后台 - 部门更新状态 Request VO")
+@Data
+public class DeptUpdateStatusReqVO {
+
+    @Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @NotNull(message = "角色编号不能为空")
+    private Long id;
+
+    @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    @NotNull(message = "状态不能为空")
+    @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
+    private Integer status;
+
+}

+ 10 - 0
sso-ui/sso-ui-admin-vue3/src/api/system/dept/index.ts

@@ -51,3 +51,13 @@ export const updateDept = async (params: DeptVO) => {
 export const deleteDept = async (id: number) => {
   return await request.delete({ url: '/system/dept/delete?id=' + id })
 }
+
+// 部门状态修改
+export const updateDeptStatus = (id: number | undefined, status: number) => {
+  const data = {
+    id,
+    status
+  }
+  return request.put({ url: '/system/dept/update-status', data: data })
+}
+

+ 2 - 1
sso-ui/sso-ui-admin-vue3/src/utils/dict.ts

@@ -107,7 +107,8 @@ export enum DICT_TYPE {
   SYNC_USER_STATUS = 'sync_user_status',
   TERMINAL = 'terminal', // 终端
   DATE_INTERVAL = 'date_interval', // 数据间隔
-
+  USER_ACCOUNT_STATUS = 'user_account_status',
+  ORG_STATUS = 'org_status',
   // ========== SYSTEM 模块 ==========
   SYSTEM_USER_SEX = 'system_user_sex',
   SYSTEM_MENU_TYPE = 'system_menu_type',

+ 8 - 3
sso-ui/sso-ui-admin-vue3/src/views/Home/index3.vue

@@ -128,7 +128,7 @@ const newPasswordValidate = (rule, value, callback) => {
   } else if (/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[._~!@#$^&*])[A-Za-z0-9._~!@#$^&*]{8,20}$/g.test(value)) {
     callback()
   } else {
-    callback(new Error('请输入包含英文字母大小写、数字和特殊符号的 8-20 位组合'))
+    callback(new Error('包含英文字母大小写、数字和特殊符号(8-20位)'))
   }
 }
 
@@ -167,7 +167,7 @@ const toProfile = async () => {
   push('/system/user')
 }
 
-const resetPassword = async () => {
+const resetPassword =  () => {
   dialogFormVisible.value = true
 }
 
@@ -200,6 +200,7 @@ const submit = (formEl: FormInstance | undefined) => {
     if (valid) {
       await updateUserPassword(passwordModel.oldPassword, passwordModel.newPassword)
       message.success(t('common.updateSuccess'))
+      authUtil.setLoginDate(new Date().getTime())
       formEl.resetFields()
       dialogFormVisible.value=false
     }
@@ -217,11 +218,15 @@ onMounted(() => {
     resetPassword()
   }
 })
-const handleClose = (done: () => void) => {
+const handleClose = (done) => {
   const loginDadte = authUtil.getLoginDate()
+  debugger
   if(!loginDadte){
     message.error('首次登录请修改密码!')
     return false
+  }else{
+    console.log(done)
+    done(false)
   }
 }
 </script>

+ 40 - 6
sso-ui/sso-ui-admin-vue3/src/views/system/dept/index.vue

@@ -24,7 +24,7 @@
           class="!w-240px"
         >
           <el-option
-            v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
+            v-for="dict in getIntDictOptions(DICT_TYPE.ORG_STATUS)"
             :key="dict.value"
             :label="dict.label"
             :value="dict.value"
@@ -75,7 +75,7 @@
       </el-table-column>
       <el-table-column prop="status" label="状态">
         <template #default="scope">
-          <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
+          <dict-tag :type="DICT_TYPE.ORG_STATUS" :value="scope.row.status" />
         </template>
       </el-table-column>
       <el-table-column
@@ -97,12 +97,30 @@
           </el-button>
           <el-button
             link
-            type="danger"
-            @click="handleDelete(scope.row.id)"
-            v-hasPermi="['system:dept:delete']"
+            type="primary"
+            @click="handleStatusChange(scope.row)"
+            v-hasPermi="['system:dept:update']"
+            v-if = "scope.row.status===1"
+          >
+            启用
+          </el-button>
+          <el-button
+            link
+            type="primary"
+            @click="handleStatusChange(scope.row)"
+            v-hasPermi="['system:dept:update']"
+            v-if = "scope.row.status===0"
           >
-            删除
+            停用
           </el-button>
+<!--          <el-button-->
+<!--            link-->
+<!--            type="danger"-->
+<!--            @click="handleDelete(scope.row.id)"-->
+<!--            v-hasPermi="['system:dept:delete']"-->
+<!--          >-->
+<!--            删除-->
+<!--          </el-button>-->
         </template>
       </el-table-column>
     </el-table>
@@ -118,6 +136,7 @@ import { handleTree } from '@/utils/tree'
 import * as DeptApi from '@/api/system/dept'
 import DeptForm from './DeptForm.vue'
 import * as UserApi from '@/api/system/user'
+import { CommonStatusEnum } from '@/utils/constants'
 
 defineOptions({ name: 'SystemDept' })
 
@@ -188,6 +207,21 @@ const handleDelete = async (id: number) => {
   } catch {}
 }
 
+/** 修改用户状态 */
+const handleStatusChange = async (row: DeptApi.DeptVO) => {
+  try {
+    const status = row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE : CommonStatusEnum.ENABLE
+    // 修改状态的二次确认
+    const text = row.status === CommonStatusEnum.ENABLE ? '启用' : '停用'
+    await message.confirm('确认要' + text + '"' + row.name + '"机构吗?')
+    // 发起修改状态
+    await DeptApi.updateDeptStatus(row.id, status)
+    // 刷新列表
+    await getList()
+  } catch {
+  }
+}
+
 /** 初始化 **/
 onMounted(async () => {
   await getList()

+ 2 - 2
sso-ui/sso-ui-admin-vue3/src/views/system/user/UserForm.vue

@@ -134,7 +134,7 @@ const formData = ref({
   email: '',
   id: undefined,
   username: '',
-  password: '',
+  password: 'Mm#123456789',
   sex: undefined,
   postIds: [],
   remark: '',
@@ -310,7 +310,7 @@ const resetForm = () => {
     email: '',
     id: undefined,
     username: '',
-    password: '',
+    password: 'Mm#123456789',
     sex: undefined,
     postIds: [],
     remark: '',

+ 7 - 7
sso-ui/sso-ui-admin-vue3/src/views/system/user/index.vue

@@ -176,12 +176,12 @@
                       >
                         <Icon icon="ep:search" />设置关系
                       </el-dropdown-item>
-                      <el-dropdown-item
-                        command="handleDelete"
-                        v-if="checkPermi(['system:user:delete'])"
-                      >
-                        <Icon icon="ep:delete" />删除
-                      </el-dropdown-item>
+<!--                      <el-dropdown-item-->
+<!--                        command="handleDelete"-->
+<!--                        v-if="checkPermi(['system:user:delete'])"-->
+<!--                      >-->
+<!--                        <Icon icon="ep:delete" />删除-->
+<!--                      </el-dropdown-item>-->
                       <el-dropdown-item
                         command="handleResetPwd"
                         v-if="checkPermi(['system:user:update-password'])"
@@ -304,7 +304,7 @@ const handleStatusChange = async (row: UserApi.UserVO) => {
   try {
     // 修改状态的二次确认
     const text = row.status === CommonStatusEnum.ENABLE ? '启用' : '停用'
-    await message.confirm('确认要"' + text + '""' + row.username + '"用户吗?')
+    await message.confirm('确认要' + text + '"' + row.nickname + '"用户吗?')
     // 发起修改状态
     await UserApi.updateUserStatus(row.id, row.status)
     // 刷新列表