siteConfigDrawer.js 1.68 KB
Newer Older
1 2 3 4 5 6 7
/*
 * @Description:
 * @Author: leizhe
 * @Date: 2022-01-13 10:47:32
 * @LastEditTime: 2022-03-31 18:43:46
 * @LastEditors: leizhe
 */
张烨's avatar
张烨 committed
8
import React from 'react';
9
import { Drawer, notification, Button, Space } from 'antd';
张烨's avatar
张烨 committed
10
import WebConfigForm from './webConfigForm';
张烨's avatar
张烨 committed
11
import { postEditWebConfig } from '@/services/webConfig/api';
张烨's avatar
张烨 committed
12 13

export default props => {
14
  const { visible, onClose, config, hasIntegerate, isEdit, onOk, submitting, productList } = props;
张烨's avatar
张烨 committed
15 16

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