siteConfigDrawer.js 1.35 KB
Newer Older
张烨's avatar
张烨 committed
1
import React from 'react';
张烨's avatar
张烨 committed
2
import { Drawer, notification } from 'antd';
张烨's avatar
张烨 committed
3
import WebConfigForm from './webConfigForm';
张烨's avatar
张烨 committed
4
import { postEditWebConfig } from '@/services/webConfig/api';
张烨's avatar
张烨 committed
5 6

export default props => {
张烨's avatar
张烨 committed
7 8 9 10 11 12 13 14 15
  const {
    visible,
    onClose,
    config,
    hasIntegerate,
    isEdit,
    onOk,
    submitting,
  } = props;
张烨's avatar
张烨 committed
16 17

  return (
张烨's avatar
张烨 committed
18
    <Drawer
张烨's avatar
张烨 committed
19 20
      title={isEdit ? '查看/编辑网站配置' : '新增网站'}
      width={620}
张烨's avatar
张烨 committed
21 22 23
      closable
      onClose={onClose}
      visible={visible}
张烨's avatar
张烨 committed
24
      maskClosable
张烨's avatar
张烨 committed
25 26 27
    >
      <WebConfigForm
        hasIntegerate={hasIntegerate}
张烨's avatar
张烨 committed
28
        isEdit={isEdit}
张烨's avatar
张烨 committed
29 30
        config={config}
        onCancel={onClose}
张烨's avatar
张烨 committed
31
        submitting={submitting}
张烨's avatar
张烨 committed
32
        onOk={values => {
张烨's avatar
张烨 committed
33 34 35 36 37 38 39
          if (!values.homePage && values.hideMap) {
            notification.error({
              message: '在按需加载地图的模式下,请配置主页路径',
              duration: '3',
            });
            return;
          }
40 41 42 43 44 45 46
          console.log(values.alarmWays, typeof values.alarmWays);
          if (values.alarmWays !== null) {
            values.alarmWays =
              typeof values.alarmWays === 'string'
                ? values.alarmWays
                : values.alarmWays.join(',') || '';
          }
张烨's avatar
张烨 committed
47 48
          // eslint-disable-next-line no-unused-expressions
          onOk && onOk(values);
张烨's avatar
张烨 committed
49 50 51
        }}
      />
    </Drawer>
张烨's avatar
张烨 committed
52 53
  );
};