|
@@ -14,6 +14,8 @@ var gljOprObj = {
|
|
|
assSheetData:[],
|
|
|
detailSheet:null,
|
|
|
detailData:[],
|
|
|
+ GLJSelection:[],
|
|
|
+ parentNodeIds:{},
|
|
|
setting: {
|
|
|
header: [
|
|
|
{headerName: "编码", headerWidth: 100, dataCode: "code", dataType: "String", formatter: "@"},
|
|
@@ -68,6 +70,64 @@ var gljOprObj = {
|
|
|
lockColumns:[2,3]
|
|
|
}
|
|
|
},
|
|
|
+ gljTreeSetting:{
|
|
|
+ view: {
|
|
|
+ //addHoverDom: gljTypeTreeOprObj.addHoverDom,
|
|
|
+ //removeHoverDom: gljTypeTreeOprObj.removeHoverDom,
|
|
|
+ expandSpeed: "",
|
|
|
+ selectedMulti: false
|
|
|
+ },
|
|
|
+ edit: {
|
|
|
+ enable: false,
|
|
|
+ editNameSelectAll: true,
|
|
|
+ showRemoveBtn: true,
|
|
|
+ showRenameBtn: true,
|
|
|
+ removeTitle: "删除节点",
|
|
|
+ renameTitle: "更改名称"
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ keep: {
|
|
|
+ parent:true,
|
|
|
+ leaf:true
|
|
|
+ },
|
|
|
+ key: {
|
|
|
+ children: "items",
|
|
|
+ name: "Name"
|
|
|
+ },
|
|
|
+ simpleData: {
|
|
|
+ enable: false,
|
|
|
+ idKey: "ID",
|
|
|
+ pIdKey: "ParentID",
|
|
|
+ rootPId: -1
|
|
|
+ }
|
|
|
+ },
|
|
|
+ callback:{
|
|
|
+ onClick: function(event,treeId,treeNode) {
|
|
|
+ let me = gljOprObj, gljTypeId = treeNode.ID;
|
|
|
+ if(me.gljCurTypeId !== treeNode.ID){
|
|
|
+ me.gljCurTypeId = treeNode.ID;
|
|
|
+ me.filterLibGLJSheetData();
|
|
|
+ me.showLibGLJSheetData();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ gljLibSheetSetting:{
|
|
|
+ owner:'gljTree',
|
|
|
+ header: [
|
|
|
+ {headerName:"选择", headerWidth: 40, dataCode: "select", hAlign: "center", vAlign: "center",cellType:"checkBox"},
|
|
|
+ {headerName:"编码",headerWidth:80,dataCode:"code", dataType: "String", formatter: "@", hAlign: "left", vAlign: "center"},
|
|
|
+ {headerName:"名称",headerWidth:120,dataCode:"name", dataType: "String", hAlign: "left", vAlign: "center"},
|
|
|
+ {headerName:"规格型号",headerWidth:80,dataCode:"specs", dataType: "String", hAlign: "center", vAlign: "center"},
|
|
|
+ {headerName:"计量单位",headerWidth:80,dataCode:"unit", dataType: "String", hAlign: "center", vAlign: "center"},
|
|
|
+ {headerName:"单价",headerWidth:80,dataCode:"basePrice", dataType: "Number", formatter: "0.00", hAlign: "right", vAlign: "center"},
|
|
|
+ {headerName:"类型",headerWidth:80,dataCode:"gljType", dataType: "String", hAlign: "center", vAlign: "center"}
|
|
|
+ ],
|
|
|
+ view:{
|
|
|
+ lockColumns:[0,1,2,3,4,5,6]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ gljLibSheet:null,
|
|
|
initSheet: function(sheet) {
|
|
|
var me = this;
|
|
|
me.sheet = sheet;
|
|
@@ -215,8 +275,10 @@ var gljOprObj = {
|
|
|
}
|
|
|
if(args.sheetName=='ration_coe'){
|
|
|
gljOprObj.updateRationCoe(args,newval)
|
|
|
- }else {
|
|
|
+ }else if(args.sheetName=='quantity_detail'){
|
|
|
projectObj.project.quantity_detail.isSummationUpdate(args,gljOprObj.detailData,newval);
|
|
|
+ }else if(args.sheetName=='glj_lib'){
|
|
|
+ gljOprObj.setGLJSelection(args,newval);
|
|
|
}
|
|
|
},
|
|
|
onCusButtonClick:function (sender,args){
|
|
@@ -628,8 +690,129 @@ var gljOprObj = {
|
|
|
}
|
|
|
return true;
|
|
|
},
|
|
|
+ showLibGLJSheetData:function () {
|
|
|
+ this.gljLibSheetData=_.sortBy(this.gljLibSheetData, 'code');
|
|
|
+ this.gljLibSheet.setRowCount(this.gljLibSheetData.length);
|
|
|
+ sheetCommonObj.showData(this.gljLibSheet,this.gljLibSheetSetting,this.gljLibSheetData,gljOprObj.distTypeTree);
|
|
|
+ },
|
|
|
+ filterLibGLJSheetData:function () {
|
|
|
+ let me=this;
|
|
|
+ let val = $("input[name='glj']:checked").val();
|
|
|
+ if(val=='allGljs'){
|
|
|
+ me.gljLibSheetData =me.stdGLJ.concat(me.complementaryGLJs);
|
|
|
+ }else {
|
|
|
+ me.gljLibSheetData=me[val];
|
|
|
+ }
|
|
|
+ if(me.gljCurTypeId==undefined){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (me.parentNodeIds["_pNodeId_" + me.gljCurTypeId]) {
|
|
|
+ me.gljLibSheetData= _.filter(me.gljLibSheetData, function(n) {
|
|
|
+ return _.includes(me.parentNodeIds["_pNodeId_" + me.gljCurTypeId],n.gljClass);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ me.gljLibSheetData = _.filter(me.gljLibSheetData,{'gljClass':me.gljCurTypeId});
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ setGLJSelection:function (args,newVal) {
|
|
|
+ if(newVal==1){
|
|
|
+ this.GLJSelection.push(this.gljLibSheetData[args.row].code);
|
|
|
+ this.gljLibSheetData[args.row].select=1;
|
|
|
+ }else if(newVal==0){
|
|
|
+ _.pull(this.GLJSelection,this.gljLibSheetData[args.row].code);
|
|
|
+ this.gljLibSheetData[args.row].select=0;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getComboData: function (gljDistType) {
|
|
|
+ let me = this;
|
|
|
+ let distType;
|
|
|
+ let distTypeTree = {
|
|
|
+ prefix : 'gljType',
|
|
|
+ distTypes: {},
|
|
|
+ comboDatas: [],
|
|
|
+ distTypesArr: []
|
|
|
+ };
|
|
|
+ gljDistType.forEach(function (typeData) {
|
|
|
+ let typeObj = {
|
|
|
+ data: typeData,
|
|
|
+ children: [],
|
|
|
+ parent: null
|
|
|
+ }
|
|
|
+ distTypeTree.distTypes[distTypeTree.prefix + typeData.ID] = typeObj;
|
|
|
+ distTypeTree.distTypesArr.push(typeObj);
|
|
|
+ });
|
|
|
+ gljDistType.forEach(function (typeData) {
|
|
|
+ distType = distTypeTree.distTypes[distTypeTree.prefix + typeData.ID];
|
|
|
+ let parent = distTypeTree.distTypes[distTypeTree.prefix + typeData.ParentID];
|
|
|
+ if(parent){
|
|
|
+ distType.parent = parent;
|
|
|
+ parent.children.push(distType);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ distTypeTree.distTypesArr.forEach(function (distTypeObj) {
|
|
|
+ if(distTypeObj.data.fullName !== '材料' && distTypeObj.data.fullName !== '机械'){
|
|
|
+ distTypeTree.comboDatas.push({text: distTypeObj.data.fullName, value: distTypeObj.data.ID});
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return distTypeTree;
|
|
|
+ },
|
|
|
refreshView:function () {
|
|
|
this.showRationGLJData();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+$(function(){
|
|
|
+ $('#glj_tree_div').on('shown.bs.modal', function (e) {
|
|
|
+ if(gljOprObj.gljLibSpresd==undefined){
|
|
|
+ gljOprObj.gljLibSpresd=sheetCommonObj.buildSheet($('#gljLibSheet')[0], gljOprObj.gljLibSheetSetting, gljOprObj.stdGLJ.length+gljOprObj.complementaryGLJs.length);
|
|
|
+ gljOprObj.gljLibSpresd.bind(GC.Spread.Sheets.Events.ButtonClicked,gljOprObj.onButtonClick);
|
|
|
+ gljOprObj.gljLibSheet = gljOprObj.gljLibSpresd.getSheet(0);
|
|
|
+ gljOprObj.gljLibSheet.options.isProtected = true;
|
|
|
+ gljOprObj.gljLibSheet.name('glj_lib');
|
|
|
+ }
|
|
|
+ gljOprObj.GLJSelection=[];
|
|
|
+ gljOprObj.gljLibSheetData =gljOprObj.stdGLJ.concat(gljOprObj.complementaryGLJs);
|
|
|
+ gljOprObj.showLibGLJSheetData();
|
|
|
+ });
|
|
|
+
|
|
|
+ $('.glj-radio').change(function () {
|
|
|
+ let val = $("input[name='glj']:checked").val();
|
|
|
+ if(val=='allGljs'){
|
|
|
+ gljOprObj.gljLibSheetData =gljOprObj.stdGLJ.concat(gljOprObj.complementaryGLJs);
|
|
|
+ gljOprObj.filterLibGLJSheetData();
|
|
|
+ gljOprObj.showLibGLJSheetData();
|
|
|
+ }else {
|
|
|
+ gljOprObj.gljLibSheetData=gljOprObj[val];
|
|
|
+ gljOprObj.filterLibGLJSheetData();
|
|
|
+ gljOprObj.showLibGLJSheetData();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ $('#glj_selected_conf').click(function () {
|
|
|
+ gljOprObj.GLJSelection= _.filter(gljOprObj.GLJSelection,function (n) {
|
|
|
+ return _.find(gljOprObj.sheetData,{'code':n})?false:true;
|
|
|
+ })
|
|
|
+ if(gljOprObj.GLJSelection.length<1){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var selected = projectObj.project.mainTree.selected;
|
|
|
+ if(selected&&selected.sourceType==ModuleNames.ration){
|
|
|
+ projectObj.project.ration_glj.addGLJByLib(gljOprObj.GLJSelection,selected.data,function (result) {
|
|
|
+ if(result){
|
|
|
+ projectObj.project.ration_glj.datas = projectObj.project.ration_glj.datas.concat(result.newRecodes);
|
|
|
+ gljOprObj.sheetData = gljOprObj.sheetData.concat(result.showData)
|
|
|
+ gljOprObj.showRationGLJSheetData();
|
|
|
+ projectObj.project.projectGLJ.loadData();
|
|
|
+ }
|
|
|
+ console.log("return---------------");
|
|
|
+ console.log(result);
|
|
|
+ $("#glj_tree_div").modal('hide');
|
|
|
+ });//doc.rationID=selected.data.ID;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ })
|
|
|
+})
|
|
|
+
|
|
|
+
|
|
|
+
|