dict update
This commit is contained in:
parent
858049d38e
commit
3f1a347346
|
@ -0,0 +1,56 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
export function getApplicationList(query) {
|
||||
return request({
|
||||
url: '/project/application/',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function createApplication(data) {
|
||||
return request({
|
||||
url: '/project/application/',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteApplication(id) {
|
||||
return request({
|
||||
url: `/project/application/${id}/`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function updateApplication(id, data) {
|
||||
return request({
|
||||
url: `/project/application/${id}/`,
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getApplication(id) {
|
||||
return request({
|
||||
url: `/project/application/${id}/`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
export function createSubApplication(data) {
|
||||
return request({
|
||||
url: '/project/subapplication/',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getSubApplicationList(query) {
|
||||
return request({
|
||||
url: '/project/subapplication/',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
|
@ -62,17 +62,17 @@ export const constantRoutes = [
|
|||
*/
|
||||
export const asyncRoutes = [
|
||||
{
|
||||
path: '/application',
|
||||
path: '/project',
|
||||
component: Layout,
|
||||
redirect: '/application/',
|
||||
name: 'ApplicationManage',
|
||||
meta: { title: '认证申请', icon: 'example'},
|
||||
redirect: '/project/application',
|
||||
name: 'ProjectManage',
|
||||
meta: { title: '认证项目', icon: 'example'},
|
||||
children: [
|
||||
{
|
||||
path: 'application',
|
||||
name: 'Applicaion',
|
||||
component: () => import('@/views/employee/employee'),
|
||||
meta: { title: '申请受理', icon: 'example', perms: ['application_view'] }
|
||||
component: () => import('@/views/application/application'),
|
||||
meta: { title: '认证申请', icon: 'example', perms: ['application_view'] }
|
||||
},
|
||||
{
|
||||
path: 'application2',
|
||||
|
@ -80,12 +80,19 @@ export const asyncRoutes = [
|
|||
component: () => import('@/views/employee/train'),
|
||||
meta: { title: '客户申请受理', icon: 'example', perms: ['application_accept'] }
|
||||
},
|
||||
{
|
||||
path: 'application/applicationform/',
|
||||
name: 'ApplicationForm',
|
||||
component: () => import('@/views/application/applicationform'),
|
||||
meta: { title: '认证申请', icon: 'example', perms: ['application_create', 'application_update'] },
|
||||
hidden: true
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/employee',
|
||||
component: Layout,
|
||||
redirect: '/employee/',
|
||||
redirect: '/employee/employee',
|
||||
name: 'EmployeeManage',
|
||||
meta: { title: '人员管理', icon: 'example'},
|
||||
children: [
|
||||
|
|
|
@ -54,12 +54,12 @@
|
|||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="认证领域">
|
||||
<template slot-scope="scope" v-if="scope.row.cert_field_">{{ scope.row.cert_field_.fullname }}</template>
|
||||
<template slot-scope="scope" v-if="scope.row.cert_field_">{{ scope.row.cert_field_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="专业">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.cert_field_.code=='CCC'">{{scope.row.major_rule_code}}</span>
|
||||
<span v-else>{{scope.row.major_.fullname}}</span>
|
||||
<span v-else>{{scope.row.major_.name}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="能力来源">
|
||||
|
|
|
@ -260,7 +260,7 @@ getImplementRuleList({cert_field__code:'CCC'}).then(res=>{
|
|||
}
|
||||
return {
|
||||
id: node.id,
|
||||
label: node.fullname?node.fullname:node.name,
|
||||
label: node.name,
|
||||
children: node.children
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,185 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<div style="display:flex">
|
||||
<treeselect
|
||||
v-model="listQuery.user__dept"
|
||||
:multiple="false"
|
||||
:options="deptOptions"
|
||||
placeholder="所属组织"
|
||||
:disable-branch-nodes="true"
|
||||
@input="handleFilter"
|
||||
style="width: 280px" clearable/>
|
||||
<el-select
|
||||
v-model="listQuery.is_onjob"
|
||||
placeholder="是否在职"
|
||||
clearable
|
||||
class="filter-item"
|
||||
style="margin-left:10px"
|
||||
@change="handleFilter"
|
||||
>
|
||||
<el-option label="是" value="true"/>
|
||||
<el-option label="否" value="false"/>
|
||||
</el-select>
|
||||
<el-select
|
||||
v-model="listQuery.is_fulltime"
|
||||
placeholder="是否全职"
|
||||
clearable
|
||||
class="filter-item"
|
||||
style="margin-left:10px"
|
||||
@change="handleFilter"
|
||||
>
|
||||
<el-option label="是" value="true"/>
|
||||
<el-option label="否" value="false"/>
|
||||
</el-select>
|
||||
<el-input
|
||||
v-model="listQuery.search"
|
||||
placeholder="姓名/易记码/编号/注册领域"
|
||||
style="width: 300px;margin-left:10px"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="handleFilter"
|
||||
/>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="handleFilter"
|
||||
style="margin-left:10px"
|
||||
>搜索</el-button>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-refresh-left"
|
||||
@click="resetFilter"
|
||||
>刷新重置</el-button>
|
||||
</div>
|
||||
<div style="margin-top:6px">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate" >认证申请</el-button>
|
||||
</div>
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="tableData.results"
|
||||
style="width: 100%;margin-top:10px;"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
max-height="600"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="申请单号">
|
||||
<template slot-scope="scope" v-if="scope.row.number">{{ scope.row.number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="申请方">
|
||||
<template slot-scope="scope">{{ scope.row.applicant_v }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="认证领域">
|
||||
<template slot-scope="scope" v-if="scope.row.fields">
|
||||
<el-tag v-for="(item, index) in scope.row.fields.split(',')" :key="index" style="margin:2px" >{{item}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="当前状态">
|
||||
<template slot-scope="scope"><el-tag>{{ scope.row.status}}</el-tag><el-tag style="margin-left:2px" type="warning">{{ scope.row.stage_}}</el-tag></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="接收部门">
|
||||
<template slot-scope="scope">{{ scope.row.belong_dept}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建日期">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.create_time }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
:disabled="!checkPermission(['application_update'])"
|
||||
@click="handleContinue(scope)"
|
||||
>继续</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
:disabled="!checkPermission(['application_delete'])"
|
||||
@click="handleDelete(scope)"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="tableData.count>0"
|
||||
:total="tableData.count"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.page_size"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getApplicationList, deleteApplication } from "@/api/application"
|
||||
import { getOrgList } from "@/api/org"
|
||||
import { getDictList } from "@/api/dict"
|
||||
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 },
|
||||
data() {
|
||||
return {
|
||||
tableData: {count:0},
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20
|
||||
},
|
||||
deptOptions: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getdeptOptions()
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
getApplicationList(this.listQuery).then(response => {
|
||||
if (response.data) {
|
||||
this.tableData = response.data
|
||||
}
|
||||
this.listLoading = false
|
||||
});
|
||||
},
|
||||
getdeptOptions() {
|
||||
getOrgList().then(res=>{
|
||||
this.deptOptions = genTree(res.data)
|
||||
})
|
||||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
page: 1,
|
||||
page_size: 20
|
||||
}
|
||||
this.getList()
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.page = 1
|
||||
this.getList()
|
||||
},
|
||||
handleCreate() {
|
||||
this.$router.push({name:"ApplicationForm"})
|
||||
},
|
||||
handleContinue(scope) {
|
||||
this.$router.push({name:"ApplicationForm",query:{id:scope.row.id}})
|
||||
},
|
||||
handleDelete(scope) {
|
||||
deleteApplication(scope.row.id).then(res=>{
|
||||
this.$message.success('成功')
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,312 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-steps :space="200" :active="formData.stage" finish-status="success">
|
||||
<el-step title="基本信息"></el-step>
|
||||
<el-step title="申请内容"></el-step>
|
||||
<el-step title="步骤 3"></el-step>
|
||||
</el-steps>
|
||||
|
||||
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="120px" v-if="formData.stage==0" style="margin-top:10px">
|
||||
<el-collapse v-model="activeNames">
|
||||
<el-collapse-item title="申请信息" name="1">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="项目级别" prop="level" >
|
||||
<el-select
|
||||
v-model="formData.level"
|
||||
placeholder="请选择项目级别"
|
||||
filterable
|
||||
allow-create
|
||||
:style="{width: '100%'}"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in levelOptions"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
:disabled="item.disabled"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="受理日期" prop="apply_date" required>
|
||||
<el-date-picker
|
||||
v-model="formData.apply_date"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
:style="{width: '100%'}"
|
||||
placeholder="受理日期"
|
||||
clearable
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="材料接收日期" prop="accept_date" required>
|
||||
<el-date-picker
|
||||
v-model="formData.accept_date"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
:style="{width: '100%'}"
|
||||
placeholder="材料接收日期"
|
||||
clearable
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-collapse-item>
|
||||
<el-collapse-item title="申请方" name="2">
|
||||
<el-form-item label="申请方" prop="applicant">
|
||||
<el-button @click="choose" type="primary">选择</el-button>
|
||||
</el-form-item>
|
||||
<div v-if="formData.applicant">
|
||||
<el-form-item label="企业名">
|
||||
<template>{{ formData.applicant_v.name }}</template>
|
||||
</el-form-item>
|
||||
<div style="display:flex">
|
||||
<el-form-item label="联系人">
|
||||
<template>{{ formData.applicant_v.linkman_name }}</template>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机">
|
||||
<template>{{ formData.applicant_v.linkman_mobile }}</template>
|
||||
</el-form-item>
|
||||
<el-form-item label="职务">
|
||||
<template>{{ formData.applicant_v.linkman_duty }}</template>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item label="地址" prop="applicant_v.address" >
|
||||
<el-select
|
||||
v-model="formData.applicant_v.address"
|
||||
placeholder="请选择地址"
|
||||
filterable
|
||||
allow-create
|
||||
:style="{width: '100%'}"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in addressOptions"
|
||||
:key="index"
|
||||
:label="item.address"
|
||||
:value="item.address"
|
||||
:disabled="item.disabled"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</el-form>
|
||||
<div v-if="formData.stage==1">
|
||||
<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}}</el-button>
|
||||
</div>
|
||||
<el-divider></el-divider>
|
||||
</div>
|
||||
<el-collapse accordion>
|
||||
<el-collapse-item v-for="(item, index) in subitems" :key="'subitems' + index" :title="item.cert_field_code">
|
||||
<template>{{item}}</template>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
<div style="margin-top: 12px;text-align:center">
|
||||
<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="next" v-else>下一步</el-button>
|
||||
</div>
|
||||
|
||||
|
||||
<el-dialog title="选择企业" :visible.sync="dgVisiable" :close-on-click-modal="false" width="80%">
|
||||
<Enterprisechose ref="Enterprisechose" @handleChose="chooseComplete"></Enterprisechose>
|
||||
</el-dialog>
|
||||
<el-dialog :title="dgTitle" :visible.sync="dgVisiableSub" :close-on-click-modal="false" width="90%" class="abow_dialog">
|
||||
<CCCform ref="CCCform" @closeDg="subComplete" :origindata="formData" :addressOptions="addressOptions"></CCCform>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Enterprisechose from "@/views/enterprise/enterprisechoose"
|
||||
import CCCform from "@/views/application/cccform"
|
||||
import { createApplication, updateApplication, getApplication, getSubApplicationList } from "@/api/application"
|
||||
import { getAddressList } from "@/api/enterprise"
|
||||
import { genTree } from "@/utils";
|
||||
import router from '../../router';
|
||||
import { getDictList } from "@/api/dict"
|
||||
export default {
|
||||
components: { Enterprisechose, CCCform },
|
||||
data() {
|
||||
return {
|
||||
field_list:['CCC', 'PV', 'QMS', 'EMS', 'OHSMS', 'ENMS'],
|
||||
activeNames: ["1", "2"],
|
||||
formData: {
|
||||
apply_date: this.getDefaultDate(1),
|
||||
accept_date: this.getDefaultDate(1),
|
||||
applicant: null,
|
||||
applicant_v: {
|
||||
address:null
|
||||
},
|
||||
stage:0
|
||||
},
|
||||
rules: {
|
||||
apply_date: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择受理日期",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
accept_date: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择材料接收日期",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
applicant: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择申请方",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
level: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择级别",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
// 'applicant_v.address': [
|
||||
// {
|
||||
// required: true,
|
||||
// message: "请输入地址",
|
||||
// trigger: "blur",
|
||||
// },
|
||||
// ],
|
||||
},
|
||||
dgVisiable: false,
|
||||
addressOptions: [],
|
||||
dgTitle:'申请',
|
||||
dgVisiableSub:false,
|
||||
levelOptions:[],
|
||||
subitems:[]
|
||||
};
|
||||
},
|
||||
created(){
|
||||
this.getLevelList()
|
||||
if(this.$route.query.id){
|
||||
this.getApplication_(this.$route.query.id)
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
'formData.stage':'stageChange'
|
||||
},
|
||||
methods: {
|
||||
previous() {
|
||||
if (this.formData.stage-- < 0) this.formData.stage = 0;
|
||||
},
|
||||
next() {
|
||||
if (this.formData.stage++ > 2) this.formData.stage = 2;
|
||||
},
|
||||
choose() {
|
||||
this.dgVisiable = true;
|
||||
},
|
||||
getDefaultDate(val) {
|
||||
var now = new Date();
|
||||
var year = now.getFullYear(); //得到年份
|
||||
var month = now.getMonth(); //得到月份
|
||||
var date = now.getDate(); //得到日期
|
||||
var day = now.getDay(); //得到周几
|
||||
var hour = now.getHours(); //得到小时
|
||||
var minu = now.getMinutes(); //得到分钟
|
||||
var sec = now.getSeconds(); //得到秒
|
||||
month = month + 1;
|
||||
if (month < 10) month = "0" + month;
|
||||
if (date < 10) date = "0" + date;
|
||||
if (hour < 10) hour = "0" + hour;
|
||||
if (minu < 10) minu = "0" + minu;
|
||||
if (sec < 10) sec = "0" + sec;
|
||||
var time = "";
|
||||
//精确到天
|
||||
if (val == 1) {
|
||||
time = year + "-" + month + "-" + date;
|
||||
}
|
||||
//精确到分
|
||||
else if (val == 2) {
|
||||
time =
|
||||
year + "-" + month + "-" + date + " " + hour + ":" + minu + ":" + sec;
|
||||
}
|
||||
return time;
|
||||
},
|
||||
submitForm1() {
|
||||
this.$refs["elForm"].validate((valid) => {
|
||||
if (!valid) return
|
||||
// TODO 提交表单
|
||||
if(this.formData.id){
|
||||
this.formData.stage++
|
||||
updateApplication(this.formData.id, this.formData).then(res=>{
|
||||
|
||||
this.$message.success('成功')
|
||||
})
|
||||
}else{
|
||||
this.formData.stage++
|
||||
createApplication(this.formData).then(res=>{
|
||||
this.formData.id = res.data.id
|
||||
this.$message.success('成功')
|
||||
})
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
resetForm() {
|
||||
this.$refs["elForm"].resetFields();
|
||||
},
|
||||
chooseComplete(val) {
|
||||
this.dgVisiable = false;
|
||||
if (val) {
|
||||
this.formData.applicant = val.id;
|
||||
this.formData.applicant_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){
|
||||
this.addressOptions = genTree(res.data)
|
||||
this.formData.applicant_v.address = this.addressOptions[0].address
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
getApplication_(id) {
|
||||
getApplication(id).then(res=>{
|
||||
this.formData = res.data
|
||||
})
|
||||
},
|
||||
CreateSub(item, index){
|
||||
this.dgVisiableSub = true
|
||||
this.dgTitle = item+'认证申请'
|
||||
},
|
||||
subComplete(val){
|
||||
this.dgVisiableSub = false
|
||||
},
|
||||
getLevelList() {
|
||||
getDictList({type__code:'project_level'}).then(res=>{
|
||||
this.levelOptions = genTree(res.data)
|
||||
})
|
||||
},
|
||||
getSubApplication_(){
|
||||
getSubApplicationList({application:this.formData.id}).then(res=>{
|
||||
this.subitems = res.data
|
||||
})
|
||||
},
|
||||
stageChange(){
|
||||
if(this.formData.stage==1){
|
||||
this.getSubApplication_()
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,297 @@
|
|||
<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"
|
||||
:normalizer="normalizer"
|
||||
:options="cccOptions"
|
||||
: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: "CCCform",
|
||||
inheritAttrs: false,
|
||||
components: { Enterprisechose, Treeselect },
|
||||
props: ["origindata", "addressOptions"],
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
cert_field_code:'CCC',
|
||||
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,
|
||||
cccOptions:[],
|
||||
patternOptions:[
|
||||
{
|
||||
label:'正常',
|
||||
value:'正常'
|
||||
},{
|
||||
label:'ODM',
|
||||
value:'ODM'
|
||||
},
|
||||
{
|
||||
label:'OEM',
|
||||
value:'OEM'
|
||||
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.getCCCOptions()
|
||||
},
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
},
|
||||
getCCCOptions(){
|
||||
getDictList({type__code:'ccc_list'}).then(res=>{
|
||||
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>
|
||||
<style>
|
||||
</style>
|
|
@ -0,0 +1,189 @@
|
|||
<template>
|
||||
<div>
|
||||
<div>
|
||||
|
||||
<el-input v-model="listQuery.search"
|
||||
placeholder="组织名称/工厂编号"
|
||||
style="width: 300px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="handleFilter" />
|
||||
<el-button class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="handleFilter">搜索</el-button>
|
||||
<el-button class="filter-item"
|
||||
style="margin-left: 10px;"
|
||||
type="primary"
|
||||
icon="el-icon-refresh-left"
|
||||
@click="resetFilter">刷新重置</el-button>
|
||||
</div>
|
||||
<el-table v-loading="listLoading"
|
||||
:data="enterpriseList.results"
|
||||
style="width: 100%;margin-bottom: 20px"
|
||||
row-key="id"
|
||||
border
|
||||
default-expand-all
|
||||
max-height="400"
|
||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||
@row-dblclick="handleChose2"
|
||||
>
|
||||
<el-table-column fixed="left" type="index" width="50" />
|
||||
<el-table-column fixed="left" width="150" label="组织查询码">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.query_code }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column width="150" label="工厂编号">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.code }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150" label="组织名称">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.name }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150" label="英文名">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.ename }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150" label="法人">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.legal }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150" label="机构类型">
|
||||
<template slot-scope="scope" v-if="scope.row.type">
|
||||
{{ scope.row.type.name }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150" label="组织员工数">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.person_count }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150" label="建厂时间">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.build_time }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column width="150" label="经济行业">
|
||||
<template slot-scope="scope" v-if="scope.row.economy_class">
|
||||
{{ scope.row.economy_class.name }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150" label="经营范围">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.business_type }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column width="150" label="组织机构代码">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.credit_code }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150" label="注册资本">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.gassets }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150" label="县/区">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.region_code }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150" label="常用联系人">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.name }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150" label="常用联系人电话">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.linkman1_tel }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150" label="常用联系人手机">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.linkman1_mobile }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150" label="常用联系人职务">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.linkman1_duty }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" fixed="right" label="操作" width="100px">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary"
|
||||
size="small"
|
||||
@click="handleChose(scope)">选中</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="enterpriseList.count>0"
|
||||
:total="enterpriseList.count"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.page_size"
|
||||
@pagination="getList" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getEnterpriseList,deleteEnterprise } from "@/api/enterprise"
|
||||
import Pagination from "@/components/Pagination"
|
||||
import checkPermission from '@/utils/permission'
|
||||
import { genTree } from "@/utils";
|
||||
export default {
|
||||
name:'Enterprisechose',
|
||||
components: { Pagination },
|
||||
data() {
|
||||
return {
|
||||
enterpriseList: {count:0},
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20
|
||||
},
|
||||
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
getEnterpriseList(this.listQuery).then(response => {
|
||||
if (response.data) {
|
||||
this.enterpriseList = response.data
|
||||
}
|
||||
this.listLoading = false
|
||||
});
|
||||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
page: 1,
|
||||
page_size: 20
|
||||
}
|
||||
this.getList()
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.page = 1
|
||||
this.getList()
|
||||
},
|
||||
handleChose(scope) {
|
||||
this.$emit('handleChose',scope.row);
|
||||
},
|
||||
handleChose2(row, column, event){
|
||||
this.$emit('handleChose',row);
|
||||
}
|
||||
},
|
||||
|
||||
};
|
||||
</script>
|
|
@ -59,18 +59,18 @@
|
|||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="所属认证类型">
|
||||
<template slot-scope="scope" v-if="scope.row.cert_field">{{ scope.row.cert_field.fullname }}</template>
|
||||
<template slot-scope="scope" v-if="scope.row.cert_field">{{ scope.row.cert_field.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品领域">
|
||||
<template slot-scope="scope" v-if="scope.row.pv_scope">{{ scope.row.pv_scope.fullname }}</template>
|
||||
<template slot-scope="scope" v-if="scope.row.pv_scope">{{ scope.row.pv_scope.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品分类">
|
||||
<template slot-scope="scope" >
|
||||
<div v-if="scope.row.pv_class">
|
||||
<el-tag style="margin:2px">{{ scope.row.pv_class.fullname }}</el-tag>
|
||||
<el-tag style="margin:2px">{{ scope.row.pv_class.name }}</el-tag>
|
||||
</div>
|
||||
<div>
|
||||
<el-tag v-for="(item, index) in scope.row.ccc_list" :key="index" style="margin:2px">{{item.fullname}}</el-tag>
|
||||
<el-tag v-for="(item, index) in scope.row.ccc_list" :key="index" style="margin:2px">{{item.name}}</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<el-option
|
||||
v-for="(item, index) in cert_patternOptions"
|
||||
:key="index"
|
||||
:label="item.fullname"
|
||||
:label="item.name"
|
||||
:value="item.value"
|
||||
:disabled="item.disabled"
|
||||
></el-option>
|
||||
|
@ -63,7 +63,7 @@
|
|||
<el-option
|
||||
v-for="(item, index) in pv_scopeOptions"
|
||||
:key="index"
|
||||
:label="item.fullname"
|
||||
:label="item.name"
|
||||
:value="item.value"
|
||||
:disabled="item.disabled"
|
||||
></el-option>
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<el-option
|
||||
v-for="(item, index) in cert_patternOptions"
|
||||
:key="index"
|
||||
:label="item.fullname"
|
||||
:label="item.name"
|
||||
:value="item.value"
|
||||
:disabled="item.disabled"
|
||||
></el-option>
|
||||
|
@ -66,7 +66,7 @@
|
|||
<el-option
|
||||
v-for="(item, index) in pv_scopeOptions"
|
||||
:key="index"
|
||||
:label="item.fullname"
|
||||
:label="item.name"
|
||||
:value="item.value"
|
||||
:disabled="item.disabled"
|
||||
></el-option>
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="认证领域">
|
||||
<template slot-scope="scope" v-if="scope.row.cert_field_">{{ scope.row.cert_field_.fullname }}</template>
|
||||
<template slot-scope="scope" v-if="scope.row.cert_field_">{{ scope.row.cert_field_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="证书号">
|
||||
<template slot-scope="scope">{{ scope.row.cert_number }}</template>
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="认证领域">
|
||||
<template slot-scope="scope" v-if="scope.row.cert_field_">{{ scope.row.cert_field_.fullname }}</template>
|
||||
<template slot-scope="scope" v-if="scope.row.cert_field_">{{ scope.row.cert_field_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="证书号">
|
||||
<template slot-scope="scope">{{ scope.row.cert_number }}</template>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from django.contrib import admin
|
||||
from .models import Standard
|
||||
from .models import ImplementRule, Standard
|
||||
# Register your models here.
|
||||
admin.site.register(Standard)
|
||||
admin.site.register(Standard)
|
||||
admin.site.register(ImplementRule)
|
|
@ -1,3 +1,8 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from .models import *
|
||||
# Register your models here.
|
||||
admin.site.register(Employee)
|
||||
admin.site.register(Qualification)
|
||||
admin.site.register(Ability)
|
||||
admin.site.register(Education)
|
||||
admin.site.register(Train)
|
|
@ -85,10 +85,10 @@ class Qualification(CommonAModel):
|
|||
else:
|
||||
if not self.is_enabled:
|
||||
for i in Ability.objects.filter(employee=self.employee, cert_field=self.cert_field):
|
||||
i.auditor_abilitys.remove(Dict.objects.get(code='checker_auditor'))
|
||||
i.auditor_abilitys.remove(Dict.objects.get(code='jcyshy'))
|
||||
else:
|
||||
for i in Ability.objects.filter(employee=self.employee, cert_field=self.cert_field):
|
||||
i.auditor_abilitys.add(Dict.objects.get(code='checker_auditor'))
|
||||
i.auditor_abilitys.add(Dict.objects.get(code='jcyshy'))
|
||||
super().save(*args, **kwargs)
|
||||
fields = Qualification.objects.filter(is_enabled=True, is_deleted=False).values_list('cert_field__code', flat=True)
|
||||
if self.employee.fields != ','.join(fields):
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from apps.project.views import ApplicationViewSet
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import *
|
||||
# Register your models here.
|
||||
admin.site.register(Application)
|
|
@ -0,0 +1,47 @@
|
|||
# Generated by Django 3.0.7 on 2020-08-05 02:35
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('project', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='application',
|
||||
name='cert_field',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='application',
|
||||
name='evdetail',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='application',
|
||||
name='factory',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='application',
|
||||
name='factory_v',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='application',
|
||||
name='manufacturer',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='application',
|
||||
name='manufacturer_v',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='application',
|
||||
name='fields',
|
||||
field=models.TextField(default=True, verbose_name='认证领域'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='application',
|
||||
name='evresult',
|
||||
field=models.CharField(choices=[('合格', '合格'), ('不合格', '不合格'), ('有条件放行', '有条件放行')], default='未评审', max_length=50, verbose_name='评审结论'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.0.7 on 2020-08-05 02:37
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('project', '0002_auto_20200805_1035'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='application',
|
||||
name='evresult',
|
||||
field=models.CharField(choices=[('未评审', '未评审'), ('合格', '合格'), ('不合格', '不合格'), ('有条件放行', '有条件放行')], default='未评审', max_length=50, verbose_name='评审结论'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.0.7 on 2020-08-05 03:54
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('project', '0003_auto_20200805_1037'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='application',
|
||||
name='fields',
|
||||
field=models.TextField(blank=True, verbose_name='认证领域'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.0.7 on 2020-08-05 06:50
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('project', '0004_auto_20200805_1154'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='application',
|
||||
name='stage',
|
||||
field=models.IntegerField(choices=[(0, '基本信息'), (1, '申请内容')], default=0, verbose_name='步骤状态'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,21 @@
|
|||
# Generated by Django 3.0.7 on 2020-08-06 06:57
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('system', '0025_auto_20200806_1457'),
|
||||
('project', '0005_application_stage'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='application',
|
||||
name='level',
|
||||
field=models.ForeignKey(default=111, on_delete=django.db.models.deletion.DO_NOTHING, related_name='application_level', to='system.Dict'),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 3.0.7 on 2020-08-06 08:25
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('project', '0006_application_level'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='subapplication',
|
||||
name='is_approve',
|
||||
field=models.BooleanField(default=True, verbose_name='是否认可'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='subapplication',
|
||||
name='pattern',
|
||||
field=models.CharField(choices=[('正常', '正常'), ('ODM', 'ODM'), ('OEM', 'OEM')], default='正常', max_length=50, verbose_name='申请模式'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,45 @@
|
|||
# Generated by Django 3.0.7 on 2020-08-06 09:22
|
||||
|
||||
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', '0007_auto_20200806_1625'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='subapplication',
|
||||
name='cert_field_code',
|
||||
field=models.CharField(default='CCC', max_length=50, verbose_name='认证领域代号'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='subapplication',
|
||||
name='factory',
|
||||
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='subapplication_factory', to='crm.Enterprise'),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='subapplication',
|
||||
name='factory_v',
|
||||
field=django.contrib.postgres.fields.jsonb.JSONField(default={}, verbose_name='生产厂'),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='subapplication',
|
||||
name='manufacture',
|
||||
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='subapplication_manufacture', to='crm.Enterprise'),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='subapplication',
|
||||
name='manufacture_v',
|
||||
field=django.contrib.postgres.fields.jsonb.JSONField(default={}, verbose_name='制造商'),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
|
@ -0,0 +1,30 @@
|
|||
# Generated by Django 3.0.7 on 2020-08-06 09:40
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('system', '0027_auto_20200806_1623'),
|
||||
('project', '0008_auto_20200806_1722'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='subapplication',
|
||||
name='cccpv_class',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='subapplication_cccpv_class', to='system.Dict', verbose_name='涉及CCC/PV分类'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='subapplication',
|
||||
name='cert_field_code',
|
||||
field=models.CharField(max_length=50, null=True, verbose_name='认证领域代号'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='subapplication',
|
||||
name='cnas_scopes',
|
||||
field=models.ManyToManyField(blank=True, null=True, related_name='subapplication_cnas_sopes', to='system.Dict', verbose_name='涉及cnas分类'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 3.0.7 on 2020-08-06 09:40
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('system', '0027_auto_20200806_1623'),
|
||||
('project', '0009_auto_20200806_1740'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='subapplication',
|
||||
name='cnas_scopes',
|
||||
field=models.ManyToManyField(blank=True, related_name='subapplication_cnas_sopes', to='system.Dict', verbose_name='涉及cnas分类'),
|
||||
),
|
||||
]
|
|
@ -29,25 +29,27 @@ class Application(CommonBModel):
|
|||
('已完成', '已完成')
|
||||
)
|
||||
result_choices = (
|
||||
('未评审', '未评审'),
|
||||
('合格', '合格'),
|
||||
('不合格', '不合格'),
|
||||
('有条件放行', '有条件放行')
|
||||
)
|
||||
stage_choices = (
|
||||
(0, '基本信息'),
|
||||
(1, '申请内容')
|
||||
)
|
||||
number = models.CharField('申请编号', max_length = 100)
|
||||
apply_date = models.DateField('申请日期', null=True, blank=True)
|
||||
accept_date = models.DateField('受理日期', null=True, blank=True)
|
||||
|
||||
applicant_v = JSONField(verbose_name='申请方')
|
||||
applicant = models.ForeignKey(Enterprise, related_name='application_applicant', on_delete=models.DO_NOTHING)
|
||||
manufacturer_v = JSONField(verbose_name='制造商', blank=True)
|
||||
manufacturer = models.ForeignKey(Enterprise, related_name='application_manufacturer', on_delete=models.SET_NULL, null=True, blank=True)
|
||||
factory_v = JSONField(verbose_name='生产厂', blank=True)
|
||||
factory = models.ForeignKey(Enterprise, related_name='application_factory', on_delete=models.SET_NULL, null=True, blank=True)
|
||||
cert_field = models.ForeignKey(Dict, verbose_name='认证领域', related_name='application_cert_field', on_delete=models.SET_NULL, null=True)
|
||||
fields = models.TextField('认证领域', blank=True)
|
||||
status = models.CharField('申请状态', choices=status_choices, default='草稿', max_length=50)
|
||||
evdetail = models.ManyToManyField(EvaluationItem, verbose_name='评审详细记录', through='EvaluationDetail')
|
||||
evresult = models.CharField('评审结论', choices = result_choices, default='合格', max_length=50)
|
||||
stage = models.IntegerField('步骤状态', choices=stage_choices, default=0)
|
||||
evresult = models.CharField('评审结论', choices = result_choices, default='未评审', max_length=50)
|
||||
evremark = models.TextField('备注', blank=True)
|
||||
level = models.ForeignKey(Dict, related_name='application_level', on_delete = models.DO_NOTHING)
|
||||
|
||||
class Meta:
|
||||
verbose_name = '认证主申请'
|
||||
|
@ -60,12 +62,24 @@ class SubApplication(CommonBModel):
|
|||
"""
|
||||
子申请
|
||||
"""
|
||||
pattern_choices = (
|
||||
('正常', '正常'),
|
||||
('ODM', 'ODM'),
|
||||
('OEM', 'OEM')
|
||||
)
|
||||
number = models.CharField('子申请编号', max_length = 100)
|
||||
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)
|
||||
cccpv_class = models.ForeignKey(Dict, verbose_name='涉及CCC/PV分类', related_name='subapplication_cccpv_class', on_delete=models.DO_NOTHING)
|
||||
cnas_scopes = models.ManyToManyField(Dict, verbose_name='涉及cnas分类', related_name='subapplication_cnas_sopes')
|
||||
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)
|
||||
project = models.ForeignKey(Project, related_name='subapplication_project', on_delete=models.SET_NULL, null=True)
|
||||
is_approve = models.BooleanField('是否认可', default=True)
|
||||
pattern = models.CharField('申请模式', default='正常', choices=pattern_choices, max_length=50)
|
||||
manufacture = models.ForeignKey(Enterprise, on_delete=models.CASCADE, related_name='subapplication_manufacture')
|
||||
manufacture_v = JSONField(verbose_name='制造商')
|
||||
factory = models.ForeignKey(Enterprise, on_delete=models.CASCADE, related_name='subapplication_factory')
|
||||
factory_v = JSONField(verbose_name='生产厂')
|
||||
|
||||
class Meta:
|
||||
verbose_name = '认证子申请'
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from .models import *
|
||||
|
||||
# from apps.system.serializers import DictSerializer, UserListSerializer
|
||||
# from apps.certset.serializers import ImplementRuleSerializer
|
||||
|
||||
class ApplicationCreateSerializer(serializers.ModelSerializer):
|
||||
number = serializers.CharField(required=False)
|
||||
class Meta:
|
||||
model = Application
|
||||
fields = '__all__'
|
||||
|
||||
class ApplicationUpdateSerializer(serializers.ModelSerializer):
|
||||
number = serializers.CharField(read_only=True)
|
||||
stage_ = serializers.SerializerMethodField(source='stage', read_only=True)
|
||||
class Meta:
|
||||
model = Application
|
||||
fields = '__all__'
|
||||
|
||||
def get_stage_(self, obj):
|
||||
return obj.get_stage_display()
|
||||
|
||||
class SubApplicationCreateSerializer(serializers.ModelSerializer):
|
||||
number = serializers.CharField(required=False)
|
||||
class Meta:
|
||||
model = SubApplication
|
||||
fields = '__all__'
|
||||
|
||||
class SubApplicationUpdateSerializer(serializers.ModelSerializer):
|
||||
number = serializers.CharField(read_only=True)
|
||||
cert_field_code = serializers.CharField(read_only=True)
|
||||
class Meta:
|
||||
model = SubApplication
|
||||
fields = '__all__'
|
|
@ -0,0 +1,10 @@
|
|||
from django.urls import path, include
|
||||
from .views import *
|
||||
from rest_framework import routers
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
router.register('application', ApplicationViewSet, basename="application")
|
||||
router.register('subapplication', SubApplicationViewSet, basename="subapplication")
|
||||
urlpatterns = [
|
||||
path('', include(router.urls))
|
||||
]
|
|
@ -1,3 +1,62 @@
|
|||
from django.shortcuts import render
|
||||
import rest_framework
|
||||
from rest_framework.viewsets import ModelViewSet, GenericViewSet
|
||||
from rest_framework.response import Response
|
||||
from rest_framework import status
|
||||
from .models import *
|
||||
from .serializers import *
|
||||
from apps.system.models import Dict
|
||||
from apps.system.permission_data import RbacFilterSet
|
||||
from apps.system.mixins import CreateUpdateCustomMixin, OptimizationMixin
|
||||
import random
|
||||
|
||||
# Create your views here.
|
||||
class ApplicationViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
||||
"""
|
||||
认证申请
|
||||
"""
|
||||
perms_map = {'get': 'application_view', 'post':'application_create', 'put':'application_update','delete': 'application_delete'}
|
||||
queryset = Application.objects.all()
|
||||
serializer_class = ApplicationCreateSerializer
|
||||
ordering = ['-create_time']
|
||||
|
||||
def get_serializer_class(self):
|
||||
if self.action == 'create':
|
||||
return ApplicationCreateSerializer
|
||||
else:
|
||||
return ApplicationUpdateSerializer
|
||||
|
||||
def perform_create(self, serializer):
|
||||
serializer.save(create_by = self.request.user, belong_dept=self.request.user.dept, number=random.randrange(1000,2000))
|
||||
|
||||
class SubApplicationViewSet(CreateUpdateCustomMixin, ModelViewSet):
|
||||
"""
|
||||
子认证申请
|
||||
"""
|
||||
perms_map = {'get': 'application_view', 'post':'application_create', 'put':'application_update','delete': 'application_delete'}
|
||||
queryset = SubApplication.objects.all()
|
||||
serializer_class = SubApplicationCreateSerializer
|
||||
filterset_fields = ['application']
|
||||
ordering = ['-create_time']
|
||||
|
||||
def get_serializer_class(self):
|
||||
if self.action == 'create':
|
||||
return SubApplicationCreateSerializer
|
||||
else:
|
||||
return SubApplicationUpdateSerializer
|
||||
|
||||
def create(self, request, *args, **kwargs):
|
||||
postdata = request.data
|
||||
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.is_valid(raise_exception=True)
|
||||
self.perform_create(serializer)
|
||||
headers = self.get_success_headers(serializer.data)
|
||||
return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)
|
||||
|
||||
def paginate_queryset(self, queryset):
|
||||
|
||||
if ((not self.request.query_params.get('page', None)) and (self.request.query_params.get('application', None))) or (self.paginator is None):
|
||||
return None
|
||||
return self.paginator.paginate_queryset(queryset, self.request, view=self)
|
|
@ -0,0 +1,29 @@
|
|||
# Generated by Django 3.0.7 on 2020-08-06 06:57
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('system', '0024_auto_20200716_0927'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='dict',
|
||||
name='typecode',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='dict_dicttype', to='system.DictType', to_field='code'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='historicaldict',
|
||||
name='typecode',
|
||||
field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='system.DictType', to_field='code'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='dict',
|
||||
name='type',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='dict_dicttype0', to='system.DictType', verbose_name='类型'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 3.0.7 on 2020-08-06 07:08
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('system', '0025_auto_20200806_1457'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='dict',
|
||||
name='type',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='system.DictType', verbose_name='类型'),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='dict',
|
||||
unique_together={('code', 'type')},
|
||||
),
|
||||
]
|
|
@ -0,0 +1,27 @@
|
|||
# Generated by Django 3.0.7 on 2020-08-06 08:23
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('system', '0026_auto_20200806_1508'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='dict',
|
||||
name='typecode',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='historicaldict',
|
||||
name='typecode',
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='dict',
|
||||
name='type',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='system.DictType', verbose_name='类型'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,37 @@
|
|||
# Generated by Django 3.0.7 on 2020-08-07 02:18
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('system', '0027_auto_20200806_1623'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='historicaldict',
|
||||
name='fullname',
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='dict',
|
||||
name='code',
|
||||
field=models.CharField(default=1, max_length=30, unique=True, verbose_name='编号'),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='historicaldict',
|
||||
name='code',
|
||||
field=models.CharField(db_index=True, default=1, max_length=30, verbose_name='编号'),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='dict',
|
||||
unique_together=set(),
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='dict',
|
||||
name='fullname',
|
||||
),
|
||||
]
|
|
@ -148,12 +148,11 @@ class Dict(SoftModel):
|
|||
数据字典
|
||||
"""
|
||||
name = models.CharField('名称', max_length=1000)
|
||||
code = models.CharField('编号', max_length=30, null=True, blank=True)
|
||||
fullname = models.CharField('全名', max_length=1000, null=True, blank=True)
|
||||
code = models.CharField('编号', max_length=30, unique=True)
|
||||
description = models.TextField('描述', blank=True, null=True)
|
||||
other = JSONField('其它信息', blank=True, null=True)
|
||||
type = models.ForeignKey(
|
||||
DictType, on_delete=models.CASCADE, verbose_name='类型')
|
||||
DictType, on_delete=models.DO_NOTHING, verbose_name='类型')
|
||||
sort = models.IntegerField('排序', default=1)
|
||||
parent = models.ForeignKey('self', null=True, blank=True,
|
||||
on_delete=models.SET_NULL, verbose_name='父')
|
||||
|
@ -163,18 +162,9 @@ class Dict(SoftModel):
|
|||
class Meta:
|
||||
verbose_name = '字典'
|
||||
verbose_name_plural = verbose_name
|
||||
unique_together = ('name', 'is_used', 'type')
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
"""
|
||||
冗余一个字段,方便调用
|
||||
"""
|
||||
if self.code and self.code not in self.name:
|
||||
self.fullname = self.code + '-' + self.name
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
class CommonAModel(SoftModel):
|
||||
"""
|
||||
|
|
|
@ -11,6 +11,6 @@ import os
|
|||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings_dev')
|
||||
|
||||
application = get_asgi_application()
|
||||
|
|
|
@ -35,6 +35,7 @@ urlpatterns = [
|
|||
path('certset/', include('apps.certset.urls')),
|
||||
path('crm/', include('apps.crm.urls')),
|
||||
path('employee/', include('apps.employee.urls')),
|
||||
path('project/', include('apps.project.urls')),
|
||||
path('docs/', include_docs_urls(title="接口文档",
|
||||
authentication_classes=[], permission_classes=[])),
|
||||
path('signature/', GenSignature.as_view(), name='gen_signature'),
|
||||
|
|
Loading…
Reference in New Issue