churf
2023-09-18 4b4e1b54cae72088fa60978e0192fe57f986e6f3
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<template>
  <div class="dashboard-container">
    <div class="dashboard-editor-container">
      <el-row :gutter="32">
        <el-col :xs="24" :sm="24" :lg="12">
          <div class="chart-wrapper">
            <div class="wrapper-div">
              <el-date-picker v-model="stTargetYear" type="year" clearable placeholder="目标年度" style="width: 185px;" @change="stTargetYearChange" />
            </div>
            <subgroup-turnover :key="stRandom" :target-year="stParameter" />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="12">
          <div class="chart-wrapper" />
        </el-col>
      </el-row>
      <el-row :gutter="32">
        <el-col :xs="24" :sm="24" :lg="12">
          <div class="chart-wrapper">
            <div class="wrapper-div">
              <div style="height: 32px;" />
            </div>
            <type-contract-price :key="tcpwhRandom" :project-distinguish="tcpwhParameterProjectDistinguish" :target-year="tcpwhParameterTargetYear" />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="12">
          <div class="chart-wrapper">
            <div class="wrapper-div">
              <el-select v-model="tcpwhProjectDistinguish" filterable clearable placeholder="项目区分" style="width: 185px;" @change="tcpwhProjectDistinguishOrTargetYearChange">
                <el-option
                  v-for="item in projectDistinguishList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
              <el-date-picker v-model="tcpwhTargetYear" type="year" clearable placeholder="目标年度" style="width: 185px;" @change="tcpwhProjectDistinguishOrTargetYearChange" />
            </div>
            <type-working-hours :key="tcpwhRandom" :project-distinguish="tcpwhParameterProjectDistinguish" :target-year="tcpwhParameterTargetYear" />
          </div>
        </el-col>
      </el-row>
      <el-row :gutter="32">
        <el-col :xs="24" :sm="24" :lg="12">
          <div class="chart-wrapper">
            <div class="wrapper-div">
              <div style="height: 32px;" />
            </div>
            <subgroup-working-hours />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="12">
          <div class="chart-wrapper" />
        </el-col>
      </el-row>
      <el-row :gutter="32">
        <el-col :xs="24" :sm="24" :lg="12">
          <div class="chart-wrapper">
            <div class="wrapper-div">
              <el-select v-model="sthProjectDistinguish" filterable clearable placeholder="项目区分" style="width: 185px;" @change="sthProjectDistinguishChange">
                <el-option
                  v-for="item in projectDistinguishList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </div>
            <subgroup-top-hours :key="sthRandom" :project-distinguish="sthParameterProjectDistinguish" />
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="12">
          <div class="chart-wrapper">
            <div class="wrapper-div">
              <el-select v-model="pwhProjectId" filterable clearable placeholder="目标项目" style="width: 185px;" @change="pwhProjectIdChange">
                <el-option
                  v-for="item in projectList"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                />
              </el-select>
            </div>
            <project-working-hours :key="pwhRandom" :project-id="pwhParameter" />
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>
 
<script>
import constant from '../../utils/constant'
import crudProject from '@/api/project/project'
import { getDictMap } from '@/api/system/dictDetail'
import SubgroupTurnover from './chart/subgroupTurnover.vue'
import SubgroupWorkingHours from './chart/subgroupWorkingHours.vue'
import ProjectWorkingHours from './chart/projectWorkingHours.vue'
import TypeContractPrice from './chart/typeContractPrice.vue'
import TypeWorkingHours from './chart/typeWorkingHours.vue'
import SubgroupTopHours from './chart/subgroupTopHours.vue'
 
export default {
  name: 'ProjectChart',
  components: { SubgroupTurnover, SubgroupWorkingHours, ProjectWorkingHours, TypeContractPrice, TypeWorkingHours, SubgroupTopHours },
  data() {
    return {
      // 项目列表
      projectList: [],
      // 项目区分列表
      projectDistinguishList: [],
      // 分组营业额:目标年度
      stTargetYear: new Date(),
      // 分组营业额:随机数
      stRandom: 0,
      // 分组营业额:传参
      stParameter: new Date().getFullYear().toString(),
      // 项目工时:目标项目
      pwhProjectId: null,
      // 项目工时:随机数
      pwhRandom: 0,
      // 项目工时:传参
      pwhParameter: null,
      // 类型合同额、分组工时:项目区分
      tcpwhProjectDistinguish: null,
      // 类型合同额、分组工时:目标年度
      tcpwhTargetYear: new Date(),
      // 类型合同额、分组工时:随机数
      tcpwhRandom: 0,
      // 类型合同额、分组工时:传参
      tcpwhParameterProjectDistinguish: null,
      tcpwhParameterTargetYear: new Date().getFullYear().toString(),
      // 分组排名工时:项目区分
      sthProjectDistinguish: null,
      // 分组排名工时:随机数
      sthRandom: 0,
      // 分组排名工时:传参
      sthParameterProjectDistinguish: null
    }
  },
  created() {
    // 获取项目
    this.getProject()
    // 获取字典
    this.getDictDetail()
  },
  methods: {
    // 获取项目
    getProject() {
      crudProject.getAll({ projectStatus: constant.PROJECT_STATUS_UNDER_WAY }).then(res => {
        // 项目列表
        this.projectList = res
        // 项目工时:目标项目
        this.pwhProjectId = res[0].id
        // 项目工时:传参
        this.pwhParameter = res[0].id.toString()
        // 项目工时:随机数
        this.pwhRandom = Math.random()
      })
    },
    // 获取字典
    getDictDetail() {
      getDictMap(constant.PROJECT_DISTINGUISH).then(res => {
        // 项目区分列表
        this.projectDistinguishList = res[constant.PROJECT_DISTINGUISH]
        // 类型合同额、分组工时:目标年度
        this.tcpwhProjectDistinguish = res[constant.PROJECT_DISTINGUISH][0].value
        // 类型合同额、分组工时:传参
        this.tcpwhParameterProjectDistinguish = res[constant.PROJECT_DISTINGUISH][0].value.toString()
        // 类型合同额、分组工时:随机数
        this.tcpwhRandom = Math.random()
        // 分组排名工时:项目区分
        this.sthProjectDistinguish = res[constant.PROJECT_DISTINGUISH][0].value
        // 分组排名工时:传参
        this.sthParameterProjectDistinguish = res[constant.PROJECT_DISTINGUISH][0].value.toString()
        // 分组排名工时:随机数
        this.sthRandom = Math.random()
      })
    },
    // 分组营业额:目标年度变更
    stTargetYearChange() {
      // 分组营业额:传参
      this.stParameter = this.stTargetYear.getFullYear().toString()
      // 分组营业额:随机数
      this.stRandom = Math.random()
    },
    // 项目工时:目标项目变更
    pwhProjectIdChange() {
      // 项目工时:传参
      this.pwhParameter = this.pwhProjectId.toString()
      // 项目工时:随机数
      this.pwhRandom = Math.random()
    },
    // 类型合同额、分组工时:项目区分/目标年度变更
    tcpwhProjectDistinguishOrTargetYearChange() {
      // 类型合同额、分组工时:传参
      this.tcpwhParameterProjectDistinguish = this.tcpwhProjectDistinguish.toString()
      this.tcpwhParameterTargetYear = this.tcpwhTargetYear.getFullYear().toString()
      // 类型合同额、分组工时:随机数
      this.tcpwhRandom = Math.random()
    },
    // 分组排名工时:项目区分变更
    sthProjectDistinguishChange() {
      // 分组排名工时:传参
      this.sthParameterProjectDistinguish = this.sthProjectDistinguish.toString()
      // 分组排名工时:随机数
      this.sthRandom = Math.random()
    }
  }
}
</script>
 
<style rel="stylesheet/scss" lang="scss" scoped>
  .dashboard-editor-container {
    padding: 32px;
    position: relative;
 
    .github-corner {
      position: absolute;
      top: 0;
      border: 0;
      right: 0;
    }
 
    .search-wrapper {
      text-align: right;
    }
 
    .chart-wrapper {
      background: #fff;
      padding: 16px 16px 0;
      margin-bottom: 32px;
      overflow: auto;
 
      .wrapper-div {
        text-align: right;
        margin: 0px 15px 15px 15px ;
      }
    }
  }
 
  @media (max-width:1024px) {
    .chart-wrapper {
      padding: 8px;
    }
  }
</style>