Your Name
2022-04-06 37b718547bc441c7502f0bfcf86209efe253851b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<template>
  <div>
    <div class="box-right">
      <div v-for="(item, index) in lists" :key="index" style="padding:0 0 20px 0">
        <div class="title">
          A级要素:<span>{{ item.elementAName }}</span>
        </div>
        <div v-for="(item, index) in item.child" :key="index">
          <el-row class="titles">
            <el-col :span="6"
              ><p><span>B级要素:</span>{{ item.elementBName }}</p></el-col
            >
            <el-col :span="6"
              ><p><span>总分:</span>50</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-column
                  prop="standardizationRequirements"
                  align="center"
                  label="标准化要求"
                >
                </el-table-column>
                <el-table-column
                  prop="enterpriseStandard"
                  align="center"
                  label="企业达标标准"
                ></el-table-column>
                <el-table-column
                  prop="reviewMethod"
                  align="center"
                  label="评审方法"
                ></el-table-column>
                <el-table-column
                  prop="veto"
                  align="center"
                  label="否决项"
                ></el-table-column>
                <el-table-column align="center" label="评审结果">
                  <template slot-scope="scope">
                    <span v-if="(scope.row.safetyInspectionItemResult== 0)"
                      >否决</span
                    >
                    <span v-if="(scope.row.safetyInspectionItemResult == 1)"
                      >扣分</span
                    >
                  </template>
                </el-table-column>
                <el-table-column
                  align="center"
                  label="扣分项"
                  type="expand"
                  width="100px"
                >
                <template slot-scope="scope">
                  <el-table
                    :data="scope.row.selfDeductionList"
                  >
                    <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"
                  align="center"
                  label="备注"
                ></el-table-column>
                <el-table-column align="center" label="操作" width="200px">
                  <template slot-scope="scope">
                    <el-button
                      @click="handleClick(scope.row)"
                      type="text"
                      size="small"
                      >评价</el-button
                    >
                    <!-- <el-button type="text" size="small" style="color: red"
                          >删除</el-button
                        > -->
                  </template>
                </el-table-column>
              </el-table>
            </el-col>
          </el-row>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import Titlename from "../../components/Titlename/index.vue";
import { safetySelfInspectionInfo } from "@/api/safetySelfInspection.js";
export default {
  components: { Titlename },
  data() {
    return {
      dialogVisible: false,
      form: {
        name: "",
      },
      id: "",
      formInline: {
        user: "",
        region: "",
      },
      list: [],
      lists: [],
    };
  },
  created() {
    this.id = this.$route.query.id;
    this.safeInitem(this.id);
  },
  methods: {
    safeInitem(id) {
      safetySelfInspectionInfo({ id: id }).then((res) => {
        if (res.data.code == 200) this.list = res.data.result;
        var arr = this.checkSameDataA(this.list.itemList);
        for (var i = 0; i < arr.length; i++) {
          arr[i].child = this.checkSameData(arr[i].child);
        }
        this.lists = arr;
        // console.log('tag', arr)
      });
    },
    checkSameDataA(resData) {
      let dataInfo = {};
      resData.forEach((item, index) => {
        let { elementAName } = item;
        if (!dataInfo[elementAName]) {
          dataInfo[elementAName] = {
            elementAName,
            child: [],
          };
        }
        dataInfo[elementAName].child.push(item);
      });
      let list = Object.values(dataInfo); // list 转换成功的数据
      return list;
    },
    checkSameData(resData) {
      let dataInfo = {};
      resData.forEach((item, index) => {
        let { elementBName } = item;
        if (!dataInfo[elementBName]) {
          dataInfo[elementBName] = {
            elementBName,
            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
         }
        }
      return list;
    },
    handleClick(data) {
      this.$router.push({
        path: "/review",
        query: {
          idC: data.id,
          id:this.id
        },
      });
    },
  },
};
</script>
<style scoped>
.box {
  width: 100%;
  display: flex;
  justify-content: space-between;
  background-color: rgb(223, 229, 235);
}
.box-right {
  width: 100%;
  background-color: white;
  border-radius: 5px;
  padding: 20px;
}
.title {
  font-size: 16px;
  padding: 10px 0px;
  font-weight: bold;
}
.titles {
  font-size: 14px;
}
</style>