This commit is contained in:
shilixia 2021-05-07 14:42:17 +08:00
commit c664f060de
14 changed files with 745 additions and 511 deletions

View File

@ -0,0 +1,30 @@
import request from '@/utils/request'
//巡查组
export function getInspectTeamList(query) {
return request({
url: '/quality/inspectteam/',
method: 'get',
params: query
})
}
export function createInspectTeam(data) {
return request({
url: '/quality/inspectteam/',
method: 'post',
data
})
}
export function deleteInspectTeam(id, data) {
return request({
url: `/quality/inspectteam/${id}/`,
method: 'delete',
data
})
}

View File

@ -41,18 +41,21 @@
max-height="600" max-height="600"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="检查模板">
<template slot-scope="scope">{{ scope.row.template_name }}</template>
</el-table-column>
<el-table-column label="任务名"> <el-table-column label="任务名">
<template slot-scope="scope">{{ scope.row.name }}</template> <template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="执行单位"> <el-table-column label="当前状态">
<template slot-scope="scope">{{ scope.row.dept_count }}</template> <template slot-scope="scope">{{ scope.row.state }}</template>
</el-table-column>
<el-table-column label="检查模板">
<template slot-scope="scope">{{ scope.row.template_name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="子任务数"> <el-table-column label="子任务数">
<template slot-scope="scope">{{ scope.row.subtask_count }}</template> <template slot-scope="scope">{{ scope.row.subtask_count }}</template>
</el-table-column> </el-table-column>
<el-table-column label="涉及单位数">
<template slot-scope="scope">{{ scope.row.dept_count }}</template>
</el-table-column>
<el-table-column label="巡查开始日期"> <el-table-column label="巡查开始日期">
<template slot-scope="scope">{{ scope.row.start_date }}</template> <template slot-scope="scope">{{ scope.row.start_date }}</template>
@ -62,30 +65,25 @@
<template slot-scope="scope">{{ scope.row.end_date }}</template> <template slot-scope="scope">{{ scope.row.end_date }}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column align="center" label="操作" width="220px">
align="center"
label="操作"
width="220px"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
type="primary" type="primary"
v-if="checkPermission(['task_view'])" v-if="checkPermission(['task_view'])"
@click="handleDo(scope)" @click="handleDo(scope)"
>执行</el-link> >执行</el-link
>
<el-link <el-link
v-if="checkPermission(['task_update'])" v-if="checkPermission(['task_update'])"
@click="handleEdit(scope)" @click="handleEdit(scope)"
>编辑</el-link> >编辑</el-link
<el-link >
v-if="checkPermission(['task_close']) && scope.row.state!='已关闭'"
@click="handleClose(scope)"
>关闭</el-link>
<el-link <el-link
v-if="checkPermission(['task_delete'])" v-if="checkPermission(['task_delete'])"
type="danger" type="danger"
@click="handleDelete(scope)" @click="handleDelete(scope)"
>删除</el-link> >删除</el-link
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -140,8 +138,6 @@
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="text-align: right"> <div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button> <el-button type="danger" @click="dialogVisible = false">取消</el-button>
@ -151,7 +147,13 @@
</div> </div>
</template> </template>
<script> <script>
import { getinspecttasklist, createinspecttask, deleteinspecttask, updateinspecttask, closeinspecttask } from "@/api/inspectTask"; import {
getinspecttasklist,
createinspecttask,
deleteinspecttask,
updateinspecttask,
closeinspecttask,
} from "@/api/inspectTask";
import { getInspecttemplateList } from "@/api/qualityinspect"; import { getInspecttemplateList } from "@/api/qualityinspect";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
@ -219,7 +221,7 @@ export default {
this.listQuery = { this.listQuery = {
page: 1, page: 1,
page_size: 20, page_size: 20,
} };
this.getList(); this.getList();
}, },
handleCreate() { handleCreate() {
@ -231,7 +233,10 @@ export default {
}); });
}, },
handleDo(scope) { handleDo(scope) {
this.$router.push({name: "InpectTaskdo", params: { inpecttask: scope.row.id }, }) this.$router.push({
name: "InpectTaskdo",
params: { id: scope.row.id },
});
}, },
handleEdit(scope) { handleEdit(scope) {
this.task = Object.assign({}, scope.row); // copy obj this.task = Object.assign({}, scope.row); // copy obj

View File

@ -8,6 +8,7 @@
> >
<el-table <el-table
style="margin-top:4px"
v-loading="listLoading" v-loading="listLoading"
:data="inspecttemplateList" :data="inspecttemplateList"
border border
@ -57,6 +58,7 @@
> >
<el-table <el-table
style="margin-top:4px"
v-loading="listLoading" v-loading="listLoading"
:data="inspectTableList" :data="inspectTableList"
border border
@ -73,7 +75,7 @@
<template slot-scope="scope">{{ scope.row.sortnum }}</template> <template slot-scope="scope">{{ scope.row.sortnum }}</template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="检查要点"> <el-table-column align="center" label="检查事项">
<template slot-scope="scope">{{ scope.row.name }}</template> <template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="检查类型"> <el-table-column align="center" label="检查类型">
@ -127,9 +129,9 @@
label-position="right" label-position="right"
:rules="rule1" :rules="rule1"
> >
<el-form-item label="检查要求" prop="name"> <el-form-item label="检查事项" prop="name">
<el-input type="textarea" <el-input type="textarea"
:rows="4" v-model="inspectTable.name" placeholder="检查要求" /> :rows="4" v-model="inspectTable.name" placeholder="检查事项" />
</el-form-item> </el-form-item>
<el-form-item label="类型" prop="type"> <el-form-item label="类型" prop="type">
<el-select <el-select
@ -180,7 +182,7 @@
</el-dialog> </el-dialog>
<el-dialog <el-dialog
:visible.sync="dialogVisibles" :visible.sync="dialogVisibles"
:title="dialogTypes === 'edit' ? '编辑资料' : '新增资料'" :title="dialogTypes === 'edit' ? '编辑' : '新增'"
> >
<el-form <el-form
ref="Forms" ref="Forms"
@ -189,9 +191,8 @@
label-position="right" label-position="right"
:rules="rule1" :rules="rule1"
> >
<el-form-item label="检查模板名称" prop="name"> <el-form-item label="模板名称" prop="name">
<el-input type="textarea" <el-input v-model="inspecttemplate.name" placeholder="检查模板名称" />
:rows="4" v-model="inspecttemplate.name" placeholder="检查模板名称" />
</el-form-item> </el-form-item>

View File

@ -52,7 +52,7 @@
<el-card style="margin-top: 2px"> <el-card style="margin-top: 2px">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<el-button type="primary" icon="el-icon-plus" @click="createChildtask()" <el-button type="primary" icon="el-icon-plus" @click="createChildtask()" v-if="task.state != '已完成'" size="small"
>创建子任务</el-button >创建子任务</el-button
> >
</div> </div>
@ -63,7 +63,6 @@
fit fit
stripe stripe
highlight-current-row highlight-current-row
max-height="300"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column align="center" label="子任务"> <el-table-column align="center" label="子任务">
@ -71,12 +70,12 @@
</el-table-column> </el-table-column>
<el-table-column align="center" label="巡检人员"> <el-table-column align="center" label="巡检人员">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-for="item in scope.row.members" v-bind:key="item.member"> <span v-for="item in scope.row.members" v-bind:key="item.member" style="padding:1px">
<el-tag v-if="item.type=='组长'" effect="plain">{{ <el-tag v-if="item.type=='组长'" effect="plain" type="danger">{{
item.member__name item.member__name
}}</el-tag> }}</el-tag>
<el-tag type="danger" effect="plain" v-else>{{ <el-tag effect="plain" v-else>{{
item.member__name item.member__name
}}</el-tag> }}</el-tag>
</span> </span>
@ -95,13 +94,7 @@
fixed="right" fixed="right"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click="handleClick(scope)" type="primary">执行</el-button> <el-button @click="handleClick(scope)" type="primary" size="small">执行</el-button>
<el-button
type="primary"
size="small"
icon="el-icon-edit"
@click="handleEdit(scope)"
/>
<el-button <el-button
type="danger" type="danger"
size="small" size="small"
@ -261,7 +254,7 @@ export default {
}; };
}, },
created() { created() {
this.task.id = this.$route.params.inpecttask; this.task.id = this.$route.params.id;
this.getinspecttask();//主任务信息 this.getinspecttask();//主任务信息
this.getUserList();//组员 this.getUserList();//组员
@ -279,7 +272,7 @@ export default {
}, },
//子任务信息 //子任务信息
getsubinspecttasklist(){ getsubinspecttasklist(){
getsubinspecttasklist({pageoff:true,inspecttask:this.$route.params.inpecttask}).then((res)=>{ getsubinspecttasklist({pageoff:true,inspecttask:this.$route.params.id}).then((res)=>{
this.subinsecttask=res.data; this.subinsecttask=res.data;
}); });
}, },

View File

@ -1,122 +1,148 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-card style="float:left;width: 45%;"> <el-row :gutter="6">
<el-button type="primary" @click="dialogVisibles=true">增加组织</el-button> <el-col :span="8">
<el-card>
<div slot="header">
<span>涉及组织</span>
</div>
<el-button type="primary" @click="dialogVisibles = true" size="small"
>增加组织</el-button
>
<el-table <el-table
:data="recordList" :data="recordList"
border
fit fit
stripe stripe
highlight-current-row highlight-current-row
style="width: 100%" style="margin-top:4px"
@row-click="deptClick" @row-click="deptClick"
max-height="300"
> >
<el-table-column <el-table-column label="组织名称">
label="组织名称"
>
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.dept__name }} {{ scope.row.dept__name }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="检查状态">
label="检查状态"
>
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.state }} {{ scope.row.state }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作"> <el-table-column label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button
type="danger"
@click="handleDelete(scope)"
>删除</el-button>
<el-button type="warning" v-if="
scope.row.state == '待检查'
"
@click="handleStartup(scope)">开始检查</el-button>
<el-button type="primary" v-if="
scope.row.state == '检查中'
"
@click="handleCheckup(scope)">组长提交</el-button>
<el-link
type="warning"
v-if="scope.row.state == '待检查'"
@click="handleStartup(scope)"
>开始检查</el-link>
<el-link
type="primary"
v-if="scope.row.state == '检查中'"
@click="handleCheckup(scope)">组长提交</el-link>
<el-link type="danger" @click="handleDelete(scope)"
>删除</el-link
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-card> </el-card>
<el-card class="box-card" style="float:right;width: 55%;"> <el-card style="margin-top:4px">
<el-button type="primary" @click="dialogFormVisible=true">指派任务</el-button> <div slot="header">
<span>检查组成员</span>
</div>
<el-button type="primary" @click="handleCreateMember" size="small"
>增加成员</el-button
>
<el-table <el-table
:data="inspectitemList" :data="members"
border
fit fit
stripe stripe
highlight-current-row highlight-current-row
style="width: 100%" style="margin-top:4px"
max-height="600"
@selection-change="handleSelectionChange"> >
<el-table-column <el-table-column label="成员名">
type="selection"
width="55">
</el-table-column>
<el-table-column
label="检查要点"
width="230">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.member__name }}
{{ scope.row.item_.name }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="成员类型">
label="检查类型"
width="100">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.type }}
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-link type="danger" @click="handleDeleteMember(scope)"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
<el-col :span="16">
<el-card>
<div slot="header">
<span>检查详情</span>
</div>
<el-button type="primary" @click="dialogFormVisible = true" size="small"
>指派任务</el-button
>
<el-table
:data="inspectitemList"
border
fit
stripe
highlight-current-row
style="margin-top:4px"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column label="检查事项" >
<template slot-scope="scope">
{{ scope.row.item_.sortnum }}.{{ scope.row.item_.name }}
</template>
</el-table-column>
<el-table-column label="检查类型" >
<template slot-scope="scope">
{{ scope.row.item_.type }} {{ scope.row.item_.type }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="检查人" >
<el-table-column
label="检查人"
width="180">
<template slot-scope="scope" v-if="scope.row.checker_"> <template slot-scope="scope" v-if="scope.row.checker_">
{{ scope.row.checker_.name }} {{ scope.row.checker_.name }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="检查状态" >
label="检查状态"
width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.checked" style="color:green">已检查</span> <span v-if="scope.row.checked" style="color: green"
>已检查</span
>
<span v-else style="color: blue">未检查</span> <span v-else style="color: blue">未检查</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作"> <el-table-column label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-link @click="handleCheck(scope)" type="primary" v-if="nowDept.state=='检查中'">检查</el-link>
<el-button <el-link @click="handleCheckDetail(scope)">详情</el-link>
@click="handleCheck(scope)">提交结果</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-card>
</el-col>
</el-row>
<el-dialog <el-dialog
:visible.sync="dialogFormVisible" :visible.sync="dialogFormVisible"
:title="dialogType === 'edit' ? '编辑任务' : '指派人员'" title="指派人员"
> >
<el-form <el-form
ref="Forms" ref="Forms"
@ -124,91 +150,153 @@
label-width="80px" label-width="80px"
label-position="right" label-position="right"
> >
<el-form-item label="检查人" prop="checker">
<el-form-item label="负责人" prop="checker">
<el-select <el-select
v-model="mbersData.checker" v-model="mbersData.checker"
style="width: 100%" style="width: 100%"
allow-create
default-first-option default-first-option
placeholder="请选择组长"> placeholder="请选择检查人"
>
<el-option <el-option
v-for="item in leaders" v-for="item in members"
:key="item.member" :key="item.member"
:label="item.member__name" :label="item.member__name"
:value="item.member"> :value="item.member"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="text-align: right"> <div style="text-align: right">
<el-button type="danger" @click="dialogFormVisible = false">取消</el-button> <el-button type="danger" @click="dialogFormVisible = false"
<el-button type="primary" @click="sendconfirm('Forms')">确认</el-button> >取消</el-button
>
<el-button type="primary" @click="sendconfirm('Forms')"
>确认</el-button
>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog <el-dialog
:visible.sync="dialogVisibles" :visible.sync="createMemberDg"
title="增加成员"
> >
<el-form
ref="Forms"
:model="memberForm"
label-width="80px"
label-position="right"
>
<el-form-item label="成员" prop="member">
<el-select
v-model="memberForm.member"
style="width: 100%"
default-first-option
placeholder="请选择成员"
>
<el-option
v-for="item in memberOptions"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="成员类型" prop="type">
<el-radio-group v-model="memberForm.type">
<el-radio label="组员">组员</el-radio>
<el-radio label="组长">组长</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="createMemberDg = false"
>取消</el-button
>
<el-button type="primary" @click="confirmMember"
>确认</el-button
>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogVisibles">
<el-form <el-form
ref="Formss" ref="Formss"
label-width="80px" label-width="80px"
label-position="right" label-position="right"
:model="inspectDept" :model="inspectDept"
> >
<el-form-item label="选择组织" prop="leader"> <el-form-item label="选择组织" prop="leader">
<el-select <el-select
filterable filterable
style="width: 100%" style="width: 100%"
allow-create
v-model="inspectDept.dept" v-model="inspectDept.dept"
default-first-option default-first-option
placeholder="请选择组织"> placeholder="请选择组织"
>
<el-option <el-option
v-for="item in deptOptions" v-for="item in deptOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="text-align: right"> <div style="text-align: right">
<el-button type="danger" @click="dialogVisibles = false">取消</el-button> <el-button type="danger" @click="dialogVisibles = false"
<el-button type="primary" @click="addDept('Formss')">确认</el-button> >取消</el-button
>
<el-button type="primary" @click="addDept('Formss')"
>确认</el-button
>
</div> </div>
</el-dialog> </el-dialog>
<el-drawer <el-drawer
title="任务检查" title="任务详情"
:before-close="handleClose"
:visible.sync="dialog" :visible.sync="dialog"
direction="ltr" direction="ltr"
custom-class="demo-drawer"
ref="drawer" ref="drawer"
> >
<div class="demo-drawer__content"> <div class="app-container">
<el-form :model="inspectrecord"> <el-form :model="inspectrecord" :disabled="readonly">
<el-form-item label="取证要求" v-if="inspectrecord.item_" :label-width="formLabelWidth"> <el-form-item
v-if="inspectrecord.item_"
>
{{ inspectrecord.item_.cate_name }}
<el-tag effect="plain">{{ inspectrecord.item_.type }}</el-tag>
</el-form-item>
<el-form-item
label="检查事项"
v-if="inspectrecord.item_"
>
{{ inspectrecord.item_.sortnum }}.{{ inspectrecord.item_.name }}
</el-form-item>
<el-form-item
label="取证要求"
v-if="inspectrecord.item_"
>
{{ inspectrecord.item_.require }} {{ inspectrecord.item_.require }}
</el-form-item> </el-form-item>
<el-form-item label="巡查结果" :label-width="formLabelWidth"> <el-form-item label="检查结果">
<el-select v-model="inspectrecord.result" placeholder="请选择巡查结果"> <el-select
v-model="inspectrecord.result"
placeholder="请选择检查结果"
>
<el-option label="发现" value="发现"></el-option> <el-option label="发现" value="发现"></el-option>
<el-option label="未发现" value="未发现"></el-option> <el-option label="未发现" value="未发现"></el-option>
<el-option label="不适用" value="不适用"></el-option> <el-option label="不适用" value="不适用"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="检查说明" :label-width="formLabelWidth"> <el-form-item label="检查说明" >
<el-input type="textarea" v-model="inspectrecord.note" autocomplete="off"></el-input> <el-input
type="textarea"
v-model="inspectrecord.note"
autocomplete="off"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="文件列表" :label-width="formLabelWidth"> <el-form-item label="文件列表" >
<el-upload <el-upload
:action="upUrl" :action="upUrl"
:before-upload="beforeUpload" :before-upload="beforeUpload"
@ -219,7 +307,6 @@
accept="image/*,.ppt,.pdf,.doc,.docx,.xls,.xlsx" accept="image/*,.ppt,.pdf,.doc,.docx,.xls,.xlsx"
> >
<el-button size="small" type="primary">上传文件</el-button> <el-button size="small" type="primary">上传文件</el-button>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<div <div
@ -237,31 +324,49 @@
}}</el-link> }}</el-link>
</div> </div>
</el-form> </el-form>
<div class="demo-drawer__footer"> <div style="float: right;margin-top:4px;padding-right:4px" v-if="!readonly">
<el-button @click="cancelForm"> </el-button> <el-button @click="cancelForm" type="danger"> </el-button>
<el-button type="primary" @click="$refs.drawer.closeDrawer()" :loading="loading">{{ loading ? '提交中 ...' : '确 定' }}</el-button> <el-button
type="primary"
@click="handleClose"
:loading="loading"
>{{ loading ? "提交中 ..." : "确 定" }}</el-button
>
</div> </div>
</div> </div>
</el-drawer> </el-drawer>
</el-card>
</div> </div>
</template> </template>
<script> <script>
import {getsubinspecttaskdep,getinspectrecordlist,updateinspectrecord,getinspectrecord,upinspectdept,gettaskdepstart,addappoint} from "@/api/subinspecttask"; import {
getsubinspecttaskdep,
getinspectrecordlist,
updateinspectrecord,
getinspectrecord,
upinspectdept,
gettaskdepstart,
addappoint,
} from "@/api/subinspecttask";
import { genTree } from "@/utils"; import { genTree } from "@/utils";
import { getOrgList } from "@/api/org"; import { getOrgList } from "@/api/org";
import {deleteInspectdept,creatInspectdept} from "@/api/qualityinspect" import { getUserList } from "@/api/user";
import { deleteInspectdept, creatInspectdept } from "@/api/qualityinspect";
import { getInspectTeamList, createInspectTeam, deleteInspectTeam} from "@/api/inspectteam"
import { upUrl, upHeaders } from "@/api/file"; import { upUrl, upHeaders } from "@/api/file";
import Pagination from "@/components/Pagination"; import Pagination from "@/components/Pagination";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
const mbersData = { const mbersData = {
checker:"" checker: "",
} };
const inspectdept = { const inspectdept = {
dept: null, dept: null,
};
const memberForm = {
member:null,
type:'组员'
} }
export default { export default {
components: { Pagination }, components: { Pagination },
@ -275,7 +380,7 @@ export default {
dialogFormVisible: false, dialogFormVisible: false,
inspectitemList: [], inspectitemList: [],
deptOptions: [], deptOptions: [],
leaders:[], members: [],
inspectDept: inspectdept, inspectDept: inspectdept,
dialogType: "new", dialogType: "new",
listQuery: {}, listQuery: {},
@ -286,84 +391,85 @@ export default {
upHeaders: upHeaders(), upHeaders: upHeaders(),
upUrl: upUrl(), upUrl: upUrl(),
fileList: [], fileList: [],
table: false, table: false,
dialog: false, dialog: false,
loading: false, loading: false,
recordid: null, recordid: null,
inspectrecord: { inspectrecord: {
id: null, id: null,
note: '', note: "",
result:'', result: "",
imgs: [], imgs: [],
}, },
formLabelWidth: '80px', formLabelWidth: "80px",
timer: null, timer: null,
memberOptions:[],
createMemberDg:false,
memberForm:{},
nowDept:{},
readonly:false
}; };
}, },
created() { created() {
this.id = this.$route.params.id; this.id = this.$route.params.id;
this.leaders = this.$route.params.leaders; // this.members = this.$route.params.members;
this.getOrgList(); this.getOrgList();
this.getsubinspecttaskdep(); //主任务信息 this.getsubinspecttaskdep(); //主任务信息
this.getinspectteam();
this.getUserList();//组员
}, },
methods: { methods: {
checkPermission, checkPermission,
//巡检的公司 //巡检的公司
getsubinspecttaskdep() { getsubinspecttaskdep() {
getsubinspecttaskdep(this.id) getsubinspecttaskdep(this.id).then((res) => {
.then((res) => {
this.recordList = res.data; this.recordList = res.data;
});
},
//巡查组成员
getinspectteam(){
getInspectTeamList({pageoff:true, subtask:this.id}).then(res=>{
this.members = res.data
}) })
},
//可选择的成员
getUserList() {
getUserList({pageoff:true, roles__name:'质量巡查成员'}).then((res) => {
this.memberOptions = res.data
});
}, },
//组织列表 //组织列表
getOrgList() { getOrgList() {
getOrgList({ can_supervision: true }).then((res) => { getOrgList({ can_supervision: true }).then((res) => {
this.deptOptions = genTree(res.data); this.deptOptions = genTree(res.data);
}); });
}, },
//点击组织弹出检查项 //点击组织弹出检查项
deptClick(row) { deptClick(row) {
this.listLoading2 = true; this.listLoading2 = true;
this.listQuery = {pageoff:true, subtask: row.subtask, dept:row.dept} this.listQuery = { pageoff: true, subtask: row.subtask, dept: row.dept };
this.nowDept=row
this.getinspectrecordlist(); this.getinspectrecordlist();
}, },
//点击组织弹出清单 //点击组织弹出清单
getinspectrecordlist() { getinspectrecordlist() {
getinspectrecordlist(this.listQuery) getinspectrecordlist(this.listQuery).then((res) => {
.then((res) => {
this.inspectitemList = res.data; this.inspectitemList = res.data;
console.log(this.inspectitemList) });
})
}, },
handleCheck(scope) handleCheck(scope) {
{ this.readonly = false;
this.dialog = true; this.dialog = true;
this.recordid=scope.row.id this.recordid = scope.row.id;
this.fileList = []; this.fileList = [];
getinspectrecord(this.recordid).then((res) => { getinspectrecord(this.recordid).then((res) => {
this.inspectrecord = res.data; this.inspectrecord = res.data;
console.log(this.inspectrecord.imgs_)
for (var i = 0; i < this.inspectrecord.imgs_.length; i++) { for (var i = 0; i < this.inspectrecord.imgs_.length; i++) {
this.fileList.push({ this.fileList.push({
id: this.inspectrecord.imgs_[i].id, id: this.inspectrecord.imgs_[i].id,
@ -371,10 +477,25 @@ export default {
path: this.inspectrecord.imgs_[i].path, path: this.inspectrecord.imgs_[i].path,
}); });
} }
});
})
}, },
handleCheckDetail(scope) {
this.readonly = true;
this.dialog = true;
this.recordid = scope.row.id;
this.fileList = [];
getinspectrecord(this.recordid).then((res) => {
this.inspectrecord = res.data;
for (var i = 0; i < this.inspectrecord.imgs_.length; i++) {
this.fileList.push({
id: this.inspectrecord.imgs_[i].id,
name: this.inspectrecord.imgs_[i].name,
path: this.inspectrecord.imgs_[i].path,
});
}
});
},
handleUpSuccess(res, file, filelist) { handleUpSuccess(res, file, filelist) {
this.fileList.push({ this.fileList.push({
id: res.data.id, id: res.data.id,
@ -410,27 +531,25 @@ export default {
if (this.loading) { if (this.loading) {
return; return;
} }
this.$confirm('确定要提交表单吗?') this.$confirm("确定提交?")
.then(_ => { .then((_) => {
var files = []; var files = [];
for (var i = 0; i < this.fileList.length; i++) { for (var i = 0; i < this.fileList.length; i++) {
files.push(this.fileList[i].id); files.push(this.fileList[i].id);
} }
this.inspectrecord.imgs = files; this.inspectrecord.imgs = files;
this.inspectrecord.id = this.recordid; this.inspectrecord.id = this.recordid;
console.log(this.recordid) console.log(this.recordid);
updateinspectrecord(this.recordid, this.inspectrecord).then((res) => { updateinspectrecord(this.recordid, this.inspectrecord).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getinspectrecordlist(); this.getinspectrecordlist();
this.getsubinspecttaskdep() this.getsubinspecttaskdep();
this.dialog = false; this.dialog = false;
this.$message.success("成功"); this.$message.success("成功");
} }
}); });
}) })
.catch(_ => {}); .catch((_) => {});
}, },
cancelForm() { cancelForm() {
this.loading = false; this.loading = false;
@ -438,19 +557,15 @@ export default {
clearTimeout(this.timer); clearTimeout(this.timer);
}, },
//组长提交 //组长提交
handleCheckup(scope) handleCheckup(scope) {
{
upinspectdept(scope.row.id).then((res) => { upinspectdept(scope.row.id).then((res) => {
this.$message.success("提交成功"); this.$message.success("提交成功");
this.getinspectrecordlist(); this.getinspectrecordlist();
this.getsubinspecttaskdep() this.getsubinspecttaskdep();
});
})
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val;
      this.multipleSelection = val;
}, },
//组长指派人员 //组长指派人员
sendconfirm() { sendconfirm() {
@ -461,25 +576,35 @@ export default {
this.ids.push(this.multipleSelection[i].id); this.ids.push(this.multipleSelection[i].id);
} }
this.mbersData.records = this.ids;
this.mbersData.records=this.ids console.log(this.mbersData);
console.log(this.mbersData)
addappoint(this.mbersData).then((res) => { addappoint(this.mbersData).then((res) => {
this.dialogFormVisible = false; this.dialogFormVisible = false;
this.getinspectrecordlist(); this.getinspectrecordlist();
this.$message.success("成功"); this.$message.success("成功");
}); });
}, },
//组长提交开始检查 //组长提交开始检查
handleStartup(scope) { handleStartup(scope) {
gettaskdepstart(scope.row.id).then((res) => { gettaskdepstart(scope.row.id).then((res) => {
this.$message.success("提交成功"); this.$message.success("提交成功");
this.getinspectrecordlist(); this.getinspectrecordlist();
this.getsubinspecttaskdep() this.getsubinspecttaskdep();
});
},
handleCreateMember(){
this.memberForm = Object.assign({}, memberForm);
this.memberForm.subtask = this.id;
this.createMemberDg = true
},
confirmMember(){
if(this.memberForm.member && this.memberForm.type){
createInspectTeam(this.memberForm).then(res=>{
this.$message.success("提交成功");
this.getinspectteam()
this.createMemberDg = false
}) })
}
}, },
handleDelete(scope) { handleDelete(scope) {
this.$confirm("确认删除?", "警告", { this.$confirm("确认删除?", "警告", {
@ -489,9 +614,23 @@ export default {
}) })
.then(async () => { .then(async () => {
await deleteInspectdept(scope.row.id); await deleteInspectdept(scope.row.id);
this.getsubinspecttaskdep() this.getsubinspecttaskdep();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
handleDeleteMember(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteInspectTeam(scope.row.id);
this.getinspectteam();
this.$message.success("成功"); this.$message.success("成功");
}) })
.catch((err) => { .catch((err) => {
console.error(err); console.error(err);
@ -509,10 +648,7 @@ export default {
this.$message.success("成功"); this.$message.success("成功");
} }
}); });
},
}
}, },
}; };
</script> </script>

View File

@ -105,7 +105,7 @@
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
"navigationBarTitleText": "uView", "navigationBarTitleText": "uView",
"navigationBarBackgroundColor": "#2b85e4", "navigationBarBackgroundColor": "#2581e4",
"backgroundColor": "#FFFFFF" "backgroundColor": "#FFFFFF"
}, },
"tabBar": { "tabBar": {

View File

@ -2,9 +2,9 @@
<view> <view>
<!-- <view :style="{background: 'url('+imageURL+')'}"> <!-- <view :style="{background: 'url('+imageURL+')'}">
</view> --> </view> -->
<view style="background-color: #0074ba;"> <view style="background-color: #2581e4;">
<u-image :src="imageURL" mode="widthFix"></u-image> <u-image :src="imageURL" mode="widthFix"></u-image>
<view style="background-color: #2b85e4;font-weight: bold;font-size: 30rpx;color:white;padding-left:8rpx">欢迎您:{{vuex_user.name}}</view> <view style="background-color: #2581e4;font-weight: bold;font-size: 30rpx;color:white;padding-left:8rpx">欢迎您:{{vuex_user.name}}</view>
</view> </view>
<!-- <u-swiper @change="change" :height="250" :list="swiper_list" :title="swtitle" :effect3d="effect3d" <!-- <u-swiper @change="change" :height="250" :list="swiper_list" :title="swtitle" :effect3d="effect3d"
@ -54,7 +54,7 @@
export default { export default {
data() { data() {
return { return {
imageURL: 'http://testsearch.ctc.ac.cn:8000/media/default/banner3.jpg', imageURL: '/static/banner3.jpg',
swiper_list: [{ swiper_list: [{
image: 'https://cdn.uviewui.com/uview/swiper/1.jpg', image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
title: '昨夜星辰昨夜风,画楼西畔桂堂东' title: '昨夜星辰昨夜风,画楼西畔桂堂东'

View File

@ -65,10 +65,11 @@
{{item.item_.sortnum}}.{{item.item_.name}} {{item.item_.sortnum}}.{{item.item_.name}}
</view> </view>
<view class="u-body-item"> <view class="u-body-item">
<span v-if="item.checker_">{{item.checker_.name}}</span>-- <span v-if="item.checker_">{{item.checker_.name}}</span>
<span v-if="item.result=='发现'" style="color:red">{{item.result}}</span> <span v-if="item.result=='发现'" style="color:red;margin-left:8rpx">{{item.result}}</span>
<span v-else-if="item.result=='未发现'" style="color:green">{{item.result}}</span> <span v-else-if="item.result=='未发现'" style="color:green;margin-left:8rpx">{{item.result}}</span>
<span v-else-if="item.result=='不适用'">{{item.result}}</span> <span v-else-if="item.result=='不适用'" style="color:green;margin-left:8rpx">{{item.result}}</span>
<span style="margin-left:8rpx" v-if="item.check_time">{{item.check_time.substr(0,16)}}</span>
</view> </view>
<view style="flex:true;text-align: right;"> <view style="flex:true;text-align: right;">
<u-button type="primary" size="mini" style="margin-left:6rpx" @click="clickRow(item)" v-if="initData.state=='检查中'">检查 <u-button type="primary" size="mini" style="margin-left:6rpx" @click="clickRow(item)" v-if="initData.state=='检查中'">检查

View File

@ -4,7 +4,9 @@
:errorType="errorType"> :errorType="errorType">
<u-form-item label="检查事项" v-if="form.item_"> <u-form-item label="检查事项" v-if="form.item_">
<view> <view>
<view>类别:<span style="color:darkblue;font-weight: bold;">{{form.item_.type}}</span></view> <view>
{{form.item_.cate_name}}
</view>
<view>{{form.item_.sortnum}}.{{form.item_.name}}</view> <view>{{form.item_.sortnum}}.{{form.item_.name}}</view>
</view> </view>
</u-form-item> </u-form-item>

View File

@ -4,8 +4,12 @@
:errorType="errorType"> :errorType="errorType">
<u-form-item label="检查事项" v-if="form.item_"> <u-form-item label="检查事项" v-if="form.item_">
<view> <view>
<view>类别:<span style="color:darkblue;font-weight: bold;">{{form.item_.type}}</span></view> <view>
{{form.item_.cate_name}}
</view>
<view>{{form.item_.sortnum}}.{{form.item_.name}}</view> <view>{{form.item_.sortnum}}.{{form.item_.name}}</view>
</view> </view>
</u-form-item> </u-form-item>
<u-form-item label="取证要求" v-if="form.item_"> <u-form-item label="取证要求" v-if="form.item_">

View File

@ -23,18 +23,22 @@
</view> </view>
</view> </view>
<u-verification-code seconds="30" ref="uCode" @change="codeChange"></u-verification-code> <u-verification-code seconds="30" ref="uCode" @change="codeChange"></u-verification-code>
<view class="buttom"> <view style="text-align: center;">
<!-- <view class="loginType"> <view class="icon"><u-icon size="70" name="weixin-fill" color="rgb(83,194,64)" @click="mpLogin"></u-icon></view>
微信登录
</view>
<!-- <view class="buttom">
<view class="loginType">
<view class="wechat item"> <view class="wechat item">
<view class="icon"><u-icon size="70" name="weixin-fill" color="rgb(83,194,64)"></u-icon></view> <view class="icon"><u-icon size="70" name="weixin-fill" color="rgb(83,194,64)"></u-icon></view>
微信 微信登录
</view> </view>
<view class="QQ item"> <view class="QQ item">
<view class="icon"><u-icon size="70" name="qq-fill" color="rgb(17,183,233)"></u-icon></view> <view class="icon"><u-icon size="70" name="qq-fill" color="rgb(17,183,233)"></u-icon></view>
QQ QQ
</view> </view>
</view> -->
</view> </view>
</view> -->
</view> </view>
</template> </template>
@ -145,6 +149,39 @@ export default {
this.$u.toast('倒计时结束后再发送'); this.$u.toast('倒计时结束后再发送');
} }
}, },
mpLogin(){
uni.showLoading({
title:'微信登录中...',
mask: true
})
uni.login({
provider: 'weixin',
success: (loginRes)=>{
this.$u.api.wxmplogin({code:loginRes.code}).then(res=>{
this.$u.vuex('vuex_token', res.data.access)
this.$u.api.getUserInfo().then(res=>{
uni.hideLoading()
uni.showToast({
title:"登录成功",
icon:"none"
})
uni.reLaunch({
url:"/pages/home/home"
})
this.$u.vuex('vuex_user', res.data)
})
}).catch(e=>{
uni.hideLoading()
uni.showToast({
title:"暂未绑定微信!",
icon:"none"
})
uni.reLaunch({
url:'/pages/login/login'
})})
}
});
}
} }
}; };
</script> </script>

View File

@ -104,6 +104,12 @@
uni.navigateTo({ uni.navigateTo({
url:'/pages/inspectrecord/index' + this.$u.queryParams(item) url:'/pages/inspectrecord/index' + this.$u.queryParams(item)
}) })
},
touchStart(e){
console.log(e)
},
touchEnd(e){
console.log(e)
} }
} }
} }

View File

@ -3,7 +3,7 @@ from django.db.models.base import Model
from rest_framework import serializers from rest_framework import serializers
from .models import * from .models import *
from apps.system.serializers import OrganizationSerializer,FileListSerializer,UserSimpleSerializer,OrganizationSimpleSerializer, FileSimpleSerializer from apps.system.serializers import OrganizationSerializer,FileListSerializer,UserSimpleSerializer,OrganizationSimpleSerializer, FileSimpleSerializer
from rest_framework.exceptions import ParseError from rest_framework.exceptions import ParseError, APIException
class InspectItemSerializer(serializers.ModelSerializer): class InspectItemSerializer(serializers.ModelSerializer):
cate_name = serializers.StringRelatedField(source='cate', read_only=True) cate_name = serializers.StringRelatedField(source='cate', read_only=True)
class Meta: class Meta:
@ -102,7 +102,7 @@ class InspectRecordDetailSerializer(serializers.ModelSerializer):
return queryset return queryset
class InspectTeamSerializer(serializers.ModelSerializer): class InspectTeamSerializer(serializers.ModelSerializer):
member_ = UserSimpleSerializer(source='member', read_only=True) member__name = serializers.CharField(source='member.name', read_only=True)
class Meta: class Meta:
model = InspectTeam model = InspectTeam
fields = '__all__' fields = '__all__'
@ -112,6 +112,17 @@ class InspectTeamSerializer(serializers.ModelSerializer):
queryset = queryset.select_related('member') queryset = queryset.select_related('member')
return queryset return queryset
def create(self, validated_data):
if InspectTeam.objects.filter(subtask=validated_data.get('subtask'),member=validated_data.get('member')).exists():
raise ParseError('成员已存在')
if validated_data.get('type') == '组长':
obj = InspectTeam.objects.get(type='组长', subtask=validated_data.get('subtask'))
obj.type='组员'
obj.save()
return InspectTeam.objects.create(**validated_data)
class InspectDeptSerializer(serializers.ModelSerializer): class InspectDeptSerializer(serializers.ModelSerializer):
dept__name = serializers.CharField(source='dept.name', read_only=True) dept__name = serializers.CharField(source='dept.name', read_only=True)
leader = serializers.SerializerMethodField() leader = serializers.SerializerMethodField()

View File

@ -7,7 +7,7 @@ from django.shortcuts import render
from django.utils import timezone from django.utils import timezone
from rest_framework import status from rest_framework import status
from rest_framework.decorators import action, permission_classes from rest_framework.decorators import action, permission_classes
from rest_framework.mixins import DestroyModelMixin, ListModelMixin, RetrieveModelMixin from rest_framework.mixins import CreateModelMixin, DestroyModelMixin, ListModelMixin, RetrieveModelMixin
from rest_framework.permissions import IsAdminUser from rest_framework.permissions import IsAdminUser
from rest_framework.response import Response from rest_framework.response import Response
from rest_framework.viewsets import GenericViewSet, ModelViewSet from rest_framework.viewsets import GenericViewSet, ModelViewSet
@ -166,6 +166,7 @@ class SubtaskViewSet(PageOrNot, CreateUpdateCustomMixin, OptimizationMixin, Mode
r['create_by'] = request.user r['create_by'] = request.user
records.append(InspectRecord(**r)) records.append(InspectRecord(**r))
for member in request.data['members']: for member in request.data['members']:
if member != request.data['leader']:
mmember = User.objects.get(pk=member) mmember = User.objects.get(pk=member)
data = {} data = {}
data['member'] = mmember data['member'] = mmember
@ -245,7 +246,7 @@ class InspectDeptViewSet(OptimizationMixin, ListModelMixin, RetrieveModelMixin,
return Response('检查状态错误', status=status.HTTP_400_BAD_REQUEST) return Response('检查状态错误', status=status.HTTP_400_BAD_REQUEST)
class InspectTeamViewSet(OptimizationMixin, ListModelMixin, RetrieveModelMixin, DestroyModelMixin, GenericViewSet): class InspectTeamViewSet(PageOrNot, OptimizationMixin, ListModelMixin, CreateModelMixin, DestroyModelMixin, GenericViewSet):
""" """
子任务涉及组员表 子任务涉及组员表
""" """
@ -253,6 +254,13 @@ class InspectTeamViewSet(OptimizationMixin, ListModelMixin, RetrieveModelMixin,
queryset = InspectTeam.objects.all() queryset = InspectTeam.objects.all()
serializer_class = InspectTeamSerializer serializer_class = InspectTeamSerializer
filterset_fields = ['subtask'] filterset_fields = ['subtask']
ordering = ['type']
def destroy(self, request, *args, **kwargs):
instance = self.get_object()
if instance.type=='组长':
return Response('组长不可删除', status=status.HTTP_400_BAD_REQUEST)
instance.delete()
return Response(status=status.HTTP_204_NO_CONTENT)
class InspectRecordViewSet(OptimizationMixin, PageOrNot, ModelViewSet): class InspectRecordViewSet(OptimizationMixin, PageOrNot, ModelViewSet):
perms_map = {'get': '*', 'post': 'inspectrecord_create', perms_map = {'get': '*', 'post': 'inspectrecord_create',