12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115 |
- var app = angular.module('app', ["angularUtils.directives.dirPagination"]);
- app.controller("formlistCtrl", ["$scope", "$http", "$compile", "$timeout", function ($scope, $http, $compile, $timeout) {
- var self = this;
- var s4 = new SM4Util();
- // sp.fitHeight("#formTypePart", 150);
- self.userId = $.cookie("GlWorkPlatform-userid");
- self.userName = $.cookie("GlWorkPlatform-username");
- self.userCName = $.cookie("GlWorkPlatform-chineseName");
- self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
- self.flowid = sp.getUrlName("FLOWKND");
- $("#formTypePart").height($("body").height() - 140);
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- };
- self.CrossPage = window.parent.CrossPage;
- self.loading = false;
- //表单类型
- self.formTypeAray = [
- {"cval": "NORMAL", "cname": "一般表"},
- {"cval": "MDETAIL", "cname": "主细表"},
- {"cval": "FILETBL", "cname": "附件表"},
- {"cval": "CODETBL", "cname": "代码表"},
- {"cval": "TREESTAL", "cname": "树状表"},
- {"cval": "ENTITYTB", "cname": "实体表"}
- ];
- ////初始化左侧效果--start--*****************************************
- self.active = {
- STATUS: 0,
- TYPE: "",
- CNAME:""
- };
- //self.active.STATUS = sp.getUrlName("leftActive") || 0;
- //self.active.TYPE = sp.getUrlName("leftActiveType") || "";
- ///激活状态的设置,考虑上来就加载和从详情页面返回的两种情况
- self.setMsgActive = function () {
- $(".sp-msg-left-bottom .sp-msg-left-lh").removeClass("sp-msg-left-active");
- $(".sp-msg-left-bottom .sp-msg-left-lh:eq(" + self.active.STATUS + ")").addClass("sp-msg-left-active");
- };
- setTimeout(function () {
- self.setMsgActive();
- }, 800);
- self.getMsgData = function (str, $item, CNAME) {
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "查询", "查询日志", "/g2work/form/queryData")
- if (str == 0) {
- self.active = {
- STATUS: str,
- TYPE: "",
- CNAME: CNAME
- };
- } else {
- self.active = {
- STATUS: str,
- TYPE: $item.PKID,
- CNAME: CNAME
- };
- }
- $(".sp-msg-left-bottom .sp-msg-left-lh").removeClass("sp-msg-left-active");
- $(".sp-msg-left-bottom .sp-msg-left-lh:eq(" + str + ")").addClass("sp-msg-left-active");
- self.showType = "List";
- self.getFormData();///加载表单
- };
- ////初始化左侧效果--end--*****************************************
- ///加载机构
- self.unitList = []; ///数组
- self.unit = ""; ///机构名称
- self.getUnit = function () {
- self.loading = true;
- $http.post(apiurljs.login + "g2work/sect/querySectAdmin", {data: s4.encryptData_CBC("")}, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- if (sp.isval(res.data)) {
- self.unitList = res.data;
- self.unit = res.data[0].CODE;
- self.getFormType();///加载表单类别
- } else {
- self.unitList = [];
- self.loading = false;
- }
- } else {
- sp.dialog(res.message);
- self.unitList = [];
- self.loading = false;
- }
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- if (textStatus != 200) {
- self.loading = false;
- }
- })
- };
- self.getUnit();
- ///加载表单类别数组
- self.formType = [];
- self.getFormType = function () {
- var postData = {
- pkid: self.unit,
- includechildren: true
- }
- $http.post(apiurljs.login + "g2work/formkinds/queryData", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- if (sp.isval(res.data)) {
- self.formType = res.data;
- if (self.flowid) {
- $.each(self.formType, function (index, item) {
- if (item.PKID == self.flowid) {
- self.active = {
- STATUS: index + 1,
- TYPE: item.PKID,
- CNAME: item.CNAME
- }
- }
- })
- } else {
- self.active = {
- STATUS: parseInt(sp.getUrlName("leftActive")) || 1,
- TYPE: sp.getUrlName("leftActiveType") || self.formType[0].PKID,
- CNAME: sp.getUrlName("leftActiveName") || self.formType[0].CNAME
- }
- }
- ;
- } else {
- self.formType = [];
- }
- self.getFormData();///加载表单数组
- } else {
- sp.dialog(res.message);
- self.formType = [];
- self.loading = false;
- }
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- if (textStatus != 200) {
- self.loading = false;
- }
- })
- };
- ///加载表单数据-start--*******************************************
- self.formList = [];
- self.formList_search = [];
- self.noDataTip = 1; //声明没有数据时变量
- self.getFormData = function () {
- self.loading = true;
- var postData = {
- unitid: self.unit,
- formkinds: self.active.TYPE
- }
- $http.post(apiurljs.login + "g2work/form/queryData", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.loading = false;
- if (res.success) {
- if (sp.isval(res.data)) {
- self.formList = res.data;
- //console.log(res.data);
- angular.forEach(self.formList, function (item) {
- if (item.FORMEDIT.length > 0) {
- item.FORMEDITSTRING = "总计" + item.FORMEDIT.length + "项";
- } else {
- item.FORMEDITSTRING = "";
- }
- angular.forEach(self.formTypeAray, function (item2) {
- if (item.CTYPE == item2.cval) {
- item.CTYPE_set = item2.cname;
- }
- //代码表和树状表无法添加视图
- if (item.CTYPE == "CODETBL" || item.CTYPE == "TREESTAL") {
- item.VIEW_set = true;
- } else {
- item.VIEW_set = false;
- }
- });
- })
- self.noDataTip = 1;
- ////从表单设计器页面返回时,打开之前点击的视图层--20230305--zyg
- $timeout(function () {
- var get_formlistViewIndex = localStorage.getItem("tjJxtGoldenlinkWork-formlistViewIndex");
- if (sp.isval(get_formlistViewIndex)) {
- self.checkViewDetail(get_formlistViewIndex);//
- localStorage.setItem("tjJxtGoldenlinkWork-formlistViewIndex", "");/// 清空--存储表单管理视图点击序号
- }
- }, 100);
-
- self.formList_search = self.formList;
- } else {
- self.formList = [];
- self.formList_search = [];
- self.noDataTip = 0;
- }
- } else {
- sp.dialog(res.message);
- }
- if (self.CrossPage.type == 0) {
- self.journalRecord(self.CrossPage.ctime, sp.getLocalDate1(), "", "接入日志", window.location.pathname)
- }
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- if (textStatus != 200) {
- self.loading = false;
- }
- })
- };
- ///加载表单数据-end--*******************************************
- self.escapeRegExpWildcards=function (searchStr) {
- const regExp = /([\(\[\{\\\^\$\}\]\)\?\*\+\.])/img;
- if (searchStr && regExp.test(searchStr)) {
- return searchStr.replace(regExp, '\\$1');
- }
- return searchStr;
- }
- self.searchByKeywords=function (keywords, searchArr) {
- const keywordsExp = new RegExp(".*?" + self.escapeRegExpWildcards(keywords) + ".*?", "img");
- return searchArr.filter(v => (keywordsExp.test(v.CNAME) || keywordsExp.test(v.CKEY)));
- }
- self.search_keyword="";
- self.btnSearch = function () {
- //console.log(JSON.stringify(self.searchByKeywords("党委", self.flowData)));
- self.formList_search=self.searchByKeywords(self.search_keyword, self.formList);
- };
- ////////筛选---start---*******************************************************************
- self.search = {
- mark: "",
- title: "",
- type: ""
- }
- ///打开筛选
- self.openSearchLayer = function () {
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "查询", "查询日志", "/g2work/form/queryData")
- sp.layer('#layer_search')
- }
- self.btnSearchTrue = function () {
- ///确定查询
- sp.layerhide();
- self.getFormData();
- };
- self.btnSearchCancel = function () {
- //取消查询
- self.search = {
- mark: "",
- title: "",
- type: ""
- }
- sp.layerhide();
- };
- ////////筛选---end---*******************************************************************
- self.showType = "List"; //list or detail
- self.formDetailList = [];
- self.nowForm = "";
- self.nowFormItem = "";
- self.checkViewDetail_index = "";
- self.checkViewDetail = function (index) {
- self.formDetailList = [];
- self.nowForm = "";
- self.nowFormItem = "";
- self.showType = "Detail";
- //let newDetailArray = angular.copy(self.formList[index].FORMEDIT);
- let newDetailArray = angular.copy(self.formList_search[index].FORMEDIT);
- self.formDetailList = newDetailArray;
- //self.nowForm = self.formList[index].CNAME;
- self.nowForm = self.formList_search[index].CNAME;
- //self.nowFormItem = self.formList[index];
- self.nowFormItem = self.formList_search[index];
- //console.log(self.nowForm);
- self.checkViewDetail_index = index;
- }
- self.goToEliminate = function () {
- window.location.href = "eliminate.html?leftActive=" + self.active.STATUS + "&leftActiveType=" + self.active.TYPE + "&leftActiveName=" + self.active.CNAME;
- }
- self.goToList = function () {
- self.showType = "List";
- self.getFormData(); //加载表单数组
- }
- /////表单类别--start---*******************************************************************
- ///新增流程类别--声明变量
- self.addflow = {
- pkid: 0,
- cname: "",
- ctype: "NORMAL"
- };
- ///打开新增类别
- self.openLayerFormType = function () {
- self.addflow = {
- pkid: 0,
- cname: "",
- ctype: "NORMAL"
- };
- sp.layer("#layer_addFormType");
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "新增类别", "修改日志", window.location.pathname)
- };
- ///更新流程类别
- self.editFormType = function ($item) {
- event.preventDefault();
- event.stopPropagation();
- self.addflow = {
- pkid: $item.PKID,
- cname: $item.CNAME,
- ctype: $item.CTYPE
- }
- sp.layer("#layer_addFormType");
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "编辑", "修改日志", window.location.pathname)
- };
- self.btnSubmitFormType = function () {
- ///点击确认提交新增流程类别
- if (spngvld.submit("#layer_addFormType")) {
- if (self.addflow.pkid == 0) {
- var postData = {
- "cname": self.addflow.cname,
- "ctype": self.addflow.ctype,
- "parentid": self.unit
- };
- $http.post(apiurljs.login + "g2work/formkinds/insertData", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg).success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- sp.layerhide();
- sp.dialog("流程新增成功!");
- $timeout(function () {
- sp.dialoghide();
- self.getFormType();
- }, 600)
- } else {
- sp.layerhide();
- sp.dialog(res.message);
- }
- });
- } else {
- var postData = {
- "pkid": self.addflow.pkid,
- "cname": self.addflow.cname,
- "ctype": self.addflow.ctype
- };
- $http.post(apiurljs.login + "g2work/formkinds/updateDataByPkid", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- sp.layerhide();
- sp.dialog("更新成功!");
- $timeout(function () {
- sp.dialoghide();
- self.getFormType();
- }, 600)
- } else {
- sp.layerhide();
- sp.dialog(res.message);
- }
- });
- }
- }
- };
- self.btnCancelFormType = function () {
- ///取消操作类别
- self.addflow = {
- pkid: 0,
- cname: "",
- ctype: "NORMAL"
- };
- spngvld.clear("#layer_addFormType")
- sp.layerhide();
- };
- self.delFormType = function ($item) {
- event.preventDefault();
- event.stopPropagation();
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "删除", "修改日志", window.location.pathname)
- ///删除类别
- var getDelID = $item.PKID;
- 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 data-id=" + getDelID + " 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 getid = $(this).attr("data-id");
- sp.dialoghide();
- var data = {
- pkid: getDelID///角色编码
- };
- $http.post(apiurljs.login + "g2work/formkinds/deleteByPkid", {data: s4.encryptData_CBC(JSON.stringify(data))}, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.getFormType();
- self.getMsgData(0, 0, "全部表单");
- sp.dialoghide();
- } else {
- sp.dialog(res.message);
- }
- });
- });
- };
- self.openSortFormType = function () {
- ///类别排序
- sp.layer("#layer_sortFormType");
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "查询", "查询日志", "/g2work/form/queryData")
- };
- self.itemSortup = function ($item, $index) {
- var set_index = parseInt($index - 1);
- var get_pkid1 = self.formType[set_index].PKID;
- self.postSortData(get_pkid1, $item.PKID);
- }
- self.itemSortdown = function ($item, $index) {
- var set_index = parseInt($index + 1);
- var get_pkid1 = self.formType[set_index].PKID;
- self.postSortData(get_pkid1, $item.PKID);
- }
- self.postSortData = function (pkid1, pkid2) {
- var postData = {
- "pkid1": pkid1,
- "pkid2": pkid2
- }
- $http.post(apiurljs.login + "g2work/formkinds/swapSortidByPkid", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg).success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.getFormType();
- } else {
- sp.layerhide();
- sp.dialog(res.message);
- }
- });
- };
- /////表单类别--end------*******************************************************************
- //**新建表单******* */
- self.form = {
- formkinds: "",
- ckey: "",
- cname: "",
- ctype: self.formTypeAray[0].cval,
- shortname: "",
- explain: ""
- };
- self.openAddLayer = function () {
- self.form = {
- formkinds: self.active.TYPE == "" ? self.formType[0].PKID : self.active.TYPE,
- ckey: "",
- cname: "",
- ctype: self.formTypeAray[0].cval,
- shortname: "",
- explain: ""
- };
- sp.layer("#layer_addForm");
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "新建", "修改日志", window.location.pathname)
- };
- self.editForm = function ($item) {
- };
- self.previewForm = function ($item) {
- var time1 = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "查看表单", "接入日志", window.location.pathname)
- self.recordCtime()
- $timeout(function () {
- window.location.href = "formlist-add.html?formid=" + $item.FORMID + "&ctype=" + $item.CTYPE + "&leftActive=" + self.active.STATUS + "&leftActiveType=" + self.active.TYPE + "&leftActiveName=" + self.active.CNAME;;
- }, 500)
- };
- self.addFormTrue = function () {
- ///新建表单-提交
- if (spngvld.submit("#layer_addForm")) {
- if (self.form.formkinds == "") {
- sp.layerhide();
- sp.dialog("流程类别不能为空!");
- return false;
- } else {
- var postData = {
- "formkinds": self.form.formkinds,
- "ckey": self.form.ckey,
- "cname": self.form.cname,
- "ctype": self.form.ctype,
- "shortname": self.form.shortname,
- "explain": self.form.explain,
- "parentid": self.unit
- }
- $http.post(apiurljs.login + "g2work/form/insertData", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg).success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.getFormData();
- sp.layerhide();
- } else {
- sp.layerhide();
- sp.dialog(res.message);
- }
- });
- }
- }
- };
- self.addFormCancel = function () {
- ///新建表单-取消
- self.form = {
- formkinds: self.formType[0].PKID,
- ckey: "",
- cname: "",
- ctype: self.formTypeAray[0].cval,
- shortname: "",
- explain: ""
- };
- sp.layerhide();
- };
- self.delForm = function ($item) {
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "删除类别", "修改日志", window.location.pathname)
- ///删除类别
- var getDelID = $item.FORMID;
- 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 data-id=" + getDelID + " 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 getid = $(this).attr("data-id");
- sp.dialoghide();
- var data = {
- formid: getDelID
- };
- $http.post(apiurljs.login + "g2work/form/deleteByFormid", {data: s4.encryptData_CBC(JSON.stringify(data))}, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.getFormData();
- sp.dialoghide();
- } else {
- sp.dialog(res.message);
- }
- });
- });
- };
- self.formSortup = function ($item, $index) {
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "上移", "修改日志", window.location.pathname)
- var set_index = parseInt($index - 1);
- var get_formid1 = self.formList[set_index].FORMID;
- self.postFormSortData(get_formid1, $item.FORMID);
- }
- self.formSortdown = function ($item, $index) {
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "下移", "修改日志", window.location.pathname)
- var set_index = parseInt($index + 1);
- var get_formid1 = self.formList[set_index].FORMID;
- self.postFormSortData(get_formid1, $item.FORMID);
- }
- self.postFormSortData = function (formid1, formid2) {
- var postData = {
- "formid1": formid1,
- "formid2": formid2
- }
- $http.post(apiurljs.login + "g2work/form/swapSortidByFormid", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg).success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.getFormData();
- } else {
- sp.dialog(res.message);
- }
- });
- };
- //打开新增视图弹出层
- self.view = {
- edit: false,
- layertitle: "新建视图",
- formid: "",
- cname: "",
- explain: "",
- tempform: "",
- usetempform: "1",
- formeditid: ""
- }
- self.openAddView = function (formid,obj) {
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "新建视图", "修改日志", window.location.pathname)
- self.view.edit = false;
- self.view.layertitle = "新建视图";
- self.view.formid = formid;
- self.view.cname = "";
- self.view.explain = "";
- self.view.tempform = "";
- self.view.usetempform = "1";
- self.view.formeditid = "";
- if(obj.FORMEDIT.length>0){
- self.view.tempform=obj.FORMEDIT[0].TEMPFORM;
- }
- sp.layer("#layer_addView");
- }
- self.openEditView = function (obj) {
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "编辑视图", "修改日志", window.location.pathname)
- self.view.edit = true;
- self.view.layertitle = "编辑视图";
- self.view.formid = obj.FORMID;
- self.view.cname = obj.CNAME;
- self.view.explain = obj.EXPLAIN;
- self.view.tempform = obj.TEMPFORM;
- self.view.usetempform = (obj.USETEMPFORM == "true") ? "1" : "0";
- self.view.formeditid = obj.FORMEDITID;
- sp.layer("#layer_addView");
- }
- //增加视图或者编辑视图
- self.btnSaveView = function () {
- if (!self.view.edit) {
- var postData = {
- formid: self.view.formid,
- cname: self.view.cname,
- explain: self.view.explain,
- tempform: self.view.tempform,
- usetempform: (self.view.usetempform == 0) ? false : true
- }
- $http.post(apiurljs.login + "g2work/formedit/insertData", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg).success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (res.success) {
- self.getFormData();
- } else {
- sp.dialog(res.message);
- }
- });
- } else {
- var postData = {
- formeditid: self.view.formeditid,
- cname: self.view.cname,
- explain: self.view.explain,
- tempform: self.view.tempform,
- usetempform: (self.view.usetempform == 0) ? false : true
- }
- $http.post(apiurljs.login + "g2work/formedit/updateDataByFormEditid", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg).success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (res.success) {
- self.formDetailList.forEach(function (item) {
- if (item.FORMEDITID == self.view.formeditid) {
- item.CNAME = self.view.cname;
- item.EXPLAIN = self.view.explain;
- item.USETEMPFORM = (self.view.usetempform == 0) ? false : true;
- item.TEMPFORM = self.view.tempform;
- }
- })
- } else {
- sp.dialog(res.message);
- }
- });
- }
- }
- //关闭视图弹出层
- self.btnCancelView = function () {
- sp.layerhide();
- }
- //删除视图函数
- self.delView = function (code, index) {
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "删除视图", "修改日志", window.location.pathname)
- var getDelID = code;
- 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 data-id=" + getDelID + " 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 getid = $(this).attr("data-id");
- sp.dialoghide();
- var data = {
- formeditid: getDelID
- };
- $http.post(apiurljs.login + "g2work/formedit/deleteByFormEditid", {data: s4.encryptData_CBC(JSON.stringify(data))}, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- sp.dialoghide();
- self.formDetailList.splice(index, 1);
- $scope.$apply()
- } else {
- sp.dialog(res.message);
- }
- });
- });
- }
- //打开编辑视图列函数
- self.viewColumnList = [];
- self.seletAllESHOW = false;
- self.seletAllGSHOW = false;
- self.seletAllEREADONLY = false;
- self.viewColumn = {
- formeditid: "",
- billkey: ""
- }
- self.openViewColumnLayer = function (item, item2) {
- var time1 = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "列设置", "修改日志", window.location.pathname)
- self.viewColumnList = [];
- self.viewColumn.formeditid = item2.FORMEDITID;
- self.viewColumn.billkey = item.CKEY;
- self.seletAllESHOW = false;
- self.seletAllGSHOW = false;
- self.seletAllEREADONLY = false;
- var postData = {
- formeditid: self.viewColumn.formeditid,
- billkey: self.viewColumn.billkey
- }
- $http.post(apiurljs.login + "g2work/formedit/queryDataFormEditCol", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg).success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- var selectESHOWNum = 0;
- var selectGSHOWNum = 0;
- var selectEREADONLYNum = 0;
- res.data.forEach(function (item) {
- item.ESHOW = (item.ESHOW == "false") ? false : true;
- item.GSHOW = (item.GSHOW == "false") ? false : true;
- item.EREADONLY = (item.EREADONLY == "false") ? false : true;
- if (item.ESHOW) {
- selectESHOWNum++;
- }
- if (item.GSHOW) {
- selectGSHOWNum++;
- }
- if (item.EREADONLY) {
- selectEREADONLYNum++;
- }
- })
- self.viewColumnList = res.data;
- if (selectESHOWNum == self.viewColumnList.length) {
- self.seletAllESHOW = true;
- }
- if (selectGSHOWNum == self.viewColumnList.length) {
- self.seletAllGSHOW = true;
- }
- if (selectEREADONLYNum == self.viewColumnList.length) {
- self.seletAllEREADONLY = true;
- }
- sp.layer("#layer_viewColumn");
- });
- };
- //全选隐藏
- self.allSelectESHOW = function () {
- var flag = self.seletAllESHOW;
- self.viewColumnList.forEach(function (item) {
- item.ESHOW = flag;
- })
- }
- //全选必填
- self.allSelectGSHOW = function () {
- var flag = self.seletAllGSHOW;
- self.viewColumnList.forEach(function (item) {
- item.GSHOW = flag;
- })
- }
- //全选只读
- self.allSelectEREADONLY = function () {
- var flag = self.seletAllEREADONLY;
- self.viewColumnList.forEach(function (item) {
- item.EREADONLY = flag;
- })
- }
- //单选隐藏
- self.itemSelectESHOW = function () {
- var selectNum = 0;
- self.viewColumnList.forEach(function (item) {
- if (item.ESHOW) {
- selectNum++
- }
- })
- if (selectNum == self.viewColumnList.length) {
- self.seletAllESHOW = true;
- } else {
- self.seletAllESHOW = false;
- }
- }
- //单选必填
- self.itemSelectGSHOW = function () {
- var selectNum = 0;
- self.viewColumnList.forEach(function (item) {
- if (item.GSHOW) {
- selectNum++
- }
- })
- if (selectNum == self.viewColumnList.length) {
- self.seletAllGSHOW = true;
- } else {
- self.seletAllGSHOW = false;
- }
- }
- //单选只读
- self.itemSelectEREADONLY = function () {
- var selectNum = 0;
- self.viewColumnList.forEach(function (item) {
- if (item.EREADONLY) {
- selectNum++
- }
- })
- if (selectNum == self.viewColumnList.length) {
- self.seletAllEREADONLY = true;
- } else {
- self.seletAllEREADONLY = false;
- }
- }
- //保存表单列设置
- self.btnViewColumnSave = function () {
- var resultArray = [];
- self.viewColumnList.forEach(function (item) {
- var itemResult = {
- COLID: item.COLID,
- CODE: item.CODE,
- CNAME: item.CNAME,
- ESHOW: item.ESHOW,
- GSHOW: item.GSHOW,
- EREADONLY: item.EREADONLY
- }
- resultArray.push(itemResult);
- })
- var postData = {
- formeditid: self.viewColumn.formeditid,
- billkey: self.viewColumn.billkey,
- data: JSON.stringify(resultArray)
- }
- $http.post(apiurljs.login + "g2work/formedit/saveDataFormEditCol", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg).success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (res.success) {
- sp.dialog("设置成功!");
- } else {
- sp.dialog("设置失败,请联系管理员!");
- }
- });
- }
- //取消保存表单列设置
- self.btnViewColumnCancel = function () {
- sp.layerhide();
- };
- //打开功能设置弹出层
- self.viewFunc = {
- formeditid: "",
- billkey: "",
- nowFunc: ""
- }
- //打开设置功能弹出层
- self.funcButtonList = [];
- self.viewFuncList = [];
- self.openViewFuncLayer = function (item, item2) {
- var time1 = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "功能设置", "修改日志", window.location.pathname)
- $(".warninfoBox").html("").hide();
- self.viewFunc.formeditid = item2.FORMEDITID;
- self.viewFunc.billkey = item.CKEY;
- self.funcButtonList = [];
- self.viewFuncList = [];
- var postData = {
- formeditid: self.viewFunc.formeditid,
- billkey: self.viewFunc.billkey
- }
- $http.post(apiurljs.login + "g2work/formedit/queryDataFuncButton", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg).success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.funcButtonList = res.data;
- self.viewFunc.nowFunc = self.funcButtonList[0].FUNCID;
- $http.post(apiurljs.login + "g2work/formedit/queryDataFormEditFunc", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg).success(function (obj1) {
- var response = strToJson(s4.decryptData_CBC(obj1.data).slice(0, s4.decryptData_CBC(obj1.data).lastIndexOf("}") + 1));
- self.viewFuncList = response.data;
- sp.layer("#layer_viewFunc");
- });
- });
- };
- //保存功能设置
- self.saveViewFuncButton = function () {
- var canAdd = true;
- self.viewFuncList.forEach(function (item) {
- if (item.FUNCID == self.viewFunc.nowFunc) {
- canAdd = false;
- }
- })
- if (canAdd) {
- var postData = {
- formeditid: self.viewFunc.formeditid,
- billkey: self.viewFunc.billkey,
- funcid: self.viewFunc.nowFunc
- }
- $http.post(apiurljs.login + "g2work/formedit/insertDataFormEditFunc", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg).success(function (obj1) {
- var response = strToJson(s4.decryptData_CBC(obj1.data).slice(0, s4.decryptData_CBC(obj1.data).lastIndexOf("}") + 1));
- if (response.success) {
- self.viewFuncList = response.data;
- self.addWarning("功能添加成功!");
- }
- });
- } else {
- self.addWarning("请勿重复配置功能");
- }
- }
- //删除保存功能
- self.deleteViewFunc = function (funcid) {
- var postData = {
- formeditid: self.viewFunc.formeditid,
- billkey: self.viewFunc.billkey,
- funcid: funcid
- }
- $http.post(apiurljs.login + "g2work/formedit/deleteByFormEditFuncid", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg).success(function (obj1) {
- var response = strToJson(s4.decryptData_CBC(obj1.data).slice(0, s4.decryptData_CBC(obj1.data).lastIndexOf("}") + 1));
- if (response.success) {
- self.viewFuncList = response.data;
- self.addWarning("功能删除成功!");
- }
- });
- }
- //上移函数
- self.upViewFunc = function (index) {
- var postData = {
- formeditid: self.viewFunc.formeditid,
- billkey: self.viewFunc.billkey,
- funcid1: self.viewFuncList[index].FUNCID,
- funcid2: self.viewFuncList[index - 1].FUNCID
- }
- $http.post(apiurljs.login + "g2work/formedit/swapSortidByFormEditFuncid", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg).success(function (obj1) {
- var response = strToJson(s4.decryptData_CBC(obj1.data).slice(0, s4.decryptData_CBC(obj1.data).lastIndexOf("}") + 1));
- if (response.success) {
- self.viewFuncList = response.data;
- self.addWarning("功能移动成功!");
- }
- });
- }
- //下移函数
- self.downViewFunc = function (index) {
- var postData = {
- formeditid: self.viewFunc.formeditid,
- billkey: self.viewFunc.billkey,
- funcid1: self.viewFuncList[index].FUNCID,
- funcid2: self.viewFuncList[index + 1].FUNCID
- }
- $http.post(apiurljs.login + "g2work/formedit/swapSortidByFormEditFuncid", {data: s4.encryptData_CBC(JSON.stringify(postData))}, postCfg).success(function (obj1) {
- var response = strToJson(s4.decryptData_CBC(obj1.data).slice(0, s4.decryptData_CBC(obj1.data).lastIndexOf("}") + 1));
- if (response.success) {
- self.viewFuncList = response.data;
- self.addWarning("功能移动成功!");
- }
- });
- }
- //去除警告
- self.removeWarning = function () {
- $(".warninfoBox").html("").hide();
- }
- //给上传弹出层添加警告
- self.addWarning = function (content) {
- $(".warninfoBox").html("<i class=\"fa fa-exclamation sp-mr-5\"></i>" + content).show();
- }
- //跳转表单设计页
- self.goFormEdit = function ($item) {
- var time1 = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "表单设计", "接入日志", window.location.pathname)
- self.recordCtime()
- // console.log($item)
- // window.parent.sp.addTabNav('FZC99', '表单设计', 'tpl/flowchart_formbuilder/formbuilder.html');
- // window.location.href = "../flowchart_formbuilder/formbuilder.html?copyrightid=" + $item.COPYRIGHTID;
- $timeout(function () {
- window.location.href = "../../" + $item.TEMPFORM;
- }, 1)
- }
- self.recordCtime = function () {
- $.cookie("CrossPage-ctime", sp.getLocalDate1(), {path: '/', expires: 1});
- $.cookie("CrossPage-title", self.CrossPage.cname, {path: '/', expires: 1});
- }
- //记录日志
- self.journalRecord = function (time1, time2, title, func, url) {
- if (!self.CrossPage.cname) {
- return;
- }
- var data = {
- tablename: "SYS_CLICKLOG",
- data: {
- CTIME: time1 == null ? sp.getLocalDate1() : time1,
- TITLE: (title != "" ? self.CrossPage.cname + "/" + title : self.CrossPage.cname),
- REQUESTURL: url,
- REQUESTHEADERURL: window.location.origin,
- LOGTYPE: func,
- USERTYPE: $.cookie("GlWorkPlatform-userType"),
- ADMIN: $.cookie("GlWorkPlatform-userTypeEng"),
- CLIENTIP: sp.myIP(),
- PCNAME: sp.detectOS(),
- BROWSERNAME: sp.browser(),
- RESPONSETIME: time2 == null ? sp.getLocalDate1() : time2,
- USERID: self.userId,
- USERNAME: self.userCName
- }
- }
- $http.post(apiurljs.login + "g2app/DangJian/insertFormData", {data: s4.encryptData_CBC(JSON.stringify(data))}, postCfg)
- .success(function (res) {
- self.CrossPage.type = 1;
- })
- }
- self.keyLogin = function () {
- if (event.keyCode == 13) //回车键的键值为13
- {
- self.addFormTrue();
- }
- }
- ////跳转入自定义表单设计模块--20230305--zyg
- self.openViewFormbuilder = function (item, item2) {
- //console.log(item);
- //console.log(item2);
- window.location.href = "../flowchart_formbuilder/formbuilder.html?formeditid=" + item2.FORMEDITID + "&routeinfoid=0&routeid=0&id=0&pagefrom=formManageformlist&leftActive=" + self.active.STATUS + "&leftActiveType=" + self.active.TYPE;
- localStorage.setItem("tjJxtGoldenlinkWork-formlistViewIndex", self.checkViewDetail_index);/// 存储表单管理视图点击序号
- };
-
- }]);
|