| | |
| | | } |
| | | |
| | | const { index: overIndex } = findCard(id) |
| | | |
| | | const _cards = update(cards, { $splice: [[overIndex + 1, 0, copycard]] }) |
| | | |
| | | handleList(_cards, copycard) |
| | |
| | | /** |
| | | * @description 搜索条件顺序调整,或拖拽添加 |
| | | */ |
| | | handleList = (list, card) => { |
| | | const { config } = this.props |
| | | handleList = (list, newcell) => { |
| | | const { card } = this.state |
| | | let _card = {...card, search: list} |
| | | |
| | | if (card) { |
| | | this.setState({searchlist: list}) |
| | | this.handleSearch(card) |
| | | if (newcell) { |
| | | this.setState({card: _card}) |
| | | this.handleSearch(newcell) |
| | | } else { |
| | | this.setState({searchlist: list}, ()=> { |
| | | this.props.updatesearch({...config, search: list}) |
| | | this.setState({card: _card}, ()=> { |
| | | this.props.updateConfig(_card) |
| | | }) |
| | | } |
| | | } |
| | |
| | | * @description 取消保存,如果元素为新添元素,则从序列中删除 |
| | | */ |
| | | editModalCancel = () => { |
| | | const { card } = this.state |
| | | const { card, editcard } = this.state |
| | | |
| | | if (card.focus) { |
| | | let searchlist = fromJS(this.state.searchlist).toJS() |
| | | |
| | | searchlist = searchlist.filter(item => item.uuid !== card.uuid) |
| | | if (editcard.focus) { |
| | | card.search = card.search.filter(item => item.uuid !== editcard.uuid) |
| | | |
| | | this.setState({ |
| | | card: null, |
| | | searchlist: searchlist, |
| | | card: card, |
| | | editcard: null, |
| | | visible: false |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | card: null, |
| | | editcard: null, |
| | | visible: false |
| | | }) |
| | | } |
| | |
| | | |
| | | /** |
| | | * @description 搜索修改后提交保存 |
| | | * 1、去除系统默认搜索条件 |
| | | * 2、字段及提示文字重复校验 |
| | | * 3、更新下拉菜单可选集合 |
| | | * 4、下拉菜单数据源语法验证 |
| | | * 1、字段及提示文字重复校验 |
| | | * 2、下拉菜单数据源语法验证 |
| | | */ |
| | | handleSubmit = () => { |
| | | const { config } = this.props |
| | | let _searchlist = fromJS(this.state.searchlist).toJS() |
| | | let card = fromJS(this.state.card).toJS() |
| | | |
| | | this.searchFormRef.handleConfirm().then(res => { |
| | | let fieldrepet = false // 字段重复 |
| | | let labelrepet = false // 提示文字重复 |
| | | |
| | | _searchlist = _searchlist.filter(item => !item.origin || item.uuid === res.uuid) // 去除系统项 |
| | | |
| | | _searchlist = _searchlist.map(item => { // 数据更新及重复检测 |
| | | card.search = card.search.map(item => { // 数据更新及重复检测 |
| | | if (item.uuid !== res.uuid && res.field && item.field) { |
| | | let itemFields = [] |
| | | if (item.type === 'text') { |
| | |
| | | return |
| | | } |
| | | |
| | | if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) { |
| | | if (['select', 'multiselect', 'link'].includes(res.type) && res.resourceType === '1' && /\s/.test(res.dataSource)) { |
| | | this.setState({ |
| | | sqlVerifing: true |
| | | }) |
| | |
| | | Api.getLocalConfig(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | card: card, |
| | | sqlVerifing: false, |
| | | searchlist: _searchlist, |
| | | visible: false |
| | | }, ()=> { |
| | | this.props.updatesearch({...config, search: _searchlist}) |
| | | this.props.updateConfig(card) |
| | | }) |
| | | } else { |
| | | this.setState({sqlVerifing: false}) |
| | |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | searchlist: _searchlist, |
| | | card: card, |
| | | visible: false |
| | | }, ()=> { |
| | | this.props.updatesearch({...config, search: _searchlist}) |
| | | this.props.updateConfig(card) |
| | | }) |
| | | } |
| | | }) |
| | |
| | | /** |
| | | * @description 搜索条件删除 |
| | | */ |
| | | deleteElement = (card) => { |
| | | const { config } = this.props |
| | | deleteElement = (cell) => { |
| | | const { dict } = this.state |
| | | let _this = this |
| | | |
| | | confirm({ |
| | | content: dict['model.confirm'] + dict['model.delete'] + ` - ${card.label} ?`, |
| | | content: dict['model.confirm'] + dict['model.delete'] + ` - ${cell.label} ?`, |
| | | onOk() { |
| | | let _searchlist = fromJS(_this.state.searchlist).toJS() |
| | | |
| | | _searchlist = _searchlist.filter(item => item.uuid !== card.uuid) |
| | | let _card = fromJS(_this.state.card).toJS() |
| | | _card.search = _card.search.filter(item => item.uuid !== cell.uuid) |
| | | |
| | | _this.setState({ |
| | | searchlist: _searchlist |
| | | card: _card |
| | | }, () => { |
| | | _this.props.updatesearch({...config, search: _searchlist}) |
| | | _this.props.updateConfig(_card) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | } |
| | | card.search.push(item) |
| | | |
| | | this.setState({card}) |
| | | this.setState({card}, () => { |
| | | this.handleSearch(item) |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | |
| | | > |
| | | <SearchForm |
| | | dict={dict} |
| | | card={this.state.card} |
| | | card={this.state.editcard} |
| | | formlist={this.state.formlist} |
| | | inputSubmit={this.handleSubmit} |
| | | wrappedComponentRef={(inst) => this.searchFormRef = inst} |
| | |
| | | line: '折线图', |
| | | tabs: '标签组', |
| | | pie: '饼图', |
| | | search: '搜索', |
| | | card: '卡片' |
| | | } |
| | | let i = 1 |
| | |
| | | isNew: true // 新添加标志,用于初始化 |
| | | } |
| | | |
| | | let targetId = '0' |
| | | let targetId = '' |
| | | |
| | | if (item.dropTargetId) { |
| | | targetId = item.dropTargetId |
| | | delete item.dropTargetId |
| | | } else if (cards.length > 0) { |
| | | targetId = cards[cards.length - 1].uuid |
| | | } |
| | |
| | | |
| | | state = { |
| | | interType: this.props.setting.interType || 'system', |
| | | modules: [] |
| | | modules: [], |
| | | useMSearch: this.props.setting.useMSearch || 'false' |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | render() { |
| | | const { setting, menu, columns, config } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { interType, modules } = this.state |
| | | const { interType, modules, useMSearch } = this.state |
| | | |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | </Col> : null} |
| | | <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'使用主搜索条件(存在时),主搜索条件与组件的搜索条件会一同用作数据过滤(组件的搜索条件优先)。'}> |
| | | <Tooltip placement="topLeft" title={'优先使用同级的搜索条件组件,同级搜索不存在时,依次向上选取,与当前组件的搜索条件一同用作数据过滤(当前组件的搜索条件优先)。'}> |
| | | <Icon type="question-circle" /> |
| | | 主搜索 |
| | | 外层搜索 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('useMSearch', { |
| | | initialValue: setting.useMSearch || 'false' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio.Group onChange={(e) => this.setState({useMSearch: e.target.value})}> |
| | | <Radio value="true">使用</Radio> |
| | | <Radio value="false">不使用</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {useMSearch === 'true' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'外层搜索条件改变时,是否刷新当前组件数据。'}> |
| | | <Icon type="question-circle" /> |
| | | 同步刷新 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('syncRefresh', { |
| | | initialValue: setting.syncRefresh || 'true' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value="true">是</Radio> |
| | | <Radio value="false">否</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={8}> |
| | | <Form.Item label="初始化数据"> |
| | | {getFieldDecorator('onload', { |
| | |
| | | isNew: true // 新添加标志,用于初始化 |
| | | } |
| | | |
| | | let targetId = '0' |
| | | let targetId = '' |
| | | |
| | | if (item.dropTargetId) { |
| | | targetId = item.dropTargetId |
| | | delete item.dropTargetId |
| | | } else if (cards.length > 0) { |
| | | targetId = cards[cards.length - 1].uuid |
| | | } |
| | |
| | | const MobLogin1 = asyncComponent(() => import('@/mob/components/login/mob-login-1')) |
| | | const MobLogin2 = asyncComponent(() => import('@/mob/components/login/mob-login-2')) |
| | | |
| | | const Card = ({ id, card, moveCard, findCard, editId, editCard, delCard, hasDrop, doubleClickCard, updateConfig }) => { |
| | | const Card = ({ id, card, moveCard, findCard, editId, editCard, delCard, doubleClickCard, updateConfig }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: 'mob', id, originalIndex }, |
| | |
| | | accept: 'mob', |
| | | canDrop: () => true, |
| | | drop: (item) => { |
| | | if (!item.hasOwnProperty('originalIndex')) { |
| | | hasDrop(card) |
| | | } |
| | | }, |
| | | hover({ id: draggedId }) { |
| | | if (!draggedId) return |
| | | if (draggedId !== id) { |
| | | const { id: draggedId, originalIndex } = item |
| | | |
| | | if (originalIndex === undefined) { |
| | | item.dropTargetId = id |
| | | } else if (draggedId && draggedId !== id) { |
| | | const { index: overIndex } = findCard(id) |
| | | moveCard(draggedId, overIndex) |
| | | } |
| | | }, |
| | | } |
| | | }) |
| | | |
| | | let style = { opacity: 1} |
| | |
| | | import './index.scss' |
| | | |
| | | const Container = ({config, editId, handleList, editCard, deleteCard, doubleClickCard }) => { |
| | | let target = null |
| | | |
| | | const [cards, setCards] = useState(config.components) |
| | | const moveCard = (id, atIndex) => { |
| | | const { card, index } = findCard(id) |
| | |
| | | card, |
| | | index: cards.indexOf(card), |
| | | } |
| | | } |
| | | |
| | | const hasDrop = (item) => { |
| | | target = item |
| | | } |
| | | |
| | | const updateConfig = (element) => { |
| | |
| | | type: item.componentType, |
| | | subtype: item.subtype, |
| | | } |
| | | |
| | | let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0 |
| | | if (target) { |
| | | targetId = target.uuid |
| | | |
| | | let targetId = '' |
| | | |
| | | if (item.dropTargetId) { |
| | | targetId = item.dropTargetId |
| | | delete item.dropTargetId |
| | | } else if (cards.length > 0) { |
| | | targetId = cards[cards.length - 1].uuid |
| | | } |
| | | |
| | | const { index: overIndex } = findCard(`${targetId}`) |
| | | let targetIndex = overIndex |
| | | |
| | | targetIndex++ |
| | | |
| | | const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] }) |
| | | const { index: overIndex } = findCard(`${targetId}`) // cards为空时 overIndex 为 -1 |
| | | const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] }) |
| | | |
| | | handleList({...config, components: _cards}) |
| | | target = null |
| | | } |
| | | }) |
| | | |
| | |
| | | editCard={editCard} |
| | | delCard={deleteCard} |
| | | findCard={findCard} |
| | | hasDrop={hasDrop} |
| | | updateConfig={updateConfig} |
| | | doubleClickCard={doubleClickCard} |
| | | /> |
| | |
| | | obj_name: 'data', |
| | | arr_field: arr_field, |
| | | custom_script: setting.customScript, |
| | | default_sql: setting.execute || 'true' |
| | | default_sql: setting.execute || 'true', |
| | | menuname: this.props.MenuName || '' |
| | | } |
| | | |
| | | let _dataresource = setting.dataresource |
| | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager) |
| | | |
| | | if (param.func === 'sPC_Get_TableData') { |
| | | param.menuname = this.props.MenuName || '' |
| | | } |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | this.setState({ |
| | |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID, this.props.menuType, this.props.dataManager) |
| | | |
| | | if (param.func === 'sPC_Get_TableData') { |
| | | param.menuname = this.props.MenuName || '' |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { menuType } = this.props |
| | | const { menuType, MenuName } = this.props |
| | | const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, userConfig, tabActive, chartId, search, selectedData } = this.state |
| | | |
| | | return ( |
| | |
| | | BID={BID} |
| | | setting={setting} |
| | | actions={actions} |
| | | MenuName={MenuName} |
| | | dict={this.state.dict} |
| | | MenuID={this.props.MenuID} |
| | | selectedData={selectedData} |
| | |
| | | {this.props.menuType !== 'HS' ? <SettingComponent |
| | | config={config} |
| | | columns={columns} |
| | | MenuName={MenuName} |
| | | dict={this.state.dict} |
| | | MenuID={this.props.MenuID} |
| | | MenuName={this.props.MenuName} |
| | | permAction={this.props.permAction} |
| | | permRoles={this.props.permRoles} |
| | | userConfig={this.state.userConfig} |
| | |
| | | config={config} |
| | | setting={setting} |
| | | columns={columns} |
| | | MenuName={MenuName} |
| | | pageSize={pageSize} |
| | | dict={this.state.dict} |
| | | data={this.state.data} |
| | |
| | | BID={BID} |
| | | plot={item} |
| | | config={config} |
| | | MenuName={MenuName} |
| | | tableId="mainTable" |
| | | data={this.state.data} |
| | | MenuID={this.props.MenuID} |
| | |
| | | BID={BID} |
| | | plot={item} |
| | | config={config} |
| | | MenuName={MenuName} |
| | | data={this.state.data} |
| | | getexceloutparam={this.getexceloutparam} |
| | | loading={this.state.loading} |
| | |
| | | |
| | | import Api from '@/api' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import preImg from '@/assets/img/prev.png' |
| | | import nextImg from '@/assets/img/next.png' |
| | | import MKEmitter from '@/utils/events.js' |
| | |
| | | BID: PropTypes.any, // 父级Id |
| | | data: PropTypes.array, // 统一查询数据 |
| | | config: PropTypes.object, // 组件配置信息 |
| | | mainSearch: PropTypes.any, // 全局搜索条件 |
| | | mainSearch: PropTypes.any, // 外层搜索条件 |
| | | menuType: PropTypes.any, // 菜单类型 |
| | | dataManager: PropTypes.any, // 数据权限 |
| | | } |
| | | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, // 字典 |
| | | config: null, // 图表配置信息 |
| | | pageIndex: 1, |
| | | activeKey: '', // 选中卡 |
| | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import Api from '@/api' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | |
| | | BID: PropTypes.any, // 父级Id |
| | | data: PropTypes.array, // 统一查询数据 |
| | | config: PropTypes.object, // 组件配置信息 |
| | | mainSearch: PropTypes.any, // 全局搜索条件 |
| | | mainSearch: PropTypes.any, // 外层搜索条件 |
| | | menuType: PropTypes.any, // 菜单类型 |
| | | dataManager: PropTypes.any, // 数据权限 |
| | | } |
| | | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, // 字典 |
| | | config: null, // 图表配置信息 |
| | | loading: true, // 数据加载状态 |
| | | activeKey: '', // 选中数据 |
| | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import './index.scss' |
| | | |
| | | const ExcelOutButton = asyncComponent(() => import('@/tabviews/zshare/actionList/exceloutbutton')) |
| | |
| | | BID: PropTypes.any, // 父级Id |
| | | data: PropTypes.array, // 统一查询数据 |
| | | config: PropTypes.object, // 组件配置信息 |
| | | mainSearch: PropTypes.any, // 全局搜索条件 |
| | | mainSearch: PropTypes.any, // 外层搜索条件 |
| | | menuType: PropTypes.any, // 菜单类型 |
| | | dataManager: PropTypes.any, // 数据权限 |
| | | } |
| | | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, // 字典 |
| | | config: null, // 图表配置信息 |
| | | empty: true, // 图表数据为空 |
| | | loading: false, // 数据加载状态 |
| | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import './index.scss' |
| | | |
| | | class LineChart extends Component { |
| | |
| | | BID: PropTypes.any, // 父级Id |
| | | data: PropTypes.array, // 统一查询数据 |
| | | config: PropTypes.object, // 组件配置信息 |
| | | mainSearch: PropTypes.any, // 全局搜索条件 |
| | | mainSearch: PropTypes.any, // 外层搜索条件 |
| | | menuType: PropTypes.any, // 菜单类型 |
| | | dataManager: PropTypes.any, // 数据权限 |
| | | } |
| | | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, // 字典 |
| | | config: null, // 图表配置信息 |
| | | empty: true, // 图表数据为空 |
| | | loading: false, // 数据加载状态 |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Button, Select, DatePicker, notification } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | import DateGroup from '@/tabviews/zshare/dategroup' |
| | | import Utils from '@/utils/utils.js' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import './index.scss' |
| | | |
| | | const { MonthPicker, WeekPicker, RangePicker } = DatePicker |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 父级Id |
| | | config: PropTypes.object, // 组件配置信息 |
| | | mainSearch: PropTypes.any, // 外层搜索条件 |
| | | menuType: PropTypes.any, // 菜单类型 |
| | | dataManager: PropTypes.any, // 数据权限 |
| | | refreshdata: PropTypes.func // 刷新数据 |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | match: null, // 搜索条件匹配规则 |
| | | style: null, // 搜索条件类型 |
| | | label: null, // 提示文字 |
| | | required: null, // 是否必填 |
| | | searchlist: null, // 搜索项 |
| | | groups: null, // 组合搜索项 |
| | | formId: Utils.getuuid() // 搜索表单Id |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let searchlist = fromJS(this.props.config.search).toJS() |
| | | let match = {} |
| | | let label = {} |
| | | let style = {} |
| | | let required = {} |
| | | let _list = [] |
| | | let fieldMap = new Map() |
| | | let mainItems = [] // 云端或单点数据 |
| | | let localItems = [] // 本地数据 |
| | | let deForms = [] // 测试系统,单个请求 |
| | | |
| | | searchlist.forEach(item => { |
| | | if (fieldMap.has(item.field)) { |
| | | item.field = item.field + '@tail@' |
| | | } |
| | | fieldMap.set(item.field, true) |
| | | |
| | | match[item.field] = item.match |
| | | label[item.field] = item.label |
| | | style[item.field] = item.type |
| | | required[item.field] = item.required === 'true' |
| | | |
| | | if (['select', 'link', 'multiselect'].includes(item.type)) { |
| | | if (item.setAll === 'true' && item.type !== 'multiselect') { |
| | | item.options.unshift({ |
| | | key: Utils.getuuid(), |
| | | Value: '', |
| | | Text: this.state.dict['main.all'] |
| | | }) |
| | | } |
| | | |
| | | // 数据源查询语句 |
| | | if (item.resourceType === '1' && item.dataSource) { |
| | | let _option = Utils.getSelectQueryOptions(item) |
| | | |
| | | if (this.props.dataManager) { // 数据权限 |
| | | _option.sql = _option.sql.replace(/\$@/ig, '/*') |
| | | _option.sql = _option.sql.replace(/@\$/ig, '*/') |
| | | } else { |
| | | _option.sql = _option.sql.replace(/@\$|\$@/ig, '') |
| | | } |
| | | |
| | | // 测试系统单个请求 |
| | | if (this.props.menuType !== 'HS' && options.sysType === 'local' && !window.GLOB.systemType) { |
| | | deForms.push({ |
| | | ...item, |
| | | arr_field: _option.field, |
| | | data_sql: Utils.formatOptions(_option.sql) |
| | | }) |
| | | } else { // 合并请求,区分本地及系统 |
| | | // 外联数据库替换 |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | _option.sql = _option.sql.replace(/@db@/ig, `[${window.GLOB.externalDatabase}]..`) |
| | | } |
| | | if (item.database === 'sso') { |
| | | mainItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql))}' as LText`) |
| | | } else { |
| | | localItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql))}' as LText`) |
| | | } |
| | | } |
| | | } |
| | | item.oriOptions = fromJS(item.options).toJS() |
| | | } |
| | | |
| | | _list.push(item) |
| | | }) |
| | | |
| | | let _groups = [] |
| | | _list = _list.map(item => { |
| | | if (item.type === 'link') { |
| | | let supItem = _list.filter(form => form.field === item.linkField)[0] |
| | | |
| | | if (!supItem) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未查询到搜索条件《' + item.label + '》关联字段!', |
| | | duration: 5 |
| | | }) |
| | | item.supInitVal = '' |
| | | } else { |
| | | item.supInitVal = supItem.initval |
| | | item.options = item.oriOptions.filter(option => option.ParentID === supItem.initval) |
| | | } |
| | | } else if (item.type === 'group' && item.Hide !== 'true') { |
| | | _groups.push(fromJS(item).toJS()) |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | match: match, |
| | | label: label, |
| | | style: style, |
| | | required: required, |
| | | searchlist: _list, |
| | | groups: _groups |
| | | }, () => { |
| | | if (this.props.menuType !== 'HS' && options.sysType === 'local' && !window.GLOB.systemType) { |
| | | this.improveSimpleSearch(deForms) |
| | | } else { |
| | | this.improveSearch(mainItems, localItems) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 查询下拉菜单 |
| | | improveSearch = (mainItems, localItems) => { |
| | | const { menuType, BID } = this.props |
| | | let deffers = [] |
| | | |
| | | if (menuType !== 'HS' && window.GLOB.systemType !== 'production') { |
| | | localItems = [...localItems, ...mainItems] |
| | | mainItems = [] |
| | | } |
| | | |
| | | // 本地请求 |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: localItems.join(' union all '), |
| | | obj_name: '', |
| | | arr_field: '', |
| | | table_type: 'Y' |
| | | } |
| | | |
| | | if (BID) { |
| | | param.BID = BID |
| | | } |
| | | |
| | | if (param.LText) { |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | if (menuType === 'HS') { // 云端数据验证 |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | deffers.push( |
| | | new Promise(resolve => { |
| | | Api.getSystemCacheConfig(param).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | ) |
| | | } |
| | | |
| | | // 系统请求 |
| | | let mainparam = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: mainItems.join(' union all '), |
| | | obj_name: '', |
| | | arr_field: '', |
| | | table_type: 'Y' |
| | | } |
| | | |
| | | if (BID) { |
| | | mainparam.BID = BID |
| | | } |
| | | |
| | | if (mainparam.LText) { |
| | | mainparam.LText = Utils.formatOptions(mainparam.LText) |
| | | mainparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | mainparam.secretkey = Utils.encrypt(mainparam.LText, mainparam.timestamp) |
| | | |
| | | if (menuType === 'HS') { // 云端数据验证 |
| | | mainparam.open_key = Utils.encryptOpenKey(mainparam.secretkey, mainparam.timestamp) |
| | | if (options.cloudServiceApi) { |
| | | mainparam.rduri = options.cloudServiceApi |
| | | mainparam.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | mainparam.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } |
| | | } else if (window.GLOB.mainSystemApi) { |
| | | mainparam.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | deffers.push( |
| | | new Promise(resolve => { |
| | | Api.getSystemCacheConfig(mainparam).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | ) |
| | | } |
| | | |
| | | Promise.all(deffers).then(response => { |
| | | let result = {...response[0], ...(response[1] || {})} |
| | | |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | 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) |
| | | } else { |
| | | item.options = item.oriOptions |
| | | } |
| | | } else if (item.type === 'select' || item.type === 'multiselect') { |
| | | item.options = item.oriOptions |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | // 测试系统单个请求下拉选项 |
| | | improveSimpleSearch = (deForms) => { |
| | | if (deForms.length === 0) return |
| | | |
| | | let deffers = deForms.map(item => { |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: item.data_sql, |
| | | obj_name: item.field, |
| | | arr_field: item.arr_field |
| | | } |
| | | |
| | | if (this.props.BID) { |
| | | param.BID = this.props.BID |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | return ( |
| | | new Promise(resolve => { |
| | | Api.getSystemCacheConfig(param).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | ) |
| | | }) |
| | | |
| | | Promise.all(deffers).then(response => { |
| | | let result = {} |
| | | |
| | | response.forEach(res => { |
| | | result = {...result, ...res} |
| | | }) |
| | | |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | 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) |
| | | } else { |
| | | item.options = item.oriOptions |
| | | } |
| | | } else if (item.type === 'select' || item.type === 'multiselect') { |
| | | item.options = item.oriOptions |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | resetform = (formlist, supfields, index, fieldsvalue) => { |
| | | index++ |
| | | let subfields = [] |
| | | |
| | | supfields.forEach(supfield => { |
| | | formlist = formlist.map(item => { |
| | | if (item.type === 'link' && item.linkField === supfield.field) { |
| | | item.options = item.oriOptions.filter(option => option.ParentID === supfield.initval) |
| | | item.initval = item.options[0] ? item.options[0].Value : '' |
| | | |
| | | if (this.props.form.getFieldValue(item.field) !== undefined) { |
| | | fieldsvalue[item.field] = item.initval |
| | | } |
| | | |
| | | subfields.push(item) |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | |
| | | if (subfields.length === 0 || index > 6) { |
| | | return formlist |
| | | } else { |
| | | return this.resetform(formlist, subfields, index, fieldsvalue) |
| | | } |
| | | } |
| | | |
| | | selectChange = (_field, value) => { |
| | | let formlist = fromJS(this.state.searchlist).toJS() |
| | | |
| | | let subfields = [] |
| | | let fieldsvalue = {} |
| | | formlist = formlist.map(item => { |
| | | if (item.type === 'link' && item.linkField === _field.field) { |
| | | item.options = item.oriOptions.filter(option => option.ParentID === value) |
| | | item.initval = item.options[0] ? item.options[0].Value : '' |
| | | |
| | | if (this.props.form.getFieldValue(item.field) !== undefined) { |
| | | fieldsvalue[item.field] = item.initval |
| | | } |
| | | |
| | | subfields.push(item) |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | if (subfields.length === 0) { |
| | | this.searchChange() |
| | | return |
| | | } |
| | | |
| | | formlist = this.resetform(formlist, subfields, 0, fieldsvalue) |
| | | |
| | | if (Object.keys(fieldsvalue).length > 0) { |
| | | this.props.form.setFieldsValue(fieldsvalue) |
| | | } |
| | | |
| | | this.setState({ |
| | | searchlist: formlist |
| | | }, () => { |
| | | this.searchChange() |
| | | }) |
| | | } |
| | | |
| | | getFields() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const fields = [] |
| | | |
| | | this.state.searchlist.forEach((item, index) => { |
| | | if (item.Hide === 'true') return |
| | | |
| | | if (item.type === 'text') { // 文本搜索 |
| | | fields.push( |
| | | <Col span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.state.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'select') { // 下拉搜索 |
| | | fields.push( |
| | | <Col span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.state.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <Select |
| | | showSearch |
| | | onChange={(value) => {this.selectChange(item, value)}} |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | getPopupContainer={() => document.getElementById(this.state.formId)} |
| | | > |
| | | {item.options.map((option, i) => |
| | | <Select.Option id={`${i}`} title={option.Text} key={`${i}`} value={option.Value}>{option.Text}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'multiselect') { // 下拉多选 |
| | | let _initval = item.initval ? item.initval.split(',').filter(Boolean) : [] |
| | | fields.push( |
| | | <Col span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: _initval, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.state.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <Select |
| | | showSearch |
| | | mode="multiple" |
| | | onChange={this.searchChange} |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | getPopupContainer={() => document.getElementById(this.state.formId)} |
| | | > |
| | | {item.options.map((option, i) => |
| | | <Select.Option id={`${i}`} title={option.Text} key={`${i}`} value={option.Value}>{option.Text}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'date') { // 时间搜索 |
| | | fields.push( |
| | | <Col span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval ? moment().subtract(item.initval, 'days') : null, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.state.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <DatePicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'datemonth') { |
| | | fields.push( |
| | | <Col span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval ? moment().subtract(item.initval, 'month') : null, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.state.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <MonthPicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'dateweek') { |
| | | fields.push( |
| | | <Col span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval ? moment().subtract(item.initval * 7, 'days') : null, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.state.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <WeekPicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'daterange') { |
| | | let _defaultValue = [null, null] |
| | | |
| | | if (item.initval) { |
| | | try { |
| | | let _initval = JSON.parse(item.initval) |
| | | _defaultValue = [moment().subtract(_initval[0], 'days'), moment().subtract(_initval[1], 'days')] |
| | | } catch { |
| | | _defaultValue = [null, null] |
| | | } |
| | | } |
| | | |
| | | fields.push( |
| | | <Col className="daterange" span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, |
| | | { |
| | | initialValue: _defaultValue, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.state.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <RangePicker |
| | | placeholder={['开始日期', '结束日期']} |
| | | renderExtraFooter={() => 'extra footer'} |
| | | onChange={this.searchChange} |
| | | getCalendarContainer={() => document.getElementById(this.state.formId)} |
| | | /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'group') { |
| | | fields.push( |
| | | <Col span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.label} className={item.required === 'true' ? 'group-required' : ''}> |
| | | <DateGroup ref={item.uuid} position={index} card={item} onGroupChange={this.searchChange} /> |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } |
| | | }) |
| | | |
| | | fields.push( |
| | | <Col span={6} style={{ whiteSpace: 'nowrap' }} key="actions"> |
| | | <Form.Item label={' '} colon={false} style={{ minHeight: '40px' }}> |
| | | <Button type="primary" htmlType="submit"> |
| | | {this.state.dict['main.search']} |
| | | </Button> |
| | | <Button style={{ marginLeft: 8 }} onClick={this.handleReset}> |
| | | {this.state.dict['main.reset']} |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | |
| | | return fields |
| | | } |
| | | |
| | | addHideFieldValue = (values) => { |
| | | const { searchlist } = this.state |
| | | let hideValue = {} |
| | | searchlist.forEach(item => { |
| | | if (item.Hide === 'true') { |
| | | let value = '' |
| | | |
| | | if (item.type === 'multiselect') { // 下拉多选 |
| | | value = item.initval ? item.initval.split(',').filter(Boolean) : [] |
| | | } else if (item.type === 'date') { // 时间搜索 |
| | | value = item.initval ? moment().subtract(item.initval, 'days') : '' |
| | | } else if (item.type === 'datemonth') { |
| | | value = item.initval ? moment().subtract(item.initval, 'month') : '' |
| | | } else if (item.type === 'dateweek') { |
| | | value = item.initval ? moment().subtract(item.initval * 7, 'days') : '' |
| | | } else if (item.type === 'daterange') { |
| | | if (item.initval) { |
| | | try { |
| | | let _initval = JSON.parse(item.initval) |
| | | value = [moment().subtract(_initval[0], 'days'), moment().subtract(_initval[1], 'days')] |
| | | } catch { |
| | | value = '' |
| | | } |
| | | } |
| | | } else if (item.type !== 'group') { |
| | | value = item.initval |
| | | } |
| | | |
| | | hideValue[item.field] = value |
| | | } |
| | | }) |
| | | |
| | | return {...hideValue, ...values} |
| | | } |
| | | |
| | | handleSearch = (e) => { |
| | | // 回车或点击搜索 |
| | | e.preventDefault() |
| | | this.props.form.validateFields((err, values) => { |
| | | if (!err) { |
| | | values = this.addHideFieldValue(values) |
| | | let searches = this.getFieldsValues(values) |
| | | this.props.refreshdata(searches) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | searchChange = () => { |
| | | this.setState({}, () => { |
| | | this.props.form.validateFields((err, values) => { |
| | | if (!err) { |
| | | values = this.addHideFieldValue(values) |
| | | let searches = this.getFieldsValues(values) |
| | | this.props.refreshdata(searches) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索条件重置 |
| | | */ |
| | | handleReset = () => { |
| | | const { groups } = this.state |
| | | |
| | | if (groups.length > 0) { |
| | | groups.forEach(item => { |
| | | this.refs[item.uuid].reset() |
| | | }) |
| | | } |
| | | |
| | | let searchlist = this.state.searchlist.map(item => { |
| | | item.initval = item.oriInitval |
| | | return item |
| | | }) |
| | | |
| | | this.setState({searchlist}, () => { |
| | | this.props.form.resetFields() |
| | | this.props.form.validateFields((err, values) => { |
| | | if (!err) { |
| | | // 异步获取更新后的时间组 |
| | | this.setState({}, () => { |
| | | values = this.addHideFieldValue(values) |
| | | let searches = this.getFieldsValues(values) |
| | | this.props.refreshdata(searches) |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | getFieldsValues = (values) => { |
| | | const { groups } = this.state |
| | | // 获取搜索条件值 |
| | | let search = [] |
| | | Object.keys(values).forEach(key => { |
| | | let _value = '' |
| | | if (this.state.style[key] === 'daterange') { |
| | | if (values[key].length > 0 && values[key][0] && values[key][1]) { |
| | | _value = [moment(values[key][0]).format('YYYY-MM-DD'), moment(values[key][1]).format('YYYY-MM-DD')] |
| | | } |
| | | } else if (this.state.style[key] === 'dateweek') { |
| | | if (values[key]) { |
| | | _value = [moment(values[key]).startOf('week').format('YYYY-MM-DD'), moment(values[key]).endOf('week').format('YYYY-MM-DD')] |
| | | } |
| | | } else if (this.state.style[key] === 'date') { |
| | | if (values[key]) { |
| | | _value = moment(values[key]).format('YYYY-MM-DD') |
| | | } |
| | | } else if (this.state.style[key] === 'datemonth') { |
| | | if (values[key]) { |
| | | _value = moment(values[key]).format('YYYY-MM') |
| | | } |
| | | } else if (this.state.style[key] === 'multiselect') { |
| | | _value = values[key] || [] |
| | | |
| | | } else { |
| | | _value = (values[key] || values[key] === 0) ? values[key] : '' |
| | | |
| | | _value = _value.replace(/(^\s*|\s*$)/ig, '') |
| | | } |
| | | |
| | | search.push({ |
| | | type: this.state.style[key], |
| | | key: key.replace(/@tail@$/, ''), |
| | | value: _value, |
| | | label: this.state.label[key], |
| | | match: this.state.match[key], |
| | | required: this.state.required[key] |
| | | }) |
| | | }) |
| | | |
| | | if (groups.length > 0) { |
| | | groups.forEach(item => { |
| | | let items = this.refs[item.uuid].getSearchItems() |
| | | search.push(...items) |
| | | }) |
| | | } |
| | | |
| | | return search |
| | | } |
| | | |
| | | render() { |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 8 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 } |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} className="custom-main-search" id={this.state.formId} onSubmit={this.handleSearch}> |
| | | <Row gutter={24}>{this.getFields()}</Row> |
| | | </Form> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default Form.create()(MainSearch) |
New file |
| | |
| | | .custom-main-search { |
| | | .ant-form-item { |
| | | display: flex; |
| | | margin-bottom: 0px; |
| | | min-height: 60px; |
| | | .ant-form-explain { |
| | | white-space: nowrap; |
| | | } |
| | | } |
| | | .ant-form-item-control-wrapper { |
| | | flex: 1; |
| | | width: calc(100% - 100px); |
| | | } |
| | | .ant-form-item-label { |
| | | text-overflow: ellipsis; |
| | | } |
| | | .daterange .ant-calendar-picker-input { |
| | | padding: 4px 20px 4px 5px; |
| | | font-size: 13px; |
| | | } |
| | | .ant-select-dropdown { |
| | | z-index: 10 !important; |
| | | } |
| | | .ant-calendar-picker-container { |
| | | z-index: 10 !important; |
| | | } |
| | | .group-required { |
| | | label::before { |
| | | display: inline-block; |
| | | margin-right: 4px; |
| | | color: #f5222d; |
| | | font-size: 14px; |
| | | font-family: SimSun, sans-serif; |
| | | line-height: 1; |
| | | content: '*'; |
| | | } |
| | | } |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | // import { fromJS } from 'immutable' |
| | | import { connect } from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Row, Col, Empty } from 'antd' |
| | | |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | | // 通用组件 |
| | | const AntvBarAndLine = asyncSpinComponent(() => import('@/tabviews/custom/components/chart/antv-bar-line')) |
| | | const MainSearch = asyncSpinComponent(() => import('@/tabviews/custom/components/search/main-search')) |
| | | const AntvPie = asyncSpinComponent(() => import('@/tabviews/custom/components/chart/antv-pie')) |
| | | const AntvTabs = asyncSpinComponent(() => import('@/tabviews/custom/components/tabs/antv-tabs')) |
| | | |
| | | class MainSearch extends Component { |
| | | class TabTransfer extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 父级Id |
| | | config: PropTypes.object, // 组件配置信息 |
| | |
| | | dataManager: PropTypes.any, // 数据权限 |
| | | } |
| | | |
| | | state = {} |
| | | state = { |
| | | mainSearch: [], |
| | | self: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config, mainSearch } = this.props |
| | | // 获取主搜索条件 |
| | | let _mainSearch = [] |
| | | let self = false |
| | | config.components.forEach(component => { |
| | | if (component.type === 'search') { |
| | | self = true |
| | | component.search = component.search.map(item => { |
| | | item.oriInitval = item.initval |
| | | |
| | | if (!item.blacklist || item.blacklist.length === 0) return item |
| | | |
| | | let _black = item.blacklist.filter(v => { |
| | | return this.props.permRoles.indexOf(v) !== -1 |
| | | }) |
| | | |
| | | if (_black.length > 0) { |
| | | item.Hide = 'true' |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | _mainSearch = Utils.initMainSearch(component.search) |
| | | } |
| | | }) |
| | | |
| | | this.setState({mainSearch: self ? _mainSearch : fromJS(mainSearch).toJS(), self}) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | const { self } = this.state |
| | | |
| | | if (!self && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({mainSearch: fromJS(nextProps.mainSearch).toJS()}) |
| | | } |
| | | } |
| | | |
| | | resetSearch = (search) => { |
| | | this.setState({mainSearch: search}) |
| | | } |
| | | |
| | | getComponents = () => { |
| | | const { menuType, dataManager, BID, mainSearch, config } = this.props |
| | | const { menuType, dataManager, BID, config } = this.props |
| | | const { mainSearch } = this.state |
| | | |
| | | if (!config || !config.components || config.components.length === 0) return (<Empty description={false} />) |
| | | |
| | |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <AntvPie config={item} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'search') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <MainSearch config={item} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} refreshdata={this.resetSearch} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'tabs') { |
| | |
| | | } |
| | | } |
| | | |
| | | export default MainSearch |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | menuType: state.editLevel, |
| | | permAction: state.permAction, |
| | | permRoles: state.permRoles, |
| | | dataManager: state.dataManager |
| | | } |
| | | } |
| | | |
| | | const mapDispatchToProps = () => { |
| | | return {} |
| | | } |
| | | |
| | | export default connect(mapStateToProps, mapDispatchToProps)(TabTransfer) |
| | |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import './index.scss' |
| | | |
| | | const TabTransfer = asyncComponent(() => import('../../share/tabtransfer')) |
| | |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 父级Id |
| | | config: PropTypes.object, // 组件配置信息 |
| | | mainSearch: PropTypes.any, // 全局搜索条件 |
| | | mainSearch: PropTypes.any, // 外层搜索条件 |
| | | menuType: PropTypes.any, // 菜单类型 |
| | | dataManager: PropTypes.any, // 数据权限 |
| | | } |
| | | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | tabs: null |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { BID, mainSearch, menuType, dataManager } = this.props |
| | | const { BID, mainSearch } = this.props |
| | | const { tabs } = this.state |
| | | |
| | | return ( |
| | |
| | | <Tabs defaultActiveKey="1" tabPosition={tabs.setting.position} type={tabs.setting.tabStyle}> |
| | | {tabs.subtabs.map(tab => ( |
| | | <TabPane tab={<span>{tab.icon ? <Icon type={tab.icon} /> : null}{tab.label}</span>} key={tab.uuid}> |
| | | <TabTransfer config={tab} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager}/> |
| | | <TabTransfer config={tab} BID={BID} mainSearch={mainSearch}/> |
| | | </TabPane> |
| | | ))} |
| | | </Tabs> |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import {connect} from 'react-redux' |
| | | import { connect } from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import { notification, Spin, Row, Col, Button, message } from 'antd' |
| | | import moment from 'moment' |
| | |
| | | const AntvTabs = asyncSpinComponent(() => import('./components/tabs/antv-tabs')) |
| | | const DataCard = asyncSpinComponent(() => import('./components/card/data-card')) |
| | | const PropCard = asyncSpinComponent(() => import('./components/card/prop-card')) |
| | | const MainSearch = asyncSpinComponent(() => import('./components/search/main-search')) |
| | | |
| | | class CustomPage extends Component { |
| | | static propTpyes = { |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索条件改变时,重置表格数据 |
| | | * 含有初始不加载的页面,修改设置 |
| | | */ |
| | | refreshbysearch = (searches) => { |
| | | this.setState({ |
| | | mainSearch: searches |
| | | }) |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @description 页面刷新,重新获取配置 |
| | | */ |
| | | reloadview = () => { |
| | | this.setState({ loadingview: true, viewlost: false, lostmsg: '', data: null, loading: false, search: '' |
| | | }, () => { |
| | | this.loadconfig() |
| | | }) |
| | | } |
| | | |
| | | handleviewconfig = (e) => { |
| | | e.stopPropagation() |
| | | |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (nextProps.refreshTab && nextProps.refreshTab.MenuID === this.props.MenuID) { |
| | | if (nextProps.refreshTab.position === 'view') { |
| | | this.reloadview() |
| | | } |
| | | this.props.refreshTabView('') |
| | | } |
| | | |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | resetSearch = (search) => { |
| | | this.setState({mainSearch: search}) |
| | | } |
| | | |
| | | getComponents = () => { |
| | |
| | | <AntvPie config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'search') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <MainSearch config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} refreshdata={this.resetSearch} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'tabs') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <AntvTabs config={item} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> |
| | | <AntvTabs config={item} BID={BID} mainSearch={mainSearch} /> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'card') { |
| | |
| | | |
| | | render () { |
| | | return ( |
| | | <iframe |
| | | title={this.props.title} |
| | | src={this.props.url} |
| | | /> |
| | | <iframe title={this.props.title} src={this.props.url} /> |
| | | ) |
| | | } |
| | | } |
| | |
| | | let param = { |
| | | func: 'sPC_Get_TableData', |
| | | obj_name: 'data', |
| | | arr_field: arr_field |
| | | arr_field: arr_field, |
| | | menuname: this.props.MenuName || '' |
| | | } |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | |
| | | |
| | | this.handleTableId() |
| | | |
| | | if (param.func === 'sPC_Get_TableData') { |
| | | param.menuname = this.props.Tab.label || '' |
| | | } |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | this.setState({ |
| | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, _BID, this.props.menuType, this.props.dataManager) |
| | | |
| | | if (param.func === 'sPC_Get_TableData') { |
| | | param.menuname = this.props.Tab.label || '' |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | let _data = res.data[0] |
| | |
| | | BData={this.props.BData} |
| | | MenuID={this.props.MenuID} |
| | | selectedData={selectedData} |
| | | MenuName={this.props.Tab.label} |
| | | logcolumns={this.state.logcolumns} |
| | | refreshdata={this.refreshbyaction} |
| | | ContainerId={this.props.ContainerId} |
| | |
| | | total={this.state.total} |
| | | MenuID={this.props.MenuID} |
| | | loading={this.state.loading} |
| | | MenuName={this.props.Tab.label} |
| | | refreshdata={this.refreshbytable} |
| | | logcolumns={this.state.logcolumns} |
| | | statFValue={this.state.statFValue} |
| | |
| | | MenuID={this.props.MenuID} |
| | | loading={this.state.loading} |
| | | tableId={this.props.Tab.uuid} |
| | | MenuName={this.props.Tab.label} |
| | | logcolumns={this.state.logcolumns} |
| | | refreshdata={this.refreshbyaction} |
| | | handleTableId={this.handleTableId} |
| | |
| | | BID={this.props.BID} |
| | | Tab={this.props.Tab} |
| | | data={this.state.data} |
| | | MenuName={this.props.Tab.label} |
| | | getexceloutparam={this.getexceloutparam} |
| | | loading={this.state.loading} |
| | | /> |
| | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager) |
| | | |
| | | if (param.func === 'sPC_Get_TableData') { |
| | | param.menuname = this.props.Tab.label || '' |
| | | } |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | this.setState({ |
| | |
| | | let _orderBy = orderBy || setting.order |
| | | let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, BID, this.props.menuType, this.props.dataManager) |
| | | |
| | | if (param.func === 'sPC_Get_TableData') { |
| | | param.menuname = this.props.Tab.label || '' |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | let _data = res.data[0] |
| | |
| | | BData={this.props.BData} |
| | | selectedData={selectedData} |
| | | MenuID={this.props.SupMenuID} |
| | | MenuName={this.props.Tab.label} |
| | | logcolumns={this.state.logcolumns} |
| | | refreshdata={this.refreshbyaction} |
| | | getexceloutparam={this.getexceloutparam} |
| | |
| | | total={this.state.total} |
| | | MenuID={this.props.MenuID} |
| | | loading={this.state.loading} |
| | | MenuName={this.props.Tab.label} |
| | | refreshdata={this.refreshbytable} |
| | | logcolumns={this.state.logcolumns} |
| | | statFValue={this.state.statFValue} |
| | |
| | | plot={item} |
| | | config={config} |
| | | BID={this.props.BID} |
| | | BData={this.props.BData} |
| | | data={this.state.data} |
| | | BData={this.props.BData} |
| | | loading={this.state.loading} |
| | | MenuName={this.props.Tab.label} |
| | | logcolumns={this.state.logcolumns} |
| | | refreshdata={this.refreshbyaction} |
| | | handleTableId={() => {}} |
| | |
| | | config={config} |
| | | data={this.state.data} |
| | | loading={this.state.loading} |
| | | MenuName={this.props.Tab.label} |
| | | /> |
| | | </Col> |
| | | ) |
| | |
| | | let param = { |
| | | func: 'sPC_Get_TableData', |
| | | obj_name: 'data', |
| | | arr_field: arr_field |
| | | arr_field: arr_field, |
| | | menuname: this.props.MenuName || '' |
| | | } |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | |
| | | func: 'sPC_Get_TableData', |
| | | obj_name: 'data', |
| | | arr_field: arr_field, |
| | | BID: BID |
| | | BID: BID, |
| | | menuname: this.props.Tab.label || '' |
| | | } |
| | | |
| | | let _orderBy = orderBy || setting.order |
| | |
| | | static propTpyes = { |
| | | show: PropTypes.any, // 显示样式 |
| | | BID: PropTypes.string, // 主表ID |
| | | MenuName: PropTypes.any, // 菜单名称 |
| | | selectedData: PropTypes.any, // 子表中选择数据 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | btn: PropTypes.object, // 按钮 |
| | |
| | | * @description Excel 导入 |
| | | */ |
| | | getexceldata = (data, errors, sheetName) => { |
| | | const { btn } = this.props |
| | | const { btn, MenuName } = this.props |
| | | |
| | | if (errors) { |
| | | if (errors === 'notexit') { |
| | |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | param.menuname = `${MenuName ? MenuName + '-' : ''}${btn.label}` |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | |
| | | static propTpyes = { |
| | | BID: PropTypes.string, // 主表ID |
| | | show: PropTypes.any, // 显示样式 |
| | | MenuName: PropTypes.any, // 菜单名称 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | btn: PropTypes.object, // 按钮 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | |
| | | * @description 执行自定义脚本 |
| | | */ |
| | | execCustomScript = () => { |
| | | const { btn } = this.props |
| | | const { btn, MenuName } = this.props |
| | | const { search } = this.state |
| | | let script = btn.verify.script |
| | | |
| | |
| | | }) |
| | | |
| | | let param = { |
| | | func: 'sPC_TableData_InUpDe' |
| | | func: 'sPC_TableData_InUpDe', |
| | | menuname: `${MenuName ? MenuName + '-' : ''}${btn.label}` |
| | | } |
| | | |
| | | if (this.props.BID) { |
| | |
| | | * @description 获取默认存储过程请求参数 |
| | | */ |
| | | getExcelDefaultParam = (arr_field, orderBy, search, pagination = false, pageIndex = 1, pageSize = 100) => { |
| | | const { setting } = this.props |
| | | const { setting, MenuName, btn } = this.props |
| | | |
| | | let _search = Utils.joinMainSearchkey(search) |
| | | |
| | |
| | | obj_name: 'data', |
| | | arr_field: arr_field, |
| | | custom_script: setting.customScript, |
| | | default_sql: setting.default || 'true' |
| | | default_sql: setting.default || 'true', |
| | | menuname: `${MenuName ? MenuName + '-' : ''}${btn.label}` |
| | | } |
| | | |
| | | // 数据管理权限 |
| | |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 主表ID |
| | | BData: PropTypes.any, // 主表数据 |
| | | MenuName: PropTypes.any, // 菜单名称 |
| | | selectedData: PropTypes.any, // 子表中选择数据 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | MenuID: PropTypes.string, // 菜单ID |
| | |
| | | } |
| | | |
| | | getButtonList = (actions) => { |
| | | const { BID, BData, MenuID, Tab, logcolumns, setting, ContainerId, selectedData, getexceloutparam } = this.props |
| | | const { BID, BData, MenuID, Tab, logcolumns, setting, ContainerId, selectedData, getexceloutparam, MenuName } = this.props |
| | | |
| | | return actions.map(item => { |
| | | if (['exec', 'prompt', 'pop'].includes(item.OpenType)) { |
| | |
| | | btn={item} |
| | | BData={BData} |
| | | setting={setting} |
| | | MenuName={MenuName} |
| | | columns={logcolumns} |
| | | ContainerId={ContainerId} |
| | | selectedData={selectedData} |
| | |
| | | Tab={Tab} |
| | | btn={item} |
| | | setting={setting} |
| | | MenuName={MenuName} |
| | | selectedData={selectedData} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | |
| | | Tab={Tab} |
| | | btn={item} |
| | | setting={setting} |
| | | MenuName={MenuName} |
| | | getexceloutparam={getexceloutparam} |
| | | updateStatus={this.updateStatus} |
| | | /> |
| | |
| | | show: PropTypes.any, // 按钮显示样式控制 |
| | | BID: PropTypes.string, // 主表ID |
| | | BData: PropTypes.any, // 主表数据 |
| | | MenuName: PropTypes.any, // 菜单名称 |
| | | style: PropTypes.any, // 按钮样式 |
| | | selectedData: PropTypes.any, // 子表中选择数据 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | |
| | | * @description 按钮提交执行 |
| | | */ |
| | | execSubmit = (data, _resolve, formdata) => { |
| | | const { setting, columns, btn } = this.props |
| | | const { setting, columns, btn, MenuName } = this.props |
| | | if (btn.intertype === 'inner' || btn.intertype === 'system') { |
| | | // 执行方式为多行拼接,且打开方式为表单时,会转为循环发送请求 |
| | | // 打开方式为模态框,使用内部函数添加(有批量添加场景,已去除) |
| | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp) |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | if (param.func === 'sPC_TableData_InUpDe') { |
| | | param.menuname = `${MenuName ? MenuName + '-' : ''}${btn.label}` |
| | | } |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | if (param.func === 'sPC_TableData_InUpDe') { |
| | | param.menuname = `${MenuName ? MenuName + '-' : ''}${btn.label}` |
| | | } |
| | | |
| | | return param |
| | | }) |
| | | |
| | |
| | | type: PropTypes.any, // 卡片类型,添加按钮为 insert |
| | | BID: PropTypes.any, // 主表ID |
| | | BData: PropTypes.any, // 主表数据 |
| | | MenuName: PropTypes.any, // 菜单名称 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | MenuID: PropTypes.string, // 菜单ID |
| | | setting: PropTypes.object, // 页面设定 |
| | |
| | | * @description 获取按钮元素 |
| | | */ |
| | | getActionList = (actions, show) => { |
| | | const { BID, BData, Tab, setting, logcolumns, ContainerId, data, MenuID } = this.props |
| | | const { BID, BData, Tab, setting, logcolumns, ContainerId, data, MenuID, MenuName } = this.props |
| | | |
| | | return actions.map(item => { |
| | | if (['exec', 'prompt', 'pop'].includes(item.OpenType)) { |
| | |
| | | show={show} |
| | | BData={BData} |
| | | setting={setting} |
| | | MenuName={MenuName} |
| | | columns={logcolumns} |
| | | selectedData={[data]} |
| | | ContainerId={ContainerId} |
| | |
| | | show={'plus' + plusSize} |
| | | BData={this.props.BData} |
| | | setting={this.props.setting} |
| | | MenuName={this.props.MenuName} |
| | | columns={this.props.logcolumns} |
| | | selectedData={[]} |
| | | ContainerId={this.props.ContainerId} |
| | |
| | | BData: PropTypes.any, // 主表数据 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | MenuID: PropTypes.string, // 菜单ID |
| | | MenuName: PropTypes.any, // 菜单名称 |
| | | config: PropTypes.object, // 页面配置信息 |
| | | logcolumns: PropTypes.array, // 显示列 |
| | | ContainerId: PropTypes.any, // tab页面ID,用于弹窗控制 |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { plot, data, loading, BID, BData, Tab, MenuID, config, logcolumns, ContainerId } = this.props |
| | | const { plot, data, loading, BID, BData, Tab, MenuID, config, logcolumns, ContainerId, MenuName } = this.props |
| | | const { card, colMap, selectKey, actionList } = this.state |
| | | |
| | | return ( |
| | |
| | | Tab={Tab} |
| | | btn={action} |
| | | show="icon" |
| | | MenuName={MenuName} |
| | | setting={config.setting} |
| | | updateStatus={() => {}} |
| | | /> |
| | |
| | | Tab={Tab} |
| | | btn={action} |
| | | show="icon" |
| | | MenuName={MenuName} |
| | | setting={config.setting} |
| | | getexceloutparam={this.props.getexceloutparam} |
| | | updateStatus={() => {}} |
| | |
| | | BData={BData} |
| | | MenuID={MenuID} |
| | | colMap={colMap} |
| | | MenuName={MenuName} |
| | | selectKey={selectKey} |
| | | logcolumns={logcolumns} |
| | | setting={config.setting} |
| | |
| | | data={{key: 'insert'}} |
| | | BData={BData} |
| | | MenuID={MenuID} |
| | | MenuName={MenuName} |
| | | setting={config.setting} |
| | | ContainerId={ContainerId} |
| | | switchCard={() => {}} |
| | |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 父级Id |
| | | Tab: PropTypes.any, // 标签信息 |
| | | MenuName: PropTypes.any, // 菜单名称 |
| | | plot: PropTypes.object, // 图标设置信息 |
| | | data: PropTypes.array, // 图表传入数据 |
| | | loading: PropTypes.bool, // 数据加载中 |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { plot, loading, config, BID, Tab } = this.props |
| | | const { plot, loading, config, BID, Tab, MenuName } = this.props |
| | | const { empty, chartFields, selectFields, actions } = this.state |
| | | |
| | | return ( |
| | |
| | | Tab={Tab} |
| | | btn={item} |
| | | show="icon" |
| | | MenuName={MenuName} |
| | | setting={config.setting} |
| | | getexceloutparam={this.props.getexceloutparam} |
| | | updateStatus={() => {}} |
| | |
| | | Tab={Tab} |
| | | btn={item} |
| | | show="icon" |
| | | MenuName={MenuName} |
| | | setting={config.setting} |
| | | updateStatus={() => {}} |
| | | /> |
| | |
| | | tableId: PropTypes.string, // 列表Id |
| | | statFValue: PropTypes.any, // 合计字段数据 |
| | | pageSize: PropTypes.any, // 每页数据 |
| | | MenuName: PropTypes.any, // 菜单名称 |
| | | dict: PropTypes.object, // 字典项 |
| | | config: PropTypes.object, // 页面配置 |
| | | MenuID: PropTypes.string, // 菜单Id |
| | |
| | | selectedData={[record]} |
| | | BData={this.props.BData} |
| | | setting={this.props.setting} |
| | | MenuName={this.props.MenuName} |
| | | columns={this.props.logcolumns} |
| | | ContainerId={this.props.ContainerId} |
| | | updateStatus={this.props.refreshbyaction} |
| | |
| | | import SearchComponent from '@/templates/sharecomponent/searchcomponent' |
| | | |
| | | import MenuForm from '@/templates/comtableconfig/menuform' |
| | | // import EditComponent from '@/templates/zshare/editcomponent' |
| | | import EditComponent from '@/templates/zshare/editcomponent' |
| | | import SourceElement from '@/templates/zshare/dragsource' |
| | | import Source from './source' |
| | | import './index.scss' |
| | |
| | | </div> |
| | | } bordered={false} extra={ |
| | | <div> |
| | | {/* <EditComponent dict={this.state.dict} type="subtable" config={this.state.config} refresh={this.updateConfig}/> */} |
| | | <EditComponent dict={this.state.dict} type="calendar" config={this.state.config} refresh={this.updateConfig}/> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['model.save']}</Button> |
| | | <Button onClick={this.cancelConfig}>{this.state.dict['model.back']}</Button> |
| | |
| | | const { MonthPicker } = DatePicker |
| | | const { TextArea } = Input |
| | | |
| | | const Card = ({ id, type, cols, card, moveCard, findCard, editCard, delCard, profileCard, hasDrop, copyCard }) => { |
| | | const Card = ({ id, type, cols, card, moveCard, findCard, editCard, delCard, profileCard, copyCard }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: ItemTypes[type], id, originalIndex }, |
| | |
| | | accept: ItemTypes[type], |
| | | canDrop: () => true, |
| | | drop: (item) => { |
| | | if (!item.hasOwnProperty('originalIndex')) { |
| | | hasDrop(card) |
| | | } |
| | | }, |
| | | hover({ id: draggedId }) { |
| | | if (!draggedId) return |
| | | if (draggedId !== id) { |
| | | const { id: draggedId, originalIndex } = item |
| | | |
| | | if (originalIndex === undefined) { |
| | | item.dropTargetId = id |
| | | } else if (draggedId && draggedId !== id) { |
| | | const { index: overIndex } = findCard(id) |
| | | moveCard(draggedId, overIndex) |
| | | } |
| | | }, |
| | | } |
| | | }) |
| | | const opacity = isDragging ? 0 : 1 |
| | | |
| | |
| | | import './index.scss' |
| | | |
| | | const Container = ({list, type, groupId, setting, placeholder, handleList, handleMenu, deleteMenu, profileMenu }) => { |
| | | let target = null |
| | | const [cards, setCards] = useState(list) |
| | | const moveCard = (id, atIndex) => { |
| | | const { card, index } = findCard(id) |
| | |
| | | deleteMenu({card: card, type: type}) |
| | | } |
| | | |
| | | const hasDrop = (item) => { |
| | | target = item |
| | | } |
| | | |
| | | const [, drop] = useDrop({ |
| | | accept: ItemTypes[type], |
| | | drop(item) { |
| | |
| | | newcard.verify = null |
| | | } |
| | | |
| | | let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0 |
| | | if (target) { |
| | | targetId = target.uuid |
| | | let targetId = '' |
| | | |
| | | if (item.dropTargetId) { |
| | | targetId = item.dropTargetId |
| | | delete item.dropTargetId |
| | | } else if (cards.length > 0) { |
| | | targetId = cards[cards.length - 1].uuid |
| | | } |
| | | |
| | | const { index: overIndex } = findCard(`${targetId}`) |
| | | let targetIndex = overIndex |
| | | const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] }) |
| | | |
| | | targetIndex++ |
| | | |
| | | const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] }) |
| | | handleList(type, _cards, newcard, groupId) |
| | | target = null |
| | | } |
| | | }) |
| | | |
| | |
| | | delCard={delCard} |
| | | profileCard={profileCard} |
| | | findCard={findCard} |
| | | hasDrop={hasDrop} |
| | | /> |
| | | ))} |
| | | {type === 'search' && cards.map(card => ( |
| | |
| | | delCard={delCard} |
| | | copyCard={copyCard} |
| | | findCard={findCard} |
| | | hasDrop={hasDrop} |
| | | /> |
| | | </Col> |
| | | ))} |
| | |
| | | |
| | | if (originalIndex === undefined) { |
| | | item.dropTargetId = id |
| | | } else if (draggedId) { |
| | | if (draggedId !== id) { |
| | | const { index: overIndex } = findCard(id) |
| | | moveCard(draggedId, overIndex) |
| | | } |
| | | } else if (draggedId && draggedId !== id) { |
| | | const { index: overIndex } = findCard(id) |
| | | moveCard(draggedId, overIndex) |
| | | } |
| | | } |
| | | }) |
| | |
| | | newcard.required = 'true' |
| | | newcard.focus = true |
| | | |
| | | let targetId = '0' |
| | | let targetId = '' |
| | | |
| | | if (item.dropTargetId) { |
| | | targetId = item.dropTargetId |
| | | delete item.dropTargetId |
| | | } else if (cards.length > 0) { |
| | | targetId = cards[cards.length - 1].uuid |
| | | } |
| | |
| | | * 3、设置编辑参数项-formlist |
| | | */ |
| | | handleForm = (_card) => { |
| | | const {menu, tabConfig, subTabConfig} = this.props |
| | | const { menu, tabConfig, subTabConfig } = this.props |
| | | let card = JSON.parse(JSON.stringify(_card)) |
| | | const { config } = this.state |
| | | let _inputfields = [] |
| | |
| | | setAll: 'false', |
| | | options: [], |
| | | dataSource: '', |
| | | linkField: '', |
| | | valueField: '', |
| | | valueText: '', |
| | | orderBy: '', |
| | | orderType: 'asc', |
| | | decimal: 0, |
| | | min: '', |
| | | max: '', |
| | | readonly: 'false', |
| | | required: 'true' |
| | | } |
| | |
| | | setAll: 'false', |
| | | options: [], |
| | | dataSource: '', |
| | | linkField: '', |
| | | valueField: '', |
| | | valueText: '', |
| | | orderBy: '', |
| | | orderType: 'asc', |
| | | readonly: 'false', |
| | | required: 'true' |
| | |
| | | import { Icon, Button, Popover } from 'antd' |
| | | import './index.scss' |
| | | |
| | | const Card = ({ id, card, moveCard, findCard, editCard, delCard, copyCard, profileCard, hasDrop, doubleClickCard }) => { |
| | | const Card = ({ id, card, moveCard, findCard, editCard, delCard, copyCard, profileCard, doubleClickCard }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: 'action', id, originalIndex }, |
| | |
| | | accept: 'action', |
| | | canDrop: () => true, |
| | | drop: (item) => { |
| | | if (!item.hasOwnProperty('originalIndex')) { |
| | | hasDrop(card) |
| | | } |
| | | }, |
| | | hover({ id: draggedId }) { |
| | | if (!draggedId) return |
| | | if (draggedId !== id) { |
| | | const { id: draggedId, originalIndex } = item |
| | | |
| | | if (originalIndex === undefined) { |
| | | item.dropTargetId = id |
| | | } else if (draggedId && draggedId !== id) { |
| | | const { index: overIndex } = findCard(id) |
| | | moveCard(draggedId, overIndex) |
| | | } |
| | | }, |
| | | } |
| | | }) |
| | | const opacity = isDragging ? 0 : 1 |
| | | |
| | |
| | | import './index.scss' |
| | | |
| | | const Container = ({list, setting, placeholder, handleList, handleMenu, deleteMenu, profileMenu, doubleClickCard }) => { |
| | | let target = null |
| | | |
| | | const [cards, setCards] = useState(list) |
| | | const moveCard = (id, atIndex) => { |
| | | const { card, index } = findCard(id) |
| | |
| | | handleList(_cards, copycard) |
| | | } |
| | | |
| | | const hasDrop = (item) => { |
| | | target = item |
| | | } |
| | | |
| | | const [, drop] = useDrop({ |
| | | accept: 'action', |
| | | drop(item) { |
| | |
| | | newcard.class = 'dgreen' |
| | | } |
| | | |
| | | let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0 |
| | | if (target) { |
| | | targetId = target.uuid |
| | | let targetId = '' |
| | | |
| | | if (item.dropTargetId) { |
| | | targetId = item.dropTargetId |
| | | delete item.dropTargetId |
| | | } else if (cards.length > 0) { |
| | | targetId = cards[cards.length - 1].uuid |
| | | } |
| | | |
| | | const { index: overIndex } = findCard(`${targetId}`) |
| | | let targetIndex = overIndex |
| | | |
| | | targetIndex++ |
| | | |
| | | const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] }) |
| | | const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] }) |
| | | |
| | | handleList(_cards, newcard) |
| | | target = null |
| | | } |
| | | }) |
| | | |
| | |
| | | editCard={editCard} |
| | | delCard={delCard} |
| | | findCard={findCard} |
| | | hasDrop={hasDrop} |
| | | profileCard={profileCard} |
| | | doubleClickCard={doubleClickBtn} |
| | | /> |
| | |
| | | import { Icon, Popover } from 'antd' |
| | | import './index.scss' |
| | | |
| | | const Card = ({ id, card, showfield, moveCard, findCard, editCard, delCard, markCard, hasDrop }) => { |
| | | const Card = ({ id, card, showfield, moveCard, findCard, editCard, delCard, markCard }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: 'columns', id, originalIndex }, |
| | |
| | | const [, drop] = useDrop({ |
| | | accept: 'columns', |
| | | canDrop: () => true, |
| | | drop: ({ id: draggedId, originalIndex }) => { |
| | | drop: (item) => { |
| | | const { id: draggedId, originalIndex } = item |
| | | |
| | | if (originalIndex === undefined) { |
| | | hasDrop(card) |
| | | item.dropTargetId = id |
| | | } else if (draggedId && draggedId !== id) { |
| | | const { index: overIndex } = findCard(id) |
| | | moveCard(draggedId, overIndex) |
| | |
| | | import './index.scss' |
| | | |
| | | const Container = ({list, setting, gridBtn, showfield, placeholder, handleList, handleMenu, handleGridBtn, deleteMenu, markMenu }) => { |
| | | let target = null |
| | | |
| | | const [cards, setCards] = useState(list) |
| | | const moveCard = (id, atIndex) => { |
| | | const { card, index } = findCard(id) |
| | |
| | | |
| | | const editCard = id => { |
| | | const { card } = findCard(id) |
| | | |
| | | delete card.focus // 兼容早期的合并列 |
| | | |
| | | handleMenu(card) |
| | |
| | | const markCard = id => { |
| | | const { card } = findCard(id) |
| | | markMenu(card) |
| | | } |
| | | |
| | | const hasDrop = (item) => { |
| | | target = item |
| | | } |
| | | |
| | | const [, drop] = useDrop({ |
| | |
| | | newcard.order = 'vertical' |
| | | } |
| | | |
| | | let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0 |
| | | if (target) { |
| | | targetId = target.uuid |
| | | let targetId = '' |
| | | |
| | | if (item.dropTargetId) { |
| | | targetId = item.dropTargetId |
| | | delete item.dropTargetId |
| | | } else if (cards.length > 0) { |
| | | targetId = cards[cards.length - 1].uuid |
| | | } |
| | | |
| | | const { index: overIndex } = findCard(`${targetId}`) |
| | | let targetIndex = overIndex |
| | | |
| | | targetIndex++ |
| | | |
| | | const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] }) |
| | | const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] }) |
| | | |
| | | handleList(_cards, newcard) |
| | | target = null |
| | | } |
| | | }) |
| | | |
| | |
| | | delCard={delCard} |
| | | markCard={markCard} |
| | | findCard={findCard} |
| | | hasDrop={hasDrop} |
| | | /> |
| | | ))} |
| | | {i === (columns.length - 1) && gridBtn && gridBtn.display ? |
| | |
| | | |
| | | const { MonthPicker, WeekPicker, RangePicker } = DatePicker |
| | | |
| | | const Card = ({ id, card, moveCard, copyCard, findCard, editCard, delCard, hasDrop }) => { |
| | | const Card = ({ id, card, moveCard, copyCard, findCard, editCard, delCard }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: 'search', id, originalIndex }, |
| | |
| | | accept: 'search', |
| | | canDrop: () => true, |
| | | drop: (item) => { |
| | | if (!item.hasOwnProperty('originalIndex')) { |
| | | hasDrop(card) |
| | | } |
| | | }, |
| | | hover({ id: draggedId }) { |
| | | if (!draggedId) return |
| | | if (draggedId !== id) { |
| | | const { id: draggedId, originalIndex } = item |
| | | |
| | | if (originalIndex === undefined) { |
| | | item.dropTargetId = id |
| | | } else if (draggedId && draggedId !== id) { |
| | | const { index: overIndex } = findCard(id) |
| | | moveCard(draggedId, overIndex) |
| | | } |
| | | }, |
| | | } |
| | | }) |
| | | const opacity = isDragging ? 0 : 1 |
| | | |
| | |
| | | import './index.scss' |
| | | |
| | | const Container = ({list, placeholder, handleList, handleMenu, deleteMenu }) => { |
| | | let target = null |
| | | |
| | | const [cards, setCards] = useState(list) |
| | | const moveCard = (id, atIndex) => { |
| | | const { card, index } = findCard(id) |
| | |
| | | handleList(_cards, copycard) |
| | | } |
| | | |
| | | const hasDrop = (item) => { |
| | | target = item |
| | | } |
| | | |
| | | const [, drop] = useDrop({ |
| | | accept: 'search', |
| | | drop(item) { |
| | |
| | | } |
| | | |
| | | newcard.match = _match |
| | | |
| | | let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0 |
| | | if (target) { |
| | | targetId = target.uuid |
| | | |
| | | let targetId = '' |
| | | |
| | | if (item.dropTargetId) { |
| | | targetId = item.dropTargetId |
| | | delete item.dropTargetId |
| | | } else if (cards.length > 0) { |
| | | targetId = cards[cards.length - 1].uuid |
| | | } |
| | | |
| | | const { index: overIndex } = findCard(`${targetId}`) |
| | | let targetIndex = overIndex |
| | | |
| | | targetIndex++ |
| | | |
| | | const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] }) |
| | | const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] }) |
| | | |
| | | handleList(_cards, newcard) |
| | | target = null |
| | | } |
| | | }) |
| | | |
| | |
| | | editCard={editCard} |
| | | delCard={delCard} |
| | | findCard={findCard} |
| | | hasDrop={hasDrop} |
| | | /> |
| | | </Col> |
| | | ))} |
| | |
| | | import { Icon, Popover } from 'antd' |
| | | import './index.scss' |
| | | |
| | | const Card = ({ id, card, moveCard, findCard, doubleClickCard, editCard, delCard, hasDrop }) => { |
| | | const Card = ({ id, card, moveCard, findCard, doubleClickCard, editCard, delCard }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: 'tabs', id, originalIndex }, |
| | |
| | | accept: 'tabs', |
| | | canDrop: () => true, |
| | | drop: (item) => { |
| | | if (!item.hasOwnProperty('originalIndex')) { |
| | | hasDrop(card) |
| | | } |
| | | }, |
| | | hover({ id: draggedId }) { |
| | | if (!draggedId) return |
| | | if (draggedId !== id) { |
| | | const { id: draggedId, originalIndex } = item |
| | | |
| | | if (originalIndex === undefined) { |
| | | item.dropTargetId = id |
| | | } else if (draggedId && draggedId !== id) { |
| | | const { index: overIndex } = findCard(id) |
| | | moveCard(draggedId, overIndex) |
| | | } |
| | |
| | | const { TabPane } = Tabs |
| | | |
| | | const Container = ({list, placeholder, handleList, handleMenu, deleteMenu, doubleClickCard }) => { |
| | | let target = null |
| | | const [cards, setCards] = useState(list) |
| | | const moveCard = (id, atIndex) => { |
| | | const { card, index } = findCard(id) |
| | |
| | | } |
| | | } |
| | | |
| | | const hasDrop = (item) => { |
| | | target = item |
| | | } |
| | | |
| | | const [, drop] = useDrop({ |
| | | accept: 'tabs', |
| | | drop(item) { |
| | |
| | | newcard.supMenu = 'mainTable' |
| | | newcard.focus = true |
| | | |
| | | let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0 |
| | | if (target) { |
| | | targetId = target.uuid |
| | | let targetId = '' |
| | | |
| | | if (item.dropTargetId) { |
| | | targetId = item.dropTargetId |
| | | delete item.dropTargetId |
| | | } else if (cards.length > 0) { |
| | | targetId = cards[cards.length - 1].uuid |
| | | } |
| | | |
| | | const { index: overIndex } = findCard(`${targetId}`) |
| | | let targetIndex = overIndex |
| | | const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] }) |
| | | |
| | | targetIndex++ |
| | | |
| | | const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] }) |
| | | handleList(_cards, newcard) |
| | | target = null |
| | | } |
| | | }) |
| | | |
| | |
| | | findCard={findCard} |
| | | editCard={editCard} |
| | | delCard={delCard} |
| | | hasDrop={hasDrop} |
| | | doubleClickCard={doubleClickBab} |
| | | /> |
| | | } key={`${index}`}> |
| | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | |
| | | import MenuForm from '@/templates/comtableconfig/menuform' |
| | | import EditComponent from '@/templates/zshare/editcomponent' |
| | | import SourceElement from '@/templates/zshare/dragsource' |
| | | import Source from './source' |
| | | import './index.scss' |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 编辑功能完成更新,包括解冻按钮、粘贴、替换等 |
| | | */ |
| | | editConfig = (res) => { |
| | | if (res.type === 'paste') { |
| | | this.setState({ |
| | | pasteContent: res.content |
| | | }, () => { |
| | | this.setState({ |
| | | pasteContent: null |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 更新标签配置信息 |
| | | */ |
| | | updatetabs = (config, delcards) => { |
| | |
| | | </div> |
| | | } bordered={false} extra={ |
| | | <div> |
| | | <EditComponent dict={this.state.dict} type="TreePage" config={this.state.config} MenuID={this.props.menu.MenuID} refresh={this.editConfig}/> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['model.save']}</Button> |
| | | <Button onClick={this.cancelConfig}>{this.state.dict['model.back']}</Button> |
| | |
| | | import { Menu, Dropdown, Icon, Modal, Spin, notification } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import PasteForm from '@/templates/zshare/pasteform' |
| | | import ReplaceForm from '@/templates/zshare/replaceform' |
| | | import TransferForm from '@/templates/zshare/basetransferform' |
| | |
| | | |
| | | this.pasteFormRef.handleConfirm().then(res => { |
| | | if (['maintable', 'subtable'].includes(type) && res.copyType === 'action') { |
| | | if (this.props.type === 'subtable' && !['pop', 'prompt', 'exec', 'excelIn', 'excelOut', 'popview'].includes(res.OpenType)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '不支持此打开方式!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | res.uuid = Utils.getuuid() |
| | | |
| | | this.setState({ |
| | | pasteVisible: false |
| | | }, () => { |
| | |
| | | content: res |
| | | }) |
| | | }) |
| | | } else if (['maintable', 'subtable'].includes(type) && res.copyType === 'search') { |
| | | } else if (['maintable', 'subtable', 'calendar'].includes(type) && (res.copyType === 'search' || res.copyType === 'form')) { |
| | | res.uuid = Utils.getuuid() |
| | | |
| | | // search: text select multiselect link date dateweek datemonth daterange group |
| | | // 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)) { |
| | | res.type = 'text' |
| | | } else if (res.type === 'radio') { |
| | | res.type = 'select' |
| | | } else if (res.type === 'checkbox') { |
| | | res.type = 'multiselect' |
| | | } else if (res.type === 'datetime') { |
| | | res.type = 'date' |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | pasteVisible: false |
| | | }, () => { |
| | |
| | | content: res |
| | | }) |
| | | }) |
| | | } else if (['form'].includes(type) && res.copyType === 'form') { |
| | | if (res.type === 'linkMain') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '不支持此表单类型!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | } else if (['form'].includes(type) && (res.copyType === 'form' || res.copyType === 'search')) { |
| | | let _config = fromJS(config).toJS() |
| | | let fieldrepet = false |
| | | let labelrepet = false |
| | | let fields = [] |
| | | let labels = [] |
| | | |
| | | res.uuid = Utils.getuuid() |
| | | |
| | | // search: text select multiselect link date dateweek datemonth daterange group |
| | | // form: text number select multiselect link switch checkbox radio checkcard |
| | | // fileupload date datemonth datetime textarea hint color funcvar |
| | | if (res.copyType === 'search') { |
| | | if (res.type === 'dateweek' || res.type === 'daterange' || res.type === 'group') { |
| | | res.type = 'date' |
| | | } |
| | | } |
| | | |
| | | if (_config.groups.length > 0) { |
| | | _config.groups.forEach(group => { |
| | | group.sublist.forEach(item => { |
| | | if (item.uuid === res.uuid) { |
| | | fieldrepet = true |
| | | } else if (item.field === res.field) { |
| | | fieldrepet = true |
| | | } else if (item.label === res.label) { |
| | | labelrepet = true |
| | | } |
| | | fields.push(item.field) |
| | | labels.push(item.label) |
| | | }) |
| | | if (group.default) { |
| | | group.sublist.push(res) |
| | | } |
| | | }) |
| | | } else { |
| | | _config.fields.forEach(item => { |
| | | if (item.uuid === res.uuid) { |
| | | fieldrepet = true |
| | | } else if (item.field === res.field) { |
| | | fieldrepet = true |
| | | } else if (item.label === res.label) { |
| | | labelrepet = true |
| | | } |
| | | fields.push(item.field) |
| | | labels.push(item.label) |
| | | }) |
| | | _config.fields.push(res) |
| | | } |
| | | |
| | | if (fieldrepet) { |
| | | if (fields.includes(res.field)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '字段已存在!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } else if (labelrepet) { |
| | | } else if (labels.includes(res.label)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '名称已存在!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (_config.groups.length > 0) { |
| | | _config.groups.forEach(group => { |
| | | if (group.default) { |
| | | group.sublist.push(res) |
| | | } |
| | | }) |
| | | } else { |
| | | _config.fields.push(res) |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | const menu = ( |
| | | <Menu onClick={this.handleMenuClick}> |
| | | {['maintable', 'subtable'].includes(type) ? <Menu.Item key="thaw"><Icon type="unlock" />{dict['header.form.thawbutton']}</Menu.Item> : null} |
| | | {['maintable', 'subtable', 'form'].includes(type) ? <Menu.Item key="paste"><Icon type="snippets" />{dict['header.form.paste']}</Menu.Item> : null} |
| | | {['maintable', 'subtable', 'form', 'calendar'].includes(type) ? <Menu.Item key="paste"><Icon type="snippets" />{dict['header.form.paste']}</Menu.Item> : null} |
| | | {/* <Menu.Item key="replace"><Icon type="retweet" />替换</Menu.Item> */} |
| | | </Menu> |
| | | ) |