Business.js 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. /**
  2. * 商机-公司商机
  3. */
  4. Ext.define('saas.view.sale.b2b.Business', {
  5. extend: 'saas.view.core.base.BasePanel',
  6. xtype: 'sale-b2b-business',
  7. controller: 'sale-b2b-business',
  8. viewModel: 'sale-b2b-business',
  9. viewName: 'sale-b2b-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.2,
  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. value: '0',
  35. editable: false,
  36. labelWidth: 80,
  37. columnWidth: 0.2,
  38. store: Ext.create('Ext.data.ArrayStore', {
  39. fields: ['name', 'value'],
  40. data: [
  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: 150
  98. }, {
  99. text: '物料型号',
  100. dataIndex: 'prodOrispeccode',
  101. width: 200
  102. }, {
  103. text: '物料规格',
  104. dataIndex: 'prodSpec',
  105. width: 200
  106. }, {
  107. text: '单位',
  108. dataIndex: 'prodUnit',
  109. width: 65
  110. }, {
  111. text: '采购数量',
  112. xtype: 'numbercolumn',
  113. dataIndex: 'needQty',
  114. width: 110,
  115. renderer: function (v, m, r) {
  116. return saas.util.BaseUtil.numberFormat(v, 0, false);
  117. }
  118. }, {
  119. text: '发布时间',
  120. xtype: 'datecolumn',
  121. dataIndex: 'startDate',
  122. format: 'Y-m-d H:i:s',
  123. width: 150
  124. }, {
  125. text: '截止时间',
  126. xtype: 'datecolumn',
  127. dataIndex: 'endDate',
  128. format: 'Y-m-d H:i:s',
  129. width: 150
  130. }, {
  131. text: '报价状态',
  132. dataIndex: 'quoted',
  133. textAlign: 'center',
  134. renderer: function (val, meta, record, x, y, store, view) {
  135. if (val == 0) {
  136. return '<div style="text-align: center;color: #35BAF6;">未报价</div>';
  137. } else {
  138. var qutations = record.data.qutations;
  139. if (qutations.agreed == null) {
  140. return '<div style="text-align: center;color: #FBBC05;">已报价</div>';
  141. } else if (qutations.agreed == 1) {
  142. return '<div style="text-align: center;color: green;">被采纳</div>';
  143. } else if (qutations.agreed == 0) {
  144. return '<div style="text-align: center;color:#ff6c00;">被拒绝</div>';
  145. }
  146. }
  147. }
  148. }, {
  149. text: '操作',
  150. dataIndex: 'quoted',
  151. renderer: function (val, meta, record, x, y, store, view) {
  152. if (val == 0) {
  153. return '<div style="text-align: center;color: #35BAF6;cursor: pointer;">点击报价</div>';
  154. } else {
  155. var qutations = record.data.qutations;
  156. if (qutations.agreed == null) {
  157. return '<div style="text-align: center;color: #FBBC05;cursor: pointer;">查看报价信息</div>';
  158. } else if (qutations.agreed == 1) {
  159. return '<div style="text-align: center;color: green;cursor: pointer;">查看报价信息</div>';
  160. } else if (qutations.agreed == 0) {
  161. return '<div style="text-align: center;color:#ff6c00;">查看报价信息</div>';
  162. }
  163. }
  164. },
  165. listeners: {
  166. click: function (tableView, td, rowIdx, colIdx, e, model, tr) {
  167. var dataIndex = this.dataIndex;
  168. var record = tableView.store.getAt(rowIdx);
  169. var value = record.get(dataIndex);
  170. me.getController().showQuoteWin(record, !!value);
  171. },
  172. }
  173. }],
  174. listeners: {
  175. itemmouseenter: function (view, record, item, index, e, eOpts) {
  176. var grid = view.up('grid');
  177. grid.focusRecord = record;
  178. }
  179. }
  180. },
  181. });
  182. this.callParent(arguments);
  183. },
  184. /**
  185. * 处理部分字段值
  186. */
  187. getConditionValue: function (field, value) {
  188. var me = this,
  189. xtypes = field.getXTypes().split('/'),
  190. conditionValue;
  191. if (me.isContainsAny(xtypes, ['datefield'])) {
  192. conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
  193. } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
  194. var from = value.from,
  195. to = value.to;
  196. conditionValue = from + ',' + to;
  197. } else if (me.isContainsAny(xtypes, ['condatefield'])) {
  198. var from = value.from,
  199. to = value.to;
  200. 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');
  201. } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
  202. conditionValue = value;
  203. } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
  204. conditionValue = value;
  205. } else if (me.isContainsAny(xtypes, ['multicombo'])) {
  206. conditionValue = value.map ? value.map(function (v) {
  207. return v.value;
  208. }).join(',') : '';
  209. } else {
  210. conditionValue = value;
  211. }
  212. return conditionValue;
  213. },
  214. getExtraParams: function (store, op, condition) {
  215. var temp = {};
  216. for (let x = 0; x < condition.length; x++) {
  217. let c = condition[x];
  218. if (c.field == 'keyword') {
  219. temp.keyword = c.value;
  220. } else if (c.field == 'date') {
  221. temp.fromDate = new Date(c.value.split(',')[0]).getTime();
  222. temp.endDate = new Date(c.value.split(',')[1]).getTime();
  223. } else if (c.field == 'quoted') {
  224. temp.quoted = c.value == 'all' ? null : c.value;
  225. } else if (c.field == 'closed') {
  226. // temp.endDate = c.value == 'all' ? null : (
  227. // c.value == '0' ?
  228. // );
  229. }
  230. }
  231. let obj = {
  232. pageNumber: store.exportNumber ? store.exportNumber : op._page,
  233. pageSize: store.exportPageSize ? store.exportPageSize : store.pageSize
  234. };
  235. for (let k in temp) {
  236. if (!!temp[k]) {
  237. obj[k] = temp[k];
  238. }
  239. }
  240. return obj;
  241. },
  242. });