下拉删除

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
type="primary"
size="small"
:disabled="!checkPermission(['certapps_update'])"
@click="handlestate(scope.row.id)"
>下达实验室</el-button>
</template>
</el-table-column>
</el-table>
@ -269,6 +270,15 @@ export default {
var val='待实验室检验';
teststateCertappunit(id, {'teststate':val}).then(res=>{
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>
<div class="app-container">
<el-table v-loading="listLoading"
:data="detectoryList.results"
style="width: 100%;margin-top:10px;"
border
fit
stripe
highlight-current-row
max-height="600">
<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-button-group>
</template>
</el-table-column>
</el-table>
<pagination v-show="detectoryList.count>0"
:total="detectoryList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
</div>
</div>
</template>
<script>
import { getTestOrgList} from "@/api/laboratory"
import Pagination from "@/components/Pagination"
import checkPermission from '@/utils/permission'
export default {
components: { Pagination },
data() {
return {
detectoryList: { count: 0 },
listLoading: true,
listQuery: {
page: 1,
page_size: 20
import { getTestOrgList} from "@/api/laboratory"
import { getDictList } from "@/api/dict";
import { getCertunitList } from "@/api/certunit";
import { getCertappList, deleteCertapp } from "@/api/certapp"
import { getCertappunitList, testtaskCertappunit,teststateCertappunit } from "@/api/certappunit";
import Pagination from "@/components/Pagination";
import checkPermission from "@/utils/permission";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { genTree } from "../../utils";
export default {
components: { Pagination, Treeselect },
props:['certapp'],
data() {
return {
tableData: [],
listLoading: true,
taskOptions:[
{
label: "待检任务",
value: "待检任务",
},
dialogVisible: false,
dialogType: 'create',
rule1: {
{
label: "在检任务",
value: "在检任务",
},
{
label: "已检任务",
value: "已检任务",
}],
listQuery: {
page: 1,
page_size: 20
},
};
},
created() {
this.getList();
},
methods: {
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>

View File

@ -78,7 +78,7 @@ class CertappViewset(PageOrNot, RbacFilterSet, ModelViewSet):
queryset = CertApp.objects.all()
serializer_class = CertappSerializer
ordering = ['-create_time']
filterset_fields = ['state', 'project', 'cert_field']
filterset_fields = ['state', 'project','cert_field']
# filterset_class = CertAppFilter
@ -197,7 +197,7 @@ class CertappunitViewset(PageOrNot, ModelViewSet):
perms_map={'get': '*', '*':'certapp_view'}
queryset = Certappunit.objects.all()
serializer_class = CertappunitSerializer
filterset_fields = ['certapp']
filterset_fields = ['certapp','teststate']
ordering= ['-id']
@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.save()
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:
return Response('检测任务异常,操作失败', status=status.HTTP_400_BAD_REQUEST)
@action(methods=['put'], detail=True, perms_map={'put':'certapp_createsamples'}, url_name='certappunit_createsamples')