164 lines
		
	
	
		
			5.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			164 lines
		
	
	
		
			5.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
<template>
 | 
						||
  <el-form
 | 
						||
    ref="taskAllocationRuleDataForm"
 | 
						||
    v-loading="loading"
 | 
						||
    :model="form"
 | 
						||
    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;">
 | 
						||
        如果分配的阅片人已开始读片则不能清空
 | 
						||
      </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 } 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: {}
 | 
						||
    }
 | 
						||
  },
 | 
						||
  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.list.forEach(v => {
 | 
						||
        if (!v.IsHaveReading) {
 | 
						||
          this.$set(v, 'IsCancelAssign', true)
 | 
						||
          is = true
 | 
						||
        }
 | 
						||
      })
 | 
						||
      if (is) {
 | 
						||
        this.$message.success('已全部清空,请点击保存应用')
 | 
						||
      } else {
 | 
						||
        this.$message.error('没有可清空的阅片人')
 | 
						||
      }
 | 
						||
    },
 | 
						||
    myClose(o) {
 | 
						||
      this.$set(o, 'IsCancelAssign', true)
 | 
						||
    },
 | 
						||
    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.loading = true
 | 
						||
      console.log(this.list)
 | 
						||
      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(params).then(() => {
 | 
						||
        this.loading = false
 | 
						||
        this.$message.success('保存成功')
 | 
						||
        this.$emit('getList')
 | 
						||
      }).catch(() => {this.loading = false})
 | 
						||
    },
 | 
						||
    close() { this.$emit('close') }
 | 
						||
  }
 | 
						||
}
 | 
						||
</script>
 | 
						||
 | 
						||
<style scoped>
 | 
						||
 | 
						||
</style>
 |