fix: 数据源分页 文本列表深色主题 数据集详情不规范

This commit is contained in:
dataeaseShu 2022-11-18 15:50:10 +08:00
parent 119644c2b9
commit 65169d8879
12 changed files with 193 additions and 204 deletions

View File

@ -136,7 +136,7 @@ export default {
unbind: 'Unbind',
unlock: 'Unlock',
unlock_success: 'Unlock success',
parameter_effect: 'Parameter values only take effect when editing a dataset',
uninstall: 'Uninstall',
no_result: 'No Result',

View File

@ -136,7 +136,7 @@ export default {
unbind: '解綁',
unlock: '解鎖',
unlock_success: '解鎖成功',
parameter_effect: '參數值僅在數据集編輯時生效',
uninstall: '卸載',
no_result: '沒有找到相關內容',

View File

@ -137,7 +137,7 @@ export default {
unlock: '解锁',
unlock_success: '解锁成功',
uninstall: '卸载',
parameter_effect: '参数值仅在数据集编辑时生效',
no_result: '没有找到相关内容',
manage_member: '管理成员',
confirm_remove_cancel: '确定删除该角色吗?',

View File

@ -823,10 +823,17 @@ div:focus {
display: none !important;
}
.el-checkbox__input.is-checked:not(.is-disabled)+.el-checkbox__label {
color: #1F2329 !important;
}
.de-select-grid-class {
.el-checkbox__input.is-checked:not(.is-disabled)+.el-checkbox__label {
color: #3370ff !important;
}
}
.el-dialog__title {
font-weight: 500;
}
@ -1317,11 +1324,11 @@ div:focus {
}
.user-popper {
padding: 0;
background: #fff;
padding: 0 !important;
background: #fff !important;
.popper__arrow {
display: none;
display: none !important;
}
}

View File

@ -436,6 +436,17 @@
prop="defaultValue"
:label="$t('commons.params_value')"
>
<template #header>
{{ $t('commons.params_value') }}
<el-tooltip
class="item"
effect="dark"
:content="$t('commons.parameter_effect')"
placement="top"
>
<i class="el-icon-warning" />
</el-tooltip>
</template>
<template slot-scope="scope">
<el-input
v-if="scope.row.type[0] === 'TEXT'"

View File

@ -141,7 +141,7 @@
</div>
<div class="info-item">
<p class="info-title">{{ $t('commons.description') }}</p>
<p class="info-content">{{ detail.datasource.desc || 'N/A' }}</p>
<p class="info-content">{{ detail.datasource.desc || '-' }}</p>
</div>
<div class="info-item">
<p class="info-title">{{ $t('datasource.type') }}</p>

View File

@ -22,10 +22,12 @@
</el-col>
</el-row>
<div class="table-container">
<el-table
<grid-table
v-loading="loading"
:data="filterTable"
:style="{ width: '100%' }"
:table-data="pagingTable"
:pagination="paginationConfig"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
<el-table-column
key="name"
@ -33,6 +35,8 @@
:label="$t('datasource.table_name')"
/>
<el-table-column
slot="__operation"
key="__operation"
:label="$t('commons.operating')"
fixed="right"
width="108"
@ -46,7 +50,7 @@
</el-button>
</template>
</el-table-column>
</el-table>
</grid-table>
</div>
<el-dialog
:title="$t('dataset.detail')"
@ -115,8 +119,10 @@
<script>
import keyEnter from '@/components/msgCfm/keyEnter.js'
import { post } from '@/api/dataset/dataset'
import GridTable from '@/components/gridTable/index.vue'
export default {
components: { GridTable },
mixins: [keyEnter],
props: {
params: {
@ -128,6 +134,11 @@ export default {
data() {
return {
userDrawer: false,
paginationConfig: {
currentPage: 1,
pageSize: 10,
total: 0
},
dsTableDetail: {},
nickName: '',
loading: false,
@ -136,12 +147,27 @@ export default {
filterTable: []
}
},
computed: {
pagingTable() {
const { currentPage, pageSize } = this.paginationConfig
return this.filterTable.slice((currentPage - 1) * pageSize, currentPage * pageSize)
}
},
created() {
this.search()
},
methods: {
handleSizeChange(pageSize) {
this.paginationConfig.currentPage = 1
this.paginationConfig.pageSize = pageSize
},
handleCurrentChange(currentPage) {
this.paginationConfig.currentPage = currentPage
},
initSearch() {
this.handleCurrentChange(1)
this.filterTable = this.tableData.filter(ele => ele.name.includes(this.nickName))
this.paginationConfig.total = this.filterTable.length
},
selectDataset(row) {
this.dsTableDetail = row

View File

@ -26,8 +26,7 @@
<span
v-for="ele in usersValueCopy"
:key="ele.id"
class="item"
:class="[activeUser.includes(ele.id) ? 'active' : '']"
class="item active"
@click="activeUserChange(ele.id)"
>{{ ele.username }}</span>
<el-popover
@ -37,14 +36,13 @@
trigger="click"
>
<el-select
ref="userSelect"
ref="select"
v-model="usersValue"
multiple
filterable
multiple
:placeholder="$t('commons.please_select')"
value-key="id"
@change="changeUser"
@remove-tag="changeUser"
>
<el-option
v-for="item in usersComputed"
@ -102,7 +100,6 @@ export default {
usersValue: [],
activeUser: [],
users: [],
userCache: [],
activeType: [],
userDrawer: false
}
@ -112,7 +109,7 @@ export default {
return this.users.filter((ele) => !this.activeUser.includes(ele.id))
},
usersValueCopy() {
return this.userCache.filter((ele) => this.activeUser.includes(ele.id))
return this.users.filter((ele) => this.activeUser.includes(ele.id))
}
},
mounted() {
@ -132,48 +129,24 @@ export default {
this.users = res.data
})
},
changeUser() {
if (
this.userCache.length >
this.usersValue.length + this.activeUser.length
) {
this.userCache = this.userCache.filter((ele) =>
this.usersValue
.map((ele) => ele.id)
.concat(this.activeUser)
.includes(ele.id)
)
return
}
const userIdx = this.usersValue.findIndex(
(ele) =>
!this.userCache
.map((ele) => ele.id)
.concat(this.activeUser)
.includes(ele.id)
)
if (userIdx === -1) return
this.activeUser.push(this.usersValue[userIdx].id)
this.userCache.push(this.usersValue[userIdx])
this.usersValue.splice(userIdx, 1)
changeUser(list) {
const [val] = list
this.activeUser.push(val.id)
this.usersValue = []
const { query } = this.$refs.select
this.$nextTick(() => {
this.$refs.select.query = query
this.$refs.select.handleQueryChange(query)
})
},
activeUserChange(id) {
const userIndex = this.activeUser.findIndex((ele) => ele === id)
if (userIndex === -1) {
this.activeUser.push(id)
this.usersValue = this.usersValue.filter((ele) => ele.id !== id)
} else {
this.activeUser.splice(userIndex, 1)
const user = this.userCache.find((ele) => ele.id === id)
this.usersValue.push(user)
}
this.activeUser = this.activeUser.filter((ele) => ele !== id)
},
clearFilter() {
this.dataRange = []
this.usersValue = []
this.activeUser = []
this.activeType = []
this.userCache = []
this.$emit('search', [], [])
},
clearOneFilter(index) {
@ -217,8 +190,7 @@ export default {
params.push(str.slice(0, str.length - 1))
this.filterTextMap.push([
'usersValue',
'activeUser',
'userCache'
'activeUser'
])
}

View File

@ -515,8 +515,8 @@ export default {
datasetTaskList(currentPage, pageSize, param, showLoading).then(
(response) => {
const multipleSelection = this.multipleSelection.map(ele => ele.id)
this.data = response.data.listObject
this.paginationConfig.total = response.data.itemCount
this.data = response.data?.listObject
this.paginationConfig.total = response.data?.itemCount
if (multipleSelection.length) {
this.$nextTick(() => {
this.data.forEach(row => {

View File

@ -14,8 +14,7 @@
<span
v-for="ele in selectDatasetsCache"
:key="ele.id"
class="item"
:class="[activeDataset.includes(ele.id) ? 'active' : '']"
class="item active"
@click="activeDatasetChange(ele.id)"
>{{ ele.name }}</span>
<el-popover
@ -34,7 +33,7 @@
<el-tree
ref="datasetTreeRef"
current-node-key="id"
:data="treeData"
:data="deptsComputed"
node-key="id"
highlight-current
:filter-node-method="filterNode"
@ -77,22 +76,12 @@
</span>
</el-tree>
<el-select
ref="datasetSelect"
<el-input
slot="reference"
v-model="selectDatasets"
popper-class="tree-select"
multiple
:placeholder="$t('commons.please_select')"
value-key="id"
>
<el-option
v-for="item in selectDatasets"
:key="item.name"
:label="item.name"
:value="item"
/>
</el-select>
clearable
/>
</el-popover>
<span
slot="reference"
@ -155,8 +144,7 @@ export default {
return {
treeLoading: false,
dataRange: [],
selectDatasets: [],
datasetCache: [],
selectDatasets: '',
activeDataset: [],
selectDatasetsCache: [],
treeData: [],
@ -169,10 +157,31 @@ export default {
userDrawer: false
}
},
computed: {
deptsComputed() {
return this.dfs(this.treeData)
}
},
watch: {
selectDatasets(val) {
this.$refs.datasetTreeRef.filter(val)
}
},
mounted() {
this.treeNode()
},
methods: {
dfs(arr) {
return arr.reduce((pre, ele) => {
if (!this.activeDataset.includes(ele.id)) {
if (ele.children?.length) {
ele.children = this.dfs(ele.children)
}
pre.push(ele)
}
return pre
}, [])
},
treeNode() {
this.treeLoading = true
queryAuthModel(
@ -200,7 +209,7 @@ export default {
},
filterNode(value, data) {
if (!value) return true
return !this.activeDataset.includes(data.id)
return data.label.indexOf(value) !== -1
},
clearFilter() {
this.active = {
@ -210,7 +219,7 @@ export default {
}
this.dataRange = []
this.activeDataset = []
this.selectDatasets = []
this.selectDatasets = ''
this.datasetCache = []
this.selectDatasetsCache = []
this.$refs.datasetTreeRef.filter()
@ -239,22 +248,14 @@ export default {
}
},
handleNodeClick(id, name) {
const datasetIdx = this.selectDatasets.findIndex((ele) => ele.id === id)
if (datasetIdx !== -1) {
this.selectDatasets.splice(datasetIdx, 1)
}
this.activeDataset.push(id)
this.selectDatasetsCache.push({ id, name })
this.datasetCache.push({ id, name })
this.$refs.datasetTreeRef.filter(id)
this.$nextTick(() => {
this.$refs.datasetTreeRef.filter(this.selectDatasets)
})
},
activeDatasetChange(id) {
const dataset = this.datasetCache.find((ele) => ele.id === id)
this.selectDatasets.push(dataset)
this.activeDataset = this.activeDataset.filter((ele) => ele !== id)
this.datasetCache = this.datasetCache.filter(
(ele) => ele.id !== id
)
this.selectDatasetsCache = this.selectDatasetsCache.filter(
(ele) => ele.id !== id
)
@ -266,6 +267,7 @@ export default {
},
formatText() {
this.filterTextMap = []
this.selectDatasets = ''
const params = []
if (this.activeDataset.length) {
const str = `${this.$t('dataset.datalist')}:${this.activeDataset.reduce(
@ -278,9 +280,7 @@ export default {
params.push(str.slice(0, str.length - 1))
this.filterTextMap.push([
'activeDataset',
'selectDatasets',
'selectDatasetsCache',
'datasetCache'
'selectDatasetsCache'
])
}
[

View File

@ -34,7 +34,7 @@
<el-tree
ref="datasetTreeRef"
current-node-key="id"
:data="treeData"
:data="datasetComputed"
node-key="id"
highlight-current
:filter-node-method="filterNode"
@ -77,22 +77,12 @@
</span>
</el-tree>
<el-select
ref="datasetSelect"
<el-input
slot="reference"
v-model="selectDatasets"
popper-class="tree-select"
multiple
:placeholder="$t('commons.please_select')"
value-key="id"
>
<el-option
v-for="item in selectDatasets"
:key="item.name"
:label="item.name"
:value="item"
/>
</el-select>
clearable
/>
</el-popover>
<span
slot="reference"
@ -159,8 +149,7 @@ export default {
treeLoading: false,
filterTextMap: [],
dataRange: [],
selectDatasets: [],
datasetCache: [],
selectDatasets: '',
activeDataset: [],
selectDatasetsCache: [],
treeData: [],
@ -171,6 +160,16 @@ export default {
userDrawer: false
}
},
computed: {
datasetComputed() {
return this.dfs(this.treeData)
}
},
watch: {
selectDatasets(val) {
this.$refs.selectDatasets.filter(val)
}
},
mounted() {
this.treeNode()
},
@ -195,6 +194,18 @@ export default {
this.treeLoading = false
})
},
dfs(arr) {
return arr.reduce((pre, ele) => {
if (!this.activeDataset.includes(ele.id)) {
if (ele.children?.length) {
pre.push(this.dfs(ele.children))
} else {
pre.push(ele)
}
}
return pre
}, [])
},
nodeClick(data) {
const { id, name, modelInnerType: type } = data
if (type === 'group') return
@ -202,7 +213,7 @@ export default {
},
filterNode(value, data) {
if (!value) return true
return !this.activeDataset.includes(data.id)
return data.label.indexOf(value) !== -1
},
clearFilter() {
this.active = {
@ -210,7 +221,7 @@ export default {
}
this.dataRange = []
this.activeDataset = []
this.selectDatasets = []
this.selectDatasets = ''
this.datasetCache = []
this.selectDatasetsCache = []
this.$refs.datasetTreeRef.filter()
@ -239,32 +250,22 @@ export default {
}
},
handleNodeClick(id, name) {
const datasetIdx = this.selectDatasets.findIndex((ele) => ele.id === id)
if (datasetIdx !== -1) {
this.selectDatasets.splice(datasetIdx, 1)
}
this.activeDataset.push(id)
this.selectDatasetsCache.push({ id, name })
this.datasetCache.push({ id, name })
this.$refs.datasetTreeRef.filter(id)
this.selectDatasets = ''
},
activeDatasetChange(id) {
const dataset = this.datasetCache.find((ele) => ele.id === id)
this.selectDatasets.push(dataset)
this.activeDataset = this.activeDataset.filter((ele) => ele !== id)
this.datasetCache = this.datasetCache.filter(
(ele) => ele.id !== id
)
this.selectDatasetsCache = this.selectDatasetsCache.filter(
(ele) => ele.id !== id
)
this.$refs.datasetTreeRef.filter(true)
},
search() {
this.userDrawer = false
this.$emit('search', this.formatCondition(), this.formatText())
},
formatText() {
this.selectDatasets = ''
this.filterTextMap = []
const params = []
if (this.activeDataset.length) {
@ -278,9 +279,7 @@ export default {
params.push(str.slice(0, str.length - 1))
this.filterTextMap.push([
'activeDataset',
'selectDatasets',
'selectDatasetsCache',
'datasetCache'
'selectDatasetsCache'
])
}
['dataset.task.last_exec_status'].forEach((ele, index) => {

View File

@ -43,30 +43,22 @@
trigger="click"
>
<el-tree
ref="tree"
:load="loadNode"
:lazy="true"
:expand-on-click-node="false"
:data="deptsComputed"
:props="defaultProps"
:filter-node-method="filterNode"
@node-click="handleNodeClick"
/>
<el-select
ref="roleSelect"
<el-input
slot="reference"
v-model="selectDepts"
popper-class="tree-select"
multiple
:placeholder="$t('commons.please_select')"
value-key="id"
>
<el-option
v-for="item in selectDepts"
:key="item.label"
:label="item.label"
:value="item"
/>
</el-select>
clearable
/>
</el-popover>
<span
slot="reference"
@ -81,8 +73,7 @@
<span
v-for="ele in rolesValueCopy"
:key="ele.id"
class="item"
:class="[activeRole.includes(ele.id) ? 'active' : '']"
class="item active"
@click="activeRoleChange(ele.id)"
>{{ ele.name }}</span>
<el-popover
@ -92,13 +83,13 @@
trigger="click"
>
<el-select
ref="roleSelect"
ref="select"
v-model="rolesValue"
multiple
:placeholder="$t('commons.please_select')"
value-key="id"
filterable
multiple
@change="changeRole"
@remove-tag="changeRole"
>
<el-option
v-for="item in rolesComputed"
@ -139,10 +130,6 @@ import { getDeptTree, treeByDeptId } from '@/api/system/dept'
export default {
data() {
return {
roleCache: [],
deptCache: [],
roles: [],
filterTextMap: [],
status: [
{
id: 1,
@ -153,11 +140,13 @@ export default {
label: 'commons.disable'
}
],
roles: [],
filterTextMap: [],
activeStatus: [],
rolesValue: [],
activeRole: [],
depts: [],
selectDepts: [],
selectDepts: '',
selectDeptsCache: [],
activeDept: [],
defaultProps: {
@ -173,27 +162,40 @@ export default {
return this.roles.filter((ele) => !this.activeRole.includes(ele.id))
},
rolesValueCopy() {
return this.roleCache.filter((ele) => this.activeRole.includes(ele.id))
return this.roles.filter((ele) => this.activeRole.includes(ele.id))
},
deptsComputed() {
return this.depts.filter((ele) => !this.activeDept.includes(ele.id))
return this.dfs(this.depts)
}
},
watch: {
selectDepts(val) {
this.$refs.tree.filter(val)
}
},
mounted() {
this.initRoles()
},
methods: {
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
clearFilter() {
Array(3)
.fill(1)
.forEach((_, index) => {
this.clearOneFilter(index)
})
this.$refs.tree.filter()
this.$emit('search', [], [])
},
clearOneFilter(index) {
(this.filterTextMap[index] || []).forEach((ele) => {
this[ele] = []
if (ele === 'activeDept') {
this.$refs.tree.filter()
}
})
},
//
@ -207,63 +209,40 @@ export default {
})
})
},
changeRole() {
if (
this.roleCache.length >
this.rolesValue.length + this.activeRole.length
) {
this.roleCache = this.roleCache.filter((ele) =>
this.rolesValue
.map((ele) => ele.id)
.concat(this.activeRole)
.includes(ele.id)
)
return
}
const roleIdx = this.rolesValue.findIndex(
(ele) =>
!this.roleCache
.map((ele) => ele.id)
.concat(this.activeRole)
.includes(ele.id)
)
if (roleIdx === -1) return
this.activeRole.push(this.rolesValue[roleIdx].id)
this.roleCache.push(this.rolesValue[roleIdx])
this.rolesValue.splice(roleIdx, 1)
dfs(arr) {
return arr.reduce((pre, ele) => {
if (!this.activeDept.includes(ele.id)) {
if (ele.children?.length) {
ele.children = this.dfs(ele.children)
}
pre.push(ele)
}
return pre
}, [])
},
changeRole(list) {
const [val] = list
this.activeRole.push(val.id)
this.rolesValue = []
const { query } = this.$refs.select
this.$nextTick(() => {
this.$refs.select.query = query
this.$refs.select.handleQueryChange(query)
})
},
activeRoleChange(id) {
const roleIndex = this.activeRole.findIndex((ele) => ele === id)
if (roleIndex === -1) {
this.activeRole.push(id)
this.rolesValue = this.rolesValue.filter((ele) => ele.id !== id)
} else {
this.activeRole.splice(roleIndex, 1)
const role = this.roleCache.find((ele) => ele.id === id)
this.rolesValue.push(role)
}
this.activeRole = this.activeRole.filter((ele) => ele !== id)
},
handleNodeClick({ id, label }) {
const deptIdx = this.selectDepts.findIndex((ele) => ele.id === id)
if (deptIdx !== -1) {
this.selectDepts.splice(deptIdx, 1)
this.selectDeptsCache = this.selectDeptsCache.filter(
(ele) => ele.id !== id
)
this.deptCache = this.deptCache.filter((ele) => ele.id !== id)
return
}
this.activeDept.push(id)
this.selectDeptsCache.push({ id, label })
this.deptCache.push({ id, label })
this.$nextTick(() => {
this.$refs.tree.filter(this.selectDatasets)
})
},
activeDeptChange(id) {
const dept = this.deptCache.find((ele) => ele.id === id)
this.selectDepts.push(dept)
this.activeDept = this.activeDept.filter((ele) => ele !== id)
this.selectDeptsCache = this.selectDeptsCache.filter(
(ele) => ele.id !== id
)
this.selectDeptsCache = this.selectDeptsCache.filter((ele) => ele.id !== id)
},
statusChange(id) {
const statusIndex = this.activeStatus.findIndex((ele) => ele === id)
@ -273,10 +252,6 @@ export default {
this.activeStatus.splice(statusIndex, 1)
}
},
changeDepts() {
const depts = this.selectDepts.map((item) => item.id)
this.activeDept = this.activeDept.filter((ele) => depts.includes(ele))
},
loadNode(node, resolve) {
if (!this.depts.length) {
this.treeByDeptId()
@ -310,6 +285,7 @@ export default {
this.$emit('search', this.formatCondition(), this.formatText())
},
formatText() {
this.selectDepts = ''
this.filterTextMap = []
const params = []
if (this.activeStatus.length) {
@ -331,9 +307,7 @@ export default {
)
this.filterTextMap.push([
'activeDept',
'selectDepts',
'selectDeptsCache',
'deptCache'
'selectDeptsCache'
])
}
if (this.activeRole.length) {
@ -342,7 +316,7 @@ export default {
.map((ele) => ele.name)
.join('、')}`
)
this.filterTextMap.push(['rolesValue', 'activeRole', 'roleCache'])
this.filterTextMap.push(['activeRole', 'rolesValue'])
}
return params
},