ttk-app-core
Version:
enterprise develop framework
909 lines (905 loc) • 31.1 kB
JavaScript
import moment from 'moment'
export function getMeta() {
return {
name: 'root',
component: 'Layout',
className: 'ttk-scm-get-voucher-to-tj',
children: [
{
name: 'mail',
component: 'Spin',
delay: 1,
tip: '生成凭证中...',
spinning: '{{data.loading}}',
children: {
name: 'form',
component: 'Form',
className: 'ttk-scm-get-voucher-to-tj-form',
children: [
{
name: 'barItem',
component: '::div',
className: 'ttk-scm-get-voucher-to-tj-form-bar',
children: [{
name: 'step1',
component: '::div',
className: 'ttk-scm-get-voucher-to-tj-form-bar-step step1',
children: [{
name: 'title',
className: 'ttk-scm-get-voucher-to-tj-form-bar-step-icon',
component: '::div',
style: { background: '#1EB5AD', borderColor: '#1EB5AD', color: '#fff' },
children: ['1']
}, {
name: 'description',
component: '::span',
className: 'ttk-scm-get-voucher-to-tj-form-bar-step-description',
style: { color: '#1EB5AD' },
children: ['档案映射']
}]
}, {
name: 'line1',
className: '{{data.other.step >= 2 ? "ttk-scm-get-voucher-to-tj-form-bar-line active" : "ttk-scm-get-voucher-to-tj-form-bar-line"}}',
component: '::span',
}, {
name: 'step2',
component: '::div',
className: 'ttk-scm-get-voucher-to-tj-form-bar-step step2',
children: [{
name: 'title',
className: 'ttk-scm-get-voucher-to-tj-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-get-voucher-to-tj-form-bar-step-description',
children: ['科目设置']
}]
}, {
name: 'line2',
className: '{{data.other.step >= 3 ? "ttk-scm-get-voucher-to-tj-form-bar-line active" : "ttk-scm-get-voucher-to-tj-form-bar-line"}}',
component: '::span',
}, {
name: 'step3',
component: '::div',
className: 'ttk-scm-get-voucher-to-tj-form-bar-step step3',
children: [{
name: 'title',
className: 'ttk-scm-get-voucher-to-tj-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-get-voucher-to-tj-form-bar-step-description',
children: ['生成凭证']
}]
}]
},
{
name: 'step1-tip',
component: "::div",
className: 'sep1-tip',
_visible: '{{data.other.step==1}}',
children: '{{data.other.vatOrEntry==0?"注:客户、存货默认生成T+对应档案":"注:供应商档案、存货档案默认生产T+对应档案"}}'
},
{
name: 'mobileItem',
component: "::div",
className: 'ttk-scm-get-voucher-to-tj-form-mobile',
_visible: '{{data.other.step==1}}',
children:
{
name: 'step1-tab',
component: 'Tabs',
children: [
{
name: 'step1-tab1',
component: 'Tabs.TabPane',
tab: '客户档案',
key: 1,
children: {
name: 'customer',
component: 'DataGrid',
headerHeight: 37,
className: 'ttk-scm-fileRules-card-content',
isColumnResizing: true,
rowHeight: 37,
enableSequence: false,
ellipsis: true,
rowsCount: "{{data.form.customerList && data.form.customerList.length}}",
readonly: false,
columns: [
{
name: 'customerCode',
component: 'DataGrid.Column',
columnKey: 'customerCode',
width: 45,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: '客户编码'
},
cell: {
name: 'cell',
component: "DataGrid.Cell",
className: 'customerCode',
value: "{{data.form.customerList[_rowIndex].code}}",
_power: '({rowIndex})=>rowIndex',
tip: true,
}
},
{
name: 'customerName',
component: 'DataGrid.Column',
columnKey: 'customerName',
width: 250,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: '客户名称'
},
cell: {
name: 'cell',
component: "DataGrid.Cell",
className: 'customerName',
value: "{{data.form.customerList[_rowIndex].name}}",
_power: '({rowIndex})=>rowIndex',
tip: true,
}
},
{
name: 'customerNameTJ',
component: 'DataGrid.Column',
columnKey: 'customerNameTJ',
width: 256,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: 'T+客户',
className: 'cell_header'
},
cell: {
name: 'cell',
// component: '{{$isFocus(_ctrlPath) ? "Select" : "DataGrid.TextCell"}}',
component: 'Select',
//className: '{{$getCellClassName(_ctrlPath)}}',
showSearch: true,
allowClear: true,
dropdownClassName: 'celldropdown',
value: '{{data.form.customerList[_rowIndex] && data.form.customerList[_rowIndex].name}}',
//filterOption: '{{$filterOption}}',
//onChange: '{{function(v){$onFieldChange(v, _rowIndex)}}}',
children: {
name: 'option',
component: 'Select.Option',
value: '{{data.other.customer && data.other.customer[_lastIndex].id}}',
children: '{{data.other.customer && data.other.customer[_lastIndex].name}}',
_power: 'for in data.other.customer'
},
dropdownFooter: {
name: 'add',
type: 'primary',
component: 'Button',
style: { width: '100%', borderRadius: '0' },
children: '新增',
onClick: '{{function(){$addCustomerClick(_rowIndex)}}}'
},
_excludeProps: '{{$isFocus(_ctrlPath) ? ["onClick"] : ["children"]}}',
_power: '({rowIndex}) => rowIndex',
}
}]
}
},
{
name: 'step1-tab2',
component: 'Tabs.TabPane',
tab: '存货档案',
key: 2,
children: {
name: 'inventory',
component: 'DataGrid',
headerHeight: 37,
className: 'ttk-scm-fileRules-card-content',
isColumnResizing: true,
rowHeight: 37,
enableSequence: false,
ellipsis: true,
rowsCount: "{{data.form.inventoryList && data.form.inventoryList.length}}",
readonly: false,
columns: [
{
name: 'inventoryCode',
component: 'DataGrid.Column',
columnKey: 'customerCode',
width: 45,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: '存货编码'
},
cell: {
name: 'cell',
component: "DataGrid.Cell",
className: 'customerCode',
value: "{{data.form.inventoryList[_rowIndex].code}}",
_power: '({rowIndex})=>rowIndex',
tip: true,
}
},
{
name: 'inventoryName',
component: 'DataGrid.Column',
columnKey: 'inventoryName',
width: 250,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: '存货名称'
},
cell: {
name: 'cell',
component: "DataGrid.Cell",
className: 'inventoryName',
value: "{{data.form.inventoryList[_rowIndex].name}}",
_power: '({rowIndex})=>rowIndex',
tip: true,
}
},
{
name: 'inventoryNameTJ',
component: 'DataGrid.Column',
columnKey: 'inventoryNameTJ',
width: 256,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: 'T+科目',
className: 'cell_header'
},
cell: {
name: 'cell',
// component: '{{$isFocus(_ctrlPath) ? "Select" : "DataGrid.TextCell"}}',
component: 'Select',
//className: '{{$getCellClassName(_ctrlPath)}}',
showSearch: true,
allowClear: true,
dropdownClassName: 'celldropdown',
value: '{{data.form.inventoryList[_rowIndex] && data.form.inventoryList[_rowIndex].name}}',
//filterOption: '{{$filterOption}}',
//onChange: '{{function(v){$onFieldChange(v, _rowIndex)}}}',
children: {
name: 'option',
component: 'Select.Option',
value: '{{data.other.inventory && data.other.inventory[_lastIndex].id}}',
children: '{{data.other.inventory && data.other.inventory[_lastIndex].name}}',
_power: 'for in data.other.inventory'
},
dropdownFooter: {
name: 'add',
type: 'primary',
component: 'Button',
style: { width: '100%', borderRadius: '0' },
children: '新增',
onClick: '{{function(){$addCustomerClick(_rowIndex)}}}'
},
_excludeProps: '{{$isFocus(_ctrlPath) ? ["onClick"] : ["children"]}}',
_power: '({rowIndex}) => rowIndex',
}
}]
}
}
]
}
},
{
name: 'orgItem',
component: "::div",
className: 'ttk-scm-get-voucher-to-tj-form-org',
_visible: '{{data.other.step==2}}',
children:
{
name: 'step2-tab',
component: 'Tabs',
children: [
{
name: 'step2-tab1',
component: 'Tabs.TabPane',
_visible: "{{data.other.vatOrEntry==0}}",
tab: '收入科目',
key: 1,
children: {
name: 'revenue',
component: 'DataGrid',
headerHeight: 37,
className: 'ttk-scm-fileRules-card-content',
isColumnResizing: true,
rowHeight: 37,
enableSequence: false,
ellipsis: true,
rowsCount: "{{data.form.revenueTypeList && data.form.revenueTypeList.length}}",
readonly: false,
columns: [
{
name: 'revenueName',
component: 'DataGrid.Column',
columnKey: 'revenueName',
width: 250,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: '收入类型名称'
},
cell: {
name: 'cell',
component: "DataGrid.Cell",
className: 'revenueName',
value: "{{data.form.revenueTypeList[_rowIndex].name}}",
_power: '({rowIndex})=>rowIndex',
tip: true,
}
},
{
name: 'revenueNameTJ',
component: 'DataGrid.Column',
columnKey: 'revenueNameTJ',
width: 256,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: 'T+科目',
className: 'cell_header'
},
cell: {
name: 'cell',
// component: '{{$isFocus(_ctrlPath) ? "Select" : "DataGrid.TextCell"}}',
component: 'Select',
//className: '{{$getCellClassName(_ctrlPath)}}',
showSearch: true,
allowClear: true,
dropdownClassName: 'celldropdown',
value: '{{data.form.revenueTypeList[_rowIndex] && data.form.revenueTypeList[_rowIndex].name}}',
//filterOption: '{{$filterOption}}',
//onChange: '{{function(v){$onFieldChange(v, _rowIndex)}}}',
children: {
name: 'option',
component: 'Select.Option',
value: '{{data.other.revenue && data.other.revenue[_lastIndex].id}}',
children: '{{data.other.revenue && data.other.revenue[_lastIndex].name}}',
_power: 'for in data.other.revenue'
},
dropdownFooter: {
name: 'add',
type: 'primary',
component: 'Button',
style: { width: '100%', borderRadius: '0' },
children: '新增',
onClick: '{{function(){$addCustomerClick(_rowIndex)}}}'
},
_excludeProps: '{{$isFocus(_ctrlPath) ? ["onClick"] : ["children"]}}',
_power: '({rowIndex}) => rowIndex',
}
}]
}
},
{
name: 'step2-tab2',
component: 'Tabs.TabPane',
_visible: "{{data.other.vatOrEntry==0}}",
tab: '结算方式科目设置',
key: 2,
children: {
name: 'customer',
component: 'DataGrid',
headerHeight: 37,
className: 'ttk-scm-fileRules-card-content',
isColumnResizing: true,
rowHeight: 37,
enableSequence: false,
ellipsis: true,
rowsCount: "{{data.form.settleList && data.form.settleList.length}}",
readonly: false,
columns: [
{
name: 'settleName',
component: 'DataGrid.Column',
columnKey: 'settleName',
width: 250,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: '结算方式'
},
cell: {
name: 'cell',
component: "DataGrid.Cell",
className: 'settleName',
value: "{{data.form.settleList[_rowIndex].name}}",
_power: '({rowIndex})=>rowIndex',
tip: true,
}
},
{
name: 'settleNameTJ',
component: 'DataGrid.Column',
columnKey: 'settleNameTJ',
width: 256,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: 'T+科目',
className: 'cell_header'
},
cell: {
name: 'cell',
// component: '{{$isFocus(_ctrlPath) ? "Select" : "DataGrid.TextCell"}}',
component: 'Select',
//className: '{{$getCellClassName(_ctrlPath)}}',
showSearch: true,
allowClear: true,
dropdownClassName: 'celldropdown',
value: '{{data.form.settleList[_rowIndex] && data.form.settleList[_rowIndex].name}}',
//filterOption: '{{$filterOption}}',
//onChange: '{{function(v){$onFieldChange(v, _rowIndex)}}}',
children: {
name: 'option',
component: 'Select.Option',
value: '{{data.other.settle && data.other.settle[_lastIndex].id}}',
children: '{{data.other.settle && data.other.settle[_lastIndex].name}}',
_power: 'for in data.other.settle'
},
dropdownFooter: {
name: 'add',
type: 'primary',
component: 'Button',
style: { width: '100%', borderRadius: '0' },
children: '新增',
onClick: '{{function(){$addCustomerClick(_rowIndex)}}}'
},
_excludeProps: '{{$isFocus(_ctrlPath) ? ["onClick"] : ["children"]}}',
_power: '({rowIndex}) => rowIndex',
}
}]
}
},
{
name: 'step2-tab3',
component: 'Tabs.TabPane',
_visible: "{{data.other.vatOrEntry==1}}",
tab: '存货类别科目',
key: 3,
children: {
name: 'inventoryType',
component: 'DataGrid',
headerHeight: 37,
className: 'ttk-scm-fileRules-card-content',
isColumnResizing: true,
rowHeight: 37,
enableSequence: false,
ellipsis: true,
rowsCount: "{{data.form.inventoryTypeList && data.form.inventoryTypeList.length}}",
readonly: false,
columns: [
{
name: 'customerName',
component: 'DataGrid.Column',
columnKey: 'customerName',
width: 250,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: '存货及服务分类'
},
cell: {
name: 'cell',
component: "DataGrid.Cell",
className: 'inventoryTypeName',
value: "{{data.form.inventoryTypeList[_rowIndex].name}}",
_power: '({rowIndex})=>rowIndex',
tip: true,
}
},
{
name: 'customerNameTJ',
component: 'DataGrid.Column',
columnKey: 'customerNameTJ',
width: 256,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: 'T+科目',
className: 'cell_header'
},
cell: {
name: 'cell',
// component: '{{$isFocus(_ctrlPath) ? "Select" : "DataGrid.TextCell"}}',
component: 'Select',
//className: '{{$getCellClassName(_ctrlPath)}}',
showSearch: true,
allowClear: true,
dropdownClassName: 'celldropdown',
value: '{{data.form.inventoryTypeList[_rowIndex] && data.form.inventoryTypeList[_rowIndex].name}}',
//filterOption: '{{$filterOption}}',
//onChange: '{{function(v){$onFieldChange(v, _rowIndex)}}}',
children: {
name: 'option',
component: 'Select.Option',
value: '{{data.other.inventoryType && data.other.inventoryType[_lastIndex].id}}',
children: '{{data.other.inventoryType && data.other.inventoryType[_lastIndex].nameTJ}}',
_power: 'for in data.other.inventoryType'
},
dropdownFooter: {
name: 'add',
type: 'primary',
component: 'Button',
style: { width: '100%', borderRadius: '0' },
children: '新增',
onClick: '{{function(){$addCustomerClick(_rowIndex)}}}'
},
_excludeProps: '{{$isFocus(_ctrlPath) ? ["onClick"] : ["children"]}}',
_power: '({rowIndex}) => rowIndex',
}
}]
}
},
{
name: 'step2-tab4',
component: 'Tabs.TabPane',
_visible: "{{data.other.vatOrEntry==1}}",
tab: '费用类型科目设置',
key: 4,
children: {
name: 'customer',
component: 'DataGrid',
headerHeight: 37,
className: 'ttk-scm-fileRules-card-content',
isColumnResizing: true,
rowHeight: 37,
enableSequence: false,
ellipsis: true,
rowsCount: "{{data.form.busnessList && data.form.busnessList.length}}",
readonly: false,
columns: [
{
name: 'customerName',
component: 'DataGrid.Column',
columnKey: 'customerName',
width: 250,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: '费用类型'
},
cell: {
name: 'cell',
component: "DataGrid.Cell",
className: 'customerName',
value: "{{data.form.busnessList[_rowIndex].name}}",
_power: '({rowIndex})=>rowIndex',
tip: true,
}
},
{
name: 'customerNameTJ',
component: 'DataGrid.Column',
columnKey: 'customerNameTJ',
width: 256,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: 'T+科目',
className: 'cell_header'
},
cell: {
name: 'cell',
// component: '{{$isFocus(_ctrlPath) ? "Select" : "DataGrid.TextCell"}}',
component: 'Select',
//className: '{{$getCellClassName(_ctrlPath)}}',
showSearch: true,
allowClear: true,
dropdownClassName: 'celldropdown',
value: '{{data.form.busnessList[_rowIndex] && data.form.busnessList[_rowIndex].nameTJ}}',
//filterOption: '{{$filterOption}}',
//onChange: '{{function(v){$onFieldChange(v, _rowIndex)}}}',
children: {
name: 'option',
component: 'Select.Option',
value: '{{data.other.customer && data.other.customer[_lastIndex].id}}',
children: '{{data.other.customer && data.other.customer[_lastIndex].name}}',
_power: 'for in data.other.customer'
},
dropdownFooter: {
name: 'add',
type: 'primary',
component: 'Button',
style: { width: '100%', borderRadius: '0' },
children: '新增',
onClick: '{{function(){$addCustomerClick(_rowIndex)}}}'
},
_excludeProps: '{{$isFocus(_ctrlPath) ? ["onClick"] : ["children"]}}',
_power: '({rowIndex}) => rowIndex',
}
}]
}
},
{
name: 'step2-tab5',
component: 'Tabs.TabPane',
_visible: "{{data.other.vatOrEntry==1}}",
tab: '结算方式科目设置',
key: 5,
children: {
name: 'customer',
component: 'DataGrid',
headerHeight: 37,
className: 'ttk-scm-fileRules-card-content',
isColumnResizing: true,
rowHeight: 37,
enableSequence: false,
ellipsis: true,
rowsCount: "{{data.form.customerList && data.form.customerList.length}}",
readonly: false,
columns: [
{
name: 'customerName',
component: 'DataGrid.Column',
columnKey: 'customerName',
width: 250,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: '结算方式'
},
cell: {
name: 'cell',
component: "DataGrid.Cell",
className: 'customerName',
value: "{{data.form.settleList[_rowIndex].name}}",
_power: '({rowIndex})=>rowIndex',
tip: true,
}
},
{
name: 'customerNameTJ',
component: 'DataGrid.Column',
columnKey: 'customerNameTJ',
width: 256,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: 'T+科目',
className: 'cell_header'
},
cell: {
name: 'cell',
// component: '{{$isFocus(_ctrlPath) ? "Select" : "DataGrid.TextCell"}}',
component: 'Select',
//className: '{{$getCellClassName(_ctrlPath)}}',
showSearch: true,
allowClear: true,
dropdownClassName: 'celldropdown',
value: '{{data.form.settleList[_rowIndex] && data.form.settleList[_rowIndex].nameTJ}}',
//filterOption: '{{$filterOption}}',
//onChange: '{{function(v){$onFieldChange(v, _rowIndex)}}}',
children: {
name: 'option',
component: 'Select.Option',
value: '{{data.other.customer && data.other.customer[_lastIndex].id}}',
children: '{{data.other.customer && data.other.customer[_lastIndex].name}}',
_power: 'for in data.other.customer'
},
dropdownFooter: {
name: 'add',
type: 'primary',
component: 'Button',
style: { width: '100%', borderRadius: '0' },
children: '新增',
onClick: '{{function(){$addCustomerClick(_rowIndex)}}}'
},
_excludeProps: '{{$isFocus(_ctrlPath) ? ["onClick"] : ["children"]}}',
_power: '({rowIndex}) => rowIndex',
}
}]
}
}
]
}
},
{
name: 'enabledDateItem',
component: "::div",
className: 'ttk-scm-get-voucher-to-tj-form-date',
_visible: '{{data.other.step==3}}',
required: true,
children: [
{
component: "::div",
name: 'get-voucher-result',
className: 'center-row',
children: [
{
component: "::span",
children: '生成'
},
{
className: 'success-count',
component: "::span",
children: '{{data.other.successCount}}'
},
{
component: "::span",
children: '张凭证!'
}
]
},
{
component: "::div",
className: 'center-row',
name: 'get-voucher-result-tip',
children: '请在T+凭证管理查看生成的凭证!'
}
]
},
]
}
},
{
name: 'footer',
component: '::div',
className: 'ttk-scm-get-voucher-to-tj-footer',
children: [{
name: 'btnGroup',
component: '::div',
className: 'ttk-scm-get-voucher-to-tj-footer-btnGroup',
children: [{
name: 'cancel',
component: 'Button',
_visible: '{{data.other.step ==2}}',
className: 'ttk-scm-get-voucher-to-tj-footer-btnGroup-item',
children: '上一步',
onClick: '{{$backLastStep}}',
},
{
name: 'confirm',
component: 'Button',
className: 'ttk-scm-get-voucher-to-tj-footer-btnGroup-item',
type: 'primary',
children: "{{data.other.step==3? '关闭' : '下一步'}}",
onClick: '{{$nextStep}}'
}
]
}]
},
]
}
}
export function getInitState(option) {
let state = {
data: {
loading: false,
form: {
//客户
customerList: [
{
code: '001',
name: '广东正超电气有限公司',
nameTJ: '广东正超电气有限公司'
},
{
code: '002',
name: '广东正超电气有限公司',
nameTJ: '广东正超电气有限公司'
},
{
code: '003',
name: '广东正超电气有限公司',
nameTJ: '广东正超电气有限公司'
}
],
//存货
inventoryList: [
{
code: '001',
name: '存货1',
nameTJ: '存货1'
},
{
code: '002',
name: '存货2',
nameTJ: '存货2'
},
{
code: '003',
name: '存货3',
nameTJ: '存货3'
}
],
revenueTypeList: [
{
code: '001',
name: '主营业业务收入',
nameTJ: '5001 主营业业务收入'
},
{
code: '002',
name: '其他业务收入',
nameTJ: '5051 其他业务收入'
},
{
code: '003',
name: '营业外收入',
nameTJ: '5031 营业外收入'
}
],
settleList: [
{
code: '001',
name: '现金',
nameTJ: '1001 现金'
},
{
code: '002',
name: '建设银行',
nameTJ: '100201 银行存款-建设银行'
},
{
code: '003',
name: '暂未收款',
nameTJ: '2202 暂未收款'
}
],
busnessList: [
{
code: '001',
name: '差旅费',
nameTJ: '560205 管理费用-差旅费'
},
{
code: '002',
name: '交通费',
nameTJ: '560201 管理费用-交通费'
}
],
inventoryTypeList: [
{
code: '001',
name: '商品',
nameTJ: '1405 库存商品'
},
{
code: '002',
name: '原材料',
nameTJ: '1403 原材料'
}
]
},
other: {
step: 1,
successCount: 0,
baseUrl: null,
}
}
}
return state
}