下拉删除

This commit is contained in:
shilixia 2020-10-29 10:03:08 +08:00
parent ebae67ab94
commit e11beae810
3 changed files with 137 additions and 67 deletions

View File

@ -44,9 +44,10 @@
<el-button <el-button
type="primary" type="primary"
size="small" size="small"
:disabled="!checkPermission(['certapps_update'])"
@click="handlestate(scope.row.id)" @click="handlestate(scope.row.id)"
>下达实验室</el-button> >下达实验室</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -269,6 +270,15 @@ export default {
var val='待实验室检验'; var val='待实验室检验';
teststateCertappunit(id, {'teststate':val}).then(res=>{ teststateCertappunit(id, {'teststate':val}).then(res=>{
this.$message.success('成功') this.$message.success('成功')
this.getList()
})
},
updatestate(id){
var val='待CTC下达';
teststateCertappunit(id, {'teststate':val}).then(res=>{
this.$message.success('成功')
this.getList()
}) })
}, },

View File

@ -1,76 +1,132 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<div>
<el-table
v-loading="listLoading"
:data="tableData"
style="width: 100%;"
border
fit
stripe
highlight-current-row
height="380"
@selection-change='selectRow'>
<el-table-column type="selection" width="45" align="center"></el-table-column>
<el-table-column type="index" width="50" />
<el-table-column label="状态">
<template slot-scope="scope" >{{ scope.row.teststate }}</template>
</el-table-column>
<el-table-column label="检测任务号">
<template slot-scope="scope" v-if="scope.row.detnumber">{{ scope.row.detnumber }}</template>
</el-table-column>
<el-table-column label="检测单元">
<template slot-scope="scope" >{{ scope.row.certunit_.name }}</template>
</el-table-column>
<el-table-column label="样品描述">
<template slot-scope="scope" v-if="scope.row.sampledec">{{ scope.row.sampledec }}</template>
</el-table-column>
<el-table-column label="收费方式">
<template slot-scope="scope" v-if="scope.row.charge">{{ scope.row.charge }}</template>
</el-table-column>
<el-table-column label="被委托检测机构">
<template slot-scope="scope" v-if="scope.row.testorg_">{{ scope.row.testorg_.name}}</template>
</el-table-column>
<el-table-column label="检验项目">
<template slot-scope="scope" v-if="scope.row.testitem">{{ scope.row.testitem}}</template>
</el-table-column>
<el-table-column label="操作" width="250">
<template slot-scope="scope">
<el-button-group>
<el-button
type="primary"
size="small"
@click="handleissued(scope)"
>任务反馈</el-button>
<el-table v-loading="listLoading" </el-button-group>
:data="detectoryList.results" </template>
style="width: 100%;margin-top:10px;" </el-table-column>
border
fit
stripe
highlight-current-row
max-height="600">
</el-table> </el-table>
<pagination v-show="detectoryList.count>0"
:total="detectoryList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
</div> </div>
</div>
</template> </template>
<script> <script>
import { getTestOrgList} from "@/api/laboratory" import { getTestOrgList} from "@/api/laboratory"
import { getDictList } from "@/api/dict";
import Pagination from "@/components/Pagination" import { getCertunitList } from "@/api/certunit";
import checkPermission from '@/utils/permission' import { getCertappList, deleteCertapp } from "@/api/certapp"
import { getCertappunitList, testtaskCertappunit,teststateCertappunit } from "@/api/certappunit";
export default { import Pagination from "@/components/Pagination";
components: { Pagination }, import checkPermission from "@/utils/permission";
data() { import Treeselect from "@riophae/vue-treeselect";
return { import "@riophae/vue-treeselect/dist/vue-treeselect.css";
detectoryList: { count: 0 }, import { genTree } from "../../utils";
export default {
listLoading: true, components: { Pagination, Treeselect },
listQuery: { props:['certapp'],
page: 1, data() {
page_size: 20 return {
tableData: [],
listLoading: true,
taskOptions:[
{
label: "待检任务",
value: "待检任务",
}, },
{
dialogVisible: false, label: "在检任务",
dialogType: 'create', value: "在检任务",
rule1: {
}, },
{
}; label: "已检任务",
}, value: "已检任务",
created() { }],
this.getList(); listQuery: {
}, page: 1,
methods: { page_size: 20
checkPermission,
getList() {
this.listLoading = true;
getTestOrgList(this.listQuery).then(response => {
if (response.data) {
this.detectoryList = response.data
}
this.listLoading = false;
});
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20
};
this.getList();
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
}, },
};
},
watch:{
},
created() {
this.getList();
},
methods: {
checkPermission,
getList() {
this.listLoading = true;
getCertappunitList({ pageoff:true,
teststate:"待CTC下达"}).then((response) => {
if (response.data) {
this.tableData = response.data;
console.log( this.tableData)
}
this.listLoading = false;
});
},
handleissued(scope) {
this.$router.push({
name: "Certapptest",
params: { id: scope.row.certapp, action:'access' },
});
} }
}; },
};
</script> </script>

View File

@ -78,7 +78,7 @@ class CertappViewset(PageOrNot, RbacFilterSet, ModelViewSet):
queryset = CertApp.objects.all() queryset = CertApp.objects.all()
serializer_class = CertappSerializer serializer_class = CertappSerializer
ordering = ['-create_time'] ordering = ['-create_time']
filterset_fields = ['state', 'project', 'cert_field'] filterset_fields = ['state', 'project','cert_field']
# filterset_class = CertAppFilter # filterset_class = CertAppFilter
@ -197,7 +197,7 @@ class CertappunitViewset(PageOrNot, ModelViewSet):
perms_map={'get': '*', '*':'certapp_view'} perms_map={'get': '*', '*':'certapp_view'}
queryset = Certappunit.objects.all() queryset = Certappunit.objects.all()
serializer_class = CertappunitSerializer serializer_class = CertappunitSerializer
filterset_fields = ['certapp'] filterset_fields = ['certapp','teststate']
ordering= ['-id'] ordering= ['-id']
@action(methods=['put'], detail=True, perms_map={'put':'certapp_access'}, url_name='certappunit_access') @action(methods=['put'], detail=True, perms_map={'put':'certapp_access'}, url_name='certappunit_access')
@ -237,6 +237,10 @@ class CertappunitViewset(PageOrNot, ModelViewSet):
obj.inspectionstate = "待检验" obj.inspectionstate = "待检验"
obj.save() obj.save()
return Response(status=status.HTTP_200_OK) return Response(status=status.HTTP_200_OK)
elif obj.teststate == "待提交CTC":
obj.teststate = request.data['teststate']
obj.save()
return Response(status=status.HTTP_200_OK)
else: else:
return Response('检测任务异常,操作失败', status=status.HTTP_400_BAD_REQUEST) return Response('检测任务异常,操作失败', status=status.HTTP_400_BAD_REQUEST)
@action(methods=['put'], detail=True, perms_map={'put':'certapp_createsamples'}, url_name='certappunit_createsamples') @action(methods=['put'], detail=True, perms_map={'put':'certapp_createsamples'}, url_name='certappunit_createsamples')