|
|
@@ -454,6 +454,14 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
}).state('baseInfo.businessGroups', {
|
|
|
url : '/businessGroups',
|
|
|
controller : 'BusinessGroupsCtrl'
|
|
|
+ }).state('baseInfo.inquiryList', {
|
|
|
+ url : '/inquiryList',
|
|
|
+ templateUrl : "static/tpl/index/baseInfo/inquiry_list.html",
|
|
|
+ controller : 'PublicInquiryListCtrl'
|
|
|
+ }).state('baseInfo.inquiryListDetail', {
|
|
|
+ url : '/inquiryList/:id',
|
|
|
+ templateUrl : "static/tpl/index/baseInfo/inquiryItem_detail.html",
|
|
|
+ controller : 'PublicInquiryListDetailCtrl'
|
|
|
}).state('qc', {
|
|
|
url : "/qc",
|
|
|
views : {
|
|
|
@@ -2772,7 +2780,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
$scope.inquiry = {
|
|
|
code: 'XJ' + $filter('date')(new Date(), 'yyMMddsss'),
|
|
|
showdate: $filter('date')(new Date, 'yyyy-MM-dd'),
|
|
|
- priceType: '采购'
|
|
|
+ priceType: '采购',
|
|
|
+ isOpen: 0
|
|
|
};
|
|
|
|
|
|
$scope.currentDay = function() {
|
|
|
@@ -2889,6 +2898,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
|
|
|
// 保存
|
|
|
$scope.save = function() {
|
|
|
+ console.log($scope.inquiry);
|
|
|
// var file = $scope.myFiles, file = file && file.length > 0 ? file[0] : null;// 可以不传附件
|
|
|
// $upload.upload({
|
|
|
// url: 'product/baseInfo/updateProdInfo',
|
|
|
@@ -2909,36 +2919,76 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
// $scope.loadingShow = false;
|
|
|
// toaster.pop('error', '操作失败', data.error);
|
|
|
// });
|
|
|
- PurchaseInquiry.save({inquiry: $scope.inquiry}, $scope.vendors, function(data) {
|
|
|
- if(data.success) {
|
|
|
- toaster.pop('success', '提示', data.success);
|
|
|
- $timeout(function() {
|
|
|
- window.loaction.hash = "#/purc/inquiry_unapply";
|
|
|
- }, 500);
|
|
|
- }
|
|
|
- if(data.error) {
|
|
|
- toaster.pop('error', '提示', data.error);
|
|
|
- }
|
|
|
- }, function(response) {
|
|
|
- toaster.pop('error', '提示', response.data);
|
|
|
- });
|
|
|
+ if($scope.inquiry.isOpen == 0) {
|
|
|
+ if( $scope.vendors.length > 0) { // 指定询价
|
|
|
+ PurchaseInquiry.save({inquiry: $scope.inquiry}, $scope.vendors, function(data) {
|
|
|
+ if(data.success) {
|
|
|
+ toaster.pop('success', '提示', data.success);
|
|
|
+ $timeout(function() {
|
|
|
+ window.location.hash = "#/purc/inquiry_unapply";
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
+ if(data.error) {
|
|
|
+ toaster.pop('error', '提示', data.error);
|
|
|
+ }
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ toaster.pop('info', '提示', '请先选择供应商');
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ PurchaseInquiry.saveWithoutVendor({inquiry: $scope.inquiry}, {}, function(data) {
|
|
|
+ if(data.success) {
|
|
|
+ toaster.pop('success', '提示', data.success);
|
|
|
+ $timeout(function() {
|
|
|
+ window.location.hash = "#/purc/inquiry_unapply";
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
+ if(data.error) {
|
|
|
+ toaster.pop('error', '提示', data.error);
|
|
|
+ }
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 保存并提交
|
|
|
$scope.submit = function() {
|
|
|
- PurchaseInquiry.submit({inquiry: $scope.inquiry}, $scope.vendors, function(data) {
|
|
|
- if(data.success) {
|
|
|
- toaster.pop('success', '提示', data.success);
|
|
|
- $timeout(function() {
|
|
|
- window.location.hash = "#/purc/inquiry_unapply";
|
|
|
- }, 500);
|
|
|
- }
|
|
|
- if(data.error) {
|
|
|
- toaster.pop('error', '提示', data.error);
|
|
|
+ if( $scope.inquiry.isOpen == 0) { // 指定询价
|
|
|
+ if($scope.vendors.length > 0) {
|
|
|
+ PurchaseInquiry.submit({inquiry: $scope.inquiry}, $scope.vendors, function(data) {
|
|
|
+ if(data.success) {
|
|
|
+ toaster.pop('success', '提示', data.success);
|
|
|
+ $timeout(function() {
|
|
|
+ window.location.hash = "#/purc/purchaseinquiry";
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
+ if(data.error) {
|
|
|
+ toaster.pop('error', '提示', data.error);
|
|
|
+ }
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ toaster.pop('info', '提示', '请先选择供应商');
|
|
|
}
|
|
|
- }, function(response) {
|
|
|
- toaster.pop('error', '提示', response.data);
|
|
|
- });
|
|
|
+ } else {
|
|
|
+ PurchaseInquiry.saveAndSubmitWithoutVendor({inquiry: $scope.inquiry}, {}, function(data) {
|
|
|
+ if(data.success) {
|
|
|
+ toaster.pop('success', '提示', data.success);
|
|
|
+ $timeout(function() {
|
|
|
+ window.location.hash = "#/purc/purchaseinquiry";
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
+ if(data.error) {
|
|
|
+ toaster.pop('error', '提示', data.error);
|
|
|
+ }
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}]);
|
|
|
|
|
|
@@ -3116,7 +3166,193 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
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);
|
|
|
+ }
|
|
|
+ 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){
|
|
|
var loadData = function() {
|
|
|
@@ -6003,6 +6239,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
|
|
|
//查找客户
|
|
|
$scope.searchCust = function(suuorname) {
|
|
|
+ console.log('eeee');
|
|
|
var modalInstance = $modal.open({
|
|
|
animation: true,
|
|
|
templateUrl: 'static/tpl/index/fa/custInfo.html',
|