2 文件已重命名
22个文件已修改
2个文件已添加
4个文件已删除
| | |
| | | <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" /> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| | | <meta name="theme-color" content="#000000" /> |
| | | <meta name="description" content="minkesoft" /> |
| | | <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> |
| | | <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo.png" /> |
| | | <script src="%PUBLIC_URL%/options.js"></script> |
| | |
| | | return Promise.reject(error) |
| | | }) |
| | | |
| | | const setCurrentUrl = () => { |
| | | if (!!(window.history && window.history.pushState)) { |
| | | window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') |
| | | window.location.reload() |
| | | } |
| | | } |
| | | // const setCurrentUrl = () => { |
| | | // if (!!(window.history && window.history.pushState)) { |
| | | // window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') |
| | | // window.location.reload() |
| | | // } |
| | | // } |
| | | |
| | | axios.interceptors.response.use((response) => { |
| | | if (response.data.ErrCode === 'LoginError') { |
| | | setCurrentUrl() |
| | | // setCurrentUrl() |
| | | } else { |
| | | return Promise.resolve(response.data) |
| | | } |
| | |
| | | import TransferForm from '@/components/transferform' |
| | | import DragElement from '../dragelement' |
| | | import MenuForm from '../menuform' |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import zhCN from '@/locales/zh-CN/header.js' |
| | | import enUS from '@/locales/en-US/header.js' |
| | | import Api from '@/api' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | |
| | | let _this = this |
| | | let param = {} |
| | | param.func = 'sPC_Menu_SortUpt' |
| | | param.LText = [] |
| | | let _text = [] |
| | | previewList.forEach((item, index) => { |
| | | param.LText.push('selectmspace\'' + item.MenuID + '\'mspaceasmspaceMenuid,' + (index + 1) * 10 + 'mspaceasmspacesort') |
| | | _text.push('select \'' + item.MenuID + '\' as Menuid,' + (index + 1) * 10 + ' as sort') |
| | | }) |
| | | param.LText = param.LText.join('mspaceunionmspace') |
| | | _text = _text.join(' union ') |
| | | param.LText = Utils.formatOptions(_text) |
| | | confirm({ |
| | | title: this.state.dict['header.menu.resetorder'], |
| | | content: '', |
| | |
| | | let _this = this |
| | | let param = {} |
| | | param.func = 'sPC_Menu_SortUpt' |
| | | param.LText = [] |
| | | let _text = [] |
| | | previewList.forEach((item, index) => { |
| | | param.LText.push('selectmspace\'' + item.MenuID + '\'mspaceasmspaceMenuid,' + (index + 1) * 10 + 'mspaceasmspacesort') |
| | | _text.push('select \'' + item.MenuID + '\' as Menuid,' + (index + 1) * 10 + ' as sort') |
| | | }) |
| | | param.LText = param.LText.join('mspaceunionmspace') |
| | | _text = _text.join(' union ') |
| | | param.LText = Utils.formatOptions(_text) |
| | | confirm({ |
| | | title: this.state.dict['header.menu.resetorder'], |
| | | content: '', |
| | |
| | | let _this = this |
| | | let param = {} |
| | | param.func = 'sPC_Menu_SortUpt' |
| | | param.LText = [] |
| | | let _text = [] |
| | | previewList.forEach((item, index) => { |
| | | param.LText.push('selectmspace\'' + item.MenuID + '\'mspaceasmspaceMenuid,' + (index + 1) * 10 + 'mspaceasmspacesort') |
| | | _text.push('select \'' + item.MenuID + '\' as Menuid,' + (index + 1) * 10 + ' as sort') |
| | | }) |
| | | param.LText = param.LText.join('mspaceunionmspace') |
| | | _text = _text.join(' union ') |
| | | param.LText = Utils.formatOptions(_text) |
| | | |
| | | confirm({ |
| | | title: this.state.dict['header.menu.resetorder'], |
| | | content: '', |
| | |
| | | |
| | | handleSubConfig = (item, originMenu, config) => { |
| | | if (item.OpenType === 'pop') { |
| | | item.pageParam = '' |
| | | if (config && config.type === 'modal') { |
| | | item.pageParam = config |
| | | } |
| | | |
| | | this.setState({ |
| | | editMenu: originMenu, |
| | | editAction: item, |
| | | tabview: 'Modal' |
| | | }) |
| | | } |
| | | console.log(item) |
| | | console.log(originMenu) |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | 'header.menu.openType.newWindow': 'A new window', |
| | | 'header.menu.newpage.service': 'Customer Service', |
| | | 'header.form.search.placeholder': '请添加搜索条件', |
| | | 'header.form.modal.placeholder': '请添加表单', |
| | | 'header.form.action.placeholder': '请添加按钮', |
| | | 'header.form.column.placeholder': '请添加显示列', |
| | | 'header.form.column.source': '显示列', |
| | |
| | | 'header.menu.openType.newWindow': '新窗口', |
| | | 'header.menu.newpage.service': '客服', |
| | | 'header.form.search.placeholder': '请添加搜索条件', |
| | | 'header.form.modal.placeholder': '请添加表单', |
| | | 'header.form.action.placeholder': '请添加按钮', |
| | | 'header.form.column.placeholder': '请添加显示列', |
| | | 'header.form.column.source': '显示列', |
| | |
| | | const proxy = require('http-proxy-middleware') |
| | | const service = 'mkwms' |
| | | |
| | | module.exports = function(app) { |
| | | app.use(proxy('/webapi', { |
| | | target: 'http://qingqiumarket.cn/MKWMS/webapi', |
| | | target: `http://qingqiumarket.cn/${service}/webapi`, |
| | | secure: false, |
| | | changeOrigin: true, |
| | | pathRewrite: { |
| | |
| | | })) |
| | | |
| | | app.use(proxy('/zh-CN', { // 登录接口 |
| | | target: 'http://qingqiumarket.cn/MKWMS/zh-CN', |
| | | target: `http://qingqiumarket.cn/${service}/zh-CN`, |
| | | secure: false, |
| | | changeOrigin: true, |
| | | pathRewrite: { |
| | |
| | | } |
| | | let result = await Api.getSystemConfig(param) |
| | | if (result.status && result.LongParam) { |
| | | |
| | | let config = window.decodeURIComponent(window.atob(result.LongParam)) |
| | | |
| | | try { |
| | | config = JSON.parse(config) |
| | | this.setState({ |
| | |
| | | export default { |
| | | CARD: 'card', |
| | | form: 'form', |
| | | search: 'search', |
| | | action: 'action', |
| | | columns: 'columns' |
| | |
| | | }) |
| | | _this.setState({ |
| | | config: _config, |
| | | [element.type + 'loading']: true, |
| | | visible: false |
| | | [element.type + 'loading']: true |
| | | }, () => { |
| | | _this.setState({ |
| | | [element.type + 'loading']: false |
| | |
| | | return |
| | | } |
| | | |
| | | let sql = [] |
| | | config.action.forEach((item, index) => { |
| | | sql.push(`'${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`) |
| | | }) |
| | | sql = sql.join(' union all select ') |
| | | sql = 'select ' + sql |
| | | |
| | | sql = Utils.formatOptions(sql) |
| | | |
| | | let btnParam = { |
| | | func: 'sPC_Button_AddUpt', |
| | | ParentID: menu.MenuID, |
| | | MenuNo: res.menuNo, |
| | | Template: menu.PageParam.Template || '', |
| | | PageParam: '', |
| | | LongParam: '', |
| | | LongButton: sql |
| | | } |
| | | |
| | | if (this.state.operaType === 'add') { // 新建菜单 |
| | | let param = { |
| | | func: 'sPC_TrdMenu_Add', |
| | |
| | | PageParam: JSON.stringify(_pageParam), |
| | | LongParam: _LongParam |
| | | } |
| | | |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | | this.setState({ |
| | | menuloading: false, |
| | | operaType: 'edit', |
| | | originMenu: { |
| | | ...originMenu, |
| | |
| | | ParentID: res.parentId |
| | | } |
| | | }) |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | | duration: 10 |
| | | }) |
| | | this.submitAction(btnParam) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false |
| | |
| | | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | | duration: 10 |
| | | this.setState({ |
| | | originMenu: { |
| | | ...originMenu, |
| | | LongParam: _config, |
| | | PageParam: _pageParam, |
| | | MenuName: res.menuName, |
| | | MenuNo: res.menuNo, |
| | | ParentID: res.parentId |
| | | } |
| | | }) |
| | | if (this.state.closeVisible) { |
| | | this.props.handleConfig('') |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | | originMenu: { |
| | | ...originMenu, |
| | | LongParam: _config, |
| | | PageParam: _pageParam, |
| | | MenuName: res.menuName, |
| | | MenuNo: res.menuNo, |
| | | ParentID: res.parentId |
| | | } |
| | | }) |
| | | } |
| | | this.submitAction(btnParam) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false |
| | |
| | | /** |
| | | * @description 保存或修改菜单按钮 |
| | | */ |
| | | submitAction = () => { |
| | | if (!is(fromJS(this.state.originActions), fromJS())) { |
| | | |
| | | } |
| | | submitAction = (param) => { |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | | duration: 10 |
| | | }) |
| | | if (this.state.closeVisible) { |
| | | this.props.handleConfig('') |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false |
| | | }) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | cancelConfig = () => { |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 设置可配置按钮 |
| | | */ |
| | | setSubConfig = (btn) => { |
| | | const { menu } = this.props |
| | | const { config, originMenu } = this.state |
| | |
| | | loading: true |
| | | }) |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_FrozenMenu', |
| | | ParentID: btn.uuid, |
| | | TYPE: 30 |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: btn.uuid |
| | | }).then(res => { |
| | | if (res.status) { |
| | | let btnconfig = '' |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | this.props.handleSubConfig(btn, originMenu, btnconfig) |
| | | let _LongParam = '' |
| | | if (res.LongParam) { |
| | | _LongParam = window.decodeURIComponent(window.atob(res.LongParam)) |
| | | try { |
| | | _LongParam = JSON.parse(_LongParam) |
| | | } catch (e) { |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | this.props.handleSubConfig(btn, originMenu, _LongParam) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | import React from 'react' |
| | | import { useDrag, useDrop } from 'react-dnd' |
| | | import { Icon, Button, Select, DatePicker, Input } from 'antd' |
| | | import { Icon, Select, DatePicker, Input } from 'antd' |
| | | import moment from 'moment' |
| | | import ItemTypes from './itemtypes' |
| | | import './index.scss' |
| | | |
| | | const Card = ({ id, type, card, moveCard, findCard, editCard, copyCard, hasDrop }) => { |
| | | const { MonthPicker } = DatePicker |
| | | |
| | | const Card = ({ id, card, moveCard, findCard, editCard, closeCard, hasDrop }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: ItemTypes[type], id, originalIndex }, |
| | | item: { type: ItemTypes.form, id, originalIndex }, |
| | | collect: monitor => ({ |
| | | isDragging: monitor.isDragging(), |
| | | }), |
| | | }) |
| | | const [, drop] = useDrop({ |
| | | accept: ItemTypes[type], |
| | | accept: ItemTypes.form, |
| | | canDrop: () => true, |
| | | drop: (item) => { |
| | | if (!item.hasOwnProperty('originalIndex')) { |
| | |
| | | editCard(id) |
| | | } |
| | | |
| | | const copy = () => { |
| | | copyCard(id) |
| | | const close = () => { |
| | | closeCard(id) |
| | | } |
| | | |
| | | return ( |
| | | <div className="page-card" style={type === 'columns' ? { flex: card.Width, opacity: opacity} : { opacity: opacity}}> |
| | | <div className="page-card" style={{ opacity: opacity}}> |
| | | <div ref={node => drag(drop(node))}> |
| | | {type === 'search' && <div className="ant-row ant-form-item"> |
| | | {<div className="ant-row ant-form-item"> |
| | | <div className="ant-col ant-form-item-label"> |
| | | <label title={card.label}>{card.label}</label> |
| | | </div> |
| | | <div className="ant-col ant-form-item-control-wrapper"> |
| | | {card.type === 'text' && |
| | | <Input style={{marginTop: '4px'}} defaultValue={card.initval} /> |
| | | } |
| | | {card.type === 'number' && |
| | | <Input style={{marginTop: '4px'}} defaultValue={card.initval} /> |
| | | } |
| | | {(card.type === 'select' || card.type === 'link') && |
| | |
| | | {card.type === 'date' && |
| | | <DatePicker defaultValue={card.initval ? moment(card.initval, 'YYYY-MM-DD') : null} /> |
| | | } |
| | | {card.type === 'datemonth' ? |
| | | <MonthPicker defaultValue={card.initval ? moment().subtract(card.initval, 'month') : null} /> : null |
| | | } |
| | | {card.type === 'datetime' && |
| | | <DatePicker showTime defaultValue={card.initval ? moment(card.initval, 'YYYY-MM-DD HH:mm:ss') : null} /> |
| | | } |
| | | <div className="input-mask"></div> |
| | | </div> |
| | | </div>} |
| | | {type === 'action' && |
| | | <Button |
| | | className={'mk-btn mk-' + card.class} |
| | | icon={card.icon} |
| | | key={card.uuid} |
| | | >{card.label}</Button> |
| | | } |
| | | {type === 'columns' && |
| | | <span className="ant-table-header-column"> |
| | | <div className="ant-table-column-sorters" title={card.label} style={{textAlign: card.Align}}> |
| | | <span className="ant-table-column-title">{card.label}</span> |
| | | {card.IsSort === 'true' && <span className="ant-table-column-sorter"> |
| | | <Icon type="caret-up" /> |
| | | <Icon type="caret-down" /> |
| | | </span>} |
| | | </div> |
| | | </span> |
| | | } |
| | | </div> |
| | | <Icon className="edit" type="edit" onClick={edit} /> |
| | | {type === 'action' && <Icon className="edit copy" type="copy" onClick={copy} />} |
| | | <Icon className="edit close" type="close" onClick={close} /> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | import ItemTypes from './itemtypes' |
| | | import './index.scss' |
| | | |
| | | const Container = ({list, type, placeholder, handleList, handleMenu }) => { |
| | | const Container = ({list, setting, placeholder, handleList, handleForm, closeForm }) => { |
| | | let target = null |
| | | const [cards, setCards] = useState(list) |
| | | const moveCard = (id, atIndex) => { |
| | | const { card, index } = findCard(id) |
| | | const _cards = update(cards, { $splice: [[index, 1], [atIndex, 0, card]] }) |
| | | setCards(_cards) |
| | | handleList({[type]: _cards}) |
| | | handleList(_cards) |
| | | } |
| | | |
| | | const findCard = id => { |
| | |
| | | |
| | | const editCard = id => { |
| | | const { card } = findCard(id) |
| | | handleMenu(card) |
| | | handleForm(card) |
| | | } |
| | | |
| | | const closeCard = id => { |
| | | const { card } = findCard(id) |
| | | closeForm(card) |
| | | } |
| | | |
| | | const hasDrop = (item) => { |
| | |
| | | } |
| | | |
| | | const [, drop] = useDrop({ |
| | | accept: ItemTypes[type], |
| | | accept: ItemTypes.form, |
| | | drop(item) { |
| | | if (item.hasOwnProperty('originalIndex')) { |
| | | return |
| | | } |
| | | |
| | | let newcard = {} |
| | | if (item.type === 'search') { |
| | | newcard.uuid = Utils.getuuid() |
| | | newcard.label = 'fieldName' |
| | | newcard.field = '' |
| | | newcard.initval = '' |
| | | newcard.type = item.subType |
| | | newcard.resourceType = '0' |
| | | newcard.options = [] |
| | | newcard.dataSource = '' |
| | | newcard.setAll = 'false' |
| | | newcard.linkField = '' |
| | | newcard.valueField = '' |
| | | newcard.valueText = '' |
| | | newcard.orderBy = '' |
| | | newcard.orderType = 'asc' |
| | | newcard.display = 'dropdown' |
| | | } |
| | | newcard.uuid = Utils.getuuid() |
| | | newcard.label = 'label' |
| | | newcard.field = '' |
| | | newcard.initval = '' |
| | | newcard.type = item.subType |
| | | newcard.resourceType = '0' |
| | | newcard.options = [] |
| | | newcard.dataSource = '' |
| | | newcard.setAll = 'false' |
| | | newcard.linkField = '' |
| | | newcard.valueField = '' |
| | | newcard.valueText = '' |
| | | newcard.orderBy = '' |
| | | newcard.orderType = 'asc' |
| | | |
| | | let indexes = cards.map(car => {return car.id}) |
| | | let newid = 0 |
| | |
| | | |
| | | const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] }) |
| | | setCards(_cards) |
| | | handleList({[type]: _cards}) |
| | | handleList(_cards) |
| | | target = null |
| | | } |
| | | }) |
| | | |
| | | let _cols = 24 / (setting.cols || 2) |
| | | |
| | | return ( |
| | | <div ref={drop} className="ant-row"> |
| | | {type === 'search' && cards.map(card => ( |
| | | <Col key={card.uuid} span={6}> |
| | | {cards.map(card => ( |
| | | <Col key={card.uuid} span={_cols}> |
| | | <Card |
| | | key={card.uuid} |
| | | id={`${card.id}`} |
| | | type={type} |
| | | card={card} |
| | | moveCard={moveCard} |
| | | editCard={editCard} |
| | | closeCard={closeCard} |
| | | findCard={findCard} |
| | | hasDrop={hasDrop} |
| | | /> |
| | |
| | | export default { |
| | | CARD: 'card', |
| | | form: 'form', |
| | | search: 'search', |
| | | action: 'action', |
| | | columns: 'columns' |
| | |
| | | import React, {Component} from 'react' |
| | | import { Row, Col, Icon, Radio } from 'antd' |
| | | import { Row, Col, Icon, Radio, Input } from 'antd' |
| | | import './index.scss' |
| | | |
| | | const { Search } = Input |
| | | |
| | | class EditCardCell extends Component { |
| | | constructor(props) { |
| | |
| | | const { card } = this.state |
| | | this.setState({ |
| | | card: {...card, selected: !card.selected} |
| | | }, () => { |
| | | this.props.changeCard(this.state.card) |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { card, type } = this.state |
| | | let _type = card.type |
| | | if (type === 'columns') { |
| | | if (_type !== 'picture') { |
| | | _type = 'text' |
| | | } |
| | | } else if (type === 'search') { |
| | | if (_type === 'number') { |
| | | _type = 'text' |
| | | } |
| | | } |
| | | const { card } = this.state |
| | | return ( |
| | | <div className={'ant-card ant-card-bordered ' + (card.selected ? 'selected' : '')} > |
| | | <div className="base" onClick={this.changeSelect}> |
| | | <Icon type="check" /> |
| | | <p title={card.field}>字段名: {card.field}</p> |
| | | <p title={card.label}>提示文字: {card.label}</p> |
| | | <p title={card.field}>字段: <span>{card.field}</span></p> |
| | | <p title={card.label}>名称: <span>{card.label}</span></p> |
| | | </div> |
| | | {type === 'search' && <Radio.Group onChange={this.changeType} value={_type} disabled={!card.selected}> |
| | | <Radio.Group onChange={this.changeType} value={card.type} disabled={!card.selected}> |
| | | <Radio value="text">text</Radio> |
| | | <Radio value="number">number</Radio> |
| | | <Radio value="select">select</Radio> |
| | | <Radio value="date">date</Radio> |
| | | <Radio value="datetime">datetime</Radio> |
| | | </Radio.Group>} |
| | | {type === 'columns' && <Radio.Group onChange={this.changeType} value={_type} disabled={!card.selected}> |
| | | <Radio value="text">text</Radio> |
| | | <Radio value="picture">picture</Radio> |
| | | </Radio.Group>} |
| | | </Radio.Group> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | |
| | | this.state = { |
| | | dataSource: props.data, |
| | | type: props.type |
| | | selectCards: props.data.filter(item => item.selected), |
| | | type: props.type, |
| | | searchKey: '' |
| | | } |
| | | } |
| | | |
| | | getSelectedCard = () => { |
| | | let box = [] |
| | | this.state.dataSource.forEach((item, index) => { |
| | | box.push(this.refs['cellCard' + index].state.card) |
| | | changeCard = (item) => { |
| | | let cards = JSON.parse(JSON.stringify(this.state.selectCards)) |
| | | let isAdd = true |
| | | cards = cards.map(card => { |
| | | if (card.field === item.field) { |
| | | isAdd = false |
| | | return item |
| | | } else { |
| | | return card |
| | | } |
| | | }) |
| | | return box |
| | | if (isAdd) { |
| | | cards.push(item) |
| | | } |
| | | this.setState({ |
| | | selectCards: cards |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | |
| | | |
| | | return ( |
| | | <div className="common-modal-edit-card"> |
| | | <Row className="search-row"> |
| | | <Col span={8}> |
| | | <Search placeholder="请输入字段名" onSearch={value => {this.setState({searchKey: value})}} enterButton /> |
| | | </Col> |
| | | </Row> |
| | | <Row> |
| | | {dataSource.map((item, index) => ( |
| | | <Col key={index} span={8}> |
| | | <EditCardCell ref={'cellCard' + index} type={type} card={item} /> |
| | | </Col> |
| | | ))} |
| | | {dataSource.map((item, index) => { |
| | | if (item.field.toLowerCase().indexOf(this.state.searchKey.toLowerCase()) >= 0) { |
| | | return ( |
| | | <Col key={index} span={8}> |
| | | <EditCardCell ref={'cellCard' + index} type={type} card={item} changeCard={this.changeCard} /> |
| | | </Col> |
| | | ) |
| | | } else { |
| | | return '' |
| | | } |
| | | })} |
| | | </Row> |
| | | </div> |
| | | ) |
| | |
| | | white-space: nowrap; |
| | | } |
| | | label { |
| | | margin-right: 7px; |
| | | margin-right: 15px; |
| | | span.ant-radio + * { |
| | | padding-right: 0px; |
| | | padding-left: 4px; |
| | |
| | | opacity: 1; |
| | | color: #1890ff; |
| | | } |
| | | p { |
| | | color: #1890ff; |
| | | } |
| | | } |
| | | } |
| | | .search-row { |
| | | .ant-col { |
| | | padding-top: 0px; |
| | | } |
| | | } |
| | | } |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { Button, Card, Modal, Collapse, notification, Select, List, Icon } from 'antd' |
| | | import { Button, Card, Modal, Collapse, notification, Select, List, Icon, Empty } from 'antd' |
| | | import DragElement from './dragelement' |
| | | import SourceElement from './dragelement/source' |
| | | import Api from '@/api' |
| | | // import SearchForm from './searchform' |
| | | // import ActionForm from './actionform' |
| | | // import ColumnForm from './columnform' |
| | | import ModalForm from './modalform' |
| | | import SettingForm from './settingform' |
| | | // import EditCard from './editcard' |
| | | import EditCard from './editcard' |
| | | import MenuForm from './menuform' |
| | | import zhCN from '@/locales/zh-CN/comtable.js' |
| | | import enUS from '@/locales/en-US/comtable.js' |
| | |
| | | fields: null, // 搜索条件及显示列,可选字段 |
| | | modalformlist: null, // 基本信息表单字段 |
| | | formlist: null, // 搜索条件、按钮、显示列表单字段 |
| | | formtemp: '', // 表单类型,显示列、按钮、搜索条件 |
| | | card: null, // 编辑元素 |
| | | searchloading: false, // 搜索条件加载中 |
| | | actionloading: false, // 按钮加载中 |
| | | columnsloading: false, // 显示列加载中 |
| | | loading: false, // 搜索条件加载中 |
| | | menuloading: false, // 菜单保存中 |
| | | settingVisible: false, // 全局配置模态框 |
| | | closeVisible: false, // 关闭模态框 |
| | |
| | | UNSAFE_componentWillMount () { |
| | | const {menu, editAction} = this.props |
| | | |
| | | let _config = JSON.parse(JSON.stringify((Source.baseConfig))) |
| | | let _config = '' |
| | | let _operaType = 'add' |
| | | if (editAction.pageParam) { |
| | | _config = editAction.pageParam |
| | | _operaType = 'edit' |
| | | } else { |
| | | _config = JSON.parse(JSON.stringify((Source.baseConfig))) |
| | | } |
| | | |
| | | if (!_config.setting.title) { |
| | | _config.setting.title = editAction.label |
| | | } |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | operaType: _operaType, |
| | | selectedTables: _config.tables || [], |
| | | modalformlist: [ |
| | | { |
| | |
| | | key: 'btnName', |
| | | label: '按钮名称', |
| | | initVal: editAction.label, |
| | | required: true, |
| | | readonly: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'menuNo', |
| | | label: this.state.dict['header.menu.menuNo'], |
| | | initVal: menu.MenuNo, |
| | | required: true, |
| | | readonly: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'opentype', |
| | | label: this.state.dict['header.menu.openType'], |
| | | initVal: '弹窗(表单)', |
| | | required: true, |
| | | readonly: true |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | handleList = (listObj) => { |
| | | let config = this.state.config |
| | | if (this.state.operaType === 'add') { |
| | | let key = Object.keys(listObj)[0] |
| | | let newlength = listObj[key].length |
| | | if (newlength > config[key].length) { |
| | | listObj[key] = listObj[key].filter(item => !item.origin) |
| | | } |
| | | if (newlength > listObj[key].length) { |
| | | handleList = (list) => { |
| | | let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | if (list.length > _config.fields.length) { |
| | | _config.fields = list.filter(item => !item.origin) |
| | | this.setState({ |
| | | loading: true, |
| | | config: _config |
| | | }, () => { |
| | | this.setState({ |
| | | [key + 'loading']: true, |
| | | config: {...config, ...listObj} |
| | | loading: false |
| | | }) |
| | | setTimeout(() => { |
| | | this.setState({ |
| | | [key + 'loading']: false |
| | | }) |
| | | }, 100) |
| | | } else { |
| | | this.setState({config: {...config, ...listObj}}) |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({config: {...config, ...listObj}}) |
| | | _config.fields = list |
| | | this.setState({config: _config}) |
| | | } |
| | | } |
| | | |
| | | handleSearch = (card) => { |
| | | handleForm = (card) => { |
| | | this.setState({ |
| | | visible: true, |
| | | formtemp: 'search', |
| | | card: card, |
| | | formlist: [ |
| | | { |
| | |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'initval', |
| | | label: this.state.dict['header.form.initval'], |
| | | initVal: card.initval, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'type', |
| | | label: this.state.dict['header.form.type'], |
| | | initVal: card.type, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'text', |
| | | value: 'text', |
| | | text: this.state.dict['header.form.text'] |
| | | }, { |
| | | MenuID: 'select', |
| | | value: 'select', |
| | | text: this.state.dict['header.form.select'] |
| | | }, { |
| | | MenuID: 'link', |
| | | value: 'link', |
| | | text: this.state.dict['header.form.link'] |
| | | }, { |
| | | MenuID: 'date', |
| | | value: 'date', |
| | | text: this.state.dict['header.form.dateday'] |
| | | }, { |
| | | MenuID: 'datetime', |
| | | text: this.state.dict['header.form.datetime'] |
| | | value: 'dateweek', |
| | | text: this.state.dict['header.form.dateweek'] |
| | | }, { |
| | | value: 'datemonth', |
| | | text: this.state.dict['header.form.datemonth'] |
| | | }, { |
| | | value: 'daterange', |
| | | text: this.state.dict['header.form.daterange'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'initval', |
| | | label: this.state.dict['header.form.initval'], |
| | | initVal: card.initval, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | initVal: card.resourceType || '0', |
| | | required: true, |
| | | options: [{ |
| | | MenuID: '0', |
| | | value: '0', |
| | | text: this.state.dict['header.form.custom'] |
| | | }, { |
| | | MenuID: '1', |
| | | value: '1', |
| | | text: this.state.dict['header.form.datasource'] |
| | | }] |
| | | }, |
| | |
| | | label: this.state.dict['header.form.setAll'], |
| | | initVal: card.setAll || 'false', |
| | | options: [{ |
| | | MenuID: 'true', |
| | | value: 'true', |
| | | text: this.state.dict['header.form.true'] |
| | | }, { |
| | | MenuID: 'false', |
| | | value: 'false', |
| | | text: this.state.dict['header.form.false'] |
| | | }] |
| | | }, |
| | |
| | | label: this.state.dict['header.form.orderType'], |
| | | initVal: card.orderType || 'asc', |
| | | options: [{ |
| | | MenuID: 'asc', |
| | | value: 'asc', |
| | | text: this.state.dict['header.form.asc'] |
| | | }, { |
| | | MenuID: 'desc', |
| | | value: 'desc', |
| | | text: this.state.dict['header.form.desc'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'display', |
| | | label: this.state.dict['header.form.display'], |
| | | initVal: card.display || 'dropdown', |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'dropdown', |
| | | text: this.state.dict['header.form.dropdown'] |
| | | }, { |
| | | MenuID: 'button', |
| | | text: this.state.dict['header.form.button'] |
| | | }] |
| | | } |
| | | ] |
| | |
| | | |
| | | handleSubmit = () => { |
| | | this.formRef.handleConfirm().then(res => { |
| | | let _config = this.state.config |
| | | |
| | | if (this.state.operaType === 'add') { |
| | | _config[res.type] = _config[res.type].map(item => { |
| | | if (item.uuid === res.values.uuid) { |
| | | return res.values |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | _config[res.type] = _config[res.type].filter(item => !item.origin) |
| | | } else { |
| | | _config[res.type] = _config[res.type].map(item => { |
| | | if (item.uuid === res.values.uuid) { |
| | | return res.values |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } |
| | | let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | | console.log(res) |
| | | _config.fields = _config.fields.map(item => { |
| | | if (item.uuid === res.uuid) { |
| | | return res |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | _config.fields = _config.fields.filter(item => !item.origin) |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | [res.type + 'loading']: true, |
| | | loading: true, |
| | | visible: false |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | this.resetFrom() |
| | | }) |
| | | } |
| | | |
| | | deleteElement = () => { |
| | | let _config = this.state.config |
| | | _config[this.state.formtemp] = _config[this.state.formtemp].filter(item => { |
| | | if (item.uuid === this.state.card.uuid) { |
| | | return false |
| | | } else { |
| | | return true |
| | | } |
| | | }) |
| | | this.setState({ |
| | | config: _config, |
| | | [this.state.formtemp + 'loading']: true, |
| | | visible: false |
| | | }) |
| | | this.resetFrom() |
| | | } |
| | | closeForm = (card) => { |
| | | let _this = this |
| | | |
| | | handleCancel = () => { |
| | | this.setState({ |
| | | visible: false |
| | | confirm({ |
| | | content: `确定删除<<${card.label}>>吗?`, |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | let _config = JSON.parse(JSON.stringify(_this.state.config)) |
| | | _config.fields = _config.fields.filter(item => { |
| | | if (item.uuid === card.uuid) { |
| | | return false |
| | | } else { |
| | | return true |
| | | } |
| | | }) |
| | | _this.setState({ |
| | | config: _config, |
| | | loading: true |
| | | }, () => { |
| | | _this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | this.resetFrom() |
| | | } |
| | | |
| | | resetFrom = () => { |
| | | setTimeout(() => { |
| | | this.setState({ |
| | | // formtemp: '', |
| | | searchloading: false, |
| | | actionloading: false, |
| | | columnsloading: false |
| | | // formlist: null |
| | | }) |
| | | }, 10) |
| | | } |
| | | |
| | | changeTemplate = () => { |
| | |
| | | const { menu } = this.props |
| | | const { config, originMenu } = this.state |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | if (config.search[0] && config.search[0].origin) { |
| | | |
| | | if (!config.fields[0] && config.fields[0].origin) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请设置搜索条件', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | if (config.action[0] && config.action[0].origin) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请设置按钮', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | if (config.columns[0] && config.columns[0].origin) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请设置显示列', |
| | | message: '请添加表单', |
| | | duration: 10 |
| | | }) |
| | | return |
| | |
| | | return |
| | | } |
| | | |
| | | if (this.state.operaType === 'add') { |
| | | let param = { |
| | | func: 'sPC_TrdMenu_Add', |
| | | ParentID: res.parentId, |
| | | MenuID: menu.MenuID, |
| | | MenuNo: res.menuNo, |
| | | Template: menu.PageParam.Template || '', |
| | | MenuName: res.menuName, |
| | | PageParam: JSON.stringify(_pageParam), |
| | | LongParam: _LongParam |
| | | } |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | let param = { |
| | | func: 'sPC_ButtonParam_AddUpt', |
| | | ParentID: res.parentId, |
| | | MenuID: menu.MenuID, |
| | | MenuNo: res.menuNo, |
| | | Template: menu.PageParam.Template || '', |
| | | MenuName: res.menuName, |
| | | PageParam: JSON.stringify(_pageParam), |
| | | LongParam: _LongParam |
| | | } |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | | this.setState({ |
| | | menuloading: false, |
| | | operaType: 'edit', |
| | | originMenu: { |
| | | ...originMenu, |
| | | LongParam: _config, |
| | | PageParam: _pageParam, |
| | | MenuName: res.menuName, |
| | | MenuNo: res.menuNo, |
| | | ParentID: res.parentId |
| | | } |
| | | }) |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | | this.setState({ |
| | | menuloading: false, |
| | | operaType: 'edit', |
| | | originMenu: { |
| | | ...originMenu, |
| | | LongParam: _config, |
| | | PageParam: _pageParam, |
| | | MenuName: res.menuName, |
| | | MenuNo: res.menuNo, |
| | | ParentID: res.parentId |
| | | } |
| | | }) |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | if (this.state.operaType === 'add') { |
| | | |
| | | } else { |
| | | let param = { |
| | | func: 'sPC_TrdMenu_Upt', |
| | |
| | | } |
| | | } |
| | | |
| | | queryField = (type) => { |
| | | queryField = () => { |
| | | const {selectedTables, tableColumns, config} = this.state |
| | | if (selectedTables.length === 0) { |
| | | notification.warning({ |
| | |
| | | }) |
| | | }) |
| | | |
| | | if (type === 'search') { |
| | | config.search.forEach(item => { |
| | | if (columns.has(item.field)) { |
| | | columns.set(item.field, {...item, selected: true, type: item.type}) |
| | | } |
| | | }) |
| | | } else if (type === 'columns') { |
| | | config.columns.forEach(item => { |
| | | if (columns.has(item.field)) { |
| | | columns.set(item.field, {...item, selected: true, type: item.type}) |
| | | } |
| | | }) |
| | | } |
| | | config.fields.forEach(item => { |
| | | if (columns.has(item.field)) { |
| | | columns.set(item.field, {...item, selected: true, type: item.type}) |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | addType: type, |
| | | tableVisible: true, |
| | | fields: [...columns.values()] |
| | | }) |
| | |
| | | addFieldSubmit = () => { |
| | | if (!this.state.fields || this.state.fields.length === 0) { |
| | | this.setState({ |
| | | tableVisible: false, |
| | | addType: '' |
| | | tableVisible: false |
| | | }) |
| | | } |
| | | |
| | | const {addType, config} = this.state |
| | | let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | let cards = this.refs.searchcard.getSelectedCard() |
| | | let cards = this.refs.searchcard.state.selectCards |
| | | let columns = new Map() |
| | | cards.forEach(card => { |
| | | columns.set(card.field, card) |
| | | }) |
| | | |
| | | let items = [] |
| | | if (addType === 'search') { |
| | | config.search.forEach(item => { |
| | | if (columns.has(item.field)) { |
| | | let cell = columns.get(item.field) |
| | | _config.fields.forEach(item => { |
| | | if (columns.has(item.field)) { |
| | | let cell = columns.get(item.field) |
| | | |
| | | if (cell.selected) { |
| | | items.push(item) |
| | | } |
| | | columns.delete(item.field) |
| | | } else if (!item.origin) { |
| | | if (cell.selected && cell.type === item.type) { // 数据未修改 |
| | | items.push(item) |
| | | } else if (cell.selected) { // 数据类型修改 |
| | | item.type = cell.type |
| | | item.initval = '' |
| | | items.push(item) |
| | | } |
| | | }) |
| | | |
| | | let _columns = [...columns.values()] |
| | | let indexes = items.map(card => {return card.id}) |
| | | let id = Math.max(...indexes, 0) |
| | | |
| | | _columns.forEach(item => { |
| | | if (item.selected) { |
| | | let newcard = { |
| | | id: id, |
| | | uuid: Utils.getuuid(), |
| | | label: item.label, |
| | | field: item.field, |
| | | initval: '', |
| | | type: item.type, |
| | | resourceType: '0', |
| | | setAll: 'false', |
| | | options: [], |
| | | dataSource: '', |
| | | linkField: '', |
| | | valueField: '', |
| | | valueText: '', |
| | | orderBy: '', |
| | | orderType: 'asc', |
| | | display: 'dropdown' |
| | | } |
| | | |
| | | items.push(newcard) |
| | | id++ |
| | | } |
| | | }) |
| | | } else { |
| | | config.columns.forEach(item => { |
| | | if (columns.has(item.field)) { |
| | | let cell = columns.get(item.field) |
| | | |
| | | if (cell.selected) { |
| | | items.push(item) |
| | | } |
| | | columns.delete(item.field) |
| | | } else if (!item.origin) { |
| | | items.push(item) |
| | | } |
| | | }) |
| | | |
| | | let _columns = [...columns.values()] |
| | | let indexes = items.map(card => {return card.id}) |
| | | let id = Math.max(...indexes, 0) |
| | | |
| | | _columns.forEach(item => { |
| | | if (item.selected) { |
| | | let newcard = { |
| | | id: id, |
| | | uuid: Utils.getuuid(), |
| | | Align: 'left', |
| | | label: item.label, |
| | | field: item.field, |
| | | Hide: 'false', |
| | | IsSort: 'true', |
| | | type: 'text', |
| | | Width: 120 |
| | | } |
| | | |
| | | items.push(newcard) |
| | | id++ |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | tableVisible: false, |
| | | [addType + 'loading']: true, |
| | | addType: '', |
| | | config: {...config, [addType]: items} |
| | | columns.delete(item.field) |
| | | } else if (!item.origin) { |
| | | items.push(item) |
| | | } |
| | | }) |
| | | setTimeout(() => { |
| | | this.setState({ |
| | | [addType + 'loading']: false |
| | | }) |
| | | }, 100) |
| | | } |
| | | |
| | | cancelFieldSubmit = () => { |
| | | let _columns = [...columns.values()] |
| | | let indexes = items.map(card => {return card.id}) |
| | | let id = Math.max(...indexes, 0) + 1 |
| | | |
| | | _columns.forEach(item => { |
| | | if (item.selected) { |
| | | let newcard = { |
| | | id: id, |
| | | uuid: Utils.getuuid(), |
| | | label: item.label, |
| | | field: item.field, |
| | | initval: '', |
| | | type: item.type, |
| | | resourceType: '0', |
| | | setAll: 'false', |
| | | options: [], |
| | | dataSource: '', |
| | | linkField: '', |
| | | valueField: '', |
| | | valueText: '', |
| | | orderBy: '', |
| | | orderType: 'asc', |
| | | } |
| | | |
| | | items.push(newcard) |
| | | id++ |
| | | } |
| | | }) |
| | | |
| | | _config.fields = items |
| | | |
| | | this.setState({ |
| | | tableVisible: false, |
| | | addType: '' |
| | | loading: true, |
| | | config: _config |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | } |
| | | |
| | |
| | | } else if (/^decimal/.test(_type)) { |
| | | _decimal = _type.split(',')[1] |
| | | _decimal = parseInt(_decimal) |
| | | if (_decimal > 4) { |
| | | _decimal = 4 |
| | | } |
| | | _type = 'number' |
| | | } else if (/^decimal/.test(_type)) { |
| | | _decimal = _type.split(',')[1] |
| | | _decimal = parseInt(_decimal) |
| | | if (_decimal > 4) { |
| | | _decimal = 4 |
| | | } |
| | | _type = 'number' |
| | | } else if (/^datetime/.test(_type)) { |
| | | _type = 'datetime' |
| | |
| | | }) |
| | | } |
| | | |
| | | cancelSetting = () => { |
| | | this.setState({ |
| | | settingVisible: false |
| | | }) |
| | | } |
| | | |
| | | render () { |
| | | const { config } = this.state |
| | | |
| | | return ( |
| | | <div className="modal-form-board"> |
| | | <DndProvider backend={HTML5Backend}> |
| | | <div className="tools"> |
| | | <Collapse accordion defaultActiveKey="0" bordered={false}> |
| | | <Panel header="基本信息" key="0" id="modal-basedata"> |
| | | <MenuForm |
| | | dict={this.state.dict} |
| | | formlist={this.state.modalformlist} |
| | | wrappedComponentRef={(inst) => this.menuformRef = inst} |
| | | /> |
| | | <MenuForm |
| | | dict={this.state.dict} |
| | | formlist={this.state.modalformlist} |
| | |
| | | return (<SourceElement key={index} content={item}/>) |
| | | })} |
| | | </div> |
| | | <Button type="primary" block onClick={() => this.queryField('search')}>添加表单</Button> |
| | | <Button type="primary" block onClick={() => this.queryField()}>添加表单</Button> |
| | | </Panel> |
| | | </Collapse> |
| | | </div> |
| | |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | | <Icon type="setting" onClick={this.changeSetting} /> |
| | | <div className="search-list"> |
| | | {<DragElement |
| | | list={this.state.config.search} |
| | | type="search" |
| | | placeholder={this.state.dict['header.form.search.placeholder']} |
| | | handleList={this.handleList} |
| | | handleMenu={this.handleSearch} |
| | | />} |
| | | <div className="ant-modal-content" style={{width: config.setting.width + '%'}}> |
| | | <button type="button" className="ant-modal-close"> |
| | | <span className="ant-modal-close-x"><Icon type="close"/></span> |
| | | </button> |
| | | <div className="ant-modal-header"> |
| | | <div className="ant-modal-title">{config.setting.title}</div> |
| | | </div> |
| | | <div className="ant-modal-body"> |
| | | <div className="modal-form"> |
| | | {!this.state.loading ? |
| | | <DragElement |
| | | list={config.fields} |
| | | setting={config.setting} |
| | | placeholder={this.state.dict['header.form.modal.placeholder']} |
| | | handleList={this.handleList} |
| | | handleForm={this.handleForm} |
| | | closeForm={this.closeForm} |
| | | /> : null |
| | | } |
| | | </div> |
| | | </div> |
| | | <div className="ant-modal-footer"> |
| | | <div> |
| | | <button type="button" className="ant-btn"><span>取 消</span></button> |
| | | <button type="button" className="ant-btn ant-btn-primary"><span>确 定</span></button> |
| | | </div> |
| | | <div className="action-mask"></div> |
| | | </div> |
| | | </div> |
| | | </Card> |
| | | </div> |
| | | </DndProvider> |
| | | {/* <Modal |
| | | <Modal |
| | | title={this.state.dict['header.edit']} |
| | | visible={this.state.visible} |
| | | width={700} |
| | | onCancel={this.handleCancel} |
| | | footer={[ |
| | | <Button key="delete" type="danger" onClick={this.deleteElement}>{this.state.dict['header.delete']}</Button>, |
| | | <Button key="cancel" onClick={this.handleCancel}>{this.state.dict['header.cancel']}</Button>, |
| | | <Button key="confirm" type="primary" onClick={this.handleSubmit}>{this.state.dict['header.confirm']}</Button> |
| | | ]} |
| | | onCancel={() => { |
| | | this.setState({ |
| | | visible: false |
| | | }) |
| | | }} |
| | | onOk={this.handleSubmit} |
| | | destroyOnClose |
| | | > |
| | | {this.state.formtemp === 'search' && <SearchForm |
| | | {<ModalForm |
| | | dict={this.state.dict} |
| | | formlist={this.state.formlist} |
| | | card={this.state.card} |
| | |
| | | width={'65vw'} |
| | | style={{minWidth: '900px', maxWidth: '1200px'}} |
| | | onOk={this.addFieldSubmit} |
| | | onCancel={this.cancelFieldSubmit} |
| | | onCancel={() => { |
| | | this.setState({ |
| | | tableVisible: false |
| | | }) |
| | | }} |
| | | destroyOnClose |
| | | > |
| | | {this.state.addType === 'search' && this.state.fields.length > 0 && |
| | | <EditCard data={this.state.fields} ref="searchcard" type="search" /> |
| | | } |
| | | {this.state.addType === 'columns' && this.state.fields.length > 0 && |
| | | <EditCard data={this.state.fields} ref="searchcard" type="columns" /> |
| | | {this.state.fields && this.state.fields.length > 0 ? |
| | | <EditCard data={this.state.fields} ref="searchcard" type="search" /> : null |
| | | } |
| | | {(!this.state.fields || this.state.fields.length === 0) && |
| | | <Empty /> |
| | | } |
| | | </Modal> */} |
| | | </Modal> |
| | | <Modal |
| | | title={this.state.dict['header.edit']} |
| | | visible={this.state.settingVisible} |
| | | width={700} |
| | | onOk={this.settingSave} |
| | | onCancel={this.cancelSetting} |
| | | onCancel={() => { |
| | | this.setState({ |
| | | settingVisible: false |
| | | }) |
| | | }} |
| | | destroyOnClose |
| | | > |
| | | <SettingForm |
| | | data={this.state.config.setting} |
| | | data={config.setting} |
| | | dict={this.state.dict} |
| | | wrappedComponentRef={(inst) => this.settingRef = inst} |
| | | /> |
| | |
| | | .ant-card-body { |
| | | position: relative; |
| | | padding: 0; |
| | | .ant-modal-content { |
| | | max-width: 95%; |
| | | margin: 0 auto; |
| | | margin-top: 30px; |
| | | .ant-modal-header { |
| | | position: relative; |
| | | z-index: 10; |
| | | background: transparent; |
| | | } |
| | | .ant-modal-close { |
| | | opacity: 0.5; |
| | | } |
| | | .ant-modal-footer { |
| | | position: relative; |
| | | button { |
| | | opacity: 0.5; |
| | | } |
| | | } |
| | | .action-mask { |
| | | position: absolute; |
| | | top: 0px; |
| | | left: 0px; |
| | | right: 0px; |
| | | bottom: 0px; |
| | | } |
| | | } |
| | | |
| | | .search-list { |
| | | padding: 1px 24px 20px; |
| | | .modal-form { |
| | | min-height: 87px; |
| | | > .ant-row { |
| | | min-height: 65px; |
| | |
| | | margin-top: 4px; |
| | | } |
| | | .ant-calendar-picker { |
| | | width: 100%; |
| | | margin-top: 4px; |
| | | } |
| | | .input-mask { |
| | |
| | | .edit { |
| | | position: absolute; |
| | | left: 0; |
| | | top: 5px; |
| | | top: 0px; |
| | | color: #1890ff; |
| | | cursor: pointer; |
| | | display: none; |
| | | } |
| | | .edit.close { |
| | | left: 20px; |
| | | color: #ff4d4f; |
| | | } |
| | | } |
| | | .page-card:hover { |
| | | .edit { |
File was renamed from src/templates/modalconfig/searchform/index.jsx |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification } from 'antd' |
| | | import moment from 'moment' |
| | | import EditTable from '../editable' |
| | | import './index.scss' |
| | | |
| | |
| | | state = { |
| | | openType: null, |
| | | resourceType: null, |
| | | formlist: null |
| | | formlist: null, |
| | | dateoptions: { |
| | | date: [{value: '', text: '空'}, {value: '0', text: '当天'}, {value: 1, text: '前一天'}, {value: 3, text: '前三天'}, {value: 7, text: '前七天'}, {value: 30, text: '前30天'}], |
| | | dateweek: [{value: '', text: '空'}, {value: '0', text: '本周'}, {value: 1, text: '上周'}, {value: 3, text: '前三周'}, {value: 7, text: '前七周'}], |
| | | datemonth: [{value: '', text: '空'}, {value: '0', text: '本月'}, {value: 1, text: '上月'}, {value: 3, text: '前三月'}, {value: 7, text: '前七月'}], |
| | | daterange: [{value: '', text: '空'}, {value: '0', text: '今天'}, {value: 1, text: '昨天'}, {value: 3, text: '前三天'}, {value: 7, text: '前七天'}, {value: 30, text: '前30天'}], |
| | | } |
| | | } |
| | | |
| | | openTypeChange = (key, value) => { |
| | | if (key === 'type') { |
| | | let _options = ['label', 'field', 'initval', 'type'] |
| | | if (value === 'select' && this.state.resourceType === '0') { |
| | | _options = [..._options, ...['resourceType', 'setAll', 'options', 'display']] |
| | | } else if (value === 'select' && this.state.resourceType === '1') { |
| | | _options = [..._options, ...['resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display']] |
| | | } else if (value === 'link' && this.state.resourceType === '0') { |
| | | _options = [..._options, ...['resourceType', 'setAll', 'options', 'linkField', 'display']] |
| | | } else if (value === 'link' && this.state.resourceType === '1') { |
| | | _options = [..._options, ...['resourceType', 'setAll', 'dataSource', 'linkField', 'valueField', 'valueText', 'orderBy', 'orderType', 'display']] |
| | | if (value === 'select' || value === 'link') { // 切换类型为选择或关联时,来源默认为自定义 |
| | | _options = [..._options, 'resourceType', 'setAll', 'options'] |
| | | } |
| | | |
| | | if (value === 'link') { |
| | | _options = [..._options, 'linkField'] |
| | | } |
| | | |
| | | this.setState({ |
| | | openType: value, |
| | | resourceType: '0', |
| | | formlist: this.state.formlist.map(form => { |
| | | form.hidden = !_options.includes(form.key) |
| | | if (form.key === 'initval') { |
| | | if (this.state.dateoptions.hasOwnProperty(value)) { |
| | | form.options = this.state.dateoptions[value] |
| | | form.type = 'select' |
| | | } else { |
| | | form.type = 'text' |
| | | } |
| | | form.initVal = '' |
| | | form.hidden = true |
| | | } |
| | | return form |
| | | }) |
| | | }, () => { |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(form => { |
| | | if (form.key === 'initval') { |
| | | form.hidden = false |
| | | } |
| | | return form |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | onChange = (e, key) => { |
| | | const { openType } = this.state |
| | | let value = e.target.value |
| | | if (key === 'resourceType') { |
| | | let _options = ['label', 'field', 'initval', 'type', 'resourceType', 'setAll'] |
| | | if (this.state.openType === 'select' && value === '0') { |
| | | _options = [..._options, ...['options', 'display']] |
| | | } else if (this.state.openType === 'select' && value === '1') { |
| | | _options = [..._options, ...['dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display']] |
| | | } else if (this.state.openType === 'link' && value === '0') { |
| | | _options = [..._options, ...['options', 'linkField', 'display']] |
| | | } else if (this.state.openType === 'link' && value === '1') { |
| | | _options = [..._options, ...['dataSource', 'linkField', 'valueField', 'valueText', 'orderBy', 'orderType', 'display']] |
| | | if (value === '0') { |
| | | _options = [..._options, 'options'] |
| | | } else if (value === '1') { |
| | | _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType'] |
| | | } |
| | | |
| | | if (openType === 'link') { |
| | | _options = [..._options, 'linkField'] |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | if (item.hidden) return |
| | | |
| | | if (item.type === 'text') { // 文本搜索 |
| | | let placeholder = '' |
| | | if (item.key === 'initval' && this.state.openType === 'date') { |
| | | placeholder = '例:' + moment().format('YYYY-MM-DD') |
| | | } else if (item.key === 'initval' && this.state.openType === 'datetime') { |
| | | placeholder = '例:' + moment().format('YYYY-MM-DD HH:mm:ss') |
| | | } |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | ] |
| | | })(<Input placeholder={placeholder} autoComplete="off" disabled={item.readonly} />)} |
| | | })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | |
| | | getPopupContainer={() => document.getElementById('commontable-search-form-box')} |
| | | > |
| | | {item.options.map(option => |
| | | <Select.Option id={option.MenuID} title={option.text} key={option.MenuID} value={option.MenuID}> |
| | | <Select.Option id={option.value} title={option.text} key={option.value} value={option.value}> |
| | | {item.key === 'icon' && <Icon type={option.text} />} {option.text} |
| | | </Select.Option> |
| | | )} |
| | |
| | | { |
| | | item.options.map(option => { |
| | | return ( |
| | | <Radio key={option.MenuID} value={option.MenuID}>{option.text}</Radio> |
| | | <Radio key={option.value} value={option.value}>{option.text}</Radio> |
| | | ) |
| | | }) |
| | | } |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | |
| | | } else if (item.type === 'textarea') { |
| | | fields.push( |
| | | <Col span={20} offset={4} key={index}> |
| | |
| | | ) |
| | | } |
| | | }) |
| | | |
| | | return fields |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | if (isvalid) { |
| | | resolve({ |
| | | type: 'search', |
| | | values |
| | | }) |
| | | resolve(values) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | if (!formlist) return |
| | | let type = formlist.filter(cell => cell.key === 'type')[0].initVal |
| | | let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal |
| | | let _options = ['label', 'field', 'initval', 'type'] |
| | | if (type === 'select' && resourceType === '0') { |
| | | _options = [..._options, ...['resourceType', 'setAll', 'options', 'display']] |
| | | } else if (type === 'select' && resourceType === '1') { |
| | | _options = [..._options, ...['resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display']] |
| | | } else if (type === 'link' && resourceType === '0') { |
| | | _options = [..._options, ...['resourceType', 'setAll', 'options', 'linkField', 'display']] |
| | | } else if (type === 'link' && resourceType === '1') { |
| | | _options = [..._options, ...['resourceType', 'setAll', 'dataSource', 'linkField', 'valueField', 'valueText', 'orderBy', 'orderType', 'display']] |
| | | let _options = ['label', 'field', 'initval', 'type'] // 默认显示项 |
| | | if ((type === 'select' || type === 'link') && resourceType === '0') { // 选择类型、自定义资源 |
| | | _options = [..._options, 'resourceType', 'setAll', 'options'] |
| | | } else if ((type === 'select' || type === 'link') && resourceType === '1') { // 选择类型、数据源 |
| | | _options = [..._options, 'resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType'] |
| | | } |
| | | |
| | | if (type === 'link') { // 关联类型、增加关联字段 |
| | | _options = [..._options, 'linkField'] |
| | | } |
| | | |
| | | this.setState({ |
| | | openType: type, |
| | | resourceType: resourceType, |
| | | formlist: formlist.map(form => { |
| | | if (this.state.dateoptions.hasOwnProperty(type) && form.key === 'initval') { |
| | | form.options = this.state.dateoptions[type] |
| | | form.type = 'select' |
| | | } |
| | | form.hidden = !_options.includes(form.key) |
| | | return form |
| | | }) |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Radio } from 'antd' |
| | | import { Form, Row, Col, Input, Radio, InputNumber } from 'antd' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | | // const { TextArea } = Input |
| | | |
| | | class SettingForm extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | formlist: PropTypes.any, |
| | | card: PropTypes.object |
| | | data: PropTypes.object |
| | | } |
| | | |
| | | state = { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { data, dict } = this.props |
| | | const { data } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | |
| | | console.log(data) |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | } |
| | | } |
| | | return ( |
| | | <Form {...formItemLayout} className="ant-advanced-search-form commontable-setting-form"> |
| | | <Form {...formItemLayout} className="ant-advanced-search-form modal-setting-form"> |
| | | <Row gutter={24}> |
| | | <Col span={12}> |
| | | <Form.Item label="固定按钮"> |
| | | {getFieldDecorator('actionfixed', { |
| | | initialValue: data.actionfixed |
| | | <Form.Item label="标题"> |
| | | {getFieldDecorator('title', { |
| | | initialValue: data.title |
| | | })(<Input placeholder="" autoComplete="off"/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label="列数"> |
| | | {getFieldDecorator('cols', { |
| | | initialValue: data.cols |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value={true}>是</Radio> |
| | | <Radio value={false}>否</Radio> |
| | | <Radio value="1">1列</Radio> |
| | | <Radio value="2">2列</Radio> |
| | | <Radio value="3">3列</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label="固定列"> |
| | | {getFieldDecorator('columnfixed', { |
| | | initialValue: data.columnfixed |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value={true}>是</Radio> |
| | | <Radio value={false}>否</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | <Form.Item label="宽度"> |
| | | {getFieldDecorator('width', { |
| | | initialValue: data.width |
| | | })(<InputNumber min={30} max={90} precision={0} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | {/* <Col span={24}> |
| | | <Form.Item label="数据源" className="textarea"> |
| | | {getFieldDecorator('dataresource', { |
| | | initialValue: data.dataresource, |
| | |
| | | ] |
| | | })(<TextArea rows={4} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | </Col> */} |
| | | </Row> |
| | | </Form> |
| | | ) |
| | |
| | | .ant-advanced-search-form.commontable-setting-form { |
| | | .ant-advanced-search-form.modal-setting-form { |
| | | .textarea { |
| | | .ant-form-item-label { |
| | | width: 16.3%; |
| | |
| | | width: 83.33333333%; |
| | | } |
| | | } |
| | | .ant-input-number { |
| | | width: 100%; |
| | | } |
| | | } |
| | |
| | | |
| | | class CommonTableBaseData { |
| | | baseConfig = { |
| | | type: 'system', |
| | | type: 'modal', |
| | | setting: { |
| | | title: '', |
| | | width: 60, |
| | |
| | | |
| | | searchItems = [ |
| | | { |
| | | type: 'search', |
| | | type: 'form', |
| | | label: '文本框', |
| | | subType: 'text', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'search', |
| | | type: 'form', |
| | | label: '数值框', |
| | | subType: 'number', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: '下拉框', |
| | | subType: 'select', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'search', |
| | | type: 'form', |
| | | label: '时间框(天)', |
| | | subType: 'date', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'search', |
| | | type: 'form', |
| | | label: '时间框(月)', |
| | | subType: 'datemonth', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'search', |
| | | type: 'form', |
| | | label: '时间框(秒)', |
| | | subType: 'datetime', |
| | | url: '' |
| | |
| | | button { |
| | | width: 100%; |
| | | height: calc(2vw + 10px); |
| | | min-height: 30px; |
| | | line-height: 1; |
| | | } |
| | | .ant-dropdown-link { |
| | |
| | | .ant-input { |
| | | font-size: 16px; |
| | | height: calc(2vw + 5px); |
| | | min-height: 30px; |
| | | } |
| | | .ant-form label { |
| | | font-size: 16px; |
| | |
| | | .ant-message { |
| | | top: 50px; |
| | | z-index: 1080; |
| | | } |
| | | @media screen and (max-width: 500px) { |
| | | .login-container { |
| | | .login-middle { |
| | | .login-form { |
| | | float: unset; |
| | | margin: 0 auto; |
| | | margin-top: 5%; |
| | | } |
| | | } |
| | | } |
| | | } |