feat:集成cas
Showing
33 changed files
with
278 additions
and
3066 deletions
| 1 | { | 1 | { |
| 2 | "TITLE": "汉中市数据上报系统", | 2 | "TITLE": "汉中市数据上报系统", |
| 3 | "CODE": "BDCSBPT", | 3 | "CODE": "BDCSJSB", |
| 4 | "AREARMAP": "610702", | 4 | "AREARMAP": "610702", |
| 5 | "XZQ": "汉中市", | 5 | "XZQ": "汉中市", |
| 6 | "SERVERAPI": "/bdcsjsb", | 6 | "SERVERAPI": "/bdcsjsb", |
| 7 | "calcHeight": 160, | 7 | "calcHeight": 160, |
| 8 | "echartTextColor": "#4A4A4A", | 8 | "echartTextColor": "#4A4A4A", |
| 9 | "MANAGEMENTAPI": "http://192.168.2.38:8090/management", | 9 | "MANAGEMENTAPI": "http://192.168.2.38:8090/management", |
| 10 | "IPCONFIG": "http://192.168.2.38:8027" | 10 | "ip": "http://192.168.2.38:8027" |
| 11 | } | 11 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | { | 1 | { |
| 2 | "TITLE": "玉树州数据上报系统", | 2 | "TITLE": "玉树州数据上报系统", |
| 3 | "CODE": "BDCSBPT", | 3 | "CODE": "BDCSJSB", |
| 4 | "AREARMAP": "632701", | 4 | "AREARMAP": "632701", |
| 5 | "XZQ": "玉树州", | 5 | "XZQ": "玉树州", |
| 6 | "SERVERAPI": "/bdcsjsb", | 6 | "SERVERAPI": "/bdcsjsb", |
| 7 | "calcHeight": 160, | 7 | "calcHeight": 160, |
| 8 | "echartTextColor": "#4A4A4A", | 8 | "echartTextColor": "#4A4A4A", |
| 9 | "MANAGEMENTAPI": "http://192.168.2.38:8090/management", | 9 | "MANAGEMENTAPI": "http://192.168.2.38:8090/management", |
| 10 | "IPCONFIG": "http://192.168.2.38:8027" | 10 | "ip": "http://192.168.2.38:8027" |
| 11 | } | 11 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | { | 1 | { |
| 2 | "TITLE": "汉中市数据上报系统", | 2 | "TITLE": "汉中市数据上报系统", |
| 3 | "CODE": "BDCSBPT", | 3 | "CODE": "BDCSJSB", |
| 4 | "AREARMAP": "610702", | 4 | "AREARMAP": "610702", |
| 5 | "XZQ": "汉中市", | 5 | "XZQ": "汉中市", |
| 6 | "SERVERAPI": "/bdcsjsb", | 6 | "SERVERAPI": "/bdcsjsb1234", |
| 7 | "calcHeight": 160, | 7 | "calcHeight": 160, |
| 8 | "echartTextColor": "#4A4A4A", | 8 | "echartTextColor": "#4A4A4A", |
| 9 | "MANAGEMENTAPI": "http://192.168.2.38:8090/management", | 9 | "MANAGEMENTAPI": "http://192.168.2.38:8090/management", |
| 10 | "IPCONFIG": "http://192.168.2.38:8026" | 10 | "ip": "http://192.168.2.38" |
| 11 | } | 11 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Description: 引入配置文件 | 2 | * @Description: 引入配置文件 |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2023-05-08 15:02:53 | 4 | * @LastEditTime: 2023-06-02 10:57:01 |
| 5 | --> | 5 | --> |
| 6 | <!DOCTYPE html> | 6 | <!DOCTYPE html> |
| 7 | <html> | 7 | <html> |
| ... | @@ -18,6 +18,20 @@ | ... | @@ -18,6 +18,20 @@ |
| 18 | </title> | 18 | </title> |
| 19 | </head> | 19 | </head> |
| 20 | <script> | 20 | <script> |
| 21 | window._config = { | ||
| 22 | // 是否微服务模式,业务系统根据需要读取 | ||
| 23 | cloudEnable: false, | ||
| 24 | baseUrl: location.origin || location.protocol + '//' + location.host, | ||
| 25 | // 是否启用单点登录 | ||
| 26 | casEnable: true, | ||
| 27 | // cas 基地址 | ||
| 28 | casBaseURL: 'http://192.168.2.38/cas', | ||
| 29 | services: { | ||
| 30 | // 配置到 contextPath 前一级 | ||
| 31 | management: 'http://192.168.2.38', | ||
| 32 | business: 'http://localhost:7001' | ||
| 33 | } | ||
| 34 | } | ||
| 21 | fetch('<%= BASE_URL %>config.json') | 35 | fetch('<%= BASE_URL %>config.json') |
| 22 | .then(response => response.json()) | 36 | .then(response => response.json()) |
| 23 | .then(config => { | 37 | .then(config => { |
| ... | @@ -30,9 +44,3 @@ | ... | @@ -30,9 +44,3 @@ |
| 30 | </body> | 44 | </body> |
| 31 | 45 | ||
| 32 | </html> | 46 | </html> |
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 33 | |||
| 34 | <script> | ||
| 35 | window.baseUrl = location.origin || location.protocol + '//' + location.host | ||
| 36 | window.timeout = 5000 | ||
| 37 | window.authorization = "bearer AT-4-MxSrO29Coe7VTazx8uuixtqqgO-hvCB6" | ||
| 38 | </script> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
src/image/icons/svg/busineInfo.svg
0 → 100644
| 1 | <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1686204771033" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1398" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><path d="M889.898667 98.730667c16.170667 0 29.269333 13.098667 29.269333 29.269333v719.232a114.602667 114.602667 0 0 1-114.602667 114.602667H128a71.936 71.936 0 0 1-71.936-71.936V213.333333A114.602667 114.602667 0 0 1 170.666667 98.730667z m-29.269334 58.496H170.666667c-30.976 0-56.064 25.173333-56.064 56.106666v676.565334c0 7.424 5.973333 13.397333 13.397333 13.397333h676.565333c30.976 0 56.064-25.088 56.064-56.064V157.226667zM597.333333 457.173333a146.304 146.304 0 0 1 134.826667 203.093334l68.693333 68.778666a29.269333 29.269333 0 0 1-37.717333 44.458667l-3.626667-3.114667-61.184-61.141333A146.304 146.304 0 1 1 597.333333 457.130667z m-219.434666 244.992a29.269333 29.269333 0 0 1 4.309333 58.197334l-4.266667 0.341333h-146.346666a29.269333 29.269333 0 0 1-4.266667-58.197333l4.266667-0.341334h146.346666zM597.333333 515.669333a87.765333 87.765333 0 1 0 0 175.530667 87.765333 87.765333 0 0 0 0-175.530667z m-219.434666 3.626667a29.269333 29.269333 0 0 1 4.309333 58.197333l-4.266667 0.341334h-146.346666a29.269333 29.269333 0 0 1-4.266667-58.197334l4.266667-0.341333h146.346666zM743.68 299.946667a29.269333 29.269333 0 0 1 4.266667 58.197333l-4.266667 0.298667h-512a29.269333 29.269333 0 0 1-4.352-58.197334l4.352-0.298666h512z" p-id="1399"></path></svg> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
src/image/icons/svg/sthj.svg
0 → 100644
| 1 | <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1686204663773" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1252" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><path d="M779.008 56.064c14.72 0 26.88 10.837333 28.970667 24.96l0.298666 4.309333v692.181334c0 14.72-10.837333 26.88-24.917333 28.970666l-4.352 0.298667H229.632a29.269333 29.269333 0 0 1-4.352-58.197333l4.352-0.298667 520.106667-0.042667V114.56H170.666667c-29.013333 0-52.906667 22.101333-55.808 50.346667L114.602667 170.666667l-0.042667 689.962666H810.666667c29.013333 0 52.906667-22.058667 55.808-50.346666l0.256-5.717334V262.528a29.269333 29.269333 0 0 1 58.197333-4.309333l0.341333 4.309333v542.037333a114.602667 114.602667 0 0 1-107.349333 114.346667l-7.253333 0.256H85.333333a29.269333 29.269333 0 0 1-28.928-24.96l-0.341333-4.266667V170.666667A114.602667 114.602667 0 0 1 163.413333 56.32L170.666667 56.064h608.341333z m-236.544 219.434667c10.112 0 19.456 5.205333 24.832 13.738666l91.434667 146.304a29.269333 29.269333 0 0 1 0 31.018667l-91.434667 146.261333a29.269333 29.269333 0 0 1-24.832 13.781334H359.68a29.269333 29.269333 0 0 1-24.832-13.781334l-91.434667-146.261333a29.269333 29.269333 0 0 1 0-31.018667l91.434667-146.304a29.269333 29.269333 0 0 1 24.832-13.738666z m-16.213333 58.496H375.893333l-73.173333 117.034666 73.173333 117.034667h150.357334l73.173333-117.034667-73.173333-117.034666z" p-id="1253"></path></svg> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
src/image/icons/svg/system.svg
0 → 100644
| 1 | <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1686204514003" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1106" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><path d="M822.869333 519.296c10.624 0 20.394667 5.76 25.6 15.061333l91.392 164.565334a29.269333 29.269333 0 0 1 0 28.416l-91.434666 164.565333a29.269333 29.269333 0 0 1-25.6 15.061333H640a29.269333 29.269333 0 0 1-25.6-15.061333l-91.392-164.565333a29.269333 29.269333 0 0 1 0-28.416l91.434667-164.565334a29.269333 29.269333 0 0 1 25.557333-15.061333z m36.565334-420.565333c14.677333 0 26.88 10.837333 28.928 24.96L888.746667 128v267.093333a29.269333 29.269333 0 0 1-58.197334 4.309334l-0.341333-4.309334V157.226667H213.333333c-29.013333 0-52.906667 22.101333-55.808 50.346666L157.269333 213.333333l-0.042666 397.397334h272.298666a29.44 29.44 0 0 1 4.693334 0.384 29.269333 29.269333 0 0 1 33.578666 24.576l0.298667 4.309333v208.426667h62.208a29.269333 29.269333 0 0 1 4.266667 58.24l-4.266667 0.298666h-256a29.269333 29.269333 0 0 1-4.352-58.197333l4.352-0.298667h135.253333v-179.2H128a29.269333 29.269333 0 0 1-28.928-24.96L98.730667 640V213.333333A114.602667 114.602667 0 0 1 206.08 98.986667L213.333333 98.730667h646.101334z m-53.76 479.061333h-148.437334l-75.178666 135.296 75.178666 135.338667h148.48l75.136-135.338667-75.178666-135.253333z" p-id="1107"></path></svg> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Description :面包屑 | 2 | * @Description :面包屑 |
| 3 | * @Autor : miaofang | 3 | * @Autor : miaofang |
| 4 | * @LastEditTime : 2023-05-17 14:35:47 | 4 | * @LastEditTime: 2023-06-08 14:16:53 |
| 5 | --> | 5 | --> |
| 6 | <template> | 6 | <template> |
| 7 | <el-breadcrumb class="app-breadcrumb" separator="/"> | 7 | <el-breadcrumb class="app-breadcrumb" separator="/"> |
| ... | @@ -9,9 +9,8 @@ | ... | @@ -9,9 +9,8 @@ |
| 9 | <el-breadcrumb-item v-for="(item, index) in levelList" :key="item.path"> | 9 | <el-breadcrumb-item v-for="(item, index) in levelList" :key="item.path"> |
| 10 | <span class="no-redirect">当前位置></span> | 10 | <span class="no-redirect">当前位置></span> |
| 11 | <!-- <svg-icon v-if="item.meta.icon" :icon-class="item.meta.icon" class="breadcrumbIcon" /> --> | 11 | <!-- <svg-icon v-if="item.meta.icon" :icon-class="item.meta.icon" class="breadcrumbIcon" /> --> |
| 12 | <span v-if="item.redirect === 'noRedirect' || index == levelList.length - 1" class="no-redirect">{{ | 12 | <span v-if="item.redirect === 'noRedirect' || index == levelList.length - 1" class="no-redirect"> |
| 13 | item.meta.title | 13 | {{ item.meta.title }}</span> |
| 14 | }}</span> | ||
| 15 | <a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a> | 14 | <a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a> |
| 16 | </el-breadcrumb-item> | 15 | </el-breadcrumb-item> |
| 17 | </transition-group> | 16 | </transition-group> |
| ... | @@ -19,9 +18,9 @@ | ... | @@ -19,9 +18,9 @@ |
| 19 | </template> | 18 | </template> |
| 20 | 19 | ||
| 21 | <script> | 20 | <script> |
| 22 | import pathToRegexp from 'path-to-regexp' | 21 | import pathToRegexp from 'path-to-regexp' |
| 23 | 22 | ||
| 24 | export default { | 23 | export default { |
| 25 | data () { | 24 | data () { |
| 26 | return { | 25 | return { |
| 27 | levelList: null | 26 | levelList: null |
| ... | @@ -72,11 +71,11 @@ export default { | ... | @@ -72,11 +71,11 @@ export default { |
| 72 | this.$router.push(this.pathCompile(path)) | 71 | this.$router.push(this.pathCompile(path)) |
| 73 | } | 72 | } |
| 74 | } | 73 | } |
| 75 | } | 74 | } |
| 76 | </script> | 75 | </script> |
| 77 | 76 | ||
| 78 | <style lang="scss" scoped> | 77 | <style lang="scss" scoped> |
| 79 | .app-breadcrumb.el-breadcrumb { | 78 | .app-breadcrumb.el-breadcrumb { |
| 80 | display: inline-block; | 79 | display: inline-block; |
| 81 | font-size: 14px; | 80 | font-size: 14px; |
| 82 | line-height: 50px; | 81 | line-height: 50px; |
| ... | @@ -94,5 +93,5 @@ export default { | ... | @@ -94,5 +93,5 @@ export default { |
| 94 | width: 16px; | 93 | width: 16px; |
| 95 | height: 16px; | 94 | height: 16px; |
| 96 | } | 95 | } |
| 97 | } | 96 | } |
| 98 | </style> | 97 | </style> | ... | ... |
| ... | @@ -17,9 +17,10 @@ | ... | @@ -17,9 +17,10 @@ |
| 17 | </div> | 17 | </div> |
| 18 | </template> | 18 | </template> |
| 19 | <script> | 19 | <script> |
| 20 | import axios from 'axios' | ||
| 21 | import Cookies from 'js-cookie' | ||
| 20 | import { mapGetters } from 'vuex' | 22 | import { mapGetters } from 'vuex' |
| 21 | import Breadcrumb from './Breadcrumb' | 23 | import Breadcrumb from './Breadcrumb' |
| 22 | import { logout } from "@/api/login.js"; | ||
| 23 | export default { | 24 | export default { |
| 24 | components: { | 25 | components: { |
| 25 | Breadcrumb | 26 | Breadcrumb |
| ... | @@ -39,17 +40,23 @@ | ... | @@ -39,17 +40,23 @@ |
| 39 | this.$store.dispatch('app/updateTheme', val) | 40 | this.$store.dispatch('app/updateTheme', val) |
| 40 | }, | 41 | }, |
| 41 | onCancel () { | 42 | onCancel () { |
| 42 | logout() | 43 | axios.post(this.BASE_API.ip + "/management/logout").then(() => { |
| 43 | .then((res) => { | 44 | if (process.env.NODE_ENV === 'development') { |
| 44 | sessionStorage.removeItem("token"); | 45 | localStorage.removeItem('token') |
| 45 | this.$store.dispatch("user/resetState"); | 46 | } else { |
| 46 | this.$store.dispatch("permission/resetRoutes"); | 47 | Cookies.remove('token') |
| 47 | this.$router.replace({ | 48 | } |
| 48 | path: "/login" | 49 | if (window._config.casEnable) { |
| 49 | }) | 50 | window.location.href = window._config.casBaseURL + '/logout?service=' + encodeURIComponent(window.location.href); |
| 51 | } else { | ||
| 52 | this.$router.push({ | ||
| 53 | path: '/login', | ||
| 54 | replace: true, | ||
| 55 | query: { | ||
| 56 | redirect: router.currentRoute.value.fullPath | ||
| 57 | } | ||
| 50 | }) | 58 | }) |
| 51 | .catch((error) => { | 59 | } |
| 52 | // console.dir(error); | ||
| 53 | }) | 60 | }) |
| 54 | } | 61 | } |
| 55 | } | 62 | } | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Description: | 2 | * @Description: |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2023-03-30 10:39:40 | 4 | * @LastEditTime: 2023-06-08 14:01:11 |
| 5 | --> | 5 | --> |
| 6 | <template> | 6 | <template> |
| 7 | <div v-if="!item.hidden"> | 7 | <div v-if="!item.hidden"> |
| ... | @@ -26,13 +26,13 @@ | ... | @@ -26,13 +26,13 @@ |
| 26 | </template> | 26 | </template> |
| 27 | 27 | ||
| 28 | <script> | 28 | <script> |
| 29 | import path from 'path' | 29 | import path from 'path' |
| 30 | import { isExternal } from '@/utils/validate' | 30 | import { isExternal } from '@/utils/validate' |
| 31 | import Item from './Item' | 31 | import Item from './Item' |
| 32 | import AppLink from './Link' | 32 | import AppLink from './Link' |
| 33 | import FixiOSBug from './FixiOSBug' | 33 | import FixiOSBug from './FixiOSBug' |
| 34 | 34 | ||
| 35 | export default { | 35 | export default { |
| 36 | name: 'SidebarItem', | 36 | name: 'SidebarItem', |
| 37 | components: { Item, AppLink }, | 37 | components: { Item, AppLink }, |
| 38 | mixins: [FixiOSBug], | 38 | mixins: [FixiOSBug], |
| ... | @@ -69,7 +69,7 @@ export default { | ... | @@ -69,7 +69,7 @@ export default { |
| 69 | } | 69 | } |
| 70 | }) | 70 | }) |
| 71 | // When there is only one child router, the child router is displayed by default | 71 | // When there is only one child router, the child router is displayed by default |
| 72 | if (showingChildren.length >= 1 && (showingChildren[0].path == 'ywjr' || showingChildren[0].path == "sbbwcx" || showingChildren[0].path == "dbrzcx")) { | 72 | if (showingChildren.length >= 1 && (showingChildren[0].path == 'qxjr')) { |
| 73 | return true | 73 | return true |
| 74 | } | 74 | } |
| 75 | 75 | ||
| ... | @@ -91,5 +91,5 @@ export default { | ... | @@ -91,5 +91,5 @@ export default { |
| 91 | return path.resolve(this.basePath, routePath) | 91 | return path.resolve(this.basePath, routePath) |
| 92 | } | 92 | } |
| 93 | } | 93 | } |
| 94 | } | 94 | } |
| 95 | </script> | 95 | </script> | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Description: | 2 | * @Description: |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2023-05-11 16:38:29 | 4 | * @LastEditTime: 2023-06-08 11:05:54 |
| 5 | --> | 5 | --> |
| 6 | <template> | 6 | <template> |
| 7 | <div> | 7 | <div> |
| ... | @@ -9,7 +9,7 @@ | ... | @@ -9,7 +9,7 @@ |
| 9 | <el-menu router :default-active="activeMenu" :background-color="variables.menuBg" :text-color="variables.menuText" | 9 | <el-menu router :default-active="activeMenu" :background-color="variables.menuBg" :text-color="variables.menuText" |
| 10 | :unique-opened="true" :active-text-color="variables.menuActiveText" :collapse-transition="false" mode="vertical"> | 10 | :unique-opened="true" :active-text-color="variables.menuActiveText" :collapse-transition="false" mode="vertical"> |
| 11 | <!-- 权限菜单 --> | 11 | <!-- 权限菜单 --> |
| 12 | <sidebar-item v-for="route in permission_routes.slice(4)" :key="route.path" :item="route" | 12 | <sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" |
| 13 | :base-path="route.path" /> | 13 | :base-path="route.path" /> |
| 14 | <!-- 菜单全部展示 --> | 14 | <!-- 菜单全部展示 --> |
| 15 | <!-- <sidebar-item v-for="route in asyncRoutes" :key="route.path" :item="route" :base-path="route.path" /> --> | 15 | <!-- <sidebar-item v-for="route in asyncRoutes" :key="route.path" :item="route" :base-path="route.path" /> --> | ... | ... |
| ... | @@ -18,10 +18,10 @@ | ... | @@ -18,10 +18,10 @@ |
| 18 | </template> | 18 | </template> |
| 19 | 19 | ||
| 20 | <script> | 20 | <script> |
| 21 | import ScrollPane from './ScrollPane' | 21 | import ScrollPane from './ScrollPane' |
| 22 | import path from 'path' | 22 | import path from 'path' |
| 23 | 23 | ||
| 24 | export default { | 24 | export default { |
| 25 | components: { ScrollPane }, | 25 | components: { ScrollPane }, |
| 26 | data () { | 26 | data () { |
| 27 | return { | 27 | return { |
| ... | @@ -34,7 +34,7 @@ export default { | ... | @@ -34,7 +34,7 @@ export default { |
| 34 | }, | 34 | }, |
| 35 | computed: { | 35 | computed: { |
| 36 | visitedViews () { | 36 | visitedViews () { |
| 37 | return this.$store.state.tagsView.visitedViews.slice(1) | 37 | return this.$store.state.tagsView.visitedViews |
| 38 | }, | 38 | }, |
| 39 | routes () { | 39 | routes () { |
| 40 | return this.$store.state.permission.routes | 40 | return this.$store.state.permission.routes |
| ... | @@ -186,13 +186,13 @@ export default { | ... | @@ -186,13 +186,13 @@ export default { |
| 186 | this.closeMenu() | 186 | this.closeMenu() |
| 187 | } | 187 | } |
| 188 | } | 188 | } |
| 189 | } | 189 | } |
| 190 | </script> | 190 | </script> |
| 191 | 191 | ||
| 192 | <style lang="scss" scoped> | 192 | <style lang="scss" scoped> |
| 193 | @import "~@/styles/_handle.scss"; | 193 | @import "~@/styles/_handle.scss"; |
| 194 | 194 | ||
| 195 | .tags-view-container { | 195 | .tags-view-container { |
| 196 | height: 50px; | 196 | height: 50px; |
| 197 | width: 100%; | 197 | width: 100%; |
| 198 | background: #fff; | 198 | background: #fff; |
| ... | @@ -208,7 +208,7 @@ export default { | ... | @@ -208,7 +208,7 @@ export default { |
| 208 | position: relative; | 208 | position: relative; |
| 209 | cursor: pointer; | 209 | cursor: pointer; |
| 210 | line-height: 26px; | 210 | line-height: 26px; |
| 211 | color: #4A4A4A; | 211 | color: #4a4a4a; |
| 212 | @include font_color("tagsText"); | 212 | @include font_color("tagsText"); |
| 213 | padding: 0 8px; | 213 | padding: 0 8px; |
| 214 | font-size: 12px; | 214 | font-size: 12px; |
| ... | @@ -231,7 +231,7 @@ export default { | ... | @@ -231,7 +231,7 @@ export default { |
| 231 | @include font_color("tagsActiveText"); | 231 | @include font_color("tagsActiveText"); |
| 232 | 232 | ||
| 233 | &::before { | 233 | &::before { |
| 234 | content: ''; | 234 | content: ""; |
| 235 | @include background("tagsActiveText"); | 235 | @include background("tagsActiveText"); |
| 236 | display: inline-block; | 236 | display: inline-block; |
| 237 | width: 8px; | 237 | width: 8px; |
| ... | @@ -255,7 +255,7 @@ export default { | ... | @@ -255,7 +255,7 @@ export default { |
| 255 | font-size: 12px; | 255 | font-size: 12px; |
| 256 | font-weight: 400; | 256 | font-weight: 400; |
| 257 | color: #333; | 257 | color: #333; |
| 258 | box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, .3); | 258 | box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, 0.3); |
| 259 | 259 | ||
| 260 | li { | 260 | li { |
| 261 | margin: 0; | 261 | margin: 0; |
| ... | @@ -267,12 +267,12 @@ export default { | ... | @@ -267,12 +267,12 @@ export default { |
| 267 | } | 267 | } |
| 268 | } | 268 | } |
| 269 | } | 269 | } |
| 270 | } | 270 | } |
| 271 | </style> | 271 | </style> |
| 272 | 272 | ||
| 273 | <style lang="scss"> | 273 | <style lang="scss"> |
| 274 | //reset element css of el-icon-close | 274 | //reset element css of el-icon-close |
| 275 | .tags-view-wrapper { | 275 | .tags-view-wrapper { |
| 276 | .tags-view-item { | 276 | .tags-view-item { |
| 277 | .el-icon-close { | 277 | .el-icon-close { |
| 278 | width: 16px; | 278 | width: 16px; |
| ... | @@ -280,11 +280,11 @@ export default { | ... | @@ -280,11 +280,11 @@ export default { |
| 280 | vertical-align: 2px; | 280 | vertical-align: 2px; |
| 281 | border-radius: 50%; | 281 | border-radius: 50%; |
| 282 | text-align: center; | 282 | text-align: center; |
| 283 | transition: all .3s cubic-bezier(.645, .045, .355, 1); | 283 | transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); |
| 284 | transform-origin: 100% 50%; | 284 | transform-origin: 100% 50%; |
| 285 | 285 | ||
| 286 | &:before { | 286 | &:before { |
| 287 | transform: scale(.6); | 287 | transform: scale(0.6); |
| 288 | display: inline-block; | 288 | display: inline-block; |
| 289 | vertical-align: -3px; | 289 | vertical-align: -3px; |
| 290 | } | 290 | } |
| ... | @@ -295,5 +295,5 @@ export default { | ... | @@ -295,5 +295,5 @@ export default { |
| 295 | } | 295 | } |
| 296 | } | 296 | } |
| 297 | } | 297 | } |
| 298 | } | 298 | } |
| 299 | </style> | 299 | </style> | ... | ... |
| ... | @@ -60,8 +60,6 @@ axios.get("./config.json") | ... | @@ -60,8 +60,6 @@ axios.get("./config.json") |
| 60 | .then((res) => { | 60 | .then((res) => { |
| 61 | Vue.prototype.BASE_API = res.data | 61 | Vue.prototype.BASE_API = res.data |
| 62 | localStorage.setItem('ApiUrl', JSON.stringify(res.data)); | 62 | localStorage.setItem('ApiUrl', JSON.stringify(res.data)); |
| 63 | process.env.TITLE = res.data.TITLE | ||
| 64 | process.env.IPCONFIG = res.data.IPCONFIG | ||
| 65 | require('./permission') | 63 | require('./permission') |
| 66 | new Vue({ | 64 | new Vue({ |
| 67 | el: '#app', | 65 | el: '#app', | ... | ... |
| 1 | /* | 1 | /* |
| 2 | * @Description: | 2 | * @Description: |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2023-05-12 10:46:51 | 4 | * @LastEditTime: 2023-06-08 10:48:43 |
| 5 | */ | 5 | */ |
| 6 | import Vue from 'vue' | 6 | import Vue from 'vue' |
| 7 | import router from "./router"; | 7 | import axios from 'axios' |
| 8 | import store from "./store"; | 8 | import store from "./store"; |
| 9 | import router from "./router"; | ||
| 9 | import { getMenuInfo } from "@/api/user"; | 10 | import { getMenuInfo } from "@/api/user"; |
| 11 | import { getUrlParam } from '@/utils/operation'; | ||
| 10 | import NProgress from "nprogress"; // progress bar | 12 | import NProgress from "nprogress"; // progress bar |
| 11 | import "nprogress/nprogress.css"; // progress bar style | 13 | import "nprogress/nprogress.css"; // progress bar style |
| 12 | import getPageTitle from "@/utils/get-page-title"; | 14 | import getPageTitle from "@/utils/get-page-title"; |
| ... | @@ -20,15 +22,45 @@ router.beforeEach(async (to, from, next) => { | ... | @@ -20,15 +22,45 @@ router.beforeEach(async (to, from, next) => { |
| 20 | let hasAddDict = store.state.dict.addDict; | 22 | let hasAddDict = store.state.dict.addDict; |
| 21 | let hasUser = store.state.user.hasUser; | 23 | let hasUser = store.state.user.hasUser; |
| 22 | let hasAddRoute = store.state.permission.addRoutes; | 24 | let hasAddRoute = store.state.permission.addRoutes; |
| 23 | if (to.path == "/login") { | 25 | // cas操作 |
| 24 | localStorage.removeItem("token"); | 26 | const token = localStorage.getItem("token") || Cookies.get('token'); |
| 25 | next(); | 27 | if (to.path === '/login') { |
| 28 | if (token) { | ||
| 29 | next('/') | ||
| 30 | } else { | ||
| 31 | next() | ||
| 32 | } | ||
| 33 | return | ||
| 34 | } | ||
| 35 | if (window._config.casEnable === true) { | ||
| 36 | let locationUrl = window.location.protocol + '//' + window.location.host + window.location.pathname; | ||
| 37 | if (!token) { | ||
| 38 | let ticket = getUrlParam('ticket'); | ||
| 39 | if (ticket) { | ||
| 40 | axios.get(Vue.prototype.BASE_API.ip + "/management/cas/validate", { | ||
| 41 | params: { | ||
| 42 | 'ticket': ticket, | ||
| 43 | 'service': locationUrl | ||
| 44 | } | ||
| 45 | }).then(async (res) => { | ||
| 46 | if (process.env.NODE_ENV === 'development') { | ||
| 47 | localStorage.setItem('token', res.data.content.accessToken) | ||
| 26 | } else { | 48 | } else { |
| 27 | let code = Vue.prototype.BASE_API.CODE | 49 | Cookies.set('token', res.data.content.accessToken) |
| 28 | //判断token是否存在 | 50 | } |
| 29 | const hasToken = localStorage.getItem("token"); | 51 | window.location.href = localStorage.getItem('location') |
| 30 | if (hasToken) { | 52 | |
| 31 | //请求用户信息 | 53 | }).catch(e => { |
| 54 | console.log(e) | ||
| 55 | }) | ||
| 56 | } else { | ||
| 57 | localStorage.setItem("location", window.location.href) | ||
| 58 | window.location.href = window._config.casBaseURL + '/login?service=' + encodeURIComponent(locationUrl); | ||
| 59 | } | ||
| 60 | } else { | ||
| 61 | permission() | ||
| 62 | } | ||
| 63 | async function permission () { | ||
| 32 | if (!hasUser) { | 64 | if (!hasUser) { |
| 33 | store.dispatch("user/getUserInfo"); | 65 | store.dispatch("user/getUserInfo"); |
| 34 | if (!hasAddDict) { | 66 | if (!hasAddDict) { |
| ... | @@ -39,25 +71,40 @@ router.beforeEach(async (to, from, next) => { | ... | @@ -39,25 +71,40 @@ router.beforeEach(async (to, from, next) => { |
| 39 | next(); | 71 | next(); |
| 40 | } else { | 72 | } else { |
| 41 | //请求菜单 | 73 | //请求菜单 |
| 42 | const { result: getMenuData } = (await getMenuInfo(code)) || []; | 74 | const { result: getMenuData } = (await getMenuInfo(Vue.prototype.BASE_API.CODE)) || []; |
| 43 | const accessRoutes = await store.dispatch( | 75 | const accessRoutes = await store.dispatch( |
| 44 | "permission/generateRoutes", | 76 | "permission/generateRoutes", |
| 45 | getMenuData | 77 | getMenuData |
| 46 | ); | 78 | ); |
| 79 | let path = JSON.parse(getMenuData[0].metadata)?.path + JSON.parse(getMenuData[0].children[0].metadata)?.path | ||
| 47 | router.addRoutes([ | 80 | router.addRoutes([ |
| 48 | ...accessRoutes, | 81 | ...accessRoutes, |
| 49 | { path: "*", redirect: "/404", hidden: true }, | 82 | { path: "*", redirect: "/404", hidden: true }, |
| 50 | ]); | 83 | ]); |
| 51 | const routeTo = Cookies.get("routerTo"); | 84 | const routeTo = Cookies.get("routerTo"); |
| 52 | if (routeTo && routeTo !== "/" && routeTo !== "/login") { | 85 | if (routeTo && routeTo !== "/") { |
| 53 | next({ ...to, replace: true }); | 86 | next({ ...to, replace: true }); |
| 54 | } else { | 87 | } else { |
| 55 | next() | 88 | next(path) |
| 89 | } | ||
| 56 | } | 90 | } |
| 57 | } | 91 | } |
| 58 | } else { | 92 | } else { |
| 59 | next('/login') | 93 | if (!token) { |
| 94 | const redirectData = { | ||
| 95 | path: '/login', | ||
| 96 | replace: true, | ||
| 97 | } | ||
| 98 | if (to.path) { | ||
| 99 | redirectData.query = { | ||
| 100 | ...redirectData.query, | ||
| 101 | redirect: to.path, | ||
| 102 | }; | ||
| 60 | } | 103 | } |
| 104 | next(redirectData) | ||
| 105 | return | ||
| 106 | } | ||
| 107 | next() | ||
| 61 | } | 108 | } |
| 62 | NProgress.done() | 109 | NProgress.done() |
| 63 | }); | 110 | }); | ... | ... |
| 1 | /* | 1 | /* |
| 2 | * @Description :路由配置 | 2 | * @Description :路由配置 |
| 3 | * @Autor : miaofang | 3 | * @Autor : miaofang |
| 4 | * @LastEditTime : 2023-05-17 14:55:00 | 4 | * @LastEditTime: 2023-06-08 14:24:36 |
| 5 | */ | 5 | */ |
| 6 | import Vue from 'vue' | 6 | import Vue from 'vue' |
| 7 | import Router from 'vue-router' | 7 | import Router from 'vue-router' |
| ... | @@ -22,32 +22,6 @@ export const constantRoutes = [ | ... | @@ -22,32 +22,6 @@ export const constantRoutes = [ |
| 22 | meta: { title: '404' } | 22 | meta: { title: '404' } |
| 23 | } | 23 | } |
| 24 | ] | 24 | ] |
| 25 | }, | ||
| 26 | //登录 | ||
| 27 | { | ||
| 28 | path: "/login", | ||
| 29 | name: "login", | ||
| 30 | component: () => import("@/views/login/index.vue"), | ||
| 31 | }, | ||
| 32 | { | ||
| 33 | path: '/', | ||
| 34 | redirect: to => { | ||
| 35 | return { path: '/login' } | ||
| 36 | }, | ||
| 37 | }, | ||
| 38 | // 监管首页 | ||
| 39 | { | ||
| 40 | path: '/home', | ||
| 41 | component: Layout, | ||
| 42 | meta: { title: '首页' }, | ||
| 43 | children: [ | ||
| 44 | { | ||
| 45 | path: '', | ||
| 46 | component: () => import('@/views/home/index'), | ||
| 47 | name: 'home', | ||
| 48 | meta: { title: '工作台', icon: 'workbench', affix: true } | ||
| 49 | } | ||
| 50 | ] | ||
| 51 | } | 25 | } |
| 52 | ] | 26 | ] |
| 53 | /** | 27 | /** |
| ... | @@ -57,15 +31,11 @@ export const constantRoutes = [ | ... | @@ -57,15 +31,11 @@ export const constantRoutes = [ |
| 57 | export const asyncRoutes = [ | 31 | export const asyncRoutes = [ |
| 58 | // 区县接入 | 32 | // 区县接入 |
| 59 | { | 33 | { |
| 60 | path: '/jsbwcx', | 34 | path: '/', |
| 35 | redirect: '/qxjr', | ||
| 36 | meta: { title: '区县接入', icon: 'qxjr' }, | ||
| 61 | component: Layout, | 37 | component: Layout, |
| 62 | children: [ | 38 | children: [ |
| 63 | // { | ||
| 64 | // path: 'xxcx', | ||
| 65 | // component: () => import('@/views/gbxxcx/index'), | ||
| 66 | // name: 'xxcx', | ||
| 67 | // meta: { title: '信息查询', icon: 'xxcx' } | ||
| 68 | // }, | ||
| 69 | { | 39 | { |
| 70 | path: 'qxjr', | 40 | path: 'qxjr', |
| 71 | component: () => import('@/views/jsbwcx/index'), | 41 | component: () => import('@/views/jsbwcx/index'), |
| ... | @@ -77,6 +47,7 @@ export const asyncRoutes = [ | ... | @@ -77,6 +47,7 @@ export const asyncRoutes = [ |
| 77 | // 省厅汇交 | 47 | // 省厅汇交 |
| 78 | { | 48 | { |
| 79 | path: '/sthj', | 49 | path: '/sthj', |
| 50 | meta: { title: '省厅汇交', icon: 'sthj' }, | ||
| 80 | component: Layout, | 51 | component: Layout, |
| 81 | children: [ | 52 | children: [ |
| 82 | { | 53 | { |
| ... | @@ -102,33 +73,33 @@ export const asyncRoutes = [ | ... | @@ -102,33 +73,33 @@ export const asyncRoutes = [ |
| 102 | { | 73 | { |
| 103 | path: 'ywltj', | 74 | path: 'ywltj', |
| 104 | component: () => import('@/views/jktj/ywltj/index'), | 75 | component: () => import('@/views/jktj/ywltj/index'), |
| 105 | name: 'jktj', | 76 | name: 'ywltj', |
| 106 | meta: { title: '业务量统计', icon: 'zhcx' } | 77 | meta: { title: '业务量统计', icon: 'zhcx' } |
| 107 | }, | 78 | }, |
| 108 | { | 79 | { |
| 109 | path: 'bsxljk', | 80 | path: 'bsxljk', |
| 110 | component: () => import('@/views/jktj/bsxljk/index'), | 81 | component: () => import('@/views/jktj/bsxljk/index'), |
| 111 | name: 'jktj', | 82 | name: 'bsxljk', |
| 112 | meta: { title: '办事效率监控', icon: 'zhcx' } | 83 | meta: { title: '办事效率监控', icon: 'zhcx' } |
| 113 | }, | 84 | }, |
| 114 | { | 85 | // { |
| 115 | path: 'dataReceiveQuality', | 86 | // path: 'dataReceiveQuality', |
| 116 | component: () => import('@/views/jktj/dataReceiveQuality/index'), | 87 | // component: () => import('@/views/jktj/dataReceiveQuality/index'), |
| 117 | name: 'dataReceiveQuality', | 88 | // name: 'dataReceiveQuality', |
| 118 | meta: { title: '接入质量评价表', icon: 'dataReceiveQuality' } | 89 | // meta: { title: '接入质量评价表', icon: 'dataReceiveQuality' } |
| 119 | }, | 90 | // }, |
| 120 | { | 91 | // { |
| 121 | path: 'nullTermRatio', | 92 | // path: 'nullTermRatio', |
| 122 | component: () => import('@/views/jktj/nullTermRatio/index'), | 93 | // component: () => import('@/views/jktj/nullTermRatio/index'), |
| 123 | name: 'nullTermRatio', | 94 | // name: 'nullTermRatio', |
| 124 | meta: { title: '相关字段空置率统计', icon: 'nullTermRatio' } | 95 | // meta: { title: '相关字段空置率统计', icon: 'nullTermRatio' } |
| 125 | }, | 96 | // }, |
| 126 | { | 97 | // { |
| 127 | path: 'registerBookQuality', | 98 | // path: 'registerBookQuality', |
| 128 | component: () => import('@/views/jktj/registerBookQuality/index'), | 99 | // component: () => import('@/views/jktj/registerBookQuality/index'), |
| 129 | name: 'registerBookQuality', | 100 | // name: 'registerBookQuality', |
| 130 | meta: { title: '登簿质量评价表', icon: 'registerBookQuality' } | 101 | // meta: { title: '登簿质量评价表', icon: 'registerBookQuality' } |
| 131 | } | 102 | // } |
| 132 | ] | 103 | ] |
| 133 | }, | 104 | }, |
| 134 | // 接入业务信息-不动产数据 | 105 | // 接入业务信息-不动产数据 |
| ... | @@ -258,24 +229,6 @@ export const asyncRoutes = [ | ... | @@ -258,24 +229,6 @@ export const asyncRoutes = [ |
| 258 | component: () => import('@/views/system/timedTask/index'), | 229 | component: () => import('@/views/system/timedTask/index'), |
| 259 | name: 'timedTask', | 230 | name: 'timedTask', |
| 260 | meta: { title: '定时任务' } | 231 | meta: { title: '定时任务' } |
| 261 | }, | ||
| 262 | { | ||
| 263 | path: 'menus', | ||
| 264 | component: () => import('@/views/system/menus/index'), | ||
| 265 | name: 'menus', | ||
| 266 | meta: { title: '菜单管理' } | ||
| 267 | }, | ||
| 268 | { | ||
| 269 | path: 'users', | ||
| 270 | component: () => import('@/views/system/users/index'), | ||
| 271 | name: 'users', | ||
| 272 | meta: { title: '人员管理' } | ||
| 273 | }, | ||
| 274 | { | ||
| 275 | path: 'roles', | ||
| 276 | component: () => import('@/views/system/roles/index'), | ||
| 277 | name: 'roles', | ||
| 278 | meta: { title: '角色管理' } | ||
| 279 | } | 232 | } |
| 280 | ] | 233 | ] |
| 281 | } | 234 | } | ... | ... |
| ... | @@ -141,3 +141,26 @@ export function getFirstDayOfSeason (d) { | ... | @@ -141,3 +141,26 @@ export function getFirstDayOfSeason (d) { |
| 141 | date.setDate(1); | 141 | date.setDate(1); |
| 142 | return timeFormat(date); | 142 | return timeFormat(date); |
| 143 | } | 143 | } |
| 144 | |||
| 145 | export function getUrlParam (paraName) { | ||
| 146 | let url = document.location.toString(); | ||
| 147 | let arrObj = url.split('?'); | ||
| 148 | |||
| 149 | if (arrObj.length > 1) { | ||
| 150 | let arrPara = arrObj[1].split('&'); | ||
| 151 | let arr; | ||
| 152 | |||
| 153 | for (let i = 0; i < arrPara.length; i++) { | ||
| 154 | arr = arrPara[i].split('='); | ||
| 155 | |||
| 156 | if (arr != null && arr[0] === paraName) { | ||
| 157 | const index = arr[1].indexOf("#"); | ||
| 158 | return arr[1].substring(0, index); | ||
| 159 | } | ||
| 160 | } | ||
| 161 | return ''; | ||
| 162 | } else { | ||
| 163 | return ''; | ||
| 164 | } | ||
| 165 | } | ||
| 166 | ... | ... |
| 1 | /* | 1 | /* |
| 2 | * @Description: 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器 | 2 | * @Description: 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器 |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2023-05-25 14:52:20 | 4 | * @LastEditTime: 2023-06-08 09:02:53 |
| 5 | */ | 5 | */ |
| 6 | import Vue from 'vue' | 6 | import Vue from 'vue' |
| 7 | import axios from "axios"; | 7 | import axios from 'axios' |
| 8 | import { Message } from "element-ui"; | 8 | import Router from '@/router' |
| 9 | import { endLoadingSubCount } from "./requestLoading"; | 9 | import Cookies from 'js-cookie' |
| 10 | import router from "../router"; | 10 | import { Message } from 'element-ui' |
| 11 | import { endLoadingSubCount } from './requestLoading' | ||
| 12 | |||
| 11 | // create an axios instance | 13 | // create an axios instance |
| 12 | const service = axios.create({ | 14 | const service = axios.create({ |
| 13 | baseURL: process.env.VUE_APP_BASE_API, | 15 | baseURL: |
| 16 | process.env.NODE_ENV == "development" | ||
| 17 | ? process.env.VUE_APP_BASE_API | ||
| 18 | : window._config.baseUrl + "/", | ||
| 14 | withCredentials: true, //是否允许跨域 | 19 | withCredentials: true, //是否允许跨域 |
| 15 | headers: { | 20 | headers: { |
| 16 | "Content-Type": "application/json; charset=utf-8", | 21 | 'Content-Type': 'application/json; charset=utf-8' |
| 17 | }, | 22 | }, |
| 18 | 23 | timeout: 15000 | |
| 19 | timeout: 15000, | 24 | }) |
| 20 | }); | ||
| 21 | 25 | ||
| 22 | // request interceptor | 26 | // request interceptor |
| 23 | service.interceptors.request.use( | 27 | service.interceptors.request.use( |
| 24 | (config) => { | 28 | config => { |
| 25 | //调用登录接口时无token,也不需要传token,其他接口都传入token | 29 | if (process.env.NODE_ENV === 'development') { |
| 26 | config.headers.Authorization = localStorage.getItem("token") || ""; | 30 | const token = localStorage.getItem('token') |
| 27 | config.headers.Accept = "application/json"; | 31 | // 添加请求头 |
| 28 | return config; | 32 | if (token) { |
| 33 | config.headers['Authorization'] = 'Bearer ' + token | ||
| 34 | } else { | ||
| 35 | config.headers.delete('Authorization') | ||
| 36 | } | ||
| 37 | } else { | ||
| 38 | const token = Cookies.get('token') | ||
| 39 | // 添加请求头 | ||
| 40 | if (token) { | ||
| 41 | config.headers['Authorization'] = 'Bearer ' + token | ||
| 42 | } else { | ||
| 43 | config.headers.delete('Authorization') | ||
| 44 | } | ||
| 45 | } | ||
| 46 | return config | ||
| 29 | }, | 47 | }, |
| 30 | (error) => { | 48 | error => { |
| 31 | Message.error("请求超时!"); | 49 | // do something with request error |
| 50 | console.log(error); // for debug | ||
| 32 | return Promise.reject(error); | 51 | return Promise.reject(error); |
| 33 | } | 52 | } |
| 34 | ); | 53 | ) |
| 35 | 54 | window.__isNeedLogin = true | |
| 36 | window.tokenValid = true | ||
| 37 | // response interceptor | 55 | // response interceptor |
| 38 | service.interceptors.response.use( | 56 | service.interceptors.response.use( |
| 39 | (response) => { | 57 | response => { |
| 40 | /** | 58 | /** |
| 41 | * 对响应数据判断: | 59 | * 对响应数据判断: |
| 42 | * 如果成功返回数据,就通过return把数据返出去 | 60 | * 如果成功返回数据,就通过return把数据返出去 |
| ... | @@ -45,37 +63,60 @@ service.interceptors.response.use( | ... | @@ -45,37 +63,60 @@ service.interceptors.response.use( |
| 45 | if (response.status == 200) { | 63 | if (response.status == 200) { |
| 46 | return response.data; | 64 | return response.data; |
| 47 | } else { | 65 | } else { |
| 48 | // 对响应错误做点什么 | 66 | handleErrorData(response.data); |
| 49 | Message({ | ||
| 50 | message: "请求失败", | ||
| 51 | type: "error", | ||
| 52 | duration: 5 * 1000, | ||
| 53 | }); | ||
| 54 | } | 67 | } |
| 55 | return response; | 68 | return response; |
| 56 | }, | 69 | }, |
| 57 | (error) => { | 70 | error => { |
| 58 | handleErrorData(error.response.status); | 71 | endLoadingSubCount() |
| 59 | endLoadingSubCount(); | 72 | if (error.response.status === 401) { |
| 60 | return Promise.reject(error); | 73 | //todo: 需要解决 一个页面多个请求,刷新后此处会触发多次 |
| 74 | if (window.__isNeedLogin) { | ||
| 75 | window.__isNeedLogin = false | ||
| 76 | Message.error('token失效,请重新登录'); | ||
| 77 | let locationUrl = window.location.protocol + '//' + window.location.host + window.location.pathname; | ||
| 78 | if (process.env.NODE_ENV === 'development') { | ||
| 79 | localStorage.removeItem('token') | ||
| 80 | } else { | ||
| 81 | Cookies.remove('token') | ||
| 61 | } | 82 | } |
| 62 | ); | 83 | |
| 63 | //对错误信息的处理函数 | 84 | if (window._config.casEnable) { |
| 64 | function handleErrorData (status) { | 85 | window.location.href = window._config.casBaseURL + '/logout?service=' + encodeURIComponent(locationUrl); |
| 65 | switch (status) { | 86 | } else { |
| 66 | case 401: | 87 | Router.replace({ |
| 67 | // 多个请求不重复提示错误信息 | 88 | path: '/login', |
| 68 | if (window.tokenValid) { | ||
| 69 | window.tokenValid = false; | ||
| 70 | Message.error("由于长时间未操作,请重新登录!"); | ||
| 71 | localStorage.removeItem("token"); | ||
| 72 | router.replace({ | ||
| 73 | path: "/login", | ||
| 74 | query: { | 89 | query: { |
| 75 | redirect: router.history.current.fullPath, | 90 | redirect: Router.currentRoute.value.fullPath |
| 76 | } | 91 | } |
| 77 | }) | 92 | }) |
| 93 | return false | ||
| 78 | } | 94 | } |
| 95 | } | ||
| 96 | |||
| 97 | } else { | ||
| 98 | // 对响应错误做点什么 | ||
| 99 | Message({ | ||
| 100 | message: '服务器异常,请联系管理员', | ||
| 101 | type: 'error', | ||
| 102 | duration: 5 * 1000, | ||
| 103 | customClass: 'messageIndex' | ||
| 104 | }) | ||
| 105 | } | ||
| 106 | return Promise.reject(error); | ||
| 107 | } | ||
| 108 | ) | ||
| 109 | //对错误信息的处理函数 | ||
| 110 | function handleErrorData (errMes) { | ||
| 111 | if (errMes.message) { | ||
| 112 | Message.error(errMes.message); | ||
| 113 | } else { | ||
| 114 | switch (errMes.code) { | ||
| 115 | case 401: | ||
| 116 | Message.error("未授权,请重新登录!"); | ||
| 117 | break; | ||
| 118 | case 403: | ||
| 119 | Message.error("拒绝访问"); | ||
| 79 | break; | 120 | break; |
| 80 | case 404: | 121 | case 404: |
| 81 | Message.error("很抱歉,资源未找到!"); | 122 | Message.error("很抱歉,资源未找到!"); |
| ... | @@ -87,5 +128,8 @@ function handleErrorData (status) { | ... | @@ -87,5 +128,8 @@ function handleErrorData (status) { |
| 87 | Message.error("服务正在联调中,请稍后!"); | 128 | Message.error("服务正在联调中,请稍后!"); |
| 88 | break; | 129 | break; |
| 89 | } | 130 | } |
| 131 | } | ||
| 90 | } | 132 | } |
| 91 | export default service; | 133 | export default service |
| 134 | |||
| 135 | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Description :接收报文查询 | 2 | * @Description :接收报文查询 |
| 3 | * @Autor : miaofang | 3 | * @Autor : miaofang |
| 4 | * @LastEditTime : 2023-05-17 15:36:17 | 4 | * @LastEditTime: 2023-06-08 14:15:38 |
| 5 | --> | 5 | --> |
| 6 | <template> | 6 | <template> |
| 7 | <!-- 接收报文查询 --> | 7 | <!-- 接收报文查询 --> |
| ... | @@ -9,9 +9,6 @@ | ... | @@ -9,9 +9,6 @@ |
| 9 | <!-- 头部搜索 --> | 9 | <!-- 头部搜索 --> |
| 10 | <div class="from-clues-header"> | 10 | <div class="from-clues-header"> |
| 11 | <el-form ref="ruleForm" :model="form" label-width="100px"> | 11 | <el-form ref="ruleForm" :model="form" label-width="100px"> |
| 12 | <el-form-item v-if="BASE_API.THEME == 'jg'"> | ||
| 13 | <Breadcrumb /> | ||
| 14 | </el-form-item> | ||
| 15 | <el-row class="mb-5"> | 12 | <el-row class="mb-5"> |
| 16 | <el-col :span="6"> | 13 | <el-col :span="6"> |
| 17 | <el-form-item label="行政区" prop="qxdm"> | 14 | <el-form-item label="行政区" prop="qxdm"> | ... | ... |
src/views/login/index.vue
deleted
100644 → 0
| 1 | <!-- | ||
| 2 | * @Description :登录 | ||
| 3 | * @Autor : miaofang | ||
| 4 | * @LastEditTime : 2023-05-17 15:36:30 | ||
| 5 | --> | ||
| 6 | <template> | ||
| 7 | <div class="bg"> | ||
| 8 | <div class="title"> | ||
| 9 | <img src="../../image/bdclogo.png" alt=""> | ||
| 10 | <h2>{{ BASE_API.TITLE }}</h2> | ||
| 11 | </div> | ||
| 12 | <div class="login-inner-bg login"> | ||
| 13 | <div class="user_style"> | ||
| 14 | <h3>用户登录</h3> | ||
| 15 | <el-form :model="user" :rules="rules" ref="user" id="loginform" class="demo-ruleForm"> | ||
| 16 | <el-form-item prop="account"> | ||
| 17 | <el-input class="username" v-model="user.account" placeholder="请输入用户名"></el-input> | ||
| 18 | </el-form-item> | ||
| 19 | <el-form-item prop="password"> | ||
| 20 | <el-input type="password" class="password" @keyup.enter.native="login('user')" v-model="user.password" | ||
| 21 | placeholder="请输入密码" show-password></el-input> | ||
| 22 | </el-form-item> | ||
| 23 | <!-- <el-form-item prop="yz"> | ||
| 24 | <div class="flex-container"> | ||
| 25 | <div class="flex-input"> | ||
| 26 | <el-input class="yz" @keyup.native="login('user')" v-model="user.yz" placeholder="请输入验证码"></el-input> | ||
| 27 | </div> | ||
| 28 | <div class="flex-line"></div> | ||
| 29 | <div class="flex-img"><canvas id="s-canvas" ref="s-canvas"></canvas></div> | ||
| 30 | <div class="flex-renovate"> | ||
| 31 | <font id="renovate" @click="verification">换一批</font> | ||
| 32 | </div> | ||
| 33 | </div> | ||
| 34 | </el-form-item> --> | ||
| 35 | <el-form-item class="login-btn"> | ||
| 36 | <el-button type="primary" style="width: 100%" @click="login('user')">登录</el-button> | ||
| 37 | </el-form-item> | ||
| 38 | </el-form> | ||
| 39 | </div> | ||
| 40 | </div> | ||
| 41 | </div> | ||
| 42 | </template> | ||
| 43 | |||
| 44 | <script> | ||
| 45 | import { getMenuInfo } from "@/api/user"; | ||
| 46 | import { loginIn } from "@/api/login.js"; | ||
| 47 | export default { | ||
| 48 | name: "sbLogin", | ||
| 49 | data () { | ||
| 50 | return { | ||
| 51 | user: { | ||
| 52 | account: "", | ||
| 53 | password: "", | ||
| 54 | yz: "", | ||
| 55 | checkStatus: false, | ||
| 56 | }, | ||
| 57 | productName: "", | ||
| 58 | rules: { | ||
| 59 | account: [{ required: true, message: "请填写帐号", trigger: "blur" }], | ||
| 60 | password: [{ required: true, message: "请填写密码", trigger: "blur" }], | ||
| 61 | }, | ||
| 62 | }; | ||
| 63 | }, | ||
| 64 | methods: { | ||
| 65 | verification () { | ||
| 66 | let str = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ', code = '', i = 0; | ||
| 67 | for (; i++ < 4;) code += str[Math.floor(Math.random() * (str.length - 0) + 0)]; | ||
| 68 | setTimeout(() => { | ||
| 69 | let canvas = document.getElementById("s-canvas"), ctx = canvas.getContext("2d"); | ||
| 70 | canvas.width = 80; | ||
| 71 | canvas.height = 28; | ||
| 72 | ctx.fillStyle = '#ffffff'; | ||
| 73 | ctx.fillRect(0, 0, 80, 28); | ||
| 74 | for (i = 0; i < code.length; i++) { this.drawText(ctx, code[i], i); } | ||
| 75 | }, 0); | ||
| 76 | }, | ||
| 77 | drawText (ctx, txt, i) { | ||
| 78 | ctx.fillStyle = this.randomColor(50, 160); | ||
| 79 | ctx.font = "18px SimHei"; | ||
| 80 | let x = (i + 1) * (80 / (4 + 1)), y = this.randomNum(18, 28 - 5); | ||
| 81 | ctx.translate(x, y); | ||
| 82 | ctx.fillText(txt, 0, 0); | ||
| 83 | ctx.rotate((-0 * Math.PI) / 180); | ||
| 84 | ctx.translate(-x, -y); | ||
| 85 | }, | ||
| 86 | randomColor (min, max) { | ||
| 87 | let r = this.randomNum(min, max); | ||
| 88 | let g = this.randomNum(min, max); | ||
| 89 | let b = this.randomNum(min, max); | ||
| 90 | return "rgb(" + r + "," + g + "," + b + ")"; | ||
| 91 | }, | ||
| 92 | randomNum (min, max) { | ||
| 93 | return Math.floor(Math.random() * (max - min) + min); | ||
| 94 | }, | ||
| 95 | //记住用户名 | ||
| 96 | checkUserName: function (flag) { | ||
| 97 | this.user.checkStatus = flag; | ||
| 98 | if (this.user.checkStatus) { | ||
| 99 | localStorage.setItem("accountId", this.user.account); | ||
| 100 | let name = localStorage.getItem("accountId"); | ||
| 101 | if (name === "") { | ||
| 102 | return; | ||
| 103 | } else { | ||
| 104 | this.user.account = name; | ||
| 105 | } | ||
| 106 | } else { | ||
| 107 | this.user.account = localStorage.getItem("accountId"); | ||
| 108 | } | ||
| 109 | }, | ||
| 110 | login (user) { | ||
| 111 | var self = this | ||
| 112 | this.$refs[user].validate(async (valid) => { | ||
| 113 | if (valid) { | ||
| 114 | let res = await loginIn(self.user.account, self.user.password) | ||
| 115 | if (res.status == 1) { | ||
| 116 | let code = this.BASE_API.CODE; | ||
| 117 | localStorage.setItem("token", `Bearer ${res.content}`); | ||
| 118 | const { result: getMenuData } = (await getMenuInfo(code)) || []; | ||
| 119 | let path1 = JSON.parse(getMenuData[0].metadata)?.path + '/' + JSON.parse(getMenuData[0].children[0].metadata)?.path | ||
| 120 | |||
| 121 | console.log(getMenuData, path1, 'path1path1path1path1path1'); | ||
| 122 | //登录成功后需判断有无重定向,没有重定向则跳转首页 | ||
| 123 | const accessRoutes = await this.$store.dispatch( | ||
| 124 | "permission/generateRoutes", | ||
| 125 | getMenuData | ||
| 126 | ); | ||
| 127 | this.$router.addRoutes([ | ||
| 128 | ...accessRoutes, | ||
| 129 | { path: "*", redirect: "/404", hidden: true }, | ||
| 130 | ]); | ||
| 131 | this.$router.replace(this.$route.query.redirect || path1); | ||
| 132 | } else { | ||
| 133 | this.$message.error(res.message); | ||
| 134 | } | ||
| 135 | } | ||
| 136 | }) | ||
| 137 | } | ||
| 138 | } | ||
| 139 | } | ||
| 140 | </script> | ||
| 141 | <style scoped lang="scss"> | ||
| 142 | .username, | ||
| 143 | .password, | ||
| 144 | .yz { | ||
| 145 | position: relative; | ||
| 146 | |||
| 147 | &:before { | ||
| 148 | content: ""; | ||
| 149 | display: block; | ||
| 150 | width: 16px; | ||
| 151 | height: 16px; | ||
| 152 | position: absolute; | ||
| 153 | left: 10px; | ||
| 154 | top: 7px; | ||
| 155 | background-size: 100% 100%; | ||
| 156 | } | ||
| 157 | |||
| 158 | /deep/ .el-input__inner { | ||
| 159 | color: #000 !important; | ||
| 160 | text-indent: 24px; | ||
| 161 | } | ||
| 162 | } | ||
| 163 | |||
| 164 | .flex-container { | ||
| 165 | position: relative; | ||
| 166 | display: -webkit-flex; | ||
| 167 | display: flex; | ||
| 168 | } | ||
| 169 | |||
| 170 | .flex-input { | ||
| 171 | width: 100%; | ||
| 172 | } | ||
| 173 | |||
| 174 | .flex-line { | ||
| 175 | position: absolute; | ||
| 176 | width: 1px; | ||
| 177 | height: 64%; | ||
| 178 | margin: 5px; | ||
| 179 | right: 36%; | ||
| 180 | background-color: #cccccc; | ||
| 181 | } | ||
| 182 | |||
| 183 | .flex-img { | ||
| 184 | position: absolute; | ||
| 185 | margin: 2px; | ||
| 186 | right: 16%; | ||
| 187 | } | ||
| 188 | |||
| 189 | .flex-renovate { | ||
| 190 | position: absolute; | ||
| 191 | margin: 1px; | ||
| 192 | right: 3%; | ||
| 193 | } | ||
| 194 | |||
| 195 | #renovate { | ||
| 196 | color: #3f8fea; | ||
| 197 | font-size: 16px; | ||
| 198 | font-weight: 700; | ||
| 199 | cursor: pointer; | ||
| 200 | } | ||
| 201 | |||
| 202 | .username::before { | ||
| 203 | background-image: url(../../image/userlogo.png); | ||
| 204 | } | ||
| 205 | |||
| 206 | .password::before { | ||
| 207 | background-image: url(../../image/passlogo.png); | ||
| 208 | } | ||
| 209 | |||
| 210 | .yz::before { | ||
| 211 | background-image: url(../../image/yzlogo.png); | ||
| 212 | } | ||
| 213 | |||
| 214 | .bg { | ||
| 215 | width: 100%; | ||
| 216 | height: 100%; | ||
| 217 | min-width: 1440px; | ||
| 218 | min-height: 560px; | ||
| 219 | background: url(../../image/loginBoxsb.png) no-repeat; | ||
| 220 | background-size: 100% 100%; | ||
| 221 | overflow: hidden; | ||
| 222 | position: relative; | ||
| 223 | } | ||
| 224 | |||
| 225 | .title { | ||
| 226 | width: 24%; | ||
| 227 | height: 6%; | ||
| 228 | top: 20%; | ||
| 229 | right: 38%; | ||
| 230 | position: absolute; | ||
| 231 | |||
| 232 | img { | ||
| 233 | width: 60px; | ||
| 234 | height: 60px; | ||
| 235 | top: 0%; | ||
| 236 | left: 2%; | ||
| 237 | position: absolute; | ||
| 238 | } | ||
| 239 | |||
| 240 | h2 { | ||
| 241 | top: 25%; | ||
| 242 | left: 22%; | ||
| 243 | position: absolute; | ||
| 244 | width: 383px; | ||
| 245 | height: 42px; | ||
| 246 | font-size: 28px; | ||
| 247 | font-weight: 600; | ||
| 248 | color: #ffffff; | ||
| 249 | text-shadow: 0px 4px 4px #002c95; | ||
| 250 | } | ||
| 251 | } | ||
| 252 | |||
| 253 | .login-inner-bg { | ||
| 254 | background: white; | ||
| 255 | width: 24.6%; | ||
| 256 | min-width: 360px; | ||
| 257 | top: 30%; | ||
| 258 | right: 38%; | ||
| 259 | position: absolute; | ||
| 260 | background-size: 100% 100%; | ||
| 261 | box-sizing: border-box; | ||
| 262 | padding: 56px; | ||
| 263 | } | ||
| 264 | |||
| 265 | .login { | ||
| 266 | .user_style { | ||
| 267 | h3 { | ||
| 268 | font-weight: normal; | ||
| 269 | text-align: center; | ||
| 270 | margin: -10px auto 28px; | ||
| 271 | font-weight: 400; | ||
| 272 | width: 125px; | ||
| 273 | height: 29px; | ||
| 274 | font-size: 20px; | ||
| 275 | font-family: Source Han Sans CN; | ||
| 276 | font-weight: 400; | ||
| 277 | color: #333333; | ||
| 278 | } | ||
| 279 | } | ||
| 280 | |||
| 281 | .btn { | ||
| 282 | width: 100%; | ||
| 283 | height: 6vh; | ||
| 284 | background-color: #00c2de; | ||
| 285 | border-radius: 5px; | ||
| 286 | font-size: 1.4vw; | ||
| 287 | color: #000; | ||
| 288 | } | ||
| 289 | |||
| 290 | .btn:hover { | ||
| 291 | cursor: pointer; | ||
| 292 | background-color: #2d8cf0; | ||
| 293 | } | ||
| 294 | } | ||
| 295 | |||
| 296 | .login #loginform { | ||
| 297 | .el-form-item { | ||
| 298 | margin-bottom: 24px !important; | ||
| 299 | } | ||
| 300 | |||
| 301 | .login-btn { | ||
| 302 | margin-top: 30px !important; | ||
| 303 | } | ||
| 304 | |||
| 305 | .el-button { | ||
| 306 | font-size: 18px; | ||
| 307 | border-radius: 0; | ||
| 308 | background: #4162d8 !important; | ||
| 309 | color: #ffffff !important; | ||
| 310 | cursor: pointer !important; | ||
| 311 | } | ||
| 312 | |||
| 313 | .el-input__inner { | ||
| 314 | width: 100% !important; | ||
| 315 | } | ||
| 316 | |||
| 317 | .el-checkbox__label { | ||
| 318 | color: #fff; | ||
| 319 | } | ||
| 320 | } | ||
| 321 | |||
| 322 | .inputUser .ivu-input { | ||
| 323 | padding: 6px 24px !important; | ||
| 324 | border: 1px solid #9f9f9f !important; | ||
| 325 | } | ||
| 326 | </style> |
| ... | @@ -4,10 +4,6 @@ | ... | @@ -4,10 +4,6 @@ |
| 4 | <!-- 头部搜索 --> | 4 | <!-- 头部搜索 --> |
| 5 | <div class="from-clues-header"> | 5 | <div class="from-clues-header"> |
| 6 | <el-form ref="ruleForm" :model="form" label-width="100px"> | 6 | <el-form ref="ruleForm" :model="form" label-width="100px"> |
| 7 | <!-- 判断进入监管还是上报系统 --> | ||
| 8 | <el-form-item v-if="BASE_API.THEME == 'jg'"> | ||
| 9 | <Breadcrumb /> | ||
| 10 | </el-form-item> | ||
| 11 | <el-row class="mb-5"> | 7 | <el-row class="mb-5"> |
| 12 | <el-col :span="6"> | 8 | <el-col :span="6"> |
| 13 | <el-form-item label="行政区" prop="qxdm"> | 9 | <el-form-item label="行政区" prop="qxdm"> | ... | ... |
| 1 | <template> | ||
| 2 | <div> | ||
| 3 | <i class="el-icon-s-management icon" :title="title" @click="openDialog" /> | ||
| 4 | <el-dialog | ||
| 5 | class="configuration" | ||
| 6 | :key="key" | ||
| 7 | :title="title" | ||
| 8 | :inner-dialog="true" | ||
| 9 | :visible.sync="dialogVisible" | ||
| 10 | width="600px" | ||
| 11 | :close-on-click-modal="false" | ||
| 12 | append-to-body | ||
| 13 | @cancel="cancel"> | ||
| 14 | <vue-json-editor | ||
| 15 | id="minejson" | ||
| 16 | v-model="resultInfo" | ||
| 17 | :mode="'code'" | ||
| 18 | lang="zh" | ||
| 19 | @json-change="onJsonChange" | ||
| 20 | @json-save="onJsonSave" | ||
| 21 | @has-error="onError" /> | ||
| 22 | <el-tooltip | ||
| 23 | content="全屏缩放" | ||
| 24 | effect="dark" | ||
| 25 | placement="bottom" | ||
| 26 | fullscreen | ||
| 27 | class="fullScreen"> | ||
| 28 | <i class="el-icon-full-screen" @click="enLarge" /> | ||
| 29 | </el-tooltip> | ||
| 30 | <template slot="footer"> | ||
| 31 | <div class="dialog-footer flex flex-pack-center"> | ||
| 32 | <btn nativeType="cx" @click="onJsonSave">保存</btn> | ||
| 33 | <btn nativeType="cx" @click="cancel">关闭</btn> | ||
| 34 | |||
| 35 | </div> | ||
| 36 | </template> | ||
| 37 | </el-dialog> | ||
| 38 | </div> | ||
| 39 | </template> | ||
| 40 | <script> | ||
| 41 | import vueJsonEditor from 'vue-json-editor' | ||
| 42 | export default { | ||
| 43 | components: { | ||
| 44 | vueJsonEditor | ||
| 45 | }, | ||
| 46 | props: { | ||
| 47 | title: { | ||
| 48 | type: String, | ||
| 49 | default: '配置参数' | ||
| 50 | }, | ||
| 51 | resultInfos: { | ||
| 52 | type: String, | ||
| 53 | default: '' | ||
| 54 | } | ||
| 55 | }, | ||
| 56 | data () { | ||
| 57 | return { | ||
| 58 | activeNames: [], | ||
| 59 | resultInfo: {}, | ||
| 60 | tmpResultInfo: {}, | ||
| 61 | dialogVisible: false, | ||
| 62 | hasJsonFlag: true, | ||
| 63 | key: 0, | ||
| 64 | isEnlarge: false | ||
| 65 | } | ||
| 66 | }, | ||
| 67 | watch: { | ||
| 68 | resultInfos: { | ||
| 69 | handler: function (val) { | ||
| 70 | ++this.key | ||
| 71 | this.resultInfo = | ||
| 72 | this.resultInfos === '' ? {} : JSON.parse(this.resultInfos) | ||
| 73 | this.tmpResultInfo = this.resultInfo | ||
| 74 | }, | ||
| 75 | deep: true, | ||
| 76 | immediate: true | ||
| 77 | } | ||
| 78 | }, | ||
| 79 | |||
| 80 | mounted () { | ||
| 81 | this.resultInfo = | ||
| 82 | this.resultInfos === '' ? {} : JSON.parse(this.resultInfos) | ||
| 83 | }, | ||
| 84 | |||
| 85 | methods: { | ||
| 86 | onJsonChange (value) { | ||
| 87 | // 只有在格式正确的时候进入此事件 | ||
| 88 | this.hasJsonFlag = true | ||
| 89 | }, | ||
| 90 | onJsonSave () { | ||
| 91 | const value = this.resultInfo | ||
| 92 | if (this.hasJsonFlag === false) { | ||
| 93 | this.$message.error({ message: 'json格式验证失败', showClose: true }) | ||
| 94 | // alert("json验证失败") | ||
| 95 | return false | ||
| 96 | } else { | ||
| 97 | this.dialogVisible = false | ||
| 98 | this.$emit('getJsonString', JSON.stringify(value)) | ||
| 99 | return true | ||
| 100 | } | ||
| 101 | }, | ||
| 102 | onError (value) { | ||
| 103 | this.hasJsonFlag = false | ||
| 104 | }, | ||
| 105 | openDialog () { | ||
| 106 | this.dialogVisible = true | ||
| 107 | }, | ||
| 108 | cancel () { | ||
| 109 | this.resultInfo = this.tmpResultInfo | ||
| 110 | this.dialogVisible = false | ||
| 111 | }, | ||
| 112 | // 放大 | ||
| 113 | enLarge () { | ||
| 114 | const fullarea = document.getElementById('minejson') | ||
| 115 | if (fullarea.requestFullscreen) { | ||
| 116 | fullarea.requestFullscreen() | ||
| 117 | } else if (fullarea.webkitRequestFullScreen) { | ||
| 118 | fullarea.webkitRequestFullScreen() // webkit内核(chrome、safari、Opera等) | ||
| 119 | } else if (fullarea.mozRequestFullScreen) { | ||
| 120 | fullarea.mozRequestFullScreen() // moz内核(firefox) | ||
| 121 | } else if (fullarea.msRequestFullscreen) { | ||
| 122 | fullarea.msRequestFullscreen() // IE11、edge | ||
| 123 | } | ||
| 124 | this.isEnlarge = true | ||
| 125 | } | ||
| 126 | } | ||
| 127 | } | ||
| 128 | </script> | ||
| 129 | |||
| 130 | <style scoped lang="scss"> | ||
| 131 | /* jsoneditor右上角默认有一个链接,加css去掉了 */ | ||
| 132 | .icon { | ||
| 133 | color: #349af3; | ||
| 134 | } | ||
| 135 | </style> |
src/views/system/menus/data/index.js
deleted
100644 → 0
| 1 | import filter from '@/utils/filter.js' | ||
| 2 | class data extends filter { | ||
| 3 | constructor() { | ||
| 4 | super() | ||
| 5 | } | ||
| 6 | columns () { | ||
| 7 | return [ | ||
| 8 | { | ||
| 9 | prop: "name", | ||
| 10 | label: "菜单名称", | ||
| 11 | align: 'left', | ||
| 12 | width: 300 | ||
| 13 | }, | ||
| 14 | { | ||
| 15 | prop: "code", | ||
| 16 | label: "菜单代码" | ||
| 17 | }, | ||
| 18 | { | ||
| 19 | prop: "uri", | ||
| 20 | width: 260, | ||
| 21 | label: "链接路径" | ||
| 22 | }, | ||
| 23 | ] | ||
| 24 | } | ||
| 25 | } | ||
| 26 | export default new data() |
| 1 | <template> | ||
| 2 | <!-- 菜单添加编辑弹框 --> | ||
| 3 | <dialogBox class="PersonnelDialog" :isMain="true" width="40%" :title="title" @closeDialog="close" @submitForm="submitForm" | ||
| 4 | v-model="myValue"> | ||
| 5 | <div class="dialogCon"> | ||
| 6 | <el-form ref="form" :model="form" :rules="rules"> | ||
| 7 | <el-row :gutter="24"> | ||
| 8 | <el-col :span="12"> | ||
| 9 | <el-form-item label="菜单名称:" prop="name" label-width="124px"> | ||
| 10 | <el-input v-model="form.name" placeholder="请输入菜单名称" /> | ||
| 11 | </el-form-item> | ||
| 12 | </el-col> | ||
| 13 | <el-col :span="12"> | ||
| 14 | <el-form-item label="图标:" label-width="54px"> | ||
| 15 | <el-input v-model="form.icon" placeholder="请选择图标" :prefix-icon="form.icon" clearable /> | ||
| 16 | </el-form-item> | ||
| 17 | </el-col> | ||
| 18 | </el-row> | ||
| 19 | <el-row :gutter="24"> | ||
| 20 | <el-col :span="12"> | ||
| 21 | <el-form-item label="上级菜单:" label-width="124px"> | ||
| 22 | <el-cascader :key="menuKey" v-model="form.parentId" :options="parentMenuList" :props="setProps" | ||
| 23 | placeholder="请选择上级菜单" clearable @change="handleChange" /> | ||
| 24 | </el-form-item> | ||
| 25 | </el-col> | ||
| 26 | |||
| 27 | </el-row> | ||
| 28 | <el-row :gutter="23"> | ||
| 29 | <el-col :span="23"> | ||
| 30 | <el-form-item label="代码:" prop="code" label-width="124px"> | ||
| 31 | <el-input v-model="codeComputed" placeholder="请输入菜单代码" :disabled="type === 1" /> | ||
| 32 | </el-form-item> | ||
| 33 | </el-col> | ||
| 34 | </el-row> | ||
| 35 | <el-row :gutter="23"> | ||
| 36 | <el-col :span="23"> | ||
| 37 | <el-form-item label="链接路径:" label-width="124px"> | ||
| 38 | <el-input v-model="form.uri" placeholder="请输入链接路径" /> | ||
| 39 | </el-form-item> | ||
| 40 | </el-col> | ||
| 41 | </el-row> | ||
| 42 | <el-row :gutter="24"> | ||
| 43 | <el-col :span="24"> | ||
| 44 | <el-form-item label="浏览器跳转模式:" label-width="124px"> | ||
| 45 | <el-select v-model="form.jumpMode" placeholder="请选择浏览器跳转模式"> | ||
| 46 | <el-option v-for="item in jumpModeList" :key="item.value" :label="item.name" :value="item.value" /> | ||
| 47 | </el-select> | ||
| 48 | </el-form-item> | ||
| 49 | </el-col> | ||
| 50 | </el-row> | ||
| 51 | <el-row :gutter="24"> | ||
| 52 | <el-col :span="24"> | ||
| 53 | <el-form-item label="配置参数:" label-width="124px" class="form-item-mb0"> | ||
| 54 | <!-- 配置参数 --> | ||
| 55 | <JsonEditor class="JsonEditors" :result-infos="form.metadata" @getJsonString="getJsonString" /> | ||
| 56 | </el-form-item> | ||
| 57 | </el-col> | ||
| 58 | </el-row> | ||
| 59 | </el-form> | ||
| 60 | <!-- 图标列表 --> | ||
| 61 | <!-- <IconList ref="iconList" @iconName="getIconName" /> --> | ||
| 62 | </div> | ||
| 63 | </dialogBox> | ||
| 64 | </template> | ||
| 65 | |||
| 66 | <script> | ||
| 67 | import { getParentMenuListAction } from '@/api/authorityManage' | ||
| 68 | import JsonEditor from './JsonEditors/index.vue' | ||
| 69 | import { validateCode } from '@/utils/validate'; | ||
| 70 | import { api, httpAction } from '@/api/manageApi' | ||
| 71 | export default { | ||
| 72 | name: 'MenuModal', | ||
| 73 | components: { | ||
| 74 | JsonEditor, | ||
| 75 | }, | ||
| 76 | props: { | ||
| 77 | value: { type: Boolean, default: false }, | ||
| 78 | productId: { | ||
| 79 | type: String, | ||
| 80 | default: '' | ||
| 81 | } | ||
| 82 | }, | ||
| 83 | data () { | ||
| 84 | return { | ||
| 85 | myValue: this.value, | ||
| 86 | form: { | ||
| 87 | icon: '', | ||
| 88 | code: '' | ||
| 89 | }, | ||
| 90 | rules: { | ||
| 91 | name: [{ required: true, message: '请输入菜单名称', trigger: 'blur' }], | ||
| 92 | code: [ | ||
| 93 | { required: true, message: '必填', trigger: 'blur' }, | ||
| 94 | { validator: validateCode, trigger: 'blur' } | ||
| 95 | ] | ||
| 96 | }, | ||
| 97 | title: '', | ||
| 98 | type: '', | ||
| 99 | visible: false, | ||
| 100 | parentMenuList: [], | ||
| 101 | menuKey: 0, | ||
| 102 | jumpModeList: [ | ||
| 103 | { name: '在当前页面显示', value: 1 }, | ||
| 104 | { name: '跳转到新页面', value: 2 } | ||
| 105 | ], | ||
| 106 | setProps: { | ||
| 107 | value: 'id', | ||
| 108 | label: 'name', | ||
| 109 | children: 'children', | ||
| 110 | expandTrigger: 'hover', | ||
| 111 | checkStrictly: true, // 可取消关联,选择任意一级选项 | ||
| 112 | emitPath: false | ||
| 113 | }, | ||
| 114 | dataUrl: api.menus | ||
| 115 | } | ||
| 116 | }, | ||
| 117 | computed: { | ||
| 118 | codeComputed: { | ||
| 119 | get: function () { | ||
| 120 | return this.form.code | ||
| 121 | }, | ||
| 122 | set: function (val) { | ||
| 123 | this.form.code = val.toUpperCase() | ||
| 124 | } | ||
| 125 | } | ||
| 126 | }, | ||
| 127 | watch: { | ||
| 128 | value (val) { | ||
| 129 | this.myValue = val | ||
| 130 | } | ||
| 131 | }, | ||
| 132 | methods: { | ||
| 133 | // 获取父级菜单 | ||
| 134 | getParentMenuList (id) { | ||
| 135 | |||
| 136 | getParentMenuListAction(id).then((res) => { | ||
| 137 | if (res.status === 1) { | ||
| 138 | const list = this.$dealArrChildren(res.content) | ||
| 139 | if (id) { | ||
| 140 | this.parentMenuList = this.$dealArrDisabled( | ||
| 141 | this.$deepCopy(list), | ||
| 142 | id | ||
| 143 | ) | ||
| 144 | this.menuKey++ | ||
| 145 | } else { | ||
| 146 | this.parentMenuList = list | ||
| 147 | } | ||
| 148 | } else { | ||
| 149 | this.$message.error({ message: res.message, showClose: true }) | ||
| 150 | } | ||
| 151 | }) | ||
| 152 | }, | ||
| 153 | // 配置参数 | ||
| 154 | getJsonString (data) { | ||
| 155 | this.form.metadata = data | ||
| 156 | }, | ||
| 157 | // 新增菜单 | ||
| 158 | add () { | ||
| 159 | this.getParentMenuList(this.productId) | ||
| 160 | this.type = 0 | ||
| 161 | this.form.jumpMode = 1 | ||
| 162 | }, | ||
| 163 | // 编辑菜单 | ||
| 164 | edit (record) { | ||
| 165 | this.type = 1 | ||
| 166 | // 若有id为编辑 | ||
| 167 | if (record.id) { | ||
| 168 | this.$nextTick(() => { | ||
| 169 | this.form = Object.assign({}, record) | ||
| 170 | this.getParentMenuList(this.productId) | ||
| 171 | }) | ||
| 172 | } | ||
| 173 | }, | ||
| 174 | // 选择上级菜单 | ||
| 175 | handleChange (value) { | ||
| 176 | this.form.parentId = value | ||
| 177 | }, | ||
| 178 | // 保存 | ||
| 179 | submitForm (submitType) { | ||
| 180 | this.$refs.form.validate((valid) => { | ||
| 181 | if (valid) { | ||
| 182 | let method = '' | ||
| 183 | let url = '' | ||
| 184 | const formData = this.form | ||
| 185 | formData.productId = this.productId | ||
| 186 | if (!formData.id) { | ||
| 187 | method = 'post' | ||
| 188 | url = this.dataUrl | ||
| 189 | } else { | ||
| 190 | method = 'put' | ||
| 191 | url = `${this.dataUrl}/${formData.id}` | ||
| 192 | } | ||
| 193 | httpAction(url, formData, method) | ||
| 194 | .then((res) => { | ||
| 195 | if (res.status === 1) { | ||
| 196 | this.$message.success({ | ||
| 197 | message: res.message, | ||
| 198 | showClose: true | ||
| 199 | }) | ||
| 200 | this.close() | ||
| 201 | this.$emit('ok') | ||
| 202 | |||
| 203 | } else { | ||
| 204 | this.$message.error({ message: res.message, showClose: true }) | ||
| 205 | } | ||
| 206 | }) | ||
| 207 | .catch((err) => { | ||
| 208 | console.log(err) | ||
| 209 | }) | ||
| 210 | } | ||
| 211 | }) | ||
| 212 | }, | ||
| 213 | // 重置 | ||
| 214 | resetForm () { | ||
| 215 | this.$refs.form.resetFields() | ||
| 216 | this.form = { | ||
| 217 | icon: '', | ||
| 218 | code: '' | ||
| 219 | } | ||
| 220 | }, | ||
| 221 | // 关闭 | ||
| 222 | close () { | ||
| 223 | this.resetForm() | ||
| 224 | this.$emit('input', false) | ||
| 225 | } | ||
| 226 | } | ||
| 227 | } | ||
| 228 | </script> | ||
| 229 | <style scoped lang="scss"> | ||
| 230 | </style> |
src/views/system/menus/index.vue
deleted
100644 → 0
| 1 | <template> | ||
| 2 | <!-- 菜单管理 --> | ||
| 3 | <div class="from-clues"> | ||
| 4 | <div class="from-clues-header"> | ||
| 5 | <el-form ref="ruleForm" :model="form" label-width="100px"> | ||
| 6 | <el-form-item v-if="BASE_API.THEME=='jg'"> | ||
| 7 | <Breadcrumb /> | ||
| 8 | </el-form-item> | ||
| 9 | <el-row class="mb-5"> | ||
| 10 | <el-col :span="4"> | ||
| 11 | <el-form-item label="菜单名称" prop="menuName"> | ||
| 12 | <el-input v-model.trim="form.menuName" class="width100" clearable placeholder="菜单名称"></el-input> | ||
| 13 | </el-form-item> | ||
| 14 | </el-col> | ||
| 15 | <el-col :span="20" class="btnColRight"> | ||
| 16 | <btn nativeType="cx" @click="searchQuery">查询</btn> | ||
| 17 | <btn nativeType="cx" @click="handleAdd()">新增菜单</btn> | ||
| 18 | </el-col> | ||
| 19 | </el-row> | ||
| 20 | </el-form> | ||
| 21 | </div> | ||
| 22 | <div class="from-clues-content"> | ||
| 23 | <lb-table :pagination="false" :column="tableData.columns" :calcHeight="BASE_API.calcHeight" :data="tablelistData" row-key="id" | ||
| 24 | default-expand-all :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"> | ||
| 25 | |||
| 26 | </lb-table> | ||
| 27 | </div> | ||
| 28 | <edit-dialog ref="dialogForm" v-model="isDialog" :product-id="productId" :resource-category-id="resourceCategoryId" | ||
| 29 | @ok="reloadTableData" /> | ||
| 30 | </div> | ||
| 31 | </template> | ||
| 32 | <script> | ||
| 33 | import data from "./data"; | ||
| 34 | import { deleteAction, getAction, api, httpAction } from "@/api/manageApi"; | ||
| 35 | import EditDialog from "./edit-dialog.vue"; | ||
| 36 | import { mapGetters } from "vuex"; | ||
| 37 | import { getMenuInfo } from "@/api/user"; | ||
| 38 | import { updateOrder } from "@/api/orders" | ||
| 39 | import { judgeSort } from "@/utils/operation"; | ||
| 40 | export default { | ||
| 41 | name: "menus", | ||
| 42 | components: { | ||
| 43 | EditDialog, | ||
| 44 | }, | ||
| 45 | data () { | ||
| 46 | return { | ||
| 47 | isDialog: false, | ||
| 48 | tablelistData: [],//菜单数据 | ||
| 49 | listData: [], | ||
| 50 | resourceCategoryId: "", | ||
| 51 | form: { | ||
| 52 | menuName: "", | ||
| 53 | }, | ||
| 54 | title: "",//标题 | ||
| 55 | // 表格数据 | ||
| 56 | tableData: { | ||
| 57 | columns: [] | ||
| 58 | .concat(data.columns()) | ||
| 59 | .concat([ | ||
| 60 | { | ||
| 61 | label: "排序", | ||
| 62 | width: 300, | ||
| 63 | render: (h, scope) => { | ||
| 64 | return ( | ||
| 65 | <div> | ||
| 66 | <el-button | ||
| 67 | type="text" | ||
| 68 | class='movebtnColor' | ||
| 69 | disabled={scope.row.isTop} | ||
| 70 | onClick={() => { | ||
| 71 | this.moveUp(scope.row, 'TOP') | ||
| 72 | }} | ||
| 73 | > | ||
| 74 | 置顶 | ||
| 75 | </el-button> | ||
| 76 | <el-button | ||
| 77 | type="text" | ||
| 78 | class='movebtnColor' | ||
| 79 | disabled={scope.row.isTop} | ||
| 80 | onClick={() => { | ||
| 81 | this.moveUp(scope.row, 'UP'); | ||
| 82 | }} | ||
| 83 | > | ||
| 84 | 上移 | ||
| 85 | </el-button> | ||
| 86 | <el-button | ||
| 87 | type="text" | ||
| 88 | class='movebtnColor' | ||
| 89 | disabled={scope.row.isBottom} | ||
| 90 | onClick={() => { | ||
| 91 | this.moveDown(scope.row, 'DOWN'); | ||
| 92 | }} | ||
| 93 | > | ||
| 94 | 下移 | ||
| 95 | </el-button> | ||
| 96 | <el-button | ||
| 97 | type="text" | ||
| 98 | class='movebtnColor' | ||
| 99 | disabled={scope.row.isBottom} | ||
| 100 | onClick={() => { | ||
| 101 | this.moveDown(scope.row, 'BOTTOM'); | ||
| 102 | }} | ||
| 103 | > | ||
| 104 | 置底 | ||
| 105 | </el-button> | ||
| 106 | </div> | ||
| 107 | ); | ||
| 108 | }, | ||
| 109 | }, | ||
| 110 | ]).concat([ | ||
| 111 | { | ||
| 112 | label: "操作", | ||
| 113 | width: 380, | ||
| 114 | render: (h, scope) => { | ||
| 115 | return ( | ||
| 116 | <div> | ||
| 117 | <el-button | ||
| 118 | type="text" | ||
| 119 | class='successColor' | ||
| 120 | onClick={() => { | ||
| 121 | this.handleEdit(scope.row); | ||
| 122 | }} | ||
| 123 | > | ||
| 124 | 修改 | ||
| 125 | </el-button> | ||
| 126 | |||
| 127 | <el-button | ||
| 128 | type="text" | ||
| 129 | class='delColor' | ||
| 130 | onClick={() => { | ||
| 131 | this.handleDelete(scope.row.id, scope.row.name); | ||
| 132 | }} | ||
| 133 | > | ||
| 134 | 删除 | ||
| 135 | </el-button> | ||
| 136 | </div> | ||
| 137 | ); | ||
| 138 | }, | ||
| 139 | }, | ||
| 140 | ]), | ||
| 141 | data: [], | ||
| 142 | }, | ||
| 143 | tableUrl: api.menus, // 菜单接口地址 | ||
| 144 | meumurlid: api.subsystem,// 项目id接口地址 | ||
| 145 | productId: "",//项目id | ||
| 146 | }; | ||
| 147 | }, | ||
| 148 | created () { | ||
| 149 | this.getTableList(); | ||
| 150 | }, | ||
| 151 | computed: { | ||
| 152 | ...mapGetters(["products"]) | ||
| 153 | }, | ||
| 154 | methods: { | ||
| 155 | //查询 | ||
| 156 | searchQuery () { | ||
| 157 | if (this.form.menuName) { | ||
| 158 | this.tablelistData = this.childrenFn(this.listData, this.form.menuName); | ||
| 159 | } else { | ||
| 160 | this.getTableList() | ||
| 161 | } | ||
| 162 | }, | ||
| 163 | // 数据处理方法 | ||
| 164 | childrenFn (arr, key) { | ||
| 165 | const that = this; | ||
| 166 | let searchTree = []; | ||
| 167 | arr.forEach((item, index) => { | ||
| 168 | if (item.children != undefined && item.children.length != 0) { | ||
| 169 | let leaf = that.childrenFn(item.children, key); | ||
| 170 | if (leaf != undefined) { | ||
| 171 | let { name, code, resourceCategoryId, id, iproductId, operations, metadata } = item; | ||
| 172 | let parentObj = { | ||
| 173 | code, name, resourceCategoryId, id, iproductId, operations, metadata, children: leaf | ||
| 174 | }; | ||
| 175 | searchTree.push(parentObj); | ||
| 176 | } else { | ||
| 177 | if (item.name.indexOf(key) != -1) { | ||
| 178 | searchTree.push(item); | ||
| 179 | } | ||
| 180 | } | ||
| 181 | } else { | ||
| 182 | if (item.name.indexOf(key) != -1) { | ||
| 183 | |||
| 184 | searchTree.push(item); | ||
| 185 | } | ||
| 186 | } | ||
| 187 | }); | ||
| 188 | if (searchTree != undefined && searchTree.length != 0) { | ||
| 189 | return searchTree; | ||
| 190 | } | ||
| 191 | }, | ||
| 192 | // 加载表格数据 | ||
| 193 | getTableList () { | ||
| 194 | getMenuInfo(this.BASE_API.CODE).then((res) => { | ||
| 195 | if (res.code === 200) { | ||
| 196 | this.tablelistData = judgeSort(res.result) | ||
| 197 | this.listData = this.tablelistData | ||
| 198 | } else { | ||
| 199 | this.$message.error({ message: res.message, showClose: true }) | ||
| 200 | } | ||
| 201 | }) | ||
| 202 | const queryOptionsid = { | ||
| 203 | conditionGroup: { | ||
| 204 | queryRelation: "AND", | ||
| 205 | conditions: [ | ||
| 206 | { | ||
| 207 | property: "code", | ||
| 208 | value: this.BASE_API.CODE, | ||
| 209 | operator: "EQ", | ||
| 210 | }, | ||
| 211 | ], | ||
| 212 | }, | ||
| 213 | }; | ||
| 214 | const params = { | ||
| 215 | queryOptions: queryOptionsid, | ||
| 216 | }; | ||
| 217 | // 获取系统id | ||
| 218 | getAction(this.meumurlid, params) | ||
| 219 | .then((res) => { | ||
| 220 | this.productId = res.content[0].id; | ||
| 221 | // this.selectedSubsystemCode = res.content[0].code | ||
| 222 | |||
| 223 | }) | ||
| 224 | .catch((error) => { | ||
| 225 | console.log("er", error); | ||
| 226 | }) | ||
| 227 | }, | ||
| 228 | // 新增菜单 | ||
| 229 | handleAdd () { | ||
| 230 | this.isDialog = true | ||
| 231 | this.$refs.dialogForm.add(); | ||
| 232 | this.$refs.dialogForm.title = "新增"; | ||
| 233 | }, | ||
| 234 | |||
| 235 | // 修改 | ||
| 236 | handleEdit (record) { | ||
| 237 | this.isDialog = true | ||
| 238 | this.$refs.dialogForm.edit(record); | ||
| 239 | this.$refs.dialogForm.title = "修改"; | ||
| 240 | }, | ||
| 241 | // 删除 | ||
| 242 | handleDelete (id, content) { | ||
| 243 | this.$confirm( | ||
| 244 | `<div class="customer-message-wrapper"> | ||
| 245 | <h5 class="title">您确认要执行该操作用于以下信息:</h5> | ||
| 246 | <p class="content" aria-controls="${content}">${content} | ||
| 247 | </p> | ||
| 248 | <p class="result">执行后,数据将 | ||
| 249 | <span >无法恢复</span> | ||
| 250 | </p> | ||
| 251 | </div>`, | ||
| 252 | '执行确认', | ||
| 253 | { | ||
| 254 | dangerouslyUseHTMLString: true, | ||
| 255 | customClass: 'customer-delete', | ||
| 256 | confirmButtonText: '确定', | ||
| 257 | cancelButtonText: '取消', | ||
| 258 | type: 'warning' | ||
| 259 | } | ||
| 260 | ) | ||
| 261 | .then(() => { | ||
| 262 | if (!this.tableUrl) { | ||
| 263 | this.$message.error({ | ||
| 264 | message: '请设置tableUrl属性为接口地址!', | ||
| 265 | showClose: true | ||
| 266 | }) | ||
| 267 | return | ||
| 268 | } | ||
| 269 | const url = this.tableUrl + '/' + id | ||
| 270 | deleteAction(url).then(res => { | ||
| 271 | if (res.status === 1) { | ||
| 272 | this.$message.success({ message: res.message, showClose: true }) | ||
| 273 | this.reloadTableData() | ||
| 274 | } else { | ||
| 275 | this.$message.error({ message: res.message, showClose: true }) | ||
| 276 | } | ||
| 277 | }) | ||
| 278 | }) | ||
| 279 | .catch(() => { }) | ||
| 280 | }, | ||
| 281 | // 新增、编辑回显 | ||
| 282 | reloadTableData () { | ||
| 283 | this.getTableList() | ||
| 284 | }, | ||
| 285 | |||
| 286 | // 排序 | ||
| 287 | moveUp (row, operate) { | ||
| 288 | if (row.isTop) { | ||
| 289 | return; | ||
| 290 | } else { | ||
| 291 | this.realMove(row, operate); | ||
| 292 | } | ||
| 293 | }, | ||
| 294 | moveDown (row, operate) { | ||
| 295 | if (row.isBottom) { | ||
| 296 | return; | ||
| 297 | } else { | ||
| 298 | this.realMove(row, operate); | ||
| 299 | } | ||
| 300 | }, | ||
| 301 | |||
| 302 | //树形表格移动 | ||
| 303 | realMove (row, operate) { | ||
| 304 | function tarverse (nodes, id) { | ||
| 305 | let result; | ||
| 306 | for (let i = 0; i < nodes.length; i++) { | ||
| 307 | if (nodes[i].children && nodes[i].children.length > 0) { | ||
| 308 | result = tarverse(nodes[i].children, id); | ||
| 309 | } | ||
| 310 | if (nodes[i].id == id) { | ||
| 311 | if (operate === 'UP') { | ||
| 312 | result = nodes[i - 1].id; | ||
| 313 | } else if (operate === 'DOWN') { | ||
| 314 | result = nodes[i + 1].id; | ||
| 315 | } | ||
| 316 | return result; | ||
| 317 | } | ||
| 318 | |||
| 319 | if (result) return result; | ||
| 320 | } | ||
| 321 | return result | ||
| 322 | } | ||
| 323 | |||
| 324 | this.$nextTick(() => { | ||
| 325 | updateOrder('/rest/menus', row, operate, tarverse(this.tablelistData, row.id)).then(res => { | ||
| 326 | if (res.status === 1) { | ||
| 327 | this.getTableList() | ||
| 328 | this.$message.success({ message: res.message, showClose: true }) | ||
| 329 | } else { | ||
| 330 | this.$message.error({ message: res.message, showClose: true }) | ||
| 331 | } | ||
| 332 | }) | ||
| 333 | this.tablelistData = judgeSort(this.tablelistData || []); | ||
| 334 | }) | ||
| 335 | // this.tablelistData = changeSort(this.tablelistData, row.id); | ||
| 336 | // function changeSort (arr, id) { | ||
| 337 | // if (arr.length) { | ||
| 338 | // let flag = false; | ||
| 339 | // for (let i in arr) { | ||
| 340 | // if (arr[i].id == id) { | ||
| 341 | // if (operate === "UP") { | ||
| 342 | // arr[i] = arr.splice(i - 1, 1, arr[i])[0]; | ||
| 343 | // } else if (operate === "DOWN") { | ||
| 344 | // let temp = arr.splice(i - 0 + 1, 1, arr[i]) | ||
| 345 | // arr[i] = temp[0]; | ||
| 346 | // } else if (operate === "TOP") { | ||
| 347 | // arr.unshift(arr.splice(i, 1)[0]); | ||
| 348 | // } else if (operate === "BOTTOM") { | ||
| 349 | // arr.push(arr.splice(i, 1)[0]); | ||
| 350 | // } | ||
| 351 | // flag = true; | ||
| 352 | // break; | ||
| 353 | // } | ||
| 354 | // if (!flag && arr[i].children && arr[i].children.length) { | ||
| 355 | // arr[i].children = changeSort(arr[i].children, id); | ||
| 356 | // } | ||
| 357 | // } | ||
| 358 | // } | ||
| 359 | // return arr; | ||
| 360 | // } | ||
| 361 | } | ||
| 362 | }, | ||
| 363 | }; | ||
| 364 | </script> | ||
| 365 | <style scoped lang="scss"> | ||
| 366 | @import "~@/styles/mixin.scss"; | ||
| 367 | |||
| 368 | // @import "~@/styles/public.scss"; | ||
| 369 | </style> |
src/views/system/roles/data/index.js
deleted
100644 → 0
| 1 | <!-- 新增 & 修改角色 --> | ||
| 2 | <template> | ||
| 3 | <dialogBox | ||
| 4 | class="PersonnelDialog" | ||
| 5 | :title="title" | ||
| 6 | :width="'567px'" | ||
| 7 | :isMain="true" | ||
| 8 | @closeDialog="close" | ||
| 9 | @submitForm="submitForm" | ||
| 10 | v-model="myValue"> | ||
| 11 | <div class="dialogCon"> | ||
| 12 | <el-form ref="form" :model="dialogForm" :rules="rules" label-width="82px"> | ||
| 13 | <el-row :gutter="24"> | ||
| 14 | <el-col :span="23"> | ||
| 15 | <el-form-item label="角色名称:" prop="roleName"> | ||
| 16 | <el-input | ||
| 17 | v-model="dialogForm.roleName" | ||
| 18 | clearable | ||
| 19 | placeholder="角色名称" /> | ||
| 20 | </el-form-item> | ||
| 21 | </el-col> | ||
| 22 | </el-row> | ||
| 23 | <el-row> | ||
| 24 | <el-col :span="23"> | ||
| 25 | <el-form-item label="备注:" class="form-item-mb0"> | ||
| 26 | <el-input | ||
| 27 | v-model="dialogForm.roleTextArea" | ||
| 28 | clearable | ||
| 29 | :rows="10" | ||
| 30 | type="textarea" | ||
| 31 | maxlength="30" | ||
| 32 | placeholder="备注" /> | ||
| 33 | </el-form-item> | ||
| 34 | </el-col> | ||
| 35 | </el-row> | ||
| 36 | </el-form> | ||
| 37 | </div> | ||
| 38 | <!-- <template slot="footer"> | ||
| 39 | <el-button | ||
| 40 | class="cancel-button" | ||
| 41 | @click="handleCloseDialog">取消</el-button> | ||
| 42 | |||
| 43 | <el-button | ||
| 44 | type="primary" | ||
| 45 | @click="handleSaveRole()">保存</el-button> | ||
| 46 | </template> --> | ||
| 47 | </dialogBox> | ||
| 48 | </template> | ||
| 49 | |||
| 50 | <script> | ||
| 51 | import Dialog from "@/components/Dialog/"; | ||
| 52 | import { api, httpAction } from '@/api/manageApi' | ||
| 53 | export default { | ||
| 54 | components: { | ||
| 55 | Dialog | ||
| 56 | }, | ||
| 57 | props: { | ||
| 58 | value: { type: Boolean, default: false }, | ||
| 59 | }, | ||
| 60 | data () { | ||
| 61 | return { | ||
| 62 | myValue: this.value, | ||
| 63 | title: '', | ||
| 64 | menuType: '', | ||
| 65 | roleId: '', | ||
| 66 | sort: 0, | ||
| 67 | dialogForm: { | ||
| 68 | roleName: '', | ||
| 69 | roleType: '', | ||
| 70 | roleTextArea: '' | ||
| 71 | }, | ||
| 72 | rules: { | ||
| 73 | roleName: [ | ||
| 74 | { required: true, message: '请输入角色名称', trigger: 'blur' } | ||
| 75 | ], | ||
| 76 | }, | ||
| 77 | roleTypeOptions: [ | ||
| 78 | { name: '定制', value: '定制' }, | ||
| 79 | { name: '其他', value: '其他' } | ||
| 80 | ] | ||
| 81 | } | ||
| 82 | }, | ||
| 83 | watch: { | ||
| 84 | value (val) { | ||
| 85 | this.myValue = val | ||
| 86 | } | ||
| 87 | }, | ||
| 88 | methods: { | ||
| 89 | // 保存新增或关闭事件 | ||
| 90 | submitForm () { | ||
| 91 | this.$refs.form.validate((valid) => { | ||
| 92 | if (valid) { | ||
| 93 | try { | ||
| 94 | const params = { | ||
| 95 | category: 2, | ||
| 96 | description: this.dialogForm.roleTextArea, | ||
| 97 | name: this.dialogForm.roleName, | ||
| 98 | sort: this.sort, | ||
| 99 | type: this.dialogForm.roleType | ||
| 100 | } | ||
| 101 | if (this.roleId) { | ||
| 102 | params.id = this.roleId | ||
| 103 | httpAction(`${api.roles}/${params.id}`, params, 'post').then( | ||
| 104 | (res) => { | ||
| 105 | if (res.status === 1) { | ||
| 106 | this.$message.success({ | ||
| 107 | message: '修改成功', | ||
| 108 | showClose: true | ||
| 109 | }) | ||
| 110 | this.dialogForm = { | ||
| 111 | roleName: '', | ||
| 112 | } | ||
| 113 | |||
| 114 | this.$emit('ok') | ||
| 115 | } else { | ||
| 116 | this.$message.error({ | ||
| 117 | message: res.message, | ||
| 118 | showClose: true | ||
| 119 | }) | ||
| 120 | } | ||
| 121 | } | ||
| 122 | ) | ||
| 123 | } else { | ||
| 124 | httpAction(api.roles, params, 'post').then((res) => { | ||
| 125 | if (res.status === 1) { | ||
| 126 | this.$message.success({ | ||
| 127 | message: '新增成功', | ||
| 128 | showClose: true | ||
| 129 | }) | ||
| 130 | this.close() | ||
| 131 | |||
| 132 | this.$emit('ok') | ||
| 133 | this.$emit('ok', this.menuType) | ||
| 134 | } else { | ||
| 135 | this.$message.error({ | ||
| 136 | message: res.message, | ||
| 137 | showClose: true | ||
| 138 | }) | ||
| 139 | } | ||
| 140 | }) | ||
| 141 | } | ||
| 142 | } catch (e) { | ||
| 143 | console.error(e) | ||
| 144 | } | ||
| 145 | } | ||
| 146 | }) | ||
| 147 | }, | ||
| 148 | // 重置 | ||
| 149 | resetForm () { | ||
| 150 | this.dialogForm = { | ||
| 151 | roleName: '', | ||
| 152 | } | ||
| 153 | this.$refs.form.resetFields() | ||
| 154 | }, | ||
| 155 | // 关闭 | ||
| 156 | close () { | ||
| 157 | this.resetForm() | ||
| 158 | this.$emit('input', false) | ||
| 159 | } | ||
| 160 | } | ||
| 161 | } | ||
| 162 | </script> | ||
| 163 | <style scoped lang="scss"> | ||
| 164 | </style> |
src/views/system/roles/index.vue
deleted
100644 → 0
| 1 | <template> | ||
| 2 | <div class="from-clues"> | ||
| 3 | <div class="from-clues-header"> | ||
| 4 | <el-form ref="ruleForm" :model="form" label-width="100px"> | ||
| 5 | <el-form-item v-if="BASE_API.THEME == 'jg'"> | ||
| 6 | <Breadcrumb /> | ||
| 7 | </el-form-item> | ||
| 8 | <el-row class="mb-5"> | ||
| 9 | <el-col :span="4"> | ||
| 10 | <el-form-item label="角色名称" prop="rolesName"> | ||
| 11 | <el-input v-model.trim="form.rolesName" class="width100" clearable placeholder="角色名称"></el-input> | ||
| 12 | </el-form-item> | ||
| 13 | </el-col> | ||
| 14 | <el-col :span="20" class="btnColRight"> | ||
| 15 | <btn nativeType="cx" @click="searchQuery">查询</btn> | ||
| 16 | <btn nativeType="cx" @click="handleAddEdit">增加角色</btn> | ||
| 17 | </el-col> | ||
| 18 | </el-row> | ||
| 19 | </el-form> | ||
| 20 | </div> | ||
| 21 | <div class="from-clues-content"> | ||
| 22 | <lb-table :pagination="false" @size-change="handleSizeChange" :calcHeight="BASE_API.calcHeight" | ||
| 23 | @p-current-change="handleCurrentChange" :column="tableData.columns" :data="listdata" :expand-row-keys="keyList" | ||
| 24 | row-key="dictid"> | ||
| 25 | </lb-table> | ||
| 26 | </div> | ||
| 27 | <EditDialog ref="addEditDialog" v-model="isDialog" @ok="reloadTableData" /> | ||
| 28 | <Roleslistdiglog ref="rolesForm" /> | ||
| 29 | </div> | ||
| 30 | </template> | ||
| 31 | <script> | ||
| 32 | import { | ||
| 33 | getUuid, | ||
| 34 | judgeSort, | ||
| 35 | realMove, | ||
| 36 | findParents, | ||
| 37 | removeTreeListItem, | ||
| 38 | } from "@/utils/operation"; | ||
| 39 | import { getRolesById, getAuthorityListAction } from "@/api/authorityManage"; | ||
| 40 | import { getUserRoles } from "@/api/personnelManage"; | ||
| 41 | import data from "./data"; | ||
| 42 | import { getMenuInfo } from "@/api/user"; | ||
| 43 | import { api, getAction, deleteAction } from "@/api/manageApi"; | ||
| 44 | import tableMixin from "@/mixins/tableMixin.js"; | ||
| 45 | import EditDialog from "./edit-dialog.vue"; | ||
| 46 | import Roleslistdiglog from "./roleslistdiglog.vue"; | ||
| 47 | import { mapGetters } from "vuex"; | ||
| 48 | import { updateOrder } from "@/api/orders" | ||
| 49 | export default { | ||
| 50 | name: "menus", | ||
| 51 | mixins: [tableMixin], | ||
| 52 | components: { | ||
| 53 | EditDialog, | ||
| 54 | Roleslistdiglog, | ||
| 55 | }, | ||
| 56 | data () { | ||
| 57 | return { | ||
| 58 | isDialog: false, | ||
| 59 | personlist: null, | ||
| 60 | waitMemberList: [], | ||
| 61 | keyList: [], | ||
| 62 | listdata: [], | ||
| 63 | setlistdata: [], | ||
| 64 | tableUrlroles: api.roles, | ||
| 65 | form: { | ||
| 66 | rolesName: "", | ||
| 67 | }, | ||
| 68 | // 当前所选角色id | ||
| 69 | roleId: "", | ||
| 70 | title: "", | ||
| 71 | queryParam: {}, | ||
| 72 | multipleSelection: [], | ||
| 73 | // 菜单列表 | ||
| 74 | menutablelistData: [], | ||
| 75 | tableUrl: api.menus, // 菜单接口地址 | ||
| 76 | meumurlid: api.subsystem, // 项目id接口地址 | ||
| 77 | selectType: "0", | ||
| 78 | queryName: "", | ||
| 79 | organizationId: "", // 组织机构ID | ||
| 80 | departmentId: "", // 部门ID | ||
| 81 | departmentList: [], // 部门列表 | ||
| 82 | levelList: [], // 职务级别 | ||
| 83 | sexList: [], | ||
| 84 | operationCodes: null, // 操作符对象 | ||
| 85 | operationList: [], // 获取授权列表需要提交的操作符数组 | ||
| 86 | typeOptions: [ | ||
| 87 | { | ||
| 88 | value: "0", | ||
| 89 | label: "姓名", | ||
| 90 | }, | ||
| 91 | { | ||
| 92 | value: "1", | ||
| 93 | label: "工号", | ||
| 94 | }, | ||
| 95 | { | ||
| 96 | value: "2", | ||
| 97 | label: "部门", | ||
| 98 | }, | ||
| 99 | { | ||
| 100 | value: "3", | ||
| 101 | label: "机构", | ||
| 102 | }, | ||
| 103 | ], | ||
| 104 | |||
| 105 | selectionList: [], | ||
| 106 | // 表格数据 | ||
| 107 | tableData: { | ||
| 108 | columns: [ | ||
| 109 | { | ||
| 110 | label: "序号", | ||
| 111 | type: "index", | ||
| 112 | width: "50", | ||
| 113 | index: this.indexMethod, | ||
| 114 | }, | ||
| 115 | ] | ||
| 116 | .concat(data.columns()) | ||
| 117 | .concat([ | ||
| 118 | { | ||
| 119 | label: "排序", | ||
| 120 | width: 300, | ||
| 121 | render: (h, scope) => { | ||
| 122 | return ( | ||
| 123 | <div> | ||
| 124 | <el-button | ||
| 125 | type="text" | ||
| 126 | class='movebtnColor' | ||
| 127 | disabled={scope.row.isTop} | ||
| 128 | onClick={() => { | ||
| 129 | this.updateOrder(scope.row, 'TOP'); | ||
| 130 | }} | ||
| 131 | > | ||
| 132 | 置顶 | ||
| 133 | </el-button> | ||
| 134 | <el-button | ||
| 135 | type="text" | ||
| 136 | class='movebtnColor' | ||
| 137 | disabled={scope.row.isTop} | ||
| 138 | onClick={() => { | ||
| 139 | this.updateOrder(scope.row, 'UP'); | ||
| 140 | }} | ||
| 141 | > | ||
| 142 | 上移 | ||
| 143 | </el-button> | ||
| 144 | <el-button | ||
| 145 | type="text" | ||
| 146 | class='movebtnColor' | ||
| 147 | disabled={scope.row.isBottom} | ||
| 148 | onClick={() => { | ||
| 149 | this.updateOrder(scope.row, 'DOWN'); | ||
| 150 | }} | ||
| 151 | > | ||
| 152 | 下移 | ||
| 153 | </el-button> | ||
| 154 | <el-button | ||
| 155 | type="text" | ||
| 156 | class='movebtnColor' | ||
| 157 | disabled={scope.row.isBottom} | ||
| 158 | onClick={() => { | ||
| 159 | this.updateOrder(scope.row, 'BOTTOM'); | ||
| 160 | }} | ||
| 161 | > | ||
| 162 | 置底 | ||
| 163 | </el-button> | ||
| 164 | </div> | ||
| 165 | ); | ||
| 166 | }, | ||
| 167 | }, | ||
| 168 | ]) | ||
| 169 | .concat([ | ||
| 170 | { | ||
| 171 | label: "操作", | ||
| 172 | width: 280, | ||
| 173 | render: (h, scope) => { | ||
| 174 | return ( | ||
| 175 | <div> | ||
| 176 | <el-tooltip | ||
| 177 | class="item" | ||
| 178 | effect="dark" | ||
| 179 | disabled={scope.row.type !== "Everyone"} | ||
| 180 | content="没有点击的权限" | ||
| 181 | placement="top" | ||
| 182 | > | ||
| 183 | <span> | ||
| 184 | <el-button | ||
| 185 | disabled={scope.row.type === "Everyone"} | ||
| 186 | type="text" | ||
| 187 | size="mini" | ||
| 188 | class="configurationbtnColor" | ||
| 189 | onClick={() => { | ||
| 190 | this.getList(scope.row); | ||
| 191 | }} | ||
| 192 | > | ||
| 193 | 配置 | ||
| 194 | </el-button> | ||
| 195 | </span> | ||
| 196 | </el-tooltip> | ||
| 197 | <el-tooltip | ||
| 198 | class="item" | ||
| 199 | effect="dark" | ||
| 200 | disabled={scope.row.category !== 1} | ||
| 201 | content="系统内置角色 不允许修改" | ||
| 202 | placement="top" | ||
| 203 | > | ||
| 204 | <span> | ||
| 205 | <el-button | ||
| 206 | disabled={scope.row.category === 1} | ||
| 207 | type="text" | ||
| 208 | size="mini" | ||
| 209 | class='successColor' | ||
| 210 | onClick={() => { | ||
| 211 | this.handleAddEdit(scope.row); | ||
| 212 | }} | ||
| 213 | > | ||
| 214 | 修改 | ||
| 215 | </el-button> | ||
| 216 | </span> | ||
| 217 | </el-tooltip> | ||
| 218 | <el-tooltip | ||
| 219 | class="item" | ||
| 220 | effect="dark" | ||
| 221 | disabled={scope.row.category !== 1} | ||
| 222 | content="系统内置角色 不允许删除" | ||
| 223 | placement="top" | ||
| 224 | > | ||
| 225 | <span> | ||
| 226 | <el-button | ||
| 227 | type="text" | ||
| 228 | disabled={scope.row.category === 1} | ||
| 229 | size="mini" | ||
| 230 | class='delColor' | ||
| 231 | // style="color:#F56C6C" | ||
| 232 | onClick={() => { | ||
| 233 | this.handleDelete(scope.row.id, scope.row.name); | ||
| 234 | }} | ||
| 235 | > | ||
| 236 | 删除 | ||
| 237 | </el-button> | ||
| 238 | </span> | ||
| 239 | </el-tooltip> | ||
| 240 | </div> | ||
| 241 | ); | ||
| 242 | }, | ||
| 243 | |||
| 244 | }]), | ||
| 245 | }, | ||
| 246 | data: [], | ||
| 247 | } | ||
| 248 | }, | ||
| 249 | created () { | ||
| 250 | this.getTableData(); | ||
| 251 | this.getTableList() | ||
| 252 | }, | ||
| 253 | computed: { | ||
| 254 | ...mapGetters(["products"]) | ||
| 255 | }, | ||
| 256 | mounted () { }, | ||
| 257 | methods: { | ||
| 258 | //查询 | ||
| 259 | searchQuery () { | ||
| 260 | if (this.form.rolesName) { | ||
| 261 | this.listdata = this.childrenFn(this.setlistdata, this.form.rolesName); | ||
| 262 | } else { | ||
| 263 | this.getTableData() | ||
| 264 | } | ||
| 265 | }, | ||
| 266 | childrenFn (arr, key) { | ||
| 267 | let searchTree = []; | ||
| 268 | arr.forEach((item, index) => { | ||
| 269 | if (item.name.indexOf(key) != -1) { | ||
| 270 | |||
| 271 | searchTree.push(item); | ||
| 272 | } | ||
| 273 | }); | ||
| 274 | if (searchTree != undefined && searchTree.length != 0) { | ||
| 275 | return judgeSort(searchTree); | ||
| 276 | } | ||
| 277 | }, | ||
| 278 | // 获取角色列表 | ||
| 279 | getTableData () { | ||
| 280 | getRolesById([1, 2]) | ||
| 281 | .then((res) => { | ||
| 282 | this.listdata = res.content; | ||
| 283 | this.listdata = judgeSort(this.listdata); | ||
| 284 | this.setlistdata = res.content; | ||
| 285 | }) | ||
| 286 | .catch((e) => console.error(e)); | ||
| 287 | }, | ||
| 288 | |||
| 289 | // 获取菜单列表 | ||
| 290 | getTableList () { | ||
| 291 | getMenuInfo(this.BASE_API.CODE).then((res) => { | ||
| 292 | if (res.code === 200) { | ||
| 293 | this.menutablelistData = judgeSort(res.result) | ||
| 294 | } else { | ||
| 295 | this.$message.error({ message: res.message, showClose: true }) | ||
| 296 | } | ||
| 297 | }) | ||
| 298 | const queryOptionsid = { | ||
| 299 | conditionGroup: { | ||
| 300 | queryRelation: "AND", | ||
| 301 | conditions: [ | ||
| 302 | { | ||
| 303 | property: "code", | ||
| 304 | value: this.products, | ||
| 305 | operator: "EQ", | ||
| 306 | }, | ||
| 307 | ], | ||
| 308 | }, | ||
| 309 | }; | ||
| 310 | const params = { | ||
| 311 | queryOptions: queryOptionsid, | ||
| 312 | }; | ||
| 313 | // 获取系统id | ||
| 314 | getAction(this.meumurlid, params) | ||
| 315 | .then((res) => { | ||
| 316 | this.productId = res.content[0].id; | ||
| 317 | this.getAuthorityList(res.content[0].id, res.content[0].code) | ||
| 318 | this.selectedSubsystemCode = res.content[0].code | ||
| 319 | // let queryOptions = { | ||
| 320 | // conditionGroup: { | ||
| 321 | // conditions: [ | ||
| 322 | // { | ||
| 323 | // property: "productId", | ||
| 324 | // value: this.productId, | ||
| 325 | // operator: "EQ", | ||
| 326 | // }, | ||
| 327 | // ], | ||
| 328 | // queryRelation: "AND", | ||
| 329 | // }, | ||
| 330 | // orderBys: [{ property: "sort", direction: "desc" }], | ||
| 331 | // }; | ||
| 332 | // if (!this.tableUrl) { | ||
| 333 | // console.log("请设置tableUrl属性为接口地址!"); | ||
| 334 | // return; | ||
| 335 | // } | ||
| 336 | // if (this.queryOptions !== "") { | ||
| 337 | // this.queryParam.queryOptions = JSON.stringify(queryOptions); | ||
| 338 | // } | ||
| 339 | // 查询系统菜单 | ||
| 340 | // getAction(this.tableUrl, this.queryParam) | ||
| 341 | // .then((res) => { | ||
| 342 | // if (res.status === 1) { | ||
| 343 | // this.loading = false; | ||
| 344 | // // this.menutablelistData = res.content; | ||
| 345 | // console.log("res.content菜单", res.content); | ||
| 346 | // } else { | ||
| 347 | // this.$message.error({ message: res.message, showClose: true }); | ||
| 348 | // this.loading = false; | ||
| 349 | // } | ||
| 350 | // }) | ||
| 351 | // .catch((error) => { | ||
| 352 | // console.log("er", error); | ||
| 353 | // this.loading = false; | ||
| 354 | // }); | ||
| 355 | }) | ||
| 356 | .catch((error) => { | ||
| 357 | console.log("er", error); | ||
| 358 | }); | ||
| 359 | }, | ||
| 360 | // 获取权限列表 | ||
| 361 | getAuthorityList (productId, code) { | ||
| 362 | getAuthorityListAction(productId, code).then( | ||
| 363 | res => { | ||
| 364 | if (res.status === 1) { | ||
| 365 | if (res.content.length !== 0) { | ||
| 366 | this.operationCodes = res.content[0].operations | ||
| 367 | this.operationList = [] | ||
| 368 | for (var k in this.operationCodes) { | ||
| 369 | this.operationList.push(k) | ||
| 370 | } | ||
| 371 | } | ||
| 372 | } else { | ||
| 373 | this.$message.error({ message: res.message, showClose: true }) | ||
| 374 | } | ||
| 375 | } | ||
| 376 | ) | ||
| 377 | }, | ||
| 378 | |||
| 379 | // 配置 | ||
| 380 | getList (row) { | ||
| 381 | this.getTableList() | ||
| 382 | const params = {}; | ||
| 383 | const queryOptions = { | ||
| 384 | conditionGroup: { | ||
| 385 | conditions: [ | ||
| 386 | { | ||
| 387 | property: "organizationId", | ||
| 388 | value: row.organizationId, | ||
| 389 | operator: "EQ", | ||
| 390 | }, | ||
| 391 | { | ||
| 392 | property: "departmentId", | ||
| 393 | value: row.departmentId, | ||
| 394 | operator: "EQ", | ||
| 395 | }, | ||
| 396 | ], | ||
| 397 | queryRelation: "AND", | ||
| 398 | }, | ||
| 399 | orderBys: [{ property: "sort", direction: "desc" }], | ||
| 400 | }; | ||
| 401 | params.queryOptions = JSON.stringify(queryOptions); | ||
| 402 | |||
| 403 | getUserRoles(row.id).then((res) => { | ||
| 404 | if (res.status === 1) { | ||
| 405 | this.personlist = res.content; | ||
| 406 | getAction(api.users, params).then((res) => { | ||
| 407 | if (res.status === 1) { | ||
| 408 | this.waitMemberList = res.content; | ||
| 409 | if (this.personlist) { | ||
| 410 | this.waitMemberList.forEach((item, i) => { | ||
| 411 | this.personlist.forEach((val) => { | ||
| 412 | if (item.id === val.id) { | ||
| 413 | this.waitMemberList[i].selectStatus = 0; | ||
| 414 | } | ||
| 415 | }); | ||
| 416 | }); | ||
| 417 | } | ||
| 418 | |||
| 419 | this.$refs.rolesForm.personlist(this.waitMemberList, row.id); | ||
| 420 | this.$refs.rolesForm.menulist(this.operationList, row.id, this.selectedSubsystemCode, this.menutablelistData, this.operationCodes); | ||
| 421 | } else { | ||
| 422 | this.$message.error({ message: res.message, showClose: true }); | ||
| 423 | } | ||
| 424 | }); | ||
| 425 | this.$refs.rolesForm.title = "人员配置"; | ||
| 426 | } else this.$message.error({ message: res.message, showClose: true }); | ||
| 427 | }); | ||
| 428 | }, | ||
| 429 | // 新增、修改角色 | ||
| 430 | handleAddEdit (value) { | ||
| 431 | this.isDialog = true | ||
| 432 | this.$refs.addEditDialog.menuType = this.menuType; | ||
| 433 | this.$refs.addEditDialog.roleId = value.id; | ||
| 434 | this.roleSort = value.sort ? value.sort : 0; | ||
| 435 | this.$refs.addEditDialog.dialogForm.roleType = this.BASE_API.CODE; | ||
| 436 | if (value.id) { | ||
| 437 | this.$refs.addEditDialog.dialogForm.roleName = value.name; | ||
| 438 | |||
| 439 | this.$refs.addEditDialog.dialogForm.roleTextArea = value.description; | ||
| 440 | } | ||
| 441 | this.$refs.addEditDialog.showAddEditDialog = true; | ||
| 442 | this.$refs.addEditDialog.title = value.id ? "修改" : "新增"; | ||
| 443 | }, | ||
| 444 | //排序 | ||
| 445 | updateOrder (record, operate) { | ||
| 446 | const findIndex = this.listdata.findIndex(item => item.id === record.id) | ||
| 447 | let swapId = '' | ||
| 448 | if (operate === 'UP') { | ||
| 449 | swapId = this.listdata[findIndex - 1].id | ||
| 450 | } else if (operate === 'DOWN') { | ||
| 451 | swapId = this.listdata[findIndex + 1].id | ||
| 452 | } | ||
| 453 | updateOrder('/rest/roles', record, operate, swapId).then(res => { | ||
| 454 | if (res.status === 1) { | ||
| 455 | this.$message.success({ message: res.message, showClose: true }) | ||
| 456 | this.getTableData(); | ||
| 457 | } else { | ||
| 458 | this.$message.error({ message: res.message, showClose: true }) | ||
| 459 | } | ||
| 460 | }) | ||
| 461 | }, | ||
| 462 | // 删除 | ||
| 463 | handleDelete: function (id, content = "") { | ||
| 464 | this.$confirm( | ||
| 465 | `<div class="customer-message-wrapper"> | ||
| 466 | <h5 class="title">您确认要执行该操作用于以下信息:</h5> | ||
| 467 | <p class="content" aria-controls="${content}">${content} | ||
| 468 | </p> | ||
| 469 | <p class="result">执行后,数据将 | ||
| 470 | <span >无法恢复</span> | ||
| 471 | </p> | ||
| 472 | </div>`, | ||
| 473 | "执行确认", | ||
| 474 | { | ||
| 475 | dangerouslyUseHTMLString: true, | ||
| 476 | customClass: "customer-delete", | ||
| 477 | confirmButtonText: "确定", | ||
| 478 | cancelButtonText: "取消", | ||
| 479 | type: "warning", | ||
| 480 | } | ||
| 481 | ) | ||
| 482 | .then(() => { | ||
| 483 | if (!this.tableUrlroles) { | ||
| 484 | this.$message.error({ | ||
| 485 | message: "请设置tableUrl属性为接口地址!", | ||
| 486 | showClose: true, | ||
| 487 | }); | ||
| 488 | return; | ||
| 489 | } | ||
| 490 | const url = this.tableUrlroles + "/" + id; | ||
| 491 | deleteAction(url).then((res) => { | ||
| 492 | if (res.status === 1) { | ||
| 493 | this.$message.success({ message: res.message, showClose: true }); | ||
| 494 | this.getTableData(); | ||
| 495 | } else { | ||
| 496 | this.$message.error({ message: res.message, showClose: true }); | ||
| 497 | } | ||
| 498 | }); | ||
| 499 | }) | ||
| 500 | .catch(() => { }); | ||
| 501 | }, | ||
| 502 | // 新增回显 | ||
| 503 | reloadTableData () { | ||
| 504 | this.getTableData(); | ||
| 505 | }, | ||
| 506 | }, | ||
| 507 | }; | ||
| 508 | </script> | ||
| 509 | <style scoped lang="scss"> | ||
| 510 | @import "~@/styles/mixin.scss"; | ||
| 511 | // @import "~@/styles/public.scss"; | ||
| 512 | |||
| 513 | /deep/.el-button.is-disabled.el-button--text { | ||
| 514 | width: 64px; | ||
| 515 | height: 28px; | ||
| 516 | background: rgba(255, 255, 255, 0.1); | ||
| 517 | border-radius: 16px; | ||
| 518 | } | ||
| 519 | </style> |
| 1 | <template> | ||
| 2 | <el-dialog | ||
| 3 | :close-on-click-modal="false" | ||
| 4 | top="0" | ||
| 5 | @click="close()" | ||
| 6 | class="roleconfiguration" | ||
| 7 | custom-class="dialogBox editDialogBox mainCenter" | ||
| 8 | :visible.sync="visible" | ||
| 9 | width="85%"> | ||
| 10 | <div slot="title" class="dialog_title" ref="dialogTitle"> | ||
| 11 | {{ title || "标题" }} | ||
| 12 | </div> | ||
| 13 | <div class="editDialogBox-box"> | ||
| 14 | <el-tabs v-model="activeName" type="card" @tab-click="handleClick"> | ||
| 15 | <el-tab-pane label="人员配置" name="first"></el-tab-pane> | ||
| 16 | <el-tab-pane label="菜单配置" name="second"></el-tab-pane> | ||
| 17 | </el-tabs> | ||
| 18 | <lb-table | ||
| 19 | v-if="activeName == 'first'" | ||
| 20 | ref="multipleTable" | ||
| 21 | :pagination="false" | ||
| 22 | :column="usertableData.column" | ||
| 23 | :data="lastuserList" | ||
| 24 | @selection-change="handleSelectionChange" | ||
| 25 | @row-click="handleClickTableRow"> | ||
| 26 | > | ||
| 27 | </lb-table> | ||
| 28 | <lb-table | ||
| 29 | :key="menukey" | ||
| 30 | v-if="activeName == 'second'" | ||
| 31 | :pagination="false" | ||
| 32 | :column="menutableData.column" | ||
| 33 | :data="lastMenuList" | ||
| 34 | row-key="id" | ||
| 35 | default-expand-all | ||
| 36 | :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> | ||
| 37 | </lb-table> | ||
| 38 | </div> | ||
| 39 | <template slot="footer"> | ||
| 40 | <btn nativeType="cx" type="primary" @click="handleSaveMember()">保存</btn> | ||
| 41 | <btn nativeType="cz" @click="close()">取消</btn> | ||
| 42 | </template> | ||
| 43 | </el-dialog> | ||
| 44 | </template> | ||
| 45 | |||
| 46 | <script> | ||
| 47 | import { api } from "@/api/manageApi"; | ||
| 48 | import { getRoleAuthorityList, roleAuthority } from "@/api/authorityManage"; | ||
| 49 | import { updateUser } from "@/api/personnelManage"; | ||
| 50 | export default { | ||
| 51 | name: "", | ||
| 52 | data () { | ||
| 53 | return { | ||
| 54 | title: "人员配置", | ||
| 55 | visible: false, | ||
| 56 | // 菜单表格数据 | ||
| 57 | menutableData: { | ||
| 58 | column: [ | ||
| 59 | { | ||
| 60 | prop: "name", | ||
| 61 | width: 830, | ||
| 62 | label: "菜单名称", | ||
| 63 | } | ||
| 64 | ].concat([ | ||
| 65 | { | ||
| 66 | label: "权限", | ||
| 67 | render: (h, scope) => { | ||
| 68 | return ( | ||
| 69 | <div> | ||
| 70 | <el-checkbox v-model={scope.row.checkArr[0].value} | ||
| 71 | disabled={scope.row.checkArr[0].disabled} | ||
| 72 | label={scope.row.checkArr[0].name} onChange={(checked) => { | ||
| 73 | this.changeCheck(checked, scope.row.checkArr[0].id, scope); | ||
| 74 | }} /> | ||
| 75 | <el-checkbox v-model={scope.row.checkArr[1].value} | ||
| 76 | disabled={scope.row.checkArr[0].disabled} | ||
| 77 | label={scope.row.checkArr[1].name} | ||
| 78 | onChange={(checked) => { | ||
| 79 | this.changeCheck(checked, scope.row.checkArr[1].id, scope); | ||
| 80 | }} /> | ||
| 81 | </div> | ||
| 82 | ); | ||
| 83 | }, | ||
| 84 | }, | ||
| 85 | ]), | ||
| 86 | }, | ||
| 87 | // 人员表格数据 | ||
| 88 | usertableData: { | ||
| 89 | column: [ | ||
| 90 | { | ||
| 91 | type: "selection", | ||
| 92 | width: 330, | ||
| 93 | }, | ||
| 94 | { | ||
| 95 | prop: "name", | ||
| 96 | width: 330, | ||
| 97 | label: "姓名", | ||
| 98 | }, | ||
| 99 | { | ||
| 100 | prop: "loginName", | ||
| 101 | label: "用户名", | ||
| 102 | }, | ||
| 103 | ], | ||
| 104 | }, | ||
| 105 | // 角色id | ||
| 106 | roleId: "", | ||
| 107 | menuList: [], // 菜单列表 | ||
| 108 | menukey: 0, | ||
| 109 | activeName: "first", | ||
| 110 | lastuserList: [], // 人员表格数据 | ||
| 111 | lastMenuList: [], // 重构完成的菜单表格数据 | ||
| 112 | usermultipleSelection: [], | ||
| 113 | // 选中菜单列表 | ||
| 114 | checkArr: [], // 重构操作符列表 | ||
| 115 | authorityList: [], // 授权回显数组 | ||
| 116 | checklistbor: [], | ||
| 117 | // 授权对象数据 | ||
| 118 | menuprams: {}, | ||
| 119 | // 系统code | ||
| 120 | selectedSubsystemCode: "" | ||
| 121 | }; | ||
| 122 | }, | ||
| 123 | computed: {}, | ||
| 124 | |||
| 125 | created () { | ||
| 126 | }, | ||
| 127 | mounted () { | ||
| 128 | }, | ||
| 129 | methods: { | ||
| 130 | |||
| 131 | // 人员配置点击行勾选数据 | ||
| 132 | handleClickTableRow (row, event) { | ||
| 133 | this.checkNum = 0; | ||
| 134 | this.isCheck = false; | ||
| 135 | if (event.label == "操作") { | ||
| 136 | return; | ||
| 137 | } else { | ||
| 138 | if (row.status == "0") { | ||
| 139 | return; | ||
| 140 | } else { | ||
| 141 | if (this.usermultipleSelection.length > 0) { | ||
| 142 | if ( | ||
| 143 | JSON.stringify(this.usermultipleSelection).indexOf( | ||
| 144 | JSON.stringify(row) | ||
| 145 | ) == -1 | ||
| 146 | ) { | ||
| 147 | this.usermultipleSelection.push(row); | ||
| 148 | this.$refs.multipleTable.toggleRowSelection(row, true); | ||
| 149 | } else { | ||
| 150 | this.usermultipleSelection.map((item, index) => { | ||
| 151 | if (item.id == row.id) { | ||
| 152 | this.usermultipleSelection.splice(index, 1); | ||
| 153 | this.$refs.multipleTable.toggleRowSelection(row, false); | ||
| 154 | } | ||
| 155 | }); | ||
| 156 | } | ||
| 157 | } else { | ||
| 158 | this.usermultipleSelection.push(row); | ||
| 159 | this.$refs.multipleTable.toggleRowSelection(row, true); | ||
| 160 | } | ||
| 161 | } | ||
| 162 | } | ||
| 163 | if (this.usermultipleSelection.length > 0) { | ||
| 164 | this.checkNum = this.usermultipleSelection.length; | ||
| 165 | this.isCheck = true; | ||
| 166 | } else { | ||
| 167 | this.isCheck = false; | ||
| 168 | } | ||
| 169 | }, | ||
| 170 | // 获取授权主体的菜单权限 | ||
| 171 | // getMenuAuthorityList | ||
| 172 | menulist (operationList, id, Code, menutablelistData, operationCodes) { | ||
| 173 | this.selectedSubsystemCode = Code | ||
| 174 | this.menuList = menutablelistData; | ||
| 175 | getRoleAuthorityList( | ||
| 176 | id, | ||
| 177 | operationList.toString(), | ||
| 178 | Code + '_MENU' | ||
| 179 | ).then(res => { | ||
| 180 | if (res.status === 1) { | ||
| 181 | this.authorityList = res.content | ||
| 182 | this.getRecursionTreeData(this.menuList, this.authorityList, operationCodes) | ||
| 183 | this.getAuthorizedInfo() | ||
| 184 | // this.setCheckAllArr() | ||
| 185 | // this.getAuthorizedInfo() | ||
| 186 | } else { | ||
| 187 | this.$message.error({ message: res.message, showClose: true }) | ||
| 188 | } | ||
| 189 | }) | ||
| 190 | |||
| 191 | |||
| 192 | }, | ||
| 193 | /** | ||
| 194 | * 递归渲染列表数据 | ||
| 195 | * list:原始数组 | ||
| 196 | * authorityList:已授权数组 | ||
| 197 | */ | ||
| 198 | getRecursionTreeData (list, authorityList, operationCodes) { | ||
| 199 | ++this.menukey | ||
| 200 | this.checkArr = [] | ||
| 201 | for (const k in operationCodes) { | ||
| 202 | const obj = {} | ||
| 203 | obj.name = operationCodes[k] | ||
| 204 | obj.id = k | ||
| 205 | obj.value = false | ||
| 206 | obj.disabled = false | ||
| 207 | // obj.isAll = false; | ||
| 208 | this.checkArr.push(obj) | ||
| 209 | } | ||
| 210 | for (const [index, item] of Object.entries(list)) { | ||
| 211 | this.setAuthorizedConditions( | ||
| 212 | authorityList, | ||
| 213 | this.$deepCopy(this.checkArr), | ||
| 214 | item | ||
| 215 | ) | ||
| 216 | if ( | ||
| 217 | item.children && | ||
| 218 | item.children !== null && | ||
| 219 | item.children.length !== 0 | ||
| 220 | ) { | ||
| 221 | item.children.forEach((child, j) => { | ||
| 222 | this.setAuthorizedConditions( | ||
| 223 | authorityList, | ||
| 224 | this.$deepCopy(this.checkArr), | ||
| 225 | child | ||
| 226 | ) | ||
| 227 | }) | ||
| 228 | this.getRecursionTreeData(item.children, authorityList, operationCodes) | ||
| 229 | } | ||
| 230 | } | ||
| 231 | this.lastMenuList = list | ||
| 232 | // this.setCheckAllArr(list) | ||
| 233 | }, | ||
| 234 | // 授权条件 | ||
| 235 | setAuthorizedConditions (authorityList, checkArr, item) { | ||
| 236 | if (this.roleId === '') { | ||
| 237 | checkArr.forEach(ele => { | ||
| 238 | ele.disabled = true | ||
| 239 | ele.value = false | ||
| 240 | }) | ||
| 241 | } else { | ||
| 242 | if (authorityList.length !== 0) { | ||
| 243 | if (authorityList[0].superPermission === true) { | ||
| 244 | checkArr.forEach(ele => { | ||
| 245 | ele.value = true | ||
| 246 | ele.disabled = true | ||
| 247 | }) | ||
| 248 | } else { | ||
| 249 | const repeatArr = authorityList.filter(authorityItem => { | ||
| 250 | return authorityItem.resourceUri === item.id | ||
| 251 | }) | ||
| 252 | repeatArr.forEach(element => { | ||
| 253 | checkArr.forEach(ele => { | ||
| 254 | if (element.operationCode === ele.id) { | ||
| 255 | ele.value = true | ||
| 256 | if (this.roleId !== element.subjectId) { | ||
| 257 | ele.disabled = true | ||
| 258 | } | ||
| 259 | } | ||
| 260 | }) | ||
| 261 | }) | ||
| 262 | } | ||
| 263 | } | ||
| 264 | } | ||
| 265 | this.$set(item, 'checkArr', this.$deepCopy(checkArr)) | ||
| 266 | }, | ||
| 267 | // 获取拼接授权信息 | ||
| 268 | getAuthorizedInfo () { | ||
| 269 | const lastArr = [] | ||
| 270 | const authorizedList = [] | ||
| 271 | const wholeArr = this.$deepCopy(this.lastMenuList) | ||
| 272 | const arr = this.$treeConvertToArr(wholeArr) | ||
| 273 | arr.forEach(ele => { | ||
| 274 | ele.checkArr.forEach(val => { | ||
| 275 | if (val.value === true && val.disabled === false) { | ||
| 276 | const obj = { | ||
| 277 | operationCode: val.id, | ||
| 278 | name: ele.name, | ||
| 279 | id: ele.id | ||
| 280 | } | ||
| 281 | lastArr.push(obj) | ||
| 282 | } | ||
| 283 | }) | ||
| 284 | }) | ||
| 285 | lastArr.forEach(element => { | ||
| 286 | authorizedList.push({ | ||
| 287 | operationCode: element.operationCode, // 标识符 | ||
| 288 | productCode: this.selectedSubsystemCode, // 子系统code | ||
| 289 | resourceCategoryCode: this.selectedSubsystemCode + '_MENU', // 资源类别code默认为MENU | ||
| 290 | resourceName: element.name, | ||
| 291 | resourceUri: element.id, // 授权菜单id | ||
| 292 | subjectId: this.roleId, // 授权对象id | ||
| 293 | subjectType: 'ROLE' // 授权对象类别 | ||
| 294 | }) | ||
| 295 | }) | ||
| 296 | this.menuprams = { | ||
| 297 | subjectId: this.roleId, | ||
| 298 | authorizedList: authorizedList | ||
| 299 | } | ||
| 300 | }, | ||
| 301 | // 获取人员列表做筛选 | ||
| 302 | personlist (a, rid) { | ||
| 303 | this.roleId = rid; | ||
| 304 | this.visible = true; | ||
| 305 | this.lastuserList = a; | ||
| 306 | this.lastuserList.forEach((item, index) => { | ||
| 307 | if (item.selectStatus === 0) { | ||
| 308 | this.$nextTick(async () => { | ||
| 309 | await this.$refs.multipleTable | ||
| 310 | if (this.$refs.multipleTable) { | ||
| 311 | this.$refs.multipleTable.toggleRowSelection( | ||
| 312 | this.lastuserList[index], | ||
| 313 | true | ||
| 314 | ); | ||
| 315 | } | ||
| 316 | |||
| 317 | }); | ||
| 318 | } | ||
| 319 | }); | ||
| 320 | }, | ||
| 321 | // 关闭事件 | ||
| 322 | close () { | ||
| 323 | this.visible = false; | ||
| 324 | }, | ||
| 325 | // 保存事件 | ||
| 326 | handleSaveMember () { | ||
| 327 | // 人员授权 | ||
| 328 | const idList = this.usermultipleSelection.map((item) => { | ||
| 329 | return item.id; | ||
| 330 | }) | ||
| 331 | updateUser(this.roleId, idList).then((res) => { | ||
| 332 | if (res.status === 1) { | ||
| 333 | this.$message.success({ message: "保存成功", showClose: true }); | ||
| 334 | this.visible = false; | ||
| 335 | } else this.$message.error({ message: res.message, showClose: true }); | ||
| 336 | }); | ||
| 337 | // 菜单授权 | ||
| 338 | roleAuthority( | ||
| 339 | this.menuprams.subjectId, | ||
| 340 | this.menuprams.authorizedList | ||
| 341 | ).then((res) => { | ||
| 342 | if (res.status === 1) { | ||
| 343 | this.$message.success({ | ||
| 344 | message: res.message, | ||
| 345 | }) | ||
| 346 | // this.authorizedContChange() | ||
| 347 | } else { | ||
| 348 | this.$message.error({ message: res.message, showClose: true }) | ||
| 349 | } | ||
| 350 | }) | ||
| 351 | }, | ||
| 352 | // 勾选人员事件 | ||
| 353 | handleSelectionChange (val) { | ||
| 354 | this.lastuserList.forEach((element, index) => { | ||
| 355 | delete this.lastuserList[index].selectStatus | ||
| 356 | }); | ||
| 357 | this.usermultipleSelection = val; | ||
| 358 | this.lastuserList.forEach((element, index) => { | ||
| 359 | this.usermultipleSelection.forEach(element1 => { | ||
| 360 | if (element.id == element1.id) { | ||
| 361 | this.lastuserList[index].selectStatus = 0 | ||
| 362 | } | ||
| 363 | }); | ||
| 364 | }); | ||
| 365 | }, | ||
| 366 | // 数据筛选 | ||
| 367 | setarrdata (scope, arr) { | ||
| 368 | |||
| 369 | arr.forEach((item, index, arr) => { | ||
| 370 | if (item.id == scope.row.id) { | ||
| 371 | this.checklistbor = [...arr] | ||
| 372 | } else if (item.id !== scope.row.id && item.children) { | ||
| 373 | this.setarrdata(scope, item.children) | ||
| 374 | } | ||
| 375 | |||
| 376 | }) | ||
| 377 | |||
| 378 | }, | ||
| 379 | // 勾选菜单事件 | ||
| 380 | changeCheck (flag, checkId, scope) { | ||
| 381 | this.checklistbor = [] | ||
| 382 | this.setarrdata(scope, this.lastMenuList) | ||
| 383 | const parents = this.$findParent(this.lastMenuList, scope.row.parentId) | ||
| 384 | const childs = this.$findChildren(this.lastMenuList, scope.row.id) | ||
| 385 | this.$setChildArr( | ||
| 386 | this.lastMenuList, | ||
| 387 | scope.row.id, | ||
| 388 | checkId, | ||
| 389 | flag, | ||
| 390 | this.checklistbor, | ||
| 391 | parents, | ||
| 392 | childs | ||
| 393 | ) | ||
| 394 | this.getAuthorizedInfo() | ||
| 395 | }, | ||
| 396 | handleClick (tab, event) { | ||
| 397 | this.lastuserList.forEach((item, index) => { | ||
| 398 | if (item.selectStatus === 0) { | ||
| 399 | this.$nextTick(async () => { | ||
| 400 | await this.$refs.multipleTable | ||
| 401 | if (this.$refs.multipleTable) { | ||
| 402 | this.$refs.multipleTable.toggleRowSelection( | ||
| 403 | this.lastuserList[index], | ||
| 404 | true | ||
| 405 | ); | ||
| 406 | } | ||
| 407 | |||
| 408 | }); | ||
| 409 | } | ||
| 410 | }); | ||
| 411 | } | ||
| 412 | |||
| 413 | }, | ||
| 414 | }; | ||
| 415 | </script> | ||
| 416 | <style scoped lang="scss"> | ||
| 417 | /deep/.dialogBox .el-dialog__header { | ||
| 418 | height: 59px !important; | ||
| 419 | } | ||
| 420 | </style> |
src/views/system/users/data/index.js
deleted
100644 → 0
| 1 | /* | ||
| 2 | * @Author: xiaomiao 1158771342@qq.com | ||
| 3 | * @Date: 2023-01-30 17:59:51 | ||
| 4 | * @LastEditors: Please set LastEditors | ||
| 5 | * @LastEditTime: 2023-03-23 09:34:50 | ||
| 6 | * @FilePath: \监管系统\js-web-jianguan\src\views\system\users\data\index.js | ||
| 7 | * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE | ||
| 8 | */ | ||
| 9 | import filter from '@/utils/filter.js' | ||
| 10 | class data extends filter { | ||
| 11 | constructor() { | ||
| 12 | super() | ||
| 13 | } | ||
| 14 | columns () { | ||
| 15 | return [ | ||
| 16 | { | ||
| 17 | prop: "code", | ||
| 18 | label: "工号", | ||
| 19 | width: 130 | ||
| 20 | }, | ||
| 21 | { | ||
| 22 | prop: "name", | ||
| 23 | label: "姓名", | ||
| 24 | width: 100 | ||
| 25 | }, | ||
| 26 | { | ||
| 27 | prop: "loginName", | ||
| 28 | label: "用户名" | ||
| 29 | }, | ||
| 30 | { | ||
| 31 | prop: "departmentName", | ||
| 32 | label: "组织机构", | ||
| 33 | minWidth: 130 | ||
| 34 | }, | ||
| 35 | { | ||
| 36 | prop: "telephone", | ||
| 37 | label: "电话" | ||
| 38 | }, | ||
| 39 | { | ||
| 40 | prop: "jobLevel", | ||
| 41 | label: "职位" | ||
| 42 | }, | ||
| 43 | ] | ||
| 44 | } | ||
| 45 | } | ||
| 46 | export default new data() |
| 1 | <template> | ||
| 2 | <dialogBox :title="title" :width="'867px'" class="PersonnelDialog" @closeDialog="close" :isMain="true" @submitForm="submitForm" | ||
| 3 | v-model="myValue"> | ||
| 4 | <div class="dialogCon"> | ||
| 5 | <el-form ref="form" :model="form" :rules="rules"> | ||
| 6 | <el-row :gutter="24"> | ||
| 7 | <el-col :span="12"> | ||
| 8 | <el-form-item label="姓名:" prop="name" label-width="100px"> | ||
| 9 | <el-input v-model="form.name" placeholder="姓名" /> | ||
| 10 | </el-form-item> | ||
| 11 | </el-col> | ||
| 12 | <el-col :span="23"> | ||
| 13 | <el-col :span="18" class="col-pd0"> | ||
| 14 | <el-form-item label="性别:" label-width="88px"> | ||
| 15 | <el-radio v-for="(item, index) in sexList" :key="index" v-model="form.sex" :label="item.value">{{ | ||
| 16 | item.name }}</el-radio> | ||
| 17 | </el-form-item> | ||
| 18 | </el-col> | ||
| 19 | <el-col :span="6"> | ||
| 20 | <el-checkbox v-model="form.isDuty">负责人</el-checkbox> | ||
| 21 | </el-col> | ||
| 22 | </el-col> | ||
| 23 | </el-row> | ||
| 24 | <el-row :gutter="24"> | ||
| 25 | <el-col :span="12"> | ||
| 26 | <el-form-item label="工号:" prop="code" label-width="100px"> | ||
| 27 | <el-input v-model="form.code" placeholder="工号" /> | ||
| 28 | </el-form-item> | ||
| 29 | </el-col> | ||
| 30 | <el-col :span="12"> | ||
| 31 | <el-form-item label="用户名:" prop="loginName" label-width="72px"> | ||
| 32 | <el-input v-model="form.loginName" :disabled="showLoginName" placeholder="用户名" /> | ||
| 33 | </el-form-item> | ||
| 34 | </el-col> | ||
| 35 | </el-row> | ||
| 36 | <el-row :gutter="24"> | ||
| 37 | <el-col :span="12"> | ||
| 38 | <el-form-item label="身份证号码:" label-width="100px"> | ||
| 39 | <el-input v-model="form.idCard" placeholder="身份证号码" /> | ||
| 40 | </el-form-item> | ||
| 41 | </el-col> | ||
| 42 | <el-col :span="12"> | ||
| 43 | <el-form-item label="手机号码:" prop="mobilePhone" label-width="72px"> | ||
| 44 | <el-input v-model="form.mobilePhone" placeholder="手机号码" /> | ||
| 45 | </el-form-item> | ||
| 46 | </el-col> | ||
| 47 | </el-row> | ||
| 48 | <el-row :gutter="24"> | ||
| 49 | <el-col :span="12"> | ||
| 50 | <el-form-item label="最高职务级别:" label-width="100px"> | ||
| 51 | <el-select v-model="form.jobLevel" placeholder="最高职务级别"> | ||
| 52 | <el-option v-for="item in levelList" :key="item.value" :label="item.name" :value="item.value" /> | ||
| 53 | </el-select> | ||
| 54 | </el-form-item> | ||
| 55 | </el-col> | ||
| 56 | <el-col :span="12"> | ||
| 57 | <el-form-item label="办公电话:" prop="telephone" label-width="72px"> | ||
| 58 | <el-input v-model="form.telephone" placeholder="办公电话" /> | ||
| 59 | </el-form-item> | ||
| 60 | </el-col> | ||
| 61 | </el-row> | ||
| 62 | <el-row :gutter="24"> | ||
| 63 | <el-col :span="24"> | ||
| 64 | <el-form-item label="组织机构:" label-width="100px" prop="departmentId"> | ||
| 65 | <el-select class="selbig" v-model="form.departmentId" placeholder="组织机构"> | ||
| 66 | <el-option v-for="item in districtAreaList" :key="item.id" :label="item.name" :value="item.id" /> | ||
| 67 | </el-select> | ||
| 68 | </el-form-item> | ||
| 69 | </el-col> | ||
| 70 | </el-row> | ||
| 71 | <el-row :gutter="24"> | ||
| 72 | <el-col :span="24"> | ||
| 73 | <el-form-item label="办公地点:" label-width="100px" class="form-item-mb0"> | ||
| 74 | <el-input v-model="form.address" placeholder="办公地点" /> | ||
| 75 | </el-form-item> | ||
| 76 | </el-col> | ||
| 77 | </el-row> | ||
| 78 | </el-form> | ||
| 79 | </div> | ||
| 80 | </dialogBox> | ||
| 81 | </template> | ||
| 82 | |||
| 83 | <script> | ||
| 84 | import { api, httpAction, getAction } from '@/api/manageApi' | ||
| 85 | export default { | ||
| 86 | name: "", | ||
| 87 | props: { | ||
| 88 | value: { type: Boolean, default: false }, | ||
| 89 | }, | ||
| 90 | data () { | ||
| 91 | return { | ||
| 92 | myValue: this.value, | ||
| 93 | districtAreaList: [], | ||
| 94 | form: { | ||
| 95 | sex: "0", | ||
| 96 | departmentId: '', | ||
| 97 | }, | ||
| 98 | rules: { | ||
| 99 | name: [{ required: true, message: "请输入姓名", trigger: "blur" }], | ||
| 100 | code: [{ required: true, message: "请输入工号", trigger: "blur" }], | ||
| 101 | departmentId: [{ required: true, message: "请选择组织机构", trigger: 'change' }], | ||
| 102 | mobilePhone: [{ validator: "sddd", trigger: "blur" }], | ||
| 103 | loginName: [ | ||
| 104 | { required: true, message: "请输入用户名", trigger: "blur" }, | ||
| 105 | ], | ||
| 106 | }, | ||
| 107 | title: "", | ||
| 108 | showLoginName: false, | ||
| 109 | sexList: [{ lable: "0", value: "0", name: "男" }, { lable: "1", value: "1", name: "女" }], | ||
| 110 | levelList: [{ lable: "0", value: "0", name: "干事" }, { lable: "1", value: "1", name: "经理" }], | ||
| 111 | dataUrl: api.users | ||
| 112 | }; | ||
| 113 | }, | ||
| 114 | watch: { | ||
| 115 | value (val) { | ||
| 116 | this.myValue = val | ||
| 117 | } | ||
| 118 | }, | ||
| 119 | created () { | ||
| 120 | this.getdistricts() | ||
| 121 | }, | ||
| 122 | methods: { | ||
| 123 | getdistricts () { | ||
| 124 | getAction(api.departments, { | ||
| 125 | queryOptions: { orderBys: [{ property: "sort", direction: "desc" }] }, | ||
| 126 | }).then((res) => { | ||
| 127 | this.districtAreaList = res.content; | ||
| 128 | |||
| 129 | }); | ||
| 130 | |||
| 131 | |||
| 132 | }, | ||
| 133 | // 添加人员 | ||
| 134 | adds () { | ||
| 135 | this.showLoginName = false | ||
| 136 | }, | ||
| 137 | // 编辑 | ||
| 138 | edit (record) { | ||
| 139 | this.showLoginName = true | ||
| 140 | // 若有id为编辑 | ||
| 141 | if (record) { | ||
| 142 | this.$nextTick(() => { | ||
| 143 | this.form = Object.assign({}, record) | ||
| 144 | }) | ||
| 145 | } | ||
| 146 | }, | ||
| 147 | // 保存 | ||
| 148 | submitForm () { | ||
| 149 | this.districtAreaList.forEach((item) => { | ||
| 150 | if (this.form.departmentId == item.id) { | ||
| 151 | this.form.organizationId = item.organizationId | ||
| 152 | } | ||
| 153 | }) | ||
| 154 | this.$refs.form.validate((valid) => { | ||
| 155 | if (valid) { | ||
| 156 | let method = '' | ||
| 157 | let url = '' | ||
| 158 | const formData = this.form | ||
| 159 | if (!formData.id) { | ||
| 160 | method = 'post' | ||
| 161 | url = this.dataUrl | ||
| 162 | } else { | ||
| 163 | method = 'put' | ||
| 164 | url = `${this.dataUrl}/${formData.id}` | ||
| 165 | } | ||
| 166 | httpAction(url, formData, method).then((res) => { | ||
| 167 | if (res.status === 1) { | ||
| 168 | this.$message.success({ message: res.message, showClose: true }) | ||
| 169 | |||
| 170 | this.close() | ||
| 171 | |||
| 172 | this.$emit('ok') | ||
| 173 | } else { | ||
| 174 | this.$message.error({ message: res.message, showClose: true }) | ||
| 175 | } | ||
| 176 | }) | ||
| 177 | } else { | ||
| 178 | return false | ||
| 179 | } | ||
| 180 | }) | ||
| 181 | }, | ||
| 182 | // 重置 | ||
| 183 | resetForm () { | ||
| 184 | this.form = { | ||
| 185 | sex: '0' | ||
| 186 | } | ||
| 187 | this.$refs.form.resetFields() | ||
| 188 | }, | ||
| 189 | // 关闭 | ||
| 190 | close () { | ||
| 191 | this.resetForm() | ||
| 192 | this.$emit('input', false) | ||
| 193 | } | ||
| 194 | } | ||
| 195 | } | ||
| 196 | </script> | ||
| 197 | <style scoped lang="scss"> | ||
| 198 | </style> |
src/views/system/users/index.scss
deleted
100644 → 0
src/views/system/users/index.vue
deleted
100644 → 0
| 1 | <template> | ||
| 2 | <!-- 人员管理 --> | ||
| 3 | <div class="from-clues"> | ||
| 4 | <div class="from-clues-header"> | ||
| 5 | <el-form ref="ruleForm" :model="form" label-width="100px"> | ||
| 6 | <el-form-item v-if="BASE_API.THEME == 'jg'"> | ||
| 7 | <Breadcrumb /> | ||
| 8 | </el-form-item> | ||
| 9 | <el-row class="mb-5"> | ||
| 10 | <el-col :span="4"> | ||
| 11 | <el-form-item label="用户名" prop="loginName"> | ||
| 12 | <el-input v-model.trim="form.loginName" class="width100" clearable placeholder="用户名"></el-input> | ||
| 13 | </el-form-item> | ||
| 14 | </el-col> | ||
| 15 | <el-col :span="4"> | ||
| 16 | <el-form-item label="姓名" prop="name"> | ||
| 17 | <el-input v-model.trim="form.name" class="width100" clearable placeholder="姓名"></el-input> | ||
| 18 | </el-form-item> | ||
| 19 | </el-col> | ||
| 20 | <el-col :span="4"> | ||
| 21 | <el-form-item label="工号" prop="code"> | ||
| 22 | <el-input v-model.trim="form.code" class="width100" clearable placeholder="工号"></el-input> | ||
| 23 | </el-form-item> | ||
| 24 | </el-col> | ||
| 25 | <!-- 操作按钮 --> | ||
| 26 | <el-col :span="12" class="btnColRight"> | ||
| 27 | <btn nativeType="cx" @click="getTableList">查询</btn> | ||
| 28 | <btn nativeType="cx" @click="handleAdd">添加人员</btn> | ||
| 29 | </el-col> | ||
| 30 | </el-row> | ||
| 31 | </el-form> | ||
| 32 | </div> | ||
| 33 | <div class="from-clues-content"> | ||
| 34 | <lb-table :pagination="false" @size-change="handleSizeChange" @p-current-change="handleCurrentChange" | ||
| 35 | :column="tableData.columns" :calcHeight="BASE_API.calcHeight" :data="tableData.data" :expand-row-keys="keyList" | ||
| 36 | row-key="dictid"> | ||
| 37 | </lb-table> | ||
| 38 | </div> | ||
| 39 | <EditDialog ref="dialogForm" v-model="isDialog" @ok="reloadTableData" /> | ||
| 40 | </div> | ||
| 41 | </template> | ||
| 42 | <script> | ||
| 43 | import { | ||
| 44 | getUuid, | ||
| 45 | judgeSort, | ||
| 46 | realMove, | ||
| 47 | findParents, | ||
| 48 | removeTreeListItem, | ||
| 49 | } from "@/utils/operation"; | ||
| 50 | import { | ||
| 51 | resetPassword, | ||
| 52 | getUserList, getUserLists | ||
| 53 | } from "@/api/personnelManage"; | ||
| 54 | import { api, deleteAction, getAction } from '@/api/manageApi' | ||
| 55 | import data from "./data"; | ||
| 56 | import { deleteDomStr } from '@/utils/proDomStr' | ||
| 57 | import tableMixin from "@/mixins/tableMixin.js"; | ||
| 58 | import EditDialog from "./edit-dialog.vue"; | ||
| 59 | import { updateOrder } from "@/api/orders" | ||
| 60 | export default { | ||
| 61 | name: "menus", | ||
| 62 | mixins: [tableMixin], | ||
| 63 | components: { | ||
| 64 | EditDialog, | ||
| 65 | }, | ||
| 66 | data () { | ||
| 67 | return { | ||
| 68 | isDialog: false, | ||
| 69 | keyList: [], | ||
| 70 | form: { | ||
| 71 | loginName: "", | ||
| 72 | name: "", | ||
| 73 | code: "", | ||
| 74 | }, | ||
| 75 | departmentId: "", // 部门ID | ||
| 76 | typeOptions: [ | ||
| 77 | { | ||
| 78 | value: "0", | ||
| 79 | label: "姓名", | ||
| 80 | }, | ||
| 81 | { | ||
| 82 | value: "1", | ||
| 83 | label: "工号", | ||
| 84 | }, | ||
| 85 | { | ||
| 86 | value: "2", | ||
| 87 | label: "部门", | ||
| 88 | }, | ||
| 89 | { | ||
| 90 | value: "3", | ||
| 91 | label: "机构", | ||
| 92 | }, | ||
| 93 | ], | ||
| 94 | |||
| 95 | selectionList: [], | ||
| 96 | // 表格数据 | ||
| 97 | tableData: { | ||
| 98 | columns: [ | ||
| 99 | { | ||
| 100 | label: "序号", | ||
| 101 | type: "index", | ||
| 102 | width: "50", | ||
| 103 | index: this.indexMethod, | ||
| 104 | }, | ||
| 105 | ] | ||
| 106 | .concat(data.columns()) | ||
| 107 | .concat([ | ||
| 108 | { | ||
| 109 | label: "职位", | ||
| 110 | render: (h, scope) => { | ||
| 111 | return ( | ||
| 112 | <div v-show={scope.row.jobLevel !== null}>{scope.row.jobLevel ? "干事" : "经理"}</div> | ||
| 113 | ) | ||
| 114 | |||
| 115 | } | ||
| 116 | }, | ||
| 117 | { | ||
| 118 | label: "负责人", | ||
| 119 | render: (h, scope) => { | ||
| 120 | return ( | ||
| 121 | <i v-show={scope.row.isDuty !== null} class="el-icon-check" /> | ||
| 122 | ) | ||
| 123 | } | ||
| 124 | }, | ||
| 125 | { | ||
| 126 | label: "排序", | ||
| 127 | width: 300, | ||
| 128 | render: (h, scope) => { | ||
| 129 | return ( | ||
| 130 | <div> | ||
| 131 | <el-button | ||
| 132 | type="text" | ||
| 133 | class='movebtnColor' | ||
| 134 | disabled={scope.row.isTop} | ||
| 135 | onClick={() => { | ||
| 136 | this.updateOrder(scope.row, 'TOP'); | ||
| 137 | }} | ||
| 138 | > | ||
| 139 | 置顶 | ||
| 140 | </el-button> | ||
| 141 | <el-button | ||
| 142 | type="text" | ||
| 143 | class='movebtnColor' | ||
| 144 | disabled={scope.row.isTop} | ||
| 145 | onClick={() => { | ||
| 146 | this.updateOrder(scope.row, 'UP'); | ||
| 147 | }} | ||
| 148 | > | ||
| 149 | 上移 | ||
| 150 | </el-button> | ||
| 151 | <el-button | ||
| 152 | type="text" | ||
| 153 | class='movebtnColor' | ||
| 154 | disabled={scope.row.isBottom} | ||
| 155 | onClick={() => { | ||
| 156 | this.updateOrder(scope.row, 'DOWN'); | ||
| 157 | }} | ||
| 158 | > | ||
| 159 | 下移 | ||
| 160 | </el-button> | ||
| 161 | <el-button | ||
| 162 | type="text" | ||
| 163 | size="mini" | ||
| 164 | class='movebtnColor' | ||
| 165 | disabled={scope.row.isBottom} | ||
| 166 | onClick={() => { | ||
| 167 | this.updateOrder(scope.row, 'BOTTOM'); | ||
| 168 | }} | ||
| 169 | > | ||
| 170 | 置底 | ||
| 171 | </el-button> | ||
| 172 | </div> | ||
| 173 | ); | ||
| 174 | }, | ||
| 175 | }, | ||
| 176 | { | ||
| 177 | label: "操作", | ||
| 178 | width: 380, | ||
| 179 | render: (h, scope) => { | ||
| 180 | return ( | ||
| 181 | <div> | ||
| 182 | <el-button | ||
| 183 | type="text" | ||
| 184 | size="mini" | ||
| 185 | class='resetbtnColor' | ||
| 186 | onClick={() => { | ||
| 187 | this.resetPassword(scope.row.id); | ||
| 188 | }} | ||
| 189 | > | ||
| 190 | 重置 | ||
| 191 | </el-button> | ||
| 192 | <el-button | ||
| 193 | type="text" | ||
| 194 | size="mini" | ||
| 195 | class='successColor' | ||
| 196 | onClick={() => { | ||
| 197 | this.handleEdit(scope.row); | ||
| 198 | }} | ||
| 199 | > | ||
| 200 | 修改 | ||
| 201 | </el-button> | ||
| 202 | <el-button | ||
| 203 | type="text" | ||
| 204 | size="mini" | ||
| 205 | class='delColor' | ||
| 206 | onClick={() => { | ||
| 207 | this.handleDelete(scope.row.id, scope.row.name); | ||
| 208 | }} | ||
| 209 | > | ||
| 210 | 删除 | ||
| 211 | </el-button> | ||
| 212 | </div> | ||
| 213 | ); | ||
| 214 | }, | ||
| 215 | }, | ||
| 216 | ]), | ||
| 217 | data: [], | ||
| 218 | }, | ||
| 219 | }; | ||
| 220 | }, | ||
| 221 | created () { | ||
| 222 | this.getTableList(); | ||
| 223 | }, | ||
| 224 | computed: { | ||
| 225 | departmentid () { | ||
| 226 | return this.$store.state.user.userInfo; | ||
| 227 | }, | ||
| 228 | }, | ||
| 229 | methods: { | ||
| 230 | handleAdd () { | ||
| 231 | this.isDialog = true | ||
| 232 | this.$refs.dialogForm.adds(); | ||
| 233 | this.$refs.dialogForm.title = "添加"; | ||
| 234 | }, | ||
| 235 | // 查询 | ||
| 236 | getTableList () { | ||
| 237 | this.queryParam = { | ||
| 238 | name: this.form.name, | ||
| 239 | code: this.form.code, | ||
| 240 | loginName: this.form.loginName, | ||
| 241 | }; | ||
| 242 | getUserLists(this.queryParam).then((res) => { | ||
| 243 | if (res.status === 1) { | ||
| 244 | this.loading = false; | ||
| 245 | this.tableData.data = res.content; | ||
| 246 | this.tableData.data = judgeSort(this.tableData.data); | ||
| 247 | let arr = [] | ||
| 248 | this.tableData.data.forEach((item) => { | ||
| 249 | arr.push(item.departmentId) | ||
| 250 | }) | ||
| 251 | this.getDepts(arr) | ||
| 252 | } else { | ||
| 253 | this.$message.error({ message: res.message, showClose: true }) | ||
| 254 | } | ||
| 255 | }) | ||
| 256 | }, | ||
| 257 | // 获取组织机构 | ||
| 258 | getDepts (deptIdArr) { | ||
| 259 | let params = { | ||
| 260 | queryOptions: { | ||
| 261 | conditionGroup: { | ||
| 262 | conditions: [ | ||
| 263 | { | ||
| 264 | property: "id", | ||
| 265 | value: deptIdArr, | ||
| 266 | operator: "IN", | ||
| 267 | }, | ||
| 268 | ], | ||
| 269 | queryRelation: "AND", | ||
| 270 | }, | ||
| 271 | orderBys: [], | ||
| 272 | }, | ||
| 273 | }; | ||
| 274 | getAction(api.departments, params).then( | ||
| 275 | (res) => { | ||
| 276 | let deptsList = res.content; | ||
| 277 | deptsList.forEach((ele) => { | ||
| 278 | this.tableData.data.forEach((item) => { | ||
| 279 | if (ele.id == item.departmentId) { | ||
| 280 | item.departmentName = ele.name | ||
| 281 | } | ||
| 282 | }) | ||
| 283 | }) | ||
| 284 | |||
| 285 | }, | ||
| 286 | (err) => { | ||
| 287 | console.log("err :", err); | ||
| 288 | } | ||
| 289 | ); | ||
| 290 | }, | ||
| 291 | // getTableList () { | ||
| 292 | // this.loading = true; | ||
| 293 | |||
| 294 | // getUserList().then((res) => { | ||
| 295 | // if (res.status === 1) { | ||
| 296 | // console.log("res人员列表", res); | ||
| 297 | // this.loading = false; | ||
| 298 | // this.tableData.data = res.content; | ||
| 299 | // this.tableData.data = judgeSort(this.tableData.data); | ||
| 300 | // } else { | ||
| 301 | // this.$message.error({ message: res.message, showClose: true }); | ||
| 302 | // } | ||
| 303 | // }); | ||
| 304 | // }, | ||
| 305 | |||
| 306 | // 重置用户密码 | ||
| 307 | resetPassword (data) { | ||
| 308 | const ids = [] | ||
| 309 | if (data instanceof Array) { | ||
| 310 | data.forEach((item) => { | ||
| 311 | ids.push(item.id) | ||
| 312 | }) | ||
| 313 | } else { | ||
| 314 | ids.push(data) | ||
| 315 | } | ||
| 316 | if (ids.length === 0) { | ||
| 317 | this.$message({ | ||
| 318 | message: '请选择需要重置密码的用户!', | ||
| 319 | showClose: true | ||
| 320 | }) | ||
| 321 | return | ||
| 322 | } | ||
| 323 | this.$confirm( | ||
| 324 | `<div class="customer-message-wrapper"> | ||
| 325 | <h5 class="title">确定要重置密码吗</h5> | ||
| 326 | <p class="result">执行后,数据将 | ||
| 327 | <span >无法恢复</span> | ||
| 328 | </p> | ||
| 329 | </div>`, | ||
| 330 | '执行确认', | ||
| 331 | { | ||
| 332 | dangerouslyUseHTMLString: true, | ||
| 333 | customClass: 'customer-delete', | ||
| 334 | confirmButtonText: '确定', | ||
| 335 | cancelButtonText: '取消', | ||
| 336 | type: 'warning' | ||
| 337 | } | ||
| 338 | ) | ||
| 339 | .then(() => { | ||
| 340 | resetPassword(ids).then((res) => { | ||
| 341 | if (res.status === 1) { | ||
| 342 | this.$message.success({ message: res.message, showClose: true }) | ||
| 343 | this.getTableList() | ||
| 344 | } else { | ||
| 345 | this.$message.error({ message: res.message, showClose: true }) | ||
| 346 | } | ||
| 347 | }) | ||
| 348 | }) | ||
| 349 | .catch(() => { }) | ||
| 350 | }, | ||
| 351 | //排序 | ||
| 352 | updateOrder (record, operate) { | ||
| 353 | const findIndex = this.tableData.data.findIndex(item => item.id === record.id) | ||
| 354 | let swapId = '' | ||
| 355 | if (operate === 'UP') { | ||
| 356 | swapId = this.tableData.data[findIndex - 1].id | ||
| 357 | } else if (operate === 'DOWN') { | ||
| 358 | swapId = this.tableData.data[findIndex + 1].id | ||
| 359 | } | ||
| 360 | updateOrder('/rest/users', record, operate, swapId).then(res => { | ||
| 361 | if (res.status === 1) { | ||
| 362 | this.$message.success({ message: res.message, showClose: true }) | ||
| 363 | this.getTableList(); | ||
| 364 | } else { | ||
| 365 | this.$message.error({ message: res.message, showClose: true }) | ||
| 366 | } | ||
| 367 | }) | ||
| 368 | }, | ||
| 369 | |||
| 370 | // 修改人员信息 | ||
| 371 | handleEdit (row) { | ||
| 372 | this.isDialog = true | ||
| 373 | this.$refs.dialogForm.edit(row); | ||
| 374 | this.$refs.dialogForm.title = "修改"; | ||
| 375 | }, | ||
| 376 | // 删除 | ||
| 377 | handleDelete (id, content) { | ||
| 378 | this.$confirm(deleteDomStr(content), '执行确认', { | ||
| 379 | dangerouslyUseHTMLString: true, | ||
| 380 | customClass: 'customer-delete', | ||
| 381 | confirmButtonText: '确定', | ||
| 382 | cancelButtonText: '取消', | ||
| 383 | type: 'warning' | ||
| 384 | }) | ||
| 385 | .then(() => { | ||
| 386 | 删除传 | ||
| 387 | deleteAction(`${api.users}/${id}`).then((res) => { | ||
| 388 | if (res.status === 1) { | ||
| 389 | this.$message.success({ message: res.message, showClose: true }) | ||
| 390 | } else { | ||
| 391 | this.$message.error({ message: res.message, showClose: true }) | ||
| 392 | } | ||
| 393 | this.getTableList() | ||
| 394 | }) | ||
| 395 | }) | ||
| 396 | .catch(() => { }) | ||
| 397 | }, | ||
| 398 | // 新增回显 | ||
| 399 | reloadTableData () { | ||
| 400 | this.getTableList() | ||
| 401 | }, | ||
| 402 | }, | ||
| 403 | }; | ||
| 404 | </script> | ||
| 405 | <style scoped lang="scss"> | ||
| 406 | @import "~@/styles/mixin.scss"; | ||
| 407 | </style> |
-
Please register or sign in to post a comment