| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- /**
- * 商机-公司商机
- */
- Ext.define('saas.view.sale.business.Business', {
- extend: 'saas.view.core.base.BasePanel',
- xtype: 'sale-business-business',
- controller: 'sale-business-business',
- viewModel: 'sale-business-business',
- viewName: 'sale-business-business',
- // dataUrl: 'http://10.1.80.23:8560/api/sale/sale/enterprise/businessChance',
- dataUrl: '/api/sale/sale/enterprise/businessChance',
- initComponent: function() {
- var me = this;
- Ext.apply(this, {
- searchField: [{
- xtype: 'textfield',
- name: 'keyword',
- columnWidth: 0.15,
- emptyText:'请输入物料编号/名称/型号/品牌'
- }, {
- xtype: 'condatefield',
- name: 'date',
- fieldLabel: '日期',
- labelWidth: 50,
- columnWidth: 0.4,
- }, {
- xtype: 'combobox',
- name: 'quoted',
- fieldLabel: '报价状态',
- queryMode: 'local',
- displayField: 'name',
- valueField: 'value',
- emptyText :'全部',
- editable:false,
- labelWidth: 80,
- columnWidth: 0.2,
- store: Ext.create('Ext.data.ArrayStore', {
- fields: ['name', 'value'],
- data: [
- ["全部", "all"],
- ["未报价", "0"],
- ["已报价", "1"]
- ]
- })
- // }, {
- // xtype: 'combobox',
- // name: 'closed',
- // fieldLabel: '截止状态',
- // queryMode: 'local',
- // displayField: 'name',
- // valueField: 'value',
- // emptyText :'全部',
- // editable:false,
- // columnWidth: 0.2,
- // store: Ext.create('Ext.data.ArrayStore', {
- // fields: ['name', 'value'],
- // data: [
- // ["全部", "all"],
- // ["未截止", "0"],
- // ["已截止", "1"]
- // ]
- // })
- }],
-
- caller: null,
- _formXtype: null,
- _title: null,
- _deleteUrl: null,
- _batchOpenUrl: null,
- _batchCloseUrl: null,
- _batchDeleteUrl: null,
-
- gridConfig: {
- idField: null,
- codeField: null,
- statusCodeField: null,
- dataUrl: me.dataUrl,
- caller: null,
- rootProperty: 'data.content',
- totalProperty: 'data.totalElements',
- actionColumn: [],
- selModel: {
- type: 'cellmodel'
- },
- hiddenTools: true,
- data: [{
- }],
- columns : [{
- text: '客户名称',
- dataIndex: 'custName',
- width: 200
- }, {
- text: '物料品牌',
- dataIndex: 'prodBrand',
- width: 100
- }, {
- text: '物料名称',
- dataIndex: 'prodName',
- width: 120
- }, {
- text: '物料型号',
- dataIndex: 'prodOrispeccode',
- width: 120
- }, {
- text: '物料规格',
- dataIndex: 'prodSpec',
- width: 120
- }, {
- text: '物料单位',
- dataIndex: 'prodUnit'
- }, {
- text: '采购数量',
- xtype: 'numbercolumn',
- dataIndex: 'needQty',
- renderer: function (v, m, r) {
- return saas.util.BaseUtil.numberFormat(v, 0, false);
- }
- }, {
- text: '发布时间',
- xtype: 'datecolumn',
- dataIndex: 'startDate',
- format: 'Y-m-d H:i:s'
- }, {
- text: '截止时间',
- xtype: 'datecolumn',
- dataIndex: 'endDate'
- }, {
- text: '操作',
- dataIndex: 'quoted',
- renderer: function(v, m) {
- return v == 1 ? '<a style="color: green; cursor: pointer;">报价中</a>' : '<a style="color: #35BAF6; cursor: pointer;">报价</a>';
- },
- listeners: {
- click: function(tableView, td, rowIdx, colIdx, e, model, tr) {
- var dataIndex = this.dataIndex;
- var record = tableView.store.getAt(rowIdx);
- var value = record.get(dataIndex);
-
- if(value == '0') {
- me.getController().showQuoteWin(record);
- }
- }
- }
- }]
- },
- });
- this.callParent(arguments);
- },
- /**
- * 处理部分字段值
- */
- getConditionValue: function (field, value) {
- var me = this,
- xtypes = field.getXTypes().split('/'),
- conditionValue;
- if (me.isContainsAny(xtypes, ['datefield'])) {
- conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s');
- } else if (me.isContainsAny(xtypes, ['conmonthfield'])) {
- var from = value.from,
- to = value.to;
- conditionValue = from + ',' + to;
- } else if (me.isContainsAny(xtypes, ['condatefield'])) {
- var from = value.from,
- to = value.to;
- 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');
- } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) {
- conditionValue = value;
- } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) {
- conditionValue = value;
- } else if (me.isContainsAny(xtypes, ['multicombo'])) {
- conditionValue = value.map ? value.map(function (v) {
- return v.value;
- }).join(',') : '';
- } else {
- conditionValue = value;
- }
- return conditionValue;
- },
- getExtraParams: function(store, op, condition) {
- var temp = {};
- for(let x = 0; x < condition.length; x++) {
- let c = condition[x];
- if(c.field == 'keyword') {
- temp.keyword = c.value;
- }else if(c.field == 'date') {
- temp.fromDate = new Date(c.value.split(',')[0]).getTime();
- temp.endDate = new Date(c.value.split(',')[1]).getTime();
- }else if(c.field == 'quoted') {
- temp.quoted = c.value == 'all' ? null : c.value;
- }else if(c.field == 'closed') {
- // temp.endDate = c.value == 'all' ? null : (
- // c.value == '0' ?
- // );
- }
- }
- let obj = {
- pageNumber: store.exportNumber?store.exportNumber:op._page,
- pageSize: store.exportPageSize?store.exportPageSize:store.pageSize
- };
- for(let k in temp) {
- if(!!temp[k]) {
- obj[k] = temp[k];
- }
- }
- return obj;
- },
- });
|