123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- let s4 = new SM4Util();
- let detailVue = new Vue({
- el: "#detailBox",
- data: {
- apiurl: apiurl,
- userId: "", //用户id
- userName: "", //用户中文名
- token: "",
- info: "",
- yzWeb: ""
- },
- methods: {
- dateFtt: (fmt, date) => {
- var o = {
- "M+": date.getMonth() + 1, //月份
- "d+": date.getDate(), //日
- "h+": date.getHours(), //小时
- "m+": date.getMinutes(), //分
- "s+": date.getSeconds(), //秒
- "q+": Math.floor((date.getMonth() + 3) / 3), //季度
- "S": date.getMilliseconds() //毫秒
- };
- if (/(y+)/.test(fmt))
- fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
- for (var k in o)
- if (new RegExp("(" + k + ")").test(fmt))
- fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
- return fmt;
- },
- backBtn: () => {
- history.back();
- },
- //只读模式打开附件
- openReadonlyFile: (obj) => {
- let 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 {
- set_convertType = 0;
- }
- let postData = {
- convertType: set_convertType,
- fileUrl: _this.apiurl + "/g2work/files2/inline/" + obj.FILEURL.slice(7)
- };
- let post_url = _this.apiurl.split("glwork")[0] + "fcscloud/composite/httpfile";
- $http({
- method: 'post',
- url: post_url,
- data: postData,
- headers: {'Content-Type': 'application/x-www-form-urlencoded'},
- transformRequest: function (data) {
- return _this.utils.param(data);
- }
- }).then(res => {
- if (res.data.errorcode === 0) {
- _this.yzWeb = res.data.data.viewUrl
- } else {
- $.alert("打开失败,请联系管理员!", "温馨提示");
- }
- })
- },
- //只读模式打开稿件
- openReadonlyRecord: (obj) => {
- let postData = {
- convertType: 570,
- fileUrl: _this.apiurl.split("glwork")[0] + "glworkweb/" + obj.FILEURL
- };
- let post_url = _this.apiurl.split("glwork")[0] + "fcscloud/composite/httpfile";
- $http({
- method: 'post',
- url: post_url,
- data: postData,
- headers: {'Content-Type': 'application/x-www-form-urlencoded'},
- transformRequest: function (data) {
- return _this.utils.param(data);
- }
- }).then(res => {
- if (res.data.errorcode === 0) {
- _this.yzWeb = res.data.data.viewUrl
- } else {
- $.alert("打开失败,请联系管理员!", "温馨提示");
- }
- })
- },
- //编辑模式打开稿件
- openEditRecord: (obj) => {
- let set_filepath = _this.apiurl.split("glwork")[0] + "glworkweb/" + obj.FILEURL;
- let postData = {
- method: 1,
- params: {
- userId: _this.userId,
- fileId: obj.ID,
- fileName: obj.FILENAMES,
- filePath: set_filepath,
- mobileFlag: true,
- //userRight: 0, // 用户权限 编辑:UserRightEdit = 0; 只读:UserRightReadonly = 1; 临时只读:UserRightTempReadonly = 2;此时页面上编辑—临时只读按钮,打开只能临时只读,不打开可以进行编辑
- //saveFlag: true, /// true:自动保存文档 false:不自动保存文档 (默认为true)
- callbackUrl: _this.apiurl + "/g2app/fawenfiles/uploadFile"
- }
- };
- $.ajax({
- url: "http://10.233.22.204:18080/api.do",
- data: {
- jsonParams: encodeURIComponent(JSON.stringify(postData))
- },
- type: "POST",
- dataType: "json",
- general: false,
- async: false,
- success: function (data) {
- if (data) {
- if (data.errorCode === "0") {
- let rst = data.result;
- if (rst && rst.urls) {
- let get_urls = rst.urls;
- if (typeof (get_urls) === "string") {
- _this.yzWeb = get_urls;
- } else {
- $.alert("打开失败,请联系管理员!", "温馨提示");
- }
- } else {
- $.alert("打开失败,请联系管理员!", "温馨提示");
- }
- } else {
- $.alert("打开失败,请联系管理员!", "温馨提示");
- }
- } else {
- $.alert("打开失败,请联系管理员!", "温馨提示");
- }
- },
- });
- },
- },
- created: function () {
- _this = this;
- let token = localStorage.getItem("mobile-token", _this.token);
- let userName = localStorage.getItem("mobile-userName", _this.userName);
- let userId = localStorage.getItem("mobile-userId", _this.userId);
- _this.userId = userId;
- _this.token = token;
- _this.userName = userName;
- _this.dataString = _this.utils.getUrlName("dataString");
- _this.info = _this.utils.strToJson(s4.decryptData_CBC(_this.dataString));
- console.log(_this.info);
- if (_this.info.type == "type1") {
- _this.openReadonlyFile(_this.info.obj);
- } else if (_this.info.type == "type2") {
- _this.openEditRecord(_this.info.obj);
- } else if (_this.info.type == "type3") {
- _this.openReadonlyRecord(_this.info.obj);
- }
- },
- mounted: function () {
- }
- })
|