kz-ui-base 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/common/package-lock.json +0 -18
- package/common/package.json +0 -51
- package/common/src/api/common/cacher.js +0 -15
- package/common/src/api/common/common.js +0 -299
- package/common/src/api/common/material.js +0 -71
- package/common/src/api/login.js +0 -103
- package/common/src/api/menu.js +0 -18
- package/common/src/assets/401_images/401.gif +0 -0
- package/common/src/assets/404_images/404.png +0 -0
- package/common/src/assets/404_images/404_cloud.png +0 -0
- package/common/src/assets/icons/file-config.png +0 -0
- package/common/src/assets/icons/file-doc.png +0 -0
- package/common/src/assets/icons/file-exe.png +0 -0
- package/common/src/assets/icons/file-ini.png +0 -0
- package/common/src/assets/icons/file-jpg.png +0 -0
- package/common/src/assets/icons/file-mpg.png +0 -0
- package/common/src/assets/icons/file-none.png +0 -0
- package/common/src/assets/icons/file-pdf.png +0 -0
- package/common/src/assets/icons/file-png.png +0 -0
- package/common/src/assets/icons/file-ppt.png +0 -0
- package/common/src/assets/icons/file-rar.png +0 -0
- package/common/src/assets/icons/file-txt.png +0 -0
- package/common/src/assets/icons/file-wav.png +0 -0
- package/common/src/assets/icons/file-xls.png +0 -0
- package/common/src/assets/icons/index.js +0 -9
- package/common/src/assets/icons/svg/404.svg +0 -1
- package/common/src/assets/icons/svg/bug.svg +0 -1
- package/common/src/assets/icons/svg/build.svg +0 -1
- package/common/src/assets/icons/svg/button.svg +0 -1
- package/common/src/assets/icons/svg/cascader.svg +0 -1
- package/common/src/assets/icons/svg/chart.svg +0 -1
- package/common/src/assets/icons/svg/checkbox.svg +0 -1
- package/common/src/assets/icons/svg/client.svg +0 -1
- package/common/src/assets/icons/svg/clipboard.svg +0 -1
- package/common/src/assets/icons/svg/code.svg +0 -1
- package/common/src/assets/icons/svg/color.svg +0 -1
- package/common/src/assets/icons/svg/component.svg +0 -1
- package/common/src/assets/icons/svg/dashboard.svg +0 -1
- package/common/src/assets/icons/svg/date-range.svg +0 -1
- package/common/src/assets/icons/svg/date.svg +0 -1
- package/common/src/assets/icons/svg/dict.svg +0 -1
- package/common/src/assets/icons/svg/documentation.svg +0 -1
- package/common/src/assets/icons/svg/download.svg +0 -1
- package/common/src/assets/icons/svg/drag.svg +0 -1
- package/common/src/assets/icons/svg/druid.svg +0 -1
- package/common/src/assets/icons/svg/edit.svg +0 -1
- package/common/src/assets/icons/svg/education.svg +0 -1
- package/common/src/assets/icons/svg/email.svg +0 -1
- package/common/src/assets/icons/svg/example.svg +0 -1
- package/common/src/assets/icons/svg/excel.svg +0 -1
- package/common/src/assets/icons/svg/exit-fullscreen.svg +0 -1
- package/common/src/assets/icons/svg/eye-open.svg +0 -1
- package/common/src/assets/icons/svg/eye.svg +0 -1
- package/common/src/assets/icons/svg/form.svg +0 -1
- package/common/src/assets/icons/svg/fullscreen.svg +0 -1
- package/common/src/assets/icons/svg/github.svg +0 -1
- package/common/src/assets/icons/svg/guide.svg +0 -1
- package/common/src/assets/icons/svg/icon.svg +0 -1
- package/common/src/assets/icons/svg/input.svg +0 -1
- package/common/src/assets/icons/svg/international.svg +0 -1
- package/common/src/assets/icons/svg/job.svg +0 -1
- package/common/src/assets/icons/svg/kz_authority.svg +0 -1
- package/common/src/assets/icons/svg/kz_build.svg +0 -1
- package/common/src/assets/icons/svg/kz_code.svg +0 -1
- package/common/src/assets/icons/svg/kz_config.svg +0 -1
- package/common/src/assets/icons/svg/kz_creatTime.svg +0 -1
- package/common/src/assets/icons/svg/kz_dept.svg +0 -1
- package/common/src/assets/icons/svg/kz_dept_profile.svg +0 -1
- package/common/src/assets/icons/svg/kz_dict.svg +0 -1
- package/common/src/assets/icons/svg/kz_edit.svg +0 -1
- package/common/src/assets/icons/svg/kz_enlarge.svg +0 -1
- package/common/src/assets/icons/svg/kz_enterprise.svg +0 -1
- package/common/src/assets/icons/svg/kz_fold.svg +0 -2
- package/common/src/assets/icons/svg/kz_job.svg +0 -1
- package/common/src/assets/icons/svg/kz_layout.svg +0 -1
- package/common/src/assets/icons/svg/kz_log.svg +0 -1
- package/common/src/assets/icons/svg/kz_log_loginInfo.svg +0 -1
- package/common/src/assets/icons/svg/kz_log_operation.svg +0 -1
- package/common/src/assets/icons/svg/kz_master-slave.svg +0 -2
- package/common/src/assets/icons/svg/kz_menu.svg +0 -1
- package/common/src/assets/icons/svg/kz_menu_analyse.svg +0 -22
- package/common/src/assets/icons/svg/kz_message.svg +0 -1
- package/common/src/assets/icons/svg/kz_monitor.svg +0 -1
- package/common/src/assets/icons/svg/kz_nacos.svg +0 -1
- package/common/src/assets/icons/svg/kz_narrow.svg +0 -1
- package/common/src/assets/icons/svg/kz_notice.svg +0 -2
- package/common/src/assets/icons/svg/kz_online.svg +0 -1
- package/common/src/assets/icons/svg/kz_open.svg +0 -2
- package/common/src/assets/icons/svg/kz_organization.svg +0 -1
- package/common/src/assets/icons/svg/kz_post.svg +0 -1
- package/common/src/assets/icons/svg/kz_post_profile.svg +0 -1
- package/common/src/assets/icons/svg/kz_productCenter.svg +0 -1
- package/common/src/assets/icons/svg/kz_rabbit.svg +0 -1
- package/common/src/assets/icons/svg/kz_refresh.svg +0 -2
- package/common/src/assets/icons/svg/kz_renovation.svg +0 -1
- package/common/src/assets/icons/svg/kz_role.svg +0 -1
- package/common/src/assets/icons/svg/kz_roleGroup.svg +0 -1
- package/common/src/assets/icons/svg/kz_search.svg +0 -1
- package/common/src/assets/icons/svg/kz_sentinel.svg +0 -1
- package/common/src/assets/icons/svg/kz_server.svg +0 -1
- package/common/src/assets/icons/svg/kz_setting.svg +0 -1
- package/common/src/assets/icons/svg/kz_sex.svg +0 -1
- package/common/src/assets/icons/svg/kz_source.svg +0 -2
- package/common/src/assets/icons/svg/kz_strategy.svg +0 -2
- package/common/src/assets/icons/svg/kz_swagger.svg +0 -1
- package/common/src/assets/icons/svg/kz_system.svg +0 -1
- package/common/src/assets/icons/svg/kz_tenant.svg +0 -1
- package/common/src/assets/icons/svg/kz_tool.svg +0 -1
- package/common/src/assets/icons/svg/kz_user.svg +0 -1
- package/common/src/assets/icons/svg/language.svg +0 -1
- package/common/src/assets/icons/svg/link.svg +0 -1
- package/common/src/assets/icons/svg/list.svg +0 -1
- package/common/src/assets/icons/svg/lock.svg +0 -1
- package/common/src/assets/icons/svg/log.svg +0 -1
- package/common/src/assets/icons/svg/logininfor.svg +0 -1
- package/common/src/assets/icons/svg/mes-ad.svg +0 -21
- package/common/src/assets/icons/svg/mes-ic.svg +0 -16
- package/common/src/assets/icons/svg/mes-mfg-order.svg +0 -22
- package/common/src/assets/icons/svg/mes-tm.svg +0 -15
- package/common/src/assets/icons/svg/message.svg +0 -1
- package/common/src/assets/icons/svg/money.svg +0 -1
- package/common/src/assets/icons/svg/monitor.svg +0 -2
- package/common/src/assets/icons/svg/nacos.svg +0 -1
- package/common/src/assets/icons/svg/nested.svg +0 -1
- package/common/src/assets/icons/svg/number.svg +0 -1
- package/common/src/assets/icons/svg/online.svg +0 -1
- package/common/src/assets/icons/svg/password.svg +0 -1
- package/common/src/assets/icons/svg/pdf.svg +0 -1
- package/common/src/assets/icons/svg/people.svg +0 -1
- package/common/src/assets/icons/svg/peoples.svg +0 -1
- package/common/src/assets/icons/svg/phone.svg +0 -1
- package/common/src/assets/icons/svg/post.svg +0 -1
- package/common/src/assets/icons/svg/qq.svg +0 -1
- package/common/src/assets/icons/svg/question.svg +0 -1
- package/common/src/assets/icons/svg/radio.svg +0 -1
- package/common/src/assets/icons/svg/rate.svg +0 -1
- package/common/src/assets/icons/svg/row.svg +0 -1
- package/common/src/assets/icons/svg/search.svg +0 -1
- package/common/src/assets/icons/svg/select.svg +0 -1
- package/common/src/assets/icons/svg/sentinel.svg +0 -1
- package/common/src/assets/icons/svg/server.svg +0 -1
- package/common/src/assets/icons/svg/shop-call.svg +0 -14
- package/common/src/assets/icons/svg/shopping.svg +0 -1
- package/common/src/assets/icons/svg/size.svg +0 -1
- package/common/src/assets/icons/svg/skill.svg +0 -1
- package/common/src/assets/icons/svg/slider.svg +0 -1
- package/common/src/assets/icons/svg/star.svg +0 -1
- package/common/src/assets/icons/svg/stock-query.svg +0 -14
- package/common/src/assets/icons/svg/stock-report.svg +0 -14
- package/common/src/assets/icons/svg/stock-take.svg +0 -14
- package/common/src/assets/icons/svg/swagger.svg +0 -1
- package/common/src/assets/icons/svg/switch.svg +0 -1
- package/common/src/assets/icons/svg/system.svg +0 -2
- package/common/src/assets/icons/svg/tab.svg +0 -1
- package/common/src/assets/icons/svg/table.svg +0 -1
- package/common/src/assets/icons/svg/textarea.svg +0 -1
- package/common/src/assets/icons/svg/theme.svg +0 -1
- package/common/src/assets/icons/svg/time-range.svg +0 -1
- package/common/src/assets/icons/svg/time.svg +0 -1
- package/common/src/assets/icons/svg/tool.svg +0 -1
- package/common/src/assets/icons/svg/tree-table.svg +0 -1
- package/common/src/assets/icons/svg/tree.svg +0 -1
- package/common/src/assets/icons/svg/upload.svg +0 -1
- package/common/src/assets/icons/svg/user.svg +0 -1
- package/common/src/assets/icons/svg/validCode.svg +0 -1
- package/common/src/assets/icons/svg/wechat.svg +0 -1
- package/common/src/assets/icons/svg/xy-cancel.svg +0 -1
- package/common/src/assets/icons/svg/xy-choice.svg +0 -1
- package/common/src/assets/icons/svg/xy-choice2.svg +0 -31
- package/common/src/assets/icons/svg/zip.svg +0 -1
- package/common/src/assets/icons/svgo.yml +0 -22
- package/common/src/assets/images/dark.svg +0 -39
- package/common/src/assets/images/light.svg +0 -39
- package/common/src/assets/images/login-background.jpg +0 -0
- package/common/src/assets/images/logo.jpg +0 -0
- package/common/src/assets/images/profile.jpg +0 -0
- package/common/src/assets/images/xy-folder.png +0 -0
- package/common/src/assets/images/xy_email.png +0 -0
- package/common/src/assets/images/xy_message.png +0 -0
- package/common/src/assets/images/xy_notice.png +0 -0
- package/common/src/assets/logo/logo.png +0 -0
- package/common/src/assets/styles/btn.scss +0 -99
- package/common/src/assets/styles/element-ui.scss +0 -84
- package/common/src/assets/styles/element-variables.scss +0 -31
- package/common/src/assets/styles/index.scss +0 -207
- package/common/src/assets/styles/kezhi.scss +0 -100
- package/common/src/assets/styles/mixin.scss +0 -66
- package/common/src/assets/styles/ruoyi.scss +0 -350
- package/common/src/assets/styles/sidebar.scss +0 -185
- package/common/src/assets/styles/transition.scss +0 -48
- package/common/src/assets/styles/variables.scss +0 -52
- package/common/src/components/base/dialog/BaseDialog.vue +0 -140
- package/common/src/components/base/dialog/Dialog.js +0 -118
- package/common/src/components/base/dialog/dialogSetting.js +0 -65
- package/common/src/components/base/dialog/dialogType.js +0 -80
- package/common/src/components/base/dialog/index.js +0 -42
- package/common/src/components/base/dialog/printDialog.vue +0 -324
- package/common/src/components/base/dialog/tableDialog.vue +0 -187
- package/common/src/components/base/dialog/uploadDialog.vue +0 -149
- package/common/src/components/base/menuTab.js +0 -130
- package/common/src/components/basics/Breadcrumb/index.vue +0 -77
- package/common/src/components/basics/Crontab/day.vue +0 -179
- package/common/src/components/basics/Crontab/hour.vue +0 -122
- package/common/src/components/basics/Crontab/index.vue +0 -425
- package/common/src/components/basics/Crontab/min.vue +0 -120
- package/common/src/components/basics/Crontab/mouth.vue +0 -128
- package/common/src/components/basics/Crontab/result.vue +0 -566
- package/common/src/components/basics/Crontab/second.vue +0 -133
- package/common/src/components/basics/Crontab/week.vue +0 -167
- package/common/src/components/basics/Crontab/year.vue +0 -144
- package/common/src/components/basics/DictData/index.js +0 -24
- package/common/src/components/basics/DictTag/index.vue +0 -52
- package/common/src/components/basics/Editor/index.vue +0 -286
- package/common/src/components/basics/FileUpload/index.vue +0 -197
- package/common/src/components/basics/Hamburger/index.vue +0 -35
- package/common/src/components/basics/HeaderSearch/index.vue +0 -206
- package/common/src/components/basics/IconSelect/index.vue +0 -84
- package/common/src/components/basics/IconSelect/requireIcons.js +0 -10
- package/common/src/components/basics/Iframe/index.vue +0 -36
- package/common/src/components/basics/ImageUpload/index.vue +0 -204
- package/common/src/components/basics/Pagination/index.vue +0 -107
- package/common/src/components/basics/PanThumb/index.vue +0 -142
- package/common/src/components/basics/ParentView/index.vue +0 -3
- package/common/src/components/basics/RightPanel/index.vue +0 -149
- package/common/src/components/basics/RightToolbar/index.vue +0 -111
- package/common/src/components/basics/Screenfull/index.vue +0 -60
- package/common/src/components/basics/SizeSelect/index.vue +0 -60
- package/common/src/components/basics/SvgIcon/index.vue +0 -61
- package/common/src/components/basics/ThemePicker/index.vue +0 -183
- package/common/src/components/basics/TopNav/index.vue +0 -476
- package/common/src/components/custom/Editor/index.vue +0 -267
- package/common/src/components/custom/FileBox/index.vue +0 -293
- package/common/src/components/custom/FileBox/indexTs.vue +0 -280
- package/common/src/components/custom/ImageBox/index.vue +0 -208
- package/common/src/components/custom/Material/fileNameHelper.js +0 -38
- package/common/src/components/custom/Material/index.vue +0 -893
- package/common/src/components/custom/Material/indexTs.vue +0 -890
- package/common/src/components/custom/Notice/index.vue +0 -244
- package/common/src/plugins/auth.js +0 -60
- package/common/src/plugins/cache.js +0 -77
- package/common/src/plugins/download.js +0 -31
- package/common/src/plugins/index.js +0 -82
- package/common/src/plugins/modal.js +0 -75
- package/common/src/plugins/tab.js +0 -66
- package/common/src/utils/auth.js +0 -29
- package/common/src/utils/cache/bdCache.js +0 -202
- package/common/src/utils/cache/fdCache.js +0 -407
- package/common/src/utils/common.js +0 -141
- package/common/src/utils/dateHelper.js +0 -122
- package/common/src/utils/dialog.js +0 -35
- package/common/src/utils/dict/Dict.js +0 -82
- package/common/src/utils/dict/DictConverter.js +0 -17
- package/common/src/utils/dict/DictData.js +0 -13
- package/common/src/utils/dict/DictMeta.js +0 -38
- package/common/src/utils/dict/DictOptions.js +0 -51
- package/common/src/utils/dict/index.js +0 -33
- package/common/src/utils/element.js +0 -49
- package/common/src/utils/errorCode.js +0 -6
- package/common/src/utils/eventHub.js +0 -3
- package/common/src/utils/file.js +0 -38
- package/common/src/utils/index.js +0 -390
- package/common/src/utils/jsencrypt.js +0 -30
- package/common/src/utils/kezhi.js +0 -311
- package/common/src/utils/kezhiToolLibrary.js +0 -51
- package/common/src/utils/permission.js +0 -51
- package/common/src/utils/printService.js +0 -749
- package/common/src/utils/request.js +0 -209
- package/common/src/utils/ruoyi.js +0 -317
- package/common/src/utils/scroll-to.js +0 -58
- package/common/src/utils/supers.js +0 -25
- package/common/src/utils/utils.js +0 -614
- package/common/src/utils/validate.js +0 -105
- package/common/src/utils/websoketservice.js +0 -161
- package/common/src/utils/zipdownload.js +0 -42
- package/common/src/views/authorize.vue +0 -270
- package/common/src/views/error/401.vue +0 -88
- package/common/src/views/error/404.vue +0 -248
- package/common/src/views/login.vue +0 -350
- package/common/src/views/register.vue +0 -208
- package/common/src/views/sample/dialog/sampleEditDialog.vue +0 -279
- package/common/src/views/tenantLogin.vue +0 -331
- package/common/vue.config.js +0 -130
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import axios from "~../../axios";
|
|
2
|
-
import { Notification, MessageBox, Message } from "~../../element-ui";
|
|
3
|
-
import store from "~../../../src/store";
|
|
4
|
-
import { getToken } from "./auth";
|
|
5
|
-
import errorCode from "./errorCode";
|
|
6
|
-
import { tansParams } from "./ruoyi";
|
|
7
|
-
import moment from "moment-timezone";
|
|
8
|
-
import { getLoginUrl } from "../api/login";
|
|
9
|
-
import Vue from "vue";
|
|
10
|
-
let vm = new Vue();
|
|
11
|
-
axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
|
|
12
|
-
// 创建axios实例
|
|
13
|
-
const service = axios.create({
|
|
14
|
-
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
|
15
|
-
baseURL: process.env.VUE_APP_BASE_API,
|
|
16
|
-
// 超时
|
|
17
|
-
timeout: 30000,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// request拦截器
|
|
21
|
-
service.interceptors.request.use(
|
|
22
|
-
(config) => {
|
|
23
|
-
config.headers["TimeZone"] = moment.tz.guess();
|
|
24
|
-
// 是否需要设置 token
|
|
25
|
-
const isToken = (config.headers || {}).isToken === false;
|
|
26
|
-
if (getToken() && !isToken) {
|
|
27
|
-
config.headers["Authorization"] = "Bearer " + getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
|
|
28
|
-
}
|
|
29
|
-
// get请求映射params参数
|
|
30
|
-
if (config.method === "get" && config.params) {
|
|
31
|
-
let url =
|
|
32
|
-
config.url +
|
|
33
|
-
(config.url.indexOf("?") > -1 ? "&" : "?") +
|
|
34
|
-
tansParams(config.params);
|
|
35
|
-
url = url.slice(0, -1);
|
|
36
|
-
config.params = {};
|
|
37
|
-
config.url = url;
|
|
38
|
-
}
|
|
39
|
-
return config;
|
|
40
|
-
},
|
|
41
|
-
(error) => {
|
|
42
|
-
console.log(error);
|
|
43
|
-
Promise.reject(error);
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
function handleError(code, msg, res) {
|
|
48
|
-
if (code === 401) {
|
|
49
|
-
MessageBox.confirm(
|
|
50
|
-
"登录状态已过期,您可以继续留在该页面,或者重新登录",
|
|
51
|
-
"系统提示",
|
|
52
|
-
{
|
|
53
|
-
confirmButtonText: "重新登录",
|
|
54
|
-
cancelButtonText: "取消",
|
|
55
|
-
type: "warning",
|
|
56
|
-
}
|
|
57
|
-
)
|
|
58
|
-
.then(() => {
|
|
59
|
-
let res = JSON.parse(localStorage.getItem("configRes"));
|
|
60
|
-
if (res && res.sso && res.sso.enable) {
|
|
61
|
-
// location.href = "/authorize";
|
|
62
|
-
let appCode = res.sso.appCode;
|
|
63
|
-
let url = window.location.href;
|
|
64
|
-
localStorage.setItem("redirect_uri", url);
|
|
65
|
-
getLoginUrl({
|
|
66
|
-
app_code: appCode,
|
|
67
|
-
redirect_url: "http://localhost/authorize", // encodeURIComponent(url),
|
|
68
|
-
}).then((res) => {
|
|
69
|
-
// console.log(res);
|
|
70
|
-
if (res.success) {
|
|
71
|
-
location.href = res.data;
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
} else {
|
|
75
|
-
store.dispatch("LogOut").then(() => {
|
|
76
|
-
location.href = "/index";
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
})
|
|
80
|
-
.catch(() => {});
|
|
81
|
-
return Promise.reject("令牌验证失败");
|
|
82
|
-
} else if (code === 500) {
|
|
83
|
-
Message({
|
|
84
|
-
message: msg,
|
|
85
|
-
type: "error",
|
|
86
|
-
duration: 6000,
|
|
87
|
-
});
|
|
88
|
-
return Promise.reject("error");
|
|
89
|
-
} else if (code >= 300) {
|
|
90
|
-
Notification.error({
|
|
91
|
-
title: msg,
|
|
92
|
-
duration: 6000,
|
|
93
|
-
});
|
|
94
|
-
return Promise.reject("error");
|
|
95
|
-
} else {
|
|
96
|
-
return res.data;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// 响应拦截器
|
|
101
|
-
service.interceptors.response.use(
|
|
102
|
-
(res) => {
|
|
103
|
-
// 未设置状态码则默认成功状态
|
|
104
|
-
const code = res.data.code || 200;
|
|
105
|
-
// 获取错误信息
|
|
106
|
-
const msg =
|
|
107
|
-
errorCode[code] || res.msg || res.data.msg || errorCode["default"];
|
|
108
|
-
return handleError(code, msg, res);
|
|
109
|
-
},
|
|
110
|
-
(error) => {
|
|
111
|
-
console.log("err" + error);
|
|
112
|
-
let { message } = error;
|
|
113
|
-
var isSystemError = false;
|
|
114
|
-
if (message == "Network Error") {
|
|
115
|
-
message = "后端接口连接异常";
|
|
116
|
-
isSystemError = true;
|
|
117
|
-
} else if (message.includes("timeout")) {
|
|
118
|
-
message = "系统接口请求超时";
|
|
119
|
-
isSystemError = true;
|
|
120
|
-
}
|
|
121
|
-
// else if (message.includes("Request failed with status code")) {
|
|
122
|
-
// message = "系统接口" + message.substr(message.length - 3) + "异常";
|
|
123
|
-
// isSystemError = true;
|
|
124
|
-
// }
|
|
125
|
-
if (isSystemError) {
|
|
126
|
-
Message({
|
|
127
|
-
message: message,
|
|
128
|
-
type: "error",
|
|
129
|
-
duration: 6 * 1000,
|
|
130
|
-
});
|
|
131
|
-
return Promise.reject(error);
|
|
132
|
-
} else {
|
|
133
|
-
const code = error.response.status;
|
|
134
|
-
const msg =
|
|
135
|
-
errorCode[code] || error.response.data.msg || errorCode["default"];
|
|
136
|
-
if (error.response.data.data) msg = error.response.data.data.msg;
|
|
137
|
-
return handleError(code, msg, error.response);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
// 通用下载方法
|
|
143
|
-
export function download(url, params, filename) {
|
|
144
|
-
return service
|
|
145
|
-
.post(url, params, {
|
|
146
|
-
transformRequest: [
|
|
147
|
-
(params) => {
|
|
148
|
-
return tansParams(params);
|
|
149
|
-
},
|
|
150
|
-
],
|
|
151
|
-
headers: {
|
|
152
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
153
|
-
},
|
|
154
|
-
responseType: "blob",
|
|
155
|
-
})
|
|
156
|
-
.then((data) => {
|
|
157
|
-
const content = data;
|
|
158
|
-
const blob = new Blob([content]);
|
|
159
|
-
if ("download" in document.createElement("a")) {
|
|
160
|
-
const elink = document.createElement("a");
|
|
161
|
-
elink.download = filename;
|
|
162
|
-
elink.style.display = "none";
|
|
163
|
-
elink.href = URL.createObjectURL(blob);
|
|
164
|
-
document.body.appendChild(elink);
|
|
165
|
-
elink.click();
|
|
166
|
-
URL.revokeObjectURL(elink.href);
|
|
167
|
-
document.body.removeChild(elink);
|
|
168
|
-
} else {
|
|
169
|
-
navigator.msSaveBlob(blob, filename);
|
|
170
|
-
}
|
|
171
|
-
})
|
|
172
|
-
.catch((r) => {
|
|
173
|
-
console.error(r);
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// 通用下载方法
|
|
178
|
-
export function downloadUI(url, params, filename) {
|
|
179
|
-
this.axios
|
|
180
|
-
.get(url, params, {
|
|
181
|
-
transformRequest: [
|
|
182
|
-
(params) => {
|
|
183
|
-
return tansParams(params);
|
|
184
|
-
},
|
|
185
|
-
],
|
|
186
|
-
headers: {
|
|
187
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
188
|
-
},
|
|
189
|
-
responseType: "blob",
|
|
190
|
-
})
|
|
191
|
-
.then((data) => {
|
|
192
|
-
const content = data;
|
|
193
|
-
const blob = new Blob([content]);
|
|
194
|
-
if ("download" in document.createElement("a")) {
|
|
195
|
-
const elink = document.createElement("a");
|
|
196
|
-
elink.download = filename;
|
|
197
|
-
elink.style.display = "none";
|
|
198
|
-
elink.href = URL.createObjectURL(blob);
|
|
199
|
-
document.body.appendChild(elink);
|
|
200
|
-
elink.click();
|
|
201
|
-
URL.revokeObjectURL(elink.href);
|
|
202
|
-
document.body.removeChild(elink);
|
|
203
|
-
} else {
|
|
204
|
-
navigator.msSaveBlob(blob, filename);
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export default service;
|
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 通用js方法封装处理
|
|
3
|
-
* Copyright (c) 2019 ruoyi
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// 日期格式化
|
|
7
|
-
export function parseTime(time, pattern) {
|
|
8
|
-
if (arguments.length === 0 || !time) {
|
|
9
|
-
return null
|
|
10
|
-
}
|
|
11
|
-
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
|
|
12
|
-
let date
|
|
13
|
-
if (typeof time === 'object') {
|
|
14
|
-
date = time
|
|
15
|
-
} else {
|
|
16
|
-
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
|
17
|
-
time = parseInt(time)
|
|
18
|
-
} else if (typeof time === 'string') {
|
|
19
|
-
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm), '');
|
|
20
|
-
}
|
|
21
|
-
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
|
22
|
-
time = time * 1000
|
|
23
|
-
}
|
|
24
|
-
date = new Date(time)
|
|
25
|
-
}
|
|
26
|
-
const formatObj = {
|
|
27
|
-
y: date.getFullYear(),
|
|
28
|
-
m: date.getMonth() + 1,
|
|
29
|
-
d: date.getDate(),
|
|
30
|
-
h: date.getHours(),
|
|
31
|
-
i: date.getMinutes(),
|
|
32
|
-
s: date.getSeconds(),
|
|
33
|
-
a: date.getDay()
|
|
34
|
-
}
|
|
35
|
-
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
|
36
|
-
let value = formatObj[key]
|
|
37
|
-
// Note: getDay() returns 0 on Sunday
|
|
38
|
-
if (key === 'a') {
|
|
39
|
-
return ['日', '一', '二', '三', '四', '五', '六'][value]
|
|
40
|
-
}
|
|
41
|
-
if (result.length > 0 && value < 10) {
|
|
42
|
-
value = '0' + value
|
|
43
|
-
}
|
|
44
|
-
return value || 0
|
|
45
|
-
})
|
|
46
|
-
return time_str
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// 表单重置
|
|
50
|
-
export function resetForm(refName, index) {
|
|
51
|
-
if (this.$refs[refName]) {
|
|
52
|
-
//ref有多项则根据下标取对应dom
|
|
53
|
-
if (index != undefined) {
|
|
54
|
-
this.$refs[refName][index].resetFields()
|
|
55
|
-
return
|
|
56
|
-
} else {
|
|
57
|
-
this.$refs[refName].resetFields()
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// 添加日期范围
|
|
63
|
-
export function addDateRange(params, dateRange, propName) {
|
|
64
|
-
let search = params;
|
|
65
|
-
search.params = typeof(search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {};
|
|
66
|
-
dateRange = Array.isArray(dateRange) ? dateRange : [];
|
|
67
|
-
if (typeof(propName) === 'undefined') {
|
|
68
|
-
search.params['beginTime'] = dateRange[0];
|
|
69
|
-
search.params['endTime'] = dateRange[1];
|
|
70
|
-
} else {
|
|
71
|
-
search.params['begin' + propName] = dateRange[0];
|
|
72
|
-
search.params['end' + propName] = dateRange[1];
|
|
73
|
-
}
|
|
74
|
-
return search;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
// 回显数据字典
|
|
80
|
-
export function selectDictLabel(datas, value) {
|
|
81
|
-
var actions = []
|
|
82
|
-
Object.keys(datas).some((key) => {
|
|
83
|
-
if (datas[key].dictValue == ('' + value)) {
|
|
84
|
-
actions.push(datas[key].dictLabel)
|
|
85
|
-
return true
|
|
86
|
-
}
|
|
87
|
-
})
|
|
88
|
-
return actions.join('')
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// 回显数据字典(字符串数组)
|
|
92
|
-
export function selectDictLabels(datas, value, separator) {
|
|
93
|
-
var actions = []
|
|
94
|
-
var currentSeparator = undefined === separator ? "," : separator
|
|
95
|
-
var temp = value.split(currentSeparator)
|
|
96
|
-
Object.keys(value.split(currentSeparator)).some((val) => {
|
|
97
|
-
Object.keys(datas).some((key) => {
|
|
98
|
-
if (datas[key].dictValue == ('' + temp[val])) {
|
|
99
|
-
actions.push(datas[key].dictLabel + currentSeparator)
|
|
100
|
-
}
|
|
101
|
-
})
|
|
102
|
-
})
|
|
103
|
-
return actions.join('').substring(0, actions.join('').length - 1)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
//// 回显数据字典
|
|
107
|
-
//export function selectDictLabel(datas, value) {
|
|
108
|
-
// var actions = [];
|
|
109
|
-
// Object.keys(datas).some((key) => {
|
|
110
|
-
// if (datas[key].value == ('' + value)) {
|
|
111
|
-
// actions.push(datas[key].label);
|
|
112
|
-
// return true;
|
|
113
|
-
// }
|
|
114
|
-
// })
|
|
115
|
-
// return actions.join('');
|
|
116
|
-
//}
|
|
117
|
-
|
|
118
|
-
//// 回显数据字典(字符串数组)
|
|
119
|
-
//export function selectDictLabels(datas, value, separator) {
|
|
120
|
-
// var actions = [];
|
|
121
|
-
// var currentSeparator = undefined === separator ? "," : separator;
|
|
122
|
-
// var temp = value.split(currentSeparator);
|
|
123
|
-
// Object.keys(value.split(currentSeparator)).some((val) => {
|
|
124
|
-
// Object.keys(datas).some((key) => {
|
|
125
|
-
// if (datas[key].value == ('' + temp[val])) {
|
|
126
|
-
// actions.push(datas[key].label + currentSeparator);
|
|
127
|
-
// }
|
|
128
|
-
// })
|
|
129
|
-
// })
|
|
130
|
-
// return actions.join('').substring(0, actions.join('').length - 1);
|
|
131
|
-
//}
|
|
132
|
-
|
|
133
|
-
// 字符串格式化(%s )
|
|
134
|
-
export function sprintf(str) {
|
|
135
|
-
var args = arguments,
|
|
136
|
-
flag = true,
|
|
137
|
-
i = 1;
|
|
138
|
-
str = str.replace(/%s/g, function() {
|
|
139
|
-
var arg = args[i++];
|
|
140
|
-
if (typeof arg === 'undefined') {
|
|
141
|
-
flag = false;
|
|
142
|
-
return '';
|
|
143
|
-
}
|
|
144
|
-
return arg;
|
|
145
|
-
});
|
|
146
|
-
return flag ? str : '';
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// 转换字符串,undefined,null等转化为""
|
|
150
|
-
export function praseStrEmpty(str) {
|
|
151
|
-
if (!str || str == "undefined" || str == "null") {
|
|
152
|
-
return "";
|
|
153
|
-
}
|
|
154
|
-
return str;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// 数据合并
|
|
158
|
-
export function mergeRecursive(source, target) {
|
|
159
|
-
for (var p in target) {
|
|
160
|
-
try {
|
|
161
|
-
if (target[p].constructor == Object) {
|
|
162
|
-
source[p] = mergeRecursive(source[p], target[p]);
|
|
163
|
-
} else {
|
|
164
|
-
source[p] = target[p];
|
|
165
|
-
}
|
|
166
|
-
} catch (e) {
|
|
167
|
-
source[p] = target[p];
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return source;
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* 构造树型结构数据
|
|
175
|
-
* @param {*} data 数据源
|
|
176
|
-
* @param {*} id id字段 默认 'id'
|
|
177
|
-
* @param {*} parentId 父节点字段 默认 'parentId'
|
|
178
|
-
* @param {*} children 孩子节点字段 默认 'children'
|
|
179
|
-
*/
|
|
180
|
-
export function handleTree(data, id, parentId, children) {
|
|
181
|
-
let config = {
|
|
182
|
-
id: id || 'id',
|
|
183
|
-
parentId: parentId || 'parentId',
|
|
184
|
-
childrenList: children || 'children'
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
var childrenListMap = {};
|
|
188
|
-
var nodeIds = {};
|
|
189
|
-
var tree = [];
|
|
190
|
-
|
|
191
|
-
for (let d of data) {
|
|
192
|
-
let parentId = d[config.parentId];
|
|
193
|
-
if (childrenListMap[parentId] == null) {
|
|
194
|
-
childrenListMap[parentId] = [];
|
|
195
|
-
}
|
|
196
|
-
nodeIds[d[config.id]] = d;
|
|
197
|
-
childrenListMap[parentId].push(d);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
for (let d of data) {
|
|
201
|
-
let parentId = d[config.parentId];
|
|
202
|
-
if (nodeIds[parentId] == null) {
|
|
203
|
-
tree.push(d);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
for (let t of tree) {
|
|
208
|
-
adaptToChildrenList(t);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
function adaptToChildrenList(o) {
|
|
212
|
-
if (childrenListMap[o[config.id]] !== null) {
|
|
213
|
-
o[config.childrenList] = childrenListMap[o[config.id]];
|
|
214
|
-
}
|
|
215
|
-
if (o[config.childrenList]) {
|
|
216
|
-
for (let c of o[config.childrenList]) {
|
|
217
|
-
adaptToChildrenList(c);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
return tree;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* 参数处理
|
|
226
|
-
* @param {*} params 参数
|
|
227
|
-
*/
|
|
228
|
-
export function tansParams(params) {
|
|
229
|
-
return setQueryParameters(params, "");
|
|
230
|
-
// let result = ''
|
|
231
|
-
// for (const propName of Object.keys(params)) {
|
|
232
|
-
// const value = params[propName];
|
|
233
|
-
// var part = encodeURIComponent(propName) + "=";
|
|
234
|
-
// if (value !== null && typeof(value) !== "undefined") {
|
|
235
|
-
// if (typeof value === 'object') {
|
|
236
|
-
// for (const key of Object.keys(value)) {
|
|
237
|
-
// if (value[key] !== null && typeof(value[key]) !== 'undefined') {
|
|
238
|
-
// let params = propName + '[' + key + ']';
|
|
239
|
-
// var subPart = encodeURIComponent(params) + "=";
|
|
240
|
-
// result += subPart + encodeURIComponent(value[key]) + "&";
|
|
241
|
-
// }
|
|
242
|
-
// }
|
|
243
|
-
// } else {
|
|
244
|
-
// result += part + encodeURIComponent(value) + "&";
|
|
245
|
-
// }
|
|
246
|
-
// }
|
|
247
|
-
// }
|
|
248
|
-
// return result
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
export function transHashMap(params, prefix){
|
|
253
|
-
let result = ''
|
|
254
|
-
for (let propName of Object.keys(params)) {
|
|
255
|
-
const value = params[propName];
|
|
256
|
-
if(prefix) propName = prefix + '[' + propName + ']';
|
|
257
|
-
var part = encodeURIComponent(propName) + "=";
|
|
258
|
-
if (value !== null && typeof(value) !== "undefined") {
|
|
259
|
-
if (typeof value === 'object') {
|
|
260
|
-
for (const key of Object.keys(value)) {
|
|
261
|
-
if (value[key] !== null && typeof(value[key]) !== 'undefined') {
|
|
262
|
-
let params = propName + '[' + key + ']';
|
|
263
|
-
var subPart = encodeURIComponent(params) + "=";
|
|
264
|
-
result += subPart + encodeURIComponent(value[key]) + "&";
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
} else {
|
|
268
|
-
result += part + encodeURIComponent(value) + "&";
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
return result
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
export function setQueryParameters(params, prefix) {
|
|
277
|
-
let url = '';
|
|
278
|
-
for (var key in params) {
|
|
279
|
-
if (params[key] == undefined || params[key] == null || typeof params[key] == "function" || key == "setting") {
|
|
280
|
-
continue;
|
|
281
|
-
} else if (params[key] && params[key].constructor === Array) {
|
|
282
|
-
let i = 0;
|
|
283
|
-
for (let item of params[key]) {
|
|
284
|
-
if (item.toString() === "[object Object]") {
|
|
285
|
-
if (item["isSumRow"] == true) continue;
|
|
286
|
-
url += setQueryParameters(params[key][i], `${(prefix ? prefix + '.' + key : key)}%5B${i}%5D`);
|
|
287
|
-
}
|
|
288
|
-
else {
|
|
289
|
-
url += `${(prefix ? prefix + '.' + key : key)}%5B${i}%5D` + "=" + encodeURIComponent("" + item) + "&";
|
|
290
|
-
}
|
|
291
|
-
i++;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
else if (params[key].constructor === Date) {
|
|
295
|
-
url += (prefix ? prefix + '.' + key : key) + "=" + params[key].toUTCString() + "&";
|
|
296
|
-
}
|
|
297
|
-
else if (params[key].toString() === "[object Object]") {
|
|
298
|
-
if(key == "params"){
|
|
299
|
-
url += transHashMap(params[key], "params");
|
|
300
|
-
}
|
|
301
|
-
else url += setQueryParameters(params[key], key);
|
|
302
|
-
}
|
|
303
|
-
else url += (prefix ? prefix + '.' + key : key) + "=" + encodeURIComponent("" + params[key]) + "&";
|
|
304
|
-
}
|
|
305
|
-
return url;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// 验证是否为blob格式
|
|
309
|
-
export async function blobValidate(data) {
|
|
310
|
-
try {
|
|
311
|
-
const text = await data.text();
|
|
312
|
-
JSON.parse(text);
|
|
313
|
-
return false;
|
|
314
|
-
} catch (error) {
|
|
315
|
-
return true;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
Math.easeInOutQuad = function(t, b, c, d) {
|
|
2
|
-
t /= d / 2
|
|
3
|
-
if (t < 1) {
|
|
4
|
-
return c / 2 * t * t + b
|
|
5
|
-
}
|
|
6
|
-
t--
|
|
7
|
-
return -c / 2 * (t * (t - 2) - 1) + b
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts
|
|
11
|
-
var requestAnimFrame = (function() {
|
|
12
|
-
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) }
|
|
13
|
-
})()
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Because it's so fucking difficult to detect the scrolling element, just move them all
|
|
17
|
-
* @param {number} amount
|
|
18
|
-
*/
|
|
19
|
-
function move(amount) {
|
|
20
|
-
document.documentElement.scrollTop = amount
|
|
21
|
-
document.body.parentNode.scrollTop = amount
|
|
22
|
-
document.body.scrollTop = amount
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function position() {
|
|
26
|
-
return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @param {number} to
|
|
31
|
-
* @param {number} duration
|
|
32
|
-
* @param {Function} callback
|
|
33
|
-
*/
|
|
34
|
-
export function scrollTo(to, duration, callback) {
|
|
35
|
-
const start = position()
|
|
36
|
-
const change = to - start
|
|
37
|
-
const increment = 20
|
|
38
|
-
let currentTime = 0
|
|
39
|
-
duration = (typeof (duration) === 'undefined') ? 500 : duration
|
|
40
|
-
var animateScroll = function() {
|
|
41
|
-
// increment the time
|
|
42
|
-
currentTime += increment
|
|
43
|
-
// find the value with the quadratic in-out easing function
|
|
44
|
-
var val = Math.easeInOutQuad(currentTime, start, change, duration)
|
|
45
|
-
// move the document.body
|
|
46
|
-
move(val)
|
|
47
|
-
// do the animation unless its over
|
|
48
|
-
if (currentTime < duration) {
|
|
49
|
-
requestAnimFrame(animateScroll)
|
|
50
|
-
} else {
|
|
51
|
-
if (callback && typeof (callback) === 'function') {
|
|
52
|
-
// the animation is done so lets callback
|
|
53
|
-
callback()
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
animateScroll()
|
|
58
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export function supers(baseClass, method,arrayList) {
|
|
2
|
-
|
|
3
|
-
const tempFunc = function() {};
|
|
4
|
-
const tempPrototy = Object.setPrototypeOf(tempFunc, baseClass);
|
|
5
|
-
let prop;
|
|
6
|
-
try {
|
|
7
|
-
prop = Object.getPrototypeOf(tempPrototy).extendOptions.methods[method];
|
|
8
|
-
} catch (error) {
|
|
9
|
-
console.error(`[supers]转换错误!`, error);
|
|
10
|
-
}
|
|
11
|
-
if(!prop){
|
|
12
|
-
prop=Object.getPrototypeOf(tempPrototy).prototype.__proto__.constructor.extendOptions.methods[method]
|
|
13
|
-
}
|
|
14
|
-
if (prop) {
|
|
15
|
-
if (_.isFunction(prop)) {
|
|
16
|
-
let list=[]
|
|
17
|
-
arrayList&&arrayList.forEach(item => {
|
|
18
|
-
list.push(item)
|
|
19
|
-
});
|
|
20
|
-
return prop.call(this,...list);
|
|
21
|
-
} else {
|
|
22
|
-
console.error(`[supers]参数错误!${method}不是一个函数!`);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|