Commit b4dd4c4d authored by wuhao's avatar wuhao 🎯

sadare

parent d3e2a96b
...@@ -15,7 +15,7 @@ import { useRequest } from "umi"; ...@@ -15,7 +15,7 @@ import { useRequest } from "umi";
import defaultFields from "./fields"; import defaultFields from "./fields";
import { doFetch } from "@/utils/doFetch"; import { doFetch } from "@/utils/doFetch";
import { deviceprovideDetail, deleteProvideCheck } from "@/services/device"; import { deviceprovideDetail, deleteProvideCheck } from "@/services/device";
import { usercusDetails } from "@/utils/detailTotalCard"; import { deviceprovideDetails } from "@/utils/detailTotalCard";
import Details from "@/components/Details"; import Details from "@/components/Details";
import { useAsyncEffect } from "ahooks"; import { useAsyncEffect } from "ahooks";
import tempfields from "@/utils/tempfields"; import tempfields from "@/utils/tempfields";
...@@ -81,7 +81,7 @@ function reducer(state, action) { ...@@ -81,7 +81,7 @@ function reducer(state, action) {
...state, ...state,
details: { details: {
dataSource: action.dataSource, dataSource: action.dataSource,
totalCard: [...usercusDetails, ...extraspecial], totalCard: [...deviceprovideDetails, ...extraspecial],
}, },
visible: true, visible: true,
}; };
......
...@@ -10,19 +10,19 @@ import { userDetails, userCheckDetails } from "@/utils/detailTotalCard"; ...@@ -10,19 +10,19 @@ import { userDetails, userCheckDetails } from "@/utils/detailTotalCard";
import Details from "@/components/Details"; import Details from "@/components/Details";
import { userSelect } from "@/services/system"; import { userSelect } from "@/services/system";
const initState = { const initState = {
vs: false, vs: false,
fields: {}, fields: {},
iftype: {}, iftype: {},
curitem: {}, curitem: {},
detail: { detail: {
dataSource: {}, dataSource: {},
totalCard: [], totalCard: [],
}, },
visible: false, visible: false,
extraparams: { extraparams: {
orderType: "1", orderType: "1",
},
}, },
},
tabList = [ tabList = [
{ {
key: "1", key: "1",
...@@ -36,78 +36,78 @@ const initState = { ...@@ -36,78 +36,78 @@ const initState = {
function reducer(state, action) { function reducer(state, action) {
let { type } = action, let { type } = action,
newState = {}; newState = {};
switch (type) { switch (type) {
case "add": case "add":
newState = { newState = {
...state, ...state,
vs: true, vs: true,
iftype: { iftype: {
title: "新增用户", title: "新增用户",
val: type, val: type,
}, },
fields: { ...action.fields }, fields: { ...action.fields },
}; };
break; break;
case "edit": case "edit":
newState = { newState = {
...state, ...state,
vs: true, vs: true,
iftype: { iftype: {
title: "编辑用户", title: "编辑用户",
val: type, val: type,
}, },
fields: { ...action.fields }, fields: { ...action.fields },
curitem: action.curitem, curitem: action.curitem,
}; };
break; break;
case "audit": case "audit":
newState = { newState = {
...state, ...state,
vs: true, vs: true,
iftype: { iftype: {
title: "审批用户", title: "审批用户",
val: type, val: type,
}, },
fields: { ...action.fields }, fields: { ...action.fields },
curitem: action.curitem, curitem: action.curitem,
}; };
break; break;
case "see": case "see":
newState = { newState = {
...state, ...state,
detail: { detail: {
dataSource: action.dataSource, dataSource: action.dataSource,
totalCard: action.totalCard, totalCard: action.totalCard,
}, },
visible: true, visible: true,
}; };
break; break;
case "start": case "start":
newState = { newState = {
...state, ...state,
extraparams: { extraparams: {
orderType: action.tabKey, orderType: action.tabKey,
}, },
}; };
break; break;
case "close": case "close":
newState = { newState = {
...state, ...state,
vs: false, vs: false,
fields: {}, fields: {},
iftype: {}, iftype: {},
curitem: {}, curitem: {},
detail: { detail: {
dataSource: {}, dataSource: {},
totalCard: [], totalCard: [],
}, },
visible: false, visible: false,
}; };
break; break;
} }
return newState; return newState;
} }
const Staff = (props) => { const Staff = (props) => {
let actionRef = useRef(), let actionRef = useRef(),
ChildRef = null; ChildRef = null;
...@@ -116,15 +116,15 @@ const Staff = (props) => { ...@@ -116,15 +116,15 @@ const Staff = (props) => {
ChildRef?.onRefresh(); ChildRef?.onRefresh();
} }
const { run, loading } = useRequest(doFetch, { const { run, loading } = useRequest(doFetch, {
manual: true, manual: true,
formatResult: (res) => res, formatResult: (res) => res,
onSuccess: (result, params) => { onSuccess: (result, params) => {
if (result.code == "0000") { if (result.code == "0000") {
reload(); reload();
dispatch({ type: "close" }); dispatch({ type: "close" });
} }
}, },
}), }),
[state, dispatch] = useReducer(reducer, initState), [state, dispatch] = useReducer(reducer, initState),
{ vs, fields, iftype, curitem, detail, visible, extraparams } = state, { vs, fields, iftype, curitem, detail, visible, extraparams } = state,
columns = [ columns = [
...@@ -154,8 +154,8 @@ const Staff = (props) => { ...@@ -154,8 +154,8 @@ const Staff = (props) => {
dataSource.gender == 1 dataSource.gender == 1
? "男" ? "男"
: dataSource.gender == 2 : dataSource.gender == 2
? "女" ? "女"
: "-"; : "-";
dispatch({ type: "see", dataSource, totalCard }); dispatch({ type: "see", dataSource, totalCard });
} }
}); });
...@@ -228,8 +228,8 @@ const Staff = (props) => { ...@@ -228,8 +228,8 @@ const Staff = (props) => {
dataSource.gender == 1 dataSource.gender == 1
? "男" ? "男"
: dataSource.gender == 2 : dataSource.gender == 2
? "女" ? "女"
: "-"; : "-";
dispatch({ type: "see", dataSource, totalCard }); dispatch({ type: "see", dataSource, totalCard });
} }
}); });
...@@ -317,138 +317,138 @@ const Staff = (props) => { ...@@ -317,138 +317,138 @@ const Staff = (props) => {
function extraAction(text, record, _, action) { function extraAction(text, record, _, action) {
return [ return [
extraparams.orderType == "1" && extraparams.orderType == "1" &&
getPrem("sysUser_restPassword", action, "重置密码", null, { getPrem("sysUser_restPassword", action, "重置密码", null, {
title: "确认重置密码?", title: "确认重置密码?",
onConfirm: () => { onConfirm: () => {
doFetch({
url: "/ngic-auth/sysUser/restPassword",
params: { id: record.id },
}).then((res) => {
if (res.code == "0000") {
message.success(res.msg);
reload();
}
});
},
}),
extraparams.orderType == "1" &&
getPrem("sysDepartment_save", action, "修改", () => {
doFetch({ doFetch({
url: "/ngic-auth/sysUser/restPassword", url: "/ngic-auth/sysUser/query/detail",
params: { id: record.id }, params: { id: record.id },
}).then((res) => { }).then((res) => {
if (res.code == "0000") { if (res.code == "0000") {
message.success(res.msg); let data = res?.data?.data ?? {};
reload(); for (let i in defaultFields) {
defaultFields[i].value = data[i];
if (i == "parentId") {
defaultFields[i].belinked = {
options: {
database: userSelect,
params: { id: record.id },
},
};
}
}
dispatch({
type: "edit",
fields: { ...defaultFields },
curitem: data,
});
} }
}); });
}, }),
}),
extraparams.orderType == "1" && extraparams.orderType == "1" &&
getPrem("sysDepartment_save", action, "修改", () => { getPrem("sysDepartment_deleteById", action, "删除", null, {
doFetch({ title: "确认删除该用户?",
url: "/ngic-auth/sysUser/query/detail", onConfirm: () => {
params: { id: record.id }, run({
}).then((res) => { url: "/ngic-auth/sysUser/deleteById",
if (res.code == "0000") { params: { id: record.id },
let data = res?.data?.data ?? {};
for (let i in defaultFields) {
defaultFields[i].value = data[i];
if (i == "parentId") {
defaultFields[i].belinked = {
options: {
database: userSelect,
params: { id: record.id },
},
};
}
}
dispatch({
type: "edit",
fields: { ...defaultFields },
curitem: data,
}); });
} },
}); }),
}),
extraparams.orderType == "1" &&
getPrem("sysDepartment_deleteById", action, "删除", null, {
title: "确认删除该用户?",
onConfirm: () => {
run({
url: "/ngic-auth/sysUser/deleteById",
params: { id: record.id },
});
},
}),
extraparams.orderType == "2" && extraparams.orderType == "2" &&
record.status == 1 && record.status == 1 &&
getPrem("sysDepartment_save", action, "审批", () => { getPrem("sysDepartment_save", action, "审批", () => {
doFetch({ doFetch({
url: "/ngic-auth/sysAccountApply/queryById", url: "/ngic-auth/sysAccountApply/queryById",
params: { id: record.id }, params: { id: record.id },
}).then((res) => { }).then((res) => {
if (res.code == "0000") { if (res.code == "0000") {
let data = res?.data?.data ?? {}; let data = res?.data?.data ?? {};
for (let i in defaultFields) { for (let i in defaultFields) {
defaultFields[i].value = data[i]; defaultFields[i].value = data[i];
if (i == "parentId") { if (i == "parentId") {
defaultFields[i].belinked = { defaultFields[i].belinked = {
options: { options: {
database: userSelect, database: userSelect,
params: { id: record.id }, params: { id: record.id },
}, },
}; };
}
} }
} let newParams = {
let newParams = { remark: {
remark: { value: data.remark,
value: data.remark, type: "textarea",
type: "textarea", title: "备注",
title: "备注", name: ["remark"],
name: ["remark"], required: false,
required: false, col: { span: 24 },
col: { span: 24 }, },
}, applyTime: {
applyTime: { value: data.applyTime,
value: data.applyTime, type: "datepicker",
type: "datepicker", title: "申请时间",
title: "申请时间", name: ["applyTime"],
name: ["applyTime"], required: false,
required: false, disabled: true,
disabled: true, },
}, auditResult: {
auditResult: { value: null,
value: null, type: "select",
type: "select", title: "审批结果",
title: "审批结果", name: ["auditResult"],
name: ["auditResult"], required: true,
required: true, options: [
options: [
{
label: "通过",
value: 1,
},
{
label: "不通过",
value: 2,
},
],
linked: true,
},
auditOpinion: {
value: null,
type: "textarea",
title: "审批意见",
name: ["auditOpinion"],
required: true,
col: { span: 24 },
belinked: {
hides: [
{ {
name: "auditResult", label: "通过",
equalvalue: [1, null], value: 1,
required: true, },
{
label: "不通过",
value: 2,
}, },
], ],
linked: true,
}, },
}, auditOpinion: {
}; value: null,
dispatch({ type: "textarea",
type: "audit", title: "审批意见",
fields: { ...defaultFields, ...newParams }, name: ["auditOpinion"],
curitem: data, required: true,
}); col: { span: 24 },
} belinked: {
}); hides: [
}), {
name: "auditResult",
equalvalue: [1, null],
required: true,
},
],
},
},
};
dispatch({
type: "audit",
fields: { ...defaultFields, ...newParams },
curitem: data,
});
}
});
}),
]; ];
} }
let saveData = (values, fn) => { let saveData = (values, fn) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment