| | |
| | | let label = item.tooltip ? <Tooltip placement="topLeft" title={item.tooltip}><QuestionCircleOutlined className="mk-form-tip" />{item.label}</Tooltip> : item.label |
| | | |
| | | if (item.type === 'text') { |
| | | content = (<MKEInput config={item} onChange={(val, defer) => !defer && this.recordChange({[item.field]: val})} onSubmit={this.props.inputSubmit} />) |
| | | content = (<MKEInput config={item} onChange={(val, defer) => !defer && this.recordChange({[item.field]: val}, item)} onSubmit={this.props.inputSubmit} />) |
| | | } else if (item.type === 'number') { |
| | | content = (<MKNumberInput config={item} onChange={(val, defer) => !defer && this.recordChange({[item.field]: val})} onSubmit={this.props.inputSubmit} />) |
| | | } else if (item.type === 'select' || item.type === 'multiselect') { |
| | |
| | | } else if (item.type === 'source') { |
| | | content = (<SourceComponent type="" placement="right"/>) |
| | | } else if (item.type === 'table') { |
| | | content = (<MKTable tip={item.tip || ''} fixed={item.fixed === true} columns={item.columns || []} actions={item.actions || []}/>) |
| | | content = (<MKTable tip={item.tip || ''} columns={item.columns || []} actions={item.actions || []}/>) |
| | | } else if (item.type === 'hint') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | |
| | | |
| | | class EditTable extends Component { |
| | | static propTpyes = { |
| | | columns: PropTypes.array, // 显示列 |
| | | onChange: PropTypes.func // 数据变化 |
| | | actions: PropTypes.array, |
| | | columns: PropTypes.array, |
| | | onChange: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let actions = this.props.actions || [] |
| | | const { actions } = this.props |
| | | let columns = fromJS(this.props.columns).toJS() |
| | | |
| | | let operation = { |
| | |
| | | </div> |
| | | ) : ( |
| | | <div className={'edit-operation-btn' + (editingKey !== '' ? ' disabled' : '')} style={{minWidth: '110px', whiteSpace: 'nowrap'}}> |
| | | <span className="primary" onClick={() => {editingKey === '' && this.edit(record)}}><EditOutlined /></span> |
| | | {editingKey === '' ? <Popconfirm |
| | | {actions.includes('edit') ? <span className="primary" onClick={() => {editingKey === '' && this.edit(record)}}><EditOutlined /></span> : null} |
| | | {actions.includes('del') && editingKey === '' ? <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title="确定删除吗?" |
| | | onConfirm={() => this.handleDelete(record.uuid) |
| | | }> |
| | | <span className="danger"><DeleteOutlined /></span> |
| | | </Popconfirm> : null} |
| | | {editingKey !== '' ? <span className="danger"><DeleteOutlined /></span> : null} |
| | | {actions.includes('view') ? <span className="copy" onClick={() => {editingKey === '' && this.changeMenu(record.menu)}}><ArrowRightOutlined /></span> : null} |
| | | {actions.includes('del') && editingKey !== '' ? <span className="danger"><DeleteOutlined /></span> : null} |
| | | {actions.includes('view') ? <span className="copy" onClick={() => {editingKey === '' && this.changeMenu(record)}}><ArrowRightOutlined /></span> : null} |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | // return !is(fromJS(this.state), fromJS(nextState)) |
| | | // } |
| | | |
| | | changeMenu = (MenuId) => { |
| | | changeMenu = (record) => { |
| | | let MenuId = record.menu |
| | | if (MenuId === 'IM') { |
| | | if (!sessionStorage.getItem('instantMessage')) return |
| | | |
| | |
| | | |
| | | MKEmitter.emit('changeEditMenu', {routerUrl: '/imdesign/' + param}) |
| | | } else { |
| | | MKEmitter.emit('changeEditMenu', {MenuID: MenuId}) |
| | | MKEmitter.emit('changeEditMenu', { ...record, MenuID: MenuId}) |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { fixed } = this.props |
| | | const { actions } = this.props |
| | | let components = { |
| | | body: { |
| | | cell: EditableCell |
| | |
| | | |
| | | let moveprops = {} |
| | | components.body.row = DragableBodyRow |
| | | moveprops.moveAble = !this.state.editingKey |
| | | moveprops.moveRow = this.moveRow |
| | | |
| | | if (actions.includes('move')) { |
| | | moveprops.moveAble = !this.state.editingKey |
| | | moveprops.moveRow = this.moveRow |
| | | } |
| | | |
| | | let columns = this.state.columns.map(col => { |
| | | if (col.copy) { |
| | |
| | | return ( |
| | | <EditableContext.Provider value={this.props.form}> |
| | | <div className="modal-editable-table"> |
| | | {!fixed ? <Button disabled={!!this.state.editingKey} type="link" onClick={this.addline}><PlusOutlined style={{}}/></Button> : null} |
| | | {actions.includes('add') ? <Button disabled={!!this.state.editingKey} type="link" onClick={this.addline}><PlusOutlined style={{}}/></Button> : null} |
| | | <DndProvider> |
| | | <Table |
| | | bordered |
| | |
| | | label: '颜色标识', |
| | | initval: wrap.signs || [], |
| | | required: false, |
| | | actions: ['edit', 'del', 'add', 'move'], |
| | | span: 24, |
| | | columns: [ |
| | | { |
| | |
| | | initval: wrap.menus || [], |
| | | required: true, |
| | | span: 24, |
| | | actions: ['view'], |
| | | actions: ['edit', 'del', 'add', 'move', 'view'], |
| | | forbid: isprint, |
| | | columns: [ |
| | | { |
| | |
| | | initval: menus, |
| | | required: true, |
| | | span: 24, |
| | | actions: ['view'], |
| | | actions: ['edit', 'del', 'add', 'move', 'view'], |
| | | columns: [ |
| | | { |
| | | title: '标识', |
| | |
| | | required: true, |
| | | forbid: subtype !== 'datacard' || appType === 'mob' || isprint, |
| | | span: 24, |
| | | actions: ['edit', 'del', 'add', 'move'], |
| | | columns: [ |
| | | { |
| | | title: '序号', |
| | |
| | | initval: card.menus || [], |
| | | required: true, |
| | | span: 24, |
| | | actions: appType === 'pc' ? ['view'] : [], |
| | | actions: ['edit', 'del', 'add', 'move', 'view'], |
| | | columns: [ |
| | | { |
| | | title: '标识', |
| | |
| | | initval: card.menus || [], |
| | | required: true, |
| | | span: 24, |
| | | actions: appType === 'pc' ? ['view'] : [], |
| | | actions: ['edit', 'del', 'add', 'move', 'view'], |
| | | columns: [ |
| | | { |
| | | title: '标识', |
| | |
| | | initval: card.menus || [], |
| | | required: true, |
| | | span: 24, |
| | | actions: ['view'], |
| | | actions: ['edit', 'del', 'add', 'move', 'view'], |
| | | forbid: appType === 'mob' || card.chartType !== 'bar', |
| | | hidden: card.click !== 'menus', |
| | | columns: [ |
| | |
| | | rules = [ |
| | | { required: item.required, message: '请添加' + item.label + '!' } |
| | | ] |
| | | content = (<MKTable tip={''} columns={item.columns || []} actions={[]}/>) |
| | | content = (<MKTable columns={item.columns || []} actions={item.actions}/>) |
| | | } else if (item.type === 'icon') { |
| | | rules = [ |
| | | { required: item.required, message: '请选择' + item.label + '!' } |
| | |
| | | label: '组件列表', |
| | | initVal: card.syncComponents || [], |
| | | required: true, |
| | | actions: [], |
| | | actions: ['edit', 'del', 'add', 'move'], |
| | | columns: [ |
| | | { |
| | | title: '组件', |
| | |
| | | label: '组件列表', |
| | | initVal: card.syncComponents || [], |
| | | required: true, |
| | | actions: [], |
| | | actions: ['edit', 'del', 'add', 'move'], |
| | | columns: [ |
| | | { |
| | | title: '组件', |
| | |
| | | editab.hide = res.hide || 'false' |
| | | editab.backgroundColor = res.backgroundColor |
| | | // editab.controlVal = res.controlVal || '' |
| | | editab.selectVal = res.selectVal || '' |
| | | // editab.selectVal = res.selectVal || '' |
| | | editab.blacklist = res.blacklist |
| | | |
| | | if (editab.uuid) { |
| | |
| | | |
| | | delete res.controlVals |
| | | } |
| | | if (res.selectVals) { |
| | | let values = {} |
| | | res.selectVals.forEach(item => { |
| | | values[item.uuid] = item.value |
| | | }) |
| | | tabs.subtabs.forEach(tab => { |
| | | tab.selectVal = values[tab.uuid] |
| | | }) |
| | | |
| | | delete res.selectVals |
| | | } |
| | | |
| | | res.tabStyle = res.tabStyle || 'line' |
| | | res.cusClass = '' |
| | |
| | | // tooltip: '当禁用字段值与隐藏标记相等时,标签页会隐藏。注:1、多个值请用逗号分隔,2、@pass@值表示忽略此设置(始终显示),2、@pass_empty@值表示忽略空值,即未获取上级组件信息时显示(可与其他值拼接)。', |
| | | // required: false, |
| | | // }, |
| | | { |
| | | type: 'text', |
| | | field: 'selectVal', |
| | | label: '选中标记', |
| | | initval: tab.selectVal || '', |
| | | tooltip: '当选中字段值与选中标记相等时,标签页默认选中。', |
| | | required: false |
| | | }, |
| | | // { |
| | | // type: 'text', |
| | | // field: 'selectVal', |
| | | // label: '选中标记', |
| | | // initval: tab.selectVal || '', |
| | | // tooltip: '当选中字段值与选中标记相等时,标签页默认选中。', |
| | | // required: false |
| | | // }, |
| | | { |
| | | type: 'color', |
| | | field: 'backgroundColor', |
| | |
| | | roleList = [] |
| | | } |
| | | |
| | | let controlVals = subtabs.map(item => ({uuid: item.uuid, label: item.label, value: item.controlVal})) |
| | | let controlVals = subtabs.map(item => ({uuid: item.uuid, label: item.label, value: item.controlVal || ''})) |
| | | let selectVals = subtabs.map(item => ({uuid: item.uuid, label: item.label, value: item.selectVal || ''})) |
| | | |
| | | let tabStyle = setting.cusClass || setting.tabStyle |
| | | |
| | |
| | | label: '选中字段', |
| | | initval: setting.selectField || '', |
| | | tooltip: '用于控制标签页初始化选中,在标签中填入选中标记,注:数据来源于url参数。', |
| | | required: false |
| | | required: false, |
| | | controlFields: [ |
| | | {field: 'selectVals', notNull: true}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'color', |
| | |
| | | { |
| | | type: 'table', |
| | | field: 'controlVals', |
| | | label: '标签组', |
| | | label: '标签组(禁用)', |
| | | initval: controlVals, |
| | | tooltip: '当禁用字段值与隐藏标记相等时,标签页会隐藏。注:1、多个值请用逗号分隔,2、@pass@值表示忽略此设置(始终显示),2、@pass_empty@值表示忽略空值,即未获取上级组件信息时显示(可与其他值拼接)。', |
| | | required: false, |
| | | fixed: true, |
| | | actions: ['edit'], |
| | | span: 24, |
| | | columns: [ |
| | | { |
| | |
| | | width: '50%' |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'table', |
| | | field: 'selectVals', |
| | | label: '标签组(选中)', |
| | | initval: selectVals, |
| | | tooltip: '当选中字段值与选中标记相等时,标签页默认选中。', |
| | | required: false, |
| | | actions: ['edit'], |
| | | span: 24, |
| | | columns: [ |
| | | { |
| | | title: '标签名称', |
| | | dataIndex: 'label', |
| | | editable: false, |
| | | required: false, |
| | | width: '30%' |
| | | }, |
| | | { |
| | | title: '选中标记', |
| | | dataIndex: 'value', |
| | | inputType: 'input', |
| | | editable: true, |
| | | required: false, |
| | | width: '50%' |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | |
| | |
| | | _item.fieldlen = item.decimal || 0 |
| | | } else if (_item.type === 'date') { |
| | | _item.type = item.declareType === 'nvarchar(50)' ? 'text' : 'date' |
| | | } else if (item.declare === 'decimal') { |
| | | _item.type = 'number' |
| | | _item.fieldlen = item.decimal || 0 |
| | | } |
| | | |
| | | formdata.push(_item) |
| | |
| | | _item.fieldlen = item.decimal || 0 |
| | | } else if (_item.type === 'date') { |
| | | _item.type = item.declareType === 'nvarchar(50)' ? 'text' : 'date' |
| | | } else if (item.declare === 'decimal') { |
| | | _item.type = 'number' |
| | | _item.fieldlen = item.decimal || 0 |
| | | } |
| | | |
| | | formdata.push(_item) |
| | |
| | | editab.hide = res.hide || 'false' |
| | | editab.backgroundColor = res.backgroundColor |
| | | // editab.controlVal = res.controlVal || '' |
| | | editab.selectVal = res.selectVal || '' |
| | | // editab.selectVal = res.selectVal || '' |
| | | editab.blacklist = res.blacklist |
| | | |
| | | if (editab.uuid) { |
| | |
| | | |
| | | delete res.controlVals |
| | | } |
| | | if (res.selectVals) { |
| | | let values = {} |
| | | res.selectVals.forEach(item => { |
| | | values[item.uuid] = item.value |
| | | }) |
| | | tabs.subtabs.forEach(tab => { |
| | | tab.selectVal = values[tab.uuid] |
| | | }) |
| | | |
| | | delete res.selectVals |
| | | } |
| | | |
| | | tabs.setting = res |
| | | |
| | |
| | | // tooltip: '当禁用字段值与隐藏标记相等时,标签页会隐藏。注:多个值请用逗号分隔。', |
| | | // required: false |
| | | // }, |
| | | { |
| | | type: 'text', |
| | | field: 'selectVal', |
| | | label: '选中标记', |
| | | initval: tab.selectVal || '', |
| | | tooltip: '当选中字段值与选中标记相等时,标签页默认选中。', |
| | | required: false |
| | | }, |
| | | // { |
| | | // type: 'text', |
| | | // field: 'selectVal', |
| | | // label: '选中标记', |
| | | // initval: tab.selectVal || '', |
| | | // tooltip: '当选中字段值与选中标记相等时,标签页默认选中。', |
| | | // required: false |
| | | // }, |
| | | { |
| | | type: 'color', |
| | | field: 'backgroundColor', |
| | |
| | | label: '上一页(url参数)' |
| | | }) |
| | | |
| | | let controlVals = subtabs.map(item => ({uuid: item.uuid, label: item.label, value: item.controlVal})) |
| | | let controlVals = subtabs.map(item => ({uuid: item.uuid, label: item.label, value: item.controlVal || ''})) |
| | | let selectVals = subtabs.map(item => ({uuid: item.uuid, label: item.label, value: item.selectVal || ''})) |
| | | |
| | | const tabForm = [ |
| | | { |
| | |
| | | label: '选中字段', |
| | | initval: setting.selectField || '', |
| | | tooltip: '用于控制标签页初始化选中,在标签中填入选中标记,注:数据源于url参数。', |
| | | required: false |
| | | required: false, |
| | | controlFields: [ |
| | | {field: 'selectVals', notNull: true}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'color', |
| | |
| | | { |
| | | type: 'table', |
| | | field: 'controlVals', |
| | | label: '标签组', |
| | | label: '标签组(禁用)', |
| | | initval: controlVals, |
| | | tooltip: '当禁用字段值与隐藏标记相等时,标签页会隐藏。注:1、多个值请用逗号分隔,2、@pass@值表示忽略此设置(始终显示),2、@pass_empty@值表示忽略空值,即未获取上级组件信息时显示(可与其他值拼接)。', |
| | | required: false, |
| | | fixed: true, |
| | | actions: ['edit'], |
| | | span: 24, |
| | | columns: [ |
| | | { |
| | |
| | | width: '50%' |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'table', |
| | | field: 'selectVals', |
| | | label: '标签组(选中)', |
| | | initval: selectVals, |
| | | tooltip: '当选中字段值与选中标记相等时,标签页默认选中。', |
| | | required: false, |
| | | actions: ['edit'], |
| | | span: 24, |
| | | columns: [ |
| | | { |
| | | title: '标签名称', |
| | | dataIndex: 'label', |
| | | editable: false, |
| | | required: false, |
| | | width: '30%' |
| | | }, |
| | | { |
| | | title: '选中标记', |
| | | dataIndex: 'value', |
| | | inputType: 'input', |
| | | editable: true, |
| | | required: false, |
| | | width: '50%' |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | |
| | |
| | | initval: wrap.menus || [], |
| | | required: false, |
| | | span: 24, |
| | | actions: ['view'], |
| | | actions: ['edit', 'del', 'add', 'move', 'view'], |
| | | tip: <span style={{fontSize: '12px', color: '#959595', position: 'relative', top: '-8px'}}>当使用图标<MkIcon type="user"/>,且右侧只有一个菜单时,会显示用户头像。</span>, |
| | | columns: [ |
| | | { |
| | |
| | | label: '协议组', |
| | | initval: wrap.groups || [], |
| | | required: true, |
| | | actions: ['edit', 'del', 'add', 'move'], |
| | | span: 24, |
| | | columns: [ |
| | | { |
| | |
| | | ] |
| | | }, |
| | | { |
| | | title: '导出', |
| | | dataIndex: 'output', |
| | | inputType: 'radio', |
| | | editable: true, |
| | | required: false, |
| | | width: '12%', |
| | | render: (text) => { |
| | | if (text !== 'false') { |
| | | return '是' |
| | | } else { |
| | | return '否' |
| | | } |
| | | }, |
| | | options: [ |
| | | {value: 'true', text: '是'}, |
| | | {value: 'false', text: '否'} |
| | | ] |
| | | }, |
| | | { |
| | | title: '红色标题', |
| | | dataIndex: 'required', |
| | | width: '10%', |
| | | editable: true, |
| | | inputType: 'radio', |
| | | render: (text, record) => record.required === 'true' ? <span style={{color: 'red'}}>是</span> : '否', |
| | | options: [ |
| | | {value: 'true', text: '是'}, |
| | | {value: 'false', text: '否'} |
| | | ] |
| | | }, |
| | | { |
| | | title: '取绝对值', |
| | | dataIndex: 'abs', |
| | | inputType: 'radio', |
| | |
| | | keyVals: ['number'], |
| | | width: '12%', |
| | | render: (text, record) => record.type === 'number' ? text : '' |
| | | }, |
| | | { |
| | | title: '导出', |
| | | dataIndex: 'output', |
| | | inputType: 'radio', |
| | | editable: true, |
| | | required: false, |
| | | width: '12%', |
| | | render: (text) => { |
| | | if (text !== 'false') { |
| | | return '是' |
| | | } else { |
| | | return '否' |
| | | } |
| | | }, |
| | | options: [ |
| | | {value: 'true', text: '是'}, |
| | | {value: 'false', text: '否'} |
| | | ] |
| | | }, |
| | | { |
| | | title: '红色标题', |
| | | dataIndex: 'required', |
| | | width: '10%', |
| | | editable: true, |
| | | inputType: 'radio', |
| | | render: (text, record) => record.required === 'true' ? <span style={{color: 'red'}}>是</span> : '否', |
| | | options: [ |
| | | {value: 'true', text: '是'}, |
| | | {value: 'false', text: '否'} |
| | | ] |
| | | }, |
| | | } |
| | | ], |
| | | scriptsColumns: [ |
| | | { |
| | |
| | | } else if (_f.type === 'number') { |
| | | _type = `decimal(18,${_fieldlen})` |
| | | _select.push(`@${_f.field}=0`) |
| | | } else if (_f.declare === 'decimal') { |
| | | _type = `decimal(18,${_f.decimal || 0})` |
| | | _select.push(`@${_f.field}=0`) |
| | | } else if (_f.type === 'rate') { |
| | | _type = `decimal(18,2)` |
| | | _select.push(`@${_f.field}=0`) |
| | |
| | | } |
| | | _param = window.btoa(window.encodeURIComponent(JSON.stringify(_param))) |
| | | window.open(`#/menudesign/${_param}`) |
| | | } else if (cell.type === 'BaseTable') { |
| | | sessionStorage.setItem('menuTree', JSON.stringify(this.props.menuTree)) |
| | | let _param = window.btoa(window.encodeURIComponent(JSON.stringify(cell))) |
| | | |
| | | window.open(`#/tabledesign/${_param}`) |
| | | } else if (['CommonTable', 'TreePage'].includes(cell.type)) { |
| | | sessionStorage.setItem('menuTree', JSON.stringify(this.props.menuTree)) |
| | | let _param = window.btoa(window.encodeURIComponent(JSON.stringify(cell))) |
| | | |
| | | window.open(`#/basedesign/${_param}`) |
| | | } else if (cell.type === 'BaseTable') { |
| | | sessionStorage.setItem('menuTree', JSON.stringify(this.props.menuTree)) |
| | | let _param = window.btoa(window.encodeURIComponent(JSON.stringify(cell))) |
| | | |
| | | window.open(`#/tabledesign/${_param}`) |
| | | } else if (['RolePermission', 'NewPage'].includes(cell.type)) { |
| | | let _cell = fromJS(cell).toJS() |
| | | _cell.Template = _cell.PageParam.Template |
| | |
| | | |
| | | MKEmitter.addListener('changePopview', this.initPopview) |
| | | MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave) |
| | | MKEmitter.addListener('changeEditMenu', this.changeEditMenu) |
| | | setTimeout(() => { |
| | | this.getRoleFields() |
| | | setGLOBFuncs() |
| | |
| | | } |
| | | MKEmitter.removeListener('changePopview', this.initPopview) |
| | | MKEmitter.removeListener('triggerMenuSave', this.triggerMenuSave) |
| | | MKEmitter.removeListener('changeEditMenu', this.changeEditMenu) |
| | | } |
| | | |
| | | changeEditMenu = (menu) => { |
| | | if (menu.MenuID && menu.MenuID.length === 3 && menu.MenuNo && !this.menuLoading) { |
| | | this.menuLoading = true |
| | | let param = { |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: menu.MenuID[2] |
| | | } |
| | | |
| | | Api.getCloudConfig(param).then(result => { |
| | | this.menuLoading = false |
| | | if (result.status) { |
| | | let config = null |
| | | |
| | | try { |
| | | config = result.LongParam ? JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) : null |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | config = null |
| | | } |
| | | |
| | | if (config) { |
| | | let _param = { |
| | | MenuId: menu.MenuID[2], |
| | | MenuID: menu.MenuID[2], |
| | | ParentId: menu.MenuID[1], |
| | | MenuName: menu.MenuName, |
| | | MenuNo: menu.MenuNo |
| | | } |
| | | if (config.Template === 'BaseTable') { |
| | | _param = window.btoa(window.encodeURIComponent(JSON.stringify(_param))) |
| | | window.open(`#/tabledesign/${_param}`) |
| | | } else if (config.Template === 'CustomPage') { |
| | | _param.MenuType = 'custom' |
| | | _param = window.btoa(window.encodeURIComponent(JSON.stringify(_param))) |
| | | window.open(`#/menudesign/${_param}`) |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | triggerMenuSave = () => { |