123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862 |
- 'use strict';
- var app = angular.module('app', [
- ]);
- //定义一个全局的截图插件变量
- var cropper;
- app.controller("formeditCtrl", ["$scope", "$http", "$timeout", "$interval", "$sce", function ($scope, $http, $timeout, $interval, $sce) {
- var self = this;
- var s4 = new SM4Util();
- self.userId = $.cookie("GlWorkPlatform-userid");
- self.userName = $.cookie("GlWorkPlatform-chineseName");
- self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
- self.routeid = sp.getUrlName("routeid");
- self.routeinfoid = sp.getUrlName("routeinfoid");
- self.directionid = sp.getUrlName("directionid");
- self.formeditid = sp.getUrlName("formeditid");
- self.docmode = sp.getUrlName("docmode");
- self.dotype = sp.getUrlName("dotype");
- self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
- self.get_lastReturnPage = sp.getUrlName("lastReturnPage");
- self.get_type = sp.getUrlName("type");
- if (self.get_lastReturnPage != "") {
- self.return = "../../../" + self.get_lastReturnPage + "?lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.get_type
- } else {
- self.return = "../list.html?lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.get_type
- }
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- };
- self.video = false;
- self.QianPi = false;
- self.watchNum = 0;
- //初始化右上角按钮
- self.buttonList = []
- var uploadformat = window.top.uploadformat.map(function (item) {
- return item.CNAME
- })
- self.getSwenList = function () {
- self.SwenList = [];
- var data = {
- directionid: self.directionid,
- userid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: self.routeid,
- formeditid: ""
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataLink", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- $.each(res.data.LINKS, function (index, item) {
- item.TEMPFORM = item.TEMPFORM + "&flowid=" + sp.getUrlName("flowid")
- if (item.TEMPFORM.indexOf("attachlist.html") > -1) {
- self.Title = item.VNAME;
- }
- if (item.TEMPFORM.indexOf("?docmode") > 0) {
- if (item.TEMPFORM.indexOf("attachlist") > -1 || item.TEMPFORM.indexOf("fawenfile") > -1) {
- item.TEMPFORM = item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
- } else {
- item.TEMPFORM = "../" + item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
- }
- } else {
- item.TEMPFORM = "#";
- }
- self.SwenList.push(item)
- })
- self.SwenList.push({
- VNAME: "流程图",
- DIRECTIONID: self.SwenList[0].DIRECTIONID,
- TEMPFORM: "modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
- })
- self.getFuncList()
- })
- }
- self.getSwenList(0)
- self.getFuncList = function () {
- var data = {
- formeditid: self.formeditid,
- billkey: "FILE_ATTACH"
- }
- $http.post(apiurljs.login + "g2work/formedit/queryDataFormEditFunc", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.buttonList = res.data
- self.getData()
- })
- }
- self.getData = function () {
- var data = {
- tablename: "FILE_ATTACH",
- colums: "*",
- order: "ID desc",
- sqlwhere: { ROUTEINFOID: self.routeinfoid },
- sqlinwhere: "",
- sqllikewhere: ""
- }
- $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.arrayFile = res.data;
- self.getCJ()
- self.getMeetMsg()
- if (self.arrayFile.length > 0) {
- if (sp.getUrlName("FileNum") != "") {
- self.browse(self.arrayFile[sp.getUrlName("FileNum")])
- } else {
- self.browse(self.arrayFile[0])
- }
- }
- })
- }
- self.getCJ = function () {
- var data = {
- routeinfoid: self.routeinfoid
- }
- //$http.post(apiurljs.login + "g2app/plugin/queryPluginRouteDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- $http.post(apiurljs.login + "g2app/plugin/queryPluginRouteDataList", data, postCfg)
- .success(function (res) {
- //var res = strToJson(s4.decryptData_CBC(obj.data));
- self.cjList = res.data.reverse();
- self.getNumCJ()
- if (sp.getUrlName("CjNum") != "") {
- self.openCJ(self.cjList[sp.getUrlName("CjNum")])
- }
- if (sp.getUrlName("addSC") != "") {
- self.scLoadFirst = true;
- self.searchCj(1)
- }
- })
- }
- self.getNumCJ = function () {
- var data = {
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/plugin/queryPluginRouteDataListCount", data, postCfg)
- .success(function (res) {
- if (res.data != self.cjList.length) {
- self.getCJ()
- }
- })
- }
- self.getMeetMsg = function () {
- var data = {
- routeid: self.routeid,
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2work/meetcoop/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.meetList = res.data;
- self.meetNum = 0;
- self.meetList.forEach(function (item) {
- self.meetNum++
- item.FILES.forEach(function (item1) {
- self.meetNum++
- item1.WATCHLIMIT = sp.format(item1.WATCHLIMIT);
- })
- })
- self.getNumMeet()
- })
- }
- self.getNumMeet = function () {
- var data = {
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2work/meetcoop/queryDataListCount", data, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.data != self.meetNum) {
- self.getMeetMsg()
- }
- })
- }
- $interval(function () {
- self.getNumCJ()
- self.getNumMeet()
- }, 2000)
- //右上角按钮调用方法
- self.btnEvent = function (item) {
- switch (item.CODE) {
- case "SENDLOG": self.RouteList(); break;
- case "PRINTITEM": self.btnPrint(); break;
- case "MEETITEM": self.Meet(); break;
- case "SAVESIGN": self.Qian(); break;
- default: self.forward(item); break;
- }
- }
- self.uploading = false;
- self.upload = function () {
- $('#fileupload').fileupload({
- url: apiurljs.login + 'g2app/abase/uploadFileWithForm',
- dataType: 'json',
- beforeSend: function (xhr, data) {
- xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
- xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=机关党委非正式文"));
- },
- add: function (e, data) {
- var num = 0;
- var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
- //文件类型判断
- $.each(data.originalFiles, function (index, item) {
- if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
- sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
- return;
- } else {
- num++
- }
- })
- if (num == data.originalFiles.length) {
- self.uploading = true;
- data.submit(); $scope.$apply();
- }
- },
- // 上传完成后的执行逻辑
- done: function (e, data) {
- self.uploading = false;
- self.getData()
- }
- })
- }
- self.downLoad = function (item) {
- window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
- }
- self.deleteFile = function (file) {
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
- sp.openCenter(".sp-dialog");
- ///取消按钮
- $('.sp-closeDialog').click(function (event) {
- sp.closeCenter(".sp-dialog");
- event.preventDefault();
- event.stopPropagation();
- });
- //post消息的id
- $("#delDataTrue").click(function () {
- var data = {
- tablename: "FILE_ATTACH",
- id: file.ID
- };
- $http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- sp.dialoghide();
- if (res.success) {
- $.each(self.iframeList, function (index, item) {
- if (item.title == file.FILENAMES && item.source == apiurljs.login + "g2work/files2/inline/" + file.FILEURL.slice(7)) {
- self.closeItem(index);
- return false;
- }
- })
- self.getData();
- } else {
- sp.dialog("删除失败,请联系管理员!");
- }
- });
- });
- }
- self.searchCj = function (n) {
- var data1 = {
- ckey: "CODE_PLUGINKINDS",
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
- .success(function (obj1) {
- var res1 = strToJson(s4.decryptData_CBC(obj1.data));
- self.KINDS = res1.data.CODE_PLUGINKINDS;
- var data2 = {
- ckey: "CODE_PLUGINDTYPE",
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data2)) }, postCfg)
- .success(function (obj2) {
- var res2 = strToJson(s4.decryptData_CBC(obj2.data));
- self.DTYPE = res2.data.CODE_PLUGINDTYPE;
- var data3 = {
- ckey: "CODE_PLUGINAUTHMAN",
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data3)) }, postCfg)
- .success(function (obj3) {
- var res3 = strToJson(s4.decryptData_CBC(obj3.data));
- self.AUTHMAN = res3.data.CODE_PLUGINAUTHMAN;
- self.search = {
- KINDS: "",
- DTYPE: ""
- }
- self.addSC = {};
- self.getCJlist(n)
- })
- })
- })
- }
- self.getCJlist = function (n) {
- var data = {
- kinds: self.search.KINDS,
- dtype: self.search.DTYPE,
- ctype: "C02"
- }
- $http.post(apiurljs.login + "g2app/plugin/queryDataList", data, postCfg)
- //$http.post(apiurljs.login + "g2app/plugin/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (res) {
- //var res = strToJson(s4.decryptData_CBC(obj.data));
- self.CJlist = res.data;
- self.CJlist.forEach(function (item) {
- self.AUTHMAN.forEach(function (item1) {
- if (item.AUTHMAN == item1.CODE) {
- item.AUTHMAN1 = item1.CNAME;
- }
- })
- if (sp.getUrlName("addSC") != "" && item.ID == sp.getUrlName("addSC") && self.scLoadFirst == true) {
- self.addSC = item;
- self.AddSC()
- self.scLoadFirst = false;
- }
- })
- if (n == 0) {
- sp.layer("#addCJ")
- }
- })
- }
- self.AddSC = function () {
- var n = 0;
- self.iframeList.forEach(function (item) {
- if (item.title == self.addSC.CNAME && item.source == self.addSC.URL) {
- n++
- }
- })
- if (n == 0) {
- self.iframeList.push({ id: self.iframeList.length + 1, title: self.addSC.CNAME, url: $sce.trustAsResourceUrl(addToken(self.addSC.URL)), source: self.addSC.URL, pgcode: self.addSC.PGCODE })
- self.add()
- }
- sp.layerhide();
- }
- self.Meeting = function () {
- $http.post(apiurljs.login + "g2app/dataabase/getDpList", { data: s4.encryptData_CBC("") }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.dpList = res.data;
- self.dpList1 = [];
- self.dpList.forEach(function (item) {
- self.dpList1.push(item)
- item.USER.forEach(function (item1) {
- item1.show = true;
- })
- })
- self.activeDep = 0;
- self.userList = self.dpList1[0].USER;
- self.meetUser = [];
- sp.layer("#meet")
- })
- }
- self.searchName = "";
- self.searchPerson = function () {
- self.dpList1 = [];
- self.dpList.forEach(function (item) {
- if (item.DEP.indexOf(self.searchName) > -1) {
- self.dpList1.push(item)
- }
- })
- self.activeDep = 0;
- self.userList = self.dpList1[0].USER;
- }
- self.addmeet = function () {
- self.dpList.forEach(function (item) {
- item.USER.forEach(function (item1) {
- if (item1.checked == true && item1.show == true) {
- self.meetUser.push(item1);
- item1.checked = false;
- item1.show = false;
- }
- })
- })
- }
- self.delmeet = function () {
- self.meetUser.forEach(function (item) {
- if (item.checked == true) {
- item.checked = false;
- item.show = true;
- }
- })
- self.meetUser = self.meetUser.filter(function (item) {
- return item.show == false;
- })
- }
- self.joinMeet = function () {
- var data = {
- tablename: "FW_JGDWFZSW",
- colums: "*",
- order: "ID desc",
- sqlwhere: { ROUTEINFOID: self.routeinfoid },
- sqlinwhere: "",
- sqllikewhere: ""
- }
- $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- var data1 = {
- routeid: self.routeid,
- routeinfoid: self.routeinfoid,
- cman: self.userId,
- cname: res.data[0].BT + "—共享沟通",
- userids: self.meetUser.map(function (item) {
- return item.USERID
- }).join(",")
- }
- $http.post(apiurljs.login + "g2work/meetcoop/createMeetcoop", data1, postCfg)
- .success(function (res1) {
- sp.layerhide()
- if (res1.success == true) {
- self.getMeetMsg()
- } else {
- sp.dialog(res1.message)
- }
- })
- })
- }
- self.browse = function (obj) {
- var n = 0;
- self.iframeList.forEach(function (item) {
- if (item.title == obj.FILENAMES && item.source == apiurljs.login + "g2work/files2/inline/" + obj.FILEURL.slice(7)) {
- n++
- }
- })
- if (n == 0) {
- //console.log(obj);
- ///20230324---zyg ---永中转换-----start
- var set_convertType = 0;
- if (obj.FILEEXT == "doc") {
- set_convertType = 0;
- } else if (obj.FILEEXT == "pdf") {
- set_convertType = 20;
- } else if (obj.FILEEXT == "ofd") {
- set_convertType = 570;
- } else if (/(png|jpg|jpeg|gif|bmp|jfif|svg|tif|tiff)$/i.test(obj.FILEEXT) == true) {
- set_convertType = 23;
- } else {
- set_convertType = 0;
- }
- let postData = {
- convertType: set_convertType,
- fileUrl: apiurljs.login + "g2work/files2/inline/" + obj.FILEURL.slice(7)
- };
- var postCfg_transfer = {
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
- transformRequest: function (data) {
- return $.param(data);
- }
- };
- $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
- .success(function (res) {
- //console.log(res);
- if (res.errorcode === 0) {
- let rst = res.data;
- //console.log(rst.viewUrl);
- self.iframeList.push({ id: self.iframeList.length + 1, title: obj.FILENAMES, url: $sce.trustAsResourceUrl(rst.viewUrl), source: apiurljs.login + "g2work/files2/inline/" + obj.FILEURL.slice(7) })
- self.add()
- } else {
- sp.dialog(res.message);
- }
- });
- ///20230324---zyg ---永中转换-----end
- }
- }
- self.openCJ = function (obj) {
- var n = 0;
- self.iframeList.forEach(function (item) {
- if (item.title == obj.CNAME && item.source == obj.URL) {
- n++
- }
- })
- if (n == 0) {
- self.iframeList.push({ id: self.iframeList.length + 1, title: obj.CNAME, url: $sce.trustAsResourceUrl(addToken(obj.URL) + "&routeinfoid=" + self.routeinfoid + "&pgcode=" + obj.PGCODE + "&bookmarkid=" + obj.ID), source: obj.URL, pgcode: obj.PGCODE })
- self.add()
- }
- }
- self.deleteCJ = function (CJ) {
- var data = {
- id: CJ.ID
- }
- $http.post(apiurljs.login + "g2app/plugin/deletePluginRouteByID", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success == true) {
- $.each(self.iframeList, function (index, item) {
- if (item.title == CJ.CNAME && item.source == CJ.URL) {
- self.closeItem(index)
- }
- })
- self.getCJ()
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.playItem = function (obj) {
- var n = 0;
- self.iframeList.forEach(function (item) {
- if (item.title == obj.WATCHLIMIT && item.source == obj.URL) {
- n++
- }
- })
- if (n == 0) {
- self.iframeList.push({ id: self.iframeList.length + 1, title: obj.WATCHLIMIT, url: $sce.trustAsResourceUrl(obj.FILEURL), source: obj.FILEURL })
- self.add()
- }
- }
- self.updateCname = function (item) {
- self.meeting = {
- type: 1,
- updateTitle: "修改会议标题",
- meetid: item.MEETID,
- cname: item.CNAME
- }
- sp.layer("#meetUpdate")
- }
- self.deleteMeet = function (meet) {
- var data = {
- meetid: meet.MEETID
- }
- $http.post(apiurljs.login + "g2work/meetcoop/deleteDataByID", data, postCfg)
- .success(function (res) {
- if (res.success == true) {
- $.each(self.iframeList, function (index, item) {
- $.each(meet.FILES, function (index1, item1) {
- if (item.title == item1.WATCHLIMIT && item.source == item1.FILEURL) {
- self.closeItem(index1)
- }
- })
- })
- self.getMeetMsg()
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.updateWatchlimit = function (item) {
- self.meeting = {
- type: 2,
- updateTitle: "修改查看时限",
- fileid: item.FILEID,
- watchlimit: item.WATCHLIMIT
- }
- sp.layer("#meetUpdate")
- }
- self.deleteMFile = function (mfile) {
- var data = {
- fileid: mfile.MEETID
- }
- $http.post(apiurljs.login + "g2work/meetcoop/deleteDataFilesByFileID", data, postCfg)
- .success(function (res) {
- if (res.success == true) {
- $.each(self.iframeList, function (index, item) {
- if (item.title == mfile.WATCHLIMIT && item.source == mfile.FILEURL) {
- self.closeItem(index)
- }
- })
- self.getMeetMsg()
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.meetUpdate = function () {
- if (self.meeting.type == 1) {
- var data = {
- meetid: self.meeting.meetid,
- cname: self.meeting.cname
- }
- $http.post(apiurljs.login + "g2work/meetcoop/updateCnameByID", data, postCfg)
- .success(function (res) {
- sp.layerhide()
- if (res.success == true) {
- self.getMeetMsg()
- } else {
- sp.dialog(res.message)
- }
- })
- } else {
- var data = {
- fileid: self.meeting.fileid,
- watchlimit: self.meeting.watchlimit
- }
- $http.post(apiurljs.login + "g2work/meetcoop/updateWatchlimitByFileID", data, postCfg)
- .success(function (res) {
- sp.layerhide()
- if (res.success == true) {
- self.getMeetMsg()
- } else {
- sp.dialog(res.message)
- }
- })
- }
- }
- self.iframeList = []//[{ id: 1, url: "../../index/img-new/background3.png", source: "../../index/img-new/background3.png", boxWidth: { width: 1200 }, iframeWidth: { width: 1190 } }]
- self.add = function () {
- if (self.iframeList.length == 1) {
- self.iframeList[0].boxWidth = { width: $(".col-md-10").width() }
- self.iframeList[0].iframeWidth = { width: $(".col-md-10").width() - 10 }
- } else {
- self.iframeList.forEach(function (item) {
- item.boxWidth = { width: Math.trunc($(".col-md-10").width() / 4 * 2 / (self.iframeList.length - 1)) - 10 }
- item.iframeWidth = { width: item.boxWidth.width - 10 }
- })
- self.iframeList[self.iframeList.length - 1].boxWidth = { width: Math.trunc($(".col-md-10").width() / 4 * 2) - 10 }
- self.iframeList[self.iframeList.length - 1].iframeWidth = { width: self.iframeList[self.iframeList.length - 1].boxWidth.width - 10 }
- }
- }
- self.openItem = function (obj) {
- window.open(obj.url)
- }
- self.closeItem = function (n) {
- self.iframeList.splice(n, 1)
- if (self.iframeList.length == 0) {
- } else if (self.iframeList.length == 1) {
- self.iframeList[0].boxWidth = { width: $(".col-md-10").width() }
- self.iframeList[0].iframeWidth = { width: $(".col-md-10").width() - 10 }
- } else {
- self.iframeList.forEach(function (item) {
- item.boxWidth = { width: Math.trunc($(".col-md-10").width() / 4 * 2 / (self.iframeList.length - 1)) - 10 }
- item.iframeWidth = { width: item.boxWidth.width - 10 }
- })
- self.iframeList[self.iframeList.length - 1].boxWidth = { width: Math.trunc($(".col-md-10").width() / 4 * 2) - 10 }
- self.iframeList[self.iframeList.length - 1].iframeWidth = { width: self.iframeList[self.iframeList.length - 1].boxWidth.width - 10 }
- }
- }
- self.reSize = function (n) {
- var leftbox = document.getElementsByClassName("iframe-item")[n - 1];
- var rightbox = document.getElementsByClassName("iframe-item")[n];
- var line = document.getElementsByClassName("iframe-border-right")[n - 1];
- document.getElementsByClassName("iframe-border-right")[n - 1].addEventListener("mousedown", function (event) {
- $(".mousemove").show()
- var leftboxW = leftbox.style.width.slice(0, leftbox.style.width.length - 2);
- var rightboxW = rightbox.style.width.slice(0, rightbox.style.width.length - 2);
- var x = event.pageX - line.offsetLeft;
- document.addEventListener("mousemove", boxMove)
- function boxMove(event) {
- if (leftboxW * 1 + (event.pageX - x) * 1 <= 200) {
- //document.removeEventListener("mousemove", boxMove)
- } else if (rightboxW * 1 - (event.pageX - x) * 1 <= 200) {
- //document.removeEventListener("mousemove", boxMove)
- } else {
- leftbox.style.width = leftboxW * 1 + (event.pageX - x) * 1 + "px";
- //leftbox.getElementsByClassName("iframe-title")[0].style.width = leftboxW * 1 + (event.pageX - x) * 1 - 10 + "px";
- leftbox.getElementsByTagName("iframe")[0].style.width = leftboxW * 1 + (event.pageX - x) * 1 - 10 + "px";
- self.iframeList[n - 1].boxWidth.width = leftboxW * 1 + (event.pageX - x) * 1;
- self.iframeList[n - 1].iframeWidth.width = leftboxW * 1 + (event.pageX - x) * 1 - 10;
- rightbox.style.width = rightboxW * 1 - (event.pageX - x) * 1 + "px";
- //rightbox.getElementsByClassName("iframe-title")[0].style.width = rightboxW * 1 - (event.pageX - x) * 1 - 10 + "px";
- rightbox.getElementsByTagName("iframe")[0].style.width = rightboxW * 1 - (event.pageX - x) * 1 - 10 + "px";
- self.iframeList[n].boxWidth.width = rightboxW * 1 - (event.pageX - x) * 1;
- self.iframeList[n].iframeWidth.width = rightboxW * 1 - (event.pageX - x) * 1 - 10;
- }
- }
- document.addEventListener("mouseup", function () {
- $(".mousemove").hide()
- document.removeEventListener("mousemove", boxMove)
- })
- })
- }
- //头部下滚冻结
- $(function () {
- //页面高度撑满
- setTimeout(function () {
- if ($(".ibox-content").height() < $(window).height() - 31) {
- $(".ibox-content").css("height", $(window).height() - 31)
- }
- $(".meeting").css("height", $(".ibox-content").height() - 636)
- }, 1)
- })
- //用来保存当前编辑图片的地址
- self.nowImgUrl = "";
- //打开截图收藏框
- self.joinItem = function (obj) {
- self.SCobj = {
- id: 0,
- routeinfoid: self.routeinfoid,
- pgcode: obj.pgcode,
- cname: "",
- url: obj.source,
- imagesmall: "",
- remark: ""
- }
- sp.layer('#layer_fav', 1);
- $("#imgUpload").blur();
- $("#imgUpload").val("");
- self.nowImgUrl = "";
- //每次打开截图层初始化截图窗口
- var image = document.querySelector('#image');
- cropper = new Cropper(image, {
- aspectRatio: 16 / 9,
- viewMode: 1,
- scalable: false,
- minCropBoxWidth: 64,
- minCropBoxHeight: 36,
- autoCrop: true,
- fillColor: "#fff",
- });
- }
- self.closeImgLayer = function () {
- self.nowImgUrl = "";
- $("#imgUpload").blur();
- $("#imgUpload").val("");
- cropper.destroy();
- sp.closeCenter('.sp-layer')
- }
- self.saveData = function () {
- var cas = cropper.getCroppedCanvas();
- var base64url = cas.toDataURL('image/png');
- console.log(base64url); //生成base64图片的格式
- self.SCobj.imagesmall = base64url;
- self.SCobj.cdate = sp.getLocalDate();
- self.SCobj.cman = self.userName;
- //$http.post(apiurljs.login + "g2app/plugin/savePluginRouteData", { data: s4.encryptData_CBC(JSON.stringify(self.SCobj)) }, postCfg)
- $http.post(apiurljs.login + "g2app/plugin/savePluginRouteData", self.SCobj, postCfg)
- .success(function (res) {
- //var res = strToJson(s4.decryptData_CBC(obj.data));
- self.closeImgLayer()
- if (res.success == true) {
- self.getCJ()
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.reset = function () {
- if (self.nowImgUrl != '') {
- cropper.reset();
- }
- }
- self.zoomOut = function () {
- if (self.nowImgUrl != '') {
- cropper.zoom(0.1);
- }
- }
- self.zoomIn = function () {
- if (self.nowImgUrl != '') {
- cropper.zoom(-0.1);
- }
- }
- self.clear = function () {
- if (self.nowImgUrl != '') {
- self.nowImgUrl = "";
- $("#imgUpload").blur();
- $("#imgUpload").val("");
- cropper.replace(" ", false);
- }
- }
- }])
- app.directive("repeatFinish", function () {
- return {
- link: function (scope) {
- if (scope.$last == true) {
- $("#iframeList").css("height", $(window).height() - 110)
- $(".mousemove").css("top", $("#iframeList").offset().top).css("left", $("#iframeList").offset().left).css("width", $("#iframeList").width()).css("height", $(window).height() - 110)
- }
- }
- };
- });
- //插件路径添加token
- function addToken(url) {
- var newUrl = "";
- if (url.indexOf("?") > -1) {
- newUrl = url + "&token=" + localStorage.getItem("main-token")
- } else {
- newUrl = url + "?token=" + localStorage.getItem("main-token")
- }
- return newUrl
- }
- function imgChange(e) {
- var files = document.getElementById('imgUpload').files;
- if (files[0].size > 3 * 1024 * 1024) {
- alert("上传文件不得超过3MB");
- return;
- }
- var reader = new FileReader();
- reader.onload = (function (file) {
- return function (e) {
- // //把图片路径复制到angular控件中
- angular.element(document.getElementById('app')).scope().ctl.nowImgUrl = this.result;
- angular.element(document.getElementById('app')).scope().$apply();
- $("#image").prop("src", this.result);
- cropper.replace(this.result, false);
- };
- })(e.target.files[0]);
- reader.readAsDataURL(e.target.files[0]);
- }
- document.body.addEventListener('paste', function (event) {
- if (!$("#layer_fav").is(":hidden")) {
- var items = (event.clipboardData || window.clipboardData).items;
- var file = null;
- var fileSize = 0;
- if (items && items.length) {
- //搜索剪切板items 只取第一个
- let first = items[0];
- if (first.type.indexOf('image') !== -1) {
- file = items[0].getAsFile();
- fileSize = file.size;
- }
- } else {
- alert('当前浏览器不支持');
- return;
- }
- if (!file) {
- //alert('粘贴内容非图片');
- return;
- }
- if (fileSize > 3 * 1024 * 1024) {
- alert('粘贴图片大小不得超过3MB');
- return;
- }
- // 此时file就是我们的剪切板中的图片对象
- // 如果需要预览,可以执行下面代码
- var reader = new FileReader()
- reader.onload = function (event) {
- // //把图片路径复制到angular控件中
- angular.element(document.getElementById('app')).scope().ctl.nowImgUrl = this.result;
- angular.element(document.getElementById('app')).scope().$apply();
- $("#image").prop("src", this.result);
- cropper.replace(this.result, false);
- }
- reader.readAsDataURL(file);
- } else {
- }
- });
|