
8 changed files with 797 additions and 285 deletions
@ -0,0 +1,393 @@ |
|||||
|
<template> |
||||
|
<div class="app-container"> |
||||
|
|
||||
|
<button-bar ref="btnbar" view-title="推送详情" :btndisabled="btndisabled" @btnhandle="btnHandle" /> |
||||
|
<div class="main-content"> |
||||
|
<div class="mid"> |
||||
|
<div class="left"> |
||||
|
<div class="listtop" style="width: 400px"> |
||||
|
<div class="tit" >项目列表</div> |
||||
|
</div> |
||||
|
<el-table :data="formobj" border ref="multipleTab" max-height="540px" style="width: 400px" highlight-current-row |
||||
|
@row-click="singleElection"> |
||||
|
<el-table-column align="center" width="55" label="选择"> |
||||
|
<template slot-scope="scope"> |
||||
|
<!-- 可以手动的修改label的值,从而控制选择哪一项 --> |
||||
|
<el-radio class="radio" v-model="uploadData.projectSid" :label="scope.row.sid" style="margin-left:10px" |
||||
|
>{{''}}</el-radio |
||||
|
> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="entryName" label="项目名称" /> |
||||
|
</el-table> |
||||
|
</div> |
||||
|
<div class="rigth"> |
||||
|
<div class="rihthGl"> |
||||
|
<div class="rigthJg"> |
||||
|
<div class="listtop" style="width: 100%"> |
||||
|
<span>项目关联人员</span> |
||||
|
<button class="Waiting" @click="getWaiting">设为待选</button> |
||||
|
</div> |
||||
|
<el-table ref="multipleTable" :data="dataListOne" border max-height="340px" style="width: 350px" |
||||
|
@selection-change="handlChange" tooltip-effect="dark" > |
||||
|
<el-table-column type="selection" width="55" align="center"/> |
||||
|
<el-table-column prop="name" label="ID" align="center" /> |
||||
|
<el-table-column prop="orgName" label="单位" align="center" /> |
||||
|
</el-table> |
||||
|
</div> |
||||
|
|
||||
|
<div class="rigthYh"> |
||||
|
<div class="listtop" style="width: 100%"> |
||||
|
<span>待选人员</span> |
||||
|
<button class="relevance" @click="getRelevance">设为关联</button> |
||||
|
</div> |
||||
|
<div class="org-tree"> |
||||
|
<el-tree |
||||
|
:data="sysorganList" |
||||
|
show-checkbox |
||||
|
node-key="sid" |
||||
|
:props="props" |
||||
|
ref="tree" |
||||
|
highlight-current |
||||
|
check-strictly |
||||
|
:default-checked-keys="uploadData.users" |
||||
|
:default-expanded-keys="['fd6435f2-0005-11ec-a033-48452053aa33','3042d730-64e8-4e34-b08a-44adca4da3a5']" @check="handleNodeClick"> |
||||
|
</el-tree> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="Btn"> |
||||
|
<el-button type="primary" @click="getPurchaseList">保存</el-button> |
||||
|
<el-button type="primary" style="margin-left: 40px;" @click="getCancel">取消</el-button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import req from '@/api/projectStaff/index' |
||||
|
import ButtonBar from '@/components/ButtonBar' |
||||
|
import Pagination from '@/components/pagination' |
||||
|
import pageye from '@/components/pagination/pageye' |
||||
|
export default { |
||||
|
name: 'SupplierBankInfoIndex', |
||||
|
components: { |
||||
|
ButtonBar, |
||||
|
Pagination, |
||||
|
pageye |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
btndisabled: false, |
||||
|
viewState: 1, // 1、列表 2、添加 3、修改 4、查看 |
||||
|
isSearchShow: false, |
||||
|
searchxianshitit: '显示查询条件', |
||||
|
tableLoading: false, |
||||
|
formobj:[], |
||||
|
dataListOne: [], |
||||
|
props: { |
||||
|
label: 'name', |
||||
|
children: 'children' |
||||
|
}, |
||||
|
btnList: [ |
||||
|
{ |
||||
|
type: 'info', |
||||
|
size: 'small', |
||||
|
icon: 'cross', |
||||
|
btnKey: 'doClose', |
||||
|
btnLabel: '关闭' |
||||
|
} |
||||
|
], |
||||
|
queryParams: { |
||||
|
current: 1, |
||||
|
size: 10, |
||||
|
total: 0, |
||||
|
params: { |
||||
|
typeName: '', |
||||
|
} |
||||
|
}, |
||||
|
sids: [], |
||||
|
templateSelection: "", |
||||
|
// 当前选择的行的数据 |
||||
|
checkList: [], |
||||
|
uploadData:{ |
||||
|
projectSid:'', |
||||
|
users:[], |
||||
|
}, |
||||
|
ValSid:[], |
||||
|
ValSids:[], |
||||
|
sysorganList:[], |
||||
|
} |
||||
|
}, |
||||
|
mounted() { |
||||
|
this.$refs['btnbar'].setButtonList(this.btnList) |
||||
|
}, |
||||
|
created() { |
||||
|
this.loadList() |
||||
|
}, |
||||
|
methods: { |
||||
|
// 搜索条件效果 |
||||
|
clicksearchShow() { |
||||
|
this.isSearchShow = !this.isSearchShow |
||||
|
if (this.isSearchShow) { |
||||
|
this.searchxianshitit = '隐藏查询条件' |
||||
|
} else { |
||||
|
this.searchxianshitit = '显示查询条件' |
||||
|
} |
||||
|
}, |
||||
|
btnHandle(btnKey) { |
||||
|
switch (btnKey) { |
||||
|
case 'doClose': |
||||
|
this.doClose() |
||||
|
break |
||||
|
default: |
||||
|
break |
||||
|
} |
||||
|
}, |
||||
|
loadList() { |
||||
|
req.projectinformation().then(res=>{ |
||||
|
if (res.success) { |
||||
|
this.formobj = res.data |
||||
|
this.uploadData.projectSid = res.data[0].sid |
||||
|
req.getUserProjectBySid(res.data[0].sid).then(res=>{ |
||||
|
this.dataListOne=res.data |
||||
|
this.forList() |
||||
|
this.estimate() |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
req.sysorganization().then(res=>{ |
||||
|
if (res.success) { |
||||
|
this.sysorganList = res.data |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
clearList(){ |
||||
|
this.ValSid=[] |
||||
|
this.ValSids=[] |
||||
|
this.dataListOne=[] |
||||
|
this.uploadData={ |
||||
|
projectSid:'', |
||||
|
users:[], |
||||
|
} |
||||
|
}, |
||||
|
singleElection(row) { |
||||
|
this.clearList() |
||||
|
this.uploadData.projectSid = row.sid |
||||
|
req.getUserProjectBySid(row.sid).then(res=>{ |
||||
|
this.dataListOne=res.data |
||||
|
this.forList() |
||||
|
this.estimate() |
||||
|
}) |
||||
|
}, |
||||
|
// 序号 |
||||
|
indexMethod(index) { |
||||
|
var pagestart = (this.queryParams.current - 1) * this.queryParams.size |
||||
|
var pageindex = index + 1 + pagestart |
||||
|
return pageindex |
||||
|
}, |
||||
|
dosearch() { |
||||
|
this.queryParams.current = 1 |
||||
|
this.loadList() |
||||
|
}, |
||||
|
resetQuery() { |
||||
|
this.queryParams = { |
||||
|
current: 1, |
||||
|
size: 10, |
||||
|
total: 0, |
||||
|
params: { |
||||
|
typeName: '', |
||||
|
} |
||||
|
} |
||||
|
this.loadList() |
||||
|
}, |
||||
|
resetState() { |
||||
|
this.viewState = 1 |
||||
|
}, |
||||
|
// 点击待选 |
||||
|
getWaiting(){ |
||||
|
if(this.ValSid[0]){ |
||||
|
for(var i=0;i<this.dataListOne.length;i++){ |
||||
|
for(var j=0;j<this.ValSid.length;j++){ |
||||
|
if(this.ValSid[j].userSid==this.dataListOne[i].userSid){ |
||||
|
this.dataListOne.splice(i,1) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
this.forList() |
||||
|
this.estimate() |
||||
|
}else{ |
||||
|
this.$message({ |
||||
|
message: '请选择待选的数据', |
||||
|
type: 'warning' |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
// 点击关联 |
||||
|
getRelevance(){ |
||||
|
if(this.ValSids[0]){ |
||||
|
let arrLists=this.ValSids |
||||
|
let arr=[] |
||||
|
for(var i=0;i<arrLists.length;i++){ |
||||
|
let orgnames=this.$refs.tree.getNode(arrLists[i]).parent.data.name |
||||
|
let bb={ |
||||
|
name: arrLists[i].name, |
||||
|
orgName: orgnames, |
||||
|
userSid:arrLists[i].sid |
||||
|
} |
||||
|
arr.push(bb) |
||||
|
} |
||||
|
this.dataListOne=arr |
||||
|
}else{ |
||||
|
this.$message({ |
||||
|
message: '请选择要改变的关联在点击', |
||||
|
type: 'warning' |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
forList(){ |
||||
|
let vals=this.dataListOne |
||||
|
let arrSids=[] |
||||
|
for(let i=0;i<vals.length;i++){ |
||||
|
arrSids.push(vals[i].userSid) |
||||
|
} |
||||
|
this.uploadData.users=arrSids |
||||
|
}, |
||||
|
getPurchaseList(){ |
||||
|
this.forList() |
||||
|
req.userprojectSave(this.uploadData).then(res=>{ |
||||
|
if (res.success) { |
||||
|
this.$message({ |
||||
|
showClose: true, |
||||
|
type: 'success', |
||||
|
message: res.msg |
||||
|
}) |
||||
|
this.clearList() |
||||
|
this.loadList() |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
getCancel(){ |
||||
|
this.clearList() |
||||
|
this.loadList() |
||||
|
// this.$nextTick(()=>{ |
||||
|
// this.$refs.multipleTab.setCurrentRow(this.baseDataList[0]) |
||||
|
// }) |
||||
|
}, |
||||
|
handlChange(val){ |
||||
|
this.ValSid=val |
||||
|
}, |
||||
|
handleNodeClick(val,num){ |
||||
|
let checkdata=this.$refs.tree.getCheckedNodes() |
||||
|
let arr=[] |
||||
|
for(let i=0;i<checkdata.length;i++){ |
||||
|
arr.push(checkdata[i]) |
||||
|
} |
||||
|
this.removeByvalue(arr,undefined) |
||||
|
this.ValSids=arr |
||||
|
}, |
||||
|
// 过滤多于数据 |
||||
|
removeByvalue(arr,val){ |
||||
|
for(var i=0;i<arr.length;i++){ |
||||
|
if(arr[i]==val){ |
||||
|
arr.splice(i,1) |
||||
|
break |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
estimate(){ |
||||
|
let allParentId = [] |
||||
|
this.sysorganList.forEach(ele => allParentId.push(ele.sid)) |
||||
|
//要勾选的节点id列表,数据应该来自后台 |
||||
|
let checkedKeyArray = this.uploadData.users |
||||
|
//只需要叶子节点的id |
||||
|
let children = checkedKeyArray.filter(menuId => ! allParentId.includes(menuId) ); |
||||
|
this.$refs.tree.setCheckedKeys(children) |
||||
|
}, |
||||
|
doClose() { |
||||
|
this.$store.dispatch('tagsView/delView', this.$route) |
||||
|
this.$router.go(-1) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
<style scoped lang="scss"> |
||||
|
::v-deep .el-tree .el-tree-node .is-leaf + .el-checkbox .el-checkbox__inner{display: inline-block;} |
||||
|
::v-deep .el-tree .el-tree-node .el-checkbox .el-checkbox__inner{display: none;} |
||||
|
.main-content{ |
||||
|
.mid{ |
||||
|
width: 100%; |
||||
|
height: 540px; |
||||
|
margin-top: 30px; |
||||
|
.left{ |
||||
|
float: left; |
||||
|
} |
||||
|
.rigth{ |
||||
|
float: right; |
||||
|
width: 63%; |
||||
|
height: 540px; |
||||
|
border: 1px solid #dfe6ec; |
||||
|
position: relative; |
||||
|
.rihthGl{ |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
display: flex; |
||||
|
justify-content: space-around; |
||||
|
.rigthJg{ |
||||
|
margin-top: 50px; |
||||
|
width: 350px; |
||||
|
.listtop{ |
||||
|
.Waiting{ |
||||
|
width: 75px; |
||||
|
height: 32px; |
||||
|
border: 2px solid #018ad2; |
||||
|
color: #018ad2; |
||||
|
font-size: 14px; |
||||
|
border-radius: 5px; |
||||
|
margin-right: 10px; |
||||
|
} |
||||
|
.Waiting:hover{ |
||||
|
background-color: #fff; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
.rigthYh{ |
||||
|
margin-top: 50px; |
||||
|
width: 350px; |
||||
|
.org-tree{ |
||||
|
width:100%; |
||||
|
max-height: 340px; |
||||
|
box-sizing: border-box; |
||||
|
/*padding-right: 10px;*/ |
||||
|
border: 1px solid #edf1f7; |
||||
|
overflow: scroll; |
||||
|
overflow-x:hidden; |
||||
|
} |
||||
|
.listtop{ |
||||
|
.relevance{ |
||||
|
width: 75px; |
||||
|
height: 32px; |
||||
|
border: 2px solid #018ad2; |
||||
|
color: #018ad2; |
||||
|
font-size: 14px; |
||||
|
border-radius: 5px; |
||||
|
margin-right: 10px; |
||||
|
} |
||||
|
.relevance:hover{ |
||||
|
background-color: #fff; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
.Btn{ |
||||
|
position: absolute; |
||||
|
left: 40%; |
||||
|
top: 85%; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
</style> |
Loading…
Reference in new issue