k94314517
2024-11-23 3011b9800d6c5bee031d87bc4e225b5b1fb52571
company/src/components/business/OperaSolutionsBaseWindow.vue
@@ -25,7 +25,7 @@
            </el-form-item>
            <el-form-item label="投保年龄" prop="minAge">
                <div style="display: flex; align-items: center;">
                    <el-select v-model="form.minAge" style="flex: 1;" placeholder="请选择">
                    <el-select v-model="form.minAge" @change="changeMinAge" style="flex: 1;" placeholder="请选择">
                        <el-option
                            v-for="item in 80"
                            :key="item"
@@ -34,7 +34,7 @@
                        </el-option>
                    </el-select>
                    <span style="margin: 0 30px;">至</span>
                    <el-select v-model="form.maxAge" style="flex: 1;" placeholder="请选择">
                    <el-select v-model="form.maxAge" @change="changeMaxAge" style="flex: 1;" placeholder="请选择">
                        <el-option
                            v-for="item in 80"
                            :key="item"
@@ -87,7 +87,11 @@
                    placeholder="请选择批改提醒时间">
                </el-time-picker>
            </el-form-item>
            <el-button type="primary" @click="add" style="margin-bottom: 10px;">添加工种</el-button>
            <div style="display: flex; align-items: center;">
                <el-button type="primary" @click="add" style="margin-bottom: 10px;">添加工种</el-button>
                <el-button type="primary" @click="impor" style="margin-bottom: 10px;">导入工种</el-button>
                <el-button type="text" @click="exprot">导入模版xls</el-button>
            </div>
            <el-table
                :data="form.worktypeIdList"
                border
@@ -133,6 +137,8 @@
                <RichEditor :richData="form.ortherInfo" :styleEditor="'border: 1px solid #ccc;display: inline-block;'" @getWangedditor="getWangedditor2" :readonly="false"/>
            </el-form-item>
        </el-form>
        <!--    上传工种    -->
        <input type="file" @change="getFile" style="opacity: 0;" ref="upload" accept=".xlsx" />
    </GlobalWindow>
</template>
@@ -140,7 +146,7 @@
  import BaseOpera from '@/components/base/BaseOpera'
  import GlobalWindow from '@/components/common/GlobalWindow'
  import { all } from '@/api/business/insurance'
  import { all as allWorktype } from '@/api/business/worktype'
  import { all as allWorktype, importExcelForSolution } from '@/api/business/worktype'
  import { solutionsBaseId } from '@/api/business/solutionsBase'
  import { pageAll as shopList } from '@/api/business/company'
  import UploadFile from '@/components/common/UploadFile'
@@ -233,6 +239,37 @@
      })
    },
    methods: {
      // 导入工种模板
      getFile(e) {
        const formdate = new FormData()
        formdate.append('file', e.target.files[0])
        formdate.append('insuranceId', this.form.insuranceId)
        importExcelForSolution(formdate)
          .then(res => {
            console.log(res)
            res.forEach(id => {
              if (this.form.worktypeIdList.length === 1 && !this.form.worktypeIdList[0].worktypeId) {
                this.form.worktypeIdList[0].worktypeId = id
              } else {
                this.form.worktypeIdList.push({ worktypeId: id })
              }
            })
          })
          .catch(err => {
            this.$message.error(err.message)
          })
          .finally(() => {
            this.$refs.upload.value = null
          })
      },
      impor() {
        if (!this.form.insuranceId) return this.$message.warning('请先选择企业')
        this.$refs.upload.click()
      },
      // 导出模板
      exprot() {
        window.open(process.env.VUE_APP_TYPEWORK_URL)
      },
      getWangedditor(val){
        this.form.specialAgreement = val;
      },
@@ -242,7 +279,18 @@
      getWangedditor2(val){
        this.form.ortherInfo = val;
      },
      changeMinAge(e) {
        if (this.form.maxAge && this.form.maxAge >= 0 && e > this.form.maxAge) {
          this.form.minAge = ''
          this.$message.warning('起始年龄不能大于截止年龄!')
        }
      },
      changeMaxAge(e) {
        if (this.form.minAge && this.form.minAge >= 0 && e < this.form.minAge) {
          this.form.maxAge = ''
          this.$message.warning('截止年龄不能大于起始年龄!')
        }
      },
      handNumberInput (value) {
        const regex = /^[-+]?\d*$/
        if (!regex.test(value)) {
@@ -338,7 +386,6 @@
                this.form[key] = res[key]
              }
              this.form.correctWarnTime = `${this.form.correctWarnTime}:00`
              console.log(this.form.correctWarnTime)
              if (res.worktypeList) {
                this.form.worktypeIdList = res.worktypeList.map(item => {
                  return {