UI5应用程序

时间:2018-04-12 11:19:56

标签: javascript sapui5

加载UI5应用程序时出现附加错误。我的项目名称是' NPAWRMA'我发现NPAWRMA.Component未找到错误。 请找到Component.js文件的附加代码。

请帮我解决这个问题。

此致 阿贾伊



header.view.xml

<mvc:View controllerName="NPAWRMA.controller.header" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc"
	displayBlock="true" xmlns="sap.m">
	<App id="idAppControl">
		<pages>
			<Page title="NPAW RMA Report">
				<content>
					<Table id="table" growing="true" items="{/npirev}">
						<columns>
							<Column>
								<Text text="{Labels>/Labels1/Label01}"/>
							</Column>
							<Column>
								<Text text="{Labels>/Labels1/Label02}"/>
							</Column>
							<Column>
								<Text text="{Labels>/Labels1/Label03}"/>
							</Column>
							<Column>
								<Text text="{Labels>/Labels1/Label04}"/>
							</Column>
							<Column>
								<Text text="{Labels>/Labels1/Label05}"/>
							</Column>
							<Column>
								<Text text="{Labels>/Labels1/Label06}"/>
							</Column>
							<Column>
								<Text text="{Labels>/Labels1/Label07}"/>
							</Column>
							<Column>
								<Text text="{Labels>/Labels1/Label08}"/>
							</Column>
							<Column>
								<Text text="{Labels>/Labels1/Label09}"/>
							</Column>
						</columns>
						<items>
							<ColumnListItem type="Active" press="onPress">
								<Text text="{odata>Ktext}"/>
								<Text text="{odata>Netwr}"/>
								<Text text="{odata>Netwr}"/>
								<Text text="{odata>Netwr}"/>
								<Text text="{odata>Netwr}"/>
								<Text text="{odata>Netwr}"/>
								<Text text="{odata>Netwr}"/>
								<Text text="{odata>Netwr}"/>
								<Text text="{odata>Netwr}"/>
							</ColumnListItem>
						</items>
					</Table>
				</content>
			</Page>
		</pages>
	</App>
</mvc:View>
&#13;
&#13;
&#13;

&#13;
&#13;
Manifest.json

{
	"_version": "1.7.0",
	"sap.app": {
		"id": "NPAWRMA",
		"type": "application",
		"i18n": "i18n/i18n.properties",
		"applicationVersion": {
			"version": "1.0.0"
		},
		"dataSources": {
			"odataService": {
				"uri": "/sap/opu/odata/sap/ZRMA_REV_SRV/",
				"type": "OData",
				"settings": {
					"odataVersion": "2.0",
					"localUri": "localService/metadata.xml"
				}
			}
		},

		"title": "{{appTitle}}",
		"description": "{{appDescription}}",
		"sourceTemplate": {
			"id": "ui5template.basicSAPUI5ApplicationProject",
			"version": "1.40.12"
		}
	},

	"sap.ui": {
		"technology": "UI5",
		"icons": {
			"icon": "",
			"favIcon": "",
			"phone": "",
			"phone@2": "",
			"tablet": "",
			"tablet@2": ""
		},
		"deviceTypes": {
			"desktop": true,
			"tablet": true,
			"phone": true
		},
		"supportedThemes": [
			"sap_hcb",
			"sap_belize"

		]
	},

	"sap.ui5": {
		"rootView": {
			"viewName": "NPAWRMA.view.header",
			"type": "XML"
		},
		"dependencies": {
			"minUI5Version": "1.30.0",
			"libs": {
				"sap.ui.core": {},
				"sap.m": {},
				"sap.ui.layout": {},
				"sap.ushell": {},
				"sap.collaboration": {},
				"sap.ui.comp": {},
				"sap.uxap": {}
			}
		},
		"contentDensities": {
			"compact": true,
			"cozy": true
		},
		"models": {
			"i18n": {
				"type": "sap.ui.model.resource.ResourceModel",
				"settings": {
					"bundleName": "NPAWRMA.i18n.i18n"
				}
			},
		"odata": {
        "type": "sap.ui.model.odata.v2.ODataModel",
        "dataSource": "odataService",
        "preload": true
      }
		},
		"resources": {
			"css": [{
				"uri": "css/style.css"
			}]
		},

		"routing": {
			"config": {
				"routerClass": "sap.m.routing.Router",
				"viewType": "XML",
				"viewPath": "NPAWRMA.view",
				"controlId": "idAppControl",
				"controlAggregation": "pages",
			   	"async": true
			},
		
			"routes": [{
				"name": "r1",
				"pattern": "",
				"target": "t1"
			}, {
				"name": "r2",
				"pattern": "page2/{noti}",
				"target": "t2"
			}],
			"targets": {
				"t1": {
					"viewName": "header",
					"viewId": "idhead",
					"viewLevel": 1
				},
				"t2": {
					"viewName": "item",
					"viewId": "iditem",
					"viewLevel": 2
				}
			}
		}
	},
	   "sap.platform.abap": {
        "uri": "/sap/opu/odata/sap/ZRMA_REV_SRV",
        "_version": "1.1.0"
    }
}
&#13;
&#13;
&#13;

&#13;
&#13;
Component.js

sap.ui.define([
	"sap/ui/core/UIComponent",
	"sap/ui/Device",
	"NPAWRMA/model/models"
], function(UIComponent, Device, models) {
	"use strict";

	return UIComponent.extend("NPAWRMA.Component", {

		metadata: {
			manifest: "json"
		},

		/**
		 * The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
		 * @public
		 * @override
		 */
		init: function() {
			//"Access-Control-Allow-Origin: *.local.com";
			//"Access-Control-Allow-Headers: X-KEY";

			// call the base component's init function
			var url = "/sap/opu/odata/sap/ZRMA_REV_SRV";
			var odata = new sap.ui.model.odata.v2.ODataModel(url, {
				json: true
			});
			this.setModel(odata, "odata"); // call the base component's init function

			UIComponent.prototype.init.apply(this, arguments);

			// set the device model
			this.setModel(models.createDeviceModel(), "device");
			
			// enable routing
			this.getRouter().initialize();
		}
	});
});
&#13;
&#13;
&#13;

附上Manifest.json和header.view.xml文件以供参考。

0 个答案:

没有答案