Merge branch 'master' into positec
| | |
| | | "filter": "false", |
| | | "defaultApp": "", |
| | | "defaultLang": "zh-CN", |
| | | "WXAppID": "", |
| | | "WXAppID": "wx4d8a34c8d4494872", |
| | | "WXminiAppID": "", |
| | | "WXNotice": "true", |
| | | "nginx": "true", |
| | | "debugger": true, |
| | | "licenseKey": "", |
| | |
| | | /** |
| | | * @description 微信业务请求 |
| | | */ |
| | | wxAccessToken () { |
| | | wxAccessToken (domain = '') { |
| | | let _url = window.GLOB.baseurl + 'wxpay/getaccesstoken' |
| | | if (process.env.NODE_ENV !== 'production') { |
| | | _url = document.location.origin + '/wxpay/getaccesstoken' |
| | | |
| | | if (domain) { |
| | | _url = domain + 'wxpay/getaccesstoken' |
| | | } |
| | | |
| | | return new Promise(resolve => { |
| | | if (window.GLOB.accessToken.accessTime && (parseInt(new Date().getTime() / 1000) - window.GLOB.accessToken.accessTime < 30)) { |
| | | if (window.GLOB.accessToken.domain === domain && window.GLOB.accessToken.accessTime && (parseInt(new Date().getTime() / 1000) - window.GLOB.accessToken.accessTime < 30)) { |
| | | resolve(window.GLOB.accessToken) |
| | | } else { |
| | | window.GLOB.accessToken = {} |
| | | window.GLOB.accessToken = {domain} |
| | | axios({ |
| | | url: _url, |
| | | method: 'get' |
| | |
| | | * @description 微信业务请求 |
| | | */ |
| | | wxNginxRequest (url, method, param) { |
| | | let _url = window.GLOB.location + '/' + url |
| | | let _url = url |
| | | |
| | | if (!/^http/.test(url)) { |
| | | _url = window.GLOB.location + '/' + url |
| | | if (process.env.NODE_ENV === 'production') { |
| | | _url = document.location.origin + '/' + url |
| | | } |
| | |
| | | _url = window.GLOB.location + ':8443/' + url |
| | | if (process.env.NODE_ENV === 'production') { |
| | | _url = document.location.origin + ':8443/' + url |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | getWxNativePay (param) { |
| | | let _url = window.GLOB.baseurl + 'wxpay/wxNativePay' |
| | | if (process.env.NODE_ENV !== 'production') { |
| | | _url = document.location.origin + '/wxpay/wxNativePay' |
| | | } |
| | | |
| | | return axios({ |
| | | url: _url, |
| | |
| | | const { confirm } = Modal |
| | | const { Search } = Input |
| | | const Resetpwd = asyncComponent(() => import('@/components/resetPassword')) |
| | | const QrCode = asyncComponent(() => import('@/components/qrcode')) |
| | | const LoginForm = asyncSpinComponent(() => import('./loginform')) |
| | | |
| | | class Header extends Component { |
| | |
| | | }) |
| | | } |
| | | |
| | | wxnotice = () => { |
| | | Modal.success({ |
| | | className: 'mk-wx-notice', |
| | | title: <QrCode card={{qrWidth: 320, color: '#000000'}} value={window.GLOB.baseurl + 'mob/wxnotice.html?userid=' + sessionStorage.getItem('UserID') + '&loginuid=' + sessionStorage.getItem('LoginUID')}/>, |
| | | okText: '关闭' |
| | | }) |
| | | } |
| | | |
| | | changeToHome = () => { |
| | | if (!['linkage', 'menu_board'].includes(window.GLOB.navBar)) return |
| | | |
| | |
| | | <Menu.Item key="verup" onClick={this.verup}> |
| | | 页面更新 |
| | | </Menu.Item> |
| | | {window.GLOB.WXNotice ? <Menu.Item key="wxnotice" onClick={this.wxnotice}> |
| | | 微信消息 |
| | | </Menu.Item> : null} |
| | | {window.GLOB.appVersion ? <Menu.Item key="version" onClick={this.about}> |
| | | 关于 |
| | | </Menu.Item> : null} |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | .mk-wx-notice { |
| | | top: 100px!important; |
| | | .anticon-check-circle { |
| | | display: none; |
| | | } |
| | | .ant-modal-confirm-title { |
| | | text-align: center; |
| | | min-height: 320px; |
| | | } |
| | | .ant-modal-confirm-btns { |
| | | float: none!important; |
| | | text-align: center; |
| | | } |
| | | } |
| | |
| | | GLOB.nginx = config.nginx + '' === 'true' |
| | | GLOB.WXAppID = config.WXAppID || '' |
| | | GLOB.WXminiAppID = config.WXminiAppID || '' |
| | | GLOB.WXNotice = config.WXNotice + '' === 'true' |
| | | GLOB.accessToken = {} |
| | | GLOB.mkHS = false |
| | | |
| | |
| | | |
| | | if (options.sysType === 'cloud') { // cloud不可设置单点服务器地址,云端appkey为系统设置 |
| | | GLOB.appkey = options.cakey |
| | | GLOB.WXNotice = false |
| | | } else if (options.sysType === 'SSO') { // sso不可设置单点服务器地址 |
| | | GLOB.appkey = config.appkey |
| | | } else if (options.sysType === 'local') { // 业务系统 |
| | |
| | | type: 'radio', |
| | | field: 'permission', |
| | | label: '权限验证', |
| | | initval: wrap.permission || 'false', |
| | | initval: wrap.permission || (!appType ? 'true' : 'false'), |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '启用'}, |
| | | {value: 'false', label: '禁用'}, |
| | | ], |
| | | forbid: !appType || sessionStorage.getItem('editMenuType') === 'popview' |
| | | forbid: sessionStorage.getItem('editMenuType') === 'popview' |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | color: ['eleType', 'datatype', 'width', 'lenWidRadio', 'noValue', 'copyable'], |
| | | } |
| | | |
| | | class MainSearch extends Component { |
| | | class ElementEditForm extends Component { |
| | | static propTpyes = { |
| | | config: PropTypes.object, // 组件信息 |
| | | formlist: PropTypes.any, // 表单信息 |
| | |
| | | } |
| | | |
| | | state = { |
| | | formlist: null, // 表单信息 |
| | | eleType: '', |
| | | datatype: '', |
| | | showType: '', |
| | | showInfo: 'false', |
| | | fixStyle: '', |
| | | link: '' |
| | | formlist: null // 表单信息 |
| | | } |
| | | |
| | | record = null |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { card, config, side } = this.props |
| | | let _options = this.getOptions(card.eleType, card.datatype, card.link, (card.showType || 'line'), card.showInfo, card.fixStyle || '', card.posterType || '') |
| | | const { card, config, side, formlist } = this.props |
| | | |
| | | this.record = {} |
| | | |
| | | formlist.forEach(item => { |
| | | this.record[item.key] = item.initVal |
| | | }) |
| | | |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | | link: card.link, |
| | | eleType: card.eleType, |
| | | datatype: card.datatype, |
| | | showType: card.showType || 'line', |
| | | showInfo: card.showInfo || 'false', |
| | | fixStyle: card.fixStyle || '', |
| | | posterType: card.posterType || '', |
| | | formlist: this.props.formlist.map(item => { |
| | | formlist: formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | if (item.key === 'field' || item.key === 'linkurl' || item.key === 'bgImage' || item.key === 'posterField') { |
| | |
| | | }) |
| | | } |
| | | |
| | | getOptions = (eleType, datatype, link, showType, showInfo, fixStyle, posterType) => { |
| | | let _options = fromJS(cardTypeOptions[eleType]).toJS() // 选项列表 |
| | | getOptions = () => { |
| | | let _options = fromJS(cardTypeOptions[this.record.eleType]).toJS() // 选项列表 |
| | | |
| | | if (['text', 'number', 'picture', 'slider', 'barcode', 'qrcode', 'video', 'color'].includes(eleType)) { |
| | | if (datatype === 'dynamic') { |
| | | if (['text', 'number', 'picture', 'slider', 'barcode', 'qrcode', 'video', 'color'].includes(this.record.eleType)) { |
| | | if (this.record.datatype === 'dynamic') { |
| | | _options.push('field') |
| | | if (eleType === 'number') { |
| | | if (this.record.eleType === 'number') { |
| | | _options.push('decimal', 'format') |
| | | } |
| | | } else if (eleType === 'picture' || eleType === 'video') { |
| | | } else if (this.record.eleType === 'picture' || this.record.eleType === 'video') { |
| | | _options.push('url') |
| | | } else { |
| | | _options.push('value') |
| | | } |
| | | if (eleType === 'video' && posterType) { |
| | | if (posterType === 'dynamic') { |
| | | if (this.record.eleType === 'video' && this.record.posterType) { |
| | | if (this.record.posterType === 'dynamic') { |
| | | _options.push('posterField') |
| | | } else { |
| | | _options.push('posterUrl') |
| | | } |
| | | } |
| | | |
| | | if (['text', 'picture'].includes(eleType) && link) { |
| | | // if (link === 'dynamic' || link === 'static') { |
| | | _options.push('linkurl', 'joint', 'linkType') |
| | | // } |
| | | } else if (eleType === 'picture' && !link) { |
| | | if (['text', 'picture'].includes(this.record.eleType) && this.record.link) { |
| | | _options.push('linkType') |
| | | if (this.record.linkType === 'linkmenu') { |
| | | _options.push('open', 'joint') |
| | | if (this.record.link === 'static') { |
| | | _options.push('linkmenu') |
| | | } else { |
| | | _options.push('linkurl') |
| | | } |
| | | } else if (this.record.linkType === 'other') { |
| | | _options.push('linkurl', 'joint') |
| | | } else { |
| | | _options.push('linkurl') |
| | | } |
| | | } else if (this.record.eleType === 'picture' && !this.record.link) { |
| | | _options.push('scale') |
| | | } else if (eleType === 'slider') { |
| | | if (showInfo === 'true') { |
| | | } else if (this.record.eleType === 'slider') { |
| | | if (this.record.showInfo === 'true') { |
| | | _options.push('infoColor') |
| | | } |
| | | if (showType !== 'line') { |
| | | if (this.record.showType !== 'line') { |
| | | _options.push('outlineWidth', 'textAlign') |
| | | } |
| | | } |
| | | } else if (eleType === 'icon') { |
| | | if (datatype === 'dynamic') { |
| | | } else if (this.record.eleType === 'icon') { |
| | | if (this.record.datatype === 'dynamic') { |
| | | _options.push('field', 'noValue') |
| | | } else { |
| | | _options.push('icon') |
| | | } |
| | | } else if (this.record.eleType === 'formula' && this.record.eval === 'true') { |
| | | _options.push('decimal') |
| | | } |
| | | if (_options.includes('fixStyle') && fixStyle === 'alone') { |
| | | if (_options.includes('fixStyle') && this.record.fixStyle === 'alone') { |
| | | _options.push('fixSize', 'fixColor', 'fixLeft', 'fixRight') |
| | | } |
| | | |
| | |
| | | * 3、切换标签类型,重置可选标签 |
| | | */ |
| | | selectChange = (key, value, option) => { |
| | | const { card, config, side } = this.props |
| | | const { datatype, eleType, showType, showInfo, fixStyle, posterType } = this.state |
| | | const { config, side } = this.props |
| | | |
| | | this.record[key] = value |
| | | |
| | | if (key === 'eleType') { |
| | | let _options = this.getOptions(value, datatype, '', showType, showInfo, fixStyle, posterType) |
| | | this.record.link = '' |
| | | let _options = this.getOptions() |
| | | |
| | | if (value === 'splitline') { |
| | | this.record.color = '#EBE9E9' |
| | | } else if (value === 'formula') { |
| | | this.record.decimal = '' |
| | | } |
| | | |
| | | let _formlist = this.state.formlist.map(item => { |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | if (item.key === 'field') { |
| | |
| | | } |
| | | } else if (item.key === 'url') { |
| | | item.required = value !== 'qrcode' |
| | | } else if (item.key === 'showInfo') { |
| | | item.initVal = showInfo |
| | | } else if (item.key === 'posterType') { |
| | | item.initVal = posterType |
| | | } else if (item.key === 'fixStyle') { |
| | | item.initVal = fixStyle |
| | | } else if (item.key === 'color') { |
| | | if (value === 'splitline') { |
| | | item.initVal = '#EBE9E9' |
| | | } |
| | | } |
| | | |
| | | return item |
| | |
| | | } |
| | | |
| | | this.setState({ |
| | | link: '', |
| | | eleType: value, |
| | | showType: card.showType || 'line', |
| | | formlist: _formlist |
| | | }, () => { |
| | | if (value === 'splitline') { |
| | |
| | | this.props.form.setFieldsValue({value: option.props.title}) |
| | | } |
| | | } else if (key === 'link') { |
| | | let _options = this.getOptions(eleType, datatype, value, showType, showInfo, fixStyle, posterType) |
| | | let _options = this.getOptions() |
| | | this.setState({ |
| | | link: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | if (item.key === 'linkurl') { |
| | | item.type = value === 'dynamic' ? 'select' : 'textarea' |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | onChange = (e, key) => { |
| | | const { eleType, datatype, link, showType, showInfo, fixStyle, posterType } = this.state |
| | | let value = e.target.value |
| | | |
| | | if (key === 'datatype') { |
| | | let _options = this.getOptions(eleType, value, link, showType, showInfo, fixStyle, posterType) |
| | | } else if (['datatype', 'showInfo', 'showType', 'fixStyle', 'posterType', 'eval', 'linkType'].includes(key)) { |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | | datatype: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (key === 'link') { |
| | | let _options = this.getOptions(eleType, datatype, value, showType, showInfo, fixStyle, posterType) |
| | | this.setState({ |
| | | link: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | if (item.key === 'linkurl') { |
| | | item.type = value === 'dynamic' ? 'select' : 'textarea' |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (key === 'showInfo') { |
| | | let _options = this.getOptions(eleType, datatype, link, showType, value, fixStyle, posterType) |
| | | this.setState({ |
| | | showInfo: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (key === 'showType') { |
| | | this.setState({ |
| | | showType: value |
| | | }, () => { |
| | | let _options = this.getOptions(eleType, datatype, link, value, showInfo, fixStyle, posterType) |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | | }) |
| | | }) |
| | | } else if (key === 'fixStyle') { |
| | | this.setState({ |
| | | fixStyle: value |
| | | }, () => { |
| | | let _options = this.getOptions(eleType, datatype, link, showType, showInfo, value, posterType) |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | | }) |
| | | }) |
| | | } else if (key === 'posterType') { |
| | | this.setState({ |
| | | posterType: value |
| | | }, () => { |
| | | let _options = this.getOptions(eleType, datatype, link, showType, showInfo, fixStyle, value) |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | |
| | | getPopupContainer={() => document.getElementById('card-winter')} |
| | | > |
| | | {item.options.map((option, index) => |
| | | <Select.Option id={`${index}`} title={option.text} key={`${index}`} value={option.value}> |
| | | {option.text} |
| | | <Select.Option id={`${index}`} title={option.text || option.label} key={`${index}`} value={option.value}> |
| | | {option.text || option.label} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | |
| | | message: '请选择' + item.label + '!' |
| | | }] |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.onChange(e, item.key)}} disabled={item.readonly}> |
| | | <Radio.Group onChange={(e) => {this.selectChange(item.key, e.target.value)}} disabled={item.readonly}> |
| | | {item.options.map(option => { |
| | | return ( |
| | | <Radio key={option.value} value={option.value}>{option.text}</Radio> |
| | |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { config } = this.props |
| | | |
| | | // 表单提交时检查输入值是否正确 |
| | | return new Promise((resolve, reject) => { |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | values.uuid = this.props.card.uuid |
| | | values.marks = this.props.card.marks || null |
| | | |
| | | // eslint-disable-next-line |
| | | if (values.eleType === 'formula' && values.eval !== 'false' && /^[\u4E00-\u9FA50-9a-zA-Z_\s@\+\-\*\/]*$/ig.test(values.formula) && /[\+\-\*\/]/ig.test(values.formula)) { |
| | | let cols = [] |
| | | config.subColumns && config.subColumns.forEach(col => { |
| | | if (/^(Int|Decimal)/ig.test(col.datatype)) { |
| | | cols.push({reg: new RegExp('@' + col.field + '@', 'ig'), value: `(@${col.field}@)`}) |
| | | } |
| | | }) |
| | | config.columns.forEach(col => { |
| | | if (/^(Int|Decimal)/ig.test(col.datatype)) { |
| | | cols.push({reg: new RegExp('@' + col.field + '@', 'ig'), value: `(@${col.field}@)`}) |
| | | } |
| | | }) |
| | | |
| | | cols.forEach(col => { |
| | | values.formula = values.formula.replace(col.reg, col.value) |
| | | }) |
| | | } |
| | | |
| | | resolve(values) |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | export default Form.create()(MainSearch) |
| | | export default Form.create()(ElementEditForm) |
| | |
| | | width = +width.replace(/x/, '.5') |
| | | } |
| | | |
| | | let linkTypes = [ |
| | | { value: 'tel', text: '电话' }, |
| | | { value: 'email', text: '邮箱' }, |
| | | { value: 'other', text: '其他' } |
| | | ] |
| | | |
| | | if (appType === 'mob') { |
| | | linkTypes = [ |
| | | { value: 'tel', text: '电话' }, |
| | | { value: 'email', text: '邮箱' }, |
| | | { value: 'qywx', text: '企业微信' }, |
| | | { value: 'linkmenu', text: '关联菜单' }, |
| | | { value: 'other', text: '其他' } |
| | | ] |
| | | } else if (appType === 'pc') { |
| | | linkTypes = [ |
| | | { value: 'tel', text: '电话' }, |
| | | { value: 'email', text: '邮箱' }, |
| | | { value: 'linkmenu', text: '关联菜单' }, |
| | | { value: 'other', text: '其他' } |
| | | ] |
| | | } |
| | | |
| | | if (card.linkType === 'qywx') { |
| | | if (appType !== 'mob') { |
| | | card.link = '' |
| | | card.linkType = '' |
| | | card.linkurl = '' |
| | | } |
| | | } else if (card.linkType === 'linkmenu') { |
| | | if (appType !== 'mob' && appType !== 'pc') { |
| | | card.link = '' |
| | | card.linkType = '' |
| | | card.linkurl = '' |
| | | card.linkmenu = '' |
| | | } |
| | | } |
| | | |
| | | let appMenus = sessionStorage.getItem('appMenus') |
| | | if (['pc', 'mob'].includes(appType)) { |
| | | if (appMenus) { |
| | | try { |
| | | appMenus = JSON.parse(appMenus) |
| | | } catch (e) { |
| | | appMenus = [] |
| | | } |
| | | } else { |
| | | appMenus = [] |
| | | } |
| | | appMenus.push({value: 'goback', text: '返回(上一页)'}) |
| | | } |
| | | |
| | | let forms = [ |
| | | { |
| | | type: 'select', |
| | |
| | | label: '预览地址', |
| | | initVal: card.posterField || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'eval', |
| | | label: '解析', |
| | | initVal: card.eval || 'false', |
| | | tooltip: '当公式内容涉及计算时请选择“是”,当公式内容为字段拼接时请选择“否”。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | |
| | | forbid: isHeader |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | type: linkTypes.length > 4 ? 'select' : 'radio', |
| | | key: 'linkType', |
| | | label: '链接类型', |
| | | initVal: card.linkType || 'other', |
| | | required: false, |
| | | options: [ |
| | | { value: 'tel', text: '电话' }, |
| | | { value: 'email', text: '邮箱' }, |
| | | { value: 'qywx', text: '企业微信' }, |
| | | { value: 'other', text: '其他' } |
| | | ] |
| | | options: linkTypes |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkmenu', |
| | | label: '关联菜单', |
| | | initVal: card.linkmenu || '', |
| | | required: true, |
| | | options: appMenus || [], |
| | | forbid: !['pc', 'mob'].includes(appType) |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkurl', |
| | | label: '链接地址', |
| | | initVal: card.linkurl || '', |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'joint', |
| | | label: '拼接参数', |
| | | initVal: card.joint || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | key: 'open', |
| | | label: '打开方式', |
| | | initVal: card.open || 'blank', |
| | | tooltip: '菜单打开方式。', |
| | | required: true, |
| | | forbid: !['pc', 'mob'].includes(appType), |
| | | options: [ |
| | | {value: 'blank', text: appType !== 'mob' ? '新窗口' : '新页面'}, |
| | | {value: 'self', text: appType !== 'mob' ? '当前窗口' : '当前页面'}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'eval', |
| | | label: '解析', |
| | | initVal: card.eval || 'false', |
| | | tooltip: '当公式内容涉及计算时请选择“是”,当公式内容为字段拼接时请选择“否”。', |
| | | key: 'joint', |
| | | label: '拼接参数', |
| | | initVal: card.joint || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | |
| | | } |
| | | |
| | | dropButton = (id) => { |
| | | const { cards, cardCell } = this.props |
| | | const { cards } = this.props |
| | | |
| | | if (!cards.action) return |
| | | if (cardCell.type === 'custom') return |
| | | |
| | | let index = cards.action.findIndex(item => item.uuid === id) |
| | | |
| | |
| | | type: 'radio', |
| | | field: 'permission', |
| | | label: '权限验证', |
| | | initval: wrap.permission || 'false', |
| | | initval: wrap.permission || (!appType ? 'true' : 'false'), |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '启用'}, |
| | | {value: 'false', label: '禁用'}, |
| | | ], |
| | | forbid: !appType || sessionStorage.getItem('editMenuType') === 'popview' |
| | | forbid: sessionStorage.getItem('editMenuType') === 'popview' |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | |
| | | type: 'radio', |
| | | field: 'permission', |
| | | label: '权限验证', |
| | | initval: wrap.permission || 'false', |
| | | initval: wrap.permission || (!appType ? 'true' : 'false'), |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '启用'}, |
| | | {value: 'false', label: '禁用'}, |
| | | ], |
| | | forbid: !appType || sessionStorage.getItem('editMenuType') === 'popview' |
| | | forbid: sessionStorage.getItem('editMenuType') === 'popview' |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | |
| | | type: 'radio', |
| | | field: 'permission', |
| | | label: '权限验证', |
| | | initval: wrap.permission || 'false', |
| | | initval: wrap.permission || (!appType ? 'true' : 'false'), |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '启用'}, |
| | | {value: 'false', label: '禁用'}, |
| | | ], |
| | | forbid: !appType || sessionStorage.getItem('editMenuType') === 'popview' |
| | | forbid: sessionStorage.getItem('editMenuType') === 'popview' |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | |
| | | border-right: 1px solid #e9e9e9; |
| | | } |
| | | span:nth-child(3), span:nth-child(6) { |
| | | border-color: #91d5ff; |
| | | border-color: #474069; |
| | | } |
| | | span:nth-child(9) { |
| | | border-color: #ffa39e; |
| | | border-color: #C48584; |
| | | } |
| | | } |
| | | |
| | |
| | | tr { |
| | | th { |
| | | position: relative; |
| | | background-color: transparent; |
| | | background-color: #E3E7F2; |
| | | padding: 0; |
| | | height: 60px; |
| | | line-height: 60px; |
| | |
| | | max-width: 60px; |
| | | } |
| | | .ant-table-tbody { |
| | | tr:last-child { |
| | | background-color: #FBF8EF; |
| | | } |
| | | tr td { |
| | | position: relative; |
| | | background-color: transparent; |
| | |
| | | values.verify.invalid = 'true' |
| | | } |
| | | } |
| | | } else if (values.OpenType === 'tab' && values.linkmenu) { |
| | | } else if (values.OpenType === 'tab' && values.linkmenu && Array.isArray(values.linkmenu)) { |
| | | if (sessionStorage.getItem('thdMenuList')) { |
| | | let list = null |
| | | try { |
| | |
| | | } else { |
| | | appMenus = [] |
| | | } |
| | | appMenus.push({value: 'goback', text: '返回(上一页)'}) |
| | | } else { |
| | | menulist = sessionStorage.getItem('fstMenuList') |
| | | if (menulist) { |
| | |
| | | extendName: 'MenuNo', |
| | | required: false, |
| | | allowClear: true, |
| | | options: appType === 'mob' || appType === 'pc' ? [...appMenus, {value: 'goback', text: '返回(上一页)'}] : menulist, |
| | | options: appType === 'mob' || appType === 'pc' ? appMenus : menulist, |
| | | forbid: viewType === 'popview' |
| | | }, |
| | | { |
| | |
| | | } else { |
| | | btn.style = item.style || {} |
| | | if (btn.class) { |
| | | if (btn.class !== item.class || btn.show !== item.show || !btn.style.color || item.focus) { |
| | | if (btn.class !== item.class || btn.show !== item.show || !btn.style.color || (item.focus && !btn.style.color)) { |
| | | if (btn.show === 'icon') { |
| | | btn.style.color = color[btn.class] |
| | | btn.style.backgroundColor = 'transparent' |
| | |
| | | let _col = null |
| | | if (config.type === 'table') { |
| | | config.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | if (col.type !== 'custom') return |
| | | |
| | | col.elements = col.elements.filter(item => { |
| | | if (item.uuid === id) { |
| | |
| | | return cell |
| | | }) |
| | | |
| | | let loopCol = (col) => { |
| | | col.subcols = col.subcols.map(c => { |
| | | c.uuid = Utils.getuuid() |
| | | |
| | | if (c.type === 'colspan' && c.subcols) { |
| | | c = loopCol(c) |
| | | } else if (c.type === 'custom' && c.elements) { |
| | | c.elements = c.elements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | | return cell |
| | | }) |
| | | } |
| | | return c |
| | | }) |
| | | |
| | | return col |
| | | } |
| | | |
| | | res.cols = res.cols.map(col => { |
| | | let loopCol = (cols) => { |
| | | return cols.map(col => { |
| | | col.uuid = Utils.getuuid() |
| | | |
| | | if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | |
| | | if (col.type === 'colspan' && col.subcols) { |
| | | col = loopCol(col) |
| | | col.subcols = loopCol(col.subcols) |
| | | } else if (col.type === 'custom' && col.elements) { |
| | | col.elements = col.elements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | | return cell |
| | | }) |
| | | } else if (col.type === 'action' && col.elements) { |
| | | col.elements = col.elements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | | return cell |
| | | }) |
| | | } |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | res.cols = loopCol(res.cols) |
| | | |
| | | let oriUids = {} |
| | | res.action = res.action.map(cell => { |
| | |
| | | }) |
| | | } |
| | | } else if (item.copyType === 'cols') { |
| | | let loopCol = (col) => { |
| | | col.subcols = col.subcols.map(c => { |
| | | c.uuid = Utils.getuuid() |
| | | let loopCol = (cols) => { |
| | | return cols.map(col => { |
| | | col.uuid = Utils.getuuid() |
| | | |
| | | if (c.type === 'colspan' && c.subcols) { |
| | | c = loopCol(c) |
| | | } else if (c.type === 'custom' && c.elements) { |
| | | c.elements = c.elements.map(cell => { |
| | | if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | |
| | | if (col.type === 'colspan' && col.subcols) { |
| | | col.subcols = loopCol(col.subcols) |
| | | } else if (col.type === 'custom' && col.elements) { |
| | | col.elements = col.elements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | | return cell |
| | | }) |
| | | } |
| | | return c |
| | | }) |
| | | |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | item.cols = item.cols.map(_item => { |
| | | _item.uuid = Utils.getuuid() |
| | | if (_item.type === 'colspan' && _item.subcols) { |
| | | _item = loopCol(_item) |
| | | } else if (_item.type === 'custom' && _item.elements) { |
| | | _item.elements = _item.elements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | | return cell |
| | | }) |
| | | } else if (_item.type === 'action' && _item.elements) { |
| | | _item.elements = _item.elements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | | return cell |
| | | }) |
| | | } |
| | | return _item |
| | | }) |
| | | item.cols = loopCol(item.cols) |
| | | } |
| | | |
| | | return item |
| | |
| | | return item |
| | | }) |
| | | |
| | | _config.cols = _config.cols.map(col => { |
| | | let loopCol = (cols) => { |
| | | return cols.map(col => { |
| | | col.uuid = Utils.getuuid() |
| | | col.marks = null |
| | | |
| | | if (col.type === 'colspan' && col.subcols) { |
| | | col = this.loopCol(col) |
| | | col.subcols = loopCol(col.subcols) |
| | | } else if (col.type === 'custom' && col.elements) { |
| | | col.elements = col.elements.map(cell => this.resetElement(cell)) |
| | | } else if (col.type === 'action' && col.elements) { |
| | | col.elements = col.elements.map(cell => { |
| | | if (cell.eleType === 'button') { |
| | | cell.verify = null |
| | | } else { |
| | | cell = this.resetElement(cell) |
| | | } |
| | | return cell |
| | | }) |
| | | } |
| | | col.marks = null |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | _config.cols = loopCol(_config.cols) |
| | | |
| | | return _config |
| | | } |
| | | |
| | | loopCol = (col) => { |
| | | col.subcols = col.subcols.map(c => { |
| | | if (c.type === 'colspan' && c.subcols) { |
| | | c = this.loopCol(c) |
| | | } else if (c.type === 'custom' && c.elements) { |
| | | c.elements = c.elements.map(cell => this.resetElement(cell)) |
| | | } |
| | | c.marks = null |
| | | return c |
| | | }) |
| | | |
| | | return col |
| | | } |
| | | |
| | | resetElement = (item) => { |
| | |
| | | text: '序号' |
| | | }] |
| | | |
| | | if (!card.isSub) { |
| | | options.push({ |
| | | value: 'action', |
| | | text: '操作' |
| | | }) |
| | | let decimal = card.decimal === undefined ? 0 : card.decimal |
| | | if (card.type === 'formula' && typeof(card.decimal) !== 'number') { |
| | | decimal = '' |
| | | } |
| | | |
| | | return [ |
| | |
| | | key: 'label', |
| | | label: '列头文字', |
| | | initVal: card.label, |
| | | required: true |
| | | required: true, |
| | | rules: [{ |
| | | max: 100, |
| | | message: '最多100个字符。' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | label: '字段', |
| | | initVal: card.field, |
| | | required: true, |
| | | options: card.isSub ? fields : [] |
| | | options: card.isSub ? fields : [], |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_' |
| | | }, { |
| | | max: 100, |
| | | message: '最多100个字符。' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'nameField', |
| | | label: '名称字段', |
| | | initVal: card.nameField || '', |
| | | required: false |
| | | required: false, |
| | | rules: [{ |
| | | max: 100, |
| | | message: '最多100个字符。' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'eval', |
| | | label: '解析', |
| | | initVal: card.eval || 'false', |
| | | tooltip: '当公式内容涉及计算时请选择“是”,当公式内容为字段拼接时请选择“否”。', |
| | | required: false, |
| | | options: [ |
| | | { value: 'true', text: '是' }, |
| | | { value: 'false', text: '否' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | max: 18, |
| | | decimal: 0, |
| | | label: '小数位', |
| | | initVal: card.decimal === undefined ? 0 : card.decimal, |
| | | initVal: decimal, |
| | | required: !card.isSub |
| | | }, |
| | | { |
| | |
| | | label: '前缀', |
| | | initVal: card.prefix || '', |
| | | required: false, |
| | | readonly: false |
| | | readonly: false, |
| | | rules: [{ |
| | | max: 100, |
| | | message: '最多100个字符。' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | label: '后缀', |
| | | initVal: card.postfix || '', |
| | | required: false, |
| | | readonly: false |
| | | readonly: false, |
| | | rules: [{ |
| | | max: 100, |
| | | message: '最多100个字符。' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | |
| | | initVal: card.linkfields || [], |
| | | required: false, |
| | | options: fields, |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'eval', |
| | | label: '解析', |
| | | initVal: card.eval || 'false', |
| | | tooltip: '当公式内容涉及计算时请选择“是”,当公式内容为字段拼接时请选择“否”。', |
| | | required: false, |
| | | options: [ |
| | | { value: 'true', text: '是' }, |
| | | { value: 'false', text: '否' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Cascader, Modal, Checkbox } from 'antd' |
| | | import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Cascader, Modal, Checkbox, Popover } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | |
| | | import { getColumnForm } from './formconfig' |
| | | import { formRule } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | |
| | | |
| | | class NormalTableColumn extends Component { |
| | | static propTpyes = { |
| | | visible: PropTypes.bool, |
| | | column: PropTypes.object, |
| | | fields: PropTypes.array, |
| | | submitCol: PropTypes.func, // 提交事件 |
| | |
| | | visible: false, |
| | | formlist: null |
| | | } |
| | | |
| | | record = null |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (nextProps.column && !is(fromJS(this.props.column), fromJS(nextProps.column))) { |
| | |
| | | }) |
| | | |
| | | let formlist = getColumnForm(column, fields) |
| | | let _options = fromJS(columnTypeOptions[column.type]).toJS() |
| | | if (column.type === 'text' || column.type === 'number') { |
| | | if (column.perspective === 'linkmenu') { |
| | | _options.push('linkmenu', 'linkfields', 'open') |
| | | } else if (column.perspective === 'linkurl') { |
| | | _options.push('linkurl', 'linkfields', 'open') |
| | | } |
| | | } |
| | | |
| | | this.record = {} |
| | | |
| | | formlist.forEach(item => { |
| | | this.record[item.key] = item.initVal |
| | | }) |
| | | |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | type: column.type, |
| | | formlist: formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | if (item.key === 'formula') { |
| | | item.fields = this.props.fields.map(col => col.field) |
| | | item.fields = item.fields.join(', ') |
| | | } else if (this.record.type === 'formula' && item.key === 'decimal') { |
| | | item.required = false |
| | | } |
| | | |
| | | return item |
| | | }) |
| | |
| | | } |
| | | } |
| | | |
| | | getOptions = () => { |
| | | let _options = fromJS(columnTypeOptions[this.record.type]).toJS() |
| | | |
| | | if (this.record.type === 'text' || this.record.type === 'number') { |
| | | if (this.record.perspective === 'linkmenu') { |
| | | _options.push('linkmenu', 'linkfields', 'open') |
| | | } else if (this.record.perspective === 'linkurl') { |
| | | _options.push('linkurl', 'linkfields', 'open') |
| | | } |
| | | } |
| | | |
| | | if (this.record.type === 'formula' && this.record.eval === 'true') { |
| | | _options.push('decimal') |
| | | } |
| | | |
| | | return _options |
| | | } |
| | | |
| | | typeChange = (key, value, option) => { |
| | | const { column } = this.props |
| | | this.record[key] = value |
| | | |
| | | if (key === 'type') { |
| | | let _options = fromJS(columnTypeOptions[value]).toJS() |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | | type: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'decimal') { |
| | | item.required = !(column.isSub || value === 'formula') |
| | | if (value === 'formula') { |
| | | this.record.decimal = '' |
| | | } |
| | | } |
| | | |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | return item |
| | |
| | | this.props.form.setFieldsValue({perspective: ''}) |
| | | } else if (value === 'colspan') { |
| | | this.props.form.setFieldsValue({Align: 'center'}) |
| | | } else if (value === 'action') { |
| | | this.props.form.setFieldsValue({Align: 'center', label: '操作'}) |
| | | } else if (value === 'index') { |
| | | this.props.form.setFieldsValue({label: '序号'}) |
| | | } |
| | |
| | | values.type = 'text' |
| | | } |
| | | |
| | | if (values.type !== this.state.type) { |
| | | let _type = this.record.type |
| | | this.record.type = values.type |
| | | |
| | | if (values.type !== _type) { |
| | | values.perspective = '' |
| | | let _options = fromJS(columnTypeOptions[values.type]).toJS() |
| | | this.record.perspective = '' |
| | | |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | | type: values.type, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | return item |
| | |
| | | } |
| | | } else if (key === 'format' && value === 'percent') { |
| | | this.props.form.setFieldsValue({postfix: '%'}) |
| | | } |
| | | } |
| | | |
| | | changeRadio = (key, value) => { |
| | | if (key === 'perspective') { |
| | | let _options = fromJS(columnTypeOptions[this.state.type]).toJS() |
| | | |
| | | if (value === 'linkmenu') { |
| | | _options.push('linkmenu', 'linkfields', 'open') |
| | | } else if (value === 'linkurl') { |
| | | _options.push('linkurl', 'linkfields', 'open') |
| | | } |
| | | } else if (['perspective', 'eval'].includes(key)) { |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | return item |
| | |
| | | if (item.hidden || item.forbid) return |
| | | |
| | | if (item.type === 'text') { |
| | | let rules = [] |
| | | if (item.key === 'field') { |
| | | rules = [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig, |
| | | message: '字段名只允许包含数字、字母、汉字以及_' |
| | | }, { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | }] |
| | | } else if (item.key !== 'linkurl') { |
| | | rules = [{ |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | }] |
| | | } |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | |
| | | required: !!item.required, |
| | | message: '请输入' + item.label + '!' |
| | | }, |
| | | ...rules |
| | | ...item.rules |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.handleSubmit} />)} |
| | | </Form.Item> |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.changeRadio(item.key, e.target.value)}}> |
| | | { |
| | | item.options.map(option => { |
| | | return ( |
| | | <Radio key={option.value} value={option.value}>{option.text}</Radio> |
| | | ) |
| | | }) |
| | | } |
| | | <Radio.Group onChange={(e) => {this.typeChange(item.key, e.target.value)}}> |
| | | {item.options.map(option => { |
| | | return (<Radio key={option.value} value={option.value}>{option.text}</Radio>) |
| | | })} |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'textarea') { |
| | | if (item.key === 'formula') { |
| | | fields.push( |
| | | <Col span={24} className="textarea" key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal || '', |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | | message: '请输入' + item.label + '!' |
| | | } |
| | | ] |
| | | })(<TextArea autoSize={{minRows: 2}} disabled={item.readonly} placeholder={item.placeholder || ''} />)} |
| | | </Form.Item> |
| | | <Popover overlayClassName="formula-fields" placement="topLeft" title="" content={<div>{item.fields}</div>} trigger="click"> |
| | | <span className="formula-icon">字段集</span> |
| | | </Popover> |
| | | </Col> |
| | | ) |
| | | } else { |
| | | fields.push( |
| | | <Col span={24} key={index} className="textarea"> |
| | | <Form.Item label={item.tooltip ? |
| | |
| | | </Col> |
| | | ) |
| | | } |
| | | } |
| | | }) |
| | | return fields |
| | | } |
| | | |
| | | handleSubmit = () => { |
| | | const { fields } = this.props |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | // eslint-disable-next-line |
| | | if (values.type === 'formula' && values.eval !== 'false' && /^[\u4E00-\u9FA50-9a-zA-Z_\s@\+\-\*\/]*$/ig.test(values.formula) && /[\+\-\*\/]/ig.test(values.formula)) { |
| | | let cols = [] |
| | | fields.forEach(col => { |
| | | if (/^(Int|Decimal)/ig.test(col.datatype)) { |
| | | cols.push({reg: new RegExp('@' + col.field + '@', 'ig'), value: `(@${col.field}@)`}) |
| | | } |
| | | }) |
| | | |
| | | cols.forEach(col => { |
| | | values.formula = values.formula.replace(col.reg, col.value) |
| | | }) |
| | | } |
| | | |
| | | this.props.submitCol(values, () => { |
| | | this.setState({visible: false, formlist: null}) |
| | | }) |
| | |
| | | width: 88%; |
| | | } |
| | | } |
| | | .formula-icon { |
| | | position: absolute; |
| | | bottom: 5px; |
| | | right: 15px; |
| | | cursor: pointer; |
| | | font-size: 12px; |
| | | color: #1890ff; |
| | | } |
| | | >.ant-row >.ant-col { |
| | | display: inline-block; |
| | | vertical-align: top; |
| | | float: none; |
| | | } |
| | | } |
| | | .formula-fields { |
| | | z-index: 1200!important; |
| | | |
| | | .ant-popover-inner-content { |
| | | div { |
| | | max-width: 750px; |
| | | word-break: break-all; |
| | | } |
| | | } |
| | | } |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider, DragSource, DropTarget } from 'react-dnd' |
| | | import { Table, Popover, Modal, message, notification } from 'antd' |
| | | import { PlusOutlined, EditOutlined, CopyOutlined, DeleteOutlined, FontColorsOutlined, CloseCircleOutlined, AntDesignOutlined, InfoOutlined } from '@ant-design/icons' |
| | | import { PlusOutlined, PlusSquareOutlined, EditOutlined, CopyOutlined, DeleteOutlined, FontColorsOutlined, CloseCircleOutlined, AntDesignOutlined, InfoOutlined } from '@ant-design/icons' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | |
| | | render() { |
| | | const { connectDragSource, connectDropTarget, moveCol, addElement, dropCol, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props |
| | | |
| | | if (index !== undefined) { |
| | | if (index !== undefined && column) { |
| | | let style = {cursor: 'move', textAlign: align} |
| | | if (column.Width) { |
| | | style.width = column.Width |
| | |
| | | } |
| | | |
| | | return connectDragSource( |
| | | connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => column && this.props.editColumn(column)}> |
| | | connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => this.props.editColumn(column)}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | | {column && ['custom', 'colspan', 'action'].includes(column.type) ? |
| | | <PlusOutlined className="plus" title="添加" onClick={() => this.props.addElement(column)} /> : null |
| | | } |
| | | {column.type === 'colspan' ? <PlusOutlined className="plus" title="添加列" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusOutlined className="plus" title="添加元素" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.props.addElement(column, 'button')} /> : null} |
| | | <EditOutlined className="edit" title="编辑" onClick={() => this.props.editColumn(column)} /> |
| | | {column && column.type === 'custom' ? <PasteComponent options={['customCardElement']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column && (column.type === 'custom' || column.type === 'action') ? <FontColorsOutlined className="style" title="调整样式" onClick={() => this.props.changeStyle(column)}/> : null} |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column.type === 'custom' ? <FontColorsOutlined className="style" title="调整样式" onClick={() => this.props.changeStyle(column)}/> : null} |
| | | <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} /> |
| | | {column && ['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | |
| | | <th {...restProps} style={style} key={column.uuid} onDoubleClick={() => this.props.editColumn(column)}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | | {column && ['custom', 'colspan'].includes(column.type) ? |
| | | <PlusOutlined className="plus" title="添加" onClick={() => this.props.addElement(column)} /> : null |
| | | } |
| | | {column.type === 'colspan' ? <PlusOutlined className="plus" title="添加列" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusOutlined className="plus" title="添加元素" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.props.addElement(column, 'button')} /> : null} |
| | | <EditOutlined className="edit" title="编辑" onClick={() => this.props.editColumn(column)} /> |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} /> |
| | | {column && ['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | |
| | | if (column && column.type === 'custom') { |
| | | return ( |
| | | <td style={{padding: 0, ...(column.style || {})}} className={className}> |
| | | <CardCellComponent cards={config} cardCell={column} elements={column.elements} updateElement={this.updateCard}/> |
| | | </td> |
| | | ) |
| | | } else if (column && column.type === 'action') { |
| | | return ( |
| | | <td style={{padding: 0, textAlign: column.Align, ...(column.style || {})}} className={'action-column ' + className}> |
| | | <CardCellComponent cards={config} cardCell={column} elements={column.elements} updateElement={this.updateCard}/> |
| | | </td> |
| | | ) |
| | |
| | | dropCol = (item, hoverIndex) => { |
| | | let _columns = fromJS(this.state.columns).toJS() |
| | | |
| | | let col = { focus: true, uuid: Utils.getuuid(), label: 'label', field: '', type: item.subType, elements: [] } |
| | | let col = { focus: true, uuid: Utils.getuuid(), Width: 120, label: 'label', field: '', type: item.subType, elements: [] } |
| | | if (col.type === 'colspan') { |
| | | col.subcols = [] |
| | | } else if (col.type === 'action') { |
| | | col.label = '操作' |
| | | } else if (col.type === 'index') { |
| | | col.label = '序号' |
| | | } |
| | |
| | | pasteCell = (col, cell, resolve) => { |
| | | resolve({status: true}) |
| | | |
| | | delete cell.copyType |
| | | cell.uuid = Utils.getuuid() |
| | | cell.focus = true |
| | | |
| | | if (!cell.eleType) { |
| | | if (cell.copyType === 'action') { |
| | | cell.eleType = 'button' |
| | | cell.width = cell.width || 12 |
| | | } else { |
| | | cell.eleType = 'text' |
| | | } |
| | | } |
| | | delete cell.copyType |
| | | |
| | | MKEmitter.emit('cardAddElement', col.uuid, cell) |
| | | } |
| | | |
| | | addElement = (col) => { |
| | | addElement = (col, type) => { |
| | | let column = fromJS(col).toJS() |
| | | |
| | | if (column.type === 'colspan') { |
| | |
| | | }) |
| | | this.updateCol(column) |
| | | } else if (column.type === 'custom') { |
| | | let newcard = {uuid: Utils.getuuid(), focus: true, width: 24, eleType: 'text', datatype: 'dynamic', style: {paddingLeft: '4px'}} |
| | | |
| | | // 注册事件-添加元素 |
| | | MKEmitter.emit('cardAddElement', column.uuid, newcard) |
| | | } else if (column.type === 'action') { |
| | | if (type === 'button') { |
| | | let newcard = { |
| | | uuid: Utils.getuuid(), |
| | | focus: true, |
| | |
| | | |
| | | // 注册事件-添加元素 |
| | | MKEmitter.emit('cardAddElement', column.uuid, newcard) |
| | | } else { |
| | | let newcard = {uuid: Utils.getuuid(), focus: true, width: 24, eleType: 'text', datatype: 'dynamic', style: {paddingLeft: '4px'}} |
| | | |
| | | // 注册事件-添加元素 |
| | | MKEmitter.emit('cardAddElement', column.uuid, newcard) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } else if (col.type === 'custom') { |
| | | col.style = card.style || {} |
| | | col.elements = card.type === 'custom' ? (card.elements || []) : [] |
| | | } else if (col.type === 'action') { |
| | | col.style = card.style || {} |
| | | col.elements = card.type === 'action' ? (card.elements || []) : [] |
| | | } |
| | | |
| | | if (!col.field || col.isSub) { |
| | |
| | | } |
| | | } |
| | | } |
| | | .action-column { |
| | | .card-detail-row:empty { |
| | | min-height: 40px; |
| | | } |
| | | } |
| | | tr:hover td { |
| | | background: #ffffff!important; |
| | | } |
| | |
| | | MKEmitter.removeListener('completeSave', this.completeSave) |
| | | } |
| | | |
| | | // updateFix = (card) => { |
| | | // let fixs = {} |
| | | |
| | | // card.cols.forEach(col => { |
| | | // if (!col.field) return |
| | | // if (col.postfix || col.prefix) { |
| | | // fixs[col.field] = col |
| | | // } |
| | | // }) |
| | | |
| | | // card.cols.forEach(col => { |
| | | // if (col.type === 'custom') { |
| | | // col.elements.forEach(cell => { |
| | | // if (cell.datatype === 'dynamic') { |
| | | // cell.height = '' |
| | | // cell.innerHeight = 'auto' |
| | | |
| | | // if (fixs[cell.field]) { |
| | | // if (!cell.prefix && fixs[cell.field].prefix) { |
| | | // cell.prefix = fixs[cell.field].prefix |
| | | // } |
| | | // if (!cell.postfix && fixs[cell.field].postfix) { |
| | | // cell.postfix = fixs[cell.field].postfix |
| | | // } |
| | | // } |
| | | // } |
| | | // }) |
| | | // } |
| | | // }) |
| | | |
| | | // return card |
| | | // } |
| | | |
| | | completeSave = () => { |
| | | const { card } = this.state |
| | | |
| | |
| | | let _actions = [...action] |
| | | |
| | | cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | _actions.push(...col.elements) |
| | | if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | _actions.push(cell) |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | return getWrapForm(wrap, _actions, columns) |
| | |
| | | roleList = [] |
| | | } |
| | | |
| | | // if (['picture', 'link', 'colspan'].includes(card.type)) { |
| | | if (['picture', 'link'].includes(card.type)) { |
| | | card.type = 'text' |
| | | } |
| | |
| | | }, { |
| | | value: 'colspan', |
| | | text: '合并列' |
| | | // }, { |
| | | // value: 'action', |
| | | // text: '操作' |
| | | }, { |
| | | value: 'formula', |
| | | text: '公式' |
| | |
| | | value: 'index', |
| | | text: '序号' |
| | | }] |
| | | |
| | | if (!card.isSub) { |
| | | options.push({ |
| | | value: 'action', |
| | | text: '操作' |
| | | }) |
| | | } |
| | | |
| | | let editCols = [ |
| | | { |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'eval', |
| | | label: '解析', |
| | | initVal: card.eval || 'false', |
| | | tooltip: '当公式内容涉及计算时请选择“是”,当公式内容为字段拼接时请选择“否”。', |
| | | required: false, |
| | | options: [ |
| | | { value: 'true', text: '是' }, |
| | | { value: 'false', text: '否' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'Align', |
| | | label: '对齐方式', |
| | | initVal: card.Align || 'left', |
| | |
| | | text: '右对齐' |
| | | }] |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // key: 'sum', |
| | | // label: '显示合计', |
| | | // initVal: card.sum || 'false', |
| | | // tooltip: '合计信息只在使用系统数据源时有效。', |
| | | // required: false, |
| | | // options: [{ |
| | | // value: 'true', |
| | | // text: '是' |
| | | // }, { |
| | | // value: 'false', |
| | | // text: '否' |
| | | // }] |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | key: 'editable', |
| | |
| | | text: '数据源' |
| | | }] |
| | | }, |
| | | // { |
| | | // type: 'select', |
| | | // key: 'editField', |
| | | // label: '编辑字段', |
| | | // initVal: card.editField || '', |
| | | // tooltip: '当值与提示文字不同时,可额外添加编辑字段,作为实际值的录入字段。', |
| | | // allowClear: true, |
| | | // required: false, |
| | | // options: fields |
| | | // }, |
| | | { |
| | | type: 'options', |
| | | key: 'options', |
| | |
| | | tooltip: '多个值用逗号分隔。', |
| | | required: false |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // key: 'footEnter', |
| | | // label: '末行回车', |
| | | // initVal: card.footEnter || 'false', |
| | | // tooltip: '新增功能仅在表格可新增时有效。', |
| | | // options: [{ |
| | | // value: 'sub', |
| | | // text: '提交' |
| | | // }, { |
| | | // value: 'add', |
| | | // text: '新增' |
| | | // }, { |
| | | // value: 'false', |
| | | // text: '无动作' |
| | | // }] |
| | | // }, |
| | | { |
| | | type: 'number', |
| | | key: 'decimal', |
| | |
| | | max: 18, |
| | | precision: 0, |
| | | label: '小数位', |
| | | initVal: card.decimal || 0, |
| | | initVal: card.decimal, |
| | | required: false |
| | | }, |
| | | { |
| | |
| | | label: '后缀', |
| | | initVal: card.postfix || '', |
| | | required: false, |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'eval', |
| | | label: '解析', |
| | | initVal: card.eval || 'false', |
| | | tooltip: '当公式内容涉及计算时请选择“是”,当公式内容为字段拼接时请选择“否”。', |
| | | required: false, |
| | | options: [ |
| | | { value: 'true', text: '是' }, |
| | | { value: 'false', text: '否' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | |
| | | const { TextArea } = Input |
| | | const columnTypeOptions = { |
| | | text: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'textFormat', 'editable', 'initval', 'blacklist'], |
| | | number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'editable', 'initval', 'sum', 'blacklist', 'noValue'], |
| | | number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'editable', 'initval', 'sum', 'blacklist'], |
| | | textarea: ['label', 'field', 'type', 'Align', 'Hide', 'Width', 'prefix', 'initval', 'postfix', 'blacklist'], |
| | | custom: ['label', 'type', 'Align', 'Width', 'blacklist'], |
| | | colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], |
| | | action: ['label', 'type', 'Align', 'Width'], |
| | | formula: ['label', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'eval', 'formula', 'blacklist', 'noValue'], |
| | | formula: ['label', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'eval', 'formula', 'blacklist'], |
| | | index: ['label', 'type', 'Align', 'Width'] |
| | | } |
| | | |
| | | class EdiTableColumn extends Component { |
| | | static propTpyes = { |
| | | visible: PropTypes.bool, |
| | | column: PropTypes.object, |
| | | columns: PropTypes.array, |
| | | fields: PropTypes.array, |
| | |
| | | transfield: {} |
| | | } |
| | | |
| | | column = null |
| | | record = null |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | let transfield = {} |
| | |
| | | } |
| | | |
| | | getOptions = () => { |
| | | let _options = fromJS(columnTypeOptions[this.column.type]).toJS() |
| | | let _options = fromJS(columnTypeOptions[this.record.type]).toJS() |
| | | |
| | | if (this.column.editable === 'true') { |
| | | if (['number', 'text'].includes(this.record.type) && this.record.editable === 'true') { |
| | | _options.push('ctrlField') |
| | | if (this.column.ctrlField) { |
| | | if (this.record.ctrlField) { |
| | | _options.push('ctrlValue') |
| | | } |
| | | if (this.column.type === 'text') { |
| | | if (this.record.type === 'text') { |
| | | _options.push('editType') |
| | | |
| | | if (this.column.editType === 'switch') { |
| | | if (this.record.editType === 'switch') { |
| | | _options.push('enter', 'openVal', 'closeVal', 'openText', 'closeText', 'editField') |
| | | } else if (this.column.editType === 'select') { |
| | | } else if (this.record.editType === 'select') { |
| | | _options.push('required', 'enter', 'resourceType', 'linkSubField', 'editField', 'dropdown') |
| | | |
| | | if (this.column.resourceType === '0') { |
| | | if (this.record.resourceType === '0') { |
| | | _options.push('options') |
| | | } else { |
| | | _options.push('dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'disableField', 'database') |
| | |
| | | } else { |
| | | _options.push('required', 'enter') |
| | | } |
| | | } else if (this.column.type === 'number') { |
| | | } else if (this.record.type === 'number') { |
| | | _options.push('max', 'min', 'enter') |
| | | } |
| | | } |
| | | if (this.record.type === 'formula' && this.record.eval === 'true') { |
| | | _options.push('decimal') |
| | | } |
| | | if (['number', 'formula'].includes(this.record.type) && this.record.Hide !== 'true') { |
| | | _options.push('noValue') |
| | | } |
| | | |
| | | return _options |
| | |
| | | }) |
| | | |
| | | let formlist = getColumnForm(column, fields, this.props.columns) |
| | | this.record = {} |
| | | |
| | | this.column = fromJS(column).toJS() |
| | | this.column.editType = this.column.editType || 'text' |
| | | this.column.resourceType = this.column.resourceType || '0' |
| | | formlist.forEach(item => { |
| | | this.record[item.key] = item.initVal |
| | | }) |
| | | |
| | | let _options = this.getOptions() |
| | | |
| | |
| | | } |
| | | |
| | | typeChange = (key, value, option) => { |
| | | this.column[key] = value |
| | | this.record[key] = value |
| | | |
| | | if (key === 'type') { |
| | | let _options = this.getOptions() |
| | |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | item.initVal = this.column[item.key] || item.initVal |
| | | if (item.key === 'decimal' && value === 'formula') { |
| | | this.record.decimal = '' |
| | | } |
| | | |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | return item |
| | |
| | | this.props.form.setFieldsValue({Align: 'center'}) |
| | | } else if (value === 'formula' && _field) { |
| | | this.props.form.setFieldsValue({formula: '@' + _field + '@'}) |
| | | } else if (value === 'action') { |
| | | this.props.form.setFieldsValue({Align: 'center', label: '操作'}) |
| | | } else if (value === 'index') { |
| | | this.props.form.setFieldsValue({label: '序号'}) |
| | | } |
| | |
| | | values.type = 'text' |
| | | } |
| | | |
| | | let _type = this.column.type |
| | | this.column.type = values.type |
| | | let _type = this.record.type |
| | | this.record.type = values.type |
| | | |
| | | if (values.type !== _type) { |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | item.initVal = this.column[item.key] || item.initVal |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | return item |
| | |
| | | } |
| | | } else if (key === 'format' && value === 'percent') { |
| | | this.props.form.setFieldsValue({postfix: '%'}) |
| | | } else if (key === 'editable' || key === 'editType' || key === 'resourceType' || key === 'ctrlField') { |
| | | } else if (['editable', 'editType', 'resourceType', 'ctrlField', 'eval', 'Hide'].includes(key)) { |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | item.initVal = this.column[item.key] || item.initVal |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | return item |
| | |
| | | multiselectChange = (key, value) => { |
| | | if (key !== 'linkSubField') return |
| | | |
| | | this.column[key] = value |
| | | this.record[key] = value |
| | | } |
| | | |
| | | handleEmpty = () => { |
| | |
| | | } |
| | | |
| | | changeOptions = (data) => { |
| | | this.column.options = data || [] |
| | | this.record.options = data || [] |
| | | } |
| | | |
| | | getFields() { |
| | |
| | | span = 24 |
| | | className = 'text-area' |
| | | |
| | | let linkSubFields = this.column.linkSubField || [] |
| | | let linkSubFields = this.record.linkSubField || [] |
| | | |
| | | content = <EditTable type={'select'} module="form" transfield={transfield} linkSubFields={linkSubFields} onChange={this.changeOptions}/> |
| | | } |
| | |
| | | } |
| | | |
| | | handleSubmit = () => { |
| | | const { fields } = this.props |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | |
| | | }) |
| | | return |
| | | } |
| | | // eslint-disable-next-line |
| | | } else if (values.type === 'formula' && values.eval !== 'false' && /^[\u4E00-\u9FA50-9a-zA-Z_\s@\+\-\*\/]*$/ig.test(values.formula) && /[\+\-\*\/]/ig.test(values.formula)) { |
| | | let cols = [] |
| | | fields.forEach(col => { |
| | | if (/^(Int|Decimal)/ig.test(col.datatype)) { |
| | | cols.push({reg: new RegExp('@' + col.field + '@', 'ig'), value: `(@${col.field}@)`}) |
| | | } |
| | | }) |
| | | |
| | | cols.forEach(col => { |
| | | values.formula = values.formula.replace(col.reg, col.value) |
| | | }) |
| | | } |
| | | |
| | | if (values.dataSource && /\s/.test(values.dataSource)) { |
| | |
| | | if (result.status) { |
| | | this.setState({visible: false, loading: false, formlist: null}) |
| | | this.props.submitCol(values) |
| | | this.column = null |
| | | this.record = null |
| | | } else { |
| | | this.setState({loading: false}) |
| | | Modal.error({ |
| | |
| | | } else { |
| | | this.setState({visible: false, formlist: null}) |
| | | this.props.submitCol(values) |
| | | this.column = null |
| | | this.record = null |
| | | } |
| | | } |
| | | }) |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider, DragSource, DropTarget } from 'react-dnd' |
| | | import { Table, Popover, Modal, message, Button, Typography } from 'antd' |
| | | import { PlusOutlined, FileSyncOutlined, EditOutlined, CopyOutlined, DeleteOutlined, FontColorsOutlined, CloseCircleOutlined, AntDesignOutlined } from '@ant-design/icons' |
| | | import { PlusOutlined, PlusSquareOutlined, FileSyncOutlined, EditOutlined, CopyOutlined, DeleteOutlined, FontColorsOutlined, CloseCircleOutlined, AntDesignOutlined } from '@ant-design/icons' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | |
| | | connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => this.props.editColumn(column)}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | | {['custom', 'colspan', 'action'].includes(column.type) ? |
| | | <PlusOutlined className="plus" title="添加" onClick={() => this.props.addElement(column)} /> : null |
| | | } |
| | | {column.type === 'colspan' ? <PlusOutlined className="plus" title="添加列" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusOutlined className="plus" title="添加元素" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.props.addElement(column, 'button')} /> : null} |
| | | <EditOutlined className="edit" title="编辑" onClick={() => this.props.editColumn(column)} /> |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column.type === 'action' ? <PasteComponent options={['action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column.type === 'custom' || column.type === 'action' ? <FontColorsOutlined className="style" title="调整样式" onClick={() => this.props.changeStyle(column)}/> : null} |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column.type === 'custom' ? <FontColorsOutlined className="style" title="调整样式" onClick={() => this.props.changeStyle(column)}/> : null} |
| | | <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} /> |
| | | {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | |
| | | <th {...restProps} style={style} key={column.uuid} onDoubleClick={() => this.props.editColumn(column)}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | | {['custom', 'colspan'].includes(column.type) ? |
| | | <PlusOutlined className="plus" title="添加" onClick={() => this.props.addElement(column)} /> : null |
| | | } |
| | | {column.type === 'colspan' ? <PlusOutlined className="plus" title="添加列" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusOutlined className="plus" title="添加元素" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.props.addElement(column, 'button')} /> : null} |
| | | <EditOutlined className="edit" title="编辑" onClick={() => this.props.editColumn(column)} /> |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} /> |
| | | {column && ['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | |
| | | if (column && column.type === 'custom') { |
| | | return ( |
| | | <td style={{padding: 0, ...(column.style || {})}} className={className}> |
| | | <CardCellComponent cards={config} cardCell={column} elements={column.elements} updateElement={this.updateCard}/> |
| | | </td> |
| | | ) |
| | | } else if (column && column.type === 'action') { |
| | | return ( |
| | | <td style={{padding: 0, textAlign: column.Align, ...(column.style || {})}} className={'action-column ' + className}> |
| | | <CardCellComponent cards={config} cardCell={column} elements={column.elements} updateElement={this.updateCard}/> |
| | | </td> |
| | | ) |
| | |
| | | let _columns = fromJS(this.state.columns).toJS() |
| | | let type = item.subType |
| | | |
| | | if (!['text', 'number', 'textarea', 'custom', 'action', 'formula', 'index', 'colspan'].includes(item.subType)) { |
| | | if (!['text', 'number', 'textarea', 'custom', 'formula', 'index', 'colspan'].includes(item.subType)) { |
| | | type = 'text' |
| | | } |
| | | |
| | | let col = { focus: true, uuid: Utils.getuuid(), label: 'label', field: '', type: type, elements: [] } |
| | | let col = { focus: true, uuid: Utils.getuuid(), Width: 120, label: 'label', field: '', type: type, elements: [] } |
| | | if (col.type === 'colspan') { |
| | | col.subcols = [] |
| | | } else if (col.type === 'action') { |
| | | col.label = '操作' |
| | | } else if (col.type === 'index') { |
| | | col.label = '序号' |
| | | } |
| | |
| | | pasteCell = (col, cell, resolve) => { |
| | | resolve({status: true}) |
| | | |
| | | delete cell.copyType |
| | | cell.uuid = Utils.getuuid() |
| | | cell.focus = true |
| | | |
| | | if (!cell.eleType) { |
| | | if (cell.copyType === 'action') { |
| | | cell.eleType = 'button' |
| | | cell.width = cell.width || 12 |
| | | } else { |
| | | cell.eleType = 'text' |
| | | } |
| | | } |
| | | delete cell.copyType |
| | | |
| | | MKEmitter.emit('cardAddElement', col.uuid, cell) |
| | | } |
| | | |
| | | addElement = (col) => { |
| | | addElement = (col, type) => { |
| | | let column = fromJS(col).toJS() |
| | | |
| | | if (column.type === 'colspan') { |
| | |
| | | }) |
| | | this.updateCol(column) |
| | | } else if (column.type === 'custom') { |
| | | let newcard = {uuid: Utils.getuuid(), focus: true, width: 24, eleType: 'text', datatype: 'dynamic', style: {paddingLeft: '4px'}} |
| | | |
| | | // 注册事件-添加元素 |
| | | MKEmitter.emit('cardAddElement', column.uuid, newcard) |
| | | } else if (column.type === 'action') { |
| | | if (type === 'button') { |
| | | let newcard = { |
| | | uuid: Utils.getuuid(), |
| | | focus: true, |
| | |
| | | |
| | | // 注册事件-添加元素 |
| | | MKEmitter.emit('cardAddElement', column.uuid, newcard) |
| | | } else { |
| | | let newcard = {uuid: Utils.getuuid(), focus: true, width: 24, eleType: 'text', datatype: 'dynamic', style: {paddingLeft: '4px'}} |
| | | |
| | | // 注册事件-添加元素 |
| | | MKEmitter.emit('cardAddElement', column.uuid, newcard) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } else if (col.type === 'custom') { |
| | | col.style = card.style || {} |
| | | col.elements = card.type === 'custom' ? (card.elements || []) : [] |
| | | } else if (col.type === 'action') { |
| | | col.style = card.style || {} |
| | | col.elements = card.type === 'action' ? (card.elements || []) : [] |
| | | } |
| | | |
| | | window.GLOB.precolumnId = window.GLOB.columnId || '' |
| | |
| | | deleteCol = (col) => { |
| | | let _columns = fromJS(this.state.columns).toJS() |
| | | |
| | | if (col.type === 'colspan' && col.subcols && col.subcols.length > 0) { |
| | | let Index = _columns.findIndex(item => item.uuid === col.uuid) |
| | | |
| | | if (Index !== -1) { |
| | | let list = col.subcols.map(item => { |
| | | item.isSub = false |
| | | return item |
| | | }) |
| | | |
| | | _columns.splice(Index, 1, ...list) |
| | | } else { |
| | | _columns = this.loopDelCol(_columns, col) |
| | | } |
| | | } else { |
| | | _columns = this.loopDelCol(_columns, col) |
| | | } |
| | | |
| | | this.setState({ |
| | | columns: _columns |
| | |
| | | } |
| | | } |
| | | } |
| | | .action-column { |
| | | .card-detail-row:empty { |
| | | min-height: 40px; |
| | | } |
| | | } |
| | | tr:hover td { |
| | | background: #ffffff!important; |
| | | } |
| | |
| | | } |
| | | |
| | | edit = (record) => { |
| | | const { type } = this.props |
| | | |
| | | this.setState({ |
| | | editItem: record |
| | | }) |
| | | |
| | | if (type === 'fullscreen') { |
| | | this.props.form.setFieldsValue({ |
| | | sql: record.sql |
| | | }) |
| | | } else { |
| | | this.props.form.setFieldsValue({ |
| | | sql: record.sql, |
| | | position: record.position || 'back' |
| | | }) |
| | | } |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { type } = this.props |
| | | const { editItem } = this.state |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (type === 'fullscreen' && err) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请输入sql!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | if (!err) { |
| | | if (/^[\s\n]+$/.test(values.sql)) { |
| | | notification.warning({ |
| | |
| | | } |
| | | |
| | | values.uuid = this.state.editItem ? this.state.editItem.uuid : '' |
| | | |
| | | if (type === 'fullscreen' && editItem) { |
| | | values.status = editItem.status || 'true' |
| | | } |
| | | |
| | | let _quot = values.sql.match(/'{1}/g) |
| | | let _lparen = values.sql.match(/\({1}/g) |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { systemScripts, btn } = this.props |
| | | const { usefulfields } = this.state |
| | | const { systemScripts, btn, type } = this.props |
| | | const { usefulfields, editItem } = this.state |
| | | const { getFieldDecorator } = this.props.form |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | return ( |
| | | <Form {...formItemLayout} className="verify-form" id="verify-excelin-custom-scripts"> |
| | | <Row gutter={24}> |
| | | {btn.sheet ? <Col span={8}> |
| | | {!type && btn.sheet ? <Col span={8}> |
| | | <Form.Item label={'表名'} style={{whiteSpace: 'nowrap', margin: 0}}> |
| | | {btn.sheet} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={10}> |
| | | {!type ? <Col span={10}> |
| | | <Form.Item label={'报错字段'} style={{margin: 0, whiteSpace: 'nowrap'}}> |
| | | ErrorCode(增加后缀NT表示数据不回滚,如ENT、NNT、FNT、NMNT), retmsg |
| | | </Form.Item> |
| | | </Col> |
| | | {usefulfields ? <Col span={24} className="sqlfield"> |
| | | </Col> : null} |
| | | {!type ? <Col span={24} className="sqlfield"> |
| | | <Form.Item label={'可用字段'}> |
| | | <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'公共值,请按照@xxx@格式使用。'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, time_id</span></Tooltip>, |
| | | <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'系统变量,系统会定义变量并赋值。'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address</span></Tooltip>, |
| | | {usefulfields},data_type(注:jskey为主键值,新增时前端生成;data_type为操作类型,新增 - add、修改 - upt、删除 - del) |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={8} style={{whiteSpace: 'nowrap'}}> |
| | | {!type ? <Col span={8} style={{whiteSpace: 'nowrap'}}> |
| | | <Form.Item style={{marginBottom: 0}} label={ |
| | | <Tooltip placement="bottomLeft" title={'自定义脚本与默认sql位置关系。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={10}> |
| | | </Col> : null} |
| | | {!type ? <Col span={10}> |
| | | <Form.Item style={{marginBottom: 0}} label={'快捷添加'}> |
| | | <Select |
| | | showSearch |
| | |
| | | )} |
| | | </Select> |
| | | </Form.Item> |
| | | </Col> |
| | | </Col> : null} |
| | | <Col span={6} className="add"> |
| | | <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginBottom: 15, marginLeft: 40}}> |
| | | 保存 |
| | | {type === 'fullscreen' && !editItem ? '添加' : '保存'} |
| | | </Button> |
| | | <Button onClick={this.handleCancel} style={{marginBottom: 15, marginLeft: 10}}> |
| | | 取消 |
| | |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import UniqueForm from './uniqueform' |
| | | import CustomScript from './customscript' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | const { confirm } = Modal |
| | | const { Paragraph } = Typography |
| | | const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) |
| | | const FullScripts = asyncComponent(() => import('@/templates/zshare/verifycard/fullScripts')) |
| | | |
| | | class VerifyTableCard extends Component { |
| | | static propTpyes = { |
| | |
| | | dataIndex: 'position', |
| | | width: '10%', |
| | | render: (text, record) => { |
| | | let _text = '' |
| | | if (record.position === 'front') { |
| | | _text = 'sql前' |
| | | } else if (record.position === 'init') { |
| | | _text = '初始化' |
| | | if (record.position === 'init') { |
| | | return <span style={{color: 'orange'}}>初始化</span> |
| | | } else if (record.position === 'front') { |
| | | return <span style={{color: '#26C281'}}>sql前</span> |
| | | } else { |
| | | _text = 'sql后' |
| | | return <span style={{color: '#1890ff'}}>sql后</span> |
| | | } |
| | | return _text |
| | | } |
| | | }, |
| | | { |
| | |
| | | values.uuid = Utils.getuuid() |
| | | verify.scripts.push(values) |
| | | } |
| | | |
| | | MKEmitter.emit('editLineId', values.uuid) |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | |
| | | {verify.scripts.length ? <span className="count-tip">{verify.scripts.length}</span> : null} |
| | | </span> |
| | | } key="scripts"> |
| | | <FullScripts |
| | | verify={verify} |
| | | getScriptsFullForm={() => this.scriptsFullForm} |
| | | getScriptsForm={() => this.scriptsForm} |
| | | handleStatus={this.handleStatus} |
| | | handleDelete={this.handleDelete} |
| | | > |
| | | <CustomScript |
| | | type="fullscreen" |
| | | btn={verify} |
| | | usefulfields={fields} |
| | | scripts={verify.scripts} |
| | | systemScripts={this.state.systemScripts} |
| | | scriptsChange={this.scriptsChange} |
| | | wrappedComponentRef={(inst) => this.scriptsFullForm = inst} |
| | | /> |
| | | </FullScripts> |
| | | <CustomScript |
| | | btn={verify} |
| | | usefulfields={fields} |
| | |
| | | z-index: 1; |
| | | } |
| | | } |
| | | .full-scripts { |
| | | position: absolute; |
| | | right: 24px; |
| | | top: 0px; |
| | | font-size: 16px; |
| | | color: #1890ff; |
| | | z-index: 1; |
| | | } |
| | | } |
| | |
| | | cell.uuid = Utils.getuuid() |
| | | return cell |
| | | }) |
| | | } else if (col.type === 'action' && col.elements) { |
| | | col.elements = col.elements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | | return cell |
| | | }) |
| | | } |
| | | return col |
| | | }) |
| | |
| | | addColumns = () => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | |
| | | card.cols.push({ focus: true, uuid: Utils.getuuid(), label: 'label', field: '', type: 'text' }) |
| | | card.cols.push({ focus: true, Width: 120, uuid: Utils.getuuid(), label: 'label', field: '', type: 'text' }) |
| | | |
| | | this.setState({card}) |
| | | } |
| | |
| | | type: 'radio', |
| | | field: 'permission', |
| | | label: '权限验证', |
| | | initval: wrap.permission || 'false', |
| | | initval: wrap.permission || (!appType ? 'true' : 'false'), |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '启用'}, |
| | | {value: 'false', label: '禁用'}, |
| | | ], |
| | | forbid: !appType || sessionStorage.getItem('editMenuType') === 'popview' |
| | | forbid: sessionStorage.getItem('editMenuType') === 'popview' |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | |
| | | text: '序号' |
| | | }] |
| | | |
| | | if (!card.isSub) { |
| | | options.push({ |
| | | value: 'action', |
| | | text: '操作' |
| | | }) |
| | | } |
| | | |
| | | if (!card.linkurl && (!card.linkmenu || card.linkmenu.length === 0)) { |
| | | card.perspective = '' |
| | | } |
| | |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'eval', |
| | | label: '解析', |
| | | initVal: card.eval || 'false', |
| | | tooltip: '当公式内容涉及计算时请选择“是”,当公式内容为字段拼接时请选择“否”。', |
| | | required: false, |
| | | options: [ |
| | | { value: 'true', text: '是' }, |
| | | { value: 'false', text: '否' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | options: [ |
| | | { value: 'blank', text: '新窗口' }, |
| | | { value: 'self', text: '当前窗口' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'eval', |
| | | label: '解析', |
| | | initVal: card.eval || 'false', |
| | | tooltip: '当公式内容涉及计算时请选择“是”,当公式内容为字段拼接时请选择“否”。', |
| | | required: false, |
| | | options: [ |
| | | { value: 'true', text: '是' }, |
| | | { value: 'false', text: '否' } |
| | | ] |
| | | }, |
| | | { |
| | |
| | | |
| | | class NormalTableColumn extends Component { |
| | | static propTpyes = { |
| | | visible: PropTypes.bool, |
| | | column: PropTypes.object, |
| | | fields: PropTypes.array, |
| | | submitCol: PropTypes.func, // 提交事件 |
| | |
| | | visible: false, |
| | | formlist: null |
| | | } |
| | | |
| | | record = null |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (nextProps.column && !is(fromJS(this.props.column), fromJS(nextProps.column))) { |
| | |
| | | }) |
| | | |
| | | let formlist = getColumnForm(column, fields) |
| | | let _options = fromJS(columnTypeOptions[column.type]).toJS() |
| | | if (column.type === 'text' || column.type === 'number') { |
| | | if (column.perspective === 'linkmenu') { |
| | | _options.push('linkmenu', 'linkfields', 'open') |
| | | } else if (column.perspective === 'linkurl') { |
| | | _options.push('linkurl', 'linkfields', 'open') |
| | | } |
| | | } |
| | | this.record = {} |
| | | |
| | | formlist.forEach(item => { |
| | | this.record[item.key] = item.initVal |
| | | }) |
| | | |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | type: column.type, |
| | | formlist: formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | getOptions = () => { |
| | | let _options = fromJS(columnTypeOptions[this.record.type]).toJS() |
| | | |
| | | if (this.record.type === 'text' || this.record.type === 'number') { |
| | | if (this.record.perspective === 'linkmenu') { |
| | | _options.push('linkmenu', 'linkfields', 'open') |
| | | } else if (this.record.perspective === 'linkurl') { |
| | | _options.push('linkurl', 'linkfields', 'open') |
| | | } |
| | | } |
| | | |
| | | if (this.record.type === 'formula' && this.record.eval === 'true') { |
| | | _options.push('decimal') |
| | | } |
| | | |
| | | return _options |
| | | } |
| | | |
| | | typeChange = (key, value, option) => { |
| | | this.record[key] = value |
| | | |
| | | if (key === 'type') { |
| | | let _options = fromJS(columnTypeOptions[value]).toJS() |
| | | let _options = this.getOptions() |
| | | |
| | | let _field = '' |
| | | if (value === 'formula') { |
| | |
| | | } |
| | | |
| | | this.setState({ |
| | | type: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'decimal' && value === 'formula') { |
| | | this.record.decimal = '' |
| | | } |
| | | |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | return item |
| | |
| | | this.props.form.setFieldsValue({Align: 'center'}) |
| | | } else if (value === 'formula' && _field) { |
| | | this.props.form.setFieldsValue({formula: '@' + _field + '@'}) |
| | | } else if (value === 'action') { |
| | | this.props.form.setFieldsValue({Align: 'center', label: '操作'}) |
| | | } else if (value === 'index') { |
| | | this.props.form.setFieldsValue({label: '序号'}) |
| | | } |
| | |
| | | values.type = 'text' |
| | | } |
| | | |
| | | if (values.type !== this.state.type) { |
| | | let _type = this.record.type |
| | | this.record.type = values.type |
| | | |
| | | if (values.type !== _type) { |
| | | values.perspective = '' |
| | | let _options = fromJS(columnTypeOptions[values.type]).toJS() |
| | | this.record.perspective = '' |
| | | |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | | type: values.type, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | return item |
| | |
| | | } |
| | | } else if (key === 'format' && value === 'percent') { |
| | | this.props.form.setFieldsValue({postfix: '%'}) |
| | | } |
| | | } |
| | | |
| | | changeRadio = (key, value) => { |
| | | if (key === 'perspective') { |
| | | let _options = fromJS(columnTypeOptions[this.state.type]).toJS() |
| | | |
| | | if (value === 'linkmenu') { |
| | | _options.push('linkmenu', 'linkfields', 'open') |
| | | } else if (value === 'linkurl') { |
| | | _options.push('linkurl', 'linkfields', 'open') |
| | | } |
| | | } else if (['perspective', 'eval'].includes(key)) { |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | return item |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.changeRadio(item.key, e.target.value)}}> |
| | | { |
| | | item.options.map(option => { |
| | | return ( |
| | | <Radio key={option.value} value={option.value}>{option.text}</Radio> |
| | | ) |
| | | }) |
| | | } |
| | | <Radio.Group onChange={(e) => {this.typeChange(item.key, e.target.value)}}> |
| | | {item.options.map(option => { |
| | | return (<Radio key={option.value} value={option.value}>{option.text}</Radio>) |
| | | })} |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | |
| | | } |
| | | |
| | | handleSubmit = () => { |
| | | const { fields } = this.props |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | // eslint-disable-next-line |
| | | if (values.type === 'formula' && values.eval !== 'false' && /^[\u4E00-\u9FA50-9a-zA-Z_\s@\+\-\*\/]*$/ig.test(values.formula) && /[\+\-\*\/]/ig.test(values.formula)) { |
| | | let cols = [] |
| | | fields.forEach(col => { |
| | | if (/^(Int|Decimal)/ig.test(col.datatype)) { |
| | | cols.push({reg: new RegExp('@' + col.field + '@', 'ig'), value: `(@${col.field}@)`}) |
| | | } |
| | | }) |
| | | |
| | | cols.forEach(col => { |
| | | values.formula = values.formula.replace(col.reg, col.value) |
| | | }) |
| | | } |
| | | this.setState({visible: false, formlist: null}) |
| | | this.props.submitCol(values) |
| | | } |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider, DragSource, DropTarget } from 'react-dnd' |
| | | import { Table, Popover, Modal, message, Typography } from 'antd' |
| | | import { PlusOutlined, FileSyncOutlined, EditOutlined, CopyOutlined, DeleteOutlined, FontColorsOutlined, CloseCircleOutlined, AntDesignOutlined } from '@ant-design/icons' |
| | | import { PlusOutlined, PlusSquareOutlined, FileSyncOutlined, EditOutlined, CopyOutlined, DeleteOutlined, FontColorsOutlined, CloseCircleOutlined, AntDesignOutlined } from '@ant-design/icons' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | |
| | | render() { |
| | | const { connectDragSource, connectDropTarget, moveCol, dropCol, addElement, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props |
| | | |
| | | if (index !== undefined) { |
| | | if (index !== undefined && column) { |
| | | let style = {cursor: 'move', textAlign: align} |
| | | if (column.Width) { |
| | | style.width = column.Width |
| | |
| | | } |
| | | |
| | | return connectDragSource( |
| | | connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => column && this.props.editColumn(column)}> |
| | | connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => this.props.editColumn(column)}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | | {column && ['custom', 'colspan', 'action'].includes(column.type) ? |
| | | <PlusOutlined className="plus" title="添加" onClick={() => this.props.addElement(column)} /> : null |
| | | } |
| | | {column.type === 'colspan' ? <PlusOutlined className="plus" title="添加列" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusOutlined className="plus" title="添加元素" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.props.addElement(column, 'button')} /> : null} |
| | | <EditOutlined className="edit" title="编辑" onClick={() => this.props.editColumn(column)} /> |
| | | {column && column.type === 'custom' ? <PasteComponent options={['customCardElement']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column && column.type === 'action' ? <PasteComponent options={['action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column && (column.type === 'custom' || column.type === 'action') ? <FontColorsOutlined className="style" title="调整样式" onClick={() => this.props.changeStyle(column)}/> : null} |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column.type === 'custom' ? <FontColorsOutlined className="style" title="调整样式" onClick={() => this.props.changeStyle(column)}/> : null} |
| | | <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} /> |
| | | {column && ['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | |
| | | <th {...restProps} style={style} key={column.uuid} onDoubleClick={() => this.props.editColumn(column)}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | | {column && ['custom', 'colspan'].includes(column.type) ? |
| | | <PlusOutlined className="plus" title="添加" onClick={() => this.props.addElement(column)} /> : null |
| | | } |
| | | {column.type === 'colspan' ? <PlusOutlined className="plus" title="添加列" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusOutlined className="plus" title="添加元素" onClick={() => this.props.addElement(column)} /> : null} |
| | | {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.props.addElement(column, 'button')} /> : null} |
| | | <EditOutlined className="edit" title="编辑" onClick={() => this.props.editColumn(column)} /> |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} |
| | | <DeleteOutlined className="close" title="删除" onClick={this.deleteCol} /> |
| | | {column && ['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | |
| | | if (column && column.type === 'custom') { |
| | | return ( |
| | | <td style={{padding: 0, ...(column.style || {})}} className={className}> |
| | | <CardCellComponent cards={config} cardCell={column} elements={column.elements} updateElement={this.updateCard}/> |
| | | </td> |
| | | ) |
| | | } else if (column && column.type === 'action') { |
| | | return ( |
| | | <td style={{padding: 0, textAlign: column.Align, ...(column.style || {})}} className={'action-column ' + className}> |
| | | <CardCellComponent cards={config} cardCell={column} elements={column.elements} updateElement={this.updateCard}/> |
| | | </td> |
| | | ) |
| | |
| | | let col = { focus: true, uuid: Utils.getuuid(), label: 'label', field: '', type: item.subType, elements: [] } |
| | | if (col.type === 'colspan') { |
| | | col.subcols = [] |
| | | } else if (col.type === 'action') { |
| | | col.label = '操作' |
| | | } else if (col.type === 'index') { |
| | | col.label = '序号' |
| | | } |
| | |
| | | |
| | | pasteCell = (col, cell, resolve) => { |
| | | resolve({status: true}) |
| | | |
| | | cell.uuid = Utils.getuuid() |
| | | cell.focus = true |
| | | |
| | | if (!cell.eleType) { |
| | | if (cell.copyType === 'action') { |
| | | cell.eleType = 'button' |
| | | cell.width = cell.width || 12 |
| | | } else { |
| | | cell.eleType = 'text' |
| | | } |
| | | } |
| | | |
| | | delete cell.copyType |
| | | cell.uuid = Utils.getuuid() |
| | | cell.focus = true |
| | | |
| | | MKEmitter.emit('cardAddElement', col.uuid, cell) |
| | | } |
| | | |
| | | addElement = (col) => { |
| | | addElement = (col, type) => { |
| | | let column = fromJS(col).toJS() |
| | | |
| | | if (column.type === 'colspan') { |
| | |
| | | }) |
| | | this.updateCol(column) |
| | | } else if (column.type === 'custom') { |
| | | let newcard = {uuid: Utils.getuuid(), focus: true, width: 24, eleType: 'text', datatype: 'dynamic', style: {paddingLeft: '4px'}} |
| | | |
| | | // 注册事件-添加元素 |
| | | MKEmitter.emit('cardAddElement', column.uuid, newcard) |
| | | } else if (column.type === 'action') { |
| | | if (type === 'button') { |
| | | let newcard = { |
| | | uuid: Utils.getuuid(), |
| | | focus: true, |
| | |
| | | |
| | | // 注册事件-添加元素 |
| | | MKEmitter.emit('cardAddElement', column.uuid, newcard) |
| | | } else { |
| | | let newcard = {uuid: Utils.getuuid(), focus: true, width: 24, eleType: 'text', datatype: 'dynamic', style: {paddingLeft: '4px'}} |
| | | |
| | | // 注册事件-添加元素 |
| | | MKEmitter.emit('cardAddElement', column.uuid, newcard) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } else if (col.type === 'custom') { |
| | | col.style = card.style || {} |
| | | col.elements = card.type === 'custom' ? (card.elements || []) : [] |
| | | } else if (col.type === 'action') { |
| | | col.style = card.style || {} |
| | | col.elements = card.type === 'action' ? (card.elements || []) : [] |
| | | } |
| | | |
| | | window.GLOB.precolumnId = window.GLOB.columnId || '' |
| | |
| | | } |
| | | } |
| | | } |
| | | .action-column { |
| | | .card-detail-row:empty { |
| | | min-height: 40px; |
| | | } |
| | | } |
| | | tr:hover td { |
| | | background: #ffffff!important; |
| | | } |
| | |
| | | cell.uuid = Utils.getuuid() |
| | | return cell |
| | | }) |
| | | } else if (col.type === 'action' && col.elements) { |
| | | col.elements = col.elements.map(cell => { |
| | | cell.uuid = Utils.getuuid() |
| | | return cell |
| | | }) |
| | | } |
| | | return col |
| | | }) |
| | |
| | | let _actions = [...action] |
| | | |
| | | cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | _actions.push(...col.elements) |
| | | if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | _actions.push(cell) |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | return getWrapForm(wrap, _actions, columns) |
| | |
| | | type: 'radio', |
| | | field: 'permission', |
| | | label: '权限验证', |
| | | initval: wrap.permission || 'false', |
| | | initval: wrap.permission || (!appType ? 'true' : 'false'), |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '启用'}, |
| | | {value: 'false', label: '禁用'}, |
| | | ], |
| | | forbid: !appType || sessionStorage.getItem('editMenuType') === 'popview' |
| | | forbid: sessionStorage.getItem('editMenuType') === 'popview' |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | |
| | | type: 'radio', |
| | | field: 'permission', |
| | | label: '权限验证', |
| | | initval: wrap.permission || 'false', |
| | | initval: wrap.permission || (!appType ? 'true' : 'false'), |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '启用'}, |
| | | {value: 'false', label: '禁用'}, |
| | | ], |
| | | forbid: !appType || sessionStorage.getItem('editMenuType') === 'popview' |
| | | forbid: sessionStorage.getItem('editMenuType') === 'popview' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | { subType: 'custom', text: '自定义列', type: 'col', $init: true }, |
| | | { subType: 'colspan', text: '合并列', type: 'col', $init: true }, |
| | | { subType: 'formula', text: '公式', type: 'col', $init: true }, |
| | | { subType: 'index', text: '序号', type: 'col', $init: true }, |
| | | { subType: 'action', text: '操作', type: 'col', $init: true } |
| | | { subType: 'index', text: '序号', type: 'col', $init: true } |
| | | ] |
| | | } |
| | | ] |
| | |
| | | import mindmap from '@/assets/mobimg/mindmap.png' |
| | | import indent from '@/assets/mobimg/indent.jfif' |
| | | import kapmap from '@/assets/mobimg/kapmap.jfif' |
| | | // import xflow from '@/assets/mobimg/xflow.png' |
| | | import Voucher from '@/assets/mobimg/voucher.png' |
| | | import Account from '@/assets/mobimg/account.png' |
| | | |
| | |
| | | { type: 'menu', url: mindmap, component: 'antvG6', subtype: 'mindmap', title: '思维导图', width: 24 }, |
| | | { type: 'menu', url: indent, component: 'antvG6', subtype: 'indentTree', title: '缩进文件树', width: 24 }, |
| | | { type: 'menu', url: kapmap, component: 'antvG6', subtype: 'kapmap', title: '知识图谱树', width: 24 }, |
| | | // { type: 'menu', url: xflow, component: 'antvX6', subtype: 'xflow', title: '流程图', width: 24 }, |
| | | { type: 'menu', url: chart, component: 'chart', subtype: 'custom', title: '自定义图表', width: 24, forbid: ['billPrint'] }, |
| | | { type: 'menu', url: Editor, component: 'editor', subtype: 'brafteditor', title: '富文本', width: 24 }, |
| | | { type: 'menu', url: SandBox, component: 'code', subtype: 'sandbox', title: '自定义', width: 24 }, |
| | |
| | | if (item.cols) { |
| | | let _update = (cols) => { |
| | | return cols.map(col => { |
| | | if (col.type === 'action' && col.elements) { |
| | | if (col.type === 'custom' && col.elements) { |
| | | col.elements = col.elements.map(m => { |
| | | if (m.eleType === 'button') { |
| | | if (m.modal && m.modal.fields) { |
| | | m.modal.fields = m.modal.fields.map(col => { |
| | | if (col.field && map[col.field.toLowerCase()]) { |
| | |
| | | if (m.config && m.config.components) { |
| | | m.config.components = _replace(m.config.components) |
| | | } |
| | | |
| | | return m |
| | | }) |
| | | } else if (col.type === 'custom' && col.elements) { |
| | | col.elements = col.elements.map(m => { |
| | | } else { |
| | | if (m.datatype === 'dynamic' && map[m.field.toLowerCase()]) { |
| | | m.field = map[m.field.toLowerCase()].FieldName |
| | | } |
| | | } |
| | | |
| | | return m |
| | |
| | | if (item.cols) { |
| | | let _update = (cols) => { |
| | | return cols.map(col => { |
| | | if (col.type === 'action' && col.elements) { |
| | | if (col.type === 'custom' && col.elements) { |
| | | col.elements = col.elements.map(m => { |
| | | if (m.eleType === 'button') { |
| | | if (m.modal && m.modal.fields) { |
| | | m.modal.fields = m.modal.fields.map(col => { |
| | | if (col.field && map[col.field.toLowerCase()]) { |
| | |
| | | if (m.config && m.config.components) { |
| | | m.config.components = _replace(m.config.components) |
| | | } |
| | | } |
| | | |
| | | return m |
| | | }) |
| | |
| | | }) |
| | | tab.components[0].cols = tab.components[0].cols.filter(col => !(col.field && col.Hide === 'true')) |
| | | tab.components[0].cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | if (col.type !== 'custom') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.OpenType === 'popview' && btn.config) { |
| | | btn.config.Template = 'CustomPage' |
| | |
| | | }) |
| | | item.cols = item.cols.filter(col => !(col.field && col.Hide === 'true')) |
| | | item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | if (col.type !== 'custom') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.OpenType === 'popview' && btn.config) { |
| | | btn.config.Template = 'CustomPage' |
| | |
| | | return false |
| | | } else if (col.Hide === 'true') { |
| | | return false |
| | | } else if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | |
| | | if (col.type === 'number') { |
| | |
| | | return false |
| | | } |
| | | } else if (col.type === 'custom') { |
| | | col.elements = col.elements.map(cell => { |
| | | if (['text', 'number', 'formula'].includes(cell.eleType)) { |
| | | col.elements = col.elements.filter(cell => { |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = 'popview' |
| | | |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | |
| | | return skip || permAction[cell.uuid] |
| | | } else if (['text', 'number', 'formula'].includes(cell.eleType)) { |
| | | if (!cell.height) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | return cell |
| | | return true |
| | | }) |
| | | |
| | | if (col.elements.length === 0) { |
| | | return false |
| | | } |
| | | } |
| | | |
| | | if (col.linkmenu && col.linkmenu.length > 0) { |
| | |
| | | return skip || permAction[cell.uuid] |
| | | }) |
| | | } |
| | | |
| | | item.cols = item.cols.filter(col => { |
| | | if (col.type !== 'action') return true |
| | | col.elements = col.elements.filter(cell => { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = 'popview' |
| | | |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | |
| | | return skip || permAction[cell.uuid] |
| | | }) |
| | | return col.elements.length !== 0 |
| | | }) |
| | | |
| | | return true |
| | | }) |
| | |
| | | elements: PropTypes.array, // 元素集 |
| | | } |
| | | |
| | | state = {} |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) || !is(fromJS(this.props), fromJS(nextProps)) |
| | | return !is(fromJS(this.props), fromJS(nextProps)) |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | window.open(_url) |
| | | return |
| | | } else if (card.linkType === 'qywx') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: 'PC不支持打开企业微信!', |
| | | duration: 5 |
| | | }) |
| | | } else if (card.linkType === 'qywx' || card.linkType === 'linkmenu') { |
| | | return |
| | | } |
| | | |
| | |
| | | // eslint-disable-next-line |
| | | _val = eval(_val) |
| | | } catch (e) { |
| | | if (window.debugger) { |
| | | console.info(_val) |
| | | console.warn(e) |
| | | } |
| | | _val = 0 |
| | | } |
| | | } |
| | |
| | | // eslint-disable-next-line |
| | | _val = eval(_val) |
| | | } catch (e) { |
| | | if (window.debugger) { |
| | | console.info(_val) |
| | | console.warn(e) |
| | | } |
| | | _val = '' |
| | | } |
| | | } |
| | |
| | | return null |
| | | } |
| | | |
| | | if (card.round && typeof(val) === 'number') { |
| | | val = Math.round(val * card.round) / card.round |
| | | val = val.toFixed(card.decimal) |
| | | } |
| | | |
| | | if (val !== '') { |
| | | if (val && typeof(val) === 'string') { |
| | | val = val.replace(/\n/ig, '<br/>') |
| | |
| | | sup_data.push(`'${n.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${n.voucher_sup_lp || ''}','${item.subject_code}','${item.subject_name}','${n.sup_voucher_text || ''}','${direct}',${item.debit || item.credit},'${n.customercode || ''}','${n.customername || ''}','${n.suppliercode || ''}','${n.suppliername || ''}','${n.co_pro_code || ''}','${n.co_pro_name || ''}','${n.workercode || ''}','${n.workername || ''}','${n.project_code || ''}','${n.project_name || ''}','${n.productcode || ''}','${n.productname || ''}','${n.cash_flow_code || ''}','${n.cash_flow_name || ''}','${n.sup_acc_code || ''}','${n.sup_acc_name || ''}','${n.sup_acc_type || ''}','${item.uuid}',0,'${n.lessor_code || ''}','${n.lessor_name || ''}','${n.logistics_code || ''}','${n.logistics_name || ''}'`) |
| | | }) |
| | | } |
| | | return `'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.debit ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},0,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}'` |
| | | return `'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.debit ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},0,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}','${item.closing_foreign_exchange || ''}'` |
| | | }) |
| | | |
| | | if (type === 'createVoucher') { |
| | |
| | | let curr = item.foreign_currency_type === 'Y' |
| | | let direct = item.debit ? 'debit' : 'credit' |
| | | |
| | | subject_data.push(`'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.debit ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},1,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}'`) |
| | | subject_data.push(`'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.debit ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},1,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}','${item.closing_foreign_exchange || ''}'`) |
| | | }) |
| | | |
| | | supMap.forEach(n => { |
| | |
| | | sup_data.push(`'${n.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${n.voucher_sup_lp || ''}','${item.subject_code}','${item.subject_name}','${n.sup_voucher_text || ''}','${direct}',${item.debit || item.credit || 0},'${n.customercode || ''}','${n.customername || ''}','${n.suppliercode || ''}','${n.suppliername || ''}','${n.co_pro_code || ''}','${n.co_pro_name || ''}','${n.workercode || ''}','${n.workername || ''}','${n.project_code || ''}','${n.project_name || ''}','${n.productcode || ''}','${n.productname || ''}','${n.cash_flow_code || ''}','${n.cash_flow_name || ''}','${n.sup_acc_code || ''}','${n.sup_acc_name || ''}','${n.sup_acc_type || ''}','${item.uuid}',0,'${n.lessor_code || ''}','${n.lessor_name || ''}','${n.logistics_code || ''}','${n.logistics_name || ''}'`) |
| | | }) |
| | | } |
| | | return `'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit || 0},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.direct ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},0,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}'` |
| | | return `'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit || 0},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.direct ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},0,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}','${item.closing_foreign_exchange || ''}'` |
| | | }) |
| | | |
| | | voucherMap.forEach(item => { |
| | |
| | | let curr = item.foreign_currency_type === 'Y' |
| | | let direct = !item.credit ? 'debit' : 'credit' |
| | | |
| | | subject_data.push(`'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit || 0},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.direct ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},1,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}'`) |
| | | subject_data.push(`'${item.uuid}','${item.subject_voucher_code || ''}','${item.voucher_lp || ''}','${item.subject_code}','${item.subject_name}','${item.subject_voucher_text || ''}',${count ? item.fcc_count || 0 : 0},${count ? item.net_unitprice || 0 : 0},'${item.unit}',${item.debit || item.credit || 0},'${direct}','${curr ? item.exratecode : '01010001'}','${curr ? item.exratename : 'CNY'}',${curr ? item.unitratio || 0 : 0},'${item.sup_accounting}',${item.direct ? 1 : -1},${curr ? item.foreign_amount || 0 : 0},1,'${item.local_currency || ''}','${count ? 'Y' : ''}','${curr ? 'Y' : ''}','${item.closing_foreign_exchange || ''}'`) |
| | | }) |
| | | |
| | | supMap.forEach(n => { |
| | |
| | | border-right: 1px solid #e9e9e9; |
| | | } |
| | | span:nth-child(3), span:nth-child(6) { |
| | | border-color: #91d5ff; |
| | | border-color: #474069; |
| | | } |
| | | span:nth-child(9) { |
| | | border-color: #ffa39e; |
| | | border-color: #C48584; |
| | | } |
| | | } |
| | | |
| | |
| | | tr { |
| | | th { |
| | | position: relative; |
| | | background-color: transparent; |
| | | background-color: #E3E7F2; |
| | | padding: 0; |
| | | height: 60px; |
| | | line-height: 60px; |
| | |
| | | max-width: 60px; |
| | | } |
| | | .ant-table-tbody { |
| | | tr:last-child { |
| | | background-color: #FBF8EF; |
| | | } |
| | | tr td { |
| | | position: relative; |
| | | background-color: transparent; |
| | |
| | | // eslint-disable-next-line |
| | | content = eval(content) |
| | | } catch (e) { |
| | | if (window.debugger) { |
| | | console.info(content) |
| | | console.warn(e) |
| | | } |
| | | content = '' |
| | | } |
| | | |
| | | if (col.round && typeof(content) === 'number') { |
| | | content = Math.round(content * col.round) / col.round |
| | | content = content.toFixed(col.decimal) |
| | | } |
| | | } |
| | | |
| | |
| | | style = {...style, ...col.style} |
| | | } |
| | | |
| | | resProps.children = ( |
| | | <CardCellComponent data={record} cards={config} elements={col.elements}/> |
| | | ) |
| | | } else if (col.type === 'action') { |
| | | style.padding = '0px' |
| | | if (col.style) { |
| | | style = {...style, ...col.style} |
| | | } |
| | | resProps.children = ( |
| | | <CardCellComponent data={record} cards={config} elements={col.elements}/> |
| | | ) |
| | |
| | | onCell: record => ({ |
| | | record, |
| | | col: item, |
| | | config: item.type === 'custom' || item.type === 'action' ? {setting, columns: fields} : null, |
| | | config: item.type === 'custom' ? {setting, columns: fields} : null, |
| | | triggerLink: this.triggerLink |
| | | }) |
| | | } |
| | |
| | | if (item.subcols.length === 0) { |
| | | return false |
| | | } |
| | | } else if (item.type === 'action') { |
| | | } else if (item.type === 'custom') { |
| | | item.elements.forEach(btn => { |
| | | if (btn.eleType !== 'button') return |
| | | if (btn.funcType === 'addline') { |
| | | setting.addable = true |
| | | } |
| | |
| | | BID: id, |
| | | BData: data |
| | | }, () => { |
| | | setTimeout(() => { |
| | | this.loadmaindata(true, 'true') |
| | | }, setting.delay || 0) |
| | | }) |
| | | } |
| | | } |
| | |
| | | } |
| | | }, 50) |
| | | |
| | | let values = {} |
| | | // if (col.editField) { |
| | | // values[col.field] = label |
| | | // values[col.editField] = val |
| | | // } else { |
| | | values[col.field] = val |
| | | // } |
| | | |
| | | MKEmitter.emit('changeRecord', col.tableId, {...record, ...values}) |
| | | MKEmitter.emit('changeRecord', col.tableId, {...record, [col.field]: val}) |
| | | } |
| | | |
| | | onSelectChange = (val, option) => { |
| | |
| | | }) |
| | | } |
| | | |
| | | // if (col.editField) { |
| | | // values[col.field] = _option.label |
| | | // values[col.editField] = val |
| | | // } else { |
| | | values[col.field] = val |
| | | // } |
| | | } |
| | | |
| | | this.setState({editing: false}) |
| | |
| | | <Input className={err ? 'has-error' : ''} title={err} id={col.uuid + record.$$uuid} defaultValue={value} onChange={(e) => this.onChange(e.target.value)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | </td>) |
| | | } else if (col.editType === 'switch') { |
| | | let _value = '' |
| | | // if (col.editField) { |
| | | // _value = record[col.editField] !== undefined ? record[col.editField] : '' |
| | | // } else { |
| | | _value = record[col.field] !== undefined ? record[col.field] : '' |
| | | // } |
| | | let _value = record[col.field] !== undefined ? record[col.field] : '' |
| | | |
| | | return (<td className="editing_table_cell"> |
| | | <CusSwitch config={col} defaultValue={_value} autoFocus={true} onChange={this.onSwitchChange} onBlur={this.switchBlur}/> |
| | | </td>) |
| | | } else { |
| | | let _value = '' |
| | | // if (col.editField) { |
| | | // _value = record[col.editField] !== undefined ? record[col.editField] : '' |
| | | // } else { |
| | | _value = record[col.field] !== undefined ? record[col.field] : '' |
| | | // } |
| | | let _value = record[col.field] !== undefined ? record[col.field] : '' |
| | | |
| | | return (<td className="editing_table_cell"> |
| | | <Select |
| | | showSearch |
| | |
| | | val = '' |
| | | } |
| | | return (<td className="editing_table_cell"> |
| | | <InputNumber className={err ? 'has-error' : ''} title={err} id={col.uuid + record.$$uuid} defaultValue={val} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | <InputNumber className={err ? 'has-error' : ''} precision={col.decimal || 0} title={err} id={col.uuid + record.$$uuid} defaultValue={val} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | </td>) |
| | | } else { |
| | | return (<td className={className + ' pointer'} style={style}> |
| | |
| | | // eslint-disable-next-line |
| | | content = eval(content) |
| | | } catch (e) { |
| | | if (window.debugger) { |
| | | console.info(content) |
| | | console.warn(e) |
| | | } |
| | | content = '' |
| | | } |
| | | } |
| | |
| | | |
| | | if (col.noValue === 'hide' && content === 0) { |
| | | content = '' |
| | | } |
| | | |
| | | if (col.round && typeof(content) === 'number') { |
| | | content = Math.round(content * col.round) / col.round |
| | | content = content.toFixed(col.decimal) |
| | | } |
| | | |
| | | if (content !== '') { |
| | |
| | | style = {...style, ...col.style} |
| | | } |
| | | |
| | | children = ( |
| | | <CardCellComponent data={record} cards={config} elements={col.elements}/> |
| | | ) |
| | | } else if (col.type === 'action') { |
| | | style.padding = '0px' |
| | | if (col.style) { |
| | | style = {...style, ...col.style} |
| | | } |
| | | children = ( |
| | | <CardCellComponent data={record} cards={config} elements={col.elements}/> |
| | | ) |
| | |
| | | } |
| | | }, 50) |
| | | |
| | | let values = {} |
| | | // if (col.editField) { |
| | | // values[col.field] = label |
| | | // values[col.editField] = val |
| | | // } else { |
| | | values[col.field] = val |
| | | // } |
| | | |
| | | MKEmitter.emit('changeRecord', col.tableId, {...record, ...values}) |
| | | MKEmitter.emit('changeRecord', col.tableId, {...record, [col.field]: val}) |
| | | } |
| | | |
| | | onSelectChange = (val, option) => { |
| | |
| | | }) |
| | | } |
| | | |
| | | // if (col.editField) { |
| | | // values[col.field] = _option.label |
| | | // values[col.editField] = val |
| | | // } else { |
| | | values[col.field] = val |
| | | // } |
| | | } |
| | | |
| | | setTimeout(() => { |
| | |
| | | let children = null |
| | | if (col.type === 'text') { |
| | | if (col.editable === 'true' && !disabled) { |
| | | let _value = '' |
| | | // if (col.editField) { |
| | | // _value = record[col.editField] !== undefined ? record[col.editField] : '' |
| | | // } else { |
| | | _value = record[col.field] !== undefined ? record[col.field] : '' |
| | | // } |
| | | let _value = record[col.field] !== undefined ? record[col.field] : '' |
| | | |
| | | if (!col.editType || col.editType === 'text') { |
| | | children = (<> |
| | |
| | | content = <span style={mark.innerStyle}>{content}</span> |
| | | } |
| | | } |
| | | |
| | | if (col.editable === 'true' && disabled) { |
| | | content = <span style={{display: 'inline-block', padding: '0 6px'}}>{content}</span> |
| | | } |
| | | |
| | | children = content |
| | | } |
| | | } else if (col.type === 'number') { |
| | |
| | | } |
| | | |
| | | children = (<> |
| | | <InputNumber className={err ? 'has-error' : ''} title={err} id={col.uuid + record.$$uuid} defaultValue={_value} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | <InputNumber className={err ? 'has-error' : ''} title={err} precision={col.decimal || 0} id={col.uuid + record.$$uuid} defaultValue={_value} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | </>) |
| | | } else { |
| | | let content = '' |
| | |
| | | content = <span style={mark.innerStyle}>{content}</span> |
| | | } |
| | | } |
| | | |
| | | if (col.editable === 'true' && disabled) { |
| | | content = <span style={{display: 'inline-block', padding: '0 6px'}}>{content}</span> |
| | | } |
| | | |
| | | children = content |
| | | } |
| | | } else if (col.type === 'textarea') { |
| | |
| | | // eslint-disable-next-line |
| | | content = eval(content) |
| | | } catch (e) { |
| | | if (window.debugger) { |
| | | console.info(content) |
| | | console.warn(e) |
| | | } |
| | | content = '' |
| | | } |
| | | } |
| | |
| | | |
| | | if (col.noValue === 'hide' && content === 0) { |
| | | content = '' |
| | | } |
| | | |
| | | if (col.round && typeof(content) === 'number') { |
| | | content = Math.round(content * col.round) / col.round |
| | | content = content.toFixed(col.decimal) |
| | | } |
| | | |
| | | if (content !== '') { |
| | |
| | | style = {...style, ...col.style} |
| | | } |
| | | |
| | | children = ( |
| | | <CardCellComponent data={record} cards={config} elements={col.elements}/> |
| | | ) |
| | | } else if (col.type === 'action') { |
| | | style.padding = '0px' |
| | | if (col.style) { |
| | | style = {...style, ...col.style} |
| | | } |
| | | children = ( |
| | | <CardCellComponent data={record} cards={config} elements={col.elements}/> |
| | | ) |
| | |
| | | onCell: record => ({ |
| | | record, |
| | | col: item, |
| | | config: item.type === 'custom' || item.type === 'action' ? {setting, columns: fields} : null, |
| | | config: item.type === 'custom' ? {setting, columns: fields} : null, |
| | | }) |
| | | } |
| | | } |
| | |
| | | if (menuid !== MenuID) return |
| | | |
| | | if (type !== 'line') { |
| | | if (setting.editType === 'multi' && data.length > 0) { |
| | | this.setState({edData: []}, () => { |
| | | this.setState({edData: data}) |
| | | }) |
| | | } else { |
| | | this.setState({edData: data}) |
| | | } |
| | | |
| | | if (setting.addable && data.length === 0) { |
| | | setTimeout(() => { |
| | |
| | | item.search = Utils.initSearchVal(item.search) |
| | | } |
| | | |
| | | if (item.type === 'table') { |
| | | let statFields = [] |
| | | let getCols = (cols) => { |
| | | return cols.filter(col => { |
| | | if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { |
| | | return false |
| | | } else if (col.Hide === 'true') { |
| | | return false |
| | | } |
| | | |
| | | if (col.type === 'number') { |
| | | if (col.sum === 'true' && !statFields.includes(col.field)) { |
| | | statFields.push(col) |
| | | } |
| | | if (typeof(col.decimal) === 'number') { |
| | | col.round = Math.pow(10, col.decimal) |
| | | if (col.format === 'percent') { |
| | | col.decimal = col.decimal > 2 ? col.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } else if (col.type === 'colspan') { |
| | | col.subcols = getCols(col.subcols || []) |
| | | if (col.subcols.length === 0) { |
| | | return false |
| | | } |
| | | } else if (col.type === 'custom') { |
| | | col.elements = col.elements.map(cell => { |
| | | cell = this.resetElement(cell) |
| | | return cell |
| | | }) |
| | | } |
| | | |
| | | if (col.linkmenu && col.linkmenu.length > 0) { |
| | | let menu_id = col.linkmenu.pop() |
| | | col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' |
| | | } else { |
| | | col.linkThdMenu = '' |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | } |
| | | |
| | | item.cols = getCols(item.cols) |
| | | item.statFields = statFields |
| | | } |
| | | |
| | | let mutil = false |
| | | if (item.wrap && item.wrap.supType === 'multi') { // 数据卡多上级组件 |
| | | mutil = true |
| | |
| | | } else { |
| | | item.setting.supModule = '' |
| | | } |
| | | } |
| | | |
| | | let pass = skip |
| | | |
| | | if (item.wrap && item.wrap.permission === 'false') { |
| | | pass = true |
| | | } |
| | | |
| | | // 权限过滤 |
| | |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | |
| | | return skip || permAction[cell.uuid] |
| | | return pass || permAction[cell.uuid] |
| | | }) |
| | | } |
| | | |
| | | if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | if (item.type === 'table') { |
| | | let statFields = [] |
| | | let getCols = (cols) => { |
| | | return cols.filter(col => { |
| | | if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { |
| | | return false |
| | | } else if (col.Hide === 'true') { |
| | | return false |
| | | } else if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | |
| | | if (col.type === 'number') { |
| | | if (col.sum === 'true' && !statFields.includes(col.field)) { |
| | | statFields.push(col) |
| | | } |
| | | if (typeof(col.decimal) === 'number') { |
| | | col.round = Math.pow(10, col.decimal) |
| | | if (col.format === 'percent') { |
| | | col.decimal = col.decimal > 2 ? col.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } else if (col.type === 'formula') { |
| | | if (typeof(col.decimal) === 'number') { |
| | | col.round = Math.pow(10, col.decimal) |
| | | } |
| | | } else if (col.type === 'colspan') { |
| | | col.subcols = getCols(col.subcols || []) |
| | | if (col.subcols.length === 0) { |
| | | return false |
| | | } |
| | | } else if (col.type === 'custom') { |
| | | col.elements = col.elements.filter(cell => { |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell = this.resetButton(item, cell, popview) |
| | | |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | |
| | | return pass || permAction[cell.uuid] |
| | | } else { |
| | | cell = this.resetElement(cell) |
| | | } |
| | | return true |
| | | }) |
| | | |
| | | if (col.elements.length === 0) { |
| | | return false |
| | | } |
| | | } |
| | | |
| | | if (col.linkmenu && col.linkmenu.length > 0) { |
| | | let menu_id = col.linkmenu.pop() |
| | | col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' |
| | | } else { |
| | | col.linkThdMenu = '' |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | } |
| | | |
| | | item.cols = getCols(item.cols) |
| | | item.statFields = statFields |
| | | |
| | | if (item.subtype === 'editable') { |
| | | item.submit.logLabel = item.$menuname + '-提交' |
| | | item.submit.$menuId = item.uuid |
| | | } |
| | | } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | item.subcards && item.subcards.forEach(card => { |
| | | if (card.style.boxShadow) { |
| | | delete card.style.hShadow |
| | |
| | | cell = this.resetElement(cell) |
| | | } |
| | | |
| | | return cell.eleType !== 'button' || skip || permAction[cell.uuid] |
| | | return cell.eleType !== 'button' || pass || permAction[cell.uuid] |
| | | }) |
| | | |
| | | if (!card.backElements || card.backElements.length === 0) return |
| | |
| | | cell = this.resetElement(cell) |
| | | } |
| | | |
| | | return cell.eleType !== 'button' || skip || permAction[cell.uuid] |
| | | return cell.eleType !== 'button' || pass || permAction[cell.uuid] |
| | | }) |
| | | }) |
| | | } else if (item.type === 'balcony') { |
| | |
| | | cell = this.resetElement(cell) |
| | | } |
| | | |
| | | return cell.eleType !== 'button' || skip || permAction[cell.uuid] |
| | | return cell.eleType !== 'button' || pass || permAction[cell.uuid] |
| | | }) |
| | | } else if (item.type === 'table') { |
| | | item.cols = item.cols.filter(col => { |
| | | if (col.type !== 'action') return true |
| | | col.elements = col.elements.filter(cell => { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell = this.resetButton(item, cell, popview) |
| | | |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | |
| | | return skip || permAction[cell.uuid] |
| | | }) |
| | | return col.elements.length !== 0 |
| | | }) |
| | | |
| | | if (item.subtype === 'editable') { |
| | | item.submit.logLabel = item.$menuname + '-提交' |
| | | item.submit.$menuId = item.uuid |
| | | } |
| | | } else if (item.type === 'form') { |
| | | item.subcards = item.subcards.map(group => { |
| | | group.subButton.uuid = group.uuid |
| | |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } else if (cell.eleType === 'formula' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | } |
| | | } else if (cell.eleType === 'icon') { |
| | | if (!cell.innerHeight) { // 兼容 |
| | |
| | | item.search = Utils.initSearchVal(item.search) |
| | | } |
| | | |
| | | if (item.type === 'table') { |
| | | let statFields = [] |
| | | let getCols = (cols) => { |
| | | return cols.filter(col => { |
| | | if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { |
| | | return false |
| | | } else if (col.Hide === 'true') { |
| | | return false |
| | | } |
| | | |
| | | if (col.type === 'number') { |
| | | if (col.sum === 'true' && !statFields.includes(col.field)) { |
| | | statFields.push(col) |
| | | } |
| | | if (typeof(col.decimal) === 'number') { |
| | | col.round = Math.pow(10, col.decimal) |
| | | if (col.format === 'percent') { |
| | | col.decimal = col.decimal > 2 ? col.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } else if (col.type === 'colspan') { |
| | | col.subcols = getCols(col.subcols || []) |
| | | if (col.subcols.length === 0) { |
| | | return false |
| | | } |
| | | } else if (col.type === 'custom') { |
| | | col.elements = col.elements.map(cell => { |
| | | cell = this.resetElement(cell) |
| | | return cell |
| | | }) |
| | | } |
| | | |
| | | if (col.linkmenu && col.linkmenu.length > 0) { |
| | | let menu_id = col.linkmenu.pop() |
| | | col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' |
| | | } else { |
| | | col.linkThdMenu = '' |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | } |
| | | |
| | | item.cols = getCols(item.cols) |
| | | item.statFields = statFields |
| | | } |
| | | |
| | | let mutil = false |
| | | if (item.wrap && item.wrap.supType === 'multi') { // 数据卡多上级组件 |
| | | mutil = true |
| | |
| | | }) |
| | | } |
| | | |
| | | if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | if (item.type === 'table') { |
| | | let statFields = [] |
| | | let getCols = (cols) => { |
| | | return cols.filter(col => { |
| | | if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { |
| | | return false |
| | | } else if (col.Hide === 'true') { |
| | | return false |
| | | } else if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | |
| | | if (col.type === 'number') { |
| | | if (col.sum === 'true' && !statFields.includes(col.field)) { |
| | | statFields.push(col) |
| | | } |
| | | if (typeof(col.decimal) === 'number') { |
| | | col.round = Math.pow(10, col.decimal) |
| | | if (col.format === 'percent') { |
| | | col.decimal = col.decimal > 2 ? col.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } else if (col.type === 'formula') { |
| | | if (typeof(col.decimal) === 'number') { |
| | | col.round = Math.pow(10, col.decimal) |
| | | } |
| | | } else if (col.type === 'colspan') { |
| | | col.subcols = getCols(col.subcols || []) |
| | | if (col.subcols.length === 0) { |
| | | return false |
| | | } |
| | | } else if (col.type === 'custom') { |
| | | col.elements = col.elements.filter(cell => { |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true' || cell.OpenType === 'popview') return false |
| | | |
| | | cell = this.resetButton(item, cell, Tab) |
| | | |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | } else { |
| | | cell = this.resetElement(cell) |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | |
| | | if (col.elements.length === 0) { |
| | | return false |
| | | } |
| | | } |
| | | |
| | | if (col.linkmenu && col.linkmenu.length > 0) { |
| | | let menu_id = col.linkmenu.pop() |
| | | col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' |
| | | } else { |
| | | col.linkThdMenu = '' |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | } |
| | | |
| | | item.cols = getCols(item.cols) |
| | | item.statFields = statFields |
| | | |
| | | if (item.subtype === 'editable') { |
| | | item.submit.logLabel = item.$menuname + '-提交' |
| | | item.submit.$menuId = item.uuid |
| | | } |
| | | } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | item.subcards && item.subcards.forEach(card => { |
| | | if (card.style.boxShadow) { |
| | | delete card.style.hShadow |
| | |
| | | |
| | | return true |
| | | }) |
| | | } else if (item.type === 'table') { |
| | | item.cols = item.cols.filter(col => { |
| | | if (col.type !== 'action') return true |
| | | col.elements = col.elements.filter(cell => { |
| | | if (cell.hidden === 'true' || cell.OpenType === 'popview') return false |
| | | |
| | | cell = this.resetButton(item, cell, Tab) |
| | | |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | return col.elements.length !== 0 |
| | | }) |
| | | |
| | | if (item.subtype === 'editable') { |
| | | item.submit.logLabel = item.$menuname + '-提交' |
| | | item.submit.$menuId = item.uuid |
| | | } |
| | | } else if (item.type === 'form') { |
| | | item.subcards = item.subcards.map(group => { |
| | | group.subButton.uuid = group.uuid |
| | |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } else if (cell.type === 'formula' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | } |
| | | } else if (cell.eleType === 'icon') { |
| | | if (!cell.innerHeight) { // 兼容 |
| | |
| | | if (/'/.test(val)) { |
| | | val = val.replace(/'/ig, '"') |
| | | } |
| | | if (form.isconst) { |
| | | _initFormfields.push(`@${_key}=N'${val}'`) |
| | | } else { |
| | | _initFormfields.push(`@${_key}='${val}'`) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | this.sendMessage(btn.verify, id) |
| | | } |
| | | if (btn.verify.wxNote === 'true') { |
| | | if (btn.verify.wxTemplateId === 'mk_category_temp') { |
| | | let verify = fromJS(btn.verify).toJS() |
| | | verify.wxTemplateId = verify.wxCustomTempId |
| | | |
| | | verify.wxNoteKeys = verify.wxNoteKeys.filter(item => item.key) |
| | | |
| | | if (!verify.wxTemplateId || verify.wxNoteKeys.length === 0) return |
| | | |
| | | this.sendWxMessage(verify, id) |
| | | } else { |
| | | this.sendWxMessage(btn.verify, id) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | let domain1 = '' |
| | | let domain2 = '' |
| | | if (['8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok'].includes(verify.wxTemplateId) && options.sysType !== 'cloud') { |
| | | domain1 = 'https://cloud.mk9h.cn/' |
| | | domain2 = 'https://cloud.mk9h.cn:8443/' |
| | | } |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | // res.data = [{openid: 'o2E7gvoSFvQRG7I8_gZxf4y3ONkQ', send_id: '2223333', first: '您的缴费信息如下', keyword1: '010000000001', keyword2: '2022年07月03日', keyword3: '供暖缴费', keyword4: '20元', keyword5: '成功', remark: '感谢您的使用!'}] |
| | | // res.send_data = [{openid: 'o2E7gvoSFvQRG7I8_gZxf4y3ONkQ', send_id: Utils.getuuid(), p1: '010000000001', p2: '明科', p3: 'dddd', p4: '顺风', p5: '成功'}] |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (!res.send_data || res.send_data.length === 0) { |
| | | } |
| | | |
| | | let sends = res.send_data || [] |
| | | sends = sends.filter(item => !!item.openid) |
| | | |
| | | if (sends.length === 0) { |
| | | return |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | verify.wxNoteKeys.forEach(item => { |
| | | _param.data[item.key] = {value: '', color: item.color} |
| | | _param.data[item.key] = {value: ''} |
| | | }) |
| | | |
| | | let params = res.send_data.map(item => { |
| | | let params = sends.map(item => { |
| | | let m = fromJS(_param).toJS() |
| | | |
| | | m.touser = item.openid || '' |
| | | m.touser = item.openid |
| | | if (item.bid && m.miniprogram && m.miniprogram.pagepath.indexOf('MenuId') > -1) { |
| | | m.miniprogram.pagepath = m.miniprogram.pagepath + `&BID=${item.bid}` |
| | | } |
| | |
| | | return m |
| | | }) |
| | | |
| | | Api.wxAccessToken().then(res => { |
| | | Api.wxAccessToken(domain1).then(res => { |
| | | if (!res.oa_access_token) return |
| | | |
| | | params.forEach(n => { |
| | | if (!n.touser) return |
| | | |
| | | Api.wxNginxRequest(`cgi-bin/message/template/send?access_token=${res.oa_access_token}`, 'post', n).then(re => { |
| | | Api.wxNginxRequest(`${domain2}cgi-bin/message/template/send?access_token=${res.oa_access_token}`, 'post', n).then(re => { |
| | | if (verify.wxNoteCallback === 'true') { |
| | | let msg = re.errmsg || '' |
| | | |
| | | if (msg.length > 50) { |
| | | msg = msg.substr(0, 50) |
| | | } |
| | | |
| | | let _p = { |
| | | func: 's_get_sms_weixin_local_suc_err', |
| | | upid: id, |
| | | send_id: n.client_msg_id || '', |
| | | status_result: re.errcode === 0 ? 'S' : 'E', |
| | | errcode: re.errcode, |
| | | msg_result: re.errmsg |
| | | msg_result: msg |
| | | } |
| | | |
| | | _p.LText = Utils.formatOptions(Utils.getuuid()) |
| | |
| | | fieldlen: item.fieldlength || 50, |
| | | writein: item.writein !== 'false', |
| | | type: item.type, |
| | | value: item.initval |
| | | value: item.initval, |
| | | isconst: item.constant === 'true' |
| | | } |
| | | |
| | | let key = item.field.toLowerCase() |
| | |
| | | fieldlen: item.fieldlength || 50, |
| | | writein: item.writein !== 'false', |
| | | type: item.type, |
| | | value: item.initval |
| | | value: item.initval, |
| | | isconst: item.constant === 'true' |
| | | } |
| | | |
| | | let key = item.field.toLowerCase() |
| | |
| | | readin: item.readin, |
| | | writein: item.writein, |
| | | fieldlen: item.fieldlength, |
| | | key: item.field |
| | | key: item.field, |
| | | isconst: item.constant === 'true' |
| | | } |
| | | |
| | | _item.value = record[item.field] !== undefined ? record[item.field] : '' |
| | |
| | | }) |
| | | }) |
| | | } else if (item.type === 'table') { |
| | | item.cols && item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | col.elements && col.elements.forEach(cell => { |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | cell.$expanded = false |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print') { |
| | | |
| | |
| | | |
| | | _comp.action.push({...cell, $line: true, ...(userConfig[cell.uuid] || {})}) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | loopCol(item.cols) |
| | | } |
| | | |
| | | if (_comp.action.length > 0) { |
| | | _components.push(_comp) |
| | |
| | | } |
| | | }) |
| | | tab.components[0].cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | if (col.type !== 'custom') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.eleType !== 'button') return |
| | | if (btn.OpenType === 'popview') { |
| | | if (menus[btn.uuid]) { |
| | | let mainTb = {name: '主表', uuid: Utils.getuuid(), useMSearch: 'false'} |
| | |
| | | } |
| | | }) |
| | | item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | if (col.type !== 'custom') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.eleType !== 'button') return |
| | | if (btn.OpenType === 'popview') { |
| | | if (menus[btn.uuid]) { |
| | | let mainTb = {name: '主表', uuid: Utils.getuuid(), useMSearch: 'false'} |
| | |
| | | } |
| | | }) |
| | | tab.components[0].cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | if (col.type !== 'custom') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.eleType !== 'button') return |
| | | if (btn.OpenType === 'popview' && btn.config && btn.config.components[0]) { |
| | | this.setTbForm(btn.config.components[0], menus, errors, tab.components[0].name + '-' + btn.label) |
| | | } else if (btn.OpenType === 'pop' || (btn.OpenType === 'funcbutton' && btn.funcType === 'print' && btn.execMode === 'pop')) { |
| | |
| | | } |
| | | }) |
| | | item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | if (col.type !== 'custom') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.eleType !== 'button') return |
| | | if (btn.OpenType === 'popview' && btn.config && btn.config.components[0]) { |
| | | this.setTbForm(btn.config.components[0], menus, errors, item.name + '-' + btn.label) |
| | | } else if (btn.OpenType === 'pop' || (btn.OpenType === 'funcbutton' && btn.funcType === 'print' && btn.execMode === 'pop')) { |
| | |
| | | } |
| | | }) |
| | | item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | if (col.type !== 'custom') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.eleType !== 'button') return |
| | | if (btn.OpenType === 'pop' || (btn.OpenType === 'funcbutton' && btn.funcType === 'print' && btn.execMode === 'pop')) { |
| | | if (menus[btn.uuid]) { |
| | | btn.modal = { |
| | |
| | | } |
| | | }) |
| | | tab.components[0].cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | if (col.type !== 'custom') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.eleType !== 'button') return |
| | | if (btn.OpenType === 'popview' && btn.config) { |
| | | btn.config.$tables = getTables(btn.config.components[0]) |
| | | } |
| | |
| | | } |
| | | }) |
| | | item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | if (col.type !== 'custom') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.eleType !== 'button') return |
| | | if (btn.OpenType === 'popview' && btn.config) { |
| | | btn.config.$tables = getTables(btn.config.components[0]) |
| | | } |
| | |
| | | marks: [], |
| | | isSub: false, |
| | | uuid: Utils.getuuid(), |
| | | type: 'action', |
| | | type: 'custom', |
| | | Width: 120, |
| | | elements: colbtns, |
| | | style: {paddingTop: '12px', paddingLeft: '8px', paddingBottom: '12px', paddingRight: '8px'} |
| | |
| | | }) |
| | | |
| | | _card.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | if (col.type !== 'custom') return |
| | | |
| | | col.elements.forEach(cell => { |
| | | if (cell.hidden === 'true') return |
| | | if (cell.hidden === 'true' || cell.eleType !== 'button') return |
| | | if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { |
| | | if (!cell.modal || cell.modal.fields.length === 0) { |
| | | _card.errors.push({ level: 0, detail: `按钮“${cell.label}”中表单尚未添加`}) |
| | |
| | | } |
| | | |
| | | edit = (record) => { |
| | | const { type } = this.props |
| | | |
| | | this.setState({ |
| | | editItem: record |
| | | }) |
| | | |
| | | if (type === 'fullscreen') { |
| | | this.props.form.setFieldsValue({ |
| | | sql: record.sql |
| | | }) |
| | | } else { |
| | | this.props.form.setFieldsValue({ |
| | | sql: record.sql, |
| | | position: record.position || 'back' |
| | | }) |
| | | } |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { type } = this.props |
| | | const { editItem } = this.state |
| | | |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (type === 'fullscreen' && err) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请输入sql!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (!err) { |
| | | if (/^[\s\n]+$/.test(values.sql)) { |
| | | notification.warning({ |
| | |
| | | return |
| | | } |
| | | |
| | | values.uuid = this.state.editItem ? this.state.editItem.uuid : '' |
| | | values.uuid = editItem ? editItem.uuid : '' |
| | | |
| | | if (type === 'fullscreen' && editItem) { |
| | | values.status = editItem.status || 'true' |
| | | } |
| | | |
| | | let _quot = values.sql.match(/'{1}/g) |
| | | let _lparen = values.sql.match(/\({1}/g) |
| | |
| | | } |
| | | |
| | | let _sql = this.props.form.getFieldValue('sql') |
| | | if (/^\s+$/.test(_sql)) { |
| | | _sql = '' |
| | | } |
| | | if (_sql) { |
| | | _sql = _sql + ` |
| | | |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { systemScripts, btn } = this.props |
| | | const { usefulfields } = this.state |
| | | const { systemScripts, btn, type } = this.props |
| | | const { usefulfields, editItem } = this.state |
| | | const { getFieldDecorator } = this.props.form |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | return ( |
| | | <Form {...formItemLayout} className="verify-form" id="verify-excelin-custom-scripts"> |
| | | <Row gutter={24}> |
| | | {btn.sheet ? <Col span={8}> |
| | | {!type && btn.sheet ? <Col span={8}> |
| | | <Form.Item label={'表名'} style={{whiteSpace: 'nowrap', margin: 0}}> |
| | | {btn.sheet} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={10}> |
| | | {!type ? <Col span={10}> |
| | | <Form.Item label={'报错字段'} style={{margin: 0, whiteSpace: 'nowrap'}}> |
| | | ErrorCode(增加后缀NT表示数据不回滚,如ENT、NNT、FNT、NMNT), retmsg |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24} className="sqlfield"> |
| | | </Col> : null} |
| | | {!type ? <Col span={24} className="sqlfield"> |
| | | <Form.Item label={'可用字段'}> |
| | | <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'公共值,请按照@xxx@格式使用。'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, time_id, typename</span></Tooltip>, |
| | | <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'系统变量,系统会定义变量并赋值。'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address</span></Tooltip>, |
| | | {usefulfields} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8} style={{whiteSpace: 'nowrap'}}> |
| | | </Col> : null} |
| | | {!type ? <Col span={8} style={{whiteSpace: 'nowrap'}}> |
| | | <Form.Item style={{marginBottom: 0}} label={ |
| | | <Tooltip placement="bottomLeft" title={'自定义脚本与默认sql位置关系。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={10}> |
| | | </Col> : null} |
| | | {!type ? <Col span={10}> |
| | | <Form.Item style={{marginBottom: 0}} label={'快捷添加'}> |
| | | <Select |
| | | showSearch |
| | |
| | | )} |
| | | </Select> |
| | | </Form.Item> |
| | | </Col> |
| | | </Col> : null} |
| | | <Col span={6} className="add"> |
| | | <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginBottom: 15, marginLeft: 40}}> |
| | | 保存 |
| | | {type === 'fullscreen' && !editItem ? '添加' : '保存'} |
| | | </Button> |
| | | <Button onClick={this.handleCancel} style={{marginBottom: 15, marginLeft: 10}}> |
| | | 取消 |
| | |
| | | const { confirm } = Modal |
| | | const { Paragraph } = Typography |
| | | const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) |
| | | const FullScripts = asyncComponent(() => import('@/templates/zshare/verifycard/fullScripts')) |
| | | |
| | | class VerifyCard extends Component { |
| | | static propTpyes = { |
| | |
| | | changeColumns = (columns) => { |
| | | const { verify } = this.state |
| | | |
| | | let reset = false |
| | | columns = columns.map(col => { |
| | | col.type = col.type || 'Nvarchar(50)' |
| | | if (col.type === 'text' || col.type === 'image') { |
| | |
| | | col.limit = col.type.match(/\d+/) ? col.type.match(/\d+/)[0] : '20000' |
| | | } else if (/^Decimal/ig.test(col.type)) { |
| | | col.limit = col.type.match(/\d+/ig)[1] |
| | | if (col.required === 'false') { |
| | | reset = true |
| | | } |
| | | col.required = 'true' |
| | | } else if (/^int/ig.test(col.type)) { |
| | | if (col.required === 'false') { |
| | | reset = true |
| | | } |
| | | col.required = 'true' |
| | | } else { |
| | | col.limit = '' |
| | |
| | | |
| | | return col |
| | | }) |
| | | |
| | | if (reset) { |
| | | message.warn('数值类型均为必填。') |
| | | } |
| | | |
| | | this.setState({verify: {...verify, columns}}, () => { |
| | | this.resetUniqueColumns() |
| | |
| | | {verify.scripts.length ? <span className="count-tip">{verify.scripts.length}</span> : null} |
| | | </span> |
| | | } key="scripts" id="mk-exin-script"> |
| | | <FullScripts |
| | | verify={verify} |
| | | getScriptsFullForm={() => this.scriptsFullForm} |
| | | getScriptsForm={() => this.scriptsForm} |
| | | handleStatus={this.handleStatus} |
| | | handleDelete={this.handleDelete} |
| | | > |
| | | <CustomScript |
| | | type="fullscreen" |
| | | btn={this.props.card} |
| | | usefulfields={verify.columns} |
| | | scripts={verify.scripts} |
| | | systemScripts={this.state.systemScripts} |
| | | scriptsChange={this.scriptsChange} |
| | | wrappedComponentRef={(inst) => this.scriptsFullForm = inst} |
| | | /> |
| | | </FullScripts> |
| | | <CustomScript |
| | | btn={this.props.card} |
| | | usefulfields={verify.columns} |
| | |
| | | z-index: 1; |
| | | } |
| | | } |
| | | .full-scripts { |
| | | position: absolute; |
| | | right: 24px; |
| | | top: 0px; |
| | | font-size: 16px; |
| | | color: #1890ff; |
| | | z-index: 1; |
| | | } |
| | | } |
| | |
| | | |
| | | this.props.form.setFieldsValue({ |
| | | sql: record.sql, |
| | | position: record.position || 'back' |
| | | // position: record.position || 'back' |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | let _sql = this.props.form.getFieldValue('sql') |
| | | if (/^\s+$/.test(_sql)) { |
| | | _sql = '' |
| | | } |
| | | if (_sql) { |
| | | _sql = _sql + ` |
| | | |
| | |
| | | ) |
| | | } |
| | | }, |
| | | { |
| | | title: '执行位置', |
| | | dataIndex: 'position', |
| | | width: '10%', |
| | | render: (text, record) => { |
| | | if (record.position === 'init') { |
| | | return <span style={{color: 'orange'}}>初始化</span> |
| | | } else if (record.position === 'front') { |
| | | return <span style={{color: '#26C281'}}>sql前</span> |
| | | } else { |
| | | return <span style={{color: '#1890ff'}}>sql后</span> |
| | | } |
| | | } |
| | | }, |
| | | // { |
| | | // title: '执行位置', |
| | | // dataIndex: 'position', |
| | | // width: '10%', |
| | | // render: (text, record) => { |
| | | // if (record.position === 'init') { |
| | | // return <span style={{color: 'orange'}}>初始化</span> |
| | | // } else if (record.position === 'front') { |
| | | // return <span style={{color: '#26C281'}}>sql前</span> |
| | | // } else { |
| | | // return <span style={{color: '#1890ff'}}>sql后</span> |
| | | // } |
| | | // } |
| | | // }, |
| | | { |
| | | title: '状态', |
| | | dataIndex: 'status', |
| | |
| | | bottom: 20px; |
| | | } |
| | | } |
| | | .model-custom-scripts-modal .code-mirror-wrap:not(.mk-fullscreen), .model-custom-view-scripts-modal .code-mirror-wrap:not(.mk-fullscreen) { |
| | | .anticon-swap { |
| | | position: absolute; |
| | | z-index: 11; |
| | | left: auto; |
| | | right: 10px; |
| | | top: auto; |
| | | bottom: 20px; |
| | | } |
| | | } |
| | | .mk-mirror-font { |
| | | z-index: 1200!important; |
| | | } |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'constant', |
| | | label: 'Unicode常量', |
| | | tooltip: '使用时将在提交内容前加上 N,代表存入数据库时以 Unicode 格式存储。', |
| | | initVal: card.constant || 'false', |
| | | options: [{ |
| | | value: 'true', |
| | | text: '使用' |
| | | }, { |
| | | value: 'false', |
| | | text: '不使用' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'sendType', |
| | | label: '发送方式', |
| | | initVal: card.sendType || 'local', |
| | |
| | | const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) |
| | | |
| | | const modalTypeOptions = { |
| | | text: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'regular', 'interception', 'span', 'labelwidth', 'encryption', 'tooltip', 'extra', 'enter', 'cursor', 'scan', 'splitline', 'placeholder', 'place', 'marginTop', 'marginBottom', 'lenControl', 'inputType'], |
| | | text: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'regular', 'interception', 'span', 'labelwidth', 'encryption', 'tooltip', 'extra', 'enter', 'cursor', 'scan', 'splitline', 'placeholder', 'place', 'marginTop', 'marginBottom', 'lenControl', 'inputType', 'constant'], |
| | | number: ['initval', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'enter', 'cursor', 'splitline', 'place', 'marginTop', 'marginBottom'], |
| | | select: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'setAll', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'place', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom', 'pickerMode'], |
| | | checkbox: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'place', 'splitline', 'arrange', 'marginTop', 'marginBottom'], |
| | |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | | const ColorSketch = asyncComponent(() => import('@/mob/colorsketch')) |
| | | const sysTempsIds = ['8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok'] |
| | | |
| | | class BillCodeForm extends Component { |
| | | static propTpyes = { |
| | |
| | | } |
| | | |
| | | componentDidMount() { |
| | | const { verify } = this.props |
| | | let wxTemps = sessionStorage.getItem('wxTemplates') |
| | | |
| | | if (window.GLOB.WXAppID && window.GLOB.nginx && !wxTemps) { |
| | |
| | | Api.wxNginxRequest(`cgi-bin/template/get_all_private_template?access_token=${wxtoken}`, 'get').then(res => { |
| | | let temps = [] |
| | | if (res.template_list) { |
| | | temps = res.template_list.filter(item => item.primary_industry) |
| | | let selectTemp = temps.filter(item => item.template_id === verify.wxTemplateId)[0] |
| | | |
| | | if (selectTemp) { |
| | | selectTemp.content = selectTemp.content.replace(/\r\n|\n/g, '<br/>') |
| | | selectTemp.example = selectTemp.example.replace(/\r\n|\n/g, '<br/>') |
| | | temps = res.template_list.filter(item => { |
| | | if (!item.primary_industry || sysTempsIds.includes(item.template_id)) return false |
| | | if (item.content) { |
| | | item.content = item.content.replace('{{first.DATA}}\n', '').replace('\n{{remark.DATA}}', '') |
| | | } |
| | | |
| | | this.setState({wxTemps: temps, selectTemp}) |
| | | return true |
| | | }) |
| | | } |
| | | |
| | | sessionStorage.setItem('wxTemplates', JSON.stringify(temps)) |
| | | localStorage.setItem('wxTemplates', JSON.stringify(temps)) |
| | | |
| | | localStorage.removeItem('wxTemplates') |
| | | |
| | | this.resetTemps(temps) |
| | | }) |
| | | } else { |
| | | sessionStorage.setItem('wxTemplates', JSON.stringify([])) |
| | |
| | | } else if (wxTemps) { |
| | | wxTemps = JSON.parse(wxTemps) |
| | | |
| | | let selectTemp = wxTemps.filter(item => item.template_id === verify.wxTemplateId)[0] |
| | | this.resetTemps(wxTemps) |
| | | } |
| | | } |
| | | |
| | | resetTemps = (wxTemps) => { |
| | | const { verify } = this.props |
| | | |
| | | let sysTemps = [ |
| | | { |
| | | template_id: '8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', |
| | | title: '订单受理通知(明科云)', |
| | | primary_industry: 'IT科技', |
| | | deputy_industry: 'IT软件与服务', |
| | | content: '订单号:{{keyword1.DATA}}\n订单类型:{{keyword2.DATA}}\n订单状态:{{keyword3.DATA}}\n通知时间:{{keyword4.DATA}}', |
| | | example: '订单号:20190101001\r\n订单类型:衣柜\r\n订单状态:设计完成\r\n通知时间:2019年1月1日12:30' |
| | | }, |
| | | { |
| | | template_id: 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok', |
| | | title: '订单进度提醒(明科云)', |
| | | primary_industry: 'IT科技', |
| | | deputy_industry: 'IT软件与服务', |
| | | content: '订单类型:{{keyword1.DATA}}\n订单号:{{keyword2.DATA}}\n订单状态:{{keyword3.DATA}}', |
| | | example: '订单类型:退租申请\r\n订单号:TZ16101909\r\n订单状态:待取货' |
| | | }, |
| | | { |
| | | template_id: 'mk_category_temp', |
| | | title: '类目模板', |
| | | primary_industry: '', |
| | | deputy_industry: '', |
| | | content: '', |
| | | example: '' |
| | | } |
| | | ] |
| | | |
| | | let _wxTemps = [...wxTemps, ...sysTemps] |
| | | |
| | | let selectTemp = _wxTemps.filter(item => item.template_id === verify.wxTemplateId)[0] |
| | | |
| | | if (selectTemp) { |
| | | selectTemp.content = selectTemp.content.replace(/\r\n|\n/g, '<br/>') |
| | | selectTemp.example = selectTemp.example.replace(/\r\n|\n/g, '<br/>') |
| | | } |
| | | |
| | | this.setState({wxTemps, selectTemp}) |
| | | } |
| | | this.setState({wxTemps: _wxTemps, selectTemp}) |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | |
| | | } else if (verify.wxNote === 'true') { |
| | | if (!verify.wxTemplateId) { |
| | | error = '开启公众号消息推送时,需要选择消息模板!' |
| | | } else if (verify.wxTemplateId === 'mk_category_temp' && !verify.wxCustomTempId) { |
| | | error = '开启公众号消息推送时,需要填写消息模板ID!' |
| | | } else if (verify.wxNoteLink === 'url' && !verify.wxNoteLinkUrl) { |
| | | error = '请填写网址!' |
| | | } |
| | | |
| | | } |
| | | |
| | | return error |
| | |
| | | _verify.wxNoteLinkMenuId = '' |
| | | _verify.wxNoteCallback = 'false' |
| | | _verify.wxNoteKeys = null |
| | | |
| | | delete _verify.wxCustomTempId |
| | | |
| | | if (this.state.selectTemp) { |
| | | this.setState({selectTemp: null}) |
| | |
| | | const { verify } = this.props |
| | | |
| | | let _verify = {...verify, wxTemplateId: val} |
| | | let selectTemp = {content: option.props.content.replace(/\r\n|\n/g, '<br/>'), example: option.props.example.replace(/\r\n|\n/g, '<br/>')} |
| | | let selectTemp = {template_id: val, content: option.props.content.replace(/\r\n|\n/g, '<br/>'), example: option.props.example.replace(/\r\n|\n/g, '<br/>')} |
| | | |
| | | let keys = [] |
| | | if (option.props.content) { |
| | |
| | | keys = keys.map(key => key.replace(/{{|\.DATA}}/g, '')) |
| | | } |
| | | |
| | | delete _verify.wxCustomTempId |
| | | |
| | | if (selectTemp.template_id === 'mk_category_temp') { |
| | | _verify.wxNoteKeys = [] |
| | | for (let i = 1; i <= 10; i++) { |
| | | _verify.wxNoteKeys.push({ |
| | | key: '', |
| | | value: 'p' + i |
| | | }) |
| | | } |
| | | } else { |
| | | let index = 1 |
| | | _verify.wxNoteKeys = keys.map(key => { |
| | | let item = { |
| | | key: key, |
| | | color: '#000000', |
| | | readonly: false |
| | | } |
| | | if (key === 'first') { |
| | | item.value = 'first' |
| | | item.readonly = true |
| | | } else if (key === 'remark') { |
| | | item.value = 'remark' |
| | | item.readonly = true |
| | | } else { |
| | | let item = { key: key } |
| | | |
| | | item.value = 'p' + index |
| | | index++ |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | this.setState({selectTemp}) |
| | | |
| | |
| | | this.props.onChange(_verify) |
| | | } |
| | | |
| | | onWxNoteColorChange = (key, val) => { |
| | | onWxNoteValueChange = (value, val) => { |
| | | let _verify = fromJS(this.props.verify).toJS() |
| | | |
| | | _verify.wxNoteKeys = _verify.wxNoteKeys.map(m => { |
| | | if (m.key === key) { |
| | | m.color = val |
| | | if (m.value === value) { |
| | | m.key = val.replace(/\s+/ig, '') |
| | | } |
| | | |
| | | return m |
| | | }) |
| | | |
| | | this.props.onChange(_verify) |
| | | } |
| | | |
| | | onWxNoteTempIdChange = (value) => { |
| | | let _verify = fromJS(this.props.verify).toJS() |
| | | |
| | | _verify.wxCustomTempId = value.replace(/\s+/ig, '') |
| | | |
| | | this.props.onChange(_verify) |
| | | } |
| | |
| | | <Input placeholder="" autoComplete="off" value={verify.wxNoteLinkMenuId || ''} onChange={(e) => {this.onOptionChange(e.target.value, 'wxNoteLinkMenuId')}}/> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {verify.wxNote === 'true' && verify.wxNoteKeys ? verify.wxNoteKeys.map(item => <Col span={8} key={item.key}> |
| | | <Form.Item className="mk-note-keyword" label={item.key} required> |
| | | <Select value={item.value} disabled={item.readonly} onSelect={(val) => this.onWxNoteKeyChange(item.key, val)}> |
| | | {verify.wxNote === 'true' && verify.wxNoteKeys && (!selectTemp || selectTemp.template_id !== 'mk_category_temp') ? verify.wxNoteKeys.map((item, index) => <Col span={8} key={'mk' + index}> |
| | | <Form.Item label={item.key} required> |
| | | <Select value={item.value} onSelect={(val) => this.onWxNoteKeyChange(item.key, val)}> |
| | | <Select.Option value="p1">p1</Select.Option> |
| | | <Select.Option value="p2">p2</Select.Option> |
| | | <Select.Option value="p3">p3</Select.Option> |
| | |
| | | <Select.Option value="p9">p9</Select.Option> |
| | | <Select.Option value="p10">p10</Select.Option> |
| | | </Select> |
| | | <ColorSketch value={item.color || '#ffffff'} onChange={(val, hex) => {this.onWxNoteColorChange(item.key, hex)}} /> |
| | | </Form.Item> |
| | | </Col>) : null} |
| | | {selectTemp && verify.wxNoteKeys ? <Col span={24} className="wx-note"> |
| | | {verify.wxNote === 'true' && verify.wxNoteKeys && (selectTemp && selectTemp.template_id === 'mk_category_temp') ? <Col span={8}> |
| | | <Form.Item label="模板ID" required> |
| | | <Input placeholder="" defaultValue={verify.wxCustomTempId} autoComplete="off" onChange={(e) => {this.onWxNoteTempIdChange(e.target.value)}}/> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {verify.wxNote === 'true' && verify.wxNoteKeys && (selectTemp && selectTemp.template_id === 'mk_category_temp') ? verify.wxNoteKeys.map((item, index) => <Col span={8} key={'mk' + index}> |
| | | <Form.Item label={item.value}> |
| | | <Input placeholder="" defaultValue={item.key} autoComplete="off" onChange={(e) => {this.onWxNoteValueChange(item.value, e.target.value)}}/> |
| | | </Form.Item> |
| | | </Col>) : null} |
| | | {selectTemp && selectTemp.template_id !== 'mk_category_temp' && verify.wxNoteKeys ? <Col span={24} className="wx-note"> |
| | | <div className="note-wrap"> |
| | | <div className="note"> |
| | | <p>内容示例</p> |
| | |
| | | <div> |
| | | <p>openid: "接收者openid",</p> |
| | | <p>send_id: "防重入id",</p> |
| | | {verify.wxNoteKeys.map(item => <p>{item.value}: "=> {item.key}",</p>)} |
| | | {verify.wxNoteKeys.map((item, i) => <p key={'index' + i}>{item.value}: "=> {item.key}",</p>)} |
| | | <p>bid: "跳转小程序时,可作为BID。"</p> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </Col> : null} |
| | | {selectTemp && selectTemp.template_id === 'mk_category_temp' && verify.wxNoteKeys ? <Col span={24} className="wx-note"> |
| | | <div className="note-wrap"> |
| | | <div className="note"> |
| | | <p>消息体</p> |
| | | <div> |
| | | <p>openid: "接收者openid",</p> |
| | | <p>send_id: "防重入id",</p> |
| | | <p>bid: "跳转小程序时,可作为BID。"</p> |
| | | <p style={{color: '#1890ff'}}>请在通用字段中(p1~p10)填入模板中对应的字段名,如 time1.DATA 则填写 time1。</p> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </Col> : null} |
| | | </Row> |
| | | </Form> |
| | | ) |
| | |
| | | .mk-note-keyword { |
| | | .ant-select { |
| | | width: 50%; |
| | | .ant-select-selection { |
| | | border-radius: 4px 0px 0px 4px; |
| | | } |
| | | } |
| | | .color-sketch-block { |
| | | width: 50%; |
| | | display: inline-block; |
| | | vertical-align: top; |
| | | position: relative; |
| | | top: 4px; |
| | | .color-sketch-block-box { |
| | | width: calc(100% - 75px); |
| | | height: 32px; |
| | | border-radius: 0px 4px 4px 0px; |
| | | .color-sketch-block-inner { |
| | | border-radius: 0px 4px 4px 0px; |
| | | } |
| | | } |
| | | .color-sketch-value { |
| | | width: 75px; |
| | | } |
| | | } |
| | | } |
| | | .wx-note { |
| | | display: flex; |
| | | .note-wrap { |
| | |
| | | import { Form, Row, Col, Select, Button, InputNumber, Input, Tooltip } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | |
| | | import './index.scss' |
| | | // import './index.scss' |
| | | |
| | | class BillCodeForm extends Component { |
| | | static propTpyes = { |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Select, Button, Input } from 'antd' |
| | | import './index.scss' |
| | | // import './index.scss' |
| | | |
| | | class UniqueForm extends Component { |
| | | static propTpyes = { |
| | |
| | | import Utils from '@/utils/utils.js' |
| | | import Api from '@/api' |
| | | import CodeMirror from '@/templates/zshare/codemirror' |
| | | import './index.scss' |
| | | // import './index.scss' |
| | | |
| | | class CustomForm extends Component { |
| | | static propTpyes = { |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Modal, notification, Typography, Popconfirm } from 'antd' |
| | | import { CheckCircleOutlined, StopOutlined, SwapOutlined, DeleteOutlined, BorderOutlined } from '@ant-design/icons' |
| | | |
| | | import MinView from '@/assets/img/minview.png' |
| | | import './index.scss' |
| | | |
| | | const { Paragraph } = Typography |
| | | |
| | | class fullScripts extends Component { |
| | | static propTpyes = { |
| | | verify: PropTypes.object, |
| | | getScriptsForm: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | | visible: false, |
| | | scriptId: '', |
| | | columns: [] |
| | | } |
| | | |
| | | trigger = () => { |
| | | const { getScriptsForm } = this.props |
| | | |
| | | let scriptsForm = getScriptsForm() |
| | | |
| | | if (scriptsForm) { |
| | | let sql = scriptsForm.props.form.getFieldValue('sql') || '' |
| | | if (scriptsForm.state.editItem || (sql && !/^\s+$/.test(sql))) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请保存自定义脚本!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | |
| | | this.setState({visible: true, scriptId: ''}) |
| | | } |
| | | |
| | | render() { |
| | | const { verify, children } = this.props |
| | | const { visible, scriptId } = this.state |
| | | |
| | | return ( |
| | | <> |
| | | <BorderOutlined className="full-scripts" onClick={this.trigger}/> |
| | | <Modal |
| | | wrapClassName="model-custom-scripts-modal" |
| | | title="自定义脚本" |
| | | visible={visible} |
| | | width={'95vw'} |
| | | maskClosable={false} |
| | | destroyOnClose |
| | | > |
| | | <img className="unfull-scripts" src={MinView} onClick={() => this.setState({visible: false, scriptId: ''})} alt=""/> |
| | | <div className="script-table-wrap"> |
| | | {verify.scripts.map(item => { |
| | | let title = item.sql.match(/^\s*\/\*.+\*\//) |
| | | title = title && title[0] ? title[0] : '' |
| | | let _text = title ? item.sql.replace(title, '') : item.sql |
| | | |
| | | let position = null |
| | | if (item.position === 'init') { |
| | | position = <span style={{color: 'orange'}}>初始化</span> |
| | | } else if (item.position === 'front') { |
| | | position = <span style={{color: '#26C281'}}>sql前</span> |
| | | } else { |
| | | position = <span style={{color: '#1890ff'}}>sql后</span> |
| | | } |
| | | |
| | | if (item.status === 'false') { |
| | | return ( |
| | | <div className="script-item" key={item.uuid}> |
| | | <div style={{cursor: 'not-allowed'}}> |
| | | {title ? <div style={{color: '#a50', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis'}}>{title}</div> : null} |
| | | <Paragraph copyable={{ text: item.sql }} ellipsis={{ rows: 4 }}>{_text}</Paragraph> |
| | | <div>{position} |
| | | <span style={{color: '#ff4d4f', marginLeft: '20px'}}> |
| | | 禁用 |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </span> |
| | | </div> |
| | | </div> |
| | | <div style={{height: '24px'}}></div> |
| | | </div> |
| | | ) |
| | | } else { |
| | | return ( |
| | | <div className={'script-item ' + (scriptId === item.uuid ? 'active' : '') } key={item.uuid}> |
| | | <div style={{cursor: 'pointer'}} onClick={() => { |
| | | let scriptsFullForm = this.props.getScriptsFullForm() |
| | | scriptsFullForm && scriptsFullForm.edit(item) |
| | | |
| | | this.setState({scriptId: item.uuid}) |
| | | }}> |
| | | {title ? <div style={{color: '#a50', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis'}}>{title}</div> : null} |
| | | <Paragraph copyable={{ text: item.sql }} ellipsis={{ rows: 4 }}>{_text}</Paragraph> |
| | | <div>{position} |
| | | <span style={{color: '#26C281', marginLeft: '20px'}}> |
| | | 启用 |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </span> |
| | | </div> |
| | | </div> |
| | | <div style={{textAlign: 'right'}}> |
| | | <span className="operation-btn" onClick={() => this.props.handleStatus(item, 'scripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title="确定删除吗?" |
| | | onConfirm={() => this.props.handleDelete(item, 'scripts') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span> |
| | | </Popconfirm> |
| | | </div> |
| | | </div> |
| | | ) |
| | | } |
| | | })} |
| | | </div> |
| | | {visible ? children : null} |
| | | </Modal> |
| | | </> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default fullScripts |
New file |
| | |
| | | .model-custom-scripts-modal { |
| | | .ant-modal { |
| | | top: 30px; |
| | | .ant-modal-header { |
| | | padding: 10px 24px; |
| | | } |
| | | .ant-modal-footer { |
| | | display: none; |
| | | } |
| | | .ant-modal-close { |
| | | display: none; |
| | | } |
| | | .ant-modal-body { |
| | | padding: 0; |
| | | height: calc(100vh - 100px); |
| | | overflow: hidden; |
| | | display: flex; |
| | | |
| | | .script-table-wrap { |
| | | width: 240px; |
| | | overflow-y: auto; |
| | | overflow-x: hidden; |
| | | height: calc(100vh - 100px); |
| | | |
| | | .operation-btn { |
| | | display: inline-block; |
| | | font-size: 16px; |
| | | padding: 0 5px; |
| | | cursor: pointer; |
| | | margin-left: 5px; |
| | | } |
| | | |
| | | .script-item { |
| | | border-bottom: 1px solid #eeeeee; |
| | | padding: 15px 10px 5px; |
| | | } |
| | | .script-item.active { |
| | | background-color: #bae7ff; |
| | | } |
| | | .ant-typography { |
| | | margin-bottom: 5px; |
| | | } |
| | | } |
| | | |
| | | .script-table-wrap::-webkit-scrollbar { |
| | | width: 7px; |
| | | } |
| | | .script-table-wrap::-webkit-scrollbar-thumb { |
| | | border-radius: 5px; |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); |
| | | background: rgba(0, 0, 0, 0.13); |
| | | } |
| | | .script-table-wrap::-webkit-scrollbar-track { |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); |
| | | border-radius: 3px; |
| | | border: 1px solid rgba(0, 0, 0, 0.07); |
| | | background: rgba(0, 0, 0, 0); |
| | | } |
| | | |
| | | .unfull-scripts { |
| | | position: absolute; |
| | | right: 20px; |
| | | z-index: 2; |
| | | top: 10px; |
| | | color: #1890ff; |
| | | width: 26px; |
| | | cursor: pointer; |
| | | padding: 5px; |
| | | |
| | | } |
| | | |
| | | .verify-form { |
| | | flex: 1; |
| | | >.ant-row { |
| | | margin: 0!important; |
| | | position: unset; |
| | | } |
| | | .sql { |
| | | padding: 0!important; |
| | | .ant-form-item-label { |
| | | display: none; |
| | | } |
| | | .ant-form-item-control-wrapper { |
| | | width: 100%; |
| | | } |
| | | .CodeMirror { |
| | | height: calc(100vh - 100px); |
| | | border-radius: 0; |
| | | } |
| | | .code-mirror-area { |
| | | border-radius: 0; |
| | | width: calc(95vw - 240px); |
| | | } |
| | | } |
| | | .sqlfield { |
| | | .ant-form-item { |
| | | margin-bottom: 5px; |
| | | } |
| | | .ant-form-item-control { |
| | | line-height: 24px; |
| | | } |
| | | .ant-form-item-label { |
| | | line-height: 25px; |
| | | } |
| | | .ant-form-item-children { |
| | | line-height: 22px; |
| | | } |
| | | .ant-col-sm-8 { |
| | | width: 10.5%; |
| | | } |
| | | .ant-col-sm-16 { |
| | | width: 89.5%; |
| | | } |
| | | } |
| | | .add { |
| | | position: absolute; |
| | | top: 10px; |
| | | z-index: 1; |
| | | .ant-btn { |
| | | height: 28px; |
| | | } |
| | | .mk-green { |
| | | margin-left: 0!important; |
| | | margin-right: 10px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Tabs, Row, Col, Button, Popconfirm, notification, Modal, message, InputNumber, Typography } from 'antd' |
| | | import { CheckCircleOutlined, StopOutlined, EditOutlined, SwapOutlined, DeleteOutlined, ExclamationOutlined, BorderOutlined } from '@ant-design/icons' |
| | | import { CheckCircleOutlined, StopOutlined, EditOutlined, SwapOutlined, DeleteOutlined, ExclamationOutlined } from '@ant-design/icons' |
| | | import Toast from 'antd-mobile/es/components/toast' |
| | | import Dialog from 'antd-mobile/es/components/dialog' |
| | | import moment from 'moment' |
| | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import { updateForm } from '@/utils/utils-update.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MinView from '@/assets/img/minview.png' |
| | | import './index.scss' |
| | | |
| | | const { TabPane } = Tabs |
| | | const { confirm } = Modal |
| | | const { Paragraph } = Typography |
| | | const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) |
| | | const FullScripts = asyncComponent(() => import('./fullScripts')) |
| | | |
| | | class VerifyCard extends Component { |
| | | static propTpyes = { |
| | |
| | | appType: sessionStorage.getItem('appType'), |
| | | notes: [], // 短信模板 |
| | | setting: null, |
| | | visible: false, |
| | | scriptId: '', |
| | | verify: {}, |
| | | fields: [], |
| | | usefulfields: '', |
| | |
| | | |
| | | render() { |
| | | const { card } = this.props |
| | | const { activeKey, verifyInter, setting, verify, fields, visible, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, cbScriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes, appType } = this.state |
| | | const { activeKey, verifyInter, setting, verify, fields, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, cbScriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes, appType } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | {verify.scripts.length ? <span className="count-tip">{verify.scripts.length}</span> : null} |
| | | </span> |
| | | } key="scripts" id="mk-normal-script"> |
| | | <BorderOutlined className="full-scripts" onClick={() => { |
| | | if (this.scriptsForm && (this.scriptsForm.state.editItem || (this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))))) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请保存自定义脚本!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | this.setState({visible: true, scriptId: ''}) |
| | | }}/> |
| | | <FullScripts |
| | | verify={verify} |
| | | getScriptsFullForm={() => this.scriptsFullForm} |
| | | getScriptsForm={() => this.scriptsForm} |
| | | handleStatus={this.handleStatus} |
| | | handleDelete={this.handleDelete} |
| | | > |
| | | <CustomScript |
| | | type="fullscreen" |
| | | btn={this.props.card} |
| | | initsql={this.state.initsql} |
| | | customScripts={verify.scripts} |
| | | defaultsql={this.state.defaultsql} |
| | | usefulfields={this.state.usefulfields} |
| | | systemScripts={this.state.systemScripts} |
| | | scriptsChange={this.scriptsChange} |
| | | wrappedComponentRef={(inst) => this.scriptsFullForm = inst} |
| | | /> |
| | | </FullScripts> |
| | | <CustomScript |
| | | btn={this.props.card} |
| | | initsql={this.state.initsql} |
| | |
| | | </Form> |
| | | </TabPane> |
| | | </Tabs> |
| | | <Modal |
| | | wrapClassName="model-custom-scripts-modal" |
| | | title="自定义脚本" |
| | | visible={visible} |
| | | width={'95vw'} |
| | | maskClosable={false} |
| | | destroyOnClose |
| | | > |
| | | <img className="unfull-scripts" src={MinView} onClick={() => this.setState({visible: false, scriptId: ''})} alt=""/> |
| | | <div className="script-table-wrap"> |
| | | {verify.scripts.map(item => { |
| | | let title = item.sql.match(/^\s*\/\*.+\*\//) |
| | | title = title && title[0] ? title[0] : '' |
| | | let _text = title ? item.sql.replace(title, '') : item.sql |
| | | |
| | | let position = null |
| | | if (item.position === 'init') { |
| | | position = <span style={{color: 'orange'}}>初始化</span> |
| | | } else if (item.position === 'front') { |
| | | position = <span style={{color: '#26C281'}}>sql前</span> |
| | | } else { |
| | | position = <span style={{color: '#1890ff'}}>sql后</span> |
| | | } |
| | | |
| | | if (item.status === 'false') { |
| | | return ( |
| | | <div className="script-item" key={item.uuid}> |
| | | <div style={{cursor: 'not-allowed'}}> |
| | | {title ? <div style={{color: '#a50', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis'}}>{title}</div> : null} |
| | | <Paragraph copyable={{ text: item.sql }} ellipsis={{ rows: 4 }}>{_text}</Paragraph> |
| | | <div>{position} |
| | | <span style={{color: '#ff4d4f', marginLeft: '20px'}}> |
| | | 禁用 |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </span> |
| | | </div> |
| | | </div> |
| | | <div style={{height: '24px'}}></div> |
| | | </div> |
| | | ) |
| | | } else { |
| | | return ( |
| | | <div className={'script-item ' + (this.state.scriptId === item.uuid ? 'active' : '') } key={item.uuid}> |
| | | <div style={{cursor: 'pointer'}} onClick={() => { |
| | | this.scriptsFullForm.edit(item) |
| | | this.setState({scriptId: item.uuid}) |
| | | }}> |
| | | {title ? <div style={{color: '#a50', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis'}}>{title}</div> : null} |
| | | <Paragraph copyable={{ text: item.sql }} ellipsis={{ rows: 4 }}>{_text}</Paragraph> |
| | | <div>{position} |
| | | <span style={{color: '#26C281', marginLeft: '20px'}}> |
| | | 启用 |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </span> |
| | | </div> |
| | | </div> |
| | | <div style={{textAlign: 'right'}}> |
| | | <span className="operation-btn" onClick={() => this.handleStatus(item, 'scripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title="确定删除吗?" |
| | | onConfirm={() => this.handleDelete(item, 'scripts') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span> |
| | | </Popconfirm> |
| | | </div> |
| | | </div> |
| | | ) |
| | | } |
| | | })} |
| | | </div> |
| | | <CustomScript |
| | | type="fullscreen" |
| | | btn={this.props.card} |
| | | initsql={this.state.initsql} |
| | | customScripts={verify.scripts} |
| | | defaultsql={this.state.defaultsql} |
| | | usefulfields={this.state.usefulfields} |
| | | systemScripts={this.state.systemScripts} |
| | | scriptsChange={this.scriptsChange} |
| | | wrappedComponentRef={(inst) => this.scriptsFullForm = inst} |
| | | /> |
| | | </Modal> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | z-index: 1; |
| | | } |
| | | } |
| | | .model-custom-scripts-modal { |
| | | .ant-modal { |
| | | top: 30px; |
| | | .ant-modal-header { |
| | | padding: 10px 24px; |
| | | } |
| | | .ant-modal-footer { |
| | | display: none; |
| | | } |
| | | .ant-modal-close { |
| | | display: none; |
| | | } |
| | | .ant-modal-body { |
| | | padding: 0; |
| | | height: calc(100vh - 100px); |
| | | overflow: hidden; |
| | | display: flex; |
| | | |
| | | .script-table-wrap { |
| | | width: 240px; |
| | | overflow-y: auto; |
| | | overflow-x: hidden; |
| | | height: calc(100vh - 100px); |
| | | |
| | | .operation-btn { |
| | | display: inline-block; |
| | | font-size: 16px; |
| | | padding: 0 5px; |
| | | cursor: pointer; |
| | | margin-left: 5px; |
| | | } |
| | | |
| | | .script-item { |
| | | border-bottom: 1px solid #eeeeee; |
| | | padding: 15px 10px 5px; |
| | | } |
| | | .script-item.active { |
| | | background-color: #bae7ff; |
| | | } |
| | | .ant-typography { |
| | | margin-bottom: 5px; |
| | | } |
| | | } |
| | | |
| | | .script-table-wrap::-webkit-scrollbar { |
| | | width: 7px; |
| | | } |
| | | .script-table-wrap::-webkit-scrollbar-thumb { |
| | | border-radius: 5px; |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); |
| | | background: rgba(0, 0, 0, 0.13); |
| | | } |
| | | .script-table-wrap::-webkit-scrollbar-track { |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); |
| | | border-radius: 3px; |
| | | border: 1px solid rgba(0, 0, 0, 0.07); |
| | | background: rgba(0, 0, 0, 0); |
| | | } |
| | | |
| | | .unfull-scripts { |
| | | position: absolute; |
| | | right: 20px; |
| | | z-index: 2; |
| | | top: 10px; |
| | | color: #1890ff; |
| | | width: 26px; |
| | | cursor: pointer; |
| | | padding: 5px; |
| | | |
| | | } |
| | | |
| | | .verify-form { |
| | | flex: 1; |
| | | >.ant-row { |
| | | margin: 0!important; |
| | | position: unset; |
| | | } |
| | | .sql { |
| | | padding: 0!important; |
| | | .ant-form-item-label { |
| | | display: none; |
| | | } |
| | | .ant-form-item-control-wrapper { |
| | | width: 100%; |
| | | } |
| | | .CodeMirror { |
| | | height: calc(100vh - 100px); |
| | | border-radius: 0; |
| | | } |
| | | .code-mirror-area { |
| | | border-radius: 0; |
| | | width: calc(95vw - 240px); |
| | | } |
| | | } |
| | | .sqlfield { |
| | | .ant-form-item { |
| | | margin-bottom: 5px; |
| | | } |
| | | .ant-form-item-control { |
| | | line-height: 24px; |
| | | } |
| | | .ant-form-item-label { |
| | | line-height: 25px; |
| | | } |
| | | .ant-form-item-children { |
| | | line-height: 22px; |
| | | } |
| | | .ant-col-sm-8 { |
| | | width: 10.5%; |
| | | } |
| | | .ant-col-sm-16 { |
| | | width: 89.5%; |
| | | } |
| | | } |
| | | .add { |
| | | position: absolute; |
| | | top: 10px; |
| | | z-index: 1; |
| | | .ant-btn { |
| | | height: 28px; |
| | | } |
| | | .mk-green { |
| | | margin-left: 0!important; |
| | | margin-right: 10px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .adm-mask { |
| | | z-index: 2000!important; |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Select, Button } from 'antd' |
| | | import './index.scss' |
| | | // import './index.scss' |
| | | |
| | | class UniqueForm extends Component { |
| | | static propTpyes = { |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Row, Col, Select, Switch, notification } from 'antd' |
| | | import './index.scss' |
| | | // import './index.scss' |
| | | |
| | | class UniqueForm extends Component { |
| | | static propTpyes = { |
| | |
| | | }) |
| | | } |
| | | } else if (item.type === 'table' && item.cols) { |
| | | let loopCol = (col) => { |
| | | col.subcols = col.subcols.map(c => { |
| | | c.uuid = md5(commonId + c.uuid) |
| | | let loopCol = (cols) => { |
| | | return cols.map(col => { |
| | | if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | |
| | | if (c.type === 'colspan' && c.subcols) { |
| | | c = loopCol(c) |
| | | } else if (c.type === 'custom' && c.elements) { |
| | | c.elements = c.elements.map(cell => { |
| | | cell.uuid = this.getuuid() |
| | | col.uuid = md5(commonId + col.uuid) |
| | | |
| | | return cell |
| | | }) |
| | | } else if (c.type === 'action' && c.elements) { |
| | | c.elements = c.elements.map(cell => { |
| | | if (col.type === 'colspan' && col.subcols) { |
| | | col.subcols = loopCol(col.subcols) |
| | | } else if (col.type === 'custom' && col.elements) { |
| | | col.elements = col.elements.map(cell => { |
| | | cell.uuid = md5(commonId + cell.uuid) |
| | | |
| | | if (cell.eleType === 'button') { |
| | | if (clear && cell.pageTemplate === 'linkpage' && cell.linkmenu) { |
| | | cell.pageTemplate = '' |
| | | cell.linkmenu = '' |
| | | } |
| | | |
| | | this.resetBtn(cell, commonId) |
| | | } |
| | | |
| | | return cell |
| | | }) |
| | | } |
| | | return c |
| | | }) |
| | | |
| | | return col |
| | | } |
| | | |
| | | item.cols = item.cols.map(col => { |
| | | col.uuid = md5(commonId + col.uuid) |
| | | |
| | | if (col.type === 'colspan' && col.subcols) { |
| | | col = loopCol(col) |
| | | } else if (col.type === 'custom' && col.elements) { |
| | | col.elements = col.elements.map(cell => { |
| | | cell.uuid = this.getuuid() |
| | | return cell |
| | | }) |
| | | } else if (col.type === 'action' && col.elements) { |
| | | col.elements = col.elements.map(cell => { |
| | | cell.uuid = md5(commonId + cell.uuid) |
| | | this.resetBtn(cell, commonId) |
| | | return cell |
| | | }) |
| | | } |
| | | return col |
| | | }) |
| | | |
| | | if (item.subtype === 'editable') { |
| | | item.cols = item.cols.map(col => { |
| | | if (col.editable === 'true' && col.enter) { |
| | | } else if (col.editable === 'true' && col.enter) { |
| | | col.enter = md5(commonId + col.enter) |
| | | } else if (col.type === 'colspan' && col.subcols) { |
| | | col.subcols = col.subcols.map(c => { |
| | | if (c.editable === 'true' && c.enter) { |
| | | c.enter = md5(commonId + c.enter) |
| | | } |
| | | return c |
| | | }) |
| | | } |
| | | |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | item.cols = loopCol(item.cols) |
| | | } else if (item.type === 'form') { |
| | | item.subcards = item.subcards.map(cell => { |
| | | cell.uuid = this.getuuid() |
| | |
| | | }) |
| | | } |
| | | } else if (item.type === 'table' && item.cols) { |
| | | let loopCol = (col) => { |
| | | col.subcols = col.subcols.map(c => { |
| | | c.uuid = this.getuuid() |
| | | |
| | | if (c.type === 'colspan' && c.subcols) { |
| | | c = loopCol(c) |
| | | } else if (c.type === 'custom' && c.elements) { |
| | | c.elements = c.elements.map(cell => { |
| | | cell.uuid = this.getuuid() |
| | | return cell |
| | | }) |
| | | } |
| | | return c |
| | | }) |
| | | |
| | | return col |
| | | let loopCol = (cols) => { |
| | | return cols.map(col => { |
| | | if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | |
| | | item.cols = item.cols.map(col => { |
| | | col.uuid = md5(commonId + col.uuid) |
| | | |
| | | if (col.type === 'colspan' && col.subcols) { |
| | | col = loopCol(col) |
| | | col.subcols = loopCol(col.subcols) |
| | | } else if (col.type === 'custom' && col.elements) { |
| | | col.elements = col.elements.map(cell => { |
| | | cell.uuid = this.getuuid() |
| | | return cell |
| | | }) |
| | | } else if (col.type === 'action' && col.elements) { |
| | | if (sessionStorage.getItem('editMenuType') === 'popview') { |
| | | col.elements = col.elements.filter(c => c.OpenType !== 'popview' && c.OpenType !== 'funcbutton') |
| | | col.elements = col.elements.filter(c => c.eleType !== 'button' || (c.OpenType !== 'popview' && c.OpenType !== 'funcbutton')) |
| | | } |
| | | col.elements = col.elements.map(cell => { |
| | | cell.uuid = md5(commonId + cell.uuid) |
| | | if (cell.eleType === 'button') { |
| | | if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { |
| | | if (cell.modal && cell.modal.fields.length > 0) { |
| | | cell.modal.fields = cell.modal.fields.map(m => { |
| | |
| | | }) |
| | | } |
| | | } |
| | | |
| | | } |
| | | return cell |
| | | }) |
| | | } |
| | | return col |
| | | }) |
| | | |
| | | if (item.subtype === 'editable') { |
| | | item.cols = item.cols.map(col => { |
| | | if (col.editable === 'true' && col.enter) { |
| | | } else if (col.editable === 'true' && col.enter) { // 可编辑表 |
| | | col.enter = md5(commonId + col.enter) |
| | | } |
| | | |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | item.cols = loopCol(item.cols) |
| | | } else if (item.type === 'form') { |
| | | item.subcards = item.subcards.map(cell => { |
| | | cell.uuid = this.getuuid() |
| | |
| | | }) |
| | | } |
| | | |
| | | config.cols && config.cols.forEach(col => { |
| | | if (col.type === 'action') { |
| | | if (config.cols) { |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | if (['form', 'pop', 'prompt', 'exec', 'excelIn', 'excelOut'].includes(cell.OpenType)) { |
| | | action.push(cell) |
| | | } else if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { |
| | |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | loopCol(config.cols) |
| | | } |
| | | |
| | | config.elements && config.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | |
| | | |
| | | if (card.$c_cl) { |
| | | card.cols.forEach(col => { |
| | | if (col.type === 'action') { |
| | | if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true') return |
| | | if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { |
| | | if (!cell.modal || cell.modal.fields.length === 0) { |
| | |
| | | if (doubleClick === cell.uuid) { |
| | | doubleClick = '' |
| | | } |
| | | }) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | } else { |
| | | if (cell.datatype === 'dynamic' && cell.field && !columns.includes(cell.field)) { |
| | | errors.push({ level: 1, detail: `显示列“${col.label}”中动态字段“${cell.field}”无效`}) |
| | | } |
| | | } |
| | | }) |
| | | } else if (col.field && !columns.includes(col.field)) { |
| | | errors.push({ level: 1, detail: `显示列“${col.label}”中字段“${col.field}”无效`}) |
| | |
| | | let _position = (_topline + lindex + 1) + '行 ' + _colindex + '列 ' |
| | | |
| | | if (/^Nvarchar/ig.test(col.type)) { |
| | | if (typeof(val) === 'number') { |
| | | val = val.toString() |
| | | } |
| | | val = val + '' |
| | | |
| | | if (/'/.test(val)) { |
| | | val = val.replace(/'/ig, '"') |
| | |
| | | } |
| | | }) |
| | | } |
| | | } else if (/^int/ig.test(col.type)) { |
| | | } else if (/^Decimal/ig.test(col.type) || /^int/ig.test(col.type)) { |
| | | if (!val && val !== 0) { |
| | | errors.push(_position + '内容不可为空') |
| | | } else { |
| | | let _val = val + '' |
| | | |
| | | if (!/^(([^0][0-9]+|0)$)|^(([1-9]+)$)/.test(_val)) { // 检验是否为整数 |
| | | errors.push(_position + '内容应为整数') |
| | | } else if (isNaN(val)) { // 检验是否为数值 |
| | | errors.push(_position + '内容应为数值') |
| | | } else if ((col.min || col.min === 0) && val < col.min) { // 最小值检验 |
| | | errors.push(_position + '小于最小值') |
| | | } else if ((col.max || col.max === 0) && val > col.max) { // 最大值检验 |
| | | errors.push(_position + '大于最大值') |
| | | } |
| | | } |
| | | } else if (/^Decimal/ig.test(col.type)) { |
| | | if (!val && val !== 0) { |
| | | errors.push(_position + '内容不可为空') |
| | | } else { |
| | | let _val = val + '' |
| | | let _vals = _val.split('.') |
| | | |
| | | if (!/^(([^0][0-9]+|0)\.([0-9]+)$)|^(([^0][0-9]+|0)$)|^(([1-9]+)\.([0-9]+)$)|^(([1-9]+)$)/.test(_val)) { // 检验是否为浮点数 |
| | | errors.push(_position + '内容应为浮点数') |
| | | } else if (_vals[0].length > 18) { // 检验整数位 |
| | | errors.push(_position + '整数位超出范围') |
| | | } else if (_vals[1] && _vals[1].length > col.limit) { // 最小值检验 |
| | | errors.push(_position + '小数位超出范围') |
| | | } else if ((col.min || col.min === 0) && val < col.min) { // 最小值检验 |
| | | errors.push(_position + '小于最小值') |
| | | } else if ((col.max || col.max === 0) && val > col.max) { // 最大值检验 |
| | | errors.push(_position + '大于最大值') |
| | | } |
| | | } |
| | | } else if (col.type === 'date') { |
| | | if (typeof(val) === 'number') { |
| | |
| | | if (/'/.test(val)) { |
| | | val = val.replace(/'/ig, '"') |
| | | } |
| | | if (form.isconst) { |
| | | _initFormfields.push(`@${_key}=N'${val}'`) |
| | | } else { |
| | | _initFormfields.push(`@${_key}='${val}'`) |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _vars.push(_key) |
| | |
| | | |
| | | if (component.type === 'table') { |
| | | let getColumns = (cols) => { |
| | | return cols.map(item => { |
| | | return cols.filter(item => { |
| | | if (item.type === 'colspan') { |
| | | item.subcols = getColumns(item.subcols) |
| | | if (item.subcols.length === 0) { |
| | | return false |
| | | } |
| | | } else if (item.type === 'custom') { |
| | | item.elements = item.elements.map(cell => { |
| | | item.elements = item.elements.filter(cell => { |
| | | if (cell.eleType === 'button') return false |
| | | |
| | | cell = this.resetElement(cell) |
| | | return cell |
| | | }) |
| | | if (item.elements.length === 0) { |
| | | return false |
| | | } |
| | | } else { |
| | | item.IsSort = 'false' |
| | | } |
| | | |
| | | return item |
| | | return true |
| | | }) |
| | | } |
| | | component.cols = getColumns(component.cols) |
| | |
| | | _btn.config.MenuID = _btn.uuid |
| | | _btn.config.ParentId = card.uuid |
| | | _btn.config.MenuName = _btn.label |
| | | |
| | | _btn.config.components = this.updateComponents(_btn.config.components || []) |
| | | } else { |
| | | _btn.config = { |
| | | uuid: _btn.uuid, |
| | |
| | | }) |
| | | this.updatePage(config) |
| | | } else { |
| | | config.components = this.updateComponents(config.components) |
| | | this.setState({ |
| | | oriConfig: fromJS(config).toJS(), |
| | | config: config |
| | |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | updateComponents = (components) => { // 兼容性升级 table |
| | | return components.map(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | tab.components = this.updateComponents(tab.components) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | item.components = this.updateComponents(item.components) |
| | | } else if (item.type === 'table') { |
| | | item.cols = item.cols.map(col => { |
| | | if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | if (item.subtype === 'tablecard') { // 兼容 |
| | | item.type = 'card' |
| | | } else if (item.type === 'table') { |
| | | item.cols = item.cols.map(col => { |
| | | if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | delete item.tabId |
| | |
| | | }) |
| | | }) |
| | | |
| | | config.cols && config.cols.forEach(col => { |
| | | if (col.type === 'action') { |
| | | if (config.cols) { |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | if (cell.OpenType === 'popview' && popbtns[cell.uuid]) { |
| | | cell.config = popbtns[cell.uuid] |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | loopCol(config.cols) |
| | | } |
| | | |
| | | config.elements && config.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | |
| | | if (item.$tables) { |
| | | tbs.push(...item.$tables) |
| | | } |
| | | |
| | | if (item.wrap && item.wrap.permission === 'false') { |
| | | return |
| | | } |
| | | |
| | | if (item.action && item.action.length > 0) { |
| | | item.action.forEach(btn => { |
| | | if (btn.hidden === 'true') return |
| | |
| | | _sort++ |
| | | }) |
| | | } else if (item.type === 'table') { |
| | | item.cols && item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.hidden === 'true') return |
| | | buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort, '${config.uuid}' as parentid, 40 as Type`) |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button' || cell.hidden === 'true') return |
| | | buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort, '${config.uuid}' as parentid, 40 as Type`) |
| | | _sort++ |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | loopCol(item.cols) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | _btn.config.MenuID = _btn.uuid |
| | | _btn.config.ParentId = card.uuid |
| | | _btn.config.MenuName = _btn.label |
| | | |
| | | _btn.config.components = this.updateComponents(_btn.config.components || []) |
| | | } else { |
| | | _btn.config = { |
| | | uuid: _btn.uuid, |
| | |
| | | }) |
| | | }) |
| | | |
| | | config.cols && config.cols.forEach(col => { |
| | | if (col.type === 'action') { |
| | | if (config.cols) { |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | if (cell.OpenType === 'popview' && popbtns[cell.uuid]) { |
| | | cell.config = popbtns[cell.uuid] |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | loopCol(config.cols) |
| | | } |
| | | |
| | | config.elements && config.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | |
| | | this.setState({ |
| | | needUpdate: true |
| | | }) |
| | | } else { |
| | | config.components = this.updateComponents(config.components) |
| | | } |
| | | |
| | | let navItem = null |
| | |
| | | this.setState({ |
| | | needUpdate: true |
| | | }) |
| | | } else { |
| | | config.components = this.updateComponents(config.components) |
| | | } |
| | | |
| | | config.enabled = false |
| | |
| | | }) |
| | | } |
| | | |
| | | updateComponents = (components) => { // 兼容性升级 table |
| | | return components.map(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | tab.components = this.updateComponents(tab.components) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | item.components = this.updateComponents(item.components) |
| | | } else if (item.type === 'table') { |
| | | item.cols = item.cols.map(col => { |
| | | if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | collectTB = (components) => { |
| | | return components.map(item => { |
| | | if (item.type === 'tabs') { |
| | |
| | | |
| | | if (item.subtype === 'tablecard') { // 兼容 |
| | | item.type = 'card' |
| | | } else if (item.type === 'table') { |
| | | item.cols = item.cols.map(col => { |
| | | if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | delete item.tabId |
| | |
| | | title: btn.label, |
| | | }) |
| | | }) |
| | | item.cols && item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.hidden === 'true') return |
| | | |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button' || cell.hidden === 'true') return |
| | | m.children.push({ |
| | | key: btn.uuid, |
| | | title: btn.label, |
| | | key: cell.uuid, |
| | | title: cell.label, |
| | | }) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | loopCol(item.cols) |
| | | } |
| | | |
| | | list.push(m) |
| | |
| | | }) |
| | | } |
| | | card.elements && card.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.linkmenu && menuObj[cell.linkmenu]) { |
| | | menus.push(menuObj[cell.linkmenu]) |
| | | } else if (cell.openmenu && menuObj[cell.openmenu]) { |
| | |
| | | |
| | | if (item.subtype === 'dualdatacard') { |
| | | card.backElements && card.backElements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.linkmenu && menuObj[cell.linkmenu]) { |
| | | menus.push(menuObj[cell.linkmenu]) |
| | | } else if (cell.openmenu && menuObj[cell.openmenu]) { |
| | |
| | | }) |
| | | } else if (item.type === 'balcony') { |
| | | item.elements && item.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.linkmenu && menuObj[cell.linkmenu]) { |
| | | menus.push(menuObj[cell.linkmenu]) |
| | | } else if (cell.openmenu && menuObj[cell.openmenu]) { |
| | |
| | | menus.push(menuObj[btn.openmenu]) |
| | | } |
| | | }) |
| | | item.cols && item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.linkmenu && menuObj[btn.linkmenu]) { |
| | | menus.push(menuObj[btn.linkmenu]) |
| | | } else if (btn.openmenu && menuObj[btn.openmenu]) { |
| | | menus.push(menuObj[btn.openmenu]) |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.linkmenu && menuObj[cell.linkmenu]) { |
| | | menus.push(menuObj[cell.linkmenu]) |
| | | } else if (cell.openmenu && menuObj[cell.openmenu]) { |
| | | menus.push(menuObj[cell.openmenu]) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | loopCol(item.cols) |
| | | } |
| | | }) |
| | | } |
| | |
| | | return cols.map(col => { |
| | | if (col.type === 'colspan') { |
| | | col.subcols = getCols(col.subcols || []) |
| | | } else if (col.type === 'custom' || col.type === 'action') { |
| | | } else if (col.type === 'custom') { |
| | | col.elements = col.elements.map(cell => { |
| | | cell.miniStyle = this.transferStyle(cell.style) |
| | | return cell |
| | |
| | | _btn.config.MenuID = _btn.uuid |
| | | _btn.config.ParentId = card.uuid |
| | | _btn.config.MenuName = _btn.label |
| | | |
| | | _btn.config.components = this.updateComponents(_btn.config.components || []) |
| | | } else { |
| | | _btn.config = { |
| | | uuid: _btn.uuid, |
| | |
| | | }) |
| | | }) |
| | | |
| | | config.cols && config.cols.forEach(col => { |
| | | if (col.type === 'action') { |
| | | if (config.cols) { |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | if (cell.OpenType === 'popview' && popbtns[cell.uuid]) { |
| | | cell.config = popbtns[cell.uuid] |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | loopCol(config.cols) |
| | | } |
| | | |
| | | config.elements && config.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | |
| | | this.setState({ |
| | | needUpdate: true |
| | | }) |
| | | } else { |
| | | config.components = this.updateComponents(config.components) |
| | | } |
| | | |
| | | let navItem = null |
| | |
| | | this.getAppMenus() |
| | | } |
| | | |
| | | updateComponents = (components) => { // 兼容性升级 table |
| | | return components.map(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | tab.components = this.updateComponents(tab.components) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | item.components = this.updateComponents(item.components) |
| | | } else if (item.type === 'table') { |
| | | item.cols = item.cols.map(col => { |
| | | if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | collectTB = (components) => { |
| | | return components.map(item => { |
| | | if (item.type === 'tabs') { |
| | |
| | | |
| | | if (item.subtype === 'tablecard') { // 兼容 |
| | | item.type = 'card' |
| | | } else if (item.type === 'table') { |
| | | item.cols = item.cols.map(col => { |
| | | if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | return col |
| | | }) |
| | | } |
| | | |
| | | delete item.tabId |
| | |
| | | title: btn.label, |
| | | }) |
| | | }) |
| | | item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.hidden === 'true') return |
| | | |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button' || cell.hidden === 'true') return |
| | | m.children.push({ |
| | | key: btn.uuid, |
| | | title: btn.label, |
| | | key: cell.uuid, |
| | | title: cell.label, |
| | | }) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | loopCol(item.cols) |
| | | } |
| | | |
| | | list.push(m) |
| | |
| | | }) |
| | | } |
| | | card.elements && card.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.linkmenu && menuObj[cell.linkmenu]) { |
| | | menus.push(menuObj[cell.linkmenu]) |
| | | } else if (cell.openmenu && menuObj[cell.openmenu]) { |
| | |
| | | }) |
| | | |
| | | card.backElements && card.backElements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.linkmenu && menuObj[cell.linkmenu]) { |
| | | menus.push(menuObj[cell.linkmenu]) |
| | | } else if (cell.openmenu && menuObj[cell.openmenu]) { |
| | |
| | | }) |
| | | } else if (item.type === 'balcony') { |
| | | item.elements && item.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.linkmenu && menuObj[cell.linkmenu]) { |
| | | menus.push(menuObj[cell.linkmenu]) |
| | | } else if (cell.openmenu && menuObj[cell.openmenu]) { |
| | |
| | | menus.push(menuObj[btn.openmenu]) |
| | | } |
| | | }) |
| | | item.cols && item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.linkmenu && menuObj[btn.linkmenu]) { |
| | | menus.push(menuObj[btn.linkmenu]) |
| | | } else if (btn.openmenu && menuObj[btn.openmenu]) { |
| | | menus.push(menuObj[btn.openmenu]) |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.linkmenu && menuObj[cell.linkmenu]) { |
| | | menus.push(menuObj[cell.linkmenu]) |
| | | } else if (cell.openmenu && menuObj[cell.openmenu]) { |
| | | menus.push(menuObj[cell.openmenu]) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | loopCol(item.cols) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | _btn.config.MenuID = _btn.uuid |
| | | _btn.config.ParentId = card.uuid |
| | | _btn.config.MenuName = _btn.label |
| | | _btn.config.components = _btn.config.components || [] |
| | | _btn.config.components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | tab.components[0].cols = tab.components[0].cols.map(col => { |
| | | if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | return col |
| | | }) |
| | | }) |
| | | } else if (item.cols) { |
| | | item.cols = item.cols.map(col => { |
| | | if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | return col |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | _btn.config = { |
| | | uuid: _btn.uuid, |
| | |
| | | submitPopConfig = (btnconfig) => { |
| | | let config = fromJS(this.state.config).toJS() |
| | | |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | if (cell.OpenType === 'popview' && cell.uuid === btnconfig.uuid) { |
| | | cell.config = btnconfig |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | config.components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | |
| | | btn.config = btnconfig |
| | | } |
| | | }) |
| | | tab.components[0].cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.OpenType === 'popview' && btn.uuid === btnconfig.uuid) { |
| | | btn.config = btnconfig |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | loopCol(tab.components[0].cols) |
| | | |
| | | tab.components[0].$tables = getTables(tab.components[0]) |
| | | }) |
| | |
| | | btn.config = btnconfig |
| | | } |
| | | }) |
| | | item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.OpenType === 'popview' && btn.uuid === btnconfig.uuid) { |
| | | btn.config = btnconfig |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | loopCol(item.cols) |
| | | |
| | | item.$tables = getTables(item) |
| | | } |
| | |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | tab.components[0].name = tab.label |
| | | tab.components[0].cols = tab.components[0].cols.map(col => { |
| | | if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | return col |
| | | }) |
| | | }) |
| | | } else { |
| | | item.cols = item.cols.map(col => { |
| | | if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | return col |
| | | }) |
| | | item.name = '主表' |
| | | } |
| | | }) |
| | |
| | | buttons.push(`select '${btn.uuid}' as menuid, '${btn.label}' as menuname, '${_s * 10}' as Sort, '${tab.components[0].uuid}' as parentid, 60 as Type`) |
| | | _s++ |
| | | }) |
| | | tab.components[0].cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.hidden === 'true') return |
| | | |
| | | buttons.push(`select '${btn.uuid}' as menuid, '${btn.label}' as menuname, '${_s * 10}' as Sort, '${tab.components[0].uuid}' as parentid, 60 as Type`) |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button' || cell.hidden === 'true') return |
| | | buttons.push(`select '${cell.uuid}' as menuid, '${cell.label}' as menuname, '${_s * 10}' as Sort, '${tab.components[0].uuid}' as parentid, 60 as Type`) |
| | | _s++ |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | loopCol(tab.components[0].cols) |
| | | }) |
| | | } else { |
| | | if (item.$tables) { |
| | |
| | | buttons.push(`select '${btn.uuid}' as menuid, '${btn.label}' as menuname, '${_sort * 10}' as Sort, '${config.uuid}' as parentid, 40 as Type`) |
| | | _sort++ |
| | | }) |
| | | item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.hidden === 'true') return |
| | | |
| | | buttons.push(`select '${btn.uuid}' as menuid, '${btn.label}' as menuname, '${_sort * 10}' as Sort, '${config.uuid}' as parentid, 40 as Type`) |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button' || cell.hidden === 'true') return |
| | | buttons.push(`select '${cell.uuid}' as menuid, '${cell.label}' as menuname, '${_sort * 10}' as Sort, '${config.uuid}' as parentid, 40 as Type`) |
| | | _sort++ |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | loopCol(item.cols) |
| | | } |
| | | }) |
| | | |
| | | return buttons |
| | |
| | | label: '序号', |
| | | subType: 'index', |
| | | $init: true |
| | | }, |
| | | { |
| | | type: 'col', |
| | | label: '操作', |
| | | subType: 'action', |
| | | $init: true |
| | | } |
| | | ], |
| | | tabItems: [ |