123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- 'use strict';
- var app = angular.module('app', [
- ]);
- app.controller("formeditCtrl", ["$scope", "$http", "$timeout", '$sce', function ($scope, $http, $timeout, $sce) {
- var self = this;
- var s4 = new SM4Util();
- self.userId = $.cookie("GlWorkPlatform-userid");
- self.userName = $.cookie("GlWorkPlatform-chineseName");
- self.userCName = $.cookie("GlWorkPlatform-chineseName");
- self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
- self.routeinfoid = sp.getUrlName("routeinfoid");
- self.get_lastReturn = sp.getUrlName("lastReturn");
- self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
- self.return = self.get_lastReturn + ".html?type=2&lastReturnPageno=" + self.get_lastReturnPageno
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- };
- self.show = false;
- self.select = {
- list1: [],
- list2: [],
- list3: [],
- miji: []
- }
- self.getSelect1 = function () {
- var data = { tablename: "CODE_PERIOD" }
- $http.post(apiurljs.login + "g2app/DangAn/queryCodeData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.select.list1 = res.data;
- self.getSelect2();
- })
- }
- self.getSelect2 = function () {
- var data = { tablename: "CODE_AGENCIES" }
- $http.post(apiurljs.login + "g2app/DangAn/queryCodeData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.select.list2 = res.data;
- self.getSelect3();
- })
- }
- self.getSelect3 = function () {
- var data = { tablename: "CODE_DISTYPE" }
- $http.post(apiurljs.login + "g2app/DangAn/queryCodeData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.select.list3 = res.data;
- self.getMIJI();
- })
- }
- self.getMIJI = function () {
- var data = { tablename: "CODE_SECRET" }
- $http.post(apiurljs.login + "g2app/DangAn/queryCodeData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.select.miji = res.data;
- self.getData(0);
- })
- }
- self.getData = function (n) {
- var data = {
- routeinfoid: self.routeinfoid,
- tablename: "DOCELEMENT_ZL"
- }
- $http.post(apiurljs.login + "g2app/DangAn/queryDataByDangHao", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.data = {
- DOCUMENTID: res.data.DOCUMENTID ? res.data.DOCUMENTID : "",
- DOCUMENTTYPE: res.data.DOCUMENTTYPE ? res.data.DOCUMENTTYPE : "",
- FLOWCODE: res.data.FLOWCODE ? res.data.FLOWCODE : "",
- SERIALNUM: res.data.SERIALNUM ? res.data.SERIALNUM : "",
- MIJIQIXIAN: res.data.MIJIQIXIAN ? res.data.MIJIQIXIAN : "",
- EMERGENCYDEGREE: res.data.EMERGENCYDEGREE ? res.data.EMERGENCYDEGREE : "",
- DOCISSUERID: res.data.DOCISSUERID ? res.data.DOCISSUERID : "",
- DOCISSUEDNUM: res.data.DOCISSUEDNUM ? res.data.DOCISSUEDNUM : "",
- SIGNER: res.data.SIGNER ? res.data.SIGNER : "",
- DOCTITLE: res.data.DOCTITLE ? res.data.DOCTITLE : "",
- MAINDPT: res.data.MAINDPT ? res.data.MAINDPT : "",
- DOCISSUEDDATE: res.data.DOCISSUEDDATE ? sp.format(res.data.DOCISSUEDDATE) : "",
- ATTACHMENT: res.data.ATTACHMENT ? res.data.ATTACHMENT : "",
- ISSUINGAGENCY: res.data.ISSUINGAGENCY ? res.data.ISSUINGAGENCY : "",
- ANNOTATION: res.data.ANNOTATION ? res.data.ANNOTATION : "",
- CCDPT: res.data.CCDPT ? res.data.CCDPT : "",
- PRINTSENDDPT: res.data.PRINTSENDDPT ? res.data.PRINTSENDDPT : "",
- PRINTDATE: res.data.PRINTDATE ? sp.format(res.data.PRINTDATE) : "",
- RELEASELEVEL: res.data.RELEASELEVEL ? res.data.RELEASELEVEL : ""
- }
- self.edit = {
- ARCHYEAR: res.data.ARCHYEAR ? res.data.ARCHYEAR : sp.currentYear(),
- RETENTPERIOD: res.data.RETENTPERIOD ? res.data.RETENTPERIOD : self.select.list1[0].CODE,
- ORGANIZATIONMA: res.data.ORGANIZATIONMA ? res.data.ORGANIZATIONMA : self.select.list2[0].CODE,
- ITEMNUM: res.data.ITEMNUM ? res.data.ITEMNUM : "",
- SOFTWENVIRON: res.data.SOFTWENVIRON ? res.data.SOFTWENVIRON : "",
- HARDWENVIRON: res.data.HARDWENVIRON ? res.data.HARDWENVIRON : "",
- DISTYPE: res.data.DISTYPE ? res.data.DISTYPE : self.select.list3[0].CODE,
- DISACTOR: res.data.DISACTOR ? res.data.DISACTOR : "",
- DISDPT: res.data.DISDPT ? res.data.DISDPT : "",
- DISTIME: res.data.DISTIME ? sp.minsToDate("yyyy-MM-dd", res.data.DISTIME) : "",
- DISLRESULT: res.data.DISLRESULT ? res.data.DISLRESULT : ""
- }
- self.edit.ARCHCODE = res.data.ARCHCODE ? res.data.ARCHCODE : "TJJH-" + res.data.FLOWCODE + "-" + self.edit.ARCHYEAR + "-" + self.edit.RETENTPERIOD + "-" + self.edit.ORGANIZATIONMA;
- var a = "", b = "";
- $.each(self.select.miji, function (index, item) {
- if (item.CODE == self.data.MIJIQIXIAN.split(",")[0]) {
- a = item.CNAME;
- }
- })
- $.each(self.select.list1, function (index, item) {
- if (item.CODE == self.edit.RETENTPERIOD) {
- b = item.CNAME;
- }
- })
- self.data.MIJIQIXIAN1 = a + "," + b;
- })
- }
- self.getSelect1();
- self.toggle = function () {
- var trList = $(".sp-table").find("tr");
- console.log(1)
- if (!$(".sp-table").hasClass("hidepart")) {
- self.show = false;
- $(".sp-table").addClass("hidepart")
- $.each(trList, function (index, item) {
- if (index <= 10) {
- item.style.display = "none"
- }
- })
- } else {
- self.show = true;
- $(".sp-table").removeClass("hidepart")
- $.each(trList, function (index, item) {
- if (index <= 10) {
- item.style.display = ""
- }
- })
- }
- }
- self.btnSave = function () {
- if (self.edit.ARCHYEAR == "" || self.edit.RETENTPERIOD == "" || self.edit.ORGANIZATIONMA == "") {
- sp.dialog("年度、保管期限、机构或问题不可为空,请填写完整!");
- return;
- }
- self.edit.MIJIQIXIAN = self.data.MIJIQIXIAN;
- var data = {
- tablename: "DOCELEMENT_ZL",
- routeinfoid: self.routeinfoid,
- data: JSON.stringify(self.edit)
- }
- $http.post(apiurljs.login + "g2app/abase/saveFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.code == 0) {
- self.routeinfoid = res.data.id;
- sp.dialog("保存成功!");
- $timeout(function () {
- sp.dialoghide()
- }, 1500)
- self.getData(1);
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.getDangHao = function () {
- self.edit.ARCHCODE = "TJJH-" + self.data.FLOWCODE + "-" + self.edit.ARCHYEAR + "-" + self.edit.RETENTPERIOD + "-" + self.edit.ORGANIZATIONMA;
- self.data.MIJIQIXIAN = self.data.MIJIQIXIAN.split(",")[0] + "," + self.edit.RETENTPERIOD;
- var a = "", b = "";
- $.each(self.select.miji, function (index, item) {
- if (item.CODE == self.data.MIJIQIXIAN.split(",")[0]) {
- a = item.CNAME;
- }
- })
- $.each(self.select.list1, function (index, item) {
- if (item.CODE == self.edit.RETENTPERIOD) {
- b = item.CNAME;
- }
- })
- self.data.MIJIQIXIAN1 = a + "," + b;
- }
- }])
|