Compare commits

..

2 Commits

4 changed files with 131 additions and 46 deletions

View File

@ -85,14 +85,13 @@ function OrgAccountPage(props) {
message.success("操作成功");
await getData();
}
else {
message.error(res?.message || "操作失败");
}
},
});
};
const onResetPassword = (record) => {
console.log(record);
Modal.confirm({
title: "重置密码",
content: (
@ -108,13 +107,11 @@ function OrgAccountPage(props) {
okText: "确认重置",
cancelText: "取消",
onOk: async () => {
const res = await props.orgAccountResetPassword({ id: record.id });
const res = await props.orgAccountResetPassword({ data: record.id });
if (res?.success !== false) {
message.success("密码已重置");
}
else {
message.error(res?.message || "重置失败");
}
},
});
};
@ -136,14 +133,12 @@ function OrgAccountPage(props) {
okButtonProps: { danger: true },
cancelText: "取消",
onOk: async () => {
const res = await props.orgAccountDelete({ id: record.id });
const res = await props.orgAccountDelete({ data: record.id });
if (res?.success !== false) {
message.success("删除成功");
await getData();
}
else {
message.error(res?.message || "删除失败");
}
},
});
};
@ -165,9 +160,7 @@ function OrgAccountPage(props) {
editForm.resetFields();
await getData();
}
else {
message.error(res?.message || "保存失败");
}
};
const columns = [

View File

@ -1,5 +1,14 @@
import React, { useEffect, useState } from "react";
import { Button, Descriptions, Form, Input, message, Modal, Select, Table } from "antd";
import {
Button,
Descriptions,
Form,
Input,
message,
Modal,
Select,
Table,
} from "antd";
import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction";
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
import SearchForm from "@cqsjjb/jjb-react-admin-component/SearchForm";
@ -9,6 +18,7 @@ import { tools } from "@cqsjjb/jjb-common-lib";
import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { NS_QUAL_EXPERT } from "~/enumerate/namespace";
import { GENDER_OPTIONS, GENDER_MAP } from "~/enumerate/constant";
import AttachmentUpload from "~/components/AttachmentUpload";
const { router } = tools;
@ -20,8 +30,21 @@ const ExperManage = (props) => {
const [editingId, setEditingId] = useState(null);
const [submiting, setSubmiting] = useState(false);
const { qualExpert, queryExpertPage, getExpertDetail, saveExpert, modifyExpert, deleteExpert } = props;
const { qualExpertList, qualExpertTotal, qualExpertLoading, qualExpertDetail, qualExpertDetailLoading } = qualExpert || {};
const {
qualExpert,
queryExpertPage,
getExpertDetail,
saveExpert,
modifyExpert,
deleteExpert,
} = props;
const {
qualExpertList,
qualExpertTotal,
qualExpertLoading,
qualExpertDetail,
qualExpertDetailLoading,
} = qualExpert || {};
const getData = () => {
queryExpertPage({
@ -66,7 +89,11 @@ const ExperManage = (props) => {
setEditVisible(true);
const res = await getExpertDetail({ id });
if (res?.success !== false) {
editForm.setFieldsValue(res.data || qualExpertDetail);
const params = res.data;
if (params.certificate) {
params.certificate = JSON.parse(params.certificate);
}
editForm.setFieldsValue(params);
}
};
@ -75,6 +102,9 @@ const ExperManage = (props) => {
setSubmiting(true);
const action = editingId ? modifyExpert : saveExpert;
const params = editingId ? { ...values, id: editingId } : values;
if (values.certificate) {
params.certificate = JSON.stringify(values.certificate);
}
const res = await action(params);
setSubmiting(false);
if (res?.success !== false) {
@ -94,7 +124,7 @@ const ExperManage = (props) => {
okButtonProps: { danger: true },
cancelText: "取消",
onOk: async () => {
const res = await deleteExpert({ id: record.id });
const res = await deleteExpert({ data: record.id });
if (res?.success !== false) {
message.success("删除成功");
getData();
@ -121,16 +151,31 @@ const ExperManage = (props) => {
render: (code) => GENDER_MAP[code] || "--",
},
{ title: "身份证号", dataIndex: "idCardNo", width: 180 },
{ title: "证书", dataIndex: "certificate", width: 120, ellipsis: true },
{
title: "操作",
width: 180,
fixed: "right",
render: (_, record) => (
<TableAction>
<Button type="link" size="small" onClick={() => openDetail(record.id)}>查看</Button>
<Button type="link" size="small" onClick={() => openEdit(record.id)}>编辑</Button>
<Button type="link" size="small" danger onClick={() => handleDelete(record)}>删除</Button>
<Button
type="link"
size="small"
onClick={() => openDetail(record.id)}
>
查看
</Button>
<Button type="link" size="small" onClick={() => openEdit(record.id)}>
编辑
</Button>
<Button
type="link"
size="small"
danger
onClick={() => handleDelete(record)}
>
删除
</Button>
</TableAction>
),
},
@ -140,7 +185,9 @@ const ExperManage = (props) => {
<PageLayout
title="专家管理"
extra={
<Button type="primary" onClick={openAdd}>新增专家</Button>
<Button type="primary" onClick={openAdd}>
新增专家
</Button>
}
>
<SearchForm
@ -149,10 +196,18 @@ const ExperManage = (props) => {
loading={qualExpertLoading}
formLine={[
<Form.Item key="userName" name="userName">
<ControlWrapper.Input label="姓名" placeholder="请输入" allowClear />
<ControlWrapper.Input
label="姓名"
placeholder="请输入"
allowClear
/>
</Form.Item>,
<Form.Item key="account" name="account">
<ControlWrapper.Input label="账号" placeholder="请输入" allowClear />
<ControlWrapper.Input
label="账号"
placeholder="请输入"
allowClear
/>
</Form.Item>,
<Form.Item key="genderCode" name="genderCode">
<ControlWrapper.Select
@ -162,12 +217,18 @@ const ExperManage = (props) => {
style={{ width: "100%" }}
>
{GENDER_OPTIONS.map((item) => (
<Select.Option key={item.value} value={item.value}>{item.label}</Select.Option>
<Select.Option key={item.value} value={item.value}>
{item.label}
</Select.Option>
))}
</ControlWrapper.Select>
</Form.Item>,
<Form.Item key="idCardNo" name="idCardNo">
<ControlWrapper.Input label="身份证号" placeholder="请输入" allowClear />
<ControlWrapper.Input
label="身份证号"
placeholder="请输入"
allowClear
/>
</Form.Item>,
]}
onReset={handleReset}
@ -210,12 +271,31 @@ const ExperManage = (props) => {
footer={<Button onClick={() => setDetailVisible(false)}>关闭</Button>}
width={560}
>
<Descriptions column={2} bordered size="small" loading={qualExpertDetailLoading}>
<Descriptions.Item label="姓名">{qualExpertDetail?.userName || "--"}</Descriptions.Item>
<Descriptions.Item label="账号">{qualExpertDetail?.account || "--"}</Descriptions.Item>
<Descriptions.Item label="性别">{GENDER_MAP[qualExpertDetail?.genderCode] || "--"}</Descriptions.Item>
<Descriptions.Item label="身份证号">{qualExpertDetail?.idCardNo || "--"}</Descriptions.Item>
<Descriptions.Item label="证书" span={2}>{qualExpertDetail?.certificate || "--"}</Descriptions.Item>
<Descriptions
column={2}
bordered
size="small"
loading={qualExpertDetailLoading}
>
<Descriptions.Item label="姓名">
{qualExpertDetail?.userName || "--"}
</Descriptions.Item>
<Descriptions.Item label="账号">
{qualExpertDetail?.account || "--"}
</Descriptions.Item>
<Descriptions.Item label="性别">
{GENDER_MAP[qualExpertDetail?.genderCode] || "--"}
</Descriptions.Item>
<Descriptions.Item label="身份证号">
{qualExpertDetail?.idCardNo || "--"}
</Descriptions.Item>
<Descriptions.Item label="证书" span={2}>
{(qualExpertDetail?.certificate? JSON.parse(qualExpertDetail?.certificate): [])?.map((item) => (
<a key={item.id} href={item.url} target="_blank">
{item.name}
</a>
))}
</Descriptions.Item>
</Descriptions>
</Modal>
@ -229,29 +309,40 @@ const ExperManage = (props) => {
width={520}
>
<Form form={editForm} layout="vertical">
<Form.Item name="userName" label="姓名" rules={[{ required: true, message: "请输入姓名" }]}>
<Form.Item
name="userName"
label="姓名"
rules={[{ required: true, message: "请输入姓名" }]}
>
<Input placeholder="请输入" allowClear />
</Form.Item>
<Form.Item name="account" label="账号" rules={[{ required: true, message: "请输入账号" }]}>
<Form.Item
name="account"
label="账号"
rules={[{ required: true, message: "请输入账号" }]}
>
<Input placeholder="请输入" allowClear />
</Form.Item>
<Form.Item name="genderCode" label="性别">
<Select placeholder="请选择" allowClear style={{ width: "100%" }}>
{GENDER_OPTIONS.map((item) => (
<Select.Option key={item.value} value={item.value}>{item.label}</Select.Option>
<Select.Option key={item.value} value={item.value}>
{item.label}
</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item name="idCardNo" label="身份证号">
<Input placeholder="请输入" allowClear />
</Form.Item>
<Form.Item name="certificate" label="证书">
<Input placeholder="请输入" allowClear />
</Form.Item>
<AttachmentUpload name="certificate" maxCount={1} label="证书" />
</Form>
</Modal>
</PageLayout>
);
};
export default Connect([NS_QUAL_EXPERT], true)(AntdTableFuncControl(ExperManage));
export default Connect(
[NS_QUAL_EXPERT],
true,
)(AntdTableFuncControl(ExperManage));

View File

@ -7,6 +7,7 @@
.micro-temp-modal-body {
max-height: 630px;
overflow-y: auto;
overflow-x: hidden;
scrollbar-width: thin;
}
body {

View File

@ -39,17 +39,17 @@ export const orgAccountModify = declareRequest("orgInfoLoading", safeAction(asyn
return fromSingleResponse(res, toOrgInfoForm);
}));
export const orgAccountDelete = declareRequest("orgInfoLoading", safeAction(async ({ id }) => {
return apiPostDelete("/safetyEval/org-info/delete", id, NO_ORG_CONTEXT);
export const orgAccountDelete = declareRequest("orgInfoLoading", safeAction(async (data) => {
return apiPost("/safetyEval/org-info/delete", data, {}, NO_ORG_CONTEXT);
}));
export const orgAccountUpdateState = declareRequest("orgInfoLoading", safeAction(async ({ id, state }) => {
return apiPost("/safetyEval/org-info/update-state", { id, state }, {}, NO_ORG_CONTEXT);
}));
export const orgAccountResetPassword = declareRequest("orgInfoLoading", safeAction(async ({ id }) => {
const url = `/safetyEval/org-info/reset-password?id=${encodeURIComponent(id)}`;
return apiPost(url, {}, {}, NO_ORG_CONTEXT);
export const orgAccountResetPassword = declareRequest("orgInfoLoading", safeAction(async (data ) => {
const url = `/safetyEval/org-info/reset-password`;
return apiPost(url, data, {}, NO_ORG_CONTEXT);
}));
export const registeredOrgList = declareRequest("orgInfoLoading", safePageResult(async (params) => {