jiancharenwu
This commit is contained in:
parent
89399f537b
commit
eaf6d0a8bc
|
@ -71,3 +71,40 @@ export function deleteTestOrgNotice(id) {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function getDetectionTaskList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/laboratory/detectiontask/',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function getDetectionTask(id) {
|
||||||
|
return request({
|
||||||
|
url: `/laboratory/detectiontask/${id}/`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function createDetectionTask(data) {
|
||||||
|
return request({
|
||||||
|
url: '/laboratory/detectiontask/',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateDetectionTask(id, data) {
|
||||||
|
return request({
|
||||||
|
url: `/laboratory/detectiontask/${id}/`,
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteDetectionTask(id) {
|
||||||
|
return request({
|
||||||
|
url: `/laboratory/detectiontask/${id}/`,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ import access from "@/views/accessment/access"
|
||||||
import Detectiontask from "@/views/certapp/detectiontask"
|
import Detectiontask from "@/views/certapp/detectiontask"
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
components: { CCCform, Certunit, QMSform, Conclusion, Member, access, CHARGE, REVIEW},
|
components: { CCCform,Detectiontask, Certunit, QMSform, Conclusion, Member, access, CHARGE, REVIEW},
|
||||||
|
|
||||||
props: [],
|
props: [],
|
||||||
data() {
|
data() {
|
||||||
|
|
|
@ -12,14 +12,11 @@
|
||||||
@row-click="rowClick"
|
@row-click="rowClick"
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="单元名称">
|
<el-table-column label="检测任务号">
|
||||||
<template slot-scope="scope" >{{ scope.row.name }}</template>
|
<template slot-scope="scope" >{{ scope.row.detnumber }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="单元描述">
|
<el-table-column label="被委托检测机构">
|
||||||
<template slot-scope="scope" >{{ scope.row.description }}</template>
|
<template slot-scope="scope" >{{ scope.row.testorg}}</template>
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="采用标准">
|
|
||||||
<template slot-scope="scope" >{{ scope.row.standard_.fullname }}</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间">
|
<el-table-column label="创建时间">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
@ -45,37 +42,12 @@
|
||||||
:limit.sync="listQuery.page_size"
|
:limit.sync="listQuery.page_size"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="80px" style="margin-top:10px">
|
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="150px" style="margin-top:10px">
|
||||||
<el-col :xs="24" :md="12">
|
<el-col :xs="24" :md="12">
|
||||||
<el-form-item label="实施规则" prop="implementrule">
|
<el-form-item label="被委托检测机构" prop="testorg">
|
||||||
<el-select
|
<el-select v-model="formData.testorg" placeholder="请选择检测机构" clearable :style="{width: '100%'}">
|
||||||
v-model="formData.implementrule"
|
|
||||||
placeholder="请选择实施规则"
|
|
||||||
clearable
|
|
||||||
:style="{width: '100%'}"
|
|
||||||
@change="changeTypeOptions"
|
|
||||||
>
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(item, index) in implementruleOptions"
|
v-for="(item, index) in TestOptions"
|
||||||
:key="index"
|
|
||||||
:label="item.fullname"
|
|
||||||
:value="item.id"
|
|
||||||
:disabled="item.disabled"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :xs="24" :md="12">
|
|
||||||
<el-form-item label="单元类型" prop="unittype">
|
|
||||||
<el-select
|
|
||||||
v-model="formData.unittype"
|
|
||||||
placeholder="请选择单元类型"
|
|
||||||
clearable
|
|
||||||
:style="{width: '100%'}"
|
|
||||||
@change="changeUnit"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="(item, index) in unittypeOptions"
|
|
||||||
:key="index"
|
:key="index"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
|
@ -84,20 +56,10 @@
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :md="12">
|
|
||||||
<el-form-item label="采用标准" prop="standard">
|
<el-col :xs="24" :md="12">
|
||||||
<el-input
|
<el-form-item label="认证性质" prop="testorg">
|
||||||
v-model="formData.standard_.fullname"
|
<el-select placeholder="请选择认证性质" clearable :style="{width: '100%'}">
|
||||||
placeholder="请输入采用标准"
|
|
||||||
readonly
|
|
||||||
clearable
|
|
||||||
:style="{width: '100%'}"
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :xs="24" :md="12">
|
|
||||||
<el-form-item label="检测机构" prop="testorg">
|
|
||||||
<el-select v-model="formData.testorg" placeholder="请选择检测机构" clearable :style="{width: '100%'}">
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="(item, index) in testorgOptions"
|
v-for="(item, index) in testorgOptions"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
@ -108,38 +70,78 @@
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :md="8">
|
<el-col :xs="24" :md="8">
|
||||||
<el-form-item label="单元名称" prop="name">
|
<el-form-item label="检验项目" prop="testitem">
|
||||||
<el-input
|
<el-select placeholder="请选择检验项目" v-model="formData.testitem" filterable allow-create :style="{width: '100%'}"
|
||||||
v-model="formData.name"
|
>
|
||||||
placeholder="请输入单元名称"
|
<el-option
|
||||||
|
v-for="(item, index) in patternOptions"
|
||||||
|
:key="index"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
:disabled="item.disabled"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :xs="24" :md="8">
|
||||||
|
<el-form-item label="收费方式" prop="charge">
|
||||||
|
<el-select placeholder="请选择收费方式" v-model="formData.charge" filterable allow-create :style="{width: '100%'}"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="(item, index) in chargeOptions"
|
||||||
|
:key="index"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
:disabled="item.disabled"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :xs="24" :md="12">
|
||||||
|
<el-form-item label="检测任务号" prop="detnumber">
|
||||||
|
<el-input v-model="formData.detnumber"
|
||||||
|
placeholder="请输入检测任务号"
|
||||||
|
readonly
|
||||||
clearable
|
clearable
|
||||||
:style="{width: '100%'}"
|
:style="{width: '100%'}"
|
||||||
></el-input>
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :md="16">
|
<el-col :xs="24" :md="12">
|
||||||
<el-form-item label="单元描述" prop="description">
|
<el-form-item label="检测单元" prop="testorg">
|
||||||
<el-input
|
<el-select v-model="formData.testorg" placeholder="请选择检测单元" clearable :style="{width: '100%'}">
|
||||||
v-model="formData.description"
|
<el-option
|
||||||
placeholder="请输入单元描述"
|
v-for="(item, index) in TestOptions"
|
||||||
clearable
|
:key="index"
|
||||||
:style="{width: '100%'}"
|
:label="item.label"
|
||||||
></el-input>
|
:value="item.value"
|
||||||
|
:disabled="item.disabled"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item size="large">
|
<el-col :xs="24" :md="12">
|
||||||
<el-button type="primary" @click="createNew">创建新记录</el-button>
|
<el-form-item label="样品描述" prop="standard">
|
||||||
<el-button type="primary" @click="updateNow">保存</el-button>
|
<el-input type="textarea" :rows="5"
|
||||||
<el-button @click="resetForm">重置</el-button>
|
clearable
|
||||||
|
:style="{width: '100%'}"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :xs="24" :md="12">
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input type="textarea" :rows="5" v-model="formData.remark"
|
||||||
|
clearable
|
||||||
|
:style="{width: '100%'}"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getImplementRuleList, getUnitTypeList } from "@/api/implementrule"
|
import { getDetectionTaskList} from "@/api/laboratory"
|
||||||
|
import { getTestOrgList} from "@/api/laboratory"
|
||||||
import { getDictList } from "@/api/dict";
|
import { getDictList } from "@/api/dict";
|
||||||
import Pagination from "@/components/Pagination";
|
import Pagination from "@/components/Pagination";
|
||||||
import checkPermission from "@/utils/permission";
|
import checkPermission from "@/utils/permission";
|
||||||
|
@ -147,7 +149,7 @@ import Treeselect from "@riophae/vue-treeselect";
|
||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
import { genTree } from "../../utils";
|
import { genTree } from "../../utils";
|
||||||
export default {
|
export default {
|
||||||
name: "Productunit",
|
name: "Detectform",
|
||||||
components: { Pagination, Treeselect },
|
components: { Pagination, Treeselect },
|
||||||
props:['certapp'],
|
props:['certapp'],
|
||||||
data() {
|
data() {
|
||||||
|
@ -156,74 +158,53 @@ export default {
|
||||||
listLoading: true,
|
listLoading: true,
|
||||||
listQuery: {
|
listQuery: {
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: 20,
|
page_size: 20
|
||||||
certapp:this.certapp
|
|
||||||
},
|
},
|
||||||
formData: {
|
formData: {
|
||||||
certapp:this.certapp,
|
|
||||||
implementrule: undefined,
|
|
||||||
unittype: undefined,
|
|
||||||
standard: undefined,
|
|
||||||
standard_:{},
|
|
||||||
testorg: undefined,
|
testorg: undefined,
|
||||||
name: undefined,
|
testitem:undefined,
|
||||||
description: undefined,
|
detnumber:undefined,
|
||||||
|
remark:undefined
|
||||||
},
|
},
|
||||||
rules: {
|
TestOptions:[],
|
||||||
implementrule: [
|
patternOptions: [
|
||||||
{
|
{
|
||||||
required: true,
|
label: "规则规定的项目",
|
||||||
message: "请选择实施规则",
|
value: "规则规定的项目",
|
||||||
trigger: "change",
|
},
|
||||||
},
|
{
|
||||||
],
|
label: "特定项目见备注",
|
||||||
unittype: [
|
value: "特定项目见备注",
|
||||||
{
|
}
|
||||||
required: true,
|
|
||||||
message: "请选择单元类型",
|
|
||||||
trigger: "change",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
standard: [],
|
|
||||||
testorg: [],
|
|
||||||
name: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: "请输入单元名称",
|
|
||||||
trigger: "blur",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
description: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: "请输入单元描述",
|
|
||||||
trigger: "blur",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
implementruleOptions: [
|
|
||||||
],
|
|
||||||
unittypeOptions: [
|
|
||||||
],
|
|
||||||
testorgOptions: [
|
|
||||||
],
|
],
|
||||||
|
chargeOptions:[
|
||||||
|
{
|
||||||
|
label: "CTC代收",
|
||||||
|
value: "CTC代收",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "自收",
|
||||||
|
value: "自收",
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch:{
|
watch:{
|
||||||
'formData.implementrule': function(val){
|
|
||||||
this.changeTypeOptions()
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getImplementRuleOptions()
|
this.getTestOptions()
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkPermission,
|
checkPermission,
|
||||||
getList() {
|
getList() {
|
||||||
this.listLoading = true;
|
this.listLoading = true;
|
||||||
getUnitList(this.listQuery).then((response) => {
|
getDetectionTaskList(this.listQuery).then((response) => {
|
||||||
|
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
|
|
||||||
this.tableData = response.data;
|
this.tableData = response.data;
|
||||||
|
@ -232,87 +213,17 @@ export default {
|
||||||
this.listLoading = false;
|
this.listLoading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
resetFilter() {
|
getTestOptions(){
|
||||||
this.listQuery = {
|
getTestOrgList().then(res=>{
|
||||||
page: 1,
|
this.TestOptions = genTree(res.data.results)
|
||||||
page_size: 20,
|
|
||||||
};
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
handleFilter() {
|
|
||||||
this.listQuery.page = 1;
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
handleCreate(item, index) {
|
|
||||||
this.$router.push({
|
|
||||||
name: "CertappForm",
|
|
||||||
params: { kind: item.code, action: "create" },
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleUpdate(scope) {
|
|
||||||
this.$router.push({
|
|
||||||
name: "CertappForm",
|
|
||||||
params: { action: "update", kind: scope.row.cert_field_.code },
|
|
||||||
query: { id: scope.row.id },
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleDelete(scope) {
|
|
||||||
this.$confirm("确定删除?", "警告", {
|
|
||||||
// confirmButtonText: '确定',
|
|
||||||
// cancelButtonText: '取消',
|
|
||||||
type: "warning",
|
|
||||||
}).then(() => {
|
|
||||||
deleteUnit(scope.row.id).then((res) => {
|
|
||||||
this.$message.success("成功");
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
}).catch(()=>{});
|
|
||||||
},
|
|
||||||
createNew() {
|
|
||||||
this.$refs['elForm'].validate(valid => {
|
|
||||||
if (!valid) return
|
|
||||||
// TODO 提交表单
|
|
||||||
createUnit(this.formData).then(res=>{
|
|
||||||
this.getList()
|
|
||||||
this.$message.success('成功')
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
updateNow(){
|
getDataList(){
|
||||||
this.$refs['elForm'].validate(valid => {
|
|
||||||
if (!valid) return
|
|
||||||
// TODO 提交表单
|
|
||||||
updateUnit(this.formData.id, this.formData).then(res=>{
|
|
||||||
this.getList()
|
|
||||||
this.$message.success('成功')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
resetForm() {
|
|
||||||
this.$refs['elForm'].resetFields()
|
|
||||||
},
|
|
||||||
getImplementRuleOptions(){
|
|
||||||
var query = {ccc_list:this.certapp.cccpv_class}
|
|
||||||
getImplementRuleList(query).then(res=>{
|
|
||||||
this.implementruleOptions = res.data.results
|
|
||||||
})
|
|
||||||
},
|
|
||||||
changeTypeOptions(){
|
|
||||||
getUnitTypeList({implementrule:this.formData.implementrule}).then(res=>{
|
|
||||||
this.unittypeOptions = genTree(res.data)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
changeUnit(val){
|
|
||||||
let obj = {};
|
|
||||||
obj = this.unittypeOptions.find((item)=>{//这里的userList就是上面遍历的数据源
|
|
||||||
return item.id === val;//筛选出匹配数据
|
|
||||||
});
|
|
||||||
this.formData.name = obj.name
|
|
||||||
this.formData.standard = obj.standard
|
|
||||||
this.formData.standard_ = obj.standard_
|
|
||||||
},
|
|
||||||
rowClick(row, column, event){
|
|
||||||
this.formData = Object.assign({}, row);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
# Generated by Django 3.0.5 on 2020-09-24 01:50
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
import django.utils.timezone
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('system', '0031_delete_bscodeset'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
('project', '0039_merge_20200924_0950'),
|
||||||
|
('laboratory', '0005_auto_20200824_1649'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='DetectionTask',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
|
||||||
|
('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
|
||||||
|
('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
|
||||||
|
('remark', models.TextField(blank=True, null=True, verbose_name='备注')),
|
||||||
|
('belong_dept', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='detectiontask_belong_dept', to='system.Organization', verbose_name='所属部门')),
|
||||||
|
('certappunit', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='detectionTask_certappunit', to='project.Certappunit', verbose_name='认证单元')),
|
||||||
|
('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='detectiontask_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
|
||||||
|
('testorg', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='detectionTask_testorg', to='laboratory.TestOrg', verbose_name='检测机构')),
|
||||||
|
('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='detectiontask_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'abstract': False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.0.5 on 2020-09-24 03:12
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('laboratory', '0006_detectiontask'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='detectiontask',
|
||||||
|
name='detnumber',
|
||||||
|
field=models.CharField(blank=True, max_length=100, null=True, verbose_name='检测任务号'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Generated by Django 3.0.5 on 2020-09-24 04:03
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('laboratory', '0007_detectiontask_detnumber'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='detectiontask',
|
||||||
|
name='charge',
|
||||||
|
field=models.CharField(choices=[('CTC代收', 'CTC代收'), ('自收', '自收')], default='CTC代收', max_length=50, verbose_name='收费方式'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='detectiontask',
|
||||||
|
name='testitem',
|
||||||
|
field=models.CharField(choices=[('规则规定的项目', '规则规定的项目'), ('特定的项目见备注', '特定的项目见备注')], default='规则规定的项目', max_length=50, verbose_name='检测项目'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -29,25 +29,39 @@ class TestOrgNotice(CommonBModel):
|
||||||
"""
|
"""
|
||||||
实验室公告
|
实验室公告
|
||||||
"""
|
"""
|
||||||
name = models.CharField('公告标题',null=True, blank=True,max_length=500)
|
name = models.CharField('公告标题',null=True, blank=True,max_length=500)
|
||||||
publishdate = models.DateTimeField('发布时间')
|
publishdate = models.DateTimeField('发布时间')
|
||||||
ismportant = models.BooleanField('是否重要公告', default=True)
|
ismportant = models.BooleanField('是否重要公告', default=True)
|
||||||
note = models.CharField('公告内容',null=True, blank=True,max_length=6000)
|
note = models.CharField('公告内容',null=True, blank=True,max_length=6000)
|
||||||
isalluser = models.BooleanField('是否通知全员', default=True)
|
isalluser = models.BooleanField('是否通知全员', default=True)
|
||||||
path = models.CharField('文件地址', max_length=1000, null=True, blank=True)
|
path = models.CharField('文件地址', max_length=1000, null=True, blank=True)
|
||||||
dettonotice = models.ManyToManyField(TestOrg, blank=True, verbose_name='选择的实验室', related_name= 'testorgnotice_dettonotice')
|
dettonotice = models.ManyToManyField(TestOrg, blank=True, verbose_name='选择的实验室', related_name= 'testorgnotice_dettonotice')
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = '实验室通知公告'
|
verbose_name = '实验室通知公告'
|
||||||
verbose_name_plural = verbose_name
|
verbose_name_plural = verbose_name
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
class DetectionTask(CommonBModel):
|
class DetectionTask(CommonBModel):
|
||||||
"""
|
"""
|
||||||
检测任务
|
检测任务
|
||||||
"""
|
"""
|
||||||
testorg = models.ForeignKey(TestOrg,verbose_name='检测机构', related_name='detectionTask_testorg', on_delete=models.DO_NOTHING)
|
item_choices = (
|
||||||
certappunit = models.ForeignKey(Certappunit,verbose_name='认证单元', related_name='detectionTask_certappunit', on_delete=models.DO_NOTHING)
|
('规则规定的项目', '规则规定的项目'),
|
||||||
remark = models.TextField('备注', null=True, blank=True)
|
('特定的项目见备注', '特定的项目见备注'),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
charge_choices = (
|
||||||
|
('CTC代收', 'CTC代收'),
|
||||||
|
('自收', '自收'),
|
||||||
|
|
||||||
|
)
|
||||||
|
testorg = models.ForeignKey(TestOrg,verbose_name='检测机构', related_name='detectionTask_testorg', on_delete=models.DO_NOTHING)
|
||||||
|
certappunit = models.ForeignKey(Certappunit,verbose_name='认证单元', related_name='detectionTask_certappunit', on_delete=models.DO_NOTHING)
|
||||||
|
remark = models.TextField('备注', null=True, blank=True)
|
||||||
|
detnumber = models.CharField('检测任务号', max_length = 100, null=True, blank=True)
|
||||||
|
testitem = models.CharField('检测项目', choices=item_choices, default='规则规定的项目', max_length=50)
|
||||||
|
charge = models.CharField('收费方式', choices=charge_choices, default='CTC代收', max_length=50)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from .models import TestOrg,TestOrgNotice
|
from .models import TestOrg,TestOrgNotice,DetectionTask
|
||||||
from apps.system.serializers import DictSerializer
|
from apps.system.serializers import DictSerializer
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,3 +17,7 @@ class TestOrgNoticListSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = TestOrgNotice
|
model = TestOrgNotice
|
||||||
fields = ['id','name','publishdate','ismportant','note','dettonotice','path']
|
fields = ['id','name','publishdate','ismportant','note','dettonotice','path']
|
||||||
|
class DetectionTaskSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = DetectionTask
|
||||||
|
fields = '__all__'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
||||||
from rest_framework.viewsets import ModelViewSet
|
from rest_framework.viewsets import ModelViewSet
|
||||||
from .models import TestOrg,TestOrgNotice
|
from .models import TestOrg,TestOrgNotice,DetectionTask
|
||||||
from utils.queryset import get_child_queryset2
|
from utils.queryset import get_child_queryset2
|
||||||
from .serializers import TestOrgSerializer,TestOrgNoticeSerializer,TestOrgNoticListSerializer,DetectionTaskSerializer
|
from .serializers import TestOrgSerializer,TestOrgNoticeSerializer,TestOrgNoticListSerializer,DetectionTaskSerializer
|
||||||
from apps.system.permission_data import RbacFilterSet
|
from apps.system.permission_data import RbacFilterSet
|
||||||
|
@ -27,10 +27,10 @@ class TestOrgNoticeViewSet(CreateUpdateCustomMixin, OptimizationMixin, ModelView
|
||||||
if self.action == 'list':
|
if self.action == 'list':
|
||||||
return TestOrgNoticListSerializer
|
return TestOrgNoticListSerializer
|
||||||
return TestOrgNoticeSerializer
|
return TestOrgNoticeSerializer
|
||||||
class DetectionTasViewSet(CreateUpdateCustomMixin, OptimizationMixin, ModelViewSet):
|
class DetectionTaskViewSet(CreateUpdateCustomMixin, OptimizationMixin, ModelViewSet):
|
||||||
perms_map = {'get': '*', 'post': 'DetectionTas_create',
|
perms_map = {'get': '*', 'post': 'DetectionTask_create',
|
||||||
'put': 'DetectionTas_update', 'delete': 'DetectionTas_delete'}
|
'put': 'DetectionTask_update', 'delete': 'DetectionTask_delete'}
|
||||||
queryset = DetectionTas.objects
|
queryset = DetectionTask.objects
|
||||||
serializer_class = DetectionTaskSerializer
|
serializer_class = DetectionTaskSerializer
|
||||||
ordering = ['-create_time']
|
ordering = ['-create_time']
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
# Generated by Django 3.0.5 on 2020-09-24 01:50
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('project', '0034_evaluationdetail_result'),
|
||||||
|
('project', '0038_certappunit_testorg'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
]
|
|
@ -0,0 +1,33 @@
|
||||||
|
# Generated by Django 3.0.5 on 2020-09-29 02:10
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('project', '0039_merge_20200924_0950'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='certappunit',
|
||||||
|
name='charge',
|
||||||
|
field=models.CharField(choices=[('CTC代收', 'CTC代收'), ('自收', '自收')], default='CTC代收', max_length=50, verbose_name='收费方式'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='certappunit',
|
||||||
|
name='detnumber',
|
||||||
|
field=models.CharField(blank=True, max_length=100, null=True, verbose_name='检测任务号'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='certappunit',
|
||||||
|
name='remark',
|
||||||
|
field=models.TextField(blank=True, null=True, verbose_name='备注'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='certappunit',
|
||||||
|
name='testitem',
|
||||||
|
field=models.CharField(choices=[('规则规定的项目', '规则规定的项目'), ('特定的项目见备注', '特定的项目见备注')], default='规则规定的项目', max_length=50, verbose_name='检测项目'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,29 @@
|
||||||
|
# Generated by Django 3.0.5 on 2020-09-29 02:17
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('project', '0040_auto_20200929_1010'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='certappunit',
|
||||||
|
name='charge',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='certappunit',
|
||||||
|
name='detnumber',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='certappunit',
|
||||||
|
name='remark',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='certappunit',
|
||||||
|
name='testitem',
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,45 @@
|
||||||
|
# Generated by Django 3.0.5 on 2020-09-29 08:18
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('laboratory', '0008_auto_20200924_1203'),
|
||||||
|
('project', '0041_auto_20200929_1017'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='certappunit',
|
||||||
|
name='charge',
|
||||||
|
field=models.CharField(blank=True, choices=[('CTC代收', 'CTC代收'), ('自收', '自收')], max_length=50, null=True, verbose_name='收费方式'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='certappunit',
|
||||||
|
name='detnumber',
|
||||||
|
field=models.CharField(blank=True, max_length=100, null=True, verbose_name='检测任务号'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='certappunit',
|
||||||
|
name='remark',
|
||||||
|
field=models.TextField(blank=True, null=True, verbose_name='备注'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='certappunit',
|
||||||
|
name='sampledec',
|
||||||
|
field=models.TextField(blank=True, null=True, verbose_name='样品描述'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='certappunit',
|
||||||
|
name='testitem',
|
||||||
|
field=models.CharField(blank=True, choices=[('规则规定的项目', '规则规定的项目'), ('特定的项目见备注', '特定的项目见备注')], max_length=50, null=True, verbose_name='检测项目'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='certappunit',
|
||||||
|
name='testorg',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='certappunit_testorg', to='laboratory.TestOrg', verbose_name='检测机构'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -3,9 +3,8 @@ from django.contrib.postgres.fields import JSONField
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from rest_framework.exceptions import ParseError
|
from rest_framework.exceptions import ParseError
|
||||||
from simple_history.models import HistoricalRecords
|
from simple_history.models import HistoricalRecords
|
||||||
|
|
||||||
from apps.certset.models import ImplementRule, UnitType, Evaluations, Standard
|
from apps.certset.models import ImplementRule, UnitType, Evaluations, Standard
|
||||||
from apps.crm.models import Certunit, Enterprise
|
from apps.crm.models import Enterprise
|
||||||
from apps.system.models import CommonAModel, CommonBModel, Dict, User
|
from apps.system.models import CommonAModel, CommonBModel, Dict, User
|
||||||
# from apps.plan.models import Plan
|
# from apps.plan.models import Plan
|
||||||
|
|
||||||
|
@ -200,7 +199,23 @@ class Certappunit(CommonBModel):
|
||||||
"""
|
"""
|
||||||
certunit = models.ForeignKey('crm.Certunit', verbose_name='单元', on_delete=models.CASCADE, related_name='certappunit_certunit')
|
certunit = models.ForeignKey('crm.Certunit', verbose_name='单元', on_delete=models.CASCADE, related_name='certappunit_certunit')
|
||||||
certapp = models.ForeignKey(CertApp, verbose_name='所属业务', on_delete = models.CASCADE, related_name='certappunit_certapp')
|
certapp = models.ForeignKey(CertApp, verbose_name='所属业务', on_delete = models.CASCADE, related_name='certappunit_certapp')
|
||||||
testorg = models.ForeignKey('laboratory.TestOrg', verbose_name='检测机构', on_delete=models.SET_NULL, null=True, blank=True)
|
#检测任务
|
||||||
|
item_choices = (
|
||||||
|
('规则规定的项目', '规则规定的项目'),
|
||||||
|
('特定的项目见备注', '特定的项目见备注'),
|
||||||
|
)
|
||||||
|
charge_choices = (
|
||||||
|
('CTC代收', 'CTC代收'),
|
||||||
|
('自收', '自收'),
|
||||||
|
|
||||||
|
)
|
||||||
|
testorg = models.ForeignKey('laboratory.TestOrg',verbose_name='检测机构',null=True, blank=True, related_name='certappunit_testorg', on_delete=models.DO_NOTHING)
|
||||||
|
remark = models.TextField('备注', null=True, blank=True)
|
||||||
|
sampledec = models.TextField('样品描述', null=True, blank=True)
|
||||||
|
detnumber = models.CharField('检测任务号', max_length = 100,null=True, blank=True)
|
||||||
|
testitem = models.CharField('检测项目', choices=item_choices,null=True, blank=True, max_length=50)
|
||||||
|
charge = models.CharField('收费方式', choices=charge_choices,null=True, blank=True, max_length=50)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = '认证单元'
|
verbose_name = '认证单元'
|
||||||
verbose_name_plural = verbose_name
|
verbose_name_plural = verbose_name
|
||||||
|
|
Loading…
Reference in New Issue