king
2024-01-10 d1dbe184ea1026e20a202ac9f8f7c8c049665ae3
2024-01-10
7个文件已修改
2个文件已添加
366 ■■■■■ 已修改文件
src/menu/components/form/formaction/actionform/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/form/formaction/formconfig.jsx 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/share/actioncomponent/actionform/index.jsx 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/share/actioncomponent/formconfig.jsx 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/card/cardcellList/index.jsx 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/index.jsx 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/normalbutton/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/shareLink/index.jsx 193 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/shareLink/index.scss 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/form/formaction/actionform/index.jsx
@@ -57,7 +57,7 @@
    } else if (this.record.type === 'close' || this.record.type === 'reset') {
      shows = ['typeName', 'label']
    } else {
      shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload', 'preButton'] // 选项列表
      shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload', 'preButton', 'formCache'] // 选项列表
      if (this.record.execSuccess === 'never') {
        shows.push('resetForms')
src/menu/components/form/formaction/formconfig.jsx
@@ -510,5 +510,20 @@
        text: '刷新'
      }]
    },
    {
      type: 'radio',
      key: 'formCache',
      label: '表单缓存',
      initVal: card.formCache || 'false',
      tooltip: '主要用于数据修改后,更新相关表单的选项,清空缓存后表单再次打开时数据会重新加载。',
      required: false,
      options: [{
        value: 'false',
        text: '不清空'
      }, {
        value: 'clear',
        text: '清空'
      }]
    },
  ]
}
src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -14,9 +14,9 @@
const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
const MKTable = asyncComponent(() => import('@/components/normalform/modalform/mkTable'))
const acTyOptions = {
  pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton'],
  prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton'],
  exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'hidden', 'preButton'],
  pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton', 'formCache'],
  prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton', 'formCache'],
  exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'hidden', 'preButton', 'formCache'],
  excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'sheet', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'width', 'hidden'],
  excelOut: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'pagination', 'search', 'width', 'hidden'],
  popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'color', 'popClose', 'width', 'display', 'ratio', 'syncComponent', 'clickouter', 'maskStyle', 'closeButton', 'hidden'],
@@ -505,6 +505,8 @@
      } else if (_funcType === 'refund') {
        shows.push('Ot', 'execSuccess', 'execError', 'syncComponent', 'openmenu')
        reOptions.Ot = requireOptions.filter(op => ['requiredSgl'].includes(op.value))
      } else if (_funcType === 'shareLink') {
        shows.push('shortUrl', 'shareUrl', 'shareProUrl', 'shareTip')
      // } else if (_funcType === 'expPdf') {
      //   shows.push('exportType')
      }
@@ -525,7 +527,7 @@
          shows.push('reason')
        }
      }
    } else if (!(openType === 'funcbutton' && this.record.funcType === 'expPdf')) {
    } else if (openType !== 'funcbutton' || !['expPdf', 'shareLink'].includes(this.record.funcType)) {
      if (openType !== 'excelOut') {
        reOptions.control = [
          { value: '', text: '无' },
src/menu/components/share/actioncomponent/formconfig.jsx
@@ -162,6 +162,7 @@
    { value: 'refund', text: '退款' },
    { value: 'closetab', text: '标签关闭' },
    { value: 'expPdf', text: '导出PDF' },
    { value: 'shareLink', text: '分享链接' },
    { value: 'megvii', text: '旷视面板机' },
    { value: 'filezip', text: '文件压缩包' },
  ]
@@ -205,6 +206,7 @@
      { value: 'clearCache', text: '清空本地配置' },
      { value: 'copyurl', text: '复制链接地址' },
      { value: 'expPdf', text: '导出PDF' },
      { value: 'shareLink', text: '分享链接' },
      { value: 'logout', text: '退出' },
      { value: 'goBack', text: '返回' },
    ]
@@ -766,6 +768,43 @@
      }]
    },
    {
      type: 'radio',
      key: 'shortUrl',
      label: '短链接',
      initVal: card.shortUrl || 'false',
      options: [{
        value: 'false',
        text: '禁用'
      }, {
        value: 'true',
        text: '启用'
      }]
    },
    {
      type: 'textarea',
      key: 'shareUrl',
      label: '链接地址',
      initVal: card.shareUrl || '',
      tooltip: '链接中如果存在@BID@或@ID@将自动替换。',
      required: true
    },
    {
      type: 'textarea',
      key: 'shareProUrl',
      label: '正式链接',
      initVal: card.shareProUrl || '',
      tooltip: '链接中如果存在@BID@或@ID@将自动替换。',
      required: false
    },
    {
      type: 'text',
      key: 'shareTip',
      label: '分享提示',
      initVal: card.shareTip || '',
      tooltip: '分享时对用户的提示信息。',
      required: false
    },
    {
      type: 'number',
      key: 'width',
      min: 0,
@@ -1236,6 +1275,21 @@
    },
    {
      type: 'radio',
      key: 'formCache',
      label: '表单缓存',
      initVal: card.formCache || 'false',
      tooltip: '主要用于数据修改后,更新相关表单的选项,清空缓存后表单再次打开时数据会重新加载。',
      required: false,
      options: [{
        value: 'false',
        text: '不清空'
      }, {
        value: 'clear',
        text: '清空'
      }]
    },
    {
      type: 'radio',
      key: 'hidden',
      label: '隐藏',
      initVal: card.hidden || 'false',
@@ -1461,6 +1515,7 @@
    { value: 'refund', text: '退款' },
    { value: 'closetab', text: '标签关闭' },
    { value: 'expPdf', text: '导出PDF' },
    { value: 'shareLink', text: '分享链接' },
    { value: 'megvii', text: '旷视面板机' },
    { value: 'filezip', text: '文件压缩包' },
  ]
@@ -1932,17 +1987,54 @@
    //   }]
    // },
    {
      type: 'number',
      key: 'width',
      min: 1,
      max: 24,
      precision: 0,
      label: '宽度',
      initVal: card.width || 12,
      tooltip: '栅格布局,每行等分为24列。',
      forbid: card.eleType !== 'button',
      type: 'radio',
      key: 'shortUrl',
      label: '短链接',
      initVal: card.shortUrl || 'false',
      options: [{
        value: 'false',
        text: '禁用'
      }, {
        value: 'true',
        text: '启用'
      }]
    },
    {
      type: 'textarea',
      key: 'shareUrl',
      label: '链接地址',
      initVal: card.shareUrl || '',
      tooltip: '链接中如果存在@BID@或@ID@将自动替换。',
      required: true
    },
    {
      type: 'textarea',
      key: 'shareProUrl',
      label: '正式链接',
      initVal: card.shareProUrl || '',
      tooltip: '链接中如果存在@BID@或@ID@将自动替换。',
      required: false
    },
    {
      type: 'text',
      key: 'shareTip',
      label: '分享提示',
      initVal: card.shareTip || '',
      tooltip: '分享时对用户的提示信息。',
      required: false
    },
    // {
    //   type: 'number',
    //   key: 'width',
    //   min: 1,
    //   max: 24,
    //   precision: 0,
    //   label: '宽度',
    //   initVal: card.width || 12,
    //   tooltip: '栅格布局,每行等分为24列。',
    //   forbid: card.eleType !== 'button',
    //   required: true
    // },
    {
      type: 'radio',
      key: 'show',
@@ -2232,6 +2324,21 @@
    },
    {
      type: 'radio',
      key: 'formCache',
      label: '表单缓存',
      initVal: card.formCache || 'false',
      tooltip: '主要用于数据修改后,更新相关表单的选项,清空缓存后表单再次打开时数据会重新加载。',
      required: false,
      options: [{
        value: 'false',
        text: '不清空'
      }, {
        value: 'clear',
        text: '清空'
      }]
    },
    {
      type: 'radio',
      key: 'hidden',
      label: '隐藏',
      initVal: card.hidden || 'false',
src/tabviews/custom/components/card/cardcellList/index.jsx
@@ -24,6 +24,7 @@
const FuncMegvii = asyncComponent(() => import('@/tabviews/zshare/actionList/funcMegvii'))
const FuncZip = asyncComponent(() => import('@/tabviews/zshare/actionList/funczip'))
const ExportPdf = asyncComponent(() => import('@/tabviews/zshare/actionList/exportPdf'))
const ShareLink = asyncComponent(() => import('@/tabviews/zshare/actionList/shareLink'))
const EditLine = asyncComponent(() => import('@/tabviews/zshare/actionList/editLine'))
const BarCode = asyncComponent(() => import('@/components/barcode'))
const QrCode = asyncComponent(() => import('@/components/qrcode'))
@@ -1107,6 +1108,12 @@
            MkButton = <ExportPdf
              btn={card}
            />
          } else if (card.funcType === 'shareLink') {
            MkButton = <ShareLink
              BID={data.$$BID}
              btn={card}
              selectedData={_data}
            />
          } else if (card.funcType === 'addline' || card.funcType === 'delline') {
            MkButton = <EditLine
              btn={card}
src/tabviews/zshare/actionList/index.jsx
@@ -19,6 +19,7 @@
const FuncZip = asyncComponent(() => import('./funczip'))
const EditLine = asyncComponent(() => import('./editLine'))
const ExportPdf = asyncComponent(() => import('./exportPdf'))
const ShareLink = asyncComponent(() => import('./shareLink'))
class ActionList extends Component {
  static propTpyes = {
@@ -196,6 +197,15 @@
              btn={item}
            />
          )
        } else if (item.funcType === 'shareLink') {
          return (
            <ShareLink
              key={item.uuid}
              BID={BID}
              btn={item}
              selectedData={selectedData}
            />
          )
        } else if (item.funcType === 'addline' || item.funcType === 'delline') {
          return (
            <EditLine
src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -2326,6 +2326,10 @@
      tabId = btn.refreshTab[btn.refreshTab.length - 1]
    }
    if (btn.formCache === 'clear') { // 清除表单缓存
      window.GLOB.CacheMap = new Map()
    }
    if (tabId && btn.$MenuID === tabId) { // 刷新当前菜单时,停止其他操作
      MKEmitter.emit('reloadMenuView', tabId, 'table')
      return
src/tabviews/zshare/actionList/shareLink/index.jsx
New file
@@ -0,0 +1,193 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Button, notification, message, Modal } from 'antd'
import md5 from 'md5'
import Api from '@/api'
import MKEmitter from '@/utils/events.js'
import MkIcon from '@/components/mk-icon'
// import './index.scss'
class ShareLink extends Component {
  static propTpyes = {
    BID: PropTypes.string,
    btn: PropTypes.object,
    selectedData: PropTypes.any
  }
  state = {
    loading: false
  }
  componentDidMount () {
    MKEmitter.addListener('triggerBtnId', this.actionTrigger)
  }
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.state), fromJS(nextState))
  }
  componentWillUnmount () {
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('triggerBtnId', this.actionTrigger)
  }
  /**
   * @description 触发按钮操作
   */
  actionTrigger = (triggerId) => {
    const { btn, BID, selectedData } = this.props
    const { loading } = this.state
    if (loading) return
    if (triggerId && btn.uuid !== triggerId) return
    if (window.GLOB.systemType === 'production' && !btn.shareProUrl) {
      notification.warning({
        top: 92,
        message: '尚未设置正式系统链接地址!',
        duration: 5
      })
      return
    }
    let bid = BID || ''
    let id = ''
    if (selectedData && selectedData[0]) {
      id = selectedData[0].$$uuid || ''
    }
    let url = btn.shareUrl
    if (window.GLOB.systemType === 'production') {
      url = btn.shareProUrl
    }
    url = url.replace(/@BID@/ig, bid).replace(/@ID@/ig, id)
    if (btn.shortUrl === 'true') {
      this.setState({
        loading: true
      }, () => {
        this.getShortUrl(url)
      })
    } else {
      this.copyUrl(url)
    }
  }
  getShortUrl = (url) => {
    let _rduri = window.atob('aHR0cHM6Ly9lcGMubWs5aC5$mkjbi93ZWJhcGkvZG9zdGFycw=='.replace(/\$mk/ig, ''))
    let _id = window.atob('YmgwYmFwYWJ0ZDQ1ZXBz$mkZ3JhNzlzZWdiY2g2YzFpYms='.replace(/\$mk/ig, ''))
    let param = {
      func: 's_url_db_adduptdel',
      appkey: window.GLOB.appkey,
      userid: _id,
      LoginUID: _id,
      type: 'add_only',
      validity: 15,
      linkurl: url,
      nonc: '' + new Date().getTime(),
      id: md5(url + window.GLOB.appkey)
    }
    let keys = Object.keys(param).sort()
    let values = ''
    keys.forEach(key => {
      values += key + param[key]
    })
    param.sign = md5(values)
    param.t = new Date().getTime()
    Api.directRequest({
      url: _rduri + '/s_url_db_adduptdel',
      method: 'post',
      data: JSON.stringify(param)
    }).then(res => {
      this.setState({
        loading: false
      })
      if (res.status && res.id) {
        this.copyUrl('https://mk9h.cn/m.asp?m=' + res.id)
      } else {
        notification.warning({
          top: 92,
          message: res.message || '链接生成失败!',
          duration: 5
        })
      }
    }, () => {
      this.setState({
        loading: false
      })
    })
  }
  copyUrl = (url) => {
    const { btn } = this.props
    let oInput = document.createElement('input')
    oInput.value = url
    document.body.appendChild(oInput)
    oInput.select()
    document.execCommand('Copy')
    document.body.removeChild(oInput)
    if (btn.shareTip) {
      Modal.success({
        title: btn.shareTip
      })
    } else {
      message.success('已复制到剪切板。')
    }
  }
  render() {
    const { btn } = this.props
    const { loading } = this.state
    let label = ''
    let icon = ''
    let type = 'link'
    let className = ''
    let style = {...btn.style}
    if (btn.show === 'button') {
      label = btn.label
      icon = btn.icon || ''
    } else if (btn.show === 'link') {
      label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span>
      icon = ''
    } else if (btn.show === 'icon') {
      icon = btn.icon || ''
    } else if (!btn.$toolbtn) {
      icon = btn.icon || ''
      label = btn.label
      className = 'mk-btn mk-' + btn.class
    } else {
      type = ''
      icon = btn.icon || ''
      label = btn.label
      className = 'mk-btn mk-' + btn.class
    }
    return (
      <Button
        type={type}
        title={btn.show === 'icon' ? btn.label : ''}
        style={style}
        loading={loading}
        icon={icon}
        className={className}
        onClick={(e) => {e.stopPropagation(); this.actionTrigger()}}
      >{label}</Button>
    )
  }
}
export default ShareLink
src/tabviews/zshare/actionList/shareLink/index.scss