Business.js 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. /**
  2. * 商机-公司商机
  3. */
  4. Ext.define('saas.view.sale.business.Business', {
  5. extend: 'saas.view.core.base.BasePanel',
  6. xtype: 'sale-business-business',
  7. controller: 'sale-business-business',
  8. viewModel: 'sale-business-business',
  9. viewName: 'sale-business-business',
  10. // dataUrl: 'http://10.1.80.23:8560/api/sale/sale/enterprise/businessChance',
  11. dataUrl: '/api/sale/sale/enterprise/businessChance',
  12. initComponent: function() {
  13. var me = this;
  14. Ext.apply(this, {
  15. searchField: [{
  16. xtype: 'textfield',
  17. name: 'keyword',
  18. columnWidth: 0.15,
  19. emptyText:'请输入物料编号/名称/型号/品牌'
  20. }, {
  21. xtype: 'condatefield',
  22. name: 'date',
  23. fieldLabel: '日期',
  24. labelWidth: 50,
  25. columnWidth: 0.4,
  26. }, {
  27. xtype: 'combobox',
  28. name: 'quoted',
  29. fieldLabel: '报价状态',
  30. queryMode: 'local',
  31. displayField: 'name',
  32. valueField: 'value',
  33. emptyText :'全部',
  34. editable:false,
  35. labelWidth: 80,
  36. columnWidth: 0.2,
  37. store: Ext.create('Ext.data.ArrayStore', {
  38. fields: ['name', 'value'],
  39. data: [
  40. ["全部", "all"],
  41. ["未报价", "0"],
  42. ["已报价", "1"]
  43. ]
  44. })
  45. // }, {
  46. // xtype: 'combobox',
  47. // name: 'closed',
  48. // fieldLabel: '截止状态',
  49. // queryMode: 'local',
  50. // displayField: 'name',
  51. // valueField: 'value',
  52. // emptyText :'全部',
  53. // editable:false,
  54. // columnWidth: 0.2,
  55. // store: Ext.create('Ext.data.ArrayStore', {
  56. // fields: ['name', 'value'],
  57. // data: [
  58. // ["全部", "all"],
  59. // ["未截止", "0"],
  60. // ["已截止", "1"]
  61. // ]
  62. // })
  63. }],
  64. caller: null,
  65. _formXtype: null,
  66. _title: null,
  67. _deleteUrl: null,
  68. _batchOpenUrl: null,
  69. _batchCloseUrl: null,
  70. _batchDeleteUrl: null,
  71. gridConfig: {
  72. idField: null,
  73. codeField: null,
  74. statusCodeField: null,
  75. dataUrl: me.dataUrl,
  76. caller: null,
  77. rootProperty: 'data.content',
  78. totalProperty: 'data.totalElements',
  79. actionColumn: [],
  80. selModel: {
  81. type: 'cellmodel'
  82. },
  83. hiddenTools: true,
  84. data: [{
  85. }],
  86. columns : [{
  87. text: '客户名称',
  88. dataIndex: 'custName',
  89. width: 200
  90. }, {
  91. text: '物料品牌',
  92. dataIndex: 'prodBrand',
  93. width: 100
  94. }, {
  95. text: '物料名称',
  96. dataIndex: 'prodName',
  97. width: 120
  98. }, {
  99. text: '物料型号',
  100. dataIndex: 'prodOrispeccode',
  101. width: 120
  102. }, {
  103. text: '物料规格',
  104. dataIndex: 'prodSpec',
  105. width: 120
  106. }, {
  107. text: '物料单位',
  108. dataIndex: 'prodUnit'
  109. }, {
  110. text: '采购数量',
  111. xtype: 'numbercolumn',
  112. dataIndex: 'needQty',
  113. renderer: function (v, m, r) {
  114. return saas.util.BaseUtil.numberFormat(v, 0, false);
  115. }
  116. }, {
  117. text: '发布时间',
  118. xtype: 'datecolumn',
  119. dataIndex: 'startDate',
  120. format: 'Y-m-d H:i:s'
  121. }, {
  122. text: '截止时间',
  123. xtype: 'datecolumn',
  124. dataIndex: 'endDate'
  125. }, {
  126. text: '操作',
  127. dataIndex: 'quoted',
  128. renderer: function(v, m) {
  129. return v == 1 ? '<a style="color: green; cursor: pointer;">报价中</a>' : '<a style="color: #35BAF6; cursor: pointer;">报价</a>';
  130. },
  131. listeners: {
  132. click: function(tableView, td, rowIdx, colIdx, e, model, tr) {
  133. var dataIndex = this.dataIndex;
  134. var record = tableView.store.getAt(rowIdx);
  135. var value = record.get(dataIndex);
  136. if(value == '0') {
  137. me.getController().showQuoteWin(record);
  138. }
  139. }
  140. }
  141. }]
  142. },
  143. });
  144. this.callParent(arguments);
  145. },
  146. /**
  147. * 处理部分字段值
  148. */
  149. getConditionValue: function (field, value) {
  150. var me = this,
  151. xtypes = field.getXTypes().split('/'),
  152. conditionValue;
  153. if (me.isContainsAny(xtypes, ['datefield'])) {
  154. conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
  155. } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
  156. var from = value.from,
  157. to = value.to;
  158. conditionValue = from + ',' + to;
  159. } else if (me.isContainsAny(xtypes, ['condatefield'])) {
  160. var from = value.from,
  161. to = value.to;
  162. conditionValue = Ext.Date.format(new Date(from), 'Y-m-d 00:00:00') + ',' + Ext.Date.format(new Date(to), 'Y-m-d 23:59:59');
  163. } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
  164. conditionValue = value;
  165. } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
  166. conditionValue = value;
  167. } else if (me.isContainsAny(xtypes, ['multicombo'])) {
  168. conditionValue = value.map ? value.map(function (v) {
  169. return v.value;
  170. }).join(',') : '';
  171. } else {
  172. conditionValue = value;
  173. }
  174. return conditionValue;
  175. },
  176. getExtraParams: function(store, op, condition) {
  177. var temp = {};
  178. for(let x = 0; x < condition.length; x++) {
  179. let c = condition[x];
  180. if(c.field == 'keyword') {
  181. temp.keyword = c.value;
  182. }else if(c.field == 'date') {
  183. temp.fromDate = new Date(c.value.split(',')[0]).getTime();
  184. temp.endDate = new Date(c.value.split(',')[1]).getTime();
  185. }else if(c.field == 'quoted') {
  186. temp.quoted = c.value == 'all' ? null : c.value;
  187. }else if(c.field == 'closed') {
  188. // temp.endDate = c.value == 'all' ? null : (
  189. // c.value == '0' ?
  190. // );
  191. }
  192. }
  193. let obj = {
  194. pageNumber: store.exportNumber?store.exportNumber:op._page,
  195. pageSize: store.exportPageSize?store.exportPageSize:store.pageSize
  196. };
  197. for(let k in temp) {
  198. if(!!temp[k]) {
  199. obj[k] = temp[k];
  200. }
  201. }
  202. return obj;
  203. },
  204. });