demandRoom.js
3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
(function () {
"use strict";
//需求方物料主页
var demandRoomIndexController = function ($scope,dialogService,CustomizationService) {
//分页传入的数值
$scope.vm ={
pageNumber:1,
pageSize:10
};
//拉取开放物料
$scope.openRoomList = [];
$scope.getOpenRoomList = function () {
CustomizationService.apiCustomizationSupplyChainOpenRoomFind($scope.vm).success(function (data) {
if(data.errors === null || data.errors.length > 0){
dialogService.tip(data.errors);
}else{
$scope.openRoomList = data.result;
$scope.vm.totalCount = data.totalCount;
}
})
}
$scope.doSearch = function () {
CustomizationService.apiCustomizationSupplyChainopenRoomSearch($scope.vm).success(function (data) {
if(data.errors === null || data.errors.length > 0){
dialogService.tip(data.errors);
}else{
$scope.openRoomList = data.result;
$scope.vm.totalCount = data.totalCount;
}
})
}
//导入
$scope.import = {
title:"导入",
uploadMethod:"api.customization.supplychain.open.room.upload",
downLoadUrl:"/customization/api.do",
downLoadMethod:"api.supplychain.open.room.template"
};
$scope.getOpenRoomList();
//导出
$scope.doExceport = function () {
CustomizationService.apiCustomizationSupplyChainOpenRoomExport($scope.vm).success(function (data) {
if(data.errors === null || data.errors.length > 0){
dialogService.tip(data.errors);
}else{
window.open(data.url, "_self");
}
})
};
//失效
$scope.inactive = function (openRoom) {
CustomizationService.apiCustomizationSupplyChainopenRoomInactive({id:openRoom.id,rowVersion:openRoom.rowVersion}).success(function (data) {
if(data.errors === null || data.errors.length > 0){
dialogService.tip(data.errors);
}else{
$scope.getOpenRoomList();
dialogService.tip([{"message":"失效成功"}]);
}
})
};
//启用
$scope.active = function (openRoom) {
CustomizationService.apiCustomizationSupplyChainopenRoomActive({id:openRoom.id,rowVersion:openRoom.rowVersion}).success(function (data) {
if(data.errors === null || data.errors.length > 0){
dialogService.tip(data.errors);
}else{
$scope.getOpenRoomList();
dialogService.tip([{"message":"启用成功"}]);
}
})
}
//监听
$scope.$watch(function () {
return $scope.import.data;
}, function (newDate, oldDate) {
if (oldDate == null && newDate != null) {
if (newDate.isSuccessful){
location.reload(true);
}
}
});
};
var app =angular.module("xn.page", [])
.controller("DemandRoomIndexController",["$scope","dialogService","CustomizationService",demandRoomIndexController])
})();