|
@@ -8,42 +8,27 @@ let pageOprObj = {
|
|
|
rationLibName : null,
|
|
|
rationLibId : null,
|
|
|
gljLibId: null,
|
|
|
- initPage : function() {
|
|
|
- let me = this, rationLibId = getQueryString("repository");
|
|
|
- me.getRationLibInfo(rationLibId, function (rstData) {
|
|
|
- if(rstData.length > 0){
|
|
|
- me.rationLibName = rstData[0].dispName;
|
|
|
- me.gljLibId = rstData[0].gljLib;
|
|
|
- if(!me.gljLibId || typeof me.gljLibId === 'undefined' || me.gljLibId == -1){
|
|
|
- alert("没有引用人材机库!");
|
|
|
- window.location.href = "/rationRepository/main";
|
|
|
- }
|
|
|
- if (me.rationLibName) {
|
|
|
- var html = $("#rationname")[0].outerHTML;
|
|
|
- html = html.replace("XXX定额库", me.rationLibName);
|
|
|
- $("#rationname")[0].outerHTML = html;
|
|
|
- me.rationLibId = rationLibId;
|
|
|
- sectionTreeObj.getSectionTree(rationLibId);
|
|
|
- //job
|
|
|
- jobContentOprObj.radiosChange(jobContentOprObj.radios, jobContentOprObj.tableAll, jobContentOprObj.tablePartial);
|
|
|
- $('#addConBtn').click(jobContentOprObj.bindAddConBtn());
|
|
|
- $('#updateConBtn').click(jobContentOprObj.bindUpdateConBtn());
|
|
|
- jobContentOprObj.bindAllEvents($('#txtareaAll'));
|
|
|
- //fz
|
|
|
- annotationOprObj.radiosChange(annotationOprObj.radios, annotationOprObj.fzTableAll, annotationOprObj.fzTablePartial);
|
|
|
- $('#fzAddConBtn').click(annotationOprObj.bindAddConBtn());
|
|
|
- $('#fzUpdateConBtn').click(annotationOprObj.bindUpdateConBtn());
|
|
|
- annotationOprObj.bindAllEvents($('#fzTxtareaAll'));
|
|
|
- }
|
|
|
- gljSelOprObj.getGljClassTree(pageOprObj.gljLibId, function () {
|
|
|
- gljSelOprObj.getSelGljItems(pageOprObj.gljLibId, function () {})});
|
|
|
- }
|
|
|
- });
|
|
|
+ initPage : function(libInfo) {
|
|
|
+ this.rationLibId = libInfo.ID;
|
|
|
+ this.gljLibId = libInfo.gljLib;
|
|
|
+ this.rationLibName = libInfo.dispName;
|
|
|
+ $('#rationname').html(`<a href="main">定额库</a><i class="fa fa-angle-right fa-fw"></i>${this.rationLibName}`);
|
|
|
+ if (!this.gljLibId || this.gljLibId === -1) {
|
|
|
+ alert('没有引用人材机库');
|
|
|
+ setTimeout(() => window.location.href = '/rationRepository/main', 2000);
|
|
|
+ }
|
|
|
+ //job
|
|
|
+ jobContentOprObj.radiosChange(jobContentOprObj.radios, jobContentOprObj.tableAll, jobContentOprObj.tablePartial);
|
|
|
+ $('#addConBtn').click(jobContentOprObj.bindAddConBtn());
|
|
|
+ $('#updateConBtn').click(jobContentOprObj.bindUpdateConBtn());
|
|
|
+ jobContentOprObj.bindAllEvents($('#txtareaAll'));
|
|
|
+ //fz
|
|
|
+ annotationOprObj.radiosChange(annotationOprObj.radios, annotationOprObj.fzTableAll, annotationOprObj.fzTablePartial);
|
|
|
+ $('#fzAddConBtn').click(annotationOprObj.bindAddConBtn());
|
|
|
+ $('#fzUpdateConBtn').click(annotationOprObj.bindUpdateConBtn());
|
|
|
+ annotationOprObj.bindAllEvents($('#fzTxtareaAll'));
|
|
|
},
|
|
|
- getRationLibInfo: function (rationLibId, callback) {
|
|
|
- CommonAjax.post('api/getRationLib', {libId: rationLibId}, callback);
|
|
|
- }
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
let sectionTreeObj = {
|
|
|
cache: null,//ref to tree.items
|
|
@@ -243,29 +228,30 @@ let sectionTreeObj = {
|
|
|
sheetCommonObj.setColumnWidthByRate($('#sectionSpread').width() - 65, this.workBook, [{rateWidth: IDRate}, {rateWidth: nameRate}]);
|
|
|
}
|
|
|
},
|
|
|
- getSectionTree: function (repId) {
|
|
|
- let me = sectionTreeObj;
|
|
|
- let url = 'api/getRationTree';
|
|
|
- let postData = {rationLibId: repId};
|
|
|
- let sucFunc = function (rstData) {
|
|
|
- //init
|
|
|
- me.buildSheet();
|
|
|
- me.initTree(rstData);
|
|
|
- me.cache = me.tree.items;
|
|
|
- me.bindBtn();
|
|
|
- me.initController(me.tree, me.sheet, me.setting.sheet);
|
|
|
- me.controller.showTreeData();
|
|
|
- me.sheet.setFormatter(-1, 0, '@');
|
|
|
- me.initSelection(me.tree.selected);
|
|
|
- explanatoryOprObj.bindEvents(exEditor, calcEditor);
|
|
|
- me.loadRateWidth();
|
|
|
- };
|
|
|
- let errFunc = function () {
|
|
|
-
|
|
|
- };
|
|
|
- CommonAjax.post(url, postData, sucFunc, errFunc);
|
|
|
+ initSectionTree: function (sectionTree) {
|
|
|
+ //init
|
|
|
+ this.buildSheet();
|
|
|
+ this.initTree(sectionTree);
|
|
|
+ this.cache = this.tree.items;
|
|
|
+ this.bindBtn();
|
|
|
+ this.initController(this.tree, this.sheet, this.setting.sheet);
|
|
|
+ this.controller.showTreeData();
|
|
|
+ this.sheet.setFormatter(-1, 0, '@');
|
|
|
+ this.initSelection(this.tree.selected);
|
|
|
+ explanatoryOprObj.bindEvents(explanatoryOprObj.exEditor, explanatoryOprObj.calcEditor);
|
|
|
+ this.loadRateWidth();
|
|
|
+ this.autoLocate();
|
|
|
+ },
|
|
|
+ //自动定位
|
|
|
+ autoLocate: function () {
|
|
|
+ const hash = window.location.hash;
|
|
|
+ const $searchInput = $('#rationSearch');
|
|
|
+ if (hash) {
|
|
|
+ const rationCode = hash.replace('#', '');
|
|
|
+ $searchInput.val(rationCode);
|
|
|
+ this.locateToSection(rationCode);
|
|
|
+ }
|
|
|
},
|
|
|
-
|
|
|
initTree: function (datas) {
|
|
|
this.tree = idTree.createNew(this.setting.tree);
|
|
|
this.tree.loadDatas(datas);
|
|
@@ -610,8 +596,7 @@ let sectionTreeObj = {
|
|
|
initTools: function (node) {
|
|
|
if(this.isDef(node)){
|
|
|
explanatoryOprObj.setAttribute(explanatoryOprObj.currentTreeNode ? explanatoryOprObj.currentTreeNode : node, node, node.data.explanation, node.data.ruleText);
|
|
|
- //explanatoryOprObj.clickUpdate($('#explanationShow'), $('#ruleTextShow'));
|
|
|
- explanatoryOprObj.showText(exEditor, calcEditor, node.data.explanation, node.data.ruleText);
|
|
|
+ explanatoryOprObj.showText(explanatoryOprObj.exEditor, explanatoryOprObj.calcEditor, node.data.explanation, node.data.ruleText);
|
|
|
//job
|
|
|
jobContentOprObj.currentSituation = typeof node.data.jobContentSituation !== 'undefined'? node.data.jobContentSituation : jobContentOprObj.situations.ALL;
|
|
|
jobContentOprObj.setAttribute(jobContentOprObj.currentTreeNode ? jobContentOprObj.currentTreeNode : node, node);
|