标准法规库 配置标准 增加已选择 功能

This commit is contained in:
hanshaozhuang
2022-07-14 16:36:19 +08:00
parent 7d49ddb184
commit 0d95f0c36f
3 changed files with 315 additions and 25 deletions
@@ -965,7 +965,8 @@
border
:header-cell-style="{background: '#f8f8f9', color: '#515a6e'}"
@sort-change="sortChangeConfig"
@selection-change="selectConfigStandChange">
@select="handleSelectConfigStand"
@select-all="selectConfigStandAll">
<el-table-column
type="selection"
width="55"
@@ -1018,6 +1019,20 @@
@pageChange="configuraPageChange"
@pageSizeChange="configuraPageSizeChange"></pagination>
<loading :loading="configLoading">加载中...</loading>
<div class="divDel">
<div class="divDel_title">已选标准</div>
<div class="divDel_box">
<el-tag
v-for="tag in selectConfigStandList"
:key="tag.id"
size="mini"
@close="handleTagClose(tag)"
closable>
{{tag.standCode}}
</el-tag>
<!-- <el-tag v-show="delList.length > 0 && !checkBox" type="danger" closable size="mini" @close="handleCloseAll()">全部删除</el-tag>-->
</div>
</div>
</div>
<div class="demo-drawer-footer">
<el-button
@@ -2320,6 +2335,8 @@ export default {
configStandtotal: 0,
height: null,
selectConfigStand: [],
selectConfigStandList: [],
selectConfigStandMap: new Map(),
configLoading: false, // 配置表格加载中
searchConfigNodes: [], // 责任部门树结构
zNodesSItem: [],
@@ -3374,6 +3391,8 @@ export default {
this.sarConfigStandSearch.replaceStandNum = ''
this.configPage = 1
this.selectConfigStand = []
this.selectConfigStandList = []
this.selectConfigStandMap = new Map()
},
async saveConfStand(item) {
if(item.menuId && item.menuId !== ''){
@@ -3401,14 +3420,17 @@ export default {
search.menuId = this.selectSarMenu.id
search.menuName = this.selectSarMenu.menuName
search.treeType = this.selectSarMenu.treeType
if (this.selectConfigStand.length === 0) {
if (this.selectConfigStandList.length === 0) {
this.$message({
showClose: true,
message: '请至少选择一条标准',
type: 'warning'
})
} else {
search.idlist = this.selectConfigStand
search.idlist = []
for (let i = 0; i < this.selectConfigStandList.length; i++) {
search.idlist.push(this.selectConfigStandList[i].id)
}
this.$http.postData('lawss/sarBussionessStand/saveStandardsMenu', search, {
_this: this,
loading: 'isSubmit'
@@ -3459,13 +3481,50 @@ export default {
}
this.selectConfiguraStand()
},
// 表格
selectConfigStandChange(alldata) {
this.selectConfigStand = []
for (let i = 0; i < alldata.length; i++) {
this.selectConfigStand.push(alldata[i].id)
// 已选标准-删除
handleTagClose(row){
this.handleSelectConfigStand({},row)
this.$refs.selection.toggleRowSelection(row,false)
},
// 配置标准弹窗-表格-单选
handleSelectConfigStand(selection, row){
if(this.selectConfigStandMap.get(row.id)){
this.selectConfigStandMap.delete(row.id)
for(let i=0; i<this.selectConfigStandList.length; i++){
if(this.selectConfigStandList[i].id === row.id){
this.selectConfigStandList.splice(i,1)
return
}
}
}else{
this.selectConfigStandMap.set(row.id,row)
this.selectConfigStandList.push(row)
}
},
// 配置标准弹窗-表格-全选
selectConfigStandAll(selection) {
if(selection.length !== 0 ){
for (let i = 0; i < selection.length; i++) {
if(!this.selectConfigStandMap.get(selection[i].id)){
this.selectConfigStandList.push(selection[i])
this.selectConfigStandMap.set(selection[i].id, selection[i])
}
}
}else{
for(let i=0; i<this.configStandList.length; i++){
this.selectConfigStandMap.delete(this.configStandList[i].id)
}
if(this.selectConfigStandMap.size === 0){
this.selectConfigStandList = []
}else{
this.selectConfigStandList = []
this.selectConfigStandMap.forEach(item=>{
this.selectConfigStandList.push(item)
})
}
}
},
SearchTreeConfigDblClick(treeId, treeNode) {
this.sarConfigStandSearch.responsibleUnit = treeNode.id
this.sarConfigStandSearch.orgName = treeNode.name
@@ -4555,6 +4614,13 @@ export default {
this.configStandList = res.data.list
this.configTotal = res.data.count
this.selectConfigStand = []
this.$nextTick(()=>{
this.configStandList.forEach(item=>{
if(this.selectConfigStandMap.get(item.id)){
this.$refs.selection.toggleRowSelection(item,true)
}
})
})
}, e => {
})
},
@@ -5578,7 +5644,7 @@ export default {
.el-drawer__wrapper {
.demo-drawer-content {
.drawer-content {
//height: calc(~'100% - 52px - 56px');
height: calc(~'100% - 52px - 56px - 100px');
flex: auto;
display: flex;
flex-direction: column;
@@ -5607,4 +5673,24 @@ export default {
::v-deep .el-drawer {
outline: none !important;
}
.divDel {
border-top: 1px solid #000;
height: 100px;
.divDel_title {
margin: 10px;
}
.divDel_box {
height: 55px;
padding: 0px;
display: flex;
flex-wrap: wrap;
overflow: auto;
margin: 10px;
align-content: flex-start;
span {
margin: 0px 5px 5px 0;
}
}
}
</style>