Browse Source

2025-04-02

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

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

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

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

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

Loading…
Cancel
Save