|
|
@@ -7,358 +7,268 @@
|
|
|
|
|
|
|
|
|
define(['app/app'], function(app) {
|
|
|
- app.register.controller('PurcDeputyOrderCtrl', ['$scope', '$filter', 'B2bPurcOrders', 'B2bPurcOrder', 'ngTableParams', 'toaster', 'B2bReportService', 'BaseService', '$rootScope', 'B2bPurchaseOrder', 'B2bPurcOrdersInfo', 'B2bPurcOrderItem', 'B2bCurrentRole',
|
|
|
- function ($scope, $filter, PurcOrders, PurcOrder, ngTableParams, toaster, ReportService, BaseService, $rootScope, PurchaseOrder, PurcOrdersInfo, PurcOrderItem, CurrentRole) {
|
|
|
- BaseService.scrollBackToTop();
|
|
|
- $scope.storeType = 'purcOrder';
|
|
|
- $rootScope.active = 'buyer_order';
|
|
|
- /**
|
|
|
- * 将日期转化为整数日期
|
|
|
- */
|
|
|
- var getDateTime = function (date) {
|
|
|
- if (angular.isDate(date)) {
|
|
|
- return date.getTime();
|
|
|
- } else {
|
|
|
- return null;
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面状态按钮过滤
|
|
|
- */
|
|
|
- var getState = function (active) {
|
|
|
- var fn = 'get';
|
|
|
- switch (active) {
|
|
|
- case 'done':
|
|
|
- fn = 'getDone';
|
|
|
- break;
|
|
|
- case 'todo':
|
|
|
- fn = 'getTodo';
|
|
|
- break;
|
|
|
- case 'end':
|
|
|
- fn = 'getEnd';
|
|
|
- break;
|
|
|
- case 'waiting':
|
|
|
- fn = 'getWaiting';
|
|
|
- break;
|
|
|
- case 'received':
|
|
|
- fn = 'getReceived';
|
|
|
- break;
|
|
|
- case 'invalid':
|
|
|
- fn = 'getInvalid';
|
|
|
- break;
|
|
|
- // 已采纳
|
|
|
- case 'agreed':
|
|
|
- fn = 'getAgreed';
|
|
|
- break;
|
|
|
- // 未采纳
|
|
|
- case 'refused':
|
|
|
- fn = 'getRefused';
|
|
|
- break;
|
|
|
- // 个人
|
|
|
- case 'personal':
|
|
|
- fn = 'getPersonal';
|
|
|
- break;
|
|
|
- // 集体
|
|
|
- case 'teams':
|
|
|
- fn = 'getTeams';
|
|
|
- break;
|
|
|
- // 非标准
|
|
|
- case 'nonstandard':
|
|
|
- fn = 'getNonstandard';
|
|
|
- break;
|
|
|
- // 标准
|
|
|
- case 'standard':
|
|
|
- fn = 'getStandard';
|
|
|
- break;
|
|
|
- // 变更单无需确认
|
|
|
- case 'unread':
|
|
|
- fn = 'getUnread';
|
|
|
- break;
|
|
|
- }
|
|
|
- return fn;
|
|
|
- };
|
|
|
-
|
|
|
- var getDateCondition = function (zone, condition) {
|
|
|
- var fromDate = new Date();
|
|
|
- var toDate = new Date();
|
|
|
- //去除时分秒限制,dateFrom设置成0时0分0秒,dateTo设置成23时59分59秒
|
|
|
- fromDate.setHours(0, 0, 0, 0);
|
|
|
- toDate.setHours(23, 59, 59, 999);
|
|
|
- if (zone == -1) { // 自定义时间,什么都不做
|
|
|
-
|
|
|
- } else if (zone == 1) {
|
|
|
- fromDate.setMonth(fromDate.getMonth() - 1);
|
|
|
- condition.dateFrom = fromDate;
|
|
|
- condition.dateTo = toDate;
|
|
|
- } else if (zone == 3) {
|
|
|
- fromDate.setMonth(fromDate.getMonth() - 3);
|
|
|
- condition.dateFrom = fromDate;
|
|
|
- condition.dateTo = toDate;
|
|
|
- } else if (zone == 6) {
|
|
|
- fromDate.setMonth(fromDate.getMonth() - 6);
|
|
|
- condition.dateFrom = fromDate;
|
|
|
- condition.dateTo = toDate;
|
|
|
- } else {
|
|
|
- condition.dateFrom = null;
|
|
|
- condition.dateTo = null;
|
|
|
- }
|
|
|
- };
|
|
|
+ app.register.controller('PurcDeputyOrderCtrl', ['$scope', '$rootScope', 'toaster', 'B2bGetDeOrder', 'ngTableParams', 'BaseService', 'B2bDeputyOrder', 'B2bReportService', 'B2bGetOrderInfo', '$modal', 'B2bCurrentRole', function ($scope, $rootScope, toaster, getDeOrder, ngTableParams, BaseService, DeputyOrder, ReportService, getOrderInfo, $modal, CurrentRole) {
|
|
|
+ BaseService.scrollBackToTop();
|
|
|
+ // 获取当前用户是否为普通用户
|
|
|
+ CurrentRole.isUser({}, {}, function (data) {
|
|
|
+ $scope.isUser = data.isUser;
|
|
|
+ });
|
|
|
+ /**
|
|
|
+ * 将日期转化为整数日期
|
|
|
+ */
|
|
|
+ var getDateTime = function (date) {
|
|
|
+ if (angular.isDate(date)) {
|
|
|
+ return date.getTime();
|
|
|
+ } else {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
- // 获取当前用户是否为普通用户
|
|
|
- CurrentRole.isUser({}, {}, function (data) {
|
|
|
- $scope.isUser = data.isUser;
|
|
|
- });
|
|
|
- // if ($rootScope.active) {
|
|
|
- // $scope.active = $rootScope.active;
|
|
|
- // $rootScope.active = null;
|
|
|
- // } else {
|
|
|
- $scope.active = 'all';
|
|
|
- // }
|
|
|
- $scope.dateZoneText = '不限';
|
|
|
- $scope.deliveryZoneText = '不限';
|
|
|
- $scope.condition = {dateZone: 1, deliveryZone: -1};
|
|
|
+ /**
|
|
|
+ * 页面状态按钮过滤
|
|
|
+ */
|
|
|
+ var getState = function (active) {
|
|
|
+ var fn = 'get';
|
|
|
+ switch (active) {
|
|
|
+ case 'done':
|
|
|
+ fn = 'getDone';
|
|
|
+ break;
|
|
|
+ case 'todo':
|
|
|
+ fn = 'getTodo';
|
|
|
+ break;
|
|
|
+ case 'end':
|
|
|
+ fn = 'getEnd';
|
|
|
+ break;
|
|
|
+ case 'waiting':
|
|
|
+ fn = 'getWaiting';
|
|
|
+ break;
|
|
|
+ case 'received':
|
|
|
+ fn = 'getReceived';
|
|
|
+ break;
|
|
|
+ case 'invalid':
|
|
|
+ fn = 'getInvalid';
|
|
|
+ break;
|
|
|
+ // 已采纳
|
|
|
+ case 'agreed':
|
|
|
+ fn = 'getAgreed';
|
|
|
+ break;
|
|
|
+ // 未采纳
|
|
|
+ case 'refused':
|
|
|
+ fn = 'getRefused';
|
|
|
+ break;
|
|
|
+ // 个人
|
|
|
+ case 'personal':
|
|
|
+ fn = 'getPersonal';
|
|
|
+ break;
|
|
|
+ // 集体
|
|
|
+ case 'teams':
|
|
|
+ fn = 'getTeams';
|
|
|
+ break;
|
|
|
+ // 非标准
|
|
|
+ case 'nonstandard':
|
|
|
+ fn = 'getNonstandard';
|
|
|
+ break;
|
|
|
+ // 标准
|
|
|
+ case 'standard':
|
|
|
+ fn = 'getStandard';
|
|
|
+ break;
|
|
|
+ // 变更单无需确认
|
|
|
+ case 'unread':
|
|
|
+ fn = 'getUnread';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return fn;
|
|
|
+ };
|
|
|
|
|
|
- /* 时间筛选初始化*/
|
|
|
+ var getDateCondition = function (zone, condition) {
|
|
|
var fromDate = new Date();
|
|
|
var toDate = new Date();
|
|
|
- fromDate.setMonth(fromDate.getMonth() - 1);
|
|
|
+ //去除时分秒限制,dateFrom设置成0时0分0秒,dateTo设置成23时59分59秒
|
|
|
fromDate.setHours(0, 0, 0, 0);
|
|
|
toDate.setHours(23, 59, 59, 999);
|
|
|
- $scope.condition.dateFrom = fromDate;
|
|
|
- $scope.condition.dateTo = toDate;
|
|
|
+ if (zone == -1) { // 自定义时间,什么都不做
|
|
|
|
|
|
- $scope.changeDateZone = function (zone) {
|
|
|
- $scope.condition.dateZone = zone;
|
|
|
- $scope.dateZoneText = zone == 1 ? '最近一个月' : (zone == 3 ? '最近三个月' : (zone == 6 ? '最近六个月' : '自定义'));
|
|
|
- $scope.condition.$dateZoneOpen = false;
|
|
|
- getDateCondition(zone, $scope.condition);
|
|
|
- $scope.tableParams.page(1);
|
|
|
- $scope.tableParams.reload();
|
|
|
- };
|
|
|
- $scope.changeDeliveryZone = function (zone) {
|
|
|
- $scope.condition.deliveryZoneText = zone;
|
|
|
- $scope.deliveryZoneText = typeof zone == 'undefined' ? '不限' : (zone == -1 ? '不限' : (zone == 1 ? '一个月内' : '两个月内'));
|
|
|
- $scope.condition.$delievryZoneOpen = false;
|
|
|
- getDelveryCondition(zone, $scope.condition);
|
|
|
- $scope.tableParams.reload();
|
|
|
- };
|
|
|
- $scope.searchMethod = false;
|
|
|
- var getService = function () {
|
|
|
- return $scope.searchMethod ? PurcOrders : PurcOrdersInfo;
|
|
|
- };
|
|
|
- // 切换单据类型
|
|
|
- $scope.setActive = function (state) {
|
|
|
- if ($scope.active != state) {
|
|
|
- $scope.active = state;
|
|
|
- if ($scope.tableParams.page() == 1)
|
|
|
- $scope.tableParams.reload();
|
|
|
- else
|
|
|
- $scope.tableParams.page(1);
|
|
|
- }
|
|
|
- };
|
|
|
+ } else if (zone == 1) {
|
|
|
+ fromDate.setMonth(fromDate.getMonth() - 1);
|
|
|
+ condition.dateFrom = fromDate;
|
|
|
+ condition.dateTo = toDate;
|
|
|
+ } else if (zone == 3) {
|
|
|
+ fromDate.setMonth(fromDate.getMonth() - 3);
|
|
|
+ condition.dateFrom = fromDate;
|
|
|
+ condition.dateTo = toDate;
|
|
|
+ } else if (zone == 6) {
|
|
|
+ fromDate.setMonth(fromDate.getMonth() - 6);
|
|
|
+ condition.dateFrom = fromDate;
|
|
|
+ condition.dateTo = toDate;
|
|
|
+ } else {
|
|
|
+ condition.dateFrom = null;
|
|
|
+ condition.dateTo = null;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ $scope.storeType = 'deputy';
|
|
|
+ $rootScope.active = 'buyer_order';
|
|
|
+ $scope.active = 'all';
|
|
|
+ $scope.currency = Symbol.currency;//将币别转化为对应的符号
|
|
|
+ $scope.total = null;
|
|
|
+ $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.agreedText = '全部';
|
|
|
+ $scope.dateZoneText = '不限';
|
|
|
+ $scope.condition = {dateZone: 1};
|
|
|
|
|
|
- var getPurcStatus = function (active) {
|
|
|
- var fn = 'getPurcAll';
|
|
|
- switch (active) {
|
|
|
- case 'done':
|
|
|
- fn = 'getPurcDone';
|
|
|
- break;
|
|
|
- case 'todo':
|
|
|
- fn = 'getPurcTodo';
|
|
|
- break;
|
|
|
- case 'end':
|
|
|
- fn = 'getPurcEnd';
|
|
|
- break;
|
|
|
- case 'waiting':
|
|
|
- fn = 'getPurcWaiting';
|
|
|
- break;
|
|
|
- }
|
|
|
- return fn;
|
|
|
- };
|
|
|
+ /* 时间筛选初始化*/
|
|
|
+ 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({ // ng-Table参数
|
|
|
- page: 1,
|
|
|
- count: 20,
|
|
|
- sorting: {
|
|
|
- display: 'desc',
|
|
|
- date: 'desc'
|
|
|
- }
|
|
|
- }, {
|
|
|
- total: 0,
|
|
|
- counts: [5, 10, 15, 25, 50],
|
|
|
- getData: function ($defer, params) {// 获取数据的方法
|
|
|
- $scope.loading = true;
|
|
|
- var pageParams = params.url();
|
|
|
- pageParams.searchFilter = { // 筛选条件
|
|
|
- keyword: $scope.keyword,
|
|
|
- fromDate: getDateTime($scope.condition.dateFrom),
|
|
|
- endDate: getDateTime($scope.condition.dateTo)
|
|
|
- };
|
|
|
- getService()[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function (page) {
|
|
|
- $scope.loading = false;
|
|
|
- if (page) {
|
|
|
- $defer.resolve(page.content);
|
|
|
- $scope.total = page.totalElement;
|
|
|
- params.total(page.totalElement);
|
|
|
- $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的条件
|
|
|
- }
|
|
|
- }, function (response) {
|
|
|
- $scope.loading = false;
|
|
|
- toaster.pop('error', '数据加载失败', response.data);
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ $scope.changeDateZone = function (zone) {
|
|
|
+ $scope.condition.dateZone = zone;
|
|
|
+ $scope.dateZoneText = zone == 1 ? '最近一个月' : (zone == 3 ? '最近三个月' : (zone == 6 ? '最近六个月' : '自定义'));
|
|
|
+ $scope.condition.$dateZoneOpen = false;
|
|
|
+ getDateCondition(zone, $scope.condition);
|
|
|
+ $scope.tableParams.page(1);
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ };
|
|
|
|
|
|
- //获得各分类未阅读数量
|
|
|
- var getUnreadCount = function () {
|
|
|
- PurcOrders.getUnreadCount(null, function (data) {
|
|
|
- $scope.unread = data;
|
|
|
- });
|
|
|
- };
|
|
|
- getUnreadCount();
|
|
|
+ $scope.openDatePicker = function ($event, item, openParam) {
|
|
|
+ $event.preventDefault();
|
|
|
+ $event.stopPropagation();
|
|
|
+ item[openParam] = !item[openParam];
|
|
|
+ };
|
|
|
|
|
|
- //设置单据已读
|
|
|
- $scope.setOrdersRead = function (id) {
|
|
|
- // 如果单据本身已读,则不发送请求修改数据
|
|
|
- if (!$scope.isUnread(id)){
|
|
|
- return;
|
|
|
- }
|
|
|
- var sourceId = [];
|
|
|
- sourceId.push(id);
|
|
|
- PurcOrders.setRead({}, sourceId, function (message) {
|
|
|
- // $scope.getUnreadIds();
|
|
|
- getUnreadCount();
|
|
|
- });
|
|
|
- };
|
|
|
+ $scope.openFilterDatePicker = function ($event, item, openParam) {
|
|
|
+ $event.preventDefault();
|
|
|
+ $event.stopPropagation();
|
|
|
+ item[openParam] = !item[openParam];
|
|
|
+ if ($scope.condition.dateFrom && $scope.condition.dateTo && !item[openParam]) {
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
- //获取未读单据id
|
|
|
- var getUnreadIds = function () {
|
|
|
- PurcOrders.getUnreadIds({}, "", function (message) {
|
|
|
- $scope.unreadCode = message.content;
|
|
|
- });
|
|
|
- };
|
|
|
- getUnreadIds();
|
|
|
- //判断单据是否未读
|
|
|
- $scope.isUnread = function (id) {
|
|
|
- for (var i in $scope.unreadCode) {
|
|
|
- if (id == $scope.unreadCode[i]) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
+ $scope.searchMethod = false;
|
|
|
+ var getSerivce = function() {
|
|
|
+ return $scope.searchMethod ? getDeOrder : getOrderInfo;
|
|
|
+ }
|
|
|
+ getSerivce();
|
|
|
|
|
|
- $scope.getReply = function (item) {
|
|
|
- if (!item.replies) {
|
|
|
- PurcOrderItem.getReply({orderItemId: item.id}, function (replies) {
|
|
|
- item.replies = replies;
|
|
|
- });
|
|
|
- }
|
|
|
- };
|
|
|
+ // 获取订单总金额
|
|
|
+ var getOrdersAmount = function() {
|
|
|
+ DeputyOrder.odersAmount({}, function(data) {
|
|
|
+ $scope.odersAmount = data.amount;
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- $scope.getOrderTotal = function (items) {
|
|
|
- var sum = 0;
|
|
|
- angular.forEach(items, function (item) {
|
|
|
- sum += item.qty * item.price;
|
|
|
- });
|
|
|
- return sum;
|
|
|
- };
|
|
|
+ getOrdersAmount();
|
|
|
|
|
|
- // 需方 打印 采购单
|
|
|
- $scope.custPrint = function (order) {
|
|
|
- var newPage = window.open("about:blank");
|
|
|
- PurcOrder.printPermission({}, function () {
|
|
|
- PurcOrder.custPrintCount({id: order.id}, {});//增加打印此次
|
|
|
- ReportService.print(order.enUU, 'PURCLIST_CUST', "where purc$orders.pu_id=" + order.id, newPage);
|
|
|
+ $scope.tableParams = new ngTableParams({
|
|
|
+ page: 1,
|
|
|
+ count: 20,
|
|
|
+ sorting: {'date': 'desc', 'id': 'desc'}
|
|
|
+ }, {
|
|
|
+ total: 0,
|
|
|
+ counts: [5, 10, 25, 50],
|
|
|
+ getData: function ($defer, params) {
|
|
|
+ $scope.loading = true;
|
|
|
+ var pageParams = params.url();
|
|
|
+ pageParams.searchFilter = {
|
|
|
+ keyword: $scope.keyword,
|
|
|
+ fromDate: getDateTime($scope.condition.dateFrom),
|
|
|
+ endDate: getDateTime($scope.condition.dateTo)
|
|
|
+ };
|
|
|
+ getSerivce()[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function (page) {
|
|
|
+ $scope.loading = false;
|
|
|
+ if (page) {
|
|
|
+ params.total(page.totalElement);
|
|
|
+ $scope.total = page.totalElement;
|
|
|
+ $defer.resolve(page.content);
|
|
|
+ $scope.keywordXls = angular.copy(pageParams.searchFilter.keyword);//保存当前取值的关键词
|
|
|
+ }
|
|
|
}, function (response) {
|
|
|
- newPage.close();
|
|
|
- toaster.pop('error', '打印失败', response.data);
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '数据加载失败', response.data);
|
|
|
});
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- };
|
|
|
-
|
|
|
- $scope.openDatePicker = function ($event, item, openParam) {
|
|
|
- $event.preventDefault();
|
|
|
- $event.stopPropagation();
|
|
|
- item[openParam] = !item[openParam];
|
|
|
- };
|
|
|
-
|
|
|
- $scope.openFilterDatePicker = function ($event, item, openParam) {
|
|
|
- $event.preventDefault();
|
|
|
- $event.stopPropagation();
|
|
|
- item[openParam] = !item[openParam];
|
|
|
- if ($scope.condition.dateFrom && $scope.condition.dateTo && !item[openParam]) {
|
|
|
- $scope.tableParams.reload();
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- $scope.parseDate = function (dateStr) {
|
|
|
- if (dateStr)
|
|
|
- return Date.parse(dateStr, 'yyyy-MM-dd');
|
|
|
- return new Date();
|
|
|
- };
|
|
|
-
|
|
|
- $scope.checkboxes = {
|
|
|
- checked: false
|
|
|
- };
|
|
|
+ //打印
|
|
|
+ $scope.print = function (deputyOrder) {
|
|
|
+ DeputyOrder.printCount({id: deputyOrder.id}, {});//增加打印此次
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ ReportService.print(deputyOrder.deputyuu, 'PURCNOTICE', "where purc$deputyorders.deo_id=" + deputyOrder.id); // 定向采购通知
|
|
|
+ ReportService.print(deputyOrder.deputyuu, 'PURCHASE', "where purc$deputyorders.deo_id=" + deputyOrder.id); // 采购订单
|
|
|
+ ReportService.print(deputyOrder.deputyuu, 'PAYCONFIRM', "where purc$deputyorders.deo_id=" + deputyOrder.id); // 付款确认
|
|
|
+ ReportService.print(deputyOrder.deputyuu, 'TRADECONTRACT', "where purc$deputyorders.deo_id=" + deputyOrder.id); // 买卖合同
|
|
|
|
|
|
- // 点击勾选全部的复选框
|
|
|
- $scope.checkAll = function () {
|
|
|
- angular.forEach($scope.tableParams.data, function (item) {
|
|
|
- item.$selected = $scope.checkboxes.checked;
|
|
|
- });
|
|
|
- };
|
|
|
+ };
|
|
|
|
|
|
- // 点击其中一个明细的复选框
|
|
|
- $scope.checkOne = function (order) {
|
|
|
- var result = true;
|
|
|
- angular.forEach($scope.tableParams.data, function (item) {
|
|
|
- if (item.$selected != true) {
|
|
|
- result = false;
|
|
|
- return;
|
|
|
- }
|
|
|
- });
|
|
|
- $scope.checkboxes.checked = result;
|
|
|
- };
|
|
|
+ // 搜索框回车
|
|
|
+ $scope.onSearch = function (keyword) {
|
|
|
+ // 每次搜索重置获取数据方法
|
|
|
+ $scope.searchMethod = false;
|
|
|
+ if(keyword != null && keyword != '') {
|
|
|
+ $scope.searchMethod = true;
|
|
|
+ }
|
|
|
+ $scope.tableParams.page(1);
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ };
|
|
|
|
|
|
- // 搜索框回车
|
|
|
- $scope.onSearch = function (keyword) {
|
|
|
- // 每次搜索重置获取数据方法
|
|
|
- $scope.searchMethod = false;
|
|
|
- if(keyword != null && keyword != '') {
|
|
|
- $scope.searchMethod = true;
|
|
|
+ // 复制采购单
|
|
|
+ $scope.copyorder = function (id) {
|
|
|
+ $scope.loading = true;
|
|
|
+ DeputyOrder.copyOrder({id: id}, {}, function (data) {
|
|
|
+ $scope.loading = false;
|
|
|
+ if (data.id) {
|
|
|
+ toaster.pop('success', '提示', '复制生成单据成功');
|
|
|
+ window.location.hash = "#/purc/deputy/" + data.id;
|
|
|
}
|
|
|
- $scope.tableParams.page(1);
|
|
|
- $scope.tableParams.reload();
|
|
|
- $scope.tip = keyword;
|
|
|
- };
|
|
|
- // 选择查找日期
|
|
|
- $scope.onDateCondition = function () {
|
|
|
- $scope.tableParams.page(1);
|
|
|
- $scope.tableParams.reload();
|
|
|
- };
|
|
|
+ if (data.error) {
|
|
|
+ toaster.pop('error', '提示', '保存失败');
|
|
|
+ }
|
|
|
+ }, function (response) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- // 复制订单
|
|
|
- $scope.copyorder = function (id) {
|
|
|
- PurchaseOrder.copyorder({id: id}, {}, function (data) {
|
|
|
- if (data.id) {
|
|
|
- toaster.pop('success', '提示', '单据复制成功');
|
|
|
- window.location.hash = "#purc/cart/" + data.id;
|
|
|
- }
|
|
|
- }, function (response) {
|
|
|
- toaster.pop('error', '提示', response.data);
|
|
|
- });
|
|
|
- }
|
|
|
+ // 删除代采订单
|
|
|
+ $scope.clear = function (id) {
|
|
|
+ $scope.loading = true;
|
|
|
+ DeputyOrder.clearOrder({id: id}, {}, function (data) {
|
|
|
+ if (data.success) {
|
|
|
+ toaster.pop('success', '提示', data.success);
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }
|
|
|
+ $scope.loading = false;
|
|
|
+ }, function (response) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- // 导出
|
|
|
- $scope.exportXls = function () {
|
|
|
- PurcOrders.exportXls({}, {}, function (data) {
|
|
|
- if (data.success){
|
|
|
- window.location.href = 'sale/orders/purc/xls?_state='+$scope.active+'&searchFilter='+encodeURIComponent(angular.toJson($scope.searchFilterXls));
|
|
|
+ $scope.viewApprove = function(salecode, uu) {
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ templateUrl: 'static/tpl/index/purc/modal/approval_detail.html',
|
|
|
+ controller: 'ViewApprovalDetailCtrl',
|
|
|
+ resolve: {
|
|
|
+ uu: function () {
|
|
|
+ return uu
|
|
|
+ },
|
|
|
+ salecode: function () {
|
|
|
+ return salecode
|
|
|
}
|
|
|
- }, function (response) {
|
|
|
- toaster.pop('error', '数据加载失败', response.data);
|
|
|
- });
|
|
|
- }
|
|
|
- }]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }]);
|
|
|
})
|