Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: 优化 krry paging #3850

Merged
merged 2 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/components/Apps/AccountCreateUpdateForm/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export const accountFieldsMeta = (vm) => {
label: vm.$t('assets.Password'),
component: UpdateToken,
hidden: (formValue) => {
console.log('formValue: ', formValue)
return formValue.secret_type !== 'password' || vm.addTemplate
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default {
<style lang="scss" scoped>
.dialog >>> .el-dialog {
border-radius: 0.3em;
max-width: 1500px;
max-width: min(100vw, 1500px);

.el-icon-circle-check {
display: none;
Expand Down
5 changes: 3 additions & 2 deletions src/components/Form/FormFields/TransferSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
/>
<Dialog
v-if="showTransfer"
:close-on-click-modal="false"
:title="label"
:visible.sync="showTransfer"
:close-on-click-modal="false"
class="the-dialog"
width="730px"
@cancel="handleTransCancel"
@confirm="handleTransConfirm"
Expand Down Expand Up @@ -154,7 +155,7 @@ export default {
this.showTransfer = false
},
handleTransConfirm() {
const selectedData = this.$refs.pageTransfer.checkedData
const selectedData = this.$refs.pageTransfer.selectListCheck
const options = selectedData.map(item => {
return { value: item.id, label: item.label }
})
Expand Down
140 changes: 79 additions & 61 deletions src/components/Libs/Krry/paging/index.vue
Original file line number Diff line number Diff line change
@@ -1,61 +1,69 @@
<template>
<div class="krry-main">
<krry-box
ref="noSelect"
:async="async"
:async-search-flag="asyncSearchFlag"
:data-show-list="notSelectDataList"
:filter-placeholder="filterPlaceholder[0] || $tc('common.Search')"
:filterable="filterable"
:highlight-color="highlightColor"
:is-highlight="isHighlight"
:is-last-page="isLastPage"
:operate-id="0"
:page-size="pageSize"
:page-texts="pageTexts"
:show-clear-btn="showClearBtn"
:title="boxTitle[0] || $tc('common.Selection')"
@check-district="noCheckSelect"
@search-word="searchWord"
@check-disable="checkDisable"
@get-data="getData"
@get-data-by-keyword="getDataByKeyword"
@clear-input="clearQueryInp('left')"
/>
<div class="opera">
<el-button
:disabled="disablePre"
class="el-transfer__button"
icon="el-icon-arrow-left"
size="mini"
@click="deleteData"
/>
<el-button
:disabled="disableNex"
class="el-transfer__button"
icon="el-icon-arrow-right"
size="mini"
type="primary"
@click="addData"
/>
</div>
<krry-box
ref="hasSelect"
:data-show-list="checkedData"
:filter-placeholder="filterPlaceholder[1] || $tc('common.Search')"
:filterable="filterable"
:highlight-color="highlightColor"
:is-highlight="isHighlight"
:operate-id="1"
:page-size="pageSize"
:page-texts="pageTexts"
:show-clear-btn="showClearBtn"
:title="boxTitle[1] || $tc('common.Selected')"
@check-district="hasCheckSelect"
@search-word="searchWord"
@check-disable="checkDisable"
@clear-input="clearQueryInp('right')"
/>
<el-row :gutter="10">
<el-col :md="10" :sm="24">
<krry-box
ref="noSelect"
:async="async"
:async-search-flag="asyncSearchFlag"
:data-show-list="notSelectDataList"
:filter-placeholder="filterPlaceholder[0] || $tc('common.Search')"
:filterable="filterable"
:highlight-color="highlightColor"
:is-highlight="isHighlight"
:is-last-page="isLastPage"
:operate-id="0"
:page-size="pageSize"
:page-texts="pageTexts"
:show-clear-btn="showClearBtn"
:title="boxTitle[0] || $tc('common.Selection')"
@check-district="noCheckSelect"
@search-word="searchWord"
@check-disable="checkDisable"
@get-data="getData"
@get-data-by-keyword="getDataByKeyword"
@clear-input="clearQueryInp('left')"
/>
</el-col>
<el-col :md="4" :sm="24" class="buttons">
<div class="opera">
<el-button
:disabled="disablePre"
class="el-transfer__button"
icon="el-icon-arrow-left"
size="mini"
@click="deleteData"
/>
<el-button
:disabled="disableNex"
class="el-transfer__button"
icon="el-icon-arrow-right"
size="mini"
type="primary"
@click="addData"
/>
</div>
</el-col>
<el-col :md="10" :sm="24">
<krry-box
ref="hasSelect"
:data-show-list="checkedData"
:filter-placeholder="filterPlaceholder[1] || $tc('common.Search')"
:filterable="filterable"
:highlight-color="highlightColor"
:is-highlight="isHighlight"
:operate-id="1"
:page-size="pageSize"
:page-texts="pageTexts"
:show-clear-btn="showClearBtn"
:title="boxTitle[1] || $tc('common.Selected')"
@check-district="hasCheckSelect"
@search-word="searchWord"
@check-disable="checkDisable"
@clear-input="clearQueryInp('right')"
/>
</el-col>
</el-row>
</div>
</template>

Expand Down Expand Up @@ -189,7 +197,7 @@ export default {
}
},
created() {
this.async ? this.getData(1) : this.initData()
this.async ? this.getData(1, true) : this.initData(true)
},
methods: {
// 分页数据,初始化数据,过滤已选数据
Expand Down Expand Up @@ -370,7 +378,7 @@ export default {
await this.getData(1)
}
},
async getData(pageIndex) {
async getData(pageIndex, changed = false) {
this.$nextTick(() => {
// 设置异步分页的 pageIndex
this.$refs.noSelect.asyncPageIndex = pageIndex
Expand All @@ -383,7 +391,8 @@ export default {
if (Array.isArray(resData) && resData.length) {
this.asyncDataList = resData
this.notSelectDataList = resData
this.initData(false)
// 这里必须是 true,否则右侧不能搜索, 一搜索确认就不行了
this.initData(changed)
this.isLastPage = resData.length < this.pageSize
} else {
this.notSelectDataList = []
Expand All @@ -401,18 +410,27 @@ export default {
.inner-center {
margin: 0 5px;
}

.buttons {
vertical-align: middle;
}
.opera {
position: relative;
display: inline-block;
vertical-align: middle;
margin: 0 8px;
text-align: center;
margin: 180px 8px;
width: 100%;
@media screen and (max-width: 992px) {
margin: 8px 8px;
text-align:start
}

.el-button.is-circle {
border-radius: 50%;
padding: 12px;
display: block;
margin: 25px auto;

}
.el-transfer__button {
padding: 5px;
Expand Down
4 changes: 4 additions & 0 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ input[type=file] {
font-size: 16px;
}

.el-dialog {
max-width: 100vw;
}

.el-input--mini .el-input__inner::placeholder {
font-size: 13px;
font-weight: 400;
Expand Down
4 changes: 2 additions & 2 deletions src/views/ops/Job/QuickJob.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import Page from '@/layout/components/Page'
import AdhocOpenDialog from '@/views/ops/Job/AdhocOpenDialog'
import AdhocSaveDialog from '@/views/ops/Job/AdhocSaveDialog'
import VariableHelpDialog from '@/views/ops/Job/VariableHelpDialog'
import { createJob, StopJob, getJob, getTaskDetail } from '@/api/ops'
import { createJob, getJob, getTaskDetail, StopJob } from '@/api/ops'

export default {
name: 'CommandExecution',
Expand Down Expand Up @@ -454,7 +454,7 @@ export default {
this.xterm.write(this.wrapperError('Task has been canceled'))
this.getTaskStatus()
}).catch((e) => {
console.log(e)
this.$log.error(e)
}).finally(() => {
this.setBtn()
})
Expand Down
Loading