|
@@ -19,7 +19,7 @@ var rationLibObj = {
|
|
|
this.sectionRationsSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick, function (sender, args) {
|
|
|
var select = $('#stdRationLibSelect'), rationCode = args.sheet.getText(args.row, 0);
|
|
|
if (rationCode !== '') {
|
|
|
- CommonAjax.postRationLib('/rationRepository/api/getRationItem', {user_id: userID, sectionId: rationLibObj.rationChapterTreeController.tree.selected.getID(), code: rationCode}, function (data) {
|
|
|
+ CommonAjax.postRationLib('/rationRepository/api/getRationItem', {user_id: userID, rationLibId: select.val(), code: rationCode}, function (data) {
|
|
|
ProjectController.addRation(project, controller, data);
|
|
|
});
|
|
|
}
|
|
@@ -202,3 +202,38 @@ $('#stdRationLibSelect').change(function () {
|
|
|
rationLibObj.loadStdRation(select.val());
|
|
|
}
|
|
|
});
|
|
|
+$('#rationSearch').click(function () {
|
|
|
+ var keyword = $('#rationSearchKeyword').val(), rationLibID = $('#stdRationLibSelect').val();
|
|
|
+ var getResultHtml = function (result) {
|
|
|
+ var html = [], i;
|
|
|
+ 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="result-box w-100">');
|
|
|
+ html.push('<table class="table">');
|
|
|
+ html.push('<thead><tr><th></th><th>编号</th><th>名称</th><th>单位</th><th>基价</th></tr></thead>');
|
|
|
+ html.push('<tbody>');
|
|
|
+ for (i = 0; i < result.length; i++) {
|
|
|
+ html.push('<tr>');
|
|
|
+ html.push('<td>' + i.toString() + '</td>');
|
|
|
+ html.push('<td>' + result[i].code + '</td>');
|
|
|
+ html.push('<td>' + result[i].name + '</td>');
|
|
|
+ html.push('<td>' + result[i].unit + '</td>');
|
|
|
+ html.push('</tr>');
|
|
|
+ }
|
|
|
+ html.push('</tbody>');
|
|
|
+ html.push('</table>');
|
|
|
+ html.push('</div>');
|
|
|
+ return html.join('');
|
|
|
+ }
|
|
|
+ CommonAjax.postRationLib('/rationRepository/api/findRation', {'user_id': userID, 'rationLibId': rationLibID, 'keyword': keyword}, function (result) {
|
|
|
+ var resultObj = $('#rationSearchResult');
|
|
|
+ resultObj.empty();
|
|
|
+ resultObj.append(getResultHtml(result));
|
|
|
+ resultObj.show();
|
|
|
+ });
|
|
|
+});
|