From 1fce0b643b1b8bd5d443efb3ff0074caab3c5dba Mon Sep 17 00:00:00 2001
From: shj <1790240199@qq.com>
Date: Thu, 31 Mar 2022 17:07:56 +0800
Subject: [PATCH] Merge branch 'shf' of https://sinanoaq.cn:8888/r/ztqt into shf
---
src/views/safetyproduction/new.vue | 59 +++++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 41 insertions(+), 18 deletions(-)
diff --git a/src/views/safetyproduction/new.vue b/src/views/safetyproduction/new.vue
index 5792d28..0ab20d8 100644
--- a/src/views/safetyproduction/new.vue
+++ b/src/views/safetyproduction/new.vue
@@ -15,7 +15,7 @@
></el-tree>
</div>
</div>
- <div class="box-right" v-if="list == '' ? false : true">
+ <div class="box-right" v-if="lists == '' ? false : true">
<div class="btns">
<el-button type="primary" class="btn" @click="open(0)"
>添加</el-button
@@ -24,7 +24,7 @@
>暂存</el-button
>
</div>
- <div v-for="(item, i) in lists" :key="i">
+ <div v-for="(item, i) in lists" :key="i" style="padding:0 0 20px 0">
<div class="title">
A级要素:<span>{{ item.elementAName }}</span>
</div>
@@ -33,9 +33,9 @@
<el-col :span="6" :offset="1"
><p><span>B级要素:</span>{{ item.elementBName }}</p></el-col
>
- <el-col :span="6" :offset="4"
+ <!-- <el-col :span="6" :offset="4"
><p><span>得分:</span>50</p></el-col
- >
+ > -->
</el-row>
<el-row>
<el-col :span="22" :offset="1">
@@ -112,12 +112,12 @@
</div>
</div>
</div>
- <el-dialog title="添加" :visible.sync="dialogVisible" :close-on-click-modal="false" width="30%">
- <el-form ref="form" :model="form" label-width="100px">
- <el-form-item label="自查清单名称">
+ <el-dialog :title="id" :visible.sync="dialogVisible" :close-on-click-modal="false" width="30%">
+ <el-form ref="form" :rules="rules" :model="form" label-width="110px">
+ <el-form-item label="自查清单名称" prop="name">
<el-input v-model="form.inspectionName"></el-input>
</el-form-item>
- <el-form-item label="检查人名称">
+ <el-form-item label="检查人名称" prop="type">
<el-select
v-model="form.inspector"
style="width: 100%"
@@ -132,7 +132,7 @@
</el-option>
</el-select>
</el-form-item>
- <el-form-item label="时间">
+ <el-form-item label="时间" prop="time">
<el-col :span="11">
<el-date-picker
type="date"
@@ -199,6 +199,18 @@
label: "label",
},
itemId: "",
+ parent: [],
+ rules: {
+ name: [
+ { required: true, message: "要素名称不能为空", trigger: "change" },
+ ],
+ type: [
+ { required: true, message: "级别不能为空", trigger: "change" },
+ ],
+ time: [
+ { required: true, message: "父要素不能为空", trigger: "change" },
+ ]
+ },
};
},
created() {
@@ -212,7 +224,6 @@
safetySelfInspectionInfo({ id: id }).then((res) => {
if (res.data.code == 200) {
this.form = res.data.result;
- console.log(res.data.result);
this.list = res.data.result;
var trees = [];
for (var i = 0; i < this.list.itemList.length; i++) {
@@ -220,16 +231,21 @@
}
this.treeList = Array.from(new Set(trees));
var arr = this.checkSameDataA(this.list.itemList);
- console.log("tag", arr);
for (var i = 0; i < arr.length; i++) {
+ var capB = {
+ safetySelfInspectionId: "",
+ safetyInspectionItemId: "",
+ }
+ var cser=[]
+ for(var j=0;j<arr[i].child.length;j++){
+ capB.safetySelfInspectionId=arr[i].child[j].safetySelfInspectionId
+ capB.safetyInspectionItemId=arr[i].child[j].safetyInspectionItemId
+ cser.push(capB)
+ }
+ arr[i].id=cser
arr[i].child = this.checkSameData(arr[i].child);
- arr[i].id = {
- safetySelfInspectionId: arr[i].child.safetySelfInspectionId,
- safetyInspectionItemId: arr[i].child.safetyInspectionItemId,
- };
}
this.lists = arr;
- console.log(this.lists);
}
});
},
@@ -274,6 +290,7 @@
}
} else if (this.id == "编辑") {
this.list = res.data.result;
+ if(this.list.length!=0){
var capA = { elementAName: "", id: [], child: [] };
var atte = [];
capA.elementAName = this.list[0].elementAName;
@@ -286,7 +303,6 @@
capB.safetySelfInspectionId = this.itemId;
atte.push(capB);
}
- console.log("数据", this.lists);
capA.id = atte;
capA.child = this.checkSameData(this.list);
if (
@@ -301,6 +317,7 @@
);
this.lists.splice(i, 1);
}
+ }
}
});
},
@@ -339,7 +356,6 @@
this.TreeB(currentObj.value);
},
handleClick(data) {
- console.log("tag", data.id);
if (data.safetyInspectionItemId != undefined) {
this.$router.push({
path: "/reviewXG",
@@ -357,6 +373,9 @@
}
},
open(type) {
+ this.$nextTick(() => {
+ this.$refs["form"].clearValidate();
+ });
this.dialogVisible = true;
this.form.status = type;
var arr = [];
@@ -374,6 +393,8 @@
});
},
addC() {
+ this.$refs["form"].validate((valid) => {
+ if (valid) {
if (this.id == "添加") {
safetySelfInspectionAdd(this.form).then((res) => {
if (res.data.code == 200) {
@@ -403,6 +424,8 @@
path:"/checklistself"
});
}
+ }
+ });
},
btnsQX() {
this.show = true;
--
Gitblit v1.9.2