| | |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import { checkSQL } from '@/utils/utils-custom.js' |
| | | import { getColumnForm } from './formconfig' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import { formRule } from '@/utils/option.js' |
| | |
| | | class EdiTableColumn extends Component { |
| | | static propTpyes = { |
| | | column: PropTypes.object, |
| | | wrap: PropTypes.object, |
| | | columns: PropTypes.array, |
| | | fields: PropTypes.array, |
| | | submitCol: PropTypes.func, // 提交事件 |
| | |
| | | } else if (this.record.editType === 'date') { |
| | | _options.push('required', 'precision', 'enter', 'declareType') |
| | | } else if (this.record.editType === 'popSelect') { |
| | | _options.push('required', 'enter', 'linkSubField', 'columns', 'dataSource', 'primaryKey', 'order', 'showField', 'controlField', 'searchKey', 'popWidth', 'laypage', 'onload') |
| | | _options.push('required', 'enter', 'linkSubField', 'columns', 'dataSource', 'primaryKey', 'order', 'showField', 'controlField', 'searchKey', 'popWidth', 'laypage', 'cache', 'onload') |
| | | } else if (this.record.editType === 'select') { |
| | | _options.push('required', 'enter', 'resourceType', 'linkSubField', 'dropdown') |
| | | |
| | |
| | | _options.push('required', 'enter') |
| | | } |
| | | } else if (this.record.type === 'number') { |
| | | _options.push('max', 'min', 'enter') |
| | | _options.push('max', 'min', 'enter', 'clearField') |
| | | } |
| | | } |
| | | if (this.record.type === 'formula' && this.record.eval === 'true') { |
| | |
| | | return item |
| | | }) |
| | | |
| | | let formlist = getColumnForm(column, fields, this.props.columns) |
| | | let formlist = getColumnForm(column, fields, this.props.columns, this.props.wrap) |
| | | this.record = {} |
| | | |
| | | formlist.forEach(item => { |
| | |
| | | } |
| | | } else if (key === 'format' && value === 'percent') { |
| | | this.props.form.setFieldsValue({postfix: '%'}) |
| | | } else if (key === 'editType') { |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'enter' && item.options && item.options[item.options.length - 1].field === '$noActX') { |
| | | item.options[item.options.length - 1].disabled = value !== 'select' |
| | | } |
| | | |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (['editable', 'editType', 'resourceType', 'ctrlField', 'eval', 'Hide', 'IsSort'].includes(key)) { |
| | | let _options = this.getOptions() |
| | | |
| | |
| | | getPopupContainer={() => document.getElementById('edit-table-column-winter')} |
| | | > |
| | | {options.map((option, i) => |
| | | <Select.Option key={i} datatype={option.datatype || ''} label={option.label || ''} value={(option.value || option.field || option.MenuID)}> |
| | | <Select.Option key={i} disabled={option.disabled === true} datatype={option.datatype || ''} label={option.label || ''} value={(option.value || option.field || option.MenuID)}> |
| | | {(option.text || option.label || option.MenuName)} |
| | | </Select.Option> |
| | | )} |
| | |
| | | } |
| | | } |
| | | |
| | | if (values.dataSource) { |
| | | let error = Utils.verifySql(values.dataSource) |
| | | |
| | | if (error) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '数据源中不可使用' + error, |
| | | duration: 5 |
| | | }) |
| | | return |
| | | if (values.type === 'text' && values.editable === 'true') { |
| | | if (values.editType !== 'select' && values.enter === '$noActX') { |
| | | values.enter = '$noAct' |
| | | } |
| | | } |
| | | |
| | | if (values.dataSource) { |
| | | let pass = checkSQL(values.dataSource) |
| | | |
| | | if (!pass) return |
| | | } |
| | | |
| | | if (values.editType === 'select' && values.resourceType === '1' && values.dataSource) { |
| | |
| | | ${_option.sql}` |
| | | |
| | | // LoginUID|SessionUid|UserID|Appkey 已替换 |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | sql = sql.replace(/@\$|\$@/ig, '') |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && values.database === 'sso') { |
| | |
| | | sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${sql}` |
| | | |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | sql = sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, `''`) |
| | | |
| | | Api.sDebug(sql).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |