增加流程页面包括样式

This commit is contained in:
zhoulingpo
2023-04-17 15:50:28 +08:00
parent 61e01291fd
commit c8db1229dc
15 changed files with 1901 additions and 619 deletions
+8
View File
@@ -0,0 +1,8 @@
// 定义枚举
import Esenum from './index.js'
// 权限申请
export const PERMISSION = new Esenum([
{ label: '预览', value: 0 },
{ label: '下载', value: 1 },
{ label: '预览+下载', value: 2 }
])
+103
View File
@@ -0,0 +1,103 @@
export default class EsEunm {
constructor (obj) {
if (!obj) {
return
}
Object.keys(obj).forEach(key => {
const item = obj[key]
this.addAll(key, item)
})
return this
}
/**
* 添加枚举
* @param key
* @param item
*/
addAll (key, item) {
this[key] = item
}
/**
* 获取到所有的枚举值列表
* @return {Array} list集合
*/
getItemList () {
const optionList = []
for (const key in this) {
const item = this[key]
const option = {}
Object.assign(option, item)
option.key = key
optionList.push(option)
}
optionList.sort((a, b) => {
const value1 = a.index
const value2 = b.index
return value1 - value2
})
return optionList
}
/**
* 过滤掉不需要的值
* @params {Array,String} val 需要过滤掉的枚举对象的name值
* @return {Array} list集合
*/
getFilterItemList (val = []) {
let filterList = []
let valueArr = [] // 接受参数的整理
if (Array.isArray(val)) {
valueArr = val
} else {
valueArr.push(val)
}
const optionList = this.getItemList() // 得到的是list
filterList = optionList.filter(item => {
if (valueArr.includes(item.name)) {
return false
}
return true
})
return filterList
}
/**
* 根据name获取到index
* @params {String} name 枚举的name值
* @return {Number} name对应的index值
*/
nameOfIndex (uname) {
if (!uname) {
return null
}
let index = ''
const optionList = this.getItemList()
optionList.forEach(item => {
if (uname.toString() === item.name.toString()) {
index = +item.index
}
})
return index
}
/**
* 根据index获取到name
* @params {Number} index 枚举的index值
* @return {String} index对应的name值
*/
indexOfName (index) {
if (index == undefined) {
return null
}
let uname = ''
const optionList = this.getItemList()
optionList.forEach(item => {
if (item.index !== undefined && item.index !== null && item.index == index) {
uname = item.name
}
})
return uname
}
}