|
|
@@ -58,7 +58,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="注册时间" align="center" prop="createTime" />
|
|
|
- <el-table-column label="操作" align="center" width="280">
|
|
|
+ <el-table-column label="操作" align="center" width="320">
|
|
|
<template #default="scope">
|
|
|
<el-tooltip content="修改" placement="top">
|
|
|
<el-button v-has-permi="['miniapp:user:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>
|
|
|
@@ -66,32 +66,38 @@
|
|
|
<el-tooltip content="删除" placement="top">
|
|
|
<el-button v-has-permi="['miniapp:user:remove']" link type="danger" icon="Delete" @click="handleDelete(scope.row)"></el-button>
|
|
|
</el-tooltip>
|
|
|
- <el-button
|
|
|
- v-if="scope.row.status === 0"
|
|
|
- v-has-permi="['miniapp:user:edit']"
|
|
|
- link
|
|
|
- type="danger"
|
|
|
+ <el-button
|
|
|
+ v-has-permi="['miniapp:user:edit']"
|
|
|
+ link
|
|
|
+ type="primary"
|
|
|
+ @click="handleChangePassword(scope.row)"
|
|
|
+ >修改密码</el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.status === 0"
|
|
|
+ v-has-permi="['miniapp:user:edit']"
|
|
|
+ link
|
|
|
+ type="danger"
|
|
|
@click="handleDisable(scope.row)"
|
|
|
>禁用</el-button>
|
|
|
- <el-button
|
|
|
- v-if="scope.row.status === 1"
|
|
|
- v-has-permi="['miniapp:user:edit']"
|
|
|
- link
|
|
|
- type="success"
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.status === 1"
|
|
|
+ v-has-permi="['miniapp:user:edit']"
|
|
|
+ link
|
|
|
+ type="success"
|
|
|
@click="handleEnable(scope.row)"
|
|
|
>启用</el-button>
|
|
|
- <el-button
|
|
|
- v-if="scope.row.status === 0"
|
|
|
- v-has-permi="['miniapp:user:edit']"
|
|
|
- link
|
|
|
- type="warning"
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.status === 0"
|
|
|
+ v-has-permi="['miniapp:user:edit']"
|
|
|
+ link
|
|
|
+ type="warning"
|
|
|
@click="handleSetAdmin(scope.row)"
|
|
|
>设为管理员</el-button>
|
|
|
- <el-button
|
|
|
- v-if="scope.row.status === 2"
|
|
|
- v-has-permi="['miniapp:user:edit']"
|
|
|
- link
|
|
|
- type="info"
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.status === 2"
|
|
|
+ v-has-permi="['miniapp:user:edit']"
|
|
|
+ link
|
|
|
+ type="info"
|
|
|
@click="handleCancelAdmin(scope.row)"
|
|
|
>取消管理员</el-button>
|
|
|
</template>
|
|
|
@@ -145,12 +151,25 @@
|
|
|
<el-button type="primary" @click="submitForm">确定</el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <!-- 修改密码对话框 -->
|
|
|
+ <el-dialog v-model="passwordDialog.visible" title="修改密码" width="400px" append-to-body>
|
|
|
+ <el-form ref="passwordFormRef" :model="passwordForm" :rules="passwordRules" label-width="80px">
|
|
|
+ <el-form-item label="新密码" prop="password">
|
|
|
+ <el-input v-model="passwordForm.password" type="password" placeholder="请输入新密码" show-password />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="passwordDialog.visible = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="submitPasswordForm">确定</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup name="MiniappUser" lang="ts">
|
|
|
import { ref, onMounted, getCurrentInstance, reactive } from 'vue';
|
|
|
-import { listMiniappUser, getMiniappUser, updateMiniappUser, delMiniappUser, changeUserStatus } from '@/api/miniapp/user';
|
|
|
+import { listMiniappUser, getMiniappUser, updateMiniappUser, delMiniappUser, changeUserStatus, changeUserPassword } from '@/api/miniapp/user';
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
|
@@ -166,6 +185,7 @@ const selectedRow = ref<any>({});
|
|
|
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
|
const formRef = ref<ElFormInstance>();
|
|
|
+const passwordFormRef = ref<ElFormInstance>();
|
|
|
|
|
|
const queryParams = ref({
|
|
|
pageNum: 1,
|
|
|
@@ -184,6 +204,10 @@ const formDialog = ref({
|
|
|
title: ''
|
|
|
});
|
|
|
|
|
|
+const passwordDialog = ref({
|
|
|
+ visible: false
|
|
|
+});
|
|
|
+
|
|
|
const form = ref<any>({
|
|
|
id: undefined,
|
|
|
nickname: '',
|
|
|
@@ -191,6 +215,11 @@ const form = ref<any>({
|
|
|
status: 0
|
|
|
});
|
|
|
|
|
|
+const passwordForm = ref<any>({
|
|
|
+ id: undefined,
|
|
|
+ password: ''
|
|
|
+});
|
|
|
+
|
|
|
const rules = reactive({
|
|
|
nickname: [{ required: true, message: '昵称不能为空', trigger: 'blur' }],
|
|
|
phone: [
|
|
|
@@ -200,6 +229,10 @@ const rules = reactive({
|
|
|
status: [{ required: true, message: '请选择状态', trigger: 'change' }]
|
|
|
});
|
|
|
|
|
|
+const passwordRules = reactive({
|
|
|
+ password: [{ required: true, message: '密码不能为空', trigger: 'blur' }]
|
|
|
+});
|
|
|
+
|
|
|
const currentUser = ref<any>({});
|
|
|
|
|
|
/** 查询用户列表 */
|
|
|
@@ -397,6 +430,24 @@ const handleExport = () => {
|
|
|
proxy?.download('miniapp/user/export', { ...queryParams.value }, `miniapp_user_${new Date().getTime()}.xlsx`);
|
|
|
};
|
|
|
|
|
|
+/** 修改密码按钮操作 */
|
|
|
+const handleChangePassword = (row: any) => {
|
|
|
+ passwordForm.value = {
|
|
|
+ id: row.id,
|
|
|
+ password: ''
|
|
|
+ };
|
|
|
+ passwordDialog.value.visible = true;
|
|
|
+};
|
|
|
+
|
|
|
+/** 提交密码表单 */
|
|
|
+const submitPasswordForm = async () => {
|
|
|
+ await passwordFormRef.value?.validate();
|
|
|
+ await changeUserPassword(passwordForm.value.id, passwordForm.value.password);
|
|
|
+ proxy?.$modal.msgSuccess('密码修改成功');
|
|
|
+ passwordDialog.value.visible = false;
|
|
|
+ passwordForm.value = { id: undefined, password: '' };
|
|
|
+};
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
getList();
|
|
|
});
|