创建空项目,流程完善

This commit is contained in:
caoqianming 2020-10-27 08:45:19 +08:00
parent cb734240e2
commit dba0c4826d
10 changed files with 335 additions and 94 deletions

View File

@ -39,6 +39,13 @@ export function getProject(id) {
})
}
export function toplanProject(id) {
return request({
url: `/project/project/${id}/toplan/`,
method: 'put'
})
}
export function assginProject(id) {
return request({
url: `/project/project/${id}/assgin/`,

View File

@ -100,7 +100,7 @@ export const asyncRoutes = [
hidden: true
},
{
path: 'certapp/create/:id/',
path: 'certapp/create/:kind/',
name: 'Certappcreate',
component: () => import('@/views/certapp/certappcreate'),
meta: { title: '申请受理单创建', icon: 'example', perms: ['certapp_create'] },
@ -120,6 +120,13 @@ export const asyncRoutes = [
meta: { title: '业务详情', icon: 'example', perms: ['certapp_detail'] },
hidden: true
},
{
path: 'project/:id/update/',
name: 'Projectupdate',
component: () => import('@/views/project/handle'),
meta: { title: '编辑项目', icon: 'example', perms: ['project_update'] },
hidden: true
},
]
},
{

View File

@ -62,6 +62,11 @@ div:focus {
// main-container global css
.app-container {
padding: 10px;
overflow-y: hidden;
}
body .el-table th.gutter{
display: table-cell!important;
}
.el-table--medium td,   .el-table--medium th {

View File

@ -97,7 +97,7 @@
<span>{{ scope.row.create_time }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="300" fixed="right">
<el-table-column label="操作" fixed="right" width="260">
<template slot-scope="scope">
<el-button
v-if="scope.row.state == '审核任务已接受'"
@ -222,22 +222,18 @@
<span>{{ scope.row.create_time }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="300" fixed="right">
<el-table-column label="操作" fixed="right" width="260">
<template slot-scope="scope">
<el-button
type="primary"
size="small"
:disabled="
!checkPermission(['certapp_feedback'])
"
:disabled="!checkPermission(['certapp_feedback'])"
@click="handleCertappFeedback(scope)"
>反馈</el-button
>
<el-button
size="small"
:disabled="
!checkPermission(['certapp_test'])
"
:disabled="!checkPermission(['certapp_test'])"
@click="handleCertappTest(scope)"
>安排检测</el-button
>

View File

@ -2,67 +2,43 @@
<div class="app-container">
<div style="display:flex">
<treeselect
v-model="listQuery.user__dept"
v-model="listQuery.cert_field"
:multiple="false"
:options="deptOptions"
placeholder="所属组织"
:options="fieldOptions"
placeholder="所属领域"
:default-expand-level="1"
: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"
style="width: 300px;margin-left:2px"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
<el-button-group style="margin-left:2px">
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
style="margin-left:2px"
>搜索</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>刷新重置</el-button>
</el-button-group>
>重置</el-button>
</div>
<div style="margin-top:6px">
<el-button-group>
<el-button type="primary" icon="el-icon-plus" v-for="(item, index) in field_list" :key="'field_list' + index" @click="handleCreate(item,index)" size="mini">{{item.name}}</el-button>
<el-button type="warning" size="mini" icon="el-icon-plus">批量多体系</el-button>
</el-button-group>
</div>
<el-table
v-loading="listLoading"
:data="tableData.results"
style="width: 100%;margin-top:10px;"
style="width: 100%;margin-top:6px;"
border
fit
stripe
@ -79,11 +55,13 @@
<el-tag v-if="scope.row.cccpv_class_" type="warning" style="margin:2px">{{scope.row.cccpv_class_.name}}</el-tag>
</template>
</el-table-column>
<el-table-column label="申请信息" width="300px">
<el-table-column label="申请" width="300px">
<template slot-scope="scope">
<div><span style="color:darkblue;font-weight:bold">申请方</span>:{{ scope.row.applicant_v.name }}</div>
<!-- <div><span style="color:darkblue;font-weight:bold">申请方</span>: -->
{{ scope.row.applicant_v.name }}
<!-- </div>
<div v-if="scope.row.manufacture"><span style="color:darkblue;font-weight:bold">制造商</span>:{{ scope.row.manufacture_v.name }}</div>
<div v-if="scope.row.factory"><span style="color:darkblue;font-weight:bold">生产厂</span>:{{ scope.row.factory_v.name }}</div>
<div v-if="scope.row.factory"><span style="color:darkblue;font-weight:bold">生产厂</span>:{{ scope.row.factory_v.name }}</div> -->
</template>
</el-table-column>
<el-table-column label="当前状态">
@ -102,15 +80,17 @@
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
v-if="scope.row.state=='申请'"
type="primary"
size="small"
:disabled="!checkPermission(['case_update'])"
:disabled="!checkPermission(['certapp_update'])"
@click="handleUpdate(scope)"
>编辑</el-button>
<el-button
v-if="scope.row.state=='申请'"
type="danger"
size="small"
:disabled="!checkPermission(['case_delete'])"
:disabled="!checkPermission(['certapp_delete'])"
@click="handleDelete(scope)"
>删除</el-button>
</template>
@ -145,13 +125,12 @@ export default {
page: 1,
page_size: 20
},
deptOptions: [],
fieldOptions: [],
field_list:[]
};
},
created() {
this.getList()
this.getdeptOptions()
this.getfields()
},
methods: {
@ -165,11 +144,11 @@ export default {
this.listLoading = false
});
},
getdeptOptions() {
getOrgList().then(res=>{
this.deptOptions = genTree(res.data)
})
},
// getdeptOptions() {
// getOrgList().then(res=>{
// this.deptOptions = genTree(res.data)
// })
// },
resetFilter() {
this.listQuery = {
page: 1,
@ -203,6 +182,7 @@ deleteCertapp(scope.row.id).then(res=>{
getfields(){
getDictList({type__code:'cert_field'}).then(res=>{
let fields = []
this.fieldOptions = genTree(res.data)
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})

View File

@ -0,0 +1,172 @@
<template>
<div class="app-container">
<div style="display:flex">
<treeselect
v-model="listQuery.cert_field"
:multiple="false"
:options="fieldOptions"
placeholder="所属领域"
:default-expand-level="1"
:disable-branch-nodes="true"
@input="handleFilter"
style="width: 280px" clearable/>
<el-input
v-model="listQuery.search"
placeholder="姓名/易记码/编号/注册领域"
style="width: 300px;margin-left:2px"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
style="margin-left:2px"
>搜索</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>重置</el-button>
</div>
<el-table
v-loading="listLoading"
:data="tableData.results"
style="width: 100%;margin-top:6px;"
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">
<el-tag >{{scope.row.cert_field_.name}}</el-tag>
<el-tag v-if="scope.row.cccpv_class_" type="warning" style="margin:2px">{{scope.row.cccpv_class_.name}}</el-tag>
</template>
</el-table-column>
<el-table-column label="申请方" width="300px">
<template slot-scope="scope">
<!-- <div><span style="color:darkblue;font-weight:bold">申请方</span>: -->
{{ scope.row.applicant_v.name }}
<!-- </div>
<div v-if="scope.row.manufacture"><span style="color:darkblue;font-weight:bold">制造商</span>:{{ scope.row.manufacture_v.name }}</div>
<div v-if="scope.row.factory"><span style="color:darkblue;font-weight:bold">生产厂</span>:{{ scope.row.factory_v.name }}</div> -->
</template>
</el-table-column>
<el-table-column label="当前状态">
<template slot-scope="scope">
{{ scope.row.state}}
</template>
</el-table-column>
<el-table-column label="创建人">
<template slot-scope="scope">{{ scope.row.create_by_.name}}</template>
</el-table-column>
<el-table-column label="创建日期">
<template slot-scope="scope">
<span>{{ scope.row.create_time }}</span>
</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 { getCertappList, deleteCertapp } from "@/api/certapp"
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 },
name:'Certappchose',
props:['querydata'],
data() {
return {
tableData: {count:0},
listLoading: true,
listQuery: this.querydata,
fieldOptions: [],
field_list:[]
};
},
created() {
this.getList()
this.getfields()
},
methods: {
checkPermission,
getList() {
this.listLoading = true;
getCertappList(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 = this.querydata
this.getList()
},
handleFilter() {
this.listQuery.page = 1
this.getList()
},
handleCreate(item, index) {
this.$router.push({name:"Certappcreate", params:{kind:item.code}})
},
handleUpdate(scope) {
this.$router.push({name:"Certappupdate", params:{ id:scope.row.id}})
},
handleDelete(scope) {
this.$confirm('确认删除?', '警告', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'error'
}).then(()=>{
deleteCertapp(scope.row.id).then(res=>{
this.$message.success('成功')
this.getList()
})
}).catch(e=>{})
},
getfields(){
getDictList({type__code:'cert_field'}).then(res=>{
let fields = []
this.fieldOptions = genTree(res.data)
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
})
},
}
};
</script>

View File

@ -12,14 +12,13 @@
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>
@click="resetFilter">重置</el-button>
</div>
<el-table v-loading="listLoading"
:data="enterpriseList.results"
style="width: 100%;margin-bottom: 20px"
style="margin-top:2px"
row-key="id"
border
default-expand-all

View File

@ -133,11 +133,12 @@
<div slot="header" class="clearfix">
<span>业务信息</span>
</div>
<el-button type="primary" @click="appendCertapp" size="mini">添加申请</el-button>
<el-table
ref="projectTable"
v-loading="listLoading"
:data="certappData"
style="width: 100%;"
style="margin-top:2px"
border
fit
stripe
@ -187,7 +188,7 @@
<span>{{ scope.row.create_time }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="300" fixed="right">
<el-table-column label="操作" fixed="right">
<template slot-scope="scope">
<el-button
v-if="$route.name == 'AuditProject'"
@ -214,6 +215,12 @@
:disabled="!checkPermission(['certapp_detail'])"
@click="handleDetail(scope)"
>详情</el-button>
<el-button
v-if="$route.name == 'Projectupdate'"
type="danger"
size="small"
@click="handleRemove(scope)"
>移除</el-button>
</template>
</el-table-column>
</el-table>
@ -466,9 +473,19 @@
width="80%"
:append-to-body="true"
>
<Userchose ref="Userchose" :queryData="queryData" @handleChose="choseComplete"></Userchose>
<Userchose ref="Userchose" :querydata="querydata" @handleChose="choseComplete"></Userchose>
</el-dialog>
<el-dialog
title="选择申请"
:visible.sync="chooseVisiable2"
:close-on-click-modal="false"
width="80%"
:append-to-body="true"
>
<Certappchose ref="Certappchose" @handleChose="chooseComplete2" :querydata="querydata2"></Certappchose>
</el-dialog>
</div>
</template>
<style scoped>
.text {
@ -494,6 +511,7 @@ import { getContactRecordList, createContactRecord } from "@/api/plan";
import Pagination from "@/components/Pagination";
import checkPermission from "@/utils/permission";
import Userchose from "@/views/employee/userchose";
import Certappchose from '@/views/certapp/certappchose'
import {
getMemberList,
createMember,
@ -501,8 +519,9 @@ import {
deleteMember,
} from "@/api/member";
import { genTree, deepClone } from "@/utils";
export default {
components: { Pagination, Userchose },
components: { Pagination, Userchose, Certappchose },
props: [],
data() {
return {
@ -556,7 +575,9 @@ export default {
],
},
choseVisiable: false,
queryData: {},
chooseVisiable2:false,
querydata: {},
querydata2:{},
identityOptions: [],
edate:[],
edate_:[],
@ -770,7 +791,18 @@ export default {
handleDetail(scope){
this.$router.push({name:"Certappdetail", params:{id:scope.row.id}})
},
appendCertapp(){
this.querydata2={
page:1,
page_size:10,
applicant:this.project.auditee,
state:'策划'
}
this.chooseVisiable2 = true
},
choseComplete2(val){
}
},
};
</script>

View File

@ -3,7 +3,7 @@
<el-tabs>
<el-tab-pane label="认证项目">
<div>
<el-button type="primary" @click="genProject0" size="mini">新建项目</el-button>
<el-button type="primary" @click="createProject" size="mini">新建项目</el-button>
</div>
<el-table
v-loading="listLoading"
@ -19,12 +19,12 @@
<el-table-column label="项目号">
<template slot-scope="scope" v-if="scope.row.number">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="受审核方" width="300px">
<el-table-column label="受审核方" >
<template slot-scope="scope">
{{ scope.row.auditee_v.name }}
</template>
</el-table-column>
<el-table-column label="项目信息" width="300px" :show-overflow-tooltip="true" >
<el-table-column label="项目信息" :show-overflow-tooltip="true" >
<template slot-scope="scope" v-if="scope.row.certapps">
<el-tag v-for="(item, index) in scope.row.certapps" :key="index" style="margin:2px" >{{item}}</el-tag>
</template>
@ -40,29 +40,29 @@
<span>{{ scope.row.create_time }}</span>
</template>
</el-table-column>
<el-table-column label="操作">
<el-table-column label="操作" fixed="right" width="260">
<template slot-scope="scope">
<el-button-group>
<el-button
v-if="scope.row.state == '创建中'"
type="warning"
size="small"
:disabled="!checkPermission(['project_assign'])"
@click="handleNext(scope)"
@click="handletoPlan(scope)"
>转策划</el-button>
<el-button
type="primary"
size="small"
:disabled="!checkPermission(['project_update'])"
@click="handleUpdate(scope)"
>编辑</el-button>
<el-button
v-if="['创建中', '待策划'].indexOf(scope.row.state)!=-1"
type="danger"
size="small"
:disabled="!checkPermission(['project_delete'])"
@click="handleDelete(scope)"
>删除</el-button>
</el-button-group>
</template>
</el-table-column>
@ -112,18 +112,7 @@
</el-table-column>
<el-table-column label="申请信息" width="300px">
<template slot-scope="scope">
<div>
<span style="color:darkblue;font-weight:bold">申请方</span>
:{{ scope.row.applicant_v.name }}
</div>
<div v-if="scope.row.manufacture">
<span style="color:darkblue;font-weight:bold">制造商</span>
:{{ scope.row.manufacture_v.name }}
</div>
<div v-if="scope.row.factory">
<span style="color:darkblue;font-weight:bold">生产厂</span>
:{{ scope.row.factory_v.name }}
</div>
{{ scope.row.applicant_v.name }}
</template>
</el-table-column>
<el-table-column label="当前状态">
@ -152,8 +141,8 @@
<el-form ref="elForm" :model="formData" label-width="80px" label-position="right" :rules="rules">
<div v-if="certapps_data.length > 0">已选择<span style="color:red;font-weight:bold">{{certapps_data.length}}</span>条已受理业务</div>
<el-form-item label="受审核方" prop="auditee">
<el-input placeholder="请选择受审核方" readonly clearable v-model="formData.auditee_v.name">
<el-button slot="append" icon="el-icon-search" @click="choose(0)" v-if="certapps_data.length == 0"></el-button>
<el-input placeholder="请选择受审核方" :readonly="dgReadonly" clearable v-model="formData.auditee_v.name">
<el-button slot="append" icon="el-icon-search" @click="chooseE"></el-button>
</el-input>
</el-form-item>
<el-form-item label="联系人" prop="auditee_v.linkman_name">
@ -172,24 +161,36 @@
<el-button type="primary" @click="confirm('Form')">确认</el-button>
</div>
</el-dialog>
<el-dialog
title="选择企业"
:visible.sync="chooseVisiable"
:close-on-click-modal="false"
width="80%"
:append-to-body="true"
>
<Enterprisechose ref="Enterprisechose" @handleChose="chooseComplete"></Enterprisechose>
</el-dialog>
</div>
</template>
<script>
import Enterprisechose from "@/views/enterprise/enterprisechoose";
import { getCertappList } from "@/api/certapp";
import { getProjectList, createProject, nextProject } from "@/api/project"
import { getProjectList, createProject, toplanProject } from "@/api/project"
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 },
components: { Pagination, Treeselect, Enterprisechose },
data() {
return {
certapps_data:[],
certappData: {count:0,results:[]},
listLoading: true,
dgReadonly:true,
listLoading: false,
chooseVisiable:false,
listQuery: {
page:1,
page_size:20,
@ -275,7 +276,10 @@ export default {
if(this.certapps_data.length >0){
this.dialogvisible_project = true
this.formData.auditee = this.certapps_data[0].applicant
this.formData.auditee_v = this.certapps_data[0].applicant_v
this.formData.auditee_v = {name:this.certapp_data[0].applicant_v.name,
linkman_name:this.certapps_data[0].applicant_v.linkman1_name,
linkman_mobile:this.certapp_data[0].applicant_v.linkman1_mobile}
}else{
this.$message.warning('请先选择已受理业务')
}
@ -284,6 +288,14 @@ export default {
this.$refs['projectTable'].clearSelection()
this.dialogvisible_project = true
},
createProject() {
this.$refs['projectTable'].clearSelection()
this.certapps_data = []
if (this.$refs['elForm'] !== undefined) {
this.$refs['elForm'].resetFields();
}
this.dialogvisible_project = true
},
handleSelectionChange(val){
this.certapps_data = val
},
@ -299,22 +311,39 @@ export default {
})
})
},
handleNext(scope) {
if(scope.row.certapps.length == 0){
this.$message.error('该项目不包含业务,无法继续!')
}else{
handletoPlan(scope) {
this.$confirm("确定转入策划派差吗?", "提示", {
type: "warning",
}).then(() => {
nextProject(scope.row.id, {}).then(res=>{
toplanProject(scope.row.id, {}).then(res=>{
this.$message.success('成功')
this.getProjectList_()
})
}).catch(()=>{
});
},
handleUpdate(scope) {
this.$router.push({
name: "Projectupdate",
params: { id: scope.row.id },
});
},
chooseE(){
this.chooseVisiable = true
},
chooseComplete(val) {
this.chooseVisiable = false;
if (val) {
console.log(val)
this.formData.auditee = val.id
this.formData.auditee_v = {
name:val.name,
linkman_name:val.linkman1_name,
linkman_mobile:val.linkman1_mobile
}
}
}
},
},
};
</script>

View File

@ -78,7 +78,7 @@ class CertappViewset(PageOrNot, RbacFilterSet, ModelViewSet):
queryset = CertApp.objects.all()
serializer_class = CertappSerializer
ordering = ['-create_time']
filterset_fields = ['state', 'project']
filterset_fields = ['state', 'project', 'cert_field']
# filterset_class = CertAppFilter
@ -288,6 +288,7 @@ class ProjectViewSet(RbacFilterSet, ModelViewSet):
serializer = self.get_serializer(data=postdata)
serializer.is_valid(raise_exception=True)
obj = serializer.save(create_by = self.request.user, belong_dept=self.request.user.dept)
obj.state = '创建中'
if 'certapps' in postdata and postdata['certapps']:
CertApp.objects.filter(pk__in = postdata['certapps']).update(project=obj)
obj.state = '待策划'
@ -309,6 +310,19 @@ class ProjectViewSet(RbacFilterSet, ModelViewSet):
else:
return Response('项目状态异常,操作失败', status=status.HTTP_400_BAD_REQUEST)
@action(methods=['put'], detail=True, perms_map={'put':'project_toplan'},
url_name='project_toplan')
def toplan(self, request, *args, **kwargs):
"""
转入策划
"""
obj = self.get_object()
if CertApp.objects.filter(project=obj, is_deleted=False).exists():
obj.state = '待策划'
obj.save()
return Response(status=status.HTTP_200_OK)
else:
return Response('该项目没有业务信息,操作失败', status=status.HTTP_400_BAD_REQUEST)
@action(methods=['put'], detail=False, perms_map={'put':'project_plan'},
url_name='project_plan')