| | |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | import { formRule } from '@/utils/option.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | const MkVercode = asyncComponent(() => import('./mkVercode')) |
| | | const MKEditor = asyncComponent(() => import('@/components/editor')) |
| | | |
| | | class MainSearch extends Component { |
| | | class MutilFormComponent extends Component { |
| | | static propTpyes = { |
| | | action: PropTypes.object, // 按钮信息、表单列表 |
| | | data: PropTypes.any, // 表格数据 |
| | |
| | | } else { |
| | | supvals.push('') |
| | | } |
| | | supvals = Array.from(new Set(supvals)) |
| | | controlFields[item.supField] = controlFields[item.supField] || [] |
| | | controlFields[item.supField].push({field: item.field, values: supvals}) |
| | | } |
| | |
| | | |
| | | let cell = fieldMap.get(item.field) |
| | | |
| | | // if (cell.hidden) return |
| | | |
| | | if (supItem.hidden || !item.values.includes(supItem.initval)) { |
| | | let _hidden = false |
| | | |
| | | if (supItem.hidden) { |
| | | _hidden = true |
| | | } else { |
| | | let box = [...item.values] |
| | | if (supItem.type === 'multiselect' || (supItem.type === 'checkcard' && supItem.multiple === 'true')) { |
| | | box.push(...supItem.initval.split(',')) |
| | | } else { |
| | | box.push(supItem.initval) |
| | | } |
| | | |
| | | if (box.length === Array.from(new Set(box)).length) { |
| | | _hidden = true |
| | | } |
| | | } |
| | | |
| | | if (_hidden) { |
| | | cell.hidden = true |
| | | if (cell.empty === 'hidden') { |
| | | cell.$hidden = true |
| | |
| | | }) |
| | | |
| | | item.options = fromJS(item.oriOptions).toJS() |
| | | } |
| | | item.linkSubField = null |
| | | } else if (item.type === 'switch' && item.linkSubField) { |
| | | item.options = [] |
| | | item.subFields = [] |
| | | item.linkSubField.forEach(m => { |
| | | let n = fieldMap.get(m) |
| | | if (n && ['text', 'number', 'textarea'].includes(n.type)) { |
| | | item.subFields.push({ |
| | | uuid: n.uuid, |
| | | field: m |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | if (item.subFields.length === 0) { |
| | | item.subFields = null |
| | | } else { |
| | | reFieldsVal = reFieldsVal || {} |
| | | |
| | | let val = item.initval === item.openVal ? item.openText : item.closeText |
| | | |
| | | item.subFields.forEach(n => { |
| | | reFieldsVal[n.field] = val || '' |
| | | }) |
| | | } |
| | | item.linkSubField = null |
| | | } |
| | |
| | | if (unload) return |
| | | |
| | | if (action.setting && action.setting.focus && fieldMap.has(action.setting.focus)) { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFC', 'focus', fieldMap.get(action.setting.focus).uuid) |
| | | }, 500) |
| | | let focusItem = fieldMap.get(action.setting.focus) |
| | | |
| | | if (focusItem.type === 'text' || focusItem.type === 'number') { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFC', 'focus', focusItem.uuid) |
| | | }, 50) |
| | | } else { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFC', 'focus', focusItem.uuid) |
| | | }, 500) |
| | | } |
| | | } |
| | | |
| | | if (deForms.length > 0) { |
| | | if (!window.GLOB.mkHS && options.sysType === 'local' && window.GLOB.systemType !== 'production') { |
| | | if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') { |
| | | this.improveSimpleActionForm(deForms) |
| | | } else { |
| | | this.improveActionForm(deForms) |
| | |
| | | let mainItems = [] // 云端或单点数据 |
| | | let localItems = [] // 本地数据 |
| | | let cache = action.setting.cache !== 'false' |
| | | let debug = window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud') |
| | | let debug = window.GLOB.debugger === true || (window.debugger === true && window.GLOB.sysType !== 'cloud') |
| | | |
| | | let _sql = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n` |
| | | let _sso = _sql |
| | |
| | | |
| | | if (window.GLOB.mkHS) { // 云端数据验证 |
| | | mainparam.open_key = Utils.encryptOpenKey(mainparam.secretkey, mainparam.timestamp) |
| | | if (options.cloudServiceApi) { |
| | | mainparam.rduri = options.cloudServiceApi |
| | | if (window.GLOB.cloudServiceApi) { |
| | | mainparam.rduri = window.GLOB.cloudServiceApi |
| | | mainparam.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | mainparam.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } |
| | |
| | | */ |
| | | improveSimpleActionForm = (deForms) => { |
| | | let cache = this.props.action.setting.cache !== 'false' |
| | | let debug = window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud') |
| | | let debug = window.GLOB.debugger === true || (window.debugger === true && window.GLOB.sysType !== 'cloud') |
| | | let _sql = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n` |
| | | |
| | | let deffers = deForms.map((form, index) => { |
| | |
| | | |
| | | current.controlFields.forEach(cell => { |
| | | let m = map.get(cell.field) |
| | | m.hidden = current.hidden || !cell.values.includes(val) |
| | | |
| | | m.hidden = false |
| | | |
| | | if (current.hidden) { |
| | | m.hidden = true |
| | | } else { |
| | | let box = [...cell.values] |
| | | if (current.type === 'multiselect' || (current.type === 'checkcard' && current.multiple === 'true')) { |
| | | box.push(...val.split(',')) |
| | | } else { |
| | | box.push(val) |
| | | } |
| | | |
| | | if (box.length === Array.from(new Set(box)).length) { |
| | | m.hidden = true |
| | | } |
| | | } |
| | | |
| | | if (m.empty === 'hidden' && m.oriOptions.length === 0) { |
| | | m.hidden = true |
| | |
| | | className = 'checkcard' |
| | | content = (<MKCheckCard config={item} onChange={(val, other) => this.recordChange({[item.field]: val, ...other}, item)}/>) |
| | | } else if (item.type === 'switch') { |
| | | content = (<MKSwitch config={item} onChange={(val) => this.recordChange({[item.field]: val}, item)}/>) |
| | | content = (<MKSwitch config={item} onChange={(val, other) => this.recordChange({[item.field]: val, ...other}, item)}/>) |
| | | } else if (item.type === 'check') { |
| | | content = (<MKCheck config={item} onChange={(val) => this.recordChange({[item.field]: val}, item)}/>) |
| | | } else if (item.type === 'checkbox') { |
| | |
| | | _item.fieldlen = item.decimal || 0 |
| | | } else if (['text', 'textarea', 'linkMain'].includes(item.type)) { |
| | | _item.value = _item.value + '' |
| | | _item.value = _item.value.replace(/\t*|\v*/g, '') // 去除制表符 |
| | | _item.value = _item.value.replace(/\t+|\v+/g, '') // 去除制表符 |
| | | |
| | | if (item.interception !== 'false') { // 去除首尾空格 |
| | | _item.value = _item.value.replace(/(^\s*|\s*$)/g, '') |
| | |
| | | } |
| | | } |
| | | |
| | | export default Form.create()(MainSearch) |
| | | export default Form.create()(MutilFormComponent) |