| | |
| | | if (card.OpenType === 'form') { |
| | | if (card.formType === 'switch') { |
| | | btnElement = (<Switch style={_style} className={card.size === 'large' ? 'ant-switch-large' : ''} size={card.size} checkedChildren={card.openText || ''} unCheckedChildren={card.closeText || ''}/>) |
| | | } else { |
| | | } else if (card.formType === 'radio') { |
| | | btnElement = (<Checkbox style={_style}></Checkbox>) |
| | | } else { |
| | | btnElement = (<Button style={_style} type="link"><MkIcon type="scan"/></Button>) |
| | | } |
| | | } else if (card.show === 'icon') { |
| | | btnElement = (<Button style={_style} type="link"><MkIcon type={card.icon}/>{warning}</Button>) |
| | |
| | | let options = ['font', 'border', 'padding', 'margin', 'background'] |
| | | |
| | | if (element.eleType === 'button') { |
| | | if (element.OpenType === 'form') { |
| | | if (element.OpenType === 'form' && element.formType !== 'scan') { |
| | | options = ['margin', 'float'] |
| | | } else { |
| | | options.push('width', 'minHeight', 'float') |
| | |
| | | if (hasMenus) { |
| | | ops = [{value: 'menus', label: '菜单组'}] |
| | | } |
| | | let adapters = sessionStorage.getItem('adapter') || '' |
| | | if (adapters.indexOf('wxmini') > -1) { |
| | | ops.push({value: 'miniprogram', label: '小程序'}) |
| | | } else if (setting.click === 'miniprogram') { |
| | | setting.click = '' |
| | | } |
| | | |
| | | const cardSettingForm = [ |
| | | { |
| | |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | | { |
| | | type: !hasMenus ? 'radio' : 'select', |
| | | type: ops.length === 0 ? 'radio' : 'select', |
| | | field: 'click', |
| | | label: '点击事件', |
| | | initval: setting.click || '', |
| | | tooltip: '当绑定点击事件时,卡片的切换功能将失效。', |
| | | // tooltip: '当绑定点击事件时,卡片的切换功能将失效。', |
| | | required: false, |
| | | options: [ |
| | | {value: '', label: '无'}, |
| | |
| | | {field: 'menu', values: ['menu']}, |
| | | {field: 'linkurl', values: ['link']}, |
| | | {field: 'open', values: ['menu', 'link', 'menus']}, |
| | | {field: 'joint', values: ['menu', 'link', 'menus']}, |
| | | {field: 'joint', values: ['menu', 'link', 'menus', 'miniprogram']}, |
| | | {field: 'linkbtn', values: ['button']}, |
| | | {field: 'clickType', values: ['button']}, |
| | | {field: 'menuType', values: ['menus']}, |
| | | {field: 'menus', values: ['menus']}, |
| | | {field: 'miniAppId', values: ['miniprogram']}, |
| | | {field: 'miniPath', values: ['miniprogram']}, |
| | | ] |
| | | }, |
| | | { |
| | |
| | | span: 24 |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'miniAppId', |
| | | label: '小程序AppID', |
| | | initval: setting.miniAppId || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'miniPath', |
| | | label: '页面路径', |
| | | initval: setting.miniPath || '', |
| | | tooltip: '可指定跳转小程序页面,为空时打开首页,注:参数拼接在指定页面时有效。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'open', |
| | | label: '打开方式', |
| | |
| | | field: 'click', |
| | | label: '点击事件', |
| | | initval: setting.click || '', |
| | | tooltip: '当选择触发按钮时,只有当卡片中只存在一个按钮时有效。', |
| | | // tooltip: '当选择触发按钮时,只有当卡片中只存在一个按钮时有效。', |
| | | required: false, |
| | | options: [ |
| | | {value: '', label: '无'}, |
| | |
| | | } |
| | | } |
| | | |
| | | let ops = [] |
| | | let adapters = sessionStorage.getItem('adapter') || '' |
| | | if (adapters.indexOf('wxmini') > -1) { |
| | | ops.push({value: 'miniprogram', label: '小程序'}) |
| | | } else if (setting.click === 'miniprogram') { |
| | | setting.click = '' |
| | | } |
| | | |
| | | const cardSettingForm = [ |
| | | { |
| | | type: 'text', |
| | |
| | | {value: '', label: '无'}, |
| | | {value: 'menu', label: '菜单'}, |
| | | {value: 'link', label: '链接'}, |
| | | ...ops |
| | | ], |
| | | controlFields: [ |
| | | {field: 'menu', values: ['menu']}, |
| | | {field: 'linkurl', values: ['link']}, |
| | | {field: 'open', values: ['menu', 'link']}, |
| | | {field: 'joint', values: ['menu', 'link']}, |
| | | {field: 'joint', values: ['menu', 'link', 'miniprogram']}, |
| | | {field: 'miniAppId', values: ['miniprogram']}, |
| | | {field: 'miniPath', values: ['miniprogram']}, |
| | | ] |
| | | }, |
| | | { |
| | |
| | | forbid: appType !== 'pc' && appType !== 'mob' |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'miniAppId', |
| | | label: '小程序AppID', |
| | | initval: setting.miniAppId || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'miniPath', |
| | | label: '页面路径', |
| | | initval: setting.miniPath || '', |
| | | tooltip: '可指定跳转小程序页面,为空时打开首页,注:参数拼接在指定页面时有效。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'joint', |
| | | label: '参数拼接', |
| | |
| | | |
| | | if (this.record.formType === 'switch') { |
| | | shows.push('field', 'size', 'openVal', 'closeVal', 'openText', 'closeText') |
| | | } else { |
| | | } else if (this.record.formType === 'radio') { |
| | | shows.push('field', 'openVal', 'closeVal') |
| | | } else { |
| | | shows.push('field') |
| | | } |
| | | |
| | | reOptions.intertype = this.state.interTypeOptions.filter(item => item.value !== 'custom') |
| | |
| | | values.modal = card.modal || null |
| | | |
| | | if (values.OpenType === 'form') { |
| | | if (values.formType !== 'scan') { |
| | | if (/^(0|[1-9]\d*)$/.test(values.openVal) && /^(0|[1-9]\d*)$/.test(values.closeVal)) { |
| | | values.openVal = +values.openVal |
| | | values.closeVal = +values.closeVal |
| | | } |
| | | } else { |
| | | values.show = 'icon' |
| | | values.icon = 'scan' |
| | | } |
| | | } else if (values.OpenType === 'excelOut') { |
| | | values.Ot = 'notRequired' |
| | | } else if (['pop', 'prompt', 'exec'].includes(values.OpenType) && values.verify) { |
| | |
| | | if (type === 'card') { |
| | | opentypes.push({ |
| | | value: 'form', |
| | | text: '表单(开关或勾选框)' |
| | | text: '表单' |
| | | }) |
| | | } else if (card.OpenType === 'form') { // 拖拽添加类型转换 |
| | | card.OpenType = 'pop' |
| | |
| | | value: 'closetab', |
| | | text: '关闭标签' |
| | | }] |
| | | } |
| | | |
| | | let formTypes = [] |
| | | if (appType === 'mob') { |
| | | formTypes = [{ |
| | | value: 'scan', |
| | | text: '扫描' |
| | | }] |
| | | } else if (card.formType === 'scan') { |
| | | card.formType = 'switch' |
| | | } |
| | | |
| | | let forms = [ |
| | |
| | | }, { |
| | | value: 'radio', |
| | | text: '勾选框' |
| | | }] |
| | | }, |
| | | ...formTypes] |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'hidden', |
| | | label: '隐藏', |
| | | initVal: card.hidden || 'false', |
| | | tooltip: '隐藏后按钮在页面中不显示,且不参与权限分配。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '否' |
| | | }, { |
| | | value: 'true', |
| | | text: '是' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'splitLine', |
| | | key: 'title', |
| | | label: '表单', |
| | |
| | | label: '关闭提示', |
| | | initVal: card.closeText || '', |
| | | required: false, |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'hidden', |
| | | label: '隐藏', |
| | | initVal: card.hidden || 'false', |
| | | tooltip: '隐藏后按钮在页面中不显示,且不参与权限分配。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '否' |
| | | }, { |
| | | value: 'true', |
| | | text: '是' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | { value: 'tab', text: '标签页', type: 'action', class: 'button', $init: true }, |
| | | { value: 'innerpage', text: '新页面', type: 'action', class: 'button', $init: true }, |
| | | { value: 'funcbutton', text: '功能按钮', type: 'action', class: 'button', $init: true }, |
| | | { value: 'form', text: '表单(开关)', type: 'action', class: 'button', $init: true } |
| | | { value: 'form', text: '表单', type: 'action', class: 'button', $init: true } |
| | | ] |
| | | }, |
| | | { |
| | |
| | | options = fromJS(components).toJS() |
| | | } else { |
| | | options = fromJS(menuOptions).toJS() |
| | | let adapters = sessionStorage.getItem('adapter') || '' |
| | | if (adapters.indexOf('wxmini') === -1) { |
| | | options = options.filter(item => item.adapter !== 'mini') |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | { type: 'menu', url: SandBox, component: 'code', subtype: 'sandbox', title: '自定义', width: 24 }, |
| | | { type: 'menu', url: group, component: 'group', subtype: 'normalgroup', title: '分组', width: 24 }, |
| | | { type: 'menu', url: Login, component: 'login', subtype: 'normallogin', title: '注册/登录', width: 24 }, |
| | | { type: 'menu', url: officialAccount, component: 'officialAccount', subtype: 'officialAccount', title: '关注公众号(小程序中)', width: 24 }, |
| | | { type: 'menu', url: officialAccount, component: 'officialAccount', subtype: 'officialAccount', title: '关注公众号(小程序中)', width: 24, adapter: 'mini' }, |
| | | ] |
| | |
| | | if (btn.OpenType === 'form') { |
| | | if (btn.formType === 'switch') { |
| | | return <Switch loading={loading} checked={check} disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} onChange={(val,e) => {e.stopPropagation();this.actionTrigger()}} style={btn.style} className={btn.size === 'large' ? 'ant-switch-large' : ''} size={btn.size} checkedChildren={btn.openText || ''} unCheckedChildren={btn.closeText || ''}/> |
| | | } else { |
| | | } else if (btn.formType === 'radio') { |
| | | return <Checkbox disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} checked={check} onChange={(e) => {e.stopPropagation();this.actionTrigger()}} style={btn.style}></Checkbox> |
| | | } else { |
| | | return <Button type="link" icon="scan" disabled={true} style={btn.style} onClick={(e) => {e.stopPropagation()}}></Button> |
| | | } |
| | | } |
| | | |