用户管理密码设置优化
This commit is contained in:
@@ -4,7 +4,7 @@ import { request } from '/@/utils/service';
|
|||||||
import * as api from './api';
|
import * as api from './api';
|
||||||
import { dictionary } from '/@/utils/dictionary';
|
import { dictionary } from '/@/utils/dictionary';
|
||||||
import { successMessage } from '/@/utils/message';
|
import { successMessage } from '/@/utils/message';
|
||||||
import {auth} from "/@/utils/authFunction";
|
import { auth } from "/@/utils/authFunction";
|
||||||
|
|
||||||
export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
const pageRequest = async (query: UserPageQuery) => {
|
const pageRequest = async (query: UserPageQuery) => {
|
||||||
@@ -100,10 +100,7 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|||||||
placement: 'top',
|
placement: 'top',
|
||||||
content: '重设密码',
|
content: '重设密码',
|
||||||
},
|
},
|
||||||
click: (ctx: any) => {
|
click: (ctx: any) => context?.handleResetPwdOpen(ctx.row),
|
||||||
const { row } = ctx;
|
|
||||||
context?.handleResetPwdOpen(row);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -185,10 +182,10 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|||||||
// value: vm.systemConfig('base.default_password'),
|
// value: vm.systemConfig('base.default_password'),
|
||||||
},
|
},
|
||||||
/* valueResolve(row, key) {
|
/* valueResolve(row, key) {
|
||||||
if (row.password) {
|
if (row.password) {
|
||||||
row.password = vm.$md5(row.password)
|
row.password = vm.$md5(row.password)
|
||||||
}
|
}
|
||||||
} */
|
} */
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
title: '姓名',
|
title: '姓名',
|
||||||
@@ -221,7 +218,7 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|||||||
}),
|
}),
|
||||||
column: {
|
column: {
|
||||||
minWidth: 200, //最小列宽
|
minWidth: 200, //最小列宽
|
||||||
formatter({value,row,index}){
|
formatter({ value, row, index }) {
|
||||||
return row.dept_name_all
|
return row.dept_name_all
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -263,8 +260,8 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|||||||
}),
|
}),
|
||||||
column: {
|
column: {
|
||||||
minWidth: 200, //最小列宽
|
minWidth: 200, //最小列宽
|
||||||
formatter({value,row,index}){
|
formatter({ value, row, index }) {
|
||||||
const values = row.role_info.map((item:any) => item.name);
|
const values = row.role_info.map((item: any) => item.name);
|
||||||
return values.join(',')
|
return values.join(',')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -389,8 +386,8 @@ export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOp
|
|||||||
form: {
|
form: {
|
||||||
show: false,
|
show: false,
|
||||||
},
|
},
|
||||||
column:{
|
column: {
|
||||||
width:150,
|
width: 150,
|
||||||
showOverflowTooltip: true,
|
showOverflowTooltip: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,27 +9,28 @@ import {
|
|||||||
CreateCrudOptionsProps,
|
CreateCrudOptionsProps,
|
||||||
CreateCrudOptionsRet
|
CreateCrudOptionsRet
|
||||||
} from '@fast-crud/fast-crud';
|
} from '@fast-crud/fast-crud';
|
||||||
import {request} from '/@/utils/service';
|
import { request } from '/@/utils/service';
|
||||||
import {dictionary} from '/@/utils/dictionary';
|
import { dictionary } from '/@/utils/dictionary';
|
||||||
import {successMessage} from '/@/utils/message';
|
import { successMessage } from '/@/utils/message';
|
||||||
import {auth} from '/@/utils/authFunction';
|
import { auth } from '/@/utils/authFunction';
|
||||||
import {SystemConfigStore} from "/@/stores/systemConfig";
|
import { SystemConfigStore } from "/@/stores/systemConfig";
|
||||||
import {storeToRefs} from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import {computed} from "vue";
|
import { computed } from "vue";
|
||||||
import { Md5 } from 'ts-md5';
|
import { Md5 } from 'ts-md5';
|
||||||
import {commonCrudConfig} from "/@/utils/commonCrud";
|
import { commonCrudConfig } from "/@/utils/commonCrud";
|
||||||
export const createCrudOptions = function ({crudExpose}: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
import { ElMessageBox } from 'element-plus';
|
||||||
|
export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
const pageRequest = async (query: UserPageQuery) => {
|
const pageRequest = async (query: UserPageQuery) => {
|
||||||
return await api.GetList(query);
|
return await api.GetList(query);
|
||||||
};
|
};
|
||||||
const editRequest = async ({form, row}: EditReq) => {
|
const editRequest = async ({ form, row }: EditReq) => {
|
||||||
form.id = row.id;
|
form.id = row.id;
|
||||||
return await api.UpdateObj(form);
|
return await api.UpdateObj(form);
|
||||||
};
|
};
|
||||||
const delRequest = async ({row}: DelReq) => {
|
const delRequest = async ({ row }: DelReq) => {
|
||||||
return await api.DelObj(row.id);
|
return await api.DelObj(row.id);
|
||||||
};
|
};
|
||||||
const addRequest = async ({form}: AddReq) => {
|
const addRequest = async ({ form }: AddReq) => {
|
||||||
return await api.AddObj(form);
|
return await api.AddObj(form);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -37,13 +38,13 @@ export const createCrudOptions = function ({crudExpose}: CreateCrudOptionsProps)
|
|||||||
return await api.exportData(query)
|
return await api.exportData(query)
|
||||||
}
|
}
|
||||||
|
|
||||||
const resetToDefaultPasswordRequest = async (row:EditReq)=>{
|
const resetToDefaultPasswordRequest = async (row: EditReq) => {
|
||||||
await api.resetToDefaultPassword(row.id)
|
await api.resetToDefaultPassword(row.id)
|
||||||
successMessage("重置密码成功")
|
successMessage("重置密码成功")
|
||||||
}
|
}
|
||||||
|
|
||||||
const systemConfigStore = SystemConfigStore()
|
const systemConfigStore = SystemConfigStore()
|
||||||
const {systemConfig} = storeToRefs(systemConfigStore)
|
const { systemConfig } = storeToRefs(systemConfigStore)
|
||||||
const getSystemConfig = computed(() => {
|
const getSystemConfig = computed(() => {
|
||||||
// console.log(systemConfig.value)
|
// console.log(systemConfig.value)
|
||||||
return systemConfig.value
|
return systemConfig.value
|
||||||
@@ -79,9 +80,10 @@ export const createCrudOptions = function ({crudExpose}: CreateCrudOptionsProps)
|
|||||||
text: "导出",//按钮文字
|
text: "导出",//按钮文字
|
||||||
title: "导出",//鼠标停留显示的信息
|
title: "导出",//鼠标停留显示的信息
|
||||||
show: auth('user:Export'),
|
show: auth('user:Export'),
|
||||||
click() {
|
click: (ctx: any) => ElMessageBox.confirm(
|
||||||
return exportRequest(crudExpose!.getSearchFormData())
|
'确定重设密码吗?', '提示',
|
||||||
}
|
{ confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }
|
||||||
|
).then(() => resetToDefaultPasswordRequest(ctx.row))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -113,7 +115,7 @@ export const createCrudOptions = function ({crudExpose}: CreateCrudOptionsProps)
|
|||||||
},
|
},
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
click: (ctx: any) => {
|
click: (ctx: any) => {
|
||||||
const {row} = ctx;
|
const { row } = ctx;
|
||||||
resetToDefaultPasswordRequest(row)
|
resetToDefaultPasswordRequest(row)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -122,7 +124,7 @@ export const createCrudOptions = function ({crudExpose}: CreateCrudOptionsProps)
|
|||||||
columns: {
|
columns: {
|
||||||
_index: {
|
_index: {
|
||||||
title: '序号',
|
title: '序号',
|
||||||
form: {show: false},
|
form: { show: false },
|
||||||
column: {
|
column: {
|
||||||
type: 'index',
|
type: 'index',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
@@ -176,7 +178,7 @@ export const createCrudOptions = function ({crudExpose}: CreateCrudOptionsProps)
|
|||||||
placeholder: '请输入密码',
|
placeholder: '请输入密码',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
valueResolve({form}) {
|
valueResolve({ form }) {
|
||||||
if (form.password) {
|
if (form.password) {
|
||||||
form.password = Md5.hashStr(form.password)
|
form.password = Md5.hashStr(form.password)
|
||||||
}
|
}
|
||||||
@@ -219,7 +221,7 @@ export const createCrudOptions = function ({crudExpose}: CreateCrudOptionsProps)
|
|||||||
}),
|
}),
|
||||||
column: {
|
column: {
|
||||||
minWidth: 200, //最小列宽
|
minWidth: 200, //最小列宽
|
||||||
formatter({value,row,index}){
|
formatter({ value, row, index }) {
|
||||||
return row.dept_name_all
|
return row.dept_name_all
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -235,7 +237,7 @@ export const createCrudOptions = function ({crudExpose}: CreateCrudOptionsProps)
|
|||||||
filterable: true,
|
filterable: true,
|
||||||
placeholder: '请选择',
|
placeholder: '请选择',
|
||||||
props: {
|
props: {
|
||||||
checkStrictly:true,
|
checkStrictly: true,
|
||||||
props: {
|
props: {
|
||||||
value: 'id',
|
value: 'id',
|
||||||
label: 'name',
|
label: 'name',
|
||||||
@@ -257,8 +259,8 @@ export const createCrudOptions = function ({crudExpose}: CreateCrudOptionsProps)
|
|||||||
}),
|
}),
|
||||||
column: {
|
column: {
|
||||||
minWidth: 200, //最小列宽
|
minWidth: 200, //最小列宽
|
||||||
formatter({value,row,index}){
|
formatter({ value, row, index }) {
|
||||||
const values = row.role_info.map((item:any) => item.name);
|
const values = row.role_info.map((item: any) => item.name);
|
||||||
return values.join(',')
|
return values.join(',')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -333,7 +335,7 @@ export const createCrudOptions = function ({crudExpose}: CreateCrudOptionsProps)
|
|||||||
span: 12,
|
span: 12,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
component: {props: {color: 'auto'}}, // 自动染色
|
component: { props: { color: 'auto' } }, // 自动染色
|
||||||
},
|
},
|
||||||
user_type: {
|
user_type: {
|
||||||
title: '用户类型',
|
title: '用户类型',
|
||||||
|
|||||||
Reference in New Issue
Block a user