shaogen1995 1 mese fa
parent
commit
cb601760e8

+ 1 - 1
src/index.tsx

@@ -23,7 +23,7 @@ root.render(
     locale={locale}
     theme={{
       token: {
-        colorPrimary: '#002c15'
+        colorPrimary: '#ab925b'
       }
     }}
   >

+ 218 - 0
src/pages/Isystem/I2dict/I2add.tsx

@@ -0,0 +1,218 @@
+import React, { useCallback, useEffect, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { Button, Cascader, Form, FormInstance, Input, InputNumber, Modal } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { useSelector } from 'react-redux'
+import { RootState } from '@/store'
+import { MessageFu } from '@/utils/message'
+import { I2AddInfoType, TypeI2dict } from './data'
+import { I2_APIgetInfo, I2_APIsave } from '@/store/action/Isystem/I2dict'
+
+type Props = {
+  acShuTxt: string
+  addInfo: I2AddInfoType
+  addFu: () => void
+  closeFu: () => void
+  isNoAcIds: string[] //没有数据或者删除了的时候-既右侧没有操作的时候用到
+}
+
+function I2add({ addInfo, addFu, closeFu, isNoAcIds, acShuTxt }: Props) {
+  const { dictList: treeData } = useSelector((state: RootState) => state.I2dict)
+
+  // 级联选择器改变的时候 筛选当前级联的 信息出来
+  const [acCardInfo, setAcCardInfo] = useState({} as TypeI2dict)
+  const [parentIdArr, setParentIdArr] = useState<string[] | null>(null)
+
+  // useEffect(() => {
+  //   console.log(acCardInfo, parentIdArr)
+  // }, [acCardInfo, parentIdArr])
+
+  const saveIdsRef = useRef<string[]>([])
+
+  useEffect(() => {
+    setAcCardInfo(addInfo.acInfo)
+
+    let ids: string[] | null = addInfo.acInfo.id ? [addInfo.acInfo.id] : null
+
+    if (addInfo.acInfo.ancestor) ids = [...addInfo.acInfo.ancestor.split(','), addInfo.acInfo.id]
+
+    let idsRes = ids
+    if (ids && ids.length >= 1 && addInfo.txt === '编辑') {
+      ids.pop()
+    }
+
+    if (idsRes) {
+      // 保存的时候需要补前面3个级别
+      saveIdsRef.current = idsRes.filter((v, i) => i <= 2)
+      // 去掉0和前2级
+      idsRes = idsRes.filter((v, i) => i > 2)
+    }
+
+    setParentIdArr(idsRes)
+  }, [addInfo.acInfo, addInfo.txt])
+
+  const cardChange = useCallback((aa: any, bb: any) => {
+    setParentIdArr(aa)
+
+    if (bb && bb.length) setAcCardInfo(bb[bb.length - 1])
+    else setAcCardInfo({} as TypeI2dict)
+  }, [])
+
+  const getInfoFu = useCallback(async (id: string) => {
+    const res = await I2_APIgetInfo(id)
+    if (res.code === 0) {
+      FormBoxRef.current?.setFieldsValue({
+        ...res.data
+      })
+    }
+  }, [])
+  useEffect(() => {
+    if (addInfo.txt === '编辑') getInfoFu(addInfo.id)
+    else {
+      FormBoxRef.current?.setFieldsValue({
+        sort: 50000
+      })
+    }
+  }, [addInfo.id, addInfo.txt, getInfoFu])
+
+  // 设置表单初始数据(区分编辑和新增)
+  const FormBoxRef = useRef<FormInstance>(null)
+
+  // 没有通过校验
+  const onFinishFailed = useCallback(() => {
+    // return MessageFu.warning("有表单不符号规则!");
+  }, [])
+
+  // 通过校验点击确定
+  const onFinish = useCallback(
+    async (values: any) => {
+      let ancestor = ''
+      let parentId: string | null = null
+
+      if (parentIdArr && parentIdArr.length >= 5 && addInfo.txt === '新增')
+        return MessageFu.warning('最多支持五级!')
+
+      if (acCardInfo) parentId = addInfo.txt === '编辑' ? acCardInfo.parentId : acCardInfo.id
+      if (parentIdArr && parentId) {
+        let arrTemp = [...saveIdsRef.current, ...parentIdArr.filter(v => v !== addInfo.id)]
+        ancestor = arrTemp.join(',')
+      }
+
+      // 新增并且没有父级
+      if (addInfo.txt === '新增' && !parentId && !ancestor) {
+        // console.log('xxx', saveIdsRef.current)
+
+        parentId = saveIdsRef.current[saveIdsRef.current.length - 1]
+        ancestor = saveIdsRef.current.join(',')
+        // console.log(123, parentId, ancestor)
+
+        // 外层没有选中
+        if (!addInfo.acInfo.id) {
+          parentId = isNoAcIds[isNoAcIds.length - 1]
+          ancestor = isNoAcIds.join(',')
+        }
+      }
+
+      // let level = 1
+      // if (parentIdArr) {
+      //   level = addInfo.txt === '新增' ? acCardInfo.level + 1 : acCardInfo.level
+      // }
+      const obj = {
+        ...values,
+        id: addInfo.txt === '编辑' ? addInfo.id : null,
+        ancestor,
+        // level,
+        parentId,
+        type: 'dict'
+      }
+      // console.log(123, obj)
+      // if (1 + 1 === 2) {
+      //   return
+      // }
+
+      const res = await I2_APIsave(obj)
+
+      if (res.code === 0) {
+        MessageFu.success(addInfo.txt + '成功!')
+        addFu()
+        closeFu()
+      }
+    },
+    [acCardInfo, addFu, addInfo.acInfo.id, addInfo.id, addInfo.txt, closeFu, isNoAcIds, parentIdArr]
+  )
+  return (
+    <Modal
+      wrapClassName={styles.I2add}
+      open={true}
+      title={addInfo.txt}
+      footer={
+        [] // 设置footer为空,去掉 取消 确定默认按钮
+      }
+    >
+      <div className='I2aMain'>
+        <Form
+          scrollToFirstError={true}
+          ref={FormBoxRef}
+          name='basic'
+          labelCol={{ span: 3 }}
+          onFinish={onFinish}
+          onFinishFailed={onFinishFailed}
+          autoComplete='off'
+        >
+          <div className='fromRow'>
+            <div className='fromRowll'>上级字典:</div>
+            <div className='fromRowrr'>
+              <Cascader
+                style={{ width: 658 }}
+                disabled={addInfo.txt === '编辑'}
+                changeOnSelect
+                fieldNames={{ label: 'name', value: 'id', children: 'children' }}
+                options={treeData}
+                // placeholder={addInfo.txt === '编辑' ? '空' : '请选择'}
+                placeholder={acShuTxt}
+                value={parentIdArr ? [...parentIdArr] : []}
+                onChange={cardChange}
+              />
+            </div>
+          </div>
+
+          <Form.Item
+            label='字典值'
+            name='name'
+            rules={[{ required: true, message: '请输入字典值!' }]}
+            getValueFromEvent={e => e.target.value.replace(/\s+/g, '')}
+          >
+            <Input maxLength={30} showCount placeholder='请输入内容' />
+          </Form.Item>
+
+          <div className='fromRow2'>
+            <Form.Item
+              label='排序值'
+              name='sort'
+              rules={[{ required: true, message: '请输入排序值!' }]}
+            >
+              <InputNumber min={1} max={50000} precision={0} placeholder='请输入' />
+            </Form.Item>
+            <div className='fromRowTit'>
+              请输入1~50000的数字。数字越小,排序越靠前。数字相同时,更新发布的内容排在前面
+            </div>
+          </div>
+
+          {/* 确定和取消按钮 */}
+          <br />
+          <Form.Item wrapperCol={{ offset: 9, span: 16 }}>
+            <Button type='primary' htmlType='submit'>
+              提交
+            </Button>
+            &emsp;
+            <MyPopconfirm txtK='取消' onConfirm={closeFu} />
+          </Form.Item>
+        </Form>
+      </div>
+    </Modal>
+  )
+}
+
+const MemoI2add = React.memo(I2add)
+
+export default MemoI2add

+ 80 - 0
src/pages/Isystem/I2dict/data.ts

@@ -0,0 +1,80 @@
+export type TypeI2dict = {
+  id: string
+  parentId: string
+  sort: number
+  name: string
+  num: string
+  description: any
+  ancestor: string
+  level: number
+  children?: TypeI2dict[]
+
+  __keep?: boolean
+}
+
+export type I2AddInfoType = {
+  id: string
+  txt: '新增' | '编辑'
+  acInfo: TypeI2dict
+}
+
+// 把所有的字典,只保留前面2级,给下拉框筛选
+export const I2toTowFu = (data: TypeI2dict[]) => {
+  return data.map(item => ({
+    ...item,
+    children: item.children?.map(child => ({
+      ...child,
+      children: undefined // 移除第三层子级
+    }))
+  }))
+}
+
+// 通过id获取 树的obj
+export const treeResIdFu = (list: any, id: string) => {
+  // 每次进来使用find遍历一次
+  let res = list.find((item: any) => item.id === id)
+
+  if (res) {
+    return res
+  } else {
+    for (let i = 0; i < list.length; i++) {
+      if (list[i].children instanceof Array && list[i].children.length > 0) {
+        res = treeResIdFu(list[i].children, id)
+
+        if (res) return res
+      }
+    }
+
+    return null
+  }
+}
+
+// -------------------树结构的搜索过滤-------------------
+export const filterTreeByName = (tree: TypeI2dict[], searchTemp: string): TypeI2dict[] => {
+  const searchKey = searchTemp.toUpperCase()
+
+  const dfs = (node: TypeI2dict): TypeI2dict | null => {
+    // 先递归处理子节点(深度优先)
+    const filteredChildren = (node.children?.map(dfs).filter(Boolean) as TypeI2dict[]) || []
+
+    // 判断当前节点是否匹配或子节点有匹配项
+
+    const txt = node.name.toUpperCase() + (node.num || '').toUpperCase()
+
+    const isSelfMatch = txt.includes(searchKey)
+
+    // console.log('pppppppp', isSelfMatch, searchKey, node.num)
+
+    const hasChildMatch = filteredChildren.length > 0
+
+    if (isSelfMatch || hasChildMatch) {
+      return {
+        ...node,
+        children: hasChildMatch ? filteredChildren : undefined
+      }
+    }
+    return null
+  }
+
+  return tree.map(dfs).filter(Boolean) as TypeI2dict[]
+}

+ 137 - 0
src/pages/Isystem/I2dict/index.module.scss

@@ -1,4 +1,141 @@
 .I2dict {
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 24px;
   :global {
+    .I2top {
+      display: flex;
+      justify-content: space-between;
+      .I2topll {
+        display: flex;
+        align-items: center;
+      }
+    }
+    .I2main {
+      margin-top: 20px;
+      height: calc(100% - 30px);
+      display: flex;
+      justify-content: space-between;
+      .I2m1ll {
+        width: 70%;
+        overflow-y: auto;
+        .site-tree-search-value {
+          color: red;
+          font-weight: 700;
+        }
+        .ant-tree {
+          min-height: 100%;
+          padding: 10px;
+        }
+        .I2m1llNone {
+          width: 70%;
+          height: 80%;
+          display: flex;
+          justify-content: center;
+          align-items: center;
+          color: var(--themeColor);
+          font-size: 20px;
+          letter-spacing: 4px;
+          font-weight: 700;
+        }
+
+        .NODATA {
+          display: flex;
+          flex-direction: column;
+          justify-content: center;
+          align-items: center;
+          color: #666666;
+          font-size: 16px;
+          height: 100%;
+          // img {
+          //   width: 150px;
+          // }
+          & > p {
+            margin-bottom: 10px;
+          }
+          div {
+            width: 80%;
+            margin-top: 8%;
+            display: flex;
+            justify-content: space-around;
+          }
+        }
+      }
+      .I2m1rr {
+        width: calc(30% - 24px);
+        padding: 20px;
+        .I2mr1 {
+          font-weight: 700;
+          color: var(--themeColor);
+          font-size: 24px;
+        }
+        .I2mr2 {
+          margin: 20px 0 40px;
+          .ant-btn {
+            font-size: 24px;
+            height: 46px;
+          }
+        }
+
+        .I2mr3 {
+          display: flex;
+          font-size: 20px;
+          margin-bottom: 30px;
+          .I2mr3ll {
+            width: 100px;
+            text-align: right;
+            font-weight: 700;
+          }
+          .I2mr3rr {
+            width: calc(100% - 100px);
+          }
+        }
+      }
+    }
+  }
+}
+
+// 新增弹窗页面
+.I2add {
+  :global {
+    .ant-modal-close {
+      display: none;
+    }
+
+    .ant-modal {
+      width: 800px !important;
+    }
+
+    .ant-modal-body {
+      border-top: 1px solid #ccc;
+    }
+
+    .I2aMain {
+      padding-top: 15px;
+      .fromRow2 {
+        position: relative;
+
+        .fromRowTit {
+          position: absolute;
+          left: 200px;
+          top: 5px;
+          color: #999;
+          font-size: 12px;
+        }
+      }
+      .fromRow {
+        display: flex;
+        align-items: center;
+        margin-bottom: 24px;
+        .fromRowll {
+          width: 94px;
+          text-align: right;
+          position: relative;
+        }
+        .fromRowrr {
+          width: calc(100% - 94px);
+        }
+      }
+    }
   }
 }

+ 281 - 1
src/pages/Isystem/I2dict/index.tsx

@@ -1,9 +1,289 @@
-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 { RootState } from '@/store'
+import { Button, Cascader, Input, Tree, TreeDataNode } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { MessageFu } from '@/utils/message'
+import { I2_APIdel, I2_APIgetDict } from '@/store/action/Isystem/I2dict'
+import { filterTreeByName, I2AddInfoType, I2toTowFu, treeResIdFu, TypeI2dict } from './data'
+import I2add from './I2add'
+
 function I2dict() {
+  const [loding, setLoding] = useState(false)
+
+  const dispatch = useDispatch()
+
+  useEffect(() => {
+    dispatch(I2_APIgetDict())
+  }, [dispatch])
+
+  // 级联改变
+  // 待完善sg-初始id
+  const [topId, setTopId] = useState(['10000', '12000'])
+
+  // 传给新增、编辑子组件(没有数据或者删除了的时候-既右侧没有操作的时候)
+  const isNoAcIds = useRef<string[]>([])
+
+  useEffect(() => {
+    isNoAcIds.current = ['0', ...topId]
+
+    if (topId && topId.length)
+      dispatch(
+        I2_APIgetDict(topId[1], data => {
+          setLoding(true)
+          if (data && data.length) {
+            setAcShu(data[0].id)
+            const txtDom: HTMLDivElement = document.querySelector('.ant-select-selection-item')!
+            if (txtDom) {
+              acShuTxtRef.current = txtDom.title
+            }
+          }
+        })
+      )
+  }, [dispatch, topId])
+
+  const onChange = useCallback((value: any) => {
+    // console.log('级联改变', value)
+    setTopId(value)
+  }, [])
+
+  const { dictAll, dictList } = useSelector((state: RootState) => state.I2dict)
+
+  // 点击重置
+  const resetFu = useCallback(
+    (flag: boolean) => {
+      // 重置 flag为true
+      // 新增和编辑 为false
+      if (flag) {
+        setTopId(['10000', '12000'])
+      } else dispatch(I2_APIgetDict(topId[1]))
+
+      setValue('')
+      setValue2('')
+    },
+    [dispatch, topId]
+  )
+
+  // 当前选中的树节点ID
+  const [acShu, setAcShu] = useState('0')
+  // 树节点文字信息
+  const acShuTxtRef = useRef('')
+
+  // 点击树节点
+  const onSelect = (id: any) => {
+    // console.log('点击树节点', id)
+    if (id[0]) {
+      setAcShu(id[0])
+      // const txtDom: HTMLDivElement = document.querySelector('.ant-select-selection-item')!
+      // console.log('-------11', txtDom.title)
+      // if (txtDom) acShuTxtRef.current = txtDom.title
+    }
+  }
+
+  const [value, setValue] = useState('')
+  const [value2, setValue2] = useState('')
+
+  const timeRef = useRef(-1)
+  const valueChange = useCallback((val: string) => {
+    setValue(val.trim())
+    clearTimeout(timeRef.current)
+    timeRef.current = window.setTimeout(() => {
+      setValue2(val.trim())
+    }, 500)
+  }, [])
+
+  // value变化的时候获取所有dom 设置隐藏
+  const treeDataTemp = useMemo(() => {
+    if (value2) {
+      return filterTreeByName(dictList, value2)
+    } else return dictList
+  }, [dictList, value2])
+
+  // 搜索高亮
+  const treeData = useMemo(() => {
+    const loop = (dataTemp: any[]): TreeDataNode[] => {
+      const data = dataTemp || []
+
+      return data.map(item => {
+        const strTitle = ((item.num ? item.num + ' ' : '') + item.name) as string
+        const strTitleD = strTitle.toUpperCase()
+
+        const valueD = value.toUpperCase()
+        const index = strTitleD.indexOf(valueD)
+
+        const beforeStr = strTitle.substring(0, index)
+        const afterStr = strTitle.slice(index + value.length)
+        const title =
+          index > -1 ? (
+            <span key={item.id}>
+              {beforeStr}
+              <span className='site-tree-search-value'>{value}</span>
+              {afterStr}
+            </span>
+          ) : (
+            <span key={item.id}>{strTitle}</span>
+          )
+        if (item.children) {
+          return { title, key: item.id, children: loop(item.children) }
+        }
+        return {
+          title,
+          key: item.id
+        }
+      })
+    }
+
+    return loop(treeDataTemp)
+  }, [treeDataTemp, value])
+
+  // 右侧信息
+  const rightData = useMemo(() => {
+    let obj = {} as TypeI2dict
+    if (treeDataTemp && treeDataTemp.length) obj = treeResIdFu(treeDataTemp, acShu)
+
+    return obj || {}
+  }, [acShu, treeDataTemp])
+
+  // 点击新增和编辑
+  const [addInfo, setAddInfo] = useState({} as I2AddInfoType)
+
+  const addSonFu = useCallback(
+    (id: string) => {
+      setAddInfo({
+        id,
+        txt: id === '-1' ? '新增' : '编辑',
+        acInfo: rightData
+      })
+    },
+    [rightData]
+  )
+
+  // 点击删除
+  const delTree = useCallback(
+    async (id: string) => {
+      const res = await I2_APIdel(id)
+      if (res.code === 0) {
+        MessageFu.success('删除成功!')
+        resetFu(false)
+      }
+    },
+    [resetFu]
+  )
+
   return (
     <div className={styles.I2dict}>
       <div className='pageTitle'>数据字典</div>
+      {/* 顶部 */}
+      <div className='I2top'>
+        <div className='I2topll'>
+          {dictAll.length ? (
+            <Cascader
+              style={{ width: 240 }}
+              value={topId}
+              options={I2toTowFu(dictAll)}
+              fieldNames={{ label: 'name', value: 'id', children: 'children' }}
+              onChange={onChange}
+              allowClear={false}
+            />
+          ) : (
+            <div style={{ width: 240 }}></div>
+          )}
+          &emsp;
+          <Input
+            style={{ width: 240 }}
+            placeholder='请输入字典值'
+            maxLength={30}
+            value={value}
+            onChange={e => valueChange(e.target.value)}
+          />
+        </div>
+        <div className='I2toprr'>
+          <Button
+            type='primary'
+            onClick={() =>
+              setAddInfo({
+                id: '-1',
+                txt: '新增',
+                acInfo: rightData
+              })
+            }
+          >
+            新增
+          </Button>
+          &emsp;
+          <Button onClick={() => resetFu(true)}>重置</Button>
+        </div>
+      </div>
+      {/* 主体 */}
+      <div className='I2main'>
+        <div className='I2m1ll'>
+          {treeDataTemp && treeDataTemp.length ? (
+            <Tree
+              // 默认全部展开
+              defaultExpandAll={true}
+              // 数据
+              treeData={treeData}
+              // 自定义字段
+              // fieldNames={{ title: 'name', key: 'id', children: 'children' }}
+              // 选中
+              selectedKeys={[acShu]}
+              // 点击
+              onSelect={onSelect}
+            />
+          ) : null}
+
+          {loding && treeDataTemp.length === 0 ? (
+            <div className='NODATA'>
+              <p>暂无相关搜索结果,请更换关键字搜索</p>
+            </div>
+          ) : null}
+        </div>
+        <div className='I2m1rr'>
+          {rightData.id ? (
+            <>
+              <div className='I2mr1'>操作</div>
+              <div className='I2mr2'>
+                <Button type='text' onClick={() => addSonFu(rightData.id)}>
+                  编辑
+                </Button>
+                &emsp;
+                <MyPopconfirm txtK='删除' onConfirm={() => delTree(rightData.id)} />
+              </div>
+
+              {/* <div className='I2mr3'>
+                <div className='I2mr3ll'>id:</div>
+                <div className='I2mr3rr'>{rightData.id}</div>
+              </div> */}
+
+              <div className='I2mr3'>
+                <div className='I2mr3ll'>字典值:</div>
+                <div className='I2mr3rr'>{rightData.name}</div>
+              </div>
+
+              <div className='I2mr3'>
+                <div className='I2mr3ll'>层级:</div>
+                <div className='I2mr3rr'>{rightData.level - 2}</div>
+              </div>
+
+              <div className='I2mr3'>
+                <div className='I2mr3ll'>排序值:</div>
+                <div className='I2mr3rr'>{rightData.sort}</div>
+              </div>
+            </>
+          ) : null}
+        </div>
+      </div>
+      {/* 新增/编辑页面 中图法分类 */}
+      {addInfo.id ? (
+        <I2add
+          acShuTxt={acShuTxtRef.current}
+          addInfo={addInfo}
+          addFu={() => resetFu(false)}
+          closeFu={() => setAddInfo({} as I2AddInfoType)}
+          isNoAcIds={isNoAcIds.current}
+        />
+      ) : null}
     </div>
   )
 }

+ 50 - 0
src/store/action/Isystem/I2dict.ts

@@ -0,0 +1,50 @@
+import { TypeI2dict } from '@/pages/Isystem/I2dict/data'
+import { AppDispatch } from '@/store'
+import http from '@/utils/http'
+/**
+ * 获取对应表格列表(传id就是列表,从第三级开始)
+ */
+export const I2_APIgetDict = (id?: string, backFu?: (data: TypeI2dict[]) => void): any => {
+  return async (dispatch: AppDispatch) => {
+    let url = 'cms/dict/getTree'
+    if (id) url = url + `?parentId=${id}`
+    const res = await http.get(url)
+    if (res.code === 0) {
+      const caseStr = id ? 'I2/getList' : 'I2/getDictAll'
+      dispatch({ type: caseStr, payload: res.data })
+
+      // if (!id) {
+      //   // 把字典存在本地,防止下拉框空白问题
+      //   localStorage.setItem('YWGOODS_HT_DICT_ALL', JSON.stringify(res.data))
+      // }
+
+      backFu && backFu(res.data)
+    }
+  }
+}
+
+// 根据指定id返回树结构
+export const I2_APIgetDictZhi = (id: string) => {
+  return http.get(`cms/dict/getTree?parentId=${id}`)
+}
+
+/**
+ * 获取详情
+ */
+export const I2_APIgetInfo = (id: string) => {
+  return http.get(`cms/dict/detail/${id}`)
+}
+
+/**
+ * 新增、编辑
+ */
+export const I2_APIsave = (data: any) => {
+  return http.post('cms/dict/save', data)
+}
+
+/**
+ * 删除
+ */
+export const I2_APIdel = (id: string) => {
+  return http.get(`cms/dict/remove/${id}`)
+}

+ 34 - 0
src/store/reducer/Isystem/I2dict.ts

@@ -0,0 +1,34 @@
+import { TypeI2dict } from '@/pages/Isystem/I2dict/data'
+
+// 初始化状态
+const initState = {
+  // 所有字典数据
+  dictAll: [] as TypeI2dict[],
+  // 列表展示的数据
+  dictList: [] as TypeI2dict[]
+}
+
+// 定义 action 类型
+type Props =
+  | {
+      type: 'I2/getDictAll'
+      payload: TypeI2dict[]
+    }
+  | {
+      type: 'I2/getList'
+      payload: TypeI2dict[]
+    }
+
+// reducer
+export default function userReducer(state = initState, action: Props) {
+  switch (action.type) {
+    // 获取字典数据
+    case 'I2/getDictAll':
+      return { ...state, dictAll: action.payload }
+    // 获取展示的数据
+    case 'I2/getList':
+      return { ...state, dictList: action.payload }
+    default:
+      return state
+  }
+}

+ 2 - 0
src/store/reducer/index.ts

@@ -4,12 +4,14 @@ import { combineReducers } from 'redux'
 // 导入 登录 模块的 reducer
 import A0Layout from './layout'
 
+import I2dict from './Isystem/I2dict'
 import Z1user from './Z1user'
 import Z2log from './Z2log'
 
 // 合并 reducer
 const rootReducer = combineReducers({
   A0Layout,
+  I2dict,
   Z1user,
   Z2log
 })

+ 2 - 2
src/utils/http.ts

@@ -7,8 +7,8 @@ import { domShowFu } from './domShow'
 
 export const envFlag = process.env.NODE_ENV === 'development'
 
-const baseUrlTemp = 'https://sit-jiningbwg.4dage.com' // 测试环境
-// const baseUrlTemp = 'http://192.168.20.61:8107' // 线下环境
+// const baseUrlTemp = 'https://sit-jiningbwg.4dage.com' // 测试环境
+const baseUrlTemp = 'http://192.168.20.61:8112' // 线下环境
 
 const baseFlag = baseUrlTemp.includes('https://')