From 2bb0e066fdc522beb51dd13f6a72cd67bd5d6a58 Mon Sep 17 00:00:00 2001 From: “dzb” <2632970487@qq.com> Date: 星期日, 09 十月 2022 18:06:46 +0800 Subject: [PATCH] 修改bug,店铺管理新增、查询 --- src/views/operate/fivepack/shop/components/main/index.vue | 2 src/views/operate/baseSetting/illegalBuild/index.vue | 17 src/views/systemSetting/baseSetting/user/components/main/index.vue | 53 ++- src/views/operate/fivepack/shop/components/createUser/index.vue | 153 ++++++---- src/views/operate/baseSetting/violation/index.vue | 45 +- src/views/systemSetting/baseSetting/role/createUser/index.vue | 31 + src/views/systemSetting/baseSetting/role/updateUser/index.vue | 98 ++--- src/views/operate/disposal/casepool/pool/index.vue | 2 src/views/systemSetting/baseSetting/department/createUser/index.vue | 77 +++-- src/views/systemSetting/baseSetting/department/index.vue | 23 + src/views/operate/fivepack/shop/components/header/index.vue | 6 src/views/systemSetting/baseSetting/user/components/updateUser/index.vue | 102 ++++-- src/views/systemSetting/baseSetting/user/components/createUser/index.vue | 213 ++++++++------ src/views/systemSetting/baseSetting/role/index.vue | 19 + 14 files changed, 505 insertions(+), 336 deletions(-) diff --git a/src/views/operate/baseSetting/illegalBuild/index.vue b/src/views/operate/baseSetting/illegalBuild/index.vue index 91fd871..25a0963 100644 --- a/src/views/operate/baseSetting/illegalBuild/index.vue +++ b/src/views/operate/baseSetting/illegalBuild/index.vue @@ -48,13 +48,13 @@ </el-table> <!-- 鏌ョ湅淇敼椤甸潰 --> <el-dialog :visible.sync="dialogUpdate" width="45%" :title="updateFlag ? '淇敼杩濆缓淇℃伅' :'鏌ョ湅杩濆缓淇℃伅'" - v-if="dialogUpdate" :before-close="handleClose"> + v-if="dialogUpdate" :before-close="handleClose2"> <updateUser :updateFlag="updateFlag" :userInfo=userInfo @changeDialog="changeDialog" /> </el-dialog> <!-- tools --> <div class="tools"> <div class="funs"> - <div class="funsItem"> + <!-- <div class="funsItem"> <el-checkbox v-model="all" @change="selectAll()">鍏ㄩ��</el-checkbox> </div> <div class="funsItem"> @@ -66,7 +66,7 @@ :value="item.value" :disabled="item.disabled"> </el-option> </el-select> - </div> + </div> --> </div> <div class="pagination"> <el-pagination background :current-page="currentPage" layout="prev, pager, next" @@ -254,6 +254,17 @@ done(); }) .catch(_ => { }); + }, + handleClose2(done){ + if(this.updateFlag){ + this.$confirm('纭鍏抽棴锛�') + .then(_ => { + done(); + }) + .catch(_ => { }); + }else{ + done(); + } } } } diff --git a/src/views/operate/baseSetting/violation/index.vue b/src/views/operate/baseSetting/violation/index.vue index cc28303..3204c91 100644 --- a/src/views/operate/baseSetting/violation/index.vue +++ b/src/views/operate/baseSetting/violation/index.vue @@ -16,7 +16,7 @@ <el-button class="addBtn" type="primary" @click="dialogCreate = true">鏂板杩濊绫诲瀷</el-button> <el-dialog :visible.sync="dialogCreate" title="鏂板杩濊绫诲瀷" width="45%" v-if="dialogCreate" :before-close="handleClose"> - <createUser @changeDialog=changeDialog /> + <createUser @changeDialog=changeDialog /> </el-dialog> </div> </div> @@ -32,13 +32,13 @@ </el-table-column> <el-table-column prop="number" label="杩濊浜嬮」缂栧彿" min-width="10"> </el-table-column> - <el-table-column prop="type" label="鎵�灞炵被鍨�" min-width="10"> + <el-table-column prop="typeThird" label="鎵�灞炵被鍨�" min-width="10"> </el-table-column> - <el-table-column prop="typeFirst" label="鎵�灞炲ぇ绫�" min-width="10"> + <el-table-column prop="typeSecond" label="鎵�灞炲ぇ绫�" min-width="10"> </el-table-column> - <el-table-column prop="typeSecond" label="鎵�灞炲皬绫�" min-width="10"> + <el-table-column prop="typeFirst" label="鎵�灞炲皬绫�" min-width="10"> </el-table-column> - <el-table-column prop="typeThird" label="妗堢敱" min-width="45"> + <el-table-column prop="type" label="妗堢敱" min-width="45"> </el-table-column> <el-table-column prop="operation" label="鎿嶄綔" min-width="10"> <template slot-scope="scope"> @@ -52,14 +52,14 @@ </el-table> <!-- 鏌ョ湅淇敼椤甸潰 --> <el-dialog :visible.sync="dialogUpdate" width="45%" :title="updateFlag ? '鏉冮檺璁剧疆' :'鏌ョ湅瑙掕壊淇℃伅'" - v-if="dialogUpdate" :before-close="handleClose"> + v-if="dialogUpdate" :before-close="handleClose2"> <updateUser :updateFlag="updateFlag" :userInfo=userInfo :getUserList=" context ? getUserList : getUserList" @changeDialog="changeDialog" /> </el-dialog> <!-- tools --> <div class="tools"> <div class="funs"> - <div class="funsItem"> + <!-- <div class="funsItem"> <el-checkbox v-model="all" @change="selectAll()">鍏ㄩ��</el-checkbox> </div> <div class="funsItem"> @@ -71,7 +71,7 @@ :value="item.value" :disabled="item.disabled"> </el-option> </el-select> - </div> + </div> --> </div> <div class="pagination"> <el-pagination background :current-page="currentPage" layout="prev, pager, next" @@ -89,7 +89,7 @@ import createUser from "./createUser" export default { components: { - updateUser,createUser + updateUser, createUser }, data() { return { @@ -132,16 +132,16 @@ }, methods: { // 鎵归噺鍒犻櫎 - mulDelete(idArr){ + mulDelete(idArr) { console.log(idArr); this.$axios({ - method:'delete', - url:'sccg/violations/batch_delete?ids='+idArr, - }).then(res=>{ + method: 'delete', + url: 'sccg/violations/batch_delete?ids=' + idArr, + }).then(res => { this.getUserList(); this.$message({ - message:res.message, - type:res.code === 200 ? 'success' : 'warning' + message: res.message, + type: res.code === 200 ? 'success' : 'warning' }) }) }, @@ -277,11 +277,24 @@ this.currentPage = page; this.getUserList(); }, - changeDialog({flag}) { + changeDialog({ flag }) { this.dialogCreate = flag; this.dialogUpdate = flag; this.getUserList(); }, + handleClose2(done) { + if (this.updateFlag) { + this.$confirm('纭鍏抽棴锛�') + .then(_ => { + this.dialogCreate = false; + this.dialogUpdate = false; + done(); + }) + .catch(_ => { }); + } else { + done(); + } + }, handleClose(done) { this.$confirm('纭鍏抽棴锛�') .then(_ => { diff --git a/src/views/operate/disposal/casepool/pool/index.vue b/src/views/operate/disposal/casepool/pool/index.vue index 89d9262..b54da2e 100644 --- a/src/views/operate/disposal/casepool/pool/index.vue +++ b/src/views/operate/disposal/casepool/pool/index.vue @@ -75,7 +75,7 @@ </el-table-column> <el-table-column prop="operation" label="鎿嶄綔" min-width="20"> <template slot-scope="scope"> - <div class="operation"> + <div class="operation" v-if="statusArr[0]===0"> <span @click="handleFind(scope.row)">涓婃姤</span> <span class="line">|</span> <span @click="handleDispatch(scope.row)">璋冨害</span> diff --git a/src/views/operate/fivepack/shop/components/createUser/index.vue b/src/views/operate/fivepack/shop/components/createUser/index.vue index f6b3f2c..dbf7350 100644 --- a/src/views/operate/fivepack/shop/components/createUser/index.vue +++ b/src/views/operate/fivepack/shop/components/createUser/index.vue @@ -2,46 +2,43 @@ <div class="createUser"> <main> <div class="mainContent"> - <el-form ref="user" label-width="140px" autoComplete="on" :model="user" :rules="createUserRules" + <el-form ref="user" label-width="140px" autoComplete="on" :model="store" :rules="createUserRules" label-position="right"> <!-- 搴楅摵绫诲瀷 --> <el-form-item class="optionItem" label="搴楅摵绫诲瀷:" prop="storetype"> - <el-select v-model="user.storetype" placeholder="閫夋嫨搴楅摵/闂ㄥ簵绫诲瀷"> - <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value" - :disabled="item.disabled"> + <el-select v-model="store.storetype" placeholder="閫夋嫨搴楅摵/闂ㄥ簵绫诲瀷"> + <el-option v-for="item in shopTypeList" :key="item.name" :label="item.name" :value="item.value"> </el-option> </el-select> </el-form-item> <!-- 搴楅摵鍚嶇О --> <el-form-item class="optionItems" label="搴楅摵鍚嶇О:" prop="storename"> - <el-input v-model="user.password" type="password" placeholder="璇峰~鍐欏簵閾哄悕绉�"></el-input> + <el-input v-model="store.storename" placeholder="璇峰~鍐欏簵閾哄悕绉�"></el-input> </el-form-item> <!-- 璐熻矗浜� --> - <el-form-item class="optionItem" label="璐熻矗浜�:" prop="username"> - <el-input v-model="user.username" placeholder="璇峰~鍐欑敤鎴峰鍚�"></el-input> + <el-form-item class="optionItem" label="璐熻矗浜�:" prop="owner"> + <el-input v-model="store.owner" placeholder="璇峰~鍐欏簵閾鸿礋璐d汉鍚嶅瓧"></el-input> </el-form-item> <!-- 搴楅摵鎻忚堪 --> - <el-form-item class="optionItem" label="搴楅摵鎻忚堪:" prop="mobile"> - <el-input type="textarea" v-model="user.mobile" placeholder="杈撳叆閮ㄩ棬鎻忚堪"></el-input> + <el-form-item class="optionItem" label="搴楅摵鎻忚堪:" prop="storedesc"> + <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" maxlength="300" show-word-limit + v-model="store.storedesc" placeholder="杈撳叆閮ㄩ棬鎻忚堪"></el-input> + <!-- <el-input type="textarea" v-model="user.storedesc" placeholder="杈撳叆閮ㄩ棬鎻忚堪"></el-input> --> </el-form-item> <!-- 鑱旂郴鏂瑰紡 --> - <el-form-item class="optionItem" label="鑱旂郴鏂瑰紡:" prop="email"> - <el-input v-model="user.email" placeholder="璇峰~鍐欏簵閾鸿仈绯绘柟寮�"></el-input> + <el-form-item class="optionItem" label="鑱旂郴鏂瑰紡:" prop="contact"> + <el-input v-model="store.contact" placeholder="璇峰~鍐欏簵閾鸿仈绯绘柟寮�"></el-input> </el-form-item> <!-- 搴楅摵鍦板潃 --> - <el-form-item class="optionItem" label="搴楅摵鍦板潃:" prop="userType"> - <el-select v-model="user.userType" placeholder="璇峰~鍐欏簵閾鸿缁嗗湴鍧�"> - <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value" - :disabled="item.disabled"> - </el-option> - </el-select> + <el-form-item class="optionItem" label="搴楅摵鍦板潃:" prop="storeaddr"> + <el-input v-model="store.storeaddr" placeholder="璇峰~鍐欏簵閾鸿缁嗗湴鍧�"></el-input> </el-form-item> </el-form> </div> </main> <footer> <div class="optionBtn"> - <el-button class="btn reset">鍙栨秷</el-button> + <el-button class="btn reset" @click="handleBack">鍙栨秷</el-button> <el-button type="primary" class="btn submit" @click="handleUser">纭畾</el-button> </div> </footer> @@ -53,7 +50,7 @@ const validateNickname = (rule, value, callback) => { if (!value) { callback(new Error("璐熻矗浜轰笉鑳戒负绌�")); - }else{ + } else { callback(); } }; @@ -66,9 +63,9 @@ }; const validateTruename = (rule, value, callback) => { if (!value) { - callback(); + callback(new Error('搴楅摵鍦板潃涓嶈兘涓虹┖')); } else { - callback(new Error('搴楅摵鍦板潃涓嶈兘涓虹┖')) + callback() } }; const validatePhone = (rule, value, callback) => { @@ -78,17 +75,26 @@ const rep = /(^1[3|4|5|7|8|9]\d{9}$)|(^09\d{8}$)/ if (!rep.test(value)) { callback("璇疯緭鍏ユ纭殑鎵嬫満鍙风爜"); + }else{ + callback(); } } }; const validateMail = (rule, value, callback) => { if (value) { callback(); - }else{ + } else { callback(new Error('搴楅摵鍚嶇О涓嶈兘涓虹┖')) } }; const validateType = (rule, value, callback) => { + if (!value) { + callback(new Error('闂ㄥ簵绫诲瀷涓嶈兘涓虹┖')); + } else { + callback(); + } + }; + const validateDesc = (rule, value, callback) => { if (!value) { callback(); } else { @@ -96,18 +102,23 @@ } }; return { - user: { - contact:'', - idcardinfo:'', - owner:'', - storeaddr:'', - storename:'', - storedesc:'', - storetype:'', + store: { + contact: '', + idcardinfo: '', + owner: '', + storeaddr: '', + storename: '', + storedesc: '', + storetype: '', }, createUserRules: { owner: [ { required: true, trigger: "blur", validator: validateNickname }, + ], + storetype:[ + { + required:true,trigger:'change', validator:validateType, + } ], idcardinfo: [ { required: true, trigger: "blur", validator: validatePass }, @@ -119,51 +130,61 @@ { required: true, trigger: "blur", validator: validatePhone }, ], storename: [ - { required: false, trigger: "blur", validator: validateMail }, + { required: true, trigger: "blur", validator: validateMail }, ], storedesc: [ - { required: true, trigger: "blur", validator: validateType }, + { required: false, trigger: "blur", validator: validateDesc }, ], }, - roleList: [ - { name: '瑙掕壊1', value: 1 }, { name: '瑙掕壊2', value: 2 } + shopTypeList: [ + { name: '绫诲瀷1', value: 1 }, { name: '绫诲瀷2', value: 2 } ], - typeList: [] } }, created() { const that = this; - // 鑾峰彇瑙掕壊鍒楄〃 - // this.$axios.get('') - // 鑾峰彇鐢ㄦ埛绫诲瀷鍒楄〃 - // this.$axios.get('sccg/admin/list',{userType:0}).then(res=>{ - // console.log(res); - // }) - // 鑾峰彇鍏ㄩ儴閮ㄩ棬鍒楄〃 - this.$axios.get('sccg/depart/page').then(res => { - that.typeList = res.data.records; - }) }, methods: { handleUser() { - const { user } = this; - this.$axios.post('sccg/store/storeinfo/add',{ - contact:'18728108911', - idcardinfo:'511025199910028213', - owner:'娴嬭瘯浜哄憳', - storeaddr:'鍥涘窛鐪�', - storename:'娴嬭瘯搴椾竴', - storephoto:'111', - storescore:0, - }) - .then(res => { - console.log(res); - // if (res.code === 200) { - // console.log(1); - // this.$emit('sendDialog', { flag: false }); - // } + const { store } = this; + console.log('in'); + this.$refs.user.validate((valid)=>{ + console.log(valid); + if(valid){ + this.$axios({ + method:'post', + url:'sccg/store/storeinfo/add', + data:{ + contact:store.contact, + idcardinfo:'511025184612310215', + owner:store.owner, + storeaddr:store.storeaddr, + storename:store.storename, + } + }) + .then(res=>{ + console.log(res); + if(res.code===200){ + this.$message({ + type:'success', + message:'娣诲姞鎴愬姛', + }) + this.$emit('sendDialog',{flag:false}); + }else{ + this.$message({ + type:'error', + message:res.message, + }) + } + }) + }else{ + return false; + } }) }, + handleBack(){ + this.$emit('sendDialog',{flag:false}) + } }, props: ['sendDialog'] } @@ -228,6 +249,7 @@ display: flex; justify-content: flex-end; padding: 0 20px; + .optionBtn { display: flex; margin-top: 20px; @@ -237,5 +259,14 @@ } } } + + ::v-deep .el-textarea__inner { + background-color: #09152f; + border: 1px solid #17324c; + } + + ::v-deep .el-input__count { + background-color: #09152f; + } } </style> \ No newline at end of file diff --git a/src/views/operate/fivepack/shop/components/header/index.vue b/src/views/operate/fivepack/shop/components/header/index.vue index c0d58ca..8cbb537 100644 --- a/src/views/operate/fivepack/shop/components/header/index.vue +++ b/src/views/operate/fivepack/shop/components/header/index.vue @@ -21,7 +21,7 @@ </div> <div class="footer"> - <el-dialog :visible.sync="dialogCreate" title="娣诲姞搴楅摵" width="45%" v-if="dialogCreate"> + <el-dialog :visible.sync="dialogCreate" title="娣诲姞搴楅摵" width="45%" v-if="dialogCreate" @close="handleClose"> <createUser @sendDialog="sendDialog" /> </el-dialog> </div> @@ -47,6 +47,10 @@ console.log(flag); this.dialogCreate = flag.flag; this.$emit('setDialog', { flag: true }) + }, + handleClose(){ + console.log(this.dialogCreate); + console.log(1); } }, props: ['setDialog', 'getSearch', 'flag'], diff --git a/src/views/operate/fivepack/shop/components/main/index.vue b/src/views/operate/fivepack/shop/components/main/index.vue index a1a6dbf..72700bb 100644 --- a/src/views/operate/fivepack/shop/components/main/index.vue +++ b/src/views/operate/fivepack/shop/components/main/index.vue @@ -52,7 +52,7 @@ data() { return { tableData: [], - search: "111", + search: "", dialogUpdate: false, updateFlag: false, userInfo: '', diff --git a/src/views/systemSetting/baseSetting/department/createUser/index.vue b/src/views/systemSetting/baseSetting/department/createUser/index.vue index 58926d7..d0e0582 100644 --- a/src/views/systemSetting/baseSetting/department/createUser/index.vue +++ b/src/views/systemSetting/baseSetting/department/createUser/index.vue @@ -18,7 +18,12 @@ </el-form-item> <!-- 閮ㄩ棬绫诲瀷 --> <el-form-item class="optionItem" label="閮ㄩ棬绫诲瀷:" prop="departType"> - <el-input v-model="depart.departType" placeholder="璇烽�夋嫨閮ㄩ棬绫诲瀷"></el-input> + <el-select v-model="depart.departType" placeholder="璇烽�夋嫨閮ㄩ棬绫诲瀷"> + <el-option v-for="item in departTypeList" :key="item.id" :label="item.name" + :value="item.id"> + </el-option> + </el-select> + <!-- <el-input v-model="depart.departType" placeholder="璇烽�夋嫨閮ㄩ棬绫诲瀷"></el-input> --> </el-form-item> <!--娣诲姞浜哄憳 --> <el-form-item class="optionItem add" label="娣诲姞浜哄憳:"> @@ -35,7 +40,7 @@ <div @click="addUser">娣诲姞</div> </div> <div class="scrollWrap"> - <el-checkbox-group :max="3" v-model="checkedUser" @change="handleCheckedUserChange"> + <el-checkbox-group v-model="checkedUser"> <el-checkbox v-for="user in userList" :label="user.id" :key="user.id"> {{user.username}} </el-checkbox> @@ -113,6 +118,7 @@ departList: [], checkedUser: [], openUser: false, + departTypeList: [], } }, created() { @@ -121,28 +127,43 @@ this.getDepartTree(); // 鑾峰彇鐢ㄦ埛鍒楄〃 this.getUserList(); + // 鑾峰彇閮ㄩ棬绫诲瀷鍒楄〃 + this.getDepartTypeList(); }, methods: { handleUser() { this.$refs.user.validate((valid) => { if (valid) { - const { depart, checkedUser } = this; + const { depart, checkedUser, userList } = this; console.log(depart); console.log(checkedUser); - this.$axios.post('/sccg/depart/create', { - departName: depart.departName, - parentId: depart.parentId, departType: depart.departType, departDes: depart.departDes + const arr = []; + checkedUser.forEach(item => { + userList.forEach(child => { + if (item === child.id) { + arr.push({ isLeader: 0, userId: item,}); + } + }) + }) + this.$axios({ + method: 'post', + url:'/sccg/depart/create', + data: { + departName: depart.departName, + parentId: depart.parentId, departType: depart.departType, departDes: depart.departDes, + departManagerList: arr + } }).then(res => { if (res.code === 200) { this.$message({ - message:res.message, - type:'success' + message: res.message, + type: 'success' }) this.refresh(); - }else if(res.code ===2001){ + } else if (res.code === 2001) { this.$message({ - message:res.message, - type:'error' + message: res.message, + type: 'error' }) this.refresh(); } @@ -165,39 +186,33 @@ }, // 鑾峰彇鎵�鏈夌敤鎴蜂俊鎭� getUserList() { - const that = this; - const { currentPage, pageSize, search } = this; // 鑾峰彇鎵�鏈夌敤鎴蜂俊鎭�佺敤鎴锋煡璇�(鏆傛椂鏀寔鐢佃瘽鍙风爜) this.$axios.get(`sccg/admin/list`).then(res => { if (res.code === 200) { - console.log(res) this.userList = res.data.records; - console.log(this.userList); } }) - }, - handleCheckedUserChange(value) { - // console.log(value); - if (value.length > 3) { - console.log(this.checkedUser); - this.$message({ - type: 'warning', - message: '鏈�澶氬彧鑳芥坊鍔犱笁涓垚鍛�' - }) - } - // let checkedCount = value.length; - // this.checkAll = checkedCount === this.cities.length; - // this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length; }, addUser() { console.log(this.checkedUser); this.openUser = false; }, - handleClose(){ - this.$emit('changMyDialog',{flag:false}); + handleClose() { + this.$emit('changMyDialog', { flag: false }); + }, + // 鑾峰彇閮ㄩ棬绫诲瀷 + getDepartTypeList() { + this.$axios({ + method: 'get', + url: 'sccg/dict/query_depart_type', + }) + .then(res => { + console.log(res); + this.departTypeList = res.data; + }) } }, - props: ['refresh','changMyDialog'] + props: ['refresh', 'changMyDialog'] } </script> <style lang="scss" scoped> diff --git a/src/views/systemSetting/baseSetting/department/index.vue b/src/views/systemSetting/baseSetting/department/index.vue index 1e1ac1b..f716b60 100644 --- a/src/views/systemSetting/baseSetting/department/index.vue +++ b/src/views/systemSetting/baseSetting/department/index.vue @@ -12,7 +12,7 @@ <div class="addUser"> <el-button class="addBtn" type="primary" @click="dialogCreate = true">鏂板閮ㄩ棬</el-button> <el-dialog :visible.sync="dialogCreate" title="鏂板閮ㄩ棬淇℃伅" width="45%" v-if="dialogCreate" - :before-close="handleClose"> + :before-close="handleClose2"> <createUser :refresh="context==='' ? getUserList : search " @changMyDialog="changMyDialog" /> </el-dialog> </div> @@ -36,8 +36,8 @@ </el-table-column> <el-table-column prop="departDes" label="閮ㄩ棬鎻忚堪" min-width="10"> </el-table-column> - <el-table-column prop="createTime" label="鍒涘缓鏃堕棿" min-width="10"> - </el-table-column> + <!-- <el-table-column prop="createTime" label="鍒涘缓鏃堕棿" min-width="10"> + </el-table-column> --> <el-table-column prop="status" label="鍚敤" min-width="5"> <template slot-scope="scope"> <el-switch class="switchStyle" v-model="scope.row.status" active-text="寮�" inactive-text="鍏�" @@ -307,15 +307,26 @@ this.search(); }, // 鍏抽棴dialog - changMyDialog({flag}) { + changMyDialog({ flag }) { this.dialogUpdate = flag; this.dialogCreate = flag; }, handleClose(done) { + if (this.updateFlag) { + this.$confirm('纭鍏抽棴锛�') + .then(_ => { + this.dialogUpdate = false; + this.dialogCreate = false; + done(); + }) + .catch(_ => { }); + } else { + done(); + } + }, + handleClose2(done) { this.$confirm('纭鍏抽棴锛�') .then(_ => { - this.dialogUpdate = false; - this.dialogCreate = false; done(); }) .catch(_ => { }); diff --git a/src/views/systemSetting/baseSetting/role/createUser/index.vue b/src/views/systemSetting/baseSetting/role/createUser/index.vue index 5208019..e967385 100644 --- a/src/views/systemSetting/baseSetting/role/createUser/index.vue +++ b/src/views/systemSetting/baseSetting/role/createUser/index.vue @@ -10,12 +10,11 @@ </el-form-item> <!-- 瑙掕壊绫诲瀷 --> <el-form-item class="optionItems" label="瑙掕壊绫诲瀷:" prop="status"> - <el-input v-model="role.type" placeholder="璇烽�夋嫨瑙掕壊绫诲瀷"></el-input> - <!-- <el-select v-model="role.type" placeholder="璇烽�夋嫨瑙掕壊绫诲瀷"> - <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value" - :disabled="item.disabled"> + <!-- <el-input v-model="role.type" placeholder="璇烽�夋嫨瑙掕壊绫诲瀷"></el-input> --> + <el-select v-model="role.type" placeholder="璇烽�夋嫨瑙掕壊绫诲瀷"> + <el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id"> </el-option> - </el-select> --> + </el-select> </el-form-item> <!-- 瑙掕壊鎻忚堪 --> <el-form-item class="optionItem" label="瑙掕壊鎻忚堪:" prop="description"> @@ -83,20 +82,13 @@ { required: false, trigger: "blur", validator: validateTruename }, ], }, + typeList:[], } }, created() { const that = this; // 鑾峰彇瑙掕壊鍒楄〃 - // this.$axios.get('') - // 鑾峰彇鐢ㄦ埛绫诲瀷鍒楄〃 - // this.$axios.get('sccg/admin/list',{userType:0}).then(res=>{ - // console.log(res); - // }) - // 鑾峰彇鍏ㄩ儴閮ㄩ棬鍒楄〃 - // this.$axios.get('sccg/depart/page').then(res => { - // that.typeList = res.data.records; - // }) + this.getRoleTypeList(); }, methods: { handleUser() { @@ -119,6 +111,17 @@ }, handleStop(){ this.refresh(); + }, + // 鑾峰彇瑙掕壊绫诲瀷 + getRoleTypeList(){ + this.$axios({ + method:'get', + url:'sccg/dict/query_role_type', + }) + .then(res=>{ + console.log(res); + this.typeList = res.data; + }) } }, props: ['refresh'] diff --git a/src/views/systemSetting/baseSetting/role/index.vue b/src/views/systemSetting/baseSetting/role/index.vue index ea851d2..9edcb79 100644 --- a/src/views/systemSetting/baseSetting/role/index.vue +++ b/src/views/systemSetting/baseSetting/role/index.vue @@ -12,7 +12,7 @@ <div class="addUser"> <el-button class="addBtn" type="primary" @click="dialogCreate = true">鏂板缓瑙掕壊</el-button> <el-dialog :visible.sync="dialogCreate" title="鏂板瑙掕壊" width="45%" v-if="dialogCreate" - :before-close="handleClose"> + :before-close="handleClose2"> <createUser :refresh="context==='' ? getUserList : search" /> </el-dialog> </div> @@ -76,7 +76,7 @@ <!-- tools --> <div class="tools"> <div class="funs"> - <div class="funsItem"> + <!-- <div class="funsItem"> <el-checkbox v-model="all" @change="selectAll()">鍏ㄩ��</el-checkbox> </div> <div class="funsItem"> @@ -88,7 +88,7 @@ :value="item.value" :disabled="item.disabled"> </el-option> </el-select> - </div> + </div> --> </div> <div class="pagination"> <el-pagination background :current-page="currentPage" layout="prev, pager, next" @@ -349,13 +349,24 @@ this.dialogView = flag; }, handleClose(done) { - this.$confirm('纭鍏抽棴锛�') + if(this.updateFlag){ + this.$confirm('纭鍏抽棴锛�') .then(_ => { this.dialogUpdate = false; this.dialogCreate = false; done(); }) .catch(_ => { }); + }else{ + done(); + } + }, + handleClose2(done){ + this.$confirm('纭鍏抽棴锛�') + .then(_ => { + done(); + }) + .catch(_ => { }); } } } diff --git a/src/views/systemSetting/baseSetting/role/updateUser/index.vue b/src/views/systemSetting/baseSetting/role/updateUser/index.vue index b697ddf..295bcbe 100644 --- a/src/views/systemSetting/baseSetting/role/updateUser/index.vue +++ b/src/views/systemSetting/baseSetting/role/updateUser/index.vue @@ -4,8 +4,8 @@ <div class="mainContent"> <div class="my-tree"> <div class="my-tree__wrap"> - <el-tree ref="tree" :data="roleList" :props="defaultProps" show-checkbox - @check="handleCheck" :default-checked-keys="checkedIds" default-expand-all node-key="id"> + <el-tree ref="tree" :data="roleList" :props="defaultProps" show-checkbox @check="handleCheck" + :default-checked-keys="checkedIds" default-expand-all node-key="id"> </el-tree> </div> <div class="my-tree__bottom"></div> @@ -45,26 +45,6 @@ this.getMenuList(); }, methods: { - handleUser() { - this.$refs.user.validate((valid) => { - if (valid) { - const { role } = this; - console.log(role); - this.$axios.post('/sccg/role/update/' + role.id, { - id: role.id, - status: role.status, - description: role.description, - name: role.name, - sort: 0 - }).then(res => { - this.$emit('changeDialog', { dialogUpdate: false }); - this.getUserList(); - }) - } else { - return false; - } - }) - }, // 鑾峰彇绯荤粺鑿滃崟 getMenuList() { this.$axios({ @@ -75,14 +55,6 @@ this.roleList = res.data; }) }, - // 鐐瑰嚮鏍戣妭鐐� - handleNodeClick({ title, id }) { - // console.log(obj); - this.role.sort = title; - this.treeLabel = title; - this.treeId = id; - - }, // 鏍戝舰鎺т欢澶嶉�夋鐐瑰嚮浜嬩欢 handleCheck(data, checked) { console.log(checked.checkedKeys); @@ -92,45 +64,47 @@ // 淇濆瓨role saveRole() { this.resCheckedIds = []; - const {userInfo} = this; + const { userInfo } = this; this.resCheckedIds = this.checkedIds; this.$axios({ - method:'post', - url:'sccg/role/allocMenu?roleId='+userInfo.id + '&menuIds=' + this.checkedIds, + method: 'post', + url: 'sccg/role/allocMenu?roleId=' + userInfo.id + '&menuIds=' + this.checkedIds, }) - .then(res=>{ - if(res.code === 200){ - this.$message({ - type:'success', - message:'淇敼瑙掕壊鏉冮檺鎴愬姛', - }) - this.getRoleMenus(userInfo.id); - }else{ - this.$message({ - type:'warning', - message:res.message - }) - } - }) + .then(res => { + if (res.code === 200) { + this.$message({ + type: 'success', + message: '淇敼瑙掕壊鏉冮檺鎴愬姛', + }) + this.getRoleMenus(userInfo.id); + this.$emit('changeDialog', { flag: false }); + this.getUserList(); + } else { + this.$message({ + type: 'warning', + message: res.message + }) + } + }) // this.$emit('changeDialog',{dialogUpdate:false}); }, // 娑堥櫎role resetRole() { this.resCheckedIds = []; - this.$emit('changeDialog',{dialogUpdate:false}); + this.$emit('changeDialog', { dialogUpdate: false }); }, // 鑾峰彇瑙掕壊鑿滃崟 - getRoleMenus(roleId){ + getRoleMenus(roleId) { this.$axios({ - method:'get', - url:`sccg/role/listMenu/${roleId}` + method: 'get', + url: `sccg/role/listMenu/${roleId}` }) - .then(res=>{ - this.checkedIds = []; - res.data.forEach(item=>{ - this.checkedIds.push(item.id); + .then(res => { + this.checkedIds = []; + res.data.forEach(item => { + this.checkedIds.push(item.id); + }) }) - }) } }, props: ['userInfo', 'updateFlag', 'getUserList', 'changeDialog'] @@ -140,10 +114,12 @@ .updateUser { border-radius: 1px; background-color: #09152f; + main { text-align: left; padding: 50px 55px; background-color: #09152f; + .mainContent { .my-tree { height: 200px; @@ -151,11 +127,13 @@ background-color: #17324c; position: relative; border-radius: 4px; - .my-tree__wrap{ + + .my-tree__wrap { overflow: scroll; height: 200px; } - .my-tree__bottom{ + + .my-tree__bottom { position: absolute; left: 0px; bottom: 0px; @@ -164,7 +142,8 @@ height: 20px; border-bottom-left-radius: 4px; } - .my-tree__right{ + + .my-tree__right { position: absolute; right: 0px; top: 0px; @@ -191,6 +170,7 @@ margin-top: 10px; display: flex; justify-content: space-between; + .el-button { padding: 10px 20px; border-radius: 4px; diff --git a/src/views/systemSetting/baseSetting/user/components/createUser/index.vue b/src/views/systemSetting/baseSetting/user/components/createUser/index.vue index c790ef6..b3bfb7b 100644 --- a/src/views/systemSetting/baseSetting/user/components/createUser/index.vue +++ b/src/views/systemSetting/baseSetting/user/components/createUser/index.vue @@ -4,17 +4,17 @@ <div class="mainContent"> <el-form ref="user" label-width="140px" autoComplete="on" :model="user" :rules="createUserRules" label-position="right"> - <!-- 鐢ㄦ埛鍚嶇О - <el-form-item class="optionItem" label="鐢ㄦ埛鍚嶇О:" prop="nickName"> - <el-input v-model="user.nickName" placeholder="濉啓鐢ㄦ埛鍚嶇О"></el-input> - </el-form-item> --> + <!-- 鐢ㄦ埛鍚嶇О --> + <el-form-item class="optionItem" label="鐢ㄦ埛鍚嶇О:" prop="username"> + <el-input v-model="user.username" placeholder="濉啓鐢ㄦ埛鍚嶇О"></el-input> + </el-form-item> <!-- 鐢ㄦ埛瀵嗙爜 --> <el-form-item class="optionItems" label="鐢ㄦ埛瀵嗙爜:" prop="password"> <el-input v-model="user.password" type="password" placeholder="璇疯緭鍏ョ敤鎴峰瘑鐮�"></el-input> </el-form-item> <!-- 鎵�灞炵敤鎴峰鍚� --> - <el-form-item class="optionItem" label="鎵�灞炵敤鎴峰鍚�:" prop="username"> - <el-input v-model="user.username" placeholder="璇峰~鍐欑敤鎴峰鍚�"></el-input> + <el-form-item class="optionItem" label="鎵�灞炵敤鎴峰鍚�:" prop="nickName"> + <el-input v-model="user.nickName" placeholder="璇峰~鍐欑敤鎴峰鍚�"></el-input> </el-form-item> <!-- 鎬у埆 --> <el-form-item class="optionItem" label="鎬у埆:" prop="sex"> @@ -32,7 +32,7 @@ </el-form-item> <!-- 鎵�灞炴墜鏈哄彿鐮� --> <el-form-item class="optionItem" label="鎵�灞炴墜鏈哄彿鐮�:" prop="mobile"> - <el-input v-model="user.mobile" placeholder="璇峰~鍐欐墜鏈哄彿鐮�"></el-input> + <el-input v-model="user.mobile" maxlength="11" placeholder="璇峰~鍐欐墜鏈哄彿鐮�"></el-input> </el-form-item> <!-- 閭鍦板潃 --> <el-form-item class="optionItem" label="閭鍦板潃:" prop="email"> @@ -40,31 +40,38 @@ </el-form-item> <!-- 閫夋嫨瑙掕壊 --> <el-form-item class="optionItem" label="閫夋嫨瑙掕壊:" prop="role"> - <el-select v-model="user.role" placeholder="璇烽�夋嫨鎵�灞炶鑹�"> + <el-select v-model="user.role" placeholder="璇烽�夋嫨鎵�灞炶鑹�" multiple collapse-tags> + <el-option v-for="item in roleList" :key="item.id" :label="item.name" :value="item.id"> + </el-option> + </el-select> + <!-- <el-select v-model="user.role" placeholder="璇烽�夋嫨鎵�灞炶鑹�"> <el-option v-for="item in roleList" :key="item.id" :label="item.name" :value="item.id" :disabled="item.disabled"> </el-option> - </el-select> + </el-select> --> </el-form-item> <!-- 鐢ㄦ埛绫诲瀷 --> <el-form-item class="optionItem" label="鐢ㄦ埛绫诲瀷:" prop="userType"> <el-select v-model="user.userType" placeholder="璇烽�夋嫨鐢ㄦ埛绫诲瀷"> - <el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id" - :disabled="item.disabled"> + <el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> </el-form-item> <!-- 搴ф満/鍒嗘満 --> - <el-form-item class="optionItem" label="搴ф満/鍒嗘満:" prop="zj"> - <div class="optionHandleSp"> - <el-input class="areaNumber" v-model="user.zj.areaNumber" placeholder="鐢佃瘽鍖哄彿"> + <div class="user-item"> + <el-form-item label="搴ф満/鍒嗘満:" prop="zjarea"> + <el-input v-model="user.zjarea" placeholder="鐢佃瘽鍖哄彿"> </el-input> - <el-input class="telNumber" v-model="user.zj.phoneNumber" placeholder="鐢佃瘽鍙风爜"> + </el-form-item> + <el-form-item prop="zjnumber" class="left-px"> + <el-input v-model="user.zjnumber" placeholder="鐢佃瘽鍙风爜"> </el-input> - <el-input class="moreNumber" v-model="user.zj.moreNumber" placeholder="鍒嗘満鍙风爜"> + </el-form-item> + <el-form-item prop="zjother" class="left-px"> + <el-input v-model="user.zjother" placeholder="鍒嗘満鍙风爜"> </el-input> - </div> - </el-form-item> + </el-form-item> + </div> <!-- 鎵�灞為儴闂� --> <el-form-item class="optionItem" label="鎵�灞為儴闂�:" prop="departmentId"> <el-select v-model="user.departmentId" placeholder="璇烽�夋嫨鎵�灞為儴闂�" @change="getDepartName"> @@ -101,13 +108,13 @@ <script> export default { data() { - // const validateNickname = (rule, value, callback) => { - // if (!value) { - // callback(new Error("鐢ㄦ埛鍚嶇О涓嶈兘涓虹┖")); - // }else{ - // callback(); - // } - // }; + const validateNickname = (rule, value, callback) => { + if (!value) { + callback(new Error("鐢ㄦ埛鍚嶇О涓嶈兘涓虹┖")); + } else { + callback(); + } + }; const validatePass = (rule, value, callback) => { if (!value) { callback(new Error("鐢ㄦ埛瀵嗙爜涓嶈兘涓虹┖")); @@ -115,7 +122,7 @@ const rep = /^\w+$/; if (!rep.test(value)) { callback(new Error("瀵嗙爜鍙兘鏄互鏁板瓧銆�26涓嫳鏂囧瓧姣嶆垨鑰呬笅鍒掔嚎缁勬垚鐨勫瓧绗︿覆")); - }else{ + } else { callback(); } } @@ -127,7 +134,7 @@ const rep = /^[\u4E00-\u9FA5]{2,4}$/; if (!rep.test(value)) { callback("璇疯緭鍏ユ纭殑鐢ㄦ埛濮撳悕"); - }else{ + } else { callback(); } } @@ -139,19 +146,23 @@ const rep = /(^1[3|4|5|7|8|9]\d{9}$)|(^09\d{8}$)/ if (!rep.test(value)) { callback("璇疯緭鍏ユ纭殑鎵嬫満鍙风爜"); - }else{ + } else { callback(); } } }; - // const validateMail = (rule, value, callback) => { - // if (value) { - // const rep = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; - // if (!rep.test(value)) { - // callback(new Error("璇疯緭鍏ユ纭殑閭")) - // } - // } - // }; + const validateMail = (rule, value, callback) => { + if (value) { + const rep = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; + if (!rep.test(value)) { + callback(new Error("璇疯緭鍏ユ纭殑閭")) + }else{ + callback(); + } + }else{ + callback(); + } + }; const validateRole = (rule, value, callback) => { if (!value) { callback(new Error("鎵�灞炶鑹蹭笉鑳戒负绌�")); @@ -180,22 +191,23 @@ callback(); } }; - // const validateMac = (rule, value, callback) => { - // if (value) { - // callback(new Error("")); - // }else{ - // callback() - // } - // }; - // const validateIp = (rule, value, callback) => { - // if (value) { - // }else{ - // callback() - // } - // }; + const validateMac = (rule, value, callback) => { + if (value) { + callback(); + }else{ + callback() + } + }; + const validateIp = (rule, value, callback) => { + if (value) { + callback(); + }else{ + callback() + } + }; return { user: { - // nickName: '', + nickName: '', password: '', username: '', sex: 1, @@ -204,20 +216,18 @@ email: '', role: null, userType: null, - zj: { - areaNumber: '', - phoneNumber: "", - moreNumber: "", - }, + zjarea: '', + zjnumber: '', + zjother: '', departmentId: null, jobTitle: null, mac: '', ip: '', }, createUserRules: { - // nickName: [ - // { required: true, trigger: "blur", validator: validateNickname }, - // ], + nickName: [ + { required: true, trigger: "blur", validator: validateNickname }, + ], password: [ { required: true, trigger: "blur", validator: validatePass }, ], @@ -233,9 +243,9 @@ mobile: [ { required: true, trigger: "blur", validator: validatePhone }, ], - // email: [ - // { required: false, trigger: "blur", validator: validateMail }, - // ], + email: [ + { required: false, trigger: "blur", validator: validateMail }, + ], role: [ { required: true, trigger: "change", validator: validateRole }, ], @@ -251,18 +261,18 @@ jobTitle: [ { required: true, trigger: "blur", validator: validateWork }, ], - // mac: [ - // { required: false, trigger: "blur", validator: validateMac }, - // ], - // ip: [ - // { required: false, trigger: "blur", validator: validateIp }, - // ], + mac: [ + { required: false, trigger: "blur", validator: validateMac }, + ], + ip: [ + { required: false, trigger: "blur", validator: validateIp }, + ], }, roleList: [ - { name: '瑙掕壊1', id: 1 }, { name: '瑙掕壊2', id: 2 } + ], typeList: [ - { name: '绫诲瀷1', id: 1 }, { name: '绫诲瀷2', id: 2 } + ], departList: [] } @@ -275,6 +285,8 @@ this.$axios.get('sccg/depart/page').then(res => { that.departList = res.data.records; }) + // 鑾峰彇鐢ㄦ埛绫诲瀷 + this.getUserTypeList(); }, methods: { // 鎻愪氦娉ㄥ唽 @@ -287,14 +299,19 @@ this.$axios.post('sccg/admin/register', { departmentId: user.departmentId, email: user.email, - jsDy: user.isDy, + icon:'', + isDy: `${user.isDy}`, jobTitle: user.jobTitle, mobile: user.mobile, + note:'', + roleIds:user.role, // nickName: user.nickName, + sex:`${user.sex}`, password: user.password, - userType: user.userType, + userType: `${user.userType}`, username: user.username, - departName:user.departName, + zj:user.zjarea+`${user.zjnumber}`+user.zjother, + // departName:user.departName, }).then(res => { if (res.code === 200) { console.log(1); @@ -308,9 +325,14 @@ type:'warning', message:'璇ョ敤鎴峰凡娉ㄥ唽' }) + }else{ + this.$message({ + type:'warning', + message:res.message + }) } }) - }else{ + } else { return false } }) @@ -326,15 +348,26 @@ }) }, // 閲嶇疆琛ㄥ崟 - resetForm(){ + resetForm() { this.$refs['user'].resetFields(); }, // 鑾峰緱閮ㄩ棬鍚嶇О - getDepartName(data){ - this.departList.forEach(item=>{ - if(item.id === data){ + getDepartName(data) { + this.departList.forEach(item => { + if (item.id === data) { this.user.departName = item.departName } + }) + }, + // 鑾峰彇鐢ㄦ埛绫诲瀷 + getUserTypeList(){ + this.$axios({ + method:'get', + url:'sccg/dict/query_user_type' + }) + .then(res=>{ + console.log(res); + this.typeList = res.data; }) } }, @@ -375,29 +408,23 @@ } } - .optionHandleSp { + .user-item { display: flex; - .areaNumber, - .moreNumber { - flex: 1; - } - - .telNumber { - flex: 2; + .left-px :deep(.el-form-item__content) { + margin-left: 0px !important; } } + .optionBtn { + display: flex; + margin-top: 20px; - .optionBtn { - display: flex; - margin-top: 20px; - - .btn { - padding: 12px 50px; + .btn { + padding: 12px 50px; + } } - } + } } } -} </style> \ No newline at end of file diff --git a/src/views/systemSetting/baseSetting/user/components/main/index.vue b/src/views/systemSetting/baseSetting/user/components/main/index.vue index cdf66b5..bd93221 100644 --- a/src/views/systemSetting/baseSetting/user/components/main/index.vue +++ b/src/views/systemSetting/baseSetting/user/components/main/index.vue @@ -18,6 +18,9 @@ <el-table-column prop="mobile" label="鑱旂郴鏂瑰紡" min-width="7"> </el-table-column> <el-table-column prop="note" label="鎵�灞炶鑹�" min-width="8"> + <template slot-scope="scope"> + <span>{{filterRole(scope.row.roles)}}</span> + </template> </el-table-column> <el-table-column prop="departName" label="鎵�灞為儴闂�" min-width="8"> </el-table-column> @@ -147,9 +150,9 @@ if (list === 3) { await this.mulDelte(this.tempList); } else if (list === 2) { - await this.mulUpdateStatus(this.tempList,0); + await this.mulUpdateStatus(this.tempList, 0); } else { - await this.mulUpdateStatus(this.tempList,1); + await this.mulUpdateStatus(this.tempList, 1); } this.myIdx = 0; } else { @@ -199,13 +202,13 @@ .catch(err => { console.log(err) }) }, // 鎵归噺淇敼璐﹀彿 - mulUpdateStatus(idArr,flag) { + mulUpdateStatus(idArr, flag) { console.log(flag); - this.$confirm( flag === 1 ? "鎮ㄧ‘瀹氳杩涜鎵归噺鍚敤鐢ㄦ埛鍚�?" :'鎮ㄧ‘瀹氳杩涜鎵归噺绂佺敤鐢ㄦ埛鍚�?' ) + this.$confirm(flag === 1 ? "鎮ㄧ‘瀹氳杩涜鎵归噺鍚敤鐢ㄦ埛鍚�?" : '鎮ㄧ‘瀹氳杩涜鎵归噺绂佺敤鐢ㄦ埛鍚�?') .then(_ => { this.$axios({ method: 'post', - url: 'sccg/admin/updateStatusBatch?ids=' + idArr + '&status='+flag, + url: 'sccg/admin/updateStatusBatch?ids=' + idArr + '&status=' + flag, }) .then(res => { if (res.code === 200) { @@ -230,11 +233,8 @@ }, selectAll() { this.$refs.multipleTable.toggleAllSelection(); - }, disSame(list) { - // console.log(this.$refs.multipleTable); - // const row = this.$refs.table.data list.forEach(row => { this.$refs.multipleTable.toggleRowSelection(row) }) @@ -260,12 +260,17 @@ this.getUserList(); }, handleClose(done) { - this.$confirm('纭鍏抽棴锛�') - .then(_ => { - this.dialogUpdate = false - done(); - }) - .catch(_ => { }); + if (this.updateFlag) { + this.$confirm('纭鍏抽棴锛�') + .then(_ => { + this.dialogUpdate = false; + this.updateFlag = false; + done(); + }) + .catch(_ => { }); + }else{ + done(); + } }, // 褰撳墠椤垫敼鍙樿Е鍙戜簨浠� changeCurrentPage(page) { @@ -311,10 +316,9 @@ this.$axios.get(`sccg/admin/list?keyword=${search}¤t=${currentPage}&pageSize=${pageSize}`).then(res => { if (res.code === 200) { res.data.records.forEach(item => { - // item.createTime = helper(item.createTime); item.status == 1 ? item.status = true : item.status = false; }) - that.totalNum = res.data.pages * pageSize; + that.totalNum = res.data.total; that.tableData = res.data.records; this.renderFlag = true; } @@ -339,6 +343,23 @@ } return ''; }, + // 澶勭悊鐢ㄦ埛鎵�灞炶鑹� + filterRole(arr){ + let str = ''; + if(arr.length === 0){ + return; + } + arr.forEach((item,index)=>{ + if(item!==null){ + if(index<arr.length-1){ + str+=item.name +','; + }else{ + str+=item.name; + } + } + }) + return str; + } }, props: ['refresh', 'keyword', 'resetFresh'], watch: { diff --git a/src/views/systemSetting/baseSetting/user/components/updateUser/index.vue b/src/views/systemSetting/baseSetting/user/components/updateUser/index.vue index f41388a..bcad673 100644 --- a/src/views/systemSetting/baseSetting/user/components/updateUser/index.vue +++ b/src/views/systemSetting/baseSetting/user/components/updateUser/index.vue @@ -41,9 +41,9 @@ </el-form-item> <!-- 閫夋嫨瑙掕壊 --> <el-form-item class="optionItem" label="閫夋嫨瑙掕壊:" prop="role"> - <el-select v-model="user.role" placeholder="璇烽�夋嫨鎵�灞炶鑹�" multiple collapse-tags @change="handleChangeRole"> - <el-option v-for="item in roleList" :key="item.id" :label="item.name" - :value="item.id"> + <el-select v-model="user.role" placeholder="璇烽�夋嫨鎵�灞炶鑹�" multiple collapse-tags + @change="handleChangeRole" :disabled="!flag.role"> + <el-option v-for="item in roleList" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> <!-- <el-select v-model="user.role" placeholder="璇烽�夋嫨鎵�灞炶鑹�" :disabled="!flag.role"> @@ -85,11 +85,11 @@ </el-form-item> <!-- 濉啓鎵�灞瀖ac鍦板潃 --> <el-form-item class="optionItem" label="濉啓鎵�灞瀖ac鍦板潃:" prop="mac"> - <el-input v-model="user.mac" placeholder="璇峰~鍐欐墍灞瀖ac鍦板潃"></el-input> + <el-input v-model="user.mac" placeholder="璇峰~鍐欐墍灞瀖ac鍦板潃" disabled></el-input> </el-form-item> <!-- 濉啓鎵�灞瀒p鍦板潃 --> <el-form-item class="optionItem" label="濉啓鎵�灞瀒p鍦板潃:" prop="ip"> - <el-input v-model="user.ip" placeholder="璇峰~鍐欐墍灞瀒p鍦板潃"></el-input> + <el-input v-model="user.ip" placeholder="璇峰~鍐欐墍灞瀒p鍦板潃" disabled></el-input> </el-form-item> <el-form-item v-if="updateFlag"> <div class="optionBtn"> @@ -302,22 +302,61 @@ }, // 淇敼鐢ㄦ埛淇℃伅 handleUser() { + const { depart, role } = this.flag; this.$refs.user.validate((valid) => { if (valid) { const { user } = this; - this.$axios({ - method: 'post', - url: 'sccg/admin/role/update?adminId=' + user.id + '&roleIds='+user.role, - data: user - }) - .then(res => { - this.$message({ - type: res.code === 200 ? 'success' : 'warning', - message: res.message, - }) - this.getUserList(); - this.$emit('closeDialog', { flag: false }); + user.isDy = `${user.isDy}`; + if (depart) { + console.log(this.user); + this.$axios({ + method: 'post', + url: `sccg/admin/update/${user.id}`, + data: { + "id": user.id, + "username": user.username, + "password": user.password, + "icon": user.icon, + "email": user.email, + "nickName": user.nickName, + "note": user.note, + "createTime": user.createTime, + "loginTime": user.loginTime, + "status": user.status ? 1 : 0, + "macAddress": user.macAddress, + "ipAddress": user.ipAddress, + "isDy": `${user.isDy}`, + "sex": `${user.sex}`, + "jobTitle": user.jobTitle, + "departmentId": user.departmentId, + "departName": user.departName, + "userType": user.userType, + "zj": user.zj, + "mobile": user.mobile, + } }) + .then(res => { + this.$message({ + type: res.code === 200 ? 'success' : 'warning', + message: res.message, + }) + this.getUserList(); + this.$emit('closeDialog', { flag: false }); + }) + } else { + this.$axios({ + method: 'post', + url: 'sccg/admin/role/update?adminId=' + user.id + '&roleIds=' + user.role, + }) + .then(res => { + this.$message({ + type: res.code === 200 ? 'success' : 'warning', + message: res.message, + }) + this.getUserList(); + this.$emit('closeDialog', { flag: false }); + }) + } } else { return false; } @@ -334,24 +373,24 @@ }) }, // 鏀瑰彉鐢ㄦ埛瑙掕壊 - handleChangeRole(data){ + handleChangeRole(data) { console.log(this.user.role); // console.log(data); }, // 鑾峰彇鐢ㄦ埛鐨勮鑹插垪琛� - getUserRole(id){ + getUserRole(id) { this.$axios({ - method:'get', - url:`sccg/admin/role/${id}` + method: 'get', + url: `sccg/admin/role/${id}` }) - .then(res=>{ - console.log(res); - const arr = []; - res.data.forEach(item=>{ - arr.push(item.id); + .then(res => { + console.log(res); + const arr = []; + res.data.forEach(item => { + arr.push(item.id); + }) + this.user.role = arr; }) - this.user.role = arr; - }) } }, props: ['userInfo', 'updateFlag', 'flag', 'closeDialog', 'getUserList'] @@ -361,13 +400,16 @@ .updateUser { border-radius: 1px; background-color: #09152f; - :deep(.el-tag){ + + :deep(.el-tag) { background-color: #09152f; } - .el-select-dropdown.is-multiple .el-select-dropdown__item.selected{ + + .el-select-dropdown.is-multiple .el-select-dropdown__item.selected { background-color: #09152f; color: #4b9bb7; } + // .el-select-dropdown__item :deep(.selected){ // background-color: #09152f; // color: #4b9bb7; -- Gitblit v1.8.0