jiangping
2025-06-09 663dbe4ddca1fa409e6acbc1f77d924c161b0c39
company/src/components/business/OpearaCaseEntryWindow.vue
@@ -11,8 +11,8 @@
                <div class="box_item">
                    <div class="box_item_title">
                        <span>出险人信息</span>
                        <el-select v-model="ruleForm.status" style="width: 100px;" placeholder="请选择">
                            <el-option label="待立案" :value="2"></el-option>
                        <el-select v-model="ruleForm.status" style="width: 100px;" placeholder="请选择案件状态">
                            <el-option label="已报案" :value="1"></el-option>
                            <el-option label="已退回" :value="4"></el-option>
                            <el-option label="待受理" :value="5"></el-option>
                            <el-option label="已拒绝" :value="6"></el-option>
@@ -51,6 +51,7 @@
                                <el-date-picker
                                    v-model="ruleForm.extData.memberBirthday"
                                    type="date"
                                    @change="changeMemberBirthday"
                                    placeholder="选择日期"
                                    format="yyyy 年 MM 月 dd 日"
                                    value-format="yyyy-MM-dd">
@@ -182,20 +183,20 @@
                            </el-form-item>
                        </div>
                        <div class="box_item_list_row">
                            <el-form-item label="报案时间" prop="happenTime">
                            <el-form-item label="报案时间" prop="reportDate">
                                <el-date-picker
                                    v-model="ruleForm.happenTime"
                                    v-model="ruleForm.extData.reportDate"
                                    type="date"
                                    placeholder="选择日期"
                                    format="yyyy-MM-dd"
                                    value-format="yyyy-MM-dd">
                                    format="yyyy-MM-dd HH:mm:ss"
                                    value-format="yyyy-MM-dd HH:mm:ss">
                                </el-date-picker>
                            </el-form-item>
                        </div>
                        <div class="box_item_list_row">
                            <el-form-item label="出险时间" prop="createDate">
                            <el-form-item label="出险时间" prop="happenTime">
                                <el-date-picker
                                    v-model="ruleForm.createDate"
                                    v-model="ruleForm.happenTime"
                                    type="datetime"
                                    placeholder="选择日期"
                                    format="yyyy-MM-dd hh:mm:ss"
@@ -227,8 +228,8 @@
                                    v-model="ruleForm.extData.logoffDate"
                                    type="date"
                                    placeholder="选择日期"
                                    format="yyyy 年 MM 月 dd 日"
                                    value-format="yyyy-MM-dd">
                                    format="yyyy-MM-dd HH:mm:ss"
                                    value-format="yyyy-MM-dd HH:mm:ss">
                                </el-date-picker>
                            </el-form-item>
                        </div>
@@ -710,368 +711,388 @@
</template>
<script>
    import BaseOpera from '@/components/base/BaseOpera'
    import GlobalWindow from '@/components/common/GlobalWindow'
    import upload from '@/components/common/upload'
    import { getCompensation } from '@/api/business/settleRisk'
    import { createSys } from '@/api/business/settleClaims'
    import { findById } from '@/api/business/settleClaimsMovement'
    export default {
        name: 'OpearaCaseEntryWindow',
        extends: BaseOpera,
        components: { GlobalWindow, upload },
        data () {
            return {
                ruleForm: {
                    id: null,
                    extData: {
                        memberName: '',
                        memberIdcardType: '',
                        memberIdcard: '',
                        memberBirthday: '',
                        memberAge: '',
                        memberSex: 0,
                        memberPhone: '',
                        memberAddr: '',
                        bxName: '',
                        bxCode: '',
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import upload from '@/components/common/upload'
import { getCompensation } from '@/api/business/settleRisk'
import { createSys } from '@/api/business/settleClaims'
import { findById } from '@/api/business/settleClaimsMovement'
export default {
  name: 'OpearaCaseEntryWindow',
  extends: BaseOpera,
  components: { GlobalWindow, upload },
  data () {
    return {
      ruleForm: {
        id: null,
        extData: {
          memberName: '',
          memberIdcardType: '',
          memberIdcard: '',
          memberBirthday: '',
          memberAge: '',
          memberSex: 0,
          memberPhone: '',
          memberAddr: '',
          bxName: '',
          bxCode: '',
          reportDate:null,
          bxDate: [],
          bxStartdate: '',
          bxEnddate: '',
          bxTbName: '',
          bxBbName: '',
          bxOrg: '',
          bxYsMoney: '',
          bxSsMoney: '',
                        bxDate: [],
                        bxStartdate: '',
                        bxEnddate: '',
                        bxTbName: '',
                        bxBbName: '',
                        bxOrg: '',
                        bxYsMoney: '',
                        bxSsMoney: '',
          rsAttr: '',
          rsInfo: '',
          rsZlStatus: '',
          rsLossMoney: '',
          rsJzInfo: '',
          rsCyDate: '',
          rsYlOrg: '',
          rsDeathDate: '',
                        rsAttr: '',
                        rsInfo: '',
                        rsZlStatus: '',
                        rsLossMoney: '',
                        rsJzInfo: '',
                        rsCyDate: '',
                        rsYlOrg: '',
                        rsDeathDate: '',
          jzHospital: '',
          jzZyCode: '',
          jzZyKs: '',
          jzZyDate: '',
          jzCyDate: '',
          jzZyDays: '',
                        jzHospital: '',
                        jzZyCode: '',
                        jzZyKs: '',
                        jzZyDate: '',
                        jzCyDate: '',
                        jzZyDays: '',
          zdZlInfo: '',
          zdSqInfo: '',
          zdLczd: '',
          zdSsName: '',
          zdHxProject: '',
          zdJwb: '',
                        zdZlInfo: '',
                        zdSqInfo: '',
                        zdLczd: '',
                        zdSsName: '',
                        zdHxProject: '',
                        zdJwb: '',
          hzBdhCl: '',
          hzDutyRate: '',
                        hzBdhCl: '',
                        hzDutyRate: '',
          jdInfo: '',
          jdChannel: '',
          jdOrg: '',
          jdUser: '',
          jdPdDate: '',
          jdScLevel: '',
          jdTerms: '',
          jdXishu: '',
          jdJsldht: 1,
          jdZrpctkRel: 0,
                        jdInfo: '',
                        jdChannel: '',
                        jdOrg: '',
                        jdUser: '',
                        jdPdDate: '',
                        jdScLevel: '',
                        jdTerms: '',
                        jdXishu: '',
                        jdJsldht: 1,
                        jdZrpctkRel: 0,
                        logoff: 1,
                        logoffUser: '',
                        logoffDate: ''
                    },
                    informantName: '',
                    informantPhone: '',
                    reportNum: '',
                    areaInfo: '',
                    type: 0,
                    hospital: '',
                    inHospital: 1,
                    hurtType: 0,
                    payForYbwyy: 1,
                    relationFileList: [],
                    outpatientFileList: [],
                    hospitalFileList: [],
                    disabilityFileList: [],
                    otherFileList: [],
                    reportFileList: [],
                    accountList: [],
                    dzbdFileList: [],
                    status: '',
                    medicalInsurance: 1,
                    content: '',
                    happenTime: '',
                    createDate: ''
                },
                rules: {
                    'extData.memberName': [
                        { required: true, message: '不能为空', trigger: 'blur' }
                    ],
                    'extData.memberIdcardType': [
                        { required: true, message: '不能为空', trigger: 'blur' }
                    ],
                    'extData.memberIdcard': [
                        { required: true, message: '不能为空', trigger: 'blur' }
                    ],
                    'extData.memberSex': [
                        { required: true, message: '不能为空', trigger: 'blur' }
                    ],
                    'extData.memberPhone': [
                        { required: true, message: '不能为空', trigger: 'blur' }
                    ],
                    'extData.bxName': [
                        { required: true, message: '不能为空', trigger: 'blur' }
                    ],
                    'extData.bxCode': [
                        { required: true, message: '不能为空', trigger: 'blur' }
                    ],
                    'extData.bxDate': [
                        { required: true, message: '不能为空', trigger: 'blur' }
                    ],
                    'extData.bxTbName': [
                        { required: true, message: '不能为空', trigger: 'blur' }
                    ],
                    'extData.bxBbName': [
                        { required: true, message: '不能为空', trigger: 'blur' }
                    ],
                    'extData.bxOrg': [
                        { required: true, message: '不能为空', trigger: 'blur' }
                    ],
                    informantPhone: [
                        { required: true, message: '不能为空', trigger: 'blur' }
                    ]
                },
                uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/upload?folder=settle',
                totalPrice: 0,
                list1: [],
                list2: [],
                list3: [],
            }
          logoff: 1,
          logoffUser: '',
          logoffDate: ''
        },
        created () {
            this.config({
                api: '/business/company',
                'field.id': 'id'
            })
        },
        methods: {
            open (title, id) {
                this.title = title
                if (id) {
                    findById(id)
                        .then(res => {
                            console.log(res)
                            this.ruleForm.id = id
                            this.$nextTick(() => {
                                for (const key in this.ruleForm) {
                                    this.ruleForm[key] = res[key]
                                }
                                if (this.ruleForm.accountList && this.ruleForm.accountList.length > 0) {
                                    this.list1 = this.ruleForm.accountList.filter(item => item.type === 0)
                                    this.list2 = this.ruleForm.accountList.filter(item => item.type === 1)
                                    this.list3 = this.ruleForm.accountList.filter(item => item.type === 2)
                                    this.changeFee()
                                }
                                if (res.extData.bxStartdate && res.extData.bxEnddate) {
                                    this.ruleForm.extData.bxDate = [res.extData.bxStartdate, res.extData.bxEnddate]
                                }
                            })
                            this.visible = true
                        })
                } else {
                    this.visible = true
                    this.ruleForm = {
                        id: null,
                        extData: {
                            memberName: '',
                            memberIdcardType: '',
                            memberIdcard: '',
                            memberBirthday: '',
                            memberAge: '',
                            memberSex: 0,
                            memberPhone: '',
                            memberAddr: '',
                            bxName: '',
                            bxCode: '',
        informantName: '',
        informantPhone: '',
        reportNum: '',
        areaInfo: '',
        type: 0,
        hospital: '',
        inHospital: 1,
        hurtType: 0,
        payForYbwyy: 1,
                            bxDate: [],
                            bxStartdate: '',
                            bxEnddate: '',
                            bxTbName: '',
                            bxBbName: '',
                            bxOrg: '',
                            bxYsMoney: '',
                            bxSsMoney: '',
        relationFileList: [],
        outpatientFileList: [],
        hospitalFileList: [],
        disabilityFileList: [],
        otherFileList: [],
        reportFileList: [],
                            rsAttr: '',
                            rsInfo: '',
                            rsZlStatus: '',
                            rsLossMoney: '',
                            rsJzInfo: '',
                            rsCyDate: '',
                            rsYlOrg: '',
                            rsDeathDate: '',
        accountList: [],
        dzbdFileList: [],
                            jzHospital: '',
                            jzZyCode: '',
                            jzZyKs: '',
                            jzZyDate: '',
                            jzCyDate: '',
                            jzZyDays: '',
                            zdZlInfo: '',
                            zdSqInfo: '',
                            zdLczd: '',
                            zdSsName: '',
                            zdHxProject: '',
                            zdJwb: '',
                            hzBdhCl: '',
                            hzDutyRate: '',
                            jdInfo: '',
                            jdChannel: '',
                            jdOrg: '',
                            jdUser: '',
                            jdPdDate: '',
                            jdScLevel: '',
                            jdTerms: '',
                            jdXishu: '',
                            jdJsldht: 1,
                            jdZrpctkRel: 0,
                            logoff: 1,
                            logoffUser: '',
                            logoffDate: ''
                        },
                        informantName: '',
                        informantPhone: '',
                        reportNum: '',
                        areaInfo: '',
                        type: 0,
                        hospital: '',
                        inHospital: 1,
                        hurtType: 0,
                        payForYbwyy: 1,
                        relationFileList: [],
                        outpatientFileList: [],
                        hospitalFileList: [],
                        disabilityFileList: [],
                        otherFileList: [],
                        reportFileList: [],
                        accountList: [],
                        dzbdFileList: [],
                        status: '',
                        medicalInsurance: 1,
                        content: '',
                        happenTime: '',
                        createDate: ''
                    }
                }
                this.getCompensations()
            },
            confirm() {
                this.$refs.ruleForm.validate((valid) => {
                    if (!valid) return
                    this.isWorking = true
                    let obj = JSON.parse(JSON.stringify(this.ruleForm))
                    obj.accountList = [...this.list1, ...this.list2, ...this.list3]
                    createSys(obj)
                        .then(() => {
                            this.visible = false
                            if (!obj.id) {
                                this.$tip.apiSuccess('新建成功')
                            } else {
                                this.$tip.apiSuccess('编辑成功')
                            }
                            this.$emit('success')
                        })
                        .catch(e => {
                            this.$tip.apiFailed(e)
                        })
                        .finally(() => {
                            this.isWorking = false
                        })
                })
            },
            changeFee() {
                let arr = [...this.list1, ...this.list2]
                let price = 0
                arr.forEach(item => {
                    if (item.fee) {
                        price += Number(item.fee)
                    }
                })
                this.totalPrice = price
            },
            delFile (index, type) {
                if (type === 1) {
                    this.ruleForm.relationFileList.splice(index, 1)
                } else if (type === 2) {
                    this.ruleForm.outpatientFileList.splice(index, 1)
                } else if (type === 3) {
                    this.ruleForm.hospitalFileList.splice(index, 1)
                } else if (type === 4) {
                    this.ruleForm.disabilityFileList.splice(index, 1)
                } else if (type === 5) {
                    this.ruleForm.otherFileList.splice(index, 1)
                } else if (type === 6) {
                    this.ruleForm.reportFileList.splice(index, 1)
                } else if (type === 7) {
                    this.ruleForm.dzbdFileList.splice(index, 1)
                }
            },
            claimsUploadFile(file, type) {
                file.fileurl = file.imgaddr
                file.name = file.originname
                if (type === 1) {
                    this.ruleForm.relationFileList.push(file)
                } else if (type === 2) {
                    this.ruleForm.outpatientFileList.push(file)
                } else if (type === 3) {
                    this.ruleForm.hospitalFileList.push(file)
                } else if (type === 4) {
                    this.ruleForm.disabilityFileList.push(file)
                } else if (type === 5) {
                    this.ruleForm.otherFileList.push(file)
                } else if (type === 6) {
                    this.ruleForm.reportFileList.push(file)
                } else if (type === 7) {
                    this.ruleForm.dzbdFileList.push(file)
                }
            },
            changeBxDate(e) {
                if (e.length > 1) {
                    this.ruleForm.extData.bxStartdate = e[0]
                    this.ruleForm.extData.bxEnddate = e[1]
                } else {
                    this.ruleForm.extData.bxStartdate = ''
                    this.ruleForm.extData.bxEnddate = ''
                }
            },
            getCompensations() {
                getCompensation({ type: 1 })
                    .then(res => {
                        console.log(res)
                        this.list1 = res.filter(item => item.type === 0)
                        this.list2 = res.filter(item => item.type === 1)
                        this.list3 = res.filter(item => item.type === 2)
                    })
            }
        }
        status: '',
        medicalInsurance: 1,
        content: '',
        happenTime: '',
        createDate: ''
      },
      rules: {
        'extData.memberName': [
          { required: true, message: '不能为空', trigger: 'blur' }
        ],
        'extData.memberIdcardType': [
          { required: true, message: '不能为空', trigger: 'blur' }
        ],
        'extData.memberIdcard': [
          { required: true, message: '不能为空', trigger: 'blur' }
        ],
        'extData.memberSex': [
          { required: true, message: '不能为空', trigger: 'blur' }
        ],
        'extData.memberPhone': [
          { required: true, message: '不能为空', trigger: 'blur' }
        ],
        'extData.bxName': [
          { required: true, message: '不能为空', trigger: 'blur' }
        ],
        'extData.bxCode': [
          { required: true, message: '不能为空', trigger: 'blur' }
        ],
        'extData.bxDate': [
          { required: true, message: '不能为空', trigger: 'blur' }
        ],
        'extData.bxTbName': [
          { required: true, message: '不能为空', trigger: 'blur' }
        ],
        'extData.bxBbName': [
          { required: true, message: '不能为空', trigger: 'blur' }
        ],
        'extData.bxOrg': [
          { required: true, message: '不能为空', trigger: 'blur' }
        ],
        informantPhone: [
          { required: true, message: '不能为空', trigger: 'blur' }
        ]
      },
      uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/upload?folder=settle',
      totalPrice: 0,
      list1: [],
      list2: [],
      list3: []
    }
  },
  created () {
    this.config({
      api: '/business/company',
      'field.id': 'id'
    })
  },
  methods: {
    open (title, id) {
      this.title = title
      if (id) {
        findById(id)
          .then(res => {
            console.log(res)
            this.ruleForm.id = id
            this.$nextTick(() => {
              for (const key in this.ruleForm) {
                this.ruleForm[key] = res[key]
              }
              if (this.ruleForm.accountList && this.ruleForm.accountList.length > 0) {
                this.list1 = this.ruleForm.accountList.filter(item => item.type === 0)
                this.list2 = this.ruleForm.accountList.filter(item => item.type === 1)
                this.list3 = this.ruleForm.accountList.filter(item => item.type === 2)
                this.changeFee()
              }
              if (res.extData.bxStartdate && res.extData.bxEnddate) {
                this.ruleForm.extData.bxDate = [res.extData.bxStartdate, res.extData.bxEnddate]
              }
            })
            this.visible = true
          })
      } else {
        this.visible = true
        this.ruleForm = {
          id: null,
          extData: {
            memberName: '',
            memberIdcardType: '',
            memberIdcard: '',
            memberBirthday: '',
            memberAge: '',
            memberSex: 0,
            memberPhone: '',
            memberAddr: '',
            bxName: '',
            bxCode: '',
            bxDate: [],
            bxStartdate: '',
            bxEnddate: '',
            bxTbName: '',
            bxBbName: '',
            bxOrg: '',
            bxYsMoney: '',
            bxSsMoney: '',
            rsAttr: '',
            rsInfo: '',
            rsZlStatus: '',
            rsLossMoney: '',
            rsJzInfo: '',
            rsCyDate: '',
            rsYlOrg: '',
            rsDeathDate: '',
            jzHospital: '',
            jzZyCode: '',
            jzZyKs: '',
            jzZyDate: '',
            jzCyDate: '',
            jzZyDays: '',
            zdZlInfo: '',
            zdSqInfo: '',
            zdLczd: '',
            zdSsName: '',
            zdHxProject: '',
            zdJwb: '',
            hzBdhCl: '',
            hzDutyRate: '',
            jdInfo: '',
            jdChannel: '',
            jdOrg: '',
            jdUser: '',
            jdPdDate: '',
            jdScLevel: '',
            jdTerms: '',
            jdXishu: '',
            jdJsldht: 1,
            jdZrpctkRel: 0,
            logoff: 1,
            logoffUser: '',
            logoffDate: ''
          },
          informantName: '',
          informantPhone: '',
          reportNum: '',
          areaInfo: '',
          type: 0,
          hospital: '',
          inHospital: 1,
          hurtType: 0,
          payForYbwyy: 1,
          relationFileList: [],
          outpatientFileList: [],
          hospitalFileList: [],
          disabilityFileList: [],
          otherFileList: [],
          reportFileList: [],
          accountList: [],
          dzbdFileList: [],
          status: '',
          medicalInsurance: 1,
          content: '',
          happenTime: '',
          createDate: ''
        }
      }
      this.getCompensations()
    },
      changeMemberBirthday(e) {
          if (!e) {
              this.ruleForm.extData.memberAge = ''
          } else {
              this.ruleForm.extData.memberAge = this.calculateAge(e)
          }
      },
      calculateAge(birthDate) {
          const today = new Date();
          const birthDateObject = new Date(birthDate);
          let age = today.getFullYear() - birthDateObject.getFullYear();
          const monthDiff = today.getMonth() - birthDateObject.getMonth();
          if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDateObject.getDate())) {
              age--;
          }
          return age;
      },
    confirm () {
      this.$refs.ruleForm.validate((valid) => {
        if (!valid) return
        this.isWorking = true
        const obj = JSON.parse(JSON.stringify(this.ruleForm))
        obj.accountList = [...this.list1, ...this.list2, ...this.list3]
        createSys(obj)
          .then(() => {
            this.visible = false
            if (!obj.id) {
              this.$tip.apiSuccess('新建成功')
            } else {
              this.$tip.apiSuccess('编辑成功')
            }
            this.$emit('success')
          })
          .catch(e => {
            this.$tip.apiFailed(e)
          })
          .finally(() => {
            this.isWorking = false
          })
      })
    },
    changeFee () {
      const arr = [...this.list1, ...this.list2]
      let price = 0
      arr.forEach(item => {
        if (item.fee) {
          price += Number(item.fee)
        }
      })
      this.totalPrice = price
    },
    delFile (index, type) {
      if (type === 1) {
        this.ruleForm.relationFileList.splice(index, 1)
      } else if (type === 2) {
        this.ruleForm.outpatientFileList.splice(index, 1)
      } else if (type === 3) {
        this.ruleForm.hospitalFileList.splice(index, 1)
      } else if (type === 4) {
        this.ruleForm.disabilityFileList.splice(index, 1)
      } else if (type === 5) {
        this.ruleForm.otherFileList.splice(index, 1)
      } else if (type === 6) {
        this.ruleForm.reportFileList.splice(index, 1)
      } else if (type === 7) {
        this.ruleForm.dzbdFileList.splice(index, 1)
      }
    },
    claimsUploadFile (file, type) {
      file.fileurl = file.imgaddr
      file.name = file.originname
      if (type === 1) {
        this.ruleForm.relationFileList.push(file)
      } else if (type === 2) {
        this.ruleForm.outpatientFileList.push(file)
      } else if (type === 3) {
        this.ruleForm.hospitalFileList.push(file)
      } else if (type === 4) {
        this.ruleForm.disabilityFileList.push(file)
      } else if (type === 5) {
        this.ruleForm.otherFileList.push(file)
      } else if (type === 6) {
        this.ruleForm.reportFileList.push(file)
      } else if (type === 7) {
        this.ruleForm.dzbdFileList.push(file)
      }
    },
    changeBxDate (e) {
      if (e.length > 1) {
        this.ruleForm.extData.bxStartdate = e[0]
        this.ruleForm.extData.bxEnddate = e[1]
      } else {
        this.ruleForm.extData.bxStartdate = ''
        this.ruleForm.extData.bxEnddate = ''
      }
    },
    getCompensations () {
      getCompensation({ type: 1 })
        .then(res => {
          console.log(res)
          this.list1 = res.filter(item => item.type === 0)
          this.list2 = res.filter(item => item.type === 1)
          this.list3 = res.filter(item => item.type === 2)
        })
    }
  }
}
</script>
<style lang="scss" scoped>