|
|
@@ -3440,7 +3440,6 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.$dateOpen = !openParam;
|
|
|
};
|
|
|
|
|
|
-
|
|
|
// 取消
|
|
|
$scope.cancel = function () {
|
|
|
$modalInstance.dismiss();
|
|
|
@@ -23987,41 +23986,70 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
* @author hejq
|
|
|
* @date 2018-06-25 16:38
|
|
|
*/
|
|
|
- app.controller('PurcChangeNewCtrl', ['$scope', 'toaster', 'BaseService', 'AuthenticationService', '$modal',
|
|
|
- function ($scope, toaster, BaseService, AuthenticationService, $modal) {
|
|
|
+ app.controller('PurcChangeNewCtrl', ['$scope', 'toaster', 'BaseService', 'AuthenticationService', '$modal', '$filter', 'change',
|
|
|
+ function ($scope, toaster, BaseService, AuthenticationService, $modal, $filter, change) {
|
|
|
// 获取登录人员信息
|
|
|
AuthenticationService.getAuthentication().success(function (data) {
|
|
|
$scope.user = data;
|
|
|
+ initChange();
|
|
|
+ });
|
|
|
+
|
|
|
+ // 初始化变更单信息
|
|
|
+ var initChange = function () {
|
|
|
$scope.change = {
|
|
|
date: new Date(),
|
|
|
- recorder: $scope.user.userName
|
|
|
+ recorder: $scope.user.userName,
|
|
|
+ orderCode: null,
|
|
|
+ code: 'B2BPC' + $filter('date')(new Date(), 'yyMMddHHmmss_sss'),
|
|
|
+ orderId: null,
|
|
|
+ orderChangeItems: []
|
|
|
}
|
|
|
- });
|
|
|
-
|
|
|
+ }
|
|
|
$scope.getEnableOrders = function() {
|
|
|
+ initChange();
|
|
|
var modalInstance = $modal.open({
|
|
|
animation: true,
|
|
|
- templateUrl: 'static/tpl/index/search/enterpirseInfo.html',
|
|
|
+ size: 'lg',
|
|
|
+ templateUrl: 'static/tpl/index/purc/modal/enableOrderList.html',
|
|
|
controller: 'EnableChangeListCtrl',
|
|
|
resolve: {
|
|
|
- enname: function () {
|
|
|
- return name
|
|
|
- }
|
|
|
}
|
|
|
});
|
|
|
modalInstance.result.then(function (data) {
|
|
|
- InvitationRecord.invite({formStore: data}, {}, function (data) {
|
|
|
- if (data.success) {
|
|
|
- toaster.pop('success', '提示', data.success);
|
|
|
- }
|
|
|
- if (data.error) {
|
|
|
- toaster.pop('error', '提示', data.error);
|
|
|
- }
|
|
|
- }, function (response) {
|
|
|
- toaster.pop('error', '提示', response.data);
|
|
|
+ $scope.change.orderCode = data.code;
|
|
|
+ $scope.change.orderId = data.id;
|
|
|
+ $scope.orderItems = data.orderItems;
|
|
|
+ $scope.change.oldCurrency = data.currency;
|
|
|
+ $scope.change.oldPayments = data.payments;
|
|
|
+ $scope.change.oldRate = data.rate;
|
|
|
+ angular.forEach($scope.orderItems, function (item) {
|
|
|
+ $scope.change.orderChangeItems.push({
|
|
|
+ oldProductId: item.productId,
|
|
|
+ orderItemId: item.id,
|
|
|
+ orderItemNumber: item.number,
|
|
|
+ oldQty: item.qty,
|
|
|
+ oldPrice: item.price,
|
|
|
+ oldTaxrate: item.taxrate,
|
|
|
+ oldDelivery: item.delivery,
|
|
|
+ oldProduct: item.product
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ $scope.openDatePicker = function ($event, openParam) {
|
|
|
+ $event.preventDefault();
|
|
|
+ $event.stopPropagation();
|
|
|
+ $scope.$dateOpen = !openParam;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.save = function() {
|
|
|
+ change.save({}, $scope.change, function (data) {
|
|
|
+
|
|
|
+ }, function(res) {
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
}]);
|
|
|
|
|
|
/**
|
|
|
@@ -24033,6 +24061,18 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
app.controller('EnableChangeListCtrl', ['$scope', 'change', 'BaseService', 'ngTableParams', 'toaster', '$modalInstance',
|
|
|
function ($scope, change, BaseService, ngTableParams, toaster, $modalInstance) {
|
|
|
|
|
|
+ $scope.dateZoneText = '一个月内';
|
|
|
+ $scope.condition = {dateZone: 1};
|
|
|
+
|
|
|
+ /* 时间筛选初始化*/
|
|
|
+ var fromDate = new Date();
|
|
|
+ var toDate = new Date();
|
|
|
+ fromDate.setMonth(fromDate.getMonth() - 1);
|
|
|
+ fromDate.setHours(0, 0, 0, 0);
|
|
|
+ toDate.setHours(23, 59, 59, 999);
|
|
|
+ $scope.condition.dateFrom = fromDate;
|
|
|
+ $scope.condition.dateTo = toDate;
|
|
|
+
|
|
|
$scope.tableParams = new ngTableParams({
|
|
|
page: 1,
|
|
|
count: 5,
|
|
|
@@ -24045,7 +24085,6 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
getData: function ($defer, params) {
|
|
|
$scope.loading = true;
|
|
|
var pageParams = params.url();
|
|
|
- var realActive = {};
|
|
|
pageParams.searchFilter = { // 筛选条件
|
|
|
keyword: $scope.keyword,
|
|
|
fromDate: getDateTime($scope.condition.dateFrom),
|
|
|
@@ -24054,7 +24093,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
change.getEnableOrderList.call(null, BaseService.parseParams(pageParams), function (page) {
|
|
|
$scope.loading = false;
|
|
|
if (page) {
|
|
|
- params.total(page.totalElements);
|
|
|
+ params.total(page.totalElement);
|
|
|
$defer.resolve(page.content);
|
|
|
}
|
|
|
}, function (response) {
|
|
|
@@ -24064,73 +24103,34 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- $scope.close = function () {
|
|
|
- $modalInstance.close();
|
|
|
- window.location.reload();
|
|
|
- };
|
|
|
-
|
|
|
-
|
|
|
- $scope.checks = {
|
|
|
- checked: false
|
|
|
- };// 全选框
|
|
|
-
|
|
|
- $scope.checkAll = function () {
|
|
|
- angular.forEach($scope.tableParams.data, function (message) {
|
|
|
- message.checked = $scope.checks.checked;
|
|
|
- });
|
|
|
- };
|
|
|
-
|
|
|
+ $scope.checkedOrder = null;
|
|
|
+ var checkItems = [];
|
|
|
// 单选
|
|
|
- $scope.checkOne = function (vendor) {
|
|
|
- vendor.checked = true;
|
|
|
-
|
|
|
- var checked = true;
|
|
|
- angular.forEach($scope.tableParams.data, function (message) { // 单选全部时,全选选中
|
|
|
- if (!message.checked) {
|
|
|
- checked = false;
|
|
|
- }
|
|
|
- });
|
|
|
- $scope.checks.checked = checked;
|
|
|
- };
|
|
|
-
|
|
|
- // 单反选
|
|
|
- $scope.unCheckOne = function (vendor) {
|
|
|
- vendor.checked = false;
|
|
|
- $scope.checks.checked = false;
|
|
|
- };
|
|
|
-
|
|
|
- /**
|
|
|
- * 当前页标为已读
|
|
|
- */
|
|
|
- $scope.setRead = function () {
|
|
|
- $scope.loading = true;
|
|
|
- var messageIds = [];
|
|
|
- angular.forEach($scope.tableParams.data, function(message) {
|
|
|
- messageIds.push(message.id);
|
|
|
- });
|
|
|
- PagingRelease.setPageRead({}, messageIds, function (data) {
|
|
|
- $scope.loading = false;
|
|
|
- if (data.success) {
|
|
|
- toaster.pop("success", "设置已读成功");
|
|
|
- }
|
|
|
- if (data.error) {
|
|
|
- toaster.pop("error", "设置已读失败");
|
|
|
- }
|
|
|
- $scope.tableParams.page(1);
|
|
|
- $scope.tableParams.reload();
|
|
|
- });
|
|
|
+ $scope.checkOne = function (order) {
|
|
|
+ order.checked = !order.checked;
|
|
|
+ if (order.checked) {
|
|
|
+ $scope.checkedOrder = order;
|
|
|
+ } else {
|
|
|
+ $scope.checkedOrder = null;
|
|
|
+ angular.forEach(order.orderItems, function (item) {
|
|
|
+ item.checked = false;
|
|
|
+ });
|
|
|
+ checkItems = [];
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
- // 点击内容连接之后,信息标为已读
|
|
|
- $scope.setOneRead = function (id) {
|
|
|
- $scope.loading = true;
|
|
|
- $modalInstance.close();
|
|
|
- PagingRelease.setMessageRead({id: id}, {}, function (data) {
|
|
|
- $scope.loading = false;
|
|
|
- }, function (response) {
|
|
|
- $scope.loading = false;
|
|
|
- toaster.pop('error', '提示', response.data);
|
|
|
- });
|
|
|
+ // 明细
|
|
|
+ $scope.checkItem = function (item) {
|
|
|
+ item.checked = !item.checked;
|
|
|
+ if (item.checked) {
|
|
|
+ checkItems.push(item);
|
|
|
+ } else {
|
|
|
+ angular.forEach(checkItems, function (checkItem) {
|
|
|
+ if (checkItem.id == item.id) {
|
|
|
+ checkItems.splice(item, 1);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
// 搜索框回车
|
|
|
@@ -24139,6 +24139,28 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.tableParams.reload();
|
|
|
};
|
|
|
|
|
|
+ $scope.getCartTotal = function (items) {
|
|
|
+ var sum = 0;
|
|
|
+ angular.forEach(items, function (item) {
|
|
|
+ sum += item.qty * item.price;
|
|
|
+ });
|
|
|
+ return sum;
|
|
|
+ };
|
|
|
+
|
|
|
+ // 选择
|
|
|
+ $scope.choose = function () {
|
|
|
+ if ($scope.checkedOrder == null || checkItems.length == 0) {
|
|
|
+ toaster.pop('error', '请先选择采购单信息');
|
|
|
+ } else {
|
|
|
+ $scope.checkedOrder.orderItems = checkItems;
|
|
|
+ $modalInstance.close($scope.checkedOrder);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 关闭
|
|
|
+ $scope.close = function () {
|
|
|
+ $modalInstance.dismiss();
|
|
|
+ };
|
|
|
}]);
|
|
|
|
|
|
return app;
|