From dc04c05b22a5323925218092a0687555a2a5c9c1 Mon Sep 17 00:00:00 2001 From: “dzb” <2632970487@qq.com> Date: 星期四, 29 九月 2022 18:39:31 +0800 Subject: [PATCH] 上报管理界面,案件池的违规、违建登记页面 --- src/views/systemSetting/baseSetting/role/updateUser/index.vue | 291 +++++++++++++++++++++++++++------------------------------ 1 files changed, 139 insertions(+), 152 deletions(-) diff --git a/src/views/systemSetting/baseSetting/role/updateUser/index.vue b/src/views/systemSetting/baseSetting/role/updateUser/index.vue index 5d2e253..d0d18e1 100644 --- a/src/views/systemSetting/baseSetting/role/updateUser/index.vue +++ b/src/views/systemSetting/baseSetting/role/updateUser/index.vue @@ -1,35 +1,20 @@ <template> <div class="updateUser"> - <!-- <header> - <div class="headerTitle">{{updateFlag ? '淇敼瑙掕壊淇℃伅' :'鏌ョ湅瑙掕壊淇℃伅'}}</div> - </header> --> <main> <div class="mainContent"> - <el-form ref="user" label-width="140px" autoComplete="on" :model="role" :rules="createRoleRules" - label-position="right"> - <!-- 瑙掕壊鍚嶇О --> - <el-form-item class="optionItem" label="瑙掕壊鍚嶇О:" prop="name"> - <el-input v-model="role.name" placeholder="璇峰~鍐欒鑹插悕绉�" :disabled="!updateFlag"></el-input> - </el-form-item> - <!-- 瑙掕壊绫诲瀷 --> - <el-form-item class="optionItems" label="瑙掕壊绫诲瀷:" prop="status"> - <el-select v-model="role.status" placeholder="璇烽�夋嫨瑙掕壊绫诲瀷" :disabled="!updateFlag"> - <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> - <!-- 瑙掕壊鎻忚堪 --> - <el-form-item class="optionItem" label="瑙掕壊鎻忚堪:" prop="description"> - <el-input v-model="role.description" placeholder="璇疯緭鍏ユ弿杩板唴瀹�200瀛椾互鍐�" :disabled="!updateFlag"></el-input> - </el-form-item> - <el-form-item v-if="updateFlag"> - <div class="optionBtn"> - <el-button type="primary" class="btn submit" @click.native.prevent="handleUser">纭</el-button> - </div> - </el-form-item> - </el-form> - + <div class="my-tree"> + <div class="my-tree__wrap"> + <el-tree :data="roleList" :props="defaultProps" @node-click="handleNodeClick" show-checkbox + @check-change="handleCheckChange" default-expand-all node-key="id"> + </el-tree> + </div> + <div class="my-tree__bottom"></div> + <div class="my-tree__right"></div> + </div> + <div class="selection"> + <el-button class="cancel" @click="resetRole">鍙栨秷</el-button> + <el-button class="save" @click="saveRole">淇濆瓨</el-button> + </div> </div> </main> </div> @@ -37,163 +22,165 @@ <script> export default { data() { - const validateNickname = (rule, value, callback) => { - if (!value) { - callback(new Error("璇峰~鍐欑敤鎴峰悕绉�")); - } - }; - const validatePass = (rule, value, callback) => { - if (!value) { - callback(new Error("璇峰~鍐欑櫥褰曞瘑鐮�")); - } else { - const rep = /^\w+$/; - if (!rep.test(value)) { - callback(new Error("瀵嗙爜鍙兘鏄互鏁板瓧銆�26涓嫳鏂囧瓧姣嶆垨鑰呬笅鍒掔嚎缁勬垚鐨勫瓧绗︿覆")); - } - } - }; - const validateTruename = (rule, value, callback) => { - if (!value) { - callback(new Error("璇峰~鍐欑敤鎴峰鍚�")); - } else { - const rep = /^[\u4E00-\u9FA5]{2,4}$/; - if (!rep.test(value)) { - callback("璇疯緭鍏ユ纭殑鐢ㄦ埛濮撳悕"); - } - } - }; return { role: { - id:'', name: '', - status: '', + sort: '', description: '', }, - createRoleRules: { - name: [ - { required: true, trigger: "blur", validator: validateNickname }, - ], - status: [ - { required: false, trigger: "blur", validator: validatePass }, - ], - description: [ - { required: false, trigger: "blur", validator: validateTruename }, - ], + roleList: [], + defaultProps: { + children: 'children', + label: 'title' }, - roleList: [ - { name: '瑙掕壊1', value: 1 }, { name: '瑙掕壊2', value: 2 } - ], - typeList: [] + treeLabel: '', + treeId: 23, + checkedIds: [], + resCheckedIds: [], } }, created() { const that = this; - this.userInfo.status ? this.userInfo.status = 1: this.userInfo.status = 0; - this.role = JSON.parse(JSON.stringify(that.userInfo)); - // 鑾峰彇瑙掕壊鍒楄〃 - // 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.getMenuList(); }, methods: { handleUser() { - const { role } = this; - this.$axios.post('/sccg/role/update/'+role.id, { - id:role.id, - status: role.status, - description:role.description, - name:role.name - }).then(res => { - this.$emit('changeDialog',{dialogUpdate:false}); - this.getUserList(); + 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({ + method: 'get', + url: 'sccg/menu/treeList', + }) + .then(res => { + this.roleList = res.data; + console.log(res); + }) + }, + // 鐐瑰嚮鏍戣妭鐐� + handleNodeClick({ title, id }) { + // console.log(obj); + this.role.sort = title; + this.treeLabel = title; + this.treeId = id; + + }, + // 鏍戝舰鎺т欢閫変腑鏇存敼 + handleCheckChange(data, checked, indeterminate) { + // console.log(data,checked,indeterminate); + if (checked) { + this.checkedIds.push(data.id); + } else { + let index = 0; + this.checkedIds.forEach((item, idx) => { + if (item.id === data.id) { + index = idx; + } + }) + this.checkedIds.splice(index, 1); + } + console.log(this.checkedIds); + }, + // 淇濆瓨role + saveRole() { + this.resCheckedIds = []; + this.resCheckedIds = this.checkedIds; + this.$emit('changeDialog',{dialogUpdate:false}); + }, + // 娑堥櫎role + resetRole() { + this.resCheckedIds = [] } }, - props: ['userInfo', 'updateFlag','getUserList','changeDialog'] + props: ['userInfo', 'updateFlag', 'getUserList', 'changeDialog'] } </script> <style lang="scss" scoped> .updateUser { border-radius: 1px; background-color: #09152f; - - // header { - // display: flex; - // justify-content: center; - // height: 60px; - // line-height: 60px; - // padding: 0 20px; - // border: 1px solid #fff; - // .headerTitle { - // color: #4b9bb7; - // font-weight: 600; - // } - - // .headerTip span { - // color: #ff3b6c; - // } - - // .headerTip label { - // color: #4b9bb7; - // } - // } - main { - // border: 1px solid #fff; text-align: left; - padding: 0 55px; + padding: 50px 55px; background-color: #09152f; - padding-bottom: 50px; .mainContent { - display: flex; - justify-content: center; - padding-top: 50px; - .el-form-item__content { - width: 400px; - - .el-select { + .my-tree { + height: 200px; + overflow: hidden; + background-color: #17324c; + position: relative; + border-radius: 4px; + .my-tree__wrap{ + overflow: scroll; + height: 200px; + } + .my-tree__bottom{ + position: absolute; + left: 0px; + bottom: 0px; + background-color: #17324c; width: 100%; + height: 20px; + border-bottom-left-radius: 4px; + } + .my-tree__right{ + position: absolute; + right: 0px; + top: 0px; + background-color: #17324c; + width: 20px; + height: 100%; } } - - .optionHandleSp { - display: flex; - - .areaNumber, - .moreNumber { - flex: 1; - } - - .telNumber { - flex: 2; - } - } - - .optionBtn { - display: flex; - margin-top: 20px; - - .btn { - padding: 12px 50px; - } - } - } + } + + &::v-deep .el-textarea__inner { + background-color: #09152f; + border: 1px solid #17324c; + } + + ::v-deep .el-input__inner { + background-color: #09152f; + border: 1px solid #17324c; } } -.updateUser::v-deep .el-form-item__label { - color: #4b9bb7; -} +.selection { + margin-top: 10px; + display: flex; + justify-content: space-between; + .el-button { + padding: 10px 20px; + border-radius: 4px; + } -.updateUser::v-deep .el-input__inner { - background-color: #09152f; - border: 1px solid #17324c; + .save { + background-color: #409eff; + color: #fff; + } + + .cancel { + background-color: #09152f; + color: #4b9bb7; + } } </style> \ No newline at end of file -- Gitblit v1.8.0