检验资质排序
This commit is contained in:
parent
4905729e07
commit
243f6996c1
|
@ -9,7 +9,7 @@ export function getQualificationList(query) {
|
|||
}
|
||||
export function getQualificationGroup(query) {
|
||||
return request({
|
||||
url: '/system/organization/group/',
|
||||
url: '/ability/qualification/group/',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
|
@ -58,6 +58,13 @@ export function getQualificationotherList(query) {
|
|||
params: query
|
||||
})
|
||||
}
|
||||
export function getQualificationGroup1(query) {
|
||||
return request({
|
||||
url: '/ability/qualificationother/group/',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function deletes(data)
|
||||
{
|
||||
return request({
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
<el-col :xs="24" :md="4">
|
||||
<el-select v-model="listQuery.qualification__ssbm__name" placeholder="所属单位" @change="handleFilter2" clearable style="width: 100%;">
|
||||
<el-option
|
||||
v-for="item in groupBy.name"
|
||||
:key="item.value"
|
||||
:label="item.text"
|
||||
:value="item.value">
|
||||
v-for="item in groupBy.qualification__ssbm__name"
|
||||
:key="item.value"
|
||||
:label="item.text"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
|
@ -76,9 +76,10 @@
|
|||
style="width: 100%;margin-top:10px;"
|
||||
border
|
||||
fit
|
||||
|
||||
stripe
|
||||
highlight-current-row
|
||||
height="650"
|
||||
|
||||
ref="filterTable"
|
||||
@selection-change="handleSelectionChange"
|
||||
@filter-change="filterChange"
|
||||
|
@ -138,8 +139,9 @@
|
|||
}
|
||||
</style>
|
||||
<script>
|
||||
import { getQualificationList,getQualificationotherList,deletes, getQualificationGroup, createQualification, updateQualification, deleteQualification, importQualification } from "@/api/qualification";
|
||||
import { getQualificationList,getQualificationotherList,deletes, getQualificationGroup1, createQualification, updateQualification, deleteQualification, importQualification } from "@/api/qualification";
|
||||
import checkPermission from "@/utils/permission"
|
||||
import {getOrgList} from "@/api/org";
|
||||
import { upUrl, upHeaders } from "@/api/file"
|
||||
import Pagination from "@/components/Pagination" // secondary package based on el-pagination
|
||||
const defaultCMA = {
|
||||
|
@ -162,7 +164,7 @@ export default {
|
|||
delarr:[],
|
||||
upHeaders: upHeaders(),
|
||||
upUrl: upUrl(),
|
||||
groupBy:{name:[]},
|
||||
groupBy:{qualification__ssbm__name:[]},
|
||||
tableData: [],
|
||||
rowIndex: '-1',
|
||||
OrderIndexArr: [],
|
||||
|
@ -233,9 +235,8 @@ delarr:[],
|
|||
|
||||
|
||||
this.tableData = response.data
|
||||
|
||||
|
||||
let OrderObj = {}
|
||||
let OrderObj = {}
|
||||
|
||||
this.tableData.forEach((element, index) => {
|
||||
element.rowIndex = index
|
||||
if (OrderObj[element.qualification_.id]) {
|
||||
|
@ -244,8 +245,11 @@ delarr:[],
|
|||
OrderObj[element.qualification_.id] = []
|
||||
OrderObj[element.qualification_.id].push(index)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.filterTable.doLayout()
|
||||
})
|
||||
// 将数组长度大于1的值 存储到this.OrderIndexArr(也就是需要合并的项)
|
||||
for (let k in OrderObj) {
|
||||
if (OrderObj[k].length > 1) {
|
||||
|
@ -254,7 +258,9 @@ delarr:[],
|
|||
}
|
||||
}
|
||||
this.listLoading = false
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
// 合并单元格
|
||||
objectSpanMethod({row,column,rowIndex,columnIndex}) {
|
||||
|
@ -279,8 +285,10 @@ delarr:[],
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
|
@ -314,13 +322,13 @@ delarr:[],
|
|||
|
||||
|
||||
getGroup() {
|
||||
for(let key in this.groupBy){
|
||||
let data = Object.assign({}, this.listQuery)
|
||||
data.group_by = key
|
||||
getQualificationGroup(data).then(response => {
|
||||
this.groupBy[key] = response.data
|
||||
console.log(response.data)
|
||||
})
|
||||
for (let key in this.groupBy) {
|
||||
let data = Object.assign({}, this.listQuery);
|
||||
data.group_by = key;
|
||||
getQualificationGroup1(data).then((response) => {
|
||||
this.groupBy[key] = response.data;
|
||||
console.log(this.groupBy);
|
||||
});
|
||||
}
|
||||
},
|
||||
resetFilter() {
|
||||
|
|
|
@ -180,16 +180,31 @@ class QualificationotherViewSet(PageOrNot,ModelViewSet):
|
|||
'put': 'qualificationother_update', 'delete': 'qualificationother_delete'}
|
||||
queryset = Qualificationother.objects.all()
|
||||
serializer_class = QualificationotherSerializer
|
||||
search_fields = ['qualification__cma', 'name','description','qualification__cnas', 'qualification__ssbm__name', 'qualification__service']
|
||||
search_fields = ['qualification__cma', 'name','description','qualification__cnas', 'qualification__ssbm__id', 'qualification__service']
|
||||
filterset_fields = ['qualification__ssbm__name']
|
||||
ordering_fields = ['qualification__ssbm__name']
|
||||
ordering = ['qualification__ssbm__name']
|
||||
ordering = ['qualification__ssbm__sort']
|
||||
@action(methods=['post'], detail=False, url_path='deletes', url_name='qualificationother_deletes', perms_map = {'post':'qualificationother_deletes'})
|
||||
def deletes(self, request):
|
||||
|
||||
array = request.data['ids']
|
||||
Qualificationother.objects.filter(pk__in=array).delete()
|
||||
return Response(status = status.HTTP_200_OK)
|
||||
@action(methods=['get'], detail=False,url_name='qualification_group_by', perms_map = {'*':'*'})
|
||||
def group(self, request, pk=None):
|
||||
"""
|
||||
聚合查询列
|
||||
"""
|
||||
queryset = self.filter_queryset(self.get_queryset())
|
||||
ret = []
|
||||
if request.query_params.get('group_by', None):
|
||||
group_by = request.query_params.get('group_by')
|
||||
group_by_data = list(queryset.values(group_by).annotate(count=Count(group_by)).order_by('qualification__ssbm__sort', group_by))
|
||||
for i in group_by_data:
|
||||
if i[group_by] and i['count']:
|
||||
ret.append({'text':i[group_by]+'('+ str(i['count']) +')','value':i[group_by]})
|
||||
return Response(ret)
|
||||
|
||||
class InspectionViewSet(ModelViewSet):
|
||||
"""
|
||||
CNAS检测能力:增删改查
|
||||
|
|
|
@ -21,6 +21,7 @@ from rest_framework_simplejwt.tokens import RefreshToken
|
|||
from utils.queryset import get_child_queryset2
|
||||
from django.db.models import Count
|
||||
|
||||
from utils.pagination import PageOrNot
|
||||
from .filters import UserFilter
|
||||
from .models import (Dict, DictType, File, Message, Organization, Permission,
|
||||
Position, Role, User)
|
||||
|
@ -174,7 +175,7 @@ class PermissionViewSet(ModelViewSet):
|
|||
ordering = 'sort'
|
||||
|
||||
|
||||
class OrganizationViewSet(ModelViewSet):
|
||||
class OrganizationViewSet(PageOrNot,ModelViewSet):
|
||||
"""
|
||||
组织机构:增删改查
|
||||
"""
|
||||
|
@ -186,21 +187,7 @@ class OrganizationViewSet(ModelViewSet):
|
|||
search_fields = ['name']
|
||||
ordering_fields = ['sort']
|
||||
ordering = ['sort', 'pk']
|
||||
@action(methods=['get'], detail=False,url_name='organization_group_by', perms_map = {'*':'*'})
|
||||
def group(self, request, pk=None):
|
||||
"""
|
||||
聚合查询列
|
||||
"""
|
||||
queryset = self.filter_queryset(self.get_queryset())
|
||||
ret = []
|
||||
if request.query_params.get('group_by', None):
|
||||
group_by = request.query_params.get('group_by')
|
||||
group_by_data = list(queryset.values(group_by).annotate(count=Count(group_by)).order_by(group_by))
|
||||
for i in group_by_data:
|
||||
if i[group_by] and i['count']:
|
||||
ret.append({'text':i[group_by]+'('+ str(i['count']) +')','value':i[group_by]})
|
||||
return Response(ret)
|
||||
|
||||
|
||||
class RoleViewSet(ModelViewSet):
|
||||
"""
|
||||
角色:增删改查
|
||||
|
|
Loading…
Reference in New Issue