董国庆
2025-04-11 aa6ab634ff987ad35d960efcad6eb0f7c6af6ea7
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
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
<template>
  <el-dialog
    :title="type === 'audit' ? '审批安置户申请信息' : '安置户申请信息'"
    :visible.sync="dialogVisible"
    width="80%"
    :close-on-click-modal="false"
    :append-to-body="true"
  >
    <div class="approval-content">
      <!-- 左侧表格区域 -->
      <div class="table-container">
        <el-table
          v-loading="loading"
          element-loading-text="加载中..."
          element-loading-spinner="el-icon-loading"
          element-loading-background="rgba(255, 255, 255, 0.8)"
          :data="tableData"
          border
          style="width: 100%"
          :row-class-name="tableRowClassName"
          height="400"
        >
          <el-table-column
            type="index"
            label="序号"
            width="50"
            align="center"
          />
          <el-table-column
            prop="street"
            label="镇(街道)"
            align="center"
            width="80"
          >
            <template slot-scope="scope">
              {{ scope.row.street }}
            </template>
          </el-table-column>
          <el-table-column
            prop="projectName"
            label="拆迁项目名称"
            align="center"
            width="150"
          >
            <template slot-scope="scope">
              {{ scope.row.projectName }}
            </template>
          </el-table-column>
          <el-table-column
            prop="community"
            label="所在村(社区)"
            align="center"
            width="100"
          >
            <template slot-scope="scope">
              {{ scope.row.community }}
            </template>
          </el-table-column>
          <el-table-column
            prop="demolitionTime"
            label="拆迁时间"
            align="center"
            width="100"
          >
            <template slot-scope="scope">
              {{ scope.row.demolitionTime }}
            </template>
          </el-table-column>
          <el-table-column
            prop="householdHead"
            label="户主名称"
            align="center"
            width="80"
          >
            <template slot-scope="scope">
              {{ scope.row.householdHead }}
            </template>
          </el-table-column>
          <el-table-column
            prop="idCard"
            label="身份证号"
            align="center"
            width="180"
          >
            <template slot-scope="scope">
              {{ scope.row.idCard }}
              <el-tooltip
                v-if="scope.row.idCardExistsWarn == 1"
                placement="top"
              >
                <div slot="content">{{ "身份证不在安置库" }}</div>
                <el-image
                  style="width: 12px; height: 12px; margin-left: 5px"
                  :src="require('../../../assets/logo/warning.png')"
                  :fit="fit"
                ></el-image>
              </el-tooltip>
              <el-tooltip v-if="scope.row.idCardNoWarn == 1" placement="top">
                <div slot="content">{{ "身份证重复" }}</div>
                <el-image
                  style="width: 12px; height: 12px; margin-left: 5px"
                  :src="require('../../../assets/logo/warning.png')"
                  :fit="fit"
                ></el-image>
              </el-tooltip>
            </template>
          </el-table-column>
          <el-table-column
            prop="mobile"
            label="联系电话"
            align="center"
            width="120"
          >
            <template slot-scope="scope">
              {{ scope.row.mobile }}
            </template>
          </el-table-column>
          <el-table-column label="本次安置人数(人)" align="center">
            <el-table-column
              prop="currentCollectiveNum"
              label="集体经济组织成员"
              align="center"
              width="120"
            >
              <template slot-scope="scope">
                {{ scope.row.currentCollectiveNum }}
              </template>
            </el-table-column>
            <el-table-column
              prop="currentNoCollectiveNum"
              label="非集体经济组织成员"
              align="center"
              width="120"
            >
              <template slot-scope="scope">
                {{ scope.row.currentNoCollectiveNum }}
              </template>
            </el-table-column>
            <el-table-column
              prop="currentCount"
              label="合计"
              align="center"
              width="60"
            >
              <template slot-scope="scope">
                {{ scope.row.currentCount }}
              </template>
            </el-table-column>
          </el-table-column>
          <el-table-column
            prop="waitFamilyNames"
            label="待安置家庭成员姓名"
            align="center"
            width="120"
          >
            <template slot-scope="scope">
              {{ scope.row.waitFamilyNames }}
              <el-tooltip
                v-if="scope.row.waitFamilyNamesWarn == 1"
                placement="top"
              >
                <div slot="content">{{ "身份信息存在重复数据" }}</div>
                <el-image
                  style="width: 12px; height: 12px; margin-left: 5px"
                  :src="require('../../../assets/logo/warning.png')"
                  :fit="fit"
                ></el-image>
              </el-tooltip>
              <el-tooltip
                v-if="scope.row.waitFamilyNamesNoWarn == 1"
                placement="top"
              >
                <div slot="content">{{ "不在安置库" }}</div>
                <el-image
                  style="width: 12px; height: 12px; margin-left: 5px"
                  :src="require('../../../assets/logo/warning.png')"
                  :fit="fit"
                ></el-image>
              </el-tooltip>
            </template>
          </el-table-column>
          <el-table-column
            prop="waitFamilyArea"
            label="待安置人员应安置面积合计(㎡)"
            align="center"
            width="120"
          >
            <template slot-scope="scope">
              {{ scope.row.waitFamilyArea }}
              <el-tooltip
                v-if="scope.row.waitFamilyAreaWarn == 1"
                placement="top"
              >
                <div slot="content">{{ "应补偿面积数据异常" }}</div>
                <el-image
                  style="width: 12px; height: 12px; margin-left: 5px"
                  :src="require('../../../assets/logo/warning.png')"
                  :fit="fit"
                ></el-image>
              </el-tooltip>
            </template>
          </el-table-column>
          <el-table-column label="补偿金额(万元)" align="center">
            <el-table-column
              prop="compensationNewAmount"
              label="新建商品住房、商业用房、停车位"
              align="center"
              width="100"
            >
              <template slot-scope="scope">
                {{ scope.row.compensationNewAmount }}
                <el-tooltip
                  v-if="scope.row.compensationAmountWarn == 1"
                  placement="top"
                >
                  <div slot="content">
                    {{ "检测到多个购房情况,请人工核对" }}
                  </div>
                  <i
                    class="el-icon-warning-outline"
                    style="color: #e6a23c; margin-left: 5px"
                  ></i>
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column
              prop="compensationOldAmount"
              label="二手住房"
              align="center"
              width="80"
            >
              <template slot-scope="scope">
                {{ scope.row.compensationOldAmount }}
              </template>
            </el-table-column>
            <el-table-column
              prop="compensationSum"
              label="合计"
              align="center"
              width="60"
            >
              <template slot-scope="scope">
                {{ scope.row.compensationSum }}
                <el-tooltip
                  v-if="scope.row.compensationSumWarn == 1"
                  placement="top"
                >
                  <div slot="content">{{ "补偿标准金额异常" }}</div>
                  <i
                    class="el-icon-warning-outline"
                    style="color: #e6a23c; margin-left: 5px"
                  ></i>
                </el-tooltip>
              </template>
            </el-table-column>
          </el-table-column>
          <el-table-column
            prop="downPaymentAmount"
            label="25%首付款(万元)"
            align="center"
            width="130"
          >
            <template slot-scope="scope">
              {{ scope.row.downPaymentAmount }}
            </template>
          </el-table-column>
          <el-table-column
            prop="quarterPayAmount"
            label="每季度需支付款项(万元)"
            align="center"
            width="120"
          >
            <template slot-scope="scope">
              {{ scope.row.quarterPayAmount }}
              <el-tooltip
                v-if="scope.row.quarterPayAmountWarn == 1"
                placement="top"
              >
                <div slot="content">{{ "季度款金额异常" }}</div>
                <el-image
                  style="width: 12px; height: 12px; margin-left: 5px"
                  :src="require('../../../assets/logo/warning.png')"
                  :fit="fit"
                ></el-image>
              </el-tooltip>
            </template>
          </el-table-column>
          <el-table-column
            prop="subsidyAmount"
            label="过渡补贴(万元)"
            align="center"
            width="60"
          >
            <template slot-scope="scope">
              {{ scope.row.subsidyAmount }}
              <el-tooltip
                v-if="scope.row.subsidyAmountWarn == 1"
                placement="top"
              >
                <div slot="content">{{ "过度补贴数据异常" }}</div>
                <el-image
                  style="width: 12px; height: 12px; margin-left: 5px"
                  :src="require('../../../assets/logo/warning.png')"
                  :fit="fit"
                ></el-image>
              </el-tooltip>
            </template>
          </el-table-column>
          <el-table-column prop="remark" label="备注" align="center" width="60">
            <template slot-scope="scope">
              {{ scope.row.remark }}
            </template>
          </el-table-column>
          <el-table-column
            prop="situation"
            label="购房差异情况"
            align="center"
            width="60"
          >
            <template slot-scope="scope">
              {{ scope.row.situation }}
            </template>
          </el-table-column>
        </el-table>
      </div>
 
      <!-- 右侧审核信息 -->
      <div class="approval-info">
        <div class="approver-timeline">
          <!-- 审核状态下显示审批人和等待审核按钮 -->
          <template v-if="type === 'audit'">
            <div class="timeline-item">
              <div class="timeline-icon">
                <el-avatar
                  size="small"
                  icon="el-icon-user"
                  :style="{ background: '#6d78ff' }"
                ></el-avatar>
              </div>
              <div class="timeline-content info-box">
                <div class="info-line">
                  <div class="approver-info">
                    <div class="approver-title">提交人:</div>
                    <div class="approver-name">
                      {{ approvalInfo.createUser }}
                    </div>
                  </div>
                  <div class="approval-time-info">
                    <div class="approval-time-title">提交时间:</div>
                    <div class="approval-time">
                      {{ approvalInfo.createTime }}
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="timeline-divider"></div>
            <div class="timeline-item">
              <div class="timeline-icon">
                <el-avatar
                  size="small"
                  icon="el-icon-time"
                  :style="{ background: '#909399' }"
                ></el-avatar>
              </div>
              <div class="timeline-content">
                <el-button size="small" disabled class="waiting-btn"
                  >等待审核</el-button
                >
              </div>
            </div>
          </template>
          <!-- 详情状态下显示经办人和审核人 -->
          <template v-else>
            <div class="timeline-item">
              <div class="timeline-icon">
                <el-avatar
                  size="small"
                  icon="el-icon-user"
                  :style="{ background: '#6d78ff' }"
                ></el-avatar>
              </div>
              <div class="timeline-content info-box">
                <div class="info-line">
                  <div class="approver-info">
                    <div class="approver-title">提交人:</div>
                    <div class="approver-name">
                      {{ approvalInfo.createUser }}
                    </div>
                  </div>
                  <div class="approval-time-info">
                    <div class="approval-time-title">提交时间:</div>
                    <div class="approval-time">
                      {{ approvalInfo.createTime }}
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="timeline-divider"></div>
            <div class="timeline-item">
              <div class="timeline-icon">
                <el-avatar
                  size="small"
                  icon="el-icon-user"
                  :style="{ background: '#6d78ff' }"
                ></el-avatar>
              </div>
              <div class="timeline-content info-box">
                <div class="info-line">
                  <div class="approver-info">
                    <div class="approver-title">审核人:</div>
                    <div class="approver-name">
                      {{ approvalInfo.approveName }}
                    </div>
                  </div>
                  <div class="approval-time-info">
                    <div class="approval-time-title">审核时间:</div>
                    <div class="approval-time">
                      {{ approvalInfo.approveTime }}
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </template>
        </div>
      </div>
    </div>
 
    <!-- 警告信息 -->
    <div class="warning-info" v-if="hasWarning && type === 'audit'">
      <div class="warning-text">
        注意: 系统检测到该申请表中存在异常数据,请仔细核实!
      </div>
    </div>
 
    <!-- 审核结果区域 -->
    <div class="audit-section">
      <div class="audit-result">
        <div class="result-label">审核结果</div>
        <div class="result-options">
          <el-button-group>
            <el-button
              :disabled="type === 'detail'"
              :type="form.auditResult === '通过' ? 'primary' : ''"
              @click="form.auditResult = '通过'"
              >通过</el-button
            >
            <el-button
              :disabled="type === 'detail'"
              :type="form.auditResult === '驳回' ? 'primary' : ''"
              @click="form.auditResult = '驳回'"
              >驳回</el-button
            >
          </el-button-group>
        </div>
      </div>
 
      <div class="audit-comment">
        <div class="comment-label">审批意见</div>
        <el-input
          type="textarea"
          :rows="4"
          placeholder="请输入审批意见"
          v-model="form.auditComment"
          :disabled="type === 'detail'"
        ></el-input>
      </div>
    </div>
 
    <!-- 底部按钮 - 仅审核模式显示 -->
    <div slot="footer" class="dialog-footer" v-if="type === 'audit'">
      <el-button @click="cancelAudit">取消</el-button>
      <el-button type="primary" @click="submitAudit">确认</el-button>
    </div>
  </el-dialog>
</template>
 
<script>
import { geDetailTabletList, approve } from "@/api/application-batch";
export default {
  name: "ApprovalDialog",
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    type: {
      type: String,
      default: "audit", // 'audit' 或 'detail'
      validator: function (value) {
        return ["audit", "detail"].indexOf(value) !== -1;
      },
    },
    id: {
      type: [Number],
      required: true,
      default: 0,
    },
  },
  data() {
    return {
      loading: false,
      dialogVisible: false,
      hasWarning: false,
      tableData: [],
      form: {
        auditResult: "通过",
        auditComment: "",
      },
      // 审批信息
      approvalInfo: {
        approver: "",
        approvalTime: "",
        operatorName: "",
        submitTime: "",
        auditorName: "",
        auditTime: "",
      },
    };
  },
  watch: {
    visible(val) {
      this.dialogVisible = val;
      if (val) {
        this.getTableData();
      }
    },
    dialogVisible(val) {
      this.$emit("update:visible", val);
    },
  },
  methods: {
    async getTableData() {
      this.loading = true;
      try {
        const res = await geDetailTabletList({
          applyId: this.id,
          pageNum: 1,
          pageSize: 99999,
        });
        if (res.code === 200) {
          this.tableData = res.data.records.map((item) => ({
            ...item,
            hasError: Object.keys(item).some(
              (key) => key.endsWith("Warn") && item[key]
            ),
          }));
          this.hasWarning = this.tableData.some((item) => item.hasError);
          this.approvalInfo = { ...res.data.placementApply };
          this.form.auditResult =
            this.approvalInfo.status === 1 ? "通过" : "驳回";
          this.form.auditComment = this.approvalInfo.reason;
        }
      } catch (error) {
        console.error("获取表格数据失败:", error);
        this.$message.error("获取数据失败,请稍后重试");
      } finally {
        this.loading = false;
      }
    },
    tableRowClassName({ row }) {
      if (
        row.compensationAmountWarn == 1 ||
        row.waitFamilyNamesWarn == 1 ||
        row.waitFamilyNamesNoWarn == 1 ||
        row.waitFamilyAreaWarn == 1 ||
        row.subsidyAmountWarn == 1 ||
        row.quarterPayAmountWarn == 1 ||
        row.idCardNoWarn == 1 ||
        row.idCardExistsWarn == 1 ||
        row.compensationSumWarn == 1
      ) {
        return "warning-row";
      }
      return "";
    },
    cancelAudit() {
      this.dialogVisible = false;
      this.resetForm();
    },
    async submitAudit() {
      // if (!this.form.auditComment.trim()) {
      //   this.$message.warning("请输入审批意见");
      //   return;
      // }
 
      const params = {
        applyId: Number(this.id), // 确保是数字类型
        reason: this.form.auditComment ? this.form.auditComment.trim() : "",
        status: Number(this.form.auditResult === "通过" ? 1 : 2), // 确保是数字类型
      };
 
      try {
        const res = await approve(params);
        if (res.code === 200) {
          this.$message.success("审批成功");
          this.$emit("refresh");
          this.dialogVisible = false;
          this.resetForm();
        } else {
          this.$message.error(res.msg || "审批失败");
        }
      } catch (error) {
        console.error("审批失败:", error);
        this.$message.error(error?.response?.data?.message || "审批失败");
      }
    },
    resetForm() {
      this.form = {
        auditResult: "通过",
        auditComment: "",
      };
    },
  },
};
</script>
 
<style scoped>
::v-deep .warning-row {
  background: #de868f !important;
}
.approval-content {
  display: flex;
  margin-bottom: 20px;
}
 
.table-container {
  flex: 1;
  margin-right: 20px;
  overflow: hidden;
  position: relative;
}
 
.approval-info {
  width: 250px;
  padding: 15px;
  border-radius: 4px;
  background-color: #f0f2f5;
}
 
.approver-timeline {
  display: flex;
  flex-direction: column;
  height: 100%;
}
 
.timeline-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 15px;
}
 
.timeline-icon {
  margin-right: 10px;
}
 
.timeline-divider {
  width: 2px;
  height: 30px;
  background-color: #dcdfe6;
  margin-left: 15px;
  margin-bottom: 15px;
}
 
.timeline-content {
  flex: 1;
}
 
.info-box {
  background-color: #8e9aff;
  border-radius: 8px;
  padding: 6px 8px;
  color: white;
}
 
.info-line {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
 
.approver-info,
.approval-time-info {
  display: flex;
  align-items: center;
  white-space: nowrap;
}
 
.approver-title,
.approval-time-title {
  font-weight: bold;
  margin-right: 2px;
  white-space: nowrap;
  font-size: 12px;
}
 
.approver-name,
.approval-time {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
 
.waiting-btn {
  background-color: #909399;
  color: white;
  border: none;
}
 
.warning-info {
  background-color: #fef0f0;
  padding: 10px 15px;
  border-radius: 4px;
  margin: 15px 0;
}
 
.warning-text {
  color: #f56c6c;
}
 
.audit-section {
  margin-top: 20px;
  padding: 0 20px;
  display: flex;
  /* align-items: center; */
  width: 100%;
  margin-top: 20px;
}
 
.audit-result {
  margin-bottom: 20px;
  display: flex;
  /* align-items: center; */
}
 
.result-label,
.comment-label {
  font-size: 14px;
  color: #606266;
  margin-right: 15px;
  min-width: 70px;
}
 
.result-options {
  flex: 1;
}
 
.result-options .el-button {
  width: 80px;
}
 
.audit-comment {
  display: flex;
  align-items: flex-start;
  flex: 1;
  padding-left: 60px;
}
 
.audit-comment .el-textarea {
  flex: 1;
}
 
.el-button-group {
  display: inline-block;
}
 
.el-button-group .el-button {
  margin-right: 0;
}
 
.el-button-group .el-button:first-child {
  border-right: 1px solid #dcdfe6;
}
 
.dialog-footer {
  text-align: right;
}
 
/* 自定义滚动条样式 */
.el-table {
  max-height: 400px;
}
 
.el-table__body-wrapper::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
 
.el-table__body-wrapper::-webkit-scrollbar-thumb {
  background-color: #dcdfe6;
  border-radius: 4px;
}
 
.el-table__body-wrapper::-webkit-scrollbar-track {
  background-color: #f5f7fa;
}
 
/* loading样式优化 */
::v-deep .el-loading-spinner .el-icon-loading {
  font-size: 30px;
  color: #409eff;
}
 
::v-deep .el-loading-spinner .el-loading-text {
  font-size: 14px;
  margin-top: 8px;
  color: #409eff;
}
</style>