批量删除所属公司
This commit is contained in:
parent
47b3104d72
commit
818021df6e
|
|
@ -72,7 +72,8 @@
|
||||||
</div>
|
</div>
|
||||||
<el-button slot="reference">导入分子公司能力</el-button>
|
<el-button slot="reference">导入分子公司能力</el-button>
|
||||||
</el-popover>
|
</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>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card style="margin-top: 10px">
|
<el-card style="margin-top: 10px">
|
||||||
|
|
@ -388,7 +389,35 @@ export default {
|
||||||
.catch((err) => {
|
.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) {
|
handleSelectionChange(val) {
|
||||||
this.multipleSelection = 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'})
|
@action(methods=['post'], detail=False, url_path='deletes', url_name='cma_deletes', perms_map = {'post':'cma_deletes'})
|
||||||
def deletes(self, request):
|
def deletes(self, request):
|
||||||
|
|
||||||
array = request.data['ids']
|
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()
|
CMA.objects.filter(pk__in=array).delete()
|
||||||
|
|
||||||
return Response(status = status.HTTP_200_OK)
|
return Response(status = status.HTTP_200_OK)
|
||||||
|
|
||||||
@action(methods=['post'], detail=False, url_path='import', url_name='cma_import', perms_map = {'post':'cma_import'})
|
@action(methods=['post'], detail=False, url_path='import', url_name='cma_import', perms_map = {'post':'cma_import'})
|
||||||
def cma_import(self, request, pk=None):
|
def cma_import(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue