duhuizhe
2023-10-16 3aa55dd3f62cee2c1c4c0aa74e1570acf83f8927
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
<template>
  <div class="app-container">
    <el-card class="box-card" style="width: 100%" shadow="never">
      <div class="f-r f-r-between">
        <div class="total-item" :class="{'total-active':curId ==null}" @click.stop="changeType(null)">
          <div class="total-title">项目总数</div>
          <div class="total-num">{{ topInfo.projectTotal }}</div>
        </div>
        <div class="total-item" :class="{'total-active':curId ==0}" @click="changeType(0)">
          <div class="total-title">未开工</div>
          <div class="total-num">{{ topInfo.awaitNum }}</div>
        </div>
        <div class="total-item" :class="{'total-active':curId ==1}" @click="changeType(1)">
          <div class="total-title">进行中</div>
          <div class="total-num">{{ topInfo.ingNum }}</div>
        </div>
        <div class="total-item" :class="{'total-active':curId ==4}" @click="changeType(4)">
          <div class="total-title">已延期</div>
          <div class="total-num">{{ topInfo.postponeNum }}</div>
        </div>
        <div class="total-item" :class="{'total-active':curId ==2}" @click="changeType(2)">
          <div class="total-title">已完成</div>
          <div class="total-num">{{ topInfo.endNum }}</div>
        </div>
        <div class="total-item" :class="{'total-active':curId ==3}" @click="changeType(3)">
          <div class="total-title">已取消</div>
          <div class="total-num">{{ topInfo.cancelNum }}</div>
        </div>
      </div>
    </el-card>
    <el-card class="box-card" style="width: 100%;margin-top: 8px" shadow="never">
      <!--搜索条件-->
      <div class="filter-container">
        <my-search ref="searchBar" :items="items" @search="fifterForm"></my-search>
      </div>
      <el-row style="margin-top: 15px">
        <el-col>
          <div>
            <el-table
              v-loading="loading"
              :show-header="false"
              :data="tableData"
              fit
              size="medium"
              style="width: 100%">
              <el-table-column
                fixed="left"
                width="240">
                <template slot-scope="scope">
                  <div class="f-r">
                    <div>
                      <div class="project-name" @click="toDetail(scope.row.id)">{{ scope.row.projectName }}</div>
                      <div class="font-13 color-666">{{ scope.row.projectCode }}</div>
                    </div>
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                fixed="left"
                width="200">
                <template slot-scope="scope">
                  <div>
                    <el-progress :percentage="scope.row.progressRate"></el-progress>
                    <div class="m-t-10 f-r f-r-between">
                      <el-tag :type="getStatusText(scope.row.status).type">{{getStatusText(scope.row.status).text}}</el-tag>
                      <div class="font-13 color-999">
                        当前进度
                        <span class="color-red">{{ scope.row.progressRate }}%</span>
                      </div>
                    </div>
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                width="180">
                <template slot-scope="scope">
                  <div class="font-13 color-666 text-center">类型</div>
                  <div class="font-13 color-333 text-center m-t-10">{{ scope.row.projectCategoryName }}</div>
                </template>
              </el-table-column>
              <el-table-column
                width="180">
                <template slot-scope="scope">
                  <div class="font-13 color-666 text-center">建设单位</div>
                  <div class="font-13 color-333 text-center m-t-10">{{ scope.row.buildOrgName }}</div>
                </template>
              </el-table-column>
              <el-table-column
                width="180">
                <template slot-scope="scope">
                  <div class="font-13 color-666 text-center">批复时间</div>
                  <div class="font-13 color-333 text-center m-t-10">{{ scope.row.approvalDate }}</div>
                </template>
              </el-table-column>
              <el-table-column
                width="180">
                <template slot-scope="scope">
                  <div class="font-13 color-666 text-center">创建时间</div>
                  <div class="font-13 color-333 text-center m-t-10">{{ scope.row.createTime }}</div>
                </template>
              </el-table-column>
              <el-table-column
                width="180">
                <template slot-scope="scope">
                  <div class="font-13 color-666 text-center">临期预警</div>
                  <div class="m-t-10 f-r f-r-center">
                    <el-switch
                      :disabled="scope.row.status===3"
                      v-model="scope.row.expirationNotifyStatus===1?true:false"
                      active-color="#13ce66"
                      @change="updateStatus(scope.row)">
                    </el-switch>
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                fixed="right"
                align="center"
                width="300">
                <template slot-scope="scope">
                  <el-button
                    size="mini"
                    type="success"
                    v-if="scope.row.status!==3"
                    @click="warnSetting(scope.row)">预警设置
                  </el-button>
                  <el-button
                    v-if="scope.row.status!==3"
                    size="mini"
                    @click="sendCode(scope.row.id)">发送短信
                  </el-button>
                  <el-button
                    size="mini"
                    type="warning"
                    @click="moneySetting(scope.row.id)">下达投资
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <div class="f-r f-r-end page-box">
            <el-pagination
              :current-page="page.pageNum"
              :page-sizes="[5, 10, 20, 50, 100, 200, 300, 400, 500]"
              :page-size="page.pageSize"
              layout="total, sizes, prev, pager, next, jumper"
              :total="page.total"
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
            />
          </div>
        </el-col>
      </el-row>
    </el-card>
    <!-- 预警设置 -->
    <warning-setting v-if="warningShow" :setting="comSetting" @close="warningShow=false" @search="search(1)"></warning-setting>
    <!-- 下达投资 -->
    <money-setting v-if="moneyShow" :setting="comSetting" @close="moneyShow=false" @search="search(1)"></money-setting>
    <!-- 详情 -->
    <detail v-if="detailShow" :setting="comSetting" @close="detailShow=false"></detail>
  </div>
</template>
 
<script>
import items from './items'
import * as information from '@/api/projectManage/information'
import warningSetting from  '@/views/projectManage/information/components/warningSetting'
import moneySetting from  '@/views/projectManage/information/components/moneySetting'
import detail from  '@/views/projectManage/information/detail'
import * as classify from "@/api/projectManage/classify";
import {updateInfoStatus} from "@/api/projectManage/information";
export default {
  name: "index",
  components: { warningSetting,moneySetting,detail },
  data() {
    return {
      loading:false,
      warningShow:false, // 预警设置
      moneyShow:false, // 下达投资
      detailShow:false, // 详情
      comSetting:{
        id:"",
        title:""
      },
      curId:null, // 当前顶部类型Id
      // 搜索框
      items: items,
      // 树数据
      treeDataList: [],
      // 搜索条件
      filterFrom: {
        projectName: null,  // 项目总数
        projectCode: null, // 项目编号
        projectCategoryId: null, // 类型
        buildOrgId: null, // 建设单位
        expirationNotifyStatus: null, // 临时预警  0关闭 1开启
        approvalDate: null, // 批复时间
        createTime: null // 创建时间
      },
      topInfo: {
        projectTotal: 0,  // 项目总数
        awaitNum: 0,  // 未开工
        ingNum: 0,  // 进行中
        postponeNum: 0,  // 已延期
        endNum: 0,  // 已完成
        cancelNum: 0,  // 已取消
      },
      page: {
        pageNum: 1,
        pageSize: 10,
        total: 0
      },
      tableData: [] // 列表数据
    }
  },
  mounted() {
    this.getTopInfo()
    this.search(1)
  },
  methods: {
    // 修改当前行预警状态
    updateStatus(row){
      let vm = this
      let text = row.expirationNotifyStatus == 1 ? "关闭" : "开启";
      vm.$modal.confirm('确认要' + text +'吗?').then(function() {
        let params = Object.assign({},row)
        params.status = row.expirationNotifyStatus == 1 ? 0 : 1
        information.updateInfoStatus(params).then(res=>{
          if(res){
            row.status = row.expirationNotifyStatus == 1 ? 0 : 1
            vm.$message.success(text + "成功");
            vm.search()
          }
        })
      })
    },
    // 详情
    toDetail(id){
      this.comSetting = {
        id,
        title:'项目详情'
      }
      this.detailShow = true
    },
    changeType(e){
      this.curId = e
    },
    getTopInfo() {
      information.getTotal().then(res => {
        this.topInfo = res
      })
    },
    //分页
    handleSizeChange(pageSize) {
      this.page.pageSize = pageSize;
      this.search(1);
    },
    handleCurrentChange(pageNum) {
      this.page.pageNum = pageNum;
      this.search(1);
    },
    // 查询table列表
    search(pageNum) {
      if(pageNum){
        this.page.pageNum = pageNum
      }
      this.loading = true
      let params = Object.assign(this.filterFrom, this.page)
      information.getInfolist(params).then(res => {
        this.tableData = res.datas
        this.page = {
          pageIndex: res.pageIndex,
          pageSize: res.pageSize,
          totalRows: res.totalRows
        }
        this.loading = false
      })
    },
    fifterForm(params) {
      this.filterFrom = Object.assign(this.filterFrom, params)
      this.search(1)
    },
    getStatusText(state) {
      // 0 未开工 1 进行中 2 已完成 3 已取消 4 已延期
      let obj = {
        text: '',
        type: 'success'
      }
      switch (state) {
        case 0:
          obj.text = '未开工'
          obj.type = 'info'
          break
        case 1:
          obj.text = '进行中'
          obj.type = 'primary'
          break
        case 2:
          obj.text = '已完成'
          obj.type = 'success'
          break
        case 3:
          obj.text = '已取消'
          obj.type = 'warning'
          break
        case 4:
          obj.text = '已延期'
          obj.type = 'danger'
          break
      }
      return obj
    },
    warnSetting(row){
      this.comSetting = {
        id:row.id,
        createOrgId:row.createOrgId,
        tempExpirationNotifyId: row.tempExpirationNotifyId,
        title:'预警设置'
      }
      this.warningShow = true
    },
    sendCode(){
 
    },
    // 下达投资
    moneySetting(id){
      this.comSetting = {
        id,
        title:'下达投资'
      }
      this.moneyShow = true
    }
  }
}
</script>
 
<style scoped>
.total-item {
  width: 15%;
  padding: 12px 20px;
  border-radius: 8px;
  background-color: #eeeeee;
}
 
.total-item:hover {
  cursor: pointer;
  background-color: #0D997C;
}
.total-item:hover .total-num,.total-item:hover .total-title {
  color: #ffffff;
}
.total-active{
  background-color: #0D997C;
}
.total-active .total-num,.total-active .total-title{
  color: #ffffff;
}
.total-title {
  font-size: 14px;
  color: #666;
  text-align: center;
}
 
.total-num {
  font-size: 22px;
  margin-top: 5px;
  color: #333;
  font-weight: bold;
  text-align: center;
}
.project-name {
  letter-spacing: 1px;
  font-size: 16px;
  color: #333333;
  cursor: pointer;
}
.project-name:hover{
  color: #0D997C;
}
.m-t-10 {
  margin-top: 10px;
}
</style>