nidapeng
2024-04-01 18b05b40f7b62962e05250e6a07abca27b5adf67
company/src/components/business/OpearaUnionApply.vue
@@ -9,8 +9,8 @@
    >
        <div class="list">
            <el-form :inline="true" ref="form" :model="form" :rules="rules" class="demo-form-inline">
                <el-form-item label="保险方案" prop="solutionsId">
                    <el-select v-model="form.solutionsId" @change="selectSolutions" placeholder="请选择">
                <el-form-item label="保险方案" prop="baseSolutionId">
                    <el-select v-model="form.baseSolutionId" @change="selectSolutions" placeholder="请选择">
                        <el-option
                            v-for="item in solutions"
                            :key="item.baseId"
@@ -19,14 +19,14 @@
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="保险生效起止期" prop="applyStartTime">
                <el-form-item label="保险生效起止期" prop="startDate">
                    <div style="display: flex; flex-direction: column;">
                        <el-date-picker
                            @change="changeTime"
                            v-model="time"
                            type="daterange"
                            value-format="yyyy-MM-dd HH:mm:ss"
                            format="yyyy-MM-dd HH:mm:ss"
                            format="yyyy 年 MM 月 dd 日"
                            value-format="yyyy-MM-dd"
                            range-separator="至"
                            start-placeholder="开始日期"
                            end-placeholder="结束日期" />
@@ -56,6 +56,7 @@
            :data="list"
            border
            ref="multipleTable"
            @selection-change="handleSelectionChange"
            style="width: 100%;margin-bottom: 15px;">
            <el-table-column
                type="selection"
@@ -67,23 +68,23 @@
                </template>
            </el-table-column>
            <el-table-column
                prop="memberName"
                prop="companyName"
                label="被保险人">
            </el-table-column>
            <el-table-column
                prop="idCard"
                prop="applyStartTime"
                label="期望保险生效起期">
            </el-table-column>
            <el-table-column
                prop="oldDuName"
                prop="applyEndTime"
                label="期望保险生效止期">
            </el-table-column>
            <el-table-column
                prop="oldWorkTypeName"
                prop="insureNum"
                label="投保人数">
            </el-table-column>
            <el-table-column
                prop="duName"
                prop="fee"
                label="总费用">
            </el-table-column>
            <el-table-column
@@ -112,6 +113,8 @@
    import selectApplicationForm from '@/components/business/selectApplicationForm'
    import employeeList from '@/components/business/employeeList'
    import { all } from '@/api/business/solutions'
import { closeWtbForShop, fetchList } from '@/api/business/insuranceApply'
import { merge } from '@/api/business/unionApply'
    export default {
        name: 'factoryChange',
        extends: BaseOpera,
@@ -119,10 +122,10 @@
        data () {
            return {
                form: {
                    id: null,
                    solutionsId: '',
                    applyStartTime: '',
                    applyEndTime: ''
        baseSolutionId: null,
        applyIds: [],
        startDate: null,
        endDate: null
                },
                solutions: [],
                list: [],
@@ -131,11 +134,11 @@
                time: [],
                // 验证规则
                rules: {
                    applyStartTime: [
                        { required: true, message: '请选择保险生效起期' }
                    ],
                    solutionsName: [
        baseSolutionId: [
                        { required: true, message: '请选择保险方案' }
        ],
        startDate: [
          { required: true, message: '请选择保险生效起期' }
                    ]
                }
            }
@@ -147,23 +150,54 @@
            })
        },
        methods: {
    handleSelectionChange (val) {
      // this.multipleSelection = val;
      this.form.applyIds = []
      // 假设取出 id 字段
      val.forEach(item => {
        const id = item.id
        if ( this.form.applyIds.indexOf(id) === -1) {
          this.form.applyIds.push(id)
        }
      })
    },
            confirm() {
      this.$refs.form.validate((valid) => {
        // debugger
        if (!valid) {
          return
        }
        if(this.form.applyIds == null || this.form.applyIds.length ===0){
          this.$tip.apiFailed({
            type: 'error',
            message: '请选择至少一条申请记录进行投保申请!!'
          })
          return;
        }
                this.$confirm('确认提交,请仔细核对信息。', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                    center: true
                }).then(() => {
          merge(this.form)
            .then(response => {
                    this.$message({
                        type: 'success',
                        message: '确定!'
                    });
                message: '提交成功!'
              })
              this.visible = false
              this.$emit('success')
            }).catch(err => {
              this.$tip.apiFailed(err)
            })
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '取消'
                    });
                });
          })
        })
      })
            },
            getValue(e) {
                console.log(e)
@@ -174,16 +208,20 @@
            },
            changeTime(e) {
                if (e.length > 0) {
                    this.form.applyStartTime = e[0]
                    this.form.applyEndTime = e[1]
        this.form.startDate = e[0]
        this.form.endDate = e[1]
                } else {
                    this.form.applyStartTime = ''
                    this.form.applyEndTime = ''
        this.form.startDate = ''
        this.form.endDate = ''
                }
            },
            open (title, target) {
                this.getSolutions()
                this.title = title
      this.solutions= []
      this.list= []
      this.item= null
      this.time= []
                if (target) {
                    this.$nextTick(() => {
                        this.$refs.form.resetFields()
@@ -198,15 +236,38 @@
            },
            // 查询全部方案
            getSolutions() {
                all({})
      all({ dataType: 0, type: 1 })
                    .then(res => {
                        this.solutions = res
                    })
            },
    search () {
      this.currentPage = 1
      this.getList()
    },
    getList () {
      fetchList({
        capacity: 10,
        page: this.currentPage,
        model: {
          solutionBaseId: this.form.solutionsId,
          status: 23
        }
      }).then(res => {
        this.list = res.records
        this.total = res.total
        this.$nextTick(() => {
          if (this.$refs.table && this.$refs.table.doLayout) {
            this.$refs.table.doLayout()
          }
        })
      })
    },
            // 选择保险单
            selectSolutions(id) {
      this.search()
                this.solutions.forEach(item => {
                    if (item.id === id) {
        if (item.baseId === id) {
                        this.item = item
                    }
                })