|
|
@@ -164,6 +164,11 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
url : "/makeoutorder/:id",
|
|
|
templateUrl : "static/tpl/index/make/outorder_detail.html",
|
|
|
controller: 'MakeOutOrderDetailCtrl'
|
|
|
+ /*平台新增询价单*/
|
|
|
+ }).state('purc.inquiry_new', {
|
|
|
+ url : "/purcinquiry",
|
|
|
+ templateUrl : "static/tpl/index/purc/inquiry_new.html",
|
|
|
+ controller: 'PurcInquiryCtrl'
|
|
|
}).state('sale.tenderlist', {
|
|
|
url : "/tender",
|
|
|
templateUrl : "static/tpl/index/sale/tenderlist.html",
|
|
|
@@ -2231,6 +2236,14 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
$scope.tableParams.page(1);
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+ // 得到消息
|
|
|
+ PurcInquiry.getMessage({}, function(data){
|
|
|
+ console.log(data);
|
|
|
+ $scope.message = data;
|
|
|
+ }, function(response) {
|
|
|
+
|
|
|
+ });
|
|
|
var getService = function() {
|
|
|
return $scope.condition.dateZone ? PurcInquiry : PurcInquiryHis;
|
|
|
};
|
|
|
@@ -2466,6 +2479,166 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
};
|
|
|
}]);
|
|
|
|
|
|
+ // 平台新增的询价单
|
|
|
+ app.controller('PurcInquiryCtrl', ['$scope', 'PurchaseInquiry', 'toaster', 'BaseService', '$upload', '$filter', '$modal', '$rootScope', 'ngTableParams', 'GetProductInfo', function($scope, PurchaseInquiry, toaster, BaseService, $upload, $filter, $modal, $rootScope, ngTableParams, GetProductInfo) {
|
|
|
+ BaseService.scrollBackToTop();
|
|
|
+ $scope.active = 'all';
|
|
|
+ var getService = function() {
|
|
|
+ return GetProductInfo;
|
|
|
+ };
|
|
|
+ $scope.inquiry = {
|
|
|
+ code: 'XJ' + $filter('date')(new Date(), 'yyMMddsss'),
|
|
|
+ showdate: $filter('date')(new Date, 'yyyy-MM-dd')
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.currentDay = function() {
|
|
|
+ return $filter('date')(new Date(), 'yyyy-MM-dd');
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.vendors = [];
|
|
|
+ // 查找供应商
|
|
|
+ $scope.dbfindVendor = function(){
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ templateUrl: 'static/tpl/index/purc/tender_vendor.html',
|
|
|
+ controller: 'DbfindVendorCtrl',
|
|
|
+ size: 'lg',
|
|
|
+ resolve: {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ modalInstance.result.then(function(data){
|
|
|
+ var ifPush = true;
|
|
|
+ modalInstance.result.then(function(data){
|
|
|
+ angular.forEach(data, function(vendor) {
|
|
|
+ if (!$scope.vendors) {// 不存在就先创建
|
|
|
+ $scope.vendors = [{}];
|
|
|
+ $scope.vendors.splice(0, 1, vendor.vendorEnterprise);
|
|
|
+ } else {
|
|
|
+ for (var i = 0;i<$scope.vendors.length; i++) {
|
|
|
+ ifPush = true;
|
|
|
+ if ($scope.vendors[i].enName == vendor.vendorEnterprise.enName) {
|
|
|
+ ifPush = false;
|
|
|
+ break; // 判定到已存在供应商,就终止循环。
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ifPush) {
|
|
|
+ $scope.vendors.push({enName: vendor.vendorEnterprise.enName, enuu: vendor.vendorEnterprise.uu});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $rootScope.tenderVendor = $scope.vendors;
|
|
|
+ }, function(){
|
|
|
+
|
|
|
+ });
|
|
|
+ }, function(){
|
|
|
+
|
|
|
+ });
|
|
|
+ };
|
|
|
+ // 删除一个供应商
|
|
|
+ $scope.removeVendor = function(index) {
|
|
|
+ $scope.vendors.splice(index, 1);
|
|
|
+ };
|
|
|
+
|
|
|
+ // 物料信息
|
|
|
+ $scope.tableParams = new ngTableParams({
|
|
|
+ page : 1,
|
|
|
+ count : 5,
|
|
|
+ sorting: {
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ total : 0,
|
|
|
+ counts: [5, 10, 25, 50],
|
|
|
+ getData : function($defer, params) {
|
|
|
+ $scope.loading = true;
|
|
|
+ var pageParams = params.url();
|
|
|
+ pageParams.keyword = $scope.keyword;
|
|
|
+ pageParams.searchFilter = $scope.searchFilter;
|
|
|
+ getService()[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function(page){
|
|
|
+ $scope.loading = false;
|
|
|
+ if(page) {
|
|
|
+ params.total(page.totalElement);
|
|
|
+ $defer.resolve(page.content);
|
|
|
+ }
|
|
|
+ }, function(response) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '数据加载失败', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 搜索框回车
|
|
|
+ $scope.onSearch = function() {
|
|
|
+ $scope.tableParams.page(1);
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.inquiry.inquiryItems = [];
|
|
|
+ //删除商品
|
|
|
+ $scope.del = function(index) {
|
|
|
+ $scope.inquiry.inquiryItems.splice(index, 1);
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.check = function(product) {
|
|
|
+ $scope.inquiry.inquiryItems.push({prodCode: product.code, prodTitle: product.title, spec: product.spec, unit: product.unit,
|
|
|
+ currency: null, toDate: null, productId: product.id});
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.getMinDate = function(item) {
|
|
|
+ return $filter('date')(new Date, 'yyyy-MM-dd');
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.openDatePicker = function($event, openParam, index) {
|
|
|
+ $event.preventDefault();
|
|
|
+ $event.stopPropagation();
|
|
|
+ $scope.inquiry.inquiryItems[index].$toDateOpen = !openParam;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.openEndDatePicker = function($event, item, openParam) {
|
|
|
+ $event.preventDefault();
|
|
|
+ $event.stopPropagation();
|
|
|
+ item[openParam] = !item[openParam];
|
|
|
+ };
|
|
|
+
|
|
|
+ // 保存
|
|
|
+ $scope.save = function() {
|
|
|
+// var file = $scope.myFiles, file = file && file.length > 0 ? file[0] : null;// 可以不传附件
|
|
|
+// $upload.upload({
|
|
|
+// url: 'product/baseInfo/updateProdInfo',
|
|
|
+// file: file,
|
|
|
+// method: 'POST',
|
|
|
+// data: {
|
|
|
+// prodInfo: $scope.prodInfo
|
|
|
+// },
|
|
|
+// }).success(function(data) {
|
|
|
+// if(data.success) {
|
|
|
+// toaster.pop('success', '提示', data.success);
|
|
|
+// window.location.reload();
|
|
|
+// }
|
|
|
+// if(data.error) {
|
|
|
+// toaster.pop('error', '提示', data.error);
|
|
|
+// }
|
|
|
+// }).error(function(data) {
|
|
|
+// $scope.loadingShow = false;
|
|
|
+// toaster.pop('error', '操作失败', data.error);
|
|
|
+// });
|
|
|
+ PurchaseInquiry.save({inquiry: $scope.inquiry}, $scope.vendors, function(data) {
|
|
|
+
|
|
|
+ }, function(response) {
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 保存并提交
|
|
|
+ $scope.submit = function() {
|
|
|
+ PurchaseInquiry.submit({inquiry: $scope.inquiry}, $scope.vendors, function(data) {
|
|
|
+
|
|
|
+ }, function(response) {
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }]);
|
|
|
+
|
|
|
// 模具询价管理
|
|
|
app.controller('SaleInquiryMouldCtrl',['$scope', '$filter', 'PurcInquiryMould', 'ngTableParams', 'toaster', 'BaseService', '$upload', function($scope, $filter, PurcInquiryMould, ngTableParams, toaster, BaseService, $upload){
|
|
|
BaseService.scrollBackToTop();
|
|
|
@@ -7697,7 +7870,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
|
|
|
$scope.submit = function(prodInfo) {
|
|
|
var file = $scope.myFiles, file = file && file.length > 0 ? file[0] : null;// 可以不传附件
|
|
|
- console.log(file);
|
|
|
$upload.upload({
|
|
|
url: 'product/baseInfo/updateProdInfo',
|
|
|
file: file,
|
|
|
@@ -9139,6 +9311,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
page : 1,
|
|
|
count : 5,
|
|
|
sorting: {
|
|
|
+ date: 'desc',
|
|
|
}
|
|
|
}, {
|
|
|
total : 0,
|