diff --git a/client/src/api/org.js b/client/src/api/org.js index 2880ec4..3ee4928 100644 --- a/client/src/api/org.js +++ b/client/src/api/org.js @@ -13,6 +13,15 @@ export function getOrgList(query) { params: query }) } + +export function getSubOrgList(query) { + return request({ + url: '/system/organization/sub/', + method: 'get', + params: query + }) +} + export function createOrg(data) { return request({ url: '/system/organization/', diff --git a/client/src/icons/svg/PT.svg b/client/src/icons/svg/PT.svg new file mode 100644 index 0000000..2649c24 --- /dev/null +++ b/client/src/icons/svg/PT.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/inspect.svg b/client/src/icons/svg/inspect.svg new file mode 100644 index 0000000..4e283ae --- /dev/null +++ b/client/src/icons/svg/inspect.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/icons/svg/share.svg b/client/src/icons/svg/share.svg new file mode 100644 index 0000000..ef1d712 --- /dev/null +++ b/client/src/icons/svg/share.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/layout/components/Sidebar/index.vue b/client/src/layout/components/Sidebar/index.vue index c2aa72e..73a15d1 100644 --- a/client/src/layout/components/Sidebar/index.vue +++ b/client/src/layout/components/Sidebar/index.vue @@ -7,7 +7,7 @@ :collapse="isCollapse" :background-color="variables.menuBg" :text-color="variables.menuText" - :unique-opened="false" + :unique-opened="true" :active-text-color="variables.menuActiveText" :collapse-transition="false" mode="vertical" @@ -39,6 +39,7 @@ export default { return meta.activeMenu } return path + }, showLogo() { return this.$store.state.settings.sidebarLogo @@ -51,4 +52,4 @@ export default { } } } - \ No newline at end of file + diff --git a/client/src/router/index.js b/client/src/router/index.js index a2c7ee5..7a1b386 100644 --- a/client/src/router/index.js +++ b/client/src/router/index.js @@ -74,79 +74,68 @@ export const constantRoutes = [ */ export const asyncRoutes = [ { - path: '/qualification', + path: '/share', component: Layout, - redirect: '/qualification', - children: [{ - path: '', - name: 'Qualification', - component: () => import('@/views/ability/qualification'), - meta: { title: '检验检测资质', icon: 'table', perms: ['qualification_view'] } - }] - }, - { - path: '/cma', - component: Layout, - redirect: '/cma', - children: [{ - path: '', - name: 'CMA', - component: () => import('@/views/ability/cma'), - meta: { title: '检测能力(总部CMA+CNAS)', icon: 'table', perms: ['cma_view'] } - }] - }, + redirect: '/share/qualification', + name: 'Share', + alwaysShow: true, + meta: { title: '能力共享', icon: 'share' }, + children: [ + { + path: 'qualification', + name: 'Qualification', + component: () => import('@/views/ability/qualification'), + meta: { title: '检验检测资质', perms: ['qualification_view'] } + }, + { + path: 'cma', + name: 'CMA', + component: () => import('@/views/ability/cma'), + meta: { title: '检测能力(总部CMA+CNAS)', perms: ['cma_view'] } + }, - { - path: '/cma2', - component: Layout, - redirect: '/cma2', - children: [{ - path: '', - name: 'CMA2', - component: () => import('@/views/ability/cma2'), - meta: { title: '检测能力(分子公司CMA)', icon: 'table', perms: ['cma2_view'] } - } + { + path: 'cma2', + name: 'CMA2', + component: () => import('@/views/ability/cma2'), + meta: { title: '检测能力(分子公司CMA)', perms: ['cma2_view'] } + } + , + { + path: 'inspection', + name: 'Inspection', + component: () => import('@/views/ability/inspection'), + meta: { title: '检验能力', perms: ['inspection_view'] } + }, ] - } - , - { - path: '/inspection', - component: Layout, - redirect: '/inspection', - children: [{ - path: '', - name: 'inspection', - component: () => import('@/views/ability/inspection'), - meta: { title: '检验能力', icon: 'table', perms: ['inspection_view'] } - }] - }, + }, { path: '/supervision', component: Layout, redirect: '/supervision/task', name: 'Supervision', - meta: { title: '日常监督', icon: 'table', perms: ['supervision'] }, + meta: { title: '日常监督', icon: 'guide', perms: ['supervision'] }, + alwaysShow: true, children: [ { path: 'content', name: 'Content', component: () => import('@/views/supervision/content.vue'), - meta: { title: '材料清单', icon: 'documentation', perms: ['content'] } + meta: { title: '材料清单', perms: ['content'] } }, { path: 'task', name: 'Task', component: () => import('@/views/supervision/task.vue'), - meta: { title: '报送任务', icon: 'guide', perms: ['task_view'] } + meta: { title: '报送任务', perms: ['task_view'] } }, { path: 'record', name: 'Record', component: () => import('@/views/supervision/record.vue'), - meta: { title: '材料报送列表', icon: 'guide', perms: ['record_view'] } - } - , + meta: { title: '报送材料查询', perms: ['record_view'] } + }, { path: 'taskdo/:id', name: 'Taskdo', @@ -156,7 +145,50 @@ export const asyncRoutes = [ }, ] }, - + { + path: '/qualityinspect', + component: Layout, + redirect: '/qualityinspect/task', + name: 'Qualityinspect', + meta: { title: '质量巡查', icon: 'inspect', perms: ['qualityinspect_view'] }, + alwaysShow: true, + children: [ + { + path: 'table', + name: 'inspectTable', + component: () => import('@/views/qualityinspect/index.vue'), + meta: { title: '检查表', perms: ['qualityinspect_view'] } + }, + { + path: 'task', + name: 'inspectTask', + component: () => import('@/views/qualityinspect/index.vue'), + meta: { title: '巡查任务', perms: ['qualityinspect_view'] } + }, + ] + }, + { + path: '/pt', + component: Layout, + redirect: '/pt/', + name: 'ProficiencyTest', + meta: { title: '能力验证', icon: 'PT', perms: ['pt_view'] }, + alwaysShow: true, + children: [ + { + path: '', + name: 'PT1', + component: () => import('@/views/PT/index.vue'), + meta: { title: '菜单一', perms: ['pt_view'] } + }, + { + path: 'msg', + name: 'PT2', + component: () => import('@/views/PT/index.vue'), + meta: { title: '菜单二', perms: ['pt_view'] } + }, + ] + }, { path: '/system', component: Layout, @@ -253,22 +285,22 @@ export const asyncRoutes = [ } ] }, - // 404 page must be placed at the end !!! - { path: '*', redirect: '/404', hidden: true } - ] - - const createRouter = () => new Router({ - // mode: 'history', // require service support - 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 - } - - export default router \ No newline at end of file + // 404 page must be placed at the end !!! + { path: '*', redirect: '/404', hidden: true } +] + +const createRouter = () => new Router({ + // mode: 'history', // require service support + 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 +} + +export default router \ No newline at end of file diff --git a/client/src/styles/sidebar.scss b/client/src/styles/sidebar.scss index 3dad4c3..9416b88 100644 --- a/client/src/styles/sidebar.scss +++ b/client/src/styles/sidebar.scss @@ -63,9 +63,13 @@ width: 100% !important; } + .el-menu-item { + font-size: 16px; + } // menu hover .submenu-title-noDropdown, .el-submenu__title { + font-size: 16px; &:hover { background-color: $menuHover !important; } @@ -79,7 +83,7 @@ & .el-submenu .el-menu-item { min-width: $sideBarWidth !important; background-color: $subMenuBg !important; - + font-size: 16px; &:hover { background-color: $subMenuHover !important; } diff --git a/client/src/styles/variables.scss b/client/src/styles/variables.scss index 027b130..aaeb16d 100644 --- a/client/src/styles/variables.scss +++ b/client/src/styles/variables.scss @@ -9,7 +9,7 @@ $menuHover:#263445; $subMenuBg:#1f2d3d; $subMenuHover:#001528; -$sideBarWidth: 230px; +$sideBarWidth: 240px; // the :export directive is the magic sauce for webpack // https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass diff --git a/client/src/views/PT/index.vue b/client/src/views/PT/index.vue new file mode 100644 index 0000000..e69de29 diff --git a/client/src/views/qualityinspect/index.vue b/client/src/views/qualityinspect/index.vue new file mode 100644 index 0000000..e69de29 diff --git a/client/src/views/supervision/record.vue b/client/src/views/supervision/record.vue index fb326af..ee6aff2 100644 --- a/client/src/views/supervision/record.vue +++ b/client/src/views/supervision/record.vue @@ -8,7 +8,7 @@ style="width: 140px" @keyup.enter.native="handleFilter" /> - - - - @@ -64,13 +64,11 @@ type="date" value-format="yyyy-MM-dd" @change="handleFilter" + style="width: 140px" placeholder="上报时间" > - 搜索
- 只显示本司 - 主动上报主动上报 -
+
确认
@@ -116,21 +117,26 @@ > - - + + - + - + @@ -144,13 +150,17 @@ + >{{ scope.row.up_user_.name }}/{{ scope.row.up_date }} - + @@ -160,9 +170,13 @@ {{ scope.row.state }} - {{ - scope.row.state - }} + {{ scope.row.state }} {{ scope.row.state }} @@ -187,15 +201,11 @@
- + @@ -260,7 +268,12 @@ @pagination="getList" /> - + diff --git a/server/apps/quality/__init__.py b/server/apps/quality/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/server/apps/quality/admin.py b/server/apps/quality/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/server/apps/quality/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/server/apps/quality/apps.py b/server/apps/quality/apps.py new file mode 100644 index 0000000..2455d38 --- /dev/null +++ b/server/apps/quality/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class QualityConfig(AppConfig): + name = 'quality' diff --git a/server/apps/quality/migrations/__init__.py b/server/apps/quality/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/server/apps/quality/models.py b/server/apps/quality/models.py new file mode 100644 index 0000000..0feccb7 --- /dev/null +++ b/server/apps/quality/models.py @@ -0,0 +1,4 @@ +from django.db import models +from utils.model import BaseModel +from apps.system.models import CommonAModel, CommonBModel, Organization, User, Dict, File +# Create your models here. diff --git a/server/apps/quality/tests.py b/server/apps/quality/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/server/apps/quality/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/server/apps/quality/views.py b/server/apps/quality/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/server/apps/quality/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/server/apps/supervision/views.py b/server/apps/supervision/views.py index 0ad7418..928c43a 100644 --- a/server/apps/supervision/views.py +++ b/server/apps/supervision/views.py @@ -172,6 +172,7 @@ class TaskViewSet(CreateUpdateCustomMixin, ModelViewSet): return Response(status=status.HTTP_200_OK) return Response('任务状态错误', status=status.HTTP_400_BAD_REQUEST) + def cal_task_rate(task, dept): """ 计算任务上报率, 确认率 @@ -216,8 +217,6 @@ class RecordViewSet(PageOrNot, CreateUpdateCustomMixin, ModelViewSet): queryset = queryset.filter(belong_dept__in = belong_depts) elif '本级' in data_range: queryset = queryset.filter(belong_dept = user.dept) - if self.request.query_params.get('only', None) == 'true': - queryset = queryset.filter(belong_dept = user.dept) return queryset def filter_queryset(self, queryset): diff --git a/server/apps/system/views.py b/server/apps/system/views.py index 7539b91..98ef80c 100644 --- a/server/apps/system/views.py +++ b/server/apps/system/views.py @@ -202,7 +202,16 @@ class OrganizationViewSet(PageOrNot,ModelViewSet): filterset_fields = ['pid','name', 'type','can_supervision'] ordering_fields = ['sort'] ordering = ['sort', 'pk'] - + + @action(methods=['get'], detail=False, permission_classes=[IsAuthenticated]) + def sub(self, request, pk=None): + """ + 获取本人所在部门的下级部门 + """ + subdept = get_child_queryset2(request.user.dept).order_by('sort') + serializer = OrganizationSerializer(subdept, many=True) + return Response(serializer.data) + class RoleViewSet(ModelViewSet): """ 角色:增删改查 diff --git a/server/server/settings.py b/server/server/settings.py index cf82f74..ad13b4b 100644 --- a/server/server/settings.py +++ b/server/server/settings.py @@ -44,7 +44,8 @@ INSTALLED_APPS = [ 'apps.system', 'apps.crm', 'apps.ability', - 'apps.supervision' + 'apps.supervision', + 'apps.quality' ] MIDDLEWARE = [