|
@@ -50,12 +50,14 @@
|
|
|
</el-tag>
|
|
</el-tag>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120">
|
|
|
|
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<el-button v-hasPermi="['employee:employee:auth']" link type="success"
|
|
<el-button v-hasPermi="['employee:employee:auth']" link type="success"
|
|
|
@click="handleAuth(scope.row)">授权</el-button>
|
|
@click="handleAuth(scope.row)">授权</el-button>
|
|
|
<el-button v-hasPermi="['employee:employee:query']" link type="primary"
|
|
<el-button v-hasPermi="['employee:employee:query']" link type="primary"
|
|
|
@click="handleDetail(scope.row)">详情</el-button>
|
|
@click="handleDetail(scope.row)">详情</el-button>
|
|
|
|
|
+ <el-button v-hasPermi="['employee:employee:resetPassword']" link type="warning"
|
|
|
|
|
+ @click="handleResetPwd(scope.row)">重置密码</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
@@ -178,7 +180,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup name="Customer" lang="ts">
|
|
<script setup name="Customer" lang="ts">
|
|
|
-import { listEmployee, addEmployee, getEmployeeDetail, authEmployee, changeEmployeeStatus } from '@/api/system/employee';
|
|
|
|
|
|
|
+import { listEmployee, addEmployee, getEmployeeDetail, authEmployee, changeEmployeeStatus, adminResetPassword } from '@/api/system/employee';
|
|
|
import { EmployeeVO, EmployeeQuery, EmployeeForm, ErpClientBriefVO } from '@/api/system/employee/types';
|
|
import { EmployeeVO, EmployeeQuery, EmployeeForm, ErpClientBriefVO } from '@/api/system/employee/types';
|
|
|
import { searchErpClient, getErpClientByIds } from '@/api/erp/client';
|
|
import { searchErpClient, getErpClientByIds } from '@/api/erp/client';
|
|
|
import { ErpClientVO } from '@/api/erp/client/types';
|
|
import { ErpClientVO } from '@/api/erp/client/types';
|
|
@@ -303,7 +305,7 @@ const handleStatusChange = async (row: EmployeeVO & { _statusActive: boolean; _s
|
|
|
const newStatus = row._statusActive ? '1' : '0';
|
|
const newStatus = row._statusActive ? '1' : '0';
|
|
|
try {
|
|
try {
|
|
|
row._statusLoading = true;
|
|
row._statusLoading = true;
|
|
|
- await changeEmployeeStatus(row.id, newStatus);
|
|
|
|
|
|
|
+ await changeEmployeeStatus({ id: row.id, status: newStatus });
|
|
|
proxy?.$modal.msgSuccess(newStatus === '1' ? '已启用' : '已禁用');
|
|
proxy?.$modal.msgSuccess(newStatus === '1' ? '已启用' : '已禁用');
|
|
|
} catch (e: any) {
|
|
} catch (e: any) {
|
|
|
// 失败回滚状态
|
|
// 失败回滚状态
|
|
@@ -364,7 +366,7 @@ const confirmAuth = async () => {
|
|
|
buttonLoading.value = true;
|
|
buttonLoading.value = true;
|
|
|
try {
|
|
try {
|
|
|
const authClientFRowIDs = selectedAuthClients.value.map(c => c.rowId).join(',');
|
|
const authClientFRowIDs = selectedAuthClients.value.map(c => c.rowId).join(',');
|
|
|
- await authEmployee(authDialog.employeeId!, authClientFRowIDs);
|
|
|
|
|
|
|
+ await authEmployee({ id: authDialog.employeeId!, authClientFRowIDs });
|
|
|
proxy?.$modal.msgSuccess('授权成功');
|
|
proxy?.$modal.msgSuccess('授权成功');
|
|
|
authDialog.visible = false;
|
|
authDialog.visible = false;
|
|
|
getList();
|
|
getList();
|
|
@@ -390,6 +392,18 @@ const handleDetail = async (row: EmployeeVO) => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+/** 重置员工密码 */
|
|
|
|
|
+const handleResetPwd = (row: EmployeeVO) => {
|
|
|
|
|
+ proxy?.$modal.confirm(`确认将员工「${row.name}」的密码重置为 123456?`).then(async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ await adminResetPassword({ id: row.id });
|
|
|
|
|
+ proxy?.$modal.msgSuccess('密码已重置为 123456');
|
|
|
|
|
+ } catch (e: any) {
|
|
|
|
|
+ proxy?.$modal.msgError(e?.msg || '重置密码失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(() => { });
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
/** 新增按钮操作 */
|
|
/** 新增按钮操作 */
|
|
|
const handleAdd = () => {
|
|
const handleAdd = () => {
|
|
|
resetAddForm();
|
|
resetAddForm();
|