lyfO_o
2022-06-09 d3e7923f5cc188da720ba9c3d6a536ae82e46f3c
src/views/safetyproduction/gojudging.vue
@@ -6,8 +6,11 @@
        class="btn"
        v-if="typeId == 2 ? false : true"
        @click="finish()"
        >结单</el-button
      >
        >结单</el-button>
        <div class="point">
            所有A级要素总分= {{remark}}
        </div>
      <div
        v-for="(item, index) in lists"
        :key="index"
@@ -150,6 +153,7 @@
      lists: [],
      listType: [],
      typeId: "",
      remark:"",
    };
  },
  created() {
@@ -178,7 +182,6 @@
        })
          .then(() => {
            safetySelfInspectionFinish({ id: this.id }).then((res) => {
              console.log(123, res);
              if (res.data.code === "200") {
                this.$notify({
                  title: "成功",
@@ -187,7 +190,7 @@
                  duration: 2000,
                });
                this.$router.push({
                  path: "/checklistself",
                path:"/safetyproduction/safetyproduction/checklistself"
                });
              } else {
                this.$message({
@@ -210,10 +213,40 @@
        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].elementAWeight = arr[i].child[0].elementAWeight;
          arr[i].child.points = arr[i].child.point;
        }
        this.lists = arr;
        console.log("tag", arr);
        let showDetail = ''
        for (let i = 0 ; i < arr.length ; i++){
            if (i < arr.length - 1 ){
                showDetail+='('+arr[i].elementAName + ' * '+arr[i].elementAWeight+ ') + '
            } else{
                showDetail+='('+arr[i].elementAName + ' * '+arr[i].elementAWeight+ ')'
            }
        }
        this.remark+=showDetail
          if (this.typeId==2){
              let pointA = ''
              let pointDetail = ' = '
              let finalPoint=0
              for (let i = 0 ; i < arr.length ; i++){
                  let childData = arr[i].child
                  pointA = 0
                  for (let j = 0 ; j < childData.length ; j++){
                      //改A级要素的总分
                      pointA += childData[j].point
                  }
                  finalPoint += pointA * arr[i].elementAWeight
                  if (i < arr.length - 1 ){
                      pointDetail +='('+pointA + ' * '+arr[i].elementAWeight+ ') + '
                  } else{
                      pointDetail +='('+pointA + ' * '+arr[i].elementAWeight+ ') = '
                  }
              }
              pointDetail +=finalPoint
              this.remark+=pointDetail
          }
      });
    },
    checkSameDataA(resData) {
@@ -223,6 +256,7 @@
        if (!dataInfo[elementAName]) {
          dataInfo[elementAName] = {
            elementAName,
            elementAWeight:'',
            child: [],
          };
        }
@@ -239,6 +273,7 @@
          dataInfo[elementBName] = {
            elementBName,
            point: "",
            elementAWeight:item.elementAWeight,
            points: item.point,
            child: [],
          };
@@ -246,7 +281,6 @@
        dataInfo[elementBName].child.push(item);
      });
      let list = Object.values(dataInfo); // list 转换成功的数据
      // 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++) {
@@ -298,6 +332,12 @@
  height: 850px;
  overflow-y: overlay;
}
.point {
    background-color: rgba(3,78,162,0.1);
    font-size: 20px;
    padding: 10px 5px;
    font-weight: bold;
}
.title {
  font-size: 16px;
  padding: 10px 0px;