批量删除功能调整

This commit is contained in:
shilixia 2020-10-13 16:24:38 +08:00
parent a667f9c8c8
commit 49c0f91ff0
2 changed files with 13 additions and 10 deletions

View File

@ -70,15 +70,15 @@
>
</el-upload>
</div>
<el-button slot="reference">导入分子公司能力</el-button>
</el-popover>
<el-button @click="delAll()" v-if="checkPermission(['cma_deletes'])">批量删除</el-button>
</div>
<div style="margin-top: 20px">
<el-button @click="delAll()" type="danger" v-if="checkPermission(['cma_deletes'])">批量删除</el-button>
<el-button @click="toggleSelection()">取消选择</el-button>
</div>
<el-table
v-loading="listLoading"
:data="cmaList.results"
@ -375,9 +375,7 @@ export default {
console.error(err);
});
},
toggleSelection() {
this.$refs.filterTable.clearSelection();
},
delAll() {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",

View File

@ -38,7 +38,13 @@ class CMAViewSet(ModelViewSet):
if i[group_by] and i['count']:
ret.append({'text':i[group_by]+'('+ str(i['count']) +')','value':i[group_by]})
return Response(ret)
@action(methods=['post'], detail=False, url_path='deletes', url_name='cma_deletes', perms_map = {'post':'cma_deletes'})
def deletes(self, request):
array = request.data['ids']
CMA.objects.filter(pk__in=array).delete()
return Response(status = status.HTTP_200_OK)
@action(methods=['post'], detail=False, url_path='import', url_name='cma_import', perms_map = {'post':'cma_import'})
def cma_import(self, request, pk=None):
"""
@ -75,7 +81,6 @@ class CMAViewSet(ModelViewSet):
else:
return Response('不支持非xlsx格式', status = status.HTTP_400_BAD_REQUEST)
return Response(status = status.HTTP_200_OK)
@action(methods=['post'], detail=False, url_path='import2', url_name='cma_import2', perms_map = {'post':'cma_import2'})
def cma_import2(self, request, pk=None):
"""