Explorar o código

ration Search

MaiXinRong %!s(int64=8) %!d(string=hai) anos
pai
achega
3ef5812275

+ 7 - 5
modules/ration_repository/models/ration_item.js

@@ -75,20 +75,22 @@ rationItemDAO.prototype.removeRationItems = function(rIds,callback){
 };
 
 rationItemDAO.prototype.getRationItemsByCode = function(repId, code,callback){
-    rationItemModel.find({"rationRepId": repId, "code": /code/, "$or": [{"isDeleted": null}, {"isDeleted": false}]},function(err,data){
+    rationItemModel.find({"rationRepId": repId, "code": {'$regex': code}, "$or": [{"isDeleted": null}, {"isDeleted": false}]},function(err,data){
         if(err) callback(true, "Fail to get items", "")
         else callback(false,"Get items successfully", data);
     })
 };
 
 rationItemDAO.prototype.findRation = function (repId, keyword, callback) {
-    rationItemModel.find({'rationRepId': repId,
+    var filter = {
+        'rationRepId': repId,
         '$and': [{
-            '$or': [{'code': /keyword/}, {'name': /keyword/}]
+            '$or': [{'code':{'$regex': keyword}}, {'name': {'$regex': keyword}}]
         }, {
-            '$or': [{'isDeleted': null}, {'isDeleted': false}]
+            '$or': [{'isDeleted': {"$exists":false}}, {'isDeleted': null}, {'isDeleted': false}]
         }]
-    }, function (err, data) {
+    };
+    rationItemModel.find(filter, function (err, data) {
         if (err) {
             callback(true, 'Fail to find ration', null);
         } else {

+ 0 - 12
web/building_saas/main/html/main.html

@@ -231,18 +231,6 @@
                                           </div>
                                           <!--搜索结果窗体-->
                                           <div class="side-search-box col-12 p-2" id="rationSearchResult" style="display: none;">
-                                              <div class="d-flex justify-content-between">
-                                                  <span>搜索结果:5</span><a title="关闭搜索" class="btn btn-link btn-sm" href="javascript:void(0)"><i class="fa fa-remove" aria-hidden="true"></i></a>
-                                              </div>
-                                              <div class="result-box w-100">
-                                                  <table class="table">
-                                                      <thead><tr><th></th><th>编号</th><th>名称</th><th>单位</th><th>基价</th></tr></thead>
-                                                      <tbody>
-                                                      <tr><td>1</td><td>1-1-8-2</td><td>机动翻斗车运第1个100m石方</td><td>1000m3</td><td>6249</td></tr>
-                                                      <tr><td>1</td><td>1-1-8-2</td><td>机动翻斗车运第1个100m石方</td><td>1000m3</td><td>6249</td></tr>
-                                                      </tbody>
-                                                  </table>
-                                              </div>
                                           </div>
                                       </div>
                                   </div>

+ 6 - 5
web/building_saas/main/js/views/std_ration_lib.js

@@ -205,7 +205,7 @@ $('#stdRationLibSelect').change(function () {
 $('#rationSearch').click(function () {
     var keyword = $('#rationSearchKeyword').val(), rationLibID = $('#stdRationLibSelect').val();
     var getResultHtml = function (result) {
-        var html = [], i;
+        var html = [], i, serialNo;
         html.push('<div class="d-flex justify-content-between">');
         html.push('<span>搜索结果:');
         html.push(result.length.toString());
@@ -219,10 +219,11 @@ $('#rationSearch').click(function () {
         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('<td>', i+1, '</td>');
+            html.push('<td>', result[i].code, '</td>');
+            html.push('<td>', result[i].name,  '</td>');
+            html.push('<td>', result[i].unit, '</td>');
+            html.push('<td>', result[i].basePrice ? result[i].basePrice : '', '</td>');
             html.push('</tr>');
         }
         html.push('</tbody>');