Переглянути джерело

feat: 规则相关接口接入。

lanjianrong 4 роки тому
батько
коміт
252a8656ab

+ 1 - 1
src/components/DatePicker.tsx

@@ -1,7 +1,7 @@
 import generatePicker from 'antd/es/date-picker/generatePicker'
 import 'antd/es/date-picker/style/index'
 import { Dayjs } from 'dayjs'
-// import 'dayjs/locale/zh-cn'
+import 'dayjs/locale/zh-cn'
 import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs'
 
 const DatePicker = generatePicker<Dayjs>(dayjsGenerateConfig)

+ 32 - 0
src/components/RuleModal/index.module.scss

@@ -0,0 +1,32 @@
+.SafeModalForm {
+  :global(.ant-input-group-addon) {
+    &:hover {
+      color: #ffffff;
+      background-color: #6c757d;
+      border-color: #6c757d;
+    }
+    &:not(:disabled) {
+      cursor: pointer;
+    }
+  }
+
+  :global(.ant-tabs-top > .ant-tabs-nav) {
+    margin: 0;
+  }
+  .ruleContaniner {
+    margin: 0.5rem 0;
+
+    .ruleText {
+      margin-bottom: 0.5rem;
+    }
+  }
+
+  .warningFooter {
+    padding: 0.5rem;
+    color: #856404;
+    background-color: #fff3cd;
+    border: 1px solid transparent;
+    border-color: #ffeeba;
+    border-radius: 0.25rem;
+  }
+}

+ 207 - 0
src/components/RuleModal/index.tsx

@@ -0,0 +1,207 @@
+import { ZhButton } from '@/components/Button'
+import { apiGetRule } from '@/pages/Safe/Content/List/api'
+import { tenderStore } from '@/store/mobx'
+import { ruleOption } from '@/types/rule'
+import consts from '@/utils/consts'
+import { dayjsFomrat } from '@/utils/util'
+import { Form, Input, InputNumber, Modal, Select, Tabs, Tag } from 'antd'
+import { TweenOneGroup } from 'rc-tween-one'
+import React, { useEffect, useState } from 'react'
+import { useActivate } from 'react-activation'
+import styles from './index.module.scss'
+const { TabPane } = Tabs
+const { Option } = Select
+
+
+interface iTags {
+  ruleArr: ruleOption[]
+  setRuleArr: (arr: ruleOption[]) => void
+}
+const RenderTags:React.FC<iTags> = ({ ruleArr, setRuleArr }) => {
+  const handleClose = (removedTag: ruleOption) => {
+    const tags = ruleArr.filter(tag => tag.value !== removedTag.value)
+    setRuleArr(tags)
+  }
+  return (
+    <div>
+      <TweenOneGroup
+            enter={{
+              scale: 0.8,
+              opacity: 0,
+              type: 'from',
+              duration: 100
+              // onComplete: (e: ) => {
+              //   e.target.style = ''
+              // }
+            }}
+            leave={{ opacity: 0, width: 0, scale: 0, duration: 200 }}
+            appear={false}
+          >
+            {
+              ruleArr.map((tag, idx) => {
+                return (
+                  <span key={idx} style={{ display: 'inline-block' }}>
+                    <Tag closable onClose={(e: Event) => {e.preventDefault();handleClose(tag)}}>
+                      {tag.value}
+                    </Tag>
+                  </span>
+                )
+              })
+            }
+          </TweenOneGroup>
+    </div>
+  )
+}
+
+interface iSafeCreateFormProps {
+  type: string;
+  visible: boolean;
+  loading: boolean;
+  title: string;
+  onCreate: (values: any) => void;
+  onCancel: () => void;
+  positionTab?: React.ReactNode
+}
+
+const SafeCreateForm: React.FC<iSafeCreateFormProps> = ({
+  type,
+  visible,
+  loading,
+  onCreate,
+  title,
+  onCancel,
+  positionTab
+}) => {
+  const [ form ] = Form.useForm()
+  const [ ruleType, setRuleType ] = useState<string>('3')
+  const [ ruleArr, setRuleArr ] = useState<ruleOption[]>([])
+  useEffect(() => {
+    form.setFieldsValue({ bidsectionId: tenderStore.bidsectionId })
+  }, [ tenderStore.bidsectionId ])
+  const ruleHandler = () => {
+    switch (ruleType) {
+      case '0':
+        setRuleArr([ ...ruleArr, { type: 'name', value: tenderStore.name } ])
+        break
+      case '1':
+        setRuleArr([ ...ruleArr, { type: 'text', value: form.getFieldValue('ruleText') } ])
+        break
+      case '2':
+        setRuleArr([ ...ruleArr, { type: 'date', value: dayjsFomrat(new Date(), 'YYYYMM') } ])
+        break
+      default:
+        setRuleArr([ ...ruleArr, { type: 'code', value: form.getFieldValue('initCode') } ])
+        break
+    }
+  }
+  // 处理自动位数编号 -> 联动起始编号
+  const digitHandler = (value: any) => {
+    if (value) {
+      const length = form.getFieldValue('digits')
+      const code = parseInt(form.getFieldValue('initCode'))
+      const newCode = (Array(length).join('0') + code).slice(-length)
+      form.setFieldsValue({ initCode: newCode })
+    }
+  }
+
+  // 初始化
+  const ruleModalIniter = async () => {
+    const { code, data } = await apiGetRule(tenderStore.bidsectionId)
+    if (code === consts.RET_CODE.SUCCESS) {
+      if (data[type]) {
+        const obj = JSON.parse(data[type])
+        const newRule = []
+        delete obj.eg
+        for (const key in obj) {
+          if (Object.prototype.hasOwnProperty.call(obj, key)) {
+            let value = obj[key]
+            if (key === 'code') {
+              // const code = parseInt(form.getFieldValue('initCode'))
+              value = (Array(value.length).join('0') + parseInt(value)).slice(-value.length)
+            }
+            newRule.push({ type: key, value })
+          }
+        }
+        setRuleArr(newRule)
+      }
+
+    }
+  }
+
+  useEffect(() => {
+    ruleModalIniter()
+  }, [])
+  useActivate(() => ruleModalIniter())
+  return (
+    <Modal
+      getContainer={false}
+      visible={visible}
+      title={title}
+      okText="确认添加"
+      cancelText="取消"
+      onCancel={onCancel}
+      confirmLoading={loading}
+      okButtonProps={{ size: 'small' }}
+      cancelButtonProps={{ size: 'small' }}
+      onOk={() => {
+        form
+          .validateFields()
+          .then(() => {
+            form.resetFields()
+            onCreate(ruleArr)
+          })
+          .catch(info => {
+            console.log('Validate Failed:', info)
+          })
+      }}
+    >
+      <Form form={form} layout="vertical" size="middle" className={styles.SafeModalForm}>
+      <Tabs defaultActiveKey="1" type="card" size="small">
+              <TabPane tab="编号规则设置" key="1">
+              <div className={styles.ruleContaniner}>
+                <h5 className={styles.ruleText}>当前规则:{ruleArr.map(item => item.value).join('-')}</h5>
+                <div><RenderTags ruleArr={ruleArr} setRuleArr={setRuleArr}></RenderTags></div>
+              </div>
+                <Form.Item label="添加新组建规则" name="ruleType" initialValue="3">
+                  <Select onChange={(value: string) => setRuleType(value)}>
+                    <Option value="0">标段名</Option>
+                    <Option value="1">文本</Option>
+                    <Option value="2">当前年月</Option>
+                    <Option value="3">自动编号</Option>
+                  </Select>
+                </Form.Item>
+                {
+                  ruleType === '3' ?
+                    <>
+                      <Form.Item label="自动编号位数" name="digits" initialValue="3">
+                        <InputNumber size="small" min={1} style={{ width: '100%' }} onChange={(value) => digitHandler(value)}></InputNumber>
+                      </Form.Item>
+                      <Form.Item label="起始编号" name="initCode" initialValue="001">
+                        <Input type="number"></Input>
+                      </Form.Item>
+                    </>
+                  : ''
+                }
+                {
+                  ruleType === '1' ?
+                  <>
+                    <Form.Item label="规则文本" name="ruleText">
+                      <Input></Input>
+                    </Form.Item>
+                  </>
+                  : ''
+                }
+                <ZhButton size="small" onClick={() => ruleHandler()}>添加组件</ZhButton>
+              </TabPane>
+              {
+                positionTab ? { positionTab } : ''
+              }
+              {/* <TabPane tab="部位设置" key="2"></TabPane> */}
+            </Tabs>
+      </Form>
+    </Modal>
+  )
+}
+
+
+export default SafeCreateForm

+ 47 - 0
src/pages/Safe/Content/List/api.ts

@@ -1,3 +1,4 @@
+import { iRulePayload } from "@/types/rule"
 import { iCreateSafe } from "@/types/safe"
 import request from "@/utils/common/request"
 
@@ -19,3 +20,49 @@ export async function apiCreateSafe(payload: iCreateSafe) {
   return data
 }
 
+/**
+ * 获取当前的规则
+ * @param bidsectionId 标段id
+ */
+export async function apiGetRule(bidsectionId: string) {
+  const { data } = await request.get('/api/rule', { bidsectionId })
+  return data
+}
+
+/**
+ * 提交编号规则设置
+ * @param payload 载荷
+ */
+export async function apiSaveRule(payload: iRulePayload) {
+  // const egRule: string[] = []
+  // payload.rule?.forEach(rule => {
+  //   if (rule.type === "code") {
+  //     egRule.push(new Array(rule.value.length).fill("_").join(""))
+  //   } else {
+  //     egRule.push(rule.value)
+  //   }
+  // })
+  // console.log(egRule)
+
+  const newValue = payload.rule.reduce((prev, curr) => {
+    // if (curr.type === 'code') {
+    //   prev[curr.type] = curr.value.length
+    // } else {
+    //   prev[curr.type] = curr.value
+    // }
+    prev[curr.type] = curr.value
+    return prev
+  }, {})
+  const { data } = await request.post('/api/rule', { ...payload, rule: JSON.stringify(newValue) })
+  return data
+}
+
+/**
+ *
+ * @param bidsectionId 标段id
+ * @param type 规则类型
+ */
+export async function apiAutoCode(bidsectionId: string, type: string) {
+  const { data } = await request.post("/api/rule/auto", { bidsectionId, type })
+  return data
+}

+ 39 - 19
src/pages/Safe/Content/List/index.tsx

@@ -1,5 +1,6 @@
 import Header from '@/components/Header'
 import Slot from '@/components/Header/slot'
+import RuleModal from '@/components/RuleModal'
 import SvgIcon from '@/components/SvgIcon'
 import { tenderStore } from '@/store/mobx'
 import { iCreateSafe } from '@/types/safe'
@@ -7,13 +8,13 @@ import { safeStatus } from '@/utils/common/constStatus'
 import consts from '@/utils/consts'
 import { dayjsFomrat } from '@/utils/util'
 import { SettingOutlined } from '@ant-design/icons'
-import { Button, Table } from 'antd'
+import { Button, message, Table } from 'antd'
 import { ColumnsType } from 'antd/lib/table'
 import React, { useEffect, useState } from 'react'
 import { useActivate } from 'react-activation'
 import { Link } from 'react-router-dom'
-import { apiCreateSafe, apiSafeList } from './api'
-import Modal from './modal'
+import { apiCreateSafe, apiSafeList, apiSaveRule } from './api'
+import AddModel from './modal'
 interface iSafeList {
   id: string;
   code: string;
@@ -27,7 +28,6 @@ interface iSafeList {
   fileCounts: number;
 }
 interface iModal {
-  type: string
   visible: boolean
   loading: boolean
 }
@@ -117,27 +117,39 @@ const SafeList:React.FC<{}> =() => {
       setList(data)
     }
   }
-  const [ modal, setModal ] = useState<iModal>({
-    type: '',
+  const [ ruleModal, setRuleModal ] = useState<iModal>({
     visible: false,
     loading: false
   })
-  const onCreate = async (payload: iCreateSafe) => {
-    setModal({ ...modal, loading: true })
+  const [ addModal, setAddModal ] = useState<iModal>({
+    visible: false,
+    loading: false
+  })
+  const onRuleCreate = async (ruleValue: any) => {
+    setRuleModal({ ...ruleModal, loading: true })
+    const { code = -1 } = await apiSaveRule({ bidsectionId: tenderStore.bidsectionId, type: 'safe_rule', rule: ruleValue })
+    if (code === consts.RET_CODE.SUCCESS) {
+      message.success("规则更改成功!")
+      initData()
+    }
+    setRuleModal({ ...ruleModal, loading: false, visible: false })
+  }
+  const onAddCreate = async (payload: iCreateSafe) => {
+    setAddModal({ ...addModal, loading: true })
     const createTime = dayjsFomrat(payload.createTime)
-
     const { code = -1 } = await apiCreateSafe({ ...payload, createTime })
     if (code === consts.RET_CODE.SUCCESS) {
       initData()
     }
-    setModal({ ...modal, loading: false, visible: false })
+    setAddModal({ ...addModal, loading: false, visible: false })
   }
+
   return (
     <div className="wrap-contaniner">
       <Header title="巡检概况">
         <Slot position="right">
-          <Button type="ghost" size="small" icon={<SettingOutlined />} className="pi-mg-right-3" style={{ color: '#007bff' }} onClick={() => setModal({ ...modal, visible: true,type: 'setting' })}>设置</Button>
-          <Button type="primary" size="small" onClick={() => setModal({ ...modal, visible: true,type: 'add' })}>新建巡检</Button>
+          <Button type="ghost" size="small" icon={<SettingOutlined />} className="pi-mg-right-3" style={{ color: '#007bff' }} onClick={() => setRuleModal({ ...ruleModal, visible: true })}>设置</Button>
+          <Button type="primary" size="small" onClick={() => setAddModal({ ...addModal, visible: true })}>新建巡检</Button>
         </Slot>
       </Header>
       <Table
@@ -148,14 +160,22 @@ const SafeList:React.FC<{}> =() => {
         bordered
         >
       </Table>
-      <Modal
-        visible={modal.visible}
-        type={modal.type}
-        onCreate={onCreate}
-        loading={modal.loading}
-        onCancel={() => setModal({ ...modal, visible: false })}
+      <RuleModal
+        type={consts.RULE.SAFE}
+        title="安全巡检编号设置"
+        visible={ruleModal.visible}
+        onCreate={onRuleCreate}
+        loading={ruleModal.loading}
+        onCancel={() => setRuleModal({ ...ruleModal, visible: false })}
+        >
+      </RuleModal>
+      <AddModel
+        visible={addModal.visible}
+        onCreate={onAddCreate}
+        loading={addModal.loading}
+        onCancel={() => setAddModal({ ...addModal, visible: false })}
         >
-      </Modal>
+      </AddModel>
     </div>
   )
 }

+ 44 - 146
src/pages/Safe/Content/List/modal.tsx

@@ -1,58 +1,13 @@
-import { ZhButton } from '@/components/Button'
 import DatePicker from '@/components/DatePicker'
 import { tenderStore } from '@/store/mobx'
-import { dayjsFomrat } from '@/utils/util'
-import { Form, Input, InputNumber, Modal, Select, Tabs, Tag } from 'antd'
+import consts from '@/utils/consts'
+import { Form, Input, Modal } from 'antd'
 import locale from 'antd/es/date-picker/locale/zh_CN'
-import { TweenOneGroup } from 'rc-tween-one'
-import React, { useEffect, useState } from 'react'
+import React, { useEffect } from 'react'
+import { apiAutoCode } from './api'
 import styles from './index.module.scss'
-const { TabPane } = Tabs
-const { Option } = Select
-
-interface iTags {
-  ruleArr: any[]
-  setRuleArr: (arr: any[]) => void
-}
-const RenderTags:React.FC<iTags> = ({ ruleArr, setRuleArr }) => {
-  const handleClose = (removedTag: any) => {
-    const tags = ruleArr.filter(tag => tag !== removedTag)
-    setRuleArr(tags)
-  }
-  return (
-    <div>
-      <TweenOneGroup
-            enter={{
-              scale: 0.8,
-              opacity: 0,
-              type: 'from',
-              duration: 100
-              // onComplete: (e: ) => {
-              //   e.target.style = ''
-              // }
-            }}
-            leave={{ opacity: 0, width: 0, scale: 0, duration: 200 }}
-            appear={false}
-          >
-            {
-              ruleArr.map((tag, idx) => {
-                return (
-                  <span key={idx} style={{ display: 'inline-block' }}>
-                    <Tag closable onClose={(e: Event) => {e.preventDefault();handleClose(tag)}}>
-                      {tag}
-                    </Tag>
-                  </span>
-                )
-              })
-            }
-          </TweenOneGroup>
-    </div>
-  )
-}
-
 interface iSafeCreateFormProps {
   visible: boolean;
-  type: string;
   loading: boolean;
   onCreate: (values: any) => void;
   onCancel: () => void;
@@ -61,41 +16,31 @@ interface iSafeCreateFormProps {
 const SafeCreateForm: React.FC<iSafeCreateFormProps> = ({
   visible,
   loading,
-  type,
   onCreate,
   onCancel
 }) => {
   const [ form ] = Form.useForm()
-  const [ ruleType, setRuleType ] = useState<string>('3')
-  const [ ruleArr, setRuleArr ] = useState<any[]>([])
-  useEffect(() => {
-    form.setFieldsValue({ bidsectionId: tenderStore.bidsectionId })
-  }, [ tenderStore.bidsectionId ])
-  const ruleHandler = () => {
-    switch (ruleType) {
-      case '0':
-        setRuleArr([ ...ruleArr, tenderStore.name ])
-        break
-      case '1':
-        setRuleArr([ ...ruleArr, form.getFieldValue('ruleText') ])
-        break
-      case '2':
-        setRuleArr([ ...ruleArr, dayjsFomrat(new Date(), 'YYYYMM') ])
-        break
-      default:
-        setRuleArr([ ...ruleArr, form.getFieldValue('initCode') ])
-        break
-    }
-  }
-  // 处理自动位数编号 -> 联动起始编号
-  const digitHandler = (value: any) => {
-    if (value) {
-      const length = form.getFieldValue('digits')
-      const code = parseInt(form.getFieldValue('initCode'))
-      const newCode = (Array(length).join('0') + code).slice(-length)
-      form.setFieldsValue({ initCode: newCode })
+  const autoCodeHandler = async () => {
+    const { code = -1, data = "" } = await apiAutoCode(tenderStore.bidsectionId, 'safeRule')
+    if (code === consts.RET_CODE.SUCCESS) {
+      if (data) {
+        const ruleArr: string[] = []
+        const code = JSON.parse(data)
+        for (const key in code) {
+          if (Object.prototype.hasOwnProperty.call(code, key)) {
+            const element = code[key]
+            if (element) {
+              ruleArr.push(element)
+            }
+          }
+        }
+        form.setFieldsValue({ code: ruleArr.join("-") })
+      }
     }
   }
+  useEffect(() => {
+    form.setFieldsValue({ bidsectionId: tenderStore.bidsectionId })
+  }, [])
   return (
     <Modal
       getContainer={false}
@@ -110,7 +55,7 @@ const SafeCreateForm: React.FC<iSafeCreateFormProps> = ({
       onOk={() => {
         form
           .validateFields()
-          .then(values => {
+          .then((values) => {
             form.resetFields()
             onCreate(values)
           })
@@ -120,73 +65,26 @@ const SafeCreateForm: React.FC<iSafeCreateFormProps> = ({
       }}
     >
       <Form form={form} layout="vertical" size="middle" className={styles.SafeModalForm}>
-        {
-          type === 'add' ?
-          <>
-            <Form.Item name="bidsectionId" hidden>
-              <Input />
-            </Form.Item>
-            <Form.Item
-              name="position"
-              label="部位"
-              rules={[ { required: true, message: '请选择' } ]}
-            >
-              <Input />
-            </Form.Item>
-            <Form.Item name="code" label="安全编号" rules={[ { required: true, message: '请输入/生成安全编号' } ]}>
-              <Input addonAfter={<span>自动编号</span>}/>
-            </Form.Item>
-            <Form.Item name="inspection" label="检查项" rules={[ { required: true, message: '请填写检查项' } ]}>
-              <Input placeholder="请填写巡检项"/>
-            </Form.Item>
-            <Form.Item name="createTime" label="日期" rules={[ { required: true, message: '请选择日期' } ]}>
-              <DatePicker locale={locale} allowClear style={{ width: '100%' }}></DatePicker>
-            </Form.Item>
-            <div className={styles.warningFooter}>添加后再补充完善其余信息</div>
-          </>
-          :
-          <>
-            <Tabs defaultActiveKey="1" type="card" size="small">
-              <TabPane tab="编号规则设置" key="1">
-              <div className={styles.ruleContaniner}>
-                <h5 className={styles.ruleText}>当前规则:{ruleArr.join('-')}</h5>
-                <div><RenderTags ruleArr={ruleArr} setRuleArr={setRuleArr}></RenderTags></div>
-              </div>
-                <Form.Item label="添加新组建规则" name="ruleType" initialValue="3">
-                  <Select onChange={(value: string) => setRuleType(value)}>
-                    <Option value="0">标段名</Option>
-                    <Option value="1">文本</Option>
-                    <Option value="2">当前年月</Option>
-                    <Option value="3">自动编号</Option>
-                  </Select>
-                </Form.Item>
-                {
-                  ruleType === '3' ?
-                    <>
-                      <Form.Item label="自动编号位数" name="digits" initialValue="3">
-                        <InputNumber size="small" min={1} style={{ width: '100%' }} onChange={(value) => digitHandler(value)}></InputNumber>
-                      </Form.Item>
-                      <Form.Item label="起始编号" name="initCode" initialValue="001">
-                        <Input type="number"></Input>
-                      </Form.Item>
-                    </>
-                  : ''
-                }
-                {
-                  ruleType === '1' ?
-                  <>
-                    <Form.Item label="规则文本" name="ruleText">
-                      <Input></Input>
-                    </Form.Item>
-                  </>
-                  : ''
-                }
-                <ZhButton size="small" onClick={() => ruleHandler()}>添加组件</ZhButton>
-              </TabPane>
-              <TabPane tab="部位设置" key="2"></TabPane>
-            </Tabs>
-          </>
-        }
+        <Form.Item name="bidsectionId" hidden>
+          <Input />
+        </Form.Item>
+        <Form.Item
+          name="position"
+          label="部位"
+          rules={[ { required: true, message: '请选择' } ]}
+        >
+          <Input />
+        </Form.Item>
+        <Form.Item name="code" label="安全编号" rules={[ { required: true, message: '请输入/生成安全编号' } ]}>
+          <Input addonAfter={<span onClick={() => autoCodeHandler()}>自动编号</span>}/>
+        </Form.Item>
+        <Form.Item name="inspection" label="检查项" rules={[ { required: true, message: '请填写检查项' } ]}>
+          <Input placeholder="请填写巡检项"/>
+        </Form.Item>
+        <Form.Item name="createTime" label="日期" rules={[ { required: true, message: '请选择日期' } ]}>
+          <DatePicker locale={locale} allowClear style={{ width: '100%' }}></DatePicker>
+        </Form.Item>
+        <div className={styles.warningFooter}>添加后再补充完善其余信息</div>
       </Form>
     </Modal>
   )

+ 10 - 0
src/types/rule.d.ts

@@ -0,0 +1,10 @@
+export interface iRulePayload {
+  bidsectionId: string
+  type: 'safe_rule' | 'quality_rule' | 'contract_rule'
+  rule: ruleOption[]
+}
+
+export interface ruleOption {
+  type: string
+  value: string
+}

+ 3 - 8
src/utils/common/request.ts

@@ -3,7 +3,7 @@
  */
 import { userStore } from '@/store/mobx'
 import { PendingType, ResponseData } from '@/types/request'
-import CONSTS from '@/utils/consts'
+import { default as consts, default as CONSTS } from '@/utils/consts'
 import { storage } from '@/utils/util'
 import { message } from 'antd'
 import axios, { AxiosRequestConfig, AxiosResponse } from 'axios'
@@ -57,13 +57,8 @@ service.interceptors.response.use(
     // 对Code不等于Success进行message提示
     if (data.code !== CONSTS.RET_CODE.SUCCESS) {
       message.error(JSON.stringify(data.msg))
-      switch (data.code) {
-        case 1:
-          userStore.logout()
-          // history.push('/login')
-          break
-        default:
-          break
+      if (consts.TOKEN_INVALID_CODE.includes(data.code)) {
+        userStore.logout()
       }
     }
     if (response.config.method?.toLocaleUpperCase() === 'GET') {

+ 2 - 2
src/utils/consts.ts

@@ -9,7 +9,7 @@ export default {
   TOKEN_INVALID_CODE: [ 1 ], // 接口返回码如果是1 则表明token过期或无效 需要重新登录
   TOKEN_WHITE_LIST: [ '/api/login' ], // 不需要设置token的白名单
   RET_CODE: { SUCCESS: 0, FAIL: 1, TOKEN_UNDEFINED: 19, TOKEN_EXPIRED: 1 }, // 接口返回状态码
-  RETRY: { COUNT: 3, DELAY: 1000 } // 请求重试次数/间隙
-
+  RETRY: { COUNT: 3, DELAY: 1000 }, // 请求重试次数/间隙
+  RULE: { SAFE: 'safeRule', QUALITY: 'qualityRule', CONTRACT: 'contractRule' } // 规则弹窗常量
 }