MrShi
2024-02-22 4be10170bc9a1546537762e03f2c963d61d2f6ea
company/src/components/enterprise/OperaDispatchUnitWindow.vue
@@ -188,12 +188,58 @@
        }
      })
    },
      // 确认新建
      __confirmCreate () {
          this.$refs.form.validate((valid) => {
              if (!valid) {
                  return
              }
              for (let i = 0; i < this.form.saveDuSolutionDTOList.length; i++) {
                  if (!this.form.saveDuSolutionDTOList[i].solutionId) {
                      this.$message.warning(`第${i + 1}项保险方案为空!`)
                      return
                  }
                  for (let a = 0; a < this.form.saveDuSolutionDTOList[i].saveDuWorkTypeDTOList.length; a++) {
                      if (!this.form.saveDuSolutionDTOList[i].saveDuWorkTypeDTOList[a].workTypeId) {
                          this.$message.warning(`第${i + 1}项保险方案第${a + 1}项工种为空!`)
                          return
                      }
                  }
              }
              // 调用新建接口
              this.isWorking = true
              this.api.create(this.form)
                  .then(() => {
                      this.visible = false
                      this.$tip.apiSuccess('新建成功')
                      this.$emit('success')
                  })
                  .catch(e => {
                      this.$tip.apiFailed(e)
                  })
                  .finally(() => {
                      this.isWorking = false
                  })
          })
      },
      // 确认修改
      __confirmEdit () {
          this.$refs.form.validate((valid) => {
              if (!valid) {
                  return
              }
              for (let i = 0; i < this.form.saveDuSolutionDTOList.length; i++) {
                if (!this.form.saveDuSolutionDTOList[i].solutionId) {
                    this.$message.warning(`第${i + 1}项保险方案为空!`)
                    return
                }
                for (let a = 0; a < this.form.saveDuSolutionDTOList[i].saveDuWorkTypeDTOList.length; a++) {
                    if (!this.form.saveDuSolutionDTOList[i].saveDuWorkTypeDTOList[a].workTypeId) {
                        this.$message.warning(`第${i + 1}项保险方案第${a + 1}项工种为空!`)
                        return
                    }
                }
              }
              // 调用新建接口
              this.isWorking = true
              editDispatchUnit(this.form)