From 65169d8879e8fd7cd357b885311c260eab65a65b Mon Sep 17 00:00:00 2001 From: dataeaseShu <106045316+dataeaseShu@users.noreply.github.com> Date: Fri, 18 Nov 2022 15:50:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=95=B0=E6=8D=AE=E6=BA=90=E5=88=86?= =?UTF-8?q?=E9=A1=B5=20=E6=96=87=E6=9C=AC=E5=88=97=E8=A1=A8=E6=B7=B1?= =?UTF-8?q?=E8=89=B2=E4=B8=BB=E9=A2=98=20=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E4=B8=8D=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/lang/en.js | 2 +- frontend/src/lang/tw.js | 2 +- frontend/src/lang/zh.js | 2 +- frontend/src/styles/index.scss | 13 +- frontend/src/views/dataset/add/AddSQL.vue | 11 ++ .../views/dataset/common/DatasetDetail.vue | 2 +- .../src/views/system/datasource/DsTable.vue | 34 ++++- frontend/src/views/system/log/FilterUser.vue | 58 ++------ .../src/views/system/task/DatasetTaskList.vue | 4 +- frontend/src/views/system/task/FilterUser.vue | 68 ++++----- .../views/system/task/FilterUserRecord.vue | 65 +++++---- frontend/src/views/system/user/FilterUser.vue | 136 +++++++----------- 12 files changed, 193 insertions(+), 204 deletions(-) diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index ab85919e2c..d041fecca0 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -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', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index d62580b15b..d6f8010b5a 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -136,7 +136,7 @@ export default { unbind: '解綁', unlock: '解鎖', unlock_success: '解鎖成功', - + parameter_effect: '參數值僅在數据集編輯時生效', uninstall: '卸載', no_result: '沒有找到相關內容', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index ee387a98f6..1c11f9b3bf 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -137,7 +137,7 @@ export default { unlock: '解锁', unlock_success: '解锁成功', uninstall: '卸载', - + parameter_effect: '参数值仅在数据集编辑时生效', no_result: '没有找到相关内容', manage_member: '管理成员', confirm_remove_cancel: '确定删除该角色吗?', diff --git a/frontend/src/styles/index.scss b/frontend/src/styles/index.scss index 47ba9071c1..e4e820d4ac 100644 --- a/frontend/src/styles/index.scss +++ b/frontend/src/styles/index.scss @@ -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; } } diff --git a/frontend/src/views/dataset/add/AddSQL.vue b/frontend/src/views/dataset/add/AddSQL.vue index a1ee77640b..25123e4a26 100644 --- a/frontend/src/views/dataset/add/AddSQL.vue +++ b/frontend/src/views/dataset/add/AddSQL.vue @@ -436,6 +436,17 @@ prop="defaultValue" :label="$t('commons.params_value')" > + - + 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 diff --git a/frontend/src/views/system/log/FilterUser.vue b/frontend/src/views/system/log/FilterUser.vue index 2a3235a6b7..717ef34cd5 100644 --- a/frontend/src/views/system/log/FilterUser.vue +++ b/frontend/src/views/system/log/FilterUser.vue @@ -26,8 +26,7 @@ {{ ele.username }} !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' ]) } diff --git a/frontend/src/views/system/task/DatasetTaskList.vue b/frontend/src/views/system/task/DatasetTaskList.vue index 360d1fd83e..c25bf252e2 100644 --- a/frontend/src/views/system/task/DatasetTaskList.vue +++ b/frontend/src/views/system/task/DatasetTaskList.vue @@ -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 => { diff --git a/frontend/src/views/system/task/FilterUser.vue b/frontend/src/views/system/task/FilterUser.vue index 65fc8d8d2c..e6ef004a3a 100644 --- a/frontend/src/views/system/task/FilterUser.vue +++ b/frontend/src/views/system/task/FilterUser.vue @@ -14,8 +14,7 @@ {{ ele.name }} - - - + clearable + /> { + 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' ]) } [ diff --git a/frontend/src/views/system/task/FilterUserRecord.vue b/frontend/src/views/system/task/FilterUserRecord.vue index fe8e2a0a98..e79f9bda4c 100644 --- a/frontend/src/views/system/task/FilterUserRecord.vue +++ b/frontend/src/views/system/task/FilterUserRecord.vue @@ -34,7 +34,7 @@ - - - + clearable + /> { + 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) => { diff --git a/frontend/src/views/system/user/FilterUser.vue b/frontend/src/views/system/user/FilterUser.vue index 9d93c6df44..48463e4690 100644 --- a/frontend/src/views/system/user/FilterUser.vue +++ b/frontend/src/views/system/user/FilterUser.vue @@ -43,30 +43,22 @@ trigger="click" > - - - + clearable + /> {{ ele.name }} !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 },