jiangping
2024-01-29 2f919191f1c7739eb0ef54392cd265284b55af9e
Merge remote-tracking branch 'origin/master'
已添加1个文件
已修改10个文件
699 ■■■■■ 文件已修改
company/src/api/business/dispatchUnit.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/api/business/insuranceApply.js 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/api/business/member.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/common/GlobalWindow.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/enterprise/OperaInsuranceApplyWindow.vue 321 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/enterprise/addEmployee.vue 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/enterprise/confirmJobType.vue 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/enterprise/importEmployees.vue 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/components/enterprise/selectEmployees.vue 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/utils/util.js 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/views/enterprise/insuranceApply.vue 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
company/src/api/business/dispatchUnit.js
@@ -31,3 +31,8 @@
export function editDispatchUnit (data) {
    return request.post('/business/dispatchUnit/editDispatchUnit', data)
}
// æ•°æ®åˆ—表
export function findListByDTO (data) {
    return request.post('/business/dispatchUnit/findListByDTO', data)
}
company/src/api/business/insuranceApply.js
@@ -11,6 +11,12 @@
export function updateById (data) {
    return request.post('/business/insuranceApply/updateById', data)
}
// æ–°å»º
export function create (data) {
    return request.post('/business/insuranceApply/create', data)
}
export function check (data) {
    return request.post('/business/insuranceApply/check', data)
}
@@ -31,6 +37,11 @@
    return request.post('/business/insuranceApply/dealBackApply', data)
}
// èŽ·å–ä¿å•æ­¢æœŸä¸Žåˆå§‹é‡‘é¢
export function getCountCyclePriceVO (data) {
    return request.post('/business/insuranceApply/getCountCyclePriceVO', data)
}
export function exportDetailExcel (data) {
    return request.post('/business/insuranceApply/exportDetailExcel', data, {
        trim: true,
company/src/api/business/member.js
@@ -16,3 +16,8 @@
export function findListByDTO (data) {
    return request.post('/business/member/findListByDTO', data)
}
// å¯¼å…¥æ¨¡æ¿
export function importExcel (data) {
    return request.post('/business/member/importExcel', data)
}
company/src/components/common/GlobalWindow.vue
@@ -20,7 +20,7 @@
    </div>
    <div v-if="withFooter" class="window__footer">
      <slot name="footer">
        <el-button @click="confirm" :loading="confirmWorking" type="primary">确定</el-button>
        <el-button @click="confirm" :loading="confirmWorking" type="primary">{{text}}</el-button>
        <el-button @click="close">返回</el-button>
      </slot>
    </div>
@@ -40,6 +40,11 @@
      type: Boolean,
      default: true
    },
    // æäº¤æŒ‰é’®æ–‡å­—
    text: {
      type: String,
      default: '确定'
    },
    // ç¡®è®¤æŒ‰é’®loading状态
    confirmWorking: {
      type: Boolean,
company/src/components/enterprise/OperaInsuranceApplyWindow.vue
@@ -2,24 +2,33 @@
    <GlobalWindow
        :title="title"
        width="100%"
        :withFooter="false"
        text="投保申请"
        :visible.sync="visible"
        :confirm-working="isWorking"
        @confirm="confirm"
    >
        <div class="list">
            <el-form :inline="true" :model="form" :rules="rules" class="demo-form-inline">
            <el-form :inline="true" ref="form" :model="form" :rules="rules" class="demo-form-inline">
                <el-form-item label="保险方案" prop="solutionId">
                    <el-select v-model="form.solutionId" placeholder="请选择">
                        <el-option label="区域一" value="shanghai"></el-option>
                        <el-option label="区域二" value="beijing"></el-option>
                    <el-select v-model="form.solutionId" @change="changeSolution" placeholder="请选择">
                        <el-option
                            v-for="item in company"
                            :key="item.id"
                            :label="item.name"
                            :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="期望保险生效起期" prop="applyStartTime">
                    <div style="display: flex; flex-direction: column;">
                        <el-date-picker
                            @change="getTimeVal"
                                v-model="form.applyStartTime"
                                type="date"
                            :disabled="!form.solutionId"
                            :picker-options="pickerOptions"
                            value-format="yyyy-MM-dd"
                            format="yyyy å¹´ MM æœˆ dd æ—¥"
                                placeholder="选择日期">
                        </el-date-picker>
                        <span style="color: #F95601; font-size: 14px;">(次日生效投保请于17:30前提交,超时提交以保险单为准)</span>
@@ -27,77 +36,101 @@
                </el-form-item>
                <el-form-item label="保险生效止期" prop="applyEndTime">
                    <el-date-picker
                        disabled
                        v-model="form.applyEndTime"
                        type="date"
                        value-format="yyyy-MM-dd"
                        format="yyyy å¹´ MM æœˆ dd æ—¥"
                        placeholder="选择日期">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="投保年龄">
                    <span>25至65</span>
                <el-form-item label="投保年龄" v-if="item">
                    <span>{{item.minAge}} è‡³ {{item.maxAge}}</span>
                </el-form-item>
                <el-form-item label="费用">
                    <span>200元/å¹´/人</span>
                <el-form-item label="费用" v-if="item">
                    <span>{{item.price}}元</span>
                    <span v-if="item.timeUnit === 0">/天</span>
                    <span v-if="item.timeUnit === 1">/半月</span>
                    <span v-if="item.timeUnit === 2">/月</span>
                    <span v-if="item.timeUnit === 3">/å¹´</span>
                    <span>/人</span>
                </el-form-item>
            </el-form>
        </div>
        <div class="btns">
            <div class="btns_item">
                <el-button type="primary" @click="$refs.selectEmployees.open('选取员工')">选取员工</el-button>
                <el-button type="primary">导入员工</el-button>
                <el-button type="primary" @click="$refs.addEmployee.open('添加员工', tableData)">添加员工</el-button>
                <el-button type="primary" @click="seleUser">选取员工</el-button>
                <el-button type="primary" @click="uploadUser">导入员工</el-button>
                <el-button type="primary" @click="addUser">添加员工</el-button>
                <el-button type="danger" @click="deleItem">删除</el-button>
            </div>
            <div class="btns_item">
                <el-button type="primary">选取派遣单位</el-button>
                <el-button type="primary" @click="sele">选取派遣单位</el-button>
            </div>
        </div>
        <el-table
            :data="tableData"
            border
            show-summary
            :summary-method="getSummaries"
            ref="multipleTable"
            @selection-change="handleSelectionChange"
            style="width: 100%;margin-bottom: 15px;">
            <el-table-column
                type="selection"
                width="55">
            </el-table-column>
            <el-table-column label="序号" width="80px">
                <template slot-scope="scope">
                    <span>{{scope.$index + 1}}</span>
                </template>
            </el-table-column>
            <el-table-column
                prop="name"
                prop="memberName"
                label="姓名">
            </el-table-column>
            <el-table-column
                prop="idcardNo"
                prop="idCard"
                label="身份证号">
            </el-table-column>
            <el-table-column
                prop="address"
                label="年龄">
                <template slot-scope="{row}">
                    <span v-if="row.idCard">{{ getAgeByIdCard(row.idCard) }}</span>
                </template>
            </el-table-column>
            <el-table-column
                prop="address"
                prop="duName"
                label="派遣单位">
            </el-table-column>
            <el-table-column
                prop="address"
                prop="workTypeName"
                label="所属工种">
            </el-table-column>
            <el-table-column
                prop="address"
                prop="fee"
                label="费用">
            </el-table-column>
            <el-table-column
                prop="address"
                label="操作">
                <template slot-scope="scope">
                    <el-button type="text" style="color: red;" @click="dele(scope.$index)">删除</el-button>
                </template>
            </el-table-column>
        </el-table>
        <div class="submit">
            <el-button type="primary">投保申请</el-button>
        </div>
        <div class="info">
            å¯Œæ–‡æœ¬
        <div class="info" v-if="item">
            <span v-if="item.specialAgreement">{{item.specialAgreement}}</span>
            <span v-if="item.specialInfo">{{item.specialInfo}}</span>
            <span v-if="item.ortherInfo">{{item.ortherInfo}}</span>
        </div>
        <!--    é€‰æ‹©å‘˜å·¥    -->
        <selectEmployees ref="selectEmployees" />
        <selectEmployees ref="selectEmployees" @result="getValue" />
        <!--    æ·»åŠ å‘˜å·¥    -->
        <addEmployee ref="addEmployee" @result="getValue" />
        <!--    å¯¼å…¥åå•    -->
        <importEmployees ref="importEmployees" @result="getValue" />
        <!--    ç¡®è®¤å·¥ç§    -->
        <confirmJobType ref="confirmJobType" @result="getUser" />
    </GlobalWindow>
</template>
@@ -106,10 +139,14 @@
import GlobalWindow from '@/components/common/GlobalWindow'
import selectEmployees from '@/components/enterprise/selectEmployees'
import addEmployee from '@/components/enterprise/addEmployee'
import importEmployees from '@/components/enterprise/importEmployees'
import confirmJobType from '@/components/enterprise/confirmJobType'
import { all } from '@/api/business/solutions'
import { create, getCountCyclePriceVO } from '@/api/business/insuranceApply'
export default {
  name: 'OperaInsuranceApplyWindow',
  extends: BaseOpera,
  components: { GlobalWindow, selectEmployees, addEmployee },
  components: { GlobalWindow, selectEmployees, addEmployee, importEmployees, confirmJobType },
  data () {
    return {
      form: {
@@ -118,6 +155,11 @@
          applyStartTime: '',
          applyEndTime: ''
      },
      pickerOptions: {}, // å­˜æ”¾picker options的变量
      price: '',
      company: [],
      seleData: [],
      item: null,
      // éªŒè¯è§„则
      rules: {
          solutionId: [
@@ -137,6 +179,229 @@
      })
  },
  methods: {
      open (title, target) {
          this.title = title
          this.tableData = []
          this.form.id = null
          this.item = null
          this.form.solutionId = ''
          this.form.applyStartTime = ''
          this.form.applyEndTime = ''
          this.$nextTick(() => {
              this.$refs.form.resetFields()
              this.form[this.configData['field.id']] = null
          })
          this.visible = true
          this.getCompany()
          this.updatePickerOptions()
      },
        getSummaries(param) {
            const { columns, data } = param
            const sums = []
            columns.forEach((column, index) => {
                if (index === 0) {
                    sums[index] = '总价'
                    return
                } else if (index === 7) {
                    let total = 0
                    this.tableData.forEach(item => {
                        total += item.fee
                    })
                    sums[index] = total
                    return
                }
            })
            return sums
        },
        deleItem() {
            if (this.seleData.length === 0) {
                this.$message.warning('至少选择一项内容')
                return
            }
            this.seleData.forEach(item => {
                this.tableData.forEach((row, index) => {
                    if (item === row.name) {
                        this.tableData.splice(index, 1)
                    }
                })
            })
        },
        confirm() {
            this.$refs.form.validate((valid) => {
                if (valid) {
                    if (this.tableData.length === 0) {
                        this.$message.warning('至少添加一项员工')
                        return
                    }
                    for (let i = 0; i < this.tableData.length; i++) {
                        console.log(this.tableData[i].worktypeId, this.tableData[i].duId)
                        if (!this.tableData[i].worktypeId || !this.tableData[i].duId) {
                            this.$message.warning('请完善派遣单位和工种信息')
                            return
                        }
                    }
                    let arr = JSON.parse(JSON.stringify(this.tableData))
                    arr.forEach(item => {
                        item.idcardNo = item.idCard
                    })
                    this.isWorking = true
                    create({
                        applyDetailList: arr,
                        applyStartTime: this.form.applyStartTime,
                        applyEndTime: this.form.applyEndTime,
                        solutionId: this.form.solutionId
                    }).then(() => {
                        this.visible = false
                        this.$tip.apiSuccess('操作成功')
                        this.$emit('success')
                    })
                    .catch(e => {
                        this.$tip.apiFailed(e)
                    })
                    .finally(() => {
                        this.isWorking = false
                    })
                }
            })
        },
        // èŽ·å–ç»“æŸæ—¶é—´å’Œä»·æ ¼
        getTimeVal(time) {
            getCountCyclePriceVO({
                solutionsId: this.form.solutionId,
                startDate: time
            }).then(res => {
                this.price = res.cyclePrice
                this.form.applyEndTime = res.endDate.substring(0, 10)
                this.tableData.forEach(item => {
                    item.fee = res.cyclePrice
                })
                console.log(this.tableData)
                this.$forceUpdate()
            })
        },
        getDate(n) { // n为多少天,-代表往前,+代表往后
            let date1 = new Date(),
            time1 = date1.getFullYear() + "-" + (date1.getMonth() + 1) + "-" + date1.getDate();//time1表示当前时间
            let date2 = new Date(date1);
            date2.setDate(date1.getDate() + n);
            let time2 = date2.getFullYear() + "-" + ("0" + (date2.getMonth() + 1)).slice(-2) + "-" + ("0" + date2.getDate()).slice(-2);
            return time2
        },
        updatePickerOptions() {
          var that = this;
            this.pickerOptions = {
                disabledDate(time) {
                    if (!that.item) return
                    if (that.item.validType === 1) {
                        // æ¬¡æœˆ
                        const currentDate = new Date();
                        currentDate.setMonth(currentDate.getMonth() + 1);
                        currentDate.setDate(1);
                        return time.getTime() <= new Date(currentDate.toLocaleString()).getTime() - 8.64e7;
                    } else if (that.item.validType === 0) {
                        // å¤šå°‘日后生效
                        return time.getTime() <= new Date(that.getDate(that.item.validTypeNum)).getTime();
                    }
                }
            };
        },
        seleUser() {
            if (!this.form.solutionId) {
                this.$message.warning('请先选择保险方案')
                return
            }
            this.$refs.selectEmployees.open('选取员工', { arr: this.tableData, price: this.price })
        },
      addUser() {
          if (!this.form.solutionId) {
              this.$message.warning('请先选择保险方案')
              return
          }
          this.$refs.addEmployee.open('添加员工', { arr: this.tableData, price: this.price })
      },
      uploadUser() {
          if (!this.form.solutionId) {
              this.$message.warning('请先选择保险方案')
              return
          }
          this.$refs.importEmployees.open('上传名单', { arr: this.tableData, price: this.price })
      },
      // åˆ‡æ¢æ–¹æ¡ˆ
      changeSolution(e) {
          this.company.forEach(item => {
              if (item.id === e) {
                  // this.price = item.price
                  this.item = item
                  this.updatePickerOptions()
              }
          })
          this.tableData.forEach(item => {
              item.fee = this.price
          })
      },
      dele(index) {
          this.tableData.splice(index, 1)
      },
      getUser(obj) {
          this.seleData.forEach(item => {
              this.tableData.forEach(row => {
                   if (item === row.name) {
                       row.workTypeName = obj.workTypeName
                       row.worktypeId = obj.worktypeId
                       row.duName = obj.duName
                       row.duId = obj.duId
                   }
              })
          })
          this.seleData = []
          this.$refs.multipleTable.clearSelection();
      },
      // é€‰æ‹©å‘˜å·¥
      sele() {
          if (!this.form.solutionId) {
              this.$message.warning('请选择保险方案')
              return
          }
          if (this.seleData.length === 0) {
              this.$message.warning('请选择员工')
              return
          }
          this.$refs.confirmJobType.open('确认工种', { solutionId: this.form.solutionId })
      },
      // æŸ¥è¯¢å…¨éƒ¨æ–¹æ¡ˆ
      getCompany() {
          all({})
            .then(res => {
                this.company = res
            })
      },
      getAgeByIdCard(idCard){
          const sexAndAge = {}
          //获取用户身份证号码
          const userCard = idCard
          //如果用户身份证号码为undefined则返回空
          if (!userCard) {
              return sexAndAge
          }
          // èŽ·å–å‡ºç”Ÿæ—¥æœŸ
          const yearBirth = userCard.substring(6, 10)
          const monthBirth = userCard.substring(10, 12)
          const dayBirth = userCard.substring(12, 14)
          // èŽ·å–å½“å‰å¹´æœˆæ—¥å¹¶è®¡ç®—å¹´é¾„
          const myDate = new Date()
          const monthNow = myDate.getMonth() + 1
          const dayNow = myDate.getDate()
          let age = myDate.getFullYear() - yearBirth
          if (monthNow < monthBirth || (monthNow == monthBirth && dayNow < dayBirth)) {
              age--
          }
          // å¾—到年龄
          sexAndAge.age = age
          return sexAndAge.age
      },
      handleSelectionChange (e) {
          this.seleData = e.map(item => item.name)
      },
      getValue(list) {
          this.tableData.push(...list)
      }
@@ -168,5 +433,7 @@
    }
    .info {
        width: 100%;
        font-size: 14px;
        color: black;
    }
</style>
company/src/components/enterprise/addEmployee.vue
@@ -9,10 +9,10 @@
        <el-form :inline="true" class="demo-form-inline">
            <div v-for="(item, index) in list" :key="index">
                <el-form-item label="姓名" required>
                    <el-input v-model="item.name" placeholder="请输入"></el-input>
                    <el-input v-model="item.memberName" placeholder="请输入"></el-input>
                </el-form-item>
                <el-form-item label="身份证号" required>
                    <el-input v-model="item.idcardNo" maxlength="18" placeholder="请输入"></el-input>
                    <el-input v-model="item.idCard" maxlength="18" placeholder="请输入"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-if="index === 0" @click="add">添加</el-button>
@@ -34,29 +34,46 @@
            return {
                list: [
                    {
                        name: '',
                        idcardNo: ''
                        memberName: '',
                        idCard: '',
                        workTypeName: '',
                        worktypeId: '',
                        duName: '',
                        duId: '',
                        fee: ''
                    }
                ],
                price: 0,
                arr: []
            }
        },
        methods: {
            open (title, arr) {
            open (title, obj) {
                this.title = title
                this.visible = true
                this.list = [
                    {
                        name: '',
                        idcardNo: ''
                        memberName: '',
                        idCard: '',
                        workTypeName: '',
                        worktypeId: '',
                        duName: '',
                        duId: '',
                        fee: ''
                    }
                ]
                this.arr = arr
                this.arr = obj.arr
                this.price = obj.price
            },
            add() {
                this.list.push({
                    name: '',
                    idCard: ''
                    memberName: '',
                    idCard: '',
                    workTypeName: '',
                    worktypeId: '',
                    duName: '',
                    duId: '',
                    fee: ''
                })
            },
            dele(index) {
@@ -67,28 +84,39 @@
            },
            confirm() {
                // åˆ¤æ–­åˆ—表否是有空值
                for (let i = 0; this.list.length; i++) {
                    if (!this.list[i].name || !this.list[i].idcardNo) {
                        this.$message.warning('请先完善信息后再提交')
                        return
                    }
                }
                // for (let i = 0; this.list.length; i++) {
                //     if (!this.list[i].memberName || !this.list[i].idCard) {
                //         this.$message.warning('请先完善信息后再提交')
                //         return
                //     }
                // }
                // åˆ¤æ–­æ–°å½•入数据身份证是否有重复
                let idcardList = this.list.map(item => item.idcardNo)
                let idcardList = this.list.map(item => item.idCard)
                if (this.hasDuplicates(idcardList)) {
                    this.$message.warning('身份证有重复')
                    return
                }
                // åˆ¤æ–­èº«ä»½è¯æ˜¯å¦æœ‰æ•ˆ
                for (let i = 0; i < this.list.length; i++) {
                    const regExp = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
                    if (!regExp.test(this.list[i].idCard)) {
                        this.$message.warning(`第${i + 1}项员工身份证不合法`)
                        return
                    }
                }
                // åˆ¤æ–­è¯¦æƒ…列表数据身份证是否有重复
                let next = true
                this.list.forEach(item => {
                    this.arr.forEach(child => {
                        if (item.idcardNo === child.idcardNo) {
                        if (item.idCard === child.idCard) {
                            next = false
                        }
                    })
                })
                if (next) {
                    this.list.forEach(item => {
                        item.fee = this.price
                    })
                    this.$emit('result', this.list)
                    this.visible = false
                } else {
company/src/components/enterprise/confirmJobType.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,112 @@
<template>
    <GlobalWindow
        :title="title"
        width="30%"
        :visible.sync="visible"
        :confirm-working="isWorking"
        @confirm="confirm"
    >
        <el-form class="demo-form-inline">
            <el-form-item label="派遣单位" required>
                <el-select v-model="dw" @change="selectChange" placeholder="请选择">
                    <el-option
                        v-for="item in dispatching"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="所属工种" required>
                <el-select v-model="gz" placeholder="请选择">
                    <el-option
                        v-for="item in options"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
        </el-form>
    </GlobalWindow>
</template>
<script>
    import BaseOpera from '@/components/base/BaseOpera'
    import GlobalWindow from '@/components/common/GlobalWindow'
    import { findListByDTO } from '@/api/business/dispatchUnit'
    import { findListByDTO as worktype } from '@/api/business/worktype'
    export default {
        name: 'confirmJobType',
        extends: BaseOpera,
        components: { GlobalWindow },
        data () {
            return {
                form: {
                    solutionId: ''
                },
                data: [],
                dw: [],
                gz: [],
                dispatching: [],
                options: []
            }
        },
        methods: {
            open (title, arr) {
                this.title = title
                this.form.solutionId = arr.solutionId
                this.data = arr.seleData
                this.visible = true
                this.getFindListByDTO()
            },
            getFindListByDTO () {
                findListByDTO({
                    solutionId: this.form.solutionId,
                    dataType: 2
                }).then(res => {
                    this.dispatching = res
                })
            },
            selectChange(id) {
                this.gz = ''
                let duSolutionId = ''
                this.dispatching.forEach(item => {
                    if (item.id === id) {
                        duSolutionId = item.duSolutionId
                    }
                })
                worktype({ id: duSolutionId, queryType: 1 })
                    .then(res => {
                        this.options = res
                    })
            },
            confirm() {
                let obj = {
                    workTypeName: '',
                    worktypeId: '',
                    duName: '',
                    duId: ''
                }
                this.dispatching.forEach(item => {
                    if (item.id === this.dw) {
                        obj.duName = item.name
                        obj.duId = item.id
                    }
                })
                this.options.forEach(item => {
                    if (item.id === this.gz) {
                        obj.workTypeName = item.name
                        obj.worktypeId = item.id
                    }
                })
                this.$emit('result', obj)
                this.visible = false
            }
        }
    }
</script>
<style lang="scss" scoped>
</style>
company/src/components/enterprise/importEmployees.vue
@@ -1,43 +1,86 @@
<template>
    <GlobalWindow
        :title="title"
        width="100%"
        width="30%"
        :visible.sync="visible"
        :confirm-working="isWorking"
        @confirm="confirm"
    >
        <el-form class="demo-form-inline">
            <el-form-item label="上传名单" required>
                <div style="width: 100%;display: flex;align-items: center;">
                <el-button type="primary" @click="clickRef">点击上传</el-button>
                <el-button type="text">名单模板.EXCEL</el-button>
                </div>
                <div style="font-size: 14px; color: black;" v-if="fileName">{{fileName}}</div>
            </el-form-item>
        </el-form>
        <input type="file" accept=".excel" ref="fileExcel" @change="result" />
        <input type="file" style="position: fixed; left: 0; top: -50px;" accept=".xlsx" ref="fileExcel" @change="result" />
    </GlobalWindow>
</template>
<script>
    import BaseOpera from '@/components/base/BaseOpera'
    import GlobalWindow from '@/components/common/GlobalWindow'
    import { importExcel } from '@/api/business/member'
    export default {
        name: 'importEmployees',
        extends: BaseOpera,
        components: { GlobalWindow },
        data () {
            return {
                list: []
                list: [],
                price: 0,
                addList: [],
                fileName: ''
            }
        },
        methods: {
            open (title, arr) {
            open (title, obj) {
                this.title = title
                this.addList = []
                this.fileName = ''
                this.visible = true
                this.list = obj.arr
                this.price = obj.price
            },
            clickRef () {
                this.$refs.fileExcel.click()
            },
            result (e) {
                console.log(e)
                const data = new FormData()
                data.append('file', e.target.files[0])
                importExcel(data)
                    .then(res => {
                        res.forEach(item => {
                            item.memberName = item.name
                            item.fee = ''
                        })
                        this.addList = res
                        this.fileName = e.target.files[0].name
                    })
                    .catch(err => {
                        this.$message.error(err)
                        this.fileName = ''
                    })
                    .finally(() => {
                        this.$refs.fileExcel.value = null
                    })
            },
            confirm () {
                for (let i = 0; i < this.addList.length; i++) {
                    for (let a = 0; a < this.list.length; a++) {
                        if (this.addList[i].name === this.list[a].memberName || this.addList[i].idCard === this.list[a].idcardNo) {
                            this.$message.warning(`[${this.addList[i].name}]员工重复`)
                            return
                        }
                    }
                }
                this.addList.forEach(item => {
                    item.fee = this.price || ''
                })
                this.$emit('result', this.addList)
                this.visible = false
            }
        }
    }
company/src/components/enterprise/selectEmployees.vue
@@ -10,26 +10,31 @@
        <el-table
            :data="list"
            border
            @selection-change="handleSelectionChange"
            style="width: 100%">
            <el-table-column
                type="selection"
                width="55">
            </el-table-column>
            <el-table-column label="序号" width="80px">
                <template slot-scope="scope">
                    <span>{{scope.$index + 1}}</span>
                </template>
            </el-table-column>
            <el-table-column
                prop="date"
                prop="name"
                label="姓名">
            </el-table-column>
            <el-table-column
                prop="name"
                prop="idcardNo"
                label="身份证号">
            </el-table-column>
            <el-table-column
                prop="address"
                prop="duName"
                label="派遣单位">
            </el-table-column>
            <el-table-column
                prop="address"
                prop="workTypeName"
                label="所属工种">
            </el-table-column>
        </el-table>
@@ -47,7 +52,10 @@
        data () {
            return {
                val: '',
                list: []
                list: [],
                price: '',
                seleData: [],
                oldList: []
            }
        },
        created () {
@@ -57,16 +65,49 @@
            })
        },
        methods: {
            open (title) {
            open (title, obj) {
                this.price = obj.price
                this.oldList = obj.arr
                this.title = title
                this.visible = true
                this.getList()
            },
            confirm() {
                if (this.seleData.length === 0) {
                    this.$message.warning('至少选择一项内容')
                    return
                }
                for (let i = 0; i < this.seleData.length; i++) {
                    for (let a = 0; a < this.oldList.length; a++) {
                        if (this.seleData[i].name === this.oldList[a].memberName || this.seleData[i].idCard === this.oldList[a].idcardNo) {
                            this.$message.warning(`[${this.seleData[i].name}]员工重复`)
                            return
                        }
                    }
                }
                this.seleData.forEach(item => {
                    item.idCard = item.idcardNo
                    item.memberName = item.name
                    item.workTypeName = ''
                    item.worktypeId = ''
                    item.duId = ''
                    item.duName = ''
                    item.fee = this.price
                })
                this.$emit('result', this.seleData)
                this.visible = false
            },
            handleSelectionChange (e) {
                this.seleData = e
            },
            getList() {
                findListByDTO({
                    name: this.val
                }).then(res => {
                    this.list = []
                    res.forEach(item => {
                        item.fee = ''
                    })
                    this.list = res
                })
            }
        }
company/src/utils/util.js
@@ -18,3 +18,52 @@
  }
  return data
}
// æ ¹æ®èº«ä»½è¯èŽ·å–å¹´é¾„
export function GetAge (identityCard) {
  let len = (identityCard + "").length;
  let strBirthday = "";
  if (len === 18) {
    //处理18位的身份证号码从号码中得到生日和性别代码
    strBirthday =
        identityCard.substr(6, 4) +
        "/" +
        identityCard.substr(10, 2) +
        "/" +
        identityCard.substr(12, 2);
  }
  if (len === 15) {
    let birthdayValue = "";
    birthdayValue = identityCard.charAt(6) + identityCard.charAt(7);
    if (parseInt(birthdayValue) < 10) {
      strBirthday =
          "20" +
          identityCard.substr(6, 2) +
          "/" +
          identityCard.substr(8, 2) +
          "/" +
          identityCard.substr(10, 2);
    } else {
      strBirthday =
          "19" +
          identityCard.substr(6, 2) +
          "/" +
          identityCard.substr(8, 2) +
          "/" +
          identityCard.substr(10, 2);
    }
  }
  let birthDate = new Date(strBirthday);
  let nowDateTime = new Date();
  let age = nowDateTime.getFullYear() - birthDate.getFullYear();
  //再考虑月、天的因素;.getMonth()获取的是从0开始的,这里进行比较,不需要加1
  if (
      nowDateTime.getMonth() < birthDate.getMonth() ||
      (nowDateTime.getMonth() == birthDate.getMonth() &&
          nowDateTime.getDate() < birthDate.getDate())
  ) {
    age--;
  }
  return age;
}
company/src/views/enterprise/insuranceApply.vue
@@ -3,7 +3,7 @@
        <!-- æœç´¢è¡¨å• -->
        <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
            <el-form-item label="状态" prop="status">
                <el-select v-model="searchForm.status" placeholder="请选择" @keypress.enter.native="search">
                <el-select v-model="searchForm.status" placeholder="请选择" @change="search">
                    <el-option label="待审批" value="0"></el-option>
                    <el-option label="待签署" value="2"></el-option>
                    <el-option label="已签署" value="3"></el-option>
@@ -51,14 +51,21 @@
                        <span>{{scope.$index + 1}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="status" label="状态"></el-table-column>
                <el-table-column prop="status" label="状态">
                    <template slot-scope="{row}">
                        <span v-if="row.status === 0">待审批</span>
                        <span v-if="row.status === 2">待签署</span>
                        <span v-if="row.status === 3">已签署</span>
                        <span v-if="row.status === 4">已撤销</span>
                    </template>
                </el-table-column>
                <el-table-column prop="solutionsName" label="保险方案"></el-table-column>
                <el-table-column prop="insureNum" label="投保人数"></el-table-column>
                <el-table-column prop="serviceDays" label="投保时长(天)"></el-table-column>
                <el-table-column prop="fee" label="总费用(元)"></el-table-column>
                <el-table-column prop="createTimeS" label="提交日期"></el-table-column>
                <el-table-column prop="endTimeE" label="投保生效日期"></el-table-column>
                <el-table-column prop="endTimeS" label="投保失效日期"></el-table-column>
                <el-table-column prop="checkDate" label="提交日期"></el-table-column>
                <el-table-column prop="startTime" label="投保生效日期"></el-table-column>
                <el-table-column prop="endTime" label="投保失效日期"></el-table-column>
                <el-table-column
                    v-if="containPermissions(['business:insuranceapply:update', 'business:insuranceapply:delete'])"
                    label="操作"