| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428 |
- /**
- * setBarcodeRule的Form
- */
- Ext.define('erp.view.scm.reserve.SetBarcodeRuleForm',{
- extend: 'Ext.form.Panel',
- alias: 'widget.erpSetBarcodeRuleForm',
- id: 'form',
- title : caller=='BarCodeSet!BATCH'?'条码产生规则维护':'包装箱号产生规则维护',
- frame : true,
- layout: 'column',
- autoScroll : true,
- defaultType : 'textfield',
- labelSeparator : ':',
- buttonAlign : 'center',
- cls: 'u-form-default',
- enableTools: true,
- fieldDefaults : {
- fieldStyle : "background:#FFFAFA;color:#515151;",
- focusCls: 'x-form-field-cir-focus',
- labelAlign : "right",
- msgTarget: 'side',
- blankText : $I18N.common.form.blankText
- },
- //requires: ['erp.view.common.JProcess.SetNodeGridPanel','erp.view.oa.task.TaskPanel'],
- FormUtil: Ext.create('erp.util.FormUtil'),
- BaseUtil: Ext.create('erp.util.BaseUtil'),
- items : [{ xtype : "container",
- html : '<div class="x-form-group-label" id="group1" style="background-color: #bfbfbe;height:22px!important;" title="收拢"><h6>'+(caller=='BarCodeSet!BATCH'?"P+V+D+N":"P+N")+'</h6></div>',
- columnWidth:1,
- style:"padding-bottom: 4px;"
- },{
- allowBlank:false,
- allowDecimals:false,
- cls:"form-field-allowBlank-hidden",
- columnWidth:0.25,
- dataIndex:"bs_id",
- editable:true,
- fieldLabel:"ID",
- fieldStyle:"background:#E0E0FF;color:#515151;",
- id:"bs_id",
- labelAlign:"left",
- name:"bs_id",
- readOnly:true,
- table:"BarcodeSet",
- xtype:"hidden"
- },{
- allowBlank:false,
- allowDecimals:false,
- cls:"form-field-allowBlank-hidden",
- columnWidth:0.25,
- dataIndex:"bs_type",
- editable:true,
- fieldLabel:"类型",
- fieldStyle:"background:#E0E0FF;color:#515151;",
- id:"bs_type",
- labelAlign:"left",
- name:"bs_type",
- readOnly:true,
- value : formCondition.split("=")[1].replace(/'/g,""),
- table:"BarcodeSet",
- xtype:"hidden"
- },{
- allowBlank:false,
- allowDecimals:false,
- cls:"form-field-allowBlank",
- columnWidth:0.25,
- dataIndex:"bs_lenprid",
- editable:true,
- fieldLabel:"物料长度(P)",
- fieldStyle:"background:#FFFAFA;color:#515151;",
- id:"bs_lenprid",
- labelAlign:"left",
- name:"bs_lenprid",
- table:"BarcodeSet",
- xtype:"numberfield"
- },{
- allowBlank:false,
- allowDecimals:false,
- cls:"form-field-allowBlank",
- columnWidth:0.25,
- dataIndex:"bs_lenveid",
- editable:true,
- fieldLabel:"供应商长度(V)",
- fieldStyle:"background:#FFFAFA;color:#515151;",
- id:"bs_lenveid",
- labelAlign:"left",
- name:"bs_lenveid",
- table:"BarcodeSet",
- xtype:caller=='BarCodeSet!BATCH'?"numberfield":"hidden"
- },{
- allowBlank:true,
- allowDecimals:false,
- cls:"form-field-allowBlank",
- columnWidth:0.25,
- dataIndex:"bs_datestr",
- displayField: 'display',
- valueField: 'value',
- editable:true,
- fieldLabel:"日期信息(D)",
- fieldStyle:"background:#FFFAFA;color:#515151;",
- id:"bs_datestr",
- labelAlign:"left",
- name:"bs_datestr",
- table:"BarcodeSet",
- xtype:caller=='BarCodeSet!BATCH'?"combo":"hidden",
- store:Ext.create("Ext.data.Store",{
- fields:["display","value"],
- data : [{display: "YYMMDD", value: "YYMMDD"},
- {display: "YYMM", value: "YYMM"},
- {display: "MMDD", value: "MMDD"},
- {display: "无", value: "0"}]
- })
- },{
- allowBlank:true,
- allowDecimals:false,
- cls:"form-field-allowBlank",
- columnWidth:0.25,
- dataIndex:"bs_lennum",
- editable:true,
- fieldLabel:"流水长度(N)",
- fieldStyle:"background:#FFFAFA;color:#515151;",
- id:"bs_lennum",
- labelAlign:"left",
- name:"bs_lennum",
- table:"BarcodeSet",
- xtype:"numberfield"
- },{
- xtype : "container",
- html : '<div class="x-form-group-label" id="group2" style="background-color: #bfbfbe;height:22px!important;" title="收拢2"><h6>其他信息</h6></div>',
- columnWidth:1,
- style:"padding-bottom: 4px;"
- },{
- cls:"form-field-allowBlank",
- columnWidth:0.25,
- dataIndex:"bs_maxnum",
- editable:true,
- fieldLabel:"当前流水",
- fieldStyle:"background:#E0E0FF;color:#515151;",
- id:"bs_maxnum",
- labelAlign:"left",
- name:"bs_maxnum",
- readOnly:true,
- table:"BarcodeSet",
- value:"0",
- xtype:"textfield"
- },{
- cls:"form-field-allowBlank",
- columnWidth:0.25,
- dataIndex:"bs_totallen",
- editable:true,
- fieldLabel:"总长度",
- fieldStyle:"background:#E0E0FF;color:#515151;",
- id:"bs_totallen",
- labelAlign:"left",
- name:"bs_totallen",
- readOnly:true,
- table:"BarcodeSet",
- value:"",
- xtype:"numberfield"
- },{
- cls:"form-field-allowBlank",
- columnWidth:0.25,
- dataIndex:"bs_recorder",
- editable:true,
- fieldLabel:"录入人",
- fieldStyle:"background:#E0E0FF;color:#515151;",
- id:"bs_recorder",
- labelAlign:"left",
- name:"bs_recorder",
- readOnly:true,
- table:"BarcodeSet",
- value:"",
- xtype:"textfield"
- },{
- cls:"form-field-allowBlank",
- columnWidth:0.25,
- dataIndex:"bs_date",
- editable:true,
- fieldLabel:"录入日期",
- fieldStyle:"background:#E0E0FF;color:#515151;",
- id:"bs_date",
- labelAlign:"left",
- name:"bs_date",
- readOnly:true,
- table:"BarcodeSet",
- value:"",
- xtype:"datefield"
- },{
- cls:"form-field-allowBlank",
- columnWidth:0.25,
- dataIndex:"bs_maxdate",
- editable:true,
- fieldLabel:"上次日期",
- fieldStyle:"background:#E0E0FF;color:#515151;",
- id:"bs_maxdate",
- labelAlign:"left",
- name:"bs_maxdate",
- readOnly:true,
- table:"BarcodeSet",
- value:"",
- xtype:caller=='BarCodeSet!BATCH'?"textfield":"hidden"
- }],
- buttonAlign:'center',
- buttons:[{
- xtype: 'erpSaveButton',
- id:"saveButton"
- },{
- xtype: 'erpUpdateButton',
- id:"updateButton"
- },{
- xtype: 'erpCloseButton',
- id:'close'
- }],
- initComponent : function(){
- var me = this;
- me.FormUtil=Ext.create('erp.util.FormUtil');
- me.GridUtil=Ext.create('erp.util.GridUtil');
- me.BaseUtil=Ext.create('erp.util.BaseUtil');
- formCondition = getUrlParam('formCondition');
- this.getData();
- this.callParent(arguments);
- if(this.enableTools) {
- me.setTools();
- }
- },
- /**
- * FormHeader Tools
- * 包括:查看日志、查看流程、查看列表、最大化、最小化、刷新、关闭、上一条、下一条
- */
- setTools: function(){
- var datalistId = getUrlParam('datalistId');
- this.tools = [{
- type: 'search',
- tooltip: '查看单据日志',
- listeners:{
- click: function(btn){
- var form = Ext.getCmp('form');
- var id = Ext.getCmp(form.keyField).value;
- if(id != null && id != 0){
- form.getLogs(id);
- }
- }
- }
- },{
- type: 'save',
- tooltip: '导出Excel',
- listeners:{
- click: function(btn){
- var form = Ext.getCmp('form');
- var id = Ext.getCmp(form.keyField).value;
- form.saveAsExcel(id,caller);
- }
- }
- },{
- type: 'maximize',
- tooltip: '最大化',
- listeners:{
- click: function(btn){
- var height = window.screen.height*0.87;
- var width = window.screen.width;
- //弹出框显示,可以锁定住地址栏和工具栏,防止用户不合理操作
- window.open(window.location.href, '', 'width=' + width + ',height=' + height + ',top=0,left=0,toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
- }
- }
- },{
- type: 'minus',
- tooltip: '最小化',
- listeners:{
- click: function(btn){
- var p = parent.Ext.getCmp('content-panel');
- if(p){
- var t = p.getActiveTab();
- var b = parent.Ext.getCmp('bottom');
- if(b){
- b.insert(4, {
- text: t.title,
- tooltip: t.tabConfig.tooltip,
- tab: t,
- handler: function(btn){
- var a = p.add(btn.tab);
- p.setActiveTab(a);
- btn.destroy();
- }
- });
- p.remove(t, false);//并不销毁
- }
- }
- }
- }
- },{
- type: 'refresh',
- tooltip: '刷新',
- listeners:{
- click: function(btn){
- var form = btn.up('form');
- if(typeof form.refresh === 'function')
- form.refresh.call(null, form);
- else
- window.location.reload();
- }
- }
- }];
- },
- /**
- * 拿到操作日志
- */
- getLogs: function(id){
- if(Ext.getCmp('win' + id)){
- Ext.getCmp('win' + id).show();
- } else {
- Ext.Ajax.request({//拿到grid的columns
- url : basePath + 'common/getMessageLogs.action',
- async: false,
- params: {
- caller: caller,
- id: id
- },
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res.exception || res.exceptionInfo){
- showError(res.exceptionInfo);
- return;
- }
- var logs = res.logs;
- logs = logs.length == 0 ? [{ml_date: $I18N.common.grid.emptyText, ml_man: $I18N.common.grid.emptyText,
- ml_content: $I18N.common.grid.emptyText, ml_result: $I18N.common.grid.emptyText}] : logs;
- Ext.create('Ext.window.Window', {
- id : 'win' + id,
- title: '<span style="color:#CD6839;">操作日志</span>',
- iconCls: 'x-button-icon-set',
- closeAction: 'hide',
- height: "100%",
- width: "80%",
- maximizable : true,
- buttonAlign : 'center',
- layout : 'anchor',
- items: [{
- anchor: '100% 100%',
- xtype: 'gridpanel',
- ignore: true,
- bodyStyle: 'background:#f1f1f1;',
- autoScroll: true,
- store: Ext.create('Ext.data.Store', {
- fields: ['ml_date', 'ml_man', 'ml_content', 'ml_result'],
- data: logs
- }),
- columnLines: true,
- columns: [
- { header: '时间', dataIndex: 'ml_date', flex: 1.5 , renderer: function(val){
- if(val != '无数据'){
- return Ext.Date.format(new Date(val), 'Y-m-d H:i:s');
- }
- }},
- { header: '操作人员', dataIndex: 'ml_man', flex: 1 ,renderer: function(val){
- if(val == em_name){
- return '<font color=red>' + val + '</font>';
- } else {
- return val;
- }
- }},
- { header: '操作', dataIndex: 'ml_content', flex: 1.5},
- { header: '结果', dataIndex: 'ml_result', flex: 3}
- ]
- }],
- buttons : [{
- text : '关 闭',
- iconCls: 'x-button-icon-close',
- cls: 'x-btn-gray',
- handler : function(){
- Ext.getCmp('win' + id).close();
- }
- }]
- }).show();
- }
- });
- }
- },
- saveAsExcel:function(id,caller){
- if(id==null || id =='') showMessage('提示','无法导出空数据单据',1000);
- else window.location.href=basePath+'excel/savePanelAsExcel.action?id='+id+"&caller="+caller+"&_noc=1";
- },
- getData:function(){
- var me = this;
- //从url解析参数
- if(formCondition != null && formCondition != ''){
- Ext.Ajax.request({
- url : basePath + 'scm/reserve/getBarcodeRuleData.action',
- params: {
- caller: caller,
- condition: formCondition.split("&")[0],
- _noc: (getUrlParam('_noc') || me._noc)
- },
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo != null){
- showError(res.exceptionInfo);return;
- }else{
- Ext.getCmp("saveButton").hide();
- me.setFormValues(res.data);
- }
- }
- });
- }else{
- Ext.Ajax.request({
- url : basePath + "scm/reserve/getCurrent.action",
- params: {},
- method : 'post',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo != null){
- showError(res.exceptionInfo);return;
- }
- if(res.man&&res.date){
- Ext.getCmp("bs_recorder").setValue(res.man);
- Ext.getCmp("bs_date").setValue(res.date);
- }
- }
- });
- Ext.getCmp("updateButton").hide();
- }
- },
- setFormValues : function(data){
- var form = Ext.getCmp('form');
- form.getForm().setValues(data);
- }
- });
|