| | |
| | | * @param {*} usefulFields 存储过程可用的开始字段 |
| | | * @param {*} type 按钮类型,用于区分可选的打开方式 |
| | | */ |
| | | export function getActionForm (card, functip, setting, usefulFields, type, menulist = [], modules = [], columns = []) { |
| | | export function getActionForm (card, functip, config, usefulFields, type, menulist = [], modules = []) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let setting = config.setting || {} |
| | | let columns = config.columns || [] |
| | | let appMenus = [] |
| | | let opentypes = [ |
| | | { |
| | |
| | | { value: 'pay', text: Formdict['model.pay'] }, |
| | | { value: 'custom', text: Formdict['header.form.custom'] } |
| | | ] |
| | | const isApp = ['pc', 'mob'].includes(sessionStorage.getItem('appType')) |
| | | const isApp = ['pc', 'mob'].includes(appType) |
| | | |
| | | let funTypes = [ |
| | | { value: 'changeuser', text: Formdict['header.form.func.changeuser'] }, |
| | | { value: 'print', text: '标签打印' } |
| | | { value: 'print', text: '标签打印' }, |
| | | { value: 'closetab', text: '标签关闭' }, |
| | | ] |
| | | |
| | | if (isApp) { |
| | | opentypes = opentypes.filter(item => item.value !== 'tab') |
| | | pageTemps = [ |
| | | // { value: 'page', text: '菜单' }, |
| | | { value: 'linkpage', text: '关联菜单' }, |
| | |
| | | if (appMenus) { |
| | | try { |
| | | appMenus = JSON.parse(appMenus) |
| | | appMenus = appMenus.map(item => ({value: item.MenuID, text: item.MenuName})) |
| | | } catch { |
| | | } catch (e) { |
| | | appMenus = [] |
| | | } |
| | | } else { |
| | | appMenus = [] |
| | | } |
| | | |
| | | if (appType === 'mob') { |
| | | opentypes = opentypes.filter(item => ['pop', 'prompt', 'exec', 'innerpage', 'funcbutton'].includes(item.value)) |
| | | funTypes = [ |
| | | { value: 'mkBinding', text: '开通扫码登录' }, |
| | | { value: 'mkUnBinding', text: '用户解绑' }, |
| | | { value: 'scan', text: '扫一扫' }, |
| | | { value: 'reAuth', text: '重新授权' }, |
| | | ] |
| | | } else { |
| | | opentypes = opentypes.filter(item => item.value !== 'tab') |
| | | } |
| | | } |
| | | |
| | | if (type === 'chart') { |
| | | if (type === 'chart' && appType !== 'mob') { |
| | | opentypes = opentypes.filter(item => item.value === 'excelIn' || item.value === 'excelOut') |
| | | } |
| | | |
| | |
| | | options: opentypes |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | type: 'select', |
| | | key: 'funcType', |
| | | label: Formdict['header.form.funcType'], |
| | | initVal: card.funcType || (isApp ? 'changeuser' : ''), |
| | | initVal: card.funcType || '', |
| | | required: true, |
| | | options: funTypes |
| | | }, |
| | |
| | | options: pageTemps |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'open', |
| | | label: '链接方式', |
| | | initVal: card.open || 'blank', |
| | | required: true, |
| | | forbid: sessionStorage.getItem('appType') === 'pc', |
| | | options: [{ |
| | | value: 'blank', |
| | | text: '新窗口' |
| | | }, { |
| | | value: 'self', |
| | | text: '当前窗口' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkmenu', |
| | | label: '关联菜单', |
| | | initVal: card.linkmenu || '', |
| | | required: true, |
| | | forbid: !isApp, |
| | | options: appMenus |
| | | }, |
| | | // { |
| | | // type: 'select', |
| | | // key: 'copyMenuId', |
| | | // label: '复制菜单', |
| | | // initVal: card.copyMenuId || '', |
| | | // required: false, |
| | | // options: appMenus |
| | | // }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'url', |
| | |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | key: 'refreshTab', |
| | | label: '刷新标签', |
| | | initVal: card.refreshTab || [], |
| | | required: false, |
| | | forbid: isApp, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'execSuccess', |
| | | label: Formdict['model.form.afterSuccess'], |
| | |
| | | { |
| | | type: 'radio', |
| | | key: 'show', |
| | | label: "显示为", |
| | | label: '显示为', |
| | | initVal: card.show || 'button', |
| | | required: true, |
| | | options: [{ |
| | |
| | | text: '图标' |
| | | }, { |
| | | value: 'button', |
| | | text: '按钮' |
| | | text: '图标+文字' |
| | | }, { |
| | | value: 'link', |
| | | text: '链接' |
| | | text: '文字+图标' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: 'radio', |
| | | key: 'swipe', |
| | | label: "滑动显示", |
| | | initVal: card.swipe || 'false', |
| | | required: false, |
| | | forbid: (type !== 'datacard' || appType !== 'mob'), |
| | | options: [{ |
| | | value: 'false', |
| | | text: '否' |
| | | }, { |
| | | value: 'left', |
| | | text: '左滑' |
| | | }, { |
| | | value: 'right', |
| | | text: '右滑' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'icon', |
| | | key: 'icon', |
| | | label: Formdict['model.icon'], |
| | | initVal: card.icon, |
| | |
| | | key: 'class', |
| | | label: Formdict['model.form.color'], |
| | | initVal: card.class, |
| | | tooltip: '此颜色为按钮初始化颜色,可在样式调整中修改。', |
| | | required: false, |
| | | options: [] |
| | | }, |
| | |
| | | tooltip: '禁用控制字段,可根据数据控制按钮是否禁用。', |
| | | initVal: card.controlField || '', |
| | | required: false, |
| | | // forbid: card.$type !== 'tableButton', |
| | | options: [{label: '无', field: ''}, ...columns] |
| | | allowClear: true, |
| | | options: columns |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | label: '控制值', |
| | | tooltip: '当选择控制字段,且字段值与控制值相等时,按钮会禁用,多个值用逗号分隔。', |
| | | initVal: card.controlVal || '', |
| | | // forbid: card.$type !== 'tableButton', |
| | | required: false |
| | | } |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'openmenu', |
| | | label: '打开菜单', |
| | | tooltip: '执行成功后需要打开的菜单。', |
| | | initVal: card.openmenu || '', |
| | | forbid: appType !== 'pc' && appType !== 'mob', |
| | | required: false, |
| | | allowClear: true, |
| | | options: appMenus |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'output', |
| | | label: '返回值', |
| | | tooltip: '执行成功后的返回值。', |
| | | initVal: card.output || '', |
| | | forbid: appType !== 'pc' && appType !== 'mob', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'open', |
| | | label: '打开方式', |
| | | initVal: card.open || 'blank', |
| | | required: true, |
| | | forbid: appType !== 'pc', |
| | | options: [{ |
| | | value: 'blank', |
| | | text: '新窗口' |
| | | }, { |
| | | value: 'self', |
| | | text: '当前窗口' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'display', |
| | | label: '显示方式', |
| | | initVal: card.display || 'modal', |
| | | required: true, |
| | | options: [{ |
| | | value: 'modal', |
| | | text: '模态框' |
| | | }, { |
| | | value: 'drawer', |
| | | text: '抽屉' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'ratio', |
| | | min: 1, |
| | | max: 24, |
| | | precision: 0, |
| | | label: '比例', |
| | | initVal: card.ratio || 85, |
| | | tooltip: '小于100为宽度(或高度)百分比,大于100为像素值。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'placement', |
| | | label: '抽屉方向', |
| | | initVal: card.placement || 'right', |
| | | tooltip: '使用抽屉时有效。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'right', |
| | | text: '右侧' |
| | | }, { |
| | | value: 'left', |
| | | text: '左侧' |
| | | }, { |
| | | value: 'top', |
| | | text: '上侧' |
| | | }, { |
| | | value: 'bottom', |
| | | text: '下侧' |
| | | }] |
| | | }, |
| | | ] |
| | | |
| | | return forms |