暂存。
define([ 'talent' ,'templates/managementunit' ,'standard-page' ,'old-standard-page' ,'detail-page' ,'small-err-dialog' ,'views/managementunit/unitdetailpage/tablesource-view' ,'baseform' ],function( Talent ,jst ,StandardPage ,OldStandardPage ,DetailPageView ,SimpleErrorView ,TableSource ,BaseForm ) { var MainView = Talent.Layout.extend({ template:_.template('<div class ="standard_page_wrap"></div><div class ="forms-section2"></div>') //template:jst["managementunit/unitdetailpage/index-page"] ,initialize: function(options) { var self = this; Talent.app.request("history:getQueryObject").done(function(obj) { self.pageState = obj.pageState; self.pageName = obj.pageName; self.id = obj.id; }); this.pageOptions = Talent.getPageConfig(self.pageName, { pageState: this.pageState ,pageName: this.pageName ,metaObjName:this.metaObjName }); $.ajax({ url:'/managementunit/GetManagementRange' ,type:"GET" ,data:{ id:self.id //id:'3FE63E20-53B2-4544-AB93-C7B090A92DE9' } ,success:function(resp){ self.tableView = new TableSource(resp); debugger self.manageArea.show(self.tableView); } }); //this.standardPage = new pageType[this.pageState+"-page"](this.pageOptions); } ,regions: { formsArea:'.forms-section1' ,manageArea:'.forms-section2' ,standardPageWrap:'.standard_page_wrap' } ,events:function(){ var events = {}; return events; } ,onShow: function() { var self = this; var iWait = function(def){ var def = $.Deferred(); $.ajax({ data: { id: self.id ,metaObjName: self.pageOptions.metaObjName ,pageType: 2 } ,url: "/MultiTenant/GetPageView" }).done(function(resp){ //a.substring(a.indexOf("_")+1) self.pageOptions = _.extend(self.pageOptions,resp); def.resolve(self.pageOptions); //this.pageOptions = resp; }).fail(function(){ }) return def.promise(); }; iWait() .done(function(data){ $.ajax({ url:'/managementunit/getdata' ,type:"GET" ,data:{ metaObjName:self.metaObjName ,pageType:'2' ,id:self.id } ,success:function(resp){ var tempData = data.wrappers.contentWrap[0].pageModules[1].viewParams[0].data.regions['part-1'] var mixedFields= []; _.each(tempData.fields,function(field) { var _field = $.extend(true,{},field);//temple for (var key in resp) { debugger //search text from formdatalist if (key == _field.data.name.substring(_field.data.name.indexOf("_")+1)) { _field.data.value = resp[key]||""; _field.data.text = _field.data.value; break; } } mixedFields.push(_field); }); tempData.fields = mixedFields; self.standardPage = new StandardPage.DetailPage(self.pageOptions); self.standardPageWrap.show(self.standardPage); },error:function(resp){ console.log('请求数据异常') } }); }) //self.pageOptions = _.extend(self.pageOptions,resp); //字符串处理 //a.substring(a.indexOf("_")+1) //数据路径 //resp.wrappers.contentWrap[0].pageModules[1].viewParams[0].data.regions //数据注入 //{Name:mou1,Title:mou1,POId:00000000-0000-0000-0000-000000000000,Description:,Status:, // $.ajax({ // data: { // id: this.id // ,metaObjName: this.pageOptions.metaObjName // ,pageType: 2 // } // ,url: "/MultiTenant/GetPageView" // }).success(function(resp){ // //a.substring(a.indexOf("_")+1) // //resp.wrappers.contentWrap[0].pageModules[1].viewParams[0].data.regions["part-1"] // debugger // self.pageOptions = _.extend(self.pageOptions,resp); // //this.pageOptions = resp; // self.standardPage = new StandardPage.DetailPage(self.pageOptions); // self.standardPageWrap.show(self.standardPage); // }); } ,onClose:function(){ } //数据注入模板 ,mixDataWithTemplate:function(resp) { //clear text of every form-item for (key in resp.formView.regions) { if (/^part\-/g.test(key)) { _.each(resp.formView.regions[key].fields,function(field) { field.data.value = null; field.data.text = null; }); } } var modules=[]; _.each(resp.formDataList,function(item) { //deal with regions:part-* var sModule = $.extend(true,{},resp.formView); for (key in sModule.regions) { var mixedFields= []; if (/^part\-/g.test(key)) { _.each(sModule.regions[key].fields,function(field) { var _field = $.extend(true,{},field);//temple for (var key in item) { //search text from formdatalist if (key == _field.data.name) { _field.data.value = item[key]||""; _field.data.text = _field.data.value; break; } } mixedFields.push(_field); }); sModule.regions[key].fields = mixedFields; } } //deal with regions:reserved //... //get id of sModule if("ID" in item){ sModule.OId = item.ID; }else{ alert("resp data is not in formatted:no id in sub-object!"); } modules.push(sModule); }); if (!modules.length) { resp.hasNoFormContent = true; modules.push(resp); } return modules; } }); return Talent.BasePageView.extend({ initialize: function(){ var self = this; this.options.hideSidebar = true; Talent.app.request("history:getQueryObject").done(function(obj) { var pageName = obj.pageName; var pageState = obj.pageState; self.pageTitle = Talent.getPageConfig(pageName)[pageState+"PageTitle"]; }); } ,mainViewClass : MainView }); }); /*define([ 'talent' ,'templates/managementunit' ,'standard-page' ,'old-standard-page' ,'detail-page' ,'small-err-dialog' ,'views/managementunit/unitdetailpage/tablesource-view' ,'baseform' ],function( Talent ,jst ,StandardPage ,OldStandardPage ,DetailPageView ,SimpleErrorView ,TableSource ,BaseForm ) { var MainView = Talent.Layout.extend({ template:jst["managementunit/unitdetailpage/index-page"] ,className:'multi-forms' ,initialize: function(options) { var self = this; Talent.app.request("history:getQueryObject").done(function(obj) { self.pageState = obj.pageState; self.pageName = obj.pageName; self.id = obj.id; }); //page options this.this.pageOptions = Talent.getOldPageConfig(self.pageName, { pageState: this.pageState ,pageName: this.pageName ,metaObjName:this.metaObjName }); } ,ui:{ 'footer':'.forms-footer' } ,regions: { formsArea:'.forms-section1' ,manageArea:'.forms-section2' } ,onShow: function() { var metaArgu = { metaObjName:this.pageOptions.metaObjName ,viewName:'SystemManage.ManagementUnitShowFormView' }; var self = this; //暂存请求参数 -yfc var reData = { metaObjName:this.pageOptions.metaObjName ,pageType:'2' ,id:self.id }; $.ajax({ url:'/MultiTenant/GetPageView' ,data:reData ,success:function(resp){ resp = $.extend(true,resp,metaArgu); var formArgu = { "data":resp ,"formState":"show" }; $.ajax({ url:'/managementunit/GetManagementRange' ,type:"GET" ,data:{ id:self.id } ,success:function(resp){ } }); $.ajax({ url:'/managementunit/getdata' ,type:"GET" ,data:reData ,success:function(resp){ } }); formArgu.metaObjName = self.pageOptions.metaObjName; // formArgu = $(true,formArgu,metaArgu); self.multiFormViews = new BaseForm(formArgu); self.formsArea.show(self.multiFormViews); //2.create and show table var tableData = resp.tableSource; //实例化之前插入 -yfc tableData.reData = reData; self.tableView = new TableSource(tableData); self.manageArea.show(self.tableView); //show footer self.ui.footer.toggleClass('hide-region'); } }) } }); return Talent.BasePageView.extend({ initialize: function(){ var self = this; this.options.hideSidebar = true; Talent.app.request("history:getQueryObject").done(function(obj) { var pageName = obj.pageName; var pageState = obj.pageState; self.pageTitle = Talent.getOldPageConfig(pageName)[pageState+"PageTitle"]; }); } ,mainViewClass : MainView }); }); */
理可顿悟,事须渐修。