king
2022-09-06 b8e1395f02c929eaa96b949cf6027ee2a43856a6
src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx
@@ -6,19 +6,36 @@
/**
 * @description 获取显示列表单配置信息
 * @param {object} card       // 搜索条件对象
 * @param {Array}  menulist   // 菜单列表-用于字段透视
 */
export function getColumnForm (card, menulist = [], fields = []) {
export function getColumnForm (card, fields = []) {
  let appType = sessionStorage.getItem('appType')
  let roleList = sessionStorage.getItem('sysRoles')
  if (roleList) {
    try {
      roleList = JSON.parse(roleList)
    } catch {
    } catch (e) {
      roleList = []
    }
  } else {
    roleList = []
  }
  let menulist = []
  if (appType === 'pc') {
    menulist = sessionStorage.getItem('appMenus')
  } else if (!appType) {
    menulist = sessionStorage.getItem('fstMenuList')
  }
  if (menulist) {
    try {
      menulist = JSON.parse(menulist)
    } catch (e) {
      menulist = []
    }
  } else {
    menulist = []
  }
  let options = [{
@@ -42,6 +59,9 @@
  }, {
    value: 'colspan',
    text: '合并列'
  }, {
    value: 'formula',
    text: '公式'
  }, {
    value: 'index',
    text: '序号'
@@ -132,9 +152,8 @@
      type: 'radio',
      key: 'IsSort',
      label: Formdict['model.sort'],
      initVal: card.IsSort || 'true',
      initVal: card.IsSort || (card.isSub ? 'false' : 'true'),
      required: true,
      forbidden: card.isSub,
      options: [{
        value: 'true',
        text: Formdict['model.true']
@@ -198,7 +217,7 @@
      decimal: 0,
      label: Formdict['header.form.decimal'],
      initVal: card.decimal || 0,
      required: true
      required: false
    },
    {
      type: 'select',
@@ -207,13 +226,16 @@
      initVal: card.format || 'none',
      options: [{
        value: 'none',
        text: Formdict['model.empty']
        text: '无'
      }, {
        value: 'thdSeparator',
        text: Formdict['header.form.thdSeparator']
        text: '千分位'
      }, {
        value: 'percent',
        text: '百分比'
      }, {
        value: 'abs',
        text: '绝对值'
      }],
      required: false
    },
@@ -224,7 +246,10 @@
      initVal: card.textFormat || 'none',
      options: [{
        value: 'none',
        text: Formdict['model.empty']
        text: '无'
      }, {
        value: 'encryption',
        text: '加密'
      }, {
        value: 'YYYY-MM-DD',
        text: 'YYYY-MM-DD'
@@ -247,12 +272,22 @@
      key: 'postfix',
      label: Formdict['header.form.postfix'],
      initVal: card.postfix || '',
      tooltipClass: 'middle',
      required: false,
      readonly: false
    },
    {
      type: 'radio',
      type: 'number',
      key: 'span',
      min: 1,
      max: 24,
      precision: 0,
      label: '图片宽度',
      initVal: card.span || 24,
      tooltip: '栅格布局,等分为24份。',
      required: true
    },
    {
      type: 'select',
      key: 'lenWidRadio',
      label: '长宽比',
      initVal: card.lenWidRadio || '1:1',
@@ -278,30 +313,9 @@
    },
    {
      type: 'radio',
      key: 'picSort',
      label: '图片排列',
      initVal: card.picSort || '1',
      tooltip: '同一单元格内,含有多张图片时的列数。',
      required: false,
      options: [{
        value: '1',
        text: '1'
      }, {
        value: '2',
        text: '2'
      }, {
        value: '3',
        text: '3'
      }, {
        value: '4',
        text: '4'
      }]
    },
    {
      type: 'radio',
      key: 'scale',
      label: Formdict['header.form.clickscale'],
      initVal: card.scale || 'false',
      label: '点击缩放',
      initVal: card.scale || 'true',
      required: false,
      options: [{
        value: 'true',
@@ -329,10 +343,10 @@
      forbidden: appType === 'mob'
    },
    {
      type: 'cascader',
      type: appType === 'pc' ? 'select' : 'cascader',
      key: 'linkmenu',
      label: Formdict['model.menu'],
      initVal: card.linkmenu || [],
      initVal: card.linkmenu || (appType === 'pc' ? '' : []),
      required: true,
      options: menulist,
      forbidden: appType === 'mob'
@@ -355,12 +369,46 @@
      forbidden: appType === 'mob'
    },
    {
      type: 'radio',
      key: 'open',
      label: '打开方式',
      initVal: card.open || 'blank',
      required: false,
      forbid: appType !== 'pc',
      options: [
        { value: 'blank', text: '新窗口' },
        { value: 'self', text: '当前窗口' }
      ]
    },
    {
      type: 'radio',
      key: 'eval',
      label: '解析',
      initVal: card.eval || 'true',
      tooltip: '当公式内容涉及计算时请选择“是”,当公式内容为字段拼接时请选择“否”。',
      required: false,
      options: [
        { value: 'true', text: '是' },
        { value: 'false', text: '否' }
      ]
    },
    {
      type: 'textarea',
      key: 'formula',
      label: '公式',
      initVal: card.formula || '',
      tooltip: '执行时会使用查询到的数据替换相应的字段,展示获得的结果,在不使用解析时换行符或空格会替换为页面元素。可使用JS的一些语法,如:三元表达式 @field1@ > @field2@ ? 0 : 1;Math对象,取绝对值 Math.abs(@field@)、四舍五入 Math.round(@field@)等',
      placeholder: '例如:@price@ * @number@',
      required: true
    },
    {
      type: 'multiselect',
      key: 'blacklist',
      label: Formdict['header.form.blacklist'],
      initVal: card.blacklist || [],
      required: false,
      options: roleList
      options: roleList,
      forbidden: appType === 'mob'
    }
  ]
}