|
@@ -32,7 +32,7 @@
|
|
<a id="aStdJobs" class="nav-link px-3" href="stdJobs">工作内容</a>
|
|
<a id="aStdJobs" class="nav-link px-3" href="stdJobs">工作内容</a>
|
|
</li>
|
|
</li>
|
|
<li class="nav-item">
|
|
<li class="nav-item">
|
|
- <a class="nav-link px-3" href="tezheng.html">项目特征</a>
|
|
|
|
|
|
+ <a id="aStdItems" class="nav-link px-3" href="stdItems">项目特征</a>
|
|
</li>
|
|
</li>
|
|
</ul>
|
|
</ul>
|
|
</nav>
|
|
</nav>
|
|
@@ -67,7 +67,6 @@
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</nav>
|
|
<div class="main-data" id="spreadBills">
|
|
<div class="main-data" id="spreadBills">
|
|
- <!--<div id="spreadBills" style="width: 100%; height: 700px;"></div>-->
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="main-side col-lg-5 p-0">
|
|
<div class="main-side col-lg-5 p-0">
|
|
@@ -220,70 +219,91 @@
|
|
<script src="public/web/tree_sheet_helper.js"></script>
|
|
<script src="public/web/tree_sheet_helper.js"></script>
|
|
<script src="web/billsLib/scripts/billsLibSetting.js"></script>
|
|
<script src="web/billsLib/scripts/billsLibSetting.js"></script>
|
|
<script src="web/billsLib/scripts/billsLibTree.js"></script>
|
|
<script src="web/billsLib/scripts/billsLibTree.js"></script>
|
|
- <!--<script src="test/tmp_data/data_15690.js"></script>-->
|
|
|
|
<script src="test/tmp_data/bills_grid_setting.js"></script>
|
|
<script src="test/tmp_data/bills_grid_setting.js"></script>
|
|
<script src="web/billsLib/scripts/dbController.js"></script>
|
|
<script src="web/billsLib/scripts/dbController.js"></script>
|
|
<script src="web/billsLib/scripts/tools.js"></script>
|
|
<script src="web/billsLib/scripts/tools.js"></script>
|
|
</body>
|
|
</body>
|
|
<script type="text/javascript">
|
|
<script type="text/javascript">
|
|
autoFlashHeight();
|
|
autoFlashHeight();
|
|
|
|
+ var maxJobsNumber;
|
|
|
|
+ var maxItemsNumber;
|
|
|
|
+ var orgJobData;
|
|
|
|
+ var orgItemData;
|
|
var billsTree = billsLibTree.createBillsTree();
|
|
var billsTree = billsLibTree.createBillsTree();
|
|
var billsLibId = getQueryString("billsLibId");
|
|
var billsLibId = getQueryString("billsLibId");
|
|
|
|
+ tools.redirect(billsLibId, 'stdBillsmain');
|
|
var jobsSpread = new GC.Spread.Sheets.Workbook($("#spreadJobs")[0], {sheetCount: 1});
|
|
var jobsSpread = new GC.Spread.Sheets.Workbook($("#spreadJobs")[0], {sheetCount: 1});
|
|
var itemsSpread = new GC.Spread.Sheets.Workbook($("#spreadItems")[0], {sheetCount: 1});
|
|
var itemsSpread = new GC.Spread.Sheets.Workbook($("#spreadItems")[0], {sheetCount: 1});
|
|
$(document).ready(function(){
|
|
$(document).ready(function(){
|
|
$("#aStdJobs").attr('href', function(){
|
|
$("#aStdJobs").attr('href', function(){
|
|
return 'stdJobs?billsLibId=' + billsLibId;
|
|
return 'stdJobs?billsLibId=' + billsLibId;
|
|
});
|
|
});
|
|
|
|
+ $('#aStdItems').attr('href', function(){
|
|
|
|
+ return 'stdItems?billsLibId=' + billsLibId;
|
|
|
|
+ });
|
|
billsAjax.getStdBillsLibName(billsLibId);
|
|
billsAjax.getStdBillsLibName(billsLibId);
|
|
billsAjax.getBills(billsLibId, function(bills){
|
|
billsAjax.getBills(billsLibId, function(bills){
|
|
showBillsSheet(bills, jobsSpread.getActiveSheet(), itemsSpread.getActiveSheet(), billsLibSetting)
|
|
showBillsSheet(bills, jobsSpread.getActiveSheet(), itemsSpread.getActiveSheet(), billsLibSetting)
|
|
});
|
|
});
|
|
- buildJobs(jobsSpread);
|
|
|
|
- buildItems(itemsSpread);
|
|
|
|
|
|
+ buildJobs(jobsSpread, jobsSetting);
|
|
|
|
+ buildItems(itemsSpread, itemsSetting);
|
|
});
|
|
});
|
|
- //test
|
|
|
|
- //test
|
|
|
|
-
|
|
|
|
|
|
|
|
- function nodeOpration(controller){
|
|
|
|
|
|
+ function nodeOpration(controller, totalJobs, totalItems){
|
|
dbController.editData(controller, controller.sheet);
|
|
dbController.editData(controller, controller.sheet);
|
|
$('#insert').click(function(){
|
|
$('#insert').click(function(){
|
|
- //controller.insert();
|
|
|
|
dbController.insert(controller);
|
|
dbController.insert(controller);
|
|
|
|
+ tools.clearData(jobsSpread.getActiveSheet());
|
|
|
|
+ tools.clearData(itemsSpread.getActiveSheet());
|
|
});
|
|
});
|
|
$('#delete').click(function(){
|
|
$('#delete').click(function(){
|
|
- //controller.delete();
|
|
|
|
- dbController.delete(controller);
|
|
|
|
|
|
+ dbController.delete(controller, totalJobs, totalItems);
|
|
});
|
|
});
|
|
$('#upLevel').click(function(){
|
|
$('#upLevel').click(function(){
|
|
- // controller.upLevel();
|
|
|
|
dbController.upLevel(controller);
|
|
dbController.upLevel(controller);
|
|
});
|
|
});
|
|
$('#downLevel').click(function(){
|
|
$('#downLevel').click(function(){
|
|
- // controller.downLevel();
|
|
|
|
dbController.downLevel(controller);
|
|
dbController.downLevel(controller);
|
|
});
|
|
});
|
|
$('#upMove').click(function(){
|
|
$('#upMove').click(function(){
|
|
- // controller.upMove();
|
|
|
|
dbController.upMove(controller);
|
|
dbController.upMove(controller);
|
|
});
|
|
});
|
|
$('#downMove').click(function(){
|
|
$('#downMove').click(function(){
|
|
- // controller.downMove();
|
|
|
|
dbController.downMove(controller);
|
|
dbController.downMove(controller);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- function showBillsSheet(datas, jobsSheet, itemsSheet, setting){
|
|
|
|
|
|
+ function showBillsSheet(datas, jobsSheet, itemsSheet, setting) {
|
|
var billsSpread = new GC.Spread.Sheets.Workbook($('#spreadBills')[0], {sheetCount: 1});
|
|
var billsSpread = new GC.Spread.Sheets.Workbook($('#spreadBills')[0], {sheetCount: 1});
|
|
- initSheet(billsSpread);
|
|
|
|
|
|
+ setSheet.initSheet(billsSpread, setting);
|
|
|
|
+ myKey.delKey(billsSpread);
|
|
billsTree.loadDatas(datas);
|
|
billsTree.loadDatas(datas);
|
|
- var controller = TREE_SHEET_CONTROLLER.createInit(billsTree.tree, billsSpread.getActiveSheet(), setting);
|
|
|
|
|
|
+ var controller = TREE_SHEET_CONTROLLER.createNew(billsTree.tree, billsSpread.getActiveSheet(), setting);
|
|
controller.showTreeData();
|
|
controller.showTreeData();
|
|
- if(!controller.tree.selected && controller.tree.findNode(controller.sheet.getTag(0, 0, GC.Spread.Sheets.SheetArea.viewport))){
|
|
|
|
|
|
+ if (!controller.tree.selected && controller.tree.findNode(controller.sheet.getTag(0, 0, GC.Spread.Sheets.SheetArea.viewport))) {
|
|
controller.setTreeSelected(controller.tree.findNode(controller.sheet.getTag(0, 0, GC.Spread.Sheets.SheetArea.viewport)));
|
|
controller.setTreeSelected(controller.tree.findNode(controller.sheet.getTag(0, 0, GC.Spread.Sheets.SheetArea.viewport)));
|
|
}
|
|
}
|
|
|
|
+ //刷新节点可进行操作的按钮
|
|
|
|
+ refreshBtn(controller);
|
|
|
|
+ controller.setTreeSelected(controller.tree.findNode(controller.sheet.getTag(0, 0)));
|
|
|
|
+ /*//节点操作
|
|
|
|
+ nodeOpration(controller, totalJobs, totalItems);*/
|
|
|
|
+ //补注内容改变
|
|
|
|
+ rechargeChange(controller);
|
|
|
|
+ //jobs
|
|
|
|
+ jobOperation(controller, jobsSheet, function(totalJobs){
|
|
|
|
+ //items
|
|
|
|
+ itemOperation(controller, itemsSheet, function(totalItems){
|
|
|
|
+ //节点操作
|
|
|
|
+ nodeOpration(controller, totalJobs, totalItems);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ /* //items
|
|
|
|
+ itemOperation(controller, itemsSheet);*/
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function refreshBtn(controller){
|
|
controller.bind('refreshBaseActn', function (tree) {
|
|
controller.bind('refreshBaseActn', function (tree) {
|
|
var showButton = function (show, btn) {
|
|
var showButton = function (show, btn) {
|
|
if (show) {
|
|
if (show) {
|
|
@@ -298,291 +318,117 @@
|
|
showButton(tree.selected && tree.selected.canDownMove(), $('#downMove'));
|
|
showButton(tree.selected && tree.selected.canDownMove(), $('#downMove'));
|
|
showButton(tree.selected ? true : false, $('#delete'));
|
|
showButton(tree.selected ? true : false, $('#delete'));
|
|
});
|
|
});
|
|
- controller.setTreeSelected(controller.tree.findNode(controller.sheet.getTag(0,0)));
|
|
|
|
- nodeOpration(controller);
|
|
|
|
-
|
|
|
|
- /*var totalJobs = new TotalJobs(controller.tree);
|
|
|
|
- totalJobs.loadJobs(controller.tree.items);
|
|
|
|
-
|
|
|
|
- bindSheet(controller, jobsSheet, 'jobs', jobsSetting);
|
|
|
|
- jobsController(controller, jobsSheet, totalJobs, jobsSetting);*/
|
|
|
|
-
|
|
|
|
- mainAjax.getMaxNumber(billsLibId, 'jobs', function(maxNumber){
|
|
|
|
- var totalJobs = createObj.newJobs();
|
|
|
|
- totalJobs.loadJobs(controller.tree.items);
|
|
|
|
- bindSheet(controller, jobsSheet, 'jobs', jobsSetting);
|
|
|
|
- jobsController.editData(controller, jobsSheet, totalJobs, maxNumber, jobsSetting);
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /*var totalItems = createObj.newItems();
|
|
|
|
- totalItems.loadItems(controller.tree.items);
|
|
|
|
- bindSheet(controller, itemsSheet, 'items', itemsSetting);
|
|
|
|
- itemsController.editData(controller, itemsSheet, totalItems, itemsSetting);*/
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- //testNodeID:
|
|
|
|
- /*console.log('newNodeID: '+controller.tree.newNodeID());
|
|
|
|
- console.log('maxNodeID: '+controller.tree.maxNodeID());
|
|
|
|
- console.log('rangeNodeID: '+controller.tree.rangeNodeID());
|
|
|
|
- controller.tree.maxNodeID(100);
|
|
|
|
- console.log('newNodeID: '+controller.tree.newNodeID());*/
|
|
|
|
- //test
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- /*var Job = function(data){
|
|
|
|
- this.data = data;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- var TotalJobs = function(tree){
|
|
|
|
- this.tree = tree;
|
|
|
|
- this.jobs = {};
|
|
|
|
- this.jobsArr = [];
|
|
|
|
- this.prefix = '_id';
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- TotalJobs.prototype.loadJobs = function (nodes){
|
|
|
|
- var me = this;
|
|
|
|
- jobsAjax.getJobContent(billsLibId, function(reslut){
|
|
|
|
- reslut.forEach(function(jobData){
|
|
|
|
- var job = new Job(jobData);
|
|
|
|
- me.jobs[me.prefix + jobData.id] = job;
|
|
|
|
- me.jobsArr.push(job);
|
|
|
|
- });
|
|
|
|
- nodes.forEach(function(node){
|
|
|
|
- node.data.jobs.forEach(function(data){
|
|
|
|
- node.jobs.push(me.jobs[me.prefix + data.id]);
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
|
|
+ function rechargeChange(controller){
|
|
|
|
+ $('#exampleTextarea').bind('change', function(){
|
|
|
|
+ var newData = $('#exampleTextarea').val();
|
|
|
|
+ if(controller.tree.selected){
|
|
|
|
+ rechargeController.updateRechar(controller.tree.selected, newData);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
- TotalJobs.prototype.getUpdateIds = function(nodes, repeatId){
|
|
|
|
- var ids = [];
|
|
|
|
- nodes.forEach(function(node){
|
|
|
|
- node.jobs.forEach(function(job){
|
|
|
|
- if(job.data.id === repeatId){
|
|
|
|
- ids.push(node.getID());
|
|
|
|
|
|
+ function jobOperation(controller, jobsSheet, callback){
|
|
|
|
+ mainAjax.getMaxNumber(billsLibId, 'jobs', function(result){
|
|
|
|
+ if(result.length === 0){
|
|
|
|
+ maxJobsNumber = 0;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ maxJobsNumber = result[0].code;
|
|
|
|
+ }
|
|
|
|
+ jobsAjax.getJobContent(billsLibId, function(datas){
|
|
|
|
+ var totalJobs = createObj.newJobs();
|
|
|
|
+ totalJobs.loadJobs(controller.tree.items, datas);
|
|
|
|
+ initData(controller, jobsSheet, jobsSetting, 'jobs');
|
|
|
|
+ myKey.delKey(jobsSpread, controller, totalJobs, jobsSetting, 'jobs');
|
|
|
|
+ bindSheet(controller, jobsSheet, 'jobs', jobsSetting);
|
|
|
|
+ jobsController.editData(controller, jobsSheet, totalJobs, jobsSetting);
|
|
|
|
+ if (callback){
|
|
|
|
+ callback(totalJobs);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|
|
- return ids;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //items
|
|
|
|
- var Item = function(data){
|
|
|
|
- this.data = data;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- var TotalItems = function(tree){
|
|
|
|
- this.tree = tree;
|
|
|
|
- this.items = {};
|
|
|
|
- this.itemsArr = [];
|
|
|
|
- this.prefix = '_id';
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- TotalItems.prototype.loaditems = function (nodes){
|
|
|
|
- var me = this;
|
|
|
|
- itemsAjax.getItemCharacter(billsLibId, function(reslut){
|
|
|
|
- reslut.forEach(function(itemData){
|
|
|
|
- var item = new Item(itemData);
|
|
|
|
- me.items[me.prefix + itemData.id] = item;
|
|
|
|
- me.itemsArr.push(item);
|
|
|
|
- });
|
|
|
|
- nodes.forEach(function(node){
|
|
|
|
- node.data.items.forEach(function(data){
|
|
|
|
- node.items.push(me.items[me.prefix + data.id]);
|
|
|
|
- });
|
|
|
|
|
|
+ function itemOperation(controller, itemsSheet, callback){
|
|
|
|
+ mainAjax.getMaxNumber(billsLibId, 'items', function(result){
|
|
|
|
+ if(result.length === 0){
|
|
|
|
+ maxItemsNumber = 0;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ maxItemsNumber = result[0].code;
|
|
|
|
+ }
|
|
|
|
+ itemsAjax.getItemCharacter(billsLibId, function(datas){
|
|
|
|
+ var totalItems = createObj.newItems();
|
|
|
|
+ totalItems.loadItems(controller.tree.items, datas);
|
|
|
|
+ initData(controller, itemsSheet, itemsSetting, 'items');
|
|
|
|
+ myKey.delKey(itemsSpread, controller, totalItems, itemsSetting, 'items');
|
|
|
|
+ bindSheet(controller, itemsSheet, 'items', itemsSetting);
|
|
|
|
+ itemsController.editData(controller, itemsSheet, totalItems, itemsSetting);
|
|
|
|
+ if(callback){
|
|
|
|
+ callback(totalItems)
|
|
|
|
+ }
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- TotalItems.prototype.getUpdateIds = function(nodes, repeatId){
|
|
|
|
- var ids = [];
|
|
|
|
- nodes.forEach(function(node){
|
|
|
|
- node.items.forEach(function(item){
|
|
|
|
- if(item.data.id === repeatId){
|
|
|
|
- ids.push(node.getID());
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- return ids;
|
|
|
|
- }*/
|
|
|
|
|
|
+ //初始焦点工作表和项目表绑定数据
|
|
|
|
+ function initData(controller, sheet, setting, classify){
|
|
|
|
+ if(controller.tree.selected){
|
|
|
|
+ var arr = controller.tree.selected[classify];
|
|
|
|
+ var recharge = controller.tree.selected.data.recharge;
|
|
|
|
+ if(arr.length > 0){
|
|
|
|
+ tools.reshowData(sheet, arr, setting, true);
|
|
|
|
+ }
|
|
|
|
+ if(recharge){
|
|
|
|
+ $('#exampleTextarea').val(recharge);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
function bindSheet(controller, sheet, field, setting){
|
|
function bindSheet(controller, sheet, field, setting){
|
|
controller.sheet.bind(GC.Spread.Sheets.Events.SelectionChanged, function(sender, args){
|
|
controller.sheet.bind(GC.Spread.Sheets.Events.SelectionChanged, function(sender, args){
|
|
- if(controller.tree.selected && args.oldSelections[0].row !== args.newSelections[0].row|| controller.tree.selected && args.oldSelections[0].row === 0){
|
|
|
|
- sheet.clear(0, 0, sheet.getRowCount(), sheet.getColumnCount(), GC.Spread.Sheets.SheetArea.viewport,GC.Spread.Sheets.StorageType.data);
|
|
|
|
- sheet.clear(0, 0, sheet.getRowCount(), sheet.getColumnCount(), GC.Spread.Sheets.SheetArea.viewport,GC.Spread.Sheets.StorageType.tag);
|
|
|
|
|
|
+ if(controller.tree.selected && args.oldSelections[0].row !== args.newSelections[0].row|| controller.tree.selected && args.oldSelections[0].row === 0){
|
|
|
|
+ //rechargeArea
|
|
|
|
+ $('#exampleTextarea').val(controller.tree.selected.data.recharge);
|
|
|
|
+ tools.clearData(sheet);
|
|
if(field === 'jobs'){
|
|
if(field === 'jobs'){
|
|
var jobs = controller.tree.selected.jobs;
|
|
var jobs = controller.tree.selected.jobs;
|
|
if(jobs.length > 0){
|
|
if(jobs.length > 0){
|
|
- for(var i=0; i<jobs.length; i++){
|
|
|
|
- setting.cols.forEach(function(col, cidx){
|
|
|
|
- sheet.setTag(i, cidx, jobs[i].data.id, GC.Spread.Sheets.SheetArea.viewport);
|
|
|
|
- if(jobs[i].data[col.data.field]){
|
|
|
|
- sheet.getCell(i, cidx, GC.Spread.Sheets.SheetArea.viewport).value(jobs[i].data[col.data.field]);
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- sheet.getCell(i, cidx, GC.Spread.Sheets.SheetArea.viewport).value('');
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ tools.reshowData(sheet, jobs, setting, true);
|
|
|
|
+ orgJobData = sheet.getValue(0, 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(field === 'items'){
|
|
if(field === 'items'){
|
|
var items = controller.tree.selected.items;
|
|
var items = controller.tree.selected.items;
|
|
if(items.length > 0){
|
|
if(items.length > 0){
|
|
- for(var i=0; i<items.length; i++){
|
|
|
|
- setting.cols.forEach(function(col, cidx){
|
|
|
|
- sheet.setTag(i, cidx, items[i].data.id, GC.Spread.Sheets.SheetArea.viewport);
|
|
|
|
- if(items[i].data[col.data.field]){
|
|
|
|
- sheet.getCell(i, cidx, GC.Spread.Sheets.SheetArea.viewport).value(items[i].data[col.data.field]);
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- sheet.getCell(i, cidx, GC.Spread.Sheets.SheetArea.viewport).value('');
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ tools.reshowData(sheet, items, setting, true);
|
|
|
|
+ orgItemData = sheet.getValue(0, 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-/* function jobsController(controller, sheet, totalJobs, setting){
|
|
|
|
- var orgData;
|
|
|
|
- sheet.bind(GC.Spread.Sheets.Events.EnterCell, function(sender, args){
|
|
|
|
- orgData = sheet.getCell(args.row, args.col).value();
|
|
|
|
- });
|
|
|
|
- sheet.bind(GC.Spread.Sheets.Events.EditEnded, function(sender, args){
|
|
|
|
- var field, newData = args.editingText, id = sheet.getTag(args.row, args.col) ;
|
|
|
|
- setting.cols.forEach(function(col, idx){
|
|
|
|
- if(args.col === idx){
|
|
|
|
- field = col.data.field;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- if(controller.tree.selected){
|
|
|
|
- var isExist = false;
|
|
|
|
- var isRepeat = false;
|
|
|
|
- //isRepeat?
|
|
|
|
- if(controller.tree.selected.jobs){
|
|
|
|
- controller.tree.selected.jobs.forEach(function(job){
|
|
|
|
- if(job.data[field] === newData && id !== job.data.id){
|
|
|
|
- isRepeat = true;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- //create
|
|
|
|
- if(!id && newData && !isRepeat){
|
|
|
|
- if(totalJobs.jobsArr.length > 0){
|
|
|
|
- totalJobs.jobsArr.forEach(function(job){
|
|
|
|
- //todo:整合代码
|
|
|
|
- if(field === 'content'&& newData === job.data.content){
|
|
|
|
- console.log('ECreate1');
|
|
|
|
- isExist = true;
|
|
|
|
- billsAjax.updateBills(billsLibId, controller.tree.selected.getID(), 'jobs', job.data);
|
|
|
|
- if(!controller.tree.selected.jobs){
|
|
|
|
- controller.tree.selected.jobs = new Array();
|
|
|
|
- }
|
|
|
|
- controller.tree.selected.jobs.push(job);
|
|
|
|
- sheet.getCell(args.row, 0).value(job.data.code);
|
|
|
|
- sheet.setTag(args.row, 0, job.data.id);
|
|
|
|
- sheet.setTag(args.row, 1, job.data.id);
|
|
|
|
- }
|
|
|
|
- else if(field === 'code' && newData === job.data.code){
|
|
|
|
- console.log('ECreate2');
|
|
|
|
- isExist = true;
|
|
|
|
- billsAjax.updateBills(billsLibId, controller.tree.selected.getID(), 'jobs', job.data);
|
|
|
|
- if(!controller.tree.selected.jobs){
|
|
|
|
- controller.tree.selected.jobs = new Array();
|
|
|
|
- }
|
|
|
|
- controller.tree.selected.jobs.push(job);
|
|
|
|
- sheet.getCell(args.row, 1).value(job.data.content);
|
|
|
|
- sheet.setTag(args.row, 0, job.data.id);
|
|
|
|
- sheet.setTag(args.row, 1, job.data.id);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- if(!isExist){
|
|
|
|
- console.log('notEcreate');
|
|
|
|
- jobsAjax.createJobContent(billsLibId, field, newData, function(id){
|
|
|
|
- var newJobData, newJob;
|
|
|
|
- if(field === 'code'){
|
|
|
|
- newJobData = {id: id, code: newData, content: ''};
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- newJobData = {id: id, content: newData, code: ''};
|
|
|
|
- }
|
|
|
|
- newJob = new Job(newJobData);
|
|
|
|
- totalJobs.jobs[totalJobs.prefix + id] = newJob;
|
|
|
|
- totalJobs.jobsArr.push(newJob);
|
|
|
|
- billsAjax.updateBills(billsLibId, controller.tree.selected.getID(), 'jobs', newJobData);
|
|
|
|
- if(!controller.tree.selected.jobs){
|
|
|
|
- controller.tree.selected.jobs = new Array();
|
|
|
|
- }
|
|
|
|
- controller.tree.selected.jobs.push(newJob);
|
|
|
|
- sheet.setTag(args.row, 0, id);
|
|
|
|
- sheet.setTag(args.row, 1, id);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- console.log('0create '+totalJobs.jobsArr.length);
|
|
|
|
- jobsAjax.createJobContent(billsLibId, field, newData, function(id){
|
|
|
|
- var newJobData, newJob;
|
|
|
|
- if(field === 'code'){
|
|
|
|
- newJobData = {id: id, code: newData, content: ''};
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- newJobData = {id: id, content: newData, code: ''};
|
|
|
|
- }
|
|
|
|
- newJob = new Job(newJobData);
|
|
|
|
- totalJobs.jobs[totalJobs.prefix + id] = newJob;
|
|
|
|
- totalJobs.jobsArr.push(newJob);
|
|
|
|
- billsAjax.updateBills(billsLibId, controller.tree.selected.getID(), 'jobs', newJobData);
|
|
|
|
- if(!controller.tree.selected.jobs){
|
|
|
|
- controller.tree.selected.jobs = new Array();
|
|
|
|
- }
|
|
|
|
- controller.tree.selected.jobs.push(newJob);
|
|
|
|
- sheet.setTag(args.row, 0, id);
|
|
|
|
- sheet.setTag(args.row, 1, id);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //update
|
|
|
|
- else if(id && newData !== orgData && !isRepeat){
|
|
|
|
- console.log('update');
|
|
|
|
- var ids = totalJobs.getUpdateIds(controller.tree.items, id);
|
|
|
|
- totalJobs.jobs[totalJobs.prefix + id].data[field] = newData;
|
|
|
|
- jobsAjax.updateJobContent(id, field, newData);
|
|
|
|
- billsAjax.updateBillsArr(billsLibId, ids, field, id, newData);
|
|
|
|
- }
|
|
|
|
- if(isRepeat){
|
|
|
|
- //todo:redirect focus
|
|
|
|
- if(id && newData){
|
|
|
|
- console.log('isRepeat1 orgData:'+orgData);
|
|
|
|
- sheet.getCell(args.row, args.col, GC.Spread.Sheets.SheetArea.viewport).value(orgData);
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- console.log('isRepeat2');
|
|
|
|
- sheet.getCell(args.row, args.col, GC.Spread.Sheets.SheetArea.viewport).value('');
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //delete
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ else {
|
|
|
|
+ tools.clearData(sheet);
|
|
|
|
+ $('#exampleTextarea').val('');
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ }
|
|
|
|
|
|
- }*/
|
|
|
|
|
|
|
|
- function buildJobs(jobsSpread){
|
|
|
|
- initSheet(jobsSpread);
|
|
|
|
|
|
+ function buildJobs(jobsSpread, setting){
|
|
|
|
+ setSheet.initSheet(jobsSpread, setting);
|
|
|
|
+ setSheet.setMaxRowCount(jobsSpread.getActiveSheet(), 10);
|
|
|
|
+ myKey.downKey(jobsSpread);
|
|
|
|
+ myKey.enterKey(jobsSpread);
|
|
TREE_SHEET_HELPER.loadSheetHeader(jobsSetting, jobsSpread.getActiveSheet());
|
|
TREE_SHEET_HELPER.loadSheetHeader(jobsSetting, jobsSpread.getActiveSheet());
|
|
}
|
|
}
|
|
|
|
|
|
- function buildItems(itemsSpread){
|
|
|
|
- initSheet(itemsSpread);
|
|
|
|
|
|
+ function buildItems(itemsSpread, setting){
|
|
|
|
+ setSheet.initSheet(itemsSpread, setting);
|
|
|
|
+ setSheet.setMaxRowCount(itemsSpread.getActiveSheet(), 10);
|
|
|
|
+ myKey.downKey(itemsSpread);
|
|
|
|
+ myKey.enterKey(itemsSpread);
|
|
TREE_SHEET_HELPER.loadSheetHeader(itemsSetting, itemsSpread.getActiveSheet());
|
|
TREE_SHEET_HELPER.loadSheetHeader(itemsSetting, itemsSpread.getActiveSheet());
|
|
}
|
|
}
|
|
|
|
|