| | |
| | | background-color: #fff; |
| | | border-color: #c49f47; |
| | | } |
| | | |
| | | // 橙色 |
| | | .mk-orange, .mk-orange:hover, .mk-orange:active, .mk-orange:focus { |
| | | color: #fff; |
| | | background-color: orange; |
| | | border-color: orange; |
| | | } |
| | | |
| | | .mk-border-orange, .mk-border-orange:hover, .mk-border-orange:active, .mk-border-orange:focus { |
| | | color: orange; |
| | | background-color: #fff; |
| | | border-color: orange; |
| | | } |
| | | |
| | | // 灰色 |
| | | .mk-gray, .mk-gray:hover, .mk-gray:active, .mk-gray:focus { |
| | |
| | | 'header.form.number': '数字', |
| | | 'header.form.colspan': '合并列', |
| | | 'header.form.select': 'Select', |
| | | 'header.form.multiselect': '多选', |
| | | 'header.form.link': '关联菜单', |
| | | 'header.form.dateday': 'Date(Day)', |
| | | 'header.form.datetime': 'Date(Second)', |
| | |
| | | 'header.form.number': '数字', |
| | | 'header.form.colspan': '合并列', |
| | | 'header.form.select': '选择', |
| | | 'header.form.multiselect': '多选', |
| | | 'header.form.link': '关联菜单', |
| | | 'header.form.dateday': '日期(天)', |
| | | 'header.form.datetime': '日期(秒)', |
| | |
| | | |
| | | let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` |
| | | let DateCount = `select count(1) as total from ${_dataresource} ${_search}` |
| | | |
| | | console.log(LText) |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | |
| | | } |
| | | > .button-list { |
| | | padding: 10px 0px 5px; |
| | | button { |
| | | margin-right: 15px; |
| | | margin-bottom: 10px; |
| | | } |
| | | .ant-spin { |
| | | position: fixed; |
| | | z-index: 1010; |
| | | left: 50vw; |
| | | top: calc(50vh - 70px); |
| | | } |
| | | } |
| | | .box404 { |
| | | padding-top: 30px; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮提交执行 |
| | | */ |
| | | execSubmit = (btn, data, _resolve, formdata) => { |
| | | const { setting } = this.props |
| | | if (btn.intertype === 'inner') { |
| | |
| | | if (this.props.setting.actionfixed && this.props.type === 'main') { // 按钮是否固定在头部 |
| | | return ( |
| | | <Affix offsetTop={48}> |
| | | <div className="button-list" id={this.props.MenuID + 'mainaction'}> |
| | | <div className="button-list toolbar-button" id={this.props.MenuID + 'mainaction'}> |
| | | {this.props.actions.map((item, index) => { |
| | | if (loadingUuid === item.uuid) { |
| | | return ( |
| | |
| | | ) |
| | | } else { |
| | | return ( |
| | | <div className="button-list"> |
| | | <div className="button-list toolbar-button"> |
| | | {this.props.actions.map((item, index) => { |
| | | if (loadingUuid === item.uuid) { |
| | | return ( |
| | |
| | | .commontable .button-list { |
| | | .button-list.toolbar-button { |
| | | padding: 10px 20px 5px; |
| | | background: #ffffff; |
| | | button { |
| | | min-width: 65px; |
| | | margin-right: 15px; |
| | | margin-bottom: 10px; |
| | | } |
| | | .ant-spin { |
| | | position: fixed; |
| | | z-index: 1010; |
| | | left: 50vw; |
| | | left: calc(50vw - 22px); |
| | | top: calc(50vh - 70px); |
| | | } |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { card } = this.props |
| | | |
| | | if (card.focus) { |
| | | try { |
| | | let _form = document.getElementById('label') |
| | | _form.select() |
| | | } catch { |
| | | console.warn('表单focus失败!') |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 打开方式或显示位置变化 |
| | | openTypeChange = (key, value) => { |
| | | if (key === 'OpenType') { |
| | |
| | | }) |
| | | } |
| | | |
| | | // _config.tabs = _config.tabs || [] |
| | | // _config.tabgroups = _config.tabgroups || ['tabs'] |
| | | // _config.setting.subtabs = _config.setting.subtabs || [] |
| | | _config.tabs = _config.tabs || [] |
| | | _config.tabgroups = _config.tabgroups || ['tabs'] |
| | | _config.setting.subtabs = _config.setting.subtabs || [] |
| | | |
| | | this.setState({ |
| | | originActions: _oriActions, |
| | | config: _config, |
| | | originActions: _oriActions, |
| | | originMenu: JSON.parse(JSON.stringify(menu)), |
| | | selectedTables: _config.tables || [], |
| | | menuformlist: [ |
| | |
| | | key: 'field', |
| | | label: this.state.dict['header.form.field'], |
| | | initVal: card.field, |
| | | tooltip: '字段名可以使用逗号分隔,进行多字段综合搜索,注:综合搜索仅在文本类型时有效', |
| | | tooltipClass: 'middle', |
| | | required: true, |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_' |
| | | }, { |
| | | max: 50, |
| | | message: '字段名最多50个字符!' |
| | | }], |
| | | readonly: false |
| | | }, |
| | | { |
| | |
| | | }, { |
| | | value: 'select', |
| | | text: this.state.dict['header.form.select'] |
| | | }, { |
| | | value: 'multiselect', |
| | | text: this.state.dict['header.form.multiselect'] |
| | | }, { |
| | | value: 'link', |
| | | text: this.state.dict['header.form.link'] |
| | |
| | | label: this.state.dict['header.form.field'], |
| | | initVal: card.field, |
| | | required: true, |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_' |
| | | }, { |
| | | max: 50, |
| | | message: '字段名最多50个字符!' |
| | | }], |
| | | readonly: false |
| | | }, |
| | | { |
| | |
| | | |
| | | if (res.type === 'search') { |
| | | if ((res.values.type === 'select' || res.values.type === 'link') && res.values.resourceType === '1') { |
| | | let sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ' from ' + res.values.dataSource |
| | | let _datasource = res.values.dataSource |
| | | |
| | | if (/\s/.test(_datasource)) { |
| | | _datasource = '(' + _datasource + ') tb' |
| | | } |
| | | |
| | | let sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ' from ' + _datasource |
| | | if (res.values.type === 'link') { |
| | | sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ',' + res.values.linkField + ' from ' + res.values.dataSource |
| | | sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ',' + res.values.linkField + ' from ' + _datasource |
| | | } |
| | | if (res.values.orderBy) { |
| | | sql = sql + ' order by ' + res.values.orderBy + ' ' + res.values.orderType |
| | |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | let _config = JSON.parse(JSON.stringify(_this.state.config)) |
| | | _config[element.type] = _config[element.type].filter(item => { |
| | | if (item.uuid === element.card.uuid) { |
| | | return false |
| | | } else { |
| | | return true |
| | | } |
| | | }) |
| | | |
| | | if (element.type === 'tabs') { |
| | | _config[element.card.groupId] = _config[element.card.groupId].filter(item => { |
| | | if (item.uuid === element.card.uuid) { |
| | | return false |
| | | } else { |
| | | return true |
| | | } |
| | | }) |
| | | } else { |
| | | _config[element.type] = _config[element.type].filter(item => { |
| | | if (item.uuid === element.card.uuid) { |
| | | return false |
| | | } else { |
| | | return true |
| | | } |
| | | }) |
| | | } |
| | | |
| | | let refreshtype = element.type + 'loading' |
| | | |
| | |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | | profileAction = (element) => { |
| | | console.log(element) |
| | | } |
| | | |
| | | changeTemplate = () => { |
| | |
| | | let _LongParam = '' |
| | | let _config = {...config, tables: this.state.selectedTables} |
| | | let _pageParam = {...menu.PageParam, OpenType: res.opentype} |
| | | |
| | | // 未设置数据源或标签不合法时,启用状态为false |
| | | if (_config.setting.interType === 'inner' && !_config.setting.innerFunc && !_config.setting.dataresource) { |
| | | _config.enabled = false |
| | | } else if (_config.tabgroups.length > 1) { |
| | | _config.tabgroups.forEach(group => { |
| | | if (_config[group].length === 0) { |
| | | _config.enabled = false |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | |
| | | } |
| | | } |
| | | |
| | | onEnabledChange = () => { |
| | | onEnabledChange = (val, e) => { |
| | | const { config } = this.state |
| | | |
| | | this.setState({ |
| | | config: {...config, enabled: !config.enabled} |
| | | }) |
| | | let tabinvalid = true |
| | | if (config.tabgroups.length > 1) { |
| | | config.tabgroups.forEach(group => { |
| | | if (config[group].length === 0) { |
| | | tabinvalid = false |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.interType === 'inner' && !config.setting.innerFunc && !config.setting.dataresource) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单尚未设置数据源,不可启用!', |
| | | duration: 10 |
| | | }) |
| | | } else if (!tabinvalid) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单标签页设置错误(多行标签内,行标签不可为空),不可启用!', |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | config: {...config, enabled: !config.enabled} |
| | | }) |
| | | } |
| | | } |
| | | |
| | | onColumnNameChange = () => { |
| | |
| | | const configAction = this.state.config.action.filter(_action => |
| | | !_action.origin && (_action.OpenType === 'pop' || _action.OpenType === 'popview' || _action.OpenType === 'blank' || _action.OpenType === 'tab') |
| | | ) |
| | | |
| | | let configTabs = [] |
| | | this.state.config.tabgroups.forEach(group => { |
| | | configTabs.push(...this.state.config[group]) |
| | | }) |
| | | |
| | | return ( |
| | | <div className="common-table-board"> |
| | |
| | | <Button |
| | | icon={item.icon} |
| | | style={{marginBottom: '10px'}} |
| | | className={'mk-btn mk-' + item.class} |
| | | className={'config-button mk-btn mk-' + item.class} |
| | | onClick={() => this.setSubConfig(item, 'button')} |
| | | >{item.label}</Button> |
| | | </div> |
| | |
| | | return (<SourceElement key={index} content={item}/>) |
| | | })} |
| | | </div> |
| | | {this.state.config.tabs.length > 0 ? |
| | | {configTabs.length > 0 ? |
| | | <p className="config-btn-title"> |
| | | <Tooltip placement="topLeft" title="点击按钮,可完成或查看标签配置信息。"> |
| | | <Icon type="question-circle" /> |
| | |
| | | {this.state.dict['header.menu.tab.configurable']} |
| | | </p> : null |
| | | } |
| | | {this.state.config.tabs.map((item, index) => { |
| | | {configTabs.map((item, index) => { |
| | | return ( |
| | | <div key={index}> |
| | | <Button |
| | | className="config-button" |
| | | icon={item.icon} |
| | | style={{marginBottom: '10px'}} |
| | | onClick={() => this.setSubConfig(item, 'tab')} |
| | |
| | | <div className="setting"> |
| | | <Card title={this.state.dict['header.menu.page.configurable']} bordered={false} extra={ |
| | | <div> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" defaultChecked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | <Button type="primary" onClick={this.changeTemplate}>{this.state.dict['header.menu.template.change']}</Button> |
| | | <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button> |
| | | <Button onClick={this.cancelConfig}>{this.state.dict['header.return']}</Button> |
| | |
| | | handleMenu={this.handleAction} |
| | | copyElement={(val) => this.handleAction(val, 'copy')} |
| | | deleteMenu={this.deleteElement} |
| | | profileMenu={this.profileAction} |
| | | placeholder={this.state.dict['header.form.action.placeholder']} |
| | | /> : null |
| | | } |
| | |
| | | color: #c49f47; |
| | | margin-right: 3px; |
| | | } |
| | | .config-button { |
| | | min-width: 65px; |
| | | } |
| | | } |
| | | .tools:hover { |
| | | overflow-y: auto; |
| | |
| | | left: 20px; |
| | | color: #26C281; |
| | | } |
| | | .edit.profile { |
| | | left: 60px; |
| | | color: purple; |
| | | } |
| | | button { |
| | | cursor: move; |
| | | min-width: 65px; |
| | | .anticon-table { |
| | | font-size: 10px; |
| | | position: absolute; |
| | |
| | | |
| | | const { index: overIndex } = findCard(`${targetId}`) |
| | | let targetIndex = overIndex |
| | | if (!target) { |
| | | targetIndex++ |
| | | } |
| | | if (targetIndex < 0) { |
| | | targetIndex = 0 |
| | | } |
| | | // if (!target) { |
| | | targetIndex++ |
| | | // } |
| | | // if (targetIndex < 0) { |
| | | // targetIndex = 0 |
| | | // } |
| | | |
| | | const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] }) |
| | | setCards(_cards) |
| | |
| | | newcard.orderBy = '' |
| | | newcard.orderType = 'asc' |
| | | newcard.readonly = 'false' |
| | | newcard.required = 'false' |
| | | newcard.required = 'true' |
| | | newcard.focus = true |
| | | |
| | | let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0 |
| | | if (target) { |
| | |
| | | let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | if ((res.type === 'select' || res.type === 'link') && res.resourceType === '1') { |
| | | let sql = 'select ' + res.valueField + ',' + res.valueText + ' from ' + res.dataSource |
| | | let _datasource = res.dataSource |
| | | |
| | | if (/\s/.test(_datasource)) { |
| | | _datasource = '(' + _datasource + ') tb' |
| | | } |
| | | |
| | | let sql = 'select ' + res.valueField + ',' + res.valueText + ' from ' + _datasource |
| | | if (res.type === 'link') { |
| | | sql = 'select ' + res.valueField + ',' + res.valueText + ',' + res.linkField + ' from ' + res.dataSource |
| | | sql = 'select ' + res.valueField + ',' + res.valueText + ',' + res.linkField + ' from ' + _datasource |
| | | } |
| | | if (res.orderBy) { |
| | | sql = sql + ' order by ' + res.orderBy + ' ' + res.orderType |
| | |
| | | }) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { card } = this.props |
| | | |
| | | if (card.focus) { |
| | | try { |
| | | let _form = document.getElementById('label') |
| | | _form.select() |
| | | } catch { |
| | | console.warn('表单focus失败!') |
| | | } |
| | | } |
| | | } |
| | | |
| | | openTypeChange = (key, value) => { |
| | | if (key === 'type') { |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required'] |
| | |
| | | getFields() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const fields = [] |
| | | |
| | | this.state.formlist.forEach((item, index) => { |
| | | if (item.hidden) return |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { card } = this.props |
| | | |
| | | if (card.focus) { |
| | | try { |
| | | let _form = document.getElementById('label') |
| | | _form.select() |
| | | } catch { |
| | | console.warn('表单focus失败!') |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 打开方式或显示位置变化 |
| | | openTypeChange = (key, value) => { |
| | | if (key === 'OpenType') { |
| | |
| | | key: 'field', |
| | | label: this.state.dict['header.form.field'], |
| | | initVal: card.field, |
| | | tooltip: '字段名可以使用逗号分隔,进行多字段综合搜索,注:综合搜索仅在文本类型时有效', |
| | | tooltipClass: 'middle', |
| | | required: true, |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_' |
| | | }, { |
| | | max: 50, |
| | | message: '字段名最多50个字符!' |
| | | }], |
| | | readonly: false |
| | | }, |
| | | { |
| | |
| | | }, { |
| | | value: 'select', |
| | | text: this.state.dict['header.form.select'] |
| | | }, { |
| | | value: 'multiselect', |
| | | text: this.state.dict['header.form.multiselect'] |
| | | }, { |
| | | value: 'link', |
| | | text: this.state.dict['header.form.link'] |
| | |
| | | label: this.state.dict['header.form.field'], |
| | | initVal: card.field, |
| | | required: true, |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_' |
| | | }, { |
| | | max: 50, |
| | | message: '字段名最多50个字符!' |
| | | }], |
| | | readonly: false |
| | | }, |
| | | { |
| | |
| | | |
| | | if (res.type === 'search') { |
| | | if ((res.values.type === 'select' || res.values.type === 'link') && res.values.resourceType === '1') { |
| | | let sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ' from ' + res.values.dataSource |
| | | let _datasource = res.values.dataSource |
| | | |
| | | if (/\s/.test(_datasource)) { |
| | | _datasource = '(' + _datasource + ') tb' |
| | | } |
| | | |
| | | let sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ' from ' + _datasource |
| | | if (res.values.type === 'link') { |
| | | sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ',' + res.values.linkField + ' from ' + res.values.dataSource |
| | | sql = 'select ' + res.values.valueField + ',' + res.values.valueText + ',' + res.values.linkField + ' from ' + _datasource |
| | | } |
| | | if (res.values.orderBy) { |
| | | sql = sql + ' order by ' + res.values.orderBy + ' ' + res.values.orderType |
| | |
| | | onEnabledChange = () => { |
| | | const { config } = this.state |
| | | |
| | | this.setState({ |
| | | config: {...config, enabled: !config.enabled} |
| | | }) |
| | | if (config.setting.interType === 'inner' && !config.setting.innerFunc && !config.setting.dataresource) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单尚未设置数据源,不可启用!', |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | config: {...config, enabled: !config.enabled} |
| | | }) |
| | | } |
| | | } |
| | | |
| | | onColumnNameChange = () => { |
| | |
| | | <Button |
| | | icon={item.icon} |
| | | style={{marginBottom: '10px'}} |
| | | className={'mk-btn mk-' + item.class} |
| | | className={'config-button mk-btn mk-' + item.class} |
| | | onClick={() => this.setSubConfig(item)} |
| | | >{item.label}</Button> |
| | | </div> |
| | |
| | | <div className="setting"> |
| | | <Card title={'标签(子表)页面配置'} bordered={false} extra={ |
| | | <div> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" defaultChecked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | {/* <Button type="primary" onClick={this.changeTemplate}>{this.state.dict['header.menu.template.change']}</Button> */} |
| | | <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button> |
| | | <Button onClick={this.cancelConfig}>{this.state.dict['header.return']}</Button> |
| | |
| | | color: #c49f47; |
| | | margin-right: 3px; |
| | | } |
| | | .config-button { |
| | | min-width: 65px; |
| | | } |
| | | } |
| | | .tools:hover { |
| | | overflow-y: auto; |
| | |
| | | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { card } = this.props |
| | | |
| | | if (card.focus) { |
| | | try { |
| | | let _form = document.getElementById('label') |
| | | _form.select() |
| | | } catch { |
| | | console.warn('表单focus失败!') |
| | | } |
| | | } |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | // 表单提交时检查输入值是否正确 |
| | | return new Promise((resolve, reject) => { |
| | |
| | | }) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { card } = this.props |
| | | |
| | | if (card.focus) { |
| | | try { |
| | | let _form = document.getElementById('label') |
| | | _form.select() |
| | | } catch { |
| | | console.warn('表单focus失败!') |
| | | } |
| | | } |
| | | } |
| | | |
| | | typeChange = (key, value) => { |
| | | if (key === 'type') { |
| | | let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width'] |
| | |
| | | if (item.hidden) return |
| | | |
| | | if (item.type === 'text') { // 文本搜索 |
| | | let rules = item.rules || [] |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | }, |
| | | ...rules |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)} |
| | | </Form.Item> |
| | |
| | | |
| | | const { MonthPicker, WeekPicker, RangePicker } = DatePicker |
| | | |
| | | const Card = ({ id, type, card, moveCard, findCard, editCard, delCard, copyCard, hasDrop, showfield }) => { |
| | | const Card = ({ id, type, card, moveCard, findCard, editCard, delCard, copyCard, profileCard, hasDrop, showfield }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: ItemTypes[type], id, originalIndex }, |
| | |
| | | const copy = () => { |
| | | copyCard(id) |
| | | } |
| | | |
| | | const profile = () => { |
| | | profileCard(id) |
| | | } |
| | | |
| | | let _defaultValue = '' // 下拉搜索、时间范围类型,初始值需要预处理 |
| | | |
| | | if (type === 'search' && card.type === 'select') { |
| | | if (type === 'search' && (card.type === 'multiselect' || card.type === 'select' || card.type === 'link')) { |
| | | if (card.initval) { |
| | | let _option = card.options.filter(option => option.Value === card.initval)[0] |
| | | if (_option) { |
| | |
| | | {card.type === 'text' ? |
| | | <Input style={{marginTop: '4px'}} defaultValue={card.initval} /> : null |
| | | } |
| | | {(card.type === 'select' || card.type === 'link') ? |
| | | {(card.type === 'multiselect' || card.type === 'select' || card.type === 'link') ? |
| | | <Select defaultValue={_defaultValue}></Select> : null |
| | | } |
| | | {card.type === 'date' ? |
| | |
| | | </span> : null |
| | | } |
| | | </div> |
| | | <Icon className="edit" type="edit" onClick={edit} /> |
| | | <Icon className="edit close" type="close" onClick={del} /> |
| | | {type === 'action' ? <Icon className="edit copy" type="copy" onClick={copy} /> : null} |
| | | <Icon className="edit" title="编辑" type="edit" onClick={edit} /> |
| | | <Icon className="edit close" title="删除" type="close" onClick={del} /> |
| | | {type === 'action' ? <Icon className="edit copy" title="复制" type="copy" onClick={copy} /> : null} |
| | | {type === 'action' && ['pop', 'prompt', 'exec'].includes(card.OpenType) && card.intertype === 'inner' && !card.innerFunc ? |
| | | <Icon className="edit profile" title="校验规则" type="profile" onClick={profile} /> : null |
| | | } |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | import ItemTypes from './itemtypes' |
| | | import './index.scss' |
| | | |
| | | const Container = ({list, setting, gridBtn, type, placeholder, handleList, handleMenu, deleteMenu, copyElement, handleGridBtn, showfield }) => { |
| | | const Container = ({list, setting, gridBtn, type, placeholder, handleList, handleMenu, deleteMenu, copyElement, profileMenu, handleGridBtn, showfield }) => { |
| | | let target = null |
| | | const [cards, setCards] = useState(list) |
| | | const moveCard = (id, atIndex) => { |
| | |
| | | const editCard = id => { |
| | | const { card } = findCard(id) |
| | | handleMenu(card) |
| | | } |
| | | |
| | | const profileCard = id => { |
| | | const { card } = findCard(id) |
| | | profileMenu(card) |
| | | } |
| | | |
| | | const delCard = id => { |
| | |
| | | } |
| | | |
| | | let newcard = {} |
| | | newcard.uuid = Utils.getuuid() |
| | | newcard.focus = true |
| | | |
| | | if (item.type === 'search') { |
| | | let _match = 'like' |
| | | if (item.subType === 'select' || item.subType === 'link') { |
| | |
| | | } else if (item.subType === 'dateweek' || item.subType === 'daterange') { |
| | | _match = 'between' |
| | | } |
| | | newcard.uuid = Utils.getuuid() |
| | | |
| | | newcard.label = 'label' |
| | | newcard.field = '' |
| | | newcard.initval = '' |
| | |
| | | newcard.match = _match |
| | | newcard.display = 'dropdown' |
| | | } else if (item.type === 'action') { |
| | | newcard.uuid = Utils.getuuid() |
| | | newcard.label = 'button' |
| | | newcard.innerFunc = '' |
| | | newcard.outerFunc = '' |
| | |
| | | newcard.label = item.label |
| | | } |
| | | } else if (item.type === 'columns') { |
| | | newcard.uuid = Utils.getuuid() |
| | | newcard.Align = 'left' |
| | | newcard.label = 'label' |
| | | newcard.field = '' |
| | |
| | | |
| | | const { index: overIndex } = findCard(`${targetId}`) |
| | | let targetIndex = overIndex |
| | | if (!target) { |
| | | targetIndex++ |
| | | } |
| | | if (targetIndex < 0) { |
| | | targetIndex = 0 |
| | | } |
| | | // if (!target) { |
| | | targetIndex++ |
| | | // } |
| | | // if (targetIndex < 0) { |
| | | // targetIndex = 0 |
| | | // } |
| | | |
| | | const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] }) |
| | | setCards(_cards) |
| | |
| | | editCard={editCard} |
| | | delCard={delCard} |
| | | copyCard={copyCard} |
| | | profileCard={profileCard} |
| | | findCard={findCard} |
| | | hasDrop={hasDrop} |
| | | /> |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification } from 'antd' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip } from 'antd' |
| | | import { dateOptions, matchReg } from '@/utils/option.js' |
| | | import EditTable from '../editable' |
| | | import './index.scss' |
| | |
| | | let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal |
| | | let _options = ['label', 'field', 'initval', 'type', 'match'] // 默认显示项 |
| | | |
| | | if ((type === 'select' || type === 'link') && resourceType === '0') { // 下拉选择类型、选项为自定义资源 |
| | | _options = [..._options, 'resourceType', 'setAll', 'options', 'display'] |
| | | } else if ((type === 'select' || type === 'link') && resourceType === '1') { // 下拉选择类型、选项为后台数据源中获取 |
| | | _options = [..._options, 'resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display'] |
| | | if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 下拉选择类型、选项为自定义资源 |
| | | _options = [..._options, 'resourceType', 'options', 'display'] |
| | | } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 下拉选择类型、选项为后台数据源中获取 |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display'] |
| | | } |
| | | |
| | | if (type === 'select' || type === 'link') { |
| | | _options.push('setAll') |
| | | } |
| | | |
| | | if (type === 'link') { // 关联类型、增加关联上级的字段名 |
| | |
| | | if (form.key === 'match') { |
| | | if (type === 'text') { |
| | | form.options = matchReg.text |
| | | } else if (type === 'select' || type === 'link') { |
| | | } else if (type === 'multiselect' || type === 'select' || type === 'link') { |
| | | form.options = matchReg.select |
| | | } else if (type === 'date') { |
| | | form.options = matchReg.date |
| | |
| | | }) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { card } = this.props |
| | | |
| | | if (card.focus) { |
| | | try { |
| | | let _form = document.getElementById('label') |
| | | _form.select() |
| | | } catch { |
| | | console.warn('表单focus失败!') |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索条件类型切换 |
| | | */ |
| | |
| | | if (key === 'type') { |
| | | let _options = ['label', 'field', 'initval', 'type', 'match'] |
| | | |
| | | if ((value === 'select' || value === 'link') && resourceType === '0') { // 下拉选择类型、选项为自定义资源 |
| | | _options = [..._options, 'resourceType', 'setAll', 'options', 'display'] |
| | | } else if ((value === 'select' || value === 'link') && resourceType === '1') { // 下拉选择类型、选项为后台数据源中获取 |
| | | _options = [..._options, 'resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display'] |
| | | if ((value === 'multiselect' || value === 'select' || value === 'link') && resourceType === '0') { // 下拉选择类型、选项为自定义资源 |
| | | _options = [..._options, 'resourceType', 'options', 'display'] |
| | | } else if ((value === 'multiselect' || value === 'select' || value === 'link') && resourceType === '1') { // 下拉选择类型、选项为后台数据源中获取 |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display'] |
| | | } |
| | | |
| | | if (value === 'select' || value === 'link') { |
| | | _options.push('setAll') |
| | | } |
| | | |
| | | if (value === 'link') { |
| | |
| | | } else if (form.key === 'match') { // 搜索条件类型切换时,匹配规则类型对应切换 |
| | | if (value === 'text') { |
| | | form.options = matchReg.text |
| | | } else if (value === 'select' || value === 'link') { |
| | | } else if (value === 'multiselect' || value === 'select' || value === 'link') { |
| | | form.options = matchReg.select |
| | | } else if (value === 'date') { |
| | | form.options = matchReg.date |
| | |
| | | let value = e.target.value |
| | | |
| | | if (key === 'resourceType') { |
| | | let _options = ['label', 'field', 'initval', 'type', 'match', 'resourceType', 'setAll', 'display'] |
| | | let _options = ['label', 'field', 'initval', 'type', 'match', 'resourceType', 'display'] |
| | | |
| | | if (value === '0') { |
| | | _options = [..._options, 'options'] |
| | | } else if (value === '1') { |
| | | _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType'] |
| | | } |
| | | |
| | | if (openType === 'select' || openType === 'link') { |
| | | _options.push('setAll') |
| | | } |
| | | |
| | | if (openType === 'link') { |
| | |
| | | if (item.hidden) return |
| | | |
| | | if (item.type === 'text') { // 文本搜索 |
| | | let rules = item.rules || [] |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal || '', |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | }, |
| | | ...rules |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)} |
| | | </Form.Item> |
| | |
| | | width: 100%; |
| | | } |
| | | } |
| | | .anticon-question-circle { |
| | | color: #c49f47; |
| | | position: relative; |
| | | left: -3px; |
| | | } |
| | | } |
| | |
| | | value: 'yellow', |
| | | text: '黄色' |
| | | }, { |
| | | value: 'orange', |
| | | text: '橙色' |
| | | }, { |
| | | value: 'danger', |
| | | text: '红色' |
| | | }, { |
| | |
| | | value: 'border-yellow', |
| | | text: '白底黄框' |
| | | }, { |
| | | value: 'border-orange', |
| | | text: '白底橙框' |
| | | }, { |
| | | value: 'border-danger', |
| | | text: '白底红框' |
| | | }, { |
| | |
| | | |
| | | newsearches[item.key] = item.value ? item.value[0] + ' 00:00:00.000' : null |
| | | newsearches[item.key + '1'] = item.value ? _endval + ' 00:00:00.000' : null |
| | | } else if (item.type === 'text') { |
| | | item.key.split(',').forEach(field => { // 综合搜索,所字段拼接 |
| | | newsearches[field] = item.value |
| | | }) |
| | | } else { |
| | | newsearches[item.key] = item.value |
| | | } |
| | |
| | | let searchText = '' |
| | | searches.forEach(item => { |
| | | if (!item.value) return |
| | | // eslint-disable-next-line |
| | | searchText += (searchText !== '' ? ' ' + 'AND' + ' ' : '') |
| | | if (item.type === 'text' || item.type === 'select') { |
| | | // eslint-disable-next-line |
| | | searchText += (searchText !== '' ? ' AND ' : '') |
| | | if (item.type === 'text') { |
| | | let str = item.match === '=' ? '' : '%' |
| | | // eslint-disable-next-line |
| | | searchText += item.key + ' ' + item.match + ' ' + '\'' + str + item.value + str + '\'' |
| | | let fields = item.key.split(',').map(field => { // 综合搜索,所字段拼接 |
| | | return field + ' ' + item.match + ' \'' + str + item.value + str + '\'' |
| | | }) |
| | | |
| | | searchText += '(' + fields.join(' OR ') + ')' |
| | | } else if (item.type === 'select') { |
| | | let str = item.match === '=' ? '' : '%' |
| | | |
| | | searchText += item.key + ' ' + item.match + ' \'' + str + item.value + str + '\'' |
| | | } else if (item.type === 'date') { |
| | | let _val = item.value |
| | | let timetail = ' 00:00:00.000' |
| | |
| | | timetail = '' |
| | | } |
| | | |
| | | // eslint-disable-next-line |
| | | searchText += '(' + item.key + ' ' + _match + ' ' + '\'' + _val + timetail + '\')' |
| | | searchText += '(' + item.key + ' ' + _match + ' \'' + _val + timetail + '\')' |
| | | } else if (item.type === 'datemonth') { // 月-过滤条件,从月开始至结束,结束时间为月末加一天的0点,方式为< |
| | | let _startval = moment(item.value, 'YYYY-MM').startOf('month').format('YYYY-MM-DD') + ' 00:00:00.000' |
| | | let _endval = moment(item.value, 'YYYY-MM').endOf('month').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' |
| | | |
| | | // eslint-disable-next-line |
| | | searchText += '(' + item.key + ' >= \'' + _startval + '\' AND ' + item.key + ' < \'' + _endval + '\')' |
| | | } else if (item.type === 'dateweek') { // 周-过滤条件 |
| | | let _startval = item.value[0] + ' 00:00:00.000' |
| | | let _endval = moment(item.value[1], 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' |
| | | |
| | | // eslint-disable-next-line |
| | | searchText += '(' + item.key + ' >= \'' + _startval + '\' AND ' + item.key + ' < \'' + _endval + '\')' |
| | | } else if (item.type === 'daterange') { |
| | | let _startval = item.value[0] + ' 00:00:00.000' |
| | | let _endval = moment(item.value[1], 'YYYY-MM-DD').add(1, 'days').format('YYYY-MM-DD') + ' 00:00:00.000' |
| | | |
| | | // eslint-disable-next-line |
| | | searchText += '(' + item.key + ' >= \'' + _startval + '\' AND ' + item.key + ' < \'' + _endval + '\')' |
| | | } else { |
| | | // eslint-disable-next-line |
| | | searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value + '\')' |
| | | searchText += '(' + item.key + ' ' + item.match + ' \'' + item.value + '\')' |
| | | } |
| | | }) |
| | | return searchText |
| | |
| | | let searchText = '' |
| | | searches.forEach(item => { |
| | | if (!item.value) return |
| | | // eslint-disable-next-line |
| | | searchText += (searchText !== '' ? ' ' + 'AND' + ' ' : '') |
| | | searchText += (searchText !== '' ? ' AND ' : '') |
| | | if (item.type === 'text') { |
| | | let options = item.key.split(',').map(op => { |
| | | // equal时不添加% |
| | | // eslint-disable-next-line |
| | | let str = item.op === 'equal' ? '' : '%' |
| | | // eslint-disable-next-line |
| | | return op + ' ' + item.op + ' ' + '"' + str + item.value + str + '"' |
| | | return op + ' ' + item.op + ' \'' + str + item.value + str + '\'' |
| | | }) |
| | | // eslint-disable-next-line |
| | | searchText += '(' + options.join(' ' + 'OR' + ' ') + ')' |
| | | searchText += '(' + options.join(' OR ') + ')' |
| | | } else if (item.type === 'date') { |
| | | // eslint-disable-next-line |
| | | searchText += '(' + item.key + ' ' + item.op + ' ' + '"' + item.value + '")' |
| | | searchText += '(' + item.key + ' ' + item.op + ' \'' + item.value + '\')' |
| | | } else { |
| | | // eslint-disable-next-line |
| | | searchText += '(' + item.key + ' ' + item.op + ' ' + '"' + item.value + '")' |
| | | searchText += '(' + item.key + ' ' + item.op + ' \'' + item.value + '\')' |
| | | } |
| | | }) |
| | | return searchText |