king
2022-10-10 1654c2e3838428eeef6bc04b5e46811cafdaf608
2022-10-10
10个文件已修改
218 ■■■■ 已修改文件
src/menu/datasource/verifycard/index.jsx 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/datasource/verifycard/index.scss 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/sysinterface/index.jsx 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pc/createview/index.jsx 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/editTable/index.jsx 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/utils-custom.js 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/design/sidemenu/thdmenuplus/index.jsx 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/main/index.jsx 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mobdesign/index.jsx 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/pcdesign/index.jsx 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/datasource/verifycard/index.jsx
@@ -2,7 +2,7 @@
import PropTypes from 'prop-types'
import { fromJS } from 'immutable'
import { Form, Tabs, Popconfirm, notification, Modal, Typography, Spin, message, Button } from 'antd'
import { StopOutlined, CheckCircleOutlined, EditOutlined, SwapOutlined, DeleteOutlined, CopyOutlined, BorderOutlined } from '@ant-design/icons'
import { StopOutlined, CheckCircleOutlined, EditOutlined, SwapOutlined, DeleteOutlined, CopyOutlined, BorderOutlined, SnippetsOutlined } from '@ant-design/icons'
import moment from 'moment'
import Api from '@/api'
@@ -12,6 +12,7 @@
import ColForm from './columnform'
import CustomScriptsForm from './customscript'
import SettingForm from './settingform'
import PasteForm from '@/templates/zshare/pasteform'
import SettingUtils from './utils'
import MinView from '@/assets/img/minview.png'
import './index.scss'
@@ -39,6 +40,8 @@
    defaultSearch: '',
    systemScripts: [],
    visible: false,
    pvisible: false,
    reload: false,
    script: null,
    scriptValue: '',
    colColumns: [
@@ -694,6 +697,90 @@
    })
  }
  copyDatasource = () => {
    const { config } = this.props
    const { columns, scripts } = this.state
    if (columns.length === 0) {
      notification.warning({
        top: 92,
        message: '请添加字段集!',
        duration: 5
      })
      return
    }
    this.settingForm.handleConfirm().then(res => {
      delete res.supModule
      res.name = config.name
      let source = {
        key: 'interface',
        type: 'line',
        data: {setting: res, columns, scripts, pageable: false, format: 'array', name: res.name, status: 'false', type: 'interface', uuid: '' }
      }
      try {
        source = window.btoa(window.encodeURIComponent(JSON.stringify(source)))
      } catch (e) {
        console.warn('Stringify Failure')
        source = ''
      }
      if (source) {
        let oInput = document.createElement('input')
        oInput.value = source
        document.body.appendChild(oInput)
        oInput.select()
        document.execCommand('Copy')
        document.body.removeChild(oInput)
        message.success('复制成功。')
      }
    })
  }
  pasteSubmit = () => {
    const { setting } = this.state
    this.pasteFormRef.handleConfirm().then(res => {
      if (res.key !== 'interface') {
        notification.warning({
          top: 92,
          message: '配置类型错误!',
          duration: 5
        })
        return
      } else if (res.type !== 'line') {
        notification.warning({
          top: 92,
          message: '请粘贴单项数据源!',
          duration: 5
        })
        return
      }
      if (setting.supModule) {
        res.data.setting.supModule = setting.supModule
      }
      this.setState({
        scripts: res.data.scripts.map(col => {
          col.uuid = Utils.getuuid()
          return col
        }),
        columns: res.data.columns.map(col => {
          col.uuid = Utils.getuuid()
          return col
        }),
        setting: res.data.setting,
        reload: true,
        pvisible: false
      }, () => {
        this.setState({reload: false})
      })
    })
  }
  copyColumns = () => {
    const { columns } = this.state
    let m = []
@@ -726,26 +813,33 @@
  render() {
    const { config } = this.props
    const { columns, setting, scripts, colColumns, scriptsColumns, activeKey, loading, searches, defaultsql, visible, script, scriptValue } = this.state
    const { columns, setting, scripts, colColumns, scriptsColumns, activeKey, loading, searches, defaultsql, visible, pvisible, reload, script, scriptValue } = this.state
    return (
      <div className="model-data-source-wrap">
        {config.name ? <div className="mk-com-name">{config.name} - 数据源</div> : null}
        {loading && <Spin size="large" />}
        <Tabs activeKey={activeKey} className="data-source-card-box" onChange={this.changeTab}>
          <TabPane tab="数据源" key="setting">
            <SettingForm
          <TabPane tab={
            <span>
              数据源
              {config.type !== 'interface' ? <CopyOutlined title="复制数据源" className="mk-copy-datasource" onClick={this.copyDatasource}/> : null}
              {config.type !== 'interface' ? <SnippetsOutlined title="导入数据源" className="mk-paste-datasource" onClick={() => this.setState({pvisible: true})}/> : null}
            </span>
          } key="setting">
            {!reload ? <SettingForm
              dict={this.props.dict}
              config={config}
              columns={columns}
              setting={setting}
              scripts={scripts}
              wrappedComponentRef={(inst) => this.settingForm = inst}
            />
            /> : null}
          </TabPane>
          <TabPane tab={
            <span>
              字段集
              {columns.length ? <span className="count-tip">{columns.length}</span> : null}
              <CopyOutlined title="以逗号拼接形式复制字段" className="mk-copy-fields" onClick={this.copyColumns}/>
            </span>
          } key="columns">
@@ -846,6 +940,17 @@
          </div>
          <CodeMirror value={scriptValue} onChange={(val) => {this.setState({scriptValue: val})}}></CodeMirror>
        </Modal>
        <Modal
          title="粘贴"
          visible={pvisible}
          width={600}
          maskClosable={false}
          onOk={this.pasteSubmit}
          onCancel={() => {this.setState({pvisible: false})}}
          destroyOnClose
        >
          <PasteForm wrappedComponentRef={(inst) => this.pasteFormRef = inst} inputSubmit={this.pasteSubmit}/>
        </Modal>
      </div>
    )
  }
src/menu/datasource/verifycard/index.scss
@@ -17,10 +17,39 @@
      right: -210px;
      color: rgb(24, 144, 255);
      display: none;
      opacity: 0.4;
      transition: opacity 0.2s;
    }
    .ant-tabs-tab-active .mk-copy-fields {
    .mk-copy-datasource {
      position: absolute;
      cursor: pointer;
      z-index: 1;
      top: 19px;
      right: -319px;
      color: rgb(24, 144, 255);
      display: none;
      opacity: 0.4;
      transition: opacity 0.2s;
    }
    .mk-paste-datasource {
      position: absolute;
      cursor: pointer;
      z-index: 1;
      top: 19px;
      right: -355px;
      color:purple;
      display: none;
      opacity: 0.4;
      transition: opacity 0.2s;
    }
    .mk-copy-fields:hover, .mk-copy-datasource:hover, .mk-paste-datasource:hover {
      opacity: 1;
    }
    .ant-tabs-tab-active {
      .mk-copy-fields, .mk-copy-datasource, .mk-paste-datasource {
      display: inline-block;
    }
    }
    .count-tip {
      position: absolute;
      top: 0px;
src/menu/sysinterface/index.jsx
@@ -181,7 +181,6 @@
      return record
    })
    this.setState({ interfaces })
    this.props.updateConfig({...config, interfaces})
@@ -233,7 +232,6 @@
          destroyOnClose
        > 
          <PlusOutlined key="add-interface" onClick={this.addInterface}/>
          {/* <div style={{fontSize: '12px', position: 'relative', top: '20px'}}>注:接口执行完成后,会触发默认不加载的组件刷新数据。</div> */}
          <EditTable key="manage-interface" actions={['copy']} type="interface" data={interfaces} columns={columns} onChange={this.changeScripts}/>
        </Modal>
      </div>
src/pc/createview/index.jsx
@@ -161,7 +161,15 @@
          }
          if (_config.components) {
            config.components = MenuUtils.resetConfig(_config.components, {}, res.clearMenu === 'true')
            let uuids = {} // 重置公共数据源
            if (_config.interfaces && _config.interfaces.length > 0) {
              config.interfaces = _config.interfaces.map(inter => {
                uuids[inter.uuid] = this.getuuid()
                inter.uuid = uuids[inter.uuid]
                return inter
              })
            }
            config.components = MenuUtils.resetConfig(_config.components, uuids, res.clearMenu === 'true')
            config.tables = _config.tables || []
            config.style = _config.style || {}
            config.statusBarbgColor = _config.statusBarbgColor || ''
src/templates/zshare/editTable/index.jsx
@@ -10,13 +10,10 @@
import PasteForm from '@/templates/zshare/pasteform'
import asyncComponent from '@/utils/asyncComponent'
import CusSwitch from './cusSwitch'
import zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
import MKEmitter from '@/utils/events.js'
import './index.scss'
const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
let eTDict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
const EditableContext = React.createContext()
const { confirm } = Modal
let dragingIndex = -1
@@ -144,7 +141,7 @@
              rules: [
                {
                  required: required,
                  message: ['number', 'text', 'input'].includes(inputType) ? `${eTDict['form.required.input']} ${title}!` : `${eTDict['form.required.select']} ${title}!`,
                  message: ['number', 'text', 'input'].includes(inputType) ? `请输入${title}!` : `请选择${title}!`,
                },
                ...rules
              ],
@@ -195,7 +192,7 @@
      operation = {
        title: (<div>
          {eTDict['model.operation']}
          操作
          <span className="copy-control">
            {actions.includes('copy') ? <CopyOutlined title="复制" onClick={() => this.copy()} /> : null}
            {actions.includes('copy') ? <SnippetsOutlined title="粘贴" onClick={this.paste} /> : null}
@@ -212,11 +209,11 @@
              <EditableContext.Consumer>
                {form => (
                  <span onClick={() => this.save(form, record.uuid)} style={{ marginRight: 8 , color: '#1890ff', cursor: 'pointer'}}>
                    {eTDict['model.save']}
                    保存
                  </span>
                )}
              </EditableContext.Consumer>
              <span style={{ color: '#1890ff', cursor: 'pointer'}} onClick={() => this.cancel(record.uuid)}>{eTDict['model.cancel']}</span>
              <span style={{ color: '#1890ff', cursor: 'pointer'}} onClick={() => this.cancel(record.uuid)}>取消</span>
            </div>
          ) : (
            <div className={'edit-operation-btn' + (editingKey !== '' ? ' disabled' : '')} style={{minWidth: '110px', whiteSpace: 'nowrap'}}>
@@ -225,7 +222,7 @@
              {actions.includes('status') ? <span className="status" onClick={() => {editingKey === '' && this.handleStatus(record)}}><SwapOutlined /></span> : null}
              {actions.includes('del') && editingKey === '' ? <Popconfirm
                overlayClassName="popover-confirm"
                title={eTDict['model.query.delete']}
                title="确定删除吗?"
                onConfirm={() => this.handleDelete(record.uuid)
              }>
                <span className="danger"><DeleteOutlined /></span>
@@ -402,7 +399,6 @@
              uuid: Utils.getuuid()
            })
          }
        })
      } else if (res.key !== type) {
        message.warning('配置信息格式错误!')
@@ -665,7 +661,7 @@
          </DndProvider>
          {/* 信息粘贴 */}
          <Modal
            title={eTDict['header.form.paste']}
            title="粘贴"
            visible={this.state.visible}
            width={600}
            maskClosable={false}
@@ -673,7 +669,7 @@
            onCancel={() => {this.setState({visible: false})}}
            destroyOnClose
          >
            <PasteForm dict={eTDict} wrappedComponentRef={(inst) => this.pasteFormRef = inst} inputSubmit={this.pasteSubmit}/>
            <PasteForm wrappedComponentRef={(inst) => this.pasteFormRef = inst} inputSubmit={this.pasteSubmit}/>
          </Modal>
        </div>
      </EditableContext.Provider>
src/utils/utils-custom.js
@@ -463,6 +463,10 @@
          return cell
        })
      } else if (['card', 'carousel', 'timeline'].includes(item.type) || (item.type === 'table' && item.subtype === 'tablecard')) {
        if (item.wrap.datatype === 'public' && uuids[item.wrap.publicId]) {
          item.wrap.publicId = uuids[item.wrap.publicId]
        }
        item.subcards.forEach(card => {
          card.uuid = this.getuuid()
@@ -503,6 +507,9 @@
          }
        })
      } else if (item.type === 'balcony') {
        if (item.wrap.datatype === 'public' && uuids[item.wrap.publicId]) {
          item.wrap.publicId = uuids[item.wrap.publicId]
        }
        if (item.elements) {
          item.elements = item.elements.map(cell => {
            cell.uuid = this.getuuid()
src/views/design/sidemenu/thdmenuplus/index.jsx
@@ -233,7 +233,17 @@
          config.MenuName = param.MenuName
          config.MenuNo = param.MenuNo
          config.easyCode = ''
          config.components = MenuUtils.resetConfig(config.components)
          let uuids = {} // 重置公共数据源
          if (config.interfaces && config.interfaces.length > 0) {
            config.interfaces = config.interfaces.map(inter => {
              uuids[inter.uuid] = this.getuuid()
              inter.uuid = uuids[inter.uuid]
              return inter
            })
          }
          config.components = MenuUtils.resetConfig(config.components, uuids)
          config.enabled = false
          param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(config)))
src/views/main/index.jsx
@@ -25,6 +25,8 @@
    MKEmitter.addListener('resetSelectLine', this.resetParentParam)
    Object.defineProperty(window, 'debug', {
      configurable: true,
      enumerable: true,
      set(value) {
        if (value + '' === 'false') {
          window.debugger = false
src/views/mobdesign/index.jsx
@@ -811,7 +811,16 @@
          }
        }
      } else {
        config.components = MenuUtils.resetConfig(config.components, {}, urlParam.clearMenu)
        let uuids = {} // 重置公共数据源
        if (config.interfaces && config.interfaces.length > 0) {
          config.interfaces = config.interfaces.map(inter => {
            uuids[inter.uuid] = this.getuuid()
            inter.uuid = uuids[inter.uuid]
            return inter
          })
        }
        config.components = MenuUtils.resetConfig(config.components, uuids, urlParam.clearMenu)
        config.enabled = false
        message.success('复制成功,保存后生效。')
      }
src/views/pcdesign/index.jsx
@@ -764,7 +764,15 @@
          }
        }
      } else {
        config.components = MenuUtils.resetConfig(config.components, {}, urlParam.clearMenu)
        let uuids = {} // 重置公共数据源
        if (config.interfaces && config.interfaces.length > 0) {
          config.interfaces = config.interfaces.map(inter => {
            uuids[inter.uuid] = this.getuuid()
            inter.uuid = uuids[inter.uuid]
            return inter
          })
        }
        config.components = MenuUtils.resetConfig(config.components, uuids, urlParam.clearMenu)
        config.enabled = false
        message.success('复制成功,保存后生效。')
      }