|
@@ -1,16 +1,9 @@
|
|
|
-starter.controller('CompConnectCtrl', function ($scope, $state, $ionicSlideBoxDelegate, $rootScope, $ionicHistory, $window,$location, showPopup, global, Comp) {
|
|
|
+starter.controller('CompConnectCtrl', function ($scope, $state, $ionicSlideBoxDelegate, $rootScope, $ionicHistory, $window, $location, formatFilter, showPopup, global, Comp) {
|
|
|
$scope.activeIndex = 3;
|
|
|
$scope.titleName = ['填写序列号', '选择公司', '用户信息', '导入部门'];
|
|
|
var compmodal = showPopup.modalTemplate('templates/modal-selectcomp.html', 'slide-in-up', $scope);
|
|
|
|
|
|
global.fetch_user().then(function (res) {
|
|
|
- // if (!global.sn)
|
|
|
- // Comp.sn.get({"comp_id": global.user.compno}, function (data) {
|
|
|
- // global.sn = data.sn;
|
|
|
- // console.warn("sn: " + global.sn);
|
|
|
- // }, function (err) {
|
|
|
- // console.error("获取服务器的SN失败: " + JSON.stringify(err))
|
|
|
- // });
|
|
|
$scope.activecomp = {};
|
|
|
});
|
|
|
|
|
@@ -19,17 +12,17 @@ starter.controller('CompConnectCtrl', function ($scope, $state, $ionicSlideBoxDe
|
|
|
};
|
|
|
|
|
|
$scope.next = function (op, serialno) {
|
|
|
- $ionicSlideBoxDelegate.next();
|
|
|
- $scope.activeIndex = $ionicSlideBoxDelegate.currentIndex();
|
|
|
if (op == 1) {
|
|
|
$scope.serialnumber = serialno;
|
|
|
global.sn = $scope.serialnumber;
|
|
|
Comp.comp('GetComp').query(function (data) {
|
|
|
$scope.compdata = data;
|
|
|
$scope.activecomp = data[0];
|
|
|
+ $ionicSlideBoxDelegate.next();
|
|
|
+ $scope.activeIndex = $ionicSlideBoxDelegate.currentIndex();
|
|
|
$scope.showmodal();
|
|
|
}, function (err) {
|
|
|
- console.log(JSON.stringify(err))
|
|
|
+ alert("GetComp失败: " + JSON.stringify(err));
|
|
|
})
|
|
|
}
|
|
|
};
|
|
@@ -39,6 +32,7 @@ starter.controller('CompConnectCtrl', function ($scope, $state, $ionicSlideBoxDe
|
|
|
global.sn = $scope.serialnumber;
|
|
|
showPopup.showLoading(1, '正在提交', false);
|
|
|
Comp.comp("PostComp").save($scope.activecomp, function (data) {
|
|
|
+ $scope.activecomp = _.extend($scope.activecomp, {"compid": data.linkercompid});
|
|
|
Comp.sn.save({"sn": global.sn, "comp": data.linkercompid}, function (data) {
|
|
|
console.log(data);
|
|
|
$ionicSlideBoxDelegate.next();
|
|
@@ -55,7 +49,7 @@ starter.controller('CompConnectCtrl', function ($scope, $state, $ionicSlideBoxDe
|
|
|
$scope.importDept = function () {
|
|
|
showPopup.showLoading(1, '导入中', false);
|
|
|
Comp.dept("PostDept").save(function (data) {
|
|
|
- $window.location.href = "http://" + $location.host() + ":8100/apps/accountMng/index.html#/contacts/-1&Linker test3&78";
|
|
|
+ $window.location.href = formatFilter("http://" + $location.host() + ":8100/apps/accountMng/index.html#/contacts/-1&{0}&{1}", $scope.activecomp.name, $scope.activecomp.compid);
|
|
|
}, function (err) {
|
|
|
alert(JSON.stringify(err))
|
|
|
}).$promise.finally(function (f) {
|