Commit 60e276c7 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

修改系统管理单位新增删除

parent c4d299ae
......@@ -61,6 +61,7 @@ const router = {
path: '/system/platformArg/edit',
name: 'platformArgEdit',
hidePageHeader: true,
hideInMenu: true,
component: '@/pages/systemManage/platformArg/template',
}]
}
......
......@@ -5,7 +5,7 @@
* @LastEditTime: 2020-08-21 15:05:26
*/
import React, { useEffect, useState, useRef, Fragment, ReactNode } from 'react'
import { Card, Button, Tabs, Radio, Space, Row, Col, Table, Popconfirm } from 'antd'
import { Card, Button, Tabs, Radio, Space, Row, Col, Table, Popconfirm, Input } from 'antd'
import { PlusOutlined, SaveOutlined } from '@ant-design/icons'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import EyePreview from '@/components/EyePreview'
......@@ -81,7 +81,7 @@ const PaySetting: React.FC<{}> = () => {
/**
* @description: 保存 编辑的时候遍历id是否一样 一样就替换
* @param {type} type: 1支付宝 2支付宝银行卡 3微信
* @return {type}
* @return {type}
*/
const handleModalOK = (obj: any) => {
// console.log('选项卡:', tabid, '弹窗id:', type)
......@@ -137,16 +137,16 @@ const PaySetting: React.FC<{}> = () => {
// const tableAddButton = <Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(1)} type='dashed'>新增参数配置1</Button>
// const tableAddButton2 = <Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(2)} type='dashed'>新增参数配置2</Button>
// const tableAddButton3 = <Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={() => handleAddMemberBtn(3)} type='dashed'>新增参数配置3</Button>
const codeText = (text:any) => {
const codeText = (text: any) => {
let code: ReactNode = '';
text === 1 ? code = <span>mchId</span>:
text === 2 ? code = <span>mchKey</span>:
text === 3 ? code = <span>appId</span>:
code = <span>appSecret</span>
text === 1 ? code = <span>mchId</span> :
text === 2 ? code = <span>mchKey</span> :
text === 3 ? code = <span>appId</span> :
code = <span>appSecret</span>
return code;
}
const tableColumns: ColumnType<any>[] = [
{ dataIndex: 'code', title: '参数代码', align: 'center', render:(text:any) => codeText(text) },
{ dataIndex: 'code', title: '参数代码', align: 'center', render: (text: any) => codeText(text) },
{ dataIndex: 'value', align: 'center', title: '参数值', render: (_, record) => <EyePreview url={`/memberCenter/memberAbility/manage/addMember?id=${record.memberId}&preview=1`}>{_}</EyePreview> },
{ dataIndex: 'describe', title: '参数描述', align: 'center' },
{
......@@ -284,6 +284,17 @@ const PaySetting: React.FC<{}> = () => {
</Col>
</Row>
}
{
(v.id === 6 && isPitchOn) &&
<div style={{ marginTop: 42 }}>
<Space direction="horizontal" size={16}>
初始申请额度不超过
<Input addonBefore="¥" />
允许满<Input />
天后申请上调<Input addonAfter="%" />
</Space>
</div>
}
</TabPane>
</Fragment>
)
......@@ -303,4 +314,4 @@ const PaySetting: React.FC<{}> = () => {
</PageHeaderWrapper>
)
}
export default PaySetting
\ No newline at end of file
export default PaySetting
......@@ -30,7 +30,12 @@ const SensitiveWords: React.FC<{}> = () => {
key: 'state',
dataIndex: 'state',
render: (text: any, record: any) => (
<StatusSwitch fieldNames="status" handleConfirm={() => handleChangeStatus(record.id, record.status)} record={record} />
<StatusSwitch
fieldNames="status"
handleConfirm={() => handleChangeStatus(record.id, record.status)}
record={record}
expectTrueValue={1}
/>
)
},{
title: '操作',
......@@ -42,7 +47,7 @@ const SensitiveWords: React.FC<{}> = () => {
/**切换状态 */
const handleChangeStatus = async (id: any, status: any) => {
let _status = status === 1 ? 0 : 1
await PublicApi.postManageParameterManageUpdateState({ id: id, status: _status })
await PublicApi.postManageParameterManageUpdateState({ id: id, state: _status })
ref.current.reload()
}
/**获取单位列表数据 */
......
......@@ -22,7 +22,6 @@ const Template: React.FC<{}> = () => {
PublicApi.postManageParameterManageUpdate(values).then(res => {
if (res.code === 1000) {
history.goBack();
message.success('修改敏感词成功')
}
})
}
......
......@@ -17,10 +17,10 @@ const SensitiveWords: React.FC<{}> = () => {
ref.current.reload()
}
const confirmCancel = (id: number) => {
PublicApi.postManageSensitiveWordDelete({ id }).then(res => {
PublicApi.postManageSensitiveWordDelete({ ids: [id] }).then(res => {
if (res.code === 1000) {
message.success('删除成功')
ref.current.Reload()
ref.current.reload()
}
})
}
......@@ -37,32 +37,42 @@ const SensitiveWords: React.FC<{}> = () => {
title: '英文简称',
key: 'englishShortName',
dataIndex: 'englishShortName',
},{
}, {
title: '状态',
key: 'status',
dataIndex: 'status',
render: (text: any, record: any) => (
<StatusSwitch fieldNames="status" handleConfirm={() => handleChangeStatus(record.id, record.status)} record={record} />
<StatusSwitch
fieldNames="status"
handleConfirm={() => handleChangeStatus(record.id, record.status)}
record={record}
expectTrueValue={true}
/>
)
},{
}, {
title: '操作',
key: 'options',
dataIndex: 'options',
render: (text: any, record: any) => {
return (
<>
<Button
type='link'
href={`/system/sensitiveWords/edit?id=${record.id}}`}
>修改</Button>
<Popconfirm
onConfirm={() => confirmCancel(record.id)}
title="确定要执行这个操作?"
okText="确定"
cancelText="取消"
>
<Button type='link'>删除</Button>
</Popconfirm>
{
!record.status &&
<>
<Button
type='link'
href={`/system/unit/edit?id=${record.id}&name=${btoa(encodeURIComponent(record.name))}&englishShortName=${btoa(encodeURIComponent(record.englishShortName))}`}
>修改</Button>
<Popconfirm
onConfirm={() => confirmCancel(record.id)}
title="确定要执行这个操作?"
okText="确定"
cancelText="取消"
>
<Button type='link'>删除</Button>
</Popconfirm>
</>
}
</>
)
}
......
import React from 'react';
import React, { useEffect } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { history } from 'umi';
import ReutrnEle from '@/components/ReturnEle';
......@@ -14,34 +14,49 @@ const tailLayout = {
wrapperCol: { style: { marginLeft: '174px' } },
};
const [form] = Form.useForm();
const { pathname, query } = history.location;
const type = pathname.split('/')[pathname.split('/').length - 1];
const onFinish = (values: any) => {
if (type === 'add') {
PublicApi.postManageUnitSaveOrUpdateUnit(values).then(res => {
if (res.code === 1000) {
history.goBack();
message.success('新增单位成功')
}
})
const Template: React.FC<{}> = () => {
const [form] = Form.useForm();
const { pathname, query } = history.location;
const type = pathname.split('/')[pathname.split('/').length - 1];
const onFinish = (values: any) => {
if (type === 'add') {
PublicApi.postManageUnitSaveOrUpdateUnit(values).then(res => {
if (res.code === 1000) {
history.goBack();
message.success('新增单位成功')
}
})
}
else {
values.id = query.id;
PublicApi.postManageUnitSaveOrUpdateUnit(values).then(res => {
if (res.code === 1000) {
history.goBack();
message.success('修改单位成功')
}
})
}
}
else {
values.id = query.id;
PublicApi.postManageUnitSaveOrUpdateUnit(values).then(res => {
if (res.code === 1000) {
history.goBack();
message.success('修改单位成功')
}
})
const confirmCancel = () => {
history.goBack()
}
}
const confirmCancel = () => {
history.goBack()
}
useEffect(() => {
try {
const data: {name: string, englishShortName: string} = {
name: decodeURIComponent(atob(query.name)),
englishShortName: decodeURIComponent(atob(query.englishShortName)),
}
form.setFieldsValue({
name: data.name,
englishShortName: data.englishShortName
})
}catch(error) {
console.log(error)
}
}, [])
const Template: React.FC<{}> = () => {
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
......@@ -61,7 +76,7 @@ const Template: React.FC<{}> = () => {
</Form.Item>
<Form.Item {...tailLayout}>
<Space size={24}>
<Button type='primary' htmlType="submit">保存</Button>
<Button type='primary' htmlType="submit">保存</Button>
<Popconfirm
onConfirm={confirmCancel}
title="确定要执行这个操作?"
......
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