Commit e452f146 authored by msgroup's avatar msgroup Committed by mingsoft
Browse files

up: 5.3.0 待发布

parent 35422a17
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.12.RELEASE</version>
<version>2.7.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>net.mingsoft</groupId>
......@@ -44,24 +44,24 @@
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-base</artifactId>
<version>2.1.16</version>
<version>2.1.17</version>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-basic</artifactId>
<version>2.1.16</version>
<version>2.1.17</version>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-mdiy</artifactId>
<version>2.1.16</version>
<version>2.1.17</version>
</dependency>
<!--store入口依赖(源码不开发),如果不需要MStore可以直接去掉依赖-->
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>store-client</artifactId>
<version>2.1.16.1</version>
<version>17</version>
</dependency>
<dependency>
<groupId>com.github.oshi</groupId>
......
......@@ -152,7 +152,7 @@ public class CategoryAction extends BaseAction {
@RequiresPermissions("cms:category:save")
public ResultData save(@ModelAttribute @ApiIgnore CategoryEntity category) {
//验证缩略图参数值是否合法
if (!category.getCategoryImg().matches("^\\[.{1,}]$") || category.getCategoryImg() == null) {
if (category.getCategoryImg() == null || !category.getCategoryImg().matches("^\\[.{1,}]$")) {
category.setCategoryImg("");
}
//验证栏目管理名称的值是否合法
......@@ -172,7 +172,7 @@ public class CategoryAction extends BaseAction {
//判断拼音是否重复
if (StrUtil.isNotBlank(category.getCategoryPinyin())) {
if (!category.getCategoryPinyin().matches("^[a-zA-Z0-9]*$")){
return ResultData.build().error(this.getResString("err.format"));
return ResultData.build().error(this.getResString("err.error",this.getResString("category.pinyin")));
}
CategoryEntity _category = new CategoryEntity();
_category.setCategoryPinyin(category.getCategoryPinyin());
......@@ -237,7 +237,7 @@ public class CategoryAction extends BaseAction {
@RequiresPermissions("cms:category:update")
public ResultData update(@ModelAttribute @ApiIgnore CategoryEntity category) {
//验证缩略图参数值是否合法
if (!category.getCategoryImg().matches("^\\[.{1,}]$") || category.getCategoryImg() == null) {
if (category.getCategoryImg() == null || !category.getCategoryImg().matches("^\\[.{1,}]$")) {
category.setCategoryImg("");
}
//验证栏目管理名称的值是否合法
......@@ -257,7 +257,7 @@ public class CategoryAction extends BaseAction {
//判断拼音是否重复并且是否和原拼音相同
if (StrUtil.isNotBlank(category.getCategoryPinyin()) && !categoryBiz.getById(category.getId()).getCategoryPinyin().equals(category.getCategoryPinyin())) {
if (!category.getCategoryPinyin().matches("^[a-zA-Z0-9]*$")){
return ResultData.build().error(this.getResString("err.format"));
return ResultData.build().error(this.getResString("err.error",this.getResString("category.pinyin")));
}
CategoryEntity _category = new CategoryEntity();
_category.setCategoryPinyin(category.getCategoryPinyin());
......
......@@ -26,6 +26,8 @@ package net.mingsoft.cms.action;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.date.DateException;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import net.mingsoft.base.entity.ResultData;
import net.mingsoft.basic.annotation.LogAnn;
......@@ -58,6 +60,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -131,7 +134,7 @@ public class GeneraterAction extends BaseAction {
// 获取文件所在路径 首先判断用户输入的模版文件是否存在
if (!FileUtil.exist(ParserUtil.buildTemplatePath())) {
return ResultData.build().error(getResString("templet.file"));
return ResultData.build().error(getResString("template.file"));
} else {
CmsParserUtil.generate(tmpFileName, generateFileName, htmlDir);
......@@ -208,7 +211,7 @@ public class GeneraterAction extends BaseAction {
BeanUtil.copyProperties(column, columnArticleIdBean, copyOptions);
articleIdList.add(columnArticleIdBean);
}
CmsParserUtil.generateBasic(articleIdList, htmlDir);
CmsParserUtil.generateBasic(articleIdList, htmlDir,null);
break;
}
}
......@@ -235,6 +238,14 @@ public class GeneraterAction extends BaseAction {
ContentBean contentBean = new ContentBean();
contentBean.setBeginTime(dateTime);
// 时间格式化
Date contentUpdateTime = null;
try {
contentUpdateTime = DateUtil.parse(dateTime);
} catch (DateException e) {
e.printStackTrace();
return ResultData.build().error(getResString("err.error",this.getResString("datetime.format")));
}
if ("0".equals(columnId)) {
categoryList = categoryBiz.list();
} else { //选择栏目更新
......@@ -252,7 +263,7 @@ public class GeneraterAction extends BaseAction {
contentBean.setCategoryType(category.getCategoryType());
contentBean.setOrderBy("date");
//将文章列表标签中的中的参数
articleIdList = contentBiz.queryIdsByCategoryIdForParserAndNotCover(contentBean);
articleIdList = contentBiz.queryIdsByCategoryIdForParser(contentBean);
// 分类是列表
if (category.getCategoryType().equals(CategoryTypeEnum.LIST.toString())) {
// 判断模板文件是否存在
......@@ -265,7 +276,7 @@ public class GeneraterAction extends BaseAction {
}
// 有符合条件的就更新
if (articleIdList.size() > 0) {
CmsParserUtil.generateBasic(articleIdList, htmlDir);
CmsParserUtil.generateBasic(articleIdList, htmlDir,contentUpdateTime);
}
}
......
......@@ -23,7 +23,7 @@ package net.mingsoft.cms.action.web;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.PageUtil;
import com.alibaba.fastjson.JSON;
import cn.hutool.json.JSONUtil;
import freemarker.core.ParseException;
import freemarker.template.MalformedTemplateNameException;
import freemarker.template.TemplateNotFoundException;
......@@ -355,7 +355,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
@Override
public String toString() {
return JSON.toJSONString(this);
return JSONUtil.toJsonStr(this);
}
}
......
......@@ -7,7 +7,7 @@
package net.mingsoft.cms.aop;
import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import net.mingsoft.base.entity.ResultData;
......@@ -78,7 +78,7 @@ public class CategoryAop extends net.mingsoft.basic.aop.BaseAop {
// 获取返回值
Object obj = pjp.proceed(pjp.getArgs());
ResultData resultData = JSONObject.parseObject(JSONObject.toJSON(obj).toString(), ResultData.class);
ResultData resultData = JSONUtil.toBean(JSONUtil.toJsonStr(obj), ResultData.class);
CategoryEntity parent = categoryDao.selectById(category.getCategoryId());
if (parent == null) {
return resultData;
......@@ -90,7 +90,7 @@ public class CategoryAop extends net.mingsoft.basic.aop.BaseAop {
// 将父栏目的内容模板清空
parent.setCategoryUrl("");
categoryDao.updateById(parent);
CategoryEntity returnCategory = JSONObject.parseObject(resultData.get(ResultData.DATA_KEY).toString(), CategoryEntity.class);
CategoryEntity returnCategory = JSONUtil.toBean(resultData.get(ResultData.DATA_KEY).toString(), CategoryEntity.class);
// 获取父栏目ID集合
String categoryIds = StringUtils.isEmpty(parent.getCategoryParentIds())
? returnCategory.getId() : parent.getCategoryParentIds() + "," + returnCategory.getId();
......
......@@ -22,7 +22,11 @@
package net.mingsoft.cms.bean;
import com.fasterxml.jackson.annotation.JsonFormat;
import net.mingsoft.cms.entity.CategoryEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 文章实体
......@@ -37,8 +41,20 @@ public class CategoryBean extends CategoryEntity {
*/
private String articleId;
/**
* 文章更新时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
private Date contentUpdateDate;
public Date getContentUpdateDate() {
return contentUpdateDate;
}
public void setContentUpdateDate(Date contentUpdateDate) {
this.contentUpdateDate = contentUpdateDate;
}
public String getArticleId() {
return articleId;
......
......@@ -101,7 +101,7 @@ public class ContentBizImpl extends BaseBizImpl<IContentDao, ContentEntity> imp
@Override
public List<CategoryBean> queryIdsByCategoryIdForParserAndNotCover(ContentBean contentBean) {
return this.contentDao.queryIdsByCategoryIdForParser(contentBean);
return this.contentDao.queryIdsByCategoryIdForParserAndNotCover(contentBean);
}
@Override
......
......@@ -52,6 +52,7 @@
<resultMap id="resultBean" type="net.mingsoft.cms.bean.CategoryBean">
<id column="id" property="id" /><!--编号 -->
<id column="article_Id" property="articleId" /><!--编号 -->
<result column="content_update_date" property="contentUpdateDate" /><!--文章更新时间-->
<result column="category_title" property="categoryTitle" /><!--栏目管理名称 -->
<result column="category_id" property="categoryId" /><!--所属栏目 -->
<result column="category_type" property="categoryType" /><!--栏目管理属性 -->
......@@ -287,7 +288,7 @@
<!-- 根据站点编号、开始、结束时间和栏目编号查询文章编号集合 -->
<select id="queryIdsByCategoryIdForParser" resultMap="resultBean" >
select
ct.id article_id,ct.content_img litpic,c.*
ct.id article_id,ct.content_img litpic,c.*,ct.update_date as content_update_date
FROM cms_content ct
LEFT JOIN cms_category c ON ct.category_id = c.id
where ct.del=0 and ct.content_display=0
......@@ -300,14 +301,7 @@
<if test="categoryId!=null and categoryId!='' and categoryType==2">
and ct.category_id=#{categoryId}
</if>
<if test="beginTime!=null and beginTime!=''">
<if test="_databaseId == 'mysql'">
AND ct.UPDATE_DATE &gt;= #{beginTime}
</if>
<if test="_databaseId == 'oracle'">
and ct.UPDATE_DATE &gt;= to_date(#{beginTime}, 'yyyy-mm-dd hh24:mi:ss')
</if>
</if>
<if test="endTime!=null and endTime!=''">
<if test="_databaseId == 'mysql'">
and ct.UPDATE_DATE &gt;= #{endTime}
......
......@@ -28,8 +28,6 @@ import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.config.MSProperties;
import net.mingsoft.mdiy.util.ConfigUtil;
import java.io.File;
/**
* 分类实体
*
......@@ -42,6 +40,7 @@ public class CategoryEntity extends BaseEntity {
private static final long serialVersionUID = 1574925152750L;
private static Boolean shortLinkSwitch = null;
@TableId(type = IdType.ASSIGN_ID)
private String id;
......@@ -490,11 +489,14 @@ public class CategoryEntity extends BaseEntity {
* @return url路径的字符串
*/
public String getUrl() {
if (shortLinkSwitch == null) {
shortLinkSwitch = ConfigUtil.getBoolean("短链配置", "shortLinkSwitch", false);
}
String appDir = "";
String htmlDir = MSProperties.diy.htmlDir;
String categoryPath = this.getCategoryPath();
String categoryPinyin = this.getCategoryPinyin();
if (!(ConfigUtil.getBoolean("短链配置", "shortLinkSwitch", false))) {
if (!shortLinkSwitch) {
//未开启短链
appDir = "/" + BasicUtil.getApp().getAppDir();
return url = "/" + htmlDir + appDir + categoryPath + "/index.html";
......
......@@ -22,7 +22,6 @@
package net.mingsoft.cms.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
......@@ -82,7 +81,6 @@ private static final long serialVersionUID = 1574925152617L;
/**
* 发布时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
private Date contentDatetime;
......
......@@ -33,6 +33,6 @@ category.id=belonging to the column
content.sort=custom order
category.diy.url=custom link
content.keyword=keyword
templet.file=template file not found
template.file=template file not found
category.pinyin=pinyin
err.format=category pinyin format error
\ No newline at end of file
datetime.format=datatime format
......@@ -33,6 +33,7 @@ category.id=\u6240\u5C5E\u680F\u76EE
content.sort=\u81EA\u5B9A\u4E49\u987A\u5E8F
category.diy.url=\u81EA\u5B9A\u4E49\u94FE\u63A5
content.keyword=\u5173\u952E\u5B57
templet.file=\u672A\u627E\u5230\u6A21\u677F\u6587\u4EF6
template.file=\u672A\u627E\u5230\u6A21\u677F\u6587\u4EF6
category.pinyin=\u62FC\u97F3
err.format=\u680f\u76ee\u62fc\u97f3\u683c\u5f0f\u9519\u8bef
datetime.format=\u65f6\u95f4\u683c\u5f0f
......@@ -46,10 +46,7 @@ import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 文章解析工具类
......@@ -191,7 +188,8 @@ public class CmsParserUtil {
* @throws MalformedTemplateNameException
* @throws TemplateNotFoundException
*/
public static void generateBasic(List<CategoryBean> articleIdList, String htmlDir) {
public static void generateBasic(List<CategoryBean> articleIdList, String htmlDir,Date datetime) {
Map<String, Object> parserParams = new HashMap<String, Object>();
parserParams.put(ParserUtil.IS_DO, false);
......@@ -280,6 +278,7 @@ public class CmsParserUtil {
}
parserParams.put(ParserUtil.ID, articleId);
// 第一篇文章没有上一篇
if (artId > 0) {
CategoryBean preCaBean = articleIdList.get(artId - 1);
......@@ -288,6 +287,7 @@ public class CmsParserUtil {
page.setPreId(preCaBean.getArticleId());
// }
}
// 最后一篇文章没有下一篇
if (artId + 1 < articleIdList.size()) {
CategoryBean nextCaBean = articleIdList.get(artId + 1);
......@@ -297,6 +297,14 @@ public class CmsParserUtil {
// }
}
// 文章更新时间在指定时间之前 跳过
if (datetime != null && categoryBean.getContentUpdateDate().before(datetime)){
artId++;
continue;
}
parserParams.put(ParserUtil.PAGE, page);
String finalWritePath = writePath;
......
......@@ -22,9 +22,9 @@
package net.mingsoft.config;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.spring.stat.BeanTypeAutoProxyCreator;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import net.mingsoft.basic.filter.XSSEscapeFilter;
import net.mingsoft.basic.interceptor.ActionInterceptor;
......@@ -206,7 +206,7 @@ public class WebConfig implements WebMvcConfigurer {
ConfigEntity configEntity = new ConfigEntity();
configEntity.setConfigName(configName);
configEntity = (ConfigEntity)this.configBiz.getOne(new QueryWrapper(configEntity));
return configEntity != null && !StringUtils.isEmpty(configEntity.getConfigData()) ? (Map) JSON.parseObject(configEntity.getConfigData(), HashMap.class) : null;
return configEntity != null && !StringUtils.isEmpty(configEntity.getConfigData()) ? (Map) JSONUtil.toBean(configEntity.getConfigData(), HashMap.class) : null;
} else {
return null;
}
......
......@@ -75,6 +75,7 @@ html *, body * {
}
.ms-alert-tip{
margin-bottom: 10px;
flex-shrink: 0;
}
.ms-select{
......
! function (e, t) {
"object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.ms = t() : e.ms = t()
}(window, (function () {
return function (e) {
var t = {};
function n(o) {
if (t[o]) return t[o].exports;
var r = t[o] = {
i: o,
l: !1,
exports: {}
};
return e[o].call(r.exports, r, r.exports, n), r.l = !0, r.exports
}
return n.m = e, n.c = t, n.d = function (e, t, o) {
n.o(e, t) || Object.defineProperty(e, t, {
enumerable: !0,
get: o
})
}, n.r = function (e) {
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
value: "Module"
}), Object.defineProperty(e, "__esModule", {
value: !0
})
}, n.t = function (e, t) {
if (1 & t && (e = n(e)), 8 & t) return e;
if (4 & t && "object" == typeof e && e && e.__esModule) return e;
var o = Object.create(null);
if (n.r(o), Object.defineProperty(o, "default", {
enumerable: !0,
value: e
}), 2 & t && "string" != typeof e)
for (var r in e) n.d(o, r, function (t) {
return e[t]
}.bind(null, r));
return o
}, n.n = function (e) {
var t = e && e.__esModule ? function () {
return e.default
} : function () {
return e
};
return n.d(t, "a", t), t
}, n.o = function (e, t) {
return Object.prototype.hasOwnProperty.call(e, t)
}, n.p = "", n(n.s = 1)
}([function (e, t) {
Vue.prototype.$table = {}, Vue.prototype.$table.moneyFormatter = function (e, t, n, o) {
return null != n ? accounting.formatMoney(n, "¥") : ""
}, Vue.prototype.$table.percentageFormatter = function (e, t, n, o) {
return null != n ? n + "%" : "-"
}
}, function (e, t, n) {
"use strict";
function o(e) {
if (null != e) {
var t = axios.create({
baseURL: null == e.baseURL ? axios.defaults.baseURL : e.baseURL,
timeout: null == e.timeout ? axios.defaults.timeout : e.timeout,
headers: null == e.headers ? null : e.headers
});
return t.interceptors.response.use((function (e) {
return e
}), (function (e) {
if (e.response) {
let n;
if (401 == e.response.status ? n = "登录超时" : 400 == e.response.status ? n = "客户端错误" : 403 == e.response.status ? n = "您的权限不足" : 423 == e.response.status ? n = "账号被锁定!" : 500 == e.response.status ? n = "服务器异常" : 501 == e.response.status ? n = "您的操作被取消或不允许提交" : 423 == e.response.status && (n = "服务器正在开小差...."), n) {
if (!t) {
var t = document.createElement("div");
t.id = "tempVue", document.body.appendChild(t)
}
new Vue({
el: "#tempVue"
}).$notify.error({
title: n,
message: e.response.data.msg || n,
type: "warning"
}), 401 == e.response.status && (window.ms.login ? location.href = window.ms.login : console.log(n))
}
return Promise.reject(e)
}
})), t.interceptors.request.use((function (e) {
return !e.headers && (e.headers = {}), e.headers = Object.assign(e.headers, {
"Cache-Control": "no-cache",
Pragma: "no-cache",
"X-Requested-With": "XMLHttpRequest"
}), "" != sessionStorage.getItem("token") && (e.headers.token = sessionStorage.getItem("token")), "post" === e.method && "application/x-www-form-urlencoded" === e.headers["Content-Type"] && (e.data = Qs.stringify(e.data, {
allowDots: !0
})), e
}), (function (e) {
return Promise.reject(e)
})), t
}
return axios
}
n.r(t), n.d(t, "http", (function () {
return r
})), n.d(t, "util", (function () {
return i
})), axios.defaults.timeout = 6e4, axios.defaults.baseURL = "";
var r = {
get: function (e, t, n) {
return null == t && (t = {}), null == n && (n = {
headers: {
"X-Requested-With": "XMLHttpRequest"
}
}), new Promise((function (r, a) {
o(n).get(e, {
params: t
}, n).then((function (e) {
r(e ? e.data : void 0)
})).catch((function (e) {
a(e)
}))
}))
},
post: function (e, t, n) {
return null == t && (t = {}), null == n && (n = {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"X-Requested-With": "XMLHttpRequest"
}
}), new Promise((function (r, a) {
o(n).post(e, t, n).then((function (e) {
r(e.data ? e.data : void 0)
}), (function (e) {
a(e)
}))
}))
},
put: function (e, t, n) {
return null == t && (t = {}), new Promise((function (r, a) {
o(n).put(e, t, n).then((function (e) {
r(e.data)
}), (function (e) {
a(e)
}))
}))
},
patch: function (e, t, n) {
return null == t && (t = {}), new Promise((function (r, a) {
o(n).patch(e, t, n).then((function (e) {
r(e)
}), (function (e) {
a(e)
}))
}))
},
download: function (e, t, n, o) {
return null == t && (t = {}), new Promise((function (r, a) {
axios({
method: "post",
url: e,
data: t,
timeout: n || 3e5,
responseType: "blob",
headers: {
Accept: "application/vnd.openxmlformats-officedocument"
},
onDownloadProgress: function (e) {
o && o(e)
}
}).then((function (e) {
const t = e.data,
n = new Blob([t]),
o = e.headers["content-disposition"].split(";"),
a = o[2].slice(11, o[2].length - 1);
if ("download" in document.createElement("a")) {
const e = document.createElement("a");
e.download = a, e.style.display = "none", e.href = URL.createObjectURL(n), document.body.appendChild(e), e.click(), URL.revokeObjectURL(e.href), document.body.removeChild(e)
} else navigator.msSaveBlob(n, a);
r(e)
}), (function (e) {
a(e)
}))
}))
}
};
var a = function (e) {
window.ms.debug && console.log(e)
};
var i = {
browserVersion: function () {
var e = navigator,
t = e.appVersion.split(";")[1].replace(/[ ]/g, "");
return "Microsoft Internet Explorer" != e.appName ? "other" : t.indexOf("MSIE") > -1 && "MSIE10.0" !== t ? "MSIE9.0" : t.indexOf("MSIE10.0") > -1 ? "MSIE10.0" : void 0
},
getParameter: function (e) {
try {
var t = new RegExp("(^|&)" + e + "=([^&]*)(&|$)"),
n = window.location.search.substr(1).match(t);
return null != n ? decodeURI(n[2]) : null
} catch (e) {
a(e.message)
}
},
treeData: function (e, t, n, o) {
var r = JSON.parse(JSON.stringify(e));
return r.filter((function (e) {
var a = r.filter((function (o) {
return e[t] == o[n]
}));
return a.length > 0 && (e[o] = a), !e[n] || "0" == e[n] || null == e[n]
}))
},
childValidate: function e(t, n, o, r, a) {
var i = t.find((function (e) {
return e[r] == o
}));
return !i || "0" === i[a] || !i[a] || n != i[a] && e(t, n, i[a], r, a)
},
moneyFormatter: function (e) {
return accounting.formatMoney(e, "¥", 2)
},
date: {
fmt: function (e, t) {
var n = new Date("string" == typeof e ? e.replace(/-/g, "/") : e);
t || (t = "yyyy-MM-dd");
var o = {
"M+": n.getMonth() + 1,
"d+": n.getDate(),
"h+": n.getHours(),
"m+": n.getMinutes(),
"s+": n.getSeconds(),
"q+": Math.floor((n.getMonth() + 3) / 3),
S: n.getMilliseconds()
};
for (var r in /(y+)/.test(t) && (t = t.replace(RegExp.$1, (n.getFullYear() + "").substr(4 - RegExp.$1.length))), o) new RegExp("(" + r + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? o[r] : ("00" + o[r]).substr(("" + o[r]).length)));
return t
},
diyFmt: function (e) {
Object.prototype.toString.call(new Date) !== Object.prototype.toString.call(e) && (e = new Date(e));
var t = ((new Date).getTime() - e) / 1e3;
return t < 60 ? "刚刚" : t < 3600 ? moment(e).format("A") + moment(e).format("H:mm") : t < 86400 ? "昨天" : t < 172800 ? moment(e).format("dddd") : t < 31536e3 ? moment(e).format("MMM Do").replace(" ", "") : moment(e).subtract(10, "days").calendar()
}
},
array: {
unique: function (e, t) {
if (0 != e.length) {
for (var n = [e[0]], o = 1; o < e.length; o++) {
for (var r = e[o], a = !1, i = 0; i < n.length; i++)
if (r[t] == n[i][t]) {
if (r.write && 0 == n[i].write) break;
a = !0;
break
} a || n.push(r)
}
return n
}
}
},
log: a,
convert: {
byte: function (e) {
if (isNaN(e)) return "";
var t = Math.floor(Math.log(e) / Math.log(2));
t < 1 && (t = 0);
var n = Math.floor(t / 10);
return (e /= Math.pow(2, 10 * n)).toString().length > e.toFixed(2).toString().length && (e = e.toFixed(2)), e + " " + ["bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"][n]
},
distance: function (e, t, n, o) {
var r, a, i, u, s;
return r = .01745329252 * t, a = .01745329252 * o, (s = .01745329252 * e - .01745329252 * n) > 3.14159265359 ? s = 6.28318530712 - s : s < -3.14159265359 && (s = 6.28318530712 + s), i = 6370693.5 * Math.cos(r) * s, u = 6370693.5 * (r - a), Math.sqrt(i * i + u * u).toFixed(0)
}
},
store: {
set: function (e, t) {
window.sessionStorage.setItem(e, t)
},
get: function (e) {
return window.sessionStorage.getItem(e)
},
remove: function (e) {
window.sessionStorage.removeItem(e)
}
},
exportTable: function (e, t, n, o) {
var r = XLSX.utils.table_to_book(e),
a = [],
i = [],
u = [];
o.column.forEach((function (e) {
u.push(e.label), a.push({
wpx: e.width
})
})), i.push(u);
var s = new Array(o.column.length);
n.map((function (e) {
var t = [];
return o.column.forEach((function (n) {
if (e.hasOwnProperty(n.filed))
if (null != n.dictDataOptions && n.dictDataOptions.length > 0) {
var r = n.dictDataOptions.find((function (t) {
return e[n.filed] == t.dictValue
}));
t.push(r ? r.dictLabel : "")
} else t.push(e[n.filed]), null != o.countFiled && o.countFiled.indexOf(n.filed) >= 0 && (s[0] = "总计", o.column.findIndex((function (t, o) {
t.filed == n.filed && (s[o] = null == s[o] ? e[n.filed] : s[o] + e[n.filed])
})));
else t.push("")
})), t
})).forEach((function (e, t) {
i.push(e)
})), i.push(s);
var l = XLSX2.utils.aoa_to_sheet(i);
r.Sheets.Sheet1 = l, r.Sheets.Sheet1["!cols"] = a;
var c = XLSX.write(r, {
bookType: "xlsx",
bookSST: !0,
type: "array"
});
try {
saveAs(new Blob([c], {
type: "application/octet-stream"
}), t + ".xlsx")
} catch (e) {
"undefined" != typeof console && console.log(e, c)
}
return c
},
printFile: function (e, t) {
"" !== e && null != e && null != e ? ms.http.get(ms.manager + "/mprint/printTemplate/get.do", {
name: e
}).then((function (e) {
null != t && null != t && null != e.data ? printVue.open(e.data, t) : console.error("未定义数据,或没有模板数据")
})).catch((function (e) {
console.log(e)
})) : console.error("未定义模板名称")
}
};
n(0)
}])
}));
\ No newline at end of file
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ms=t():e.ms=t()}(window,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t){Vue.prototype.$table={},Vue.prototype.$table.moneyFormatter=function(e,t,n,o){return null!=n?accounting.formatMoney(n,"¥"):""},Vue.prototype.$table.percentageFormatter=function(e,t,n,o){return null!=n?n+"%":"-"}},function(e,t,n){"use strict";function o(e){if(null!=e){var t=axios.create({baseURL:null==e.baseURL?axios.defaults.baseURL:e.baseURL,timeout:null==e.timeout?axios.defaults.timeout:e.timeout,headers:null==e.headers?null:e.headers});return t.interceptors.response.use((function(e){return e}),(function(e){if(e.response){let n;if(401==e.response.status?n="登录超时":400==e.response.status?n="客户端错误":403==e.response.status?n="您的权限不足":423==e.response.status?n="账号被锁定!":500==e.response.status?n="服务器异常,请刷新页面重试!":501==e.response.status?n="您的操作被取消或不允许提交,请刷新页面重试!":423==e.response.status?n="服务器正在开小差,请刷新页面重试!":404==e.response.status&&(n="资源不存在,请刷新页面重试!"),n){if(!t){var t=document.createElement("div");t.id="tempVue",document.body.appendChild(t)}new Vue({el:"#tempVue"}).$notify.error({title:"系统提示",message:e.response.data.msg||n,type:"warning",onClose:function(){var e=document.getElementsByClassName("el-loading-mask");e&&e[0].parentElement.removeChild(e[0])}}),401==e.response.status&&(window.ms.login?location.href=window.ms.login:console.log(n))}return Promise.reject(e)}})),t.interceptors.request.use((function(e){return!e.headers&&(e.headers={}),e.headers=Object.assign(e.headers,{"Cache-Control":"no-cache",Pragma:"no-cache","X-Requested-With":"XMLHttpRequest"}),""!=sessionStorage.getItem("token")&&(e.headers.token=sessionStorage.getItem("token")),"post"===e.method&&"application/x-www-form-urlencoded"===e.headers["Content-Type"]&&(e.data=Qs.stringify(e.data,{allowDots:!0})),e}),(function(e){return Promise.reject(e)})),t}return axios}n.r(t),n.d(t,"http",(function(){return r})),n.d(t,"util",(function(){return a})),axios.defaults.timeout=3e5,axios.defaults.baseURL="";var r={get:function(e,t,n){return null==t&&(t={}),null==n&&(n={headers:{"X-Requested-With":"XMLHttpRequest"}}),new Promise((function(r,a){o(n).get(e,{params:t},n).then((function(e){r(e?e.data:void 0)})).catch((function(e){a(e)}))}))},post:function(e,t,n){return null==t&&(t={}),null==n&&(n={headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"}}),new Promise((function(r,a){o(n).post(e,t,n).then((function(e){r(e.data?e.data:void 0)}),(function(e){a(e)}))}))},put:function(e,t,n){return null==t&&(t={}),new Promise((function(r,a){o(n).put(e,t,n).then((function(e){r(e.data)}),(function(e){a(e)}))}))},patch:function(e,t,n){return null==t&&(t={}),new Promise((function(r,a){o(n).patch(e,t,n).then((function(e){r(e)}),(function(e){a(e)}))}))},download:function(e,t,n,o){return null==t&&(t={}),new Promise((function(r,a){axios({method:"post",url:e,data:t,timeout:n||3e5,responseType:"blob",headers:{Accept:"application/vnd.openxmlformats-officedocument"},onDownloadProgress:function(e){o&&o(e)}}).then((function(e){const t=e.data,n=new Blob([t]),o=e.headers["content-disposition"].split(";"),a=o[2].slice(11,o[2].length-1);if("download"in document.createElement("a")){const e=document.createElement("a");e.download=a,e.style.display="none",e.href=URL.createObjectURL(n),document.body.appendChild(e),e.click(),URL.revokeObjectURL(e.href),document.body.removeChild(e)}else navigator.msSaveBlob(n,a);r(e)}),(function(e){a(e)}))}))}};var a={browserVersion:function(){var e=navigator,t=e.appVersion.split(";")[1].replace(/[ ]/g,"");return"Microsoft Internet Explorer"!=e.appName?"other":t.indexOf("MSIE")>-1&&"MSIE10.0"!==t?"MSIE9.0":t.indexOf("MSIE10.0")>-1?"MSIE10.0":void 0},getParameter:function(e){try{var t=new RegExp("(^|&)"+e+"=([^&]*)(&|$)"),n=window.location.search.substr(1).match(t);return null!=n?decodeURI(n[2]):null}catch(e){o=e.message,window.ms.debug&&console.log(o)}var o},treeData:function(e,t,n,o){var r=JSON.parse(JSON.stringify(e));return r.filter((function(e){var a=r.filter((function(o){return e[t]==o[n]}));return a.length>0&&(e[o]=a),!e[n]||"0"==e[n]||null==e[n]}))},childValidate:function e(t,n,o,r,a){var i=t.find((function(e){return e[r]==o}));return!i||"0"===i[a]||!i[a]||n!=i[a]&&e(t,n,i[a],r,a)},moneyFormatter:function(e){return accounting.formatMoney(e,"¥",2)},openSystemUrl:function(e){window.location.href=ms.manager+e},date:{fmt:function(e,t){var n=new Date("string"==typeof e?e.replace(/-/g,"/"):e);t||(t="yyyy-MM-dd");var o={"M+":n.getMonth()+1,"d+":n.getDate(),"h+":n.getHours(),"H+":n.getHours(),"m+":n.getMinutes(),"s+":n.getSeconds(),"q+":Math.floor((n.getMonth()+3)/3),S:n.getMilliseconds()};for(var r in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(n.getFullYear()+"").substr(4-RegExp.$1.length))),o)new RegExp("("+r+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?o[r]:("00"+o[r]).substr((""+o[r]).length)));return t},diyFmt:function(e){Object.prototype.toString.call(new Date)!==Object.prototype.toString.call(e)&&(e=new Date(e));var t=((new Date).getTime()-e)/1e3;return t<60?"刚刚":t<3600?moment(e).format("A")+moment(e).format("H:mm"):t<86400?"昨天":t<172800?moment(e).format("dddd"):t<31536e3?moment(e).format("MMM Do").replace(" ",""):moment(e).subtract(10,"days").calendar()}},array:{unique:function(e,t){if(0!=e.length){for(var n=[e[0]],o=1;o<e.length;o++){for(var r=e[o],a=!1,i=0;i<n.length;i++)if(r[t]==n[i][t]){if(r.write&&0==n[i].write)break;a=!0;break}a||n.push(r)}return n}}},convert:{byte:function(e){if(isNaN(e))return"";var t=Math.floor(Math.log(e)/Math.log(2));t<1&&(t=0);var n=Math.floor(t/10);return(e/=Math.pow(2,10*n)).toString().length>e.toFixed(2).toString().length&&(e=e.toFixed(2)),e+" "+["bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][n]},distance:function(e,t,n,o){var r,a,i,u,s;return r=.01745329252*t,a=.01745329252*o,(s=.01745329252*e-.01745329252*n)>3.14159265359?s=6.28318530712-s:s<-3.14159265359&&(s=6.28318530712+s),i=6370693.5*Math.cos(r)*s,u=6370693.5*(r-a),Math.sqrt(i*i+u*u).toFixed(0)}},store:{set:function(e,t){window.sessionStorage.setItem(e,t)},get:function(e){return window.sessionStorage.getItem(e)},remove:function(e){window.sessionStorage.removeItem(e)}},exportTable:function(e,t,n,o){var r=XLSX.utils.table_to_book(e),a=[],i=[],u=[];o.column.forEach((function(e){u.push(e.label),a.push({wpx:e.width})})),i.push(u);var s=new Array(o.column.length);n.map((function(e){var t=[];return o.column.forEach((function(n){if(e.hasOwnProperty(n.filed))if(null!=n.dictDataOptions&&n.dictDataOptions.length>0){var r=n.dictDataOptions.find((function(t){return e[n.filed]==t.dictValue}));t.push(r?r.dictLabel:"")}else t.push(e[n.filed]),null!=o.countFiled&&o.countFiled.indexOf(n.filed)>=0&&(s[0]="总计",o.column.findIndex((function(t,o){t.filed==n.filed&&(s[o]=null==s[o]?e[n.filed]:s[o]+e[n.filed])})));else t.push("")})),t})).forEach((function(e,t){i.push(e)})),i.push(s);var l=XLSX2.utils.aoa_to_sheet(i);r.Sheets.Sheet1=l,r.Sheets.Sheet1["!cols"]=a;var c=XLSX.write(r,{bookType:"xlsx",bookSST:!0,type:"array"});try{saveAs(new Blob([c],{type:"application/octet-stream"}),t+".xlsx")}catch(e){"undefined"!=typeof console&&console.log(e,c)}return c},printFile:function(e,t){""!==e&&null!=e&&null!=e?ms.http.get(ms.manager+"/mprint/printTemplate/get.do",{name:e}).then((function(e){null!=t&&null!=t&&null!=e.data?printVue.open(e.data,t):console.error("未定义数据,或没有模板数据")})).catch((function(e){console.log(e)})):console.error("未定义模板名称")}};n(0)}])}));
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment