index.js 14.1 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436
import React, { useState, useImperativeHandle, forwardRef, useMemo, useRef } from 'react'
import Drag from '../../components/Drag'
import styles from './index.less'
import { CaretUpOutlined, CaretDownOutlined } from '@ant-design/icons';

const options = [
  {
    title: '布局控件',
    child: [
      {
        title: '分组标题',
        height: 92,
        descriptions: (
          <div>
            <div>将表单信息内容进行分组展示,使表单的界面展示更为实用和美观</div>
          </div>
        )
      },
      {
        title: '描述',
        height: 114,
        descriptions: (
          <div>
            <div>用于表单中注释或提醒的描述,描述说明可以修改显示内容字体字号等设置,以及对齐方式,并支持背景色的设置</div>
          </div>
        )
      },
    ]
  },
  {
    title: '基础控件',
    child: [
      {
        title: '单行文本',
        height: 136,
        descriptions: (
          <div>
            <div>用于表单中录入短文本信息的场景,可混合输入汉字、字母和数字:</div>
            <div>例如:本人姓名、本人部门、邮箱、手机号、身份证号、银行卡号等。</div>
            <div>备注:支持配置字段必填或只读,默认限制文本框录入字符总数200</div>
          </div>
        )
      },
      {
        title: '多行文本',
        height: 114,
        descriptions: (
          <div>
            <div>用于表单中录入较长文本信息的场景,例如:备注说明、会议记录、订单详情等;</div>
            <div>备注:默认限制文本框录入字符总数200</div>
          </div>
        )
      },
      {
        title: '数值输入',
        height: 136,
        descriptions: (
          <div>
            <div>用于表单中数值记录或计算的场景,仅允许录入数字,例如物料数量、价格、金额等;</div>
            <div>支持设置数值前缀和后缀符号,例如金额前增加¥符号;</div>
            <div>支持设置整数、小数、货币、百分比等数值格式的最大、最小值范围</div>
          </div>
        )
      },
      {
        title: '搜索地址',
        height: 92,
        descriptions: (
          <div>
            <div>用于表单中输入关键词进行地址搜素,在表单中展示下拉框形态</div>
          </div>
        )
      },
      {
        title: '单选框组',
        height: 114,
        descriptions: (
          <div>
            <div>适用于表单中选项较少目为单选的场景,选项固定,平铺显示;</div>
            <div>例如性别、满意度、优先级等。</div>
          </div>
        )
      },
      {
        title: '复选框组',
        height: 114,
        descriptions: (
          <div>
            <div>适用于表单中选项多选的场景,选项固定,平铺显示;</div>
            <div>例如维修来源、维修配件等。</div>
          </div>
        )
      },
      {
        title: '下拉选择',
        height: 136,
        descriptions: (
          <div>
            <div>适用于表单中选项较多且为单选的场景,以下拉形式展现,选项内容可以自定义内容或者关联已有表单、数据字典的数据。</div>
            <div>例如选择行业、地区、物料等。</div>
          </div>
        )
      },
      {
        title: '开关按钮',
        height: 114,
        descriptions: (
          <div>
            <div>用于表单中进行确认的场景,打开为“是”,关闭为“否</div>
            <div>例如是否同意、是否超预算、是否有漏点等。</div>
          </div>
        )
      },
      {
        title: '附件',
        height: 114,
        descriptions: (
          <div>
            <div>用于表单中上传附件的场景</div>
            <div>例如产品、物料、电子版合同等,视频、音频等资料上传</div>
          </div>
        )
      },
      // {
      //   title: '图片',
      //   height: 114,
      //   descriptions: (
      //     <div>
      //       <div>用于表单中拍照上传或选择本地图片上传</div>
      //       <div>例现场施工照片、现场维修照片等。</div>
      //     </div>
      //   )
      // },
      {
        title: '日期选择',
        height: 114,
        descriptions: (
          <div>
            <div>用于表单中选择日期的场景,以日历的形式展开呈现,支持日期时间、日期年份、月份等多种形式</div>
            <div>例如维修日期、出入库日期、合同签订日期等。</div>
          </div>
        )
      },
      {
        title: '时间选择',
        height: 114,
        descriptions: (
          <div>
            <div>用于表单中选择时间的场景,以时间选择的形式展开呈现。</div>
            <div>例如维修时间、出入库时间、合同签订时间等。</div>
          </div>
        )
      },
      {
        title: '人员选择',
        height: 114,
        descriptions: (
          <div>
            <div>用于表单中读取组织机构中人员姓名的场景。支持单选和多选。</div>
            <div>例如责任人、维修人员等。</div>
          </div>
        )
      },
      {
        title: '部门选择',
        height: 114,
        descriptions: (
          <div>
            <div>用于表单中读取组织机构中部门名称的场景。支持单选和多选.</div>
            <div>例如维修部门、办理部门等等。</div>
          </div>
        )
      },
      {
        title: '台账选择',
        height: 114,
        descriptions: (
          <div>
            <div>用于表单中读取组织机构中部门名称的场景。支持单选和多选.</div>
            <div>例如台账选择等等。</div>
          </div>
        )
      }
    ]
  },
  {
    title: 'GIS控件',
    child: [
      {
        title: '地图坐标',
        height: 136,
        descriptions: (
          <div>
            <div>用于表单中打开GIS地图选择对应地图坐标位置的场暴,支持关联字段,同步该坐标点对应的详细地址信息</div>
            <div>例如维修坐标、漏点位置、坐标点位置等。</div>
          </div>
        )
      },
      {
        title: '设备选择',
        height: 136,
        descriptions: (
          <div>
            <div>用于表单中选择GIS管网地图中的GIS设备的场景。支持将设备信息回填显示在表单中。例如维修中选择阀门、压力表、管段等设备,</div>
            <div>支持关联字段,当表单中存在“GIS 编码"、“GIS 图层”字段时,会将该信息自动填充。</div>
          </div>
        )
      },
      {
        title: '绘制路径',
        height: 114,
        descriptions: (
          <div>
            <div>用于表单中在GIS管网地图中进行路径绘制的场景.</div>
            <div>例如巡检路径等等。</div>
          </div>
        )
      },
      {
        title: '绘制区域',
        height: 114,
        descriptions: (
          <div>
            <div>用于表单中在GIS管网地图中进行区域绘制的场景.</div>
            <div>例如漏点区域范围等等。</div>
          </div>
        )
      },
      {
        title: '区域任务',
        height: 136,
        descriptions: (
          <div>
            <div>用于工单流程中绘制区域进行巡检的业务场景。</div>
            <div>支持将控件配置在表单中,打开GIS地图绘制要巡检的区域设备</div>
            <div>支持关联管网巡检区域,支持配置区域巡检设备类型,以及前端列表展示字段以及巡检任务的摘要字段</div>
          </div>
        )
      }
    ]
  },
  {
    title: '高级控件',
    child: [
      {
        title: '富文本',
        height: 114,
        descriptions: (
          <div>
            <div>用于表单中录入大量文本,并需要对文本的段落、字体格式样式进行辑的使用场景。</div>
            <div>例如停水通知、公告发布、用户反馈信息等。</div>
          </div>
        )
      },
      {
        title: '编码',
        height: 440,
        descriptions: (
          <div>
            <div>用于系统自动生成字段内容,根据预设规则生成编码或流水号信息的场景。</div>
            <div>例如采购单号、订单号、流水号等。</div>
            <div><strong>【前缀】:</strong>用于编码(流水号前缀)比如:WXSH 等</div>
            <div><strong>【编码方式】:</strong>结合前缀形成唯一编码(流水号)</div>
            <div className={styles['descriptions-Coding-img']}></div>
          </div>
        )
      },
      {
        title: '级联选择',
        height: 92,
        descriptions: (
          <div>
            <div>用于表单中选择城市的场景,例如湖北省/武汉市/洪山区等。</div>
          </div>
        )
      },
      {
        title: '关联表单',
        height: 440,
        descriptions: (
          <div>
            <div>适用于当前表单关联其他表单,从而在两个表单之间建立联系。</div>
            <div>例如在维修工单中增加维修物料清单等等。</div>
            <div className={styles['descriptions-relationForm-img']}></div>
          </div>
        )
      },
      {
        title: '手写签名',
        height: 114,
        descriptions: (
          <div>
            <div>在收集数据时,让填写人上传手写签名保障数据的真实性;</div>
            <div>例如:新用户申请供水服务时,可能需要在申请表上签名,以证明申请的真实性</div>
          </div>
        )
      },
      {
        title: '身份证识别',
        height: 430,
        descriptions: (
          <div>
            <div>在填写身份证信息时,通过上传身份证图片自动填充证件信息,提升效率、避免输入出错</div>
            <div className={styles['descriptions-IDCard']}>
              <div className={styles['IDCard-item']}>
                <div className={styles['item-header']}>上传身份证</div>
                <div className={styles['item-content']}>
                  <div className={styles['img-one']}></div>
                </div>
              </div>
              <div className={styles['IDCard-arrow']}></div>
              <div className={styles['IDCard-item']}>
                <div className={styles['item-header']}>文字识别</div>
                <div className={styles['item-content']}>
                  <div className={styles['img-two']}></div>
                </div>
              </div>
              <div className={styles['IDCard-arrow']}></div>
              <div className={styles['IDCard-item']}>
                <div className={styles['item-header']}>自动填充</div>
                <div className={styles['item-content']}>
                  <div className={styles['img-three']}></div>
                </div>
              </div>
            </div>
          </div>
        )
      },
    ]
  }
]

const Help = (props, ref) => {

  useImperativeHandle(ref, () => ({
    open,
  }));

  const [visible, setVisible] = useState(false)
  const [active, setActive] = useState('单行文本')
  const [shink, setShink] = useState({ 基础控件: true, GIS控件: true, 高级控件: true })
  const rightRef = useRef(null)

  const contentHTML = useMemo(() => {
    let array = []
    options.forEach(v => {
      array.push(...v.child)
    })
    return array
  }, [])

  const activeChange = (value) => {
    setActive(value)
    let scrollTop = 0
    let bool = true
    for (let i = 0; i < contentHTML.length; i++) {
      if (value === contentHTML[i].title) {
        bool = false
      }
      if (bool) {
        scrollTop = scrollTop + (contentHTML[i].height || 0)
      }
    }
    rightRef.current.scrollTop = scrollTop
  }

  const open = ({ active, title }) => {
    setVisible(true)
    setShink({ 基础控件: true, GIS控件: true, 高级控件: true, [title]: false })
    setTimeout(() => {
      activeChange(active)
    }, 500)
  }

  return (
    <Drag
      title={(
        <div className={styles.helpTitle}>
          <div className={styles.titleIcon}></div>
          <div className={styles.titleText}>控件-使用说明</div>
        </div>
      )}
      width={800}
      bodyStyle={{ height: '450px', padding: 0, }}
      onOk={() => setVisible(false)}
      onCancel={() => setVisible(false)}
      visible={visible}
      getContainer={false}
      destroyOnClose
    >
      <div className={styles['help-content']}>
        <div className={styles['c-left']}>
          {
            options.map(v => {
              let style = { position: 'absolute', color: '#646464', right: 18, top: 13 }
              return (
                <div className={styles['t-item']} key={v.title}>
                  <div className={styles['m-header']} onClick={() => setShink({ ...shink, [v.title]: !shink[v.title] })}>
                    <div>{v.title}</div>
                    {
                      shink[v.title] ? <CaretDownOutlined style={style} /> : <CaretUpOutlined style={style} />
                    }
                  </div>
                  <div className={styles['m-content']} style={{ height: shink[v.title] ? 0 : 'unset' }}>
                    {
                      v.child.map(s => {
                        return (
                          <div className={styles['t-list']} key={s.title} active={`${s.title === active}`} onClick={() => activeChange(s.title)}>{s.title}</div>
                        )
                      })
                    }
                  </div>
                </div>
              )
            })
          }
        </div>
        <div className={styles['c-right']} ref={rightRef}>
          {
            contentHTML.map(v => {
              return (
                <div className={styles['t-box']} key={v.title}>
                  <div className={['x-title']}>{v.title}</div>
                  <div className={styles['x-content']}>{v.descriptions}</div>
                </div>
              )
            })
          }
        </div>
      </div>
    </Drag>
  )

}

export default forwardRef(Help)