| | |
| | | ] |
| | | ] |
| | | }, |
| | | "homepage": "./build", |
| | | "homepage": ".", |
| | | "devDependencies": { |
| | | "typescript": "^4.0.2" |
| | | } |
| | |
| | | |
| | | // 新系统文件置于admin中 ../options.json |
| | | |
| | | fetch('./options.json') |
| | | fetch('../options.json') |
| | | .then(response => response.json()) |
| | | .catch(() => { |
| | | document.getElementById('root').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">系统配置信息获取失败,请联系管理员!</div>' |
| | |
| | | let options = ['font', 'border', 'padding', 'margin', 'backgroundColor'] |
| | | |
| | | if (element.eleType === 'button') { |
| | | |
| | | options.push('width') |
| | | } else if (element.eleType === 'picture') { |
| | | options = ['border', 'margin'] |
| | | } else if (element.eleType === 'slider') { |
| | |
| | | import { Icon, Select, DatePicker, Input, Popover, Form } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import DateGroup from '../dategroup' |
| | | import './index.scss' |
| | | |
| | | const { MonthPicker, WeekPicker, RangePicker } = DatePicker |
| | | const CheckCard = asyncComponent(() => import('@/templates/modalconfig/checkCard')) |
| | | |
| | | const Card = ({ id, card, showField, moveCard, copyCard, findCard, editCard, delCard }) => { |
| | | const originalIndex = findCard(id).index |
| | |
| | | } |
| | | } |
| | | |
| | | let formItem = null |
| | | if (card.type === 'text') { |
| | | formItem = (<Input style={{marginTop: '4px'}} placeholder={card.labelShow === 'false' ? card.label : ''} value={card.initval} />) |
| | | } else if (card.type === 'multiselect' || card.type === 'select' || card.type === 'link') { |
| | | formItem = (<Select value={_defaultValue}></Select>) |
| | | } else if (card.type === 'date') { |
| | | formItem = (<DatePicker value={card.initval ? moment().subtract(card.initval, 'days') : null} />) |
| | | } else if (card.type === 'dateweek') { |
| | | formItem = (<WeekPicker value={card.initval ? moment().subtract(card.initval * 7, 'days') : null} />) |
| | | } else if (card.type === 'datemonth') { |
| | | formItem = (<MonthPicker value={card.initval ? moment().subtract(card.initval, 'month') : null} />) |
| | | } else if (card.type === 'daterange') { |
| | | formItem = (<RangePicker |
| | | className="data-range" |
| | | placeholder={['BeginTime', 'EndTime']} |
| | | renderExtraFooter={() => 'extra footer'} |
| | | value={_defaultValue} |
| | | />) |
| | | } else if (card.type === 'group') { |
| | | formItem = (<DateGroup card={card} />) |
| | | } else if (card.type === 'checkcard') { |
| | | formItem = <CheckCard config={card} /> |
| | | } |
| | | |
| | | return ( |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | |
| | | required={card.required === 'true'} |
| | | help={showField ? card.field + (card.datefield ? ', ' + card.datefield : '') : ''} |
| | | > |
| | | {card.type === 'text' ? |
| | | <Input style={{marginTop: '4px'}} placeholder={card.labelShow === 'false' ? card.label : ''} value={card.initval} /> : null |
| | | } |
| | | {(card.type === 'multiselect' || card.type === 'select' || card.type === 'link') ? |
| | | <Select value={_defaultValue}></Select> : null |
| | | } |
| | | {card.type === 'date' ? |
| | | <DatePicker value={card.initval ? moment().subtract(card.initval, 'days') : null} /> : null |
| | | } |
| | | {card.type === 'dateweek' ? |
| | | <WeekPicker value={card.initval ? moment().subtract(card.initval * 7, 'days') : null} /> : null |
| | | } |
| | | {card.type === 'datemonth' ? |
| | | <MonthPicker value={card.initval ? moment().subtract(card.initval, 'month') : null} /> : null |
| | | } |
| | | {card.type === 'daterange' ? |
| | | <RangePicker |
| | | className="data-range" |
| | | placeholder={['BeginTime', 'EndTime']} |
| | | renderExtraFooter={() => 'extra footer'} |
| | | value={_defaultValue} |
| | | /> : null |
| | | } |
| | | {card.type === 'group' ? <DateGroup card={card} /> : null } |
| | | {formItem} |
| | | </Form.Item> |
| | | </div> |
| | | </div> |
| | |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | appType: sessionStorage.getItem('appType'), |
| | | searchlist: null, // 搜索条件集 |
| | | sqlVerifing: false, // sql验证中 |
| | | visible: false, // 模态框控制 |
| | |
| | | return |
| | | } |
| | | |
| | | if (['select', 'multiselect', 'link'].includes(res.type) && res.resourceType === '1' && /\s/.test(res.dataSource)) { |
| | | if (['select', 'multiselect', 'link', 'checkcard'].includes(res.type) && res.resourceType === '1' && /\s/.test(res.dataSource)) { |
| | | this.setState({ |
| | | sqlVerifing: true |
| | | }) |
| | |
| | | background: #ffffff; |
| | | padding-bottom: 15px; |
| | | |
| | | .ant-form-item-control { |
| | | line-height: 1.5; |
| | | } |
| | | >.ant-switch { |
| | | position: absolute; |
| | | z-index: 3; |
| | |
| | | min-height: 65px; |
| | | > .ant-col { |
| | | padding: 0 12px!important; |
| | | } |
| | | } |
| | | >.ant-row:not(.ant-form-item) { |
| | | > .ant-col { |
| | | display: inline-block; |
| | | float: none; |
| | | vertical-align: top; |
| | | } |
| | | } |
| | | .ant-row.ant-form-item .ant-col { |
| | |
| | | min-width: 100px!important; |
| | | width: 100%; |
| | | } |
| | | .check-card-edit-box { |
| | | margin-top: 5px!important; |
| | | } |
| | | } |
| | | .main-search-edit-list.right { |
| | | >.ant-row { |
| | |
| | | label: '链接方式', |
| | | initVal: card.open || 'blank', |
| | | required: true, |
| | | forbid: sessionStorage.getItem('appType') === 'pc', |
| | | forbid: sessionStorage.getItem('appType') !== 'pc', |
| | | options: [{ |
| | | value: 'blank', |
| | | text: '新窗口' |
| | |
| | | let keys = config.search.map(item => item.field.toLowerCase()) |
| | | |
| | | if (type === 'form') { |
| | | if (['number', 'switch', 'textarea', 'checkcard', 'fileupload', 'hint', 'color', 'funcvar'].includes(res.type)) { |
| | | if (['number', 'switch', 'textarea', 'fileupload', 'hint', 'color', 'funcvar'].includes(res.type)) { |
| | | res.type = 'text' |
| | | } else if (res.type === 'radio') { |
| | | res.type = 'select' |
| | |
| | | import { Icon, Select, DatePicker, Input, Popover, Form } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import DateGroup from '../dategroup' |
| | | import DateGroup from '@/menu/components/search/main-search/dategroup' |
| | | import './index.scss' |
| | | |
| | | const { MonthPicker, WeekPicker, RangePicker } = DatePicker |
| | |
| | | .common-drawarea-placeholder { |
| | | width: 100%; |
| | | line-height: 65px; |
| | | text-align: center; |
| | | color: #bcbcbc; |
| | | } |
| | |
| | | return |
| | | } |
| | | |
| | | if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) { |
| | | if (['select', 'multiselect', 'link', 'checkcard'].includes(res.type) && res.resourceType === '1' && /\s/.test(res.dataSource)) { |
| | | this.setState({ |
| | | sqlVerifing: true |
| | | }) |
| | |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | TypeCharOne: sessionStorage.getItem('kei_no'), |
| | | typename: sessionStorage.getItem('appType') || 'pc', |
| | | typename: sessionStorage.getItem('typename') || 'pc', |
| | | MenuID: res.keys_id |
| | | }).then(result => { |
| | | if (!result.status) { |
| | |
| | | |
| | | let mkey = result.mk_api_key || '' |
| | | |
| | | delete result.mk_ex_invoke |
| | | delete result.mk_ex_invoke // 是否继续执行 |
| | | delete result.status |
| | | delete result.message |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | delete result.mk_api_key |
| | | delete result.mk_api_key // 当前请求的key值,用于回调 |
| | | |
| | | let param = {} |
| | | |
| | |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, DatePicker } from 'antd' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | | const { MonthPicker, WeekPicker, RangePicker } = DatePicker |
| | | const CheckCard = asyncComponent(() => import('@/tabviews/zshare/mutilform/checkCard')) |
| | | |
| | | class AdvanceSearch extends Component { |
| | | static propTpyes = { |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'checkcard') { // 多选框 |
| | | fields.push( |
| | | <Col span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.labelShow !== 'false' ? item.label : ''}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | | { |
| | | required: item.required, |
| | | message: dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <CheckCard card={item} /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } |
| | | }) |
| | | |
| | |
| | | .ant-calendar-picker-container { |
| | | z-index: 10 !important; |
| | | } |
| | | .check-card-form-box { |
| | | margin-top: 5px; |
| | | } |
| | | } |
| | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | import DateGroup from '@/tabviews/zshare/dategroup' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import Utils from '@/utils/utils.js' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | |
| | | const { MonthPicker, WeekPicker, RangePicker } = DatePicker |
| | | |
| | | const MutilForm = asyncSpinComponent(() => import('./advanceform')) |
| | | const CheckCard = asyncComponent(() => import('@/tabviews/zshare/mutilform/checkCard')) |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | |
| | | |
| | | item.required = item.required === 'true' |
| | | |
| | | if (['select', 'link', 'multiselect'].includes(item.type)) { |
| | | if (['select', 'link', 'multiselect', 'checkcard'].includes(item.type)) { |
| | | if (item.setAll === 'true' && item.type !== 'multiselect') { |
| | | item.options.unshift({ |
| | | key: Utils.getuuid(), |
| | |
| | | delete result.message |
| | | delete result.status |
| | | |
| | | let _searchlist = this.state.searchlist.map(item => { |
| | | if (['select', 'link', 'multiselect'].includes(item.type) && result[item.field] && result[item.field].length > 0) { |
| | | let options = result[item.field].map(cell => { |
| | | let _item = { |
| | | key: Utils.getuuid(), |
| | | Value: cell[item.valueField], |
| | | Text: cell[item.valueText] |
| | | } |
| | | this.resetSearch(result) |
| | | }) |
| | | } |
| | | |
| | | if (item.type === 'link') { |
| | | _item.ParentID = cell[item.linkField] |
| | | } |
| | | |
| | | return _item |
| | | }) |
| | | |
| | | item.oriOptions = [...item.oriOptions, ...options] |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | searchlist: _searchlist.map(item => { |
| | | if (item.type === 'link') { |
| | | if (item.supInitVal) { |
| | | item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal || option.Value === '') |
| | | } else { |
| | | item.options = item.oriOptions |
| | | } |
| | | } else if (item.type === 'select' || item.type === 'multiselect') { |
| | | item.options = item.oriOptions |
| | | resetSearch = (result) => { |
| | | let _searchlist = this.state.searchlist.map(item => { |
| | | if (['select', 'link', 'multiselect', 'checkcard'].includes(item.type) && result[item.field] && result[item.field].length > 0) { |
| | | let options = result[item.field].map(cell => { |
| | | let _item = { |
| | | key: Utils.getuuid() |
| | | } |
| | | |
| | | return item |
| | | if (item.type !== 'checkcard') { |
| | | _item.Value = cell[item.valueField] |
| | | _item.Text = cell[item.valueText] |
| | | } else { |
| | | _item.$value = cell[item.cardValField] |
| | | _item = {..._item, ...cell} |
| | | } |
| | | |
| | | if (item.type === 'link') { |
| | | _item.ParentID = cell[item.linkField] |
| | | } |
| | | |
| | | return _item |
| | | }) |
| | | |
| | | item.oriOptions = [...item.oriOptions, ...options] |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | searchlist: _searchlist.map(item => { |
| | | if (item.type === 'link') { |
| | | if (item.supInitVal) { |
| | | item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal || option.Value === '') |
| | | } else { |
| | | item.options = item.oriOptions |
| | | } |
| | | } else if (item.type === 'select' || item.type === 'multiselect' || item.type === 'checkcard') { |
| | | item.options = item.oriOptions |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | }) |
| | | } |
| | |
| | | delete result.message |
| | | delete result.status |
| | | |
| | | let _searchlist = this.state.searchlist.map(item => { |
| | | if (['select', 'link', 'multiselect'].includes(item.type) && result[item.field] && result[item.field].length > 0) { |
| | | let options = result[item.field].map(cell => { |
| | | let _item = { |
| | | key: Utils.getuuid(), |
| | | Value: cell[item.valueField], |
| | | Text: cell[item.valueText] |
| | | } |
| | | |
| | | if (item.type === 'link') { |
| | | _item.ParentID = cell[item.linkField] |
| | | } |
| | | |
| | | return _item |
| | | }) |
| | | |
| | | item.oriOptions = [...item.oriOptions, ...options] |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | searchlist: _searchlist.map(item => { |
| | | if (item.type === 'link') { |
| | | if (item.supInitVal) { |
| | | item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal || option.Value === '') |
| | | } else { |
| | | item.options = item.oriOptions |
| | | } |
| | | } else if (item.type === 'select' || item.type === 'multiselect') { |
| | | item.options = item.oriOptions |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | }) |
| | | this.resetSearch(result) |
| | | }) |
| | | } |
| | | |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'checkcard') { // 多选框 |
| | | fields.push( |
| | | <Col span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.labelShow !== 'false' ? item.label : ''}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | | { |
| | | required: item.required, |
| | | message: dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <CheckCard card={item} onChange={this.searchChange} /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } |
| | | }) |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | .check-card-form-box { |
| | | margin-top: 5px; |
| | | } |
| | | } |
| | | .top-search.right { |
| | | >.ant-row { |
| | |
| | | }, |
| | | { |
| | | type: 'search', |
| | | label: '选项卡', |
| | | subType: 'checkcard', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'search', |
| | | label: CommonDict['model.form.dateday'], |
| | | subType: 'date', |
| | | url: '' |
| | |
| | | }, |
| | | { |
| | | type: 'search', |
| | | label: '选项卡', |
| | | subType: 'checkcard', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'search', |
| | | label: CommonDict['model.form.dateday'], |
| | | subType: 'date', |
| | | url: '' |
| | |
| | | state = {} |
| | | |
| | | getCards = () => { |
| | | const { display, width, options, fields, ratio, backgroundColor, borderColor } = this.props.config |
| | | const { display, width, options, fields, ratio, picratio, backgroundColor, borderColor } = this.props.config |
| | | |
| | | let _ratio = picratio || ratio |
| | | let paddingTop = '100%' |
| | | if (ratio === '4:3') { |
| | | if (_ratio === '4:3') { |
| | | paddingTop = '75%' |
| | | } else if (ratio === '3:2') { |
| | | } else if (_ratio === '3:2') { |
| | | paddingTop = '66.7%' |
| | | } else if (ratio === '16:9') { |
| | | } else if (_ratio === '16:9') { |
| | | paddingTop = '56.25%' |
| | | } |
| | | |
| | |
| | | import moment from 'moment' |
| | | |
| | | import DateGroup from '../dategroup' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | | const { MonthPicker, WeekPicker, RangePicker } = DatePicker |
| | | const CheckCard = asyncComponent(() => import('@/templates/modalconfig/checkCard')) |
| | | |
| | | const Card = ({ id, card, showField, moveCard, copyCard, findCard, editCard, delCard }) => { |
| | | const originalIndex = findCard(id).index |
| | |
| | | } |
| | | } |
| | | |
| | | let formItem = null |
| | | if (card.type === 'text') { |
| | | formItem = (<Input style={{marginTop: '4px'}} placeholder={card.labelShow === 'false' ? card.label : ''} value={card.initval} />) |
| | | } else if (card.type === 'multiselect' || card.type === 'select' || card.type === 'link') { |
| | | formItem = (<Select value={_defaultValue}></Select>) |
| | | } else if (card.type === 'date') { |
| | | formItem = (<DatePicker value={card.initval ? moment().subtract(card.initval, 'days') : null} />) |
| | | } else if (card.type === 'dateweek') { |
| | | formItem = (<WeekPicker value={card.initval ? moment().subtract(card.initval * 7, 'days') : null} />) |
| | | } else if (card.type === 'datemonth') { |
| | | formItem = (<MonthPicker value={card.initval ? moment().subtract(card.initval, 'month') : null} />) |
| | | } else if (card.type === 'daterange') { |
| | | formItem = (<RangePicker |
| | | className="data-range" |
| | | placeholder={['BeginTime', 'EndTime']} |
| | | renderExtraFooter={() => 'extra footer'} |
| | | value={_defaultValue} |
| | | />) |
| | | } else if (card.type === 'group') { |
| | | formItem = (<DateGroup card={card} />) |
| | | } else if (card.type === 'checkcard') { |
| | | formItem = <CheckCard config={card} /> |
| | | } |
| | | |
| | | return ( |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | |
| | | required={card.required === 'true'} |
| | | help={showField ? card.field + (card.datefield ? ', ' + card.datefield : '') : ''} |
| | | > |
| | | {card.type === 'text' ? |
| | | <Input style={{marginTop: '4px'}} value={card.initval} /> : null |
| | | } |
| | | {(card.type === 'multiselect' || card.type === 'select' || card.type === 'link') ? |
| | | <Select value={_defaultValue}></Select> : null |
| | | } |
| | | {card.type === 'date' ? |
| | | <DatePicker value={card.initval ? moment().subtract(card.initval, 'days') : null} /> : null |
| | | } |
| | | {card.type === 'dateweek' ? |
| | | <WeekPicker value={card.initval ? moment().subtract(card.initval * 7, 'days') : null} /> : null |
| | | } |
| | | {card.type === 'datemonth' ? |
| | | <MonthPicker value={card.initval ? moment().subtract(card.initval, 'month') : null} /> : null |
| | | } |
| | | {card.type === 'daterange' ? |
| | | <RangePicker |
| | | className="data-range" |
| | | placeholder={['BeginTime', 'EndTime']} |
| | | renderExtraFooter={() => 'extra footer'} |
| | | value={_defaultValue} |
| | | /> : null |
| | | } |
| | | {card.type === 'group' ? <DateGroup card={card} /> : null } |
| | | {formItem} |
| | | </Form.Item> |
| | | </div> |
| | | </div> |
| | |
| | | newcard.display = 'dropdown' |
| | | |
| | | let _match = 'like' |
| | | if (item.subType === 'select' || item.subType === 'link') { |
| | | if (item.subType === 'select' || item.subType === 'link' || item.subType === 'checkcard') { |
| | | _match = '=' |
| | | } else if (item.subType === 'date' || item.subType === 'datemonth') { |
| | | _match = '>=' |
| | |
| | | return |
| | | } |
| | | |
| | | if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) { |
| | | if (['checkcard', 'select', 'multiselect', 'link'].includes() && res.resourceType === '1' && /\s/.test(res.dataSource)) { |
| | | this.setState({ |
| | | sqlVerifing: true |
| | | }) |
| | |
| | | min-width: 100px!important; |
| | | width: 100%; |
| | | } |
| | | .check-card-edit-box { |
| | | margin-top: 5px!important; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | handleDelete = key => { |
| | | const dataSource = [...this.state.dataSource] |
| | | this.setState({ dataSource: dataSource.filter(item => item.key !== key) }) |
| | | const dataSource = this.state.dataSource.filter(item => item.key !== key) |
| | | this.setState({ dataSource }) |
| | | this.props.onChange && this.props.onChange(dataSource) |
| | | } |
| | | |
| | | handleAdd = () => { |
| | |
| | | if (type === 'link') { |
| | | newData.ParentID = `${count}` |
| | | } |
| | | let data = [...dataSource, newData] |
| | | this.setState({ |
| | | dataSource: [...dataSource, newData], |
| | | dataSource: data, |
| | | count: count + 1 |
| | | }) |
| | | this.props.onChange && this.props.onChange(data) |
| | | } |
| | | |
| | | handleSave = row => { |
| | |
| | | ...row |
| | | }) |
| | | this.setState({ dataSource: newData }) |
| | | this.props.onChange && this.props.onChange(newData) |
| | | } |
| | | |
| | | resetColumn = (type) => { |
| | |
| | | import EditTable from '../searcheditable' |
| | | import Utils from '@/utils/utils.js' |
| | | import CodeMirror from '@/templates/zshare/codemirror' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | | const ColorSketch = asyncComponent(() => import('@/mob/colorsketch')) |
| | | const FieldsTable = asyncComponent(() => import('@/templates/zshare/modalform/fieldtable')) |
| | | const DataTable = asyncComponent(() => import('@/templates/zshare/modalform/datatable')) |
| | | |
| | | const groupOptions = [ |
| | | { |
| | |
| | | multiselect: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced'], |
| | | link: ['label', 'field', 'resourceType', 'initval', 'type', 'linkField', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll'], |
| | | date: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced'], |
| | | checkcard: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'resourceType', 'display', 'width', 'multiple', 'borderColor', 'required', 'Hide', 'labelShow', 'advanced'], |
| | | dateweek: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced'], |
| | | datemonth: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced'], |
| | | daterange: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced'], |
| | |
| | | openType: null, // 搜索条件显示类型 |
| | | resourceType: null, // 下拉搜索时,选项来源类型 |
| | | formlist: null, // 表单 |
| | | display: null, |
| | | cFields: [], |
| | | textTooltip: '字段名可以使用逗号分隔,进行综合搜索', |
| | | } |
| | | |
| | |
| | | UNSAFE_componentWillMount () { |
| | | const { formlist, dict } = this.props |
| | | |
| | | let type = formlist.filter(cell => cell.key === 'type')[0].initVal |
| | | let _items = formlist.filter(cell => cell.key === 'items')[0].initVal |
| | | let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal |
| | | let type = '' |
| | | let _items = [] |
| | | let resourceType = '' |
| | | let display = '' |
| | | let cFields = [] |
| | | |
| | | let _options = this.getOptions(type, resourceType) |
| | | formlist.forEach(cell => { |
| | | if (cell.key === 'type') { |
| | | type = cell.initVal |
| | | } else if (cell.key === 'items') { |
| | | _items = cell.initVal |
| | | } else if (cell.key === 'display') { |
| | | display = cell.initVal |
| | | } else if (cell.key === 'resourceType') { |
| | | resourceType = cell.initVal |
| | | } else if (cell.key === 'fields') { |
| | | cFields = cell.initVal |
| | | } |
| | | }) |
| | | |
| | | let _options = this.getOptions(type, resourceType, display) |
| | | |
| | | this.setState({ |
| | | display, |
| | | cFields, |
| | | openType: type, |
| | | items: _items, |
| | | resourceType: resourceType, |
| | | resourceType, |
| | | formlist: formlist.map(form => { |
| | | // 表单为初始值字段,且数据类型属于时间类型时,设置初始值为下拉选择,并重置选择项 |
| | | if (form.key === 'initval' && dateOptions.hasOwnProperty(type)) { |
| | |
| | | form.options = matchReg.text |
| | | } else if (type === 'multiselect') { |
| | | form.options = matchReg.multiselect |
| | | } else if (type === 'select' || type === 'link') { |
| | | } else if (type === 'select' || type === 'link' || type === 'checkcard') { |
| | | form.options = matchReg.select |
| | | } else if (type === 'date') { |
| | | form.options = matchReg.date |
| | |
| | | } |
| | | } |
| | | |
| | | getOptions = (type, resourceType) => { |
| | | getOptions = (type, resourceType, display) => { |
| | | let _options = fromJS(searchTypeOptions[type]).toJS() // 选项列表 |
| | | |
| | | if (['multiselect', 'select', 'link'].includes(type) && resourceType === '0') { // 下拉选择类型、选项为自定义资源 |
| | | _options.push('options') |
| | | } else if (['multiselect', 'select', 'link'].includes(type) && resourceType === '1') { // 下拉选择类型、选项为后台数据源中获取 |
| | | _options.push('dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database') |
| | | } else if (type === 'checkcard') { |
| | | if (display === 'picture') { |
| | | if (resourceType === '0') { // 自定义资源 |
| | | _options.push('options', 'picratio') |
| | | } else if (resourceType === '1') { // 数据源 |
| | | _options.push('dataSource', 'cardValField', 'urlField', 'orderBy', 'orderType', 'database', 'picratio') |
| | | } |
| | | } else { |
| | | if (resourceType === '0') { // 自定义资源 |
| | | _options.push('options', 'fields', 'backgroundColor') |
| | | } else if (resourceType === '1') { // 数据源 |
| | | _options.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'database', 'backgroundColor') |
| | | } |
| | | } |
| | | } |
| | | |
| | | return _options |
| | |
| | | */ |
| | | openTypeChange = (key, value) => { |
| | | const { dict } = this.props |
| | | const { resourceType, items } = this.state |
| | | const { resourceType, items, display } = this.state |
| | | |
| | | if (key === 'type') { |
| | | let _options = this.getOptions(value, resourceType) |
| | | let _options = this.getOptions(value, resourceType, display) |
| | | let matchs = [] |
| | | |
| | | this.setState({ |
| | |
| | | form.options = matchReg.text |
| | | } else if (value === 'multiselect') { |
| | | form.options = matchReg.multiselect |
| | | } else if (value === 'select' || value === 'link') { |
| | | } else if (value === 'select' || value === 'link' || value === 'checkcard') { |
| | | form.options = matchReg.select |
| | | } else if (value === 'date') { |
| | | form.options = matchReg.date |
| | |
| | | * @description 数据源类型切换 |
| | | */ |
| | | onChange = (e, key) => { |
| | | const { openType } = this.state |
| | | const { openType, display, resourceType } = this.state |
| | | let value = e.target.value |
| | | |
| | | if (key === 'resourceType') { |
| | | let _options = this.getOptions(openType, value) |
| | | let _options = this.getOptions(openType, value, display) |
| | | |
| | | this.setState({ |
| | | resourceType: value, |
| | |
| | | return form |
| | | }) |
| | | }) |
| | | } else if (key === 'display') { |
| | | let _options = this.getOptions(openType, resourceType, value) |
| | | |
| | | this.setState({ |
| | | display: value, |
| | | formlist: this.state.formlist.map(form => { |
| | | form.hidden = !_options.includes(form.key) |
| | | return form |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | changeField = (data) => { |
| | | this.setState({ |
| | | cFields: data, |
| | | formlist: this.state.formlist.map(form => { |
| | | if (form.key === 'fields') { |
| | | form.initVal = data |
| | | } |
| | | return form |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | checkChange = (values, key) => { |
| | |
| | | ) |
| | | } else if (item.type === 'textarea') { |
| | | fields.push( |
| | | <Col span={20} offset={4} key={index}> |
| | | <Form.Item className="text-area"> |
| | | <Col span={24} key={index}> |
| | | <Form.Item className="text-area" label={item.label}> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal, |
| | | rules: [ |
| | |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'options') { |
| | | if (openType !== 'checkcard') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.label} className="text-area"> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal |
| | | })(<EditTable dict={this.props.dict} type={this.state.openType} data={item.initVal}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.label} className="text-area"> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal |
| | | })(<DataTable dict={this.props.dict} type={this.state.display} fields={this.state.cFields}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } |
| | | } else if (item.type === 'fields') { |
| | | fields.push( |
| | | <Col span={20} offset={4} key={index}> |
| | | <EditTable data={item.initVal} type={this.state.openType} dict={this.props.dict} ref="editTable"/> |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.label} className="text-area"> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal |
| | | })(<FieldsTable dict={this.props.dict} onChange={this.changeField}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'checkbox') { |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'color') { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label} className="color-form-item"> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal |
| | | })(<ColorSketch allowClear={true}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } |
| | | }) |
| | | |
| | |
| | | let isvalid = true |
| | | values.uuid = this.props.card.uuid |
| | | // 下拉菜单或联动菜单 |
| | | if ((values.type === 'multiselect' || values.type === 'select' || values.type === 'link') && values.resourceType === '0') { |
| | | values.options = this.refs.editTable.state.dataSource |
| | | if (['multiselect', 'select', 'link', 'checkcard'].includes(values.type) && values.resourceType === '0') { |
| | | values.options = values.options || [] |
| | | values.dataSource = '' |
| | | let emptys = [] |
| | | if (values.type === 'multiselect' || values.type === 'select') { |
| | | if (['multiselect', 'select'].includes(values.type)) { |
| | | emptys = values.options.filter(op => !(op.Value && op.Text)) |
| | | } else { |
| | | } else if (values.type === 'link') { |
| | | emptys = values.options.filter(op => !(op.Value && op.Text && op.ParentID)) |
| | | } |
| | | if (emptys.length > 0) { |
| | | isvalid = false |
| | | } |
| | | } else if ((values.type === 'multiselect' || values.type === 'select' || values.type === 'link') && values.resourceType === '1') { |
| | | } else if (['multiselect', 'select', 'link', 'checkcard'].includes(values.type) && values.resourceType === '1') { |
| | | values.options = [] |
| | | } |
| | | |
| | | console.log(values) |
| | | |
| | | if (isvalid) { |
| | | ['linkField', 'valueField', 'valueText', 'orderBy'].forEach(item => { |
| | | if (values[item]) { |
| | |
| | | padding-bottom: 20px; |
| | | } |
| | | .ant-form-item.text-area { |
| | | margin-bottom: 0px; |
| | | // margin-bottom: 0px; |
| | | .ant-form-item-control-wrapper { |
| | | width: 100%; |
| | | width: 84%; |
| | | } |
| | | .ant-form-item-label { |
| | | width: 16%; |
| | | } |
| | | .CodeMirror { |
| | | height: 150px; |
| | |
| | | } |
| | | } |
| | | } |
| | | .color-form-item { |
| | | .ant-form-item-control { |
| | | height: 40px; |
| | | .color-sketch-block { |
| | | margin-top: 7px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | }, |
| | | { |
| | | type: 'search', |
| | | label: '选项卡', |
| | | subType: 'checkcard', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'search', |
| | | label: CommonDict['model.form.dateday'], |
| | | subType: 'date', |
| | | url: '' |
| | |
| | | // form: text number select multiselect link switch checkbox radio checkcard |
| | | // fileupload date datemonth datetime textarea hint color funcvar |
| | | if (res.copyType === 'form') { |
| | | if (['number', 'switch', 'textarea', 'checkcard', 'fileupload', 'hint', 'color', 'funcvar'].includes(res.type)) { |
| | | if (['number', 'switch', 'textarea', 'fileupload', 'hint', 'color', 'funcvar'].includes(res.type)) { |
| | | res.type = 'text' |
| | | } else if (res.type === 'radio') { |
| | | res.type = 'select' |
| | |
| | | roleList = [] |
| | | } |
| | | |
| | | let typeOptions = [] |
| | | |
| | | if (sessionStorage.getItem('appType') === 'mob') { |
| | | typeOptions = [{ |
| | | value: 'text', |
| | | text: Formdict['model.form.text'] |
| | | }, { |
| | | value: 'checkcard', |
| | | text: '选项卡' |
| | | }, { |
| | | value: 'date', |
| | | text: Formdict['model.form.dateday'] |
| | | }, { |
| | | value: 'datemonth', |
| | | text: Formdict['model.form.datemonth'] |
| | | }] |
| | | if (!['text', 'checkcard', 'date', 'datemonth'].includes(card.type)) { |
| | | card.type = 'text' |
| | | } |
| | | } else { |
| | | typeOptions = [{ |
| | | value: 'text', |
| | | text: Formdict['model.form.text'] |
| | | }, { |
| | | value: 'select', |
| | | text: Formdict['model.form.select'] |
| | | }, { |
| | | value: 'multiselect', |
| | | text: Formdict['model.form.multiselect'] |
| | | }, { |
| | | value: 'link', |
| | | text: Formdict['model.form.link'] |
| | | }, { |
| | | value: 'checkcard', |
| | | text: '选项卡' |
| | | }, { |
| | | value: 'date', |
| | | text: Formdict['model.form.dateday'] |
| | | }, { |
| | | value: 'dateweek', |
| | | text: Formdict['model.form.dateweek'] |
| | | }, { |
| | | value: 'datemonth', |
| | | text: Formdict['model.form.datemonth'] |
| | | }, { |
| | | value: 'daterange', |
| | | text: Formdict['model.form.daterange'] |
| | | }, { |
| | | value: 'group', |
| | | text: Formdict['model.form.dategroup'] |
| | | }] |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'text', |
| | |
| | | label: Formdict['model.form.type'], |
| | | initVal: card.type, |
| | | required: true, |
| | | options: [{ |
| | | value: 'text', |
| | | text: Formdict['model.form.text'] |
| | | }, { |
| | | value: 'select', |
| | | text: Formdict['model.form.select'] |
| | | }, { |
| | | value: 'multiselect', |
| | | text: Formdict['model.form.multiselect'] |
| | | }, { |
| | | value: 'link', |
| | | text: Formdict['model.form.link'] |
| | | }, { |
| | | value: 'date', |
| | | text: Formdict['model.form.dateday'] |
| | | }, { |
| | | value: 'dateweek', |
| | | text: Formdict['model.form.dateweek'] |
| | | }, { |
| | | value: 'datemonth', |
| | | text: Formdict['model.form.datemonth'] |
| | | }, { |
| | | value: 'daterange', |
| | | text: Formdict['model.form.daterange'] |
| | | }, { |
| | | value: 'group', |
| | | text: Formdict['model.form.dategroup'] |
| | | }] |
| | | options: typeOptions |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'display', |
| | | label: '显示', |
| | | initVal: card.display || 'text', |
| | | required: true, |
| | | options: [{ |
| | | value: 'text', |
| | | text: '文本' |
| | | }, { |
| | | value: 'picture', |
| | | text: '图片' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 1, |
| | | max: 24, |
| | | precision: 0, |
| | | label: '卡片宽度', |
| | | initVal: card.width || 4, |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'cardValField', |
| | | label: Formdict['header.form.valueField'], |
| | | initVal: card.cardValField || 'Value', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'urlField', |
| | | label: '地址字段', |
| | | initVal: card.urlField || '', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'picratio', |
| | | label: '图片比例', |
| | | initVal: card.picratio || '1:1', |
| | | required: true, |
| | | options: [{ |
| | | value: '1:1', |
| | | text: '1:1' |
| | | }, { |
| | | value: '3:2', |
| | | text: '3:2' |
| | | }, { |
| | | value: '4:3', |
| | | text: '4:3' |
| | | }, { |
| | | value: '16:9', |
| | | text: '16:9' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'fields', |
| | | key: 'fields', |
| | | label: '字段集', |
| | | initVal: card.fields || [], |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'dataSource', |
| | | label: Formdict['header.form.datasource'], |
| | |
| | | { |
| | | type: 'options', |
| | | key: 'options', |
| | | label: '', |
| | | label: '选项', |
| | | initVal: card.options || [], |
| | | required: true, |
| | | readonly: false |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'multiple', |
| | | label: '可多选', |
| | | initVal: card.multiple || 'false', |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'required', |
| | | label: Formdict['model.required'], |
| | | initVal: card.required || 'false', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'color', |
| | | key: 'backgroundColor', |
| | | label: '背景色', |
| | | initVal: card.backgroundColor || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'color', |
| | | key: 'borderColor', |
| | | label: '边框颜色', |
| | | initVal: card.borderColor || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'blacklist', |
| | | label: Formdict['header.form.blacklist'], |
| | |
| | | import { dateOptions } from '@/utils/option.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import EditTable from './modaleditable' |
| | | import DataTable from './datatable' |
| | | import FieldsTable from './fieldtable' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import CodeMirror from '@/templates/zshare/codemirror' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | | const ColorSketch = asyncComponent(() => import('@/mob/colorsketch')) |
| | | const FieldsTable = asyncComponent(() => import('./fieldtable')) |
| | | const DataTable = asyncComponent(() => import('./datatable')) |
| | | |
| | | const modalTypeOptions = { |
| | | text: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'regular', 'interception', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'cursor', 'scan'], |
| | |
| | | } else if (item.type === 'checkcard') { |
| | | arrfield = item.fields.map(f => f.field) |
| | | arrfield.push(item.cardValField) |
| | | if (item.urlField) { |
| | | arrfield.push(item.urlField) |
| | | } |
| | | } |
| | | |
| | | arrfield = Array.from(new Set(arrfield)) |
| | |
| | | SndID: parMenuId, |
| | | ParentID: parMenuId, |
| | | MenuID: item.uuid, |
| | | MenuNo: item.wrap.MenuNo || '', |
| | | MenuNo: item.wrap.MenuNo || Utils.getuuid(), |
| | | EasyCode: '', |
| | | Template: item.type, |
| | | TypeCharOne: sessionStorage.getItem('kei_no'), |
| | |
| | | SndID: parMenuId, |
| | | ParentID: parMenuId, |
| | | MenuID: item.uuid, |
| | | MenuNo: item.wrap.MenuNo || '', |
| | | MenuNo: item.wrap.MenuNo || Utils.getuuid(), |
| | | EasyCode: '', |
| | | Template: item.type, |
| | | TypeCharOne: sessionStorage.getItem('kei_no'), |