Kaynağa Gözat

亲属信息

shaogen1995 1 hafta önce
ebeveyn
işleme
e0c03d7345

+ 1 - 1
后台管理/src/pages/A1record/A1look/index.tsx

@@ -189,7 +189,7 @@ function A1look({ sId }: Props) {
             </div>
 
             {tabAc === 1 ? <A1tab1life sId={sId} /> : null}
-            {tabAc === 2 ? <A2tab2clan sId={sId} /> : null}
+            {tabAc === 2 ? <A2tab2clan sId={sId} listAllRes={listAllRes} /> : null}
             {tabAc === 3 ? <A3tab3clue sId={sId} listAllRes={listAllRes} /> : null}
             {tabAc === 4 ? <A4tab4antique sId={sId} /> : null}
           </div>

+ 10 - 0
后台管理/src/pages/A1record/A1tab/A2tab2clan/index.module.scss

@@ -1,4 +1,14 @@
 .A2tab2clan {
   :global {
+    .A2t1btn {
+      position: absolute;
+      right: 10px;
+      top: 12px;
+      z-index: 10;
+    }
+
+    .ant-table-cell {
+      padding: 8px !important;
+    }
   }
 }

+ 83 - 3
后台管理/src/pages/A1record/A1tab/A2tab2clan/index.tsx

@@ -1,14 +1,94 @@
-import React from 'react'
+import React, { useCallback, useEffect, useMemo, useState } from 'react'
 import styles from './index.module.scss'
+import { A1ListSelectType } from '../../data'
+import { A3ListType } from '@/pages/A3clan/data'
+import { A3_APIdel, A3_APIgetList } from '@/store/action/A3clan'
+import { MessageFu } from '@/utils/message'
+import { Button } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import MyTable from '@/components/MyTable'
+import { A3tableC } from '@/utils/tableData'
+import A3add from '@/pages/A3clan/A3add'
 
 type Props = {
   sId: number
+  listAllRes: A1ListSelectType
 }
 
-function A2tab2clan({ sId }: Props) {
+function A2tab2clan({ sId, listAllRes }: Props) {
+  // 获取列表信息
+  const [list, setList] = useState<A3ListType[]>([])
+
+  const getList = useCallback(async () => {
+    const res = await A3_APIgetList(
+      {
+        pageNum: 1,
+        pageSize: 99999,
+        martyrId: sId
+      },
+      true
+    )
+    if (res.code === 0) {
+      setList(res.data.records || [])
+    }
+  }, [sId])
+
+  useEffect(() => {
+    getList()
+  }, [getList])
+
+  // 点击新增、编辑
+  const [editId, setEditId] = useState(0)
+
+  // 点击删除
+  const delTableFu = useCallback(
+    async (id: number) => {
+      const res = await A3_APIdel(id)
+      if (res.code === 0) {
+        MessageFu.success('删除成功!')
+        getList()
+      }
+    },
+    [getList]
+  )
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: any) => {
+          return (
+            <>
+              <Button size='small' type='text' onClick={() => setEditId(item.id)}>
+                编辑
+              </Button>
+              <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
+            </>
+          )
+        }
+      }
+    ]
+  }, [delTableFu])
+
   return (
     <div className={styles.A2tab2clan}>
-      <h1>A2tab2clan</h1>
+      <div className='A2t1btn'>
+        <Button type='primary' onClick={() => setEditId(-1)}>
+          新增线索
+        </Button>
+      </div>
+      <MyTable list={list} columnsTemp={A3tableC} lastBtn={tableLastBtn} pagingInfo={false} />
+
+      {editId ? (
+        <A3add
+          sId={editId}
+          closeFu={() => setEditId(0)}
+          addTableFu={getList}
+          upTableFu={getList}
+          listAllRes={listAllRes}
+          myMartyrId={sId}
+        />
+      ) : null}
     </div>
   )
 }

+ 1 - 0
后台管理/src/pages/A1record/data.ts

@@ -302,4 +302,5 @@ export type A1RRlistType = {
   relationMartyr: string
   relationModule: string
   isNew?: boolean
+  martyrId?: number
 }

+ 118 - 0
后台管理/src/pages/A3clan/A3add/index.module.scss

@@ -0,0 +1,118 @@
+.A3add {
+  position: absolute;
+  top: 0;
+  left: 0;
+  z-index: 100;
+  width: 100%;
+  height: 100%;
+  border-radius: 10px;
+  background-color: rgba(0, 0, 0, 0.6);
+  padding: 50px 100px;
+  overflow: hidden;
+  :global {
+    .A3addMain {
+      width: 100%;
+      height: 100%;
+      background-color: #fff;
+      border-radius: 10px;
+      position: relative;
+      padding: 15px;
+
+      .A3aTit {
+        font-weight: 700;
+        font-size: 16px;
+        color: var(--themeColor);
+        margin-bottom: 15px;
+      }
+
+      .A3accc {
+        width: calc(100% - 100px);
+        height: calc(100% - 30px);
+        overflow: auto;
+
+        .ant-form-item-label {
+          width: 81px;
+        }
+
+        .A3aRow {
+          display: flex;
+          justify-content: space-between;
+          .ant-form-item {
+            width: 48%;
+          }
+
+          .A3aRowSon {
+            width: 48%;
+            display: flex;
+            .ant-btn {
+              margin-left: 10px;
+            }
+            .ant-form-item {
+              width: calc(100% - 74px);
+            }
+          }
+        }
+        .A3aRowAll {
+          width: 100%;
+          .ant-form-item {
+            width: 100%;
+          }
+        }
+
+        .formRow {
+          display: flex;
+
+          .formLeft {
+            position: relative;
+            top: 3px;
+            width: 81px;
+            text-align: right;
+
+            & > span {
+              color: #ff4d4f;
+            }
+          }
+
+          .formRight {
+            width: calc(100% - 81px);
+            position: relative;
+            top: -15px;
+          }
+
+          .formRightBox {
+            top: 0;
+            margin-bottom: 24px;
+
+            .A1Rrow2 {
+              display: flex;
+              height: 22px;
+              margin: 10px 0;
+              & > div {
+                width: 50%;
+              }
+            }
+            .A1Rrow3 {
+              display: flex;
+              & > div {
+                width: 50%;
+                .ant-input-affix-wrapper {
+                  width: 90%;
+                }
+              }
+            }
+          }
+        }
+        .formRow2 {
+          margin-bottom: -20px;
+        }
+
+        .A3aBtn {
+          position: absolute;
+          top: 50%;
+          right: 20px;
+          transform: translateY(-50%);
+        }
+      }
+    }
+  }
+}

+ 344 - 0
后台管理/src/pages/A3clan/A3add/index.tsx

@@ -0,0 +1,344 @@
+import React, { useCallback, useEffect, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { A1ListSelectType, A1RRlistType } from '@/pages/A1record/data'
+import { Button, Cascader, Form, FormInstance, Input, Select } from 'antd'
+import { A3_APIgetInfo, A3_APIsave } from '@/store/action/A3clan'
+import { MessageFu } from '@/utils/message'
+import { myCity } from '@/utils/history'
+import TextArea from 'antd/es/input/TextArea'
+import ZupTypes from '@/components/ZupTypes'
+import ZupVideos from '@/components/ZupVideos'
+import MyPopconfirm from '@/components/MyPopconfirm'
+
+type Props = {
+  sId: number
+  closeFu: () => void
+  addTableFu: () => void
+  upTableFu: () => void
+  listAllRes: A1ListSelectType
+  // 从烈士档案中进来
+  myMartyrId?: number
+}
+
+function A3add({ sId, closeFu, addTableFu, upTableFu, listAllRes, myMartyrId }: Props) {
+  // 表单的ref
+  const FormBoxRef = useRef<FormInstance>(null)
+
+  // 多张图片的ref
+  const ZupImgsRef = useRef<any>(null)
+
+  // 多个视频的ref
+  const ZupVideosRef = useRef<any>(null)
+  // 存一个备份key 判断一下关联烈士有没有改变
+  const relationKeyRef = useRef('')
+
+  // 判断关联烈士是否编辑的时候删除掉
+  const relationIdRef = useRef(0)
+
+  // 编辑进来获取详情
+  const getInfoFu = useCallback(async (id: number) => {
+    const res = await A3_APIgetInfo(id)
+    if (res.code === 0) {
+      const obj = res.data
+
+      setNowName(obj.name)
+
+      setRelationObj(obj.relation || {})
+
+      if (obj.relation && obj.relation.id) {
+        relationIdRef.current = obj.relation.id
+
+        relationKeyRef.current =
+          obj.relation.martyrId +
+          (obj.relation.relationMartyr || '') +
+          (obj.relation.relationModule || '')
+      }
+
+      // 所在城市
+      if (obj.province) obj.myCity = [obj.province]
+      if (obj.city) obj.myCity.push(obj.city)
+      if (obj.region) obj.myCity.push(obj.region)
+
+      FormBoxRef.current?.setFieldsValue(obj)
+    }
+
+    const file = res.data.img || []
+    // 传给 附件 组件的
+    const sonInfo = {
+      type: 'img',
+      fileList: file
+    }
+    ZupImgsRef.current?.setFileComFileFu(sonInfo)
+    ZupVideosRef.current?.setFileComFileFu(res.data.video || [])
+  }, [])
+
+  useEffect(() => {
+    if (sId > 0) getInfoFu(sId)
+    if (myMartyrId) setRelationObj({ martyrId: myMartyrId } as A1RRlistType)
+  }, [getInfoFu, myMartyrId, sId])
+
+  const formDomRef = useRef<HTMLDivElement>(null)
+
+  // 关联烈士
+  const [relationObj, setRelationObj] = useState({} as A1RRlistType)
+
+  // 下拉框id转换成lable
+  const selectNameRes = useCallback(
+    (moduleId: number) => {
+      let txt = ''
+      const obj = listAllRes.find(v => v.value === moduleId)
+      if (obj) txt = obj.label
+      return txt
+    },
+    [listAllRes]
+  )
+
+  // 当前用户信息存起来
+  const [nowName, setNowName] = useState('')
+
+  // 没有通过校验
+  const onFinishFailed = useCallback(() => {}, [])
+
+  //  通过校验点击确定
+  const onFinish = useCallback(
+    async (values: any) => {
+      // 多张图片
+      const { sonFileIds, sonIsOk } = ZupImgsRef.current?.fileComFileResFu()
+
+      // 多个视频
+      const list = ZupVideosRef.current?.fileComFileResFu() || []
+
+      // 线索地址
+      let province = ''
+      let city = ''
+      let region = ''
+
+      if (values.myCity && values.myCity.length) {
+        province = values.myCity[0] || ''
+        city = values.myCity[1] || ''
+        region = values.myCity[2] || ''
+      }
+
+      let relation: any = null
+
+      // 对比一下key
+      if (relationObj.martyrId) {
+        const newKey =
+          relationObj.martyrId +
+          (relationObj.relationMartyr || '') +
+          (relationObj.relationModule || '')
+
+        // if (1 + 1 === 2) {
+        //   console.log(newKey, relationKeyRef.current)
+        //   return
+        // }
+        if (newKey !== relationKeyRef.current) {
+          relation = {
+            id: relationObj.id ? relationObj.id : null,
+            martyrId: relationObj.martyrId,
+            moduleId: sId > 0 ? sId : null,
+            relationMartyr: relationObj.relationMartyr,
+            relationModule: relationObj.relationModule,
+            type: 'kinship'
+          }
+        } else relation = null
+      }
+
+      let delRelationId: any = null
+
+      if (relationIdRef.current && !relationObj.martyrId) delRelationId = relationIdRef.current
+
+      const obj = {
+        ...values,
+        id: sId > 0 ? sId : null,
+        province,
+        city,
+        region,
+        martyrId: relationObj.martyrId ? relationObj.martyrId : null,
+        imgIds: sonIsOk ? '' : sonFileIds.join(','),
+        videoIds: list.map((v: any) => v.id).join(','),
+        relation,
+        delRelationId
+      }
+
+      const res = await A3_APIsave(obj)
+      if (res.code === 0) {
+        MessageFu.success(sId > 0 ? '编辑成功' : '新增成功')
+        sId > 0 ? upTableFu() : addTableFu()
+        closeFu()
+      }
+
+      // if (1 + 1 === 2) {
+      //   console.log('------222', obj)
+      //   return
+      // }
+    },
+    [addTableFu, closeFu, sId, upTableFu, relationObj]
+  )
+
+  return (
+    <div className={styles.A3add} style={{ position: myMartyrId ? 'fixed' : 'absolute' }}>
+      <div className='A3addMain'>
+        <div className='A3aTit'>{sId > 0 ? '编辑' : '新增'}亲属</div>
+
+        <div className='A3accc' ref={formDomRef}>
+          <div>
+            <Form
+              ref={FormBoxRef}
+              name='basic'
+              onFinish={onFinish}
+              onFinishFailed={onFinishFailed}
+              autoComplete='off'
+              scrollToFirstError
+            >
+              <div className='A3aRow'>
+                <Form.Item
+                  label='姓名'
+                  name='name'
+                  rules={[{ required: true, message: '请输入姓名' }]}
+                  // getValueFromEvent={(e) => e.target.value.replace(/\s+/g, "")}
+                  getValueFromEvent={e => e.target.value.trim()}
+                >
+                  <Input
+                    onChange={e => setNowName(e.target.value)}
+                    maxLength={10}
+                    showCount
+                    placeholder='请输入内容'
+                  />
+                </Form.Item>
+
+                <Form.Item label='联系方式' name='contact'>
+                  <Input maxLength={50} showCount placeholder='请输入内容' />
+                </Form.Item>
+              </div>
+
+              <div className='A3aRow'>
+                <Form.Item label='所在城市' name='myCity'>
+                  <Cascader options={myCity} placeholder='请选择' allowClear changeOnSelect />
+                </Form.Item>
+                <Form.Item label='城市详址' name='address'>
+                  <Input maxLength={50} showCount placeholder='请输入内容' />
+                </Form.Item>
+              </div>
+
+              <div className='A3aRowAll'>
+                <Form.Item label='个人介绍' name='intro'>
+                  <TextArea maxLength={500} showCount placeholder='请输入内容' />
+                </Form.Item>
+              </div>
+
+              {/* 多个图片 */}
+              <div className='formRow'>
+                <div className='formLeft'>图片:</div>
+                <div className='formRight'>
+                  <ZupTypes
+                    ref={ZupImgsRef}
+                    isLook={false}
+                    fileCheck={false}
+                    selecFlag='图片'
+                    imgSize={5}
+                    imgLength={50}
+                    dirCode='A3clan'
+                    myUrl='cms/kinship/upload'
+                    isTypeShow={true}
+                  />
+                </div>
+              </div>
+
+              {/* 多个视频 */}
+              <div className='formRow formRow2'>
+                <div className='formLeft'>视频:</div>
+                <div className='formRight'>
+                  <ZupVideos
+                    isLook={false}
+                    size={500}
+                    fileNum={50}
+                    dirCode='A3clanVideo'
+                    myUrl='cms/kinship/upload'
+                    upTxt=';数量不超过50个。'
+                    ref={ZupVideosRef}
+                  />
+                </div>
+              </div>
+
+              <div className='formRow'>
+                <div className='formLeft'>关联烈士:</div>
+                <div className='formRight formRightBox'>
+                  <div>
+                    <Select
+                      disabled={!!myMartyrId}
+                      style={{ width: 558 }}
+                      getPopupContainer={() => document.querySelector('.ant-modal-content')!}
+                      filterOption={(input, option) =>
+                        (option?.label ?? '').toLowerCase().includes(input.toLowerCase())
+                      }
+                      allowClear
+                      placeholder='请搜索并选择'
+                      showSearch
+                      options={listAllRes}
+                      value={relationObj.martyrId || null}
+                      onChange={e => setRelationObj({ ...relationObj, martyrId: e })}
+                    />
+                  </div>
+                  <div className='A1Rrow2'>
+                    <div>
+                      {nowName} → {selectNameRes(relationObj.martyrId!)}
+                    </div>
+                    <div>
+                      {selectNameRes(relationObj.martyrId!)} → {nowName}
+                    </div>
+                  </div>
+
+                  <div className='A1Rrow3'>
+                    <div>
+                      <Input
+                        placeholder='请输入'
+                        maxLength={10}
+                        showCount
+                        value={relationObj.relationMartyr}
+                        onChange={e =>
+                          setRelationObj({ ...relationObj, relationMartyr: e.target.value.trim() })
+                        }
+                      />
+                    </div>
+                    <div>
+                      <Input
+                        placeholder='请输入'
+                        maxLength={10}
+                        showCount
+                        value={relationObj.relationModule}
+                        onChange={e =>
+                          setRelationObj({ ...relationObj, relationModule: e.target.value.trim() })
+                        }
+                      />
+                    </div>
+                  </div>
+                </div>
+              </div>
+
+              <div className='A3aRowAll'>
+                <Form.Item label='备注' name='remark'>
+                  <TextArea maxLength={500} showCount placeholder='请输入内容' />
+                </Form.Item>
+              </div>
+
+              {/* 确定和取消按钮 */}
+              <Form.Item className='A3aBtn'>
+                <Button type='primary' htmlType='submit'>
+                  提交
+                </Button>
+                <br />
+                <br />
+                <MyPopconfirm txtK='取消' onConfirm={closeFu} />
+              </Form.Item>
+            </Form>
+          </div>
+        </div>
+      </div>
+    </div>
+  )
+}
+
+const MemoA3add = React.memo(A3add)
+
+export default MemoA3add

+ 22 - 0
后台管理/src/pages/A3clan/data.ts

@@ -0,0 +1,22 @@
+export type A3ListType = {
+  address: string
+  city: string
+  contact: string
+  createTime: string
+  creatorId: number
+  creatorName: string
+  id: number
+  img?: any
+  imgIds: string
+  intro: string
+  martyrId: number
+  martyrName: string
+  name: string
+  province: string
+  region: string
+  relation?: any
+  remark: string
+  updateTime: string
+  video?: any
+  videoIds: string
+}

+ 35 - 0
后台管理/src/pages/A3clan/index.module.scss

@@ -1,4 +1,39 @@
 .A3clan {
   :global {
+    .A3top {
+      padding: 15px 24px;
+      border-radius: 10px;
+      background-color: #fff;
+      display: flex;
+      justify-content: space-between;
+
+      .A3topLeft {
+        display: flex;
+
+        & > div {
+          margin-right: 24px;
+          .ant-btn {
+            margin-right: 10px;
+          }
+        }
+      }
+    }
+
+    .A3tableBox {
+      border-radius: 10px;
+      overflow: hidden;
+      margin-top: 15px;
+      height: calc(100% - 77px);
+      background-color: #fff;
+
+      .ant-table-body {
+        height: 645px;
+        overflow: auto !important;
+      }
+
+      .ant-table-cell {
+        padding: 8px !important;
+      }
+    }
   }
 }

+ 184 - 2
后台管理/src/pages/A3clan/index.tsx

@@ -1,9 +1,191 @@
-import React from 'react'
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
+import { useDispatch, useSelector } from 'react-redux'
+import { A1ListSelectType, A1ListType } from '../A1record/data'
+import { A1_APIgetList } from '@/store/action/A1record'
+import { A3_APIdel, A3_APIgetList } from '@/store/action/A3clan'
+import { RootState } from '@/store'
+import { MessageFu } from '@/utils/message'
+import { Button, Input, Select } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import MyTable from '@/components/MyTable'
+import { A3tableC } from '@/utils/tableData'
+import A3add from './A3add'
+
+const baseFromData = {
+  pageNum: 1,
+  pageSize: 10,
+  searchKey: '',
+  martyrId: ''
+}
+
 function A3clan() {
+  const dispatch = useDispatch()
+
+  // 获取所有烈士信息
+  const [listAllRes, setListAllRes] = useState<A1ListSelectType>([])
+
+  const getListAllFu = useCallback(async () => {
+    const res = await A1_APIgetList(
+      {
+        pageNum: 1,
+        pageSize: 99999
+      },
+      true
+    )
+    if (res.code === 0) {
+      const list: A1ListType[] = res.data.records || []
+      setListAllRes(
+        list.map(c => ({
+          value: c.id,
+          label: c.name
+        }))
+      )
+    }
+  }, [])
+
+  useEffect(() => {
+    getListAllFu()
+  }, [getListAllFu])
+  // 获取所有烈士信息-end
+
+  const [fromData, setFromData] = useState(baseFromData)
+
+  const getListFu = useCallback(() => {
+    dispatch(A3_APIgetList(fromData))
+  }, [dispatch, fromData])
+
+  useEffect(() => {
+    getListFu()
+  }, [getListFu])
+
+  const tableInfo = useSelector((state: RootState) => state.A3clan.tableInfo)
+
+  // 点击重置
+  const resetSelectFu = useCallback(() => {
+    setInputKey(Date.now())
+    setFromData({ ...baseFromData })
+  }, [])
+
+  // 下拉框的改变
+  const selectChangeFu = useCallback(
+    (value: any, key: 'martyrId') => {
+      setFromData({ ...fromData, [key]: value, pageNum: 1 })
+    },
+    [fromData]
+  )
+
+  // 作品名称的输入
+  const timeRef = useRef(-1)
+  const [inputKey, setInputKey] = useState(0)
+  const fromKeyChangeFu = useCallback(
+    (e: React.ChangeEvent<HTMLInputElement>, key: 'searchKey') => {
+      clearTimeout(timeRef.current)
+      timeRef.current = window.setTimeout(() => {
+        setFromData({ ...fromData, [key]: e.target.value, pageNum: 1 })
+      }, 500)
+    },
+    [fromData]
+  )
+
+  // 点击新增、编辑
+  const [editId, setEditId] = useState(0)
+
+  // 点击删除
+  const delTableFu = useCallback(
+    async (id: number) => {
+      const res = await A3_APIdel(id)
+      if (res.code === 0) {
+        MessageFu.success('删除成功!')
+        getListFu()
+      }
+    },
+    [getListFu]
+  )
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: any) => {
+          return (
+            <>
+              <Button size='small' type='text' onClick={() => setEditId(item.id)}>
+                编辑
+              </Button>
+              <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
+            </>
+          )
+        }
+      }
+    ]
+  }, [delTableFu])
+
   return (
     <div className={styles.A3clan}>
-      <div className='pageTitle'>亲属信息</div>
+      <div className='pageTitle'>亲属信息{editId ? (editId > 0 ? ' - 编辑' : ' - 新增') : ''}</div>
+      {/* 顶部筛选 */}
+      <div className='A3top'>
+        <div className='A3topLeft'>
+          <div>
+            <Input
+              key={inputKey}
+              maxLength={30}
+              showCount
+              style={{ width: 300 }}
+              placeholder='请输入亲属姓名或联系方式'
+              allowClear
+              onChange={e => fromKeyChangeFu(e, 'searchKey')}
+            />
+          </div>
+
+          <div>
+            <Select
+              style={{ width: 240 }}
+              filterOption={(input, option) =>
+                (option?.label ?? '').toLowerCase().includes(input.toLowerCase())
+              }
+              allowClear
+              placeholder='搜索并选择关联烈士'
+              showSearch
+              options={listAllRes}
+              value={fromData.martyrId || null}
+              onChange={e => selectChangeFu(e, 'martyrId')}
+            />
+          </div>
+        </div>
+
+        <div>
+          <Button onClick={resetSelectFu}>重置</Button>
+          &emsp;
+          <Button type='primary' onClick={() => setEditId(-1)}>
+            新增
+          </Button>
+        </div>
+      </div>
+
+      {/* 表格主体 */}
+      <div className='A3tableBox'>
+        <MyTable
+          yHeight={645}
+          list={tableInfo.list}
+          columnsTemp={A3tableC}
+          lastBtn={tableLastBtn}
+          pageNum={fromData.pageNum}
+          pageSize={fromData.pageSize}
+          total={tableInfo.total}
+          onChange={(pageNum, pageSize) => setFromData({ ...fromData, pageNum, pageSize })}
+        />
+      </div>
+      {editId ? (
+        <A3add
+          sId={editId}
+          closeFu={() => setEditId(0)}
+          addTableFu={resetSelectFu}
+          upTableFu={getListFu}
+          listAllRes={listAllRes}
+        />
+      ) : null}
     </div>
   )
 }

+ 42 - 0
后台管理/src/store/action/A3clan.ts

@@ -0,0 +1,42 @@
+import http from '@/utils/http'
+import { AppDispatch } from '..'
+/**
+ * 亲属信息-获取列表
+ */
+export const A3_APIgetList = (data: any, flag = false): any => {
+  if (flag) return http.post('cms/kinship/pageList', data)
+  else {
+    return async (dispatch: AppDispatch) => {
+      const res = await http.post('cms/kinship/pageList', data)
+      if (res.code === 0) {
+        const obj = {
+          list: res.data.records,
+          total: res.data.total
+        }
+
+        dispatch({ type: 'A3/getList', payload: obj })
+      }
+    }
+  }
+}
+
+/**
+ * 亲属信息-删除
+ */
+export const A3_APIdel = (id: number) => {
+  return http.get(`cms/kinship/remove/${id}`)
+}
+
+/**
+ * 亲属信息-新增
+ */
+export const A3_APIsave = (data: any) => {
+  return http.post('cms/kinship/save', data)
+}
+
+/**
+ * 亲属信息-获取详情
+ */
+export const A3_APIgetInfo = (id: number) => {
+  return http.get(`cms/kinship/detail/${id}`)
+}

+ 28 - 0
后台管理/src/store/reducer/A3clan.ts

@@ -0,0 +1,28 @@
+import { A3ListType } from '@/pages/A3clan/data'
+
+// 初始化状态
+const initState = {
+  // 列表数据
+  tableInfo: {
+    list: [] as A3ListType[],
+    total: 0
+  }
+}
+
+// 定义 action 类型
+type Props = {
+  type: 'A3/getList'
+  payload: { list: A3ListType[]; total: number }
+}
+
+// reducer
+export default function userReducer(state = initState, action: Props) {
+  switch (action.type) {
+    // 获取列表数据
+    case 'A3/getList':
+      return { ...state, tableInfo: action.payload }
+
+    default:
+      return state
+  }
+}

+ 2 - 0
后台管理/src/store/reducer/index.ts

@@ -5,6 +5,7 @@ import { combineReducers } from 'redux'
 import A0Layout from './layout'
 import A1record from './A1record'
 import A2clue from './A2clue'
+import A3clan from './A3clan'
 
 import Z1user from './Z1user'
 import Z2log from './Z2log'
@@ -14,6 +15,7 @@ const rootReducer = combineReducers({
   A0Layout,
   A1record,
   A2clue,
+  A3clan,
   Z1user,
   Z2log
 })

+ 11 - 1
后台管理/src/utils/tableData.ts

@@ -28,11 +28,21 @@ export const A2tableC = [
   ['txtChange', '线索状态', 'status', A2select2Obj],
   ['cityAll', '线索地址', 'province', 'city', 'region', 'address'],
   ['txt', '提供者信息', 'supply'],
-
   ['txt', '编辑时间', 'updateTime'],
   ['txt', '编辑人', 'creatorName']
 ]
 
+export const A3tableC = [
+  ['txt', '姓名', 'name'],
+  ['cityAll', '所在城市', 'province', 'city', 'region', 'address'],
+  ['txt', '联系方式', 'contact'],
+  ['text', '个人介绍', 'intro', 80],
+  ['txt', '关联烈士', 'martyrName'],
+  ['txt', '编辑时间', 'updateTime'],
+  ['txt', '编辑人', 'creatorName'],
+  ['text', '备注', 'remark', 80]
+]
+
 export const Z1tableC = [
   ['txt', '用户名', 'userName'],
   ['txtChange', '角色', 'isAdmin', { 1: '管理员', 0: '普通成员' }],