|
@@ -1,18 +1,14 @@
|
1
|
1
|
|
2
|
2
|
import React, { useState, useRef, useEffect } from 'react';
|
3
|
|
-import { useIntl, FormattedMessage, useAccess } from '@umijs/max';
|
|
3
|
+import { useIntl, FormattedMessage } from '@umijs/max';
|
4
|
4
|
import type { FormInstance } from 'antd';
|
5
|
5
|
import { Button, message, Modal, Image, Upload, Drawer } from 'antd';
|
6
|
|
-import { ActionType, FooterToolbar, PageContainer, ProColumns, ProForm, ProFormDigit, ProFormText, ProTable } from '@ant-design/pro-components';
|
7
|
|
-import { PlusOutlined, DeleteOutlined, ExclamationCircleOutlined, RedoOutlined } from '@ant-design/icons';
|
8
|
|
-// import { getNoticeList, removeNotice, addNotice, updateNotice, exportNotice } from '@/services/system/notice';
|
9
|
|
-import { getEnterpriseList, saveEnterprise, deleteEnterprise, upload } from '@/services/other/footer';
|
|
6
|
+import { ActionType, PageContainer, ProColumns, ProForm, ProFormDigit, ProFormText, ProTable } from '@ant-design/pro-components';
|
|
7
|
+import { PlusOutlined } from '@ant-design/icons';
|
|
8
|
+import { getEnterpriseList, saveEnterprise, deleteEnterprise, upload,saveFooter,getFooterList } from '@/services/other/footer';
|
10
|
9
|
import EnterpriseForm from './edit';
|
11
|
|
-import moment from 'moment';
|
12
|
10
|
import { KeepAlive } from 'react-activation';
|
13
|
11
|
import './index.less'
|
14
|
|
-import DictTag from '../../../components/DictTag';
|
15
|
|
-import { getDataEnumList } from '../../../services/system/Enum';
|
16
|
12
|
import { RcFile } from 'antd/es/upload';
|
17
|
13
|
|
18
|
14
|
|
|
@@ -39,25 +35,6 @@ const NoticeTableList: React.FC = () => {
|
39
|
35
|
}
|
40
|
36
|
return false;
|
41
|
37
|
};
|
42
|
|
- const handleRemoveOne = async (selectedRow: API.System.Notice) => {
|
43
|
|
- const hide = message.loading(intl.formatMessage({ id: 'public.loadingDelete' }));
|
44
|
|
- if (!selectedRow) return true;
|
45
|
|
- try {
|
46
|
|
- const params = [selectedRow.uuid];
|
47
|
|
- const resp = await deleteEnterprise(params.join(','));
|
48
|
|
- hide();
|
49
|
|
- if (resp.code === 200) {
|
50
|
|
- message.success(intl.formatMessage({ id: 'public.deleteSuccess' }));
|
51
|
|
- } else {
|
52
|
|
- message.error(resp.msg);
|
53
|
|
- }
|
54
|
|
- return true;
|
55
|
|
- } catch (error) {
|
56
|
|
- hide();
|
57
|
|
- message.error(intl.formatMessage({ id: 'public.deleteError' }));
|
58
|
|
- return false;
|
59
|
|
- }
|
60
|
|
- };
|
61
|
38
|
|
62
|
39
|
const columns: ProColumns<API.System.Notice>[] = [
|
63
|
40
|
{
|
|
@@ -87,12 +64,15 @@ const NoticeTableList: React.FC = () => {
|
87
|
64
|
dataIndex: 'sort',
|
88
|
65
|
valueType: 'text',
|
89
|
66
|
hideInSearch: true,
|
|
67
|
+ width: 80,
|
|
68
|
+ align:'center'
|
90
|
69
|
},
|
91
|
70
|
{
|
92
|
71
|
title: '操作',
|
93
|
72
|
dataIndex: 'option',
|
94
|
73
|
width: '120px',
|
95
|
74
|
valueType: 'option',
|
|
75
|
+ align:'center',
|
96
|
76
|
render: (_, record: any) => [
|
97
|
77
|
<Button
|
98
|
78
|
type="link"
|
|
@@ -120,11 +100,14 @@ const NoticeTableList: React.FC = () => {
|
120
|
100
|
okText: intl.formatMessage({ id: 'public.confirm' }),
|
121
|
101
|
cancelText: intl.formatMessage({ id: 'public.cancel' }),
|
122
|
102
|
onOk: async () => {
|
123
|
|
- const success = await handleRemoveOne(record);
|
124
|
|
- if (success) {
|
|
103
|
+ const success = await deleteEnterprise(record.uuid);
|
|
104
|
+ if (success.code == 200) {
|
125
|
105
|
if (actionRef.current) {
|
126
|
106
|
actionRef.current.reload();
|
127
|
107
|
}
|
|
108
|
+ message.success('删除成功')
|
|
109
|
+ }else{
|
|
110
|
+ message.error(success.msg || '操作失败,请重试')
|
128
|
111
|
}
|
129
|
112
|
},
|
130
|
113
|
});
|
|
@@ -135,17 +118,57 @@ const NoticeTableList: React.FC = () => {
|
135
|
118
|
],
|
136
|
119
|
},
|
137
|
120
|
];
|
138
|
|
-
|
|
121
|
+ useEffect(()=>{
|
|
122
|
+ getDetail()
|
|
123
|
+ },[])
|
|
124
|
+ const getDetail = async ()=>{
|
|
125
|
+ try {
|
|
126
|
+ const res = await getFooterList()
|
|
127
|
+ if(res.code === 200){
|
|
128
|
+ if(res.data){
|
|
129
|
+ form?.current?.setFieldsValue(res.data)
|
|
130
|
+ if(res.data.wxImgUrl){
|
|
131
|
+ setFileList([{
|
|
132
|
+ id:res.data.wxImg,
|
|
133
|
+ url:res.data.wxImgUrl
|
|
134
|
+ }])
|
|
135
|
+ }
|
|
136
|
+ }
|
|
137
|
+ }else{
|
|
138
|
+ message.error(res.msg || '操作失败,请重试')
|
|
139
|
+ }
|
|
140
|
+ } catch (error) {
|
|
141
|
+
|
|
142
|
+ }
|
|
143
|
+
|
|
144
|
+ }
|
|
145
|
+ const onFinishForm = async (values)=>{
|
|
146
|
+ try {
|
|
147
|
+ if(img) values.img = img;
|
|
148
|
+ const res = await saveFooter(values)
|
|
149
|
+ if(res.code === 200){
|
|
150
|
+ message.success('保存成功')
|
|
151
|
+ }else{
|
|
152
|
+ message.error(res.msg || '操作失败,请重试')
|
|
153
|
+ }
|
|
154
|
+ } catch (error) {
|
|
155
|
+
|
|
156
|
+ }
|
|
157
|
+ }
|
139
|
158
|
return (
|
140
|
|
- <KeepAlive name='底部信息管理' path="/Enterprise/EnterpriseList">
|
|
159
|
+ <KeepAlive name='底部信息管理' path="/Other/footer">
|
141
|
160
|
<PageContainer>
|
142
|
161
|
<div style={{ width: '100%', float: 'right' }}>
|
143
|
|
-
|
|
162
|
+ <div style={{ width:'100%',padding:'30px',display:'flex',alignItems:'center',justifyContent:'space-between' }}>
|
|
163
|
+ <div></div>
|
|
164
|
+ <Button type='primary' onClick={() => form?.current?.submit()}>保存</Button>
|
|
165
|
+ </div>
|
144
|
166
|
<ProForm
|
145
|
167
|
formRef={form}
|
146
|
168
|
grid={true}
|
147
|
169
|
submitter={false}
|
148
|
170
|
layout="horizontal"
|
|
171
|
+ onFinish={onFinishForm}
|
149
|
172
|
>
|
150
|
173
|
<ProFormText
|
151
|
174
|
name="phone"
|
|
@@ -207,11 +230,9 @@ const NoticeTableList: React.FC = () => {
|
207
|
230
|
<ProTable<API.System.Notice>
|
208
|
231
|
actionRef={actionRef}
|
209
|
232
|
formRef={formTableRef}
|
|
233
|
+ headerTitle="旗下企业"
|
210
|
234
|
rowKey="uuid"
|
211
|
|
- key="EnterpriseList"
|
212
|
|
- search={{
|
213
|
|
- labelWidth: 120,
|
214
|
|
- }}
|
|
235
|
+ search={false}
|
215
|
236
|
toolBarRender={() => [
|
216
|
237
|
<Button
|
217
|
238
|
type="primary"
|
|
@@ -246,7 +267,7 @@ const NoticeTableList: React.FC = () => {
|
246
|
267
|
<EnterpriseForm
|
247
|
268
|
onSubmit={async (values) => {
|
248
|
269
|
let success = false;
|
249
|
|
- if (currentRow) {
|
|
270
|
+ if (currentRow?.uuid) {
|
250
|
271
|
values.uuid = currentRow.uuid;
|
251
|
272
|
}
|
252
|
273
|
|