上传文件
//上传文件
$scope.filePath;
$scope.selFile = function (address, name) {
filePath = "";
var fileList = [];
if (model.tid != "0") {
for (var i = 0; i < address.length; i++) {
if (address[i].length > 0) {
fileList.push({ "FilePath": address[i], "FileName": name[i] });
}
}
}
$scope.uploadPicList({ list: fileList, allowNum: 100 }, function (selectedItem) {
for (var i = 0; i < selectedItem.length; i++) {
/*
在上传附件拿到上传的附件结果列表后,
遍历列表,
检查allFileNameList中是否存在当前项,
如果存在,不进行push操作,
反之,将当前项铺设到allFileNameList中
避免文件重复添加
*/
var flag = 0;
for (var j = 0; j < $scope.allFileNameList.length; j++) {
if (selectedItem[i].FileName == $scope.allFileNameList[j]) {
flag = 1;
break;
}
}
if (flag == 0) {
$scope.allFileNameList.push(selectedItem[i].FileName);
$scope.allAddressList.push(selectedItem[i].FilePath);
}
}
});
};
文件上传取消
//文件上传取消
$scope.remove = function (removeFile) {
if ($scope.isDetail) {
alert("查看详情无法删除文件");
}
var allFile = $scope.allAddressList;
var allFileName = $scope.allFileNameList;
var addreddAndName = laFileUploadService.removeFilePath(removeFile, allFile, allFileName);
$scope.allAddressList = addreddAndName[0];
$scope.allFileNameList = addreddAndName[1];
};
打开所要上传的文件
//打开所要上传的文件
$scope.openAddress = function (Address) {
window.open(Address);
};