king
2021-03-26 b816a38598a2b96f244ba1aacec05f7071b1a803
src/tabviews/custom/components/form/normal-form/index.jsx
@@ -6,7 +6,7 @@
// import moment from 'moment'
import Api from '@/api'
// import Utils from '@/utils/utils.js'
import Utils from '@/utils/utils.js'
import UtilsDM from '@/utils/utils-datamanage.js'
import asyncComponent from '@/utils/asyncComponent'
import asyncSpinComponent from '@/utils/asyncSpinComponent'
@@ -46,7 +46,7 @@
    let _data = null
    let _sync = false
    
    if (config.setting && config.wrap.datatype !== 'static') {
    if (config.wrap.datatype !== 'static') {
      _sync = config.setting.sync === 'true'
      if (_sync && data && data[config.dataName]) {
@@ -60,6 +60,8 @@
      _data = {}
    }
    let roleId = sessionStorage.getItem('role_id') || ''
    config.subcards = config.subcards.map(group => {
      group.subButton.uuid = group.uuid
      group.subButton.$menuId = group.uuid
@@ -68,6 +70,25 @@
      group.subButton.OpenType = 'formSubmit'
      group.subButton.execError = 'never'
      group.fields = group.fields.map(cell => {
        // 数据源sql语句,预处理,权限黑名单字段设置为隐藏表单
        if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') {
          let _option = Utils.getSelectQueryOptions(cell)
          cell.data_sql = Utils.formatOptions(_option.sql)
          cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql))
          cell.arr_field = _option.field
        }
        // 字段权限黑名单
        if (!cell.blacklist || !roleId || cell.blacklist.length === 0) return cell
        if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
          cell.hidden = 'true'
        }
        return cell
      })
      return group
    })