1 文件已重命名
24个文件已修改
10个文件已添加
| | |
| | | return axios({ |
| | | url: '/local/dostar', |
| | | data: { |
| | | func: 'ResetPassword', |
| | | func: 's_PwdUpt', |
| | | userid: sessionStorage.getItem('UserID'), |
| | | OriginPwd: originpwd, |
| | | NewPwd: newpwd |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 获取系统配置,增加appkey |
| | | * @description 获取或修改系统配置,增加appkey |
| | | */ |
| | | getSystemConfig (param) { |
| | | param.userid = sessionStorage.getItem('UserID') |
| | |
| | | import React, {Component} from 'react' |
| | | import Lostsvg from '@/components/lostsvg' |
| | | import zhCN from '@/locales/zh-CN/share.js' |
| | | import enUS from '@/locales/en-US/share.js' |
| | | import './index.scss' |
| | | |
| | | const _dict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | | class NotFound extends Component { |
| | | render () { |
| | |
| | | <Lostsvg /> |
| | | </div> |
| | | <div className="ant-result-title">404</div> |
| | | <div className="ant-result-subtitle">抱歉,你访问的页面不存在,请联系管理员。</div> |
| | | <div className="ant-result-subtitle">{this.props.msg ? this.props.msg : _dict['view.notFound']}</div> |
| | | </div> |
| | | </main> |
| | | ) |
| | |
| | | render () { |
| | | return ( |
| | | <div className="header-edit-box"> |
| | | <div className="mask"></div> |
| | | <div className="mask"> |
| | | <div className="tipcard card1"> |
| | | 拖动一级菜单可调整顺序,顺序调整后,请点击确定按钮保存。 |
| | | </div> |
| | | <div className="tipcard card2"> |
| | | 鼠标经过菜单时会显示编辑图标,点击编辑可修改和删除菜单。 |
| | | </div> |
| | | <div className="tipcard card3"> |
| | | 点击解除冻结按钮,可还原已删除的一级菜单。 |
| | | </div> |
| | | <div className="tipcard card4"> |
| | | 点击添加图标,可新增一级菜单。 |
| | | </div> |
| | | <div className="tipcard card5"> |
| | | <p>编辑状态中,一级菜单之外区域会锁定,查看系统数据请点击。</p> |
| | | <div> |
| | | <a target="blank" href="#/main" >新页面</a> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | {this.props.menulist && <DndProvider backend={HTML5Backend}> |
| | | <DragElement |
| | | dict={this.state.dict} |
| | |
| | | left: 0px; |
| | | right: 0px; |
| | | bottom: 0px; |
| | | background-color: rgba(0, 0, 0, 0.25); |
| | | .tipcard { |
| | | position: absolute; |
| | | min-height: 100px; |
| | | font-size: 16px; |
| | | border-radius: 6px; |
| | | background-size: 100% 100%; |
| | | background-repeat: no-repeat; |
| | | padding: 15px; |
| | | } |
| | | .card1 { |
| | | left: 30%; |
| | | top: 20vh; |
| | | width: 230px; |
| | | min-height: 100px; |
| | | background-image: url('../../../assets/img/card-bg2.jpg'); |
| | | color: #000000; |
| | | font-style: oblique; |
| | | } |
| | | .card2 { |
| | | left: 60%; |
| | | top: 20vh; |
| | | width: 230px; |
| | | min-height: 100px; |
| | | background-image: url('../../../assets/img/card-bg5.jpg'); |
| | | color: #000000; |
| | | padding: 20px 30px; |
| | | font-style: oblique; |
| | | } |
| | | .card3 { |
| | | left: 30%; |
| | | top: 50vh; |
| | | width: 230px; |
| | | min-height: 140px; |
| | | background-image: url('../../../assets/img/card-bg8.jpg'); |
| | | color: #000000; |
| | | padding: 20px 30px; |
| | | font-style: oblique; |
| | | } |
| | | .card4 { |
| | | left: 60%; |
| | | top: 50vh; |
| | | width: 230px; |
| | | min-height: 140px; |
| | | background-image: url('../../../assets/img/card-bg7.jpg'); |
| | | color: #000000; |
| | | padding: 20px 30px; |
| | | font-style: oblique; |
| | | } |
| | | .card5 { |
| | | right: 5%; |
| | | top: 20vh; |
| | | width: 130px; |
| | | min-height: 240px; |
| | | background-image: url('../../../assets/img/card-bg6.jpg'); |
| | | color: #000000; |
| | | padding: 40px 15px 10px; |
| | | p { |
| | | margin: 0 0 5px; |
| | | } |
| | | div { |
| | | text-align: center; |
| | | a { |
| | | display: inline-block; |
| | | color: #fff; |
| | | padding: 2px 10px; |
| | | border-radius: 4px; |
| | | background-color: #1890ff; |
| | | border-color: #1890ff; |
| | | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12); |
| | | -webkit-box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045); |
| | | box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import PropTypes from 'prop-types' |
| | | import {connect} from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import {Dropdown, Menu, Icon, Modal, message, Form, notification, Switch } from 'antd' |
| | | import md5 from 'md5' |
| | | import moment from 'moment' |
| | | import {Dropdown, Menu, Icon, Modal, Form, notification, Switch } from 'antd' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import {toggleCollapse, modifyMainMenu, resetState, resetDebug, resetEditState, resetEditLevel, logout} from '@/store/action' |
| | | import Resetpwd from '@/components/resetpwd' |
| | | import Api from '@/api' |
| | | import zhCN from '@/locales/zh-CN/header.js' |
| | | import enUS from '@/locales/en-US/header.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import logourl from '@/assets/img/main-logo.png' |
| | | import avatar from '@/assets/img/avatar.jpg' |
| | | import Resetpwd from './resetpwd' |
| | | import './index.scss' |
| | | |
| | | const EditMenu = asyncComponent(() => import('./editmenu')) |
| | |
| | | }) |
| | | } |
| | | |
| | | md5Password (pwd) { |
| | | // md5密码加密 |
| | | const salt = 'minkesoft' |
| | | return md5(md5(pwd + salt)) |
| | | } |
| | | |
| | | resetPwdSubmit = () => { |
| | | this.formRef.handleConfirm().then(res => { |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | async resetPwdSubmitexec (param) { |
| | | // 重置密码提交,关闭模态框,清空表单数据 |
| | | let password = this.md5Password(param.originpwd) |
| | | let newpassword = this.md5Password(param.password) |
| | | let result = await Api.resetpassword(password, newpassword) |
| | | let _param = { |
| | | func: 's_PwdUpt', |
| | | LText: `select '${param.originpwd}','${param.password}'` |
| | | } |
| | | |
| | | _param.LText = Utils.formatOptions(_param.LText) // 关键字符替换,base64加密 |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' // 时间戳 |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) // md5密钥 |
| | | |
| | | let result = await Api.getSystemConfig(_param) |
| | | if (result.status) { |
| | | this.setState({ |
| | | visible: false, |
| | | confirmLoading: false |
| | | }) |
| | | this.formRef.resetfrom() |
| | | message.success(this.state.dict['header.password.resetsuccess']) |
| | | notification.success({ |
| | | top: 92, |
| | | message: this.state.dict['header.password.resetsuccess'], |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | this.setState({ |
| | | visible: false |
| | | }) |
| | | this.formRef.resetfrom() |
| | | } |
| | | |
| | | logout = () => { |
| | |
| | | // 获取主菜单 |
| | | let result = await Api.getSystemConfig({func: 'sPC_Get_RolesMenu'}) |
| | | if (result.status) { |
| | | // console.log(result.Roles) |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | onOk={this.resetPwdSubmit} |
| | | confirmLoading={this.state.confirmLoading} |
| | | onCancel={this.handleCancel} |
| | | destroyOnClose |
| | | > |
| | | <Resetpwd dict={this.state.dict} wrappedComponentRef={(inst) => this.formRef = inst} resetPwdSubmit={this.resetPwdSubmit}/> |
| | | </Modal> |
File was renamed from src/components/resetpwd/index.jsx |
| | |
| | | }) |
| | | } |
| | | |
| | | resetfrom = () => { |
| | | this.props.form.resetFields() |
| | | } |
| | | |
| | | handleConfirmBlur = e => { |
| | | const { value } = e.target |
| | | this.setState({ confirmDirty: this.state.confirmDirty || !!value }) |
| | |
| | | .close { |
| | | position: absolute; |
| | | right: 0; |
| | | top: 0; |
| | | top: 1px; |
| | | font-size: 16px; |
| | | color: #ff4d4f; |
| | | cursor: pointer; |
| | | :hover { |
| | | color: #ffffff; |
| | |
| | | } |
| | | .edit { |
| | | position: absolute; |
| | | right: 0; |
| | | bottom: 1px; |
| | | cursor: pointer; |
| | | :hover { |
| | | color: #ffffff; |
| | | } |
| | | } |
| | | .close { |
| | | position: absolute; |
| | | right: 0; |
| | | right: 23px; |
| | | top: 1px; |
| | | font-size: 16px; |
| | | color: #1890ff; |
| | | cursor: pointer; |
| | | :hover { |
| | | color: #ffffff; |
| | |
| | | 'header.form.pop': '弹窗', |
| | | 'header.form.popform': '弹窗(表单)', |
| | | 'header.form.popview': '弹窗(页面)', |
| | | 'header.form.tab': '新标签页', |
| | | 'header.form.tab': '标签页', |
| | | 'header.form.currenttab': '当前菜单', |
| | | 'header.form.excelIn': 'Excel导入', |
| | | 'header.form.excelOut': 'Excel导出', |
| | | 'header.form.newpage': '新页面', |
New file |
| | |
| | | export default { |
| | | 'view.notFound': '抱歉,你访问的页面不存在,请联系管理员。', |
| | | 'date.empty': '空' |
| | | } |
| | |
| | | 'header.form.pop': '弹窗', |
| | | 'header.form.popform': '弹窗(表单)', |
| | | 'header.form.popview': '弹窗(页面)', |
| | | 'header.form.tab': '新标签页', |
| | | 'header.form.tab': '标签页', |
| | | 'header.form.currenttab': '当前菜单', |
| | | 'header.form.excelIn': 'Excel导入', |
| | | 'header.form.excelOut': 'Excel导出', |
| | | 'header.form.newpage': '新页面', |
| | |
| | | 'main.action.primarykey.repetition': '存在多个主键!', |
| | | 'main.action.primarykey.repetitionbid': '存在多个BID!', |
| | | 'main.column.operation': '操作', |
| | | 'main.view.unenabled': '抱歉,你访问的页面未启用,请联系管理员。', |
| | | 'form.required.input': '请输入', |
| | | 'form.required.select': '请选择' |
| | | } |
New file |
| | |
| | | export default { |
| | | 'view.notFound': '抱歉,你访问的页面不存在,请联系管理员。', |
| | | 'date.empty': '空' |
| | | } |
| | |
| | | // 系统配置 |
| | | export default { |
| | | AppId: '201912040924165801464FF1788654BC5AC73' |
| | | AppId: '201912040924165801464FF1788654BC5AC73', |
| | | cloudDatabase: 'sqlserver', |
| | | localDatabase: 'mysql' |
| | | } |
| | |
| | | |
| | | export default class NormalTable extends Component { |
| | | static propTpyes = { |
| | | MenuNo: PropTypes.string, // 菜单参数 |
| | | MenuID: PropTypes.string // 菜单Id |
| | | MenuNo: PropTypes.string, // 菜单参数 |
| | | MenuID: PropTypes.string // 菜单Id |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | loadingview: true, |
| | | viewlost: false, |
| | | loadingview: true, // 页面加载中 |
| | | viewlost: false, // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用 |
| | | lostmsg: '', // 页面丢失时的提示信息 |
| | | config: {}, |
| | | searchlist: null, |
| | | actions: null, |
| | |
| | | configMap: {} |
| | | } |
| | | |
| | | /** |
| | | * @description 获取页面配置信息 |
| | | */ |
| | | async loadconfig () { |
| | | // 获取主菜单 |
| | | let param = { |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: this.props.MenuID |
| | | } |
| | | let result = await Api.getSystemCacheConfig(param) |
| | | if (result.status && result.LongParam) { |
| | | let config = window.decodeURIComponent(window.atob(result.LongParam)) |
| | | let config = '' |
| | | |
| | | try { |
| | | try { // 配置信息解析 |
| | | config = window.decodeURIComponent(window.atob(result.LongParam)) |
| | | config = JSON.parse(config) |
| | | this.setState({ |
| | | loadingview: false |
| | | }) |
| | | } catch (e) { |
| | | this.setState({ |
| | | loadingview: false, |
| | | viewlost: true |
| | | }) |
| | | config = '' |
| | | } |
| | | |
| | | // 页面配置解析错误时提示 |
| | | if (!config) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['main.page.settingerror'], |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _search = Utils.mainjointsearchkey(config.search) |
| | | let _arrField = [] |
| | | let _columns = [] |
| | | let _hideCol = [] |
| | | // 页面未启用时,显示未启用页面 |
| | | if (!config.enabled) { |
| | | this.setState({ |
| | | loadingview: false, |
| | | viewlost: true, |
| | | lostmsg: this.state.dict['main.view.unenabled'] |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _arrField = [] // 字段集 |
| | | let _columns = [] // 显示列 |
| | | let _hideCol = [] // 隐藏及合并列中字段的uuid集 |
| | | let colMap = new Map() |
| | | |
| | | // 1、筛选字段集,2、过滤隐藏列及合并列中的字段uuid |
| | | config.columns.forEach(col => { |
| | | if (col.field) { |
| | | _arrField.push(col.field) |
| | |
| | | colMap.set(col.uuid, col) |
| | | }) |
| | | |
| | | // 生成显示列,处理合并列中的字段 |
| | | config.columns.forEach(col => { |
| | | if (_hideCol.includes(col.uuid)) return |
| | | |
| | | if (col.type === 'colspan' && col.sublist) { |
| | | let _col = JSON.parse(JSON.stringify(col)) |
| | | let subColumn = [] |
| | |
| | | } |
| | | }) |
| | | |
| | | let _actions = config.action.filter(item => item.position === 'toolbar') |
| | | // let _operation = config.action.filter(item => item.position === 'grid') |
| | | // 添加操作列(存在时)(未经过权限过滤) |
| | | if (config.gridBtn && config.gridBtn.display) { |
| | | _columns.push({ |
| | | ...config.gridBtn, |
| | | operations: config.action.filter(item => item.position === 'grid') |
| | | }) |
| | | } |
| | | |
| | | // if (_operation.length > 0) { |
| | | // _columns.push({ |
| | | // Align: 'center', |
| | | // uuid: Utils.getuuid(), |
| | | // IsSort: 'false', |
| | | // Width: 120, |
| | | // type: 'action', |
| | | // style: 'button', |
| | | // label: this.state.dict['main.column.operation'], |
| | | // operations: _operation |
| | | // }) |
| | | // } |
| | | // 过滤工具栏按钮(未经过权限过滤) |
| | | let _actions = config.action.filter(item => item.position === 'toolbar') |
| | | |
| | | this.setState({ |
| | | loadingview: false, |
| | | config: config, |
| | | setting: config.setting, |
| | | searchlist: config.search, |
| | | actions: _actions, |
| | | columns: _columns, |
| | | arr_field: _arrField.join(','), |
| | | search: _search ? 'where (' + _search + ')' : '', |
| | | // orderColumn: config.setting.orderColumn, |
| | | search: Utils.initMainSearch(config.search), // 搜索条件初始化(含有时间格式,需要转化) |
| | | loading: true |
| | | }, () => { |
| | | this.improveSearch() |
| | |
| | | |
| | | async loadmaindata () { |
| | | const { arr_field, pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state |
| | | console.log(setting) |
| | | |
| | | let _search = Utils.joinMainSearchkey(search) |
| | | _search = _search ? 'where (' + _search + ')' : '' |
| | | // 获取列表数据 |
| | | let param = { |
| | | func: setting.innerFunc || 'sPC_Get_TableData', |
| | |
| | | |
| | | let orderBy = orderColumn ? (orderColumn + ' ' + orderType) : setting.order |
| | | |
| | | let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${setting.dataresource} ${search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` |
| | | let DateCount = `select count(1) as total from ${setting.dataresource} ${search}` |
| | | let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${setting.dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` |
| | | let DateCount = `select count(1) as total from ${setting.dataresource} ${_search}` |
| | | console.log(LText) |
| | | param.LText = Utils.formatOptions(LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | |
| | | loading: false |
| | | }) |
| | | } else { |
| | | // this.setState({ |
| | | // data: [1,2,3,4,5,6,7,8,9,10].map((item, index) => { |
| | | // let cell = {} |
| | | // this.state.config.columns.forEach(column => { |
| | | // if (!column.field) return |
| | | // cell[column.field] = 'test' + item |
| | | // }) |
| | | // cell.key = index |
| | | // return cell |
| | | // }), |
| | | // total: 329, |
| | | // loading: false |
| | | // }) |
| | | this.setState({ |
| | | data: [1,2,3,4,5,6,7,8,9,10].map((item, index) => { |
| | | let cell = {} |
| | | this.state.config.columns.forEach(column => { |
| | | if (!column.field) return |
| | | cell[column.field] = 'test' + item |
| | | }) |
| | | cell.key = index |
| | | return cell |
| | | }), |
| | | total: 329, |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | |
| | | |
| | | refreshbysearch = (searches) => { |
| | | // 搜索条件变化 |
| | | let search = Utils.mainjointsearchkey(searches) |
| | | this.refs.mainTable.resetTable() |
| | | |
| | | this.setState({ |
| | | loading: true, |
| | | search: search ? 'where (' + search + ')' : '' |
| | | search: searches |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | |
| | | </div> |
| | | </div> |
| | | </BackTop> |
| | | {viewlost ? <NotFount /> : null} |
| | | {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | |
| | | const fields = [] |
| | | let cols = 2 |
| | | if (this.props.form.setting && this.props.form.setting.cols) { |
| | | cols = parseInt(this.props.form.setting.cols) |
| | | if (this.props.action.setting && this.props.action.setting.cols) { |
| | | cols = parseInt(this.props.action.setting.cols) |
| | | if (cols > 3 || cols < 1) { |
| | | cols = 2 |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip } from 'antd' |
| | | import { btnIcons, btnClasses } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | | |
| | | const btnIcons = [{ |
| | | MenuID: '', |
| | | text: 'unset' |
| | | }, { |
| | | MenuID: 'plus', |
| | | text: 'plus' |
| | | }, { |
| | | MenuID: 'plus-circle', |
| | | text: 'plus-circle' |
| | | }, { |
| | | MenuID: 'edit', |
| | | text: 'edit' |
| | | }, { |
| | | MenuID: 'form', |
| | | text: 'form' |
| | | }, { |
| | | MenuID: 'close', |
| | | text: 'close' |
| | | }, { |
| | | MenuID: 'close-circle', |
| | | text: 'close-circle' |
| | | }, { |
| | | MenuID: 'delete', |
| | | text: 'delete' |
| | | }] |
| | | |
| | | const btnClasses = [{ |
| | | MenuID: 'default', |
| | | text: '默认(黑边白底)' |
| | | }, { |
| | | MenuID: 'primary', |
| | | text: '蓝色' |
| | | }, { |
| | | MenuID: 'yellow', |
| | | text: '黄色' |
| | | }, { |
| | | MenuID: 'danger', |
| | | text: '红色' |
| | | }, { |
| | | MenuID: 'green', |
| | | text: '绿色' |
| | | }, { |
| | | MenuID: 'dgreen', |
| | | text: '深绿色' |
| | | }, { |
| | | MenuID: 'purple', |
| | | text: '紫色' |
| | | }, { |
| | | MenuID: 'gray', |
| | | text: '灰色' |
| | | }] |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | |
| | | } |
| | | |
| | | const findCard = id => { |
| | | const card = cards.filter(c => `${c.id}` === id)[0] |
| | | const card = cards.filter(c => `${c.uuid}` === id)[0] |
| | | return { |
| | | card, |
| | | index: cards.indexOf(card), |
| | |
| | | copycard.uuid = Utils.getuuid() |
| | | copycard.origin = false |
| | | copycard.label = copycard.label + '(copy)' |
| | | |
| | | let indexes = cards.map(car => { return car.id }) |
| | | let newid = 0 |
| | | while (indexes.includes(newid)) { |
| | | newid++ |
| | | } |
| | | copycard.id = newid |
| | | |
| | | copycard.originCard = card |
| | | |
| | | copyElement(copycard) |
| | |
| | | } |
| | | } |
| | | |
| | | let indexes = cards.map(car => {return car.id}) |
| | | let newid = 0 |
| | | while (indexes.includes(newid)) { |
| | | newid++ |
| | | } |
| | | newcard.id = newid |
| | | |
| | | let targetId = indexes.length > 0 ? indexes[indexes.length - 1] : 0 |
| | | let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0 |
| | | if (target) { |
| | | targetId = target.id |
| | | targetId = target.uuid |
| | | } |
| | | |
| | | const { index: overIndex } = findCard(`${targetId}`) |
| | |
| | | {type === 'action' && cards.map(card => ( |
| | | <Card |
| | | key={card.uuid} |
| | | id={`${card.id}`} |
| | | id={`${card.uuid}`} |
| | | type={type} |
| | | card={card} |
| | | moveCard={moveCard} |
| | |
| | | {type === 'search' && cards.map(card => ( |
| | | <Col key={card.uuid} span={6}> |
| | | <Card |
| | | key={card.uuid} |
| | | id={`${card.id}`} |
| | | id={`${card.uuid}`} |
| | | type={type} |
| | | card={card} |
| | | moveCard={moveCard} |
| | |
| | | {column.map(card => ( |
| | | <Card |
| | | key={card.uuid} |
| | | id={`${card.id}`} |
| | | id={`${card.uuid}`} |
| | | type={type} |
| | | card={card} |
| | | moveCard={moveCard} |
| | |
| | | }, { |
| | | MenuID: 'newpage', |
| | | text: this.state.dict['header.form.newpage'] |
| | | }, { |
| | | MenuID: 'currenttab', |
| | | text: this.state.dict['header.form.currenttab'] |
| | | }] |
| | | } |
| | | ] |
| | |
| | | }) |
| | | |
| | | let _columns = [...columnsMap.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, |
| | |
| | | } |
| | | |
| | | items.push(newcard) |
| | | id++ |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | }) |
| | | |
| | | let _columns = [...columnsMap.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, |
| | |
| | | } |
| | | |
| | | items.push(newcard) |
| | | id++ |
| | | } |
| | | }) |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification } from 'antd' |
| | | import { dateOptions, matchReg } from '@/utils/option.js' |
| | | import EditTable from '../editable' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | | const matchReg = { |
| | | text: [{ |
| | | value: 'like', |
| | | text: 'like' |
| | | }, { |
| | | value: 'not like', |
| | | text: 'not like' |
| | | }, { |
| | | value: '=', |
| | | text: '=' |
| | | }], |
| | | select: [{ |
| | | value: '=', |
| | | text: '=' |
| | | }, { |
| | | value: 'like', |
| | | text: 'like' |
| | | }, { |
| | | value: 'not like', |
| | | text: 'not like' |
| | | }], |
| | | date: [{ |
| | | value: '>=', |
| | | text: '>=' |
| | | }, { |
| | | value: '<=', |
| | | text: '<=' |
| | | }, { |
| | | value: '>', |
| | | text: '>' |
| | | }, { |
| | | value: '<', |
| | | text: '<' |
| | | }, { |
| | | value: '=', |
| | | text: '=' |
| | | }], |
| | | daterange: [{ |
| | | value: 'between', |
| | | text: 'between' |
| | | }] |
| | | } |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | formlist: PropTypes.any, |
| | | card: PropTypes.object |
| | | dict: PropTypes.object, // 字典项 |
| | | formlist: PropTypes.any, // 表单 |
| | | card: PropTypes.object // 搜索条件信息 |
| | | } |
| | | |
| | | state = { |
| | | openType: null, |
| | | resourceType: 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天'}], |
| | | } |
| | | openType: null, // 搜索条件显示类型 |
| | | resourceType: null, // 下拉搜索时,选项来源类型 |
| | | formlist: null // 表单 |
| | | } |
| | | |
| | | /** |
| | | * @description 表单预处理 |
| | | * 1、根据表单类型,显示表单可编辑项 |
| | | * 2、下拉选择,根据数据源类型显示相关配置 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { formlist } = this.props |
| | | |
| | | 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', 'match'] // 默认显示项 |
| | | |
| | | if ((type === 'select' || type === 'link') && resourceType === '0') { // 下拉选择类型、选项为自定义资源 |
| | | _options = [..._options, 'resourceType', 'setAll', 'options', 'display'] |
| | | } else if ((type === 'select' || type === 'link') && resourceType === '1') { // 下拉选择类型、选项为后台数据源中获取 |
| | | _options = [..._options, 'resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display'] |
| | | } |
| | | |
| | | if (type === 'link') { // 关联类型、增加关联上级的字段名 |
| | | _options = [..._options, 'linkField'] |
| | | } |
| | | |
| | | this.setState({ |
| | | openType: type, |
| | | resourceType: resourceType, |
| | | formlist: formlist.map(form => { |
| | | // 表单为初始值字段,且数据类型属于时间类型时,设置初始值为下拉选择,并重置选择项 |
| | | if (form.key === 'initval' && dateOptions.hasOwnProperty(type)) { |
| | | form.options = dateOptions[type] |
| | | form.type = 'select' |
| | | } |
| | | // 表单为匹配字段时,根据不同的类型,显示对应的匹配规则 |
| | | if (form.key === 'match') { |
| | | if (type === 'text') { |
| | | form.options = matchReg.text |
| | | } else if (type === 'select' || type === 'link') { |
| | | form.options = matchReg.select |
| | | } else if (type === 'date' || type === 'datemonth') { |
| | | form.options = matchReg.date |
| | | } else if (type === 'dateweek' || type === 'daterange') { |
| | | form.options = matchReg.daterange |
| | | } |
| | | } |
| | | form.hidden = !_options.includes(form.key) |
| | | return form |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索条件类型切换 |
| | | */ |
| | | openTypeChange = (key, value) => { |
| | | const { resourceType } = this.state |
| | | |
| | | if (key === 'type') { |
| | | let _options = ['label', 'field', 'initval', 'type', 'match'] |
| | | if (value === 'select' || value === 'link') { // 切换类型为选择或关联时,来源默认为自定义 |
| | | |
| | | if ((value === 'select' || value === 'link') && resourceType === '0') { // 下拉选择类型、选项为自定义资源 |
| | | _options = [..._options, 'resourceType', 'setAll', 'options', 'display'] |
| | | } else if ((value === 'select' || value === 'link') && resourceType === '1') { // 下拉选择类型、选项为后台数据源中获取 |
| | | _options = [..._options, 'resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display'] |
| | | } |
| | | |
| | | if (value === 'link') { |
| | |
| | | |
| | | this.setState({ |
| | | openType: value, |
| | | resourceType: '0', |
| | | formlist: this.state.formlist.map(form => { |
| | | form.hidden = !_options.includes(form.key) |
| | | form.hidden = !_options.includes(form.key) // 隐藏表单 |
| | | |
| | | if (form.key === 'initval') { |
| | | if (this.state.dateoptions.hasOwnProperty(value)) { |
| | | form.options = this.state.dateoptions[value] |
| | | if (dateOptions.hasOwnProperty(value)) { // 根据搜索条件类型,选择初始值的类型及数据 |
| | | form.options = dateOptions[value] |
| | | form.type = 'select' |
| | | } else { |
| | | form.type = 'text' |
| | | } |
| | | form.initVal = '' |
| | | form.initVal = '' // 搜索条件类型切换时,初始值置空 |
| | | form.hidden = true |
| | | } |
| | | |
| | | if (form.key === 'match') { |
| | | } else if (form.key === 'match') { // 搜索条件类型切换时,匹配规则类型对应切换 |
| | | if (value === 'text') { |
| | | form.options = matchReg.text |
| | | } else if (value === 'select' || value === 'link') { |
| | |
| | | } |
| | | form.hidden = true |
| | | } |
| | | |
| | | return form |
| | | }) |
| | | }, () => { |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(form => { |
| | | |
| | | if (form.key === 'initval') { |
| | | form.hidden = false |
| | | } |
| | | if (form.key === 'match') { |
| | | } else if (form.key === 'match') { |
| | | form.initVal = form.options[0].value |
| | | form.hidden = false |
| | | } |
| | | |
| | | return form |
| | | }) |
| | | }) |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 数据源类型切换 |
| | | */ |
| | | onChange = (e, key) => { |
| | | const { openType } = this.state |
| | | let value = e.target.value |
| | | |
| | | if (key === 'resourceType') { |
| | | let _options = ['label', 'field', 'initval', 'type', 'match', 'resourceType', 'setAll', 'display'] |
| | | |
| | | if (value === '0') { |
| | | _options = [..._options, 'options'] |
| | | } else if (value === '1') { |
| | |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | resetForm = (formlist) => { |
| | | 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', 'match'] // 默认显示项 |
| | | if ((type === 'select' || type === 'link') && resourceType === '0') { // 选择类型、自定义资源 |
| | | _options = [..._options, 'resourceType', 'setAll', 'options', 'display'] |
| | | } else if ((type === 'select' || type === 'link') && resourceType === '1') { // 选择类型、数据源 |
| | | _options = [..._options, 'resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display'] |
| | | } |
| | | |
| | | if (type === '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' |
| | | } |
| | | if (form.key === 'match') { |
| | | if (type === 'text') { |
| | | form.options = matchReg.text |
| | | } else if (type === 'select' || type === 'link') { |
| | | form.options = matchReg.select |
| | | } else if (type === 'date' || type === 'datemonth') { |
| | | form.options = matchReg.date |
| | | } else if (type === 'dateweek' || type === 'daterange') { |
| | | form.options = matchReg.daterange |
| | | } |
| | | } |
| | | form.hidden = !_options.includes(form.key) |
| | | return form |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | this.resetForm(this.props.formlist) |
| | | } |
| | | |
| | | render() { |
| | |
| | | search: [ |
| | | { |
| | | origin: true, |
| | | id: 0, |
| | | uuid: Utils.getuuid(), |
| | | label: 'label', |
| | | field: '', |
| | |
| | | display: 'dropdown' |
| | | }, { |
| | | origin: true, |
| | | id: 1, |
| | | uuid: Utils.getuuid(), |
| | | label: 'label', |
| | | field: '', |
| | |
| | | display: 'dropdown' |
| | | }, { |
| | | origin: true, |
| | | id: 2, |
| | | uuid: Utils.getuuid(), |
| | | label: 'label', |
| | | field: '', |
| | |
| | | action: [ |
| | | { |
| | | origin: true, |
| | | id: 0, |
| | | uuid: Utils.getuuid(), |
| | | label: 'add', |
| | | intertype: 'inner', |
| | |
| | | class: 'green' |
| | | }, { |
| | | origin: true, |
| | | id: 1, |
| | | uuid: Utils.getuuid(), |
| | | label: 'update', |
| | | intertype: 'inner', |
| | |
| | | class: 'purple' |
| | | }, { |
| | | origin: true, |
| | | id: 2, |
| | | uuid: Utils.getuuid(), |
| | | label: 'delete', |
| | | intertype: 'inner', |
| | |
| | | columns: [ |
| | | { |
| | | origin: true, |
| | | id: 0, |
| | | uuid: Utils.getuuid(), |
| | | Align: 'left', |
| | | label: 'label', |
| | |
| | | Width: 120 |
| | | }, { |
| | | origin: true, |
| | | id: 1, |
| | | uuid: Utils.getuuid(), |
| | | Align: 'left', |
| | | label: 'label', |
| | |
| | | Width: 120 |
| | | }, { |
| | | origin: true, |
| | | id: 2, |
| | | uuid: Utils.getuuid(), |
| | | Align: 'left', |
| | | label: 'label', |
| | |
| | | Width: 120 |
| | | }, { |
| | | origin: true, |
| | | id: 3, |
| | | uuid: Utils.getuuid(), |
| | | Align: 'left', |
| | | label: 'label', |
| | |
| | | <div className="page-card" style={{ opacity: opacity}}> |
| | | <div ref={node => drag(drop(node))}> |
| | | {<div className="ant-row ant-form-item"> |
| | | <div className="ant-col ant-form-item-label"> |
| | | <div className="ant-col ant-form-item-label ant-col-xs-24 ant-col-sm-8"> |
| | | <label title={card.label}>{card.label}</label> |
| | | </div> |
| | | <div className="ant-col ant-form-item-control-wrapper"> |
| | | <div className="ant-col ant-form-item-control-wrapper ant-col-xs-24 ant-col-sm-16"> |
| | | {card.type === 'text' && |
| | | <Input style={{marginTop: '4px'}} defaultValue={card.initval} /> |
| | | } |
| | |
| | | } |
| | | |
| | | const findCard = id => { |
| | | const card = cards.filter(c => `${c.id}` === id)[0] |
| | | const card = cards.filter(c => `${c.uuid}` === id)[0] |
| | | return { |
| | | card, |
| | | index: cards.indexOf(card), |
| | |
| | | newcard.readonly = 'false' |
| | | newcard.required = 'false' |
| | | |
| | | newcard.id = Utils.getuuid() |
| | | |
| | | let targetId = cards.length > 0 ? cards[cards.length - 1].id : 0 |
| | | let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0 |
| | | if (target) { |
| | | targetId = target.id |
| | | targetId = target.uuid |
| | | } |
| | | |
| | | const { index: overIndex } = findCard(`${targetId}`) |
| | |
| | | {cards.map(card => ( |
| | | <Col key={card.uuid} span={_cols}> |
| | | <Card |
| | | key={card.uuid} |
| | | id={`${card.id}`} |
| | | id={`${card.uuid}`} |
| | | card={card} |
| | | moveCard={moveCard} |
| | | editCard={editCard} |
| | |
| | | let element = null |
| | | _config.groups.forEach(item => { |
| | | item.sublist = item.sublist.filter(cell => { |
| | | if (cell.id !== elementId) { |
| | | if (cell.uuid !== elementId) { |
| | | return true |
| | | } else { |
| | | element = cell |
| | |
| | | |
| | | let _additems = _columns.map(item => { // 循环添加新增字段 |
| | | return { |
| | | id: Utils.getuuid(), |
| | | uuid: Utils.getuuid(), |
| | | label: item.label, |
| | | field: item.field, |
| | |
| | | _columns.forEach(item => { // 循环添加新增字段 |
| | | if (item.selected) { |
| | | let newcard = { |
| | | id: Utils.getuuid(), |
| | | uuid: Utils.getuuid(), |
| | | label: item.label, |
| | | field: item.field, |
| | |
| | | display: flex; |
| | | margin-bottom: 0px; |
| | | .ant-form-item-label { |
| | | width: 100px; |
| | | // width: 100px; |
| | | height: 40px; |
| | | label { |
| | | width: 100%; |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, InputNumber } from 'antd' |
| | | import { dateOptions } from '@/utils/option.js' |
| | | import EditTable from '../editable' |
| | | import './index.scss' |
| | | |
| | |
| | | state = { |
| | | openType: null, |
| | | resourceType: null, |
| | | formlist: null, |
| | | dateoptions: { |
| | | date: [{value: '', text: '空'}, {value: '0', text: '当天'}, {value: 1, text: '前一天'}, {value: 3, text: '前三天'}, {value: 7, text: '前七天'}, {value: 30, text: '前30天'}], |
| | | datemonth: [{value: '', text: '空'}, {value: '0', text: '本月'}, {value: 1, text: '上月'}, {value: 3, text: '前三月'}, {value: 6, text: '前六月'}], |
| | | datetime: [{value: '', text: '空'}, {value: '0', text: '现在'}, {value: 1, text: '昨天'}, {value: 3, text: '前三天'}, {value: 7, text: '前七天'}, {value: 30, text: '前30天'}], |
| | | } |
| | | formlist: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | openType: type, |
| | | resourceType: resourceType, |
| | | formlist: formlist.map(form => { |
| | | if (this.state.dateoptions.hasOwnProperty(type) && form.key === 'initval') { |
| | | form.options = this.state.dateoptions[type] |
| | | if (dateOptions.hasOwnProperty(type) && form.key === 'initval') { |
| | | form.options = dateOptions[type] |
| | | form.type = 'select' |
| | | } else if (type === 'number' && form.key === 'initval') { |
| | | form.type = 'number' |
| | |
| | | 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] |
| | | if (dateOptions.hasOwnProperty(value)) { |
| | | form.options = dateOptions[value] |
| | | form.type = 'select' |
| | | form.initVal = '' |
| | | } else if (value === 'number') { |
| | |
| | | fields: [ |
| | | { |
| | | origin: true, |
| | | id: Utils.getuuid(), |
| | | uuid: Utils.getuuid(), |
| | | label: 'label', |
| | | field: '', |
| | |
| | | required: 'false' |
| | | }, { |
| | | origin: true, |
| | | id: Utils.getuuid(), |
| | | uuid: Utils.getuuid(), |
| | | label: 'label', |
| | | field: '', |
| | |
| | | required: 'false' |
| | | }, { |
| | | origin: true, |
| | | id: Utils.getuuid(), |
| | | uuid: Utils.getuuid(), |
| | | label: 'label', |
| | | field: '', |
New file |
| | |
| | | import zhCN from '@/locales/zh-CN/share.js' |
| | | import enUS from '@/locales/en-US/share.js' |
| | | |
| | | const _dict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | | export const dateOptions = { |
| | | date: [ |
| | | {value: '', text: _dict['date.empty']}, |
| | | {value: '0', text: '当天'}, |
| | | {value: 1, text: '前一天'}, |
| | | {value: 3, text: '前三天'}, |
| | | {value: 7, text: '前七天'}, |
| | | {value: 30, text: '前30天'} |
| | | ], |
| | | dateweek: [ |
| | | {value: '', text: _dict['date.empty']}, |
| | | {value: '0', text: '本周'}, |
| | | {value: 1, text: '上周'}, |
| | | {value: 3, text: '前三周'}, |
| | | {value: 7, text: '前七周'} |
| | | ], |
| | | datemonth: [ |
| | | {value: '', text: _dict['date.empty']}, |
| | | {value: '0', text: '本月'}, |
| | | {value: 1, text: '上月'}, |
| | | {value: 3, text: '前三月'}, |
| | | {value: 7, text: '前七月'} |
| | | ], |
| | | daterange: [ |
| | | {value: '', text: _dict['date.empty']}, |
| | | {value: '0', text: '今天'}, |
| | | {value: 1, text: '昨天'}, |
| | | {value: 3, text: '前三天'}, |
| | | {value: 7, text: '前七天'}, |
| | | {value: 30, text: '前30天'} |
| | | ], |
| | | datetime: [ |
| | | {value: '', text: _dict['date.empty']}, |
| | | {value: '0', text: '现在'}, |
| | | {value: 1, text: '昨天'}, |
| | | {value: 3, text: '前三天'}, |
| | | {value: 7, text: '前七天'}, |
| | | {value: 30, text: '前30天'} |
| | | ] |
| | | } |
| | | |
| | | export const matchReg = { // 匹配规则 |
| | | text: [{ |
| | | value: 'like', |
| | | text: 'like' |
| | | }, { |
| | | value: 'not like', |
| | | text: 'not like' |
| | | }, { |
| | | value: '=', |
| | | text: '=' |
| | | }], |
| | | select: [{ |
| | | value: '=', |
| | | text: '=' |
| | | }, { |
| | | value: 'like', |
| | | text: 'like' |
| | | }, { |
| | | value: 'not like', |
| | | text: 'not like' |
| | | }], |
| | | date: [{ |
| | | value: '>=', |
| | | text: '>=' |
| | | }, { |
| | | value: '<=', |
| | | text: '<=' |
| | | }], |
| | | daterange: [{ |
| | | value: 'between', |
| | | text: 'between' |
| | | }] |
| | | } |
| | | |
| | | export const btnIcons = [{ |
| | | MenuID: '', |
| | | text: 'unset' |
| | | }, { |
| | | MenuID: 'plus', |
| | | text: 'plus' |
| | | }, { |
| | | MenuID: 'plus-circle', |
| | | text: 'plus-circle' |
| | | }, { |
| | | MenuID: 'edit', |
| | | text: 'edit' |
| | | }, { |
| | | MenuID: 'form', |
| | | text: 'form' |
| | | }, { |
| | | MenuID: 'close', |
| | | text: 'close' |
| | | }, { |
| | | MenuID: 'close-circle', |
| | | text: 'close-circle' |
| | | }, { |
| | | MenuID: 'delete', |
| | | text: 'delete' |
| | | }] |
| | | |
| | | export const btnClasses = [{ |
| | | MenuID: 'default', |
| | | text: '默认(黑边白底)' |
| | | }, { |
| | | MenuID: 'primary', |
| | | text: '蓝色' |
| | | }, { |
| | | MenuID: 'yellow', |
| | | text: '黄色' |
| | | }, { |
| | | MenuID: 'danger', |
| | | text: '红色' |
| | | }, { |
| | | MenuID: 'green', |
| | | text: '绿色' |
| | | }, { |
| | | MenuID: 'dgreen', |
| | | text: '深绿色' |
| | | }, { |
| | | MenuID: 'purple', |
| | | text: '紫色' |
| | | }, { |
| | | MenuID: 'gray', |
| | | text: '灰色' |
| | | }] |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 初始化搜索条件 |
| | | * @param {Array} searches 搜索条件 |
| | | * @return {String} searches 格式化后结果 |
| | | */ |
| | | static initMainSearch (searches) { |
| | | if (!searches || searches.length === 0) return [] |
| | | |
| | | let newsearches = [] |
| | | searches.forEach(search => { |
| | | let item = { |
| | | key: search.field, |
| | | match: search.match, |
| | | type: search.type, |
| | | value: search.initval |
| | | } |
| | | if (item.type === 'date') { |
| | | item.value = item.value ? moment().subtract(item.value, 'days').format('YYYY-MM-DD') : '' |
| | | } else if (item.type === 'datemonth') { |
| | | item.value = item.value ? moment().subtract(item.value, 'month').format('YYYY-MM') : '' |
| | | } else if (item.type === 'dateweek') { |
| | | item.value = item.value ? [moment().subtract(item.value * 7, 'days').startOf('week').format('YYYY-MM-DD'), |
| | | moment().subtract(item.value * 7, 'days').endOf('week').format('YYYY-MM-DD')] : '' |
| | | } else if (item.type === 'daterange') { |
| | | item.value = item.value ? [moment().subtract(item.value, 'days').format('YYYY-MM-DD'), |
| | | moment().subtract(item.value === 1 ? 1 : 0, 'days').format('YYYY-MM-DD')] : '' |
| | | } |
| | | newsearches.push(item) |
| | | }) |
| | | |
| | | return newsearches |
| | | } |
| | | |
| | | /** |
| | | * @description 拼接搜索条件 |
| | | * @param {Array} searches 搜索条件 |
| | | * @return {String} searchText 拼接结果 |
| | | */ |
| | | static mainjointsearchkey (searches) { |
| | | static joinMainSearchkey (searches) { |
| | | if (!searches || searches.length === 0) return '' |
| | | |
| | | if (searches[0].hasOwnProperty('initval')) { |
| | | let newsearches = [] |
| | | searches.forEach(search => { |
| | | let item = { |
| | | key: search.field, |
| | | match: search.match, |
| | | type: search.type, |
| | | value: search.initval |
| | | } |
| | | if (item.type === 'date') { |
| | | item.value = item.value ? moment().subtract(item.value, 'days').format('YYYY-MM-DD') : '' |
| | | } else if (item.type === 'datemonth') { |
| | | item.value = item.value ? moment().subtract(item.value, 'month').format('YYYY-MM') : '' |
| | | } else if (item.type === 'dateweek') { |
| | | item.value = item.value ? [moment().subtract(item.value * 7, 'days').startOf('week').format('YYYY-MM-DD'), |
| | | moment().subtract(item.value * 7, 'days').endOf('week').format('YYYY-MM-DD')] : '' |
| | | } else if (item.type === 'daterange') { |
| | | item.value = item.value ? [moment().subtract(item.value, 'days').format('YYYY-MM-DD'), |
| | | moment().subtract(item.value === 1 ? 1 : 0, 'days').format('YYYY-MM-DD')] : '' |
| | | } |
| | | newsearches.push(item) |
| | | }) |
| | | searches = newsearches |
| | | } |
| | | |
| | | let searchText = '' |
| | | searches.forEach(item => { |
| | |
| | | let str = item.match === '=' ? '' : '%' |
| | | // eslint-disable-next-line |
| | | searchText += item.key + ' ' + item.match + ' ' + '\'' + str + item.value + str + '\'' |
| | | } else if (item.type === 'date' || item.type === 'datemonth') { |
| | | } else if (item.type === 'date') { |
| | | let timetail = ' 00:00:00.000' |
| | | if (item.match === '<' || item.match === '<=') { |
| | | timetail = ' 23:59:59.999' |
| | | } |
| | | // eslint-disable-next-line |
| | | searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value + timetail + '\')' |
| | | } else if (item.type === 'datemonth') { |
| | | // eslint-disable-next-line |
| | | searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value + '\')' |
| | | } else if (item.type === 'dateweek') { |
| | | let stimetail = ' 00:00:00.000' |
| | | let etimetail = ' 23:59:59.999' |
| | | // eslint-disable-next-line |
| | | searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value[0] + '\' AND \'' + item.value[1] + '\')' |
| | | searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value[0] + stimetail + '\' AND \'' + item.value[1] + etimetail + '\')' |
| | | } else if (item.type === 'daterange') { |
| | | let stimetail = ' 00:00:00.000' |
| | | let etimetail = ' 23:59:59.999' |
| | | // eslint-disable-next-line |
| | | searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value[0] + '\' AND \'' + item.value[1] + '\')' |
| | | searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value[0] + stimetail + '\' AND \'' + item.value[1] + etimetail + '\')' |
| | | } else { |
| | | // eslint-disable-next-line |
| | | searchText += '(' + item.key + ' ' + item.match + ' ' + '\'' + item.value + '\')' |
| | |
| | | /* |
| | | select top 10 * from sProcExcep order by id desc |
| | | |
| | | declare @UserName nvarchar(50),@FullName nvarchar(50) |
| | | declare @UserName nvarchar(50),@FullName nvarchar(50) |
| | | |
| | | select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID |
| | | ${form} |