| | |
| | | import React from 'react' |
| | | import { useDrag, useDrop } from 'react-dnd' |
| | | import { Select, DatePicker, Input, Popover, Form, Switch, Checkbox } from 'antd' |
| | | import { Select, Radio, DatePicker, Input, Popover, Form, Switch, Checkbox } from 'antd' |
| | | import { CopyOutlined, EditOutlined, CloseOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | |
| | | formItem = <CheckCard config={card} /> |
| | | } else if (card.type === 'switch') { |
| | | formItem = (<Switch checkedChildren={card.openText || ''} unCheckedChildren={card.closeText || ''} style={{marginTop: '8px'}} checked={card.initval === card.openVal}/>) |
| | | } else if (card.type === 'radio') { |
| | | let options = card.options |
| | | if (options.length === 0) { |
| | | options = [{Value: '1', Text: '选项1'}, {Value: '2', Text: '选项2'}] |
| | | } |
| | | formItem = (<Radio.Group value={card.initval} style={{lineHeight: '36px'}}> |
| | | {options.map((item, i) => (<Radio key={i} value={item.Value}> {item.Text} </Radio>))} |
| | | </Radio.Group>) |
| | | } else if (card.type === 'check') { |
| | | formItem = <Checkbox style={{lineHeight: '36px'}} checked={card.initval === card.openVal}>{card.checkTip || ''}</Checkbox> |
| | | } |
| | |
| | | } |
| | | |
| | | getrolelist = () => { |
| | | // Api.getSystemConfig({func: 's_get_rolelist', OrderCol: 'RoleID desc', PageIndex: 1, PageSize: 1000}).then(res => { |
| | | Api.genericInterface({func: 's_get_organizations_v1'}).then(res => { |
| | | if (!res.status) { |
| | | notification.error({ |
| | |
| | | <Col span={12}> |
| | | <Form.Item label="文件夹"> |
| | | {getFieldDecorator('data_code', { |
| | | initialValue: '', |
| | | initialValue: files[0] ? files[0].data_code : '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | |
| | | list = list.map(item => { |
| | | item.icon = this.getIcon(item.attachments_url) |
| | | item.name = this.getName(item.attachments_url) |
| | | return item |
| | | }) |
| | | |
| | |
| | | file.attachments = file.attachments.map(item => { |
| | | item.id = item.attach_id |
| | | item.icon = this.getIcon(item.attachments_url) |
| | | item.name = this.getName(item.attachments_url) |
| | | item.data_code = file.data_code |
| | | item.data_name = file.data_name |
| | | item.BID = file.id |
| | |
| | | } |
| | | |
| | | item.icon = this.getIcon(res.url) |
| | | item.name = this.getName(res.url) |
| | | |
| | | list.push(item) |
| | | |
| | |
| | | |
| | | deleteFile = (id) => { |
| | | this.setState({list: this.state.list.filter(item => item.id !== id)}) |
| | | } |
| | | |
| | | getName = (url) => { |
| | | if (!url || !/\//.test(url)) return url |
| | | |
| | | let names = url.split('/') |
| | | |
| | | return names[names.length - 1] |
| | | } |
| | | |
| | | getIcon = (url) => { |
| | |
| | | return <div className="attach-item" key={item.id}> |
| | | <img src={item.icon} alt=""/> |
| | | <div className="attach-msg"> |
| | | <div>{item.attachments_title}</div> |
| | | <div>{item.data_name ? item.data_name + ' / ' : ''}{item.name}</div> |
| | | {/* <div>{item.attachments_title}</div> */} |
| | | <div>{item.data_name ? item.data_name + ' / ' : ''}{item.attachments_title}</div> |
| | | </div> |
| | | <div> |
| | | <DeleteOutlined onClick={() => this.deleteFile(item.id)}/> |
| | |
| | | flex: 1; |
| | | width: calc(100% - 95px); |
| | | padding: 5px 0px; |
| | | line-height: 45px; |
| | | div { |
| | | color: #000000; |
| | | overflow: hidden; |
| | |
| | | |
| | | let _searchId = searchId |
| | | |
| | | tab.components.forEach(cell => { |
| | | if (cell.type !== 'search') return |
| | | _searchId = cell.uuid |
| | | window.GLOB.SearchBox.set(cell.uuid, cell.$searches) |
| | | if (cell.$s_req) { |
| | | window.GLOB.SearchBox.set(cell.uuid + 'required', true) |
| | | } |
| | | }) |
| | | if (tab.components.findIndex(cell => cell.type === 'search') > -1) { |
| | | _searchId = tab.uuid |
| | | } |
| | | |
| | | tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, time, MenuName, _searchId, tab.uuid) |
| | | |
| | | if (_searchId === tab.uuid) { |
| | | tab.components.forEach(cell => { |
| | | if (cell.type !== 'search') return |
| | | window.GLOB.SearchBox.set(_searchId, cell.$searches) |
| | | if (cell.$s_req) { |
| | | window.GLOB.SearchBox.set(_searchId + 'required', true) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | return tab |
| | | }) |
| | | |
| | |
| | | } |
| | | |
| | | // 搜索条件初始化 |
| | | if (item.type === 'search' && item.search.length === 0) { |
| | | return false |
| | | } else if (item.search) { |
| | | if (item.search) { |
| | | Utils.initSearchVal(item) |
| | | |
| | | item.$searches = Utils.initMainSearch(item.search) |
| | |
| | | |
| | | let _searchId = searchId |
| | | |
| | | tab.components.forEach(cell => { |
| | | if (cell.type !== 'search') return |
| | | _searchId = cell.uuid |
| | | window.GLOB.SearchBox.set(cell.uuid, cell.$searches) |
| | | if (cell.$s_req) { |
| | | window.GLOB.SearchBox.set(cell.uuid + 'required', true) |
| | | } |
| | | }) |
| | | if (tab.components.findIndex(cell => cell.type === 'search') > -1) { |
| | | _searchId = tab.uuid |
| | | } |
| | | |
| | | tab.components = this.filterComponent(tab.components, roleId, balMap, urlparam, Tab, _searchId, tab.uuid) |
| | | |
| | | if (_searchId === tab.uuid) { |
| | | tab.components.forEach(cell => { |
| | | if (cell.type !== 'search') return |
| | | window.GLOB.SearchBox.set(_searchId, cell.$searches) |
| | | if (cell.$s_req) { |
| | | window.GLOB.SearchBox.set(_searchId + 'required', true) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | return tab |
| | | }) |
| | | |
| | |
| | | } |
| | | |
| | | // 搜索条件初始化 |
| | | if (item.type === 'search' && item.search.length === 0) { |
| | | return false |
| | | } else if (item.search) { |
| | | if (item.search) { |
| | | Utils.initSearchVal(item) |
| | | |
| | | item.$searches = Utils.initMainSearch(item.search) |
| | |
| | | |
| | | const MKCheckCard = asyncComponent(() => import('@/tabviews/zshare/mutilform/mkCheckCard')) |
| | | const MKSelect = asyncComponent(() => import('../mkSelect')) |
| | | const MKCheck = asyncComponent(() => import('@/tabviews/zshare/mutilform/mkCheck')) |
| | | const MKSwitch = asyncComponent(() => import('@/tabviews/zshare/mutilform/mkSwitch')) |
| | | const MKRadio = asyncComponent(() => import('../mkRadio')) |
| | | const MKDatePicker = asyncComponent(() => import('../mkDatePicker')) |
| | | |
| | | class AdvanceSearch extends Component { |
| | |
| | | content = (<MKDatePicker config={item}/>) |
| | | } else if (item.type === 'checkcard') { |
| | | content = <MKCheckCard config={item}/> |
| | | } else if (item.type === 'radio') { |
| | | content = <MKRadio config={item} onChange={(val) => this.recordChange(val, false, item)} /> |
| | | } else if (item.type === 'check') { |
| | | content = <MKCheck config={item}/> |
| | | } else if (item.type === 'switch') { |
| | | content = <MKSwitch config={item}/> |
| | | } |
| | | |
| | | if (content) { |
| | |
| | | const MKCheckCard = asyncComponent(() => import('./mkCheckCard')) |
| | | const MKCheck = asyncComponent(() => import('@/tabviews/zshare/mutilform/mkCheck')) |
| | | const MKSwitch = asyncComponent(() => import('@/tabviews/zshare/mutilform/mkSwitch')) |
| | | const MKRadio = asyncComponent(() => import('./mkRadio')) |
| | | const MKSelect = asyncComponent(() => import('./mkSelect')) |
| | | const DateGroup = asyncComponent(() => import('./dategroup')) |
| | | const MKDatePicker = asyncComponent(() => import('./mkDatePicker')) |
| | |
| | | record[item.field] = item.initval |
| | | } |
| | | |
| | | if (['select', 'link', 'multiselect', 'checkcard'].includes(item.type)) { |
| | | if (['select', 'link', 'multiselect', 'checkcard', 'radio'].includes(item.type)) { |
| | | item.options = item.options || [] |
| | | item.options = item.options.filter(op => !op.Hide) |
| | | if (item.setAll === 'true' && ['select', 'link'].includes(item.type)) { |
| | |
| | | |
| | | resetSearch = (result) => { |
| | | let _searchlist = fromJS(this.state.searchlist).toJS().map(item => { |
| | | if (['select', 'link', 'multiselect', 'checkcard'].includes(item.type) && result[item.field] && result[item.field].length > 0) { |
| | | if (['select', 'link', 'multiselect', 'checkcard', 'radio'].includes(item.type) && result[item.field] && result[item.field].length > 0) { |
| | | let options = [] |
| | | let map = new Map() |
| | | let all = false |
| | |
| | | content = <DateGroup position={index} config={item} onChange={(val, type) => this.dateGroupChange(val, type, item)} /> |
| | | } else if (item.type === 'checkcard') { |
| | | content = <MKCheckCard config={item} onChange={(val) => this.cardChange(val, item)} /> |
| | | } else if (item.type === 'radio') { |
| | | content = <MKRadio config={item} onChange={(val) => this.recordChange(val, false, item)} /> |
| | | } else if (item.type === 'check') { |
| | | content = <MKCheck config={item} onChange={(val) => this.recordChange(val, false, item)} /> |
| | | } else if (item.type === 'switch') { |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Radio } from 'antd' |
| | | |
| | | class MKRadio extends Component { |
| | | static propTpyes = { |
| | | config: PropTypes.object, |
| | | onChange: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | | value: '', |
| | | config: null, |
| | | options: [] |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config } = this.props |
| | | let value = config.initval |
| | | |
| | | if (value) { |
| | | let option = null |
| | | option= config.oriOptions[0] |
| | | if (typeof(value) === 'string' && option && typeof(option.value) === 'number') { |
| | | value = +value |
| | | if (isNaN(value)) { |
| | | value = config.initval |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | config: fromJS(config).toJS(), |
| | | options: fromJS(config.options).toJS(), |
| | | value, |
| | | }) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { config } = this.state |
| | | |
| | | if (!is(fromJS(config.oriOptions), fromJS(nextProps.config.oriOptions))) { |
| | | this.setState({ |
| | | config: fromJS(nextProps.config).toJS(), |
| | | options: fromJS(nextProps.config.options).toJS() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | onChange = (val) => { |
| | | this.props.onChange(val) |
| | | this.setState({value: val}) |
| | | } |
| | | |
| | | render() { |
| | | const { value, options } = this.state |
| | | |
| | | return ( |
| | | <Radio.Group value={value} onChange={(e) => this.onChange(e.target.value)}> |
| | | {options.map(option => <Radio key={option.key} value={option.Value}>{option.Text}</Radio>)} |
| | | </Radio.Group> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default MKRadio |
| | |
| | | const searchTypeOptions = { |
| | | text: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'inputType', 'advanced', 'query', 'labelwidth'], |
| | | select: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll', 'dropdown', 'query', 'labelwidth'], |
| | | radio: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll', 'query', 'labelwidth'], |
| | | multiselect: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], |
| | | link: ['label', 'field', 'resourceType', 'initval', 'type', 'linkField', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll', 'dropdown', 'query', 'labelwidth'], |
| | | date: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'precision', 'labelwidth'], |
| | |
| | | let reRequired = {} |
| | | let reLabel = {} |
| | | |
| | | if (['multiselect', 'select', 'link'].includes(type)) { |
| | | if (['multiselect', 'select', 'link', 'radio'].includes(type)) { |
| | | reRequired.linkField = true |
| | | if (this.record.resourceType === '0') { // 自定义资源 |
| | | shows.push('options') |
| | |
| | | uuid: key |
| | | }] |
| | | } |
| | | } else if (['multiselect', 'select', 'link'].includes(value)) { |
| | | } else if (['multiselect', 'select', 'link', 'radio'].includes(value)) { |
| | | if (!this.record.options[0].Text && this.record.fields.length > 0) { |
| | | let field = this.record.fields[0].field |
| | | |
| | |
| | | if (!err) { |
| | | values.uuid = this.props.card.uuid |
| | | // 下拉菜单或联动菜单 |
| | | if (['multiselect', 'select', 'link'].includes(values.type)) { |
| | | if (['multiselect', 'select', 'link', 'radio'].includes(values.type)) { |
| | | if (values.resourceType === '0') { |
| | | values.options = values.options || [] |
| | | values.dataSource = '' |
| | |
| | | value: 'switch', |
| | | text: '开关' |
| | | }, { |
| | | value: 'radio', |
| | | text: '单选框' |
| | | }, { |
| | | value: 'check', |
| | | text: '勾选框' |
| | | }] |
| | |
| | | if (card.focus) { |
| | | if (['text', 'multiselect'].includes(card.type)) { |
| | | card.match = 'like' |
| | | } else if (['select', 'link', 'checkcard'].includes(card.type)) { |
| | | } else if (['select', 'link', 'checkcard', 'radio'].includes(card.type)) { |
| | | card.match = '=' |
| | | } else if (card.type === 'date') { |
| | | card.match = '>=' |