| | |
| | | data: PropTypes.any, // 表格数据 |
| | | BID: PropTypes.any, // 主表ID |
| | | BData: PropTypes.any, // 主表数据 |
| | | unload: PropTypes.any, // 下拉菜单不加载数据 |
| | | inputSubmit: PropTypes.func // input回车提交 |
| | | } |
| | | |
| | | state = { |
| | | formlist: [], // 表单项 |
| | | ID: '' |
| | | } |
| | | |
| | | record = {} |
| | | |
| | | componentDidMount () { |
| | | const { action } = this.props |
| | | const { action, unload } = this.props |
| | | |
| | | let data = {} |
| | | let BData = {} |
| | |
| | | |
| | | if (item.regular) { |
| | | if (item.regular === 'number') { |
| | | let reg = /^[0-9.-]*$/ |
| | | if (item.regularExtra) { |
| | | reg = new RegExp('^[0-9.-' + item.regularExtra.replace(/\.|-/g, '') + ']*$') |
| | | } |
| | | _rules.push({ |
| | | pattern: /^[0-9.-]*$/, |
| | | pattern: reg, |
| | | message: item.regularText || formRule.input.numbermsg |
| | | }) |
| | | } else if (item.regular === 'letter') { |
| | | let reg = /^[a-zA-Z]*$/ |
| | | if (item.regularExtra) { |
| | | reg = new RegExp('^[a-zA-Z' + item.regularExtra + ']*$') |
| | | } |
| | | _rules.push({ |
| | | pattern: /^[a-zA-Z]*$/, |
| | | pattern: reg, |
| | | message: item.regularText || formRule.input.lettermsg |
| | | }) |
| | | } else if (item.regular === 'letter_number') { |
| | | let reg = /^[a-zA-Z0-9]*$/ |
| | | if (item.regularExtra) { |
| | | reg = new RegExp('^[a-zA-Z0-9' + item.regularExtra + ']*$') |
| | | } |
| | | _rules.push({ |
| | | pattern: /^[a-zA-Z0-9]*$/, |
| | | pattern: reg, |
| | | message: item.regularText || '请输入数字或字母' |
| | | }) |
| | | } else if (item.regular === 'letter&number') { |
| | | let reg = /^[a-zA-Z0-9@_.]*$/ |
| | | if (item.regularExtra) { |
| | | reg = new RegExp('^[a-zA-Z0-9@_.' + item.regularExtra.replace(/\.|_|@/g, '') + ']*$') |
| | | } |
| | | _rules.push({ |
| | | pattern: /^[a-zA-Z0-9@_.]*$/, |
| | | pattern: reg, |
| | | message: item.regularText || '请输入数字、字母以及@_.' |
| | | }) |
| | | } else if (item.regular === 'phone') { |
| | |
| | | }) |
| | | } else if (item.regular === 'email') { |
| | | _rules.push({ |
| | | pattern: /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/, |
| | | pattern: /^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/, |
| | | message: item.regularText || '请正确输入邮箱地址' |
| | | }) |
| | | } |
| | |
| | | |
| | | this.record = record |
| | | |
| | | this.setState({ formlist }, () => { |
| | | this.setState({ formlist, ID: this.props.data ? this.props.data.$$uuid || '' : '' }, () => { |
| | | 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) |
| | |
| | | let mainItems = [] // 云端或单点数据 |
| | | let localItems = [] // 本地数据 |
| | | let cache = action.setting.cache !== 'false' |
| | | let debug = window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud') |
| | | |
| | | let _sql = `Declare @mk_organization nvarchar(512) select @mk_organization='${sessionStorage.getItem('organization') || ''}'\n` |
| | | let _sso = _sql |
| | | |
| | | deForms.forEach(item => { |
| | | if (item.database === 'sso') { |
| | | mainItems.push(`select '${item.field}' as obj_name,'${item.arr_field}' as arr_field,'${item.base_sql}' as LText`) |
| | | let sql = _sso + item.base_sql |
| | | _sso = '' |
| | | |
| | | sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`) |
| | | sql = sql.replace(/@BID@/ig, `'${BID}'`) |
| | | |
| | | if (debug) { |
| | | console.info(sql) |
| | | } |
| | | mainItems.push(`select '${item.field}' as obj_name,'${item.arr_field}' as arr_field,'${window.btoa(window.encodeURIComponent(sql))}' as LText`) |
| | | } else { |
| | | localItems.push(`select '${item.field}' as obj_name,'${item.arr_field}' as arr_field,'${item.base_sql}' as LText`) |
| | | let sql = _sql + item.base_sql |
| | | _sql = '' |
| | | |
| | | sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`) |
| | | sql = sql.replace(/@BID@/ig, `'${BID}'`) |
| | | |
| | | if (debug) { |
| | | console.info(sql) |
| | | } |
| | | localItems.push(`select '${item.field}' as obj_name,'${item.arr_field}' as arr_field,'${window.btoa(window.encodeURIComponent(sql))}' as LText`) |
| | | } |
| | | }) |
| | | |
| | | if (!window.GLOB.mkHS && options.sysType !== 'local') { |
| | | localItems = [...localItems, ...mainItems] |
| | | mainItems = [] |
| | | } |
| | | |
| | | // 本地请求 |
| | | let param = { |
| | |
| | | LText: localItems.join(' union all '), |
| | | obj_name: '', |
| | | arr_field: '', |
| | | table_type: 'Y', |
| | | BID: BID || '' |
| | | table_type: 'Y' |
| | | } |
| | | |
| | | if (param.LText) { |
| | |
| | | LText: mainItems.join(' union all '), |
| | | obj_name: '', |
| | | arr_field: '', |
| | | table_type: 'Y', |
| | | BID: BID || '' |
| | | table_type: 'Y' |
| | | } |
| | | |
| | | if (mainparam.LText) { |
| | |
| | | */ |
| | | improveSimpleActionForm = (deForms) => { |
| | | let cache = this.props.action.setting.cache !== 'false' |
| | | let debug = window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud') |
| | | let _sql = `Declare @mk_organization nvarchar(512) select @mk_organization='${sessionStorage.getItem('organization') || ''}'\n` |
| | | |
| | | let deffers = deForms.map((form, index) => { |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: form.data_sql, |
| | | LText: _sql + form.base_sql, |
| | | obj_name: form.field, |
| | | arr_field: form.arr_field, |
| | | BID: this.props.BID || '' |
| | | arr_field: form.arr_field |
| | | } |
| | | |
| | | param.LText = param.LText.replace(/@ID@/ig, `'${this.state.ID || ''}'`) |
| | | param.LText = param.LText.replace(/@BID@/ig, `'${this.props.BID || ''}'`) |
| | | |
| | | if (debug) { |
| | | console.info(param.LText) |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | |
| | | if (['select', 'link', 'radio', 'checkbox', 'checkcard', 'multiselect', 'cascader'].includes(item.type) && result[item.field] && result[item.field].length > 0) { |
| | | let options = [] |
| | | let map = new Map() |
| | | let all = false |
| | | result[item.field].forEach(cell => { |
| | | let _cell = { key: Utils.getuuid() , ParentID: ''} |
| | | |
| | |
| | | if (item.type !== 'checkcard') { |
| | | _cell.value = cell[item.valueField] |
| | | _cell.label = cell[item.valueText] + '' |
| | | if (!_cell.label || map.has(_cell.ParentID + _cell.value)) return |
| | | if (map.has(_cell.ParentID + _cell.value)) return |
| | | if (!_cell.label) { |
| | | if (!all) { |
| | | _cell.label = '全部' |
| | | all = true |
| | | } else { |
| | | return |
| | | } |
| | | } |
| | | |
| | | map.set(_cell.ParentID + _cell.value, 0) |
| | | } else { |
| | | _cell.$value = cell[item.cardValField] |
| | | _cell = {..._cell, ...cell} |
| | | |
| | | if (item.urlField) { |
| | | _cell.$url = cell[item.urlField] || '' |
| | | } else if (item.colorField) { |
| | | _cell.$color = cell[item.colorField] || '' |
| | | } |
| | | |
| | | if (map.has(_cell.ParentID + _cell.$value)) return |
| | | |
| | |
| | | |
| | | formlist.forEach((item, index) => { |
| | | if (item.hidden) return |
| | | if (item.empty === 'hidden' && item.options.length === 0) return |
| | | |
| | | if (item.type === 'split') { |
| | | fields.push( |