This commit is contained in:
shilixia 2021-04-28 11:48:26 +08:00
parent 291294cbcd
commit 10db3cb6dd
8 changed files with 248 additions and 301 deletions

View File

@ -1,8 +1,36 @@
import request from '@/utils/request'
//质量巡检----检查表
export function getInspecttemplateList(query) {
return request({
url: '/quality/inspecttemplate/',
method: 'get',
params: query
})
}
export function createInspecttemplate(data) {
return request({
url: '/quality/inspecttemplate/',
method: 'post',
data
})
}
export function updateInspecttemplate(id, data) {
return request({
url: `/quality/inspecttemplate/${id}/`,
method: 'put',
data
})
}
export function deleteInspecttemplate(id, data) {
return request({
url: `/quality/inspecttemplate/${id}/`,
method: 'delete',
data
})
}
//质量巡检-----检查项
export function getQualityinspectList(query) {
return request({
url: '/quality/inspectitem/',

View File

@ -70,6 +70,12 @@ export function getsubinspecttaskdep(id) {
})
}
export function gettaskdepstart(id) {
return request({
url: `/quality/inspectdept/${id}/start/`,
method: 'put'
})
}
export function getinspectrecordlist(query) {
return request({
url: '/quality/inspectrecord/',

View File

@ -160,12 +160,7 @@ export const asyncRoutes = [
alwaysShow: true,
children: [
{
path: 'item',
name: 'InspectItem',
component: () => import('@/views/qualityinspect/inspectItem.vue'),
meta: { title: '检查项', perms: ['qualityinspect_view'] }
},
{
path: 'table',
name: 'InspectTable',

View File

@ -41,6 +41,9 @@
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>
@ -105,6 +108,15 @@
label-position="right"
:rules="rule1"
>
<el-form-item label="检查模板" prop="template">
<el-cascader
v-model="task.template"
:options="templateOptions"
:props="{ emitPath: false }"
clearable
style="width: 100%"
></el-cascader>
</el-form-item>
<el-form-item label="任务名" prop="name">
<el-input v-model="task.name" placeholder="名称" />
</el-form-item>
@ -139,10 +151,15 @@
</div>
</template>
<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 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,
name: "",
start_date: null,
end_date: null,
@ -155,6 +172,7 @@ export default {
taskList: {
count: 0,
},
templateOptions:[],
listQuery: {
page: 1,
page_size: 20,
@ -163,6 +181,7 @@ export default {
dialogVisible: false,
dialogType: "new",
rule1: {
template: [{ required: true, message: "请选择", trigger: "blur" }],
name: [{ required: true, message: "请输入", trigger: "blur" }],
start_date: [{ required: true, message: "请选择", trigger: "blur" }],
end_date: [{ required: true, message: "请选择", trigger: "blur" }],
@ -173,6 +192,7 @@ export default {
watch: {},
created() {
this.getList();
this.getTemplate();
},
methods: {
checkPermission,
@ -185,7 +205,12 @@ export default {
this.listLoading = false;
});
},
//选择模板
getTemplate() {
getInspecttemplateList({pageoff:true}).then((res) => {
this.templateOptions = genTree(res.data);
});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();

View File

@ -1,265 +0,0 @@
<template>
<div class="app-container">
<el-card>
<el-button type="primary" icon="el-icon-plus" @click="handleAddinspectTable"
>新增</el-button
>
</el-card>
<el-card style="margin-top: 10px">
<el-table
v-loading="listLoading"
:data="inspectTableList"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50" />
<el-table-column align="center" label="检查类别">
<template slot-scope="scope">{{ scope.row.cate_name }}</template>
</el-table-column>
<el-table-column align="center" label="序号">
<template slot-scope="scope">{{ scope.row.sortnum }}</template>
</el-table-column>
<el-table-column align="center" label="检查要点">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column align="center" label="检查类型">
<template slot-scope="scope">{{ scope.row.type }}</template>
</el-table-column>
<el-table-column align="center" label="取证要求">
<template slot-scope="scope">{{ scope.row.require }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="200px"
fixed="right"
>
<template slot-scope="scope">
<el-button
:disabled="!checkPermission(['inspectTable'])"
type="primary"
size="small"
icon="el-icon-edit"
@click="handleEdit(scope)"
/>
<el-button
:disabled="!checkPermission(['inspectTable'])"
type="danger"
size="small"
icon="el-icon-delete"
@click="handleDelete(scope)"
/>
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:title="dialogType === 'edit' ? '编辑资料' : '新增资料'"
>
<el-form
ref="Form"
:model="inspectTable"
label-width="80px"
label-position="right"
:rules="rule1"
>
<el-form-item label="检查要求" prop="name">
<el-input type="textarea"
:rows="4" v-model="inspectTable.name" placeholder="检查要求" />
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select
v-model="inspectTable.type"
placeholder="类型"
clearable
style="width: 140px"
@change="handleFilter"
>
<el-option
v-for="item in stateOptions"
:key="item.key"
:label="item.name"
:value="item.key"
/>
</el-select>
</el-form-item>
<el-form-item label="类别" prop="cate">
<el-cascader
v-model="inspectTable.cate"
:options="typeOptions"
:props="{ emitPath: false }"
clearable
style="width: 100%"
></el-cascader>
</el-form-item>
<el-form-item label="取证要求" prop="desc">
<el-input
type="textarea"
:rows="4"
v-model="inspectTable.require"
placeholder="详情"
/>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input-number
v-model="inspectTable.sortnum"
:min="1"
:max="999"
></el-input-number>
</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 {
getQualityinspectList,
createQualityinspect,
deleteQualityinspect,
updateQualityinspect,
} from "@/api/qualityinspect";
import { genTree } from "@/utils";
import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { getDictList, getDictTypeList } from "@/api/dict";
const defaultinspectTable = {
name: "",
require: "",
type: null,
sortnum: null,
};
export default {
components: { Pagination, Treeselect },
data() {
return {
inspectTable: defaultinspectTable,
inspectTableList: [],
typeOptions: [],
stateOptions: [
{ key: "合规", name: "合规" },
{ key: "体系", name: "体系" }
],
listLoading: true,
dialogVisible: false,
dialogType: "new",
rule1: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
},
filterOrgText: "",
treeLoding: false,
};
},
computed: {},
watch: {
filterOrgText(val) {
this.$refs.tree.filter(val);
},
},
created() {
this.getList();
this.getTypeAll();
},
methods: {
checkPermission,
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
getList() {
this.listLoading = true;
getQualityinspectList({pageoff:true}).then((response) => {
if (response.data) {
this.inspectTableList = response.data;
}
this.listLoading = false;
});
},
getTypeAll() {
getDictList({ type__code: "inspect_category" }).then((res) => {
this.typeOptions = genTree(res.data);
});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
handleAddinspectTable() {
this.inspectTable = Object.assign({}, defaultinspectTable);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
this.inspectTable = 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 deleteQualityinspect(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) {
updateQualityinspect(this.inspectTable.id, this.inspectTable).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
createQualityinspect(this.inspectTable).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
},
};
</script>

View File

@ -1,11 +1,58 @@
<template>
<div class="app-container">
<el-card>
<el-button type="primary" icon="el-icon-plus" @click="handleAddinspectTable"
<el-card style="float:left;width: 25%;">
<el-button type="primary" icon="el-icon-plus" @click="handleAddinspectTables"
>创建模板</el-button
>
<el-table
v-loading="listLoading"
:data="inspecttemplateList"
border
fit
stripe
highlight-current-row
max-height="600"
@row-click="recorclickRow"
>
<el-table-column type="index" width="50" />
<el-table-column align="center" label="检查模板名称">
<template slot-scope="scope" >
{{ scope.row.name }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="200px"
fixed="right"
>
<template slot-scope="scope">
<el-button
:disabled="!checkPermission(['inspectTable'])"
type="primary"
size="small"
icon="el-icon-edit"
@click="handleEdits(scope)"
/>
<el-button
:disabled="!checkPermission(['inspectTable'])"
type="danger"
size="small"
icon="el-icon-delete"
@click="handleDeletes(scope)"
/>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card style="margin-top: 10px">
<el-card style="float:right;width: 75%;">
<el-button type="primary" icon="el-icon-plus" @click="handleAddinspectTable"
>新增</el-button
>
<el-table
v-loading="listLoading"
:data="inspectTableList"
@ -124,14 +171,36 @@
<el-button type="primary" @click="confirm('Form')">确认</el-button>
</div>
</el-dialog>
<el-dialog
:visible.sync="dialogVisibles"
:title="dialogTypes === 'edit' ? '编辑资料' : '新增资料'"
>
<el-form
ref="Forms"
:model="inspecttemplate"
label-width="80px"
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>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisibles = false">取消</el-button>
<el-button type="primary" @click="confirms('Forms')">确认</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
getQualityinspectList,
import {getInspecttemplateList,createInspecttemplate,updateInspecttemplate,deleteInspecttemplate,getQualityinspectList,
createQualityinspect,
deleteQualityinspect,
updateQualityinspect,
updateQualityinspect
} from "@/api/qualityinspect";
import { genTree } from "@/utils";
import checkPermission from "@/utils/permission";
@ -139,17 +208,30 @@ import Pagination from "@/components/Pagination"; // secondary package based on
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { getDictList, getDictTypeList } from "@/api/dict";
const defaultinspecttemplate = {
name: "",
};
const defaultinspectTable = {
name: "",
require: "",
type: null,
sortnum: null,
template:null,
};
export default {
components: { Pagination, Treeselect },
data() {
return {
inspectTable: defaultinspectTable,
inspecttemplate: defaultinspecttemplate,
inspecttemplateList: [],
listLoading: true,
dialogVisibles: false,
dialogTypes: "new",
rule1: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
},
treeLoding: false,
inspectTable: defaultinspectTable,
inspectTableList: [],
typeOptions: [],
stateOptions: [
@ -173,8 +255,8 @@ export default {
},
},
created() {
this.getList();
this.getTypeAll();
this.getLists();
},
methods: {
checkPermission,
@ -184,15 +266,89 @@ export default {
return data.label.indexOf(value) !== -1;
},
getList() {
getLists() {
this.listLoading = true;
getQualityinspectList({pageoff:true}).then((response) => {
getInspecttemplateList({pageoff:true}).then((response) => {
if (response.data) {
this.inspecttemplateList = response.data;
}
this.listLoading = false;
});
},
recorclickRow(row) {
this.template=row.id;
this.listLoading = true;
getQualityinspectList({pageoff:true,template:this.template}).then((response) => {
if (response.data) {
this.inspectTableList = response.data;
}
this.listLoading = false;
});
},
handleAddinspectTables() {
this.inspecttemplate = Object.assign({}, defaultinspecttemplate);
this.dialogTypes = "new";
this.dialogVisibles = true;
this.$nextTick(() => {
this.$refs["Forms"].clearValidate();
});
},
handleEdits(scope) {
this.inspecttemplate = Object.assign({}, scope.row); // copy obj
this.dialogTypes = "edit";
this.dialogVisibles = true;
this.$nextTick(() => {
this.$refs["Forms"].clearValidate();
});
},
handleDeletes(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteInspecttemplate(scope.row.id);
this.getLists();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
async confirms(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogTypes === "edit";
if (isEdit) {
updateInspecttemplate(this.inspecttemplate.id, this.inspecttemplate).then((res) => {
if (res.code >= 200) {
this.getLists();
this.dialogVisibles = false;
this.$message.success("成功");
}
});
} else {
createInspecttemplate(this.inspecttemplate).then((res) => {
if (res.code >= 200) {
this.getLists();
this.dialogVisibles = false;
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
getTypeAll() {
getDictList({ type__code: "inspect_category" }).then((res) => {
this.typeOptions = genTree(res.data);
@ -239,17 +395,17 @@ export default {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
this.inspectTable.template=this.template;
updateQualityinspect(this.inspectTable.id, this.inspectTable).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
this.inspectTable.template=this.template;
createQualityinspect(this.inspectTable).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}

View File

@ -142,15 +142,7 @@
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
size="mini"
type="danger"
@click="handleDeletes(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card class="box-card" style="float:right;width: 70%;margin-top:4px;">

View File

@ -1,6 +1,6 @@
<template>
<div class="app-container">
<el-card style="float:left;width: 25%;">
<el-card style="float:left;width: 45%;">
<el-table
:data="recordList"
@ -32,15 +32,19 @@
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="warning"
@click="handleStartup(scope)">开始检查</el-button>
<el-button type="primary"
@click="handleCheckup(scope)">组长提交</el-button>
<el-link type="primary"
@click="handleCheckup(scope)">组长提交</el-link>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card class="box-card" style="float:right;width: 75%;">
<el-card class="box-card" style="float:right;width: 55%;">
<el-table
:data="inspectitemList"
@ -171,7 +175,7 @@
</div>
</template>
<script>
import {getsubinspecttaskdep,getinspectrecordlist,updateinspectrecord,getinspectrecord,upinspectdept} from "@/api/subinspecttask";
import {getsubinspecttaskdep,getinspectrecordlist,updateinspectrecord,getinspectrecord,upinspectdept,gettaskdepstart} from "@/api/subinspecttask";
import { upUrl, upHeaders } from "@/api/file";
import Pagination from "@/components/Pagination";
import checkPermission from "@/utils/permission";
@ -344,9 +348,15 @@ export default {
upinspectdept(scope.row.id).then((res) => {
this.$message.success("提交成功");
})
},
//组长提交开始检查
handleStartup(scope){
gettaskdepstart(scope.row.id).then((res) => {
this.$message.success("提交成功");
})
}
},