305 lines
		
	
	
		
			9.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			305 lines
		
	
	
		
			9.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
| <template>
 | ||
|   <el-form
 | ||
|     ref="taskAllocationRuleDataForm"
 | ||
|     v-loading="loading"
 | ||
|     :model="form"
 | ||
|     size="small"
 | ||
|   >
 | ||
|     <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 size="mini">
 | ||
| <!--          <el-option v-for="item of DoctorSelectList.R1" v-if="item.DoctorUserId !== form.R2 && item.DoctorUserId !== form.AD && item.DoctorUserId !== form.O1" :label="`${item.UserName}(${item.FullName})`" :value="item.DoctorUserId" />-->
 | ||
|           <el-option v-for="item of DoctorSelectList.R1" :key="`R1${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 size="mini">
 | ||
|           <el-option v-for="item of DoctorSelectList.R1" :key="`R1${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 size="mini">
 | ||
|           <el-option v-for="item of DoctorSelectList.R2" :key="`R2${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 size="mini">
 | ||
|           <el-option v-for="item of DoctorSelectList.AD" :key="`AD${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 size="mini">
 | ||
|           <el-option v-for="item of DoctorSelectList.O1" :key="`O1${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="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>
 | ||
|     <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 { getSubjectAssignAndTaskStatList, batchAssignDoctorToSubject, getDoctorSubjectStat, getDoctorSelectList} from '@/api/trials/reading'
 | ||
| 
 | ||
| export default {
 | ||
|   name: 'ManualAllocationTable',
 | ||
|   props: {
 | ||
|     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,
 | ||
|     }
 | ||
|   },
 | ||
|   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))
 | ||
|     Promise.all(arr).then(() => {
 | ||
|       if (Object.keys(this.data).length && this.data.SubjectId) {
 | ||
|         this.form.R0 = this.findDoctorUser(this.data.PreviousDoctorUserList, 0).DoctorUser ? this.findDoctorUser(this.data.PreviousDoctorUserList, 0).DoctorUser.UserId : null
 | ||
|         this.form.R1 = this.findDoctorUser(this.data.PreviousDoctorUserList, 1).DoctorUser ? this.findDoctorUser(this.data.PreviousDoctorUserList, 1).DoctorUser.UserId : null
 | ||
|         this.form.R2 = this.findDoctorUser(this.data.PreviousDoctorUserList, 2).DoctorUser ? this.findDoctorUser(this.data.PreviousDoctorUserList, 2).DoctorUser.UserId : null
 | ||
|         this.form.AD = this.findDoctorUser(this.data.PreviousDoctorUserList, 3).DoctorUser ? this.findDoctorUser(this.data.PreviousDoctorUserList, 3).DoctorUser.UserId : null
 | ||
|         this.form.O1 = this.findDoctorUser(this.data.PreviousDoctorUserList, 4).DoctorUser ? this.findDoctorUser(this.data.PreviousDoctorUserList, 4).DoctorUser.UserId : null
 | ||
|       }
 | ||
|     })
 | ||
|   },
 | ||
|   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).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,
 | ||
|         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>
 |