jiangping
2025-05-27 3d6a8e384d31432a23f5a8c1a3135a58cbe617b5
company/src/components/enterprise/onlineReporting.vue
@@ -407,360 +407,376 @@
</template>
<script>
    import BaseOpera from '@/components/base/BaseOpera'
    import GlobalWindow from '@/components/common/GlobalWindow'
    import upload from '@/components/common/upload'
    import { saveSettleClaims } from '@/api/business/settleRisk'
    import { findById } from '@/api/business/settleClaims'
    import { findListByDTO } from '@/api/business/member'
    import { findList } from '@/api/business/applyChange'
    import { findTreeList } from '@/api/business/knowledge'
    import OperaWtbApplyShopWindow from '@/components/business/OperaWtbApplyShopWindow'
    import OperaInsuranceApplyDetails from '@/components/business/OperaInsuranceApplyWindow'
    import OperaSettleClaimsWindow from '@/components/business/OperaSettleClaimsWindow'
    import { mapState } from 'vuex'
    export default {
        name: 'onlineReporting',
        extends: BaseOpera,
        components: { GlobalWindow, upload, OperaSettleClaimsWindow, OperaWtbApplyShopWindow, OperaInsuranceApplyDetails },
        computed: {
            ...mapState(['userInfo'])
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import upload from '@/components/common/upload'
import { saveSettleClaims } from '@/api/business/settleRisk'
import { findById } from '@/api/business/settleClaims'
import { findListByDTO } from '@/api/business/member'
import { findList } from '@/api/business/applyChange'
import { findTreeList } from '@/api/business/knowledge'
import OperaWtbApplyShopWindow from '@/components/business/OperaWtbApplyShopWindow'
import OperaInsuranceApplyDetails from '@/components/business/OperaInsuranceApplyWindow'
import OperaSettleClaimsWindow from '@/components/business/OperaSettleClaimsWindow'
import { mapState } from 'vuex'
export default {
  name: 'onlineReporting',
  extends: BaseOpera,
  components: { GlobalWindow, upload, OperaSettleClaimsWindow, OperaWtbApplyShopWindow, OperaInsuranceApplyDetails },
  computed: {
    ...mapState(['userInfo'])
  },
  data () {
    return {
      i: 0,
      id: null,
      statusList: [
        {
          name: '填写出险信息',
          info: '完成报案基础信息填写'
        },
        data () {
            return {
                i: 0,
                id: null,
                statusList: [
                    {
                        name: '填写出险信息',
                        info: '完成报案基础信息填写'
                    },
                    {
                        name: '上传理赔材料',
                        info: '补充需要理赔的相关资料'
                    },
                    {
                        name: '完成报案',
                        info: '提交报案信息'
                    }
                ],
                form: {
                    id: null,
                    memberId: '',
                    idcardNo: '',
                    insuranceApplyId: '',
                    happenTime: '',
                    hospital: '',
                    area: [],
                    areaId: '',
                    address: '',
                    areaInfo: '',
                    content: '',
                    type: 0,
                    inHospital: 0,
                    hurtType: 0,
                    medicalInsurance: 0,
                    reportFileList: [],
                    informantName: '',
                    informantPhone: '',
                    relationFileList: [],
                    outpatientFileList: [],
                    hospitalFileList: [],
                    disabilityFileList: [],
                    otherFileList: [],
                    applyDetailId: '',
                    solutionId: '',
                    worktypeId: '',
                    duId: '',
                    receiveBank: '',
                    receiveUserName: '',
                    receiveAccount: ''
                },
                rules: {
                    receiveAccount: [
                        { required: true, message: '不能为空' }
                    ],
                    receiveUserName: [
                        { required: true, message: '不能为空' }
                    ],
                    receiveBank: [
                        { required: true, message: '不能为空' }
                    ],
                    memberId: [
                        { required: true, message: '不能为空' }
                    ],
                    idcardNo: [
                        { required: true, message: '不能为空' }
                    ],
                    happenTime: [
                        { required: true, message: '不能为空' }
                    ],
                    content: [
                        { required: true, message: '不能为空' }
                    ],
                    type: [
                        { required: true, message: '不能为空' }
                    ],
                    inHospital: [
                        { required: true, message: '不能为空' }
                    ],
                    hurtType: [
                        { required: true, message: '不能为空' }
                    ],
                    medicalInsurance: [
                        { required: true, message: '不能为空' }
                    ],
                    informantName: [
                        { required: true, message: '不能为空' }
                    ],
                    informantPhone: [
                        { required: true, message: '不能为空' }
                    ],
                },
                pickerOptions: {},
                area: [],
                user: [],
                solutionList: []
            }
        {
          name: '上传理赔材料',
          info: '补充需要理赔的相关资料'
        },
        created () {
            this.config({
                api: '/business/settleClaims',
                'field.id': 'id'
            })
        },
        methods: {
            open (title, id) {
                this.title = title
                this.form.area = []
                this.i = 0
                this.solutionList = []
                this.area = []
                this.user = []
                this.getUser()
                this.getCityTree()
                if (id) {
                    findById(id)
                        .then(res => {
                            this.visible = true
                            this.$nextTick(() => {
                                for (const key in this.form) {
                                    this.form[key] = res[key]
                                }
                                if (this.form.areaId) {
                                    this.form.area = this.form.areaId.split(',').map(item => Number(item))
                                }
                                findList({ memberId: this.form.memberId })
                                    .then(res1 => {
                                        res1.forEach(item => {
                                            if (item.id === res.applyDetailId) {
                                                item.active = true
                                                this.pickerOptions = {
                                                    disabledDate(time) {
                                                        return time.getTime() < new Date(item.parentStartTime).getTime() || time.getTime() > new Date(item.parentEndTime).getTime()
                                                    }
                                                };
                                            } else {
                                                item.active = false
                                            }
                                        })
                                        this.solutionList = res1
                                    })
                            })
                        })
                } else {
                    this.visible = true
                    this.$nextTick(() => {
                        this.$refs.form.resetFields()
                        this.form.informantName = this.userInfo.realname
                    })
                }
            },
            continueReporting() {
                this.i = 0
                this.id = null
                this.pickerOptions = {}
                this.solutionList = []
                this.form = {
                    id: null,
                    memberId: '',
                    idcardNo: '',
                    insuranceApplyId: '',
                    happenTime: '',
                    hospital: '',
                    area: [],
                    areaId: '',
                    address: '',
                    areaInfo: '',
                    content: '',
                    type: 0,
                    inHospital: 0,
                    hurtType: 0,
                    medicalInsurance: 0,
                    reportFileList: [],
                    informantName: '',
                    informantPhone: '',
                    relationFileList: [],
                    outpatientFileList: [],
                    hospitalFileList: [],
                    disabilityFileList: [],
                    otherFileList: [],
                    applyDetailId: '',
                    solutionId: '',
                    worktypeId: '',
                    duId: '',
                    receiveBank: '',
                    receiveUserName: '',
                    receiveAccount: ''
                }
            },
            changeArea(e) {
                if (!e && e.length === 0) {
                    this.form.areaId = ''
                    this.form.areaInfo = ''
                } else {
                    this.form.areaId = e.join(',')
                    this.form.areaInfo = this.$refs.cascader.getCheckedNodes()[0].pathLabels.join(',')
                }
            },
            async getCityTree() {
                this.area = await findTreeList({})
                this.setSecondLevelChildrenToNullPrecise(this.area);
            },
            setSecondLevelChildrenToNullPrecise(data, level = 1) {
                if (!data || !data.length) return;
                data.forEach(item => {
                    if (item.childAreasList && item.childAreasList.length) {
                        if (level === 2) {
                            // 这是第一级节点,处理其子节点(第二级)
                            item.childAreasList.forEach(child => {
                                child.childAreasList = null;
                            });
                        } else {
                            // 继续递归处理更深层级
                            this.setSecondLevelChildrenToNullPrecise(item.childAreasList, level + 1);
                        }
                    }
                });
            },
            getUser() {
                findListByDTO({})
                    .then(res => {
                        this.user = res
                    })
            },
            delFile(index, type) {
                if (type === 1) {
                    this.form.relationFileList.splice(index, 1)
                } else if (type === 2) {
                    this.form.outpatientFileList.splice(index, 1)
                } else if (type === 3) {
                    this.form.hospitalFileList.splice(index, 1)
                } else if (type === 4) {
                    this.form.disabilityFileList.splice(index, 1)
                } else if (type === 5) {
                    this.form.otherFileList.splice(index, 1)
                } else if (type === 6) {
                    this.form.reportFileList.splice(index, 1)
                }
            },
            claimsUploadFile(file, type) {
                file.fileurl = file.imgaddr
                file.name = file.originname
                file.fileurlFull = file.url
                if (type === 1) {
                    this.form.relationFileList.push(file)
                } else if (type === 2) {
                    this.form.outpatientFileList.push(file)
                } else if (type === 3) {
                    this.form.hospitalFileList.push(file)
                } else if (type === 4) {
                    this.form.disabilityFileList.push(file)
                } else if (type === 5) {
                    this.form.otherFileList.push(file)
                } else if (type === 6) {
                    this.form.reportFileList.push(file)
                }
            },
            getSolutions(id) {
                let row = this.user.filter(item => item.id === id)
                this.form.idcardNo = row[0].idcardNo
                findList({ memberId: id })
                    .then(res => {
                        this.form.insuranceApplyId = ''
                        res.forEach(item => {
                            item.active = false
                        })
                        this.solutionList = res
                    })
            },
            changeSolution(e, i) {
                this.solutionList.forEach((item, index) => {
                    item.active = i === index
                })
                let obj = this.solutionList.filter(item => item.active)[0]
                this.form.insuranceApplyId = obj.applyId
                this.form.solutionId = obj.solutionId
                this.form.worktypeId = obj.worktypeId
                this.form.duId = obj.duId
                this.form.applyDetailId = obj.id
                this.form.happenTime = ''
                this.pickerOptions = {
                    disabledDate(time) {
                        return time.getTime() < new Date(obj.parentStartTime).getTime() || time.getTime() > new Date(obj.parentEndTime).getTime()
                    }
                };
            },
            // 查看保单详情
            jumpSolutionDetail(id, solutionType) {
                if (solutionType === 1) {
                    this.$refs.OperaWtbApplyShopWindow.open('委托投保详情', { id: id })
                } else {
                    this.$refs.OperaInsuranceApplyDetails.open('投保详情', { id: id })
                }
            },
            confirm(saveType) {
                this.isWorking = true
                saveSettleClaims({...this.form, saveType})
                    .then(res => {
                        console.log(res)
                        if (saveType === 0) {
                            this.visible = false
                        } else {
                            this.id = res
                            this.i = 2
                        }
                        this.$emit('success')
                    })
                    .finally(() => {
                        this.isWorking = false
                    })
            },
            next() {
                this.$refs.form.validate((valid) => {
                    if (!valid) return
                    this.i++
                    // this.isWorking = true
                    // createSys(obj)
                    //     .then(() => {
                    //         this.visible = false
                    //         this.$emit('success')
                    //     })
                    //     .catch(e => {
                    //         this.$tip.apiFailed(e)
                    //     })
                    //     .finally(() => {
                    //         this.isWorking = false
                    //     })
                })
            }
        {
          name: '完成报案',
          info: '提交报案信息'
        }
      ],
      form: {
        id: null,
        memberId: '',
        idcardNo: '',
        insuranceApplyId: '',
        happenTime: '',
        hospital: '',
        area: [],
        areaId: '',
        address: '',
        areaInfo: '',
        content: '',
        type: 0,
        inHospital: 0,
        hurtType: 0,
        medicalInsurance: 0,
        reportFileList: [],
        informantName: '',
        informantPhone: '',
        relationFileList: [],
        outpatientFileList: [],
        hospitalFileList: [],
        disabilityFileList: [],
        otherFileList: [],
        applyDetailId: '',
        solutionId: '',
        worktypeId: '',
        duId: '',
        receiveBank: '',
        receiveUserName: '',
        receiveAccount: ''
      },
      rules: {
        receiveAccount: [
          { required: true, message: '不能为空' }
        ],
        receiveUserName: [
          { required: true, message: '不能为空' }
        ],
        receiveBank: [
          { required: true, message: '不能为空' }
        ],
        memberId: [
          { required: true, message: '不能为空' }
        ],
        idcardNo: [
          { required: true, message: '不能为空' }
        ],
        happenTime: [
          { required: true, message: '不能为空' }
        ],
        content: [
          { required: true, message: '不能为空' }
        ],
        type: [
          { required: true, message: '不能为空' }
        ],
        inHospital: [
          { required: true, message: '不能为空' }
        ],
        hurtType: [
          { required: true, message: '不能为空' }
        ],
        medicalInsurance: [
          { required: true, message: '不能为空' }
        ],
        informantName: [
          { required: true, message: '不能为空' }
        ],
        informantPhone: [
          { required: true, message: '不能为空' }
        ]
      },
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now(); // 禁用未来的日期
        }
      },
      area: [],
      user: [],
      solutionList: []
    }
  },
  created () {
    this.config({
      api: '/business/settleClaims',
      'field.id': 'id'
    })
  },
  methods: {
    open (title, id) {
      this.title = title
      this.form.area = []
      this.i = 0
      this.solutionList = []
      this.area = []
      this.user = []
      this.getUser()
      this.getCityTree()
      if (id) {
        findById(id)
          .then(res => {
            this.visible = true
            this.$nextTick(() => {
              for (const key in this.form) {
                this.form[key] = res[key]
              }
              if (this.form.areaId) {
                this.form.area = this.form.areaId.split(',').map(item => Number(item))
              }
              findList({ memberId: this.form.memberId })
                .then(res1 => {
                  res1.forEach(item => {
                    if (item.id === res.applyDetailId) {
                      item.active = true
                      this.pickerOptions = {
                        disabledDate (time) {
                          var start = new Date(item.startTime)
                          var end = new Date(item.endTime)
                          return ( time.getTime() < start.getTime() ||  time.getTime()>end.getTime())
                        }
                      }
                    } else {
                      item.active = false
                    }
                  })
                  this.solutionList = res1
                })
            })
          })
      } else {
        this.visible = true
        this.$nextTick(() => {
          this.$refs.form.resetFields()
          this.form.informantName = this.userInfo.realname
        })
      }
    },
    continueReporting () {
      this.i = 0
      this.id = null
      this.pickerOptions = {}
      this.solutionList = []
      this.form = {
        id: null,
        memberId: '',
        idcardNo: '',
        insuranceApplyId: '',
        happenTime: '',
        hospital: '',
        area: [],
        areaId: '',
        address: '',
        areaInfo: '',
        content: '',
        type: 0,
        inHospital: 0,
        hurtType: 0,
        medicalInsurance: 0,
        reportFileList: [],
        informantName: '',
        informantPhone: '',
        relationFileList: [],
        outpatientFileList: [],
        hospitalFileList: [],
        disabilityFileList: [],
        otherFileList: [],
        applyDetailId: '',
        solutionId: '',
        worktypeId: '',
        duId: '',
        receiveBank: '',
        receiveUserName: '',
        receiveAccount: ''
      }
    },
    changeArea (e) {
      if (!e && e.length === 0) {
        this.form.areaId = ''
        this.form.areaInfo = ''
      } else {
        this.form.areaId = e.join(',')
        this.form.areaInfo = this.$refs.cascader.getCheckedNodes()[0].pathLabels.join(',')
      }
    },
    async getCityTree () {
      this.area = await findTreeList({})
      this.setSecondLevelChildrenToNullPrecise(this.area)
    },
    setSecondLevelChildrenToNullPrecise (data, level = 1) {
      if (!data || !data.length) return
      data.forEach(item => {
        if (item.childAreasList && item.childAreasList.length) {
          if (level === 2) {
            // 这是第一级节点,处理其子节点(第二级)
            item.childAreasList.forEach(child => {
              child.childAreasList = null
            })
          } else {
            // 继续递归处理更深层级
            this.setSecondLevelChildrenToNullPrecise(item.childAreasList, level + 1)
          }
        }
      })
    },
    getUser () {
      findListByDTO({})
        .then(res => {
          this.user = res
        })
    },
    delFile (index, type) {
      if (type === 1) {
        this.form.relationFileList.splice(index, 1)
      } else if (type === 2) {
        this.form.outpatientFileList.splice(index, 1)
      } else if (type === 3) {
        this.form.hospitalFileList.splice(index, 1)
      } else if (type === 4) {
        this.form.disabilityFileList.splice(index, 1)
      } else if (type === 5) {
        this.form.otherFileList.splice(index, 1)
      } else if (type === 6) {
        this.form.reportFileList.splice(index, 1)
      }
    },
    claimsUploadFile (file, type) {
      file.fileurl = file.imgaddr
      file.name = file.originname
      file.fileurlFull = file.url
      if (type === 1) {
        this.form.relationFileList.push(file)
      } else if (type === 2) {
        this.form.outpatientFileList.push(file)
      } else if (type === 3) {
        this.form.hospitalFileList.push(file)
      } else if (type === 4) {
        this.form.disabilityFileList.push(file)
      } else if (type === 5) {
        this.form.otherFileList.push(file)
      } else if (type === 6) {
        this.form.reportFileList.push(file)
      }
    },
    getSolutions (id) {
      const row = this.user.filter(item => item.id === id)
      this.form.idcardNo = row[0].idcardNo
      findList({ memberId: id })
        .then(res => {
          this.form.insuranceApplyId = ''
          res.forEach(item=> {
              item.active = false
          })
          this.solutionList = res
          this.changeSolution(null,0)
        })
    },
    changeSolution (e, i) {
      this.pickerOptions = {}
      if(this.solutionList.length < i){
        return
      }
      this.solutionList.forEach((item, index) => {
        item.active = i === index
      })
      const obj = this.solutionList.filter(item => item.active)[0]
      this.pickerOptions = {
        disabledDate (time) {
          var start = new Date(obj.startTime)
          var end = new Date(obj.endTime)
          return ( time.getTime() < start.getTime() ||  time.getTime()>end.getTime())
        }
      }
      this.form.insuranceApplyId = obj.applyId
      this.form.solutionId = obj.solutionId
      this.form.worktypeId = obj.worktypeId
      this.form.duId = obj.duId
      this.form.applyDetailId = obj.id
      this.form.happenTime = obj.startTime
      console.log(this.pickerOptions)
    },
    // 查看保单详情
    jumpSolutionDetail (id, solutionType) {
      if (solutionType === 1) {
        this.$refs.OperaWtbApplyShopWindow.open('委托投保详情', { id: id })
      } else {
        this.$refs.OperaInsuranceApplyDetails.open('投保详情', { id: id })
      }
    },
    confirm (saveType) {
      this.isWorking = true
      saveSettleClaims({ ...this.form, saveType })
        .then(res => {
          console.log(res)
          if (saveType === 0) {
            this.visible = false
          } else {
            this.id = res
            this.i = 2
          }
          this.$emit('success')
        }).catch(err => {
            this.$tip.apiFailed(err)
         })
        .finally(() => {
          this.isWorking = false
        })
    },
    next () {
      this.$refs.form.validate((valid) => {
        if (!valid) return
        this.i++
        // this.isWorking = true
        // createSys(obj)
        //     .then(() => {
        //         this.visible = false
        //         this.$emit('success')
        //     })
        //     .catch(e => {
        //         this.$tip.apiFailed(e)
        //     })
        //     .finally(() => {
        //         this.isWorking = false
        //     })
      })
    }
  }
}
</script>
<style lang="scss" scoped>