Ext.namespace('Shipping'); Shipping.MsRptRepairView = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsRptRepairView.superclass.constructor.call(this); }; Ext.extend(Shipping.MsRptRepairView, Ext.Panel, { OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, sqlcontext: '', sqlcontextc: '', PageSize: 100, sortfield: '', sortdire: '', bslistdrsortfield: '', bslistdrsortdire: '', bslistcrsortfield: '', bslistcrsortdire: '', initUIComponents: function () { this.formname = "MsRptRepairView"; //页面名称 this.sqlcontext = ''; this.sqlcontextc = ''; //#region 维修 this.storeListRepair = Ext.create('Ext.data.Store', { model: 'MsOpCtnRepair', pageSize: this.PageSize, remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsOpCtnBsCard/GetOpCtnRepairList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.initgirdcolums1 = [{ sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'LINKID', header: 'LINKID', width: 80 }, { sortable: true, dataIndex: 'CTNNO', header: '箱号', width: 200 }, { sortable: true, dataIndex: 'BSNO', header: '业务编号', width: 200 }, { sortable: true, dataIndex: 'AUDITSTATUS', header: '状态', width: 150 }, { sortable: true, dataIndex: 'REPAIRITEMS', header: '维修改装项目', width: 150 }, { sortable: true, dataIndex: 'REPAIRTIME', header: '维修改装日期', renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 150 }, { sortable: true, dataIndex: 'CURSTATOIN', header: '场站', width: 150 }, { sortable: true, dataIndex: 'FEENAME', header: '费用名称', width: 150 }, { sortable: true, dataIndex: 'CURRENCY', header: '币别', width: 150 }, { sortable: true, dataIndex: 'AMOUNT', header: '金额', width: 150 }, { sortable: true, dataIndex: 'IMAGE1', header: '改装前照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'IMAGE2', header: '改装后照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'REMARKS', header: '备注', width: 150 }]; this.girdcolums1 = this.initgirdcolums1; //明细表表格 this.gridListRepairCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.RepairGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridListRepair = new Ext.grid.GridPanel({ store: this.storeListRepair, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListRepairCellEditing], selModel: this.RepairGridCheckBoxModel, selType: 'cellmodel', columns: this.girdcolums1, // paging bar on the bottom bbar: Ext.create('Ext.PagingToolbar', { store: this.storeListRepair, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); this.girdcolums1 = DsTruck.GetGridPanel(USERID, this.formname+'1', this.girdcolums1, 1); //使用者id,表名,中间column数组,跳过一开始的几列 this.gridListRepair.reconfigure(this.storeListRepair, this.girdcolums1); this.gridListRepair.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; DsOpenEditWin('/MvcContainer/MsOpCtnBsCard/CtnStatusEdit?bsno=' + record.data.LINKGID, record.data.GID); }, this); this.gridListRepair.addListener('sortchange', function (ct, column, direction, eOpts) { this.bslistdrsortfield = column.dataIndex; this.bslistdrsortdire = direction; }, this); //#endregion //#region 清洗 this.storeListClearing = Ext.create('Ext.data.Store', { model: 'MsOpCtnClearing', pageSize: this.PageSize, remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsOpCtnBsCard/GetOpCtnClearingList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.initgirdcolums2=[{ sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'LINKID', header: 'LINKID', width: 80 }, { sortable: true, dataIndex: 'CTNNO', header: '箱号', width: 200 }, { sortable: true, dataIndex: 'BSNO', header: '业务编号', width: 200 }, { sortable: true, dataIndex: 'AUDITSTATUS', header: '状态', width: 150 }, { sortable: true, dataIndex: 'CURSTATOIN', header: '场站', width: 150 }, { sortable: true, dataIndex: 'INSTATOINTIME', header: '进场时间', renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 120 }, { sortable: true, dataIndex: 'IMAGE1', header: '进场照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'EIR', header: 'EIR照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'CLEARINGMODE', header: '清洗方式', width: 120 }, { sortable: true, dataIndex: 'PREGOODSNAME', header: '前装货', width: 150 }, { sortable: true, dataIndex: 'ISCLEAR_CERT', header: '是否有清洁证', hidden: true, editor: { xtype: 'checkboxfield', inputValue: '1', uncheckedValue: '0' // selectOnFocus: true }, renderer: function (value, cellmeta) { if (value == 'true' || value == '1') { return "√"; } else return ""; }, width: 60 }, { sortable: true, dataIndex: 'CHECKGOV', header: '检测机构', width: 120 }, { sortable: true, dataIndex: 'ISCLEAR_PLAN', header: '发送清洗计划', hidden: true, renderer: function (value, cellmeta) { if (value == 'true' || value == '1') { return "√"; } else return ""; }, width: 60 }, { sortable: true, dataIndex: 'CLEARTIME', header: '清洗时间', renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 120 }, { sortable: true, dataIndex: 'IMAGE_CLEAR', header: '清洗照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'IMAGE_CHECKGOV', header: '清洁证照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'ISCOMPLETE', header: '是否完成', hidden: true, renderer: function (value, cellmeta) { if (value == 'true' || value == '1') { return "√"; } else return ""; }, width: 60 }, { sortable: true, dataIndex: 'FEENAME', header: '费用名称', width: 150 }, { sortable: true, dataIndex: 'CURRENCY', header: '币别', width: 150 }, { sortable: true, dataIndex: 'AMOUNT', header: '金额', width: 150 }, { sortable: true, dataIndex: 'REMARKS', header: '备注', width: 150 }]; this.girdcolums2 = this.initgirdcolums2; //明细表表格 this.gridListClearing = new Ext.grid.GridPanel({ store: this.storeListClearing, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selType: 'cellmodel', columns: this.girdcolums2, // paging bar on the bottom bbar: Ext.create('Ext.PagingToolbar', { store: this.storeListClearing, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); this.gridListClearing.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; DsOpenEditWin('/MvcContainer/MsOpCtnBsCard/CtnStatusEdit?bsno=' + record.data.LINKGID, record.data.GID); }, this); this.girdcolums2 = DsTruck.GetGridPanel(USERID, this.formname+'2', this.girdcolums2, 1); //使用者id,表名,中间column数组,跳过一开始的几列 this.gridListClearing.reconfigure(this.storeListClearing, this.girdcolums2); this.gridListClearing.addListener('sortchange', function (ct, column, direction, eOpts) { this.bslistcrsortfield = column.dataIndex; this.bslistcrsortdire = direction; }, this); //#region formSearch 查询面板 _this = this; //#endregion formSearch this.panelRepair = new Ext.Panel({ title: '维修改装信息', layout: "border", region: 'center', animate: true, split: true, // autoScroll: true, // containerScroll: true, frame: false, items: [this.gridListRepair] }); this.panelClearing = new Ext.Panel({ title: '清洗信息', layout: "border", region: 'center', animate: true, // autoScroll: true, // containerScroll: true, frame: false, items: [this.gridListClearing] }); //#endregion this.tabpanel = new Ext.TabPanel ({ activeTab: 0, autoWidth: true, border: false, frame: false, region: 'center', id: "TabPanelID", enableTabScroll: true, items: [ this.panelRepair, this.panelClearing ] }); // this.panelTop = new Ext.Panel({ // layout: "border", // region: "north", // height: 75, // items: [this.formSearch, this.panelBtn] // }); Ext.apply(this, { items: [ this.tabpanel] }); this.sqlcontext = ''; this.storeListRepair.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext }); }, this); this.storeListClearing.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontextc }); }, this); // this.onRefreshClick(); }, //end initUIComponents InitGrid: function (grid) { var agirdcolums = grid; this.gridList.reconfigure(this.storeList, agirdcolums); }, onRefreshClick: function (button, event) { if (this.tabpanel.getActiveTab() == this.panelRepair) { var sql = this.getCondition(); this.sqlcontext = sql; this.storeListRepair.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); } else if (this.tabpanel.getActiveTab() == this.panelClearing) { var sql2 = this.getConditionc(); this.sqlcontextc = sql2; this.storeListClearing.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql2 }, waitMsg: "正在查询数据...", scope: this }); } }, onDsQuery: function () { if (this.tabpanel.getActiveTab() == this.panelRepair) { var sql = this.sqlcontext; this.storeListRepair.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); } else if (this.tabpanel.getActiveTab() == this.panelClearing) { var sql2 = this.sqlcontext; this.sqlcontextc = sql2; this.storeListClearing.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql2 }, waitMsg: "正在查询数据...", scope: this }); } }, onAuditPassClick: function () { var selections = this.gridListRepair.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择需审核的改装信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var BILLSTATUS = rec.data.AUDITSTATUS; if (BILLSTATUS == '提交审核' || BILLSTATUS == '申请修改') { bodyAddDatas.push(rec); } else { Ext.Msg.show({ title: '提示', msg: '当前状态不允许审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; } var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); _this = this; Ext.MessageBox.confirm('提示', '确定审核通过选中的业务吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在审核数据...'); Ext.Ajax.request({ waitMsg: '正在审核数据...', url: '/MvcContainer/MsOpCtnBsCard/AuditOpCtnRepair', params: { data: jsonbodyAddDatas, type: '0' }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { _this.onRefreshClick(); Ext.Msg.show({ title: '提示', msg: '审核成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, onAuditBackClick: function () { var selections = this.gridListBody.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择需驳回的单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; var BILLSTATUS = rec.data.AUDITSTATUS; if ((BILLSTATUS == '审核通过' || BILLSTATUS == '提交审核')) { bodyAddDatas.push(rec); } else { Ext.Msg.show({ title: '提示', msg: '当前状态不允许驳回!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; } var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); _this = this; Ext.MessageBox.confirm('提示', '确定驳回选中的业务吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在驳回数据...'); Ext.Ajax.request({ waitMsg: '正在驳回数据...', url: '/MvcContainer/MsOpCtnBsCard/AuditOpCtnRepair', params: { data: jsonbodyAddDatas, type: '4' }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { _this.onRefreshClick(); Ext.Msg.show({ title: '提示', msg: '驳回成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = ''; var CTNNO = form.findField('CTNNO').getValue(); sql = sql + getAndConSql(sql, CTNNO, " LINKGID in (select GID from op_ctnbscard where CTNNO like '%" + CTNNO + "%')"); var expDateBgn = form.findField('ETDbgn').getRawValue(); sql = sql + getAndConSql(sql, expDateBgn, "REPAIRTIME>='" + expDateBgn + "'"); var expDateEnd = form.findField('ETDend').getRawValue(); sql = sql + getAndConSql(sql, expDateEnd, "REPAIRTIME<='" + expDateEnd + " 23:59:59'"); var expINPUTBgn = form.findField('INPUTbgn').getRawValue(); sql = sql + getAndConSql(sql, expINPUTBgn, "INPUTTIME>='" + expINPUTBgn + "'"); var expINPUTEnd = form.findField('INPUTend').getRawValue(); sql = sql + getAndConSql(sql, expINPUTEnd, "INPUTTIME<='" + expINPUTEnd + " 23:59:59'"); return sql; }, getConditionc: function () { var form = this.formSearchClear.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = ''; var CTNNO = form.findField('CTNNO').getValue(); sql = sql + getAndConSql(sql, CTNNO, " LINKGID in (select GID from op_ctnbscard where CTNNO like '%" + CTNNO + "%')"); var expDateBgn = form.findField('ETDbgn').getRawValue(); sql = sql + getAndConSql(sql, expDateBgn, "CLEARTIME>='" + expDateBgn + "'"); var expDateEnd = form.findField('ETDend').getRawValue(); sql = sql + getAndConSql(sql, expDateEnd, "CLEARTIME<='" + expDateEnd + " 23:59:59'"); var expINPUTBgn = form.findField('INPUTbgn').getRawValue(); sql = sql + getAndConSql(sql, expINPUTBgn, "INPUTTIME>='" + expINPUTBgn + "'"); var expINPUTEnd = form.findField('INPUTend').getRawValue(); sql = sql + getAndConSql(sql, expINPUTEnd, "INPUTTIME<='" + expINPUTEnd + " 23:59:59'"); return sql; }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; return ret; }, onSaveGridClick: function (button, event) { if (this.tabpanel.getActiveTab() == this.panelRepair) { this.girdcolums1 = DsTruck.SaveGridPanel(USERID, this.formname + '1', this.gridListRepair.columns, this.girdcolums1, 1, true); } else if (this.tabpanel.getActiveTab() == this.panelClearing) { this.girdcolums2 = DsTruck.SaveGridPanel(USERID, this.formname + '2', this.gridListClearing.columns, this.girdcolums2, 1, true); } }, oninitGridClick: function (button, event) { if (this.tabpanel.getActiveTab() == this.panelRepair) { this.gridListRepair.reconfigure(this.storeListRepair, this.initgirdcolums1); this.girdcolums1 = DsTruck.SaveGridPanel(USERID, this.formname + '1', this.gridListRepair.columns, this.initgirdcolums1, 1, true); } else if (this.tabpanel.getActiveTab() == this.panelClearing) { this.gridListClearing.reconfigure(this.storeListClearing, this.initgirdcolums2); this.girdcolums2 = DsTruck.SaveGridPanel(USERID, this.formname + '2', this.gridListClearing.columns, this.initgirdcolums2, 1, true); } }, onExportClick: function (button, event) { _this = this; if (this.tabpanel.getActiveTab() == this.panelRepair) { GridExportExcelPage(this.gridListRepair); } else if (this.tabpanel.getActiveTab() == this.panelClearing) { GridExportExcelPage(this.gridListClearing); } }, Print: function () { _this = this; if (this.tabpanel.getActiveTab() == this.panelRepair) { if (this.storeListRepair.getCount() == 0) { return; } var sortstr = ' LINKGID,REPAIRTIME'; if (this.bslistdrsortfield != '' && this.bslistdrsortdire != '') { sortstr = this.bslistdrsortfield + ' ' + this.bslistdrsortdire; } Ext.Msg.wait('正在组织数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在组织数据...', url: '/MvcContainer/MsOpCtnBsCard/GetOpCtnRepairListStr', scope: this, params: { start: 0, limit: this.PageSize, condition: this.sqlcontext, sortstr: sortstr }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnstr = jsonresult.Data; var printType = 'MSRPTREPAIR'; var sql1 = returnstr; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); } else if (this.tabpanel.getActiveTab() == this.panelClearing) { if (this.storeListClearing.getCount() == 0) { return; } var sortstr = ' LINKGID,CLEARTIME'; if (this.bslistcrsortfield != '' && this.bslistcrsortdire != '') { sortstr = this.bslistcrsortfield + ' ' + this.bslistcrsortdire; } Ext.Msg.wait('正在组织数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在组织数据...', url: '/MvcContainer/MsOpCtnBsCard/GetOpCtnClearingListStr', scope: this, params: { start: 0, limit: this.PageSize, condition: this.sqlcontextc, sortstr: sortstr }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnstr = jsonresult.Data; var printType = 'MSRPTREPAIR2'; var sql1 = returnstr; var sql2 = ""; var sql3 = ""; var sql4 = ""; var sql5 = ""; var sql6 = ""; PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); } } });