@ -0,0 +1,796 @@ |
||||
<!-- 主页 --> |
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<title>造价管理系统</title> |
||||
<#include '/include/head-file.ftl'/> |
||||
<script src="${base}/static/plugins/sockjs/1.4.0/sockjs.min.js"></script> |
||||
<script src="${base}/static/plugins/stomp/2.3.3/stomp.min.js"></script> |
||||
<style> |
||||
.to-ele { |
||||
font-size: 18px; |
||||
margin: -2px 9px 0px 3px |
||||
} |
||||
</style> |
||||
</head> |
||||
<body> |
||||
<#include "/reset-password.ftl"/> |
||||
<#include "/exit-system.ftl"/> |
||||
<div id="app" class="index" :class="theme"> |
||||
<el-container> |
||||
<!--左侧菜单--> |
||||
<el-aside class="ms-admin-menu-aside" v-cloak> |
||||
<el-scrollbar style="height:100%"> |
||||
<el-menu :default-active="asideMenuActive" class="el-menu-vertical-demo" |
||||
text-color="rgba(255,255,255,1)" active-text-color="rgba(255,255,255,1)" |
||||
:collapse="collapseMenu" :unique-opened='true' ref='menu' @open="asideMenuOpen"> |
||||
<div class="ms-admin-logo" :style="{display: 'flex','padding-left': (collapseMenu?'5px':'22px')}"> |
||||
<img :src="ms.base+'/static/ms-admin/5.0.0/images/logo.png'"/> |
||||
<div class="class-1" v-show="!collapseMenu"> |
||||
<div class="class-2">v</div> |
||||
2.0 |
||||
</div> |
||||
</div> |
||||
<el-submenu :popper-class="['ms-admin-menu-aside-submenu',theme]" :index="menu.modelId+''" |
||||
:data-index="menu.modelId+''" v-for="(menu,i) in asideMenuList" :key='i'> |
||||
<template slot="title"> |
||||
<i class='ms-admin-icon iconfont' :class="menu.modelIcon"></i> |
||||
<span>{{menu.modelTitle}}</span> |
||||
</template> |
||||
<!-- 子菜单 --> |
||||
<el-menu-item :index="sub.modelId+''" :data-index="sub.modelId" |
||||
v-for="(sub,index) in getSubMenu(menu.modelId)" |
||||
:key='sub.modelModelId' v-text="sub.modelTitle" |
||||
@click.self='open(sub)'></el-menu-item> |
||||
</el-submenu> |
||||
<!-- 收缩按钮 --> |
||||
</el-menu> |
||||
</el-scrollbar> |
||||
</el-aside> |
||||
<#--右侧内容--> |
||||
<el-container class="ms-admin-container" v-cloak> |
||||
<!--头部--> |
||||
<el-header class="ms-admin-header" v-cloak> |
||||
<#--展示合并菜单--> |
||||
<div class="ms-admin-header-menu-shrink" @click="collapseMenu = !collapseMenu"> |
||||
<i class="iconfont" :class="collapseMenu?'icon-liebiaoxiangyou':'icon-shousuo'"></i> |
||||
</div> |
||||
<!--头部menu--> |
||||
|
||||
|
||||
<el-menu menu-trigger="hover" class="ms-admin-header-menu" background-color="rgba(255,255,255,1)" |
||||
text-color="#333333" active-text-color="#409EFF" :default-active="headMenuActive" |
||||
mode="horizontal"> |
||||
<el-submenu style="height: 100%;"> |
||||
|
||||
<template slot="title"> |
||||
<i class="iconfont icon-gezi" style="font-size: 17px"></i> |
||||
<span>功能大全</span> |
||||
</template> |
||||
<div class="ms-admin-header-menu-all"> |
||||
<li class="ms-admin-header-menu-all-item" v-for="(item,index) of parentMenuList" |
||||
:key='index' @click='openMenu(item,index)'> |
||||
<i class="iconfont" :class="item.modelIcon" style="padding-right: 4px"></i> |
||||
<div style="width:80px">{{item.modelTitle}}</div> |
||||
<div style="float: right;width: 18px;"> |
||||
<template> |
||||
<i v-if="markList.find(function(x) { |
||||
return x.title == item.modelTitle |
||||
})!=undefined" @click="cancelMarkMenu(item.modelTitle)" |
||||
class='el-icon-star-on'></i> |
||||
<i v-else class='el-icon-star-off ' |
||||
@click="markMenu(item.modelTitle,item.modelIcon)"></i> |
||||
</template> |
||||
</div> |
||||
|
||||
</li> |
||||
</div> |
||||
</el-submenu> |
||||
</el-menu> |
||||
|
||||
|
||||
<!--头部右侧--> |
||||
<div class="ms-admin-mstore"> |
||||
<div class="ms-admin-mstore-menu-icon" style="padding-left:20px " @click="handleMessage"> |
||||
<el-badge :value="unreadTotal>0?unreadTotal:null" type="danger" class="item" style="z-index: 1"> |
||||
<i class="iconfont icon-lingdang" style="color: #909399;"></i> |
||||
</el-badge> |
||||
</div> |
||||
|
||||
<el-menu menu-trigger="hover" class="ms-admin-header-menu" background-color="rgba(255,255,255,1)" |
||||
text-color="#333333" active-text-color="#409EFF" |
||||
mode="horizontal"> |
||||
<el-submenu style="height: 100%;" popper-class="theme-select"> |
||||
<template slot="title"> |
||||
<i class="iconfont icon-pifu" style="font-size: 18px"></i> |
||||
</template> |
||||
<el-menu-item @click="handleCommand('ms-theme-light')" |
||||
style="display: flex;align-items: center"> |
||||
<div style="height: 18px;width: 18px;background-color: rgba(64,158,255,1);margin-right: 7px;border-radius: 2px;"></div> |
||||
<span>浅色系</span> |
||||
</el-menu-item> |
||||
<el-menu-item @click="handleCommand('ms-theme-dark')" |
||||
style="display: flex;align-items: center"> |
||||
<div style="height: 18px;width: 18px;background-color: rgba(56,58,63,1);margin-right: 7px;border-radius: 2px;"></div> |
||||
<span>深色系</span> |
||||
</el-menu-item> |
||||
</el-submenu> |
||||
</el-menu> |
||||
<#-- <el-dropdown trigger="hover" class="ms-admin-login" placement="top-start" |
||||
@visible-change="loginDown = !loginDown"> |
||||
<span class="el-dropdown-link"> |
||||
<div class="ms-admin-people-head" |
||||
v-text="peopleInfo.managerNickName && peopleInfo.managerNickName.substr(0, 1)"></div> |
||||
<span v-text='peopleInfo.managerNickName'></span> |
||||
</span> |
||||
<el-dropdown-menu class="ms-admin-login-down" slot="dropdown"> |
||||
<el-dropdown-item icon="iconfont icon-suo" @click.native='openModal(true)'>修改密码 |
||||
</el-dropdown-item> |
||||
<el-dropdown-item icon="iconfont icon-tuichu1" @click.native='openModal(false)'>退出 |
||||
</el-dropdown-item> |
||||
</el-dropdown-menu> |
||||
</el-dropdown>--> |
||||
<el-menu menu-trigger="hover" class="ms-admin-header-menu" background-color="rgba(255,255,255,1)" |
||||
text-color="#333333" active-text-color="#409EFF" |
||||
mode="horizontal"> |
||||
<el-submenu style="height: 100%;" popper-class="top-operate-select"> |
||||
<template slot="title"> |
||||
<span class="el-dropdown-link" style="display:flex;align-items: center;float: left"> |
||||
<div class="ms-admin-people-head adminhead" |
||||
v-text="peopleInfo.managerNickName && peopleInfo.managerNickName.substr(0, 1)"></div> |
||||
<span v-text='peopleInfo.managerNickName'></span> |
||||
</span> |
||||
</template> |
||||
<el-menu-item @click="openModal(true)" style="display: flex;align-items: center"> |
||||
<i class="iconfont icon-suo to-ele"></i> |
||||
<span>修改密码</span> |
||||
</el-menu-item> |
||||
<#-- <el-menu-item @click="subscribe" style="display: flex;align-items: center">--> |
||||
<#-- <i class="iconfont icon-erweimadenglu to-ele"></i>--> |
||||
<#-- <span>微信绑定</span>--> |
||||
<#-- </el-menu-item>--> |
||||
<el-menu-item @click="openModal(false)" style="display: flex;align-items: center"> |
||||
<i class="iconfont icon-tuichu1 to-ele"></i> |
||||
<span>退出</span> |
||||
</el-menu-item> |
||||
</el-submenu> |
||||
</el-menu> |
||||
|
||||
<#-- <!--mstore按钮–> |
||||
<div class="ms-admin-mstore-icon" @click="open(mstore)"> |
||||
<span v-if="mstore.syncNum>0" v-text="mstore.syncNum"></span> |
||||
<i style="line-height: 42px !important;font-size: 30px;" class="iconfont icon-fenxiang2"></i> |
||||
</div>--> |
||||
</div> |
||||
|
||||
</el-header> |
||||
<!--内容--> |
||||
<el-main class="ms-admin-main" > |
||||
<!--选项卡--> |
||||
<el-tabs class="ms-admin-tabs" v-model="currentTab" type="card" closable @tab-remove="closeTab" |
||||
@tab-click='tabClick'> |
||||
<el-tab-pane v-for="(item, index) in editableTabs" :key="index" :label="item.modelTitle" |
||||
:name="item.modelTitle" |
||||
:data-modelId='item.modelId' :data-modelModelId='item.modelModelId'> |
||||
<keep-alive> |
||||
<iframe :src='item.isStore?item.modelUrl:ms.manager+"/"+item.modelUrl+(item.modelUrl.indexOf("?")==-1?"?":"&")+"modelId="+item.modelId+"&modelCode="+item.modelCode+"&modelTitle="+encodeURI(item.modelTitle)' |
||||
:ref="item.modelTitle"></iframe> |
||||
</keep-alive> |
||||
</el-tab-pane> |
||||
</el-tabs> |
||||
</el-main> |
||||
</el-container> |
||||
</el-container> |
||||
</div> |
||||
</body> |
||||
|
||||
</html> |
||||
<script> |
||||
var indexVue = new Vue({ |
||||
el: "#app", |
||||
data: { |
||||
code: '', |
||||
menuList: [], //菜单接口数据 |
||||
asideMenuList: [], //侧边菜单 |
||||
parentMenuList: [], //一级菜单 |
||||
subMenuList: [], //二级菜单 所有 |
||||
unreadTotal: 0,//未读消息数量 |
||||
messageList: [],//消息列表 |
||||
mainParentMenuList: [], //头部菜单显示主要的选项 |
||||
loginDown: false, //登录下拉 |
||||
asideMenuActive: "", //左侧选中菜单 |
||||
headMenuActive: '', //头部菜单激活 |
||||
editableTabsValue: '', |
||||
messageTypeList: [], |
||||
editableTabs: [{"modelTitle": "工作台", "modelUrl": "main.do"}], //当前打开的tab页面 |
||||
shortcutMenu: false, //快捷菜单显示状态 |
||||
collapseMenu: false, //菜单折叠,false不折叠 |
||||
currentTab: '工作台', //当前激活tab的name |
||||
tabIndex: 1, |
||||
// markList: ['项目管理', '组织管理', '客户管理', '合同管理', '印章管理', '绩效管理', '权限管理', '系统设置'], |
||||
markList: [ |
||||
{title: "权限管理", icon: "icon-wode", hide: true}, |
||||
{title: "系统设置", icon: "icon-xitongguanli", hide: true}, |
||||
{title: "内容管理", icon: "icon-neirongguanli", hide: true}, |
||||
{title: "印章管理", icon: "icon-huizhang", hide: true}, |
||||
{title: "会员中心", icon: "icon-huiyuanzhongxin", hide: true}, |
||||
{title: "自定义管理", icon: "icon-zidingyiguanli", hide: true}, |
||||
], |
||||
//登录用户信息 |
||||
peopleInfo: { |
||||
managerName: '', //账号 |
||||
managerNickName: '', |
||||
}, |
||||
mstore: {}, |
||||
theme: 'ms-theme-light', |
||||
callbackFun: {}, |
||||
}, |
||||
computed: { |
||||
messageType: function (type) { |
||||
var that = this |
||||
return function (type) { |
||||
var dict = that.messageTypeList.find(function (x) { |
||||
return x.dictValue == type; |
||||
}); |
||||
if (dict) { |
||||
return dict.dictLabel; |
||||
} |
||||
return ''; |
||||
|
||||
} |
||||
} |
||||
}, |
||||
watch: { |
||||
menuList: function (n, o) { |
||||
var that = this; |
||||
n && n.forEach(function (item, index) { |
||||
item.modelModelId ? that.subMenuList.push(item) : that.parentMenuList.push(item) |
||||
}) |
||||
}, |
||||
parentMenuList: function (n, o) { |
||||
var that = this |
||||
this.mainParentMenuList = n.slice(0, 5); |
||||
this.asideMenuList = n.filter(function (f) { |
||||
return that.markList.find( |
||||
function (x) { |
||||
return x.title == f['modelTitle'] |
||||
}) != undefined |
||||
}) |
||||
}, |
||||
editableTabs: { |
||||
handler: function (n, o) { |
||||
if (n.length) { |
||||
var that = this; |
||||
if (!document.querySelector('.el-icon-refresh')) { |
||||
var i = document.createElement('i'); |
||||
i.className = "el-icon-refresh ms-admin-refresh" |
||||
i.title = "点击刷新当前页" |
||||
i.addEventListener('click', function () { |
||||
var index = null |
||||
Object.keys(that.$refs).forEach(function (item, i) { |
||||
item.indexOf(that.currentTab) > -1 ? index = i : '' |
||||
}, that) |
||||
that.$refs[Object.keys(that.$refs)[index]][0].contentDocument.location.reload(true) |
||||
}) |
||||
document.querySelector('.el-tabs__header').insertBefore(i, document.querySelector('.el-tabs__nav-wrap')) |
||||
} |
||||
} else { |
||||
if (document.querySelector('.ms-admin-refresh')) { |
||||
document.querySelector('.el-tabs__header').removeChild(document.querySelector('.ms-admin-refresh')) |
||||
} |
||||
} |
||||
}, |
||||
deep: true |
||||
} |
||||
}, |
||||
methods: { |
||||
getAuthorization: function () { |
||||
|
||||
}, |
||||
subscribe: function () { |
||||
var h = this.$createElement |
||||
var that = this; |
||||
ms.http.get( |
||||
ms.manager + "/lic/info" |
||||
).then(function (res) { |
||||
that.$msgbox({ |
||||
title: '关注公众号接收系统通知', |
||||
message: h('p', null, [h('el-image', { |
||||
attrs: { |
||||
src: 'http://www.meczj.com/wx/employee/qrCode?code=' + encodeURIComponent(res.data), |
||||
}, |
||||
style: { |
||||
width: "80%", |
||||
height: "300px" |
||||
} |
||||
} |
||||
), h('el-alert', { |
||||
props: { |
||||
title: '一人一码,请确认当前登录用户信息再进行绑定,如果绑定错误,请取消关注 铭软 公众号再重新扫码绑定', |
||||
closable: false |
||||
}, |
||||
} |
||||
)]), |
||||
showConfirmButton: false, |
||||
center: true |
||||
}) |
||||
}).catch(function (err) { |
||||
console.log(err) |
||||
}) |
||||
|
||||
}, |
||||
connect: function () { |
||||
var that = this |
||||
var sockjs = new SockJS("/websocket"); |
||||
var stompClient = Stomp.over(sockjs); |
||||
stompClient.connect({}, function (frame) { |
||||
stompClient.subscribe('/topic/message/' +${Session.manager_session.managerId}, function (greeting) { |
||||
if (greeting.body == "list") { |
||||
that.getMessage() |
||||
} |
||||
}); |
||||
}); |
||||
}, |
||||
markMenu: function (title, icon) { |
||||
var menu = { |
||||
title: title, |
||||
icon: icon, |
||||
} |
||||
this.markList.push(menu); |
||||
localStorage.setItem("markList", JSON.stringify(this.markList)) |
||||
this.callbackFun(); |
||||
}, |
||||
cancelMarkMenu: function (title) { |
||||
var index = this.markList.findIndex(function (x) { |
||||
return x.title == title |
||||
}); |
||||
this.markList.splice(index, 1); |
||||
localStorage.setItem("markList", JSON.stringify(this.markList)) |
||||
}, |
||||
handleMessage: function () { |
||||
this.openMenuInTitle('收到消息') |
||||
}, |
||||
handleCommand: function (theme) { |
||||
this.theme = theme; |
||||
localStorage.setItem("theme", theme); |
||||
}, |
||||
// 菜单列表 |
||||
list: function () { |
||||
var that = this; |
||||
ms.http.get(ms.manager + "/model/list.do") |
||||
.then(function (data) { |
||||
that.menuList = data.data.rows |
||||
}, function (err) { |
||||
that.$message.error(err); |
||||
}) |
||||
}, |
||||
asideMenuOpen: function (index, indexPath) { |
||||
}, |
||||
// 菜单打开页面 |
||||
open: function (sub) { |
||||
var that = this |
||||
var result = ''; |
||||
result = this.editableTabs.some(function (item, index) { |
||||
return item.modelTitle == sub.modelTitle |
||||
}) |
||||
|
||||
if (sub.syncStoreUrl) { |
||||
sub.modelUrl = sub.syncStoreUrl |
||||
sub.modelTitle = 'mstore'; |
||||
sub.isStore = true; |
||||
!result ? this.editableTabs.push(sub) : "" |
||||
} else { |
||||
!result ? this.editableTabs.push(sub) : "" |
||||
} |
||||
|
||||
this.currentTab = sub.modelTitle; |
||||
this.headMenuActive = sub.modelModelId |
||||
this.$nextTick(function () { |
||||
that.asideMenuActive = sub.modelId; |
||||
}) |
||||
// 处理其他逻辑 |
||||
setTimeout(function () { |
||||
if (document.querySelector('.el-tabs__nav-prev')) { |
||||
document.querySelector('.el-tabs__nav-wrap').style.padding = '0 40px' |
||||
} else { |
||||
document.querySelector('.el-tabs__nav-wrap').style.padding = '0' |
||||
} |
||||
}, 16) |
||||
}, |
||||
tabClick: function (tab) { |
||||
this.asideMenuActive = tab.$el.dataset.modelid |
||||
this.headMenuActive = tab.$el.dataset.modelmodelid |
||||
console.log(this.editableTabs) |
||||
}, |
||||
// 获取当前菜单的子菜单 |
||||
getSubMenu: function (modelId) { |
||||
var result = []; |
||||
var that = this; |
||||
that.subMenuList && that.subMenuList.forEach(function (item) { |
||||
item.modelModelId == modelId ? result.push(item) : '' |
||||
}) |
||||
return result; |
||||
}, |
||||
//关闭tab标签页 |
||||
closeTab: function (targetName) { |
||||
var that = this; |
||||
// 关闭的面板是当前激活面板 |
||||
if (that.currentTab == targetName) { |
||||
var modelModelId = null |
||||
that.editableTabs.forEach(function (tab, index, arr) { |
||||
if (tab.modelTitle == targetName) { |
||||
modelModelId = arr[index].modelModelId |
||||
var nextTab = arr[index + 1] || arr[index - 1]; |
||||
if (nextTab) { |
||||
that.currentTab = nextTab.modelTitle |
||||
that.asideMenuActive = nextTab.modelId |
||||
that.headMenuActive = nextTab.modelModelId |
||||
} |
||||
} |
||||
}) |
||||
} |
||||
// 去掉关闭的tab |
||||
that.editableTabs = that.editableTabs.filter(function (tab) { |
||||
return tab.modelTitle !== targetName |
||||
}) |
||||
|
||||
// 关闭左侧父菜单 |
||||
if (that.editableTabs.length) { |
||||
var result = that.editableTabs.every(function (item) { |
||||
return item.modelModelId !== modelModelId |
||||
}) |
||||
if (result) { |
||||
that.asideMenuList.forEach(function (menu, index, arr) { |
||||
if (menu.modelId == modelModelId) { |
||||
var flag = false; |
||||
that.markList.forEach(function (item, index, array) { |
||||
if (item.title == menu.modelTitle) { |
||||
flag = true; |
||||
} |
||||
}) |
||||
if (!flag) { |
||||
arr.splice(index, 1); |
||||
} |
||||
} |
||||
}) |
||||
} |
||||
} else { |
||||
that.asideMenuList = [] |
||||
} |
||||
|
||||
// 判断是否出现左右箭头 |
||||
setTimeout(function () { |
||||
if (document.querySelector('.el-tabs__nav-prev')) { |
||||
document.querySelector('.el-tabs__nav-wrap').style.padding = '0 40px' |
||||
} else { |
||||
document.querySelector('.el-tabs__nav-wrap').style.padding = '0' |
||||
} |
||||
}, 16) |
||||
}, |
||||
openParentMenuInTitle: function (title) { |
||||
var data = this.parentMenuList.find(function (menu) { |
||||
return menu.modelTitle == title |
||||
}) |
||||
data && this.openMenu(data) |
||||
}, |
||||
// 头部导航打开菜单 |
||||
openMenu: function (menu, index) { |
||||
this.asideMenuList.some(function (item, index) { |
||||
return item.modelId == menu.modelId |
||||
}) || this.asideMenuList.push(menu) |
||||
// this.getSubMenu(menu.modelId)[0] && this.$refs.menu.open(this.getSubMenu(menu.modelId)[0].modelTitle); |
||||
var children = []; |
||||
this.menuList.forEach(function (tab) { |
||||
if (tab.modelModelId == menu.modelId) { |
||||
children.push(tab) |
||||
} |
||||
}) |
||||
this.currentTab = children[0] && children[0].modelTitle; |
||||
this.open(children[0]); |
||||
var that = this; |
||||
setTimeout(function () { |
||||
that.shortcutMenu = false |
||||
}, 50) |
||||
that.$nextTick(function () { |
||||
that.$refs.menu.open(String(menu.modelId)) |
||||
}) |
||||
}, |
||||
managerGet: function () { |
||||
var that = this; |
||||
ms.http.get(ms.manager + "/basic/manager/get.do") |
||||
.then(function (data) { |
||||
that.peopleInfo = data.data |
||||
resetPasswordVue.resetPasswordForm.managerName = that.peopleInfo.managerName |
||||
}, function (err) { |
||||
that.$message.error(err); |
||||
}) |
||||
}, |
||||
exitSystem: function () { |
||||
this.$confirm('是否确认退出账号?', '退出系统', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
cancelButtonClass: 'el-button--mini', |
||||
confirmButtonClass: 'el-button--mini', |
||||
type: 'warning' |
||||
}).then(function () { |
||||
ms.http.get(ms.manager + "/loginOut.do") |
||||
.then(function (data) { |
||||
isShow = false; |
||||
location.href = ms.manager + "/login.do"; |
||||
}, function (err) { |
||||
that.$message.error(err.msg); |
||||
}) |
||||
}) |
||||
}, |
||||
// 打开修改密码,退出的模态框 |
||||
openModal: function (edit) { |
||||
edit ? |
||||
resetPasswordVue.isShow = true : this.exitSystem(); |
||||
}, |
||||
// 显示图标 |
||||
formmateIcon: function (icon) { |
||||
return "<i class='ms-admin-icon iconfont'></i>" |
||||
}, |
||||
//打开指定标题 |
||||
openMenuInTitle: function (title) { |
||||
this.open(this.menuList.find(function (x) { |
||||
return x.modelTitle == title |
||||
})) |
||||
}, |
||||
//消息显示 |
||||
getMessage: function () { |
||||
var that = this |
||||
ms.http.post(ms.manager + "/message/myMessage/list.do", {pageSize: 9999, mlStatus: 'unread'}) |
||||
.then(function (res) { |
||||
if (res.result) { |
||||
that.messageList = res.data.rows.splice(0, 5); |
||||
that.unreadTotal = res.data.total; |
||||
} |
||||
}, function (err) { |
||||
that.$message.error(err); |
||||
}) |
||||
|
||||
}, |
||||
dictList: function () { |
||||
var that = this; |
||||
ms.http.get(ms.base + '/mdiy/dict/list.do', {dictType: '消息类型', pageSize: 99999}).then(function (res) { |
||||
that.messageTypeList = res.rows; |
||||
}).catch(function (err) { |
||||
console.log(err); |
||||
}); |
||||
}, |
||||
addCallBackFun: function (fun) { |
||||
this.callbackFun = fun; |
||||
} |
||||
}, |
||||
created: function () { |
||||
this.getAuthorization(); |
||||
var markList = localStorage.getItem("markList"); |
||||
if (markList) { |
||||
this.markList = JSON.parse(markList) |
||||
} |
||||
localStorage.setItem("markList", JSON.stringify(this.markList)) |
||||
}, |
||||
mounted: function () { |
||||
// this.getMessage(); |
||||
this.dictList(); |
||||
if (localStorage.getItem("theme")) { |
||||
this.theme = localStorage.getItem("theme"); |
||||
} |
||||
//setInterval(this.getMessage,3000) |
||||
// 菜单列表 |
||||
this.list(); |
||||
this.connect(); |
||||
//获取登录用户信息 |
||||
this.managerGet(); |
||||
var that = this; |
||||
ms.http.get(ms.manager + "/upgrader/sync.do").then(function (data) { |
||||
if (data.syncStoreUrl != undefined) { |
||||
data.syncStoreUrl += "?client=${client}"; |
||||
that.mstore = data; |
||||
} |
||||
}) |
||||
|
||||
}, |
||||
}) |
||||
</script> |
||||
<style> |
||||
|
||||
.adminhead{ |
||||
margin-top: 10px\0; |
||||
} |
||||
.item { |
||||
margin-right: 19px; |
||||
} |
||||
|
||||
.ms-notice-menu { |
||||
padding: 0px; |
||||
width: 400px; |
||||
} |
||||
|
||||
.ms-notice-menu-type { |
||||
color: #ccc; |
||||
font-weight: 500; |
||||
font-family: 黑体 !important; |
||||
} |
||||
|
||||
.ms-notice-menu-border { |
||||
border-bottom: 1px solid rgb(239, 239, 239); |
||||
font-weight: bold; |
||||
font-family: 黑体 !important; |
||||
} |
||||
|
||||
.ms-admin-header-menu-shrink { |
||||
width: 64px; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
line-height: 50px; |
||||
border-right: 1px solid rgba(238, 238, 238, 1); |
||||
cursor: pointer; |
||||
} |
||||
|
||||
.ms-admin-header-menu-shrink:hover { |
||||
background: rgba(250, 250, 250, 1); |
||||
} |
||||
|
||||
.el-menu-vertical-demo:not(.el-menu--collapse) { |
||||
width: 180px; |
||||
height: 100vh; |
||||
} |
||||
|
||||
.el-menu--collapse { |
||||
height: 100vh; |
||||
} |
||||
|
||||
.ms-admin-menu-aside .el-submenu__title, |
||||
.ms-admin-menu-aside .el-menu-item { |
||||
color: rgba(255, 255, 255, 1); |
||||
height: 40px; |
||||
line-height: 40px; |
||||
} |
||||
|
||||
.ms-admin-menu-aside .el-submenu__title i { |
||||
color: inherit; |
||||
} |
||||
|
||||
.ms-admin-menu-aside .el-submenu__title .iconfont { |
||||
font-size: 19px !important; |
||||
} |
||||
|
||||
.ms-admin-menu-aside .el-submenu.is-active .el-submenu__title { |
||||
color: rgba(255, 255, 255, 1) !important; |
||||
} |
||||
|
||||
.ms-admin-header-menu .el-submenu__title { |
||||
height: 50px !important; |
||||
line-height: 50px !important; |
||||
} |
||||
|
||||
.ms-admin-header-menu .el-submenu__title:hover { |
||||
background: rgba(250, 250, 250, 1) !important; |
||||
} |
||||
|
||||
.ms-admin-header-menu-all { |
||||
width: 560px; |
||||
height: auto; |
||||
background: rgba(255, 255, 255, 1); |
||||
border-radius: 2px; |
||||
display: flex; |
||||
flex-direction: row; |
||||
flex-wrap: wrap; |
||||
line-height: 40px; |
||||
} |
||||
|
||||
.ms-admin-header-menu-all .iconfont { |
||||
font-size: 17px; |
||||
} |
||||
|
||||
.ms-admin-header-menu-all .ms-admin-header-menu-all-item { |
||||
display: flex; |
||||
width: 25%; |
||||
justify-content: center; |
||||
align-items: center; |
||||
cursor: pointer; |
||||
} |
||||
|
||||
.ms-admin-header-menu-all .ms-admin-header-menu-all-item .el-icon-star-on { |
||||
color: #ccc; |
||||
font-size: 17px; |
||||
margin-left: -1px; |
||||
margin-top: 1px; |
||||
} |
||||
|
||||
.ms-admin-header-menu-all .ms-admin-header-menu-all-item .el-icon-star-on:hover { |
||||
color: rgba(64, 158, 255, 1); |
||||
} |
||||
|
||||
.ms-admin-header-menu-all .ms-admin-header-menu-all-item .el-icon-star-off { |
||||
color: #ccc; |
||||
} |
||||
|
||||
.ms-admin-header-menu-all .ms-admin-header-menu-all-item .el-icon-star-off:hover { |
||||
color: rgba(64, 158, 255, 1); |
||||
} |
||||
|
||||
.ms-admin-header-menu-all .ms-admin-header-menu-all-item:hover { |
||||
color: rgba(64, 158, 255, 1); |
||||
} |
||||
|
||||
.ms-admin-mstore .ms-admin-mstore-menu-icon { |
||||
height: 100%; |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
cursor: pointer; |
||||
width: 48px; |
||||
color: rgba(51, 51, 51, 1); |
||||
} |
||||
|
||||
.ms-admin-mstore .ms-admin-login .el-dropdown-link:hover, |
||||
.ms-admin-mstore .ms-admin-mstore-menu-icon:hover { |
||||
background: rgba(250, 250, 250, 1); |
||||
} |
||||
|
||||
.ms-admin-mstore .ms-admin-mstore-menu-icon i { |
||||
font-size: 18px; |
||||
margin: 0 5px 0 0; |
||||
} |
||||
|
||||
.ms-admin-login-down { |
||||
top: 55px !important; |
||||
} |
||||
|
||||
.ms-admin-menu-aside-submenu .el-menu-item { |
||||
line-height: 40px; |
||||
height: 40px; |
||||
} |
||||
|
||||
.el-submenu__title * { |
||||
vertical-align: top; |
||||
} |
||||
|
||||
.ms-admin-login-theme .el-dropdown-menu__item { |
||||
display: flex; |
||||
flex-direction: row; |
||||
justify-content: center; |
||||
align-items: center; |
||||
} |
||||
|
||||
.el-tabs__nav .el-tabs__item:nth-child(1) span { |
||||
display: none; |
||||
} |
||||
|
||||
.el-tabs__item.is-active { |
||||
background-color: rgba(255, 255, 255, 1); |
||||
} |
||||
|
||||
.el-menu { |
||||
border-right: 0px; |
||||
} |
||||
|
||||
.ms-admin-logo .class-1 { |
||||
color: white; |
||||
padding-top: 8px; |
||||
color: #FFFFFF; |
||||
word-wrap: break-word; |
||||
font-family: MicrosoftYaHei-Bold; |
||||
font-weight: bold; |
||||
font-style: italic; |
||||
} |
||||
|
||||
.ms-admin-logo .class-2 { |
||||
font-size: 12px; |
||||
font-weight: normal; |
||||
} |
||||
|
||||
.theme-select .el-menu--popup { |
||||
width: 100px; |
||||
min-width: 100px; |
||||
} |
||||
|
||||
.top-operate-select .el-menu--popup { |
||||
width: 162px; |
||||
min-width: 162px; |
||||
} |
||||
</style> |
||||
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 198 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 428 B |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 142 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 960 B |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 224 KiB |
|
After Width: | Height: | Size: 105 KiB |
|
After Width: | Height: | Size: 97 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 200 KiB |
|
After Width: | Height: | Size: 146 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 208 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 415 B |
|
After Width: | Height: | Size: 415 B |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 415 B |
|
After Width: | Height: | Size: 415 B |
|
After Width: | Height: | Size: 803 B |
|
After Width: | Height: | Size: 202 B |
|
After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 912 KiB After Width: | Height: | Size: 933 KiB |
@ -0,0 +1,413 @@ |
||||
/*! |
||||
* accounting.js v0.4.1 |
||||
* Copyright 2014 Open Exchange Rates |
||||
* |
||||
* Freely distributable under the MIT license. |
||||
* Portions of accounting.js are inspired or borrowed from underscore.js |
||||
* |
||||
* Full details and documentation: |
||||
* http://openexchangerates.github.io/accounting.js/
|
||||
*/ |
||||
|
||||
(function(root, undefined) { |
||||
|
||||
/* --- Setup --- */ |
||||
|
||||
// Create the local library object, to be exported or referenced globally later
|
||||
var lib = {}; |
||||
|
||||
// Current version
|
||||
lib.version = '0.4.1'; |
||||
|
||||
|
||||
/* --- Exposed settings --- */ |
||||
|
||||
// The library's settings configuration object. Contains default parameters for
|
||||
// currency and number formatting
|
||||
lib.settings = { |
||||
currency: { |
||||
symbol : "$", // default currency symbol is '$'
|
||||
format : "%s%v", // controls output: %s = symbol, %v = value (can be object, see docs)
|
||||
decimal : ".", // decimal point separator
|
||||
thousand : ",", // thousands separator
|
||||
precision : 2, // decimal places
|
||||
grouping : 3 // digit grouping (not implemented yet)
|
||||
}, |
||||
number: { |
||||
precision : 0, // default precision on numbers is 0
|
||||
grouping : 3, // digit grouping (not implemented yet)
|
||||
thousand : ",", |
||||
decimal : "." |
||||
} |
||||
}; |
||||
|
||||
|
||||
/* --- Internal Helper Methods --- */ |
||||
|
||||
// Store reference to possibly-available ECMAScript 5 methods for later
|
||||
var nativeMap = Array.prototype.map, |
||||
nativeIsArray = Array.isArray, |
||||
toString = Object.prototype.toString; |
||||
|
||||
/** |
||||
* Tests whether supplied parameter is a string |
||||
* from underscore.js |
||||
*/ |
||||
function isString(obj) { |
||||
return !!(obj === '' || (obj && obj.charCodeAt && obj.substr)); |
||||
} |
||||
|
||||
/** |
||||
* Tests whether supplied parameter is a string |
||||
* from underscore.js, delegates to ECMA5's native Array.isArray |
||||
*/ |
||||
function isArray(obj) { |
||||
return nativeIsArray ? nativeIsArray(obj) : toString.call(obj) === '[object Array]'; |
||||
} |
||||
|
||||
/** |
||||
* Tests whether supplied parameter is a true object |
||||
*/ |
||||
function isObject(obj) { |
||||
return obj && toString.call(obj) === '[object Object]'; |
||||
} |
||||
|
||||
/** |
||||
* Extends an object with a defaults object, similar to underscore's _.defaults |
||||
* |
||||
* Used for abstracting parameter handling from API methods |
||||
*/ |
||||
function defaults(object, defs) { |
||||
var key; |
||||
object = object || {}; |
||||
defs = defs || {}; |
||||
// Iterate over object non-prototype properties:
|
||||
for (key in defs) { |
||||
if (defs.hasOwnProperty(key)) { |
||||
// Replace values with defaults only if undefined (allow empty/zero values):
|
||||
if (object[key] == null) object[key] = defs[key]; |
||||
} |
||||
} |
||||
return object; |
||||
} |
||||
|
||||
/** |
||||
* Implementation of `Array.map()` for iteration loops |
||||
* |
||||
* Returns a new Array as a result of calling `iterator` on each array value. |
||||
* Defers to native Array.map if available |
||||
*/ |
||||
function map(obj, iterator, context) { |
||||
var results = [], i, j; |
||||
|
||||
if (!obj) return results; |
||||
|
||||
// Use native .map method if it exists:
|
||||
if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context); |
||||
|
||||
// Fallback for native .map:
|
||||
for (i = 0, j = obj.length; i < j; i++ ) { |
||||
results[i] = iterator.call(context, obj[i], i, obj); |
||||
} |
||||
return results; |
||||
} |
||||
|
||||
/** |
||||
* Check and normalise the value of precision (must be positive integer) |
||||
*/ |
||||
function checkPrecision(val, base) { |
||||
val = Math.round(Math.abs(val)); |
||||
return isNaN(val)? base : val; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Parses a format string or object and returns format obj for use in rendering |
||||
* |
||||
* `format` is either a string with the default (positive) format, or object |
||||
* containing `pos` (required), `neg` and `zero` values (or a function returning |
||||
* either a string or object) |
||||
* |
||||
* Either string or format.pos must contain "%v" (value) to be valid |
||||
*/ |
||||
function checkCurrencyFormat(format) { |
||||
var defaults = lib.settings.currency.format; |
||||
|
||||
// Allow function as format parameter (should return string or object):
|
||||
if ( typeof format === "function" ) format = format(); |
||||
|
||||
// Format can be a string, in which case `value` ("%v") must be present:
|
||||
if ( isString( format ) && format.match("%v") ) { |
||||
|
||||
// Create and return positive, negative and zero formats:
|
||||
return { |
||||
pos : format, |
||||
neg : format.replace("-", "").replace("%v", "-%v"), |
||||
zero : format |
||||
}; |
||||
|
||||
// If no format, or object is missing valid positive value, use defaults:
|
||||
} else if ( !format || !format.pos || !format.pos.match("%v") ) { |
||||
|
||||
// If defaults is a string, casts it to an object for faster checking next time:
|
||||
return ( !isString( defaults ) ) ? defaults : lib.settings.currency.format = { |
||||
pos : defaults, |
||||
neg : defaults.replace("%v", "-%v"), |
||||
zero : defaults |
||||
}; |
||||
|
||||
} |
||||
// Otherwise, assume format was fine:
|
||||
return format; |
||||
} |
||||
|
||||
|
||||
/* --- API Methods --- */ |
||||
|
||||
/** |
||||
* Takes a string/array of strings, removes all formatting/cruft and returns the raw float value |
||||
* Alias: `accounting.parse(string)` |
||||
* |
||||
* Decimal must be included in the regular expression to match floats (defaults to |
||||
* accounting.settings.number.decimal), so if the number uses a non-standard decimal
|
||||
* separator, provide it as the second argument. |
||||
* |
||||
* Also matches bracketed negatives (eg. "$ (1.99)" => -1.99) |
||||
* |
||||
* Doesn't throw any errors (`NaN`s become 0) but this may change in future |
||||
*/ |
||||
var unformat = lib.unformat = lib.parse = function(value, decimal) { |
||||
// Recursively unformat arrays:
|
||||
if (isArray(value)) { |
||||
return map(value, function(val) { |
||||
return unformat(val, decimal); |
||||
}); |
||||
} |
||||
|
||||
// Fails silently (need decent errors):
|
||||
value = value || 0; |
||||
|
||||
// Return the value as-is if it's already a number:
|
||||
if (typeof value === "number") return value; |
||||
|
||||
// Default decimal point comes from settings, but could be set to eg. "," in opts:
|
||||
decimal = decimal || lib.settings.number.decimal; |
||||
|
||||
// Build regex to strip out everything except digits, decimal point and minus sign:
|
||||
var regex = new RegExp("[^0-9-" + decimal + "]", ["g"]), |
||||
unformatted = parseFloat( |
||||
("" + value) |
||||
.replace(/\((.*)\)/, "-$1") // replace bracketed values with negatives
|
||||
.replace(regex, '') // strip out any cruft
|
||||
.replace(decimal, '.') // make sure decimal point is standard
|
||||
); |
||||
|
||||
// This will fail silently which may cause trouble, let's wait and see:
|
||||
return !isNaN(unformatted) ? unformatted : 0; |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* Implementation of toFixed() that treats floats more like decimals |
||||
* |
||||
* Fixes binary rounding issues (eg. (0.615).toFixed(2) === "0.61") that present |
||||
* problems for accounting- and finance-related software. |
||||
*/ |
||||
var toFixed = lib.toFixed = function(value, precision) { |
||||
precision = checkPrecision(precision, lib.settings.number.precision); |
||||
var power = Math.pow(10, precision); |
||||
|
||||
// Multiply up by precision, round accurately, then divide and use native toFixed():
|
||||
return (Math.round(lib.unformat(value) * power) / power).toFixed(precision); |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* Format a number, with comma-separated thousands and custom precision/decimal places |
||||
* Alias: `accounting.format()` |
||||
* |
||||
* Localise by overriding the precision and thousand / decimal separators |
||||
* 2nd parameter `precision` can be an object matching `settings.number` |
||||
*/ |
||||
var formatNumber = lib.formatNumber = lib.format = function(number, precision, thousand, decimal) { |
||||
// Resursively format arrays:
|
||||
if (isArray(number)) { |
||||
return map(number, function(val) { |
||||
return formatNumber(val, precision, thousand, decimal); |
||||
}); |
||||
} |
||||
|
||||
// Clean up number:
|
||||
number = unformat(number); |
||||
|
||||
// Build options object from second param (if object) or all params, extending defaults:
|
||||
var opts = defaults( |
||||
(isObject(precision) ? precision : { |
||||
precision : precision, |
||||
thousand : thousand, |
||||
decimal : decimal |
||||
}), |
||||
lib.settings.number |
||||
), |
||||
|
||||
// Clean up precision
|
||||
usePrecision = checkPrecision(opts.precision), |
||||
|
||||
// Do some calc:
|
||||
negative = number < 0 ? "-" : "", |
||||
base = parseInt(toFixed(Math.abs(number || 0), usePrecision), 10) + "", |
||||
mod = base.length > 3 ? base.length % 3 : 0; |
||||
|
||||
// Format the number:
|
||||
return negative + (mod ? base.substr(0, mod) + opts.thousand : "") + base.substr(mod).replace(/(\d{3})(?=\d)/g, "$1" + opts.thousand) + (usePrecision ? opts.decimal + toFixed(Math.abs(number), usePrecision).split('.')[1] : ""); |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* Format a number into currency |
||||
* |
||||
* Usage: accounting.formatMoney(number, symbol, precision, thousandsSep, decimalSep, format) |
||||
* defaults: (0, "$", 2, ",", ".", "%s%v") |
||||
* |
||||
* Localise by overriding the symbol, precision, thousand / decimal separators and format |
||||
* Second param can be an object matching `settings.currency` which is the easiest way. |
||||
* |
||||
* To do: tidy up the parameters |
||||
*/ |
||||
var formatMoney = lib.formatMoney = function(number, symbol, precision, thousand, decimal, format) { |
||||
// Resursively format arrays:
|
||||
if (isArray(number)) { |
||||
return map(number, function(val){ |
||||
return formatMoney(val, symbol, precision, thousand, decimal, format); |
||||
}); |
||||
} |
||||
|
||||
// Clean up number:
|
||||
number = unformat(number); |
||||
|
||||
// Build options object from second param (if object) or all params, extending defaults:
|
||||
var opts = defaults( |
||||
(isObject(symbol) ? symbol : { |
||||
symbol : symbol, |
||||
precision : precision, |
||||
thousand : thousand, |
||||
decimal : decimal, |
||||
format : format |
||||
}), |
||||
lib.settings.currency |
||||
), |
||||
|
||||
// Check format (returns object with pos, neg and zero):
|
||||
formats = checkCurrencyFormat(opts.format), |
||||
|
||||
// Choose which format to use for this value:
|
||||
useFormat = number > 0 ? formats.pos : number < 0 ? formats.neg : formats.zero; |
||||
|
||||
// Return with currency symbol added:
|
||||
return useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(number), checkPrecision(opts.precision), opts.thousand, opts.decimal)); |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* Format a list of numbers into an accounting column, padding with whitespace |
||||
* to line up currency symbols, thousand separators and decimals places |
||||
* |
||||
* List should be an array of numbers |
||||
* Second parameter can be an object containing keys that match the params |
||||
* |
||||
* Returns array of accouting-formatted number strings of same length |
||||
* |
||||
* NB: `white-space:pre` CSS rule is required on the list container to prevent |
||||
* browsers from collapsing the whitespace in the output strings. |
||||
*/ |
||||
lib.formatColumn = function(list, symbol, precision, thousand, decimal, format) { |
||||
if (!list) return []; |
||||
|
||||
// Build options object from second param (if object) or all params, extending defaults:
|
||||
var opts = defaults( |
||||
(isObject(symbol) ? symbol : { |
||||
symbol : symbol, |
||||
precision : precision, |
||||
thousand : thousand, |
||||
decimal : decimal, |
||||
format : format |
||||
}), |
||||
lib.settings.currency |
||||
), |
||||
|
||||
// Check format (returns object with pos, neg and zero), only need pos for now:
|
||||
formats = checkCurrencyFormat(opts.format), |
||||
|
||||
// Whether to pad at start of string or after currency symbol:
|
||||
padAfterSymbol = formats.pos.indexOf("%s") < formats.pos.indexOf("%v") ? true : false, |
||||
|
||||
// Store value for the length of the longest string in the column:
|
||||
maxLength = 0, |
||||
|
||||
// Format the list according to options, store the length of the longest string:
|
||||
formatted = map(list, function(val, i) { |
||||
if (isArray(val)) { |
||||
// Recursively format columns if list is a multi-dimensional array:
|
||||
return lib.formatColumn(val, opts); |
||||
} else { |
||||
// Clean up the value
|
||||
val = unformat(val); |
||||
|
||||
// Choose which format to use for this value (pos, neg or zero):
|
||||
var useFormat = val > 0 ? formats.pos : val < 0 ? formats.neg : formats.zero, |
||||
|
||||
// Format this value, push into formatted list and save the length:
|
||||
fVal = useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(val), checkPrecision(opts.precision), opts.thousand, opts.decimal)); |
||||
|
||||
if (fVal.length > maxLength) maxLength = fVal.length; |
||||
return fVal; |
||||
} |
||||
}); |
||||
|
||||
// Pad each number in the list and send back the column of numbers:
|
||||
return map(formatted, function(val, i) { |
||||
// Only if this is a string (not a nested array, which would have already been padded):
|
||||
if (isString(val) && val.length < maxLength) { |
||||
// Depending on symbol position, pad after symbol or at index 0:
|
||||
return padAfterSymbol ? val.replace(opts.symbol, opts.symbol+(new Array(maxLength - val.length + 1).join(" "))) : (new Array(maxLength - val.length + 1).join(" ")) + val; |
||||
} |
||||
return val; |
||||
}); |
||||
}; |
||||
|
||||
|
||||
/* --- Module Definition --- */ |
||||
|
||||
// Export accounting for CommonJS. If being loaded as an AMD module, define it as such.
|
||||
// Otherwise, just add `accounting` to the global object
|
||||
if (typeof exports !== 'undefined') { |
||||
if (typeof module !== 'undefined' && module.exports) { |
||||
exports = module.exports = lib; |
||||
} |
||||
exports.accounting = lib; |
||||
} else if (typeof define === 'function' && define.amd) { |
||||
// Return the library as an AMD module:
|
||||
define([], function() { |
||||
return lib; |
||||
}); |
||||
} else { |
||||
// Use accounting.noConflict to restore `accounting` back to its original value.
|
||||
// Returns a reference to the library's `accounting` object;
|
||||
// e.g. `var numbers = accounting.noConflict();`
|
||||
lib.noConflict = (function(oldAccounting) { |
||||
return function() { |
||||
// Reset the value of the root's `accounting` variable:
|
||||
root.accounting = oldAccounting; |
||||
// Delete the noConflict method:
|
||||
lib.noConflict = undefined; |
||||
// Return reference to the library to re-assign it:
|
||||
return lib; |
||||
}; |
||||
})(root.accounting); |
||||
|
||||
// Declare `fx` on the root (global/window) object:
|
||||
root['accounting'] = lib; |
||||
} |
||||
|
||||
// Root will be `window` in browser or `global` on the server:
|
||||
}(this)); |
||||
@ -0,0 +1,119 @@ |
||||
/** |
||||
* 字典类 |
||||
* 初始化: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; |
||||
}()); |
||||