gaoluyang
昨天 b93657ca98a9f1ced3aacc255c3fa09b7d39cca4
src/views/CNAS/personnel/personnelInfo/components/AddInDetail.vue
@@ -33,12 +33,20 @@
            </el-col>
            <el-col :span="12">
              <el-form-item label="培训讲师:" prop="trainingLecturerId">
                <el-select v-model="trainingPlan.trainingLecturerId"
                           clearable filterable
                           placeholder="请选择" size="small" style="width: 100%;">
                  <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
                  </el-option>
                </el-select>
                <div style="display: flex; align-items: center; gap: 8px; width: 100%;">
                  <el-radio-group v-model="lecturerType" size="small" @change="handleLecturerTypeChange">
                    <el-radio-button label="internal">内部人员</el-radio-button>
                    <el-radio-button label="external">外聘讲师</el-radio-button>
                  </el-radio-group>
                  <el-select v-if="lecturerType === 'internal'" v-model="trainingPlan.trainingLecturerId"
                             clearable filterable
                             placeholder="请选择" size="small" style="flex: 1;">
                    <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
                    </el-option>
                  </el-select>
                  <el-input v-else v-model="trainingPlan.trainingLecturerName" clearable
                            placeholder="请输入外聘讲师姓名" size="small" style="flex: 1;"></el-input>
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="12">
@@ -88,6 +96,7 @@
    return {
      addTrainingPlanDia: false,
      submitAddLoading: false,
      lecturerType: 'internal',
      trainingPlan: {
        planId: '',
        id: '',
@@ -97,6 +106,7 @@
        participants: '',
        trainingContent: '',
        trainingLecturerId: '',
        trainingLecturerName: '',
        trainingMode: '',
        holdingDepartment: '',
        remarks: '',
@@ -104,7 +114,6 @@
      trainingPlanRules: {
        trainingDate: [{ required: true, message: '请选择培训日期', trigger: 'change' }],
        trainingContent: [{ required: true, message: '请输入培训内容', trigger: 'blur' }],
        trainingLecturerId: [{ required: true, message: '请选择培训讲师', trigger: 'blur' }],
      },
      responsibleOptions: [],
      operationType: ''
@@ -117,7 +126,9 @@
      this.operationType = type
      if (this.operationType === 'edit') {
        this.trainingPlan = this.HaveJson(row)
        this.lecturerType = row.trainingLecturerId ? 'internal' : (row.trainingLecturerName ? 'external' : 'internal')
      } else {
        this.lecturerType = 'internal'
        this.trainingPlan = {
          id: '',
          trainingDate: '',
@@ -134,10 +145,32 @@
      this.trainingPlan.planId = id
      this.getUserList()
    },
    handleLecturerTypeChange(type) {
      if (type === 'internal') {
        this.trainingPlan.trainingLecturerName = ''
      } else {
        this.trainingPlan.trainingLecturerId = null
      }
    },
    // 提交新增
    submitAdd() {
      this.$refs.trainingPlanForm.validate((valid) => {
        if (valid) {
          if (this.lecturerType === 'internal' && !this.trainingPlan.trainingLecturerId) {
            this.$message.warning('请选择培训讲师')
            return
          }
          if (this.lecturerType === 'external') {
            const lecturerName = (this.trainingPlan.trainingLecturerName || '').trim()
            if (!lecturerName) {
              this.$message.warning('请输入外聘讲师姓名')
              return
            }
            this.trainingPlan.trainingLecturerId = null
            this.trainingPlan.trainingLecturerName = lecturerName
          } else {
            this.trainingPlan.trainingLecturerName = null
          }
          this.submitAddLoading = true
          this.trainingPlan.planId = this.currentChangeRow.id
          const personTrainingDetailed = this.trainingPlan