application update
This commit is contained in:
parent
3f1a347346
commit
9c8ce37b46
|
@ -93,17 +93,44 @@
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
</el-collapse>
|
</el-collapse>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div v-if="formData.stage==1">
|
<div v-if="formData.stage==1" style="margin-bottom:10px;margin-top:10px">
|
||||||
<div style="margin-top:10px">
|
<el-button type="primary" icon="el-icon-plus" v-for="(item, index) in field_list" :key="'field_list' + index" @click="CreateSub(item,index)" size="mini">{{item.name}}</el-button>
|
||||||
<el-button type="primary" icon="el-icon-plus" v-for="(item, index) in field_list" :key="'field_list' + index" @click="CreateSub(item,index)" size="mini">{{item}}</el-button>
|
|
||||||
</div>
|
|
||||||
<el-divider></el-divider>
|
|
||||||
</div>
|
</div>
|
||||||
<el-collapse accordion>
|
<el-row :gutter="10" v-if="formData.stage==1">
|
||||||
<el-collapse-item v-for="(item, index) in subitems" :key="'subitems' + index" :title="item.cert_field_code">
|
<el-col :span="6" v-for="(item, index) in subitems" :key="'subitems' + index" style="margin-bottom:6px">
|
||||||
<template>{{item}}</template>
|
<el-card class="box-card" :style="{height:'280px'}" shadow="hover">
|
||||||
</el-collapse-item>
|
<div slot="header" >
|
||||||
</el-collapse>
|
<span>{{item.cert_field_.name}}</span>
|
||||||
|
<el-checkbox style="float: right; padding: 3px 0"></el-checkbox>
|
||||||
|
<!-- <el-checkbox style="float: right; padding: 3px 0" ></el-checkbox> -->
|
||||||
|
<!-- <input type="checkbox" @click="checked(item.id)" :id="item.id" style="float: right; padding: 3px 0"> -->
|
||||||
|
</div>
|
||||||
|
<el-button size="mini" type="primary" style="margin-bottom:2px">操作按钮</el-button>
|
||||||
|
<div>
|
||||||
|
<label>申请领域:</label><span> {{item.cert_field_.name}}</span>
|
||||||
|
</div>
|
||||||
|
<div v-if="item.cccpv_class">
|
||||||
|
<label>产品分类:</label><el-tag> {{item.cccpv_class_.name}}</el-tag>
|
||||||
|
</div>
|
||||||
|
<div v-if="item.cnas_scopes.length">
|
||||||
|
<label>CNAS分类:</label><el-tag v-for="(item, index) in item.cnas_scopes_" :key="'cnas_scope' + index"> {{item.name}}</el-tag>
|
||||||
|
</div>
|
||||||
|
<div >
|
||||||
|
<label>申请方:</label><span> {{formData.applicant_v.name}}</span>
|
||||||
|
</div>
|
||||||
|
<div v-if="item.manufacture">
|
||||||
|
<label>制造商:</label><span> {{item.manufacture_v.name}}</span>
|
||||||
|
</div>
|
||||||
|
<div v-if="item.factory">
|
||||||
|
<label>生产厂:</label><span> {{item.factory_v.name}}</span>
|
||||||
|
</div>
|
||||||
|
<div v-if="item.pattern">
|
||||||
|
<label>申请模式:</label><span> {{item.pattern}}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
<div style="margin-top: 12px;text-align:center">
|
<div style="margin-top: 12px;text-align:center">
|
||||||
<el-button @click="previous" v-if="formData.stage>0">上一步</el-button>
|
<el-button @click="previous" v-if="formData.stage>0">上一步</el-button>
|
||||||
<el-button @click="submitForm1" v-if="formData.stage==0">保存并进行下一步</el-button>
|
<el-button @click="submitForm1" v-if="formData.stage==0">保存并进行下一步</el-button>
|
||||||
|
@ -114,8 +141,10 @@
|
||||||
<el-dialog title="选择企业" :visible.sync="dgVisiable" :close-on-click-modal="false" width="80%">
|
<el-dialog title="选择企业" :visible.sync="dgVisiable" :close-on-click-modal="false" width="80%">
|
||||||
<Enterprisechose ref="Enterprisechose" @handleChose="chooseComplete"></Enterprisechose>
|
<Enterprisechose ref="Enterprisechose" @handleChose="chooseComplete"></Enterprisechose>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<el-dialog :title="dgTitle" :visible.sync="dgVisiableSub" :close-on-click-modal="false" width="90%" class="abow_dialog">
|
<el-dialog :title="dgTitle" :visible.sync="dgVisiableSub" :close-on-click-modal="false" width="90%">
|
||||||
<CCCform ref="CCCform" @closeDg="subComplete" :origindata="formData" :addressOptions="addressOptions"></CCCform>
|
<CCCform ref="CCCform" @closeDg="subComplete" :origindata="formData" :addressOptions="addressOptions" v-if="subitem&&subitem.code=='CCC'" :cert_field="subitem.id"></CCCform>
|
||||||
|
<PVform ref="PVform" @closeDg="subComplete" :origindata="formData" :addressOptions="addressOptions" v-if="subitem&&subitem.code=='PV'" :cert_field="subitem.id"></PVform>
|
||||||
|
<QMSform ref="QMSform" @closeDg="subComplete" :origindata="formData" v-if="subitem&&subitem.code=='QMS'" :cert_field="subitem.id"></QMSform>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -123,16 +152,19 @@
|
||||||
<script>
|
<script>
|
||||||
import Enterprisechose from "@/views/enterprise/enterprisechoose"
|
import Enterprisechose from "@/views/enterprise/enterprisechoose"
|
||||||
import CCCform from "@/views/application/cccform"
|
import CCCform from "@/views/application/cccform"
|
||||||
|
import PVform from "@/views/application/pvform"
|
||||||
|
import QMSform from "@/views/application/qmsform"
|
||||||
import { createApplication, updateApplication, getApplication, getSubApplicationList } from "@/api/application"
|
import { createApplication, updateApplication, getApplication, getSubApplicationList } from "@/api/application"
|
||||||
import { getAddressList } from "@/api/enterprise"
|
import { getAddressList } from "@/api/enterprise"
|
||||||
import { genTree } from "@/utils";
|
import { genTree } from "@/utils";
|
||||||
import router from '../../router';
|
import router from '../../router';
|
||||||
import { getDictList } from "@/api/dict"
|
import { getDictList } from "@/api/dict"
|
||||||
export default {
|
export default {
|
||||||
components: { Enterprisechose, CCCform },
|
components: { Enterprisechose, CCCform, PVform, QMSform },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
field_list:['CCC', 'PV', 'QMS', 'EMS', 'OHSMS', 'ENMS'],
|
checksubList:[],
|
||||||
|
field_list:[],
|
||||||
activeNames: ["1", "2"],
|
activeNames: ["1", "2"],
|
||||||
formData: {
|
formData: {
|
||||||
apply_date: this.getDefaultDate(1),
|
apply_date: this.getDefaultDate(1),
|
||||||
|
@ -185,17 +217,21 @@ export default {
|
||||||
dgTitle:'申请',
|
dgTitle:'申请',
|
||||||
dgVisiableSub:false,
|
dgVisiableSub:false,
|
||||||
levelOptions:[],
|
levelOptions:[],
|
||||||
subitems:[]
|
subitems:[],
|
||||||
|
subitem:null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created(){
|
created(){
|
||||||
this.getLevelList()
|
this.getLevelList()
|
||||||
|
this.getfields()
|
||||||
|
|
||||||
if(this.$route.query.id){
|
if(this.$route.query.id){
|
||||||
this.getApplication_(this.$route.query.id)
|
this.getApplication_(this.$route.query.id)
|
||||||
}
|
}
|
||||||
|
this.getSubApplication_()
|
||||||
},
|
},
|
||||||
watch:{
|
watch:{
|
||||||
'formData.stage':'stageChange'
|
// 'formData.stage':'stageChange'
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
previous() {
|
previous() {
|
||||||
|
@ -286,27 +322,38 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
CreateSub(item, index){
|
CreateSub(item, index){
|
||||||
|
this.subitem = item
|
||||||
this.dgVisiableSub = true
|
this.dgVisiableSub = true
|
||||||
this.dgTitle = item+'认证申请'
|
this.dgTitle = item.name + '认证申请'
|
||||||
|
|
||||||
},
|
},
|
||||||
subComplete(val){
|
subComplete(val){
|
||||||
this.dgVisiableSub = false
|
this.dgVisiableSub = false,
|
||||||
|
this.getSubApplication_()
|
||||||
},
|
},
|
||||||
getLevelList() {
|
getLevelList() {
|
||||||
getDictList({type__code:'project_level'}).then(res=>{
|
getDictList({type__code:'project_level'}).then(res=>{
|
||||||
this.levelOptions = genTree(res.data)
|
this.levelOptions = genTree(res.data)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getfields(){
|
||||||
|
getDictList({type__code:'cert_field'}).then(res=>{
|
||||||
|
let fields = []
|
||||||
|
for(var i=0;i<res.data.length;i++){
|
||||||
|
if(res.data[i].parent!=null){
|
||||||
|
fields.push({id:res.data[i].id, name:res.data[i].name, code:res.data[i].code})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.field_list = fields
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
getSubApplication_(){
|
getSubApplication_(){
|
||||||
getSubApplicationList({application:this.formData.id}).then(res=>{
|
let query = {application:this.$route.query.id}
|
||||||
|
getSubApplicationList(query).then(res=>{
|
||||||
this.subitems = res.data
|
this.subitems = res.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
stageChange(){
|
|
||||||
if(this.formData.stage==1){
|
|
||||||
this.getSubApplication_()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
|
@ -110,7 +110,6 @@
|
||||||
<treeselect
|
<treeselect
|
||||||
v-model="formData.cccpv_class"
|
v-model="formData.cccpv_class"
|
||||||
:multiple="false"
|
:multiple="false"
|
||||||
:normalizer="normalizer"
|
|
||||||
:options="cccOptions"
|
:options="cccOptions"
|
||||||
:disable-branch-nodes="true"
|
:disable-branch-nodes="true"
|
||||||
placeholder="请选择产品分类"
|
placeholder="请选择产品分类"
|
||||||
|
@ -161,11 +160,11 @@ export default {
|
||||||
name: "CCCform",
|
name: "CCCform",
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
components: { Enterprisechose, Treeselect },
|
components: { Enterprisechose, Treeselect },
|
||||||
props: ["origindata", "addressOptions"],
|
props: ["origindata", "addressOptions", "cert_field"],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
formData: {
|
formData: {
|
||||||
cert_field_code:'CCC',
|
cert_field:this.cert_field,
|
||||||
application:this.origindata.id,
|
application:this.origindata.id,
|
||||||
manufacture_v: this.origindata.applicant_v,
|
manufacture_v: this.origindata.applicant_v,
|
||||||
manufacture: this.origindata.applicant,
|
manufacture: this.origindata.applicant,
|
||||||
|
@ -279,17 +278,6 @@ this.formData.manufacture = val.id;
|
||||||
this.cccOptions=genTree(res.data)
|
this.cccOptions=genTree(res.data)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
normalizer(node) {
|
|
||||||
//去掉children=[]的children属性
|
|
||||||
if (node.children && !node.children.length) {
|
|
||||||
delete node.children;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
id: node.id,
|
|
||||||
label: node.name,
|
|
||||||
children: node.children
|
|
||||||
};
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -0,0 +1,286 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="80px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="3">
|
||||||
|
<el-form-item label="制造商" prop="manufacture" >
|
||||||
|
<el-button type="primary" @click="choose(1)">选择</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="3">
|
||||||
|
<el-form-item label="生产厂" prop="factory" >
|
||||||
|
<el-button type="primary" @click="choose(2)">选择</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<div v-if="formData.manufacture">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="4">
|
||||||
|
<el-form-item label="制造商">
|
||||||
|
<template>{{ formData.manufacture_v.name }}</template>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="2">
|
||||||
|
<el-form-item label="联系人">
|
||||||
|
<template>{{ formData.manufacture_v.linkman_name }}</template>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="3">
|
||||||
|
<el-form-item label="手机">
|
||||||
|
<template>{{ formData.manufacture_v.linkman_mobile }}</template>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="2">
|
||||||
|
<el-form-item label="职务">
|
||||||
|
<template>{{ formData.manufacture_v.linkman_duty }}</template>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="5">
|
||||||
|
<el-form-item label="地址" prop="manufacture_v.address">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.manufacture_v.address"
|
||||||
|
placeholder="请选择地址"
|
||||||
|
filterable
|
||||||
|
allow-create
|
||||||
|
:style="{width: '100%'}"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="(item, index) in addressOptions1"
|
||||||
|
:key="index"
|
||||||
|
:label="item.address"
|
||||||
|
:value="item.address"
|
||||||
|
:disabled="item.disabled"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
<div v-if="formData.factory">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="4">
|
||||||
|
<el-form-item label="生产厂">
|
||||||
|
<template>{{ formData.factory_v.name }}</template>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="2">
|
||||||
|
<el-form-item label="联系人">
|
||||||
|
<template>{{ formData.factory_v.linkman_name }}</template>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="3">
|
||||||
|
<el-form-item label="手机">
|
||||||
|
<template>{{ formData.factory_v.linkman_mobile }}</template>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="2">
|
||||||
|
<el-form-item label="职务">
|
||||||
|
<template>{{ formData.factory_v.linkman_duty }}</template>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="4">
|
||||||
|
<el-form-item label="人数">
|
||||||
|
<el-input-number v-model="formData.factory_v.person_count" :min="1" ></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="5">
|
||||||
|
<el-form-item label="地址" prop="factory_v.address">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.manufacture_v.address"
|
||||||
|
placeholder="请选择地址"
|
||||||
|
filterable
|
||||||
|
allow-create
|
||||||
|
:style="{width: '100%'}"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="(item, index) in addressOptions2"
|
||||||
|
:key="index"
|
||||||
|
:label="item.address"
|
||||||
|
:value="item.address"
|
||||||
|
:disabled="item.disabled"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="产品分类" prop="cccpv_class" :span="8">
|
||||||
|
<treeselect
|
||||||
|
v-model="formData.cccpv_class"
|
||||||
|
:multiple="false"
|
||||||
|
:options="cpOptions"
|
||||||
|
:disable-branch-nodes="true"
|
||||||
|
placeholder="请选择产品分类"
|
||||||
|
:style="{width: '100%'}"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="申请模式" prop="pattern" :span="8">
|
||||||
|
<el-select
|
||||||
|
v-model="formData.pattern"
|
||||||
|
placeholder="请选择模式"
|
||||||
|
filterable
|
||||||
|
allow-create
|
||||||
|
:style="{width: '100%'}"
|
||||||
|
>
|
||||||
|
<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-row>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" align="center">
|
||||||
|
<el-button @click="close(false)">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handelConfirm">确定</el-button>
|
||||||
|
</div>
|
||||||
|
<el-dialog title="选择企业" :visible.sync="dgVisiable" :close-on-click-modal="false" width="80%" :append-to-body="true">
|
||||||
|
<Enterprisechose ref="Enterprisechose" @handleChose="chooseComplete"></Enterprisechose>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { createSubApplication } from "@/api/application"
|
||||||
|
import Enterprisechose from "@/views/enterprise/enterprisechoose";
|
||||||
|
import { getAddressList } from "@/api/enterprise"
|
||||||
|
import { genTree } from '../../utils';
|
||||||
|
import { getDictList } from '../../api/dict';
|
||||||
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
export default {
|
||||||
|
name: "PVform",
|
||||||
|
inheritAttrs: false,
|
||||||
|
components: { Enterprisechose, Treeselect },
|
||||||
|
props: ["origindata", "addressOptions", "cert_field"],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
formData: {
|
||||||
|
cert_field:this.cert_field,
|
||||||
|
application:this.origindata.id,
|
||||||
|
manufacture_v: this.origindata.applicant_v,
|
||||||
|
manufacture: this.origindata.applicant,
|
||||||
|
factory: this.origindata.applicant,
|
||||||
|
factory_v: this.origindata.applicant_v,
|
||||||
|
cccpv_class:null,
|
||||||
|
pattern:'正常'
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
manufacture: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请选择制造商",
|
||||||
|
trigger: "change",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
factory: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请选择生产厂",
|
||||||
|
trigger: "change",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
addressOptions1: this.addressOptions,
|
||||||
|
addressOptions2: this.addressOptions,
|
||||||
|
dgVisiable: false,
|
||||||
|
dgType: 1,
|
||||||
|
cpOptions:[],
|
||||||
|
patternOptions:[
|
||||||
|
{
|
||||||
|
label:'正常',
|
||||||
|
value:'正常'
|
||||||
|
},{
|
||||||
|
label:'ODM',
|
||||||
|
value:'ODM'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:'OEM',
|
||||||
|
value:'OEM'
|
||||||
|
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
watch: {},
|
||||||
|
created() {
|
||||||
|
this.getCpOptions()
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
methods: {
|
||||||
|
close(val) {
|
||||||
|
// this.$refs['elForm'].resetFields()
|
||||||
|
this.$emit("closeDg", val);
|
||||||
|
},
|
||||||
|
handelConfirm() {
|
||||||
|
this.$refs["elForm"].validate((valid) => {
|
||||||
|
if (!valid) return;
|
||||||
|
createSubApplication(this.formData).then(res=>{
|
||||||
|
this.close(res.data);
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
choose(val) {
|
||||||
|
this.dgType = val;
|
||||||
|
this.dgVisiable = true;
|
||||||
|
},
|
||||||
|
chooseComplete(val) {
|
||||||
|
this.dgVisiable = false;
|
||||||
|
if (val) {
|
||||||
|
if(this.dgType==1){
|
||||||
|
this.formData.manufacture = val.id;
|
||||||
|
this.formData.manufacture_v = {
|
||||||
|
name: val.name,
|
||||||
|
linkman_name: val.linkman1_name,
|
||||||
|
linkman_mobile: val.linkman1_mobile,
|
||||||
|
linkman_duty: val.linkman1_duty,
|
||||||
|
};
|
||||||
|
}else{
|
||||||
|
this.formData.factory = val.id;
|
||||||
|
this.formData.factory_v = {
|
||||||
|
name: val.name,
|
||||||
|
linkman_name: val.linkman1_name,
|
||||||
|
linkman_mobile: val.linkman1_mobile,
|
||||||
|
linkman_duty: val.linkman1_duty,
|
||||||
|
person_count:val.person_count
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.getAddressList_(val.id);
|
||||||
|
},
|
||||||
|
getAddressList_(id) {
|
||||||
|
getAddressList({ enterprise: id }).then((res) => {
|
||||||
|
if(res.data){
|
||||||
|
if(this.dgType==1){
|
||||||
|
this.addressOptions1 = genTree(res.data)
|
||||||
|
this.formData.manufacture_v.address = this.addressOptions1[0].address
|
||||||
|
}else{
|
||||||
|
this.addressOptions2 = genTree(res.data)
|
||||||
|
this.formData.factory_v.address = this.addressOptions2[0].address
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getCpOptions(){
|
||||||
|
let query = 'pv_scope'
|
||||||
|
getDictList({type__code:'pv_scope'}).then(res=>{
|
||||||
|
this.cpOptions=genTree(res.data)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
</style>
|
|
@ -0,0 +1,90 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="80px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="专业分类" prop="cccpv_class" :span="8">
|
||||||
|
<treeselect
|
||||||
|
v-model="formData.cnas_scopes"
|
||||||
|
:multiple="true"
|
||||||
|
:options="cnasOptions"
|
||||||
|
:disable-branch-nodes="true"
|
||||||
|
placeholder="请选择专业分类"
|
||||||
|
:style="{width: '100%'}"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="认证范围" prop="content" >
|
||||||
|
<el-input v-model="formData.content" placeholder="请输入认证范围"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" align="center">
|
||||||
|
<el-button @click="close(false)">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handelConfirm">确定</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { createSubApplication } from "@/api/application"
|
||||||
|
import { getAddressList } from "@/api/enterprise"
|
||||||
|
import { genTree } from '../../utils';
|
||||||
|
import { getDictList } from '../../api/dict';
|
||||||
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
export default {
|
||||||
|
name: "QMSform",
|
||||||
|
inheritAttrs: false,
|
||||||
|
components: { Treeselect },
|
||||||
|
props: ["origindata", "cert_field"],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
formData: {
|
||||||
|
cert_field:this.cert_field,
|
||||||
|
application:this.origindata.id,
|
||||||
|
cccpv_class:null,
|
||||||
|
cnas_scopes:[],
|
||||||
|
pattern:'正常'
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
|
||||||
|
},
|
||||||
|
dgVisiable: false,
|
||||||
|
dgType: 1,
|
||||||
|
cnasOptions:[],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
watch: {},
|
||||||
|
created() {
|
||||||
|
this.getCnasOptions()
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
methods: {
|
||||||
|
close(val) {
|
||||||
|
// this.$refs['elForm'].resetFields()
|
||||||
|
this.$emit("closeDg", val);
|
||||||
|
},
|
||||||
|
handelConfirm() {
|
||||||
|
this.$refs["elForm"].validate((valid) => {
|
||||||
|
if (!valid) return;
|
||||||
|
createSubApplication(this.formData).then(res=>{
|
||||||
|
this.close(res.data);
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getCnasOptions(){
|
||||||
|
let query = {type__code:'cnas_scope'}
|
||||||
|
getDictList(query).then(res=>{
|
||||||
|
this.cnasOptions=genTree(res.data)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
</style>
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Generated by Django 3.0.7 on 2020-08-07 03:37
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('project', '0010_auto_20200806_1740'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='subapplication',
|
||||||
|
name='cert_field_code',
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,36 @@
|
||||||
|
# Generated by Django 3.0.7 on 2020-08-07 09:43
|
||||||
|
|
||||||
|
import django.contrib.postgres.fields.jsonb
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('crm', '0011_enterprise_parent'),
|
||||||
|
('project', '0011_remove_subapplication_cert_field_code'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='subapplication',
|
||||||
|
name='factory',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='subapplication_factory', to='crm.Enterprise'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='subapplication',
|
||||||
|
name='factory_v',
|
||||||
|
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, verbose_name='生产厂'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='subapplication',
|
||||||
|
name='manufacture',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='subapplication_manufacture', to='crm.Enterprise'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='subapplication',
|
||||||
|
name='manufacture_v',
|
||||||
|
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, verbose_name='制造商'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,24 @@
|
||||||
|
# Generated by Django 3.0.7 on 2020-08-07 09:45
|
||||||
|
|
||||||
|
import django.contrib.postgres.fields.jsonb
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('project', '0012_auto_20200807_1743'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='subapplication',
|
||||||
|
name='factory_v',
|
||||||
|
field=django.contrib.postgres.fields.jsonb.JSONField(default=dict, verbose_name='生产厂'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='subapplication',
|
||||||
|
name='manufacture_v',
|
||||||
|
field=django.contrib.postgres.fields.jsonb.JSONField(default=dict, verbose_name='制造商'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,24 @@
|
||||||
|
# Generated by Django 3.0.7 on 2020-08-07 09:47
|
||||||
|
|
||||||
|
import django.contrib.postgres.fields.jsonb
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('project', '0013_auto_20200807_1745'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='subapplication',
|
||||||
|
name='factory_v',
|
||||||
|
field=django.contrib.postgres.fields.jsonb.JSONField(null=True, verbose_name='生产厂'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='subapplication',
|
||||||
|
name='manufacture_v',
|
||||||
|
field=django.contrib.postgres.fields.jsonb.JSONField(null=True, verbose_name='制造商'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.0.7 on 2020-08-07 09:53
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('project', '0014_auto_20200807_1747'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='subapplication',
|
||||||
|
name='pattern',
|
||||||
|
field=models.CharField(blank=True, choices=[('正常', '正常'), ('ODM', 'ODM'), ('OEM', 'OEM')], max_length=50, null=True, verbose_name='申请模式'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -69,17 +69,16 @@ class SubApplication(CommonBModel):
|
||||||
)
|
)
|
||||||
number = models.CharField('子申请编号', max_length = 100)
|
number = models.CharField('子申请编号', max_length = 100)
|
||||||
application = models.ForeignKey(Application, on_delete=models.CASCADE, related_name='subapplication_application')
|
application = models.ForeignKey(Application, on_delete=models.CASCADE, related_name='subapplication_application')
|
||||||
cert_field_code = models.CharField('认证领域代号', max_length=50, null=True)
|
|
||||||
cert_field = models.ForeignKey(Dict, verbose_name='认证领域', related_name='subapplication_cert_field', on_delete=models.DO_NOTHING)
|
cert_field = models.ForeignKey(Dict, verbose_name='认证领域', related_name='subapplication_cert_field', on_delete=models.DO_NOTHING)
|
||||||
cccpv_class = models.ForeignKey(Dict, verbose_name='涉及CCC/PV分类', related_name='subapplication_cccpv_class', on_delete=models.DO_NOTHING, null=True, blank=True)
|
cccpv_class = models.ForeignKey(Dict, verbose_name='涉及CCC/PV分类', related_name='subapplication_cccpv_class', on_delete=models.DO_NOTHING, null=True, blank=True)
|
||||||
cnas_scopes = models.ManyToManyField(Dict, verbose_name='涉及cnas分类', related_name='subapplication_cnas_sopes', blank=True)
|
cnas_scopes = models.ManyToManyField(Dict, verbose_name='涉及cnas分类', related_name='subapplication_cnas_sopes', blank=True)
|
||||||
project = models.ForeignKey(Project, related_name='subapplication_project', on_delete=models.SET_NULL, null=True)
|
project = models.ForeignKey(Project, related_name='subapplication_project', on_delete=models.SET_NULL, null=True)
|
||||||
is_approve = models.BooleanField('是否认可', default=True)
|
is_approve = models.BooleanField('是否认可', default=True)
|
||||||
pattern = models.CharField('申请模式', default='正常', choices=pattern_choices, max_length=50)
|
pattern = models.CharField('申请模式', choices=pattern_choices, max_length=50, null=True, blank=True)
|
||||||
manufacture = models.ForeignKey(Enterprise, on_delete=models.CASCADE, related_name='subapplication_manufacture')
|
manufacture = models.ForeignKey(Enterprise, on_delete=models.CASCADE, related_name='subapplication_manufacture', null=True, blank=True)
|
||||||
manufacture_v = JSONField(verbose_name='制造商')
|
manufacture_v = JSONField(verbose_name='制造商', null=True)
|
||||||
factory = models.ForeignKey(Enterprise, on_delete=models.CASCADE, related_name='subapplication_factory')
|
factory = models.ForeignKey(Enterprise, on_delete=models.CASCADE, related_name='subapplication_factory', null=True, blank=True)
|
||||||
factory_v = JSONField(verbose_name='生产厂')
|
factory_v = JSONField(verbose_name='生产厂', null=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = '认证子申请'
|
verbose_name = '认证子申请'
|
||||||
|
|
|
@ -2,7 +2,7 @@ from rest_framework import serializers
|
||||||
|
|
||||||
from .models import *
|
from .models import *
|
||||||
|
|
||||||
# from apps.system.serializers import DictSerializer, UserListSerializer
|
from apps.system.serializers import DictSerializer, UserListSerializer
|
||||||
# from apps.certset.serializers import ImplementRuleSerializer
|
# from apps.certset.serializers import ImplementRuleSerializer
|
||||||
|
|
||||||
class ApplicationCreateSerializer(serializers.ModelSerializer):
|
class ApplicationCreateSerializer(serializers.ModelSerializer):
|
||||||
|
@ -29,7 +29,9 @@ class SubApplicationCreateSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
class SubApplicationUpdateSerializer(serializers.ModelSerializer):
|
class SubApplicationUpdateSerializer(serializers.ModelSerializer):
|
||||||
number = serializers.CharField(read_only=True)
|
number = serializers.CharField(read_only=True)
|
||||||
cert_field_code = serializers.CharField(read_only=True)
|
cert_field_ = DictSerializer(source='cert_field')
|
||||||
|
cccpv_class_ = DictSerializer(source='cccpv_class')
|
||||||
|
cnas_scopes_ = DictSerializer(source='cnas_scopes', many=True)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = SubApplication
|
model = SubApplication
|
||||||
fields = '__all__'
|
fields = '__all__'
|
|
@ -48,7 +48,6 @@ class SubApplicationViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
||||||
def create(self, request, *args, **kwargs):
|
def create(self, request, *args, **kwargs):
|
||||||
postdata = request.data
|
postdata = request.data
|
||||||
postdata['number'] = random.randrange(1000,2000)
|
postdata['number'] = random.randrange(1000,2000)
|
||||||
postdata['cert_field'] = Dict.objects.get(code=postdata['cert_field_code'], type__code='cert_field').pk
|
|
||||||
serializer = self.get_serializer(data=postdata)
|
serializer = self.get_serializer(data=postdata)
|
||||||
serializer.is_valid(raise_exception=True)
|
serializer.is_valid(raise_exception=True)
|
||||||
self.perform_create(serializer)
|
self.perform_create(serializer)
|
||||||
|
|
Loading…
Reference in New Issue