Browse Source

监听缓存是否更改配置,字段设置组件按钮样式调整

集成Redis
安虹睿 2 years ago
parent
commit
a0b404bae7
  1. 18
      fe/PC/public/config.js
  2. 18
      fe/PC/src/components/currenButton/innerButton.vue
  3. 20
      fe/PC/src/components/rowDrop/index.vue
  4. 2
      fe/PC/src/components/umyTable/index.vue
  5. 2
      fe/PC/src/main.js
  6. 12
      fe/PC/src/mixins/mixins.js
  7. 19
      fe/PC/src/utils/defaultButtons.js

18
fe/PC/public/config.js

@ -1,12 +1,22 @@
// dev
window.SITE_CONFIG['base'] = 'http://dev.ccwin-in.com:21093'
window.SITE_CONFIG['user'] = 'http://dev.ccwin-in.com:21293'
window.SITE_CONFIG['base'] = 'http://dev.ccwin-in.com:59099'
window.SITE_CONFIG['user'] = 'http://dev.ccwin-in.com:59093'
window.SITE_CONFIG['print'] = 'print'
window.SITE_CONFIG['largeScreen'] = 'http://dev.ccwin-in.com:21093'
window.SITE_CONFIG['largeScreen'] = 'http://dev.ccwin-in.com:59082'
window.SITE_CONFIG['warehouseCode'] = 'T8'
window.SITE_CONFIG['company'] = 'DongYang'
window.SITE_CONFIG['client_secret'] = '1q2w3e*'
window.SITE_CONFIG['reportsUrl'] = 'http://10.164.0.227:21093/#/reports/'
window.SITE_CONFIG['reportsUrl'] = 'http://10.164.0.227:59091/#/reports/'
// dev-new
// window.SITE_CONFIG['base'] = 'http://dev.ccwin-in.com:21093'
// window.SITE_CONFIG['user'] = 'http://dev.ccwin-in.com:21293'
// window.SITE_CONFIG['print'] = 'print'
// window.SITE_CONFIG['largeScreen'] = 'http://dev.ccwin-in.com:21093'
// window.SITE_CONFIG['warehouseCode'] = 'T8'
// window.SITE_CONFIG['company'] = 'DongYang'
// window.SITE_CONFIG['client_secret'] = '1q2w3e*'
// window.SITE_CONFIG['reportsUrl'] = 'http://10.164.0.227:21093/#/reports/'
// localhost
// window.SITE_CONFIG['base'] = 'http://dev.ccwin-in.com:59099'

18
fe/PC/src/components/currenButton/innerButton.vue

@ -31,7 +31,25 @@ export default {
}
},
},
mounted(){
window.addEventListener('setItemEvent', (item) => {
this.initButtonType(item)
})
},
methods:{
initButtonType(changeItem){
let _num = 0
let _new = JSON.parse(changeItem.newValue)
_new.forEach((item) => {
if(item.istrue)_num ++
})
this.Butttondata.forEach(item=>{
// type
if(item.name == 'field'){
return item.type = (_num >= _new.length) ? '' : 'warning';
}
})
},
tableButtonClick (val,item) {
this.$emit('tableButtonClick', val,item)
}

20
fe/PC/src/components/rowDrop/index.vue

@ -28,9 +28,9 @@
>
<svg-icon
class="checkbox-svg"
:class="{'show': dataList[index].isture}"
:class="{'show': dataList[index].istrue}"
@click="rediochange(index)"
:icon-class="dataList[index].isture ? 'show' : 'hide'"
:icon-class="dataList[index].istrue ? 'show' : 'hide'"
/>
<div class="lable">{{ item.label }}</div>
</div>
@ -88,10 +88,10 @@ export default {
type: 'warning',
cancelButtonClass:'rowDropNotHideItem'
}).then(() => {
localStorage.removeItem(this.$store.getters.name.userName + '_' + this.$route.name)
localStorage.removeItem('tableColumns_' + this.$store.getters.name.userName + '_' + this.$route.name)
let _resetCol = this.$isTableColumns[this.$route.name]
_resetCol.forEach(item => {
item.isture = true
item.istrue = true
})
this.dataList = _resetCol
this.initSelectSta()
@ -108,8 +108,8 @@ export default {
formatData (val) {
this.dataList = JSON.parse(JSON.stringify(val))
this.dataList.forEach(item => {
if (item.isture == undefined) {
item.isture = true
if (item.istrue == undefined) {
item.istrue = true
}
})
},
@ -117,7 +117,7 @@ export default {
this.$forceUpdate()
this.$emit('radio',this.dataList)
// +
localStorage.setItem(this.$store.getters.name.userName + '_' + this.$route.name, JSON.stringify(this.dataList))
localStorage.setItem('tableColumns_' + this.$store.getters.name.userName + '_' + this.$route.name, JSON.stringify(this.dataList))
},
dragstart(value) {
this.oldData = value
@ -147,7 +147,7 @@ export default {
},
// item
rediochange(index){
this.dataList[index].isture = !this.dataList[index].isture
this.dataList[index].istrue = !this.dataList[index].istrue
this.initSelectSta()
this.save()
},
@ -155,7 +155,7 @@ export default {
initSelectSta(){
let _num = 0
this.dataList.forEach(item=>{
if(item.isture){
if(item.istrue){
_num ++
}
})
@ -168,7 +168,7 @@ export default {
let isSelectAll = !(this.allSeletType == 'allSelect')
this.allSeletType = isSelectAll ? 'allSelect' : 'NoSelect';
this.dataList.forEach(item=>{
return item.isture = isSelectAll
return item.istrue = isSelectAll
})
this.save()
},

2
fe/PC/src/components/umyTable/index.vue

@ -31,7 +31,7 @@
:width="item.width"
:align="item.tableAlign"
:header-align="item.tableHeaderAlign"
v-if="item.isture==null?true:item.isture"
v-if="item.istrue==null?true:item.istrue"
>
<template #header>
<span>{{ item.label }}</span>

2
fe/PC/src/main.js

@ -5,6 +5,7 @@ import '@/styles/index.scss' // global css
import App from './App'
import store from './store'
import router from './router'
import watchLocal from '@/utils/watcLlocalstorage'//用于监听本地缓存
import "./utils/utils"
@ -23,6 +24,7 @@ Vue.use(UTableColumn);
Vue.use(UTable);
Vue.use(UxGrid);
Vue.use(UxTableColumn);
Vue.use(watchLocal)
// 通用按钮样式
import {

12
fe/PC/src/mixins/mixins.js

@ -54,14 +54,14 @@ export const mixins = {
methods: {
// 结合默认及缓存中的列表tableColumns数据做初始化
initTableColumns(){
let _local = localStorage.getItem(this.$store.getters.name.userName + '_' + this.$route.name)
let _list_local = JSON.parse(localStorage.getItem(this.$store.getters.name.userName + '_' + this.$route.name))
let _local = localStorage.getItem('tableColumns_' + this.$store.getters.name.userName + '_' + this.$route.name)
let _list_local = JSON.parse(localStorage.getItem('tableColumns_' + this.$store.getters.name.userName + '_' + this.$route.name))
let _list_defalut = this.$isTableColumns[this.$route.name]
let _new_list = [] //格式化后的数据
// 如果没有缓存则直接为默认值
if(!_local){
_list_defalut.forEach((defalutItem,index) => {
defalutItem.isture = true
defalutItem.istrue = true
_new_list.push(defalutItem)
})
}
@ -81,13 +81,13 @@ export const mixins = {
let _number = 0
_list_defalut.forEach((defalutItem) => {
if(_locals[defalutItem.showProp]){
defalutItem.isture = _locals[defalutItem.showProp].isture
defalutItem.istrue = _locals[defalutItem.showProp].istrue
defalutItem.itemIndex = _locals[defalutItem.showProp].itemIndex
}else if(_locals[defalutItem.prop]){
defalutItem.isture = _locals[defalutItem.prop].isture
defalutItem.istrue = _locals[defalutItem.prop].istrue
defalutItem.itemIndex = _locals[defalutItem.prop].itemIndex
}else{
defalutItem.isture = false
defalutItem.istrue = false
defalutItem.itemIndex = _number
}
_number ++

19
fe/PC/src/utils/defaultButtons.js

@ -42,10 +42,23 @@ export function defaultExportBtn(option) {
// 字段设置
export function defaultFieldSettingBtn(option) {
// todo:监听已经配置过的字段按钮更改状态特殊显示
// let _local = localStorage.getItem(this.$store.getters.name.userName + '_' + this.$route.name)
// let _type = _local ? 'warning' : ''
let _local = localStorage.getItem('tableColumns_' + this.$store.getters.name.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,
type: _type,
plain: true,
icon: "el-icon-setting",
label: "字段设置",

Loading…
Cancel
Save