From ef9eb48046f8dfbb3c18b0f45befcbeddbdf6899 Mon Sep 17 00:00:00 2001
From: value <z1292839451@163.com>
Date: 星期三, 29 五月 2024 03:56:23 +0800
Subject: [PATCH] 光纤配置数据回显和保存
---
src/components/view/person-manage.vue | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 101 insertions(+), 16 deletions(-)
diff --git a/src/components/view/person-manage.vue b/src/components/view/person-manage.vue
index 739eebf..5938846 100644
--- a/src/components/view/person-manage.vue
+++ b/src/components/view/person-manage.vue
@@ -175,7 +175,7 @@
<el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button>
</div>
<div class="search_thing" style="display: flex;justify-content: right;margin-right: 10px;">
- <el-button size="small" type="primary" @click="openthirdParty" v-if="selectCompaniesList">鑾峰彇涓夋柟浜哄憳</el-button>
+ <el-button size="small" type="primary" @click="openthirdParty" v-if="addUserPower">鑾峰彇涓夋柟浜哄憳</el-button>
<el-button size="small" type="primary" @click="opeaAdd" v-if="addPower">鏂板鐢ㄦ埛</el-button>
</div>
</div>
@@ -208,11 +208,25 @@
clearable @blur="searchFilter2" @clear="searchFilter2" @keyup.enter.native="searchFilter2()">
</el-input>
<el-tree :data="datathirdParty" node-key="id" :props="defaultProps" @node-click="nodeClick2"
- style="height: calc(100% - 42px);" :filter-node-method="filterNode2" ref="tree2" highlight-current>
+ style="height: calc(100% - 42px);"
+ @node-expand="nodeOpen0" :filter-node-method="filterNode2" ref="tree2" highlight-current>
</el-tree>
</el-col>
<el-col :span="15" style="height: 70vh;padding-left: 8px;">
- <el-table height="70vh" border stripe :data="personList" v-loading="personLoad" ref="personTable"
+ <div class="search_thing" style="width: 360px;margin-bottom: 10px;">
+ <div class="search_label" style="width: 140px;">鍛樺伐鍙�/鍛樺伐濮撳悕锛�</div>
+ <div class="search_input">
+ <el-input
+ size="small"
+ placeholder="璇疯緭鍏ュ伐鍙�/鍛樺伐濮撳悕"
+ @clear="searchPerson"
+ clearable
+ v-model="userSearch2"
+ @keyup.enter.native="searchPerson()">
+ <i slot="suffix" class="el-input__icon el-icon-search" style="cursor: pointer;" @click="searchPerson"></i></el-input>
+ </div>
+ </div>
+ <el-table height="67vh" border stripe :data="personList" v-loading="personLoad" ref="personTable"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="50">
</el-table-column>
@@ -275,7 +289,8 @@
font: '缂栬緫',
type: 'text',
method: 'doDiy',
- field: ['createUserName', 'updateUserName', 'roleName', '瑙掕壊=roleId', '瀵嗙爜=password']
+ field: ['roleName', '瑙掕壊=roleId', '瀵嗙爜=password',
+ '濮撳悕EN=nameEn','骞撮緞=age','閭=email','鍗曚綅=company','绛惧悕=pictureUrl','鏈汉鐓�=signatureUrl']
}],
tagField: {
state: {
@@ -330,8 +345,8 @@
upIndex: 0,
addDia: false,
addPower: true,
+ addUserPower: true,
delStandardTree: true,
- selectCompaniesList: true,
addDia0: false,
addOb: {
fatherId: '',
@@ -344,12 +359,19 @@
expandedKeys: [],
addLoad: false,
personList: [],
+ personListCopy:[],
treeLoad: false,
personLoad: false,
search2: '',
- multipleSelection: []
+ multipleSelection: [],
+ companiesList:[],
+ currentCompaniesList: [],
+ userSearch2:''
}
},
+ // watch: {
+ // userSearch2(val){}
+ // },
mounted() {
this.selectTreeList()
this.selectRole()
@@ -360,6 +382,7 @@
openthirdParty() {
this.addthirdParty = true;
this.$axios.get(this.$api.companies.selectCompaniesList).then(res => {
+ this.companiesList = JSON.parse(JSON.stringify(res.data));
this.datathirdParty = []
for (let ai = 0; ai < res.data.length; ai++) {
let a = res.data[ai]
@@ -443,8 +466,8 @@
let power = JSON.parse(sessionStorage.getItem('power'))
let up = false
let add = false
+ let addUserPower = false
let delStandardTree = false
- let selectCompaniesList = false
for (var i = 0; i < power.length; i++) {
if (power[i].menuMethod == 'updateUser') {
up = true
@@ -455,8 +478,8 @@
if (power[i].menuMethod == 'delDepartment') {
delStandardTree = true
}
- if(power[i].menuMethod == 'selectCompaniesList'){
- selectCompaniesList = true
+ if (power[i].menuMethod == 'selectCompaniesList') {
+ addUserPower = true
}
}
if (!up) {
@@ -464,11 +487,13 @@
}
this.delStandardTree = delStandardTree
this.addPower = add
- this.selectCompaniesList = selectCompaniesList
+ this.addUserPower = addUserPower
},
handleAdd() {
- if (this.addOb.fatherId) {
- this.addDia0 = true;
+ console.log(`output->this.addOb.fatherId`,this.addOb.fatherId)
+ console.log(`output->this.addOb.name`,this.addOb.name)
+ if (this.addOb.fatherId||this.addOb.name=='鍏ㄩ儴') {
+ this.addDia = true;
} else {
this.$message.error('璇烽�夋嫨涓�涓灦鏋勫眰绾�')
}
@@ -499,11 +524,14 @@
}
this.selectTree = data2.replace(' - ', '')
this.addOb.fatherId = val.id;
- this.componentData.entity.departId = val.id;
+ this.componentData.entity.departId = val.id + ',';
this.refreshTable()
},
nodeOpen(data, node, el) {
$($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder-opened')
+ },
+ nodeOpen0(data, node, el){
+ this.currentCompaniesList[node.level-1] = data.id
},
nodeClose(data, node, el) {
$($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder')
@@ -561,33 +589,90 @@
return
}
this.$message.success('娣诲姞鎴愬姛')
- this.addDia0 = false
+ this.addDia = false
this.selectTreeList()
this.addLoad = false
this.addOb.name = ''
this.addOb.fatherId = ''
}).catch(e => {
- this.addDia0 = false
+ this.addDia = false
this.addLoad = false
})
},
nodeClick2(ob, node, el) {
+ this.getNodeParent(node)
if (ob.id !== 'SC21') {
this.personLoad = true
this.$axios.post(this.$api.companies.selectSimpleList, {
companyId: ob.id
}).then(res => {
+ this.personListCopy = JSON.parse(JSON.stringify(res.data))
this.personList = res.data
this.personLoad = false
this.$refs.personTable.doLayout()
})
}
},
+ getNodeParent(val){
+ this.currentCompaniesList[val.level-1] = val.data.id
+ if(val.parent!=null){
+ this.getNodeParent(val.parent)
+ }
+ },
handleSelectionChange(val) {
this.multipleSelection = val;
- console.log(this.multipleSelection);
},
addUser2(){
+ if(this.multipleSelection.length === 0){
+ return this.$message.error('璇烽�夋嫨浜哄憳')
+ }
+ if(this.currentCompaniesList.length === 0){
+ return this.$message.error('璇烽�夋嫨缁勭粐')
+ }
+ /* for (let index = this.currentCompaniesList.length-1; index >1; index--) {
+ let obj = this.multipleSelection.find(a=>a.companyId==this.currentCompaniesList[index])
+ if(!obj){
+ this.currentCompaniesList.splice(index,1)
+ }
+ } */
+ let arr = []
+ this.currentCompaniesList.forEach(b=>{
+ let obj = this.companiesList.find(a=>a.companyId==b)
+ arr.push(obj)
+ })
+ this.addLoad = true
+ this.$axios.post(this.$api.companies.addPersonUser, {
+ company: arr,
+ person: this.multipleSelection
+ }, {
+ headers: {
+ 'Content-Type': 'application/json'
+ }
+ }).then(res => {
+ if (res.code === 201) {
+ this.addLoad = false
+ return
+ }
+ this.$message.success('鎿嶄綔鎴愬姛')
+ this.multipleSelection = []
+ this.$refs.personTable.clearSelection()
+ this.addthirdParty = false
+ this.addLoad = false
+ this.personList = []
+ this.userSearch2 = ''
+ this.selectTreeList()
+ }).catch(e => {
+ this.addthirdParty = false
+ this.addLoad = false
+ })
+ },
+ searchPerson(){
+ let arr = JSON.parse(JSON.stringify(this.personListCopy))
+ this.personList = arr.filter(a=>{
+ if(a.employeeID.includes(this.userSearch2)||a.name.includes(this.userSearch2)){
+ return true
+ }
+ })
}
}
}
--
Gitblit v1.9.3