From 44d0be2ff89f8acabe0e188998f272df64488e65 Mon Sep 17 00:00:00 2001
From: songhuangfeng123 <shf18767906695@163.com>
Date: 星期三, 20 四月 2022 10:26:31 +0800
Subject: [PATCH] 路由fix
---
src/views/safetyproduction/new.vue | 113 +++++++++++++++++++++++++++++++++++---------------------
1 files changed, 70 insertions(+), 43 deletions(-)
diff --git a/src/views/safetyproduction/new.vue b/src/views/safetyproduction/new.vue
index 5792d28..f0e9581 100644
--- a/src/views/safetyproduction/new.vue
+++ b/src/views/safetyproduction/new.vue
@@ -15,16 +15,16 @@
></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 type="primary" class="btn" @click="open(1)"
>添加</el-button
>
- <el-button type="primary" class="btn" @click="open(-1)"
+ <el-button type="primary" class="btn" @click="open(0)"
>暂存</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,13 +33,13 @@
<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">
- <el-table ref="table" border :data="item.child">
+ <el-table ref="table" border :stripe="true" :data="item.child" :header-cell-style="{background:'#eef1f6',color:'#606266'}" :cell-style="{background:'#fff',color:'#606266'}">
<el-table-column
prop="standardizationRequirements"
align="center"
@@ -69,7 +69,9 @@
type="expand"
>
<template slot-scope="scope">
- <el-table :data="scope.row.deductionList">
+ <el-table border :data="scope.row.deductionList"
+ :header-cell-style="{background:'#eef1f6',color:'#606266'}" :cell-style="{background:'#fff',color:'#606266'}"
+ >
<el-table-column
prop="name"
align="center"
@@ -77,13 +79,7 @@
>
</el-table-column>
<el-table-column
- prop="date"
- align="center"
- label="扣分"
- >
- </el-table-column>
- <el-table-column
- prop="date"
+ prop="remark"
align="center"
label="扣分备注"
>
@@ -112,12 +108,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="inspectionName">
<el-input v-model="form.inspectionName"></el-input>
</el-form-item>
- <el-form-item label="检查人名称">
+ <el-form-item label="检查人名称" prop="inspector">
<el-select
v-model="form.inspector"
style="width: 100%"
@@ -132,11 +128,11 @@
</el-option>
</el-select>
</el-form-item>
- <el-form-item label="时间">
+ <el-form-item label="时间" prop="inspectionTime">
<el-col :span="11">
<el-date-picker
type="date"
- format="yyyy 年 MM 月 dd 日"
+ value-format="yyyy-MM-dd"
placeholder="开始时间"
v-model="form.inspectionTime"
style="width: 100%"
@@ -154,7 +150,7 @@
class="dialog-footer"
>
<el-button type="primary" class="btn" @click="addC">确 定</el-button>
- <el-button @click="dialogVisible = false">取 消</el-button>
+ <el-button @click="closeDialog">取 消</el-button>
</span>
</el-dialog>
</div>
@@ -199,10 +195,21 @@
label: "label",
},
itemId: "",
+ parent: [],
+ rules: {
+ inspectionName: [{required: true, message: '自查清单名称不能为空', trigger: 'blur'}],
+ inspector: [{required: true, message: '检查人名称为空', trigger: 'blur'}],
+ inspectionTime: [{required: true, message: '检查时间不能为空', trigger: 'blur'}],
+ },
};
},
created() {
this.TreeA();
+ safetyInspectionItemName().then((res) => {
+ if (res.data.code == 200) {
+ this.nameList = res.data.result;
+ }
+ });
this.id = this.$route.query.name;
this.itemId = this.$route.query.id;
this.itemInfo(this.$route.query.id);
@@ -212,7 +219,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 +226,23 @@
}
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 cser=[]
+ for(var j=0;j<arr[i].child.length;j++){
+ var capB = {
+ safetySelfInspectionId: "",
+ safetyInspectionItemId: "",
+ }
+ arr[i].child[j].deductionList= arr[i].child[j].selfDeductionList
+ console.log(arr[i].child[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);
}
});
},
@@ -242,7 +255,7 @@
},
TreeB(id) {
safetyInspectionItemTreeB({ id: id }).then((res) => {
- this.list = [];
+ // this.list = [];
if (this.id == "添加") {
if (res.data.code == 200) {
this.list = res.data.result;
@@ -274,11 +287,13 @@
}
} 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;
for (var i = 0; i < this.list.length; i++) {
- var capB = {
+ var capB = {
safetySelfInspectionId: "",
safetyInspectionItemId: "",
};
@@ -286,7 +301,6 @@
capB.safetySelfInspectionId = this.itemId;
atte.push(capB);
}
- console.log("数据", this.lists);
capA.id = atte;
capA.child = this.checkSameData(this.list);
if (
@@ -301,6 +315,7 @@
);
this.lists.splice(i, 1);
}
+ }
}
});
},
@@ -339,19 +354,22 @@
this.TreeB(currentObj.value);
},
handleClick(data) {
- console.log("tag", data.id);
if (data.safetyInspectionItemId != undefined) {
this.$router.push({
path: "/reviewXG",
query: {
- id: data.safetyInspectionItemId,
+ idX: data.safetyInspectionItemId,
+ name:this.id,
+ id:this.itemId
},
});
} else {
this.$router.push({
path: "/reviewXG",
query: {
- id: data.id,
+ idX: data.id,
+ name:this.id,
+ id:this.itemId
},
});
}
@@ -361,20 +379,21 @@
this.form.status = type;
var arr = [];
for (var i = 0; i < this.lists.length; i++) {
- this.lists[i].id;
+ // this.lists[i].id;
for (var j = 0; j < this.lists[i].id.length; j++) {
arr.push(this.lists[i].id[j]);
}
}
this.form.itemList = arr;
- safetyInspectionItemName().then((res) => {
- if (res.data.code == 200) {
- this.nameList = res.data.result;
- }
- });
},
+ closeDialog(){
+ this.dialogVisible = false
+ },
addC() {
+ this.$refs["form"].validate((valid) => {
+ if (valid) {
if (this.id == "添加") {
+ console.log("添加",this.form)
safetySelfInspectionAdd(this.form).then((res) => {
if (res.data.code == 200) {
this.dialogVisible = false;
@@ -390,6 +409,7 @@
}
});
} else if (this.id == "编辑") {
+ console.log('编辑',this.form)
safetySelfInspectionMod(this.form).then((res) => {
this.dialogVisible = false;
this.$notify({
@@ -403,6 +423,8 @@
path:"/checklistself"
});
}
+ }
+ });
},
btnsQX() {
this.show = true;
@@ -422,7 +444,7 @@
}
.box-left {
width: 20%;
- min-height: 800px;
+ min-height: 850px;
background-color: white;
border-radius: 5px;
}
@@ -434,6 +456,8 @@
width: 79%;
background-color: white;
border-radius: 5px;
+ height: 850px;
+ overflow-y:overlay;
}
.title {
font-size: 16px;
@@ -455,4 +479,7 @@
background-color: #034ea2;
border: 1px solid #034ea2;
}
-</style>
\ No newline at end of file
+.box-right /deep/ .el-table__expanded-cell{
+ background-color: #fff !important;
+}
+</style>
--
Gitblit v1.9.2