From 18e67adf6b0390a07962b03fdc4db8b58f90d817 Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期三, 15 五月 2024 15:28:32 +0800 Subject: [PATCH] 修改用户管理 --- src/components/view/person-manage.vue | 156 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 146 insertions(+), 10 deletions(-) diff --git a/src/components/view/person-manage.vue b/src/components/view/person-manage.vue index e3d8ba1..3542f40 100644 --- a/src/components/view/person-manage.vue +++ b/src/components/view/person-manage.vue @@ -46,32 +46,31 @@ .search { background-color: #fff; - height: 80px; + height: 60px; display: flex; align-items: center; } .search_thing { - width: 350px; + width: 250px; display: flex; align-items: center; } .search_label { - width: 110px; + width: 90px; font-size: 14px; text-align: right; } .search_input { - width: calc(100% - 110px); + width: calc(100% - 90px); } .table { - margin-top: 10px; + margin-top: 4px; background-color: #fff; - height: calc(100% - 100px); - padding: 20px; + height: calc(100% - 44px); } </style> <style> @@ -83,20 +82,47 @@ justify-content: center; } </style> +<style> + .person_manage .el-tree-node__content { + height: 32px; + font-size: 14px; + border-radius: 2px; + } + .person_manage .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content { + color: #3A7BFA; + } + + .person_manage .has-gutter .el-table__cell .cell { + line-height: 34px; + background-color: #f8f8f8; + } + + .person_manage .has-gutter .el-table__cell { + background-color: #fafafa !important; + } + + .person_manage .el-table__row .cell { + font-size: 14px; + } + + .person_manage .el-table .warning-row .cell { + color: #bababa; + } +</style> <template> <div class="person_manage"> <!-- <el-row class="title"> <el-col :span="12" style="padding-left: 20px;">鐢ㄦ埛绠$悊</el-col> <el-col :span="12" style="text-align: right;"> - <el-button size="medium" type="primary" @click="opeaAdd" v-if="addPower">鏂板鐢ㄦ埛</el-button> + </el-col> </el-row> --> <div class="left"> <el-row> <el-col :span="20"> <el-input placeholder="杈撳叆鍏抽敭瀛楄繘琛屾悳绱�" suffix-icon="el-icon-search" v-model="search" size="small" - style="margin-bottom: 5px;" clearable @blur="searchFilter" @clear="searchFilter"></el-input> + style="margin-bottom: 5px;" clearable @blur="searchFilter" @clear="searchFilter" @keyup.enter.native="searchFilter()"></el-input> </el-col> <el-col :span="4" style="text-align: center;line-height: 30px;" v-if="addPower"> <el-button type="primary" icon="el-icon-plus" size="mini" circle @click="handleAdd"></el-button> @@ -150,6 +176,10 @@ <el-button size="small" @click="refresh()">閲� 缃�</el-button> <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button> </div> + <div class="search_thing"> + <el-button size="small" type="primary" @click="openthirdParty">鑾峰彇涓夋柟浜哄憳</el-button> + <el-button size="small" type="primary" @click="opeaAdd" v-if="addPower">鏂板鐢ㄦ埛</el-button> + </div> </div> <div class="table"> <ValueTable ref="ValueTable" :url="$api.user.selectUserList" :upUrl="$api.user.updateUser" :componentData="componentData" :key="upIndex" @upUser="upUser"/> @@ -171,6 +201,22 @@ <el-button type="primary" @click="addStandardTree" :loading="addLoad">纭� 瀹�</el-button> </span> </el-dialog> + <el-dialog title="娣诲姞涓夋柟浜哄憳" :visible.sync="addthirdParty" width="400px"> + <div class="body"> + <el-tree + :data="datathirdParty" + show-checkbox + node-key="id" + :default-expanded-keys="[2, 3]" + :default-checked-keys="[5]" + :props="defaultProps"> + </el-tree> + <span slot="footer" style="padding-left: 200px"> + <el-button @click="addthirdParty = false" size="mini">鍙� 娑�</el-button> + <el-button type="primary" @click="" :loading="addLoad" size="mini">纭� 瀹�</el-button> + </span> + </div> + </el-dialog> </div> </template> @@ -182,11 +228,52 @@ }, data() { return { + datathirdParty:[{ + id: 1, + label: '涓�绾� 1', + children: [{ + id: 4, + label: '浜岀骇 1-1', + children: [{ + id: 9, + label: '涓夌骇 1-1-1' + }, { + id: 10, + label: '涓夌骇 1-1-2' + }] + }] + }, { + id: 2, + label: '涓�绾� 2', + children: [{ + id: 5, + label: '浜岀骇 2-1' + }, { + id: 6, + label: '浜岀骇 2-2' + }] + }, { + id: 3, + label: '涓�绾� 3', + children: [{ + id: 7, + label: '浜岀骇 3-1' + }, { + id: 8, + label: '浜岀骇 3-2' + }] + }], + defaultProps: { + children: 'children', + label: 'label' + }, + addthirdParty:false, componentData: { entity: { name: null, state: null, company: null, + departId:null, orderBy:{ field: 'id', order: 'asc' @@ -246,6 +333,7 @@ }, */ requiredAdd:['account','name','state','roleId','password','nameEn','phone'], requiredUp:['account','name','state','roleId','nameEn','phone'], + // disabledUp:['departId'], addUpload:['pictureUrl','signatureUrl'], addUploadConfig:{ accept:'.png, .jpg, .jpeg, .gif', @@ -256,6 +344,7 @@ upIndex: 0, addDia: false, addPower: true, + delStandardTree:true, addDia0:false, addOb:{ fatherId:'', @@ -276,12 +365,17 @@ this.getPower() }, methods: { + openthirdParty(){ + this.addthirdParty=true; + + }, refreshTable() { this.$refs['ValueTable'].selectList() }, refresh() { this.componentData.entity = this.HaveJson(this.entityCopy) - this.upIndex++ + // this.upIndex++ + this.refreshTable() }, upUser(row){ console.log(row); @@ -299,7 +393,12 @@ }) }, opeaAdd(){ + if(!this.addOb.fatherId||this.selectTree==''||this.selectTree=='鍏ㄩ儴'){ + this.$message.error('璇烽�夋嫨涓�涓粍缁�') + return + } this.$refs.ValueTable.openAddDia(this.$api.user.addUser); + this.$refs['ValueTable'].upData.departId = this.selectTree }, selectTreeList(){ /* this.$axios.get(this.$api.department.selectDepartment).then(res => { @@ -322,6 +421,7 @@ let power = JSON.parse(sessionStorage.getItem('power')) let up = false let add = false + let delStandardTree = false for (var i = 0; i < power.length; i++) { if(power[i].menuMethod=='updateUser'){ up = true @@ -329,10 +429,14 @@ if(power[i].menuMethod=='addUser'){ add = true } + if(power[i].menuMethod=='delDepartment'){ + delStandardTree = true + } } if(!up){ this.componentData.do.splice(0, 1) } + this.delStandardTree = delStandardTree this.addPower = add }, handleAdd(){ @@ -369,6 +473,12 @@ nodeClose(data, node, el) { $($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder') }, + getNodeParent(val) { + if (val.parent != null) { + this.selectTree += ' - ' + val.label + this.getNodeParent(val.parent) + } + }, remove(node, data) { this.$confirm("鏄惁鍒犻櫎璇ュ眰绾�", "鎻愮ず", { type: "error" @@ -400,6 +510,32 @@ this.refreshTable() }) }, + addStandardTree() { + if (this.addOb.name == null || this.addOb.factory == '') { + this.$message.error('鏋勬灦鍚嶇О鏄繀濉」') + return + } + this.addLoad = true + this.$axios.post(this.$api.department.addDepartment, this.addOb, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + if (res.code === 201) { + this.addLoad = false + return + } + this.$message.success('娣诲姞鎴愬姛') + this.addDia0 = false + this.selectTreeList() + this.addLoad = false + this.addOb.name = '' + this.addOb.fatherId = '' + }).catch(e => { + this.addDia0 = false + this.addLoad = false + }) + }, } } </script> -- Gitblit v1.9.3