You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
3.5 KiB
125 lines
3.5 KiB
// 页面基础按钮样式
|
|
/**
|
|
* 如果需要更改配置,格式如:defaultExportBtn({label:'自定义'})
|
|
* @param {*} option
|
|
* @returns
|
|
*/
|
|
|
|
// 新增按钮
|
|
export function defaultAddBtn(option) {
|
|
return __defaultBtnOption(option,{
|
|
type: "primary",
|
|
icon: "el-icon-plus",
|
|
label: "新增",
|
|
name: "newly",
|
|
size: "mini",
|
|
background:"#31bb99"
|
|
})
|
|
}
|
|
|
|
// 导入按钮
|
|
export function defaultImportBtn(option) {
|
|
return __defaultBtnOption(option,{
|
|
type: "primary",
|
|
icon: "el-icon-bottom-left",
|
|
label: "导入",
|
|
name: "import",
|
|
size: "mini",
|
|
})
|
|
}
|
|
|
|
// 导出按钮
|
|
export function defaultExportBtn(option) {
|
|
return __defaultBtnOption(option,{
|
|
type: "primary",
|
|
icon: "el-icon-top-right",
|
|
label: "导出",
|
|
name: "export",
|
|
size: "mini",
|
|
})
|
|
}
|
|
|
|
// 字段设置
|
|
export function defaultFieldSettingBtn(option,source) {
|
|
let _source = source ? source : 'list_api'
|
|
// todo:监听已经配置过的字段按钮更改状态特殊显示
|
|
let _local = localStorage.getItem('file_Columns_' + _source + '_' + this.$store.getters.currentUserInfo.userName + '_' + this.$route.name)
|
|
let _type = ''
|
|
let _num = 0
|
|
if(_local){
|
|
JSON.parse(_local).forEach(item => {
|
|
if(item.istrue == true){
|
|
_num ++
|
|
}
|
|
});
|
|
if(_num >= JSON.parse(_local).length){
|
|
_type = ''
|
|
}else{
|
|
_type= 'warning'
|
|
}
|
|
}
|
|
return __defaultBtnOption(option,{
|
|
// type: _type,//暂不处理颜色
|
|
plain: true,
|
|
icon: "el-icon-setting",
|
|
label: "字段设置",
|
|
name: "field",
|
|
size: "mini",
|
|
float: 'right',
|
|
class: "rowDropNotHideItem"
|
|
})
|
|
}
|
|
|
|
// 刷新按钮
|
|
export function defaultFreshBtn(option) {
|
|
return __defaultBtnOption(option,{
|
|
icon: "el-icon-refresh",
|
|
label: "刷新",
|
|
name: "refresh",
|
|
size: "mini",
|
|
float: 'right'
|
|
})
|
|
}
|
|
|
|
// 筛选按钮
|
|
export function defaultFilterBtn(option) {
|
|
return __defaultBtnOption(option,{
|
|
type: "primary",
|
|
icon: "el-icon-finished",
|
|
label: "筛选",
|
|
name: "filter",
|
|
size: "mini",
|
|
float: 'right'
|
|
})
|
|
}
|
|
|
|
// 明细查询按钮
|
|
export function defaultFilterForDetailBtn(option) {
|
|
return __defaultBtnOption(option,{
|
|
type: "warning",
|
|
icon: "el-icon-finished",
|
|
label: "明细查询",
|
|
name: "filterForDetail",
|
|
size: "mini",
|
|
float: 'right',
|
|
})
|
|
}
|
|
|
|
// 默认按钮规则
|
|
function __defaultBtnOption(option,specific){
|
|
return {
|
|
type:option && option.type ? option.type : specific.type,
|
|
plain:option && option.plain ? option.plain : specific.plain,
|
|
icon:option && option.icon ? option.icon : specific.icon,
|
|
label:option && option.label ? option.label : specific.label,
|
|
name:option && option.name ? option.name : specific.name,
|
|
size:option && option.size ? option.size : specific.size,
|
|
float:option && option.float ? option.float : (specific.float || null),
|
|
url:option && option.url ? option.url : (specific.url || null),
|
|
background:option && option.background ? option.background : (specific.background || null),
|
|
class:option && option.class ? option.class : specific.class,
|
|
isDetailExport:option && option.isDetailExport ? option.isDetailExport : false,
|
|
isRedundance:option && option.isRedundance ? option.isRedundance : false,
|
|
}
|
|
}
|
|
|
|
|