king
2020-12-01 b3852c89968e9d5d6a3b9a4998d869bfbbfd1842
2020-12-01
11个文件已修改
251 ■■■■■ 已修改文件
src/menu/modelsource/option.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/calendar/index.jsx 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/calendar/index.jsx 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/calendar/index.scss 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/index.jsx 118 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/sharecomponent/settingcalcomponent/verifycard/utils.jsx 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/sharecomponent/settingcomponent/settingform/index.jsx 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/sharecomponent/settingcomponent/settingform/utils.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/verifycard/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/utils.js 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/modelsource/option.jsx
@@ -8,7 +8,7 @@
import card1 from '@/assets/mobimg/card1.png'
import card2 from '@/assets/mobimg/card2.png'
import TableCard from '@/assets/mobimg/table-card.png'
import NormalTable from '@/assets/mobimg/normal-table.png'
// import NormalTable from '@/assets/mobimg/normal-table.png'
import Pie from '@/assets/mobimg/pie.png'
import Pie1 from '@/assets/mobimg/ring.png'
import Pie2 from '@/assets/mobimg/nightingale.png'
@@ -22,7 +22,7 @@
  { type: 'menu', url: Mainsearch, component: 'search', subtype: 'mainsearch', title: '搜索条件', width: 24, forbid: ['billPrint'] },
  { type: 'menu', url: card1, component: 'card', subtype: 'datacard', title: '数据卡', config: `[{"uuid":"160135809128212dm7i29fim9ksto9od","setting":{"width":6},"style":{"paddingTop":"15px","marginTop":"4px","paddingRight":"15px","marginRight":"8px","marginLeft":"8px","backgroundColor":"rgba(255, 255, 255, 1)","borderColor":"#e8e8e8","paddingLeft":"15px","marginBottom":"4px","borderWidth":"1px","paddingBottom":"10px"},"backStyle":{},"elements":[{"datatype":"static","width":12,"marks":null,"height":1,"value":"关单","style":{},"prefix":"","postfix":"","format":"","eleType":"text","uuid":"160231860159931untbea62sgokunc5s"},{"datatype":"static","width":12,"marks":null,"style":{"color":"rgba(250, 219, 20, 1)","textAlign":"right"},"btnstyle":{},"eleType":"icon","icon":"question-circle","field":"","uuid":"1602318768361nv8ql4t47sgcsn88b0u"},{"datatype":"static","width":24,"marks":null,"height":1,"innerHeight":36,"value":"100","style":{"fontSize":"24px","fontWeight":"500","color":"rgba(0, 0, 0, 1)"},"prefix":"","btnstyle":{},"postfix":"","format":"","eleType":"text","uuid":"1602318817884v70gtgb65ubnm8mbcvv"},{"color":"#1890ff","width":24,"marks":null,"maxValue":100,"style":{"color":"rgba(250, 140, 22, 1)","paddingTop":"20px","paddingBottom":"10px"},"btnstyle":{},"eleType":"slider","field":"int1","uuid":"16023188871233rkktuvpp1h077igrsu"},{"eleType":"splitline","width":24,"color":"#e8e8e8","uuid":"1602320017038n31bk9o831ggug0tu0b","marks":null,"style":{"marginTop":"10px","marginBottom":"10px"},"btnstyle":{}},{"datatype":"static","width":12,"marks":null,"height":1,"value":"100","style":{"marginTop":"6px"},"prefix":"关单","btnstyle":{},"postfix":"","format":"","eleType":"text","uuid":"1602320061243drd7lf3agvn04kgr175"}],"backElements":[]}]` },
  { type: 'menu', url: card2, component: 'card', subtype: 'propcard', title: '属性卡', config: `[{"uuid":"1603681387259qaqf1127f72esmtchge","setting":{"width":6,"type":"simple"},"style":{"paddingTop":"15px","marginTop":"8px","paddingRight":"15px","marginRight":"8px","marginLeft":"8px","borderColor":"#e8e8e8","paddingLeft":"15px","marginBottom":"8px","borderWidth":"1px","paddingBottom":"15px"},"backStyle":{},"elements":[{"datatype":"static","width":12,"marks":null,"height":1,"value":"超时工单","style":{"color":"rgba(67, 67, 67, 0.51)"},"prefix":"","postfix":"","format":"","eleType":"text","uuid":"1603681402945qnkgm7q8cng65evn5ev"},{"eleType":"icon","datatype":"static","width":12,"icon":"question-circle","tooltip":"超时工单","uuid":"1603681473384i2crkbtofg4pu76k06a","marks":null,"style":{"textAlign":"right","color":"rgba(250, 219, 20, 1)"}},{"datatype":"static","width":24,"marks":null,"height":1,"innerHeight":36,"value":"100","style":{"fontSize":"24px","color":"rgba(0, 0, 0, 1)"},"prefix":"","postfix":"","format":"","eleType":"number","uuid":"1603681539870d704ufqf98kc6t7537t"},{"color":"rgba(250, 219, 20, 1)","datatype":"static","width":24,"marks":null,"maxValue":100,"value":50,"style":{"paddingTop":"10px","paddingBottom":"10px"},"eleType":"slider","uuid":"1603683067556mvupau0odvrtv45u7o8"},{"eleType":"splitline","width":24,"color":"#e8e8e8","uuid":"1603683117981t9k55k8an430fuppmci","marks":null,"style":{"paddingTop":"5px","paddingBottom":"5px"}},{"datatype":"static","width":12,"marks":null,"height":1,"value":"100","style":{"color":"rgba(0, 0, 0, 0.65)","marginTop":"10px"},"prefix":"超时工单  ","postfix":"","format":"","eleType":"text","uuid":"1603683136553uvsmkfohkft9idbfkhu"}],"backElements":[]}]` },
  { type: 'menu', url: NormalTable, component: 'table', subtype: 'normaltable', title: '常用表', width: 24 },
  // { type: 'menu', url: NormalTable, component: 'table', subtype: 'normaltable', title: '常用表', width: 24 },
  { type: 'menu', url: TableCard, component: 'table', subtype: 'tablecard', title: '表格', width: 12 },
  { type: 'menu', url: line, component: 'line', subtype: 'line', title: '折线图' },
  { type: 'menu', url: line1, component: 'line', subtype: 'line1', title: '阶梯折线图' },
src/tabviews/calendar/index.jsx
@@ -329,7 +329,7 @@
    }
    
    let _dataresource = setting.dataresource
    let regoptions = null
    let regoptions = []
    if (setting.queryType === 'statistics' || param.custom_script) {
      let allSearch = Utils.getAllSearchOptions(search)
      let userName = sessionStorage.getItem('User_Name') || ''
@@ -355,18 +355,18 @@
      })
    }
    if (config.calendar.refresh === 'true' && regoptions) {
    if (config.calendar.refresh === 'true') {
      regoptions.push({
        reg: new RegExp('@calendarDate@', 'ig'),
        value: `${calendarYear}-01-01 00:00:00.000`
        value: `'${calendarYear}-01-01 00:00:00.000'`
      })
      regoptions.push({
        reg: new RegExp('@calendarDate1@', 'ig'),
        value: `${calendarYear}-12-31 23:59:59.999`
        value: `'${calendarYear}-12-31 23:59:59.999'`
      })
    }
    if (setting.queryType === 'statistics' && setting.execute !== 'false') { // 统计数据源,内容替换
    if ((setting.queryType === 'statistics' || config.calendar.refresh === 'true') && setting.execute !== 'false') { // 统计数据源,内容替换
      regoptions.forEach(item => {
        _dataresource = _dataresource.replace(item.reg, item.value)
      })
src/tabviews/zshare/calendar/index.jsx
@@ -67,7 +67,7 @@
      let datelist = this.getDateList(this.state.selectYear)
      let monthlist = null
      
      datelist = this.mountdata(datelist, nextProps.data || [])
      datelist = this.mountdata(datelist, nextProps.data)
      if (this.state.levels.includes('month') || this.state.levels.includes('year')) {
        monthlist = datelist.filter(item => item.month === this.state.selectMonth)[0]
@@ -95,7 +95,7 @@
    let levels = { red: 1, orange: 2, yellow: 3, green: 4, cyan: 5, blue: 6, purple: 7, gray: 8 }
    let colors = { red: '#d0021b', orange: '#f5a623', yellow: '#f8e71c', green: '#7ed321', cyan: '#50e3c2', blue: '#1890ff', purple: '#bd10e0', gray: '#9b9b9b' }
    data.forEach(item => {
    data && data.forEach(item => {
      let startTime = item[calendar.startfield]
      let endTime = item[calendar.endfield]
      let color = item[calendar.colorfield]
@@ -237,7 +237,16 @@
  }
  monthChange = (value) => {
    const { datelist } = this.state
    const { datelist, levels, selectYear } = this.state
    if (!levels.includes('month')) {
      if (this.props.triggerDate) {
        this.props.triggerDate({
          time: `${selectYear}${value}01`
        })
      }
      return
    }
    this.setState({
      level: 'month',
src/tabviews/zshare/calendar/index.scss
@@ -133,9 +133,9 @@
    .year-calendar {
      .year-wrap {
        width: calc(100% - 2px);
        box-shadow: 0px 0px 3px #bae7ff;
        cursor: pointer;
        transition: background 0.1s;
        box-shadow: 0px 0px 3px #bae7ff;
        .header {
          text-align: center;
          font-size: 16px;
src/tabviews/zshare/mutilform/index.jsx
@@ -66,6 +66,7 @@
    let formlist = []
    let encrypts = []
    let intercepts = []
    let _inputfields = []
    if (action.groups.length > 0) {
      action.groups.forEach(group => {
@@ -85,29 +86,32 @@
      formlist = action.fields
    }
    let _inputfields = formlist.filter(item => (item.type === 'text' || item.type === 'number') && item.field) // 用于过滤下拉菜单关联表单
    let linkFields = {} // 关联菜单
    let supItemVal = {} // 上级菜单初始值
    let deForms = []    // 需要动态获取下拉菜单的表单
    formlist.forEach(item => {
      if (item.type === 'text' || item.type === 'number') {                // 用于过滤下拉菜单关联表单
        _inputfields.push(item.field)
      } else if (item.type === 'textarea' && item.encryption === 'true') { // 加密字段
        encrypts.push(item.field)
      } else if (item.type === 'link') {
        linkFields[item.linkField] = linkFields[item.linkField] || []
        linkFields[item.linkField].push(item.field)
      }
      if (item.interception === 'true') {                                  // 字符截取字段
        intercepts.push(item.field)
      }
    })
    formlist = formlist.map(item => {
      if (item.type === 'title') return item
      // 加密字段
      if (item.type === 'textarea' && item.encryption === 'true') {
        encrypts.push(item.field)
      }
      // 字符截取字段
      if (item.interception === 'true') {
        intercepts.push(item.field)
      }
      // 数据自动填充
      let _readin = item.readin !== 'false'
      if (item.type === 'linkMain' || item.type === 'funcvar') {
        _readin = false
      }
      // 用于受控值的表单,隐藏时传默认值(未使用?)
      item.initVal = typeof(item.initval) === 'object' ? fromJS(item.initval).toJS() : item.initval
      let _fieldlen = item.fieldlength || 50
      if (item.type === 'textarea' || item.type === 'fileupload' || item.type === 'multiselect') {
@@ -122,29 +126,22 @@
      writein[item.field] = item.writein !== 'false'
      fieldlen[item.field] = _fieldlen
      if (item.type === 'select' || item.type === 'link' || item.type === 'multiselect' || item.type === 'radio' || item.type === 'checkbox') {
        if (item.setAll === 'true' && (item.type === 'select' || item.type === 'link' || item.type === 'radio')) {
          item.options.unshift({
            key: Utils.getuuid(),
            Value: '',
            Text: item.emptyText || '空'
          })
        }
      if (item.setAll === 'true' && (item.type === 'select' || item.type === 'link' || item.type === 'radio')) { // 添加空值
        item.options.unshift({
          key: Utils.getuuid(),
          Value: '',
          Text: item.emptyText || '空'
        })
      }
        // 保存初始列表,用于联动菜单控制
        item.oriOptions = fromJS(item.options).toJS()
      item.oriOptions = item.options ? fromJS(item.options).toJS() : null // 保存初始列表,用于联动菜单控制
        // 下级表单控制-字段写入
        if (item.type === 'select' || item.type === 'radio') {
          if (item.linkSubField && item.linkSubField.length > 0) {
            item.linkSubField = item.linkSubField.filter(_item => _inputfields.includes(_item))
          }
          if (item.linkSubField && item.linkSubField.length === 0) {
            item.linkSubField = null
          }
        } else {
          item.linkSubField = null
        }
      // 下级表单控制-字段写入
      if ((item.type === 'select' || item.type === 'radio') && item.linkSubField && item.linkSubField.length > 0) {
        item.linkSubField = item.linkSubField.filter(_item => _inputfields.includes(_item))
      }
      if (item.linkSubField && item.linkSubField.length === 0) {
        item.linkSubField = null
      }
      let newval = ''
@@ -226,31 +223,30 @@
        item.supvalue = supvals
      }
      if (linkFields[item.field]) {
        item.linkFields = linkFields[item.field]
      }
      supItemVal[item.field] = item.initval
      if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(item.type) && item.resourceType === '1') {
        deForms.push(item)
      }
      return item
    })
    formlist = formlist.map(item => {
      if (item.type === 'link') {
        let supItem = formlist.filter(form => form.field === item.linkField)[0]
        item.supInitVal = ''
        // 关联显示列中的字段值,通过该值过滤下拉选项
        if (!supItem && data && data.hasOwnProperty(item.linkField)) {
          supItem = {initval: data[item.linkField]}
        if (supItemVal[item.linkField]) {
          item.supInitVal = supItemVal[item.linkField]
        } else if (data && data.hasOwnProperty(item.linkField)) {
          item.supInitVal = data[item.linkField]
        }
        
        if (!supItem) {
          notification.warning({
            top: 92,
            message: '未查询到表单《' + item.label + '》关联字段!',
            duration: 5
          })
          item.supInitVal = ''
        } else {
          item.supInitVal = supItem.initval
          item.options = item.oriOptions.filter(option => option.ParentID === supItem.initval)
        }
        item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal)
      }
      return item
    })
@@ -281,19 +277,16 @@
      this.setState({
        loaded: true
      })
      this.improveActionForm()
      this.improveActionForm(deForms)
    })
  }
  /**
   * @description 获取下拉表单选项信息
   */
  improveActionForm = () => {
  improveActionForm = (deForms) => {
    const { BID, menuType } = this.props
    const { formlist } = this.state
    // 需要动态获取下拉菜单的表单
    let deForms = formlist.filter(item => ['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(item.type) && item.resourceType === '1' && (item.type === 'link' || item.hidden !== 'true'))
    if (deForms.length === 0) {
      return
@@ -445,11 +438,7 @@
      this.setState({
        formlist: _formlist.map(item => {
          if (item.type === 'link') {
            if (item.supInitVal) {
              item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal)
            } else {
              item.options = item.oriOptions
            }
            item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal)
          } else if (['select', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(item.type)) {
            item.options = item.oriOptions
          }
@@ -542,11 +531,7 @@
      this.setState({
        formlist: _formlist.map(item => {
          if (item.type === 'link') {
            if (item.supInitVal) {
              item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal)
            } else {
              item.options = item.oriOptions
            }
            item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal)
          } else if (['select', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(item.type)) {
            item.options = item.oriOptions
          }
@@ -1291,7 +1276,6 @@
              return item
            })
          }
          resolve(search)
        } else {
          reject(err)
src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx
@@ -244,7 +244,7 @@
  }
  sqlverify = (resolve, reject, type, testScripts) => {
    const { searches } = this.props
    const { searches, config } = this.props
    const { columns, setting, scripts } = this.state
    if (setting.interType !== 'system') { // 不使用系统接口时,不需要sql验证
@@ -278,7 +278,7 @@
    } else if (setting.execute !== 'false' || _scripts.length > 0) {
      let param = {
        func: 's_debug_sql',
        LText: SettingUtils.getDebugSql(setting, _scripts, columns, searches)
        LText: SettingUtils.getDebugSql(setting, _scripts, columns, Utils.getRegOptions(searches), config.calendar)
      }
      param.LText = Utils.formatOptions(param.LText)
      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
src/templates/sharecomponent/settingcalcomponent/verifycard/utils.jsx
@@ -7,7 +7,7 @@
   * @return {Object}  setting       页面设置
   * @return {Array}   columns       显示字段
   */
  static getDebugSql (setting, scripts, columns, searches) {
  static getDebugSql (setting, scripts, columns, searches, calendar) {
    let sql = ''
    let _dataresource = ''
    let _customScript = ''
@@ -39,27 +39,31 @@
    }
    
    // 正则替换
    let _regoptions = searches.map(item => {
      return {
        reg: new RegExp('@' + item.key + '@', 'ig'),
        value: `'${item.value}'`
      }
    })
    let _regoptions = []
    let _search = ''
    // 日历中的年份替换
    if (setting.queryType === 'statistics' || _customScript) {
      _regoptions.push({
        reg: new RegExp('@calendarDate@', 'ig'),
        value: `1970-01-01 00:00:00.000`
      })
      _regoptions.push({
        reg: new RegExp('@calendarDate1@', 'ig'),
        value: `2030-12-31 23:59:59.999`
      _regoptions = searches.map(item => {
        return {
          reg: new RegExp('@' + item.key + '@', 'ig'),
          value: `'0'`
        }
      })
    }
    if (setting.queryType === 'statistics' && _dataresource) {
    // 日历中的年份替换
    if (calendar.refresh === 'true') {
      _regoptions.push({
        reg: new RegExp('@calendarDate@', 'ig'),
        value: `'1970-01-01 00:00:00.000'`
      })
      _regoptions.push({
        reg: new RegExp('@calendarDate1@', 'ig'),
        value: `'2030-12-31 23:59:59.999'`
      })
    }
    if ((setting.queryType === 'statistics' || calendar.refresh === 'true') && _dataresource) {
      _regoptions.forEach(item => {
        _dataresource = _dataresource.replace(item.reg, item.value)
      })
src/templates/sharecomponent/settingcomponent/settingform/index.jsx
@@ -69,10 +69,6 @@
      })
    }
    // 搜索条件,正则替换
    let allSearch = Utils.initMainSearch(search)
    allSearch = Utils.getAllSearchOptions(allSearch)
    // 搜索的where条件
    let _search = this.formatSearch(search)
    _search = Utils.joinMainSearchkey(_search)
@@ -84,7 +80,7 @@
      setting: _setting,
      search: _search,
      arr_field: arr_field.join(','),
      regoptions: allSearch,
      regoptions: Utils.getRegOptions(search), // 搜索条件,正则替换
      columns: columns,
      scripts: _scripts
    })
src/templates/sharecomponent/settingcomponent/settingform/utils.jsx
@@ -38,7 +38,7 @@
    let _regoptions = regoptions.map(item => {
      return {
        reg: new RegExp('@' + item.key + '@', 'ig'),
        value: `'${item.value}'`
        value: `'0'`
      }
    })
src/templates/zshare/verifycard/index.jsx
@@ -818,12 +818,12 @@
      {
        obj_name: 'voucher',
        arr_field: 'ID,NameNO,TypeCharOne',
        LText: window.btoa(window.encodeURIComponent('select distinct ModularCode as ID,ModularCode+ModularName+ModularNo as NameNO,TypeCharOne from sModular where deleted=0  and Appkey=case when Appkey=\'\' then \'\' else @Appkey@ end  order by ModularCode'))
        LText: window.btoa(window.encodeURIComponent(`select distinct ModularCode as ID,ModularCode+ModularName+ModularNo as NameNO,TypeCharOne from sModular where deleted=0  and Appkey=case when Appkey='' then '' else @Appkey@ end  order by ModularCode`))
      },
      {
        obj_name: 'voucherDetail',
        arr_field: 'ModularDetailCode,CodeName,BID,VoucherTypeTwo,IDefine1',
        LText: window.btoa(window.encodeURIComponent('select distinct ModularDetailCode,ModularDetailCode+ModularDetailName as CodeName,ModularCode as BID, VoucherTypeTwo, IDefine1 from sModularDetail where Deleted=0 and VoucherTypeTwo!=\'\' and Appkey=case when Appkey=\'\' then \'\' else @Appkey@ end  order by ModularDetailCode'))
        LText: window.btoa(window.encodeURIComponent(`select distinct ModularDetailCode,ModularDetailCode+ModularDetailName as CodeName,ModularCode as BID, VoucherTypeTwo, IDefine1 from sModularDetail where Deleted=0 and VoucherTypeTwo!='' and Appkey=case when Appkey='' then '' else @Appkey@ end  order by ModularDetailCode`))
      },
      {
        obj_name: 'noteCodes',
src/utils/utils.js
@@ -524,7 +524,7 @@
  }
  /**
   * @description 拼接搜索条件main
   * @description 获取搜索用于正则替换
   * @param {Array}   searches     搜索条件
   * @return {String}  searchText  拼接结果
   */
@@ -538,9 +538,7 @@
        key: search.key,
        match: search.match,
        type: search.type,
        label: search.label,
        value: search.value,
        required: search.required
        value: search.value
      }
      if (fieldmap.has(item.key)) {
@@ -613,6 +611,50 @@
  }
  /**
   * @description 获取搜索用于正则替换
   * @param {Array}   searches     搜索条件
   * @return {String}  searchText  拼接结果
   */
  static getRegOptions (searches) {
    if (!searches || searches.length === 0) return []
    let options = []
    let fieldmap = new Map()
    searches.forEach(search => {
      let item = {
        key: search.field,
        value: '0'
      }
      if (fieldmap.has(item.key)) {
        item.key = item.key + '1'
      }
      fieldmap.set(item.key, true)
      if (search.type === 'group') {
        options.push({
          key: search.datefield,
          value: '0'
        })
        if (search.transfer === 'true') {
          options.push(item)
        }
      } else if (['datemonth', 'dateweek', 'daterange'].includes(search.type)) {
        options.push(item)
        options.push({
          key: item.key + '1',
          value: '0'
        })
      } else {
        options.push(item)
      }
    })
    return options
  }
  /**
   * @description 拼接搜索条件datamanage
   * @param {Array}   searches     搜索条件
   * @return {String}  searchText  拼接结果