Browse Source

2025-04-02

master
qiezi 10 months ago
parent
commit
665a6ae573
  1. 158
      src/views/modules/project/projectInfo/com_projectInfo-add-or-update.vue
  2. 4
      src/views/modules/sys/user-add-or-update.vue

158
src/views/modules/project/projectInfo/com_projectInfo-add-or-update.vue

@ -118,9 +118,9 @@
:close-on-click-modal="false"
:visible.sync="managerFlag">
<el-transfer class="rq" filterable v-model="projectManagerList" :props="{
key: 'operatorId',
label: 'operatorName'
}" :data="operatorList" :titles="['未选择', '已选择']"></el-transfer>
key: 'operatorId',
label: 'operatorName'
}" :data="operatorList" :titles="['未选择', '已选择']"></el-transfer>
<span slot="footer" class="dialog-footer">
<div style="margin-top: 5px">
<el-button type="primary" @click="saveManagerList()">确定</el-button>
@ -135,15 +135,13 @@
:close-on-click-modal="false"
:visible.sync="ownerFlag">
<el-transfer class="rq" filterable v-model="projectOwnerList" :props="{
key: 'operatorId',
label: 'operatorName'
}" :data="operatorList" :titles="['未选择', '已选择']"></el-transfer>
key: 'operatorId',
label: 'operatorName'
}" :data="operatorList" :titles="['未选择', '已选择']"></el-transfer>
<span slot="footer" class="dialog-footer">
<div style="margin-top: 5px">
<el-button type="primary" @click="saveOwnerList()">确定</el-button>
<el-button @click="ownerFlag = false" type="primary">取消</el-button>
</div>
</span>
<el-button type="primary" @click="saveOwnerList()">确定</el-button>
<el-button @click="ownerFlag = false" type="primary">取消</el-button>
</span>
</el-dialog>
<el-dialog
@ -166,7 +164,7 @@
:data="userRoleList"
border
:height="300"
v-loading="false"
v-loading="queryUserRoleListLoading"
style="width: 100%;">
<el-table-column
prop="username"
@ -265,6 +263,7 @@
import DictDataSelect from "../../sys/dict-data-select.vue";
import {queryCustomer
} from "@/api/customer/customerInformation";
import item from "../../code/item.vue";
export default {
@ -387,6 +386,8 @@
],
},
saveCheckAll:'N',
queryUserRoleListLoading:false,
}
},
created () {
@ -400,6 +401,13 @@
// this.saveCheckAll='N'
}
},
queryUserRoleListLoading(newVal,oldVal){
if (newVal){
setTimeout(()=>{
this.queryUserRoleListLoading = false
},5000)
}
}
},
computed:{
saveCheckAllIndeterminate(){
@ -505,7 +513,7 @@
if (this.dataForm.customerId){
requestCustomer = JSON.parse(JSON.stringify(this.dataForm))
}
if(this.dataForm.id!=0){
if(this.dataForm.id!==0){
let inData={
page: 1,
limit: 10,
@ -563,6 +571,8 @@
userRoleList:[],
productSet:'',
}
//
this.addRollForUsername(this.$store.state.user.name,this.$store.state.user.userDisplay)
// this.searchUserRollAll();
}
@ -577,10 +587,20 @@
projectId:this.dataForm.projectId,
username:this.userRoleForm.username,
userDisplay:this.userRoleForm.userDisplay,
checkList:this.dataForm.userRoleList,
}
this.queryUserRoleListLoading = true
this.userRoleList = []
searchUserRoll(inData3).then(({data}) => {
this.userRoleList = data.rows;
if (data && data.code === 0){
this.userRoleList = data.rows;
}else {
this.$message.warning(data.msg)
}
this.queryUserRoleListLoading = false
}).catch((error)=>{
this.$message.error(error)
this.queryUserRoleListLoading = false
})
},
searchUserRollAll(){
@ -608,12 +628,22 @@
},
saveManagerList(){
let projectManagerName='';
for (let i = 0; i < this.projectManagerList.length; i++) {
let select= this.operatorList.filter(item => item.operatorId === this.projectManagerList[i])
if(select.length>0){
projectManagerName+=select[0].operatorName+';'
this.addRollForUsername(select[0].operatorId,select[0].operatorName);
}
let indexList = [];
let selectionOwnerList = this.operatorList.filter((item,index) => {
indexList.push(index)
return this.projectManagerList.includes(item.operatorId)
})
projectManagerName=selectionOwnerList.map(item => item.operatorName).join(';');
// for (let i = 0; i < this.projectManagerList.length; i++) {
// let select= this.operatorList.filter(item => item.operatorId === this.projectManagerList[i])
// if(select.length > 0){
// projectManagerName+=select[0].operatorName+';'
// this.addRollForUsername(select[0].operatorId,select[0].operatorName);
// }
// }
for (let i = 0; i < indexList.length; i++) {
let row = this.operatorList[indexList[i]]
this.addRollForUsername(row.operatorId,row.operatorName)
}
this.dataForm.projectManagerName=projectManagerName
this.dataForm.projectManagerList=JSON.parse(JSON.stringify(this.projectManagerList));
@ -634,21 +664,31 @@
},
saveOwnerList(){
let projectOwnerName='';
for (let i = 0; i < this.projectOwnerList.length; i++) {
let select= this.operatorList.filter(item => item.operatorId === this.projectOwnerList[i])
if(select.length>0){
projectOwnerName+=select[0].operatorName+';'
this.addRollForUsername(select[0].operatorId,select[0].operatorName);
}
let indexList = [];
let selectionOwnerList = this.operatorList.filter((item,index) => {
indexList.push(index)
return this.projectOwnerList.includes(item.operatorId)
})
projectOwnerName=selectionOwnerList.map(item => item.operatorName).join(';');
// for (let i = 0; i < this.projectOwnerList.length; i++) {
// let select= this.operatorList.filter(item => item.operatorId === this.projectOwnerList[i])
// if(select.length>0){
// projectOwnerName+=select[0].operatorName+';'
// // this.`addRollForUsername`(select[0].operatorId,select[0].operatorName);
// }
// }
for (let i = 0; i < indexList.length; i++) {
let row = this.operatorList[indexList[i]]
this.addRollForUsername(row.operatorId,row.operatorName)
}
this.dataForm.projectOwnerName=projectOwnerName
this.dataForm.projectOwnerName = projectOwnerName
this.dataForm.projectOwnerList=JSON.parse(JSON.stringify(this.projectOwnerList));
this.ownerFlag=false
},
addRollForUsername(username,userDisplay){
debugger
if(this.dataForm.userRoleList.length>0) {
let checkList = this.dataForm.userRoleList.filter(item => item.username === username)
if (checkList.length === 0) {
@ -665,11 +705,8 @@
userDisplay: userDisplay,
username: username,
})
this.dataForm.userRoleName += userDisplay + ';'
}
}else {
console.log(username)
console.log(userDisplay)
this.dataForm.userRoleList=[{
checkAll: true,
deleteCheck: true,
@ -683,40 +720,45 @@
userDisplay: userDisplay,
username: username,
}]
this.dataForm.userRoleName = userDisplay + ';'
}
this.dataForm.userRoleName = this.dataForm.userRoleList.map(item => item.userDisplay).join(';');
},
userRollModal(){
this.searchUserRoll()
this.userRoleFlag=true
},
saveUserList(){
for (let i = 0; i <this.userRoleList.length ; i++) {
if(this.userRoleList[i].username===this.$store.state.user.name){
this.userRoleList[i].searchCheck=true;
this.userRoleList[i].updateCheck=true;
this.userRoleList[i].downCheck=true;
this.userRoleList[i].deleteCheck=true;
this.userRoleList[i].searchFlag='Y'
this.userRoleList[i].updateFlag='Y'
this.userRoleList[i].downFlag='Y'
this.userRoleList[i].deleteFlag='Y'
}
}
let name= '';
for (let i = 0; i < this.userRoleList.length; i++) {
this.dataForm.userRoleList=this.dataForm.userRoleList.filter(item => item.username != this.userRoleList[i].username)
if(this.userRoleList[i].searchCheck||this.userRoleList[i].updateCheck||this.userRoleList[i].downCheck||this.userRoleList[i].deleteCheck){
this.dataForm.userRoleList.push(this.userRoleList[i])
}
}
for (let i = 0; i < this.dataForm.userRoleList.length; i++) {
if(this.dataForm.userRoleList[i].searchCheck||this.dataForm.userRoleList[i].updateCheck
||this.dataForm.userRoleList[i].downCheck||this.dataForm.userRoleList[i].deleteCheck){
name+=this.dataForm.userRoleList[i].userDisplay+';'
}
}
this.dataForm.userRoleName=name
let name = "";
let selectionUserList = this.userRoleList.filter(item => item.searchCheck || item.updateCheck || item.downCheck || item.deleteCheck)
this.dataForm.userRoleList = [...selectionUserList]
name = selectionUserList.map(item => item.userDisplay).join(";")
// for (let i = 0; i <this.userRoleList.length ; i++) {
// if(this.userRoleList[i].username===this.$store.state.user.name){
// this.userRoleList[i].searchCheck=true;
// this.userRoleList[i].updateCheck=true;
// this.userRoleList[i].downCheck=true;
// this.userRoleList[i].deleteCheck=true;
// this.userRoleList[i].searchFlag='Y'
// this.userRoleList[i].updateFlag='Y'
// this.userRoleList[i].downFlag='Y'
// this.userRoleList[i].deleteFlag='Y'
// }
// }
// let name = '';
// for (let i = 0; i < this.userRoleList.length; i++) {
// this.dataForm.userRoleList=this.dataForm.userRoleList.filter(item => item.username !== this.userRoleList[i].username)
// if(this.userRoleList[i].searchCheck||this.userRoleList[i].updateCheck||this.userRoleList[i].downCheck||this.userRoleList[i].deleteCheck){
// this.dataForm.userRoleList.push(this.userRoleList[i])
// }
// }
// for (let i = 0; i < this.dataForm.userRoleList.length; i++) {
// if(this.dataForm.userRoleList[i].searchCheck||this.dataForm.userRoleList[i].updateCheck
// ||this.dataForm.userRoleList[i].downCheck||this.dataForm.userRoleList[i].deleteCheck){
// name+=this.dataForm.userRoleList[i].userDisplay+';'
// }
// }
this.dataForm.userRoleName = name
// this.dataForm.userRoleList=JSON.parse(JSON.stringify(this.userRoleList));
this.userRoleFlag=false

4
src/views/modules/sys/user-add-or-update.vue

@ -364,6 +364,10 @@ export default {
},
//
dataFormSubmit() {
if (!this.dataForm.userDisplay){
this.$message.warning((this.buttons.userDisplay||'用户名') +"不能为空")
return
}
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({

Loading…
Cancel
Save