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
@@ -107,112 +108,172 @@
</template>
<script>
    import BaseOpera from '@/components/base/BaseOpera'
    import GlobalWindow from '@/components/common/GlobalWindow'
    import selectApplicationForm from '@/components/business/selectApplicationForm'
    import employeeList from '@/components/business/employeeList'
    import { all } from '@/api/business/solutions'
    export default {
        name: 'factoryChange',
        extends: BaseOpera,
        components: { GlobalWindow, selectApplicationForm, employeeList },
        data () {
            return {
                form: {
                    id: null,
                    solutionsId: '',
                    applyStartTime: '',
                    applyEndTime: ''
                },
                solutions: [],
                list: [],
                endTime: '',
                item: null,
                time: [],
                // 验证规则
                rules: {
                    applyStartTime: [
                        { required: true, message: '请选择保险生效起期' }
                    ],
                    solutionsName: [
                        { required: true, message: '请选择保险方案' }
                    ]
                }
            }
        },
        created () {
            this.config({
                api: '/business/insuranceApply',
                'field.id': 'id'
            })
        },
        methods: {
            confirm() {
                this.$confirm('确认提交,请仔细核对信息。', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                    center: true
                }).then(() => {
                    this.$message({
                        type: 'success',
                        message: '确定!'
                    });
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '取消'
                    });
                });
            },
            getValue(e) {
                console.log(e)
            },
            selectApplicationForm() {
                if (!this.form.solutionsId) return this.$message.warning('请先选择保险方案')
                this.$refs.selectApplicationForm.open('选择申请单', this.form.solutionsId)
            },
            changeTime(e) {
                if (e.length > 0) {
                    this.form.applyStartTime = e[0]
                    this.form.applyEndTime = e[1]
                } else {
                    this.form.applyStartTime = ''
                    this.form.applyEndTime = ''
                }
            },
            open (title, target) {
                this.getSolutions()
                this.title = title
                if (target) {
                    this.$nextTick(() => {
                        this.$refs.form.resetFields()
                    })
                } else {
                    this.$nextTick(() => {
                        this.$refs.form.resetFields()
                        this.form[this.configData['field.id']] = null
                    })
                }
                this.visible = true
            },
            // 查询全部方案
            getSolutions() {
                all({})
                    .then(res => {
                        this.solutions = res
                    })
            },
            // 选择保险单
            selectSolutions(id) {
                this.solutions.forEach(item => {
                    if (item.id === id) {
                        this.item = item
                    }
                })
            }
        }
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
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,
  components: { GlobalWindow, selectApplicationForm, employeeList },
  data () {
    return {
      form: {
        baseSolutionId: null,
        applyIds: [],
        startDate: null,
        endDate: null
      },
      solutions: [],
      list: [],
      endTime: '',
      item: null,
      time: [],
      // 验证规则
      rules: {
        baseSolutionId: [
          { required: true, message: '请选择保险方案' }
        ],
        startDate: [
          { required: true, message: '请选择保险生效起期' }
        ]
      }
    }
  },
  created () {
    this.config({
      api: '/business/insuranceApply',
      'field.id': 'id'
    })
  },
  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: '提交成功!'
              })
              this.visible = false
              this.$emit('success')
            }).catch(err => {
              this.$tip.apiFailed(err)
            })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '取消'
          })
        })
      })
    },
    getValue (e) {
      console.log(e)
    },
    selectApplicationForm () {
      if (!this.form.solutionsId) return this.$message.warning('请先选择保险方案')
      this.$refs.selectApplicationForm.open('选择申请单', this.form.solutionsId)
    },
    changeTime (e) {
      if (e.length > 0) {
        this.form.startDate = e[0]
        this.form.endDate = e[1]
      } else {
        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()
        })
      } else {
        this.$nextTick(() => {
          this.$refs.form.resetFields()
          this.form[this.configData['field.id']] = null
        })
      }
      this.visible = true
    },
    // 查询全部方案
    getSolutions () {
      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.baseId === id) {
          this.item = item
        }
      })
    }
  }
}
</script>
<style lang="scss" scoped>