This commit is contained in:
caoqianming 2021-04-16 10:48:16 +08:00
commit c3ac5073fe
7 changed files with 842 additions and 7 deletions

View File

@ -0,0 +1,99 @@
import request from '@/utils/request'
export function getinspecttasklist(query) {
return request({
url: '/quality/inspecttask/',
method: 'get',
params: query
})
}
export function getinspecttask(id) {
return request({
url: `/quality/inspecttask/${id}/`,
method: 'get'
})
}
export function createinspecttask(data) {
return request({
url: '/quality/inspecttask/',
method: 'post',
data
})
}
export function updateinspecttask(id, data) {
return request({
url: `/quality/inspecttask/${id}/`,
method: 'put',
data
})
}
export function deleteinspecttask(id, data) {
return request({
url: `/quality/inspecttask/${id}/`,
method: 'delete',
data
})
}
export function initinspecttask(id, data) {
return request({
url: `/quality/inspecttask/${id}/init/`,
method: 'post',
data
})
}
export function appendinspecttask(id, data) {
return request({
url: `/quality/inspecttask/${id}/append/`,
method: 'post',
data
})
}
export function getinspecttaskcontents(id) {
return request({
url: `/quality/inspecttask/${id}/contents/`,
method: 'get'
})
}
export function getinspecttaskdepts(id) {
return request({
url: `/quality/inspecttask/${id}/depts/`,
method: 'get'
})
}
export function startinspecttask(id) {
return request({
url: `/quality/inspecttask/${id}/start/`,
method: 'put'
})
}
export function closeinspecttask(id) {
return request({
url: `/quality/inspecttask/${id}/close/`,
method: 'put'
})
}
export function getinspecttaskdeptall(id) {
return request({
url: `/quality/inspecttask/${id}/deptall/`,
method: 'get'
})
}
export function getmyinspecttasklist(query) {
return request({
url: '/quality/inspecttask/self/',
method: 'get',
params: query
})
}

View File

@ -167,10 +167,17 @@ export const asyncRoutes = [
},
{
path: 'task',
name: 'inspectTask',
component: () => import('@/views/qualityinspect/inspectTable.vue'),
name: 'inspeatTask',
component: () => import('@/views/qualityinspect/inspeatTask.vue'),
meta: { title: '巡查任务', perms: ['qualityinspect_view'] }
},
{
path: 'inpecttaskdo/:id',
name: 'InpectTaskdo',
component: () => import('@/views/qualityinspect/inspecttaskdo.vue'),
meta: { title: '报送任务执行', perms: ['task_view'] },
hidden: true
},
]
},
{

View File

@ -0,0 +1,281 @@
<template>
<div class="app-container">
<el-card>
<div>
<el-input
v-model="listQuery.search"
placeholder="任务名"
style="width: 300px"
class="filter-item"
@keyup.enter.native="handleFilter"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索</el-button
>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>重置</el-button
>
</div>
<div style="margin-top: 10px">
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>创建报送任务</el-button
>
</div>
</el-card>
<el-card style="margin-top: 10px">
<el-table
v-loading="listLoading"
:data="taskList.results"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50" />
<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>
<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.start_date }}</template>
</el-table-column>
<el-table-column label="巡查结束日期">
<template slot-scope="scope">{{ scope.row.end_date }}</template>
</el-table-column>
<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
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
v-if="checkPermission(['task_delete'])"
type="danger"
@click="handleDelete(scope)"
>删除</el-link>
</template>
</el-table-column>
</el-table>
<pagination
v-show="taskList.count > 0"
:total="taskList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:title="dialogType === 'edit' ? '编辑任务' : '新增任务'"
>
<el-form
ref="Form"
:model="task"
label-width="80px"
label-position="right"
:rules="rule1"
>
<el-form-item label="任务名" prop="name">
<el-input v-model="task.name" placeholder="名称" />
</el-form-item>
<el-form-item label="开始日期" prop="start_date">
<el-date-picker
v-model="task.start_date"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
style="width:100%"
>
</el-date-picker>
</el-form-item>
<el-form-item label="结束日期" prop="end_date">
<el-date-picker
v-model="task.end_date"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
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>
<el-button type="primary" @click="confirm('Form')">确认</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getinspecttasklist, createinspecttask, deleteinspecttask, updateinspecttask, closeinspecttask } from "@/api/inspectTask";
import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulttask = {
name: "",
start_date: null,
end_date: null,
};
export default {
components: { Pagination },
data() {
return {
task: defaulttask,
taskList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
listLoading: true,
dialogVisible: false,
dialogType: "new",
rule1: {
name: [{ required: true, message: "请输入", trigger: "blur" }],
start_date: [{ required: true, message: "请选择", trigger: "blur" }],
end_date: [{ required: true, message: "请选择", trigger: "blur" }],
},
};
},
computed: {},
watch: {},
created() {
this.getList();
},
methods: {
checkPermission,
getList() {
this.listLoading = true;
getinspecttasklist(this.listQuery).then((response) => {
if (response.data) {
this.taskList = response.data;
}
this.listLoading = false;
});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
}
this.getList();
},
handleCreate() {
this.task = Object.assign({}, defaulttask);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleCreate2() {
},
handleDo(scope) {
this.$router.push({name: "InpectTaskdo", params: { id: scope.row.id }, })
},
handleEdit(scope) {
this.task = Object.assign({}, scope.row); // copy obj
this.dialogType = "edit";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleDelete(scope) {
this.$confirm("确认删除?该操作将删除该任务所有报送记录!", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteinspecttask(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
handleClose(scope) {
this.$confirm("确认关闭该任务吗?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning",
})
.then(async () => {
await closeinspecttask(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
async confirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
updateinspecttask(this.task.id, this.task).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
createinspecttask(this.task).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
// this.$router.push({name: "Taskdo", params: { id: res.data.id }, })
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
},
};
</script>

View File

@ -16,21 +16,21 @@
max-height="600"
>
<el-table-column type="index" width="50" />
<el-table-column label="检查类别">
<el-table-column align="center" label="检查类别">
<template slot-scope="scope">{{ scope.row.cate_name }}</template>
</el-table-column>
<el-table-column label="序号">
<el-table-column align="center" label="序号">
<template slot-scope="scope">{{ scope.row.sortnum }}</template>
</el-table-column>
<el-table-column label="检查要点">
<el-table-column align="center" label="检查要点">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column label="检查类型">
<el-table-column align="center" label="检查类型">
<template slot-scope="scope">{{ scope.row.type }}</template>
</el-table-column>
<el-table-column label="取证要求">
<el-table-column align="center" label="取证要求">
<template slot-scope="scope">{{ scope.row.require }}</template>
</el-table-column>

View File

@ -0,0 +1,322 @@
<template>
<div class="app-container">
<el-card>
<div slot="header" class="clearfix">
<span>任务详情</span>
</div>
<div style="margin-left: 10px; margin-right: 10px">
<el-row :gutter="20">
<el-col :span="6">
<div style="margin-bottom: 6px">
<span class="term">任务名称:</span>
<span class="desc"> {{ task.name }}</span>
</div>
</el-col>
<el-col :span="6">
<div style="margin-bottom: 6px">
<span class="term">巡检开始日期:</span>
<span class="desc"> {{ task.start_date }}</span>
</div>
</el-col>
<el-col :span="6">
<div style="margin-bottom: 6px">
<span class="term">巡检结束日期:</span>
<span class="desc"> {{ task.end_date }}</span>
</div>
</el-col>
<el-col :span="6">
<div style="margin-bottom: 6px">
<span class="term">创建人:</span>
<span class="desc" v-if="task.create_by_">
{{ task.create_by_.name }}/</span
>
<span class="desc" v-if="task.belong_dept_">{{
task.belong_dept_.name
}}</span>
</div>
</el-col>
</el-row>
</div>
</el-card>
<el-card style="margin-top: 2px">
<div slot="header" class="clearfix">
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>创建子任务</el-button
>
</div>
<el-table
border
fit
stripe
highlight-current-row
max-height="400px"
style="margin-top:2px"
>
<el-table-column type="selection" align="center" width="55" />
<el-table-column label="序号" type="index" align="center" width="55" />
<el-table-column label="材料">
<template slot-scope="scope">{{ scope.row.content_name }}</template>
</el-table-column>
<el-table-column label="状态">
<template slot-scope="scope">
<el-tag type="danger" v-if="scope.row.state == '待报送'">{{
scope.row.state
}}</el-tag>
<el-tag
type="warning"
v-else-if="
scope.row.state == '待整改' || scope.row.state == '待发布'
"
>{{ scope.row.state }}</el-tag
>
<el-tag type="success" v-else-if="scope.row.state == '已确认'">{{
scope.row.state
}}</el-tag>
<el-tag v-else-if="scope.row.state == '已报送'">{{
scope.row.state
}}</el-tag>
</template>
</el-table-column>
<el-table-column label="报送要求/备注">
<template slot-scope="scope">{{ scope.row.note }}</template>
</el-table-column>
<el-table-column label="是否适用">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_yes" effect="plain"></el-tag>
<el-tag type="danger" effect="plain" v-else></el-tag>
</template>
</el-table-column>
<el-table-column label="报送情况">
<template slot-scope="scope" v-if="scope.row.up_user_"
>{{ scope.row.up_user_.name }}/{{ scope.row.up_date }}</template
>
</el-table-column>
<el-table-column label="报送说明">
<template slot-scope="scope" >{{ scope.row.noteb}}</template
>
</el-table-column>
<el-table-column label="文件">
<template slot-scope="scope" v-if="scope.row.files">
<el-link
v-if="scope.row.files.length > 1"
@click="handleRecord({ action: 'view', record: scope.row })"
>
<span style="color: red">{{ scope.row.files.length }}</span>
个文件</el-link
>
<div v-else v-for="item in scope.row.files_" v-bind:key="item.id">
<el-link :href="item.path" target="_blank" type="primary">{{
item.name
}}</el-link>
</div>
</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="240px"
fixed="right"
>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['record_delete'])"
type="danger"
size="small"
@click="handleRecord({ action: 'delete', record: scope.row })"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:title="dialogType === 'edit' ? '编辑任务' : '新增任务'"
>
<el-form
ref="Form"
:model="inspecttask"
label-width="80px"
label-position="right"
>
<el-form-item label="子任务名" prop="name">
<el-input v-model="inspecttask.name" placeholder="子任务名" />
</el-form-item>
<el-form-item label="选择组长" prop="leader">
<el-select
v-model="inspecttask.leader"
multiple
filterable
style="width: 100%"
allow-create
default-first-option
placeholder="请选择组长">
<el-option
v-for="item in leaderOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="选择组员" prop="member">
<el-select
v-model="inspecttask.member"
multiple
filterable
style="width: 100%"
allow-create
default-first-option
placeholder="请选择组员">
<el-option
v-for="item in memberOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="选择组织" prop="leader">
<el-select
v-model="inspecttask.dept"
multiple
filterable
style="width: 100%"
allow-create
default-first-option
placeholder="请选择组织">
<el-option
v-for="item in deptOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirm('Form')">确认</el-button>
</div>
</el-dialog>
</div>
</template>
<style >
.term {
color: rgba(0, 0, 0, 0.85);
font-weight: bold;
font-size: 16px;
}
.desc {
color: rgba(0, 0, 0, 0.65);
font-weight: bold;
font-size: 16px;
}
.litem {
margin-bottom: 4px;
margin-left: 2px;
cursor: pointer;
color: #409eff;
}
</style>
<script>
import { getinspecttask, createinspecttask } from "@/api/inspectTask";
import { getUserList } from "@/api/user";
import { getOrgList } from "@/api/org";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination";
import checkPermission from "@/utils/permission";
const defaulttask = {
name: "",
leader:"",
member:"",
dept:"",
};
export default {
components: { Pagination},
data() {
return {
task: { id: 0 },
inspecttask: defaulttask,
dialogVisible: false,
listLoading: true,
leaderOptions:[],
memberOptions:[],
deptOptions:[],
dialogVisible: false,
dialogType: "new",
data: {},
listQuery:{},
};
},
created() {
this.task.id = this.$route.params.id;
this.getinspecttask();//主任务信息
this.getTypeAll();//组长
this.getUserList();//组员
this.getOrgList();//组织
},
methods: {
checkPermission,
//主任务信息展示
getinspecttask() {
getinspecttask(this.task.id).then((res) => {
this.task = res.data;
});
},
//组长列表
getTypeAll() {
getUserList({pageoff:true}).then((res) => {
this.leaderOptions = genTree(res.data);
});
},
//组员列表
getUserList() {
getUserList({pageoff:true}).then((res) => {
this.memberOptions = genTree(res.data);
});
},
//组织列表
getOrgList() {
getOrgList({can_supervision:true}).then((res) => {
this.deptOptions = genTree(res.data);
});
},
handleCreate() {
this.inspecttask = Object.assign({}, defaulttask);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
async confirm(form) {
//创建子任务
createinspecttask(this.deptOptions).then((res) => {
if (res.code >= 200) {
this.dialogVisible = false;
this.$message.success("成功");
}
});
},
},
};
</script>

View File

@ -0,0 +1,63 @@
<template>
<div>
<div style="margin-top:6px">
<el-transfer
v-model="depts"
:data="userOptions"
:titles="['组员列表', '选择的组员']"
:props="{ key : 'id' , label: 'name' }"
>
<span slot-scope="{ option }">{{ option.sort }} - {{ option.name }}</span>
</el-transfer>
</div>
<div style="text-align: right">
<el-button type="primary" @click="confirm()">确认</el-button>
</div>
</div>
</template>
<style lang="scss">
.el-transfer-panel {
width: 470px;
}
.el-transfer__buttons {
padding: 0 2px;
.el-button {
display: block;
}
}
</style>
<script>
import { getUserList } from "@/api/user";
export default {
name: "leaderinit",
data() {
return {
depts: [],
userOptions: [],
};
},
created() {
this.getUserList();
},
methods: {
getUserList() {
getUserList({pageoff:true}).then((res) => {
this.userOptions = res.data;
});
},
confirm(){
if( this.depts.length>0){
var data = {
depts:this.depts
}
this.$emit('handleChose', data)
}else{
this.$message.error('请选择单位!')
}
}
},
};
</script>

View File

@ -0,0 +1,63 @@
<template>
<div>
<div style="margin-top:6px">
<el-transfer
v-model="depts"
:data="deptOptions"
:titles="['单位列表', '选择的单位']"
:props="{ key : 'id' , label: 'name' }"
>
<span slot-scope="{ option }">{{ option.sort }} - {{ option.name }}</span>
</el-transfer>
</div>
<div style="text-align: right">
<el-button type="primary" @click="confirm()">确认</el-button>
</div>
</div>
</template>
<style lang="scss">
.el-transfer-panel {
width: 470px;
}
.el-transfer__buttons {
padding: 0 2px;
.el-button {
display: block;
}
}
</style>
<script>
import { getOrgList } from "@/api/org";
export default {
name: "leaderinit",
data() {
return {
depts: [],
deptOptions: [],
};
},
created() {
this.getOrgList();
},
methods: {
getOrgList() {
getOrgList({can_supervision:true}).then((res) => {
this.deptOptions = res.data;
});
},
confirm(){
if( this.depts.length>0){
var data = {
depts:this.depts
}
this.$emit('handleChose', data)
}else{
this.$message.error('请选择单位!')
}
}
},
};
</script>