From aa45647cf4f831667981bce2ea2f0aa9bb477377 Mon Sep 17 00:00:00 2001 From: mg <maokecheng@163.com> Date: 星期五, 04 十一月 2022 15:25:59 +0800 Subject: [PATCH] 点位管理 --- /dev/null | 291 ---------------------------------------------------------- src/views/systemSetting/device/grid/components/main/index.vue | 5 2 files changed, 1 insertions(+), 295 deletions(-) diff --git a/src/views/systemSetting/device/grid/components/main/index.vue b/src/views/systemSetting/device/grid/components/main/index.vue index 4ccec1b..ad1119a 100644 --- a/src/views/systemSetting/device/grid/components/main/index.vue +++ b/src/views/systemSetting/device/grid/components/main/index.vue @@ -97,12 +97,9 @@ </template> <script> import helper from '@/utils/mydate' -import updateUser from '../updateUser'; -import MyPwd from '../password' -import MyView from '../myView' export default { components: { - updateUser, MyPwd,MyView + }, data() { return { diff --git a/src/views/systemSetting/device/grid/components/myView/index.vue b/src/views/systemSetting/device/grid/components/myView/index.vue deleted file mode 100644 index 8608360..0000000 --- a/src/views/systemSetting/device/grid/components/myView/index.vue +++ /dev/null @@ -1,202 +0,0 @@ -<template> - <div class="updateUser"> - <main> - <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="username"> - <el-input v-model="user.username" placeholder="濉啓鐢ㄦ埛鍚嶇О" disabled></el-input> - </el-form-item> - <!-- 鐢ㄦ埛瀵嗙爜 --> - <el-form-item class="optionItems" label="鐢ㄦ埛瀵嗙爜:" prop="password"> - <el-input v-model="user.password" type="password" placeholder="璇疯緭鍏ョ敤鎴峰瘑鐮�" disabled> - </el-input> - </el-form-item> - <!-- 鎵�灞炵敤鎴峰鍚� --> - <el-form-item class="optionItem" label="鎵�灞炵敤鎴峰鍚�:" prop="nickName"> - <el-input v-model="user.nickName" placeholder="璇峰~鍐欑敤鎴峰鍚�" disabled></el-input> - </el-form-item> - <!-- 鎬у埆 --> - <el-form-item class="optionItem" label="鎬у埆:" prop="sex"> - <el-radio-group v-model="user.sex" disabled> - <el-radio :label="1">鐢�</el-radio> - <el-radio :label="0">濂�</el-radio> - </el-radio-group> - </el-form-item> - <!-- 鏄惁鍏氬憳 --> - <el-form-item class="optionItem" label="鏄惁鍏氬憳:" prop="isDy"> - <el-radio-group v-model="user.isDy" disabled> - <el-radio :label="1">鏄�</el-radio> - <el-radio :label="0">鍚�</el-radio> - </el-radio-group> - </el-form-item> - <!-- 鎵�灞炴墜鏈哄彿鐮� --> - <el-form-item class="optionItem" label="鎵�灞炴墜鏈哄彿鐮�:" prop="mobile"> - <el-input v-model="user.mobile" placeholder="璇峰~鍐欐墜鏈哄彿鐮�" disabled></el-input> - </el-form-item> - <!-- 閭鍦板潃 --> - <el-form-item class="optionItem" label="閭鍦板潃:" prop="email"> - <el-input v-model="user.email" placeholder="璇峰~鍐欓偖绠卞湴鍧�" disabled></el-input> - </el-form-item> - <!-- 閫夋嫨瑙掕壊 --> - <el-form-item class="optionItem" label="閫夋嫨瑙掕壊:" prop="role"> - <el-select v-model="user.role" placeholder="璇烽�夋嫨鎵�灞炶鑹�" multiple collapse-tags - disabled> - <el-option v-for="item in roleList" :key="item.id" :label="item.name" :value="item.id"> - </el-option> - </el-select> - </el-form-item> - <!-- 鐢ㄦ埛绫诲瀷 --> - <el-form-item class="optionItem" label="鐢ㄦ埛绫诲瀷:" prop="userType"> - <el-select v-model="user.userType" placeholder="璇烽�夋嫨鐢ㄦ埛绫诲瀷" 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="departmentId"> - <el-input v-model="user.departName"></el-input> - </el-form-item> - <!-- 褰撳墠鑱屽姟 --> - <el-form-item class="optionItem" label="褰撳墠鑱屽姟:" prop="jobTitle"> - <el-input v-model="user.jobTitle" placeholder="璇疯緭鍏ュ綋鍓嶈亴鍔�" disabled></el-input> - </el-form-item> - <!-- 濉啓鎵�灞瀖ac鍦板潃 --> - <el-form-item class="optionItem" label="濉啓鎵�灞瀖ac鍦板潃:" prop="mac"> - <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鍦板潃" disabled></el-input> - </el-form-item> - </el-form> - </div> - </main> - </div> -</template> -<script> -export default { - data() { - return { - user: { - }, - createUserRules: { - }, - roleList: [ - - ], - typeList: [], - departList: [], - } - }, - created() { - const that = this; - this.user = JSON.parse(JSON.stringify(that.userInfo)); - this.user.departName = this.user.departName ? this.user.departName : '鏆傛棤鎵�灞為儴闂�' - // 鑾峰彇鎵�鏈夎鑹插垪琛� - this.getRoleList(); - // 鑾峰彇褰撳墠鐢ㄦ埛瑙掕壊鍒楄〃 - this.getUserRole(this.user.id) - // 鑾峰彇鍏ㄩ儴閮ㄩ棬鍒楄〃 - this.$axios.get('/sccg/depart/tree').then(res => { - this.departList = res.data; - }) - }, - methods: { - // 鑾峰彇瑙掕壊鍒楄〃 - getRoleList() { - this.$axios({ - method: 'get', - url: 'sccg/role/listAll', - }) - .then(res => { - this.roleList = res.data; - }) - }, - // 鑾峰彇鐢ㄦ埛鐨勮鑹插垪琛� - getUserRole(id) { - this.$axios({ - method: 'get', - url: `sccg/admin/role/${id}` - }) - .then(res => { - const arr = []; - res.data.forEach(item => { - arr.push(item.id); - }) - this.user.role = arr; - }) - }, - }, - props: ['userInfo'] -} -</script> -<style lang="scss" scoped> -.updateUser { - border-radius: 1px; - background-color: #09152f; - - :deep(.el-tag) { - background-color: #09152f; - } - - .el-select-dropdown.is-multiple .el-select-dropdown__item.selected { - background-color: #09152f; - color: #4b9bb7; - } - - main { - text-align: left; - padding: 0 55px; - background-color: #09152f; - padding-bottom: 50px; - - .mainContent { - display: flex; - justify-content: center; - padding-top: 50px; - - .el-form-item__content { - width: 400px; - - .el-select { - width: 100%; - } - } - - .optionHandleSp { - display: flex; - - .areaNumber, - .moreNumber { - flex: 1; - } - - .telNumber { - flex: 2; - } - } - - .optionBtn { - display: flex; - margin-top: 20px; - - .btn { - padding: 12px 50px; - } - } - - } - } -} - -.updateUser::v-deep .el-form-item__label { - color: #4b9bb7; -} - -.updateUser::v-deep .el-input__inner { - background-color: #09152f; - border: 1px solid #17324c; -} -</style> \ No newline at end of file diff --git a/src/views/systemSetting/device/grid/components/password/index.vue b/src/views/systemSetting/device/grid/components/password/index.vue deleted file mode 100644 index 90e5ed3..0000000 --- a/src/views/systemSetting/device/grid/components/password/index.vue +++ /dev/null @@ -1,145 +0,0 @@ -<template> - <div class="password"> - <el-form ref="pwd" label-width="140px" autoComplete="on" :model="user" :rules="passrules"> - <!-- 鍒濆瀵嗙爜 --> - <el-form-item class="optionItem" label="鍒濆瀵嗙爜:" prop="password"> - <el-input v-model="user.password" type="password" placeholder="璇峰~鍐欏垵濮嬪瘑鐮�"></el-input> - </el-form-item> - <!-- 鏂板瘑鐮� --> - <el-form-item class="optionItem" label="鏂板瘑鐮�:" prop="newPwd"> - <el-input v-model="user.newPwd" type="password" placeholder="璇峰~鍐欐柊瀵嗙爜"></el-input> - </el-form-item> - <!-- 鏂板瘑鐮� --> - <el-form-item class="optionItem" label="纭鏂板瘑鐮�:" prop="secondPwd"> - <el-input v-model="user.secondPwd" type="password" placeholder="纭鎮ㄧ殑鏂板瘑鐮�"></el-input> - </el-form-item> - - </el-form> - <div class="pwd-footer"> - <el-button @click="resetForm">鍙栨秷</el-button> - <el-button type="primary" @click="handleSubmit">鎻愪氦</el-button> - </div> - </div> -</template> -<script> -export default { - data() { - const checkPwd = (rule, value, callback) => { - if (!value) { - callback(new Error('鍒濆瀵嗙爜涓嶈兘涓虹┖')) - } else { - callback(); - } - } - const checkNewPwd = (rule, value, callback) => { - if (!value) { - callback(new Error('鏂板瘑鐮佷笉鑳戒负绌�')) - }else if(value === this.user.password){ - callback(new Error('鏂板瘑鐮佷笉鑳藉拰鏃у瘑鐮佷竴鏍�')) - } else { - callback(); - } - } - const checkSame = (rule, value, callback) => { - if (!value) { - callback(new Error('纭瀵嗙爜涓嶈兘涓虹┖')) - } else if (value !== this.user.newPwd) { - console.log(111); - callback(new Error('鎮ㄨ緭鍏ョ殑涓ゆ瀵嗙爜缁撴灉涓嶅悓')); - } else { - - callback(); - } - } - return { - user: { - password: '', - secondPwd: '', - newPwd: '', - }, - passrules: { - password: [ - { - required: true, - trigger: 'blur', - validator: checkPwd - }, - ], - secondPwd: [ - { - required: true, - trigger: 'blur', - validator: checkSame - } - ], - newPwd: [ - { - required: true, - trigger: 'blur', - validator: checkNewPwd - } - ] - } - } - }, - props: ['userInfo', 'closeDialog'], - created() { - - }, - methods: { - // 鎻愪氦 - handleSubmit() { - const { userInfo,user } = this; - this.$refs.pwd.validate((valid) => { - if (valid) { - this.$axios({ - method:'post', - url:'sccg/admin/updatePassword', - data:{ - newPassword:user.newPwd, - oldPassword:user.password, - username:userInfo.username - } - }) - .then(res=>{ - if(res.code === 200){ - this.$emit('closeDialog',{flag:false}); - this.$message({ - type:'success', - message:'瀵嗙爜淇敼鎴愬姛' - }) - }else{ - this.$message({ - type:'warning', - message:res.message - }) - } - }) - } else { - return false; - } - }) - }, - // 娓呯┖琛ㄥ崟 - resetForm() { - this.$refs.pwd.resetFields(); - this.$emit('closeDialog',{flag:false}); - } - } -} -</script> -<style lang="scss" scoped> -.password { - padding: 50px 100px; - - ::v-deep .el-input__inner { - background-color: #09152f; - border: 1px solid #17324c; - } - - .pwd-footer { - display: flex; - justify-content: center; - } -} -</style> \ No newline at end of file diff --git a/src/views/systemSetting/device/grid/components/updateUser/index.vue b/src/views/systemSetting/device/grid/components/updateUser/index.vue deleted file mode 100644 index 80a74ab..0000000 --- a/src/views/systemSetting/device/grid/components/updateUser/index.vue +++ /dev/null @@ -1,291 +0,0 @@ -<template> - <div class="updateUser"> - <main> - <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="role" v-if="flag.role"> - <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-form-item> - <!-- 鎵�灞為儴闂� --> - <el-form-item class="optionItem" label="鎵�灞為儴闂�:" prop="departmentId" v-else> - <el-select v-model="user.departName" placeholder="璇烽�夋嫨鎵�灞為儴闂�" :disabled="!flag.depart"> - <el-option :value="mylabel"> - <el-tree ref="tree" :check-strictly="true" :data="departList" :props="defaultProps" - show-checkbox @check-change="handleCheck" - :default-checked-keys="[selectOrg.orgsid[0],]" default-expand-all node-key="id"> - </el-tree> - </el-option> - </el-select> - </el-form-item> - <el-form-item> - <div class="optionBtn"> - <el-button type="primary" class="btn submit" @click.native.prevent="handleUser">鎻愪氦 - </el-button> - </div> - </el-form-item> - </el-form> - - </div> - </main> - </div> -</template> -<script> -export default { - data() { - return { - user: { - }, - createUserRules: { - }, - roleList: [ - - ], - departList: [], - mylabel: "", - defaultProps: { - children: "children", - label: "departName", - }, - selectOrg: { - orgsid: [], - }, - tempName: '', - tempRole: [] - } - }, - created() { - this.user = JSON.parse(JSON.stringify(this.userInfo)); - this.tempName = this.user.departName; - this.selectOrg.orgsid.push(this.user.departmentId); - // 鑾峰彇鎵�鏈夎鑹插垪琛� - this.getRoleList(); - // 鑾峰彇褰撳墠鐢ㄦ埛瑙掕壊鍒楄〃 - this.getUserRole(this.user.id) - // 鑾峰彇鍏ㄩ儴閮ㄩ棬鍒楄〃 - this.$axios.get('/sccg/depart/tree').then(res => { - this.departList = res.data; - }) - }, - methods: { - // 淇敼閮ㄩ棬 - changeDepart(data) { - this.departList.forEach(item => { - if (item.id === data) { - this.user.departName = item.departName; - } - }) - }, - // 淇敼鐢ㄦ埛淇℃伅 - handleUser() { - const { flag, user, tempName, selectOrg, tempRole, isArraySame } = this; - let umsDepartManage={userId:user.id,departId:selectOrg.orgsid[0]} - this.$refs.user.validate((valid) => { - if (valid) { - user.isDy = `${user.isDy}`; - if (flag.depart) { - if (tempName === user.departName) { - this.$message({ - type: 'warning', - message: '鎮ㄧ殑閮ㄩ棬杩樻湭鏇存敼' - }) - } else { - if (user.departName) { - this.$axios({ - method: 'put', - url: `/sccg/depart/user_update_depart?userId=`+user.id+'&departId='+selectOrg.orgsid[0] - }) - .then(res => { - this.$message({ - type: res.code === 200 ? 'success' : 'warning', - message: res.message, - }) - this.getUserList(); - this.$emit('closeDialog', { flag: false }); - }) - } else { - this.$message({ - type: 'warning', - message: '鐢ㄦ埛閮ㄩ棬涓嶈兘涓虹┖' - }) - } - } - - } else { - if (user.role.length === 0) { - this.$message({ - type: 'warning', - message: '鐢ㄦ埛瑙掕壊涓嶈兘涓虹┖', - }) - } - else if (isArraySame(tempRole, user.role) && tempRole.length === user.role.length) { - this.$message({ - type: 'warning', - message: '鎮ㄨ繕鏈洿鏀硅鑹�', - }) - } - 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; - } - }) - }, - // 鑾峰彇瑙掕壊鍒楄〃 - getRoleList() { - this.$axios({ - method: 'get', - url: 'sccg/role/listAll', - }) - .then(res => { - this.roleList = res.data; - }) - }, - // 鑾峰彇鐢ㄦ埛鐨勮鑹插垪琛� - getUserRole(id) { - this.$axios({ - method: 'get', - url: `sccg/admin/role/${id}` - }) - .then(res => { - const arr = []; - res.data.forEach(item => { - arr.push(item.id); - }) - this.user.role = arr; - this.tempRole = arr; - }) - }, - // 閮ㄩ棬淇敼 - handleCheck(data, checked) { - console.log(this.selectOrg.orgsid[0]) - this.user.departName = data.departName; - // 鑾峰彇褰撳墠閫夋嫨鐨刬d鍦ㄦ暟缁勪腑鐨勭储寮� - const indexs = this.selectOrg.orgsid.indexOf(data.id); - // 濡傛灉涓嶅瓨鍦ㄦ暟缁勪腑锛屽苟涓旀暟缁勪腑宸茬粡鏈変竴涓猧d骞朵笖checked涓簍rue鐨勬椂鍊欙紝浠h〃涓嶈兘鍐嶆閫夋嫨銆� - if (indexs < 0 && this.selectOrg.orgsid.length === 1 && checked) { - this.$message({ - message: "鍙兘閫夋嫨涓�涓儴闂紒", - type: "warning", - showClose: true, - }); - // 璁剧疆宸查�夋嫨鐨勮妭鐐逛负false 寰堥噸瑕� - this.$refs.tree.setChecked(data, false); - } else if (this.selectOrg.orgsid.length === 0 && checked) { - // 鍙戠幇鏁扮粍涓虹┖ 骞朵笖鏄凡閫夋嫨 - // 闃叉鏁扮粍鏈夊�硷紝棣栧厛娓呯┖锛屽啀push - this.selectOrg.orgsid = []; - this.selectOrg.orgsid.push(data.id); - } else if ( - indexs >= 0 && - this.selectOrg.orgsid.length === 1 && - !checked - ) { - // 鍐嶆鐩存帴杩涜璧嬪�间负绌烘搷浣� - this.selectOrg.orgsid = []; - this.user.departName = '' - } - }, - // 鍒ゆ柇鏁扮粍鏄惁鐩哥瓑 - isArraySame(arr1, arr2) { - let flag = true - arr1.sort((a, b) => a - b) - arr2.sort((a, b) => a - b) - arr1.forEach(item => { - arr2.forEach(child => { - if (item !== child) { - flag = false - } - }) - }) - return flag - } - }, - props: ['userInfo', 'flag', 'closeDialog', 'getUserList'] -} -</script> -<style lang="scss" scoped> -.updateUser { - border-radius: 1px; - background-color: #09152f; - - :deep(.el-tag) { - background-color: #09152f; - } - - .el-select-dropdown.is-multiple .el-select-dropdown__item.selected { - background-color: #09152f; - color: #4b9bb7; - } - - main { - text-align: left; - padding: 0 55px; - background-color: #09152f; - padding-bottom: 50px; - - .mainContent { - display: flex; - justify-content: center; - padding-top: 50px; - - .el-form-item__content { - width: 400px; - - .el-select { - width: 100%; - } - } - - .optionHandleSp { - display: flex; - - .areaNumber, - .moreNumber { - flex: 1; - } - - .telNumber { - flex: 2; - } - } - - .optionBtn { - display: flex; - margin-top: 20px; - - .btn { - padding: 12px 50px; - } - } - - } - } -} - -.updateUser::v-deep .el-form-item__label { - color: #4b9bb7; -} - -.updateUser::v-deep .el-input__inner { - background-color: #09152f; - border: 1px solid #17324c; -} -</style> \ No newline at end of file -- Gitblit v1.8.0