我有用html编写的Java脚本代码,我需要在打字稿中调用javascript函数,现在我想在作为相同html文件组成部分的打字稿文件中调用CompanyTree函数,请帮助此代码在ID为jqxWidget的潜水中显示>
<script type="text/javascript">
function CompanyTree() {
var data = CompanyTreeStructure;
debugger;
var source =
{
datatype: "json",
datafields: [
{ name: 'id' },
{ name: 'parentid' },
{ name: 'text' },
{ name: 'value' },
],
id: 'id',
localdata: data
};
var dataAdapter = new $.jqx.dataAdapter(source);
dataAdapter.dataBind();
var records = dataAdapter.getRecordsHierarchy('id', 'parentid', 'items', [{ name: 'text', map: 'label' }]);
$('#jqxWidget').jqxTree({ source: records, width: '300px' });
$('#jqxWidget').on('select', function (event) {
debugger;
var args = event.args;
var item = $('#jqxWidget').jqxTree('getItem', args.element);
var Level = item.level;
var myConEle = document.querySelector('[ng-controller=myCntrl]');
var myscope = angular.element(myConEle).scope();
myscope.FK_LevelId = Level;
//alert(Level);
var trt = item.value;
var myConEle = document.querySelector('[ng-controller=myCntrl]');
var myscope = angular.element(myConEle).scope();
myscope.Value = trt;
var itemsplit = trt.split(":");
var EntId = itemsplit[0];
var EntityId = parseInt(EntId);
var id = itemsplit[1];
var Company = itemsplit[2];
var ID = parseInt(id);
var myConEle = document.querySelector('[ng-controller=myCntrl]');
var myscope = angular.element(myConEle).scope();
myscope.FK_ParentId = EntityId;
if (Company == 'Company') {
angular.element(document.getElementById('myCntrl')).scope().DS(ID);
var myConEle = document.querySelector('[ng-controller=myCntrl]');
var myscope = angular.element(myConEle).scope();
myscope.IsCompany = true;
}
else {
angular.element(document.getElementById('myCntrl')).scope().Fin(EntityId);
}
});
};
</script>