top-setting.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <BaseDrawer title="设置"
  3. :visible.sync="drawer"
  4. :direction="direction"
  5. :before-close="handleClose">
  6. <BaseCol :span="24"
  7. style="padding:24px">
  8. <BaseRow>
  9. <BaseCol :span="20"> <span>是否显示主题</span></BaseCol>
  10. <BaseCol :span="4">
  11. <BaseSwitch v-model="showThemView"
  12. class="drawer-switch" />
  13. </BaseCol>
  14. </BaseRow>
  15. <!-- <BaseRow>
  16. <BaseCol :span="20"> <span>是否显示头部搜索框</span></BaseCol>
  17. <BaseCol :span="4">
  18. <BaseSwitch v-model="showSearchView"
  19. class="drawer-switch" />
  20. </BaseCol>
  21. </BaseRow> -->
  22. <BaseRow>
  23. <BaseCol :span="20"> <span>是否显示Logo</span></BaseCol>
  24. <BaseCol :span="4">
  25. <BaseSwitch v-model="showLogoView"
  26. class="drawer-switch" />
  27. </BaseCol>
  28. </BaseRow>
  29. <BaseRow v-if="vesselBankFlag !== 'V' && permissionIf('map.mapManagement.view')">
  30. <BaseCol :span="20"> <span>是否显示船舶动态</span></BaseCol>
  31. <BaseCol :span="4">
  32. <BaseSwitch v-model="showVesslBankFlag"
  33. class="drawer-switch"
  34. @change="changeVesslBankMethod" />
  35. </BaseCol>
  36. </BaseRow>
  37. <BaseRow >
  38. <button @click="clear()">清理后台缓存</button>
  39. </BaseRow>
  40. <span class="version">{{$t('systemVersion')+ ' ' + systemVersion}}</span>
  41. </BaseCol>
  42. </BaseDrawer>
  43. </template>
  44. <script>
  45. import { mapActions, mapGetters, mapState } from 'vuex';
  46. import { clearCache }
  47. from '@/model/home/index'
  48. export default {
  49. props: {
  50. value: {
  51. type: Boolean,
  52. default: false
  53. },
  54. },
  55. computed: {
  56. ...mapGetters(['showTag', 'showMenu', 'showTheme', 'showSearch', 'userSetting', 'systemVersion']),
  57. ...mapState({
  58. showLogo: state => state.commonStore.showLogo
  59. }),
  60. },
  61. data () {
  62. return {
  63. vesselBankFlag: localStorage.getItem('ws-pf_vesselBankFlag'),
  64. drawer: false,
  65. direction: 'rtl',
  66. setting: 'false',
  67. showTagView: false,
  68. showTopMenuView: false,
  69. showThemView: false,
  70. showSearchView: false,
  71. showLogoView: false,
  72. showVesslBankFlag: false
  73. };
  74. },
  75. mounted () {
  76. this.showTagView = this.showTag
  77. this.showTopMenuView = this.showMenu
  78. this.showThemView = this.showTheme
  79. this.showSearchView = this.showSearch
  80. this.showLogoView = this.showLogo
  81. this.showVesslBankFlag = this.userSetting['shipMap'][0].showFlag
  82. },
  83. watch: {
  84. value (val) {
  85. this.drawer = val
  86. },
  87. showVesslBankFlag (value) {
  88. this.$store.commit('SET_SHOWVESSLBANKFLAG', value)
  89. },
  90. showTagView (value) {
  91. this.$store.commit('SET_SHOWTAG', value)
  92. },
  93. showTopMenuView (value) {
  94. this.$store.commit('SET_SHOWMENU', value)
  95. },
  96. showThemView (value) {
  97. this.$store.commit('SET_SHOWTHEME', value)
  98. },
  99. showSearchView (value) {
  100. this.$store.commit('SET_SHOWSEARCH', value)
  101. },
  102. showLogoView (value) {
  103. this.$store.commit('SET_LOGO', value)
  104. }
  105. },
  106. methods: {
  107. ...mapActions('user', ['toSetShow', 'changeVesslBank']),
  108. handleClose (done) {
  109. this.$emit('close', true)
  110. done();
  111. },
  112. async changeVesslBankMethod (val) {
  113. this.changeVesslBank([{
  114. id: this.userSetting['shipMap'][0].id,
  115. staffId: localStorage.getItem('ws-pf_userId'),
  116. typeId: 'shipMap',
  117. showFlag: val
  118. }])
  119. },
  120. clear(){
  121. clearCache({
  122. }).toPromise().then(res => {
  123. this.$message.success('缓存清理成功')
  124. })
  125. }
  126. }
  127. };
  128. </script>
  129. <style lang="scss" scoped>
  130. /deep/.el-drawer {
  131. max-width: 300px;
  132. &__header {
  133. margin-bottom: 0px;
  134. }
  135. }
  136. .el-row {
  137. color: rgba(0, 0, 0, 0.65);
  138. font-size: 14px;
  139. padding: 12px 0;
  140. }
  141. .version {
  142. font-size: 12px;
  143. text-align: center;
  144. width: 100%;
  145. display: inherit;
  146. }
  147. </style>