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"
>
<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="任务名">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column label="执行单位">
<template slot-scope="scope">{{ scope.row.dept_count }}</template>
<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.template_name }}</template>
</el-table-column>
<el-table-column label="子任务数">
<template slot-scope="scope">{{ scope.row.subtask_count }}</template>
</el-table-column>
<el-table-column label="涉及单位数">
<template slot-scope="scope">{{ scope.row.dept_count }}</template>
</el-table-column>
<el-table-column label="巡查开始日期">
<template slot-scope="scope">{{ scope.row.start_date }}</template>
@ -62,30 +65,25 @@
<template slot-scope="scope">{{ scope.row.end_date }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="220px"
>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
type="primary"
v-if="checkPermission(['task_view'])"
@click="handleDo(scope)"
>执行</el-link>
>执行</el-link
>
<el-link
v-if="checkPermission(['task_update'])"
@click="handleEdit(scope)"
>编辑</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'])"
type="danger"
@click="handleDelete(scope)"
>删除</el-link>
>删除</el-link
>
</template>
</el-table-column>
</el-table>
@ -126,7 +124,7 @@
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
style="width:100%"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
@ -136,12 +134,10 @@
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
style="width:100%"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
@ -151,15 +147,21 @@
</div>
</template>
<script>
import { getinspecttasklist, createinspecttask, deleteinspecttask, updateinspecttask, closeinspecttask } from "@/api/inspectTask";
import {getInspecttemplateList} from "@/api/qualityinspect";
import {
getinspecttasklist,
createinspecttask,
deleteinspecttask,
updateinspecttask,
closeinspecttask,
} from "@/api/inspectTask";
import { getInspecttemplateList } from "@/api/qualityinspect";
import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
import { genTree } from "@/utils";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
const defaulttask = {
template:null,
template: null,
name: "",
start_date: null,
end_date: null,
@ -172,7 +174,7 @@ export default {
taskList: {
count: 0,
},
templateOptions:[],
templateOptions: [],
listQuery: {
page: 1,
page_size: 20,
@ -207,7 +209,7 @@ export default {
},
//选择模板
getTemplate() {
getInspecttemplateList({pageoff:true}).then((res) => {
getInspecttemplateList({ pageoff: true }).then((res) => {
this.templateOptions = genTree(res.data);
});
},
@ -219,7 +221,7 @@ export default {
this.listQuery = {
page: 1,
page_size: 20,
}
};
this.getList();
},
handleCreate() {
@ -231,7 +233,10 @@ export default {
});
},
handleDo(scope) {
this.$router.push({name: "InpectTaskdo", params: { inpecttask: scope.row.id }, })
this.$router.push({
name: "InpectTaskdo",
params: { id: scope.row.id },
});
},
handleEdit(scope) {
this.task = Object.assign({}, scope.row); // copy obj

View File

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

View File

@ -52,7 +52,7 @@
<el-card style="margin-top: 2px">
<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
>
</div>
@ -63,7 +63,6 @@
fit
stripe
highlight-current-row
max-height="300"
>
<el-table-column type="index" width="50" />
<el-table-column align="center" label="子任务">
@ -71,12 +70,12 @@
</el-table-column>
<el-table-column align="center" label="巡检人员">
<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
}}</el-tag>
<el-tag type="danger" effect="plain" v-else>{{
<el-tag effect="plain" v-else>{{
item.member__name
}}</el-tag>
</span>
@ -95,13 +94,7 @@
fixed="right"
>
<template slot-scope="scope">
<el-button @click="handleClick(scope)" type="primary">执行</el-button>
<el-button
type="primary"
size="small"
icon="el-icon-edit"
@click="handleEdit(scope)"
/>
<el-button @click="handleClick(scope)" type="primary" size="small">执行</el-button>
<el-button
type="danger"
size="small"
@ -261,7 +254,7 @@ export default {
};
},
created() {
this.task.id = this.$route.params.inpecttask;
this.task.id = this.$route.params.id;
this.getinspecttask();//主任务信息
this.getUserList();//组员
@ -279,7 +272,7 @@ export default {
},
//子任务信息
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;
});
},

View File

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

View File

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

View File

@ -2,9 +2,9 @@
<view>
<!-- <view :style="{background: 'url('+imageURL+')'}">
</view> -->
<view style="background-color: #0074ba;">
<view style="background-color: #2581e4;">
<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>
<!-- <u-swiper @change="change" :height="250" :list="swiper_list" :title="swtitle" :effect3d="effect3d"
@ -54,7 +54,7 @@
export default {
data() {
return {
imageURL: 'http://testsearch.ctc.ac.cn:8000/media/default/banner3.jpg',
imageURL: '/static/banner3.jpg',
swiper_list: [{
image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
title: '昨夜星辰昨夜风,画楼西畔桂堂东'

View File

@ -65,10 +65,11 @@
{{item.item_.sortnum}}.{{item.item_.name}}
</view>
<view class="u-body-item">
<span v-if="item.checker_">{{item.checker_.name}}</span>--
<span v-if="item.result=='发现'" style="color:red">{{item.result}}</span>
<span v-else-if="item.result=='未发现'" style="color:green">{{item.result}}</span>
<span v-else-if="item.result=='不适用'">{{item.result}}</span>
<span v-if="item.checker_">{{item.checker_.name}}</span>
<span v-if="item.result=='发现'" style="color:red;margin-left:8rpx">{{item.result}}</span>
<span v-else-if="item.result=='未发现'" style="color:green;margin-left:8rpx">{{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 style="flex:true;text-align: right;">
<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">
<u-form-item label="检查事项" v-if="form.item_">
<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>
</u-form-item>

View File

@ -4,8 +4,12 @@
:errorType="errorType">
<u-form-item label="检查事项" v-if="form.item_">
<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>
</u-form-item>
<u-form-item label="取证要求" v-if="form.item_">

View File

@ -23,18 +23,22 @@
</view>
</view>
<u-verification-code seconds="30" ref="uCode" @change="codeChange"></u-verification-code>
<view class="buttom">
<!-- <view class="loginType">
<view style="text-align: center;">
<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="icon"><u-icon size="70" name="weixin-fill" color="rgb(83,194,64)"></u-icon></view>
微信
微信登录
</view>
<view class="QQ item">
<view class="icon"><u-icon size="70" name="qq-fill" color="rgb(17,183,233)"></u-icon></view>
QQ
</view>
</view> -->
</view>
</view> -->
</view>
</template>
@ -145,6 +149,39 @@ export default {
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>

View File

@ -39,7 +39,7 @@
</u-collapse-item>
</view>
</u-card>
<view style="background-color: #ffffff;padding: 8rpx 4rpx 0rpx 4rpx;">
<view style="background-color: #ffffff;padding: 8rpx 4rpx 0rpx 4rpx;" >
<!-- <u-subsection :list="list" :current="currentIndex" @change="sectionChange"></u-subsection> -->
<u-tabs :list="list" :is-scroll="false" :current="currentIndex" @change="sectionChange"></u-tabs>
<u-cell-group v-if="nowdepts.length>0">
@ -104,6 +104,12 @@
uni.navigateTo({
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 .models import *
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):
cate_name = serializers.StringRelatedField(source='cate', read_only=True)
class Meta:
@ -102,7 +102,7 @@ class InspectRecordDetailSerializer(serializers.ModelSerializer):
return queryset
class InspectTeamSerializer(serializers.ModelSerializer):
member_ = UserSimpleSerializer(source='member', read_only=True)
member__name = serializers.CharField(source='member.name', read_only=True)
class Meta:
model = InspectTeam
fields = '__all__'
@ -112,6 +112,17 @@ class InspectTeamSerializer(serializers.ModelSerializer):
queryset = queryset.select_related('member')
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):
dept__name = serializers.CharField(source='dept.name', read_only=True)
leader = serializers.SerializerMethodField()

View File

@ -7,7 +7,7 @@ from django.shortcuts import render
from django.utils import timezone
from rest_framework import status
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.response import Response
from rest_framework.viewsets import GenericViewSet, ModelViewSet
@ -166,6 +166,7 @@ class SubtaskViewSet(PageOrNot, CreateUpdateCustomMixin, OptimizationMixin, Mode
r['create_by'] = request.user
records.append(InspectRecord(**r))
for member in request.data['members']:
if member != request.data['leader']:
mmember = User.objects.get(pk=member)
data = {}
data['member'] = mmember
@ -245,7 +246,7 @@ class InspectDeptViewSet(OptimizationMixin, ListModelMixin, RetrieveModelMixin,
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()
serializer_class = InspectTeamSerializer
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):
perms_map = {'get': '*', 'post': 'inspectrecord_create',