Преглед на файлове

企业详情-企业用户账号状态更改

Xiao_123 преди 6 месеца
родител
ревизия
4370ec0770

+ 5 - 0
src/views/menduner/system/enterprise/message/details/components/job.vue

@@ -26,6 +26,11 @@
         <dict-tag :type="DICT_TYPE.MENDUNER_EXP_TYPE" :value="scope.row.expType" />
       </template>
     </el-table-column>
+    <el-table-column label="职位状态" align="center" prop="status">
+        <template #default="scope">
+          <dict-tag :type="DICT_TYPE.MENDUNER_STATUS" :value="scope.row.status" />
+        </template>
+      </el-table-column>
     <el-table-column label="刷新时间" align="center" prop="updateTime" width="180px">
       <template #default="scope">
         {{ timesTampChange(scope.row.updateTime, 'Y-M-D h:m') }}

+ 24 - 0
src/views/menduner/system/enterprise/message/details/components/user.vue

@@ -14,6 +14,11 @@
         {{ scope.row.userType === '1' ? '管理员': '普通用户' }}
       </template>
     </el-table-column>
+    <el-table-column label="帐号状态" align="center" prop="status">
+      <template #default="scope">
+        <dict-tag :type="DICT_TYPE.MENDUNER_STATUS" :value="scope.row.status" />
+      </template>
+    </el-table-column>
     <el-table-column label="最后登录IP" align="center" prop="loginIp" />
     <el-table-column
       label="最后登录时间"
@@ -29,6 +34,12 @@
       :formatter="dateFormatter"
       width="180px"
     />
+    <el-table-column label="操作" align="center">
+      <template #default="scope">
+        <el-button v-if="scope.row.status === '0'" link type="danger" @click="handleActions(scope.row.id, 'disabled')">禁用</el-button>
+        <el-button v-if="scope.row.status === '1'" link type="success" @click="handleActions(scope.row.id, 'enable')">启用</el-button>
+      </template>
+    </el-table-column>
   </el-table>
 
   <Pagination
@@ -44,11 +55,13 @@ defineOptions({ name: 'EnterpriseUserList'})
 import { EnterpriseApi } from '@/api/menduner/system/enterprise/message'
 import { DICT_TYPE } from '@/utils/dict'
 import { dateFormatter } from '@/utils/formatTime'
+import { EnterpriseUserBindApi } from '@/api/menduner/system/enterprise/userBind'
 
 const props = defineProps({
   id: String
 })
 
+const message = useMessage() // 消息弹窗
 const loading = ref(false)
 const tableData = ref([])
 const total = ref(0)
@@ -69,4 +82,15 @@ const getList = async () => {
   }
 }
 getList()
+
+// 禁用、启用账户
+const handleActions = async (id, type) => {
+  try {
+    await message.confirm(type === 'disabled' ? '确定要禁用该账户吗?' : '确定要启用该账户吗?')
+    type === 'disabled' ? await EnterpriseUserBindApi.disabledEnterpriseAccount(id) : await EnterpriseUserBindApi.enableEnterpriseAccount([id])
+    message.success('操作成功')
+    // 刷新列表
+    await getList()
+  } catch {}
+}
 </script>

+ 6 - 44
src/views/menduner/system/enterprise/userbind/index.vue

@@ -106,52 +106,14 @@
         </template>
       </el-table-column>
       <el-table-column label="最后登录IP" align="center" prop="loginIp" />
-      <el-table-column
-        label="最后登录时间"
-        align="center"
-        prop="loginDate"
-        :formatter="dateFormatter"
-        width="180px"
-      />
+      <el-table-column label="最后登录时间" align="center" prop="loginDate" :formatter="dateFormatter" width="180px" />
       <el-table-column label="操作" align="center">
         <template #default="scope">
-          <el-button
-            link
-            type="primary"
-            @click="openDetail(scope.row.id, scope.row.enterpriseId, scope.row.userId)"
-          >
-            详情
-          </el-button>
-          <el-button
-            link
-            type="primary"
-            @click="openEditEmail(scope.row.id)"
-          >
-            修改登录邮箱
-          </el-button>
-          <el-button
-            link
-            type="primary"
-            @click="openEditPassword(scope.row.id)"
-          >
-            修改登录密码
-          </el-button>
-          <el-button
-            v-if="scope.row.status === '0'"
-            link
-            type="danger"
-            @click="handleActions(scope.row.id, 'disabled')"
-          >
-            禁用
-          </el-button>
-          <el-button
-            v-if="scope.row.status === '1'"
-            link
-            type="success"
-            @click="handleActions(scope.row.id, 'enable')"
-          >
-            启用
-          </el-button>
+          <el-button link type="primary" @click="openDetail(scope.row.id, scope.row.enterpriseId, scope.row.userId)">详情</el-button>
+          <el-button link type="primary" @click="openEditEmail(scope.row.id)">修改登录邮箱</el-button>
+          <el-button link type="primary" @click="openEditPassword(scope.row.id)">修改登录密码</el-button>
+          <el-button v-if="scope.row.status === '0'" link type="danger" @click="handleActions(scope.row.id, 'disabled')">禁用</el-button>
+          <el-button v-if="scope.row.status === '1'" link type="success" @click="handleActions(scope.row.id, 'enable')">启用</el-button>
         </template>
       </el-table-column>
     </el-table>