/** * 商机-公司商机 */ Ext.define('saas.view.sale.b2b.Business', { extend: 'saas.view.core.base.BasePanel', xtype: 'sale-b2b-business', controller: 'sale-b2b-business', viewModel: 'sale-b2b-business', viewName: 'sale-b2b-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.2, emptyText: '物料名称/型号/品牌' }, { xtype: 'condatefield', name: 'date', fieldLabel: '日期', labelWidth: 50, columnWidth: 0.4, }, { xtype: 'combobox', name: 'quoted', fieldLabel: '报价状态', queryMode: 'local', displayField: 'name', valueField: 'value', emptyText: '未报价', value: '0', editable: false, labelWidth: 80, columnWidth: 0.2, store: Ext.create('Ext.data.ArrayStore', { fields: ['name', 'value'], data: [ ["未报价", "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', width: 150 }, { text: '截止时间', xtype: 'datecolumn', dataIndex: 'endDate', format: 'Y-m-d H:i:s', width: 150 }, { text: '报价状态', dataIndex: 'quoted', textAlign: 'center', renderer: function (val, meta, record, x, y, store, view) { if (val == 0) { return '
未报价
'; } else { var qutations = record.data.qutations; if (qutations.agreed == null) { return '
已报价
'; } else if (qutations.agreed == 1) { return '
被采纳
'; } else if (qutations.agreed == 0) { return '
被拒绝
'; } } } }, { text: '操作', dataIndex: 'quoted', renderer: function (val, meta, record, x, y, store, view) { if (val == 0) { return '
点击报价
'; } else { var qutations = record.data.qutations; if (qutations.agreed == null) { return '
查看报价信息
'; } else if (qutations.agreed == 1) { return '
查看报价信息
'; } else if (qutations.agreed == 0) { return '
查看报价信息
'; } } }, 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); me.getController().showQuoteWin(record, !!value); }, } }], listeners: { itemmouseenter: function (view, record, item, index, e, eOpts) { var grid = view.up('grid'); grid.focusRecord = 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; }, });