|
@@ -5,6 +5,7 @@
|
|
|
$scope.selectTabId = '';
|
|
|
$scope.fileList = [];
|
|
|
$scope.treeList = [];
|
|
|
+ $scope.ssflTypeList = [];
|
|
|
|
|
|
$stateParams = $bsRouterState.$params($scope);
|
|
|
|
|
@@ -16,6 +17,20 @@
|
|
|
ptotal: 0
|
|
|
};
|
|
|
|
|
|
+ $scope.loadSsflTypes=function(){
|
|
|
+
|
|
|
+ $http({
|
|
|
+ method: 'get',
|
|
|
+ url: '../../api/dictionary/getDictionaryListByDicTypeKey',
|
|
|
+ params: {dicTypeKey: 'ssflType'}
|
|
|
+ }).then(function (result) {
|
|
|
+ $scope.ssflTypeList = result.data;
|
|
|
+ }, function (resp) {
|
|
|
+
|
|
|
+ });
|
|
|
+ };
|
|
|
+ $scope.loadSsflTypes();
|
|
|
+
|
|
|
$scope.selectData.fileName = $stateParams.fileName;
|
|
|
|
|
|
$scope.GetNavData = function () {
|
|
@@ -33,7 +48,7 @@
|
|
|
|
|
|
});
|
|
|
//添加
|
|
|
- if ($scope.selectData.fileName != null){
|
|
|
+ if ($scope.selectData.fileName){
|
|
|
$scope.FindWord();
|
|
|
}else{
|
|
|
$scope.clickTreeChild($scope.navList[0]);
|
|
@@ -86,7 +101,6 @@
|
|
|
$scope.selectData.pageindex = 1;
|
|
|
$scope.selectData.filetypeid=item.id;
|
|
|
$scope.selectData.filetypename=item.name;
|
|
|
-
|
|
|
$scope.selectData.fileName = '';
|
|
|
|
|
|
if(!item.children){
|
|
@@ -105,7 +119,7 @@
|
|
|
|
|
|
$scope.FindWord = function () {
|
|
|
|
|
|
- if ($scope.selectData.fileName.length > 0) {
|
|
|
+ if ($scope.selectData.fileName){
|
|
|
//$window.open('http://10.160.8.64:8080/es/search.do?keyWords=' + decodeURI($scope.selectKey));
|
|
|
//$bsRouterState.go('home.fileFrame', {keyWords: $scope.selectKey});
|
|
|
$http({
|
|
@@ -121,7 +135,7 @@
|
|
|
//$loading.hide();
|
|
|
});
|
|
|
} else {
|
|
|
- $alert({title: '提示:', content: '请输入关键字!', placement: 'top', type: 'info', show: true, duration: 3});
|
|
|
+ $scope.showMsg("提示", "请输入关键字!", '');
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -175,7 +189,7 @@
|
|
|
//监视页数变化
|
|
|
$scope.$watch("selectData.pageindex", function (newVal, oldVal) {
|
|
|
if ($scope.selectData.ptotal > 0) {
|
|
|
- if ($scope.selectData.fileName != null && $scope.selectData.fileName != ''){
|
|
|
+ if ($scope.selectData.fileName){
|
|
|
$scope.FindWord();
|
|
|
}else {
|
|
|
$scope.loadData();
|
|
@@ -248,15 +262,7 @@
|
|
|
var loc = filename.lastIndexOf('.');
|
|
|
var filetype = filename.substring(loc + 1, filename.length).toLowerCase();
|
|
|
if(filetype!='pdf'){
|
|
|
- $alert({
|
|
|
- title: '消息',
|
|
|
- content: "只允许上传pdf",
|
|
|
- placement: 'top',
|
|
|
- type: 'info',
|
|
|
- show: true,
|
|
|
- duration: 3,
|
|
|
- container: '#dicmodal'
|
|
|
- });
|
|
|
+ $scope.showMsg("消息", "只允许上传pdf", "#dicmodal");
|
|
|
|
|
|
$scope.content.file=null;
|
|
|
}
|
|
@@ -266,93 +272,48 @@
|
|
|
|
|
|
};
|
|
|
|
|
|
- $scope.upfile=function(){
|
|
|
+ $scope.submit = function (isflag) {
|
|
|
+ if(!$scope.content.file){
|
|
|
+ $scope.showMsg("消息", "请选择上传文件", '');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
$scope.updata.isuping=true;
|
|
|
Upload.upload({
|
|
|
url: '../../api/workresourcelibrary/postFile',
|
|
|
data: {file: $scope.content.file, 'fileId': $scope.content.fileid}
|
|
|
}).then(function (resp) {
|
|
|
if (resp.data.success) {
|
|
|
- $alert({
|
|
|
- title: '消息',
|
|
|
- content: resp.data.msg,
|
|
|
- placement: 'top',
|
|
|
- type: 'info',
|
|
|
- show: true,
|
|
|
- duration: 3
|
|
|
- });
|
|
|
- //fileObject.loadItems(fileObject.fileoption);
|
|
|
- //$scope.updata.progressPer=100;
|
|
|
$scope.updata.isuping=false;
|
|
|
$scope.updata.updated=true;
|
|
|
|
|
|
+ if (isflag) {
|
|
|
+ $loading.show();
|
|
|
+ $http({
|
|
|
+ method: "post",
|
|
|
+ url: "../../api/workresourcelibrary/saveFile",
|
|
|
+ data: $scope.content
|
|
|
+ }).then(function (result) {
|
|
|
+ $loading.hide();
|
|
|
+ $scope.showMsg("成功", result.data.msg, '');
|
|
|
+ //重新刷新列表
|
|
|
+ $scope.loadData();
|
|
|
+ $scope.$hide();
|
|
|
+
|
|
|
+ }), function (resp) {
|
|
|
+ $scope.showMsg("错误", "服务器错误", '');
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
$scope.updata.progressPer=0;
|
|
|
- $alert({
|
|
|
- title: '消息',
|
|
|
- content: resp.data.msg,
|
|
|
- placement: 'top',
|
|
|
- type: 'info',
|
|
|
- show: true,
|
|
|
- duration: 3
|
|
|
- });
|
|
|
-
|
|
|
+ $scope.showMsg("消息", resp.data.msg, '');
|
|
|
}
|
|
|
- //console.log('Success ' + resp.config.data.file.name + 'uploaded. Response: ' + resp.data);
|
|
|
}, function (resp) {
|
|
|
$scope.updata.updated=false;
|
|
|
- $alert({title: '错误', content: "上传服务器错误!", placement: 'center', type: 'info', show: true, duration: 3});
|
|
|
- //$scope.updata.progressPer=0;
|
|
|
-
|
|
|
+ $scope.showMsg("错误", "上传服务器错误", '');
|
|
|
}, function (evt) {
|
|
|
$scope.updata.progressPer = parseInt(100.0 * evt.loaded / evt.total);
|
|
|
- //console.log('progress: ' + progressPercentage + '% ' + evt.config.data.file.name);
|
|
|
});
|
|
|
- };
|
|
|
-
|
|
|
- $scope.submit = function (isflag) {
|
|
|
- if (isflag) {
|
|
|
- if(!$scope.updata.updated){
|
|
|
- $alert({
|
|
|
- title: '提示:',
|
|
|
- content: '请上传文件',
|
|
|
- placement: 'top',
|
|
|
- type: 'info',
|
|
|
- show: true,
|
|
|
- duration: 3
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- $loading.show();
|
|
|
- $http({
|
|
|
- method: "post",
|
|
|
- url: "../../api/workresourcelibrary/saveFile",
|
|
|
- data: $scope.content
|
|
|
- }).then(function (result) {
|
|
|
- $loading.hide();
|
|
|
- $alert({
|
|
|
- title: '成功:',
|
|
|
- content: result.data.msg,
|
|
|
- placement: 'top',
|
|
|
- type: 'info',
|
|
|
- show: true,
|
|
|
- duration: 3
|
|
|
- });
|
|
|
- //重新刷新列表
|
|
|
- $scope.loadData();
|
|
|
- $scope.$hide();
|
|
|
-
|
|
|
- }), function (resp) {
|
|
|
- $alert({
|
|
|
- title: '错误:',
|
|
|
- content: '服务器错误',
|
|
|
- placement: 'top',
|
|
|
- type: 'info',
|
|
|
- show: true,
|
|
|
- duration: 3
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
};
|
|
|
savemodalCtrl.$inject = ['$scope', '$http','Upload','$alert'];
|
|
@@ -394,13 +355,14 @@
|
|
|
$loading.show();
|
|
|
};
|
|
|
|
|
|
- $scope.importFile = function () {
|
|
|
- console.log("importFile");
|
|
|
- }
|
|
|
-
|
|
|
$scope.exportFile = function () {
|
|
|
- console.log("exportFile");
|
|
|
- }
|
|
|
+ var params = "?1=1";
|
|
|
+ for (var p in $scope.selectData) {
|
|
|
+ if ($scope.selectData[p] !== '' && $scope.selectData[p] !== null)
|
|
|
+ params += ("&" + p + "=" + encodeURI($scope.selectData[p]));
|
|
|
+ }
|
|
|
+ window.open('../../api/workresourcelibrary/export' + params);
|
|
|
+ };
|
|
|
|
|
|
$scope.getFileById = function (id) {
|
|
|
$http.get("../../api/workresourcelibrary/getFile", {params: {'fileId': id}}).then(function (result) {
|
|
@@ -410,7 +372,7 @@
|
|
|
workModal.params.content.filetypename=$scope.selectData.filetypename;
|
|
|
workModal.$promise.then(workModal.show);
|
|
|
}, function () {
|
|
|
- $alert({title: '错误:', content: '服务器错误', placement: 'top', type: 'info', show: true, duration: 3});
|
|
|
+ $scope.showMsg("错误", "服务器错误", '');
|
|
|
});
|
|
|
};
|
|
|
|
|
@@ -421,7 +383,7 @@
|
|
|
method: 'GET',
|
|
|
params: {fileId: id}
|
|
|
}).then(function (result) {
|
|
|
- $scope.showMsg("消息", result.data.msg);
|
|
|
+ $scope.showMsg("消息", result.data.msg, '');
|
|
|
if (result.data.success) {
|
|
|
$scope.loadData();
|
|
|
}
|
|
@@ -430,22 +392,22 @@
|
|
|
};
|
|
|
|
|
|
var fileTypeModalController = function ($scope, $http) {
|
|
|
-
|
|
|
$scope.edit = {
|
|
|
filetypeparentname: "",
|
|
|
- filetypeparentid: "",
|
|
|
- treecurrentfiletypeid :'',
|
|
|
- treefiletypeparentname :'',
|
|
|
- treefiletypeparentid :''
|
|
|
+ filetypeparentid: ""
|
|
|
};
|
|
|
$scope.title = "模板分类信息";
|
|
|
$scope.fileTypeModel = angular.copy($scope.currentFileType);
|
|
|
$scope.edit.filetypeparentid = $scope.fileTypeModel.parenttypeid;
|
|
|
- $scope.selectfileTypeParent = function () {
|
|
|
+ $scope.selectFileTypeParent = function () {
|
|
|
if ($scope.selectParentShow) {
|
|
|
myselectModal.$promise.then(myselectModal.show);
|
|
|
}
|
|
|
+ };
|
|
|
|
|
|
+ $scope.clearFileTypeParent = function () {
|
|
|
+ $scope.edit.filetypeparentname = '模板分类';
|
|
|
+ $scope.edit.filetypeparentid = '';
|
|
|
};
|
|
|
|
|
|
//获取原父级菜单
|
|
@@ -492,61 +454,32 @@
|
|
|
});
|
|
|
};
|
|
|
$scope.selectTreeFileTypeItem = function (item) {
|
|
|
- if ($scope.curMenuID != item.filetypeid) {
|
|
|
+ if ($scope.edit.filetypeparentid != item.filetypeid) {
|
|
|
if (item.parentmoduleid != null) {
|
|
|
- $alert({
|
|
|
- title: '提示:',
|
|
|
- content: "只能选择一级模块",
|
|
|
- placement: 'top',
|
|
|
- type: 'info',
|
|
|
- show: true,
|
|
|
- duration: 3,
|
|
|
- container: "#selectParentMenu"
|
|
|
- });
|
|
|
- return;
|
|
|
+ $scope.showMsg("提示", "只能选择一级模块", "#selectParentMenu");
|
|
|
+ return false;
|
|
|
}
|
|
|
- $scope.edit.treefiletypeid = item.filetypeid;
|
|
|
- $scope.edit.treefiletypeparentname = item.filetypename;
|
|
|
- $scope.edit.treefiletypeparentid = item.filetypeid;
|
|
|
+ $scope.edit.filetypeparentid = item.filetypeid;
|
|
|
+ $scope.edit.filetypeparentname = item.filetypename;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
//加载所有的父菜单记录
|
|
|
var selecModalController = function ($scope, $http) {
|
|
|
-
|
|
|
- //加载所有的父菜单记录
|
|
|
- $scope.getMenus = function () {
|
|
|
- $.ajax({
|
|
|
- url: "../../api/workresourcelibrary/getFiletypeList",
|
|
|
- data: {
|
|
|
- pageindex: 1,
|
|
|
- pagesize: 999
|
|
|
- },
|
|
|
- type: 'get',
|
|
|
- contentType: 'application/json',
|
|
|
- success: function (res) {
|
|
|
- $scope.$apply(function () {
|
|
|
- $scope.selectMenus = res.item.list;
|
|
|
- })
|
|
|
- },
|
|
|
- error: function (res) {
|
|
|
- console.log(res);
|
|
|
- }
|
|
|
- });
|
|
|
- };
|
|
|
//加载子菜单
|
|
|
- $scope.loadChild = function (item) {
|
|
|
-
|
|
|
+ $scope.loadTreeChildFileType = function (item) {
|
|
|
+ $scope.searchParam = "";//查询条件清空
|
|
|
if (!item.isExpand)//如果该节点未展开
|
|
|
{
|
|
|
item.isExpand = true;
|
|
|
- $scope.getMenuByPID(item);
|
|
|
+ $scope.getFileTypeByParentID(item);
|
|
|
} else {
|
|
|
item.isExpand = false;
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
//根据当前项的menuID找到其所有的子菜单
|
|
|
- $scope.getMenuByPID = function (item) {
|
|
|
+ $scope.getFileTypeByParentID = function (item) {
|
|
|
$http.get("../../api/workresourcelibrary/getFiletypeList", {
|
|
|
params: {
|
|
|
'parentId': item.filetypeid,
|
|
@@ -554,55 +487,48 @@
|
|
|
pagesize: 999
|
|
|
}
|
|
|
}).then(function (result) {
|
|
|
- item.childs = result.data.item.list;
|
|
|
+ item.childMenus = result.data.item.list;
|
|
|
|
|
|
- }, function (result) {
|
|
|
+ }, function (reason) {
|
|
|
console.log("无匹配项");
|
|
|
});
|
|
|
};
|
|
|
- $scope.getMenus();
|
|
|
|
|
|
- $scope.changeChoose = function (item) {
|
|
|
- if ($scope.curMenuID != item.filetypeid) {
|
|
|
+ $scope.selectTreeFileTypeItem = function (item) {
|
|
|
+ if ($scope.edit.filetypeparentid != item.filetypeid) {
|
|
|
if (item.parentmoduleid != null) {
|
|
|
- $alert({
|
|
|
- title: '提示:',
|
|
|
- content: "只能选择一级模块",
|
|
|
- placement: 'top',
|
|
|
- type: 'info',
|
|
|
- show: true,
|
|
|
- duration: 3,
|
|
|
- container: "#selectfileTypeParentMenu"
|
|
|
- });
|
|
|
- return;
|
|
|
+ $scope.showMsg("提示", "只能选择一级模块", "#selectParentMenu");
|
|
|
+ return false;
|
|
|
}
|
|
|
- $scope.curMenuID = item.filetypeid;
|
|
|
- $scope.Finalfiletypeparentname = item.filetypename;
|
|
|
- $scope.Finalfiletypeparentid = item.filetypeid;
|
|
|
+ $scope.edit.filetypeparentid = item.filetypeid;
|
|
|
+ $scope.edit.filetypeparentname = item.filetypename;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- $scope.choose = function () {
|
|
|
- if ($scope.Finalfiletypeparentid != null) {
|
|
|
- $scope.edit.filetypeparentname = $scope.Finalfiletypeparentname;
|
|
|
- $scope.edit.parenttypeid = $scope.Finalfiletypeparentid;
|
|
|
- myselectModal.$promise.then(myselectModal.hide);
|
|
|
- } else {
|
|
|
- $alert({
|
|
|
- title: '提示:',
|
|
|
- content: "未选择有效的父级模块",
|
|
|
- placement: 'top',
|
|
|
- type: 'info',
|
|
|
- show: true,
|
|
|
- duration: 3,
|
|
|
- container: "#selectfileTypeParentMenu"
|
|
|
- });
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+ $scope.loadFiletypeList = function () {
|
|
|
+ $.ajax({
|
|
|
+ url: "../../api/workresourcelibrary/getFiletypeList",
|
|
|
+ data: {
|
|
|
+ pageindex: 1,
|
|
|
+ pagesize: 999
|
|
|
+ },
|
|
|
+ type: 'get',
|
|
|
+ contentType: 'application/json',
|
|
|
+ success: function (res) {
|
|
|
+ $scope.$apply(function () {
|
|
|
+ $scope.selectMenus = res.item.list;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ error: function (res) {
|
|
|
+ console.log(res);
|
|
|
+ }
|
|
|
+ });
|
|
|
};
|
|
|
+ $scope.loadFiletypeList();
|
|
|
|
|
|
-
|
|
|
+ $scope.choose = function () {
|
|
|
+ myselectModal.$promise.then(myselectModal.hide);
|
|
|
+ };
|
|
|
};
|
|
|
selecModalController.$inject = ['$scope', '$http'];
|
|
|
var myselectModal = $modal({
|
|
@@ -621,7 +547,7 @@
|
|
|
});
|
|
|
//保存菜单项
|
|
|
$scope.saveFileType = function () {
|
|
|
- $scope.fileTypeModel.parenttypeid = $scope.edit.parenttypeid;
|
|
|
+ $scope.fileTypeModel.parenttypeid = $scope.edit.filetypeparentid;
|
|
|
$.ajax({
|
|
|
url: "../../api/workresourcelibrary/saveFiletype",
|
|
|
data: JSON.stringify($scope.fileTypeModel),
|
|
@@ -629,9 +555,9 @@
|
|
|
contentType: 'application/json',
|
|
|
success: function (res) {
|
|
|
$scope.$apply(function () {
|
|
|
- $scope.getMenuList();
|
|
|
+ $scope.GetNavData();
|
|
|
fileTypeModal.$promise.then(fileTypeModal.hide);
|
|
|
- $scope.showalert(res.msg);
|
|
|
+ $scope.showMsg("提示", res.msg, '');
|
|
|
})
|
|
|
},
|
|
|
error: function (res) {
|
|
@@ -675,16 +601,24 @@
|
|
|
}
|
|
|
$http.get("../../api/workresourcelibrary/deleteFiletype",
|
|
|
{params: {'typeid': $scope.currentFileType.filetypeid}}).then(function (result) {
|
|
|
- // $scope.getMenuList();
|
|
|
- $scope.showalert(result.data.msg);
|
|
|
+ $scope.GetNavData();
|
|
|
+ $scope.showMsg("提示", result.data.msg, '');
|
|
|
}, function () {
|
|
|
console.log("无匹配项");
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- //提示函数
|
|
|
- $scope.showalert = function (data) {
|
|
|
- $alert({title: '提示:', content: data, placement: 'top', type: 'info', show: true, duration: 3});
|
|
|
+ $scope.showMsg = function (title, content, container) {
|
|
|
+ $alert({
|
|
|
+ title: title + ':',
|
|
|
+ content: content,
|
|
|
+ placement: 'top',
|
|
|
+ type: 'info',
|
|
|
+ show: true,
|
|
|
+ duration: 3,
|
|
|
+ container: container
|
|
|
+ });
|
|
|
+
|
|
|
};
|
|
|
|
|
|
}).controller('fileViewCtrl', function ($scope, $http) {
|