Browse Source

修复店铺列表无法搜索bug

wangyc 7 years ago
parent
commit
b4481a468f

+ 7 - 3
src/main/webapp/resources/js/admin/controllers/supplierMaintenanceCtrl.js

@@ -3,6 +3,7 @@ define([ 'app/app' ], function(app) {
 	app.register.controller('supplierMaintenanceCtrl', ['$scope', 'ngTableParams', 'toaster', 'BrandActive', '$stateParams', 'SupplierSubmit', 'Loading', 'BaseService', '$window', 'Supplier', 'StoreInfo', '$upload', function($scope, ngTableParams, toaster, BrandActive, $stateParams, SupplierSubmit, Loading, BaseService, $window, Supplier, StoreInfo, $upload) {
 		$scope.storeType = '';
 		$scope.addedSupplier = false;
+		$scope.brandKeyword = '';
 
 		// 根据路由地址获取品牌信息
 		var getBrand = function () {
@@ -155,8 +156,8 @@ define([ 'app/app' ], function(app) {
                         param.type = $scope.storeType;
                     }
                     // 根据关键字进行搜索
-                    if ($scope.keyword && $scope.keyword !== '') {
-                        param.keyword = $scope.keyword;
+                    if ($scope.brandKeyword && $scope.brandKeyword !== '') {
+                        param.keyword = $scope.brandKeyword;
                     }
 					StoreInfo.pageStoreInfoWhenAdminQuery(param, function (data) {
 						if (!data.content || !Array.isArray(data.content)) {
@@ -208,7 +209,8 @@ define([ 'app/app' ], function(app) {
 		/**
 		 * 根据关键字进行搜索
 		 */
-		$scope.refreshTableData = function () {
+		$scope.refreshTableData = function (keyword) {
+      $scope.brandKeyword = keyword;
 			$scope.storeTableParams.page(1);
 			$scope.storeTableParams.reload();
 		};
@@ -220,6 +222,7 @@ define([ 'app/app' ], function(app) {
 		 */
 		$scope.chooseStore = function (supplier, store) {
 			supplier.storeIn = store;
+      $scope.brandKeyword = '';
 			supplier.chooseStoreAssociated = false;
 		};
 
@@ -228,6 +231,7 @@ define([ 'app/app' ], function(app) {
 		 * @param supplier 供应商
 		 */
 		$scope.storeAssociated = function (supplier){
+      $scope.brandKeyword = '';
 			supplier.chooseStoreAssociated = typeof supplier.chooseStoreAssociated == 'undefined' ? true : !supplier.chooseStoreAssociated;
 			if (supplier.chooseStoreAssociated) {
 				getStoreData();

+ 8 - 8
src/main/webapp/resources/view/admin/supplier_maintenance.html

@@ -649,7 +649,7 @@
 									<span ng-bind="supplier.website">http://www.wordshine.net.com</span>
 								</td>
 								<td>
-									<button ng-click="storeAssociated()" ng-bind="supplier.storeIn.storeName">选择关联店铺 <i class="fa fa-angle-down"></i></button>
+									<button ng-click="storeAssociated(supplier)" ng-bind="supplier.storeIn.storeName">选择关联店铺 <i class="fa fa-angle-down"></i></button>
 								</td>
 								<td>
 									<span ng-bind="supplier.email" class="emails">12345678@qq.com</span>
@@ -708,14 +708,14 @@
 												<span class="fl">经销商</span>
 											</label>
 											<div class="form-search">
-												<input type="text" ng-click="refreshTableData()">
-												<button><i class="fa fa-search" ng-click="refreshTableData()"></i></button>
+												<input type="text" ng-model="brandKeyword">
+												<button><i class="fa fa-search" ng-click="refreshTableData(brandKeyword)"></i></button>
 											</div>
 										</div>
 										<table ng-table="storeTableParams">
 											<thead>
 											<tr>
-												<th width="30"></th>
+												<th width="30">{{brandKeyword}}</th>
 												<th width="70">店铺编号</th>
 												<th width="170">公司名称</th>
 												<th width="60">类型</th>
@@ -785,16 +785,16 @@
 									<div class="top">
 										<span>类型选择</span>
 										<label>
-											<input type="checkbox" class="fl">
+											<input type="checkbox" class="fl" ng-click="chooseStoreType('AGENCY')">
 											<span class="fl">代理商</span>
 										</label>
 										<label>
-											<input type="checkbox" class="fl">
+											<input type="checkbox" class="fl" ng-click="chooseStoreType('DISTRIBUTION')">
 											<span class="fl">经销商</span>
 										</label>
 										<div class="form-search">
-											<input type="text">
-											<button><i class="fa fa-search"></i></button>
+											<input type="text" ng-model="brandKeyword">
+											<button><i class="fa fa-search"  ng-click="refreshTableData(brandKeyword)"></i></button>
 										</div>
 									</div>
 									<table ng-table="storeTableParams">