| | |
| | | newcard.datatype = 'dynamic' |
| | | newcard.height = 1 |
| | | |
| | | if (card.wrap.datatype === 'static') { |
| | | newcard.datatype = 'static' |
| | | } |
| | | |
| | | // 注册事件-添加元素 |
| | | MKEmitter.emit('cardAddElement', card.uuid, newcard) |
| | | } |
| | |
| | | options: [ |
| | | { value: 'tel', text: '电话' }, |
| | | { value: 'email', text: '邮箱' }, |
| | | { value: 'qywx', text: '企业微信' }, |
| | | { value: 'other', text: '其他' } |
| | | ] |
| | | }, |
| | |
| | | } |
| | | |
| | | addElement = () => { |
| | | const { cards } = this.props |
| | | const { card } = this.state |
| | | |
| | | let newcard = {} |
| | |
| | | |
| | | if (card.$cardType === 'extendCard' && card.setting.cardRole === 'header') { |
| | | newcard.datatype = 'static' |
| | | } else if (cards.subtype === 'propcard' && cards.wrap.datatype === 'static') { |
| | | newcard.datatype = 'static' |
| | | } |
| | | |
| | | // 注册事件-添加元素 |
| | |
| | | values.modal = card.modal || null |
| | | values.config = card.config || null |
| | | |
| | | if (card.OpenType === 'excelOut' && values.OpenType === 'excelIn') { |
| | | if (values.verify && values.verify.columns && values.verify.columns.length > 0) { |
| | | values.verify.columns = values.verify.columns.map(col => { |
| | | col.required = col.required || 'true' |
| | | col.type = col.type || 'Nvarchar(50)' |
| | | col.import = col.import || 'true' |
| | | |
| | | if (col.type === 'text' || col.type === 'image') { |
| | | col.type = 'Nvarchar(50)' |
| | | } else if (col.type === 'number') { |
| | | col.type = 'Decimal(18,2)' |
| | | } |
| | | |
| | | if (/^Nvarchar/ig.test(col.type)) { |
| | | col.limit = col.type.match(/\d+/)[0] |
| | | } else if (/^Decimal/ig.test(col.type)) { |
| | | col.limit = col.type.match(/\d+/ig)[1] |
| | | } else { |
| | | col.limit = '' |
| | | } |
| | | |
| | | delete col.output |
| | | delete col.abs |
| | | delete col.Width |
| | | |
| | | return col |
| | | }) |
| | | |
| | | values.verify.sheet = values.verify.sheet || 'Sheet1' |
| | | } |
| | | } else if (card.OpenType === 'excelIn' && values.OpenType === 'excelOut') { |
| | | if (values.verify && values.verify.columns && values.verify.columns.length > 0) { |
| | | values.verify.columns = values.verify.columns.map(col => { |
| | | col.type = col.type || 'text' |
| | | col.output = col.output || 'true' |
| | | col.required = col.required || 'false' |
| | | col.Width = 20 |
| | | |
| | | if (!['text', 'image', 'number'].includes(col.type)) { |
| | | if (/^Decimal/ig.test(col.type)) { |
| | | col.type = 'number' |
| | | } else { |
| | | col.type = 'text' |
| | | } |
| | | } |
| | | |
| | | delete col.import |
| | | |
| | | return col |
| | | }) |
| | | } |
| | | } |
| | | |
| | | if (values.OpenType === 'form') { |
| | | if (values.formType !== 'scan') { |
| | | if (/^(0|[1-9]\d*)$/.test(values.openVal) && /^(0|[1-9]\d*)$/.test(values.closeVal)) { |
| | |
| | | |
| | | return !is(fromJS(this.props.column), fromJS(nextProps.column)) || |
| | | !is(fromJS(this.props.fields), fromJS(nextProps.fields)) || |
| | | this.props.index !== nextProps.index |
| | | this.props.index !== nextProps.index || |
| | | window.GLOB.columnId === nextProps.column.uuid || window.GLOB.precolumnId === nextProps.column.uuid |
| | | } |
| | | |
| | | render() { |
| | |
| | | if (column.Width) { |
| | | style.width = column.Width |
| | | style.minWidth = column.Width |
| | | } |
| | | |
| | | if (window.GLOB.columnId === column.uuid) { |
| | | style.color = '#1890ff' |
| | | } |
| | | |
| | | return connectDragSource( |
| | |
| | | style.width = column.Width |
| | | style.minWidth = column.Width |
| | | } |
| | | |
| | | if (window.GLOB.columnId === column.uuid) { |
| | | style.color = '#1890ff' |
| | | } |
| | | |
| | | return ( |
| | | <th {...restProps} style={style} key={column.uuid} onDoubleClick={() => this.props.editColumn(column)}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | |
| | | } |
| | | } |
| | | |
| | | window.GLOB.precolumnId = window.GLOB.columnId || '' |
| | | window.GLOB.columnId = col.uuid |
| | | |
| | | this.setState({card: null}) |
| | | this.updateCol(col) |
| | | } |
| | |
| | | type: 'select', |
| | | key: 'enter', |
| | | label: '回车切换', |
| | | initVal: card.enter || '$next', |
| | | initVal: card.enter || '$noAct', |
| | | tooltip: '包括文本或数值回车事件、下拉菜单选中事件、开关切换事件。', |
| | | options: editCols |
| | | }, |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Modal, notification, Popover } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import { getColumnForm } from './formconfig' |
| | | import { formRule } from '@/utils/option.js' |
| | | import CodeMirror from '@/templates/zshare/codemirror' |
| | |
| | | |
| | | state = { |
| | | visible: false, |
| | | loading: false, |
| | | formlist: null, |
| | | transfield: {} |
| | | } |
| | |
| | | return |
| | | } |
| | | } |
| | | |
| | | if (values.dataSource && /\s/.test(values.dataSource)) { |
| | | let error = Utils.verifySql(values.dataSource) |
| | | |
| | | if (error) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '数据源中不可使用' + error, |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | | LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${values.dataSource}` |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) |
| | | param.LText = param.LText.replace(/\n/g, ' ') |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | if (window.GLOB.mainSystemApi && values.database === 'sso') { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({visible: false, loading: false, formlist: null}) |
| | | this.props.submitCol(values) |
| | | this.column = null |
| | | } else { |
| | | this.setState({loading: false}) |
| | | Modal.error({ |
| | | title: result.message |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({visible: false, formlist: null}) |
| | | this.props.submitCol(values) |
| | | |
| | | this.column = null |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | editModalCancel = () => { |
| | | this.setState({visible: false, formlist: null}) |
| | | this.setState({visible: false, loading: false, formlist: null}) |
| | | |
| | | this.props.cancelCol() |
| | | } |
| | | |
| | | render() { |
| | | const { visible } = this.state |
| | | const { visible, loading } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | | confirmLoading={loading} |
| | | destroyOnClose |
| | | > |
| | | <Form {...formItemLayout} className="commontable-column-form" id="edit-table-column-winter"> |
| | |
| | | |
| | | return !is(fromJS(this.props.column), fromJS(nextProps.column)) || |
| | | !is(fromJS(this.props.fields), fromJS(nextProps.fields)) || |
| | | this.props.index !== nextProps.index |
| | | this.props.index !== nextProps.index || |
| | | window.GLOB.columnId === nextProps.column.uuid || window.GLOB.precolumnId === nextProps.column.uuid |
| | | } |
| | | |
| | | render() { |
| | |
| | | if (column.Width) { |
| | | style.width = column.Width |
| | | style.minWidth = column.Width |
| | | } |
| | | |
| | | if (window.GLOB.columnId === column.uuid) { |
| | | style.color = '#1890ff' |
| | | } |
| | | |
| | | return connectDragSource( |
| | |
| | | if (column.Width) { |
| | | style.width = column.Width |
| | | style.minWidth = column.Width |
| | | } |
| | | if (window.GLOB.columnId === column.uuid) { |
| | | style.color = '#1890ff' |
| | | } |
| | | |
| | | return ( |
| | |
| | | col.elements = card.type === 'action' ? (card.elements || []) : [] |
| | | } |
| | | |
| | | window.GLOB.precolumnId = window.GLOB.columnId || '' |
| | | window.GLOB.columnId = col.uuid |
| | | |
| | | this.setState({card: null}) |
| | | this.updateCol(col) |
| | | } |
| | |
| | | |
| | | return !is(fromJS(this.props.column), fromJS(nextProps.column)) || |
| | | !is(fromJS(this.props.fields), fromJS(nextProps.fields)) || |
| | | this.props.index !== nextProps.index |
| | | this.props.index !== nextProps.index || |
| | | window.GLOB.columnId === nextProps.column.uuid || window.GLOB.precolumnId === nextProps.column.uuid |
| | | } |
| | | |
| | | render() { |
| | |
| | | if (column.Width) { |
| | | style.width = column.Width |
| | | style.minWidth = column.Width |
| | | } |
| | | |
| | | if (window.GLOB.columnId === column.uuid) { |
| | | style.color = '#1890ff' |
| | | } |
| | | |
| | | return connectDragSource( |
| | |
| | | if (column.Width) { |
| | | style.width = column.Width |
| | | style.minWidth = column.Width |
| | | } |
| | | |
| | | if (window.GLOB.columnId === column.uuid) { |
| | | style.color = '#1890ff' |
| | | } |
| | | |
| | | return ( |
| | |
| | | col.elements = card.type === 'action' ? (card.elements || []) : [] |
| | | } |
| | | |
| | | window.GLOB.precolumnId = window.GLOB.columnId || '' |
| | | window.GLOB.columnId = col.uuid |
| | | |
| | | this.setState({card: null}) |
| | | this.updateCol(col) |
| | | } |
| | |
| | | } |
| | | window.open(_url) |
| | | return |
| | | } else if (card.linkType === 'qywx') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: 'PC不支持打开企业微信!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | // positecgroup |
| | |
| | | if (debug) { |
| | | console.info(sql) |
| | | } |
| | | |
| | | sql = sql.replace(/%/ig, ' mpercent ') |
| | | |
| | | mainItems.push(`select '${item.uuid}' as obj_name,'${item.arr_field}' as arr_field,'${window.btoa(window.encodeURIComponent(sql))}' as LText`) |
| | | } else { |
| | | let sql = _sql + item.base_sql |
| | |
| | | if (debug) { |
| | | console.info(sql) |
| | | } |
| | | |
| | | sql = sql.replace(/%/ig, ' mpercent ') |
| | | |
| | | localItems.push(`select '${item.uuid}' as obj_name,'${item.arr_field}' as arr_field,'${window.btoa(window.encodeURIComponent(sql))}' as LText`) |
| | | } |
| | | }) |
| | |
| | | getSysDeclareSql = (btn, formdata, data, columns, primaryId, BID = '') => { |
| | | let datavars = {} // 声明的变量,表单及显示列 |
| | | // 需要声明的变量集 |
| | | let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'bid'] |
| | | let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'mk_deleted', 'bid'] |
| | | |
| | | // sql语句 |
| | | let _sql = '' |
| | |
| | | if (debug) { |
| | | console.info(sql) |
| | | } |
| | | |
| | | sql = sql.replace(/%/ig, ' mpercent ') |
| | | |
| | | mainItems.push(`select '${item.field}' as obj_name,'${item.arr_field}' as arr_field,'${window.btoa(window.encodeURIComponent(sql))}' as LText`) |
| | | } else { |
| | | let sql = _sql + item.base_sql |
| | |
| | | if (debug) { |
| | | console.info(sql) |
| | | } |
| | | |
| | | sql = sql.replace(/%/ig, ' mpercent ') |
| | | |
| | | localItems.push(`select '${item.field}' as obj_name,'${item.arr_field}' as arr_field,'${window.btoa(window.encodeURIComponent(sql))}' as LText`) |
| | | } |
| | | }) |
| | |
| | | }) |
| | | } else { // 合并请求,区分本地及系统 |
| | | if (item.database === 'sso') { |
| | | mainItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql))}' as LText`) |
| | | mainItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql.replace(/%/ig, ' mpercent ')))}' as LText`) |
| | | } else { |
| | | localItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql))}' as LText`) |
| | | localItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql.replace(/%/ig, ' mpercent ')))}' as LText`) |
| | | } |
| | | } |
| | | } |
| | |
| | | static verifySql (sql, type) { |
| | | if (!sql) return '' |
| | | let chars = [ |
| | | {key: 'create', reg: /(^|\s)create\s/ig}, |
| | | {key: 'insert', reg: /(^|\s)insert\s/ig}, |
| | | {key: 'delete', reg: /(^|\s)delete\s/ig}, |
| | | {key: 'update', reg: /(^|\s)update\s/ig}, |
| | | {key: 'set', reg: /(^|\s)set\s/ig}, |
| | | {key: 'drop', reg: /(^|\s)drop\s/ig}, |
| | | {key: 'alter', reg: /(^|\s)alter\s/ig}, |
| | | {key: 'truncate', reg: /(^|\s)truncate\s/ig}, |
| | | {key: 'if', reg: /(^|\s)if\s/ig}, |
| | | {key: 'exec', reg: /(^|\s)exec(\s|\()/ig}, |
| | | {key: 'OBJECT', reg: /(^|\s)object(\s|\()/ig}, |
| | | {key: 'sys.', reg: /(^|\s)sys\./ig}, |
| | | {key: 'kill', reg: /(^|\s)kill\s/ig} |
| | | {key: 'create', reg: /(^|\s|\(|\))create\s/ig}, |
| | | {key: 'insert', reg: /(^|\s|\(|\))insert\s/ig}, |
| | | {key: 'delete', reg: /(^|\s|\(|\))delete\s/ig}, |
| | | {key: 'update', reg: /(^|\s|\(|\))update\s/ig}, |
| | | {key: 'set', reg: /(^|\s|\(|\))set\s/ig}, |
| | | {key: 'drop', reg: /(^|\s|\(|\))drop\s/ig}, |
| | | {key: 'alter', reg: /(^|\s|\(|\))alter\s/ig}, |
| | | {key: 'truncate', reg: /(^|\s|\(|\))truncate\s/ig}, |
| | | {key: 'if', reg: /(^|\s|\(|\))if\s/ig}, |
| | | {key: 'exec', reg: /(^|\s|\(|\))exec(\s|\()/ig}, |
| | | {key: 'OBJECT', reg: /(^|\s|\(|\))object(\s|\()/ig}, |
| | | {key: 'sys.', reg: /(^|\s|\(|\))sys\./ig}, |
| | | {key: 'kill', reg: /(^|\s|\(|\))kill\s/ig} |
| | | ] |
| | | |
| | | if (type === 'customscript') { |
| | |
| | | }) |
| | | |
| | | // 需要声明的变量集 |
| | | let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'bid'] |
| | | let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'mk_deleted', 'bid'] |
| | | |
| | | // 主键字段 |
| | | let primaryKey = setting.primaryKey || 'id' |