fix: 请求地址,localStorage(key)优化

This commit is contained in:
@changcode
2022-04-14 15:52:07 +08:00
parent 58e2d233d6
commit 2cc23bf1a9
24 changed files with 147 additions and 92 deletions

View File

@@ -38,6 +38,7 @@
</template>
<script>
import { storageKey } from '@/utils/constants'
export default {
props: {
customTableTitle: Array, // 自定义的title
@@ -51,9 +52,9 @@ export default {
}
},
created () {
const localStorageTitle = JSON.parse(localStorage.getItem('cn-tableTitle-' + localStorage.getItem('cn-username') + '-' + this.tableId))
const localStorageTitle = JSON.parse(localStorage.getItem(storageKey.tableTitle + '-' + localStorage.getItem(storageKey.username) + '-' + this.tableId))
if (localStorageTitle) {
localStorage.setItem('cn-tableTitle-' + localStorage.getItem('cn-username') + '-' + this.tableId, JSON.stringify(localStorageTitle))
localStorage.setItem(storageKey.tableTitle + '-' + localStorage.getItem(storageKey.username) + '-' + this.tableId, JSON.stringify(localStorageTitle))
}
},
watch: {
@@ -92,10 +93,8 @@ export default {
// 点击第二个cancel
save () {
this.$emit('update', this.custom)
localStorage.setItem(
'cn-tableTitle-' + localStorage.getItem('cn-username') + '-' + this.tableId,
JSON.stringify(this.custom)
)
localStorage.setItem(storageKey.tableTitle + '-' + localStorage.getItem(storageKey.username) + '-' + this.tableId,
JSON.stringify(this.custom))
this.esc()
}
},

View File

@@ -8,7 +8,6 @@
@header-dragend="dragend"
@sort-change="tableDataSort"
@selection-change="selectionChange"
@select="select"
>
<el-table-column
:resizable="false"
@@ -69,7 +68,7 @@
</el-table-column>
</el-table>
<div class="table-operation-all">
<el-checkbox v-model="checkboxAll" @change="builtinReportCheckbox(tableData)"></el-checkbox>
<el-checkbox v-model="checkboxAll" @change="selectAll(tableData)"></el-checkbox>
<div class="table-operation-all-span">
<span>{{ $t('overall.all') }}</span>
<div class="table-operation-back-down" :class="{'table-operation-all-checkbox': batchDow, 'table-operation-all-loading': loading}" @click="tableOperation(['download', this.checkboxIds, 'builtin'])">
@@ -128,7 +127,7 @@ export default {
this.checkboxAll = objs.length > 0 || objs.length === this.tableData.length
this.batchDow = objs.length > 0
},
builtinReportCheckbox (objs) {
selectAll (objs) {
if (objs) {
objs.forEach(item => {
this.$refs.dataTable.toggleAllSelection(item)

View File

@@ -82,13 +82,14 @@
<script>
import table from '@/mixins/table'
import { put } from '@/utils/http'
import { storageKey } from '@/utils/constants'
export default {
name: 'userTable',
mixins: [table],
data () {
return {
loginName: localStorage.getItem('cn-username'),
loginName: localStorage.getItem(storageKey.username),
tableTitle: [ // 原始table列
{
label: 'ID',