340 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			340 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Plaintext
		
	
	
| <template>
 | ||
|   <el-form
 | ||
|     ref="taskAllocationRuleDataForm"
 | ||
|     v-loading="loading"
 | ||
|     :model="form"
 | ||
|     size="small"
 | ||
|   >
 | ||
|     <el-tabs type="border-card" v-model="TrialReadingCriterionId">
 | ||
|       <el-tab-pane :label="item.TrialReadingCriterionName" :name="item.TrialReadingCriterionId" v-for="item of trialCriterionList">
 | ||
|         <div>
 | ||
|           <div style="line-height: 32px;margin-bottom: 10px;">
 | ||
|             当前项目阅片模式为:
 | ||
|             <el-tag type="primary">{{ $fd('ReadingMethod', readingType) }}</el-tag>
 | ||
|           </div>
 | ||
|           <div v-if="readingType === 1" style="line-height: 32px;margin-bottom: 10px;">
 | ||
|             阅片人(R1):
 | ||
|             <el-select v-model="form.R1" clearable :disabled="!!q.find(v => v.ArmEnum === 0)" size="mini">
 | ||
|               <el-option v-for="item of DoctorSelectList.R1" :key="`R1${item.DoctorUserId}`" v-if="form.O1 !== item.DoctorUserId && form.AD !== item.DoctorUserId && form.R2 !== item.DoctorUserId && !q.find(v => v.DoctorUser.UserId === item.DoctorUserId)" :label="`${item.UserName}(${item.FullName})`" :value="item.DoctorUserId" />
 | ||
|             </el-select>
 | ||
|           </div>
 | ||
|           <div v-if="readingType === 2" style="line-height: 32px;margin-bottom: 10px;">
 | ||
|             阅片人(R1):
 | ||
|             <el-select v-model="form.R1" clearable :disabled="!!q.find(v => v.ArmEnum === 1)" size="mini">
 | ||
|               <el-option v-for="item of DoctorSelectList.R1" :key="`R1${item.DoctorUserId}`" v-if="form.O1 !== item.DoctorUserId && form.AD !== item.DoctorUserId && form.R2 !== item.DoctorUserId && !q.find(v => v.DoctorUser.UserId === item.DoctorUserId)" :label="`${item.UserName}(${item.FullName})`" :value="item.DoctorUserId" />
 | ||
|             </el-select>
 | ||
|           </div>
 | ||
|           <div v-if="readingType === 2" style="line-height: 32px;margin-bottom: 10px;">
 | ||
|             阅片人(R2):
 | ||
|             <el-select v-model="form.R2" clearable :disabled="!!q.find(v => v.ArmEnum === 2)" size="mini">
 | ||
|               <el-option v-for="item of DoctorSelectList.R2" :key="`R2${item.DoctorUserId}`" v-if="form.O1 !== item.DoctorUserId && form.R1 !== item.DoctorUserId && form.AD !== item.DoctorUserId && !q.find(v => v.DoctorUser.UserId === item.DoctorUserId)" :label="`${item.UserName}(${item.FullName})`" :value="item.DoctorUserId" />
 | ||
|             </el-select>
 | ||
|           </div>
 | ||
|           <div style="line-height: 32px;margin-bottom: 10px;">
 | ||
|             裁判(AD):
 | ||
|             <el-select v-model="form.AD" clearable :disabled="!!q.find(v => v.ArmEnum === 3)" size="mini">
 | ||
|               <el-option v-for="item of DoctorSelectList.AD" :key="`AD${item.DoctorUserId}`" v-if="form.O1 !== item.DoctorUserId && form.R1 !== item.DoctorUserId && form.R2 !== item.DoctorUserId && !q.find(v => v.DoctorUser.UserId === item.DoctorUserId)" :label="`${item.UserName}(${item.FullName})`" :value="item.DoctorUserId" />
 | ||
|             </el-select>
 | ||
|           </div>
 | ||
|           <div style="line-height: 32px;margin-bottom: 10px;">
 | ||
|             肿瘤阅片人(O1):
 | ||
|             <el-select v-model="form.O1" clearable :disabled="!!q.find(v => v.ArmEnum === 4)" size="mini">
 | ||
|               <el-option v-for="item of DoctorSelectList.O1" :key="`O1${item.DoctorUserId}`" v-if="form.AD !== item.DoctorUserId && form.R1 !== item.DoctorUserId && form.R2 !== item.DoctorUserId && !q.find(v => v.DoctorUser.UserId === item.DoctorUserId)" :label="`${item.UserName}(${item.FullName})`" :value="item.DoctorUserId" />
 | ||
|             </el-select>
 | ||
|           </div>
 | ||
|         </div>
 | ||
|         <el-table
 | ||
|           border
 | ||
|           :data="list"
 | ||
|           stripe
 | ||
|         >
 | ||
|           <el-table-column
 | ||
|             prop="UserName"
 | ||
|             label="阅片人"
 | ||
|             min-width="180"
 | ||
|             show-overflow-tooltip
 | ||
|           >
 | ||
|             <template slot-scope="scope">
 | ||
|               {{ `${scope.row.DoctorUser.UserName}(${scope.row.DoctorUser.FullName})` }}
 | ||
|             </template>
 | ||
|           </el-table-column>
 | ||
|           <el-table-column
 | ||
|             prop="PlanSubjectCount"
 | ||
|             label="计划受试者数量"
 | ||
|             min-width="130"
 | ||
|             show-overflow-tooltip
 | ||
|           >
 | ||
|           </el-table-column>
 | ||
|           <el-table-column
 | ||
|             prop="AssignedSubjectCount"
 | ||
|             label="已分配受试者数量"
 | ||
|             min-width="140"
 | ||
|             show-overflow-tooltip
 | ||
|           >
 | ||
|           </el-table-column>
 | ||
|           <el-table-column
 | ||
|             prop="UserName"
 | ||
|             label="阅片类型"
 | ||
|             min-width="260"
 | ||
|             show-overflow-tooltip
 | ||
|           >
 | ||
|             <template slot-scope="scope">
 | ||
|           <span v-for="item of scope.row.ReadingCategoryList">
 | ||
|             <el-tag v-if="item === 1" type="primary">{{ $fd('ReadingCategory', item) + '&' + $fd('ReadingCategory', 2) }}</el-tag>
 | ||
|             <el-tag v-if="item === 4" type="danger">{{ $fd('ReadingCategory', item) }}</el-tag>
 | ||
|             <el-tag v-if="item === 5" type="warning">{{ $fd('ReadingCategory', item) }}</el-tag>
 | ||
|           </span>
 | ||
|             </template>
 | ||
|           </el-table-column>
 | ||
|           <el-table-column
 | ||
|             prop="WaitDealAllTaskCount"
 | ||
|             label="待处理任务量(全平台)"
 | ||
|             min-width="180"
 | ||
|             show-overflow-tooltip
 | ||
|           >
 | ||
|           </el-table-column>
 | ||
|           <el-table-column
 | ||
|             prop="WaitDealTrialTaskCount"
 | ||
|             label="待处理任务量(项目)"
 | ||
|             min-width="180"
 | ||
|             show-overflow-tooltip
 | ||
|           >
 | ||
|           </el-table-column>
 | ||
|           <el-table-column
 | ||
|             prop="UserName"
 | ||
|             label="访视平均阅片时间(去除离群值后的)"
 | ||
|             min-width="260"
 | ||
|             show-overflow-tooltip
 | ||
|           >
 | ||
|           </el-table-column>
 | ||
|           <el-table-column
 | ||
|             prop="IsEnable"
 | ||
|             label="状态"
 | ||
|             min-width="100"
 | ||
|             show-overflow-tooltip
 | ||
|           >
 | ||
|             <template slot-scope="scope">
 | ||
|               <el-tag v-if="!scope.row.IsEnable" type="danger">{{ $fd('IsEnable', scope.row.IsEnable) }}</el-tag>
 | ||
|               <el-tag v-else>{{ $fd('IsEnable', scope.row.IsEnable) }}</el-tag>
 | ||
|             </template>
 | ||
|           </el-table-column>
 | ||
|           <el-table-column
 | ||
|             prop="Note"
 | ||
|             label="备注"
 | ||
|             min-width="100"
 | ||
|             show-overflow-tooltip
 | ||
|           />
 | ||
|         </el-table>
 | ||
|         <el-form-item style="text-align: right">
 | ||
|           <el-button size="small" type="primary" :loading="loading" style="margin-top: 10px;" @click="save">
 | ||
|             {{ $t('common:button:save') }}
 | ||
|           </el-button>
 | ||
|         </el-form-item>
 | ||
|       </el-tab-pane>
 | ||
|     </el-tabs>
 | ||
|     <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"
 | ||
|         >
 | ||
|           关闭
 | ||
|         </el-button>
 | ||
|       </el-form-item>
 | ||
|     </div>
 | ||
|   </el-form>
 | ||
| </template>
 | ||
| 
 | ||
| <script>
 | ||
| import { getSubjectAssignAndTaskStatList, batchAssignDoctorToSubject, getDoctorSubjectStat, getDoctorSelectList} from '@/api/trials/reading'
 | ||
| 
 | ||
| export default {
 | ||
|   name: 'ManualAllocationTable',
 | ||
|   props: {
 | ||
|     trialCriterionList: {
 | ||
|       type: Array,
 | ||
|       default() {
 | ||
|         return []
 | ||
|       }
 | ||
|     },
 | ||
|     data: {
 | ||
|       type: Object,
 | ||
|       default() {
 | ||
|         return {}
 | ||
|       }
 | ||
|     },
 | ||
|     SubjectAssignSelectList: {
 | ||
|       type: Array,
 | ||
|       default() {
 | ||
|         return []
 | ||
|       }
 | ||
|     },
 | ||
|     readingType: {
 | ||
|       type: Number,
 | ||
|       default() {
 | ||
|         return 0
 | ||
|       }
 | ||
|     }
 | ||
|   },
 | ||
|   data() {
 | ||
|     return {
 | ||
|       TrialId: this.$route.query.trialId,
 | ||
|       form: {
 | ||
|         R0: null,
 | ||
|         R1: null,
 | ||
|         R2: null,
 | ||
|         AD: null,
 | ||
|         O1: null
 | ||
|       },
 | ||
|       DoctorSelectList: {
 | ||
|         R1: [],
 | ||
|         R2: [],
 | ||
|         AD: [],
 | ||
|         O1: [],
 | ||
|       },
 | ||
|       list: [],
 | ||
|       loading: false,
 | ||
|       btnLoading: false,
 | ||
|       q: [],
 | ||
|       TrialReadingCriterionId: this.trialCriterionList[0].TrialReadingCriterionId
 | ||
|     }
 | ||
|   },
 | ||
|   mounted() {
 | ||
|     this.TrialId = this.$route.query.trialId
 | ||
|     this.getDoctorSubjectStat()
 | ||
|     var arr = []
 | ||
|     arr.push(this.getDoctorSelectList(1))
 | ||
|     arr.push(this.getDoctorSelectList(2))
 | ||
|     arr.push(this.getDoctorSelectList(4))
 | ||
|     arr.push(this.getDoctorSelectList(5))
 | ||
|     var q = []
 | ||
|     if (Object.keys(this.data).length && this.data.SubjectId) {
 | ||
| 
 | ||
|     } else {
 | ||
|       this.SubjectAssignSelectList.forEach(v => {
 | ||
|         v.NowDoctorUserList.forEach(v1 => {
 | ||
|           q.push(v1)
 | ||
|         })
 | ||
|         this.q = q
 | ||
|       })
 | ||
|     }
 | ||
|     Promise.all(arr).then(() => {
 | ||
|       if (Object.keys(this.data).length && this.data.SubjectId) {
 | ||
|         this.form.R0 = this.findDoctorUser(this.data.NowDoctorUserList, 0).DoctorUser ? this.findDoctorUser(this.data.NowDoctorUserList, 0).DoctorUser.UserId : null
 | ||
|         this.form.R1 = this.findDoctorUser(this.data.NowDoctorUserList, 1).DoctorUser ? this.findDoctorUser(this.data.NowDoctorUserList, 1).DoctorUser.UserId : null
 | ||
|         this.form.R2 = this.findDoctorUser(this.data.NowDoctorUserList, 2).DoctorUser ? this.findDoctorUser(this.data.NowDoctorUserList, 2).DoctorUser.UserId : null
 | ||
|         this.form.AD = this.findDoctorUser(this.data.NowDoctorUserList, 3).DoctorUser ? this.findDoctorUser(this.data.NowDoctorUserList, 3).DoctorUser.UserId : null
 | ||
|         this.form.O1 = this.findDoctorUser(this.data.NowDoctorUserList, 4).DoctorUser ? this.findDoctorUser(this.data.NowDoctorUserList, 4).DoctorUser.UserId : null
 | ||
|         this.data.NowDoctorUserList.forEach(v1 => {
 | ||
|           q.push(v1)
 | ||
|         })
 | ||
|         this.q = q
 | ||
|       }
 | ||
|     })
 | ||
|   },
 | ||
|   methods: {
 | ||
|     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
 | ||
|     },
 | ||
|     getDoctorSelectList(ReadingCategory) {
 | ||
|       return new Promise(resolve => {
 | ||
|         getDoctorSelectList({
 | ||
|           TrialId: this.$route.query.trialId,
 | ||
|           ReadingCategory: ReadingCategory
 | ||
|         }).then(res => {
 | ||
|           switch (ReadingCategory) {
 | ||
|             case 1:
 | ||
|               this.$set(this.DoctorSelectList, 'R1', res.Result)
 | ||
|               break;
 | ||
|             case 2:
 | ||
|               this.$set(this.DoctorSelectList, 'R2', res.Result)
 | ||
|               break;
 | ||
|             case 4:
 | ||
|               this.$set(this.DoctorSelectList, 'AD', res.Result)
 | ||
|               break;
 | ||
|             case 5:
 | ||
|               this.$set(this.DoctorSelectList, 'O1', res.Result)
 | ||
|               break;
 | ||
|           }
 | ||
|           resolve()
 | ||
|         })
 | ||
|       })
 | ||
|     },
 | ||
|     getDoctorSubjectStat() {
 | ||
|       this.loading = true
 | ||
|       getDoctorSubjectStat(this.TrialId, this.TrialReadingCriterionId).then(res => {
 | ||
|         this.list = res.Result
 | ||
|         this.loading = false
 | ||
|       }).catch(() => {
 | ||
|         this.loading = false
 | ||
|       })
 | ||
|     },
 | ||
|     save() {
 | ||
|       var DoctorArmList = []
 | ||
|       if (this.form.R0) {
 | ||
|         DoctorArmList.push({
 | ||
|           ArmEnum: 0,
 | ||
|           DoctorUserId: this.form.R0
 | ||
|         })
 | ||
|       }
 | ||
|       if (this.form.R1) {
 | ||
|         DoctorArmList.push({
 | ||
|           ArmEnum: 1,
 | ||
|           DoctorUserId: this.form.R1
 | ||
|         })
 | ||
|       }
 | ||
|       if (this.form.R2) {
 | ||
|         DoctorArmList.push({
 | ||
|           ArmEnum: 2,
 | ||
|           DoctorUserId: this.form.R2
 | ||
|         })
 | ||
|       }
 | ||
|       if (this.form.AD) {
 | ||
|         DoctorArmList.push({
 | ||
|           ArmEnum: 3,
 | ||
|           DoctorUserId: this.form.AD
 | ||
|         })
 | ||
|       }
 | ||
|       if (this.form.O1) {
 | ||
|         DoctorArmList.push({
 | ||
|           ArmEnum: 4,
 | ||
|           DoctorUserId: this.form.O1
 | ||
|         })
 | ||
|       }
 | ||
|       var params = {
 | ||
|         TrialId: this.TrialId,
 | ||
|         TrialReadingCriterionId: this.TrialReadingCriterionId,
 | ||
|         SubjectIdList: this.SubjectAssignSelectList.map(v => v.SubjectId),
 | ||
|         DoctorArmList: DoctorArmList
 | ||
|       }
 | ||
|       this.loading = true
 | ||
|       batchAssignDoctorToSubject(params).then(res => {
 | ||
|         this.$message.success('保存成功')
 | ||
|         this.loading = false
 | ||
|         this.$emit('getList')
 | ||
|       }).catch(() => {
 | ||
|         this.loading = false
 | ||
|       })
 | ||
|     },
 | ||
|     close() { this.$emit('close') }
 | ||
|   }
 | ||
| }
 | ||
| </script>
 | ||
| 
 | ||
| <style scoped>
 | ||
| 
 | ||
| </style>
 |