From 37b718547bc441c7502f0bfcf86209efe253851b Mon Sep 17 00:00:00 2001
From: Your Name <123456>
Date: Wed, 06 Apr 2022 17:32:03 +0800
Subject: [PATCH] 'lct'
---
src/views/safetyproduction/checklist.vue | 571 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 571 insertions(+), 0 deletions(-)
diff --git a/src/views/safetyproduction/checklist.vue b/src/views/safetyproduction/checklist.vue
new file mode 100644
index 0000000..9dc6c1b
--- /dev/null
+++ b/src/views/safetyproduction/checklist.vue
@@ -0,0 +1,571 @@
+<template>
+ <div class="app-container">
+ <div class="box">
+ <div class="box-left">
+ <Titlename title="检查项树"></Titlename>
+ <div class="box-left-content">
+ <el-form ref="form" :model="form" style="font-size: 12px" size="mini">
+ <el-row>
+ <el-col :span="12">
+ <el-form-item size="mini">
+ <el-input
+ v-model="filterText"
+ placeholder="请输入检查项名称"
+ ></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="11" :offset="1" style="white-space: nowrap">
+ <el-form-item size="mini">
+ <el-button type="primary" class="btns" size="mini"
+ >搜索</el-button
+ >
+ <el-button
+ type="primary"
+ style="margin: 0px"
+ class="btns"
+ icon="el-icon-plus"
+ size="mini"
+ @click="safetyInspectionItemC('', '新增')"
+ ></el-button>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <el-tree
+ :data="tree"
+ :props="defaultProps"
+ @node-click="safetyInspectionItemL"
+ default-expand-all
+ :filter-node-method="filterNode"
+ ref="tree"
+ ></el-tree>
+ </div>
+ </div>
+ <div class="box-right" v-if="show">
+ <div class="box-rightXQ" v-for="(item, index) in list" :key="index">
+ <el-row class="box-rightXQ-top">
+ <el-col :span="2">
+ <p class="titles">标准化要求:</p>
+ </el-col>
+ <el-col :span="20">
+ <p class="titles-type">
+ {{ item.standardizationRequirements }}
+ </p>
+ </el-col>
+ <el-col :span="1"
+ ><p class="btnXG" @click="safetyInspectionItemC(item.id, '修改')">
+ 修改
+ </p></el-col
+ >
+ <el-col :span="1"
+ ><p class="btnXG" style="color:red;" @click="safetyInspectionItemDel(item.id)">
+ 删除
+ </p></el-col
+ >
+ </el-row>
+ <el-row>
+ <el-col :span="2"><p class="title">企业达标标准:</p></el-col>
+ <el-col :span="9"
+ ><p class="title-type">
+ {{ item.enterpriseStandard }}
+ </p></el-col
+ >
+ <el-col :span="2" :offset="1"
+ ><p class="title">评审方法:</p></el-col
+ >
+ <el-col :span="10"
+ ><p class="title-type">
+ {{ item.reviewMethod }}
+ </p></el-col
+ >
+ </el-row>
+ </div>
+ </div>
+ <!-- 修改 -->
+ <div class="box-rights" v-if="show == false ? true : false">
+ <Titlename title="基础信息"></Titlename>
+ <el-form ref="form" :model="form" label-width="120px">
+ <div style="width: 80%; margin: auto">
+ <el-row class="box-right-content" align="top">
+ <el-col :span="11">
+ <el-form-item label="A级要素">
+ <el-select
+ v-model="form.elementA"
+ :disabled="disabled"
+ style="width: 100%"
+ @change="select"
+ >
+ <el-option
+ v-for="item in tree"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ >
+ </el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="11" :offset="2" style="white-space: nowrap">
+ <el-form-item label="B级要素">
+ <el-select
+ v-if="title == '新增'"
+ v-model="form.elementB"
+ :disabled="disabled"
+ style="width: 100%"
+ >
+ <el-option
+ v-for="item in treeChildren"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ >
+ </el-option>
+ </el-select>
+ <el-select
+ v-if="title == '修改'"
+ v-model="form.elementBName"
+ :disabled="disabled"
+ style="width: 100%"
+ >
+ <el-option
+ v-for="item in treeChildren"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ >
+ </el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24">
+ <el-form-item label="标准化要求">
+ <el-input
+ :rows="3"
+ type="textarea"
+ v-model="form.standardizationRequirements"
+ placeholder=""
+ maxlength="250"
+ show-word-limit
+ ></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24">
+ <el-form-item label="企业达标标准">
+ <el-input
+ type="textarea"
+ :rows="3"
+ v-model="form.enterpriseStandard"
+ placeholder=""
+ maxlength="250"
+ show-word-limit
+ ></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24">
+ <el-form-item label="评审方法">
+ <el-input
+ type="textarea"
+ :rows="3"
+ v-model="form.reviewMethod"
+ placeholder=""
+ maxlength="250"
+ show-word-limit
+ ></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </div>
+ <Titlename title="评选标准"></Titlename>
+ <div style="width: 80%; margin: auto">
+ <el-row>
+ <el-col :span="24">
+ <el-form-item label="否决项">
+ <el-input
+ type="textarea"
+ :rows="3"
+ v-model="form.veto"
+ placeholder=""
+ maxlength="250"
+ show-word-limit
+ ></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row style="padding: 15px 0">
+ <el-col :span="12">
+ <span
+ style="font-size: 16px; font-weight: bold; line-height: 29px"
+ >扣分清单</span
+ >
+ </el-col>
+ <el-col :span="12" style="text-align: right">
+ <el-button
+ type="primary"
+ @click="coAdd('', '新增')"
+ class="btns"
+ size="mini"
+ icon="el-icon-plus"
+ >新增</el-button
+ >
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24">
+ <el-table border :data="form.deductionList">
+ <el-table-column
+ type="index"
+ align="center"
+ label="序号"
+ width="150"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="name"
+ align="center"
+ label="名称"
+ ></el-table-column>
+ <el-table-column align="center" label="操作" width="200px">
+ <template slot-scope="scope">
+ <el-button
+ @click="coAdd(scope.row, '编辑')"
+ type="text"
+ size="small"
+ >编辑</el-button
+ >
+ <el-button
+ type="text"
+ size="small"
+ style="color: red"
+ @click="listDel(scope.row)"
+ >删除</el-button
+ >
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24" style="padding: 20px 0; text-align: center">
+ <el-button
+ type="primary"
+ @click="safetyInspectionItemA"
+ class="btns"
+ >提交</el-button
+ >
+ <el-button @click="btnsQX">取消</el-button>
+ </el-col>
+ </el-row>
+ </div>
+ </el-form>
+ </div>
+ </div>
+
+ <el-dialog :title="titleN" :visible.sync="dialogVisible" :close-on-click-modal="false" width="30%">
+ <el-form ref="form" :rules="rules" :model="formInline" label-width="80px">
+ <el-form-item label="名称" prop="name">
+ <el-input v-model="formInline.name"></el-input>
+ </el-form-item>
+ <el-form-item label="说明">
+ <el-input
+ v-model="formInline.remark"
+ :rows="5"
+ type="textarea"
+ ></el-input>
+ </el-form-item>
+ </el-form>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="listCel">取 消</el-button>
+ <el-button type="primary" class="btns" @click="listAdd"
+ >确 定</el-button
+ >
+ </span>
+ </el-dialog>
+ </div>
+</template>
+<script>
+import Titlename from "../../components/Titlename/index.vue";
+import {
+ safetyInspectionItemList,
+ safetyInspectionItemAdd,
+ safetyInspectionItemMod,
+ safetyInspectionItemDel,
+ safetyInspectionItemTree,
+} from "@/api/safetyInspectionItem.js";
+export default {
+ components: { Titlename },
+ data() {
+ return {
+ filterText: "",
+ dialogVisible: false,
+ show: true,
+ disabled: true,
+ title: "",
+ titleN: "",
+ index: "",
+ form: {
+ elementA: "",
+ elementB: "",
+ standardizationRequirements: "",
+ enterpriseStandard: "",
+ reviewMethod: "",
+ veto: "",
+ deductionList: [],
+ },
+ formInline: {
+ name: "",
+ remark: "",
+ },
+ listQuery: {
+ filter: {
+ elementB: "",
+ },
+
+ pageIndex: 1,
+ pageSize: 10,
+ },
+ tree: [],
+ list: [],
+ treeChildren: [],
+ defaultProps: {
+ children: "children",
+ label: "label",
+ },
+ rules: {
+ name: [
+ { required: true, message: "名称不能为空", trigger: "change" },
+ ],}
+ };
+ },
+ created() {
+ this.beforTree();
+ },
+ watch: {
+ filterText(val) {
+ this.$refs.tree.filter(val);
+ },
+ },
+ methods: {
+ filterNode(value, data){
+ if (!value) return true;
+ return data.label.indexOf(value) !== -1;
+ },
+ beforTree() {
+ safetyInspectionItemTree().then((res) => {
+ this.tree = res.data.result;
+ });
+ },
+ safetyInspectionItemL(data) {
+ this.listQuery.filter.elementB = data.value;
+ safetyInspectionItemList(this.listQuery).then((res) => {
+ this.list = res.data.result.records;
+ });
+ },
+ safetyInspectionItemC(id, type) {
+ this.show = false;
+ this.title = type;
+ if (type == "新增") {
+ this.disabled = false;
+ this.form = {
+ elementA: "",
+ elementB: "",
+ standardizationRequirements: "",
+ enterpriseStandard: "",
+ reviewMethod: "",
+ veto: "",
+ deductionList: [],
+ };
+ } else {
+ this.disabled = true;
+ var i = this.list.findIndex((item) => item.id == id);
+ this.form = this.list[i];
+ }
+ },
+ select(val) {
+ this.form.elementB = "";
+ var i = this.tree.findIndex((item) => item.value == val);
+ this.treeChildren = this.tree[i].children;
+ },
+ safetyInspectionItemA() {
+ if (this.title == "新增") {
+ safetyInspectionItemAdd(this.form).then((res) => {
+ if (res.data.code == 200) {
+ this.show = true;
+ safetyInspectionItemList(this.listQuery).then((res) => {
+ this.list = res.data.result.records;
+ });
+ this.$notify({
+ type: "success",
+ duration: 2000,
+ message: "新增成功",
+ title: "成功",
+ });
+ } else {
+ this.$message({
+ type: "warning",
+ message: res.data.message,
+ });
+ }
+ });
+ } else {
+ safetyInspectionItemMod(this.form).then((res) => {
+ if (res.data.code == 200) {
+ this.show = true;
+ safetyInspectionItemList(this.listQuery).then((res) => {
+ this.list = res.data.result.records;
+ });
+ this.$notify({
+ type: "success",
+ duration: 2000,
+ message: "修改成功",
+ title: "成功",
+ });
+ } else {
+ his.$message({
+ type: "warning",
+ message: res.data.message,
+ });
+ }
+ });
+ }
+ },
+ coAdd(val, type) {
+ this.titleN = type;
+ if (type == "新增") {
+ this.dialogVisible = true;
+ this.formInline = {
+ name: "",
+ remark: "",
+ };
+ } else {
+ this.dialogVisible = true;
+ this.index = this.form.deductionList.findIndex(
+ (item) => item.name == val.name
+ );
+ this.formInline=JSON.parse(JSON.stringify(val));
+ }
+ this.$nextTick(() => {
+ this.$refs["form"].clearValidate();
+ });
+ },
+ listAdd() {
+ this.$refs["form"].validate((valid) => {
+ if (valid) {
+ if (this.titleN == "新增") {
+ this.form.deductionList.push(this.formInline);
+ this.dialogVisible = false;
+ } else {
+ this.form.deductionList[this.index].name = this.formInline.name;
+ this.form.deductionList[this.index].space = this.formInline.space;
+ this.dialogVisible = false;
+ }
+ }
+ });
+ },
+ listDel(val) {
+ var i = this.form.deductionList.findIndex(
+ (item) => item.name == val.name
+ );
+ this.form.deductionList.splice(i, 1);
+ },
+ safetyInspectionItemDel(id) {
+ safetyInspectionItemDel({ id: id }).then((res) => {
+ if (res.data.code == 200) {
+ safetyInspectionItemList(this.listQuery).then((res) => {
+ this.list = res.data.result.records;
+ });
+ this.$notify({
+ title: "成功",
+ message: "删除成功",
+ type: "success",
+ duration: 2000,
+ });
+ }
+ });
+ },
+ listCel(){
+ this.dialogVisible = false;
+ },
+ btnsQX() {
+ this.show = true;
+ },
+ },
+};
+</script>
+<style scoped>
+.app-container {
+ padding: 0px;
+}
+.box {
+ width: 100%;
+ display: flex;
+ justify-content: space-between;
+ background-color: rgb(223, 229, 235);
+}
+.box-left {
+ width: 20%;
+ min-height: 800px;
+ background-color: white;
+ border-radius: 5px;
+}
+.box-left-content {
+ padding: 10px;
+}
+.box-right {
+ width: 79%;
+ background-color: rgb(223, 229, 235);
+ border-radius: 5px;
+}
+.box-rights {
+ width: 79%;
+ background-color: #fff;
+ border-radius: 5px;
+}
+.box-rightXQ {
+ margin-bottom: 10px;
+ border: 1px solid #dedede;
+ border-radius: 5px;
+ padding: 0 10px;
+ background-color: white;
+ font-size: 14px;
+}
+.titles {
+ font-weight: bold;
+ text-align: right;
+}
+.title {
+ text-align: right;
+}
+.titles-type {
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
+.title-type {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 4;
+}
+.btnXG {
+ text-align: center;
+ color: #034ea2;
+ font-weight: bolder;
+}
+.box-rightXQ-top {
+ border-bottom: 1px solid #e9e9e9;
+}
+.box-right-content {
+ padding: 15px 0;
+}
+.btns {
+ background-color: #034ea2;
+ border: 1px solid #034ea2;
+}
+</style>
--
Gitblit v1.9.2