UA grid列表中调用指定方法,给列绑定下拉,失去焦点触发指定事件
效果图
左树JSON
{
"id": "CJY-0153",
"text": "CJY-0153/铝箔厚度",
"icon": true,
"parent": "#",
"parents": ["#"],
"children": [],
"children_d": [],
"state": {
"loaded": true,
"opened": false,
"selected": true,
"disabled": false
},
"li_attr": {
"id": "CJY-0153"
},
"a_attr": {
"href": "#",
"id": "CJY-0153_anchor"
},
"original": {
"id": "CJY-0153",
"StandardTypeName": "计量",
"StandardType": "1",
"StandardValue": "",
"Description": "",
"Upper": "50.00",
"Lower": "30.00",
"UnitCode": "ZJ03",
"UnitName": "um",
"parent": "#",
"text": "CJY-0153/铝箔厚度",
"type": "root",
"isTree": "50.00",
"state": {
"opened": false,
"selected": false
}
}
}
右侧列表JSON
[{
"Id": null,
"CheckResult": null,
"StandardValue": null,
"Description": "测试",
"Lower": null,
"Upper": null,
"StandardCode": null,
"StandardName": null,
"StandardType": "0",
"StandardTypeName": "计数",
"ActualValue": null,
"checkDateTime": "2022-12-23T06:17:25.332Z",
"UnitCode": null,
"UnitName": null,
"Remark": null,
"CheckResultStr": {
"options": [{
"ID": "1",
"Name": "合格"
}, {
"ID": "0",
"Name": "不合格"
}, {
"ID": "-1",
"Name": "未检验"
}],
"selectedOption": {
"ID": "-1",
"Name": "未检验"
}
},
"editrow": true
}]
1、FirstArticleInspection-edit-ctrl.js
(function () {
'use strict';
angular.module('Siemens.SimaticIT.QualityApp.FirstArticleInspection').config(EditScreenStateConfig);
EditScreenController.$inject = ['Siemens.SimaticIT.QualityApp.FirstArticleInspection.FirstArticleInspection.service', '$state', '$stateParams', 'common.base', '$filter', '$rootScope', '$scope', 'commonService', 'uiGridConstants', 'common.widgets.notificationTile.globalService'];
function EditScreenController(dataService, $state, $stateParams, common, $filter, $rootScope, $scope, commonService, uiGridConstants, notificationService) {
var self = this;
var deleteArr = new Array();
var sidePanelManager, backendService, propertyGridHandler, messageservice;
var leftTreeClick = false;//是否点击了左侧树
activate();
function activate() {
init();
registerEvents();
initGridOptions();
initGridData();
var title = "";
if (self.StandardType == "质量检验")
title = "修改首件质量检验数据";
else
title = "修改首件生产检验数据";
sidePanelManager.setTitle(title);
sidePanelManager.open(
{
mode: 'e',
//size: 'wide'
}
);
}
function init() {
sidePanelManager = common.services.sidePanel.service;
backendService = common.services.runtime.backendService;
//Initialize Model Data
// TODO: Put here the properties of the entity managed by the service
self.currentItem = angular.copy($stateParams.selectedItem);
self.StandardType = angular.copy($stateParams.StandardType);
self.deptType = angular.copy($stateParams.deptType);
self.validInputs = false;
self.SearchParams = {};
self.isAddDisplay = false;
self.isDelDisplay = false;
self.returnDate = {
qualified: "",
userId: "",
isChildComplete: false,
checkDate: "",
isQualityFinished: false,
isCheckFinished: false
};
//Expose Model Methods
self.save = save;
self.cancel = cancel;
self.addButtonHandler = addButtonHandler;
self.saveButtonHandler = saveButtonHandler_Btn;
self.deleteButtonHandler = deleteButtonHandler;
self.resultConfirmButtonHandler = resultConfirmButtonHandler;
self.checkResultoptions = [
{
ID: '1',
Name: '合格'
},
{
ID: '0',//2
Name: '不合格'
}
];
self.CheckResultOptions = {
options: [{
ID: '1',
Name: '合格'
},
{
ID: '0',//2
Name: '不合格'
},
{
ID: '-1',//2
Name: '未检验'
}],
selectedOption: { ID: '-1', Name: '未检验' }
}
self.ResultSelect = {
selectedItem: null,
options: [
{
ID: '1',
Name: '合格'
},
{
ID: '0',//2
Name: '不合格'
}
]
};
self.copyData = [
{
FieldName: 'AAA',
QualityCheckResult: 'OK',
editrow: true
},
{
FieldName: 'BBB',
QualityCheckResult: 'NG',
editrow: true
}
];
$scope.typesConfig = {
"#": {
"valid_children": ["root"]
},
"root": {
//"icon" : "CR.FactoryModelingApp/scripts/jstree/tree.png",
"icon": "fa fa-folder",
"valid_children": ["default"]
},
"default": {
//"icon" : 'jstree-folder',
"icon": 'fa fa-folder',
"valid_children": ["default", "file"]
},
"file": {
//"icon" : 'jstree-file',
"icon": 'fa fa-file-o',
"valid_children": []
}
}
$scope.changedCB = function (e, data) {
console.log('changedCB');
var i, j, r = [];
for (i = 0, j = data.selected.length; i < j; i++) {
r.push(data.instance.get_node(data.selected[i]).id);
}
if (!!data.node) {
leftTreeClick = true;
saveButtonHandler();
self.selectedDataItemId = data.node.id;
console.log('data.node.id-------------: ' + data.node.id);
self.selectedDataItemIsTree = data.node.original.isTree;
self.DataItemClass = data.node.text;
self.SearchParams = {
"checkType": "0001",
"materialCode": self.currentItem.MaterialCode,
"standardCode": data.node.original.id,
"process": self.currentItem.ProcessCode,
"deptType": self.deptType,
"taskNo": self.currentItem.TaskNO,
"version": self.currentItem.Version
}
console.log(JSON.stringify(self.SearchParams));
getDataItemDetailList(self.SearchParams);
self.isAddDisplay = true;
self.isDelDisplay = false;
self.currentItem.FieldName = data.node.text;
self.currentItem.Upper = data.node.original.Upper;
self.currentItem.StandardValue = data.node.original.StandardValue;
self.currentItem.StandardType = data.node.original.StandardType;