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