Commit 049098d8 authored by mingsoft's avatar mingsoft
Browse files

5.2.5版本更新

parent 6135f0ec
!function(e,t){"function"==typeof define&&define.amd?define("element/locale/zh-CN",["module","exports"],t):"undefined"!=typeof exports?t(module,exports):(t(t={exports:{}},t.exports),e.ELEMENT.lang=e.ELEMENT.lang||{},e.ELEMENT.lang.zhCN=t.exports)}(this,function(e,t){"use strict";t.__esModule=!0,t.default={el:{colorpicker:{confirm:"确定",clear:"清空"},datepicker:{now:"此刻",today:"今天",cancel:"取消",clear:"清空",confirm:"确定",selectDate:"选择日期",selectTime:"选择时间",startDate:"开始日期",startTime:"开始时间",endDate:"结束日期",endTime:"结束时间",prevYear:"前一年",nextYear:"后一年",prevMonth:"上个月",nextMonth:"下个月",year:"",month1:"1 月",month2:"2 月",month3:"3 月",month4:"4 月",month5:"5 月",month6:"6 月",month7:"7 月",month8:"8 月",month9:"9 月",month10:"10 月",month11:"11 月",month12:"12 月",weeks:{sun:"",mon:"",tue:"",wed:"",thu:"",fri:"",sat:""},months:{jan:"一月",feb:"二月",mar:"三月",apr:"四月",may:"五月",jun:"六月",jul:"七月",aug:"八月",sep:"九月",oct:"十月",nov:"十一月",dec:"十二月"}},select:{loading:"加载中",noMatch:"无匹配数据",noData:"无数据",placeholder:"请选择"},cascader:{noMatch:"无匹配数据",loading:"加载中",placeholder:"请选择",noData:"暂无数据"},pagination:{goto:"前往",pagesize:"条/页",total:"共 {total} 条",pageClassifier:""},messagebox:{title:"提示",confirm:"确定",cancel:"取消",error:"输入的数据不合法!"},upload:{deleteTip:"按 delete 键可删除",delete:"删除",preview:"查看图片",continue:"继续上传"},table:{emptyText:"暂无数据",confirmFilter:"筛选",resetFilter:"重置",clearFilter:"全部",sumText:"合计"},tree:{emptyText:"暂无数据"},transfer:{noMatch:"无匹配数据",noData:"无数据",titles:["列表 1","列表 2"],filterPlaceholder:"请输入搜索内容",noCheckedFormat:"共 {total} 项",hasCheckedFormat:"已选 {checked}/{total} 项"},image:{error:"加载失败"},pageHeader:{title:"返回"},popconfirm:{confirmButtonText:"确定",cancelButtonText:"取消"}}},e.exports=t.default});
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
* 兼容ie 重写合并js对象方法
* 在ie浏览器中使用es6 语法"Object.assign()"合并对象报错,可以引用该js
*/
if (typeof Object.assign != 'function') {
Object.assign = function(target) {
'use strict';
if (target == null) {
throw new TypeError('Cannot convert undefined or null to object');
}
target = Object(target);
for (var index = 1; index < arguments.length; index++) {
var source = arguments[index];
if (source != null) {
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
}
return target;
};
}
/**
* 字典
* 初始化:ms.dict.list("A类型,B类型,C类型","子业务类型")
* 获取值:ms.dict.getDictValue("A类型标签") ;ms.dict.getDictValue("C类型标签",3)
* 获取值:ms.dict.getDictLabel("B类型值",2)
*/
(function() {
var dictData;
/**
* 获取所有字典类型的数组集合
* @param dictType 字典类型 支持多个类型用英文逗号隔开
* @param isChild 子业务类型 可选
*/
function list(dictType,isChild) {
var _dict={
dictType:dictType,
isChild:isChild,
}
ms.http.get(ms.manager+'/mdiy/dict/dictList.do', _dict).then(function (res) {
if(res.code==200){
dict.dictData = res.data;
}
}).catch(function (err) {
console.log(err);
});
}
function get(index, dictLabel, dictValue,isChild){
var dicts= (dict.dictData?dict.dictData[index-1]:[]).filter(function(element,index,self){
if(dictLabel&&dictLabel!=element.dictLabel){
return false
}else if(dictValue&&dictValue!=element.dictValue){
return false
}
return true
})
if(dicts.length){
return dicts[0];
}else {
return null;
}
}
/**
* 获取字典列表
* @param index list方法中dictType的索引值 从1开始
* @returns {*}
*/
function getList(index){
if(index){
return dict.dictData[0]
}else {
return dict.dictData[index-1]
}
}
/**
* 获取字典值
* @param dictLabel 字典标签值
* @param index list方法中dictType的索引值 从1开始
* @param defaultValue 默认值
* @returns {string|string|rules.dictValue|{message, required}}
*/
function getDictValue( dictLabel, index, defaultValue) {
if (!defaultValue) {
defaultValue="";
}
var dictEntity = ''
if (index && dictLabel) {
dictEntity = get(index, dictLabel, null);
}
if (!index && dictLabel) {
dictEntity = get(1, dictLabel, null);
}
if(dictEntity){
return dictEntity.dictValue;
}
return defaultValue;
}
/**
* 获取字典标签
* @param dictValue 字典值
* @param index list方法中dictType的索引值 从1开始
* @param defaultValue 默认值
* @returns {string|string|rules.dictLabel|{message, required}|data.mdiyFormRule.dictLabel|{trigger, message, required}}
*/
function getDictLabel( dictValue, index, defaultValue) {
if (!defaultValue) {
defaultValue = "";
}
var dictEntity = ''
if(!index && dictValue){
dictEntity = get(1,"", dictValue, null);
}
if (index && dictValue) {
dictEntity = get(index,"", dictValue, null);
}
if(dictEntity){
return dictEntity.dictLabel;
}
return defaultValue;
}
var dict = {
list: list,
dictData: dictData,
getList:getList,
getDictValue:getDictValue,
getDictLabel:getDictLabel,
}
if (typeof ms != "object") {
window.ms = {};
}
window.ms.dict = dict;
}());
/**
* 封装http请求
*/
(function () {
axios.defaults.timeout = 1000 * 60;
axios.defaults.baseURL = '';
//http request 拦截器
axios.interceptors.request.use(
function (config) {
config.headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'Cache-Control': 'no-cache',
'Pragma': 'no-cache',
'X-Requested-With': 'XMLHttpRequest'
}
if (config.method === 'post' && config.headers["Content-Type"] === "application/x-www-form-urlencoded") {
config.data = Qs.stringify(config.data, {
allowDots: true
});
}
return config;
},
function (error) {
return Promise.reject(error);
}
);
//http response 拦截器
axios.interceptors.response.use(
function (response) {
return response;
},
function (error) {
if (error.response) {
let msg;
if (error.response.status == 401) {
msg = "登录失败";
} else if (error.response.status == 400) {
msg = "客户端错误";
} else if (error.response.status == 403) {
msg = "您的权限不足";
} else if (error.response.status == 423) {
msg = "账号被锁定!";
} else if (error.response.status == 500) {
msg = "服务器异常";
} else if (error.response.status == 501) {
msg = "您的操作被取消或不允许提交";
} else if (error.response.status == 423) {
msg = "服务器正在开小差....";
}
if(error.response.data && error.response.data.msg) {
msg = error.response.data.msg;
}
if (msg && error.response.status != 404) {
var tempVue = document.createElement('div');
tempVue.id = "tempVue";
document.body.appendChild(tempVue)
new Vue({el: '#tempVue',}).$notify.error({
title: '错误',
message: msg,
type: 'warning'
});
if (error.response.status == 401) {
window.location.reload();
}
document.body.removeChild(tempVue);
}
}
return Promise.reject(error)
}
)
function ajax(conf) {
if (conf != undefined) {
var _axios = axios.create({
baseURL: conf.baseURL == undefined ? axios.defaults.baseURL : conf.baseURL,
timeout: conf.timeout == undefined ? axios.defaults.timeout : conf.timeout,
headers: conf.headers == undefined ? null : conf.headers,
});
_axios.interceptors.request.use(
function (config) {
if (config.method === 'post' && config.headers["Content-Type"] === "application/x-www-form-urlencoded") {
config.data = Qs.stringify(config.data, {
allowDots: true
});
}
return config;
},
function (error) {
return Promise.reject(error);
}
);
return _axios;
}
return axios;
}
/**
* 封装get方法
* @param url
* @param data
* @returns {Promise}
*/
function get(url, params) {
if (params == undefined) {
params = {}
}
return new Promise(function (resolve, reject) {
ajax().get(url, {
params: params
})
.then(function (response) {
resolve(response.data);
})
.catch(function (err) {
reject(err)
})
})
}
/**
* 封装post请求
* @param url
* @param data
* @returns {Promise}
*/
function post(url, data, conf) {
if (data == undefined) {
data = {}
}
return new Promise(function (resolve, reject) {
ajax(conf).post(url, data, conf)
.then(function (response) {
resolve(response.data);
}, function (err) {
reject(err)
})
})
}
/**
* 封装patch请求
* @param url
* @param data
* @returns {Promise}
*/
function patch(url, data, conf) {
if (data == undefined) {
data = {}
}
return new Promise(function (resolve, reject) {
ajax(conf).patch(url, data, conf)
.then(function (response) {
resolve(response);
}, function (err) {
reject(err)
})
})
}
/**
* 封装put请求
* @param url
* @param data
* @returns {Promise}
*/
function put(url, data, conf) {
if (data == undefined) {
data = {}
}
return new Promise(function (resolve, reject) {
ajax(conf).put(url, data, conf)
.then(function (response) {
resolve(response.data);
}, function (err) {
reject(err)
})
})
}
/**
* 下载资源
* @param url
* @param data
* @returns {Promise}
*/
function download(url, data) {
if (data == undefined) {
data = {}
}
return new Promise(function (resolve, reject) {
axios({
method: 'post',
// 请求地址
url: url,
// 参数
data: data,
// 表明返回服务器返回的数据类型
responseType: 'blob',
headers: {Accept: 'application/vnd.openxmlformats-officedocument'}
}).then((res) => { // 处理返回的文件流
const content = res.data
const blob = new Blob([content])
const fileName = res.headers["filename"];
if ('download' in document.createElement('a')) { // 非IE下载
const elink = document.createElement('a')
elink.download = fileName
elink.style.display = 'none'
elink.href = URL.createObjectURL(blob)
document.body.appendChild(elink)
elink.click()
URL.revokeObjectURL(elink.href) // 释放URL 对象
document.body.removeChild(elink)
} else { // IE10+下载
navigator.msSaveBlob(blob, fileName)
}
resolve(res);
}, function (err) {
reject(err)
})
})
}
var http = {
get: get,
post: post,
put: put,
patch: patch,
download: download
}
if (typeof ms != "object") {
window.ms = {};
}
window.ms.http = http;
window.ms.isLoginRedirect = true;
}());
/**
* 基础变量定义
*/
(function(window) {
var ms = {
base: null, //主机地址
login:"/login.htm", //登录页面
debug:true, //测试模式
log:function(msg) {
console.log(msg);
}
}
window.ms = ms;
})(window);
\ 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