更新
This commit is contained in:
@@ -47,3 +47,8 @@ export const getLogInfo = params => {
|
|||||||
{ params }
|
{ params }
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
export const apiPassWord = data => {
|
||||||
|
return http.request<Result>("post", "/adminapi/User/changePwd", {
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -6,8 +6,10 @@ import {
|
|||||||
addData,
|
addData,
|
||||||
editData,
|
editData,
|
||||||
deleteData,
|
deleteData,
|
||||||
getDataInfo
|
getDataInfo,
|
||||||
|
apiPassWord
|
||||||
} from "@/api/modules/admin";
|
} from "@/api/modules/admin";
|
||||||
|
import passwordForm from './password.vue';
|
||||||
import { addDialog } from "@/components/ReDialog";
|
import { addDialog } from "@/components/ReDialog";
|
||||||
export function useData() {
|
export function useData() {
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
@@ -142,6 +144,40 @@ export function useData() {
|
|||||||
onSearch();
|
onSearch();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const settingPassWord = (title, rowData) => {
|
||||||
|
addDialog({
|
||||||
|
title: title,
|
||||||
|
width: "40%",
|
||||||
|
props: {
|
||||||
|
formInline: {
|
||||||
|
new_pwd: ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
closeOnClickModal: false,
|
||||||
|
contentRenderer: () => h(passwordForm, { ref: formRef, formInline: null }),
|
||||||
|
beforeSure: (done, { options }) => {
|
||||||
|
const FormRef = formRef.value.getRef();
|
||||||
|
const curData = options.props.formInline;
|
||||||
|
const updatePassWord = async form => {
|
||||||
|
console.log(form)
|
||||||
|
const { code } = await apiPassWord(form);
|
||||||
|
if (code) {
|
||||||
|
message("设置成功", { type: "success" });
|
||||||
|
onSearch();
|
||||||
|
done();
|
||||||
|
} else {
|
||||||
|
message("设置失败", { type: "error" });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
FormRef.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
console.log("curData", curData.new_pwd);
|
||||||
|
updatePassWord({ new_pwd: curData.new_pwd, user_id: rowData.id })
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
onSearch,
|
onSearch,
|
||||||
isShow,
|
isShow,
|
||||||
@@ -152,6 +188,7 @@ export function useData() {
|
|||||||
handleCurrentChange,
|
handleCurrentChange,
|
||||||
loading,
|
loading,
|
||||||
openDialog,
|
openDialog,
|
||||||
handleDelete
|
handleDelete,
|
||||||
|
settingPassWord
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ const {
|
|||||||
handleCurrentChange,
|
handleCurrentChange,
|
||||||
openDialog,
|
openDialog,
|
||||||
loading,
|
loading,
|
||||||
|
settingPassWord,
|
||||||
handleDelete
|
handleDelete
|
||||||
} = useData();
|
} = useData();
|
||||||
defineOptions({
|
defineOptions({
|
||||||
@@ -44,6 +45,9 @@ onMounted(() => {
|
|||||||
color: 'var(--el-text-color-primary)'
|
color: 'var(--el-text-color-primary)'
|
||||||
}" @page-size-change="handleSizeChange" @page-current-change="handleCurrentChange">
|
}" @page-size-change="handleSizeChange" @page-current-change="handleCurrentChange">
|
||||||
<template #operation="{ row }">
|
<template #operation="{ row }">
|
||||||
|
<el-button link type="primary" :size="size" @click="settingPassWord('设置密码', row)">
|
||||||
|
设置密码
|
||||||
|
</el-button>
|
||||||
<el-button link type="primary" :size="size" @click="openDialog('编辑', row)">
|
<el-button link type="primary" :size="size" @click="openDialog('编辑', row)">
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|||||||
30
src/views/Admin/userList/password.vue
Normal file
30
src/views/Admin/userList/password.vue
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue";
|
||||||
|
const ruleFormRef = ref();
|
||||||
|
const formRules = ref({
|
||||||
|
new_pwd: [
|
||||||
|
{ required: true, message: "密码为必填项", trigger: "blur" }
|
||||||
|
]
|
||||||
|
});
|
||||||
|
const props = defineProps(["formInline"]);
|
||||||
|
const newFormInline = ref(
|
||||||
|
props.formInline
|
||||||
|
? props.formInline
|
||||||
|
: {
|
||||||
|
user_id: "",
|
||||||
|
new_pwd: ""
|
||||||
|
}
|
||||||
|
);
|
||||||
|
function getRef() {
|
||||||
|
return ruleFormRef.value;
|
||||||
|
}
|
||||||
|
defineExpose({ getRef });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<el-form ref="ruleFormRef" :model="newFormInline" :rules="formRules" label-width="120px">
|
||||||
|
<el-form-item label="设置新的密码" prop="new_pwd">
|
||||||
|
<el-input placeholder="请输入密码" v-model="newFormInline.new_pwd" show-password></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
@@ -30,7 +30,8 @@ onMounted(() => {
|
|||||||
<el-form ref="form" :model="formData" label-width="200px">
|
<el-form ref="form" :model="formData" label-width="200px">
|
||||||
<el-form-item :label="ele.key_name" v-for="ele in formLabel">
|
<el-form-item :label="ele.key_name" v-for="ele in formLabel">
|
||||||
<div style="width: 100%;display: inline-flex;">
|
<div style="width: 100%;display: inline-flex;">
|
||||||
<div style="width: 20%;"><el-input v-model="formData[ele.key_title]"></el-input></div>
|
<div style="width: 20%;"><el-input v-model="formData[ele.key_title]"
|
||||||
|
:show-password="item.id === 11"></el-input></div>
|
||||||
<div style="width: 70%; margin-left: 20px;color: #666;">{{ ele.key_desc }}</div>
|
<div style="width: 70%; margin-left: 20px;color: #666;">{{ ele.key_desc }}</div>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
Reference in New Issue
Block a user