|
@@ -3,182 +3,157 @@
|
|
* Created by Mai on 2017/5/16.
|
|
* Created by Mai on 2017/5/16.
|
|
*/
|
|
*/
|
|
|
|
|
|
-/**
|
|
|
|
- * showObj = {bills, jobAndFeatureTab, job, feature, remarkTab, remark}
|
|
|
|
- */
|
|
|
|
-/*var stdBillsLibObj = {
|
|
|
|
- createNew: function (sessionID, showObj) {
|
|
|
|
- var tools = {
|
|
|
|
- sessionID: sessionID,
|
|
|
|
- billsSpread: null,
|
|
|
|
- billsJobSpread: null,
|
|
|
|
- billsFeatureSpread: null,
|
|
|
|
- checkSpread: function (spread, spreadObj) {
|
|
|
|
- if (!spread) {
|
|
|
|
- spread = SheetDataHelper.createNewSpread(spreadObj);
|
|
|
|
|
|
+var billsLibObj = {
|
|
|
|
+ stdBillsSpread: null,
|
|
|
|
+ stdBillsJobSpread: null,
|
|
|
|
+ stdBillsFeatureSpread: null,
|
|
|
|
+ checkBillsSpread: function () {
|
|
|
|
+ if (!this.stdBillsSpread) {
|
|
|
|
+ this.stdBillsSpread = SheetDataHelper.createNewSpread($('#stdBillsSpread')[0]);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ checkBillsRelaSpread: function () {
|
|
|
|
+ if (!this.stdBillsJobSpread) {
|
|
|
|
+ this.stdBillsJobSpread = SheetDataHelper.createNewSpread($('#stdBillsJobs')[0]);
|
|
|
|
+ }
|
|
|
|
+ if (!this.stdBillsFeatureSpread) {
|
|
|
|
+ this.stdBillsFeatureSpread = SheetDataHelper.createNewSpread($('#stdBillsFeatures')[0]);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ loadStdBillsLib: function () {
|
|
|
|
+ CommonAjax.post('/stdBillsEditor/getStdBillsLib', {userId: userID}, function (datas) {
|
|
|
|
+ var i, select = $('#stdBillsLibSelect');
|
|
|
|
+ select.empty();
|
|
|
|
+ datas.forEach(function (data) {
|
|
|
|
+ var option = $('<option>').val(data.billsLibId).text(data.billsLibName);
|
|
|
|
+ select.append(option);
|
|
|
|
+ });
|
|
|
|
+ if (select.children.length !== 0) {
|
|
|
|
+ billsLibObj.loadStdBills(select.val());
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ loadStdBills: function (stdBillsLibID) {
|
|
|
|
+ var stdBillsJobData, stdBillsFeatureData, stdBills;
|
|
|
|
+ var stdBillsTree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1, autoUpdate: true});
|
|
|
|
+ var stdBillsTreeController = TREE_SHEET_CONTROLLER.createNew(stdBillsTree, billsLibObj.stdBillsSpread.getActiveSheet(), billsLibObj.stdBillsTreeSetting);
|
|
|
|
+ var findData = function (value, field, Array) {
|
|
|
|
+ var i = 0;
|
|
|
|
+ for (i = 0; i < Array.length - 1; i++) {
|
|
|
|
+ if (value === Array[i][field]) {
|
|
|
|
+ return Array[i];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ };
|
|
|
|
+ var getBillsJobs = function (node) {
|
|
|
|
+ var jobs = [], i, jobData = null;
|
|
|
|
+ if (stdBillsJobData && node && node.data.jobs) {
|
|
|
|
+ for (i = 0; i < node.data.jobs.length - 1; i++) {
|
|
|
|
+ jobData = findData(node.data.jobs[i], 'id', stdBillsJobData);
|
|
|
|
+ if (jobData) {
|
|
|
|
+ jobs.push(jobData);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ return jobs;
|
|
|
|
+ };
|
|
|
|
+ var getBillsFeatures = function (node) {
|
|
|
|
+ var features = [], i, featureData = null;
|
|
|
|
+ if (stdBillsFeatureData && node && node.data.items) {
|
|
|
|
+ for (i = 0; i < node.data.items.length - 1; i++) {
|
|
|
|
+ featureData = findData(node.data.items[i], 'id', stdBillsFeatureData);
|
|
|
|
+ if (featureData) {
|
|
|
|
+ features.push(featureData);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return features;
|
|
|
|
+ };
|
|
|
|
+ var showJobs = function (jobs) {
|
|
|
|
+ SheetDataHelper.loadSheetHeader(billsLibObj.jobsSetting, billsLibObj.stdBillsJobSpread.getActiveSheet());
|
|
|
|
+ SheetDataHelper.loadSheetData(billsLibObj.jobsSetting, billsLibObj.stdBillsJobSpread.getActiveSheet(), jobs);
|
|
};
|
|
};
|
|
- var libObj = function () {
|
|
|
|
- this.billsTree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1, autoUpdate: true});
|
|
|
|
- this.spread = tools.billsSpread;
|
|
|
|
|
|
+ var showFeatures = function (features) {
|
|
|
|
+ SheetDataHelper.loadSheetHeader(billsLibObj.featuresSetting, billsLibObj.stdBillsFeatureSpread.getActiveSheet());
|
|
|
|
+ SheetDataHelper.loadSheetData(billsLibObj.featuresSetting, billsLibObj.stdBillsFeatureSpread.getActiveSheet(), features);
|
|
};
|
|
};
|
|
|
|
+ var showJobsAndFeatures = function (node) {
|
|
|
|
+ $('#stdBillsJobTab').show();
|
|
|
|
+ $('#stdBillsRemarkTab').hide();
|
|
|
|
+ billsLibObj.checkBillsRelaSpread();
|
|
|
|
+ showJobs(getBillsJobs(node));
|
|
|
|
+ showFeatures(getBillsFeatures(node));
|
|
|
|
+ };
|
|
|
|
+ var showBillsRemark = function (node) {
|
|
|
|
+ $('#stdBillsJobTab').hide();
|
|
|
|
+ $('#stdBillsRemarkTab').show();
|
|
|
|
+ $('#stdBillsRemark').text(node && node.data.recharge ? node.data.recharge : '');
|
|
|
|
+ };
|
|
|
|
+ var showBillsRela = function (node) {
|
|
|
|
+ if (node && node.children.length === 0) {
|
|
|
|
+ showJobsAndFeatures(node);
|
|
|
|
+ } else {
|
|
|
|
+ showBillsRemark(node);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ CommonAjax.post('/stdBillsEditor/getJobContent', {userId: userID, billsLibId: stdBillsLibID}, function (datas) {
|
|
|
|
+ stdBillsJobData = datas;
|
|
|
|
+ }, function () {
|
|
|
|
+ stdBillsJobData = [];
|
|
|
|
+ });
|
|
|
|
+ CommonAjax.post('/stdBillsEditor/getItemCharacter', {userId: userID, billsLibId: stdBillsLibID}, function (datas) {
|
|
|
|
+ stdBillsFeatureData = datas;
|
|
|
|
+ }, function () {
|
|
|
|
+ stdBillsFeatureData = [];
|
|
|
|
+ });
|
|
|
|
+ CommonAjax.post('/stdBillsEditor/getBills', {userId: userID, billsLibId: stdBillsLibID}, function (datas) {
|
|
|
|
+ stdBills = datas;
|
|
|
|
+ stdBillsTree.loadDatas(stdBills);
|
|
|
|
+ stdBillsTreeController.showTreeData();
|
|
|
|
+ showBillsRela(stdBillsTree.firstNode());
|
|
|
|
|
|
- libObj.prototype.LoadStdBills = function () {
|
|
|
|
- tools.checkSpread(tools.billsSpread, showObj.bills);
|
|
|
|
|
|
+ stdBillsTreeController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, showBillsRela);
|
|
|
|
+ });
|
|
|
|
|
|
- };
|
|
|
|
|
|
+ $('#stdBillsSearch>span>button').click(function () {
|
|
|
|
+ var keyword = $('#stdBillsSearch>input').val();
|
|
|
|
|
|
- return new libObj(sessionID);
|
|
|
|
- },
|
|
|
|
- settings: {
|
|
|
|
- stdBillsTreeSetting: {
|
|
|
|
- "treeCol": 0,
|
|
|
|
- "emptyRows":0,
|
|
|
|
- "headRows":1,
|
|
|
|
- "headRowHeight":[
|
|
|
|
- 35
|
|
|
|
- ],
|
|
|
|
- "cols":[{
|
|
|
|
- "width":100,
|
|
|
|
- "readOnly":null,
|
|
|
|
- "head":{
|
|
|
|
- "titleNames":["项目编码"],
|
|
|
|
- "spanCols":[1],
|
|
|
|
- "spanRows":[1],
|
|
|
|
- "vAlign":[1],
|
|
|
|
- "hAlign":[1],
|
|
|
|
- "font":["12px Arial"]
|
|
|
|
- },
|
|
|
|
- "data":{
|
|
|
|
- "field":"code",
|
|
|
|
- "vAlign":0,
|
|
|
|
- "hAlign":3,
|
|
|
|
- "font":"12px Arial"
|
|
|
|
- }
|
|
|
|
- }, {
|
|
|
|
- "width":120,
|
|
|
|
- "readOnly":null,
|
|
|
|
- "head":{
|
|
|
|
- "titleNames":["项目名称"],
|
|
|
|
- "spanCols":[1],
|
|
|
|
- "spanRows":[1],
|
|
|
|
- "vAlign":[1],
|
|
|
|
- "hAlign":[1],
|
|
|
|
- "font":["12px Arial"]
|
|
|
|
- },
|
|
|
|
- "data":{
|
|
|
|
- "field":"name",
|
|
|
|
- "vAlign":0,
|
|
|
|
- "hAlign":3,
|
|
|
|
- "font":"12px Arial"
|
|
|
|
- }
|
|
|
|
- }, {
|
|
|
|
- "width":40,
|
|
|
|
- "readOnly":null,
|
|
|
|
- "head":{
|
|
|
|
- "titleNames":["计量单位"],
|
|
|
|
- "spanCols":[1],
|
|
|
|
- "spanRows":[1],
|
|
|
|
- "vAlign":[1],
|
|
|
|
- "hAlign":[1],
|
|
|
|
- "font":["12px Arial"],
|
|
|
|
- "wordWrap": true
|
|
|
|
- },
|
|
|
|
- "data":{
|
|
|
|
- "field":"unti",
|
|
|
|
- "vAlign":0,
|
|
|
|
- "hAlign":3,
|
|
|
|
- "font":"12px Arial"
|
|
|
|
- }
|
|
|
|
- }, {
|
|
|
|
- "width":100,
|
|
|
|
- "readOnly": true,
|
|
|
|
- "head":{
|
|
|
|
- "titleNames":["工程量计算规则"],
|
|
|
|
- "spanCols":[1],
|
|
|
|
- "spanRows":[1],
|
|
|
|
- "vAlign":[1],
|
|
|
|
- "hAlign":[1],
|
|
|
|
- "font":["12px Arial"]
|
|
|
|
- },
|
|
|
|
- "data":{
|
|
|
|
- "field":"ruleText",
|
|
|
|
- "vAlign":0,
|
|
|
|
- "hAlign":3,
|
|
|
|
- "font":"12px Arial"
|
|
|
|
- }
|
|
|
|
- }]
|
|
|
|
- },
|
|
|
|
- stdBillsJobSetting: {
|
|
|
|
- "emptyRows":0,
|
|
|
|
- "headRows":1,
|
|
|
|
- "headRowHeight":[
|
|
|
|
- 20
|
|
|
|
- ],
|
|
|
|
- "cols":[{
|
|
|
|
- "width":200,
|
|
|
|
- "readOnly":true,
|
|
|
|
- "head":{
|
|
|
|
- "titleNames":["工程内容"],
|
|
|
|
- "spanCols":[1],
|
|
|
|
- "spanRows":[1],
|
|
|
|
- "vAlign":[1],
|
|
|
|
- "hAlign":[1],
|
|
|
|
- "font":["12px Arial"]
|
|
|
|
- },
|
|
|
|
- "data":{
|
|
|
|
- "field":"content",
|
|
|
|
- "vAlign":0,
|
|
|
|
- "hAlign":3,
|
|
|
|
- "font":"12px Arial"
|
|
|
|
- }
|
|
|
|
- }]
|
|
|
|
- },
|
|
|
|
- stdBillsFeatureSetting: {
|
|
|
|
- "emptyRows":0,
|
|
|
|
- "headRows":1,
|
|
|
|
- "headRowHeight":[
|
|
|
|
- 20
|
|
|
|
- ],
|
|
|
|
- "cols":[{
|
|
|
|
- "width":200,
|
|
|
|
- "readOnly":null,
|
|
|
|
- "head":{
|
|
|
|
- "titleNames":["项目特征"],
|
|
|
|
- "spanCols":[1],
|
|
|
|
- "spanRows":[1],
|
|
|
|
- "vAlign":[1],
|
|
|
|
- "hAlign":[1],
|
|
|
|
- "font":["12px Arial"]
|
|
|
|
- },
|
|
|
|
- "data":{
|
|
|
|
- "field":"content",
|
|
|
|
- "vAlign":0,
|
|
|
|
- "hAlign":3,
|
|
|
|
- "font":"12px Arial"
|
|
|
|
- }
|
|
|
|
- }]
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-};*/
|
|
|
|
|
|
+ if (!keyword || keyword === '') {return}
|
|
|
|
|
|
-CommonAjax.post('/stdBillsEditor/getStdBillsLib', {userId: userID}, function (datas) {
|
|
|
|
- var i, select = $('#stdBillsLibSelect');
|
|
|
|
- select.empty();
|
|
|
|
- datas.forEach(function (data) {
|
|
|
|
- var option = $('<option>').val(data.billsLibId).text(data.billsLibName);
|
|
|
|
- select.append(option);
|
|
|
|
- });
|
|
|
|
- if (select.children.length !== 0) {
|
|
|
|
- LoadStdBills(select.val());
|
|
|
|
- }
|
|
|
|
-});
|
|
|
|
|
|
+ var result = stdBillsTree.items.filter(function (item) {
|
|
|
|
+ var codeIs = item.data.code ? item.data.code.indexOf(keyword) !== -1 : false;
|
|
|
|
+ var nameIs = item.data.name ? item.data.name.indexOf(keyword) !== -1 : false;
|
|
|
|
+ return codeIs || nameIs;
|
|
|
|
+ });
|
|
|
|
+ result.sort(function (x, y) {
|
|
|
|
+ return x.serialNo() - y.serialNo();
|
|
|
|
+ });
|
|
|
|
+ if (result.length !== 0) {
|
|
|
|
+ var sel = billsLibObj.stdBillsSpread.getActiveSheet().getSelections();
|
|
|
|
+ stdBillsTreeController.setTreeSelected(result[0]);
|
|
|
|
+ billsLibObj.stdBillsSpread.getActiveSheet().setSelection(result[0].serialNo(), sel[0].col, 1, 1);
|
|
|
|
|
|
-var LoadStdBills = (function () {
|
|
|
|
- var stdBillsSpread = SheetDataHelper.createNewSpread($('#stdBillsSpread')[0]);
|
|
|
|
- var stdBillsJobSpread = null, stdBillsFeatureSpread = null;
|
|
|
|
- var stdBillsTreeSetting = {
|
|
|
|
|
|
+ $('#nextStdBills').show();
|
|
|
|
+ $('#nextStdBills').click(function () {
|
|
|
|
+ var cur = stdBillsTree.selected, resultIndex = result.indexOf(cur), sel = billsLibObj.stdBillsSpread.getActiveSheet().getSelections();
|
|
|
|
+ if (resultIndex === result.length - 1) {
|
|
|
|
+ stdBillsTreeController.setTreeSelected(result[0]);
|
|
|
|
+ billsLibObj.stdBillsSpread.getActiveSheet().setSelection(result[0].serialNo(), sel[0].col, 1, 1);
|
|
|
|
+ } else {
|
|
|
|
+ stdBillsTreeController.setTreeSelected(result[resultIndex + 1]);
|
|
|
|
+ billsLibObj.stdBillsSpread.getActiveSheet().setSelection(result[resultIndex + 1].serialNo(), sel[0].col, 1, 1);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ $('#nextStdBills').hide();
|
|
|
|
+ }
|
|
|
|
+ $('#stdBillsSearchResultCount').text('搜索结果:' + result.length);
|
|
|
|
+ $('#stdBillsSearchResult').show();
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ stdBillsTreeSetting: {
|
|
"treeCol": 0,
|
|
"treeCol": 0,
|
|
"emptyRows":0,
|
|
"emptyRows":0,
|
|
"headRows":1,
|
|
"headRows":1,
|
|
@@ -256,188 +231,65 @@ var LoadStdBills = (function () {
|
|
"font":"Arial"
|
|
"font":"Arial"
|
|
}
|
|
}
|
|
}]
|
|
}]
|
|
- };
|
|
|
|
- var stdBillsData, stdBillsJobData, stdBillsFeatureData;
|
|
|
|
- var stdBillsTree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1, autoUpdate: true});
|
|
|
|
- var stdBillsTreeController = TREE_SHEET_CONTROLLER.createNew(stdBillsTree, stdBillsSpread.getActiveSheet(), stdBillsTreeSetting);
|
|
|
|
-
|
|
|
|
- var findData = function (value, field, Array) {
|
|
|
|
- var i = 0;
|
|
|
|
- for (i = 0; i < Array.length - 1; i++) {
|
|
|
|
- if (value === Array[i][field]) {
|
|
|
|
- return Array[i];
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return null;
|
|
|
|
- };
|
|
|
|
- var getBillsJobs = function (node) {
|
|
|
|
- var jobs = [], i, jobData = null;
|
|
|
|
- if (stdBillsJobData && node && node.data.jobs) {
|
|
|
|
- for (i = 0; i < node.data.jobs.length - 1; i++) {
|
|
|
|
- jobData = findData(node.data.jobs[i], 'id', stdBillsJobData);
|
|
|
|
- if (jobData) {
|
|
|
|
- jobs.push(jobData);
|
|
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ jobsSetting: {
|
|
|
|
+ "emptyRows":0,
|
|
|
|
+ "headRows":1,
|
|
|
|
+ "headRowHeight":[25],
|
|
|
|
+ "defaultRowHeight": 21,
|
|
|
|
+ "cols":[{
|
|
|
|
+ "width":200,
|
|
|
|
+ "readOnly":true,
|
|
|
|
+ "head":{
|
|
|
|
+ "titleNames":["工作内容"],
|
|
|
|
+ "spanCols":[1],
|
|
|
|
+ "spanRows":[1],
|
|
|
|
+ "vAlign":[1],
|
|
|
|
+ "hAlign":[1],
|
|
|
|
+ "font":["Arial"]
|
|
|
|
+ },
|
|
|
|
+ "data":{
|
|
|
|
+ "field":"content",
|
|
|
|
+ "vAlign":0,
|
|
|
|
+ "hAlign":3,
|
|
|
|
+ "font":"Arial"
|
|
}
|
|
}
|
|
- }
|
|
|
|
- return jobs;
|
|
|
|
- };
|
|
|
|
- var getBillsFeatures = function (node) {
|
|
|
|
- var features = [], i, featureData = null;
|
|
|
|
- if (stdBillsFeatureData && node && node.data.items) {
|
|
|
|
- for (i = 0; i < node.data.items.length - 1; i++) {
|
|
|
|
- featureData = findData(node.data.items[i], 'id', stdBillsFeatureData);
|
|
|
|
- if (featureData) {
|
|
|
|
- features.push(featureData);
|
|
|
|
- }
|
|
|
|
|
|
+ }]
|
|
|
|
+ },
|
|
|
|
+ featuresSetting: {
|
|
|
|
+ "emptyRows":0,
|
|
|
|
+ "headRows":1,
|
|
|
|
+ "headRowHeight":[25],
|
|
|
|
+ "defaultRowHeight": 21,
|
|
|
|
+ "cols":[{
|
|
|
|
+ "width":200,
|
|
|
|
+ "readOnly":true,
|
|
|
|
+ "head":{
|
|
|
|
+ "titleNames":["项目特征"],
|
|
|
|
+ "spanCols":[1],
|
|
|
|
+ "spanRows":[1],
|
|
|
|
+ "vAlign":[1],
|
|
|
|
+ "hAlign":[1],
|
|
|
|
+ "font":["Arial"]
|
|
|
|
+ },
|
|
|
|
+ "data":{
|
|
|
|
+ "field":"content",
|
|
|
|
+ "vAlign":0,
|
|
|
|
+ "hAlign":3,
|
|
|
|
+ "font":"Arial"
|
|
}
|
|
}
|
|
- }
|
|
|
|
- return features;
|
|
|
|
- };
|
|
|
|
- var showJobs = function (jobs) {
|
|
|
|
- var jobsSetting = {
|
|
|
|
- "emptyRows":0,
|
|
|
|
- "headRows":1,
|
|
|
|
- "headRowHeight":[25],
|
|
|
|
- "defaultRowHeight": 21,
|
|
|
|
- "cols":[{
|
|
|
|
- "width":200,
|
|
|
|
- "readOnly":true,
|
|
|
|
- "head":{
|
|
|
|
- "titleNames":["工作内容"],
|
|
|
|
- "spanCols":[1],
|
|
|
|
- "spanRows":[1],
|
|
|
|
- "vAlign":[1],
|
|
|
|
- "hAlign":[1],
|
|
|
|
- "font":["Arial"]
|
|
|
|
- },
|
|
|
|
- "data":{
|
|
|
|
- "field":"content",
|
|
|
|
- "vAlign":0,
|
|
|
|
- "hAlign":3,
|
|
|
|
- "font":"Arial"
|
|
|
|
- }
|
|
|
|
- }]
|
|
|
|
- };
|
|
|
|
- SheetDataHelper.loadSheetHeader(jobsSetting, stdBillsJobSpread.getActiveSheet());
|
|
|
|
- SheetDataHelper.loadSheetData(jobsSetting, stdBillsJobSpread.getActiveSheet(), jobs);
|
|
|
|
- };
|
|
|
|
- var showFeatures = function (features) {
|
|
|
|
- var featuresSetting = {
|
|
|
|
- "emptyRows":0,
|
|
|
|
- "headRows":1,
|
|
|
|
- "headRowHeight":[25],
|
|
|
|
- "defaultRowHeight": 21,
|
|
|
|
- "cols":[{
|
|
|
|
- "width":200,
|
|
|
|
- "readOnly":true,
|
|
|
|
- "head":{
|
|
|
|
- "titleNames":["项目特征"],
|
|
|
|
- "spanCols":[1],
|
|
|
|
- "spanRows":[1],
|
|
|
|
- "vAlign":[1],
|
|
|
|
- "hAlign":[1],
|
|
|
|
- "font":["Arial"]
|
|
|
|
- },
|
|
|
|
- "data":{
|
|
|
|
- "field":"content",
|
|
|
|
- "vAlign":0,
|
|
|
|
- "hAlign":3,
|
|
|
|
- "font":"Arial"
|
|
|
|
- }
|
|
|
|
- }]
|
|
|
|
- };
|
|
|
|
- SheetDataHelper.loadSheetHeader(featuresSetting, stdBillsFeatureSpread.getActiveSheet());
|
|
|
|
- SheetDataHelper.loadSheetData(featuresSetting, stdBillsFeatureSpread.getActiveSheet(), features);
|
|
|
|
- }
|
|
|
|
- var showJobsAndFeatures = function (node) {
|
|
|
|
- $('#stdBillsJobTab').show();
|
|
|
|
- $('#stdBillsRemarkTab').hide();
|
|
|
|
- if (!stdBillsJobSpread) {
|
|
|
|
- stdBillsJobSpread = SheetDataHelper.createNewSpread($('#stdBillsJobs')[0]);
|
|
|
|
- }
|
|
|
|
- showJobs(getBillsJobs(node));
|
|
|
|
- if (!stdBillsFeatureSpread) {
|
|
|
|
- stdBillsFeatureSpread = SheetDataHelper.createNewSpread($('#stdBillsFeatures')[0]);
|
|
|
|
- }
|
|
|
|
- showFeatures(getBillsFeatures(node));
|
|
|
|
- };
|
|
|
|
- var showBillsRemark = function (node) {
|
|
|
|
- $('#stdBillsJobTab').hide();
|
|
|
|
- $('#stdBillsRemarkTab').show();
|
|
|
|
- $('#stdBillsRemark').text(node && node.data.recharge ? node.data.recharge : '');
|
|
|
|
- };
|
|
|
|
- var showBillsRela = function (node) {
|
|
|
|
- if (node && node.children.length === 0) {
|
|
|
|
- showJobsAndFeatures(node);
|
|
|
|
- } else {
|
|
|
|
- showBillsRemark(node);
|
|
|
|
- }
|
|
|
|
|
|
+ }]
|
|
}
|
|
}
|
|
|
|
+};
|
|
|
|
|
|
- var LoadData = function (stdBillsLibID) {
|
|
|
|
- CommonAjax.post('/stdBillsEditor/getJobContent', {userId: userID, billsLibId: stdBillsLibID}, function (datas) {
|
|
|
|
- stdBillsJobData = datas;
|
|
|
|
- }, function () {
|
|
|
|
- stdBillsJobData = [];
|
|
|
|
- });
|
|
|
|
- CommonAjax.post('/stdBillsEditor/getItemCharacter', {userId: userID, billsLibId: stdBillsLibID}, function (datas) {
|
|
|
|
- stdBillsFeatureData = datas;
|
|
|
|
- }, function () {
|
|
|
|
- stdBillsFeatureData = [];
|
|
|
|
- });
|
|
|
|
- CommonAjax.post('/stdBillsEditor/getBills', {userId: userID, billsLibId: stdBillsLibID}, function (datas) {
|
|
|
|
- stdBills = datas;
|
|
|
|
- stdBillsTree.loadDatas(stdBills);
|
|
|
|
- stdBillsTreeController.showTreeData();
|
|
|
|
- showBillsRela(stdBillsTree.firstNode());
|
|
|
|
-
|
|
|
|
- stdBillsTreeController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, showBillsRela);
|
|
|
|
- });
|
|
|
|
|
|
+$('#stdBillsTab').bind('click', function () {
|
|
|
|
+ $(".main-data-side-q").height($(window).height() - $(".header").height() - $(".toolsbar").height() - $(".tools-bar-height-q").height() - 202);
|
|
|
|
+ var select = $('#stdBillsLibSelect');
|
|
|
|
+ billsLibObj.checkBillsSpread();
|
|
|
|
+ if (select[0].options.length === 0) {
|
|
|
|
+ billsLibObj.loadStdBillsLib();
|
|
};
|
|
};
|
|
-
|
|
|
|
- stdBillsSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick, function (sender, args) {
|
|
|
|
- if (stdBillsTree.items[args.row].children.length === 0) {
|
|
|
|
- ProjectController.addBills(project, controller, stdBillsTree.items[args.row]);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- $('#stdBillsSearch>span>button').click(function () {
|
|
|
|
- var keyword = $('#stdBillsSearch>input').val();
|
|
|
|
- var result = stdBillsTree.items.filter(function (item) {
|
|
|
|
- var codeIs = item.data.code ? item.data.code.indexOf(keyword) !== -1 : false;
|
|
|
|
- var nameIs = item.data.name ? item.data.name.indexOf(keyword) !== -1 : false;
|
|
|
|
- return codeIs || nameIs;
|
|
|
|
- });
|
|
|
|
- result.sort(function (x, y) {
|
|
|
|
- return x.serialNo() - y.serialNo();
|
|
|
|
- });
|
|
|
|
- if (result.length !== 0) {
|
|
|
|
- var sel = stdBillsSpread.getActiveSheet().getSelections();
|
|
|
|
- stdBillsTreeController.setTreeSelected(result[0]);
|
|
|
|
- stdBillsSpread.getActiveSheet().setSelection(result[0].serialNo(), sel[0].col, 1, 1);
|
|
|
|
-
|
|
|
|
- $('#nextStdBills').show();
|
|
|
|
- $('#nextStdBills').click(function () {
|
|
|
|
- var cur = stdBillsTree.selected, resultIndex = result.indexOf(cur), sel = stdBillsSpread.getActiveSheet().getSelections();
|
|
|
|
- if (resultIndex === result.length - 1) {
|
|
|
|
- stdBillsTreeController.setTreeSelected(result[0]);
|
|
|
|
- stdBillsSpread.getActiveSheet().setSelection(result[0].serialNo(), sel[0].col, 1, 1);
|
|
|
|
- } else {
|
|
|
|
- stdBillsTreeController.setTreeSelected(result[resultIndex + 1]);
|
|
|
|
- stdBillsSpread.getActiveSheet().setSelection(result[resultIndex + 1].serialNo(), sel[0].col, 1, 1);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- $('#nextStdBills').hide();
|
|
|
|
- }
|
|
|
|
- $('#stdBillsSearchResultCount').text('搜索结果:' + result.length);
|
|
|
|
- $('#stdBillsSearchResult').show();
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- return LoadData;
|
|
|
|
-})();
|
|
|
|
-
|
|
|
|
|
|
+});
|
|
$('#stdBillsLibSelect').change(function () {
|
|
$('#stdBillsLibSelect').change(function () {
|
|
var select = $(this);
|
|
var select = $(this);
|
|
if (this.children.length !== 0) {
|
|
if (this.children.length !== 0) {
|
|
@@ -447,4 +299,5 @@ $('#stdBillsLibSelect').change(function () {
|
|
|
|
|
|
$('#closeSearchStdBills').click(function () {
|
|
$('#closeSearchStdBills').click(function () {
|
|
$('#stdBillsSearchResult').hide();
|
|
$('#stdBillsSearchResult').hide();
|
|
|
|
+ $(".main-data-side-q").height($(window).height() - $(".header").height() - $(".toolsbar").height() - $(".tools-bar-height-q").height() - 202);
|
|
});
|
|
});
|