194 lines
		
	
	
		
			6.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			194 lines
		
	
	
		
			6.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
<template>
 | 
						||
  <el-form
 | 
						||
    ref="taskAllocationRuleDataForm"
 | 
						||
    v-loading="loading"
 | 
						||
    :model="form"
 | 
						||
    :rules="rules"
 | 
						||
    size="small"
 | 
						||
  >
 | 
						||
    <div v-if="list.length > 0">
 | 
						||
      <div style="text-align: right">
 | 
						||
        <el-button size="mini" type="primary" style="position:relative;top: -10px" @click="clearAll">
 | 
						||
          清空全部未读阅片人
 | 
						||
        </el-button>
 | 
						||
      </div>
 | 
						||
      <div v-if="readingType === 1" style="line-height: 32px;margin-bottom: 10px;">
 | 
						||
        阅片人(R1):
 | 
						||
        <el-tag v-if="findDoctorUser(list, 0).DoctorUser && !findDoctorUser(list, 0).IsCancelAssign" :closable="!findDoctorUser(list, 0).IsHaveReading" @close="myClose(findDoctorUser(list, 0))">
 | 
						||
          {{findDoctorUser(list, 0).DoctorUser.UserName}}({{findDoctorUser(list, 0).DoctorUser.FullName}})
 | 
						||
        </el-tag>
 | 
						||
      </div>
 | 
						||
      <div v-if="readingType === 2" style="line-height: 32px;margin-bottom: 10px;">
 | 
						||
        阅片人(R1):
 | 
						||
        <el-tag v-if="findDoctorUser(list, 1).DoctorUser && !findDoctorUser(list, 1).IsCancelAssign" :closable="!findDoctorUser(list, 1).IsHaveReading" @close="myClose(findDoctorUser(list, 1))">
 | 
						||
          {{findDoctorUser(list, 1).DoctorUser.UserName}}({{findDoctorUser(list, 1).DoctorUser.FullName}})
 | 
						||
        </el-tag>
 | 
						||
      </div>
 | 
						||
      <div v-if="readingType === 2" style="line-height: 32px;margin-bottom: 10px;">
 | 
						||
        阅片人(R2):
 | 
						||
        <el-tag v-if="findDoctorUser(list, 2).DoctorUser && !findDoctorUser(list, 2).IsCancelAssign" :closable="!findDoctorUser(list, 2).IsHaveReading" @close="myClose(findDoctorUser(list, 2))">
 | 
						||
          {{findDoctorUser(list, 2).DoctorUser.UserName}}({{findDoctorUser(list, 2).DoctorUser.FullName}})
 | 
						||
        </el-tag>
 | 
						||
      </div>
 | 
						||
      <div style="line-height: 32px;margin-bottom: 10px;">
 | 
						||
        裁判(AD):
 | 
						||
        <el-tag v-if="findDoctorUser(list, 3).DoctorUser && !findDoctorUser(list, 3).IsCancelAssign" :closable="!findDoctorUser(list, 3).IsHaveReading" @close="myClose(findDoctorUser(list, 3))">
 | 
						||
          {{findDoctorUser(list, 3).DoctorUser.UserName}}({{findDoctorUser(list, 3).DoctorUser.FullName}})
 | 
						||
        </el-tag>
 | 
						||
      </div>
 | 
						||
      <div style="line-height: 32px;margin-bottom: 10px;">
 | 
						||
        肿瘤阅片人(O1):
 | 
						||
        <el-tag v-if="findDoctorUser(list, 4).DoctorUser && !findDoctorUser(list, 4).IsCancelAssign" :closable="!findDoctorUser(list, 4).IsHaveReading" @close="myClose(findDoctorUser(list, 4))">
 | 
						||
         {{findDoctorUser(list, 4).DoctorUser.UserName}}({{findDoctorUser(list, 4).DoctorUser.FullName}})
 | 
						||
        </el-tag>
 | 
						||
      </div>
 | 
						||
      <div style="line-height: 32px;margin-bottom: 10px;font-size: 12px;color:#f66;">
 | 
						||
        <i class="el-icon-info"></i>如果分配的阅片人已开始读片则不能清空
 | 
						||
      </div>
 | 
						||
      <div>
 | 
						||
        <el-form-item label-width="80px" label="原因:" prop="Note">
 | 
						||
          <el-input v-model="form.Note" type="textarea"  maxlength="500" show-word-limit></el-input>
 | 
						||
        </el-form-item>
 | 
						||
      </div>
 | 
						||
    </div>
 | 
						||
    <div class="base-dialog-footer" style="text-align:right;margin-top:10px;">
 | 
						||
      <el-form-item>
 | 
						||
        <!-- 取消 -->
 | 
						||
        <el-button
 | 
						||
          :disabled="loading"
 | 
						||
          size="small"
 | 
						||
          type="primary"
 | 
						||
          @click="close"
 | 
						||
        >
 | 
						||
          {{ $t('common:button:cancel') }}
 | 
						||
        </el-button>
 | 
						||
        <!-- 保存 -->
 | 
						||
        <el-button size="small" type="primary" :loading="loading" @click="save">
 | 
						||
          {{ $t('common:button:save') }}
 | 
						||
        </el-button>
 | 
						||
      </el-form-item>
 | 
						||
    </div>
 | 
						||
  </el-form>
 | 
						||
</template>
 | 
						||
 | 
						||
<script>
 | 
						||
import { getSubjectAssignedDoctorList, cancelSubjectAssignedDoctor, addSubjectCancelDoctorNote } from '@/api/trials/reading'
 | 
						||
 | 
						||
export default {
 | 
						||
  name: 'ManualAllocationTable',
 | 
						||
  props: {
 | 
						||
    data: {
 | 
						||
      type: Object,
 | 
						||
      default() {
 | 
						||
        return {}
 | 
						||
      }
 | 
						||
    },
 | 
						||
    readingType: {
 | 
						||
      type: Number,
 | 
						||
      default() {
 | 
						||
        return 0
 | 
						||
      }
 | 
						||
    }
 | 
						||
  },
 | 
						||
  data() {
 | 
						||
    return {
 | 
						||
      TrialId: this.$route.query.trialId,
 | 
						||
      list: [],
 | 
						||
      loading: false,
 | 
						||
      btnLoading: false,
 | 
						||
      form: {
 | 
						||
        Note: ''
 | 
						||
      },
 | 
						||
      rules: {
 | 
						||
        Note: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }],
 | 
						||
      },
 | 
						||
    }
 | 
						||
  },
 | 
						||
  mounted() {
 | 
						||
    this.TrialId = this.$route.query.trialId
 | 
						||
    this.loading = true
 | 
						||
    getSubjectAssignedDoctorList(this.data.SubjectId).then(res => {
 | 
						||
      this.list = res.Result
 | 
						||
      this.loading = false
 | 
						||
    }).catch(() => {
 | 
						||
      this.loading = false
 | 
						||
    })
 | 
						||
  },
 | 
						||
  methods: {
 | 
						||
    clearAll () {
 | 
						||
      var is = false
 | 
						||
      this.form.Note = ''
 | 
						||
      this.list.forEach((v,i) => {
 | 
						||
        if (!v.IsHaveReading) {
 | 
						||
          this.$set(v, 'IsCancelAssign', true)
 | 
						||
          if (i + 1 === this.list.length) {
 | 
						||
            this.form.Note += `取消${this.$fd('ArmEnum', v.ArmEnum)}阅片人${v.DoctorUser.UserName}(${v.DoctorUser.FullName});`
 | 
						||
          } else {
 | 
						||
            this.form.Note += `取消${this.$fd('ArmEnum', v.ArmEnum)}阅片人${v.DoctorUser.UserName}(${v.DoctorUser.FullName});\n`
 | 
						||
          }
 | 
						||
          is = true
 | 
						||
        }
 | 
						||
      })
 | 
						||
      if (is) {
 | 
						||
        this.$message.success('已全部清空,请点击保存应用')
 | 
						||
      } else {
 | 
						||
        this.$message.error('没有可清空的阅片人')
 | 
						||
      }
 | 
						||
    },
 | 
						||
    myClose(o) {
 | 
						||
      this.$set(o, 'IsCancelAssign', true)
 | 
						||
      if (this.form.Note) {
 | 
						||
        this.form.Note += `\n取消${this.$fd('ArmEnum', o.ArmEnum)}阅片人${o.DoctorUser.UserName}(${o.DoctorUser.FullName});`
 | 
						||
      } else {
 | 
						||
        this.form.Note += `取消${this.$fd('ArmEnum', o.ArmEnum)}阅片人${o.DoctorUser.UserName}(${o.DoctorUser.FullName});`
 | 
						||
      }
 | 
						||
    },
 | 
						||
    findDoctorUser(list, type) {
 | 
						||
      var a
 | 
						||
      if (list.length > 0) {
 | 
						||
        a = list.find(v => {
 | 
						||
          return v.ArmEnum === type
 | 
						||
        }) ? list.find(v => {
 | 
						||
          return v.ArmEnum === type
 | 
						||
        }) : {
 | 
						||
          DoctorUser: null
 | 
						||
        }
 | 
						||
      }
 | 
						||
      return a
 | 
						||
    },
 | 
						||
    save() {
 | 
						||
      this.$refs.taskAllocationRuleDataForm.validate(valid => {
 | 
						||
        if (!valid) return
 | 
						||
        this.loading = true
 | 
						||
        var params = this.list.map(v => {
 | 
						||
          return {
 | 
						||
            Id: v.Id,
 | 
						||
            TrialId: this.TrialId,
 | 
						||
            SubjectId: this.data.SubjectId,
 | 
						||
            DoctorUserId: v.DoctorUserId,
 | 
						||
            ArmEnum: v.ArmEnum,
 | 
						||
            IsCancelAssign: v.IsCancelAssign
 | 
						||
          }
 | 
						||
        })
 | 
						||
        cancelSubjectAssignedDoctor({
 | 
						||
          CancelList: params,
 | 
						||
          Note: this.form.Note
 | 
						||
        }).then(() => {
 | 
						||
          this.loading = false
 | 
						||
          this.$message.success('保存成功')
 | 
						||
          this.$emit('getList')
 | 
						||
          this.close()
 | 
						||
        }).catch(() => {
 | 
						||
          this.loading = false
 | 
						||
        })
 | 
						||
      })
 | 
						||
    },
 | 
						||
    close() { this.$emit('close') }
 | 
						||
  }
 | 
						||
}
 | 
						||
</script>
 | 
						||
 | 
						||
<style scoped>
 | 
						||
 | 
						||
</style>
 |