zhouwenxuan
2024-01-22 9cd375c82cf24394ed94180149bba732a0e90446
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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
<template>
  <div class="project-container">
    <div class="header">
      <el-button type="success" icon="Plus" @click="toProcess('add',{})">新增</el-button>
      <vue3-json-excel
          :json-data="dataList"
          :fields="fields"
          name="项目信息表.xlsx"
          style="margin-right: 5px;margin-left: 5px"
      >
        <el-button type="warning">导出</el-button>
      </vue3-json-excel>
      <el-button type="primary"  icon="Filter" @click="showDrawer = true">筛选</el-button>
    </div>
    <div class="middle">
      <div class="card-box">
        <div class="box-left" @click="choose('')">
          <div class="font-left">
            <div>项目</div>
            <div>总数</div>
          </div>
          <div class="font-right">{{search.num.projectTotal}}</div>
        </div>
        <div class="box-right">
          <div class="inbox" @click="choose(1)" style="box-shadow: rgba(132, 122, 253, 0.2) 0 3px 5px 0;" :class="{btn1: chooseType === 1}">
            <div class="top" style="background: linear-gradient(90deg, rgb(127, 118, 253), rgb(218, 180, 246));">
              <span class="top-right-font">风险分析及计划评价</span>
            </div>
            <div class="bottom">
              <span class="top-right-font-bottom">{{search.num.riskTotal}}</span>
            </div>
          </div>
          <div class="inbox" @click="choose(2)" style="box-shadow: rgba(255, 142, 139, 0.15) 0 3px 5px 0;" :class="{btn2: chooseType === 2}">
            <div class="top" style="background: linear-gradient(90deg, rgb(255, 140, 138), rgb(239, 186, 141));">
              <span class="top-right-font">现场勘验</span>
            </div>
            <div class="bottom">
              <span class="top-right-font-bottom">{{search.num.investigationTotal}}</span>
            </div>
          </div>
          <div class="inbox"  @click="choose(3)" style="box-shadow: rgba(222, 106, 169, 0.15) 0 3px 5px 0;" :class="{btn3: chooseType === 3}">
            <div class="top" style="background: linear-gradient(90deg, rgb(229, 119, 180), rgb(249, 159, 192));">
              <span class="top-right-font">项目审核</span>
            </div>
            <div class="bottom">
              <span class="top-right-font-bottom">{{search.num.reviewTotal}}</span>
            </div>
          </div>
          <div class="inbox" @click="choose(4)" style="box-shadow: rgba(109, 177, 254, 0.2) 0 3px 5px 0;" :class="{btn4: chooseType === 4}">
            <div class="top" style="background: linear-gradient(90deg, rgb(54, 115, 255), rgb(124, 196, 242));">
              <span class="top-right-font">出具报告</span>
            </div>
            <div class="bottom">
              <span class="top-right-font-bottom">{{search.num.reportTotal}}</span>
            </div>
          </div>
          <div class="inbox" @click="choose(5)" style="box-shadow: rgba(88, 211, 137, 0.2) 0 3px 5px 0;" :class="{btn5: chooseType === 5}">
            <div class="top" style="background: linear-gradient(90deg, rgb(0, 195, 151), rgb(114, 232, 200));">
              <span class="top-right-font">项目归档</span>
            </div>
            <div class="bottom">
              <span class="top-right-font-bottom">{{search.num.archiveTotal}}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 表格数据 -->
    <el-table v-loading="loading" :data="dataList" :border="true" ref="tableRef" :height="tableHeight" style="width: 100%;">
      <el-table-column label="序号" width="80" align="center" type="index" ></el-table-column>
      <el-table-column label="项目名称" prop="name" align="center" :show-overflow-tooltip="true" width="180" />
      <el-table-column label="委托单位" prop="client" align="center"  :show-overflow-tooltip="true" width="180"/>
      <el-table-column label="所属地市" align="center"  width="250">
        <template #default="scope">
         {{scope.row.area}}
        </template>
      </el-table-column>
      <el-table-column label="评价类型" prop="estimateTypeName" align="center"  width="150"/>
      <el-table-column label="业务范围" prop="businessName" align="center" :show-overflow-tooltip="true" width="150"/>
      <el-table-column label="项目负责人" prop="leaderName" align="center"  width="120" :show-overflow-tooltip="true"/>
      <el-table-column label="项目阶段" align="center"  width="200">
        <template #default="scope">
          <div v-if="scope.row.process === 1" class="process1">
            <span>风险分析及计划评价</span>
          </div>
          <div v-else-if="scope.row.process === 2" class="process1 process2">
            <span>现场勘验</span>
          </div>
          <div v-else-if="scope.row.process === 3" class="process1 process3">
            <span>项目审核</span>
          </div>
          <div v-else-if="scope.row.process === 4" class="process1 process4">
            <span>出具报告</span>
          </div>
          <div v-else class="process1 process5">
            <span>项目归档</span>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="项目实施天数" prop="filingDate" align="center"  width="150"/>
      <el-table-column label="项目变更" prop="" align="center"  width="120">
        <template #default="scope">
          <div style="cursor:pointer;color: #3b82f6;" >
            <span v-if="scope.row.process !== 1" @click="goMenu('toFive',scope.row)">{{}}</span>
            <span v-else></span>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="预估金额(万元)" prop="contractMoney" align="center"  width="130"/>
      <el-table-column label="归档金额(万元)" prop="actualContractMoney" align="center"  width="130"/>
      <el-table-column label="缺失要件"  align="center"  width="150">
        <template #default="scope">
          <div style="cursor:pointer;color: #3b82f6;" >
            <span v-if="scope.row.process === 5" @click="goMenu('toTwelve',scope.row)">{{scope.row.materialCnt}}</span>
            <span v-else></span>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="归档确认" prop="" align="center"  width="150">
        <template #default="scope">
          <div style="cursor:pointer;color: #3b82f6;" >
            <span v-if="scope.row.process === 5" @click="goMenu('toThirteen',scope.row)">{{}}</span>
            <span v-else></span>
          </div>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" width="180">
        <template #default="scope">
          <el-button link type="primary" @click="toProcess('view',scope.row)">查看</el-button>
          <el-button link type="primary" @click="toProcess('edit',scope.row)">编辑</el-button>
          <el-button link type="danger" @click="del(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
 
    <div class="pag-container">
      <el-pagination
          v-model:current-page="search.queryParams.pageNum"
          v-model:page-size="search.queryParams.pageSize"
          :page-sizes="[10,15,20,25]"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
      />
    </div>
    <el-drawer v-model="showDrawer" :direction="direction" :with-header="false"  :size="size" >
      <template #default>
      <div class="drawer">
        <el-form ref="drawerRef"  class="register-form" label-position="top">
            <el-form-item label="时间选择">
              <el-date-picker
                  v-model="searchTime"
                  type="daterange"
                  @change="changeTime"
                  range-separator="至"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                  value-format="YYYY-MM-DD"
              />
            </el-form-item>
          <el-form-item  label="所属区域">
            <el-cascader
                v-model="area"
                :options="addressList"
                :props="props"
                @change="handleChange"
                style="width: 100%"
                size="large"
            />
          </el-form-item>
          <el-form-item  label="项目名称" >
            <el-input v-model="search.queryParams.name" placeholder="请输入项目名称"></el-input>
          </el-form-item>
          <el-form-item  label="委托单位">
            <el-input v-model="search.queryParams.client" placeholder="委托单位"></el-input>
          </el-form-item>
          <el-form-item  label="业务范围">
            <el-select v-model="search.queryParams.business" class="m-2" size="large" placeholder="请选择" style="width: 100%" >
              <el-option
                  v-for="item in businessList"
                  :key="item.id"
                  :label="item.label"
                  :value="item.id"
              />
            </el-select>
          </el-form-item>
          <el-form-item  label="评价类型">
            <el-select v-model="search.queryParams.estimateType" class="m-2" size="large" placeholder="请选择" style="width: 100%" >
              <el-option
                  v-for="item in estimateTypeList"
                  :key="item.id"
                  :label="item.label"
                  :value="item.id"
              />
            </el-select>
          </el-form-item>
          <el-form-item  label="缺失要件">
            <el-select v-model="search.queryParams.params.lostMaterial" class="m-2" size="large" placeholder="请选择" style="width: 100%" >
              <el-option
                  v-for="item in missingList"
                  :key="item.id"
                  :label="item.label"
                  :value="item.id"
              />
            </el-select>
          </el-form-item>
 
        </el-form>
      </div>
      </template>
      <template #footer>
        <div style="flex: auto">
          <el-button type="primary" @click="searchClick">查询</el-button>
          <el-button type="warning" @click="reset">重置</el-button>
          <el-button @click="confirmClick">取消</el-button>
 
        </div>
      </template>
    </el-drawer>
 
  </div>
 
</template>
 
<script setup>
import {onMounted, reactive, ref} from "vue";
import {delProject, getProjectList, getProjectStatistics} from "@/api/projectManage/project";
import {ElMessage, ElMessageBox} from "element-plus";
import {getRegionTree} from "@/api/area";
import {getDict} from "@/api/login";
import {getDictList} from "@/api/backManage/evaluate";
const router = useRouter();
 
const loading = ref(false);
const direction = ref('rtl');
const showDrawer = ref(false);
const size = ref('400px')
const props = {
  expandTrigger: 'hover',
  value: 'name',
  label: 'name'
}
const search = reactive({
  queryParams: {
    pageNum: 1,
    pageSize: 20,
    name: '',
    client: '',
    province: '',
    city: '',
    district: '',
    business: '',
    estimateType: '',
    params:{
      projectPhase: '',
      lostMaterial: null
    }
  },
  num: {
    projectTotal: 0,
    riskTotal: 0,
    investigationTotal: 0,
    reviewTotal: 0,
    reportTotal: 0,
    archiveTotal: 0
  }
});
const searchTime = ref([]);
const area = ref([]);
const businessList = ref([]);
const addressList = ref([]);
const estimateTypeList = ref([]);
const missingList = ref([
  {
    id: 1,
    label: '是'
  },
  {
    id: 0,
    label: '否'
  }
])
const tableRef  = ref(null);
const tableHeight = ref(0);
const dataList = ref([]);
const total = ref(0);
 
onMounted(() => {
  getList();
  getStatistics();
  getArea();
  getBusinessList();
  getRiskList();
  tableHeight.value = window.innerHeight - tableRef.value.$el.offsetTop - 170;
  // 监听浏览器高度变化
  window.onresize = () => {
    tableHeight.value = window.innerHeight - tableRef.value.$el.offsetTop - 170;
  };
 
});
const chooseType = ref('');
const choose = (val) => {
  chooseType.value = val;
  search.queryParams.params.projectPhase = val;
  getList();
}
const getList = async () => {
  loading.value = true;
  console.log(search.queryParams,'search.queryParams')
  const res = await getProjectList(search.queryParams);
  if(res.code == 200){
    dataList.value = res.data.list.map(item => {
      return {
        ...item,
        process: item.reportProgress <= 4 ? 1 : item.reportProgress > 4 && item.reportProgress <= 6 ? 2 : item.reportProgress > 6 && item.reportProgress <= 9 ? 3 : item.reportProgress > 9 && item.reportProgress <= 11 ? 4 : 5,
        leaderName: item.leader ? item.leader.name : '',
        area: item.district ? item.province + '/' + item.city + '/' + item.district : item.city?item.province + '/' + item.city:item.province ,
        filingDate: item.filingDate ? item.filingDate : conversionDays(item.createTime),
        contractMoney: item.contract ? item.contract.contractMoney : '',
        actualContractMoney: item.contract ? item.contract.actualContractMoney : ''
      }
    })
    total.value = res.data.total
    loading.value = false;
  }else{
    ElMessage.warning(res.message)
  }
}
const getStatistics = async () => {
  const {pageNum,pageSize, ...data} = JSON.parse(JSON.stringify(search.queryParams))
  console.log("data",data)
  const res = await getProjectStatistics(data);
  if(res.code == 200){
   console.log("res统计",res)
    search.num = res.data
 
  }else{
    ElMessage.warning(res.message)
  }
}
const handleSizeChange = (val) => {
  search.queryParams.pageNum = 1;
  search.queryParams.pageSize = val
  getList()
}
const handleCurrentChange = (val) => {
  search.queryParams.pageNum = val
  getList()
}
const toProcess = (type,value,toPath) => {
  value.type = type;
  router.push({ path: '/process', query: {id: value.id, type: type, toPath: toPath}});
}
 
const getArea = async ()=>{
  const type = 1
  const res = await getRegionTree({name: '',parentId: null,regionType: type})
  if(res.code == 200){
   addressList.value = res.data
  }else{
    ElMessage.warning(res.message)
  }
}
const getBusinessList = async () => {
  const res = await getDict({dictType: 'sys_business_scope'})
  if(res.code === 200){
    businessList.value = res.data
  }else{
    ElMessage.warning(res.message)
  }
}
const getRiskList = async () => {
  const res = await getDictList({dictType: "sys_assess_type"});
  if(res.code === 200){
    estimateTypeList.value = res.data.list
  }else{
    ElMessage.warning(res.message)
  }
}
 
const del = (val) => {
  ElMessageBox.confirm(
      '确定删除此条数据?',
      '提示',
      {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
      .then( async() => {
        const res = await delProject(val)
        if(res.code == 200){
          ElMessage.success('数据删除成功')
          getList()
        }else{
          ElMessage.warning(res.message)
        }
      })
}
const confirmClick = () => {
  showDrawer.value = false;
}
const changeTime=(value)=>{
  if(!value){
    search.queryParams.params.endTime = ""
    search.queryParams.params.startTime = ""
  }
}
const searchClick = () => {
  if(searchTime.value && searchTime.value.length>0){
    search.queryParams.params.startTime = searchTime.value[0]
    search.queryParams.params.endTime = searchTime.value[1]
  }
  getList();
  getStatistics();
  showDrawer.value = false;
}
const reset = () => {
  searchTime.value = [];
  area.value = [];
  search.queryParams = {
    pageNum: 1,
    pageSize: 20,
    name: '',
    client: '',
    province: '',
    city: '',
    district: '',
    business: '',
    estimateType: '',
  }
  search.queryParams.params = {}
  getList();
  getStatistics();
  showDrawer.value = false;
}
const conversionDays = (createTime) => {
  let day = Date.now() - new Date(createTime).getTime();//日期转时间戳
  return Math.floor(day / 86400000) ;//时间戳获取天数
}
const handleChange = (value) => {
  // if(state.registerForm.agency.attribute == 0){
  //   state.registerForm.agency.province = '新疆维吾尔自治区'
  //   state.registerForm.agency.city = value[0]?value[0]:''
  //   state.registerForm.agency.district  = value[1]?value[1]:''
  // }else{
  search.queryParams.province = value[0]?value[0]:''
  search.queryParams.city = value[1]?value[1]:''
  search.queryParams.district  = value[2]?value[2]:''
  // }
}
// 导出表格
const fields = ref({
  '项目名称':'name',
  '委托单位':'client',
  '所属地市': 'area',
  '评价类型': 'estimateTypeName',
  '业务范围': 'businessName',
  '项目负责人': 'leaderName',
  '项目阶段': {
    field: 'process',
    callback: (value) => {
      if (value === 1) {
        return '风险分析及计划评价'
      } else if(value === 2){
        return '现场勘验'
      }else if(value === 3){
        return '项目审核'
      }else if(value === 4){
        return '出具报告'
      }else if(value === 5){
        return '项目归档'
      }
    }
  },
  '项目实施天数': 'filingDate',
  '项目变更': '',
  '预估金额(万元)': 'contractMoney',
  '归档金额(万元)': 'actualContractMoney',
  '缺失要件': 'materialCnt',
  '归档确认': ''
});
const goMenu = (toPath,val) => {
  console.log("val",val)
  toProcess('edit',val,toPath);
}
 
 
</script>
 
<style scoped lang="scss">
.project-container{
  .header{
    margin: 15px 10px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }
  .middle{
    height: 99px;
    margin-bottom: 20px;
  }
  .card-box{
    margin: 20px;
    height: 99px;
    background: #fff;
    box-shadow: 0 3px 10px 0 rgba(62,62,62,.25);
    border-radius: 10px;
    display: flex;
    .box-left{
      width: 20%;
      min-width: 200px;
      height: 99px;
      background: #fff;
      box-shadow: 0 0 5px 0 rgba(62,62,62,.2);
      border-radius: 10px;
      display: flex;
      margin-left: -15px;
      align-items: center;
      cursor: pointer;
      padding-left: 2%;
      .font-left{
        width: 40px;
        height: 40px;
        font-size: 20px;
        font-weight: 400;
        color: #9198ad;
        line-height: 18px;
        font-family: fantasy;
      }
      .font-right{
        position: relative;
        left: 7%;
        top: -3px;
        height: 40px;
        font-size: 36px;
        font-family: fantasy;
        font-weight: 400;
        color: #222733;
      }
    }
    .box-left:hover{
      border: 1px solid #4378f1
    }
    .box-right{
      width: 80%;
      height: 99px;
      border-radius: 10px;
      margin-left: 15px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      .inbox{
        width: 19%;
        height: 76px;
        background: #fff;
        border-radius: 5px;
        cursor: pointer;
        .top{
          width: 100%;
          height: 39px;
          border-top-left-radius: 5px;
          border-top-right-radius: 5px;
          .top-right-font{
            font-size: 16px;
            color: #fff;
            line-height: 39px;
            margin-left: 10px;
          }
        }
        .bottom{
          height: 37px;
          .top-right-font-bottom{
            font-size: 20px;
            color: #333;
            line-height: 37px;
            margin-left: 20px;
            font-family: fantasy;
          }
        }
      }
      .inbox:nth-child(1):hover{
        border: 1px solid #dab4f6;
      }
      .inbox:nth-child(2):hover{
        border: 1px solid #efba8d;
      }
      .inbox:nth-child(3):hover{
        border: 1px solid #f99fc0;
      }
      .inbox:nth-child(4):hover{
        border: 1px solid #7cc4f2;
      }
      .inbox:nth-child(5):hover{
        border: 1px solid #72e8c8;
      }
    }
  }
  .btn1{
    border: 1px solid #dab4f6;
  }
  .btn2{
    border: 1px solid #efba8d;
  }
  .btn3{
    border: 1px solid #f99fc0;
  }
  .btn4{
    border: 1px solid #7cc4f2;
  }
  .btn5{
    border: 1px solid #72e8c8;
  }
  .pag-container{
    float: right;
    margin-top: 20px;
  }
  .process1{
    border-radius: 5px;
    color: rgb(255, 255, 255);
    padding: 5px 10px;
    background: linear-gradient(90deg, rgb(127, 118, 253), rgb(218, 180, 246));
  }
  .process2{
    background: linear-gradient(90deg, rgb(255, 140, 138), rgb(239, 186, 141));
  }
  .process3 {
    background: linear-gradient(90deg, rgb(229, 119, 180), rgb(249, 159, 192));;
  }
  .process4 {
    background: linear-gradient(90deg, rgb(54, 115, 255), rgb(124, 196, 242));;
  }
  .process5 {
    background: linear-gradient(90deg, rgb(0, 195, 151), rgb(114, 232, 200));;
  }
  .drawer{
    :deep(.el-form .el-form-item__label) {
      font-size: 15px;
    }
  }
 
}
</style>