|
|
@@ -5301,9 +5301,8 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- $scope.uploadAttach = function (mould) {
|
|
|
+ var uploadAttach = function (mould, file) {
|
|
|
// var file = mould.attachFile.$viewValue, file = file && file.length > 0 ? file[0] : null;
|
|
|
- var file = mould.attachs[0];
|
|
|
$scope.mould = mould;
|
|
|
$upload.upload({
|
|
|
url: 'sale/mould/' + mould.id + '/send',
|
|
|
@@ -5313,10 +5312,47 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
json: $scope.mould
|
|
|
}
|
|
|
}).success(function (res) {
|
|
|
+ $scope.mould.sellAttachs.push(res);
|
|
|
}).error(function (res) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ $scope.pushFile = function(mould, file) {
|
|
|
+ // var file = $scope.myFiles;
|
|
|
+ if (file.length > 0) {
|
|
|
+ for (var i = 0; i < file.length; i++) {
|
|
|
+ console.log(file[i].name);
|
|
|
+ var flag = true;
|
|
|
+
|
|
|
+ if (mould.sellAttachs.length > 0) {
|
|
|
+ for (var j = 0; j < mould.sellAttachs.length; j++) {
|
|
|
+ if (mould.sellAttachs[j].name == file[i].name
|
|
|
+ && mould.sellAttachs[j].size == file[i].size) {
|
|
|
+ flag = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flag) {
|
|
|
+ uploadAttach(mould, file[i]);
|
|
|
+ $scope.canSave = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ document.getElementById("inquiryMould.sellAttachs").value = "";
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.removeFile = function(mould, file) {
|
|
|
+ $scope.inquiryMould = mould;
|
|
|
+ if ($scope.inquiryMould.sellAttachs != null && $scope.inquiryMould.sellAttachs.length > 0) {
|
|
|
+ for (var i = 0; i < $scope.inquiryMould.sellAttachs.length; i++) {
|
|
|
+ if ($scope.inquiryMould.sellAttachs[i].name == file.name
|
|
|
+ && $scope.inquiryMould.sellAttachs[i].size == file.size) {
|
|
|
+ $scope.inquiryMould.sellAttachs.splice(i, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
// 保存并确认报价
|
|
|
$scope.onReplyClick = function (mould, withSteps) {
|
|
|
@@ -5502,7 +5538,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}
|
|
|
}).success(function(attach){
|
|
|
if (attach){
|
|
|
- $scope.inquiryMould.attachs.push(attach);
|
|
|
+ $scope.inquiryMould.sellAttachs.push(attach);
|
|
|
}
|
|
|
}).error(function(res){
|
|
|
console.log("failure");
|
|
|
@@ -5510,17 +5546,17 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- $scope.pushFile = function() {
|
|
|
- var file = $scope.myFiles;
|
|
|
+ $scope.pushFile = function(file) {
|
|
|
+ // var file = $scope.myFiles;
|
|
|
if (file.length > 0) {
|
|
|
for (var i = 0; i < file.length; i++) {
|
|
|
console.log(file[i].name);
|
|
|
var flag = true;
|
|
|
|
|
|
- if ($scope.inquiryMould.attachs.length > 0) {
|
|
|
- for (var j = 0; j < $scope.inquiryMould.attachs.length; j++) {
|
|
|
- if ($scope.inquiryMould.attachs[j].name == file[i].name
|
|
|
- && $scope.inquiryMould.attachs[j].size == file[i].size) {
|
|
|
+ if ($scope.inquiryMould.sellAttachs.length > 0) {
|
|
|
+ for (var j = 0; j < $scope.inquiryMould.sellAttachs.length; j++) {
|
|
|
+ if ($scope.inquiryMould.sellAttachs[j].name == file[i].name
|
|
|
+ && $scope.inquiryMould.sellAttachs[j].size == file[i].size) {
|
|
|
flag = false;
|
|
|
break;
|
|
|
}
|
|
|
@@ -5534,11 +5570,11 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
};
|
|
|
|
|
|
$scope.removeFile = function(file) {
|
|
|
- if ($scope.files != null && $scope.files.length > 0) {
|
|
|
- for (var i = 0; i < $scope.files.length; i++) {
|
|
|
- if ($scope.files[i].name == file.name
|
|
|
- && $scope.files[i].size == file.size) {
|
|
|
- $scope.files.splice(i, 1);
|
|
|
+ if ($scope.inquiryMould.sellAttachs != null && $scope.inquiryMould.sellAttachs.length > 0) {
|
|
|
+ for (var i = 0; i < $scope.inquiryMould.sellAttachs.length; i++) {
|
|
|
+ if ($scope.inquiryMould.sellAttachs[i].name == file.name
|
|
|
+ && $scope.inquiryMould.sellAttachs[i].size == file.size) {
|
|
|
+ $scope.inquiryMould.sellAttachs.splice(i, 1);
|
|
|
document.getElementById("file").value = "";
|
|
|
}
|
|
|
}
|