e5461965d9af3e22e3dc52b07604f657b0df2e35.svn-base 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. $(function () {
  2. 'use strict';
  3. BemsWebApplication.Factory.Partner = {
  4. getBasicDataSourceRef: function (options) {
  5. var dbModeIId = options.dbModeIId,
  6. primaryKeyDataField = options.primaryKeyDataField,
  7. moreSelectFields = options.moreSelectFields,
  8. expand = ['CmPartnerType']
  9. ;
  10. var select = [
  11. 'SiteId',
  12. 'PartnerId',
  13. 'PartnerTypeId',
  14. 'Name',
  15. 'PhoneNo',
  16. 'FaxNo',
  17. 'RepresentativeName',
  18. 'SalesName',
  19. 'SalesPhoneNo',
  20. 'AddressZip1',
  21. 'AddressZip2',
  22. 'Address1',
  23. 'Adderss2',
  24. 'HomepageUri',
  25. 'Note',
  26. 'IsUse',
  27. 'CmPartnerType/Name'
  28. ];
  29. if (_.isArray(moreSelectFields)) {
  30. select = select.concat(moreSelectFields);
  31. }
  32. if (_.isArray(options.expand)) {
  33. expand = expand.concat(options.expand);
  34. }
  35. return BWA.DataUtil.createDataSource({
  36. dataSourceOptions: {
  37. paginate: false, // 전체를 모두 가져옴
  38. select: select,
  39. expand: expand,
  40. extendOptions: {
  41. forceOriginalField: true,
  42. alterNames: {
  43. 'CmPartnerType/Name': 'TypeName'
  44. }
  45. },
  46. filter: [
  47. ['SiteId', '=', BWA.UserInfo.SiteId()],
  48. 'and',
  49. ['PartnerTypeId', '=', 1]
  50. ],
  51. sort: { field: "PartnerId", desc: true },
  52. }
  53. }, dbModeIId);
  54. },
  55. getDataSourceWithRelation: function (store, options) {
  56. return BWA.Factory.getBaseDataSourceWithRelation(
  57. store,
  58. options,
  59. BWA.Factory.Partner.getDataSourceForRefDataGrid(),
  60. 'CmPartner');
  61. },
  62. getDataSourceForDataGrid: function () {
  63. return {
  64. select: [
  65. 'SiteId',
  66. 'PartnerId',
  67. 'PartnerTypeId',
  68. 'Name',
  69. 'PhoneNo',
  70. 'FaxNo',
  71. 'RepresentativeName',
  72. 'SalesName',
  73. 'SalesPhoneNo',
  74. 'AddressZip1',
  75. 'AddressZip2',
  76. 'Address1',
  77. 'Adderss2',
  78. 'HomepageUri',
  79. 'Note',
  80. 'IsUse',
  81. 'CmPartnerType/Name'
  82. ],
  83. expand: ['CmPartnerType'],
  84. filter: [
  85. ['SiteId', '=', BWA.UserInfo.SiteId()],
  86. 'and',
  87. ['PartnerTypeId', '=', 1]
  88. ],
  89. sort: { field: "PartnerId", desc: true }
  90. };
  91. },
  92. defaultColumns: [
  93. { dataField: 'PartnerId', caption: $G('number'), width: '10%', alignment: 'center', allowFiltering: false },
  94. { dataField: 'Name', caption: '거래처명', width: '35%', alignment: 'center' },
  95. { dataField: 'RepresentativeName', caption: $G('companyRepresentativeName'), width: '15%', alignment: 'center' },
  96. { dataField: 'PhoneNo', caption: $G('companyPhoneNo'), width: '15%', alignment: 'center' },
  97. utils.datagrid.columnIsUse('10%')
  98. ],
  99. };
  100. $.extend(BWA.Factory.Partner, BWA.DataUtil.pickFunctions(BWA.Partner));
  101. });