|
@@ -67,7 +67,6 @@ var rationLibObj = {
|
|
|
var that = this;
|
|
|
var showRationChapterTree = function (datas) {
|
|
|
var rationChapterTree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1, autoUpdate: false});
|
|
|
- console.log(that);
|
|
|
that.tree = rationChapterTree;
|
|
|
var rationChapterTreeController = TREE_SHEET_CONTROLLER.createNew(rationChapterTree, that.rationChapterSpread.getActiveSheet(), that.rationChapterTreeSetting);
|
|
|
rationChapterTree.loadDatas(datas);
|
|
@@ -132,9 +131,6 @@ var rationLibObj = {
|
|
|
sheet.setTag(i, 0, '');
|
|
|
}
|
|
|
for(let i = 0, len = datas.length; i < len; i++){
|
|
|
- if(datas[i].code === 'AA0032'){
|
|
|
- console.log(datas[i]);
|
|
|
- }
|
|
|
sheet.setTag(i, 0, datas[i].hint ? datas[i].hint : '');
|
|
|
}
|
|
|
sheet.resumePaint();
|
|
@@ -448,13 +444,50 @@ $('#rationSearchKeyword').keyup(function () {
|
|
|
if($('#rationSearchResult').is(':visible')){
|
|
|
$('#rationSearchResult').hide();
|
|
|
$(".main-data-side-search", $('#rationSearchResult')).height(0);
|
|
|
+ switchRationSearchMode(0);
|
|
|
autoFlashHeight();
|
|
|
rationLibObj.refreshSpread();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+//变换搜索本定额、全部定额状态
|
|
|
+function switchRationSearchMode(mode) {
|
|
|
+ //搜索本定额
|
|
|
+ if(mode === 0){
|
|
|
+ $('#curRationLib').removeClass('btn-light');
|
|
|
+ $('#curRationLib').addClass('btn-secondary');
|
|
|
+ $('#allRationLibs').removeClass('btn-secondary');
|
|
|
+ $('#allRationLibs').addClass('btn-light');
|
|
|
+ } else {//搜索全部定额
|
|
|
+ $('#allRationLibs').removeClass('btn-light');
|
|
|
+ $('#allRationLibs').addClass('btn-secondary');
|
|
|
+ $('#curRationLib').removeClass('btn-secondary');
|
|
|
+ $('#curRationLib').addClass('btn-light');
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//搜索本定额
|
|
|
+$('#curRationLib').click(function () {
|
|
|
+ if($(this).hasClass('btn-secondary')){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ switchRationSearchMode(0);
|
|
|
+ $('#rationSearch').click();
|
|
|
+});
|
|
|
+
|
|
|
+//搜索全部定额
|
|
|
+$('#allRationLibs').click(function () {
|
|
|
+ if($(this).hasClass('btn-secondary')){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ switchRationSearchMode(1);
|
|
|
+ $('#rationSearch').click();
|
|
|
+});
|
|
|
+
|
|
|
+//搜索
|
|
|
$('#rationSearch').click(function () {
|
|
|
- var keyword = $('#rationSearchKeyword').val(), rationLibID = $('#stdRationLibSelect').val();
|
|
|
+ var keyword = $('#rationSearchKeyword').val();
|
|
|
if(keyword === ''){
|
|
|
if($('#rationSearchResult').is(':visible')){
|
|
|
$('#rationSearchResult').hide();
|
|
@@ -464,19 +497,15 @@ $('#rationSearch').click(function () {
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
- var getResultHtml = function (result) {
|
|
|
- var html = [], i, serialNo;
|
|
|
- html.push('<div class="d-flex justify-content-between">');
|
|
|
- html.push('<span>搜索结果:');
|
|
|
- html.push(result.length.toString());
|
|
|
- html.push('</span>');
|
|
|
- html.push('<a title="关闭搜索" class="btn btn-link btn-sm" href="javascript:void(0)"><i class="fa fa-remove" aria-hidden="true"></i></a>');
|
|
|
- html.push('</div>');
|
|
|
-
|
|
|
- html.push('<div class="w-100 main-data-side-search">');
|
|
|
- html.push('</div>');
|
|
|
- return html.join('');
|
|
|
- };
|
|
|
+ //获取搜索定额的库:本库/所有库
|
|
|
+ let rationLibIDs = [];
|
|
|
+ if($('#curRationLib').hasClass('btn-secondary')){
|
|
|
+ rationLibIDs.push($('#stdRationLibSelect').val());
|
|
|
+ } else {
|
|
|
+ for(let lib of projectInfoObj.projectInfo.engineeringInfo.ration_lib){
|
|
|
+ rationLibIDs.push(lib.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
let bindContextmenuOpr = function (sheet) {
|
|
|
$.contextMenu({
|
|
|
selector: '#rationSearchResult',
|
|
@@ -503,7 +532,23 @@ $('#rationSearch').click(function () {
|
|
|
$(".main-data-side-search", $('#rationSearchResult')).height(0);
|
|
|
autoFlashHeight();
|
|
|
rationLibObj.refreshSpread();
|
|
|
- rationLibObj.locateAtRation(data.rationRepId, data.code);
|
|
|
+ switchRationSearchMode(0);
|
|
|
+ if($('#stdRationLibSelect').select().val() != data.rationRepId){
|
|
|
+ let libOpts = $('#stdRationLibSelect').find('option');
|
|
|
+ for(let libOpt of libOpts){
|
|
|
+ if($(libOpt).val() == data.rationRepId){
|
|
|
+ $(libOpt).prop('selected', 'selected');
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $('#stdRationLibSelect').change();
|
|
|
+ rationLibObj.doAfterGetRationTree = function () {
|
|
|
+ this.locateAtRation(data.rationRepId, data.code);
|
|
|
+ this.doAfterGetRationTree = null;
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ rationLibObj.locateAtRation(data.rationRepId, data.code);
|
|
|
+ }
|
|
|
}}
|
|
|
}
|
|
|
};
|
|
@@ -528,7 +573,8 @@ $('#rationSearch').click(function () {
|
|
|
SheetDataHelper.loadSheetData(rationLibObj.sectionRationsSetting, rationLibObj.resultSpread.getActiveSheet(), result);
|
|
|
rationLibObj.setTagForHint(rationLibObj.resultSpread.getActiveSheet(), result);
|
|
|
};
|
|
|
- CommonAjax.post('/complementaryRation/api/findRation', {'user_id': userID, 'rationRepId': rationLibID, 'keyword': keyword}, function (result) {
|
|
|
+ $.bootstrapLoading.start();
|
|
|
+ CommonAjax.post('/complementaryRation/api/findRation', {'user_id': userID, 'rationRepId': rationLibIDs, 'keyword': keyword}, function (result) {
|
|
|
//sort
|
|
|
result.sort(function (a, b) {
|
|
|
let rst = 0;
|
|
@@ -537,11 +583,10 @@ $('#rationSearch').click(function () {
|
|
|
return rst;
|
|
|
});
|
|
|
var resultObj = $('#rationSearchResult');
|
|
|
- /*resultObj.empty();
|
|
|
- resultObj.append(getResultHtml(result));*/
|
|
|
$('#rationSearchCount').text(`搜索结果:${result.length.toString()}`);
|
|
|
$('a', result).unbind('click');
|
|
|
$('a', resultObj).bind('click', function () {
|
|
|
+ switchRationSearchMode(0);
|
|
|
resultObj.hide();
|
|
|
$(".main-data-side-search", resultObj).height(0);
|
|
|
autoFlashHeight();
|
|
@@ -550,5 +595,8 @@ $('#rationSearch').click(function () {
|
|
|
resultObj.show();
|
|
|
$(".main-data-side-search", resultObj).height($(window).height() - $(".header").height() - $(".toolsbar").height() - 64);
|
|
|
showResult(result);
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ }, function () {
|
|
|
+ $.bootstrapLoading.end();
|
|
|
});
|
|
|
});
|