123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721 |
- /**
- * softVersionLib的Form
- */
- Ext.define('erp.view.scm.product.SoftVersionLibForm',{
- extend: 'Ext.form.Panel',
- alias: 'widget.erpSoftVersionLibForm',
- id: 'form',
- title : '软件版本维护',
- frame : true,
- layout: 'column',
- autoScroll : true,
- defaultType : 'textfield',
- 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
- },
- FormUtil: Ext.create('erp.util.FormUtil'),
- BaseUtil: Ext.create('erp.util.BaseUtil'),
- items : [{
- allowBlank:false,
- allowDecimals:false,
- cls:"form-field-allowBlank-hidden",
- columnWidth:0.25,
- dataIndex:"sl_id",
- editable:true,
- fieldLabel:"ID",
- fieldStyle:"background:#E0E0FF;color:#515151;",
- id:"sl_id",
- labelAlign:"left",
- name:"sl_id",
- readOnly:true,
- table:"SoftVersionLib",
- xtype:"hidden"
- },{
- allowBlank:false,
- cls:"form-field-allowBlank",
- columnWidth:0.25,
- dataIndex:"sl_code",
- editable:true,
- fieldLabel:"<font color='red'>版本号</font>",
- labelSeparator : "<font color='red'>:</font>",
- fieldStyle:"background:#FFFAFA;color:#515151;",
- id:"sl_code",
- labelAlign:"left",
- name:"sl_code",
- table:"SoftVersionLib",
- xtype:"textfield"
- },{
- allowBlank:false,
- cls:"form-field-allowBlank",
- columnWidth:0.25,
- dataIndex:"sl_name",
- editable:true,
- fieldLabel:"<font color='red'>版本名称</font>",
- labelSeparator : "<font color='red'>:</font>",
- fieldStyle:"background:#FFFAFA;color:#515151;",
- id:"sl_name",
- labelAlign:"left",
- name:"sl_name",
- table:"SoftVersionLib",
- xtype:"textfield"
- },{
- allowBlank:true,
- allowDecimals:false,
- cls:"form-field-allowBlank",
- columnWidth:0.25,
- dataIndex:"sl_platform",
- editable:true,
- fieldLabel:"平台",
- fieldStyle:"background:#FFFAFA;color:#515151;",
- labelSeparator : ":",
- id:"sl_platform",
- labelAlign:"left",
- name:"sl_platform",
- table:"SoftVersionLib",
- xtype:"textfield"
- },{
- cls:"form-field-allowBlank",
- columnWidth:0.25,
- dataIndex:"sl_status",
- editable:true,
- fieldLabel:"状态",
- labelSeparator : ":",
- fieldStyle:"background:#E0E0FF;color:#515151;",
- id:"sl_status",
- labelAlign:"left",
- name:"sl_status",
- readOnly:true,
- table:"SoftVersionLib",
- value:"在录入",
- xtype:"textfield"
- },{
- cls:"form-field-allowBlank",
- columnWidth:0.25,
- dataIndex:"sl_inman",
- editable:true,
- fieldLabel:"录入人",
- labelSeparator : ":",
- fieldStyle:"background:#E0E0FF;color:#515151;",
- id:"sl_inman",
- labelAlign:"left",
- name:"sl_inman",
- readOnly:true,
- table:"SoftVersionLib",
- value:"",
- xtype:"textfield"
- },{
- cls:"form-field-allowBlank",
- columnWidth:0.25,
- dataIndex:"sl_indate",
- editable:true,
- fieldLabel:"录入日期",
- labelSeparator : ":",
- fieldStyle:"background:#E0E0FF;color:#515151;",
- id:"sl_indate",
- labelAlign:"left",
- name:"sl_indate",
- readOnly:true,
- table:"SoftVersionLib",
- value:"",
- xtype:"datefield"
- },{
- cls:"form-field-allowBlank",
- columnWidth:0.25,
- dataIndex:"sl_statuscode",
- editable:true,
- fieldLabel:"状态码",
- id:"sl_statuscode",
- labelAlign:"left",
- name:"sl_statuscode",
- table:"SoftVersionLib",
- value:"ENTERING",
- xtype:"hidden"
- },{
- cls:"form-field-allowBlank",
- columnWidth:0.5,
- dataIndex:"sl_remark",
- editable:true,
- fieldLabel:"备注",
- fieldStyle:"background:#FFFAFA;color:#515151;",
- id:"sl_remark",
- labelAlign:"left",
- name:"sl_remark",
- table:"SoftVersionLib",
- value:"",
- xtype:"textfield"
- }],
- buttonAlign:'center',
- buttons:[{
- xtype: 'erpAddButton',
- id:"addButton"
- },{
- xtype: 'erpSaveButton',
- id:"saveButton"
- },{
- xtype: 'erpUpdateButton',
- id:"updateButton"
- },{
- xtype: 'erpEnableButton',
- id:"enableButton"
- },{
- xtype: 'erpForBiddenButton',
- id:"forbiddenButton"
- },{
- 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: 'expand',
- tooltip: '查看流程处理',
- listeners:{
- click: function(btn){
- var form = btn.ownerCt.ownerCt;
- if(!form.statuscodeField){
- btn.disable(true);
- } else {
- var f = form.statuscodeField;
- if(!Ext.getCmp(f) || Ext.getCmp(f).value == 'ENTERING'){
- btn.disable(true);
- } else {
- var id = Ext.getCmp(form.keyField).value;
- if(id != null && id != 0){
- form.getProcess(id);
- }
- }
- }
- }
- }
- },{
- type: 'gear',
- tooltip: '设置流程处理人',
- listeners:{
- click: function(btn){
- var form = btn.ownerCt.ownerCt;
- if(!form.statuscodeField){
- btn.disable(true);
- } else {
- var f = form.statuscodeField;
- if(!Ext.getCmp(f) || Ext.getCmp(f).value == 'ENTERING'){
- btn.disable(true);
- } else {
- var id = Ext.getCmp(form.keyField).value;
- if(id != null && id != 0){
- form.SetNodeDealMan(id);
- }
- }
- }
- }
- }
- },{
- type: 'collapse',
- tooltip: '查看列表',
- listeners:{
- click: function(btn){
- if(parent.Ext) {
- Ext.Ajax.request({
- url: basePath + 'common/getFieldData.action',
- params: {
- caller: 'Datalist',
- field: 'count(*)',
- condition: 'dl_caller=\'' + caller + '\''
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if(rs.exceptionInfo) {
- showError(localJson.exceptionInfo);return null;
- } else if(rs.success && rs.data){
- var datalist = parent.Ext.getCmp(datalistId);
- if(!datalist){
- var form = btn.ownerCt.ownerCt;
- var url = 'jsps/common/datalist.jsp?whoami=' + caller;
- if(btn.urlcondition){
- url += '&urlcondition=' + btn.urlcondition;
- }
- form.FormUtil.onAdd(caller + '_scan', parent.Ext.getCmp('content-panel').getActiveTab().title + 'DataList', url);
- } else {
- datalist.ownerCt.setActiveTab(datalist);
- }
- }
- }
- });
- }
- }
- }
- },{
- type: 'restore',
- tooltip: '关联查询',
- listeners:{
- click: function(btn){
- var form = btn.ownerCt.ownerCt;
- form.showRelativeQuery();
- }
- }
- },{
- 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();
- }
- }
- },{
- type: 'task',
- cls : 'custom-tool',
- tooltip: '添加任务',
- listeners : {
- click : function(btn) {
- var form = btn.ownerCt.ownerCt;
- if(!form.codeField){
- btn.disable(true);
- }
- else form.addTask(form);
- }
- }
- },{
- type:'prev',
- id: 'prev',
- tooltip: '上一条',
- listeners:{
- render: function(btn){
- if(parent.Ext) {
- var datalist = parent.Ext.getCmp(datalistId);
- if(datalist){
- var datalistStore = datalist.currentStore;
- Ext.each(datalistStore, function(){
- if(this.selected == true){
- if(this.prev == null){
- btn.disable(true);
- }
- }
- });
- } else {
- btn.disable(true);
- }
- }
- },
- click: function(btn){
- var datalist = parent.Ext.getCmp(datalistId);
- if(datalist){
- var datalistStore = datalist.currentStore;
- var form = Ext.getCmp('form');
- var newId = 0;
- var idx = 0;
- Ext.each(datalistStore, function(s, index){
- if(this.selected == true){
- if(this.prev != null){
- newId = this.prev;
- idx = index;
- }
- }
- });
- datalistStore[idx].selected = false;
- datalistStore[idx-1].selected = true;
- var url = window.location.href;
- if(form.keyField) {
- url = url.replace(/formCondition=(\w*)(IS|=)(\d*)/, 'formCondition=$1$2' + newId);
- url = url.replace(/gridCondition=(\w*)(IS|=)(\d*)/, 'gridCondition=$1$2' + newId);
- }
- window.location.href = url;
- }
- }
- }
- },{
- type: 'next',
- id: 'next',
- tooltip: '下一条',
- listeners:{
- render: function(btn){
- if(parent.Ext) {
- var datalist = parent.Ext.getCmp(datalistId);
- if(datalist){
- var datalistStore = datalist.currentStore;
- Ext.each(datalistStore, function(){
- if(this.selected == true){
- if(this.next == null){
- btn.disable(true);
- }
- }
- });
- } else {
- btn.disable(true);
- }
- }
- },
- click: function(btn){
- var datalist = parent.Ext.getCmp(datalistId);
- if(datalist){
- var datalistStore = datalist.currentStore;
- var form = Ext.getCmp('form');
- var newId = 0;
- var idx = 0;
- Ext.each(datalistStore, function(s, index){
- if(s.selected == true){
- if(s.next != null){
- newId = s.next;
- idx = index;
- }
- }
- });
- datalistStore[idx].selected = false;
- datalistStore[idx+1].selected = true;
- var url = window.location.href;
- if(form.keyField) {
- url = url.replace(/formCondition=(\w*)(IS|=)(\d*)/, 'formCondition=$1$2' + newId);
- url = url.replace(/gridCondition=(\w*)(IS|=)(\d*)/, 'gridCondition=$1$2' + newId);
- }
- window.location.href = url;
- }
- }
- }
- },{
- type : 'pin',
- tooltip : '凭证制作',
- listeners : {
- click : function(t) {
- var form = t.ownerCt.ownerCt;
- if (form.voucherConfig) {
- form.createVoucher(form.voucherConfig);
- }
- }
- }
- },{
- type: 'unpin',
- tooltip: '使用条例与规则',
- listeners:{
- click: function(t){
- var form = t.ownerCt.ownerCt, foid = form.fo_id;
- Ext.Ajax.request({//拿到grid的columns
- url : basePath + "common/getFieldData.action",
- params: {
- caller: 'FormBook',
- field: 'fb_content',
- condition: "fb_foid='" + foid + "'"
- },
- method : 'post',
- async: false,
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo){
- showError(res.exceptionInfo);return;
- }
- if(res.success){
- var win = new Ext.window.Window({
- title: '使用条例与规则',
- height: "90%",
- width: "95%",
- maximizable : true,
- buttonAlign : 'center',
- layout : 'anchor',
- items: [{
- xtype : 'container',
- anchor : '100% 100%',
- html : res.data,
- style: 'padding: 20px;background: #fff'
- }]
- });
- win.show();
- }
- }
- });
- }
- }
- },{
- type:'plus',
- tooltip:'单据样例',
- listeners:{
- click: function(t){
- var form = t.ownerCt.ownerCt;
- Ext.Ajax.request({//拿到grid的columns
- url : basePath + 'common/form/reqDemo.action',
- async: false,
- params: {
- caller: caller
- },
- method : 'post',
- callback : function(options,success,response){
- window.open(response.responseText);
- //var res = new Ext.decode(response.responseText);
-
- }
- });
- }
- }
- },{
- type: 'help',
- tooltip: '帮助文档',
- listeners:{
- click: function(t){
- var form = t.ownerCt.ownerCt;
- form.showHelpWindow();
- }
- }
- }];
- },
- /**
- * 拿到操作日志
- */
- 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();
- }
- });
- }
- },
- showHelpWindow:function(){
- var me = this,
- win = Ext.getCmp('ext-help'),path;
- Ext.Ajax.request({
- url : basePath + 'ma/help/scan.action',
- params: {
- caller:caller
- },
- method : 'get',
- async:false,
- callback : function(opt, s, res){
- var r = new Ext.decode(res.responseText);
- if(r.exceptionInfo){
- showError(r.exceptionInfo);
- } else if(r.success){
- path=r.path;
- }
- }
- });
- if(!win) {
- win = Ext.create('Ext.Window', {
- id: 'ext-help',
- width: '90%',
- height: '100%',
- closeAction: 'hide',
- title: '帮助文档',
- modal:true,
- layout: 'border',
- items: [{
- region:'center',
- tag : 'iframe',
- layout : 'fit',
- html : '<iframe src="' + basePath + path + '" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>'
- }]
- });
- }
- win.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/product/getSoftVersionLibData.action',
- params: {
- caller: caller,
- id: formCondition.split("IS")[1],
- _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();
- if(res.data.sl_statuscode=='ENTERING'){
- Ext.getCmp("enableButton").hide();
- }else{
- Ext.getCmp('sl_code').setReadOnly(true);
- Ext.getCmp('sl_code').setFieldStyle("background:#E0E0FF;color:#515151;");
- Ext.getCmp('sl_name').setReadOnly(true);
- Ext.getCmp('sl_name').setFieldStyle("background:#E0E0FF;color:#515151;");
- Ext.getCmp('sl_platform').setReadOnly(true);
- Ext.getCmp('sl_platform').setFieldStyle("background:#E0E0FF;color:#515151;");
- Ext.getCmp('sl_remark').setReadOnly(true);
- Ext.getCmp('sl_remark').setFieldStyle("background:#E0E0FF;color:#515151;");
- Ext.getCmp("updateButton").hide();
- Ext.getCmp("forbiddenButton").hide();
- }
- //
- me.setFormValues(res.data);
- }
- }
- });
- }else{
- Ext.Ajax.request({
- url : basePath + "scm/product/getNow.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("sl_inman").setValue(res.man);
- Ext.getCmp("sl_indate").setValue(res.date);
- }
- Ext.getCmp("updateButton").hide();
- Ext.getCmp("enableButton").hide();
- Ext.getCmp("forbiddenButton").hide();
- }
- });
- }
- },
- setFormValues : function(data){
- var form = Ext.getCmp('form');
- form.getForm().setValues(data);
- }
- });
|