| | |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | |
| | | const Formdict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | | /** |
| | | * @description 获取按钮表单配置信息 |
| | |
| | | * @param {*} usefulFields 存储过程可用的开始字段 |
| | | * @param {*} type 按钮类型,用于区分可选的打开方式 |
| | | */ |
| | | export function getActionForm (card, functip, setting, usefulFields, type, menulist = [], modules = []) { |
| | | export function getActionForm (card, functip, setting, usefulFields, type, menulist = [], modules = [], columns = []) { |
| | | let appMenus = [] |
| | | let opentypes = [ |
| | | { |
| | | value: 'pop', |
| | |
| | | } |
| | | ] |
| | | |
| | | if (type === 'chart') { |
| | | opentypes = [ |
| | | { |
| | | value: 'excelIn', |
| | | text: Formdict['model.form.excelIn'] |
| | | }, { |
| | | value: 'excelOut', |
| | | text: Formdict['model.form.excelOut'] |
| | | } |
| | | let pageTemps = [ |
| | | { value: 'billprint', text: '单据打印' }, |
| | | { value: 'pay', text: Formdict['model.pay'] }, |
| | | { value: 'custom', text: Formdict['header.form.custom'] } |
| | | ] |
| | | const isApp = ['pc', 'mob'].includes(sessionStorage.getItem('appType')) |
| | | |
| | | let funTypes = [ |
| | | { value: 'changeuser', text: Formdict['header.form.func.changeuser'] }, |
| | | { value: 'print', text: '标签打印' } |
| | | ] |
| | | |
| | | if (isApp) { |
| | | opentypes = opentypes.filter(item => item.value !== 'tab') |
| | | pageTemps = [ |
| | | // { value: 'page', text: '菜单' }, |
| | | { value: 'linkpage', text: '关联菜单' }, |
| | | { value: 'billprint', text: '单据打印' }, |
| | | { value: 'pay', text: Formdict['model.pay'] }, |
| | | { value: 'custom', text: '链接' } |
| | | ] |
| | | funTypes = [ |
| | | { value: 'changeuser', text: Formdict['header.form.func.changeuser'] }, |
| | | ] |
| | | appMenus = sessionStorage.getItem('appMenus') |
| | | if (appMenus) { |
| | | try { |
| | | appMenus = JSON.parse(appMenus) |
| | | appMenus = appMenus.map(item => ({value: item.MenuID, text: item.MenuName})) |
| | | } catch { |
| | | appMenus = [] |
| | | } |
| | | } else { |
| | | appMenus = [] |
| | | } |
| | | } |
| | | |
| | | if (type === 'chart') { |
| | | opentypes = opentypes.filter(item => item.value === 'excelIn' || item.value === 'excelOut') |
| | | } |
| | | |
| | | let refresh = [] |
| | | if (sessionStorage.getItem('editMenuType') === 'popview') { // 弹窗标签 |
| | | opentypes = opentypes.filter(item => item.value !== 'popview' && item.value !== 'funcbutton') |
| | | refresh.push({ |
| | | value: 'popclose', |
| | | text: '标签刷新' |
| | | }) |
| | | } |
| | | |
| | | let forms = [ |
| | |
| | | options: opentypes |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: 'radio', |
| | | key: 'funcType', |
| | | label: Formdict['header.form.funcType'], |
| | | initVal: card.funcType || 'print', |
| | | initVal: card.funcType || (isApp ? 'changeuser' : ''), |
| | | required: true, |
| | | options: [{ |
| | | value: 'changeuser', |
| | | text: Formdict['header.form.func.changeuser'] |
| | | }, { |
| | | value: 'print', |
| | | text: '标签打印' |
| | | }] |
| | | options: funTypes |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | label: Formdict['header.form.intertype'], |
| | | initVal: card.intertype || 'system', |
| | | required: true, |
| | | options: [{ |
| | | value: 'system', |
| | | text: '系统' |
| | | }, { |
| | | value: 'inner', |
| | | text: Formdict['model.interface.inner'] |
| | | }, { |
| | | value: 'outer', |
| | | text: Formdict['model.interface.outer'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'sqlType', |
| | | label: Formdict['header.form.action.type'], |
| | | initVal: card.sqlType || '', |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | |
| | | initVal: card.label, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'procMode', |
| | | label: '参数处理', |
| | | initVal: card.procMode || 'system', |
| | | required: true, |
| | | options: [{ |
| | | value: 'system', |
| | | text: '系统函数' |
| | | }, { |
| | | value: 'inner', |
| | | text: '内部函数' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'sqlType', |
| | | label: Formdict['header.form.action.type'], |
| | | initVal: card.sqlType || '', |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | label: Formdict['model.form.newpage.type'], |
| | | initVal: card.pageTemplate || '', |
| | | required: true, |
| | | options: pageTemps |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'open', |
| | | label: '链接方式', |
| | | initVal: card.open || 'blank', |
| | | required: true, |
| | | forbid: sessionStorage.getItem('appType') === 'pc', |
| | | options: [{ |
| | | value: 'billprint', |
| | | text: '单据打印' |
| | | value: 'blank', |
| | | text: '新窗口' |
| | | }, { |
| | | value: 'pay', |
| | | text: Formdict['model.pay'] |
| | | }, { |
| | | value: 'custom', |
| | | text: Formdict['header.form.custom'] |
| | | value: 'self', |
| | | text: '当前窗口' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | type: 'select', |
| | | key: 'linkmenu', |
| | | label: '关联菜单', |
| | | initVal: card.linkmenu || '', |
| | | required: true, |
| | | options: appMenus |
| | | }, |
| | | // { |
| | | // type: 'select', |
| | | // key: 'copyMenuId', |
| | | // label: '复制菜单', |
| | | // initVal: card.copyMenuId || '', |
| | | // required: false, |
| | | // options: appMenus |
| | | // }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'url', |
| | | label: Formdict['model.form.newpage.url'], |
| | | label: Formdict['model.pageUrl'], |
| | | initVal: card.url || '', |
| | | required: true |
| | | }, |
| | |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | type: 'textarea', |
| | | key: 'interface', |
| | | label: Formdict['header.form.interface'], |
| | | label: '测试地址', |
| | | initVal: card.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (card.interface || ''), |
| | | required: true, |
| | | readonly: card.sysInterface === 'true' |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'proInterface', |
| | | label: '正式地址', |
| | | initVal: card.proInterface || '', |
| | | tooltip: '正式系统所使用的接口地址。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'method', |
| | | label: '请求方式', |
| | | initVal: card.method || 'post', |
| | | required: true, |
| | | options: [{ |
| | | value: 'get', |
| | | text: 'GET' |
| | | }, { |
| | | value: 'post', |
| | | text: 'POST' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'cross', |
| | | label: '跨域请求', |
| | | initVal: card.cross || 'true', |
| | | tooltip: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '支持' |
| | | }, { |
| | | value: 'false', |
| | | text: '不支持' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'callbackType', |
| | | label: '回调方式', |
| | | initVal: card.callbackType || 'script', |
| | | tooltip: '使用后台脚本执行时,需要配合计划任务。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'script', |
| | | text: '自定义脚本' |
| | | }, { |
| | | value: 'default', |
| | | text: '后台脚本' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'cbTable', |
| | | label: '回调表名', |
| | | initVal: card.cbTable || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | label: Formdict['model.form.linkmenu'], |
| | | initVal: card.linkmenu || [], |
| | | required: true, |
| | | forbid: isApp, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | type: 'select', |
| | | key: 'execSuccess', |
| | | label: Formdict['model.form.afterSuccess'], |
| | | initVal: card.execSuccess || 'never', |
| | | tooltip: refresh.length ? '执行标签刷新时,会同步刷新当前组件和上级组件-行。' : '刷新上级组件-行时,会同步刷新当前组件,注:上级组件在数据源中添加。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'grid', |
| | | text: Formdict['header.form.refresh'] |
| | | }, { |
| | | value: 'never', |
| | | text: Formdict['header.form.refresh.never'] |
| | | }] |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新当前组件' |
| | | }, { |
| | | value: 'mainline', |
| | | text: '刷新上级组件 - 行' |
| | | }, |
| | | ...refresh] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | type: 'select', |
| | | key: 'execError', |
| | | label: Formdict['model.form.afterError'], |
| | | initVal: card.execError || 'never', |
| | | tooltip: refresh.length ? '执行标签关闭刷新时,会同步刷新当前组件和上级组件-行。' : '刷新上级组件-行时,会同步刷新当前组件,注:上级组件在数据源中添加。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'grid', |
| | | text: Formdict['header.form.refresh'] |
| | | }, { |
| | | value: 'never', |
| | | text: Formdict['header.form.refresh.never'] |
| | | }] |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新当前组件' |
| | | }, { |
| | | value: 'mainline', |
| | | text: '刷新上级组件 - 行' |
| | | }, |
| | | ...refresh] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | type: 'select', |
| | | key: 'popClose', |
| | | label: Formdict['header.form.popClose'], |
| | | initVal: card.popClose || 'never', |
| | | required: true, |
| | | options: [{ |
| | | value: 'grid', |
| | | text: Formdict['header.form.refresh'] |
| | | }, { |
| | | value: 'never', |
| | | text: Formdict['header.form.refresh.never'] |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新当前组件' |
| | | }, { |
| | | value: 'mainline', |
| | | text: '刷新上级组件 - 行' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'resetPageIndex', |
| | | label: '刷新时', |
| | | initVal: card.resetPageIndex || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '重置页码' |
| | | }, { |
| | | value: 'false', |
| | | text: '不重置' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: 'radio', |
| | | key: 'show', |
| | | label: "显示为", |
| | | initVal: card.show || 'icon', |
| | | initVal: card.show || 'button', |
| | | required: true, |
| | | options: [{ |
| | | value: 'icon', |
| | |
| | | initVal: card.syncComponent || [], |
| | | required: false, |
| | | options: modules |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'controlField', |
| | | label: '控制字段', |
| | | tooltip: '禁用控制字段,可根据数据控制按钮是否禁用。', |
| | | initVal: card.controlField || '', |
| | | required: false, |
| | | // forbid: card.$type !== 'tableButton', |
| | | options: [{label: '无', field: ''}, ...columns] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'controlVal', |
| | | label: '控制值', |
| | | tooltip: '当选择控制字段,且字段值与控制值相等时,按钮会禁用,多个值用逗号分隔。', |
| | | initVal: card.controlVal || '', |
| | | // forbid: card.$type !== 'tableButton', |
| | | required: false |
| | | } |
| | | ] |
| | | |