ttk-app-core
Version:
enterprise develop framework
174 lines (173 loc) • 4.89 kB
JavaScript
export function getMeta() {
return {
name: 'root',
component: '::div',
className: 'ttk-scm-app-matching-unit',
children: [{
className: 'ttk-scm-app-matching-unit-waring',
component: '::div',
children: {
// className: '',
component: '::div',
children: '注意:供应商/客户为空时,点击确定按钮,会根据默认性质自动生成客户档案或者供应商档案'
}
}, {
name: 'dataGrid',
component: 'DataGrid',
headerHeight: 37,
isColumnResizing: false,
rowHeight: 38,
ellipsis: true,
className: 'ttk-scm-app-matching-unit-list',
loading: '{{data.loading}}',
// enableSequence: false,
rowsCount: "{{data.list.length}}",
columns: [{
name: 'seq',
component: 'DataGrid.Column',
columnKey: 'seq',
width: 41,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: '序号'
},
cell: {
name: 'cell',
component: "DataGrid.Cell",
value: "{{data.list[_rowIndex].seq}}",
_power: '({rowIndex})=>rowIndex',
}
}, {
name: 'name',
component: 'DataGrid.Column',
columnKey: 'name',
width: 150,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: '对方户名'
},
cell: {
name: 'cell',
component: "DataGrid.Cell",
tip: true,
className: 'mk-datagrid-cellContent-left',
value: "{{data.list[_rowIndex].name}}",
_power: '({rowIndex})=>rowIndex',
}
}, {
name: 'archiveSelect',
component: 'DataGrid.Column',
columnKey: 'archiveSelect',
width: 150,
flexGrow: 1,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: '供应商/客户'
},
cell: {
name: 'cell',
component: 'Select',
className: 'ttk-scm-app-matching-unit-list-archiveSelect',
showSearch: true,
allowClear: true,
value: '{{data.list[_rowIndex] && data.list[_rowIndex].archiveId}}',
onChange: '{{function(value){$onFieldChange(value, _rowIndex)}}}',
// filterOption: '{{$filterOption}}',
onFocus: '{{function(){data.list[_rowIndex].archiveType == "供应商" ? $getSupplier({ entity: { isEnable: true } }, "data.other.supplier") : $getCustomer({ entity: { isEnable: true } }, "data.other.customer")}}}',
children: '{{$selectChidren(data.list[_rowIndex].archiveType)}}',
dropdownFooter: {
name: 'add',
type: 'primary',
component: 'Button',
style: { width: '100%', borderRadius: '0' },
children: '新增',
onClick: '{{function(){data.list[_rowIndex].archiveType == "供应商" ? $addSupplierCustomer("supplier", _rowIndex) : $addSupplierCustomer("customer", _rowIndex)}}}'
},
_power: '({rowIndex}) => rowIndex',
}
}, {
name: 'archiveType',
component: 'DataGrid.Column',
columnKey: 'archiveType',
width: 150,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: '性质'
},
cell: {
name: 'cell',
component: "Radio.Group",
className: 'ttk-scm-app-matching-unit-list-archiveType',
value: '{{data.list[_rowIndex].archiveType}}',
onChange: '{{function(v){$rptTypeChange(_rowIndex,v.target.value)}}}',
_power: '({rowIndex})=>rowIndex',
children: [{
name: 'type',
component: 'Radio',
value:'供应商',
children: '供应商'
// onClick: '{{$modifyDetail(data.list[_rowIndex].id)}}'
}, {
name: 'type',
component: 'Radio',
value:'客户',
children: '客户'
// onClick: '{{$modifyDetail(data.list[_rowIndex].id)}}'
}]
}
}, {
name: 'receiptAndDisbursementDirection',
component: 'DataGrid.Column',
columnKey: 'receiptAndDisbursementDirection',
width: 90,
header: {
name: 'header',
component: 'DataGrid.Cell',
children: '收支方向'
},
cell: {
name: 'cell',
component: "DataGrid.Cell",
tip: true,
value: "{{data.list[_rowIndex].receiptAndDisbursementDirection}}",
_power: '({rowIndex})=>rowIndex',
}
}]
}]
}
}
export function getInitState() {
return {
data: {
loading: false,
list: [
{
"name": "畅捷通信息技术股份有限公司",
"archiveType": "客户",
"receiptAndDisbursementDirection": "收入",
"seq": "1",
"attachments": [],
"details": []
},
{
"name": "畅捷通信息技术股份有限公司",
"archiveType": "供应商",
"receiptAndDisbursementDirection": "支出",
"seq": "2",
"attachments": [],
"details": []
}
],
other: {
inventory: [],
supplier: [],
customer: []
}
}
}
}