Merge branch 'master' of https://gitea.zianxin.com/zianxin/pj_admin_cloud
build / task (16.x, npm, macOS-latest) (push) Canceled after 0s
build / task (16.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, npm, windows-latest) (push) Canceled after 0s
build / task (16.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (16.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (16.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (16.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, yarn, windows-latest) (push) Canceled after 0s
build / task (18.x, npm, macOS-latest) (push) Canceled after 0s
build / task (18.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, npm, windows-latest) (push) Canceled after 0s
build / task (18.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (18.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (18.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (18.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, yarn, windows-latest) (push) Canceled after 0s
build / task (20.x, npm, macOS-latest) (push) Canceled after 0s
build / task (20.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, npm, windows-latest) (push) Canceled after 0s
build / task (20.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (20.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (20.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (20.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, yarn, windows-latest) (push) Canceled after 0s
build / task (16.x, npm, macOS-latest) (push) Canceled after 0s
build / task (16.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, npm, windows-latest) (push) Canceled after 0s
build / task (16.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (16.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (16.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (16.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (16.x, yarn, windows-latest) (push) Canceled after 0s
build / task (18.x, npm, macOS-latest) (push) Canceled after 0s
build / task (18.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, npm, windows-latest) (push) Canceled after 0s
build / task (18.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (18.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (18.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (18.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (18.x, yarn, windows-latest) (push) Canceled after 0s
build / task (20.x, npm, macOS-latest) (push) Canceled after 0s
build / task (20.x, npm, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, npm, windows-latest) (push) Canceled after 0s
build / task (20.x, pnpm, macOS-latest) (push) Canceled after 0s
build / task (20.x, pnpm, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, pnpm, windows-latest) (push) Canceled after 0s
build / task (20.x, yarn, macOS-latest) (push) Canceled after 0s
build / task (20.x, yarn, ubuntu-latest) (push) Canceled after 0s
build / task (20.x, yarn, windows-latest) (push) Canceled after 0s
# Conflicts: # src/views/admin/system/user/index.vue
This commit is contained in:
commit
3e744b63f1
8 files changed
+508
-65
No files matched your search
@@ -21,7 +21,7 @@ VITE_ADMIN_PROXY_PATH = http://localhost:9999
|
||||
VITE_PWD_ENC_KEY='pigxpigxpigxpigx'
|
||||
|
||||
# OAUTH2 密码模式客户端信息
|
||||
VITE_OAUTH2_PASSWORD_CLIENT='pig:pig'
|
||||
VITE_OAUTH2_PASSWORD_CLIENT='pigaaa:pigbbb'
|
||||
|
||||
# OAUTH2 短信客户端信息
|
||||
VITE_OAUTH2_MOBILE_CLIENT='app:app'
|
||||
|
||||
@@ -47,8 +47,9 @@ export function refreshCache() {
|
||||
}
|
||||
|
||||
export function getDetails(obj: Object) {
|
||||
// 走需登录的查询接口;getClientDetailsById 仅服务间 Inner 调用,禁止前端匿名访问
|
||||
return request({
|
||||
url: '/admin/client/getClientDetailsById/' + obj,
|
||||
url: '/admin/client/' + obj,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
@@ -64,5 +65,8 @@ export function validateclientId(rule: any, value: any, callback: any, isEdit: b
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}).catch(() => {
|
||||
// 无权限或不存在时按不存在处理,避免误拦新增
|
||||
callback();
|
||||
});
|
||||
}
|
||||
@@ -169,3 +169,12 @@ export function getSimpleUserAll(params?: { name?: string; mobile?: string; user
|
||||
|
||||
/** 按原筛选条件提交后台分批导出。 */
|
||||
export const submitUserExport = (query: Record<string, unknown>) => submitExportTask("/admin/user/export-async", query)
|
||||
|
||||
/** 异步修复「密码=手机号」弱口令,返回任务进度(轮询 /admin/async-task/progress) */
|
||||
export const fixPhoneAsPassword = (password: string) => {
|
||||
return request({
|
||||
url: "/admin/user/fix-phone-as-password",
|
||||
method: "post",
|
||||
data: { password },
|
||||
})
|
||||
}
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
import request from '/@/utils/request'
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/thirdparty/zzdPhoneBind/page',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: '/thirdparty/zzdPhoneBind/' + id,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
/** 修正核验手机号 */
|
||||
export function updatePhone(obj: { id: string | number; verifiedPhone: string }) {
|
||||
return request({
|
||||
url: '/thirdparty/zzdPhoneBind/phone',
|
||||
method: 'put',
|
||||
data: obj,
|
||||
})
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item :label="$t('sysuser.password')" prop="password">
|
||||
<el-input clearable placeholder="请输入密码" type="password"
|
||||
<el-input clearable placeholder="字母+数字,至少8位" type="password"
|
||||
v-model="dataForm.password"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -170,11 +170,33 @@ const dataRules = ref({
|
||||
},
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: "密码不能为空", trigger: "blur" },
|
||||
{
|
||||
min: 6,
|
||||
max: 20,
|
||||
message: "用户密码长度必须介于 5 和 20 之间",
|
||||
validator: (_rule: any, value: any, callback: any) => {
|
||||
// 编辑时占位 ****** 不校验;新增或修改了明文密码则校验
|
||||
if (dataForm.userId && (!value || String(value).includes("******"))) {
|
||||
return callback()
|
||||
}
|
||||
if (!value) {
|
||||
return callback(new Error("密码不能为空"))
|
||||
}
|
||||
const pwd = String(value)
|
||||
if (pwd.length < 8) {
|
||||
return callback(new Error("密码长度不能少于8位"))
|
||||
}
|
||||
if (pwd.length > 20) {
|
||||
return callback(new Error("密码长度不能超过20位"))
|
||||
}
|
||||
if (!/[A-Za-z]/.test(pwd) || !/[0-9]/.test(pwd)) {
|
||||
return callback(new Error("密码必须同时包含字母和数字"))
|
||||
}
|
||||
if (dataForm.phone && pwd === String(dataForm.phone).trim()) {
|
||||
return callback(new Error("密码不能与手机号相同"))
|
||||
}
|
||||
if (dataForm.username && pwd.toLowerCase() === String(dataForm.username).trim().toLowerCase()) {
|
||||
return callback(new Error("密码不能与用户名相同"))
|
||||
}
|
||||
callback()
|
||||
},
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
|
||||
@@ -1,14 +1,28 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<DraggableDepTree ref="draggableDepTreeRef" placeholder="请输入部门名称" :show-expand="true"
|
||||
@getSelectNode="handleGetSelectNode" switch-inactive-text="包含" switch-active-text="不包含"
|
||||
:defaultTreeWidth="20" :nodeClickable="false">
|
||||
<DraggableDepTree
|
||||
ref="draggableDepTreeRef"
|
||||
placeholder="请输入部门名称"
|
||||
:show-expand="true"
|
||||
@getSelectNode="handleGetSelectNode"
|
||||
switch-inactive-text="包含"
|
||||
switch-active-text="不包含"
|
||||
:defaultTreeWidth="20"
|
||||
:nodeClickable="false"
|
||||
>
|
||||
<template #default>
|
||||
<el-row v-show="showSearch">
|
||||
<SearchPanel v-show="showSearch" ref="queryRef" :model="state.queryForm"
|
||||
:loading="Boolean(state.loading)" :search-text="$t('common.queryBtn')"
|
||||
:reset-text="$t('common.resetBtn')" @search="getDataList" @reset="resetQuery">
|
||||
<SearchPanel
|
||||
v-show="showSearch"
|
||||
ref="queryRef"
|
||||
:model="state.queryForm"
|
||||
:loading="Boolean(state.loading)"
|
||||
:search-text="$t('common.queryBtn')"
|
||||
:reset-text="$t('common.resetBtn')"
|
||||
@search="getDataList"
|
||||
@reset="resetQuery"
|
||||
>
|
||||
<el-form-item style="width: 250px" label="用户" prop="userId">
|
||||
<select-user v-model="state.queryForm.userId" clearable />
|
||||
</el-form-item>
|
||||
@@ -27,42 +41,76 @@
|
||||
<select-role v-model="state.queryForm.role" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 250px" label="编制情况" prop="staffingType">
|
||||
<dict-select v-model="state.queryForm.staffingType"
|
||||
dict-code="user_staffing_type" />
|
||||
<dict-select v-model="state.queryForm.staffingType" dict-code="user_staffing_type" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</SearchPanel>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button v-auth="'sys_user_add'" icon="folder-add" type="primary"
|
||||
@click="userDialogRef.openDialog()">新增</el-button>
|
||||
<el-button plain v-auth="'sys_user_export'" class="ml10" icon="upload-filled" type="primary"
|
||||
@click="excelUploadRef.show()">
|
||||
<el-button v-auth="'sys_user_add'" icon="folder-add" type="primary" @click="userDialogRef.openDialog()">新增</el-button>
|
||||
<el-button plain v-auth="'sys_user_export'" class="ml10" icon="upload-filled" type="primary" @click="excelUploadRef.show()">
|
||||
导入
|
||||
</el-button>
|
||||
<el-button plain v-auth="'sys_user_del'" :disabled="multiple" class="ml10" icon="Delete"
|
||||
type="primary" @click="handleDelete(selectObjs)">
|
||||
<el-button
|
||||
plain
|
||||
v-auth="'sys_user_del'"
|
||||
:disabled="multiple"
|
||||
class="ml10"
|
||||
icon="Delete"
|
||||
type="primary"
|
||||
@click="handleDelete(selectObjs)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button plain v-auth="'sys_user_del'" v-if="activeName == '1'" :disabled="multiple"
|
||||
class="ml10" icon="VideoPlay" type="primary" @click="doBatchDeal">
|
||||
<el-button
|
||||
plain
|
||||
v-auth="'sys_user_del'"
|
||||
v-if="activeName == '1'"
|
||||
:disabled="multiple"
|
||||
class="ml10"
|
||||
icon="VideoPlay"
|
||||
type="primary"
|
||||
@click="doBatchDeal"
|
||||
>
|
||||
审批
|
||||
</el-button>
|
||||
<el-button
|
||||
plain
|
||||
v-auth="'sys_user_edit'"
|
||||
class="ml10"
|
||||
icon="Key"
|
||||
type="warning"
|
||||
:loading="fixWeakPwdLoading"
|
||||
@click="openFixWeakPwdDialog"
|
||||
>
|
||||
修复弱口令
|
||||
</el-button>
|
||||
<div class="flex justify-between items-center">
|
||||
<el-tabs class="flex-1" v-model="activeName" @tab-click="handleClickTabItem">
|
||||
<el-tab-pane v-for="v in tabItems" :key="v.id" :label="v.label" :name="v.value" />
|
||||
</el-tabs>
|
||||
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'sys_user_export'"
|
||||
@exportExcel="exportExcel" @queryTable="getDataList" class="ml10"
|
||||
style="float: right" />
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'sys_user_export'"
|
||||
@exportExcel="exportExcel"
|
||||
@queryTable="getDataList"
|
||||
class="ml10"
|
||||
style="float: right"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table v-loading="state.loading" :data="state.dataList" @selection-change="handleSelectionChange"
|
||||
row-key="userId" border :cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle">
|
||||
<el-table
|
||||
v-loading="state.loading"
|
||||
:data="state.dataList"
|
||||
@selection-change="handleSelectionChange"
|
||||
row-key="userId"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
>
|
||||
<el-table-column :selectable="handleSelectable" type="selection" width="40" />
|
||||
<el-table-column label="#" type="index" width="60" fixed="left" />
|
||||
<el-table-column label="用户名" prop="username" fixed="left" show-overflow-tooltip />
|
||||
@@ -71,9 +119,13 @@
|
||||
<el-table-column label="部门" prop="deptName" show-overflow-tooltip min-width="150" />
|
||||
<el-table-column label="启用" show-overflow-tooltip min-width="150">
|
||||
<template #default="{ row }">
|
||||
<el-switch :disabled="!auth('sys_user_edit') || row.processStatus != '2'"
|
||||
v-model="row.lockFlag" @change="changeSwitch(row)" active-value="0"
|
||||
inactive-value="9"></el-switch>
|
||||
<el-switch
|
||||
:disabled="!auth('sys_user_edit') || row.processStatus != '2'"
|
||||
v-model="row.lockFlag"
|
||||
@change="changeSwitch(row)"
|
||||
active-value="0"
|
||||
inactive-value="9"
|
||||
></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="编制" min-width="80">
|
||||
@@ -83,8 +135,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="角色" show-overflow-tooltip min-width="150">
|
||||
<template #default="scope">
|
||||
<el-tag v-for="(item, index) in scope.row.roleList" :key="index"> {{ item.roleName
|
||||
}}</el-tag>
|
||||
<el-tag v-for="(item, index) in scope.row.roleList" :key="index"> {{ item.roleName }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="人脸">
|
||||
@@ -94,44 +145,68 @@
|
||||
</el-table-column>
|
||||
<el-table-column v-if="false" label="全局人脸" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-switch :disabled="!auth('userFace_sysUserFace_global_face')" v-if="row.isGlobalFace"
|
||||
v-model="row.isGlobalFace" @change="changeGlobalFaceSwitch(row)" active-value="1"
|
||||
inactive-value="0" />
|
||||
<el-switch
|
||||
:disabled="!auth('userFace_sysUserFace_global_face')"
|
||||
v-if="row.isGlobalFace"
|
||||
v-model="row.isGlobalFace"
|
||||
@change="changeGlobalFaceSwitch(row)"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="所属商户" prop="merchantName" show-overflow-tooltip min-width="150" />
|
||||
<el-table-column v-auths="['sys_user_edit', 'userFace_sysUserFace_view', 'sys_user_del']"
|
||||
label="操作" min-width="300" width="300" fixed="right">
|
||||
<el-table-column
|
||||
v-auths="['sys_user_edit', 'userFace_sysUserFace_view', 'sys_user_del']"
|
||||
label="操作"
|
||||
min-width="300"
|
||||
width="300"
|
||||
fixed="right"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center">
|
||||
<!-- 重置密码 -->
|
||||
<popover-input v-if="row.processStatus == '2'" v-model="inputPassword"
|
||||
@confirm="changePassword(row)">
|
||||
<popover-input v-if="row.processStatus == '2'" v-model="inputPassword" @confirm="changePassword(row)">
|
||||
<template #default>
|
||||
<el-button v-auth="'sys_user_edit'" icon="RefreshLeft" text type="primary"
|
||||
class="mr-4">密码</el-button>
|
||||
<el-button v-auth="'sys_user_edit'" icon="RefreshLeft" text type="primary" class="mr-4">密码</el-button>
|
||||
</template>
|
||||
</popover-input>
|
||||
<!-- 修改信息 -->
|
||||
<el-button v-if="row.processStatus == '2'" v-auth="'sys_user_edit'" icon="edit-pen"
|
||||
text type="primary" @click="userDialogRef.openDialog(row.userId)">
|
||||
<el-button
|
||||
v-if="row.processStatus == '2'"
|
||||
v-auth="'sys_user_edit'"
|
||||
icon="edit-pen"
|
||||
text
|
||||
type="primary"
|
||||
@click="userDialogRef.openDialog(row.userId)"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
<!-- 人脸管理 -->
|
||||
<el-button v-if="row.processStatus == '2'" v-auth="'userFace_sysUserFace_view'"
|
||||
icon="User" text type="primary" @click="faceManageRef.openDialog(row.userId)">
|
||||
<el-button
|
||||
v-if="row.processStatus == '2'"
|
||||
v-auth="'userFace_sysUserFace_view'"
|
||||
icon="User"
|
||||
text
|
||||
type="primary"
|
||||
@click="faceManageRef.openDialog(row.userId)"
|
||||
>
|
||||
人脸管理
|
||||
</el-button>
|
||||
<el-button v-if="row.processStatus == 1" type="primary" size="small" link
|
||||
icon="VideoPlay" @click="deal(row)">
|
||||
<el-button v-if="row.processStatus == 1" type="primary" size="small" link icon="VideoPlay" @click="deal(row)">
|
||||
开始处理
|
||||
</el-button>
|
||||
<!-- 删除用户 -->
|
||||
<el-tooltip content="admin 不允许被删除" :disabled="row.userId !== '1'" placement="top">
|
||||
<span style="margin-left: 12px">
|
||||
<el-button icon="delete" v-auth="'sys_user_del'"
|
||||
:disabled="row.username === 'admin'" text type="primary"
|
||||
@click="handleDelete([row.userId])">
|
||||
<el-button
|
||||
icon="delete"
|
||||
v-auth="'sys_user_del'"
|
||||
:disabled="row.username === 'admin'"
|
||||
text
|
||||
type="primary"
|
||||
@click="handleDelete([row.userId])"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</span>
|
||||
@@ -140,16 +215,20 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-bind="state.pagination" @current-change="currentChangeHandle"
|
||||
@size-change="sizeChangeHandle" />
|
||||
<pagination v-bind="state.pagination" @current-change="currentChangeHandle" @size-change="sizeChangeHandle" />
|
||||
</template>
|
||||
</DraggableDepTree>
|
||||
</div>
|
||||
|
||||
<user-form ref="userDialogRef" @refresh="getDataList(false)" :deptId="state.queryForm.deptId" />
|
||||
<face-manage ref="faceManageRef" @refresh="getDataList(false)" />
|
||||
<upload-excel ref="excelUploadRef" title="用户导入" temp-url="/admin/sys-file/local/file/user.xlsx"
|
||||
url="/admin/user/import-face" @refreshDataList="getDataList" />
|
||||
<upload-excel
|
||||
ref="excelUploadRef"
|
||||
title="用户导入"
|
||||
temp-url="/admin/sys-file/local/file/user.xlsx"
|
||||
url="/admin/user/import-face"
|
||||
@refreshDataList="getDataList"
|
||||
/>
|
||||
|
||||
<!-- 审批抽屉 -->
|
||||
<process-drawer ref="processDrawerRef" @task-submit-event="taskSubmitEvent" />
|
||||
@@ -157,8 +236,33 @@
|
||||
<!-- 批量审批对话框 -->
|
||||
<batch-deal ref="batchDealRef" @task-submit-event="taskSubmitEvent" />
|
||||
|
||||
<async-task-progress-component ref="exportProgressRef" :config="exportTaskConfig" @success="handleExportSuccess"
|
||||
@failure="handleExportFailure" />
|
||||
<!-- 修复弱口令:输入统一新密码 -->
|
||||
<el-dialog v-model="fixWeakPwdVisible" title="修复弱口令(密码=手机号)" width="480px" destroy-on-close>
|
||||
<el-alert type="warning" :closable="false" show-icon class="mb15" title="将后台异步扫描并重置所有「密码等于手机号」的账号;完成后可下载名单发公告。人多时请耐心等待进度。" />
|
||||
<el-form label-width="100px">
|
||||
<el-form-item label="统一新密码" required>
|
||||
<el-input v-model="fixWeakPwdForm.password" type="password" show-password placeholder="字母+数字,至少8位,且不能等于任何用户手机号/用户名" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="fixWeakPwdVisible = false">取消</el-button>
|
||||
<el-button type="warning" :loading="fixWeakPwdLoading" @click="submitFixWeakPwd">确认执行</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 修复结果名单(可复制发公告) -->
|
||||
<el-dialog v-model="fixWeakPwdResultVisible" title="弱口令修复结果" width="640px" destroy-on-close>
|
||||
<p class="mb10">{{ fixWeakPwdResultMessage }}</p>
|
||||
<el-input v-model="fixWeakPwdResultText" type="textarea" :rows="12" readonly placeholder="若名单未自动加载,请点「下载名单」打开 txt 后复制发公告" />
|
||||
<template #footer>
|
||||
<el-button v-if="fixWeakPwdResultFileUrl" type="primary" @click="downloadFixWeakPwdResult">下载名单</el-button>
|
||||
<el-button type="primary" :disabled="!fixWeakPwdResultText" @click="copyFixWeakPwdResult">复制名单</el-button>
|
||||
<el-button @click="fixWeakPwdResultVisible = false">关闭</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<async-task-progress-component ref="exportProgressRef" :config="exportTaskConfig" @success="handleExportSuccess" @failure="handleExportFailure" />
|
||||
<async-task-progress-component ref="fixWeakPwdProgressRef" :config="fixWeakPwdTaskConfig" @success="handleFixWeakPwdSuccess" @failure="handleFixWeakPwdFailure" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -166,8 +270,9 @@
|
||||
import AsyncTaskProgressComponent from "/@/components/AsyncTaskProgress.vue"
|
||||
import { useBatchExport } from "/@/hooks/batchExport"
|
||||
import { submitUserExport as submitBatchExport } from "/@/api/admin/user"
|
||||
import type { AsyncTaskPollingConfig, AsyncTaskProgress } from "/@/api/asyncTask"
|
||||
|
||||
import { delObj, pageList, putObj } from "/@/api/admin/user"
|
||||
import { delObj, pageList, putObj, fixPhoneAsPassword } from "/@/api/admin/user"
|
||||
import { putGlobalFace } from "/@/api/admin/userFace"
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
@@ -176,6 +281,8 @@ import { auth } from "/@/utils/authFunction"
|
||||
import { getDicts } from "/@/api/admin/dict"
|
||||
import ProcessDrawer from "/@/components/processDrawer/index.vue"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { downloadExportFile } from "/@/utils/exportDownload"
|
||||
import other from "/@/utils/other"
|
||||
|
||||
const UserForm = defineAsyncComponent(() => import("./form.vue"))
|
||||
const FaceManage = defineAsyncComponent(() => import("./face-manage.vue"))
|
||||
@@ -266,15 +373,15 @@ const taskSubmitEvent = () => {
|
||||
// 导出excel
|
||||
/** 当前页面只声明原导出场景,进度及重复提交由公共 hook 管理。 */
|
||||
const { exportProgressRef, exportTaskConfig, submitExport, handleExportSuccess, handleExportFailure } = useBatchExport({
|
||||
progressUrl: "/admin/async-task/progress", redisKey: "admin:export:user",
|
||||
taskName: "用户管理", fileName: "用户管理.xlsx", submitTask: submitBatchExport,
|
||||
progressUrl: "/admin/async-task/progress", redisKey: "admin:export:user",
|
||||
taskName: "用户管理", fileName: "用户管理.xlsx", submitTask: submitBatchExport,
|
||||
})
|
||||
|
||||
const exportExcel = () => {
|
||||
const query = { ...state.queryForm }
|
||||
// 保留原导出角色参数的转换规则及勾选元数据。
|
||||
query.role = query.role && !Array.isArray(query.role) ? [query.role] : []
|
||||
return submitExport({ ...query, ids: [...selectObjs.value] })
|
||||
const query = { ...state.queryForm }
|
||||
// 保留原导出角色参数的转换规则及勾选元数据。
|
||||
query.role = query.role && !Array.isArray(query.role) ? [query.role] : []
|
||||
return submitExport({ ...query, ids: [...selectObjs.value] })
|
||||
}
|
||||
|
||||
// 是否可以多选
|
||||
@@ -336,4 +443,110 @@ const changePassword = async (row: any) => {
|
||||
useMessage().success(t("common.optSuccessText"))
|
||||
getDataList()
|
||||
}
|
||||
|
||||
const fixWeakPwdVisible = ref(false)
|
||||
const fixWeakPwdLoading = ref(false)
|
||||
const fixWeakPwdForm = reactive({ password: "" })
|
||||
const fixWeakPwdResultVisible = ref(false)
|
||||
const fixWeakPwdResultMessage = ref("")
|
||||
const fixWeakPwdResultText = ref("")
|
||||
const fixWeakPwdResultFileUrl = ref("")
|
||||
const fixWeakPwdResultFileName = ref("弱口令修复名单.txt")
|
||||
const fixWeakPwdProgressRef = ref<InstanceType<typeof AsyncTaskProgressComponent>>()
|
||||
const fixWeakPwdTaskConfig: AsyncTaskPollingConfig = {
|
||||
progressUrl: "/admin/async-task/progress",
|
||||
redisKey: "admin:fix:phone-password",
|
||||
waitingMessage: "正在后台分页扫描用户密码,人多时可能较久,请勿关闭页面",
|
||||
downloadButtonText: "下载名单",
|
||||
pollTimeoutMs: 6 * 60 * 60 * 1000,
|
||||
}
|
||||
|
||||
const openFixWeakPwdDialog = () => {
|
||||
fixWeakPwdForm.password = ""
|
||||
fixWeakPwdVisible.value = true
|
||||
}
|
||||
|
||||
const resolveFileAbsoluteUrl = (fileUrl: string) => {
|
||||
if (!fileUrl) return ""
|
||||
if (/^https?:\/\//i.test(fileUrl)) return fileUrl
|
||||
return `${String(import.meta.env.VITE_API_URL || "").replace(/\/$/, "")}${other.adaptationUrl(fileUrl)}`
|
||||
}
|
||||
|
||||
const submitFixWeakPwd = async () => {
|
||||
const pwd = (fixWeakPwdForm.password || "").trim()
|
||||
if (!pwd || pwd.length < 8) {
|
||||
useMessage().error("新密码长度不能少于8位")
|
||||
return
|
||||
}
|
||||
if (!/[A-Za-z]/.test(pwd) || !/[0-9]/.test(pwd)) {
|
||||
useMessage().error("新密码必须同时包含字母和数字")
|
||||
return
|
||||
}
|
||||
try {
|
||||
await useMessageBox().confirm("确认将所有「密码=手机号」账号重置为该统一新密码?此操作不可撤销,将在后台异步执行。")
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
fixWeakPwdLoading.value = true
|
||||
fixWeakPwdProgressRef.value?.startSubmitting("修复弱口令")
|
||||
try {
|
||||
const { data } = await fixPhoneAsPassword(pwd)
|
||||
if (!data?.taskId) throw new Error("任务响应缺少任务 ID")
|
||||
fixWeakPwdVisible.value = false
|
||||
fixWeakPwdProgressRef.value?.start(data)
|
||||
} catch (err: any) {
|
||||
const message = err.msg || err.message || "修复任务提交失败"
|
||||
fixWeakPwdProgressRef.value?.submissionFailed(message)
|
||||
useMessage().error(message)
|
||||
} finally {
|
||||
fixWeakPwdLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleFixWeakPwdSuccess = async (progress: AsyncTaskProgress) => {
|
||||
fixWeakPwdResultMessage.value = progress.message || "修复完成"
|
||||
fixWeakPwdResultFileUrl.value = progress.resultFileUrl || ""
|
||||
fixWeakPwdResultFileName.value = progress.resultFileName || "弱口令修复名单.txt"
|
||||
fixWeakPwdResultText.value = ""
|
||||
if (progress.resultFileUrl) {
|
||||
try {
|
||||
downloadExportFile(progress.resultFileUrl, fixWeakPwdResultFileName.value)
|
||||
} catch {
|
||||
/* 下载失败仍展示结果弹窗 */
|
||||
}
|
||||
try {
|
||||
const abs = resolveFileAbsoluteUrl(progress.resultFileUrl)
|
||||
const resp = await fetch(abs)
|
||||
if (resp.ok) {
|
||||
fixWeakPwdResultText.value = await resp.text()
|
||||
}
|
||||
} catch {
|
||||
/* 跨域或鉴权失败时靠下载的 txt */
|
||||
}
|
||||
}
|
||||
fixWeakPwdResultVisible.value = true
|
||||
useMessage().success(progress.message || "修复完成")
|
||||
}
|
||||
|
||||
const handleFixWeakPwdFailure = (progress: AsyncTaskProgress) => {
|
||||
useMessage().error(progress.message || "修复弱口令失败")
|
||||
}
|
||||
|
||||
const downloadFixWeakPwdResult = () => {
|
||||
if (!fixWeakPwdResultFileUrl.value) return
|
||||
try {
|
||||
downloadExportFile(fixWeakPwdResultFileUrl.value, fixWeakPwdResultFileName.value)
|
||||
} catch (error: any) {
|
||||
useMessage().error(error?.message || "下载名单失败")
|
||||
}
|
||||
}
|
||||
|
||||
const copyFixWeakPwdResult = async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(fixWeakPwdResultText.value)
|
||||
useMessage().success("名单已复制")
|
||||
} catch {
|
||||
useMessage().error("复制失败,请手动全选复制或下载名单")
|
||||
}
|
||||
}
|
||||
</script>
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<el-dialog title="修改核验手机号" v-model="visible" :close-on-click-modal="false" width="480px" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="100px" v-loading="loading">
|
||||
<el-form-item label="姓名">
|
||||
<el-input :model-value="form.displayName" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="员工编码">
|
||||
<el-input :model-value="form.employeeCode" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="原手机号">
|
||||
<el-input :model-value="form.oldPhone" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="新手机号" prop="verifiedPhone">
|
||||
<el-input v-model="form.verifiedPhone" maxlength="11" placeholder="请输入正确的11位手机号" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" :disabled="loading" @click="onSubmit">确定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="zzdPhoneBindForm">
|
||||
import { useMessage } from '/@/hooks/message'
|
||||
import { updatePhone } from '/@/api/thirdparty/zzdPhoneBind'
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const dataFormRef = ref()
|
||||
|
||||
const form = reactive({
|
||||
id: '' as string | number,
|
||||
displayName: '',
|
||||
employeeCode: '',
|
||||
oldPhone: '',
|
||||
verifiedPhone: '',
|
||||
})
|
||||
|
||||
const dataRules = {
|
||||
verifiedPhone: [
|
||||
{ required: true, message: '请输入手机号', trigger: 'blur' },
|
||||
{ pattern: /^1\d{10}$/, message: '手机号格式不正确', trigger: 'blur' },
|
||||
],
|
||||
}
|
||||
|
||||
const openDialog = (row: any) => {
|
||||
visible.value = true
|
||||
form.id = row?.id
|
||||
form.displayName = row?.displayName || ''
|
||||
form.employeeCode = row?.employeeCode || ''
|
||||
form.oldPhone = row?.verifiedPhone || ''
|
||||
form.verifiedPhone = row?.verifiedPhone || ''
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.clearValidate()
|
||||
})
|
||||
}
|
||||
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value?.validate().catch(() => false)
|
||||
if (!valid) return
|
||||
if (form.verifiedPhone === form.oldPhone) {
|
||||
useMessage().warning('手机号未变更')
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
try {
|
||||
await updatePhone({ id: form.id, verifiedPhone: form.verifiedPhone })
|
||||
useMessage().success('手机号已更新')
|
||||
visible.value = false
|
||||
emit('refresh')
|
||||
} catch (err: any) {
|
||||
useMessage().error(err?.msg || err?.message || '更新失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({ openDialog })
|
||||
</script>
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row v-show="showSearch">
|
||||
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||
<el-form-item label="姓名" prop="name">
|
||||
<el-input v-model="state.queryForm.name" placeholder="名称模糊查询" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="verifiedPhone">
|
||||
<el-input v-model="state.queryForm.verifiedPhone" placeholder="核验手机号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="员工编码" prop="employeeCode">
|
||||
<el-input v-model="state.queryForm.employeeCode" placeholder="GE_…" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="getDataList">查询</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<right-toolbar v-model:showSearch="showSearch" class="ml10 mr20" style="float: right" @queryTable="getDataList" />
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@sort-change="sortChangeHandle"
|
||||
>
|
||||
<el-table-column type="index" label="#" width="50" />
|
||||
<el-table-column prop="displayName" label="姓名" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="verifiedPhone" label="核验手机号" width="130" show-overflow-tooltip />
|
||||
<el-table-column prop="employeeCode" label="员工编码" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="openId" label="openid" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column prop="updateTime" label="更新时间" width="170" show-overflow-tooltip />
|
||||
<el-table-column prop="createTime" label="创建时间" width="170" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
icon="edit-pen"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'thirdparty_zzdPhoneBind_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row)"
|
||||
>
|
||||
改手机号
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="thirdpartyZzdPhoneBind">
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table'
|
||||
import { fetchList } from '/@/api/thirdparty/zzdPhoneBind'
|
||||
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'))
|
||||
|
||||
const formDialogRef = ref()
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {
|
||||
name: '',
|
||||
verifiedPhone: '',
|
||||
employeeCode: '',
|
||||
},
|
||||
pageList: fetchList,
|
||||
})
|
||||
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, tableStyle } = useTable(state)
|
||||
|
||||
const resetQuery = () => {
|
||||
queryRef.value?.resetFields()
|
||||
getDataList()
|
||||
}
|
||||
</script>
|
||||
Reference in new issue
Block a user