From a49ae63a6f96d10b8ec9fa479a0c28c5df4537e7 Mon Sep 17 00:00:00 2001
From: songhuangfeng123 <shf18767906695@163.com>
Date: Thu, 31 Mar 2022 16:45:59 +0800
Subject: [PATCH] fix
---
src/views/safetyproduction/new.vue | 72 ++++++++++++++++++++++++++----------
1 files changed, 52 insertions(+), 20 deletions(-)
diff --git a/src/views/safetyproduction/new.vue b/src/views/safetyproduction/new.vue
index 35b0d78..d10d19c 100644
--- a/src/views/safetyproduction/new.vue
+++ b/src/views/safetyproduction/new.vue
@@ -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" width="30%">
- <el-form ref="form" :model="form" label-width="100px">
- <el-form-item label="自查清单名称">
+ <el-dialog title="添加" :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() {
@@ -220,13 +232,20 @@
}
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
+ console.log('tag', capB)
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 +293,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 +306,6 @@
capB.safetySelfInspectionId = this.itemId;
atte.push(capB);
}
- console.log("数据", this.lists);
capA.id = atte;
capA.child = this.checkSameData(this.list);
if (
@@ -301,6 +320,7 @@
);
this.lists.splice(i, 1);
}
+ }
}
});
},
@@ -339,24 +359,26 @@
this.TreeB(currentObj.value);
},
handleClick(data) {
- console.log('tag', data.id)
- if (data.safetyInspectionItemId!=undefined) {
- this.$router.push({
+ if (data.safetyInspectionItemId != undefined) {
+ this.$router.push({
path: "/reviewXG",
query: {
id: data.safetyInspectionItemId,
},
});
- } else{
- this.$router.push({
+ } else {
+ this.$router.push({
path: "/reviewXG",
query: {
- id:data.id
+ id: data.id,
},
});
}
},
open(type) {
+ this.$nextTick(() => {
+ this.$refs["form"].clearValidate();
+ });
this.dialogVisible = true;
this.form.status = type;
var arr = [];
@@ -374,6 +396,8 @@
});
},
addC() {
+ this.$refs["form"].validate((valid) => {
+ if (valid) {
if (this.id == "添加") {
safetySelfInspectionAdd(this.form).then((res) => {
if (res.data.code == 200) {
@@ -383,6 +407,9 @@
duration: 2000,
message: "新增成功",
title: "成功",
+ });
+ this.$router.push({
+ path:"/checklistself"
});
}
});
@@ -396,7 +423,12 @@
title: "成功",
});
});
+ this.$router.push({
+ path:"/checklistself"
+ });
}
+ }
+ });
},
btnsQX() {
this.show = true;
--
Gitblit v1.9.2