|
@@ -2775,7 +2775,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.inquiry = {
|
|
$scope.inquiry = {
|
|
|
code: 'XJ' + $filter('date')(new Date(), 'yyMMddsss'),
|
|
code: 'XJ' + $filter('date')(new Date(), 'yyMMddsss'),
|
|
|
showdate: $filter('date')(new Date, 'yyyy-MM-dd'),
|
|
showdate: $filter('date')(new Date, 'yyyy-MM-dd'),
|
|
|
- priceType: '采购'
|
|
|
|
|
|
|
+ priceType: '采购',
|
|
|
|
|
+ isOpen: 1
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
$scope.currentDay = function() {
|
|
$scope.currentDay = function() {
|
|
@@ -3119,6 +3120,192 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
toaster.pop('error', '提示', response.data);
|
|
toaster.pop('error', '提示', response.data);
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 发布公共询价
|
|
|
|
|
+ $scope.publish = function(id) {
|
|
|
|
|
+ PurchaseInquiry.publishInquiry({id: id}, {}, function(data) {
|
|
|
|
|
+ toaster.pop('success', '提示', data.success);
|
|
|
|
|
+ }, function(response) {
|
|
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }]);
|
|
|
|
|
+
|
|
|
|
|
+ // 公共询价列表
|
|
|
|
|
+ app.controller('PublicInquiryListCtrl', ['$scope', '$stateParams', 'PurchaseInquiry','$filter', 'toaster', 'BaseService', 'ngTableParams', function($scope, $stateParams, PurchaseInquiry, $filter, toaster, BaseService, ngTableParams) {
|
|
|
|
|
+ BaseService.scrollBackToTop();
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 改变单据日期范围
|
|
|
|
|
+ */
|
|
|
|
|
+ var getTenderDateCondition = function(zone, condition) {
|
|
|
|
|
+ var date = new Date();
|
|
|
|
|
+ if(zone == -1) {
|
|
|
|
|
+ condition.dateFrom = null;
|
|
|
|
|
+ condition.dateTo = null;
|
|
|
|
|
+ } else if(zone == 7) { // 一星期内
|
|
|
|
|
+ date.setDate(date.getDate() - 7);
|
|
|
|
|
+ condition.dateFrom = date;
|
|
|
|
|
+ condition.dateTo = new Date();
|
|
|
|
|
+ } else if(zone == 1) { // 一个月内
|
|
|
|
|
+ date.setMonth(date.getMonth() - 1);
|
|
|
|
|
+ condition.dateFrom = date;
|
|
|
|
|
+ condition.dateTo = new Date();
|
|
|
|
|
+ } else if(zone == 3) { // 三个月内
|
|
|
|
|
+ date.setMonth(date.getMonth() - 3);
|
|
|
|
|
+ condition.dateFrom = date;
|
|
|
|
|
+ condition.dateTo = new Date();
|
|
|
|
|
+ } else if (zone == 6) { // 半年内
|
|
|
|
|
+ date.setMonth(date.getMonth() - 6);
|
|
|
|
|
+ condition.dateFrom = date;
|
|
|
|
|
+ condition.dateTo = new Date();
|
|
|
|
|
+ } else { // 一年内
|
|
|
|
|
+ date.setYear(date.getYear() - 1);
|
|
|
|
|
+ condition.dateFrom = date;
|
|
|
|
|
+ condition.dateTo = new Date();
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ $scope.dateZoneText = '不限';
|
|
|
|
|
+ $scope.deliveryZoneText = '不限';
|
|
|
|
|
+ $scope.condition = {dateZone: -1};
|
|
|
|
|
+ $scope.changeDateZone = function(zone) {
|
|
|
|
|
+ $scope.condition.dateZone = zone;
|
|
|
|
|
+ $scope.condition.$dateZoneOpen = false;
|
|
|
|
|
+ getTenderDateCondition(zone, $scope.condition);
|
|
|
|
|
+ $scope.tableParams.reload();
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ $scope.openDatePicker = function($event, item, openParam) {
|
|
|
|
|
+ $event.preventDefault();
|
|
|
|
|
+ $event.stopPropagation();
|
|
|
|
|
+ item[openParam] = !item[openParam];
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ $scope.parseDate = function(dateStr) {
|
|
|
|
|
+ if(dateStr)
|
|
|
|
|
+ return Date.parse(dateStr, 'yyyy-MM-dd');
|
|
|
|
|
+ return new Date();
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 选择查找日期
|
|
|
|
|
+ $scope.onDateCondition = function(){
|
|
|
|
|
+ $scope.tableParams.page(1);
|
|
|
|
|
+ $scope.tableParams.reload();
|
|
|
|
|
+ };
|
|
|
|
|
+ // $scope.setActive = function(state) {
|
|
|
|
|
+ // if($scope.active != state) {
|
|
|
|
|
+ // $scope.active = state;
|
|
|
|
|
+ // if($scope.tableParams.page() == 1)
|
|
|
|
|
+ // $scope.tableParams.reload();
|
|
|
|
|
+ // else
|
|
|
|
|
+ // $scope.tableParams.page(1);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // };
|
|
|
|
|
+
|
|
|
|
|
+ $scope.nowdate = new Date().getTime();
|
|
|
|
|
+ var getOpenState = function(active) {
|
|
|
|
|
+ var fn = 'getOpenAll';
|
|
|
|
|
+ switch(active) {
|
|
|
|
|
+ case 'all':
|
|
|
|
|
+ fn = 'getOpenAll';break;
|
|
|
|
|
+ case 'todo':
|
|
|
|
|
+ fn = 'getOpenTodo';break;
|
|
|
|
|
+ case 'end':
|
|
|
|
|
+ fn = 'getOpenEnd';break;
|
|
|
|
|
+ }
|
|
|
|
|
+ return fn;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ $scope.tableParams = new ngTableParams({
|
|
|
|
|
+ page : 1,
|
|
|
|
|
+ count : 10,
|
|
|
|
|
+ sorting: {
|
|
|
|
|
+// 'tender.endDate': 'desc',
|
|
|
|
|
+// 'tender.enterprise.enName': 'asc',
|
|
|
|
|
+// 'tender.code': 'asc'
|
|
|
|
|
+ }
|
|
|
|
|
+ }, {
|
|
|
|
|
+ total : 0,
|
|
|
|
|
+ counts: [10, 25, 50, 100],
|
|
|
|
|
+ getData : function($defer, params) {
|
|
|
|
|
+ $scope.loading = true;
|
|
|
|
|
+ var pageParams = params.url();
|
|
|
|
|
+// var realActive = {};
|
|
|
|
|
+ pageParams.searchFilter = { // 筛选条件
|
|
|
|
|
+ keyword: $scope.keyword,
|
|
|
|
|
+ fromDate: getDateTime($scope.condition.dateFrom),
|
|
|
|
|
+ endDate: getDateTime($scope.condition.dateTo)
|
|
|
|
|
+ };
|
|
|
|
|
+// AccountEnterprise.get({}, function(data){
|
|
|
|
|
+// $scope.loading = false;
|
|
|
|
|
+// $scope.currentEn = data;
|
|
|
|
|
+// });
|
|
|
|
|
+ PurchaseInquiry.publicInquiryItem.call(null, BaseService.parseParams(pageParams), function(page){
|
|
|
|
|
+ $scope.loading = false;
|
|
|
|
|
+ if(page) {
|
|
|
|
|
+ params.total(page.totalElement);
|
|
|
|
|
+ $defer.resolve(page.content);
|
|
|
|
|
+ // $scope.keywordXls = angular.copy($scope.keyword); // 保存当前取值的关键词 做导出时需要的字段
|
|
|
|
|
+ }
|
|
|
|
|
+ }, function(response){
|
|
|
|
|
+ $scope.loading = false;
|
|
|
|
|
+ toaster.pop('error', '数据加载失败', response.data);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ $scope.toDetail = function(id) {
|
|
|
|
|
+ window.location.hash = '#/baseInfo/inquiryList/' + id;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 搜索框回车
|
|
|
|
|
+ $scope.onSearch = function() {
|
|
|
|
|
+ $scope.tableParams.page(1);
|
|
|
|
|
+ $scope.tableParams.reload();
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ }]);
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 公共询价详情
|
|
|
|
|
+ */
|
|
|
|
|
+ app.controller('PublicInquiryListDetailCtrl', ['$scope', '$stateParams', 'PurchaseInquiry','$filter', 'toaster', 'BaseService', 'ngTableParams', 'AccountEnterprise', function($scope, $stateParams, PurchaseInquiry, $filter, toaster, BaseService, ngTableParams, AccountEnterprise) {
|
|
|
|
|
+ BaseService.scrollBackToTop();
|
|
|
|
|
+ var loadData = function() {
|
|
|
|
|
+ PurchaseInquiry.inquiryItemDetail({id: $stateParams.id}, function(data) {
|
|
|
|
|
+ $scope.inquiryItem = data;
|
|
|
|
|
+ }, function(response) {
|
|
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ loadData();
|
|
|
|
|
+
|
|
|
|
|
+ // 当前时间
|
|
|
|
|
+ $scope.nowdate = new Date().getTime();
|
|
|
|
|
+
|
|
|
|
|
+ // 当前企业
|
|
|
|
|
+ AccountEnterprise.get({}, function(data){
|
|
|
|
|
+ $scope.loading = false;
|
|
|
|
|
+ $scope.enterprise = data;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 转客户询价
|
|
|
|
|
+ $scope.transtoInquiry = function(id) {
|
|
|
|
|
+ PurchaseInquiry.transtoInquiry({id: id}, {}, function(data) {
|
|
|
|
|
+ if(data.success) {
|
|
|
|
|
+ toaster.pop('success', '提示', data.success);
|
|
|
|
|
+ window.location.hash = "sale/inquiry/" + data.id;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(data.error) {
|
|
|
|
|
+ toaster.pop('error', '提示', data.error);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(data.info) {
|
|
|
|
|
+ toaster.pop('info', '提示', data.info);
|
|
|
|
|
+ }
|
|
|
|
|
+ }, function(response) {
|
|
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}]);
|
|
}]);
|
|
|
// 询价单明细
|
|
// 询价单明细
|
|
|
app.controller('PurcInquiryDetailCtrl', ['$scope', '$stateParams', 'PurcInquiry','$filter', 'toaster', function($scope, $stateParams, PurcInquiry,$filter, toaster){
|
|
app.controller('PurcInquiryDetailCtrl', ['$scope', '$stateParams', 'PurcInquiry','$filter', 'toaster', function($scope, $stateParams, PurcInquiry,$filter, toaster){
|
|
@@ -3274,6 +3461,37 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
|
|
+ // 采纳
|
|
|
|
|
+ $scope.accept = function(id) {
|
|
|
|
|
+ PurchaseInquiry.accept({id: id}, {}, function(data) {
|
|
|
|
|
+ if(data.success) {
|
|
|
|
|
+ toaster.pop('success', '提示', data.success);
|
|
|
|
|
+ $scope.tableParams.reload();
|
|
|
|
|
+ }
|
|
|
|
|
+ if(data.error) {
|
|
|
|
|
+ toaster.pop('error', '提示', data.error);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }, function(response) {
|
|
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
|
|
+ })
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 拒绝
|
|
|
|
|
+ $scope.refuse = function(id) {
|
|
|
|
|
+ PurchaseInquiry.refuse({id: id}, {}, function(data) {
|
|
|
|
|
+ if(data.success) {
|
|
|
|
|
+ toaster.pop('success', '提示', data.success);
|
|
|
|
|
+ $scope.tableParams.reload();
|
|
|
|
|
+ }
|
|
|
|
|
+ if(data.error) {
|
|
|
|
|
+ toaster.pop('error', '提示', data.error);
|
|
|
|
|
+ }
|
|
|
|
|
+ }, function(response) {
|
|
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
}]);
|
|
}]);
|
|
|
|
|
|
|
|
|
|
|
|
@@ -3491,8 +3709,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.tableParams.reload();
|
|
$scope.tableParams.reload();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}]);
|
|
}]);
|
|
|
|
|
|
|
|
|
|
|