UNPKG

ttk-app-core

Version:
599 lines (594 loc) 17.8 kB
import moment from 'moment' export function getMeta() { return { name: 'root', component: 'Layout', className: 'ttk-scm-tj-init-setting', children: { name: 'form', component: 'Form', className: 'ttk-scm-tj-init-setting-form', children: [ { name: 'barItem', component: '::div', className: 'ttk-scm-tj-init-setting-form-bar', children: [{ name: 'step1', component: '::div', className: 'ttk-scm-tj-init-setting-form-bar-step step1', children: [{ name: 'title', className: 'ttk-scm-tj-init-setting-form-bar-step-icon', component: '::div', style: { background: '#1EB5AD', borderColor: '#1EB5AD', color: '#fff' }, children: ['1'] }, { name: 'description', component: '::span', className: 'ttk-scm-tj-init-setting-form-bar-step-description', style: { color: '#1EB5AD' }, children: ['连接服务器'] }] }, { name: 'line1', className: '{{data.other.step >= 2 ? "ttk-scm-tj-init-setting-form-bar-line active" : "ttk-scm-tj-init-setting-form-bar-line"}}', component: '::span', }, { name: 'step2', component: '::div', className: 'ttk-scm-tj-init-setting-form-bar-step step2', children: [{ name: 'title', className: 'ttk-scm-tj-init-setting-form-bar-step-icon', style: "{{data.other.step>=2? {background: '#1EB5AD',borderColor: '#1EB5AD',color: '#fff'}:{background: '#fff',borderColor: '#666666',color: '#666666'}}}", component: '::div', children: ['2'] }, { name: 'description', component: '::span', style: "{{data.other.step>=2?{color: '#1EB5AD'}:{color: '#666666'}}}", className: 'ttk-scm-tj-init-setting-form-bar-step-description', children: ['连接账套'] }] }, { name: 'line2', className: '{{data.other.step >= 3 ? "ttk-scm-tj-init-setting-form-bar-line active" : "ttk-scm-tj-init-setting-form-bar-line"}}', component: '::span', }, { name: 'step3', component: '::div', className: 'ttk-scm-tj-init-setting-form-bar-step step3', children: [{ name: 'title', className: 'ttk-scm-tj-init-setting-form-bar-step-icon', style: "{{data.other.step==3? {background: '#1EB5AD',borderColor: '#1EB5AD',color: '#fff'}:{background: '#fff',borderColor: '#666666',color: '#666666'}}}", component: '::div', children: ['3'] }, { name: 'description', component: '::span', style: "{{data.other.step==3?{color: '#1EB5AD'}:{color: '#666666'}}}", className: 'ttk-scm-tj-init-setting-form-bar-step-description', children: ['绑定成功'] }] }] }, { name: 'step1', className: 'step-container', component: "::div", _visible: '{{data.other.step==1&&!data.other.hasbind}}', children: [ { name: 'step1-tip', component: "::div", children: [ { name: 'word', component: '::span', children: '注:链接服务器之前,请先在服务器端安装配置软件。' }, { name: 'a', component: "::a", children: '下载配置软件' } ] }, { name: 'app', component: 'Form.Item', label: '选择软件', required: true, validateStatus: "{{data.other.error.app? 'error':'success'}}", help: '{{data.other.error.app}}', children: { name: 'app', component: 'Select', value: '{{data.form.app}}', children: { name: 'option', component: 'Select.Option', className: 'app-option', value: '{{data.other.app && data.other.app[_rowIndex].value }}', title: '{{data.other.app && data.other.app[_rowIndex].name }}', children: '{{data.other.app && data.other.app[_rowIndex].name }}', _power: 'for in data.other.app' }, onChange: "{{function(value){$fieldotherChange('data.form.app',value)}}}", } }, { name: 'foreseeipport', component: '::div', className: 'ipport-row', children: [ { name: 'foreseeClientHost', component: 'Form.Item', label: '客户端IP地址', required: true, validateStatus: "{{data.other.error.foreseeClientHost ? 'error':'success'}}", help: '{{data.other.error.foreseeClientHost}}', children: [{ name: 'foreseeClientHost', component: 'Input', placeholder: "可输入内部IP", value: '{{data.form.foreseeClientHost}}', onChange: "{{function(e){$fieldotherChange('data.form.foreseeClientHost',e.target.value)}}}", }] }, { name: 'foreseeClientPort', component: 'Form.Item', className: 'port-row', label: '端口号', required: true, validateStatus: "{{data.other.error.foreseeClientPort? 'error':'success'}}", help: '{{data.other.error.foreseeClientPort}}', children: [{ name: 'foreseeClientPort', component: 'Input', maxlength: 4, placeholder: "端口号", value: '{{data.form.foreseeClientPort}}', onChange: "{{function(e){$fieldotherChange('data.form.foreseeClientPort',e.target.value)}}}", }] }, ] }, { name: 'dbUsername', component: 'Form.Item', label: '数据库用户名', required: true, validateStatus: "{{data.other.error.dbUsername? 'error':'success'}}", help: '{{data.other.error.dbUsername}}', children: [{ name: 'dbUsername', component: 'Input', placeholder: "用户名", value: '{{data.form.dbUsername}}', onChange: "{{function(e){$fieldotherChange('data.form.dbUsername',e.target.value)}}}", }] }, { name: 'test', className: 'test-row', component: '::div', children: [ { name: 'dbPassword', component: 'Form.Item', label: '数据库密码', required: true, validateStatus: "{{data.other.error.dbPassword?'error':'success'}}", help: '{{data.other.error.dbPassword}}', children: [{ name: 'dbPassword', component: 'Input', placeholder: "密码", type: 'password', value: '{{data.form.dbPassword}}', onChange: "{{function(e){$fieldotherChange('data.form.dbPassword',e.target.value)}}}", }] }, { name: 'dbPassword', component: 'Form.Item', label: '', required: true, children: [{ name: 'dbPassword', component: 'Input', type: 'primary', placeholder: "测试连接", type: 'button', value: '测试连接', onClick: '{{$dbTest}}' }] }, ] }, { name: 'moreInfo', component: '::div', className: 'tj-init-setting-more', children: [{ name: 'more', component: '::span', className: 'app-asset-card-more-ico', children: [{ name: 'left', component: '::span', children: '高级' }, { name: 'icon', component: 'Icon', className: 'operation', showStyle: 'showy', fontFamily: 'edficon', type: '{{data.other.moreInfo ? "shang" : "xia"}}', style: { fontSize: 26 }, }], onClick: '{{$moreClick}}' }] }, { name: 'bsipport', component: '::div', _visible: '{{data.other.moreInfo==true}}', className: 'ipport-row', children: [ { name: 'bsAppHost', component: 'Form.Item', label: 'T+服务器IP地址', required: true, validateStatus: "{{data.other.error.bsAppHost ? 'error':'success'}}", help: '{{data.other.error.dbHost}}', children: [{ name: 'bsAppHost', component: 'Input', placeholder: "T+服务器IP地址", value: '{{data.form.bsAppHost}}', onChange: "{{function(e){$fieldotherChange('data.form.bsAppHost',e.target.value)}}}", }] }, { name: 'bsAppPort', component: 'Form.Item', className: 'port-row', label: '端口号', required: true, validateStatus: "{{data.other.error.bsAppPort? 'error':'success'}}", help: '{{data.other.error.bsAppPort}}', children: [{ name: 'bsAppPort', component: 'Input', maxlength: 4, placeholder: "端口号", value: '{{data.form.bsAppPort}}', onChange: "{{function(e){$fieldotherChange('data.form.bsAppPort',e.target.value)}}}", }] }, ] }, { name: 'dbipport', component: '::div', _visible: '{{data.other.moreInfo==true}}', className: 'ipport-row', children: [ { name: 'dbHost', component: 'Form.Item', label: 'T+数据库IP地址', required: true, validateStatus: "{{data.other.error.dbHost ? 'error':'success'}}", help: '{{data.other.error.dbHost}}', children: [{ name: 'dbHost', component: 'Input', placeholder: "T+数据库IP地址", value: '{{data.form.dbHost}}', onChange: "{{function(e){$fieldotherChange('data.form.dbHost',e.target.value)}}}", }] }, { name: 'dbPort', component: 'Form.Item', className: 'port-row', label: '端口号', required: true, validateStatus: "{{data.other.error.dbPort? 'error':'success'}}", help: '{{data.other.error.dbPort}}', children: [{ name: 'dbPort', component: 'Input', maxlength: 4, placeholder: "端口号", value: '{{data.form.dbPort}}', onChange: "{{function(e){$fieldotherChange('data.form.dbPort',e.target.value)}}}", }] }, ] }, ] }, { name: 'step2', className: 'step-container', component: "::div", _visible: '{{data.other.step==2&&!data.other.hasbind}}', children: [ { name: 'appUserName', component: 'Form.Item', label: '用户名', required: true, validateStatus: "{{data.other.error.appUserName?'error':'success'}}", help: '{{ data.other.error.appUserName}}', children: [{ name: 'appUserName', component: 'Input', value: '{{data.form.appUserName}}', onChange: "{{function(e){$fieldotherChange('data.form.appUserName',e.target.value)}}}", }] }, { name: 'appPassword', component: 'Form.Item', label: '密码', required: true, validateStatus: "{{data.other.error.appPassword ? 'error':'success'}}", help: '{{data.other.error.appPassword}}', children: [{ name: 'appPassword', component: 'Input', type: 'password', value: '{{data.form.appPassword}}', onChange: "{{function(e){$fieldotherChange('data.form.appPassword',e.target.value)}}}", }] }, { name: 'appAccountNumber', component: 'Form.Item', label: '账套', required: true, validateStatus: "{{data.other.error.appAccountNumber?'error':'success'}}", help: '{{data.other.error.appAccountNumber}}', children: [{ name: 'appAccountNumber', component: 'Select', value: '{{data.form.appAccountNumber}}', onChange: "{{function(value){$fieldotherChange('data.form.appAccountNumber',value)}}}", children: { name: 'option', component: 'Select.Option', className: 'app-option', value: '{{data.other.accoutList && data.other.accoutList[_rowIndex].value }}', title: '{{data.other.accoutList && data.other.accoutList[_rowIndex].name }}', children: '{{data.other.accoutList && data.other.accoutList[_rowIndex].name }}', _power: 'for in data.other.accoutList' } }] }, ] }, { name: 'step3', className: 'step-container step3', component: "::div", _visible: '{{data.other.step==3}}', children: [ { name: 'success', component: '::div', children: [ { name: 'icon', component: "::Icon", type: "chenggongtishi", fontFamily: 'edficon' }, { name: 'success', component: "::span", children: '绑定成功' } ] }, { name: 'info', component: '::div', children: '对接T+账套信息' }, { name: 'host', component: '::div', children: '{{"服务器地址:"+data.form.foreseeClientHost+":"+data.form.foreseeClientPort}}' }, { name: 'username', component: '::div', children: '{{"用户名:"+data.form.appUserName}}' }, { name: 'zt', component: '::div', children: '{{"帐套:"+data.form.appAccountNumber}}' }, ] }, { name: 'footer', component: '::div', className: 'ttk-scm-tj-init-setting-footer', children: [{ name: 'btnGroup', component: '::div', className: 'ttk-scm-tj-init-setting-footer-btnGroup', children: [ { name: 'cancel', component: 'Button', _visible: '{{data.other.step >=2}}', className: 'ttk-scm-tj-init-setting-footer-btnGroup-item', children: "{{data.other.step==3? '解除绑定' : '上一步'}}", onClick: '{{$backLastStep}}', }, { name: 'confirm', component: 'Button', className: 'ttk-scm-tj-init-setting-footer-btnGroup-item', type: 'primary', children: "{{data.other.step==3? '关闭' : '下一步'}}", onClick: '{{$nextStep}}' } ] }] }, ] } } } export function getInitState(option) { let state = { data: { form: { app: null, dbHost: null, dbPort: null, dbUsername: null, dbPassword: null, bsAppHost: null, bsAppPort: null, foreseeClientHost: null, foreseeClientPort: null, appUserName: null, appPassword: null, appAccountNumber: null, appLoginDate: null, ttkUserName: null, ttkPassword: null, ttkOrgId: null, ttkLoginDate: null }, other: { moreInfo: false, step: 1, hasbind: false,//是否已经绑定 error: { app: null, dbHost: null, dbPort: null, dbUsername: null, dbPassword: null, bsAppHost: null, bsAppPort: null, foreseeClientHost: null, foreseeClientPort: null, appUserName: null, appPassword: null, appAccountNumber: null, appLoginDate: null, ttkUserName: null, ttkPassword: null, ttkOrgId: null, ttkLoginDate: null }, app: [ { id: '1.1', appName: 'Tplus12.3(含)以上', dbVersion: 'SqlServer2000', name: 'Tplus12.3(含)以上 SqlServer2000', value: '1.1' }, { id: '1.2', appName: 'Tplus12.3(含)以上', dbVersion: 'SqlServer2000以上', name: 'Tplus12.3(含)以上 SqlServer2000以上', value: '1.2' }, { id: '2.1', appName: 'Tplus12.3(不含)以下', dbVersion: 'SqlServer2000以上', name: 'Tplus12.3(不含)以下 SqlServer2000以上', value: '2.1' }, { id: '2.2', appName: 'Tplus12.3(不含)以下', dbVersion: 'SqlServer2000以上', name: 'Tplus12.3(不含)以下 SqlServer2000以上', value: '2.2' }, { id: '3.1', appName: 'T3', dbVersion: 'SqlServer2000以上', name: 'T3 SqlServer2000以上', value: '3.1' }, { id: '3.2', appName: 'T3', dbVersion: 'SqlServer2000以上', name: 'T3 SqlServer2000以上', value: '3.2' }, { id: '4.1', appName: 'T6', dbVersion: 'SqlServer2000以上', name: 'T6 SqlServer2000以上', value: '4.1' }, { id: '4.2', appName: 'T6', dbVersion: 'SqlServer2000以上', name: 'T6 SqlServer2000以上', value: '4.2' }, { id: '5.1', appName: 'K3', dbVersion: 'SqlServer2000以上', name: 'K3 SqlServer2000以上', value: '5.1' }, { id: '5.2', appName: 'K6', dbVersion: 'SqlServer2000以上', name: 'K3 SqlServer2000以上', value: '5.2' }, ] , accoutList: [ { id: '001', name: '001', value: '001' }, { id: '002', name: '002', value: '002' } ] } } } return state }