This commit is contained in:
shilixia 2021-04-27 15:09:33 +08:00
parent a1bf6d8254
commit a99a56ba1c
5 changed files with 287 additions and 14 deletions

View File

@ -2,8 +2,8 @@
ENV = 'development'
# base api
VUE_APP_BASE_API = 'http://10.0.11.127:8000/api'
#VUE_APP_BASE_API = 'http://127.0.0.1:8000/api'
#VUE_APP_BASE_API = 'http://10.0.11.127:8000/api'
VUE_APP_BASE_API = 'http://127.0.0.1:8000/api'
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.

View File

@ -159,6 +159,13 @@ export const asyncRoutes = [
meta: { title: '质量巡查', icon: 'inspect', perms: ['qualityinspect'] },
alwaysShow: true,
children: [
{
path: 'item',
name: 'InspectItem',
component: () => import('@/views/qualityinspect/inspectItem.vue'),
meta: { title: '检查项', perms: ['qualityinspect_view'] }
},
{
path: 'table',
name: 'InspectTable',

View File

@ -0,0 +1,265 @@
<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

@ -2,7 +2,7 @@
<div class="app-container">
<el-card>
<el-button type="primary" icon="el-icon-plus" @click="handleAddinspectTable"
>新增</el-button
>创建模板</el-button
>
</el-card>
<el-card style="margin-top: 10px">
@ -186,7 +186,7 @@ export default {
getList() {
this.listLoading = true;
getQualityinspectList().then((response) => {
getQualityinspectList({pageoff:true}).then((response) => {
if (response.data) {
this.inspectTableList = response.data;
}

View File

@ -118,19 +118,19 @@
ref="drawer"
>
<div class="demo-drawer__content">
<el-form :model="form">
<el-form :model="inspectrecord">
<el-form-item label="取证要求" v-if="inspectrecord.item_" :label-width="formLabelWidth">
{{ inspectrecord.item_.require }}
</el-form-item>
<el-form-item label="巡查结果" :label-width="formLabelWidth">
<el-select v-model="form.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-select>
</el-form-item>
<el-form-item label="检查说明" :label-width="formLabelWidth">
<el-input type="textarea" v-model="form.note" autocomplete="off"></el-input>
<el-input type="textarea" v-model="inspectrecord.note" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="文件列表" :label-width="formLabelWidth">
<el-upload
@ -203,7 +203,7 @@ export default {
dialog: false,
loading: false,
recordid:null,
form: {
inspectrecord: {
id:null,
note: '',
result:'',
@ -256,11 +256,11 @@ export default {
this.dialog=true;
console.log(this.recordid)
getinspectrecord(scope.row.id).then((res) => {
this.form.note=res.data.note;
this.from.result=res.data.result;
this.form.imgs=res.data.imgs;
this.inspectrecord = res.data;
})
},
@ -268,6 +268,7 @@ export default {
{
this.dialog=true;
this.recordid=scope.row.id
console.log(this.recordid)
getinspectrecord(this.recordid).then((res) => {
this.inspectrecord = res.data;
@ -316,10 +317,10 @@ export default {
for (var i = 0; i < this.fileList.length; i++) {
files.push(this.fileList[i].id);
}
this.form.imgs = files;
this.form.id=this.recordid;
this.inspectrecord.imgs = files;
this.inspectrecord.id=this.recordid;
console.log(this.recordid)
updateinspectrecord(this.recordid, this.form).then((res) => {
updateinspectrecord(this.recordid, this.inspectrecord).then((res) => {
if (res.code >= 200) {
this.getinspectrecordlist();
this.getsubinspecttaskdep()