125 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			125 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
/* eslint-disable */
 | 
						||
<template>
 | 
						||
  <el-form
 | 
						||
    ref="taskAllocationRuleDataForm"
 | 
						||
    v-loading="loading"
 | 
						||
    :model="form"
 | 
						||
    size="small"
 | 
						||
    :rules="rules"
 | 
						||
    label-width="110px"
 | 
						||
  >
 | 
						||
    <div class="base-dialog-body">
 | 
						||
      <el-form-item label="阅片人" prop="DoctorUserId">
 | 
						||
        <el-select v-model="form.DoctorUserId" :disabled="form.Id" clearable>
 | 
						||
          <el-option v-for="item of doctorUserList" :label="`${item.UserName}(${item.FullName})`" :value="item.DoctorUserId" />
 | 
						||
        </el-select>
 | 
						||
      </el-form-item>
 | 
						||
      <el-form-item label="受试者比例" prop="PlanReadingRatio">
 | 
						||
        <div style="display: flex;justify-content: left;align-items: center">
 | 
						||
          <el-input-number v-model="form.PlanReadingRatio" :min="0" :max="100" controls-position="right" />
 | 
						||
          <span style="margin-left: 10px;">(%)</span>
 | 
						||
        </div>
 | 
						||
      </el-form-item>
 | 
						||
      <el-form-item label="状态">
 | 
						||
        <el-radio-group v-model="form.IsEnable">
 | 
						||
          <el-radio v-for="item of $d.IsEnable" :key="'form.IsEnable' + item.value" :label="item.value">{{ item.label }}</el-radio>
 | 
						||
        </el-radio-group>
 | 
						||
      </el-form-item>
 | 
						||
      <el-form-item label="备注">
 | 
						||
        <el-input
 | 
						||
          v-model="form.Note"
 | 
						||
          type="textarea"
 | 
						||
          maxlength="100"
 | 
						||
          show-word-limit
 | 
						||
        />
 | 
						||
      </el-form-item>
 | 
						||
    </div>
 | 
						||
    <div class="base-dialog-footer" style="text-align:right;margin-top:10px;">
 | 
						||
      <el-form-item>
 | 
						||
        <!-- 取消 -->
 | 
						||
        <el-button
 | 
						||
          :disabled="btnLoading"
 | 
						||
          size="small"
 | 
						||
          type="primary"
 | 
						||
          @click="close"
 | 
						||
        >
 | 
						||
          {{ $t('common:button:cancel') }}
 | 
						||
        </el-button>
 | 
						||
        <!-- 保存 -->
 | 
						||
        <el-button size="small" type="primary" :loading="btnLoading" @click="save">
 | 
						||
          {{ $t('common:button:save') }}
 | 
						||
        </el-button>
 | 
						||
      </el-form-item>
 | 
						||
    </div>
 | 
						||
  </el-form>
 | 
						||
</template>
 | 
						||
<script>
 | 
						||
import { addOrUpdateTaskAllocationRule } from '@/api/trials/reading'
 | 
						||
 | 
						||
export default {
 | 
						||
  name: 'AddOrUpdateTaskAllocationRuleData',
 | 
						||
  props: {
 | 
						||
    data: {
 | 
						||
      type: Object,
 | 
						||
      default() {
 | 
						||
        return {}
 | 
						||
      }
 | 
						||
    },
 | 
						||
    doctorUserList: {
 | 
						||
      type: Array,
 | 
						||
      default() {
 | 
						||
        return []
 | 
						||
      }
 | 
						||
    }
 | 
						||
  },
 | 
						||
  data() {
 | 
						||
    return {
 | 
						||
      form: {
 | 
						||
        Id: null,
 | 
						||
        TrialId: null,
 | 
						||
        PlanReadingRatio: 50,
 | 
						||
        DoctorUserId: null,
 | 
						||
        IsEnable: true,
 | 
						||
        Note: ''
 | 
						||
      },
 | 
						||
      rules: {
 | 
						||
        DoctorUserId: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }],
 | 
						||
        PlanReadingRatio: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }]
 | 
						||
      },
 | 
						||
      loading: false,
 | 
						||
      btnLoading: false
 | 
						||
    }
 | 
						||
  },
 | 
						||
  mounted() {
 | 
						||
    console.log(this.doctorUserList)
 | 
						||
    console.log(this.data)
 | 
						||
    this.form.TrialId = this.$route.query.trialId
 | 
						||
    if (Object.keys(this.data).length && this.data.Id) {
 | 
						||
      this.form = { ...this.data }
 | 
						||
    }
 | 
						||
  },
 | 
						||
  methods: {
 | 
						||
    save() {
 | 
						||
      this.$refs.taskAllocationRuleDataForm.validate(valid => {
 | 
						||
        console.log(valid)
 | 
						||
        if (!valid) return
 | 
						||
        this.btnLoading = true
 | 
						||
        this.loading = true
 | 
						||
        addOrUpdateTaskAllocationRule(this.form).then(res => {
 | 
						||
          this.loading = false
 | 
						||
          this.btnLoading = false
 | 
						||
          this.$message.success(this.$t('common:message:savedSuccessfully'))
 | 
						||
          this.$emit('getList')
 | 
						||
        }).catch(() => {
 | 
						||
          this.loading = false
 | 
						||
          this.btnLoading = false
 | 
						||
        })
 | 
						||
      })
 | 
						||
    },
 | 
						||
    close() { this.$emit('close') }
 | 
						||
  }
 | 
						||
}
 | 
						||
</script>
 | 
						||
<style lang="scss" scoped>
 | 
						||
</style>
 |