From 1b3b9e0bb02144949c49702d27884ad0d6b3e7e2 Mon Sep 17 00:00:00 2001 From: songhuangfeng123 <shf18767906695@163.com> Date: 星期四, 31 三月 2022 16:46:10 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/shf' into shf --- src/views/safetyproduction/new.vue | 56 +++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 41 insertions(+), 15 deletions(-) diff --git a/src/views/safetyproduction/new.vue b/src/views/safetyproduction/new.vue index 5792d28..91e648f 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" :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() { @@ -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,7 +359,6 @@ this.TreeB(currentObj.value); }, handleClick(data) { - console.log("tag", data.id); if (data.safetyInspectionItemId != undefined) { this.$router.push({ path: "/reviewXG", @@ -357,6 +376,9 @@ } }, 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) { @@ -403,6 +427,8 @@ path:"/checklistself" }); } + } + }); }, btnsQX() { this.show = true; -- Gitblit v1.9.2