123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- '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.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
- self.get_id = sp.getUrlName("id")
- self.routeinfoid = sp.getUrlName("routeinfoid");
- self.type = sp.getUrlName("type");
- self.get_lastReturn = sp.getUrlName("lastReturn");
- self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
- self.return = self.get_lastReturn + ".html?type=" + self.type + "&lastReturnPageno=" + self.get_lastReturnPageno
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- };
- self.SwenList = [{
- VNAME: "文件详情",
- TEMPFORM: "submitdetail.html?id=" + self.get_id + "&routeinfoid=" + self.routeinfoid + "&lastReturn=" + self.get_lastReturn + "&lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.type
- }, {
- VNAME: "附件列表",
- TEMPFORM: "attachlist.html?id=" + self.get_id + "&routeinfoid=" + self.routeinfoid + "&lastReturn=" + self.get_lastReturn + "&lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.type
- }]
- self.Title = "文件详情";
- self.select = {};
- self.getJIGOU = 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.list = res.data;
- self.getData();
- })
- }
- self.getData = function () {
- var data = {
- routeinfoid: self.routeinfoid,
- tablename: "DOCELEMENT_ZL"
- }
- $http.post(apiurljs.login + "g2app/DangAn/queryDataByTablename", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.data = {
- ARCHCODE: res.data.ARCHCODE ? res.data.ARCHCODE : "",
- ARCHYEAR: res.data.ARCHYEAR ? res.data.ARCHYEAR : "",
- ORGANIZATIONMA: res.data.ORGANIZATIONMA ? res.data.ORGANIZATIONMA : "",
- DOCUMENTID: res.data.DOCUMENTID ? res.data.DOCUMENTID : "",
- DANGANML: res.data.DANGANML ? res.data.DANGANML : "",
- DOCUMENTTYPE: res.data.DOCUMENTTYPE ? res.data.DOCUMENTTYPE : "",
- 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 : "",
- }
- console.log(res.data)
- $.each(self.select.list, function (index, item) {
- if (item.CODE == self.data.ORGANIZATIONMA) {
- self.data.ORGANIZATIONMA = item.CNAME;
- }
- })
- })
- self.getAttachList()
- }
- self.getAttachList = function () {
- var data = {
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/DangAn/getAttachList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.list = res.data;
- $.each(self.list, function (index, item) {
- item.SIZE = item.FILESIZE >= 104857.6 ? (item.FILESIZE / 1048576).toFixed(2) + "MB" : (item.FILESIZE / 1024).toFixed(2) + "KB";
- })
- })
- }
- self.btnSave = function () {
- var data = {
- routeinfoid: self.routeinfoid,
- data: JSON.stringify(self.data),
- tablename: "DOCELEMENT_ZL"
- }
- $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;
- self.getData();
- sp.dialog("保存成功!");
- $timeout(function () {
- sp.dialoghide()
- }, 1500)
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.getJIGOU();
- }])
|