From 694ffa950bf2435affef95272c7bfd6b62704639 Mon Sep 17 00:00:00 2001 From: 王震 <10952869+daywangzhen@user.noreply.gitee.com> Date: 星期一, 28 八月 2023 11:10:02 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/laboratory/measure/index.vue | 20 src/api/laboratory/role.js | 17 src/views/basicData/index.vue | 36 src/views/standardLibrary/index.vue | 121 +- src/components/experiment/checkTheReport/index.vue | 42 src/views/login/index.vue | 55 src/layout/components/Navbar.vue | 10 src/layout/index.vue | 132 ++- src/views/laboratory/role/index.vue | 483 +++++++++++++ src/layout/components/Sidebar/Item.vue | 3 src/views/laboratory/personnel/index.vue | 2 src/router/index.js | 1021 ++++++++++++++++------------- src/components/Breadcrumb/index.vue | 4 src/utils/request.js | 25 .env.development | 4 src/views/home/index.vue | 2 src/views/laboratory/measure/Add.vue | 2 src/views/experiment/checkTheReport/index.vue | 9 18 files changed, 1,308 insertions(+), 680 deletions(-) diff --git a/.env.development b/.env.development index 4589431..ab9be2d 100644 --- a/.env.development +++ b/.env.development @@ -2,6 +2,4 @@ ENV = 'development' # base api -# VUE_APP_BASE_API = 'http://192.168.0.4:1234/' -VUE_APP_BASE_API = 'http://192.168.110.107:1234/' - +VUE_APP_BASE_API = 'http://localhost:1234/' diff --git a/src/api/laboratory/role.js b/src/api/laboratory/role.js index 9744850..eba1b01 100644 --- a/src/api/laboratory/role.js +++ b/src/api/laboratory/role.js @@ -31,4 +31,21 @@ method: 'get', params }) + } + + export function deleteRole(params) { + return request({ + url: '/role-manager/deleteRole', + method: 'get', + params + }) + } + + //updateRoleMenu + export function updateRoleMenu(data) { + return request({ + url: '/role-manager/updateRoleMenu', + method: 'post', + data + }) } \ No newline at end of file diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index 3c4c407..ed6144a 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -11,8 +11,8 @@ </el-breadcrumb> </el-col> <el-col :span="12" style="background-color: #fff;display: flex;justify-content: end; align-items: center;"> - <el-button v-if="backPlan" type="primary" icon="el-icon-refresh-left" size="mini" plain @click="backPlanUp">杩斿洖</el-button> - <el-button v-if="add" size="mini" @click="breadd" style="width: 60px;" type="primary">淇濆瓨</el-button> + <!-- <el-button v-if="backPlan" type="primary" icon="el-icon-refresh-left" size="mini" plain @click="backPlanUp">杩斿洖</el-button> --> + <!-- <el-button v-if="add" size="mini" @click="breadd" style="width: 60px;" type="primary">淇濆瓨</el-button> --> <el-col :span="1"></el-col> </el-col> </div> diff --git a/src/components/experiment/checkTheReport/index.vue b/src/components/experiment/checkTheReport/index.vue index fe7d0f5..3c005d9 100644 --- a/src/components/experiment/checkTheReport/index.vue +++ b/src/components/experiment/checkTheReport/index.vue @@ -5,7 +5,7 @@ </div> <div class="center"> <h1>鍘熸潗鏂欐娴嬫姤鍛�</h1> - <table> + <table height="30px"> <tr> <td>鏉愭枡鍚嶇О</td> <td colspan="5">{{reportData.name}}</td> @@ -26,7 +26,9 @@ </tr> <tr> <td>妫�娴嬩緷鎹�</td> - <td colspan="2">{{reportData.specifications.split("-")[0]}}</td> + <td colspan="2"> + {{reportData.specifications.split("-")[0]}} + </td> <td>妫�娴嬬被鍒�</td> <td colspan="2">鍘熸潗鏂�</td> </tr> @@ -44,7 +46,7 @@ <td>{{item.unit}}</td> <td>{{item.required}}</td> <td>{{item.testValue}}</td> - <td>{{item.testState == 1 ? "鈭�" : "X"}}</td> + <td>{{item.testState === 1 ? "鈭�" : "X"}}</td> </tr> <tr> <td colspan="6">妫�楠岀粨璁猴細{{reportData.type == 1 ? "鍚堟牸" : "涓嶅悎鏍�"}}</td> @@ -55,14 +57,14 @@ </td> </tr> </table> - <el-row class="date-group" :gutter="20"> - <el-col :span="12">妫�娴嬨�佹棩鏈燂細<span>{{reportData.createTime}}</span></el-col> - <el-col :span="12">瀹℃牳銆佹棩鏈燂細<span>{{reportData.checkTime}}</span></el-col> + <el-row class="date-group"> + <p>妫�娴嬨�佹棩鏈燂細<span>{{reportData.createTime}}</span></p> + <p>瀹℃牳銆佹棩鏈燂細<span>{{reportData.checkTime}}</span></p> </el-row> <p class="footer"> - <span>缂栧彿:</span><span>{{reportData.reportCode}}</span> - <span> 鍙戣鏃ユ湡:</span><span>{{new Date() | formatDate}}</span> - <span> 淇濆瓨鏈熼檺:</span><span>闀挎湡</span> + <span>缂栧彿锛�</span><span>{{reportData.rcode}} </span> + <span>鍙戣鏃ユ湡锛�</span><span>{{now}} </span> + <span>淇濆瓨鏈熼檺锛�</span><span>闀挎湡</span> </p> </div> </div> @@ -72,6 +74,7 @@ data() { return { logoSrc : require("@/assets/404_images/logo.png"), + now: new Date().toLocaleDateString() } }, methods:{ @@ -107,7 +110,6 @@ } table{ width:100%; - height:100vh; border-collapse: collapse; font-size: 18px; } @@ -115,19 +117,23 @@ border: 2px solid black; } tr,td,th{ - padding: 5px 5px; + padding: 10px 10px; } - .date-group .el-col{ - text-align: center; - padding: 50px 0px; - font-size: 18px; + .date-group{ + width: 90%; + margin-left: 5%; + p{ + width: 50%; + float: left; + text-align: center; + padding: 50px 0px; + font-size: 18px; + } } .footer{ - margin: 0; - padding: 0; width:90%; margin-left: 5%; - color: gray; + color: lightgray; text-align: center; margin-top: 250px; } diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index dd146bb..ba4d987 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -64,6 +64,10 @@ newPwd: '', confirmPwd: '' }, + user: { + id: null, + name: 'value' + }, dialogFormVisible: false, formLabelWidth: '120px', user: { @@ -103,11 +107,15 @@ }, async logout() { // await this.$store.dispatch('user/logout') - this.$router.push(`/login?redirect=${this.$route.fullPath}`) + sessionStorage.removeItem("user") + this.$router.push(`/login?redirect=${this.$route.fullPath}`) + this.$router.replace({path: '/login'}); + location.reload(); }, getUser(){ get(this.$url.info).then(res=>{ this.user = res.data + sessionStorage.setItem("user",JSON.stringify(res.data)) }) } } diff --git a/src/layout/components/Sidebar/Item.vue b/src/layout/components/Sidebar/Item.vue index 454e81b..effef3c 100644 --- a/src/layout/components/Sidebar/Item.vue +++ b/src/layout/components/Sidebar/Item.vue @@ -16,6 +16,9 @@ default: '' } }, + created(){ + + }, render(h, context) { const { icon, title } = context.props const vnodes = [] diff --git a/src/layout/index.vue b/src/layout/index.vue index 37ab14d..3424c5b 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -1,18 +1,18 @@ <template> <div :class="classObj" class="app-wrapper"> - <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" /> + <div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside" /> <sidebar class="sidebar-container" /> <div class="main-container"> - <div :class="{'fixed-header':fixedHeader}"> + <div :class="{ 'fixed-header': fixedHeader }"> <navbar /> </div> <div class="clearFixed" /> <!-- 娓呴櫎瀹氫綅鐨勫奖鍝� --> <div class="breadcrumb"> - <Breadcrumb class="breadcrumb-container" ref="breadcrumb" /> + <Breadcrumb class="breadcrumb-container" ref="breadcrumb" /> </div> <div class="app-main"> - <app-main ref="main" @triggerCombackBtn="triggerCombackBtn"/> + <app-main ref="main" @triggerCombackBtn="triggerCombackBtn" /> </div> </div> </div> @@ -51,20 +51,26 @@ } } }, + created() { + if (sessionStorage.getItem("flushPage") == 0) { + location.reload(); + sessionStorage.setItem("flushPage",1) + } + }, methods: { handleClickOutside() { this.$store.dispatch('app/closeSideBar', { withoutAnimation: false }) }, - combackPlan(){ - this.$refs.main.childMethod() + combackPlan() { + this.$refs.main.childMethod() }, - indexAdd(){ + indexAdd() { this.$refs.main.mainAdd() }, - showIndexAdd(){ + showIndexAdd() { this.$refs.breadcrumb.showadd() }, - triggerCombackBtn(){ + triggerCombackBtn() { this.$refs.breadcrumb.triggerBtnPlan() } } @@ -72,63 +78,69 @@ </script> <style lang="scss" scoped> - @import "~@/styles/mixin.scss"; - @import "~@/styles/variables.scss"; +@import "~@/styles/mixin.scss"; +@import "~@/styles/variables.scss"; - .app-wrapper { - @include clearfix; - position: relative; - height: 100%; - width: 100%; - &.mobile.openSidebar{ - position: fixed; - top: 0; - } - .sidebar-container{ - box-shadow: 0 0 0.857143rem rgba(0,0,0,.12); - } - .main-container{ - position: relative; - background: #f0f2f5; - .clearFixed{ - height: 50px; - } - .breadcrumb{ - position: fixed; - left: 0.57rem !important; - width: 93.8%; - z-index: 999; - } - .app-main{ - margin-top: 4vh; - } - } - } - .drawer-bg { - background: #000; - opacity: 0.3; - width: 100%; - top: 0; - height: 100%; - position: absolute; - z-index: 999; - } +.app-wrapper { + @include clearfix; + position: relative; + height: 100%; + width: 100%; - .fixed-header { + &.mobile.openSidebar { position: fixed; top: 0; - right: 0; - z-index: 9; - width: calc(100% - #{$sideBarWidth}); - // width: calc(100% - 100px); - transition: width 0.28s; } - .hideSidebar .fixed-header { - width: calc(100% - #{$sideBarWidth}) + .sidebar-container { + box-shadow: 0 0 0.857143rem rgba(0, 0, 0, .12); } - .mobile .fixed-header { - width: 100%; + .main-container { + position: relative; + background: #f0f2f5; + + .clearFixed { + height: 50px; + } + + .breadcrumb { + position: fixed; + left: 0.57rem !important; + width: 93.8%; + z-index: 999; + } + + .app-main { + margin-top: 4vh; + } } -</style> +} + +.drawer-bg { + background: #000; + opacity: 0.3; + width: 100%; + top: 0; + height: 100%; + position: absolute; + z-index: 999; +} + +.fixed-header { + position: fixed; + top: 0; + right: 0; + z-index: 9; + width: calc(100% - #{$sideBarWidth}); + // width: calc(100% - 100px); + transition: width 0.28s; +} + +.hideSidebar .fixed-header { + width: calc(100% - #{$sideBarWidth}) +} + +.mobile .fixed-header { + width: 100%; +}</style> diff --git a/src/router/index.js b/src/router/index.js index 6e2fc1e..5f0ac20 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -30,469 +30,588 @@ * a base page that does not have permission requirements * all roles can be accessed */ -export const constantRoutes = [ - { - path: '/login', - component: () => import('@/views/login/index'), - hidden: true - }, - { - path: '/404', - component: () => import('@/views/404'), - hidden: true - }, - { - path: '/addCommision', - component: () => import('@/views/inspectionManagement/commissionInspection/addCommision'), - hidden:true - }, - { - path: '/testReport', - component: () => import('@/views/template_testReport/index'), - hidden:true - }, - { - path: '/', - component: Layout, - redirect: '/home', - // meta: { title: '涓婚〉', icon: 'el-icon-s-home' }, - children: [{ - path: 'home', - name: 'Home', - component: () => import('@/views/home/index'), - meta: { title: '涓婚〉', icon: 'el-icon-s-home' } - }] - }, - { - path: '/addCommision/:viewId', - hidden: true, - component: () => import('@/views/inspectionManagement/commissionInspection/addCommision'), - }, - { - path: '/standardLibrary', - component: Layout, - redirect: '/standardLibrary/index', - meta: { title: '鏍囧噯搴�', icon: 'el-icon-s-help' }, - children: [ - { - path: 'index', - name: 'StandardLibrary', - component: () => import('@/views/standardLibrary/index'), - meta: { title: '鏍囧噯搴�', icon: 'form' } - }, - { - path: 'specificationDetails/:id', - name: 'SpecificationDetails', - // hidden: true, - component: () => import('@/views/standardLibrary/SpecificationDetails'), - meta: { title: '浜у搧瑙勬牸璇︽儏', icon: 'form', show: false } - } - ] - }, - // { - // path: '/rawMaterials', - // component: Layout, - // redirect: '/rawMaterials/reportForInspection', - // name: 'rawMaterials', - // meta: { title: '妫�楠�', icon: 'el-icon-s-help' }, - // children: [ - // { - // path: 'reportForInspection', - // name: 'ReportForInspection', - // component: () => import('@/views/rawMaterials/reportForInspection/index'), - // meta: { title: '鍘熸潗鏂欐姤妫�', icon: 'table' }, - // children: [ - // // { - // // path: 'index', - // // name: 'ReportForInspectionIndex', - // // // hidden: true, - // // component: () => import('@/views/rawMaterials/reportForInspection/index'), - // // meta: { title: '鍘熸潗鏂欐姤妫�', icon: 'table' } - // // }, - // { - // path: 'forInspectionDetail', - // name: 'ForInspectionDetail', - // hidden: true, - // component: () => import('@/views/rawMaterials/reportForInspection/forInspectionDetail'), - // meta: { title: '鏂板妫�楠屽崟璇︽儏', icon: 'table' } - // } - // ] - // }, - // { - // path: 'print', - // name: 'Print', - // component: () => import('@/views/rawMaterials/print/index'), - // meta: { title: '鏉$爜鎵撳嵃', icon: 'tree' } - // }, - // { - // path: 'planAssignments', - // name: 'PlanAssignments', - // component: () => import('@/views/rawMaterials/planAssignments/index'), - // meta: { title: '妫�楠岃鍒掑垎閰�', icon: 'tree' } - // }, - // { - // path: 'rawMaterialInspection', - // name: 'RawMaterialInspection', - // component: () => import('@/views/rawMaterials/rawMaterialInspection/index'), - // meta: { title: '鍘熸潗鏂欐楠�', icon: 'tree' } - // }, - // { - // path: 'checkTheReport', - // name: 'CheckTheReport', - // component: () => import('@/views/rawMaterials/checkTheReport/index'), - // meta: { title: '妫�楠屾姤鍛�', icon: 'tree' } - // }, - // { - // path: 'reportAuditing', - // name: 'ReportAuditing', - // component: () => import('@/views/rawMaterials/reportAuditing/index'), - // meta: { title: '鎶ュ憡瀹℃牳', icon: 'tree' } - // }, - // { - // path: 'nonConformanceReview', - // name: 'NonConformanceReview', - // component: () => import('@/views/rawMaterials/nonConformanceReview/index'), - // meta: { title: '涓嶅悎鏍煎弽棣�', icon: 'tree' } - // }, - // { - // path: 'nonConformingFeedback', - // name: 'NonConformingFeedback', - // component: () => import('@/views/rawMaterials/nonConformingFeedback/index'), - // meta: { title: '涓嶅悎鏍艰瘎瀹�', icon: 'tree' } - // }, - // { - // path: 'passRateStatistics', - // name: 'PassRateStatistics', - // component: () => import('@/views/rawMaterials/passRateStatistics/index'), - // meta: { title: '鍚堟牸鐜囩粺璁�', icon: 'tree' } - // } - // ] - // }, - { - path: '/inspectionManagement', - component: Layout, - redirect: '/inspectionManagement/commissionInspection', - name: 'InspectionManagement', - meta: { title: '鎶ユ绠$悊', icon: 'el-icon-s-help' }, - children: [ - { - path: 'commissionInspection', - name: 'CommissionInspection', - component: () => import('@/views/inspectionManagement/commissionInspection/index'), - meta: { title: '濮旀墭妫�楠�', icon: 'table' } - }, - { - path: 'reportForInspection', - name: 'ReportForInspection', - component: () => import('@/views/inspectionManagement/reportForInspection/index'), - meta: { title: '鍘熸潗鏂欐姤妫�', icon: 'tree' } - } - ] - }, - { - path: '/experiment', - component: Layout, - redirect: '/experiment/inspectionApplication', - name: 'Experiment', - meta: { title: '璇曢獙绠$悊', icon: 'el-icon-s-help' }, - children: [ - { - path: 'inspectionApplication', - name: 'inspectionApplication', - component: () => import('@/views/experiment/inspectionApplication/index'), - meta: { title: '鏂板妫�楠�', icon: 'tree' } - }, +function getRoutes() { + let constantRoutes = [ + { + path: '/login', + component: () => import('@/views/login/index'), + hidden: true + }, + { + path: '/404', + component: () => import('@/views/404'), + hidden: true + }, + { + path: '/addCommision', + component: () => import('@/views/inspectionManagement/commissionInspection/addCommision'), + hidden: true + }, + { + path: '/', + component: Layout, + redirect: '/home', + // meta: { title: '涓婚〉', icon: 'el-icon-s-home' }, + children: [{ + path: 'home', + name: 'Home', + component: () => import('@/views/home/index'), + meta: { title: '涓婚〉', icon: 'el-icon-s-home' } + }] + }, + { + path: '/addCommision/:viewId', + hidden: true, + component: () => import('@/views/inspectionManagement/commissionInspection/addCommision'), + }, + { + path: '/standardLibrary', + component: Layout, + redirect: '/standardLibrary/index', + meta: { title: '鏍囧噯搴�', icon: 'el-icon-s-help' }, + children: [ + { + path: 'index', + name: 'StandardLibrary', + component: () => import('@/views/standardLibrary/index'), + meta: { title: '鏍囧噯搴�', icon: 'form' } + }, + { + path: 'specificationDetails/:id', + name: 'SpecificationDetails', + // hidden: true, + component: () => import('@/views/standardLibrary/SpecificationDetails'), + meta: { title: '浜у搧瑙勬牸璇︽儏', icon: 'form', show: false } + } + ] + }, + // { + // path: '/rawMaterials', + // component: Layout, + // redirect: '/rawMaterials/reportForInspection', + // name: 'rawMaterials', + // meta: { title: '妫�楠�', icon: 'el-icon-s-help' }, + // children: [ + // { + // path: 'reportForInspection', + // name: 'ReportForInspection', + // component: () => import('@/views/rawMaterials/reportForInspection/index'), + // meta: { title: '鍘熸潗鏂欐姤妫�', icon: 'table' }, + // children: [ + // // { + // // path: 'index', + // // name: 'ReportForInspectionIndex', + // // // hidden: true, + // // component: () => import('@/views/rawMaterials/reportForInspection/index'), + // // meta: { title: '鍘熸潗鏂欐姤妫�', icon: 'table' } + // // }, + // { + // path: 'forInspectionDetail', + // name: 'ForInspectionDetail', + // hidden: true, + // component: () => import('@/views/rawMaterials/reportForInspection/forInspectionDetail'), + // meta: { title: '鏂板妫�楠屽崟璇︽儏', icon: 'table' } + // } + // ] + // }, + // { + // path: 'print', + // name: 'Print', + // component: () => import('@/views/rawMaterials/print/index'), + // meta: { title: '鏉$爜鎵撳嵃', icon: 'tree' } + // }, + // { + // path: 'planAssignments', + // name: 'PlanAssignments', + // component: () => import('@/views/rawMaterials/planAssignments/index'), + // meta: { title: '妫�楠岃鍒掑垎閰�', icon: 'tree' } + // }, + // { + // path: 'rawMaterialInspection', + // name: 'RawMaterialInspection', + // component: () => import('@/views/rawMaterials/rawMaterialInspection/index'), + // meta: { title: '鍘熸潗鏂欐楠�', icon: 'tree' } + // }, + // { + // path: 'checkTheReport', + // name: 'CheckTheReport', + // component: () => import('@/views/rawMaterials/checkTheReport/index'), + // meta: { title: '妫�楠屾姤鍛�', icon: 'tree' } + // }, + // { + // path: 'reportAuditing', + // name: 'ReportAuditing', + // component: () => import('@/views/rawMaterials/reportAuditing/index'), + // meta: { title: '鎶ュ憡瀹℃牳', icon: 'tree' } + // }, + // { + // path: 'nonConformanceReview', + // name: 'NonConformanceReview', + // component: () => import('@/views/rawMaterials/nonConformanceReview/index'), + // meta: { title: '涓嶅悎鏍煎弽棣�', icon: 'tree' } + // }, + // { + // path: 'nonConformingFeedback', + // name: 'NonConformingFeedback', + // component: () => import('@/views/rawMaterials/nonConformingFeedback/index'), + // meta: { title: '涓嶅悎鏍艰瘎瀹�', icon: 'tree' } + // }, + // { + // path: 'passRateStatistics', + // name: 'PassRateStatistics', + // component: () => import('@/views/rawMaterials/passRateStatistics/index'), + // meta: { title: '鍚堟牸鐜囩粺璁�', icon: 'tree' } + // } + // ] + // }, + { + path: '/inspectionManagement', + component: Layout, + redirect: '/inspectionManagement/commissionInspection', + name: 'InspectionManagement', + meta: { title: '鎶ユ绠$悊', icon: 'el-icon-s-help' }, + children: [ + { + path: 'commissionInspection', + name: 'CommissionInspection', + component: () => import('@/views/inspectionManagement/commissionInspection/index'), + meta: { title: '濮旀墭妫�楠�', icon: 'table' } + }, + { + path: 'reportForInspection', + name: 'ReportForInspection', + component: () => import('@/views/inspectionManagement/reportForInspection/index'), + meta: { title: '鍘熸潗鏂欐姤妫�', icon: 'tree' } + } + ] + }, + { + path: '/experiment', + component: Layout, + redirect: '/experiment/inspectionApplication', + name: 'Experiment', + meta: { title: '璇曢獙绠$悊', icon: 'el-icon-s-help' }, + children: [ + { + path: 'inspectionApplication', + name: 'inspectionApplication', + component: () => import('@/views/experiment/inspectionApplication/index'), + meta: { title: '鏂板妫�楠�', icon: 'tree' } + }, { path: 'Viewdetails', name: 'Viewdetails', - hidden: true , + hidden: true, component: () => import('@/views/experiment/inspectionApplication/Viewdetails/index'), meta: { title: '璇︽儏椤�', icon: 'tree' } }, - { - path: 'planAssignments', - name: 'PlanAssignments', - component: () => import('@/views/experiment/planAssignments/plan'), - meta: { title: '妫�楠岃鍒�', icon: 'tree' } - }, - { - path: 'checkTheReport', - name: 'CheckTheReport', - component: () => import('@/views/experiment/checkTheReport/index'), - meta: { title: '妫�楠屾姤鍛�', icon: 'tree' } - }, - { - path: 'reportAuditing', - name: 'ReportAuditing', - component: () => import('@/views/experiment/reportAuditing/index'), - meta: { title: '鎶ュ憡瀹℃牳', icon: 'tree' } - }, - { - path: 'nonConformanceReview', - name: 'NonConformanceReview', - component: () => import('@/views/experiment/nonConformanceReview/index'), - meta: { title: '涓嶅悎鏍煎搧鍙嶉', icon: 'tree' } - }, - { - path: 'nonConformingFeedback', - name: 'NonConformingFeedback', - component: () => import('@/views/experiment/nonConformingFeedback/index'), - meta: { title: '涓嶅悎鏍煎搧璇勫', icon: 'tree' } - }, - { - path: 'passRateStatistics', - name: 'PassRateStatistics', - component: () => import('@/views/experiment/passRateStatistics/index'), - meta: { title: '鍚堟牸鐜囩粺璁�', icon: 'tree' } - } - ] - }, - // { - // path: '/finishedProduct', - // component: Layout, - // redirect: '/finishedProduct/reportForInspection', - // name: 'FinishedProduct', - // meta: { title: '鎴愬搧妫�楠�', icon: 'el-icon-s-help' }, - // children: [ - // { - // path: 'reportForInspection', - // name: 'ReportForInspection', - // component: () => import('@/views/rawMaterials/reportForInspection/index'), - // meta: { title: '鎴愬搧閫佹鐧昏', icon: 'table' } - // }, - // { - // path: 'print', - // name: 'Print', - // component: () => import('@/views/rawMaterials/print/index'), - // meta: { title: '鏉$爜鎵撳嵃', icon: 'tree' } - // }, - // { - // path: 'planAssignments', - // name: 'PlanAssignments', - // component: () => import('@/views/rawMaterials/planAssignments/index'), - // meta: { title: '妫�楠岃鍒掑垎閰�', icon: 'tree' } - // }, - // { - // path: 'rawMaterialInspection', - // name: 'RawMaterialInspection', - // component: () => import('@/views/rawMaterials/rawMaterialInspection/index'), - // meta: { title: '鎴愬搧妫�楠�', icon: 'tree' } - // }, - // { - // path: 'checkTheReport', - // name: 'CheckTheReport', - // component: () => import('@/views/rawMaterials/checkTheReport/index'), - // meta: { title: '妫�楠屾姤鍛�', icon: 'tree' } - // }, - // { - // path: 'reportAuditing', - // name: 'ReportAuditing', - // component: () => import('@/views/rawMaterials/reportAuditing/index'), - // meta: { title: '鎶ュ憡瀹℃牳', icon: 'tree' } - // }, - // { - // path: 'nonConformanceReview', - // name: 'NonConformanceReview', - // component: () => import('@/views/rawMaterials/nonConformanceReview/index'), - // meta: { title: '涓嶅悎鏍煎弽棣�', icon: 'tree' } - // }, - // { - // path: 'nonConformingFeedback', - // name: 'NonConformingFeedback', - // component: () => import('@/views/rawMaterials/nonConformingFeedback/index'), - // meta: { title: '涓嶅悎鏍艰瘎瀹�', icon: 'tree' } - // }, - // { - // path: 'passRateStatistics', - // name: 'PassRateStatistics', - // component: () => import('@/views/rawMaterials/passRateStatistics/index'), - // meta: { title: '鍚堟牸鐜囩粺璁�', icon: 'tree' } - // } - // ] - // }, - { - path: '/laboratory', - component: Layout, - redirect: '/laboratory/ledger', - name: 'Laboratory', - meta: { title: '瀹為獙瀹ょ鐞�', icon: 'el-icon-s-help' }, - children: [ - { - path: 'ledger', - name: 'Ledger', - component: () => import('@/views/laboratory/ledger/index'), - meta: { title: '璁惧鍙拌处', icon: 'table' } - }, - { - path: 'measure', - name: 'Measure', - component: () => import('@/views/laboratory/measure/index'), - meta: { title: '璁¢噺绠$悊', icon: 'tree' } - }, - { - path: 'gather', - name: 'Gather', - component: () => import('@/views/laboratory/gather/index'), - meta: { title: '璁惧閲囬泦', icon: 'tree' } - }, - { - path: 'personnel', - name: 'Personnel', - component: () => import('@/views/laboratory/personnel/index'), - meta: { title: '浜哄憳绠$悊', icon: 'tree' } - }, - { - path: 'org', - name: 'Organizational', - component: () => import('@/views/laboratory/organizational/index.vue'), - meta: { title: '缁勭粐鏋舵瀯', icon: 'tree'} - }, - { - path: 'role', - name: 'Role', - component: () => import('@/views/laboratory/role/index'), - meta: { title: '瑙掕壊绠$悊', icon: 'tree' } - } - ] - }, - { - path: '/CNAS', - component: Layout, - redirect: '/CNAS/reviewAnnualPlan', - name: 'CNAS', - meta: { title: 'CNAS绠$悊', icon: 'el-icon-s-help' }, - children: [ - { - path: 'reviewAnnualPlan', - name: 'ReviewAnnualPlan', - component: () => import('@/views/CNAS/reviewAnnualPlan/index'), - meta: { title: '瀹℃牳骞村害璁″垝', icon: 'table' } - }, - { - path: 'nonConformanceManage', - name: 'NonConformanceManage', - component: () => import('@/views/CNAS/nonConformanceManage/index'), - meta: { title: '涓嶇鍚堥」绠$悊', icon: 'tree' } - }, - { - path: 'nonConformanceStatistics', - name: 'NonConformanceStatistics', - component: () => import('@/views/CNAS/nonConformanceStatistics/index'), - meta: { title: '涓嶇鍚堥」缁熻', icon: 'tree' } - }, - { - path: 'satisfactionSurveys', - name: 'SatisfactionSurveys', - component: () => import('@/views/CNAS/satisfactionSurveys/index'), - meta: { title: '婊℃剰搴﹁皟鏌�', icon: 'tree' } - } - ] - }, - { - path: '/chart', - component: Layout, - redirect: '/chart/center', - name: 'Chart', - meta: { title: '鏅鸿兘鍥捐〃', icon: 'el-icon-s-help' }, - children: [ - { - path: 'center', - name: 'center', - component: () => import('@/views/chart/center/index'), - meta: { title: '瀹為獙涓績', icon: 'table' } - }, - { - path: 'spc', - name: 'Spc', - component: () => import('@/views/chart/spc/index'), - meta: { title: 'SPC鎺у埗鍥�', icon: 'tree' } - }, - { - path: 'shota', - name: 'Shota', - component: () => import('@/views/chart/shota/index'), - meta: { title: '姝eお鍒嗗竷鍥�', icon: 'tree' } - }, - { - path: 'work', - name: 'Work', - component: () => import('@/views/chart/work/index'), - meta: { title: '宸ヤ綔缁熻', icon: 'tree' } - } - ] - }, - { - path: '/message', - component: Layout, - redirect: '/message/toDo', - name: 'Message', - meta: { title: '娑堟伅寰呭姙', icon: 'el-icon-s-help' }, - children: [ + { + path: 'planAssignments', + name: 'PlanAssignments', + component: () => import('@/views/experiment/planAssignments/plan'), + meta: { title: '妫�楠岃鍒�', icon: 'tree' } + }, + { + path: 'checkTheReport', + name: 'CheckTheReport', + component: () => import('@/views/experiment/checkTheReport/index'), + meta: { title: '妫�楠屾姤鍛�', icon: 'tree' } + }, + { + path: 'reportAuditing', + name: 'ReportAuditing', + component: () => import('@/views/experiment/reportAuditing/index'), + meta: { title: '鎶ュ憡瀹℃牳', icon: 'tree' } + }, + { + path: 'nonConformanceReview', + name: 'NonConformanceReview', + component: () => import('@/views/experiment/nonConformanceReview/index'), + meta: { title: '涓嶅悎鏍煎搧鍙嶉', icon: 'tree' } + }, + { + path: 'nonConformingFeedback', + name: 'NonConformingFeedback', + component: () => import('@/views/experiment/nonConformingFeedback/index'), + meta: { title: '涓嶅悎鏍煎搧璇勫', icon: 'tree' } + }, + { + path: 'passRateStatistics', + name: 'PassRateStatistics', + component: () => import('@/views/experiment/passRateStatistics/index'), + meta: { title: '鍚堟牸鐜囩粺璁�', icon: 'tree' } + } + ] + }, + // { + // path: '/finishedProduct', + // component: Layout, + // redirect: '/finishedProduct/reportForInspection', + // name: 'FinishedProduct', + // meta: { title: '鎴愬搧妫�楠�', icon: 'el-icon-s-help' }, + // children: [ + // { + // path: 'reportForInspection', + // name: 'ReportForInspection', + // component: () => import('@/views/rawMaterials/reportForInspection/index'), + // meta: { title: '鎴愬搧閫佹鐧昏', icon: 'table' } + // }, + // { + // path: 'print', + // name: 'Print', + // component: () => import('@/views/rawMaterials/print/index'), + // meta: { title: '鏉$爜鎵撳嵃', icon: 'tree' } + // }, + // { + // path: 'planAssignments', + // name: 'PlanAssignments', + // component: () => import('@/views/rawMaterials/planAssignments/index'), + // meta: { title: '妫�楠岃鍒掑垎閰�', icon: 'tree' } + // }, + // { + // path: 'rawMaterialInspection', + // name: 'RawMaterialInspection', + // component: () => import('@/views/rawMaterials/rawMaterialInspection/index'), + // meta: { title: '鎴愬搧妫�楠�', icon: 'tree' } + // }, + // { + // path: 'checkTheReport', + // name: 'CheckTheReport', + // component: () => import('@/views/rawMaterials/checkTheReport/index'), + // meta: { title: '妫�楠屾姤鍛�', icon: 'tree' } + // }, + // { + // path: 'reportAuditing', + // name: 'ReportAuditing', + // component: () => import('@/views/rawMaterials/reportAuditing/index'), + // meta: { title: '鎶ュ憡瀹℃牳', icon: 'tree' } + // }, + // { + // path: 'nonConformanceReview', + // name: 'NonConformanceReview', + // component: () => import('@/views/rawMaterials/nonConformanceReview/index'), + // meta: { title: '涓嶅悎鏍煎弽棣�', icon: 'tree' } + // }, + // { + // path: 'nonConformingFeedback', + // name: 'NonConformingFeedback', + // component: () => import('@/views/rawMaterials/nonConformingFeedback/index'), + // meta: { title: '涓嶅悎鏍艰瘎瀹�', icon: 'tree' } + // }, + // { + // path: 'passRateStatistics', + // name: 'PassRateStatistics', + // component: () => import('@/views/rawMaterials/passRateStatistics/index'), + // meta: { title: '鍚堟牸鐜囩粺璁�', icon: 'tree' } + // } + // ] + // }, + { + path: '/laboratory', + component: Layout, + redirect: '/laboratory/ledger', + name: 'Laboratory', + meta: { title: '瀹為獙瀹ょ鐞�', icon: 'el-icon-s-help' }, + children: [ + { + path: 'ledger', + name: 'Ledger', + component: () => import('@/views/laboratory/ledger/index'), + meta: { title: '璁惧鍙拌处', icon: 'table' } + }, + { + path: 'measure', + name: 'Measure', + component: () => import('@/views/laboratory/measure/index'), + meta: { title: '璁¢噺绠$悊', icon: 'tree' } + }, + { + path: 'gather', + name: 'Gather', + component: () => import('@/views/laboratory/gather/index'), + meta: { title: '璁惧閲囬泦', icon: 'tree' } + }, + { + path: 'personnel', + name: 'Personnel', + component: () => import('@/views/laboratory/personnel/index'), + meta: { title: '浜哄憳绠$悊', icon: 'tree' } + }, + { + path: 'org', + name: 'Organizational', + component: () => import('@/views/laboratory/organizational/index.vue'), + meta: { title: '缁勭粐鏋舵瀯', icon: 'tree' } + }, + { + path: 'role', + name: 'Role', + component: () => import('@/views/laboratory/role/index'), + meta: { title: '瑙掕壊绠$悊', icon: 'tree' } + } + ] + }, + { + path: '/CNAS', + component: Layout, + redirect: '/CNAS/reviewAnnualPlan', + name: 'CNAS', + meta: { title: 'CNAS绠$悊', icon: 'el-icon-s-help' }, + children: [ + { + path: 'reviewAnnualPlan', + name: 'ReviewAnnualPlan', + component: () => import('@/views/CNAS/reviewAnnualPlan/index'), + meta: { title: '瀹℃牳骞村害璁″垝', icon: 'table' } + }, + { + path: 'nonConformanceManage', + name: 'NonConformanceManage', + component: () => import('@/views/CNAS/nonConformanceManage/index'), + meta: { title: '涓嶇鍚堥」绠$悊', icon: 'tree' } + }, + { + path: 'nonConformanceStatistics', + name: 'NonConformanceStatistics', + component: () => import('@/views/CNAS/nonConformanceStatistics/index'), + meta: { title: '涓嶇鍚堥」缁熻', icon: 'tree' } + }, + { + path: 'satisfactionSurveys', + name: 'SatisfactionSurveys', + component: () => import('@/views/CNAS/satisfactionSurveys/index'), + meta: { title: '婊℃剰搴﹁皟鏌�', icon: 'tree' } + } + ] + }, + { + path: '/chart', + component: Layout, + redirect: '/chart/center', + name: 'Chart', + meta: { title: '鏅鸿兘鍥捐〃', icon: 'el-icon-s-help' }, + children: [ + { + path: 'center', + name: 'center', + component: () => import('@/views/chart/center/index'), + meta: { title: '瀹為獙涓績', icon: 'table' } + }, + { + path: 'spc', + name: 'Spc', + component: () => import('@/views/chart/spc/index'), + meta: { title: 'SPC鎺у埗鍥�', icon: 'tree' } + }, + { + path: 'shota', + name: 'Shota', + component: () => import('@/views/chart/shota/index'), + meta: { title: '姝eお鍒嗗竷鍥�', icon: 'tree' } + }, + { + path: 'work', + name: 'Work', + component: () => import('@/views/chart/work/index'), + meta: { title: '宸ヤ綔缁熻', icon: 'tree' } + } + ] + }, + { + path: '/message', + component: Layout, + redirect: '/message/toDo', + name: 'Message', + meta: { title: '娑堟伅寰呭姙', icon: 'el-icon-s-help' }, + children: [ { path: 'toDo', name: 'ToDo', component: () => import('@/views/message/toDo/index'), meta: { title: '鎴戠殑寰呭姙', icon: 'tree' } }, - { - path: 'message', - name: 'Message', - component: () => import('@/views/message/message/index'), - // meta: { title: '鎴戠殑娑堟伅', icon: 'table' } - }, - ] - }, - { - path: '/personal', - component: Layout, - redirect: '/personal/myInformation', - name: 'Personal', - meta: { title: '涓汉绠$悊', icon: 'el-icon-s-help' }, - children: [ - { - path: 'myInformation', - name: 'MyInformation', - component: () => import('@/views/personal/myInformation/index'), - meta: { title: '鎴戠殑淇℃伅', icon: 'table' } - }, - { - path: 'myBusiness', - name: 'MyBusiness', - component: () => import('@/views/personal/myBusiness/index'), - meta: { title: '鎴戠殑浼佷笟', icon: 'tree', show: false } - } - ] - }, - { - path: '/baseData', - component: Layout, - redirect: '/baseData/basicDataMessage', - meta: { title: '鍩虹鏁版嵁', icon: 'el-icon-s-tools' }, - children: [ - { - path: '/basicDataMessage', - name: 'BasicDataMessage', - component: () => import('@/views/basicData/index'), - meta: { title: '鍩虹鏁版嵁', icon: 'el-icon-s-tools' } - } - ] - }, - // 404 page must be placed at the end !!! - { path: '*', redirect: '/404', hidden: true } -] - -const createRouter = () => new Router({ - mode: 'history', - scrollBehavior: () => ({ y: 0 }), - routes: constantRoutes -}) - -const router = createRouter() - -// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465 -export function resetRouter() { - const newRouter = createRouter() - router.matcher = newRouter.matcher // reset router + { + path: 'message', + name: 'Message', + // hidden: true, + component: () => import('@/views/message/message/index'), + // meta: { title: '鎴戠殑娑堟伅', icon: 'table' } + }, + ] + }, + { + path: '/personal', + component: Layout, + redirect: '/personal/myInformation', + name: 'Personal', + meta: { title: '涓汉绠$悊', icon: 'el-icon-s-help' }, + children: [ + { + path: 'myInformation', + name: 'MyInformation', + component: () => import('@/views/personal/myInformation/index'), + meta: { title: '鎴戠殑淇℃伅', icon: 'table' } + }, + { + path: 'myBusiness', + name: 'MyBusiness', + component: () => import('@/views/personal/myBusiness/index'), + meta: { title: '鎴戠殑浼佷笟', icon: 'tree', show: false } + } + ] + }, + { + path: '/baseData', + component: Layout, + redirect: '/baseData/basicDataMessage', + name: 'BaseData', + meta: { title: '鍩虹鏁版嵁', icon: 'el-icon-s-tools' }, + children: [ + { + path: 'basicDataMessage', + name: 'BasicDataMessage', + component: () => import('@/views/basicData/index'), + meta: { title: '鍩虹鏁版嵁', icon: 'el-icon-s-tools' } + } + ] + }, + { path: '*', redirect: '/404', hidden: true } + ] + return constantRoutes } +const baseRouter = [{ + path: '/login', + component: () => import('@/views/login/index'), + hidden: true +}, +{ + path: '/404', + component: () => import('@/views/404'), + hidden: true +}, +{ + path: '/addCommision', + component: () => import('@/views/inspectionManagement/commissionInspection/addCommision'), + hidden: true +}, +{ + path: '/', + component: Layout, + redirect: '/home', + // meta: { title: '涓婚〉', icon: 'el-icon-s-home' }, + children: [{ + path: 'home', + name: 'Home', + component: () => import('@/views/home/index'), + meta: { title: '涓婚〉', icon: 'el-icon-s-home' } + }] +}, { + path: '/addCommision/:viewId', + hidden: true, + component: () => import('@/views/inspectionManagement/commissionInspection/addCommision'), +}] + +function fn3(tempArr) { + let result = []; + let obj = {}; + for (let i = 0; i < tempArr.length; i++) { + if (!obj[tempArr[i].path]) { + result.push(tempArr[i]); + obj[tempArr[i].path] = true; + }; + }; + return result; +}; + + +function createRouter(Routees) { + if (JSON.parse(sessionStorage.getItem("user")) != undefined && JSON.parse(sessionStorage.getItem("user")) != null) { + let role = JSON.parse(sessionStorage.getItem("user")).role + let menuFather = baseRouter + const dataMenuFather = fn3(menuFather) + role.roleMenuList.forEach((r) => { + dataMenuFather.push(Routees.filter(item => { + return item.path === r.menuUrl + })[0]) + }) + let eqChildren = []; + role.roleMenuList.forEach((r) => { + dataMenuFather.forEach(m => { + if (r.menuUrl === m.path) { + r.children.forEach(rc => { + m.children.forEach(mc => { + if (mc.meta != undefined) { + eqChildren.push({ "path": mc.path, "meta": JSON.parse(JSON.stringify(mc.meta)) }) + delete mc["meta"] + } + }) + }) + } + }) + }) + let once = [] + role.roleMenuList.forEach((r) => { + r.children.forEach(rc => { + eqChildren.forEach(eq => { + if (eq != undefined) { + if (eq.path == rc.menuUrl.split("/")[1]) { + once.push(eq) + } + } + }) + }) + }) + dataMenuFather.forEach(m => { + let i = 0 + if (m.children != undefined) { + m.children.forEach(mc => { + once.forEach(eq => { + if (eq != undefined) { + if (mc.path == eq.path) { + if (i === 0) { + m.redirect = m.path + "/" + eq.path + } + i++; + mc.meta = eq.meta + } + } + }) + }) + } + }) + dataMenuFather.push({path: '*', redirect: '/404', hidden: true}) + dataMenuFather.push() + Routees = dataMenuFather + } else { + Routees = baseRouter + } + return new Router({ + // mode: 'history', // require service support + scrollBehavior: () => ({ y: 0 }), + routes: Routees + }) +} +let router = createRouter(getRoutes()) + +// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465 +export async function resetRouter() { + let newRouter = createRouter(getRoutes()) + router.matcher = newRouter.matcher +} +router.beforeEach(async (to, from, next) => { + // 1. 鍒ゆ柇鏄笉鏄櫥褰曢〉闈� + // 鏄櫥褰曢〉闈� + if (to.path === '/login') { + next() + } else { + // 涓嶆槸鐧诲綍椤甸潰 + // 2. 鍒ゆ柇 鏄惁鐧诲綍杩� + let token = sessionStorage.getItem('user') + if(token!=null&&token!=undefined){ + await resetRouter() + } + token ? next() : next('/login') + } +}) export default router diff --git a/src/utils/request.js b/src/utils/request.js index 13d605c..4218d62 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -48,6 +48,31 @@ // if the custom code is not 20000, it is judged as an error. if (res.code !== 200) { + if(res.code===400){ + Message({ + message: res.message, + type: 'warning', + duration: 5 * 1000 + }) + } + if(res.code===401){ + Message({ + message: res.message, + type: 'warning', + duration: 5 * 1000 + }) + sessionStorage.removeItem("user") + sessionStorage.setItem("flushPage",1) + this.$router.replace({path: '/login'}); + location.reload() + } + if(res.code===403){ + Message({ + message: res.message, + type: 'warning', + duration: 5 * 1000 + }) + } // Message({ // message: res.message || 'Error', // type: 'error', diff --git a/src/views/basicData/index.vue b/src/views/basicData/index.vue index e47537f..7aa28c5 100644 --- a/src/views/basicData/index.vue +++ b/src/views/basicData/index.vue @@ -52,12 +52,8 @@ width="30%" right :before-close="handleClose" + :title="isUpdate ? '鏇存柊' : '鏂板'" > - <template slot="title"> - <div class="addTop"> - <span>{{ isUpdate ? "鏇存柊" : "鏂板" }}鍩虹鏁版嵁</span> - </div> - </template> <el-form :model="form" :rules="rules" ref="ruleForm" class="addForm"> <el-form-item prop="material" required> <span>鏍峰搧鍚嶇О锛�</span> @@ -387,13 +383,13 @@ }); }, handleSelectionChange(val) { - this.deleteList = [] + this.deleteList = []; val.forEach((v) => { - if(v.id !== undefined) { - this.deleteList.push(v.id) + if (v.id !== undefined) { + this.deleteList.push(v.id); } - }) - console.log(`output->this.deleteList`,this.deleteList) + }); + console.log(`output->this.deleteList`, this.deleteList); }, // 琛ㄦ牸鏍戝叏閮ㄩ�変腑閰嶇疆 缁撴潫 deleteListClick() { @@ -458,12 +454,6 @@ position: relative; padding: 0 10px 10px 10px; } -.el-dialog__header { - padding: 0; -} -.el-dialog__headerbtn { - top: 0; -} .el-dialog__close { padding: 8px 0; color: #ffffff !important; @@ -479,20 +469,6 @@ } .el-dialog__body { padding: 30px 20px 0 20px; -} -.addTop { - border-top-left-radius: 10px; - border-top-right-radius: 10px; - background-color: #00a5ff; - color: #ffffff; - padding: 8px 20px; - float: left; - height: 30px; - width: 100%; -} -.addTop span { - font-size: 16px; - font-weight: 700; } .table_div { margin-top: 10px; diff --git a/src/views/experiment/checkTheReport/index.vue b/src/views/experiment/checkTheReport/index.vue index ab2d6ee..47cd9c1 100644 --- a/src/views/experiment/checkTheReport/index.vue +++ b/src/views/experiment/checkTheReport/index.vue @@ -60,7 +60,8 @@ <el-button type="primary" @click="printFun()">鎵撳嵃</el-button> </span> <div class="printStyle"> - <preview id="printDiv" :reportData="reportData"></preview> + <preview id="printDiv" :reportData="reportData" v-if="reportType===0"></preview> + <div v-else>鎴愬搧妫�娴嬫姤鍛�</div> </div> </el-dialog> <div class="table-box"> @@ -186,6 +187,7 @@ data() { return { reportData: [], + reportType: 0, searchData:{ sample_code:'', reportCode:'', @@ -217,6 +219,7 @@ //鏌ョ湅鎶ュ憡鎸夐挳 previewFun(row){ this.dialogVisible = true; + this.reportType = row.type; this.queryReportByRCode(row.reportCode); }, //鎵撳嵃鎸夐挳 @@ -295,6 +298,8 @@ } } .library-table { + height: 80vh; + overflow: scroll; background-color: #fff; flex: 1; margin: 0px -15px; @@ -324,7 +329,7 @@ } .printStyle{ overflow: scroll; - height:600px; + height:500px; .el-button{ position: absolute; top: 10vh; diff --git a/src/views/home/index.vue b/src/views/home/index.vue index d7201cd..aeecc96 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -124,7 +124,7 @@ this.getcheckProjectNum(); this.getVerifiedData(); this.getUncheckedData(); - this.getPieChart(); + this.getPieChart(); }, methods: { cell({ row, column, rowIndex, columnIndex }) { diff --git a/src/views/laboratory/measure/Add.vue b/src/views/laboratory/measure/Add.vue index 224b34e..bbc0fe9 100644 --- a/src/views/laboratory/measure/Add.vue +++ b/src/views/laboratory/measure/Add.vue @@ -40,7 +40,7 @@ <el-col style="width:93%;height: 20vh;margin-top: 30px; margin-left: 40px;"> <el-button icon="el-icon-plus" @click="addcodePointsTable()" style="margin-bottom: 10px;" type="primary">鏂板璁¢噺</el-button> - <el-table ref="codePointsTable" :cell-style="{ textAlign: 'center' }" + <el-table max-height="300" ref="codePointsTable" :cell-style="{ textAlign: 'center' }" :header-cell-style="{ border: '0px', background: '#f5f7fa', color: '#606266', boxShadow: 'inset 0 1px 0 #ebeef5', textAlign: 'center' }" :data="codePointsTable" style="width: 100%"> <el-table-column type="index" v-model="codePointsTable.index" label="搴忓彿" min-width="90" /> diff --git a/src/views/laboratory/measure/index.vue b/src/views/laboratory/measure/index.vue index 0e01e41..e927978 100644 --- a/src/views/laboratory/measure/index.vue +++ b/src/views/laboratory/measure/index.vue @@ -117,6 +117,13 @@ </div> </div> </div> + <div> + <el-button v-if="selectInfoBtn" @click="combackLookPlan" style="position: fixed;top: 43px;right: 14px; z-index: 1000;" type="primary" icon="el-icon-refresh-left" size="mini" plain >杩斿洖</el-button> + <div v-if="addBtn" style="display: flex;justify-content: center;width: 10%;position: fixed;top: 43px;right: 14px; z-index: 1000;"> + <el-button @click="addTop = -82;addBtn=false" size="mini" style="width: 60px;" >杩斿洖</el-button> + <el-button size="mini" @click="measureAdd" style="width: 60px;" type="primary">淇濆瓨</el-button> + </div> + </div> <div :style="`position: absolute;top:${addTop}vh;left: 9px;transition: 1s;width: 99%;height: 82vh;background-color: #fff;z-index: 21;`"> <Add ref="add" /> @@ -150,7 +157,7 @@ </el-col> </el-col> <el-col style="width:93%;height: 20vh;margin-top: 30px; margin-left: 40px;"> - <el-table :data="measureData"> + <el-table max-height="300" :data="measureData"> <el-table-column type="index" label="搴忓彿" /> <el-table-column prop="equipmentCode" label="浠櫒璁惧缂栧彿" /> <el-table-column prop="equipmentName" label="浠櫒璁惧鍚嶇О" /> @@ -276,6 +283,8 @@ return { dialogVisible: false, tableIndex: null, + selectInfoBtn: false, + addBtn: false, measureUpInfo: { id: null, code: null, @@ -370,18 +379,16 @@ this.measureUpInfo.termValidity = scope.row.termValidity }, measureAdd() { - let add = this.$refs.add.add() - if (add) { - this.addTop = -82 + this.addTop = -82 this.$message({ message: '鎿嶄綔鎴愬姛锛�', type: 'success' }); this.lookVisible = false - } }, async handleSizeChangePlan(num) { this.pageSizePlan = num + this.currentPagePlan=1 await this.limitGetPlanMeasureInstrument() }, async handleCurrentChangePllan(num) { @@ -392,6 +399,7 @@ this.addTop = 2 this.lookVisible = true this.$parent.mainShowAdd() + this.addBtn=true }, async limitGetPlanMeasureInstrument() { let param = { @@ -408,6 +416,7 @@ this.getPlanAndInfoAndIns(id) this.lookVisible = true this.mymodelTop = 2 + this.selectInfoBtn=true this.$parent.triggerMainBtnPlan() }, async getPlanAndInfoAndIns(id) { @@ -429,6 +438,7 @@ combackLookPlan() { this.lookVisible = false this.mymodelTop = -85 + this.selectInfoBtn=false }, blurSearch() { if (this.radioValue === 1) { diff --git a/src/views/laboratory/personnel/index.vue b/src/views/laboratory/personnel/index.vue index 4259f2f..f4f4ee2 100644 --- a/src/views/laboratory/personnel/index.vue +++ b/src/views/laboratory/personnel/index.vue @@ -86,7 +86,7 @@ <el-select v-model="form.roleId" clearable - style="100%" + style="width: 100%" placeholder="璇烽�夋嫨鏉冮檺" > <el-option diff --git a/src/views/laboratory/role/index.vue b/src/views/laboratory/role/index.vue index a56cda7..c4f696c 100644 --- a/src/views/laboratory/role/index.vue +++ b/src/views/laboratory/role/index.vue @@ -8,7 +8,7 @@ </el-input> </el-form-item> <el-form-item class="rightBtn"> - <el-button type="primary">鏌ヨ</el-button> + <el-button type="primary" @click="searchRole">鏌ヨ</el-button> <el-button type="primary" plain>閲嶇疆</el-button> </el-form-item> </el-form> @@ -16,7 +16,6 @@ <el-form-item class="rightBtn"> <el-button type="primary" @click="addClickRole" icon="el-icon-plus">鏂板瑙掕壊</el-button> </el-form-item> - </el-form> </el-form> </div> <div class="library-table"> @@ -30,8 +29,9 @@ <el-table-column prop="updateTime" label="鏇存柊鏃堕棿" min-width="20%" /> <el-table-column label="鎿嶄綔" min-width="12%"> <template slot-scope="scope"> - <el-button type="text" size="small">缂栬緫</el-button> - <el-button type="text" size="small">鍒犻櫎</el-button> + <el-button type="text" @click="selectRoleInfo(scope)" size="small">鏌ョ湅</el-button> + <el-button type="text" @click="upRole(scope)" size="small">缂栬緫</el-button> + <el-button type="text" @click="removeRole(scope)" size="small">鍒犻櫎</el-button> </template> </el-table-column> </el-table> @@ -67,10 +67,10 @@ :default-expand-all="false" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"> <el-table-column highlight-current-row prop="parentId" label="鑿滃崟绫诲瀷" sortable width="180"> <template slot-scope="scope"> - <span v-if="scope.row.parentId == 0 && scope.row.children != undefined" style="color: #409eff;">涓昏彍鍗�</span> - <span v-if="scope.row.parentId == 0 && scope.row.children === undefined" style="color: #409eff;"> + <span v-if="scope.row.parentId == 0" style="color: #409eff;">涓昏彍鍗�</span> + <!-- <span v-if="scope.row.parentId == 0 && scope.row.children === undefined" style="color: #409eff;"> 涓昏彍鍗� - </span> + </span> --> </template> </el-table-column> <el-table-column prop="name" label="鑿滃崟鍚�" sortable width="180"> @@ -103,11 +103,125 @@ <el-button type="primary" @click="addRole">纭� 瀹�</el-button> </span> </el-dialog> + + <el-dialog top="5vh" title="缂栬緫瑙掕壊" :visible.sync="dialogTableVisibleUpdate" width="50%"> + <el-form :model="updateRole" ref="updateRole" label-position="right" label-width="100px"> + <el-col :span="24" style="display: flex;justify-content: space-between;"> + <el-form-item :rules="nameaRules" label="瑙掕壊鍚�:"> + <el-input @blur="assertUpName" style="width: 300px" v-model="updateRole.roleName" placeholder="璇疯緭鍏ヨ鑹插悕"> + </el-input> + </el-form-item> + <!-- <el-form-item label="鑿滃崟閫夋嫨:"> + <el-cascader style="width: 300px" collapse-tags size="medium " filterable :props="props" + v-model="roleAdd.menuData" :options="menuInfo"> + <template slot-scope="{ data }"> + <span>{{ data.label }}</span> + </template> + </el-cascader> + </el-form-item> --> + </el-col> + </el-form> + <el-col :span="24"> + <el-table height="500" :data="menuUpdateInfo" style="width: 100%;margin-bottom: 20px;" row-key="id" + :default-expand-all="true" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"> + <el-table-column highlight-current-row prop="parentId" label="鑿滃崟绫诲瀷" sortable width="180"> + <template slot-scope="scope"> + <span v-if="scope.row.parentId == 0" style="color: #409eff;">涓昏彍鍗�</span> + <!-- <span v-if="scope.row.parentId == 0 && scope.row.children === undefined" style="color: #409eff;"> + 涓昏彍鍗� + </span> --> + </template> + </el-table-column> + <el-table-column prop="name" label="鑿滃崟鍚�" sortable width="180"> + <template slot-scope="scope"> + <el-col v-if="scope.row.parentId == 0"> + <span style="color: #409eff;">{{ scope.row.name }}</span> + </el-col> + <el-col v-else> + <span style="color: #40b815;">{{ scope.row.name }}</span> + </el-col> + </template> + </el-table-column> + <el-table-column prop="id" label="鎿嶄綔鏉冮檺"> + <template slot-scope="scope"> + <el-col v-if="scope.row.parentId == 0 && scope.row.children != undefined"> + <!-- <el-checkbox v-model="scope.row.select">鏌ヨ</el-checkbox> --> + </el-col> + <el-col v-else> + <el-checkbox size="medium" v-model="scope.row.selected" @change="chekSelect(scope)">鏌ヨ</el-checkbox> + <el-checkbox size="medium" v-model="scope.row.added" @change="chekAdd(scope)">娣诲姞</el-checkbox> + <el-checkbox size="medium" v-model="scope.row.updated" @change="chekUpdate(scope)">淇敼</el-checkbox> + <el-checkbox size="medium" v-model="scope.row.deleted" @change="chekDelet(scope)">鍒犻櫎</el-checkbox> + </el-col> + </template> + </el-table-column> + </el-table> + </el-col> + <span slot="footer" class="dialog-footer"> + <el-button @click="clearUPAll">鍙� 娑�</el-button> + <el-button type="primary" @click="cilckUP">纭� 瀹�</el-button> + </span> + </el-dialog> + + <el-dialog top="5vh" title="瑙掕壊瀵熺湅" :visible.sync="dialogTableSelectVisible" width="50%"> + <el-form :model="selectMenuInfo" ref="selectMenuInfo" label-position="right" label-width="100px"> + <el-col :span="24" style="display: flex;justify-content: space-between;"> + <el-form-item label="瑙掕壊鍚�:"> + <el-input style="width: 300px" v-model="selectMenuInfo.roleName" readonly> + </el-input> + </el-form-item> + <!-- <el-form-item label="鑿滃崟閫夋嫨:"> + <el-cascader style="width: 300px" collapse-tags size="medium " filterable :props="props" + v-model="roleAdd.menuData" :options="menuInfo"> + <template slot-scope="{ data }"> + <span>{{ data.label }}</span> + </template> + </el-cascader> + </el-form-item> --> + </el-col> + </el-form> + <el-col :span="24"> + <el-table height="500" :data="selectMenuInfo.menuData" style="width: 100%;margin-bottom: 20px;" row-key="menuId" + :default-expand-all="true" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"> + <el-table-column highlight-current-row prop="parentId" label="鑿滃崟绫诲瀷" sortable width="180"> + <template slot-scope="scope"> + <span v-if="scope.row.parentId == 0" style="color: #409eff;">涓昏彍鍗�</span> + <!-- <span v-if="scope.row.parentId == 0 && scope.row.children === undefined" style="color: #409eff;"> + 涓昏彍鍗� + </span> --> + </template> + </el-table-column> + <el-table-column prop="menuName" label="鑿滃崟鍚�" sortable width="180"> + <template slot-scope="scope"> + <el-col v-if="scope.row.parentId == 0"> + <span style="color: #409eff;">{{ scope.row.menuName }}</span> + </el-col> + <el-col v-else> + <span style="color: #40b815;">{{ scope.row.menuName }}</span> + </el-col> + </template> + </el-table-column> + <el-table-column prop="menuId" label="鎿嶄綔鏉冮檺"> + <template slot-scope="scope"> + <el-col v-if="scope.row.parentId == 0 && scope.row.children.length > 0"> + <!-- <el-checkbox v-model="scope.row.select">鏌ヨ</el-checkbox> --> + </el-col> + <el-col id="selectRoleCheck" class="selectRoleCheck" v-else> + <el-checkbox size="medium" disabled v-model="scope.row.selected">鏌ヨ</el-checkbox> + <el-checkbox size="medium" disabled v-model="scope.row.added">娣诲姞</el-checkbox> + <el-checkbox size="medium" disabled v-model="scope.row.updated">淇敼</el-checkbox> + <el-checkbox size="medium" disabled v-model="scope.row.deleted">鍒犻櫎</el-checkbox> + </el-col> + </template> + </el-table-column> + </el-table> + </el-col> + </el-dialog> </div> </template> <script> -import { getMenusTree, addRoleInfo, assertRepeat, getAllRoleAndMenuInfo } from '@/api/laboratory/role' +import { getMenusTree, addRoleInfo, assertRepeat, getAllRoleAndMenuInfo, deleteRole, updateRoleMenu } from '@/api/laboratory/role' import { default as menuPower } from './menuPower.vue' export default { components: { @@ -116,6 +230,15 @@ data() { return { props: { multiple: true }, + dialogTableVisibleUpdate: false, + updateRole: { + roleId: null, + roleName: null, + lastName: null, + menuData: null, + lastMenuSelect: null + }, + selectRole: [], roleAdd: { roleName: null, menuData: null @@ -124,10 +247,14 @@ menuTableTree: null, searchData: { roleName: '', - permission: '' }, assertRepeatName: true, menuInfo: [], + menuUpdateInfo: [], + selectMenuInfo: { + roleName: null, + menuData: null + }, roleTable: [], updateData: { oldPassWord: '', @@ -135,6 +262,8 @@ confirmPassWord: '' }, dialogTableVisible: false, + dialogTableSelectVisible: false, + addOrUp: false, currentPage: 1, pageSize: 5, total: 20 @@ -147,13 +276,169 @@ this.start() }, methods: { - chekSelect(scope) { + selectRoleInfo(scope) { + this.selectMenuInfo.roleName = scope.row.roleName + this.selectMenuInfo.menuData = scope.row.roleMenuList + console.log(this.selectMenuInfo.menuData); + this.dialogTableSelectVisible = true + }, + searchRole() { + this.start() + }, + clearUPAll() { + this.updateRole = { + roleId: null, + roleName: null, + lastName: null, + menuData: null, + lastMenuSelect: null + } + this.menuUpdateInfo = [] + this.dialogTableVisibleUpdate = false + }, + async cilckUP() { + if (this.updateRole.roleName == null || this.updateRole.roleName == '') { + this.$message({ + message: '璇疯緭鍏ヨ鑹插悕', + type: 'warning' + }); + return + } + if (!this.assertRepeatName) { + this.$message({ + message: '瑙掕壊鍚嶉噸澶嶏紝璇烽噸鏂拌緭鍏�', + type: 'warning' + }); + return + } + this.menuUpdateInfo.forEach(item => { + if (item.children != undefined) { + item.children.forEach(c => { + if (c.added) { + item.selected = true + } + if (c.selected) { + item.selected = true + } + if (c.updated) { + item.selected = true + } + if (c.deleted) { + item.selected = true + } + }) + } + }) + console.log(this.menuUpdateInfo); + this.updateRole.menuData = JSON.parse(JSON.stringify(this.menuUpdateInfo)); + this.updateRole.menuData.forEach(item => { + if (item.children != undefined) { + let child = item.children.filter(c => { + return c.added == true || c.selected == true || c.deleted == true || c.updated === true + }) + item.children = child + } + }) + this.updateRole.menuData = this.updateRole.menuData.filter(item => { + return item.selected == true + }) + this.assertDeleteOrUp() + console.log(this.updateRole); + let up = await updateRoleMenu(this.updateRole) + if (up.data) { + this.$message({ + type: 'success', + message: '缂栬緫鎴愬姛!' + }); + this.start() + this.clearUPAll() + } else { + this.$message.error('缂栬緫澶辫触锛佽閲嶆柊鎿嶄綔'); + } }, + async upRole(scope) { + console.log(scope); + this.updateRole.roleId = scope.row.roleId + this.updateRole.roleName = scope.row.roleName + this.updateRole.lastName = scope.row.roleName + let menuSelect = scope.row.roleMenuList + this.updateRole.lastMenuSelect = scope.row.roleMenuList + console.log(menuSelect); + let res = await getMenusTree(); + this.menuUpdateInfo = res.data + this.menuUpdateInfo.forEach(item => { + this.$set(item, 'added', false); + this.$set(item, 'updated', false); + this.$set(item, 'deleted', false); + this.$set(item, 'selected', false); + if (item.children.length == 0) { + delete item['children'] + } else { + item.children.forEach(c => { + this.$set(c, 'selected', false); + this.$set(c, 'added', false); + this.$set(c, 'updated', false); + this.$set(c, 'deleted', false); + if (c.children.length == 0) { + delete c['children'] + } + }) + } + }) + console.log(this.menuUpdateInfo); + menuSelect.forEach(ms => { + this.menuUpdateInfo.forEach(item => { + if (ms.menuName === item.name) { + item.selected = ms.selected + item.added = ms.added + item.deleted = ms.deleted + item.updated = ms.updated + ms.children.forEach(msc => { + if (item.children != undefined) { + item.children.forEach(itemc => { + if (itemc.name === msc.menuName) { + itemc.selected = msc.selected + itemc.added = msc.added + itemc.deleted = msc.deleted + itemc.updated = msc.updated + } + }) + } + }) + } + }) + }) + this.dialogTableVisibleUpdate = true + }, + removeRole(scope) { + this.$confirm('姝ゆ搷浣滃皢鍒犻櫎璇ヨ鑹�, 鏄惁缁х画?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(async () => { + this.roleTable = this.roleTable.filter(item => { + return item.roleId != scope.row.roleId + }); + this.$message({ + type: 'success', + message: '鍒犻櫎鎴愬姛!' + }); + await deleteRole({ id: scope.row.roleId }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, async start() { - let res = await getAllRoleAndMenuInfo() - this.roleTable = res.data - console.log(res); + let res = await getAllRoleAndMenuInfo({ currentPage: this.currentPage, pageSize: this.pageSize, name: this.searchData.roleName }) + res.data.list.forEach(item => { + item.roleId = String(item.roleId) + }) + this.roleTable = res.data.list + this.total = res.data.total }, async assertName() { if (this.roleAdd.roleName == null || this.roleAdd.roleName == '') { @@ -175,13 +460,81 @@ } }, chekAdd(scope) { - scope.row.selected = true + if (scope.row.added) { + scope.row.selected = true + } + this.updateFatherState(scope) }, chekUpdate(scope) { - scope.row.selected = true + if (scope.row.updated) { + scope.row.selected = true + } + this.updateFatherState(scope) }, chekDelet(scope) { - scope.row.selected = true + if (scope.row.deleted) { + scope.row.selected = true + } + this.updateFatherState(scope) + }, + chekSelect(scope) { + this.updateFatherState(scope) + }, + updateFatherState(scope) { + if (this.menuUpdateInfo != []) { + this.menuUpdateInfo.forEach(item => { + if (item.id == scope.row.parentId) { + if (item.children != undefined) { + let childrenFalse = item.children.length * 4; + let countFalse = 0; + item.children.forEach(c => { + if (c.added == false) { + countFalse++; + } + if (c.deleted == false) { + countFalse++; + } + if (c.updated == false) { + countFalse++; + } + if (c.selected == false) { + countFalse++; + } + }) + if (childrenFalse === countFalse) { + item.selected = false + } + } + } + }) + } + if (this.menuInfo != []) { + this.menuInfo.forEach(item => { + if (item.id == scope.row.parentId) { + if (item.children != undefined) { + let childrenFalse = item.children.length * 4; + let countFalse = 0; + item.children.forEach(c => { + if (c.added == false) { + countFalse++; + } + if (c.deleted == false) { + countFalse++; + } + if (c.updated == false) { + countFalse++; + } + if (c.selected == false) { + countFalse++; + } + }) + if (childrenFalse === countFalse) { + item.selected = false + } + } + } + }) + } }, async addClickRole() { let res = await getMenusTree(); @@ -254,6 +607,7 @@ return item.selected == true }) let res = await addRoleInfo(this.roleAdd); + this.start() if (res.data) { this.$message({ message: '娣诲姞瑙掕壊鎴愬姛', @@ -287,6 +641,92 @@ this.menuInfo = [] this.assertRepeatName = true this.dialogTableVisible = false + }, + assertDeleteOrUp() { + console.log("---------"); + console.log(this.updateRole.menuData); + this.updateRole.lastMenuSelect + this.updateRole.menuData + let newTree = [] + let oldTree = [] + this.updateRole.menuData.forEach(item => { + const obj = { + menuId: item.id, + menuName: item.name, + added: item.added, + parentId: item.parentId, + deleted: item.deleted, + updated: item.updated, + selected: item.selected + } + newTree.push(obj) + if (item.children != undefined && obj.selected != false) { + item.children.forEach(c => { + const objc = { + menuId: c.id, + menuName: c.name, + parentId: c.parentId, + added: c.added, + deleted: c.deleted, + updated: c.updated, + selected: c.selected + } + newTree.push(objc) + }) + } + }) + console.log(newTree); + // this.updateRole.lastMenuSelect.forEach(item => { + // const obj = { + // menuId: item.menuId, + // menuName: item.menuName, + // added: item.added, + // deleted: item.deleted, + // updated: item.updated, + // selected: item.selected + // } + // if (obj.selected) { + // oldTree.push(obj) + // } + // if (item.children != [] && obj.selected != false) { + // item.children.forEach(c => { + // const objc = { + // menuId: c.menuId, + // menuName: c.menuName, + // added: c.added, + // deleted: c.deleted, + // updated: c.updated, + // selected: c.selected + // } + // oldTree.push(objc) + // }) + // } + // }) + console.log(oldTree); + // this.updateRole.lastMenuSelect = oldTree + this.updateRole.menuData = newTree + }, + async assertUpName() { + if (this.updateRole.roleName == null || this.updateRole.roleName == '') { + this.$message({ + message: '璇疯緭鍏ヨ鑹插悕绉帮紒', + type: 'warning' + }); + return + } + if (this.updateRole.roleName === this.updateRole.lastName) { + return + } + let res = await assertRepeat({ roleName: this.updateRole.roleName }) + if (!res.data) { + this.assertRepeatName = false + this.$message({ + message: '瑙掕壊鍚嶉噸澶嶏紝璇烽噸鏂拌緭鍏ワ紒', + type: 'warning' + }); + } else { + this.assertRepeatName = true + } } } } @@ -336,5 +776,16 @@ justify-content: end; margin-top: 20px } + } </style> + +<style> +#selectRolecheck .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner::after { + border-color: #fff !important; +} +#selectRoleCheck .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner { + background-color: #409EFF; + border-color: #409EFF; +} +</style> \ No newline at end of file diff --git a/src/views/login/index.vue b/src/views/login/index.vue index d753b3b..6fcb22a 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -11,38 +11,23 @@ <span class="svg-container"> <svg-icon icon-class="user" /> </span> - <el-input - ref="username" - v-model="loginForm.username" - placeholder="Username" - name="username" - type="text" - tabindex="1" - auto-complete="on" - /> + <el-input ref="username" v-model="loginForm.username" placeholder="Username" name="username" type="text" + tabindex="1" auto-complete="on" /> </el-form-item> <el-form-item prop="password"> <span class="svg-container"> <svg-icon icon-class="password" /> </span> - <el-input - :key="passwordType" - ref="password" - v-model="loginForm.password" - :type="passwordType" - placeholder="Password" - name="password" - tabindex="2" - auto-complete="on" - @keyup.enter.native="handleLogin" - /> + <el-input :key="passwordType" ref="password" v-model="loginForm.password" :type="passwordType" + placeholder="Password" name="password" tabindex="2" auto-complete="on" @keyup.enter.native="handleLogin" /> <span class="show-pwd" @click="showPwd"> <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" /> </span> </el-form-item> - <el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">Login</el-button> + <el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" + @click.native.prevent="handleLogin">Login</el-button> <!-- <div class="tips"> <span style="margin-right:20px;">username: admin</span> <span> password: any</span> @@ -53,7 +38,7 @@ <script> import { validUsername } from '@/utils/validate' - +import { get } from "@/api/util/requestUtil.js" export default { name: 'Login', data() { @@ -87,7 +72,7 @@ }, watch: { $route: { - handler: function(route) { + handler: function (route) { this.redirect = route.query && route.query.redirect }, immediate: true @@ -108,7 +93,12 @@ this.$refs.loginForm.validate(valid => { if (valid) { this.loading = true - this.$store.dispatch('user/login', this.loginForm).then(() => { + this.$store.dispatch('user/login', this.loginForm).then(async () => { + await get(this.$url.info).then(res => { + this.user = res.data + sessionStorage.setItem("user", JSON.stringify(res.data)) + sessionStorage.setItem("flushPage",0) + }) this.$router.push({ path: this.redirect || '/' }) this.loading = false }).catch(() => { @@ -128,8 +118,8 @@ /* 淇input 鑳屾櫙涓嶅崗璋� 鍜屽厜鏍囧彉鑹� */ /* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */ -$bg:#283443; -$light_gray:#fff; +$bg: #283443; +$light_gray: #fff; $cursor: #fff; @supports (-webkit-mask: none) and (not (cater-color: $cursor)) { @@ -172,27 +162,28 @@ </style> <style lang="scss" scoped> -$bg:#2d3a4b; -$dark_gray:#889aa4; -$light_gray:#eee; +$bg: #2d3a4b; +$dark_gray: #889aa4; +$light_gray: #eee; .login-container { min-height: 100%; width: 100%; - background:url('../../assets/404_images/backgroud.png') no-repeat; + background: url('../../assets/404_images/backgroud.png') no-repeat; background-size: 100vw 100vh; overflow: hidden; + .login-form { position: relative; width: 520px; max-width: 100%; - padding: 0 35px ; + padding: 0 35px; margin: 0 auto; overflow: hidden; position: absolute; top: 50%; left: 50%; - transform: translate(-50%,-50%); + transform: translate(-50%, -50%); } diff --git a/src/views/standardLibrary/index.vue b/src/views/standardLibrary/index.vue index 5c69021..5277b3b 100644 --- a/src/views/standardLibrary/index.vue +++ b/src/views/standardLibrary/index.vue @@ -25,16 +25,22 @@ <div class="table-header"> <div class="serve-btn"> <span class="tipMsg">{{ msg !== "" ? msg : "" }}</span> - <el-select v-model="versionValue" @change="changeSelect" placeholder="璇烽�夋嫨鐗堟湰鍙�"> + <el-select + v-model="versionValue" + @change="changeSelect" + placeholder="璇烽�夋嫨鐗堟湰鍙�" + > <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" - > + > </el-option> </el-select> - <el-button type="primary" @click="addVersionFun">鏂板鐗堟湰鍙�</el-button> + <el-button type="primary" @click="addVersionFun" + >鏂板鐗堟湰鍙�</el-button + > <el-button type="primary" icon="el-icon-plus" @@ -172,15 +178,15 @@ deleteListApi, blurUpdateApi, getVersion, - addVersion + addVersion, } from "@/api/standardLibrary"; import { selectproductModelApi } from "@/api/basicData/index"; export default { data() { return { - options:[], - versionValue: '', + options: [], + versionValue: "", deleteList: [], msg: "", isAllSelect: false, @@ -213,47 +219,49 @@ created() { this.getStandardTree(); }, - mounted(){ - - }, + mounted() {}, methods: { - async initSelect(){ - this.options = []; - this.versionValue = ""; - const response = await getVersion({"specificationsId":this.selectData.id}); - if(response.code===200 && response.data.length>0){ - this.getTableByClick(this.selectData,response.data[0]) - for(let i=0;i<response.data.length;i++){ - this.options.push({ - value: response.data[i], - label: "V" + response.data[i] - }) - this.versionValue = response.data[0]; - } - } - }, - changeSelect(){ - this.tableData = []; - this.getTableByClick(this.selectData,this.versionValue); - }, - async insertVersion(){ - const resp = await addVersion({"specificationsId":this.selectData.id}); - if(resp.code===200){ - this.initSelect(); - this.$message({ - type: 'success', - message: resp.message + async initSelect() { + this.options = []; + this.versionValue = ""; + const response = await getVersion({ + specificationsId: this.selectData.id, + }); + if (response.code === 200 && response.data.length > 0) { + this.getTableByClick(this.selectData, response.data[0]); + for (let i = 0; i < response.data.length; i++) { + this.options.push({ + value: response.data[i], + label: "V" + response.data[i], }); + this.versionValue = response.data[0]; + } } }, - addVersionFun() { - this.$confirm('纭娣诲姞鏂扮殑鐗堟湰鍙峰悧?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { + changeSelect() { + this.tableData = []; + this.getTableByClick(this.selectData, this.versionValue); + }, + async insertVersion() { + const resp = await addVersion({ specificationsId: this.selectData.id }); + if (resp.code === 200) { + this.initSelect(); + this.$message({ + type: "success", + message: resp.message, + }); + } + }, + addVersionFun() { + this.$confirm("纭娣诲姞鏂扮殑鐗堟湰鍙峰悧?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { this.insertVersion(); - }).catch(() => {}); + }) + .catch(() => {}); }, filterNode(value, data) { if (!value) return true; @@ -308,7 +316,7 @@ this.getParentData(node.parent, node.data.name); // 瀛樹笅閫変腑鑺傜偣 this.selectData = data; - this.getTableByClick(data,this.versionValue); + this.getTableByClick(data, this.versionValue); this.initSelect(); } if (!("children" in data)) { @@ -324,10 +332,10 @@ this.getParentData(node.parent, this.msg); } }, - async getTableByClick(data,versionVal) { + async getTableByClick(data, versionVal) { await getProductList({ specificationsId: data.id, - version: versionVal + version: versionVal, }).then((res) => { res.data.forEach((i) => { if (i.name === undefined) { @@ -349,10 +357,9 @@ this.$router.push(`/standardLibrary/SpecificationDetails/${row.id}`); }, renderContent(h, { node, data, store }) { - // console.log('data', data) - // console.log('node', node) // 鍒ゆ柇鏄惁鏄埗鑺傜偣鎴栨枃浠跺す const isFolder = "children" in data; + console.log(`output->data`, isFolder); return ( <span class="tree-node"> {isFolder ? ( @@ -408,7 +415,7 @@ addTypeArr: [], }; this.getStandardTree(); - this.getTableByClick(this.selectData,this.versionValue); + this.getTableByClick(this.selectData, this.versionValue); }, changeCascader(data) { this.addTreeForm.addTypeArr = data; @@ -499,13 +506,13 @@ }); }, handleSelectionChange(val) { - this.deleteList = [] + this.deleteList = []; val.forEach((v) => { - if(v.id !== undefined){ - this.deleteList.push(v.id) + if (v.id !== undefined) { + this.deleteList.push(v.id); } - }) - console.log(`output->this.deleteList`,this.deleteList) + }); + console.log(`output->this.deleteList`, this.deleteList); }, // 琛ㄦ牸鏍戝叏閮ㄩ�変腑閰嶇疆 缁撴潫 deleteListClick() { @@ -514,7 +521,7 @@ message: res.message, type: "success", }); - this.getTableByClick(this.selectData,this.versionValue); + this.getTableByClick(this.selectData, this.versionValue); }); }, async requiredOnfocus(scope) { @@ -529,7 +536,7 @@ message: res.message, type: "success", }); - this.getTableByClick(this.selectData,this.versionValue); + this.getTableByClick(this.selectData, this.versionValue); }); }, }, @@ -665,8 +672,8 @@ width: 100%; padding-bottom: 6px; text-align: right; - .el-select{ - margin-right:10px; + .el-select { + margin-right: 10px; } } .tipMsg { -- Gitblit v1.9.3