feat:集成cas
Showing
33 changed files
with
403 additions
and
1476 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 => { | 
| ... | @@ -29,10 +43,4 @@ | ... | @@ -29,10 +43,4 @@ | 
| 29 | <div id="app"></div> | 43 | <div id="app"></div> | 
| 30 | </body> | 44 | </body> | 
| 31 | 45 | ||
| 32 | </html> | ||
| 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 | 
| 46 | </html> | ||
| ... | \ 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,80 +18,80 @@ | ... | @@ -19,80 +18,80 @@ | 
| 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 | 
| 28 | } | ||
| 29 | }, | ||
| 30 | watch: { | ||
| 31 | $route (route) { | ||
| 32 | // if you go to the redirect page, do not update the breadcrumbs | ||
| 33 | if (route.path.startsWith('/redirect/')) { | ||
| 34 | return | ||
| 35 | } | ||
| 36 | this.getBreadcrumb() | ||
| 37 | } | ||
| 38 | }, | ||
| 39 | created () { | ||
| 40 | this.getBreadcrumb() | ||
| 41 | }, | ||
| 42 | methods: { | ||
| 43 | getBreadcrumb () { | ||
| 44 | // only show routes with meta.title | ||
| 45 | let matched = this.$route.matched.filter(item => item.meta && item.meta.title) | ||
| 46 | const first = matched[0] | ||
| 47 | |||
| 48 | if (!this.isDashboard(first)) { | ||
| 49 | matched = matched | ||
| 50 | } | 27 | } | 
| 51 | |||
| 52 | this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false) | ||
| 53 | }, | 28 | }, | 
| 54 | isDashboard (route) { | 29 | watch: { | 
| 55 | const name = route && route.name | 30 | $route (route) { | 
| 56 | if (!name) { | 31 | // if you go to the redirect page, do not update the breadcrumbs | 
| 57 | return false | 32 | if (route.path.startsWith('/redirect/')) { | 
| 33 | return | ||
| 34 | } | ||
| 35 | this.getBreadcrumb() | ||
| 58 | } | 36 | } | 
| 59 | return name.trim().toLocaleLowerCase() === 'Dashboard'.toLocaleLowerCase() | ||
| 60 | }, | 37 | }, | 
| 61 | pathCompile (path) { | 38 | created () { | 
| 62 | const { params } = this.$route | 39 | this.getBreadcrumb() | 
| 63 | var toPath = pathToRegexp.compile(path) | ||
| 64 | return toPath(params) | ||
| 65 | }, | 40 | }, | 
| 66 | handleLink (item) { | 41 | methods: { | 
| 67 | const { redirect, path } = item | 42 | getBreadcrumb () { | 
| 68 | if (redirect) { | 43 | // only show routes with meta.title | 
| 69 | this.$router.push(redirect) | 44 | let matched = this.$route.matched.filter(item => item.meta && item.meta.title) | 
| 70 | return | 45 | const first = matched[0] | 
| 46 | |||
| 47 | if (!this.isDashboard(first)) { | ||
| 48 | matched = matched | ||
| 49 | } | ||
| 50 | |||
| 51 | this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false) | ||
| 52 | }, | ||
| 53 | isDashboard (route) { | ||
| 54 | const name = route && route.name | ||
| 55 | if (!name) { | ||
| 56 | return false | ||
| 57 | } | ||
| 58 | return name.trim().toLocaleLowerCase() === 'Dashboard'.toLocaleLowerCase() | ||
| 59 | }, | ||
| 60 | pathCompile (path) { | ||
| 61 | const { params } = this.$route | ||
| 62 | var toPath = pathToRegexp.compile(path) | ||
| 63 | return toPath(params) | ||
| 64 | }, | ||
| 65 | handleLink (item) { | ||
| 66 | const { redirect, path } = item | ||
| 67 | if (redirect) { | ||
| 68 | this.$router.push(redirect) | ||
| 69 | return | ||
| 70 | } | ||
| 71 | this.$router.push(this.pathCompile(path)) | ||
| 71 | } | 72 | } | 
| 72 | this.$router.push(this.pathCompile(path)) | ||
| 73 | } | 73 | } | 
| 74 | } | 74 | } | 
| 75 | } | ||
| 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; | 
| 83 | margin-left: 8px; | 82 | margin-left: 8px; | 
| 84 | 83 | ||
| 85 | .no-redirect { | 84 | .no-redirect { | 
| 86 | color: #ffffff; | 85 | color: #ffffff; | 
| 87 | cursor: text; | 86 | cursor: text; | 
| 88 | font-size: 16px; | 87 | font-size: 16px; | 
| 89 | } | 88 | } | 
| 90 | 89 | ||
| 91 | .breadcrumbIcon { | 90 | .breadcrumbIcon { | 
| 92 | color: #ffffff; | 91 | color: #ffffff; | 
| 93 | margin-right: 5px; | 92 | margin-right: 5px; | 
| 94 | width: 16px; | 93 | width: 16px; | 
| 95 | height: 16px; | 94 | height: 16px; | 
| 95 | } | ||
| 96 | } | 96 | } | 
| 97 | } | ||
| 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,18 +40,24 @@ | ... | @@ -39,18 +40,24 @@ | 
| 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) { | 
| 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 | } | ||
| 49 | }) | 58 | }) | 
| 50 | }) | 59 | } | 
| 51 | .catch((error) => { | 60 | }) | 
| 52 | // console.dir(error); | ||
| 53 | }) | ||
| 54 | } | 61 | } | 
| 55 | } | 62 | } | 
| 56 | } | 63 | } | ... | ... | 
| 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,70 +26,70 @@ | ... | @@ -26,70 +26,70 @@ | 
| 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], | 
| 39 | props: { | 39 | props: { | 
| 40 | // route object | 40 | // route object | 
| 41 | item: { | 41 | item: { | 
| 42 | type: Object, | 42 | type: Object, | 
| 43 | required: true | 43 | required: true | 
| 44 | }, | ||
| 45 | isNest: { | ||
| 46 | type: Boolean, | ||
| 47 | default: false | ||
| 48 | }, | ||
| 49 | basePath: { | ||
| 50 | type: String, | ||
| 51 | default: '' | ||
| 52 | } | ||
| 44 | }, | 53 | }, | 
| 45 | isNest: { | 54 | data () { | 
| 46 | type: Boolean, | 55 | // To fix https://github.com/PanJiaChen/vue-admin-template/issues/237 | 
| 47 | default: false | 56 | // TODO: refactor with render function | 
| 57 | this.onlyOneChild = null | ||
| 58 | return {} | ||
| 48 | }, | 59 | }, | 
| 49 | basePath: { | 60 | methods: { | 
| 50 | type: String, | 61 | hasOneShowingChild (children = [], parent) { | 
| 51 | default: '' | 62 | const showingChildren = children.filter(item => { | 
| 52 | } | 63 | if (item.hidden) { | 
| 53 | }, | 64 | return false | 
| 54 | data () { | 65 | } else { | 
| 55 | // To fix https://github.com/PanJiaChen/vue-admin-template/issues/237 | 66 | // Temp set(will be used if only has one showing child) | 
| 56 | // TODO: refactor with render function | 67 | this.onlyOneChild = item | 
| 57 | this.onlyOneChild = null | 68 | return true | 
| 58 | return {} | 69 | } | 
| 59 | }, | 70 | }) | 
| 60 | methods: { | 71 | // When there is only one child router, the child router is displayed by default | 
| 61 | hasOneShowingChild (children = [], parent) { | 72 | if (showingChildren.length >= 1 && (showingChildren[0].path == 'qxjr')) { | 
| 62 | const showingChildren = children.filter(item => { | ||
| 63 | if (item.hidden) { | ||
| 64 | return false | ||
| 65 | } else { | ||
| 66 | // Temp set(will be used if only has one showing child) | ||
| 67 | this.onlyOneChild = item | ||
| 68 | return true | 73 | return true | 
| 69 | } | 74 | } | 
| 70 | }) | ||
| 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")) { | ||
| 73 | return true | ||
| 74 | } | ||
| 75 | 75 | ||
| 76 | // Show parent if there are no child router to display | 76 | // Show parent if there are no child router to display | 
| 77 | if (showingChildren.length === 0) { | 77 | if (showingChildren.length === 0) { | 
| 78 | this.onlyOneChild = { ...parent, path: '', noShowingChildren: true } | 78 | this.onlyOneChild = { ...parent, path: '', noShowingChildren: true } | 
| 79 | return true | 79 | return true | 
| 80 | } | 80 | } | 
| 81 | 81 | ||
| 82 | return false | 82 | return false | 
| 83 | }, | 83 | }, | 
| 84 | resolvePath (routePath) { | 84 | resolvePath (routePath) { | 
| 85 | if (isExternal(routePath)) { | 85 | if (isExternal(routePath)) { | 
| 86 | return routePath | 86 | return routePath | 
| 87 | } | 87 | } | 
| 88 | if (isExternal(this.basePath)) { | 88 | if (isExternal(this.basePath)) { | 
| 89 | return this.basePath | 89 | return this.basePath | 
| 90 | } | ||
| 91 | return path.resolve(this.basePath, routePath) | ||
| 90 | } | 92 | } | 
| 91 | return path.resolve(this.basePath, routePath) | ||
| 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" /> --> | ... | ... | 
This diff is collapsed.
Click to expand it.
| ... | @@ -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') { | 
| 26 | } else { | 28 | if (token) { | 
| 27 | let code = Vue.prototype.BASE_API.CODE | 29 | next('/') | 
| 28 | //判断token是否存在 | 30 | } else { | 
| 29 | const hasToken = localStorage.getItem("token"); | 31 | next() | 
| 30 | if (hasToken) { | 32 | } | 
| 31 | //请求用户信息 | 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) | ||
| 48 | } else { | ||
| 49 | Cookies.set('token', res.data.content.accessToken) | ||
| 50 | } | ||
| 51 | window.location.href = localStorage.getItem('location') | ||
| 52 | |||
| 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) | 
| 56 | } | 89 | } | 
| 57 | } | 90 | } | 
| 58 | } else { | ||
| 59 | next('/login') | ||
| 60 | } | 91 | } | 
| 92 | } else { | ||
| 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 | }; | ||
| 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: | 
| 14 | withCredentials: true, //是否允许跨域 | 16 | process.env.NODE_ENV == "development" | 
| 15 | headers: { | 17 | ? process.env.VUE_APP_BASE_API | 
| 16 | "Content-Type": "application/json; charset=utf-8", | 18 | : window._config.baseUrl + "/", | 
| 17 | }, | 19 | withCredentials: true, //是否允许跨域 | 
| 18 | 20 | headers: { | |
| 19 | timeout: 15000, | 21 | 'Content-Type': 'application/json; charset=utf-8' | 
| 20 | }); | 22 | }, | 
| 23 | timeout: 15000 | ||
| 24 | }) | ||
| 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) { | 
| 29 | }, | 33 | config.headers['Authorization'] = 'Bearer ' + token | 
| 30 | (error) => { | 34 | } else { | 
| 31 | Message.error("请求超时!"); | 35 | config.headers.delete('Authorization') | 
| 32 | return Promise.reject(error); | 36 | } | 
| 33 | } | 37 | } else { | 
| 34 | ); | 38 | const token = Cookies.get('token') | 
| 35 | 39 | // 添加请求头 | |
| 36 | window.tokenValid = true | 40 | if (token) { | 
| 41 | config.headers['Authorization'] = 'Bearer ' + token | ||
| 42 | } else { | ||
| 43 | config.headers.delete('Authorization') | ||
| 44 | } | ||
| 45 | } | ||
| 46 | return config | ||
| 47 | }, | ||
| 48 | error => { | ||
| 49 | // do something with request error | ||
| 50 | console.log(error); // for debug | ||
| 51 | return Promise.reject(error); | ||
| 52 | } | ||
| 53 | ) | ||
| 54 | window.__isNeedLogin = 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把数据返出去 | 
| 43 | * 如果请求不成功,就在拦截器这里统一处理(组件的代码就不用关注错误的情况了) | 61 | * 如果请求不成功,就在拦截器这里统一处理(组件的代码就不用关注错误的情况了) | 
| 44 | */ | 62 | */ | 
| 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({ | 67 | } | 
| 50 | message: "请求失败", | 68 | return response; | 
| 51 | type: "error", | 69 | }, | 
| 52 | duration: 5 * 1000, | 70 | error => { | 
| 53 | }); | 71 | endLoadingSubCount() | 
| 72 | if (error.response.status === 401) { | ||
| 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') | ||
| 82 | } | ||
| 83 | |||
| 84 | if (window._config.casEnable) { | ||
| 85 | window.location.href = window._config.casBaseURL + '/logout?service=' + encodeURIComponent(locationUrl); | ||
| 86 | } else { | ||
| 87 | Router.replace({ | ||
| 88 | path: '/login', | ||
| 89 | query: { | ||
| 90 | redirect: Router.currentRoute.value.fullPath | ||
| 91 | } | ||
| 92 | }) | ||
| 93 | return false | ||
| 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); | ||
| 54 | } | 107 | } | 
| 55 | return response; | 108 | ) | 
| 56 | }, | ||
| 57 | (error) => { | ||
| 58 | handleErrorData(error.response.status); | ||
| 59 | endLoadingSubCount(); | ||
| 60 | return Promise.reject(error); | ||
| 61 | } | ||
| 62 | ); | ||
| 63 | //对错误信息的处理函数 | 109 | //对错误信息的处理函数 | 
| 64 | function handleErrorData (status) { | 110 | function handleErrorData (errMes) { | 
| 65 | switch (status) { | 111 | if (errMes.message) { | 
| 66 | case 401: | 112 | Message.error(errMes.message); | 
| 67 | // 多个请求不重复提示错误信息 | 113 | } else { | 
| 68 | if (window.tokenValid) { | 114 | switch (errMes.code) { | 
| 69 | window.tokenValid = false; | 115 | case 401: | 
| 70 | Message.error("由于长时间未操作,请重新登录!"); | 116 | Message.error("未授权,请重新登录!"); | 
| 71 | localStorage.removeItem("token"); | 117 | break; | 
| 72 | router.replace({ | 118 | case 403: | 
| 73 | path: "/login", | 119 | Message.error("拒绝访问"); | 
| 74 | query: { | 120 | break; | 
| 75 | redirect: router.history.current.fullPath, | 121 | case 404: | 
| 76 | } | 122 | Message.error("很抱歉,资源未找到!"); | 
| 77 | }) | 123 | break; | 
| 78 | } | 124 | case 500: | 
| 79 | break; | 125 | Message.error("服务器错误!"); | 
| 80 | case 404: | 126 | break; | 
| 81 | Message.error("很抱歉,资源未找到!"); | 127 | default: | 
| 82 | break; | 128 | Message.error("服务正在联调中,请稍后!"); | 
| 83 | case 500: | 129 | break; | 
| 84 | Message.error("服务器错误!"); | 130 | } | 
| 85 | break; | 131 | } | 
| 86 | default: | ||
| 87 | Message.error("服务正在联调中,请稍后!"); | ||
| 88 | break; | ||
| 89 | } | ||
| 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"> | 
| ... | @@ -141,8 +137,8 @@ | ... | @@ -141,8 +137,8 @@ | 
| 141 | pageSize: 10, | 137 | pageSize: 10, | 
| 142 | current: 1 | 138 | current: 1 | 
| 143 | }, | 139 | }, | 
| 144 | // 表格数据 | 140 | // 表格数据 | 
| 145 | tableData: { | 141 | tableData: { | 
| 146 | // 表头数据 | 142 | // 表头数据 | 
| 147 | columns: [ | 143 | columns: [ | 
| 148 | { | 144 | { | ... | ... | 
| 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
This diff is collapsed.
Click to expand it.
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
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
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
This diff is collapsed.
Click to expand it.
- 
Please register or sign in to post a comment