知识分享私密模式下,选择人员权限

This commit is contained in:
范强强
2023-08-03 17:37:17 +08:00
parent 93adc2a939
commit 28d2c857a3
6 changed files with 517 additions and 66 deletions
+20 -6
View File
@@ -51,7 +51,11 @@
isSingleChoice: {
type: Boolean,
default: false
}
},
flag:{
type: Number,
default: 0
},
},
data() {
return {
@@ -109,6 +113,7 @@
return
}
}
this.confirmLoading = true
if (this.userIds && this.userIds.length > 0) {
this.submitLoading = true
this.$emit('SelectedByForm', this.userIds.join(','),this.userName.join(','))
@@ -143,12 +148,21 @@
} else {
gData = ''
}
let query = {}
if (this.flag == 1){
query = {
departId: this.departId,
json: gData,
}
}else{
query = {
departId: this.departId,
json: gData,
flag: '1'
}
}
this.confirmLoading = true
postAction('sys/user/queryDepartUserTreeList', {
departId: this.departId,
json: gData,
flag: '1'
}).then((res) => {
postAction('sys/user/queryDepartUserTreeList', query).then((res) => {
this.confirmLoading = false
if (res.success) {
this.gData = res.result
@@ -129,11 +129,11 @@
<span class="Required">*</span>
<span class="title-text-text" :title="$t('authorizedUser')">{{$t('authorizedUser')}}</span>
</div>
<a-form-model-item class="itemModel-multi" prop="studioEngineerName">
<PersonnelSelection :query="{db_field_name:'studioEngineer',db_field_txt:$t('authorizedUser')}"
<a-form-model-item class="itemModel-multi" prop="studioEngineerIdName">
<PersonnelSelection :query="{db_field_name:'studioEngineerId',db_field_txt:$t('authorizedUser')}"
:personneQuery="formInline"
@change="PersonnelSelectionChange"
v-model="formInline.studioEngineerName"/>
v-model="formInline.studioEngineerIdName"/>
</a-form-model-item>
</div>
</a-col>
@@ -209,7 +209,7 @@
</template>
<script>
import PersonnelSelection from '@/components/PersonnelSelection/index'
import PersonnelSelection from './problemPersonnelSelection'
import uploadFile from '@/components/uploadFile/file'
import { getAction, postAction, putAction } from '@/api/manage'
import 'quill/dist/quill.core.css'
@@ -287,7 +287,7 @@
trigger: 'change'
}
],
studioEngineerName: [
studioEngineerIdName: [
{
required: true,
message: this.$t('authorizedUser') + this.$t('cannotEmpty'),
@@ -466,8 +466,8 @@
userId.push(val.userId)
userName.push(val.userName)
})
this.formInline.studioEngineerName = userName.join(',')
this.formInline.studioEngineer = userId.join(',')
this.formInline.studioEngineerIdName = userName.join(',')
this.formInline.studioEngineerId = userId.join(',')
}
} else {
this.isDisplay = false
@@ -636,7 +636,7 @@
}
formInline.permissionUserList = []
if (formInline.showPermissions == 'Privacy') {
let studioEngineer = formInline.studioEngineer.split(',')
let studioEngineer = formInline.studioEngineerId.split(',')
studioEngineer.forEach(res => {
formInline.permissionUserList.push({
userId: res
@@ -872,4 +872,7 @@
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
}
::v-deep .ant-input-disabled{
color: #040B29;
}
</style>
@@ -200,7 +200,11 @@
<JLoading :loading="loading">{{$t('dataLoading')}}</JLoading>
<classificationMaintenanceModel @classificationMaintenanceModelForm="classificationMaintenanceModelForm"
ref="classificationMaintenanceModelRef"/>
<SelectedBy ref="SelectedByRef" :title="$t('share')" @SelectedByForm="SelectedByForm"></SelectedBy>
<SelectedBy ref="SelectedByRef"
:title="$t('share')"
:flag="1"
@SelectedByForm="SelectedByForm"></SelectedBy>
</div>
</template>
@@ -454,10 +458,12 @@
this.$message.success(this.$t('OperationSuccessful'))
this.$refs.SelectedByRef.visible = false
this.$refs.SelectedByRef.submitLoading = false
this.$refs.SelectedByRef.confirmLoading = false
this.getList()
} else {
this.$message.warning(this.$t('operationFailed'))
this.$refs.SelectedByRef.submitLoading = false
this.$refs.SelectedByRef.confirmLoading = false
}
})
},
@@ -148,7 +148,10 @@
</div>
</div>
</div>
<SelectedBy ref="SelectedByRef" :title="$t('share')" @SelectedByForm="SelectedByForm"></SelectedBy>
<SelectedBy ref="SelectedByRef"
:title="$t('share')"
:flag="1"
@SelectedByForm="SelectedByForm"></SelectedBy>
</div>
<a-modal
:title="$t('replyToComments')"
@@ -492,9 +495,11 @@
this.$message.success(this.$t('OperationSuccessful'))
this.$refs.SelectedByRef.visible = false
this.$refs.SelectedByRef.submitLoading = false
this.$refs.SelectedByRef.confirmLoading = false
} else {
this.$message.warning(this.$t('operationFailed'))
this.$refs.SelectedByRef.submitLoading = false
this.$refs.SelectedByRef.confirmLoading = false
}
})
},
@@ -0,0 +1,388 @@
<template>
<div>
<div class="box-title-text" v-if="!isInput">
<a-input class="box-input" :value="value" @input="indexclick($event)"
:disabled="true"
:title="value"
:placeholder="$t('PleaseSelect')+query.db_field_txt"/>
<a-button type="primary" class="button-box" :disabled="disabled" @click="standardClick">
{{this.$t('PersonnelSelection')}}
</a-button>
<a-button type="primary" v-if='isDelete' class="button-box" @click="standardDelete">
{{this.$t('delete')}}
</a-button>
</div>
<div class="box-title-text" v-if="isInput">
<a-input :class="{'box-input':!isClass}" :value="value"
readonly
:title="value"
@click.native="standardClick"
:placeholder="$t('PleaseSelect')+query.db_field_txt"/>
</div>
<a-drawer
:title="$t('PersonnelSelection')"
:maskClosable="false"
:width="600"
placement="right"
:closable="true"
@close="handleCancel"
:visible="visible"
style="height: 100%;overflow: auto;padding-bottom: 53px;">
<a-input-search style="margin-bottom: 8px" :placeholder="$t('NodeQuickLookup')"
v-model="searchModel" @search="onSearch"/>
<div class="drawer-content">
<JLoading :loading="loading">{{$t('dataLoading')}}</JLoading>
<a-tree
style="margin-bottom: 60px;height: 600px"
v-if="treeVisible"
checkable
checkStrictly
:loading="loading"
:tree-data="gData"
@check="onCheck"
@expand="onExpand"
v-model:checkedKeys="defaultCheckedKeys"
:defaultExpandedKeys="defaultExpandedKeys"
>
</a-tree>
</div>
<div class="drawer-bootom-button">
<a-button @click="handleCancel" style="margin-right: 16px">{{$t('cancel')}}</a-button>
<a-button @click="handleSubmit" type="primary">{{$t('submit')}}</a-button>
</div>
</a-drawer>
</div>
</template>
<script>
import { getAction, postAction } from '@/api/manage'
import virtualNodeTree from '@/components/virtualNodeTree/tree'
import XEUtils from 'xe-utils'
import VXETable from 'vxe-table'
export default {
name: 'problemPersonnelSelection',
props: ['query', 'value', 'personneQuery', 'isSingleChoice', 'isInput', 'isClass', 'isDelete', 'disabled', 'selectDepartment'],
components: {
virtualNodeTree
},
data() {
return {
loading: false,
gData: [],
autoExpandParent: false,
checkboxList: [],
expandedKeys: [],
visible: false,
treeVisible: false,
confirmLoading: false,
departId: '',
selectedKey: [],
userIds: [],
searchModel: '',
defaultExpandedKeys: [],
defaultCheckedKeys: [],
defaultCheckedKeysName: [],
content: [],
dataList: [],
defaultExpandAll: false,
searchData: ''
}
},
mounted() {
},
methods: {
standardClick() {
this.treeVisible = false
this.departId = ''
this.searchModel = ''
this.searchData = ''
this.userIds = []
this.userName = []
this.queryDepartUserTreeList(1)
this.visible = true
},
standardDelete() {
this.$emit('input', null)
this.$forceUpdate()
this.$emit('deleteData', this.query.db_field_name)
},
onCheck(checkedKeys, info) {
this.userIds = checkedKeys.checked
this.userName = []
if (this.userIds.length > 0) {
for (let i = 0; i < this.userIds.length; i++) {
for (let j = 0; j < this.defaultCheckedKeysName.length; j++) {
if (this.userIds[i] == this.defaultCheckedKeysName[j].id) {
this.userName.push(this.defaultCheckedKeysName[j].name)
}
}
}
}
if (info.checkedNodes && info.checkedNodes.length > 0) {
info.checkedNodes.forEach(res => {
if (res.data.props.dataRef.key) {
this.content.push({
id: res.data.props.dataRef.key,
title: res.data.props.dataRef.title
})
} else {
this.content.push({
id: res.data.props.id,
title: res.data.props.title
})
}
})
}
if (this.content && this.content.length > 0) {
for (let i = 0; i < this.content.length; i++) {
for (let j = i + 1; j < this.content.length; j++) {
if (this.content[i].id == this.content[j].id) {
this.content.splice(j, 1)
j--
}
}
}
this.userIds.forEach(res => {
this.content.forEach(val => {
if (res == val.id) {
this.userName.push(val.title)
}
})
})
}
if (this.userName.length > 0) {
for (let i = 0; i < this.userName.length; i++) {
for (let j = i + 1; j < this.userName.length; j++) {
if (this.userName[i] == this.userName[j]) {
this.userName.splice(j, 1)
j--
}
}
}
}
},
handleCancel() {
this.visible = false
this.treeVisible = false
},
handleSubmit() {
// if (this.userIds && this.userIds.length > 0) {
if (this.isSingleChoice) {
if (this.userIds.length > 1) {
this.$message.warning(this.$t('onlyOnePersonCanBeSelected'))
return
}
}
let userIds = JSON.parse(JSON.stringify(this.userIds))
let userName = JSON.parse(JSON.stringify(this.userName))
// userName = userName.filter(function(item, index) {
// return userName.indexOf(item) === index // 因为indexOf 只能查找到第一个
// })
// userIds = userIds.filter(function(item, index) {
// return userIds.indexOf(item) === index // 因为indexOf 只能查找到第一个
// })
this.$emit('input', userName.join(','))
this.$emit('change', this.query.db_field_name, userIds.join(','), this.query.subscript)
this.visible = false
this.treeVisible = false
// } else {
// this.$message.warning(this.$t('pleaseSelectPersonFirst'))
// }
},
indexclick(event) {
this.$emit('input', event.target.value)
this.departId = ''
this.searchModel = ''
this.userIds = []
this.userName = []
this.defaultCheckedKeys = []
},
onSearch(e) {
this.gData = []
this.departId = ''
this.visibleTree = false
if (e) {
this.getUserAndDepart()
} else {
this.treeVisible = false
this.queryDepartUserTreeList(2)
}
},
getUserAndDepart() {
getAction('sys/user/getUserAndDepart', { name: this.searchModel }).then((res) => {
if (res) {
this.gData = res.filter(ele => ele.flag === 'DEPART')
} else {
this.gData = []
}
this.visibleTree = true
})
},
onExpand(selectedKeys, val) {
if (this.searchModel == '' || !this.searchModel) {
if (val.expanded) {
if (this.departId == val.node.value) {
} else {
this.departId = val.node.value
this.queryDepartUserTreeList(2)
}
}
}
},
queryDepartUserTreeList(num) {
let gData = JSON.parse(JSON.stringify(this.gData))
if (gData && gData.length > 0) {
gData = JSON.stringify(gData)
} else {
gData = ''
}
this.confirmLoading = true
this.loading = true
//queryDepartUserTreeList
//queryUserTreeList
postAction('sys/user/queryDepartUserTreeList', {
departId: this.departId,
json: gData,
}).then((res) => {
this.confirmLoading = false
if (res.success) {
this.loading = false
this.gData = res.result
this.gData = [...this.gData]
// this.gData[0].isLeaf = false
this.defaultExpandedKeys = [this.departId]
if (num == 1) {
if (this.userName && this.userName.length == 0) {
if (this.personneQuery[this.query.db_field_name + 'Name']) {
this.userName = this.personneQuery[this.query.db_field_name + 'Name'].split(',')
} else if (this.personneQuery[this.query.db_field_name]) {
this.userName = this.personneQuery[this.query.db_field_name].split(',')
} else {
this.userName = []
}
}
if (this.userIds && this.userIds.length == 0) {
if (this.personneQuery[this.query.db_field_name + '_id']) {
this.userIds = this.personneQuery[this.query.db_field_name + '_id'].split(',')
} else if (this.personneQuery[this.query.db_field_name]) {
this.userIds = this.personneQuery[this.query.db_field_name].split(',')
} else {
this.userIds = []
}
}
this.defaultCheckedKeys = this.userIds
this.defaultCheckedKeys = [...this.defaultCheckedKeys]
this.defaultCheckedKeysName = []
if (this.defaultCheckedKeys.length > 0) {
for (let i = 0; i < this.defaultCheckedKeys.length; i++) {
this.defaultCheckedKeysName.push({
id: this.defaultCheckedKeys[i],
name: this.userName[i]
})
}
}
}
this.defaultExpandAll = false
this.treeVisible = true
} else {
this.gData = []
}
})
}
}
}
</script>
<style scoped>
.box-title-text {
line-height: 1.4;
display: flex;
}
.box-input {
display: inline-block;
height: 38px;
width: 100%;
}
.button-box {
margin-left: 10px;
height: 38px;
line-height: 38px;
}
.drawer-bootom-button {
position: absolute;
bottom: 0;
width: 100%;
z-index: 100;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
.drawer-content {
height: calc(100% - 60px);
overflow: auto;
position: relative;
}
.my-tree {
padding: 0 10px;
/*border: 1px solid #e8eaec;*/
}
.my-tree .my-tree-item {
height: 32px;
line-height: 32px;
}
.my-tree .my-tree-item.has-child .tree-icon {
visibility: visible;
transition: all 0.3s;
}
.my-tree .my-tree-item.is-expand .tree-icon {
transform: rotate(90deg);
}
.my-tree .tree-icon {
cursor: pointer;
width: 20px;
line-height: 20px;
text-align: center;
visibility: hidden;
user-select: none;
}
.caret-right {
margin-right: 4px;
font-size: 14px;
}
.checkbox {
margin-right: 8px;
}
::v-deep .ant-checkbox-group {
width: 100%;
height: 600px;
}
.treeWrap {
height: calc(100vh - 240px);
}
.active {
color: #21c9cc;
display: inline-block;
}
</style>
@@ -341,24 +341,11 @@
<!-- @click="viewClick(record)">-->
<!-- {{ $t('view') }}-->
<!-- </a>-->
<!-- <a class="text-operation"-->
<!-- v-if="(-->
<!-- record.verifyFlowStatus == 'List to be released' ||-->
<!-- record.verifyFlowStatus == 'Regulatory engineer returns' ||-->
<!-- record.verifyFlowStatus == 'Compliance' ||-->
<!-- record.verifyFlowStatus == 'Non-Compliance' ||-->
<!-- record.verifyFlowStatus == 'To be tracked' ||-->
<!-- record.verifyFlowStatus == 'NA')-->
<!-- && (record.designFlowStatus == 'List to be released' ||-->
<!-- record.designFlowStatus == 'Regulatory engineer returns' ||-->
<!-- record.designFlowStatus == 'Compliance' ||-->
<!-- record.designFlowStatus == 'Non-Compliance' ||-->
<!-- record.designFlowStatus == 'To be tracked' ||-->
<!-- record.designFlowStatus == 'NA')-->
<!-- && roleSwitchingCode == 0"-->
<!-- @click="deleteLib(record)">-->
<!-- {{ $t('deleteLib') }}-->
<!-- </a>-->
<a class="text-operation"
v-if="roleSwitchingCode == 0"
@click="deleteLib(record)">
{{ $t('deleteLib') }}
</a>
<a class="text-operation"
@click="resultReportedClick(record)">
{{ $t('resultReported') }}
@@ -2383,31 +2370,35 @@
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
let _this = this
let selectedRowKeys = JSON.parse(JSON.stringify(_this.selectedRowKeys))
let selectedRowKeysList = []
let isTrue = false
for (let i = 0; i < this.dataSource.length; i++) {
for (let j = 0; j < selectedRowKeys.length; j++) {
if (this.dataSource[i].id == selectedRowKeys[j]) {
if (
(this.dataSource[i].verifyFlowStatus == 'List to be released' ||
this.dataSource[i].verifyFlowStatus == 'Compliance' ||
this.dataSource[i].verifyFlowStatus == 'Non-Compliance' ||
this.dataSource[i].verifyFlowStatus == 'To be tracked' ||
this.dataSource[i].verifyFlowStatus == 'NA')
&&
(this.dataSource[i].designFlowStatus == 'List to be released' ||
this.dataSource[i].designFlowStatus == 'Compliance' ||
this.dataSource[i].designFlowStatus == 'Non-Compliance' ||
this.dataSource[i].designFlowStatus == 'To be tracked' ||
this.dataSource[i].designFlowStatus == 'NA')) {
isTrue = true
} else {
isTrue = false
this.$message.warning(this.$t('onlyDeleted'))
return
}
selectedRowKeysList.push(this.dataSource[i])
}
}
}
for (let i = 0; i < selectedRowKeysList.length; i++) {
if (
(selectedRowKeysList[i].verifyFlowStatus == 'List to be released' ||
selectedRowKeysList[i].verifyFlowStatus == 'Compliance' ||
selectedRowKeysList[i].verifyFlowStatus == 'Non-Compliance' ||
selectedRowKeysList[i].verifyFlowStatus == 'To be tracked' ||
selectedRowKeysList[i].verifyFlowStatus == 'NA')
&&
(selectedRowKeysList[i].designFlowStatus == 'List to be released' ||
selectedRowKeysList[i].designFlowStatus == 'Compliance' ||
selectedRowKeysList[i].designFlowStatus == 'Non-Compliance' ||
selectedRowKeysList[i].designFlowStatus == 'To be tracked' ||
selectedRowKeysList[i].designFlowStatus == 'NA')) {
isTrue = true
} else {
isTrue = false
// this.$message.warning(this.$t('onlyDeleted'))
break
}
}
if (isTrue) {
this.$confirm({
content: _this.$t('ConfirmBatchDeletion'),
@@ -2427,6 +2418,25 @@
})
}
})
}else{
this.$confirm({
content: _this.$t('thereProcessInProgressDeletion')+'?',
onOk() {
let idList = JSON.parse(JSON.stringify(_this.selectedRowKeys))
postAction(_this.url.deleteBatch, {
ids: idList.join(','),
projectLibraryId: _this.$route.query.id
}).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.selectedRowKeys = []
_this.getList()
} else {
_this.$message.warning(res.message)
}
})
}
})
}
} else {
this.$message.warning(this.$t('selectLeastOne'))
@@ -2445,19 +2455,44 @@
//删除
deleteLib(val) {
let _this = this
this.$confirm({
content: _this.$t('ConfirmDelete'),
onOk() {
deleteAction(_this.url.deleteOne, { id: val.id, projectLibraryId: _this.$route.query.id }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.getList()
} else {
_this.$message.warning(_this.$t('operationFailed'))
}
})
}
})
if ((val.verifyFlowStatus == 'List to be released' ||
val.verifyFlowStatus == 'Compliance' ||
val.verifyFlowStatus == 'Non-Compliance' ||
val.verifyFlowStatus == 'To be tracked' ||
val.verifyFlowStatus == 'NA')&&
(val.designFlowStatus == 'List to be released' ||
val.designFlowStatus == 'Compliance' ||
val.designFlowStatus == 'Non-Compliance' ||
val.designFlowStatus == 'To be tracked' ||
val.designFlowStatus == 'NA')){
this.$confirm({
content: _this.$t('ConfirmDelete'),
onOk() {
deleteAction(_this.url.deleteOne, { id: val.id, projectLibraryId: _this.$route.query.id }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.getList()
} else {
_this.$message.warning(_this.$t('operationFailed'))
}
})
}
})
}else{
this.$confirm({
content: _this.$t('thereProcessInProgressDeletion')+'?',
onOk() {
deleteAction(_this.url.deleteOne, { id: val.id, projectLibraryId: _this.$route.query.id }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.getList()
} else {
_this.$message.warning(_this.$t('operationFailed'))
}
})
}
})
}
},
//选择数据
onSelectChange(value, rows) {
@@ -2674,7 +2709,7 @@
title: this.$t('operation'),
align: 'left',
fixed: 'right',
width: long == 'zh-cn' ? 140 : 186,
width: long == 'zh-cn' ? 180 : 226,
scopedSlots: { customRender: 'operation' }
})
this.columnsAll.forEach((item) => {