普通项目;工作组变更--文件维护接口;批量开票
This commit is contained in:
+79
-61
@@ -11,7 +11,7 @@ export function timeFix() {
|
||||
|
||||
export function welcome() {
|
||||
const arr = ['休息一会儿吧', '准备吃什么呢?', '要不要打一把 DOTA', '我猜你可能累了']
|
||||
let index = Math.floor((Math.random()*arr.length))
|
||||
let index = Math.floor((Math.random() * arr.length))
|
||||
return arr[index]
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export function filterObj(obj) {
|
||||
return
|
||||
}
|
||||
|
||||
for ( let key in obj) {
|
||||
for (let key in obj) {
|
||||
// eslint-disable-next-line
|
||||
if (obj.hasOwnProperty(key)
|
||||
&& (obj[key] == null || obj[key] == undefined || obj[key] === '')) {
|
||||
@@ -53,7 +53,7 @@ export function filterObj(obj) {
|
||||
*/
|
||||
export function formatDate(value, fmt) {
|
||||
let regPos = /^\d+(\.\d+)?$/
|
||||
if(regPos.test(value)){
|
||||
if (regPos.test(value)) {
|
||||
//如果是数字
|
||||
let getDate = new Date(value)
|
||||
let o = {
|
||||
@@ -74,46 +74,46 @@ export function formatDate(value, fmt) {
|
||||
}
|
||||
}
|
||||
return fmt
|
||||
}else{
|
||||
} else {
|
||||
//TODO
|
||||
value = value.trim()
|
||||
return value.substr(0,fmt.length)
|
||||
return value.substr(0, fmt.length)
|
||||
}
|
||||
}
|
||||
|
||||
// 生成首页路由
|
||||
export function generateIndexRouter(data) {
|
||||
let indexRouter = [{
|
||||
path: '/',
|
||||
name: 'dashboard',
|
||||
//component: () => import('@/components/layouts/BasicLayout'),
|
||||
// eslint-disable-next-line
|
||||
component: resolve => require(['@/components/layouts/TabLayout'], resolve),
|
||||
meta: { title: '首页' },
|
||||
redirect: '/dashboard/analysis',
|
||||
children: [
|
||||
...generateChildRouters(data)
|
||||
]
|
||||
},{
|
||||
'path': '*', 'redirect': '/404', 'hidden': true
|
||||
}]
|
||||
let indexRouter = [{
|
||||
path: '/',
|
||||
name: 'dashboard',
|
||||
//component: () => import('@/components/layouts/BasicLayout'),
|
||||
// eslint-disable-next-line
|
||||
component: resolve => require(['@/components/layouts/TabLayout'], resolve),
|
||||
meta: { title: '首页' },
|
||||
redirect: '/dashboard/analysis',
|
||||
children: [
|
||||
...generateChildRouters(data)
|
||||
]
|
||||
}, {
|
||||
'path': '*', 'redirect': '/404', 'hidden': true
|
||||
}]
|
||||
return indexRouter
|
||||
}
|
||||
|
||||
// 生成嵌套路由(子路由)
|
||||
|
||||
function generateChildRouters (data) {
|
||||
function generateChildRouters(data) {
|
||||
const routers = []
|
||||
for (let item of data) {
|
||||
let component = ''
|
||||
if(item.component.indexOf('layouts')>=0){
|
||||
component = 'components/'+item.component
|
||||
}else{
|
||||
component = 'views/'+item.component
|
||||
if (item.component.indexOf('layouts') >= 0) {
|
||||
component = 'components/' + item.component
|
||||
} else {
|
||||
component = 'views/' + item.component
|
||||
}
|
||||
|
||||
// eslint-disable-next-line
|
||||
let URL = (item.meta.url|| '').replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)) // URL支持{{ window.xxx }}占位符变量
|
||||
let URL = (item.meta.url || '').replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)) // URL支持{{ window.xxx }}占位符变量
|
||||
if (isURL(URL)) {
|
||||
item.meta.url = URL
|
||||
}
|
||||
@@ -139,42 +139,42 @@ function generateChildRouters (data) {
|
||||
// componentPath = onlineCommons.OnlCgreportAutoList
|
||||
// }else{
|
||||
// eslint-disable-next-line
|
||||
componentPath = resolve => require(['@/' + component+'.vue'], resolve)
|
||||
componentPath = resolve => require(['@/' + component + '.vue'], resolve)
|
||||
// }
|
||||
|
||||
let menu = {
|
||||
let menu = {
|
||||
path: item.path,
|
||||
name: item.name,
|
||||
redirect:item.redirect,
|
||||
redirect: item.redirect,
|
||||
component: componentPath,
|
||||
//component: resolve => require(['@/' + component+'.vue'], resolve),
|
||||
hidden:item.hidden,
|
||||
hidden: item.hidden,
|
||||
//component:()=> import(`@/views/${item.component}.vue`),
|
||||
meta: {
|
||||
title:item.meta.title ,
|
||||
title: item.meta.title,
|
||||
icon: item.meta.icon,
|
||||
url:item.meta.url ,
|
||||
permissionList:item.meta.permissionList,
|
||||
keepAlive:item.meta.keepAlive,
|
||||
url: item.meta.url,
|
||||
permissionList: item.meta.permissionList,
|
||||
keepAlive: item.meta.keepAlive,
|
||||
/*update_begin author:wuxianquan date:20190908 for:赋值 */
|
||||
internalOrExternal:item.meta.internalOrExternal,
|
||||
internalOrExternal: item.meta.internalOrExternal,
|
||||
/*update_end author:wuxianquan date:20190908 for:赋值 */
|
||||
componentName:item.meta.componentName
|
||||
componentName: item.meta.componentName
|
||||
}
|
||||
}
|
||||
if(item.alwaysShow){
|
||||
if (item.alwaysShow) {
|
||||
menu.alwaysShow = true
|
||||
menu.redirect = menu.path
|
||||
}
|
||||
if (item.children && item.children.length > 0) {
|
||||
menu.children = [...generateChildRouters( item.children)]
|
||||
menu.children = [...generateChildRouters(item.children)]
|
||||
}
|
||||
//--update-begin----author:scott---date:20190320------for:根据后台菜单配置,判断是否路由菜单字段,动态选择是否生成路由(为了支持参数URL菜单)------
|
||||
//判断是否生成路由
|
||||
if(item.route && item.route === '0'){
|
||||
if (item.route && item.route === '0') {
|
||||
//console.log(' 不生成路由 item.route: '+item.route);
|
||||
//console.log(' 不生成路由 item.path: '+item.path);
|
||||
}else{
|
||||
} else {
|
||||
routers.push(menu)
|
||||
}
|
||||
//--update-end----author:scott---date:20190320------for:根据后台菜单配置,判断是否路由菜单字段,动态选择是否生成路由(为了支持参数URL菜单)------
|
||||
@@ -208,7 +208,7 @@ export function randomNumber() {
|
||||
}
|
||||
if (arguments.length === 1) {
|
||||
let [length] = arguments
|
||||
// 生成指定长度的随机数字,首位一定不是 0
|
||||
// 生成指定长度的随机数字,首位一定不是 0
|
||||
let nums = [...Array(length).keys()].map((i) => (i > 0 ? random(0, 9) : random(1, 9)))
|
||||
return parseInt(nums.join(''))
|
||||
} else if (arguments.length >= 2) {
|
||||
@@ -250,8 +250,8 @@ export function randomUUID() {
|
||||
* @param string
|
||||
* @returns {*}
|
||||
*/
|
||||
export function underLine2CamelCase(string){
|
||||
return string.replace( /_([a-z])/g, function( all, letter ) {
|
||||
export function underLine2CamelCase(string) {
|
||||
return string.replace(/_([a-z])/g, function (all, letter) {
|
||||
return letter.toUpperCase()
|
||||
})
|
||||
}
|
||||
@@ -261,8 +261,8 @@ export function underLine2CamelCase(string){
|
||||
* @param bpmStatus
|
||||
* @returns {*}
|
||||
*/
|
||||
export function showDealBtn(bpmStatus){
|
||||
if(bpmStatus!='1'&&bpmStatus!='3'&&bpmStatus!='4'){
|
||||
export function showDealBtn(bpmStatus) {
|
||||
if (bpmStatus != '1' && bpmStatus != '3' && bpmStatus != '4') {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -276,7 +276,7 @@ export function showDealBtn(bpmStatus){
|
||||
export function cssExpand(css, id) {
|
||||
let style = document.createElement('style')
|
||||
style.type = 'text/css'
|
||||
style.innerHTML = `@charset "UTF-8"; ${css}`
|
||||
style.innerHTML = `@charset "UTF-8"; ${ css }`
|
||||
// 清除旧样式
|
||||
if (id) {
|
||||
let $style = document.getElementById(id)
|
||||
@@ -307,16 +307,16 @@ export function jsExpand(options = {}) {
|
||||
let id = randomString(16, 'qwertyuioplkjhgfdsazxcvbnm'.toUpperCase())
|
||||
// 封装按钮点击事件
|
||||
let code = `
|
||||
(function (o_${id}) {
|
||||
(function (o_${ id }) {
|
||||
try {
|
||||
(function (globalEvent, vm) {
|
||||
${options.jsCode}
|
||||
})(o_${id}.event, o_${id}.vm)
|
||||
${ options.jsCode }
|
||||
})(o_${ id }.event, o_${ id }.vm)
|
||||
} catch (e) {
|
||||
o_${id}.error(e)
|
||||
o_${ id }.error(e)
|
||||
}
|
||||
o_${id}.done()
|
||||
})(window['${windowKeyName}']['EVENT_${id}'])
|
||||
o_${ id }.done()
|
||||
})(window['${ windowKeyName }']['EVENT_${ id }'])
|
||||
`
|
||||
// 创建script标签
|
||||
const script = document.createElement('script')
|
||||
@@ -332,7 +332,7 @@ export function jsExpand(options = {}) {
|
||||
},
|
||||
// 当js运行出错的时候调用的事件
|
||||
error(e) {
|
||||
console.group(`${options.errorMessage || '用户自定义JS增强代码运行出错'}(${new Date()})`)
|
||||
console.group(`${ options.errorMessage || '用户自定义JS增强代码运行出错' }(${ new Date() })`)
|
||||
console.error(e)
|
||||
console.groupEnd()
|
||||
}
|
||||
@@ -555,16 +555,17 @@ export function neverNull(value, def) {
|
||||
*/
|
||||
export function removeArrayElement(array, prod, value) {
|
||||
let index = -1
|
||||
for(let i = 0;i<array.length;i++){
|
||||
if(array[i][prod] == value){
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
if (array[i][prod] == value) {
|
||||
index = i
|
||||
break
|
||||
}
|
||||
}
|
||||
if(index>=0){
|
||||
if (index >= 0) {
|
||||
array.splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 前端加密方法
|
||||
* @param publicKey:公钥
|
||||
@@ -576,13 +577,14 @@ export function encrypt(publicKey, message) {
|
||||
const txt = encrypt.encrypt(message)
|
||||
return txt
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验数组是否有重复的元素
|
||||
* */
|
||||
export function isRepeat(arr) {
|
||||
var hash = {}
|
||||
for(var i in arr) {
|
||||
if(hash[arr[i]]) {
|
||||
for (var i in arr) {
|
||||
if (hash[arr[i]]) {
|
||||
return true
|
||||
}
|
||||
// 不存在该元素,则赋值为true,可以赋任意值,相应的修改if判断条件即可
|
||||
@@ -590,6 +592,7 @@ export function isRepeat(arr) {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* 补充0
|
||||
* */
|
||||
@@ -613,14 +616,29 @@ export function addZero(e) {
|
||||
// 大于等于2
|
||||
if (afterPointValue.length >= 2) {
|
||||
e.target.value = beforePointValue + afterPointValue
|
||||
}else {
|
||||
} else {
|
||||
// 不足2位补0
|
||||
afterPointValue = afterPointValue.padEnd(2,'0')
|
||||
afterPointValue = afterPointValue.padEnd(2, '0')
|
||||
e.target.value = beforePointValue + afterPointValue
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
// 不包括小数点
|
||||
e.target.value = e.target.value + '.00'
|
||||
e.target.value = e.target.value + '.00'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 数组内元素是否完全一致
|
||||
* @param array
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isAllEqual(array) {
|
||||
if (array.length > 0) {
|
||||
return !array.some(item => {
|
||||
return item !== array[0]
|
||||
})
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user