hejianhao
2026-01-09 be5d0750301ebad72f9f7f94e3b878bce43d4ec8
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
220
221
222
223
224
225
import React, { Component } from "react";
import { Card, Table, Input, Select, Modal, Cascader } from "antd";
import { getProjectScore, getPlanByProject } from "@/api/business";
import { getTreeListByModelId } from "@/api/standard";
import { getPlanDetails, getModelTypeList } from "@/api/produce";
import moment from "moment";
import '../style/clientInfo.less'
const { Column } = Table;
const { Option } = Select
const axios = require('axios');
class DataProb extends Component {
  state = {
      planList: [],
      projectList: [],
      treeList: [],
      modelList: [],
      planId: '',
      projectId: '',
      modelSysId: '',
      hierarchySysId: '',
      deductScore: null,
      deserveScore: null,
      score: null
  };
 
  formatList = (list) => { // 格式化数据
    let temp = []
    list.map(item => {
      let obj = {
        ...item
      }
      obj.label = item.name
      obj.value = item.id;
      obj.children = item.children ? this.formatList(item.children) : [];
      temp.push(obj)
    })
    return temp
  }
  handleNodeChange = (value) => {
      this.setState({
        hierarchySysId: value[value.length - 1]
      }, () => {
        getProjectScore({
            planId: this.state.planId,
            projectId: this.state.projectId,
            modelSysId: this.state.modelSysId,
            hierarchySysId: this.state.hierarchySysId,
            currPage: 1,
            pageSize: 20000
        }).then(res => {
          if (res.data.status === 'OK') {
            this.setState({
              dataProbs: res.data.data.list,
              score: res.data.data.score,
              deductScore: res.data.data.deductScore,
              deserveScore: res.data.data.deserveScore
            })
          }
        })
      })
  }
  getTreeListByModelIdFun = async () => { // 获取树形结构
    const result = await getTreeListByModelId({type: 'SYSTEM', modelId: this.state.modelSysId})
    if (result.data.status === 'OK') {
      this.setState({
        treeList: this.formatList(result.data.data)
      })
    }
  }
  handlePlanChange = async (value) => {
    const result = await getPlanByProject({
        planId: value,
        currPage: 1,
        pageSize: 20000,
    })
    if (result.status === 200 && result.data.status === 'OK') {
        let temp = []
        result.data.data.forEach(item => {
            const ele = {
                label: item.projectName,
                value: item.id
            }
            temp.push(ele)
        })
        this.setState({
            projectList: temp,
            planId: value
        })
    }
    this.getPlanDetailsFun(value)
  }
  getPlanDetailsFun = async (id) => {
    const result = await getPlanDetails({id: id})
    if (result.data.status === 'OK') {
        this.setState({
            modelSysId: result.data.data.checkSysId,
        })
    }
  }
  handleProjectChange = value => {
      this.setState({
          projectId: value
      }, () => {
        this.getTreeListByModelIdFun()
      })
  }
  getModelTypeListFun = async () => {
    const result = await getModelTypeList({
      type: 'SYSTEM',
    })
    if (result.data.status === 'OK') {
      let temp = []
      result.data.data.forEach(item => {
        const ele = {
          label: item.name,
          value: parseInt(item.code)
        }
        temp.push(ele)
      })
      this.setState({
        modelList: temp
      })
    }
  }
  componentDidMount() {
      // this.getTreeListByModelIdFun()
      this.getModelTypeListFun()
  }
  render() {
    const { dataProbs } = this.state
    const { visible, onCancel, planOptions } = this.props
    const title = (
      <div className="title flex">
          <Select
            style={{
              width: '25%',
            }}
            placeholder="计划"
            allowClear
            onChange={this.handlePlanChange}
          >
            {planOptions.map((item, index) => (
              <Option value={item.value} key={index}>{item.label}</Option>
            ))}
          </Select>
          &nbsp;
          &nbsp;
          <Select
            style={{
              width: '25%',
            }}
            placeholder="查询已结束项目项目"
            onChange={this.handleProjectChange}
            allowClear
          >
            {this.state.projectList.map((item, index) => (
              <Option value={item.value} key={index}>{item.label}</Option>
            ))}
          </Select>
          &nbsp;
          &nbsp;
          <Select
            style={{
              width: '25%',
            }}
            placeholder="查询已结束项目项目"
            onChange={this.handleProjectChange}
            value={this.state.modelSysId}
            allowClear
            disabled
          >
            {this.state.modelList.map((item, index) => (
              <Option value={item.value} key={index}>{item.label}</Option>
            ))}
          </Select>
          &nbsp;
          &nbsp;
          <Cascader
                style={{
                    width: '25%',
                }}
                options={this.state.treeList ? this.state.treeList : []}
                placeholder="节点"
                expandTrigger="hover"
                onChange={this.handleNodeChange} />
      </div>
    )
    return (
        <Modal
            title={'项目评分'}
            visible={visible}
            onCancel={onCancel}
            footer={[
            <div key={'footer'}></div>
            ]}
            width={'70%'}
            destroyOnClose
        >
            <div className="app-container">
                <Card title={title}>
                    <div className="grid grid-1-1-1">
                      <div>应得分:{this.state.deserveScore}</div>
                      <div>扣除分:{this.state.deductScore}</div>
                      <div>得分:{this.state.score}</div>
                    </div>
                    <Table 
                        bordered 
                        rowKey="index" 
                        dataSource={dataProbs} 
                        pagination={true}
                        scroll={{x: 'max-content'}}>
                        <Column title="序号" dataIndex="serialNum" key="serialNum" align="center"/>
                        <Column title="检查内容" dataIndex="checkContent" key="checkContent" align="center"/>
                        <Column title="应得分" dataIndex="deserveScore" key="deserveScore" align="center"/>
                        <Column title="扣除分数" key="deductScore" align="center" dataIndex="deductScore"/>
                        <Column title="得分" dataIndex="score" key="score" align="center" />
                    </Table>
                </Card>
            </div>
        </Modal>
    );
  }
}
 
export default DataProb;