批量删除所属公司
This commit is contained in:
parent
47b3104d72
commit
818021df6e
|
@ -72,7 +72,8 @@
|
|||
</div>
|
||||
<el-button slot="reference">导入分子公司能力</el-button>
|
||||
</el-popover>
|
||||
<el-button @click="delAll()" v-if="checkPermission(['cma_deletes'])">批量删除</el-button>
|
||||
<el-button @click="delAll()" v-if="checkPermission(['cma_deletes'])" type="danger" plain>批量删除</el-button>
|
||||
<el-button @click="delAll2()" v-if="checkPermission(['cma_deletes'])" type="danger" plain>批量删除所属公司</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card style="margin-top: 10px">
|
||||
|
@ -388,7 +389,35 @@ export default {
|
|||
.catch((err) => {
|
||||
});
|
||||
},
|
||||
|
||||
delAll2() {
|
||||
let sszx = this.listQuery.sszx
|
||||
if(sszx==null || sszx==='' || sszx == undefined){
|
||||
this.$message({
|
||||
message: "请选中所属公司",
|
||||
type: "warning",
|
||||
});
|
||||
return
|
||||
}
|
||||
this.$confirm("确认删除?", "警告", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "error",
|
||||
})
|
||||
.then(async () => {
|
||||
|
||||
let data = { sszx: sszx };
|
||||
deletes(data)
|
||||
.then((res) => {
|
||||
this.$message({
|
||||
message: "删除成功",
|
||||
type: "success",
|
||||
});
|
||||
this.getList();
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
});
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
|
|
|
@ -186,10 +186,14 @@ class CMAViewSet(RecordMixin, ModelViewSet):
|
|||
@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()
|
||||
|
||||
array = request.data.get('ids', [])
|
||||
sszx = request.data.get('sszx', None)
|
||||
if array:
|
||||
CMA.objects.filter(sszx__id=sszx).delete()
|
||||
elif sszx:
|
||||
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):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue