| | |
| | | <template> |
| | | <div> |
| | | <div class="box-right"> |
| | | <el-button type="primary" class="btn" @click="finish()">结单</el-button> |
| | | <div v-for="(item, index) in lists" :key="index" style="padding:0 0 20px 0"> |
| | | <el-button |
| | | type="primary" |
| | | class="btn" |
| | | v-if="typeId == 2 ? false : true" |
| | | @click="finish()" |
| | | >结单</el-button |
| | | > |
| | | <div |
| | | v-for="(item, index) in lists" |
| | | :key="index" |
| | | style="padding: 0 0 20px 0" |
| | | > |
| | | <div class="title"> |
| | | A级要素:<span>{{ item.elementAName }}</span> |
| | | </div> |
| | |
| | | ><p><span>B级要素:</span>{{ item.elementBName }}</p></el-col |
| | | > |
| | | <el-col :span="6" |
| | | ><p><span>总分:</span>50</p></el-col |
| | | ><p><span>总分:</span>{{ item.points }}</p></el-col |
| | | > |
| | | <el-col :span="6" |
| | | ><p><span>得分:</span>{{item.point}}</p></el-col> |
| | | <el-col :span="6" |
| | | ><p><span>得分:</span>{{ item.point }}</p></el-col |
| | | > |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-table border :data="item.child" :header-cell-style="{background:'#eef1f6',color:'#606266'}" :cell-style="{background:'#fff',color:'#606266'}"> |
| | | <el-table |
| | | border |
| | | :data="item.child" |
| | | :header-cell-style="{ background: '#eef1f6', color: '#606266' }" |
| | | :cell-style="{ background: '#fff', color: '#606266' }" |
| | | > |
| | | <el-table-column |
| | | prop="standardizationRequirements" |
| | | align="center" |
| | |
| | | ></el-table-column> |
| | | <el-table-column align="center" label="评审结果"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="(scope.row.safetyInspectionItemResult== 0)" |
| | | <span v-if="scope.row.safetyInspectionItemResult == 0" |
| | | >否决</span |
| | | > |
| | | <span v-if="(scope.row.safetyInspectionItemResult == 1)" |
| | | <span v-if="scope.row.safetyInspectionItemResult == 1" |
| | | >扣分</span |
| | | > |
| | | </template> |
| | |
| | | type="expand" |
| | | width="100px" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-table |
| | | :data="scope.row.selfDeductionList" |
| | | border |
| | | :header-cell-style="{background:'#eef1f6',color:'#606266'}" :cell-style="{background:'#fff',color:'#606266'}" |
| | | > |
| | | <el-table-column prop="name" align="center" label="扣分项"> |
| | | </el-table-column> |
| | | <el-table-column prop="point" align="center" label="扣分"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="remark" |
| | | align="center" |
| | | label="扣分备注" |
| | | <template slot-scope="scope"> |
| | | <el-table |
| | | :data="scope.row.selfDeductionList" |
| | | border |
| | | :header-cell-style="{ |
| | | background: '#eef1f6', |
| | | color: '#606266', |
| | | }" |
| | | :cell-style="{ background: '#fff', color: '#606266' }" |
| | | > |
| | | </el-table-column> |
| | | </el-table> |
| | | </template> |
| | | <el-table-column |
| | | prop="name" |
| | | align="center" |
| | | label="扣分项" |
| | | > |
| | | </el-table-column> |
| | | <el-table-column prop="point" align="center" label="扣分"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="remark" |
| | | align="center" |
| | | label="扣分备注" |
| | | > |
| | | </el-table-column> |
| | | </el-table> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="remark" |
| | |
| | | @click="handleClick(scope.row)" |
| | | type="text" |
| | | size="small" |
| | | :disabled="typeId == 2 ? true : false" |
| | | >评价</el-button |
| | | > |
| | | <!-- <el-button type="text" size="small" style="color: red" |
| | |
| | | </template> |
| | | <script> |
| | | import Titlename from "../../components/Titlename/index.vue"; |
| | | import { safetySelfInspectionInfo ,safetySelfInspectionFinish} from "@/api/safetySelfInspection.js"; |
| | | import { |
| | | safetySelfInspectionInfo, |
| | | safetySelfInspectionFinish, |
| | | } from "@/api/safetySelfInspection.js"; |
| | | export default { |
| | | components: { Titlename }, |
| | | data() { |
| | |
| | | }, |
| | | list: [], |
| | | lists: [], |
| | | listType: [], |
| | | typeId: "", |
| | | }; |
| | | }, |
| | | created() { |
| | | this.id = this.$route.query.id; |
| | | this.typeId = this.$route.query.type; |
| | | this.safeInitem(this.id); |
| | | }, |
| | | methods: { |
| | | finish(){ |
| | | let id = this.id |
| | | this.$confirm('确定要结单吗?','提示',{ |
| | | confirmButtonText:'确定', |
| | | cancelButtonText:'取消', |
| | | type:'warning', |
| | | }).then(()=> { |
| | | safetySelfInspectionFinish({id:this.id}).then(res=>{ |
| | | console.log(123,res) |
| | | if (res.data.code === '200') { |
| | | this.$notify({ |
| | | title:'成功', |
| | | message:'结单成功', |
| | | type:'success', |
| | | duration:2000, |
| | | }) |
| | | }else{ |
| | | this.$message({ |
| | | message:res.data.message, |
| | | type:'warning' |
| | | }) |
| | | } |
| | | }) |
| | | }).catch(error =>{ |
| | | finish() { |
| | | var faly = ""; |
| | | var bar = []; |
| | | for (var i = 0; i < this.listType.length; i++) { |
| | | if (this.listType[i].safetyInspectionItemResult == null) { |
| | | faly = false; |
| | | } else { |
| | | faly = true; |
| | | } |
| | | bar.push(faly); |
| | | } |
| | | if (bar.indexOf(false) == -1) { |
| | | let id = this.id; |
| | | this.$confirm("确定要结单吗?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | safetySelfInspectionFinish({ id: this.id }).then((res) => { |
| | | console.log(123, res); |
| | | if (res.data.code === "200") { |
| | | this.$notify({ |
| | | title: "成功", |
| | | message: "结单成功", |
| | | type: "success", |
| | | duration: 2000, |
| | | }); |
| | | this.$router.push({ |
| | | path: "/checklistself", |
| | | }); |
| | | } else { |
| | | this.$message({ |
| | | message: res.data.message, |
| | | type: "warning", |
| | | }); |
| | | } |
| | | }); |
| | | }) |
| | | }, |
| | | .catch((error) => {}); |
| | | } else { |
| | | alert("请将所有评分评价后再点结算"); |
| | | } |
| | | }, |
| | | |
| | | safeInitem(id) { |
| | | safetySelfInspectionInfo({ id: id }).then((res) => { |
| | | if (res.data.code == 200) this.list = res.data.result; |
| | | this.listType = res.data.result.itemList; |
| | | var arr = this.checkSameDataA(this.list.itemList); |
| | | for (var i = 0; i < arr.length; i++) { |
| | | arr[i].child = this.checkSameData(arr[i].child); |
| | | arr[i].child.points = arr[i].child.point; |
| | | } |
| | | this.lists = arr; |
| | | // console.log('tag', arr) |
| | | console.log("tag", arr); |
| | | }); |
| | | }, |
| | | checkSameDataA(resData) { |
| | |
| | | if (!dataInfo[elementBName]) { |
| | | dataInfo[elementBName] = { |
| | | elementBName, |
| | | point:"", |
| | | point: "", |
| | | points: item.point, |
| | | child: [], |
| | | }; |
| | | } |
| | | dataInfo[elementBName].child.push(item); |
| | | }); |
| | | let list = Object.values(dataInfo); // list 转换成功的数据 |
| | | console.log(list) |
| | | for(var i=0;i<list.length;i++){ |
| | | var pot=50 |
| | | for(var j=0;j<list[i].child.length;j++){ |
| | | if(list[i].child[j].safetyInspectionItemResult!=0){ |
| | | pot=pot-list[i].child[j].selfDeductionList[0].point |
| | | }else{ |
| | | var cont=0 |
| | | pot=0 |
| | | } |
| | | } |
| | | if(pot>0){ |
| | | list[i].point=pot |
| | | }else{ |
| | | list[i].point=0 |
| | | } |
| | | // console.log("数据",list) |
| | | for (var i = 0; i < list.length; i++) { |
| | | var pot = list[i].points; |
| | | for (var j = 0; j < list[i].child.length; j++) { |
| | | if (list[i].child[j].safetyInspectionItemResult != 0) { |
| | | for ( |
| | | var s = 0; |
| | | s < list[i].child[j].selfDeductionList.length; |
| | | s++ |
| | | ) { |
| | | pot = pot - list[i].child[j].selfDeductionList[s].point; |
| | | } |
| | | } else { |
| | | var cont = 0; |
| | | pot = 0; |
| | | } |
| | | } |
| | | if (pot > 0) { |
| | | list[i].point = pot; |
| | | } else { |
| | | list[i].point = 0; |
| | | } |
| | | } |
| | | return list; |
| | | }, |
| | | handleClick(data) { |
| | |
| | | path: "/review", |
| | | query: { |
| | | idC: data.id, |
| | | id:this.id |
| | | id: this.id, |
| | | }, |
| | | }); |
| | | }, |
| | |
| | | border-radius: 5px; |
| | | padding: 20px; |
| | | height: 850px; |
| | | overflow-y:overlay; |
| | | overflow-y: overlay; |
| | | } |
| | | .title { |
| | | font-size: 16px; |
| | |
| | | .titles { |
| | | font-size: 14px; |
| | | } |
| | | .box-right /deep/ .el-table__expanded-cell{ |
| | | .box-right /deep/ .el-table__expanded-cell { |
| | | background-color: #fff !important; |
| | | } |
| | | .btn { |
| | | background-color: #034ea2; |
| | | border: 1px solid #034ea2; |
| | | float: right; |
| | | background-color: #034ea2; |
| | | border: 1px solid #034ea2; |
| | | float: right; |
| | | } |
| | | </style> |