king
2021-02-18 c71b5c29fea2b90ffac2045ce45bc1bd74236446
2021-02-18
5个文件已修改
2个文件已添加
277 ■■■■ 已修改文件
src/tabviews/zshare/mutilform/index.jsx 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/settingform/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/verifycard/callbackcustomscript/index.jsx 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/verifycard/customscript/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mobmanage/index.jsx 132 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mobmanage/mutilform/index.jsx 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mobmanage/mutilform/index.scss 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/index.jsx
@@ -229,7 +229,7 @@
      if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(item.type) && item.resourceType === '1') {
        deForms.push(item)
      } else if (['select', 'link', 'radio'].includes(item.type) && item.resourceType !== '1') { // 选中第一项
        if (item.initval && item.initval.indexOf('$first') > -1) {
        if (typeof(item.initval) === 'string' && item.initval.indexOf('$first') > -1) {
          item.initval = item.options[0] ? item.options[0].Value : ''
        }
      }
@@ -462,7 +462,7 @@
          } else if (['select', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(item.type)) {
            item.options = item.oriOptions
          }
          if (['select', 'link', 'radio'].includes(item.type) && item.initval && item.initval.indexOf('$first') > -1) { // 选中第一项
          if (['select', 'link', 'radio'].includes(item.type) && typeof(item.initval) === 'string' && item.initval.indexOf('$first') > -1) { // 选中第一项
            item.initval = item.options[0] ? item.options[0].Value : ''
            values.push({field: item.field, value: item.initval})
          }
@@ -569,7 +569,7 @@
          } else if (['select', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(item.type)) {
            item.options = item.oriOptions
          }
          if (['select', 'link', 'radio'].includes(item.type) && item.initval && item.initval.indexOf('$first') > -1) { // 选中第一项
          if (['select', 'link', 'radio'].includes(item.type) && typeof(item.initval) === 'string' && item.initval.indexOf('$first') > -1) { // 选中第一项
            item.initval = item.options[0] ? item.options[0].Value : ''
            values.push({field: item.field, value: item.initval})
          }
src/templates/modalconfig/settingform/index.jsx
@@ -23,14 +23,14 @@
    if (config.groups.length > 0) {
      config.groups.forEach(group => {
        group.sublist.forEach(item => {
          if (item.field && (item.type === 'text' || item.type === 'number') && item.hidden !== 'true' && item.readonly !== 'true') {
          if (item.field && ['select', 'link', 'text', 'number'].includes(item.type) && item.hidden !== 'true' && item.readonly !== 'true') {
            fields.push(item)
          }
        })
      })
    } else if (config.fields.length > 0) {
      config.fields.forEach(f => {
        if (f.field && (f.type === 'text' || f.type === 'number') && f.hidden !== 'true' && f.readonly !== 'true') {
        if (f.field && ['select', 'link', 'text', 'number'].includes(f.type) && f.hidden !== 'true' && f.readonly !== 'true') {
          fields.push(f)
        }
      })
src/templates/zshare/verifycard/callbackcustomscript/index.jsx
@@ -258,12 +258,7 @@
            </Button>
          </Col>
          <Col span={24} className="sql">
            <Form.Item label={
              <Tooltip placement="topLeft" title={'数据检查替换符 $check@ -> /* 或 \'\'、 @check$ -> */ 或 \'\''}>
                <Icon type="question-circle" />
                sql
              </Tooltip>
            }>
            <Form.Item label="sql">
              {getFieldDecorator('sql', {
                initialValue: '',
                rules: [
src/templates/zshare/verifycard/customscript/index.jsx
@@ -267,7 +267,7 @@
          </Col>
          <Col span={24} className="sql">
            <Form.Item label={
              <Tooltip placement="topLeft" title={'数据检查替换符 $check@ -> /* 或 \'\'、 @check$ -> */ 或 \'\''}>
              <Tooltip placement="topLeft" title={'数据检查替换符 $check@ -> \'\'、 @check$ -> \'\',ErrorCode等于C时 $check@ -> /*、 @check$ -> */'}>
                <Icon type="question-circle" />
                sql
              </Tooltip>
src/views/mobmanage/index.jsx
@@ -1,19 +1,20 @@
import React, {Component} from 'react'
// import { fromJS } from 'immutable'
import { Spin, notification, Button, Table } from 'antd'
import { Spin, notification, Button, Table, Modal } from 'antd'
import Api from '@/api'
// import Utils from '@/utils/utils.js'
import Utils from '@/utils/utils.js'
import asyncComponent from '@/utils/asyncComponent'
import './index.scss'
const Header = asyncComponent(() => import('@/mob/header'))
// const MobCard = asyncComponent(() => import('@/mob/mobcard'))
const MutilForm = asyncComponent(() => import('./mutilform'))
class AppManage extends Component {
  state = {
    loading: false,
    applist: [],
    appsublist: [],
    columns: [
      { title: '应用名称', dataIndex: 'remark', key: 'remark', align: 'center' },
      { title: '应用参数', dataIndex: 'kei_no', key: 'kei_no', align: 'center' },
@@ -21,7 +22,7 @@
        title: 'Action',
        key: 'action',
        align: 'center',
        render: (text, record) => (<Button type="link" style={{color: '#ff4d4f'}}>删除</Button>),
        render: (text, record) => (<Button type="link" onClick={() => this.deleteApp(record)} style={{color: '#ff4d4f'}}>删除</Button>),
      },
    ],
    subcolumns: [
@@ -48,7 +49,12 @@
        title: 'Action',
        key: 'action',
        align: 'center',
        render: (text, record) => (<Button type="link" style={{color: '#ff4d4f'}}>删除</Button>),
        render: (text, record) => (
          <div>
            <Button type="link" onClick={() => this.deleteSubApp(record)} style={{color: '#ff4d4f'}}>删除</Button>
            <Button type="link" onClick={() => this.jumpMenu(record)}>编辑应用</Button>
          </div>
        )
      },
    ],
    selectApp: null,
@@ -104,12 +110,21 @@
    })
  }
  deleteApp = (record) => {
    console.log(record)
  }
  deleteSubApp = (record) => {
    console.log(record)
  }
  jumpMenu = (card) => {
    let _type = 'mob'
    if (card.type === 'pc') {
      _type = 'pc'
    }
    this.props.history.replace(`/mobdesign/${card.uuid}/${_type}/${card.keiNo}/${card.name}`)
    console.log(card)
    // let _type = 'mob'
    // if (card.type === 'pc') {
    //   _type = 'pc'
    // }
    // this.props.history.replace(`/mobdesign/${card.uuid}/${_type}/${card.keiNo}/${card.name}`)
  }
  /**
@@ -126,7 +141,6 @@
   * 
   */
  onSubChange = selectedSubRowKeys => {
    this.setState({ selectedSubRowKeys })
  }
@@ -134,7 +148,7 @@
   * @description 点击整行,触发切换, 判断是否可选,单选或多选,进行对应操作
   */
  changeRow = (record) => {
    this.setState({ selectedRowKeys: [record.ID], selectApp: record })
    this.setState({ selectedRowKeys: [record.ID], selectApp: record, appsublist: record.sublist || [] })
  }
  /**
@@ -144,8 +158,72 @@
    this.setState({ selectedSubRowKeys: [record.ID], selectSubApp: record })
  }
  trigerApp = (type) => {
    if ((type === 'appedit' && !this.state.selectApp) || (type === 'subappedit' && !this.state.selectSubApp)) {
      notification.warning({
        top: 92,
        message: '请选择需要编辑的应用!',
        duration: 5
      })
      return
    }
    this.setState({
      visible: type
    })
  }
  submitCard = () => {
    const { card } = this.state
    this.mobcardRef.handleConfirm().then(res => {
      this.setState({
        confirmloading: true
      })
      let param = {
        func: 's_kei_addupt',
        ID: card ? card.uuid : Utils.getuuid(),
        TypeName: res.type,
        remark: res.name,
        kei_no: res.keiNo
      }
      Api.getCloudConfig(param).then(result => {
        if (result.status) {
          notification.success({
            top: 92,
            message: card ? '修改成功!' : '添加成功!',
            duration: 5
          })
          this.setState({
            confirmloading: false,
            visible: false,
            loading: true
          })
          this.getMobCards()
        } else {
          this.setState({
            confirmloading: false
          })
          notification.warning({
            top: 92,
            message: result.message,
            duration: 5
          })
        }
      }, () => {
        this.setState({
          confirmloading: false
        })
      })
    })
  }
  render () {
    const { loading, columns, applist, selectedRowKeys, selectedSubRowKeys, selectApp, subcolumns } = this.state
    const { loading, visible, columns, applist, appsublist, selectedRowKeys, selectedSubRowKeys, subcolumns, selectApp, selectSubApp } = this.state
    return (
      <div className="mk-app-manage">
@@ -158,8 +236,8 @@
        }
        <div className="app-table">
          <div className="app-action">
            <Button className="mk-green">添加</Button>
            <Button className="mk-purple">修改</Button>
            <Button className="mk-green" onClick={() => this.trigerApp('appplus')}>添加</Button>
            <Button className="mk-purple" onClick={() => this.trigerApp('appedit')}>修改</Button>
          </div>
          <Table
            rowKey="ID"
@@ -173,19 +251,33 @@
        <div className="app-table">
          <div className="sub-app-title"><span>子应用</span></div>
          <div className="app-action">
            <Button className="mk-green">添加</Button>
            <Button className="mk-purple">修改</Button>
            <Button className="mk-green" onClick={() => this.trigerApp('subappplus')}>添加</Button>
            <Button className="mk-purple" onClick={() => this.trigerApp('subappedit')}>修改</Button>
          </div>
          <Table
            rowKey="ID"
            columns={subcolumns}
            dataSource={selectApp ? selectApp.sublist : []}
            dataSource={appsublist}
            pagination={false}
            rowSelection={{ type: 'radio', selectedSubRowKeys, onChange: this.onSubChange }}
            rowSelection={{ type: 'radio', selectedRowKeys: selectedSubRowKeys, onChange: this.onSubChange }}
            onRow={(record) => ({ onClick: () => {this.changeSubRow(record)} })}
          />
        </div>
        {/* <MobCard jumpMenu={this.jumpMenu}/> */}
        <Modal
          // className="mob-card-modal"
          title={'编辑应用'}
          width={'600px'}
          maskClosable={false}
          visible={!!visible}
          onCancel={() => this.setState({visible: ''})}
          confirmLoading={this.state.confirmloading}
          onOk={this.submitCard}
          cancelText="取消"
          okText="确定"
          destroyOnClose
        >
          <MutilForm card={visible === 'appedit' ? selectApp : (visible === 'subappedit' ? selectSubApp : '')} wrappedComponentRef={(inst) => this.mobcardRef = inst} inputSubmit={this.submitCard} />
        </Modal>
      </div>
    )
  }
src/views/mobmanage/mutilform/index.jsx
New file
@@ -0,0 +1,122 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Form, Row, Col, Input, Select, Radio } from 'antd'
import './index.scss'
class MainSearch extends Component {
  static propTpyes = {
    card: PropTypes.any,         // 编辑应用
    inputSubmit: PropTypes.func  // input回车提交
  }
  state = {}
  /**
   * @description 获取表单值
   */
  handleConfirm = () => {
    return new Promise(resolve => {
      this.props.form.validateFieldsAndScroll((err, values) => {
        if (!err) {
          resolve(values)
        }
      })
    })
  }
  /**
   * @description 回车提交
   */
  handleSubmit = (e) => {
    e.preventDefault()
    this.props.inputSubmit()
  }
  render() {
    const { card } = this.props
    const { getFieldDecorator } = this.props.form
    const formItemLayout = {
      labelCol: {
        xs: { span: 24 },
        sm: { span: 8 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      }
    }
    return (
      <Form {...formItemLayout} className="mob-card-edit-form">
        <Row gutter={24}>
          <Col span={24}>
            <Form.Item label="应用名">
              {getFieldDecorator('name', {
                initialValue: card ? card.name : '',
                rules: [{
                  required: true,
                  message: '请输入应用名!'
                }, {
                  max: 20,
                  message: '应用名不可超过20个字符!'
                }]
              })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)}
            </Form.Item>
          </Col>
          <Col span={24}>
            <Form.Item label="应用类型">
              {getFieldDecorator('type', {
                initialValue: card ? card.type : 'mob',
                rules: [
                  {
                    required: true,
                    message: '请选择应用类型!'
                  }
                ]
              })(
                <Select>
                  <Select.Option value="mob">移动端</Select.Option>
                  <Select.Option value="pc">PC端</Select.Option>
                </Select>
              )}
            </Form.Item>
          </Col>
          <Col span={24}>
            <Form.Item label="应用编码">
              {getFieldDecorator('keiNo', {
                initialValue: card ? card.keiNo : '',
                rules: [{
                  required: true,
                  message: '请输入应用编码!'
                }, {
                  pattern: /^[a-zA-Z_]*$/ig,
                  message: '应用编码只允许包含大小写字母及_!'
                }, {
                  max: 20,
                  message: '应用编码不可超过20个字符!'
                }]
              })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)}
            </Form.Item>
          </Col>
          <Col span={24}>
            <Form.Item label="权限管理">
              {getFieldDecorator('role_manage', {
                initialValue: card ? card.role_manage || 'false' : 'false',
                rules: [{
                  required: true,
                  message: '请选择是否启用权限管理!'
                }]
              })(
                <Radio.Group>
                  <Radio value="true">启用</Radio>
                  <Radio value="false">不启用</Radio>
                </Radio.Group>
              )}
            </Form.Item>
          </Col>
        </Row>
      </Form>
    )
  }
}
export default Form.create()(MainSearch)
src/views/mobmanage/mutilform/index.scss
New file
@@ -0,0 +1,4 @@
.mob-card-edit-form {
  padding: 0px 24px 20px;
}