Commit 2aa29621 authored by Bill's avatar Bill

fix: 修改消息接口以及考评bug

parent 3ed9ad5c
import React, { useMemo, useState } from 'react';
import { Progress } from 'antd';
import { initial } from 'lodash';
import { GetMemberAppraisalResultGetResponse, GetMemberAppraisalSummaryGetResponse } from '@/services/MemberV2Api';
/**
* 获取考评详情页的公共部分
*/
type Options = {
blackList: string[]
initialValue?: any,
initialValue?: (GetMemberAppraisalSummaryGetResponse | GetMemberAppraisalResultGetResponse) & {
name: string,
upperName: string,
notifyMember: 1 | 0,
},
}
function useGetDetailCommon(options: Options) {
const { blackList, initialValue = {} } = options;
const { blackList, initialValue = {} as Options['initialValue'] } = options;
const [anchorHeader] = useState(() => {
const temp = [
{
......@@ -39,14 +43,15 @@ function useGetDetailCommon(options: Options) {
});
const basicInfoList = useMemo(() => {
const isUpperMember = typeof initialValue?.upperName !== 'undefined'
return [
{
title: '考评单号',
value: initialValue?.appraisalNo,
},
{
title: '会员名称',
value: initialValue?.name,
title: !isUpperMember ? '会员名称' : '上级会员名称',
value: !isUpperMember ? initialValue?.name : initialValue?.upperName,
},
{
title: '附件',
......@@ -104,11 +109,11 @@ function useGetDetailCommon(options: Options) {
{
title: '附件',
value: (
<div>
<div style={{display: 'flex', flexDirection: 'column',}}>
{
initialValue?.resultAttachments?.map((_row) => {
return (
<a key={_row.url} href={_row.url}>{_row.name}</a>
<a style={{marginBottom: '4px'}} key={_row.url} href={_row.url}>{_row.name}</a>
)
})
}
......@@ -121,7 +126,7 @@ function useGetDetailCommon(options: Options) {
},
{
title: '通知考评结果',
value: initialValue?.notifyMember ? '是' : '否'
value: initialValue?.totalScore !== null ? (initialValue?.notifyMember ? '是' : '否') : ''
}
]
}, [initialValue])
......
......@@ -60,6 +60,7 @@ const List: React.FC<Iprops> = (props: Iprops) => {
return (
<Card>
<CustomizeQueryList
ref={ref}
columns={columns}
rowSelection={rowSelection as any}
schema={evaluationListSchema}
......
......@@ -13,7 +13,7 @@ import { Link } from 'umi';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
const defaultColumns = setColumnsByLinks({
detail: '/memberCenter/memberAbility/memberEvaluate/tobeReviewI',
detail: '/memberCenter/memberAbility/memberEvaluate/tobeReviewI/detail',
});
interface Iprops {};
......@@ -36,17 +36,17 @@ const List: React.FC<Iprops> = (props: Iprops) => {
const controllerBtns = (
<Space>
<Button loading={submitLoading} onClick={() => handleBatchRemove(rowController.selectedRowKeys)} type="ghost">批量审核通过</Button>
<Button loading={submitLoading} onClick={() => handleBatchUpdate(rowController.selectedRowKeys)} type="ghost">批量审核通过</Button>
</Space>
)
const handleBatchRemove = async (ids: number[]) => {
// setSubmitLoading(true)
// const { code, data } = await PublicApi.postMemberAppraisalDelete({ids: ids});
// setSubmitLoading(false)
// if (code === 1000) {
// ref.current?.submit();
// }
const handleBatchUpdate = async (ids: number[]) => {
setSubmitLoading(true)
const { code, data } = await PublicApi.postMemberAppraisalWaitAuditOneAuditBatch({ids: ids});
setSubmitLoading(false)
if (code === 1000) {
ref.current?.submit();
}
}
const handleFetch = async (params: GetMemberAppraisalWaitAuditOnePageRequest) => {
......@@ -57,6 +57,7 @@ const List: React.FC<Iprops> = (props: Iprops) => {
return (
<Card>
<CustomizeQueryList
ref={ref}
columns={columns}
rowSelection={rowSelection as any}
schema={evaluationListSchema}
......
......@@ -13,7 +13,7 @@ import { Link } from 'umi';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
const defaultColumns = setColumnsByLinks({
detail: '/memberCenter/memberAbility/memberEvaluate/tobeReviewII',
detail: '/memberCenter/memberAbility/memberEvaluate/tobeReviewII/detail',
});
interface Iprops {};
......@@ -36,17 +36,18 @@ const List: React.FC<Iprops> = (props: Iprops) => {
const controllerBtns = (
<Space>
<Button loading={submitLoading} onClick={() => handleBatchRemove(rowController.selectedRowKeys)} >批量审核通过</Button>
<Button loading={submitLoading} onClick={() => handleBatchUpdate(rowController.selectedRowKeys)} >批量审核通过</Button>
</Space>
)
const handleBatchRemove = async (ids: number[]) => {
// setSubmitLoading(true)
// const { code, data } = await PublicApi.postMemberAppraisalDelete({ids: ids});
// setSubmitLoading(false)
// if (code === 1000) {
// ref.current?.submit();
// }
const handleBatchUpdate = async (ids: number[]) => {
console.log(123);
setSubmitLoading(true)
const { code, data } = await PublicApi.postMemberAppraisalWaitAuditTwoAuditBatch({ids: ids});
setSubmitLoading(false)
if (code === 1000) {
ref.current?.submit();
}
}
const handleFetch = async (params: GetMemberAppraisalWaitAuditTwoPageRequest) => {
......@@ -57,6 +58,7 @@ const List: React.FC<Iprops> = (props: Iprops) => {
return (
<Card>
<CustomizeQueryList
ref={ref}
columns={columns}
rowSelection={rowSelection as any}
schema={evaluationListSchema}
......
......@@ -22,6 +22,7 @@ import useInitialValue from '../../common/hooks/useInitialValue';
import { findLastIndexFlowState } from '@/utils';
import FlowRecords from '@/components/FlowRecords';
import NiceForm from '@/components/NiceForm';
import { history } from 'umi';
type EditDataType = {
appraisalId: number
......@@ -124,7 +125,6 @@ const TobeEvaluateDetail = () => {
}
const resultOnSubmit = async (value: SubmitData) => {
console.log(value);
setSubmitLoading(true)
const postData = {
id: id,
......@@ -145,8 +145,9 @@ const TobeEvaluateDetail = () => {
const { code, data } = await PublicApi.postMemberAppraisalWaitSubmitSubmit(postData as any);
setSubmitLoading(false)
if(code === 1000) {
refresh(params);
// refresh(params);
resultToggle(false);
history.goBack();
}
}
......
import moment from "moment";
import React from "react"
import { Link } from 'umi'
import { Link } from 'umi';
const format = 'YYYY-MM-DD';
export const commonColumns = [
{
title: '考评单号/主题',
dataIndex: 'des',
render: (text, record) => {
return (
<div style={{ display: 'flex', flexDirection: 'column', }}>
<Link to={`/memberCenter/memberAbility/profile/memberEvaluate/detail?id=${record.id}`}>{record.id}</Link>
<Link to={`/memberCenter/memberAbility/profile/memberEvaluate/detail?id=${record.id}`}>{record.appraisalNo}</Link>
<p>{record.subject}</p>
</div>
)
......@@ -17,7 +19,7 @@ export const commonColumns = [
},
{
title: '会员名称',
dataIndex: 'name',
dataIndex: 'upperName',
},
{
title: '考评范围',
......@@ -33,10 +35,11 @@ export const commonColumns = [
{
title: '考评完成时间',
dataIndex: 'completeDay',
sorter: (_a, _b) => _a.date - _b.date,
sorter: (_a, _b) => moment(_a.completeDay, format).valueOf() - moment(_b.completeDay, format).valueOf(),
},
{
title: '考评最终分',
dataIndex: 'totalScore',
sorter: (_a, _b) => _a.totalScore - _b.totalScore
}
]
......@@ -15,7 +15,7 @@ const EvaluateDetail = () => {
const { id } = usePageStatus();
const params = useMemo(() => { return id ? { id: id.toString() } : null }, [id]);
const { loading, initialValue }= useInitialValue<GetMemberAppraisalSummaryGetResponse, { id: string }>(PublicApi.getMemberAppraisalResultGet, params)
const { anchorHeader, basicInfoList, evaluateResultColumn } = useGetDetailCommon({blackList: ['process', 'record'], initialValue: initialValue})
const { anchorHeader, basicInfoList, evaluateResultColumn } = useGetDetailCommon({blackList: ['progress', 'record'], initialValue: initialValue})
return (
<Spin spinning={loading}>
......
import React, {useState, useEffect} from 'react';
import React, {useState, useEffect, useCallback} from 'react';
import { history } from 'umi';
import { Card, List, Avatar, Button } from 'antd';
import styles from './index.less'
......@@ -9,6 +9,7 @@ import moment from 'moment';
import msg_system from '@/assets/imgs/msg_system.png'
import msg_platform from '@/assets/imgs/msg_platform.png';
import { BookOutlined, ReadOutlined } from '@ant-design/icons';
import { GetMessageMessageMemberPageRequest } from '@/services/MessageV2Api';
const Message: React.FC<{}> = () => {
const [dataSource, setDataSource] = useState<any>({totalCount: 0, data: []})
......@@ -17,47 +18,46 @@ const Message: React.FC<{}> = () => {
pageSize: 10,
})
useEffect(() => {
// @ts-ignore
getList(pagination)
}, [])
const getList = (params) => {
PublicApi.getReportMessageMemberPage(params).
then(({data, code}) => {
if(code === 1000) {
setDataSource(data)
}
})
}
const getList = useCallback(async (params: GetMessageMessageMemberPageRequest) => {
const { data, code } = await PublicApi.getMessageMessageMemberPage(params);
if(code === 1000) {
setDataSource(data)
}
}, [])
const handlePaginationChange = (page, pageSize) => {
const handlePaginationChange = (page: number, pageSize: number) => {
setPagination({current: page, pageSize});
getList({current: page, pageSize})
getList({current: page.toString(), pageSize: pageSize.toString()})
}
const handleRead = (id, url: string) => {
PublicApi.postReportMessageMemberRead({id: id}, {ctlType: 'none'})
.then((data) => {
if(url) {
if(/http/.test(url)) {
location.href = url
} else {
history.push(url);
}
const handleRead = async (id: number, url: string) => {
const { data, code } = await PublicApi.postReportMessageMemberRead({id: id}, {ctlType: 'none'})
if(url) {
if(/http/.test(url)) {
location.href = url
} else {
getList(pagination);
history.push(url);
}
})
} else {
getList({
current: pagination.current.toString(),
pageSize: pagination.pageSize.toString()
})
}
}
const handleAllMessageRead = () => {
PublicApi.postReportMessageMemberReadAll()
.then((data) => {
if(data.code === 1000) {
getList(pagination)
}
})
const handleAllMessageRead = async () => {
const { data, code } = await PublicApi.postMessageMessageMemberReadAll()
if(code === 1000) {
getList({
current: pagination.current.toString(),
pageSize: pagination.pageSize.toString()
})
}
}
const renderMessage = (data) => {
......
......@@ -24,6 +24,7 @@ import * as TemplateV2Api from './TemplateV2Api';
import * as MemberV2Api from './MemberV2Api';
import * as ReportV2Api from './ReportV2Api';
import * as EnhanceV2Api from './EnhanceV2Api';
import * as MessageV2 from './MessageV2Api'
/**
......@@ -60,5 +61,6 @@ export const PublicApi = {
...TemplateV2Api,
...MemberV2Api,
...ReportV2Api,
...EnhanceV2Api
...EnhanceV2Api,
...MessageV2
}
......@@ -26,6 +26,7 @@ const tokenList = [
{ name: 'MemberV2', token: '87f86a297246fbf1c0dff7d34f13729cb194935a95db077a5009ac4ea48cea6f', categoryIds: [0]}, //会员服务 V2
{ name: 'ReportV2', token: 'dab50c384c27f1c981a03f2c44ad76d1e7e1f60b4520bd279cea67f5cf146cee', categoryIds: [0]}, // 报表服务v2 首页
{ name: 'EnhanceV2', token: '71b97616a81866ade2731437ca121e288b1dd8331dce4b5c1ccaacb176c16580', categoryIds: [0], }, // 加工服务v2
{ name: 'MessageV2', token: '69a667ec9861e8bdc25b89238d0b908a2123d9fce26e72fec3cdf6cd0b1f2681', categoryIds: [0], }, // 消息中心v2
]
......
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