Quellcode durchsuchen

Merge branch 'dev' of http://git.ycjcjy.com/jgz/admin into dev

Yansen vor 2 Jahren
Ursprung
Commit
25bfd9aba4

+ 13
- 9
src/pages/rotationChart/introduction/edit/index.jsx Datei anzeigen

@@ -1,22 +1,24 @@
1
-import { addRegulation, getRegulationById } from '@/services/regulation';
1
+import { addRegulation, getRegulationList } from '@/services/regulation';
2 2
 import { PageContainer, ProForm, ProFormTextArea } from '@ant-design/pro-components';
3 3
 import { Card, Col, message, Row, Space } from 'antd';
4 4
 import { useNavigate, useSearchParams } from 'react-router-dom';
5 5
 import { useEffect, useRef, useState } from 'react';
6
+import { queryTable } from '@/utils/request';
6 7
 
7 8
 export default (props) => {
9
+
8 10
   const [searchParams, setSearchParams] = useSearchParams();
9 11
   const id = searchParams.get('id');
12
+  const [data, setData] = useState({});
10 13
   const formRef = useRef();
11 14
   const navigate = useNavigate();
12 15
 
13 16
   useEffect(() => {
14
-    if (id) {
15
-      getRegulationById(id).then((res) => {
16
-        formRef.current.setFieldsValue(res);
17
-      });
18
-    }
19
-  }, [id]);
17
+    getRegulationList({ type: `station` }).then((res) => {
18
+      formRef.current.setFieldsValue(res.records[0]);
19
+      console.log('tt', res)
20
+    });
21
+  }, []);
20 22
 
21 23
   const onFinish = async (values) => {
22 24
     //添加,修改
@@ -40,7 +42,7 @@ export default (props) => {
40 42
             searchConfig: {
41 43
               resetText: '返回',
42 44
             },
43
-            onReset: () => navigate(-1),
45
+            // onReset: () => navigate(-1),
44 46
             render: (props, doms) => {
45 47
               return (
46 48
                 <Row>
@@ -53,12 +55,14 @@ export default (props) => {
53 55
           }}
54 56
         >
55 57
           <ProFormTextArea
56
-            name="detail"
57 58
             label="发布内容"
58 59
             placeholder="请输入发布内容"
59 60
             rules={[{ required: true, message: '请输入发布内容' }]}
60 61
             allowClear={false}
61 62
             width={750}
63
+            name="detail"
64
+            onFinish={onFinish}
65
+            request={queryTable(getRegulationList)}
62 66
           />
63 67
         </ProForm>
64 68
       </Card>

+ 0
- 1
src/regulation/edit/index.jsx Datei anzeigen

@@ -22,7 +22,6 @@ export default (props) => {
22 22
   const onFinish = async (values) => {
23 23
     console.log(values);
24 24
 
25
-    // if (id) {
26 25
     //添加,修改
27 26
     addRegulation({ ...values, id }).then((res) => {
28 27
       // message.success('成功');

+ 4
- 4
src/routes/routes.jsx Datei anzeigen

@@ -264,8 +264,8 @@ export const authRoutes = [
264 264
         element: <Navigate to="rotationChart/list" replace />,
265 265
       },
266 266
       {
267
-        path: "station",
268
-        element: null,
267
+        path: "rotationChart/introduction",
268
+        element: <RotationChartIntroductionEdit />,
269 269
         meta: {
270 270
           title: "本站信息",
271 271
           permission: 'station',
@@ -481,7 +481,7 @@ export const defaultRoutes = [
481 481
   },
482 482
 ];
483 483
 
484
-export function mergeAuthRoutes(r1, r2) {
484
+export function mergeAuthRoutes (r1, r2) {
485 485
   const r = r1.slice();
486 486
   const children = r1[0].children.slice();
487 487
   r[0].children = children.concat(r2);
@@ -490,7 +490,7 @@ export function mergeAuthRoutes(r1, r2) {
490 490
 
491 491
 // 全部路由
492 492
 export const routes = mergeAuthRoutes(defaultRoutes, authRoutes);
493
-function getPath(parent = "/", current = "") {
493
+function getPath (parent = "/", current = "") {
494 494
   if (current.indexOf("/") === 0 || current.indexOf("http") === 0)
495 495
     return current;
496 496
   return `${parent}/${current}`.replace(/\/\//g, "/");

+ 2
- 10
src/services/regulation.js Datei anzeigen

@@ -1,4 +1,4 @@
1
-import request, { restful } from '@/utils/request';
1
+import request from '@/utils/request';
2 2
 
3 3
 /**
4 4
  * 查询列表
@@ -27,12 +27,4 @@ export const getRegulationById = (id) => request(`/posts/${id}`);
27 27
  * @param {*} id
28 28
  * @returns
29 29
  */
30
-export const deleteRegulation = (id) => request(`/posts/${id}`, { method: 'delete' });
31
-
32
-//标题
33
-/**
34
- * 查询列表
35
- * @param {*} params
36
- * @returns
37
- */
38
-export const getRegulationTitleList = (params) => request('/posts', { params, successTip: false });
30
+export const deleteRegulation = (id) => request(`/posts/${id}`, { method: 'delete' });