<template>
  <div class="research_bs_content">
    <el-form ref="researchBSForm" label-position="left" :model="form" :rules="rules">
      <div class="basic_content form-label-width">
        <el-form-item :label="$t('trials:researchForm:title:researchSurveyStatus')">
          <el-tag>{{ $fd('ResearchRecord', state) }}</el-tag>
        </el-form-item>
        <!-- 项目编号 -->
        <el-form-item :label="$t('trials:researchForm:form:trialId')">
          <span>{{ form.TrialCode }}</span>
        </el-form-item>
        <!-- 试验方案号 -->
        <el-form-item :label="$t('trials:researchForm:form:researchNo')">
          <span>{{ form.ResearchProgramNo }}</span>
        </el-form-item>
        <!-- 试验名称 -->
        <el-form-item :label="$t('trials:researchForm:form:researchName')">
          <span>{{ form.ExperimentName }}</span>
        </el-form-item>
        <!-- 适应症类型 -->
        <el-form-item :label="$t('trials:researchForm:form:decleareType')">
          <span>{{ form.IndicationType }}</span>
        </el-form-item>
      </div>
      <div class="login_content">
        <div class="form-label-width">
          <el-form-item :label="$t('trials:researchForm:form:siteName')" prop="TrialSiteId">
            <el-select v-model="form.TrialSiteId" filterable style="width:100%;"
              :disabled="!(state === 0 && userTypeEnumInt === 0) || isHistory" @change="handleSiteChange">
              <el-option v-for="(item, index) of siteOptions" :key="index" :label="item.TrialSiteAliasName"
                :value="item.TrialSiteId" />
            </el-select>
          </el-form-item>
          <!-- 中心编号 -->
          <el-form-item v-if="form.TrialSiteId" :label="$t('trials:researchForm:form:siteId')">
            <el-input v-model="form.TrialSiteCode" disabled />
          </el-form-item>
          <!-- 联系人 -->
          <el-form-item :label="$t('trials:researchForm:form:contactor')" prop="UserName">
            <el-input v-model="form.UserName" :disabled="!(state === 0 && userTypeEnumInt === 0) || isHistory" />
          </el-form-item>
          <!-- 联系电话 -->
          <el-form-item :label="$t('trials:researchForm:form:contactorPhone')" prop="Phone">
            <el-input v-model="form.Phone" :disabled="!(state === 0 && userTypeEnumInt === 0) || isHistory" />
          </el-form-item>
          <!-- 联系邮箱 -->
          <el-form-item :label="$t('trials:researchForm:form:contactorEmail')" prop="Email">
            <el-input v-model="form.Email" disabled />
          </el-form-item>
          <el-form-item :label="$t('trials:researchForm:form:CommonUploadRecordId')
            " v-if="IsSupportUploadFile" class="file">
            <el-input v-model="form.SiteSurveyFile.FileName" type="textarea" :autosize="{ minRows: 1, maxRows: 3 }"
              style="margin-right: 5px;" disabled />
            <div class="upload" v-if="!(!(state === 0 && userTypeEnumInt === 0) || isHistory)">
              <input accept=".pdf,.docx,.doc" type="file" name="uploadFolder" class="select-file" title=""
                @change="beginScanFiles($event)" />
              <div class="btn-select">
                {{ $t('dictionary:template:basicData:button:selectFile') }}
              </div>
            </div>
            <!-- <el-button type="primary" @click="viewManualFile"
              :disabled="!this.form.SiteSurveyFile || !this.form.SiteSurveyFile.Path">{{
                $t('trials:researchForm:form:preview') }}</el-button> -->
            <el-button type="primary" @click="downLoad"
              :disabled="!this.form.SiteSurveyFile || !this.form.SiteSurveyFile.Path">{{
                $t('trials:researchForm:form:download') }}</el-button>
          </el-form-item>
          <!-- 平均刻盘周期（天） -->
          <el-form-item v-if="!notShowFieldList.includes('AverageEngravingCycle')"
            :label="$t('trials:researchForm:form:engravingCycle')">
            <el-input-number v-model="form.AverageEngravingCycle"
              :disabled="!(state === 0 && userTypeEnumInt === 0) || isHistory" controls-position="right" :min="0"
              style="width:100%;" />
          </el-form-item>
        </div>
        <!-- MRI-PDFF 是否为本中心该适应症的常规诊疗检查项目？ -->
        <el-form-item v-if="!notShowFieldList.includes('IsRoutineMRIPDEE')"
          :label="$t('trials:researchForm:form:IsRoutineMRIPDEE')" prop="IsRoutineMRIPDEE">
          <el-radio-group v-model="form.IsRoutineMRIPDEE"
            :disabled="(!(state === 0 && userTypeEnumInt === 0) || isHistory)">
            <el-radio v-for="item of $d.YesOrNo" :key="`IsRoutineMRIPDEE${item.value}`" :label="item.value">{{
              item.label }}</el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- MRI-PDFF 检查的检测周期（含单次检查时长、预约等待时长等） -->
        <el-form-item
          v-if="!notShowFieldList.includes('MRIPDFFScanTime') || !notShowFieldList.includes('MRIPDFFLeadTime') || !notShowFieldList.includes('MRIPDFFOther')"
          :label="$t('trials:researchForm:form:IsMRIPDFF')">
        </el-form-item>
        <!-- 单次检查时长（分钟） -->
        <el-form-item v-if="!notShowFieldList.includes('MRIPDFFScanTime')"
          :label="$t('trials:researchForm:form:MRIPDFFScanTime')">
          <el-input-number v-model="form.MRIPDFFScanTime"
            :disabled="(!(state === 0 && userTypeEnumInt === 0) || isHistory)" controls-position="right" :min="0" />
        </el-form-item>
        <!-- 平均预约等待时长（天） -->
        <el-form-item v-if="!notShowFieldList.includes('MRIPDFFLeadTime')"
          :label="$t('trials:researchForm:form:MRIPDFFLeadTime')">
          <el-input-number v-model="form.MRIPDFFLeadTime"
            :disabled="(!(state === 0 && userTypeEnumInt === 0) || isHistory)" controls-position="right" :min="0" />
        </el-form-item>
        <!-- 特殊情况备注-->
        <el-form-item v-if="!notShowFieldList.includes('MRIPDFFOther')"
          :label="$t('trials:researchForm:form:MRIPDFFOther')">
          <el-input v-model="form.MRIPDFFOther" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }"
            :disabled="(!(state === 0 && userTypeEnumInt === 0) || isHistory)" />
        </el-form-item>
        <!-- 如已选择研究者评估，项目是否会授权影像科老师参与本试验？如不单独授权，是否可在试验中保持 1-2 名固定技师操作？-->
        <el-form-item
          v-if="!notShowFieldList.includes('IsAuthorizeRadiologistsParticipate') || !notShowFieldList.includes('AssignFixedTechnologists')"
          :label="$t('trials:researchForm:form:IsAuthorize')" prop="IsAuthorize">
          <el-radio-group v-model="form.IsAuthorize" :disabled="(!(state === 0 && userTypeEnumInt === 0) || isHistory)"
            @input="handleIsAuthorizeInput">
            <el-radio label="IsAuthorizeRadiologistsParticipate">{{
              $t('trials:researchForm:form:IsAuthorizeRadiologistsParticipate') }}</el-radio>
            <el-radio label="AssignFixedTechnologists">{{
              $t('trials:researchForm:form:AssignFixedTechnologists') }}</el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- 请确认参与本项目影像采集的影像技师具备对应的资质（如：“技师证”，对应设备的“大型设备上岗证”） -->
        <el-form-item v-if="!notShowFieldList.includes('IsConfirmImagingTechnologist')"
          :label="$t('trials:researchForm:form:isQualified')" prop="IsConfirmImagingTechnologist">
          <el-radio-group v-model="form.IsConfirmImagingTechnologist"
            :disabled="!(state === 0 && userTypeEnumInt === 0) || isHistory">
            <el-radio v-for="item of $d.YesOrNo" :key="`IsConfirmImagingTechnologist${item.value}`"
              :label="item.value">{{ item.label }}</el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- 原因 -->
        <el-form-item
          v-if="!notShowFieldList.includes('NotConfirmReson') && form.IsConfirmImagingTechnologist === false"
          :label="$t('trials:researchForm:form:notQualifiedReason')" prop="NotConfirmReson">
          <el-input v-model="form.NotConfirmReson" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }"
            :disabled="!(state === 0 && userTypeEnumInt === 0) || isHistory" />
        </el-form-item>
        <!-- 研究单位疗效评估人员类型 -->
        <el-form-item v-if="!notShowFieldList.includes('EfficacyEvaluatorType')"
          :label="$t('trials:researchForm:form:staffType')">
          <el-radio-group v-model="form.EfficacyEvaluatorType"
            :disabled="!(state === 0 && userTypeEnumInt === 0) || isHistory">
            <el-radio v-for="item of $d.EfficacyEvaluatorType" :key="`EfficacyEvaluatorType${item.value}`"
              :label="item.value">{{ item.label }}</el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- 是否严格按照研究单位影像手册参数完成图像采集 -->
        <el-form-item v-if="!notShowFieldList.includes('IsFollowStudyParameters')" prop="IsFollowStudyParameters">
          <span slot="label" v-html="$t('trials:researchForm:form:isFollowStudyParam')" />
          <el-radio-group v-model="form.IsFollowStudyParameters"
            :disabled="!(state === 0 && userTypeEnumInt === 0) || isHistory">
            <el-radio v-for="item of $d.YesOrNo" :key="`IsFollowStudyParameters${item.value}`" :label="item.value">{{
              item.label }}</el-radio>
          </el-radio-group>
          <el-button type="primary" size="small" style="margin-left: 5px;" @click="viewManual">
            {{ $t('trials:researchForm:button:viewManual') }}
          </el-button>
        </el-form-item>
        <!-- 不能严格按照研究单位影像手册参数采集图像原因 -->
        <el-form-item v-if="!notShowFieldList.includes('NotFollowReson') && !form.IsFollowStudyParameters"
          prop="NotFollowReson">
          <span slot="label" v-html="$t('trials:researchForm:form:notFollowStudyParam')" />
          <el-input v-model="form.NotFollowReson" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }"
            :disabled="!(state === 0 && userTypeEnumInt === 0) || isHistory" />
        </el-form-item>
        <!-- 是否严格按照影像手册参数完成刻盘 -->
        <el-form-item v-if="!notShowFieldList.includes('ISStrictManualBurnFlag')" prop="ISStrictManualBurnFlag">
          <span slot="label" v-html="$t('trials:researchForm:form:ISStrictManualBurnFlag')" />
          <el-radio-group v-model="form.ISStrictManualBurnFlag"
            :disabled="(!(state === 0 && userTypeEnumInt === 0) || isHistory)" style="margin-right: 10px;">
            <el-radio v-for="item of $d.YesOrNo" :key="`ISStrictManualBurnFlag${item.value}`" :label="item.value">{{
              item.label }}</el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- 不能严格按照影像手册参数完成刻盘原因 -->
        <el-form-item v-if="!notShowFieldList.includes('NotStrictManualBurnFlagReason') && !form.ISStrictManualBurnFlag"
          prop="NotStrictManualBurnFlagReason">
          <span slot="label" v-html="$t('trials:researchForm:form:NotStrictManualBurnFlagReason')" />
          <el-input v-model="form.NotStrictManualBurnFlagReason" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }"
            :disabled="(!(state === 0 && userTypeEnumInt === 0) || isHistory)" />
        </el-form-item>
      </div>
    </el-form>
  </div>
</template>
<script>
import { getTrialSiteSelect, getTrialDocumentList, addOrUpdateCommonUploadRecord } from '@/api/trials'
import { addOrUpdateTrialSiteSurvey } from '@/api/research'
export default {
  name: 'ResearchBasicInfo',
  props: {
    isHistory: {
      type: Boolean,
      default: false
    },
    IsOnlyUploadFile: {
      type: Boolean,
      default: false
    },
    IsSupportUploadFile: {
      type: Boolean,
      default: false
    },
  },
  data() {
    var checkPhone = (rule, value, callback) => {
      const phoneReg = /^[0-9]+$/
      if (!value) {
        callback(new Error(this.$t('trials:researchForm:formRule:specify')))
      } else {
        setTimeout(() => {
          if (phoneReg.test(value)) {
            callback()
          } else {
            callback(new Error(this.$t('trials:researchForm:formRule:phone')))
          }
        }, 100)
      }
    }
    return {
      form: {
        Id: '',
        Sponsor: '', // 申办方
        ResearchProgramNo: '', // 方案号
        ExperimentName: '',
        TrialCode: '', // 项目编号
        TrialSiteCode: '',
        TrialSiteAliasName: '',
        IndicationType: '', // 适应症
        TrialSiteId: '', // 研究单位名称
        UserName: '', // 联系人
        Phone: '', // 联系人电话
        Email: '', // 联系人邮箱
        AverageEngravingCycle: '',
        IsRoutineMRIPDEE: '',
        MRIPDFFScanTime: '',
        MRIPDFFLeadTime: '',
        MRIPDFFOther: '',
        IsAuthorize: '',
        IsAuthorizeRadiologistsParticipate: '',
        AssignFixedTechnologists: '',
        ISStrictManualBurnFlag: '',
        NotStrictManualBurnFlagReason: '',
        IsConfirmImagingTechnologist: '',
        NotConfirmReson: '',
        EfficacyEvaluatorType: '',
        IsFollowStudyParameters: '',
        NotFollowReson: '',
        CommonUploadRecordId: null,
        SiteSurveyFile: []
      },
      rules: {
        TrialSiteId: [
          { required: true, message: this.$t('trials:researchForm:formRule:specify'), trigger: 'blur' }
        ],
        IsRoutineMRIPDEE: [
          { required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
        ],
        IsAuthorize: [
          { required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
        ],
        ISStrictManualBurnFlag: [
          { required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
        ],
        IsFollowStudyParameters: [
          { required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
        ],
        IsConfirmImagingTechnologist: [
          { required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
        ],
        NotConfirmReson: [
          { required: true, message: this.$t('trials:researchForm:formRule:specify'), trigger: 'blur' }
        ],
        NotFollowReson: [
          { required: true, message: this.$t('trials:researchForm:formRule:specify'), trigger: 'blur' }
        ],
        NotStrictManualBurnFlagReason: [
          { required: true, message: this.$t('trials:researchForm:formRule:specify'), trigger: 'blur' }
        ],
        UserName: [
          { required: true, validator: (rule, value, callback) => { !value ? callback(new Error(this.$t('trials:researchForm:formRule:specify'))) : callback() }, trigger: 'blur' },
          { min: 0, max: 50, message: this.$t('trials:researchForm:formRule:maxLength'), trigger: ['blur', 'change'] }
        ],
        Phone: [
          { required: true, validator: checkPhone, trigger: 'blur' }
        ],
        Email: [
          {
            pattern: new RegExp(this.$reg().EmailRegexStr),
            message: 'Please input the correct email address',
            trigger: 'blur,change',
          }
        ]
      },
      siteOptions: [],
      loading: false,
      state: null,
      userTypeEnumInt: zzSessionStorage.getItem('userTypeEnumInt') * 1,
      isShow: false,
      notShowFieldList: [],
      perview_visible: false,
      ExternalList: []
    }
  },
  methods: {
    async beginScanFiles(e) {
      try {
        let file = e.target.files[0]
        let name = file.name
        if (!this.checkFileSuffix(name)) return this.$message.warning(this.$t("trials:researchRecord:ImageManual:message:checkFileSuffix"))
        this.loading = true
        file = await this.fileToBlob(file)
        let scope = this
        var index = name.lastIndexOf('.')
        var type = name.substring(index + 1, name.length)
        let res = await this.OSSclient.put(
          `/${this.$route.query.trialId}/InspectionUpload/SiteSurvey/${this.form.TrialSiteId}/${scope.getGuid(Date.now() + '_' + name.split('.')[0])}.${type}`,
          file
        )
        let data = {
          Path: this.$getObjectName(res.url),
          FileName: name,
          FileSize: file.size,
          FileType: type

        }
        res = await addOrUpdateCommonUploadRecord(data)
        this.loading = false
        if (res.IsSuccess) {
          this.form.CommonUploadRecordId = res.Result
          data.Id = res.Result
          this.form.SiteSurveyFile = data
        }
      } catch (err) {
        console.log(err)
        this.loading = false;
      }
    },
    checkFileSuffix(fileName) {
      var index = fileName.lastIndexOf('.')
      var suffix = fileName.substring(index + 1, fileName.length)
      if ('.pdf'.toLocaleLowerCase().search(suffix.toLocaleLowerCase()) === -1 && '.docx'.toLocaleLowerCase().search(suffix.toLocaleLowerCase()) === -1 && '.doc'.toLocaleLowerCase().search(suffix.toLocaleLowerCase()) === -1) {
        return false
      } else {
        return true
      }
    },
    handleIsAuthorizeInput(label) {
      this.form.IsAuthorizeRadiologistsParticipate = false
      this.form.AssignFixedTechnologists = false
      this.form[label] = true
    },
    async viewManualFile() {
      if (!this.form.SiteSurveyFile || !this.form.SiteSurveyFile.Path) return this.$message.warning(this.$t("trials:researchForm:message:notFile"))
      this.$preview({
        path: this.form.SiteSurveyFile.Path,
        type: this.form.SiteSurveyFile.FileType,
        title: this.form.SiteSurveyFile.Path.FileName,
      })
    },
    async downLoad() {
      if (!this.form.SiteSurveyFile || !this.form.SiteSurveyFile.Path) return this.$message.warning(this.$t("trials:researchForm:message:notFile"))
      let link = document.createElement('a')
      link.href = this.OSSclientConfig.basePath + this.form.SiteSurveyFile.Path;
      link.target = '_blank'
      link.download = this.form.SiteSurveyFile.FileName
      link.style.display = 'none'
      document.body.append(link)
      link.click()
      document.body.removeChild(link)
      link = null
    },
    async viewManual() {
      try {
        let data = {
          PageIndex: 1,
          PageSize: 20,
          TrialId: this.$route.query.trialId,
          IsPublish: true,
          FileTypeCode: 4,
          IsDeleted: false
        }
        let res = await getTrialDocumentList(data)
        if (res.IsSuccess) {
          const { CurrentPageData } = res.Result
          if (CurrentPageData.length <= 0) return this.$message.warning(this.$t("trials:researchRecord:ImageManual:message:noImageManual"))
          this.ExternalList = []
          CurrentPageData.forEach(item => {
            let obj = {
              FilePath: item.Path,
              FileFormat: 'pdf',
              Name: item.Name
            }
            this.ExternalList.push(obj)
          });
          // this.perview_visible = true
          this.ExternalList.forEach(item => {
            let link = document.createElement('a')
            link.href = this.OSSclientConfig.basePath + item.FilePath;
            link.target = '_blank'
            link.download = item.Name
            link.style.display = 'none'
            document.body.append(link)
            link.click()
            document.body.removeChild(link)
            link = null
          })
        }
      } catch (err) {
        console.log(err)
      }
    },
    // 保存基本信息
    handleSave(isAutoCommit, isCheck = false) {
      return new Promise(async (resolve) => {
        isCheck = false
        try {
          if (this.IsOnlyUploadFile && !isCheck) {
            if (!this.form.UserName) {
              this.$message.warning(this.$t("trials:researchForm:message:notUserName"))
              return resolve(false)
            }
            if (!this.form.Phone) {
              this.$message.warning(this.$t("trials:researchForm:message:notPhone"))
              return resolve(false)
            }
            if (!this.form.CommonUploadRecordId) {
              this.$message.warning(this.$t("trials:researchForm:message:notCommonUploadRecordId"))
              return resolve(false)
            }
            this.btnLoading = true
            const param = {
              id: this.form.Id,
              trialId: this.$route.query.trialId,
              trialSiteId: this.form.TrialSiteId,
              userName: this.form.UserName,
              phone: this.form.Phone,
              email: this.form.Email,
              averageEngravingCycle: this.form.AverageEngravingCycle,
              IsRoutineMRIPDEE: this.form.IsRoutineMRIPDEE,
              MRIPDFFScanTime: this.form.MRIPDFFScanTime,
              MRIPDFFLeadTime: this.form.MRIPDFFLeadTime,
              MRIPDFFOther: this.form.MRIPDFFOther,
              IsAuthorizeRadiologistsParticipate: this.form.IsAuthorizeRadiologistsParticipate,
              AssignFixedTechnologists: this.form.AssignFixedTechnologists,
              ISStrictManualBurnFlag: this.form.ISStrictManualBurnFlag,
              NotStrictManualBurnFlagReason: this.form.NotStrictManualBurnFlagReason,
              isConfirmImagingTechnologist: this.form.IsConfirmImagingTechnologist,
              notConfirmReson: this.form.NotConfirmReson,
              efficacyEvaluatorType: this.form.EfficacyEvaluatorType,
              isFollowStudyParameters: this.form.IsFollowStudyParameters,
              notFollowReson: this.form.NotFollowReson,
              CommonUploadRecordId: this.form.CommonUploadRecordId
            }
            addOrUpdateTrialSiteSurvey(param).then(res => {
              this.btnLoading = false
              if (res.IsSuccess && !isAutoCommit) {
                this.$message.success(this.$t('common:message:savedSuccessfully'))
              }
              resolve(true)
            }).catch(() => {
              this.btnLoading = false
              reject(false)
            })
            return resolve(true)
          }
          const valid = await this.$refs['researchBSForm'].validate()
          if (valid) {
            this.loading = true
            const param = {
              id: this.form.Id,
              trialId: this.$route.query.trialId,
              trialSiteId: this.form.TrialSiteId,
              userName: this.form.UserName,
              phone: this.form.Phone,
              email: this.form.Email,
              averageEngravingCycle: this.form.AverageEngravingCycle,
              IsRoutineMRIPDEE: this.form.IsRoutineMRIPDEE,
              MRIPDFFScanTime: this.form.MRIPDFFScanTime,
              MRIPDFFLeadTime: this.form.MRIPDFFLeadTime,
              MRIPDFFOther: this.form.MRIPDFFOther,
              IsAuthorizeRadiologistsParticipate: this.form.IsAuthorizeRadiologistsParticipate,
              AssignFixedTechnologists: this.form.AssignFixedTechnologists,
              ISStrictManualBurnFlag: this.form.ISStrictManualBurnFlag,
              NotStrictManualBurnFlagReason: this.form.NotStrictManualBurnFlagReason,
              isConfirmImagingTechnologist: this.form.IsConfirmImagingTechnologist,
              notConfirmReson: this.form.NotConfirmReson,
              efficacyEvaluatorType: this.form.EfficacyEvaluatorType,
              isFollowStudyParameters: this.form.IsFollowStudyParameters,
              notFollowReson: this.form.NotFollowReson,
              CommonUploadRecordId: this.form.CommonUploadRecordId
            }
            const res = await addOrUpdateTrialSiteSurvey(param)
            this.loading = false
            if (res.IsSuccess && !isAutoCommit) {
              this.$message.success(this.$t('common:message:savedSuccessfully'))
            }
            resolve(true)
          } else {
            if (isAutoCommit) {
              this.$message.error(this.$t('trials:researchForm:button:msg1'))
            }
            resolve(false)
          }
        } catch (e) {
          console.log(e)
          resolve(false)
        }
      })
    },
    // 初始化
    async initForm(trialInfo, trialSiteSurvey, notShowFieldList) {
      // 获取项目下的site
      const { Result } = await getTrialSiteSelect(this.$route.query.trialId, { IgnoreDisable: true })
      this.siteOptions = Result
      this.form.Id = trialSiteSurvey.Id
      this.form.Sponsor = trialInfo.Sponsor // 申办方
      this.form.ResearchProgramNo = trialInfo.ResearchProgramNo // 方案号
      this.form.ExperimentName = trialInfo.ExperimentName
      this.form.TrialCode = trialInfo.TrialCode // 项目编号
      this.form.TrialSiteCode = trialSiteSurvey.TrialSiteCode
      this.form.TrialSiteAliasName = trialSiteSurvey.TrialSiteAliasName // 项目别称
      this.form.IndicationType = trialInfo.IndicationType // 适应症
      this.form.TrialSiteId = trialSiteSurvey.TrialSiteId
      this.form.UserName = trialSiteSurvey.UserName // 联系人
      this.form.Phone = trialSiteSurvey.Phone // 联系人电话
      this.form.Email = trialSiteSurvey.Email // 联系人邮箱
      this.form.CommonUploadRecordId = trialSiteSurvey.CommonUploadRecordId
      this.form.SiteSurveyFile = trialSiteSurvey.SiteSurveyFile || {}
      this.form.fileStr = this.form.SiteSurveyFile.FileName
      this.form.AverageEngravingCycle = trialSiteSurvey.AverageEngravingCycle
      this.form.IsRoutineMRIPDEE = trialSiteSurvey.IsRoutineMRIPDEE
      this.form.MRIPDFFScanTime = trialSiteSurvey.MRIPDFFScanTime
      this.form.MRIPDFFLeadTime = trialSiteSurvey.MRIPDFFLeadTime
      this.form.MRIPDFFOther = trialSiteSurvey.MRIPDFFOther
      this.form.IsAuthorizeRadiologistsParticipate = trialSiteSurvey.IsAuthorizeRadiologistsParticipate
      this.form.AssignFixedTechnologists = trialSiteSurvey.AssignFixedTechnologists
      if (this.form.IsAuthorizeRadiologistsParticipate) this.form.IsAuthorize = 'IsAuthorizeRadiologistsParticipate'
      if (this.form.AssignFixedTechnologists) this.form.IsAuthorize = 'AssignFixedTechnologists'
      this.form.ISStrictManualBurnFlag = trialSiteSurvey.ISStrictManualBurnFlag
      this.form.NotStrictManualBurnFlagReason = trialSiteSurvey.NotStrictManualBurnFlagReason
      this.form.IsConfirmImagingTechnologist = trialSiteSurvey.IsConfirmImagingTechnologist
      this.form.NotConfirmReson = trialSiteSurvey.NotConfirmReson
      this.form.EfficacyEvaluatorType = trialSiteSurvey.EfficacyEvaluatorType
      this.form.IsFollowStudyParameters = trialSiteSurvey.IsFollowStudyParameters
      this.form.NotFollowReson = trialSiteSurvey.NotFollowReson
      this.state = trialSiteSurvey.State
      this.isShow = true
      if (!notShowFieldList) return
      this.notShowFieldList = notShowFieldList
    },
    handleSiteChange(val) {
      var selected = this.siteOptions.find(item => item.TrialSiteId === val)
      if (selected) {
        this.form.TrialSiteCode = selected.TrialSiteCode
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.research_bs_content {

  .basic_content {
    padding: 0 20px;
    background: #fff;

  }

  .login_content {
    padding: 5px 20px;
    margin-top: 5px;
    background: #fff;

    ::v-deep .el-form-item {
      padding-bottom: 20px;

    }
  }

  .code_content {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;

    .el-input {
      margin-right: 10px;
    }
  }

  .form-label-width {
    ::v-deep .el-form-item__label {
      width: 140px;
    }

    ::v-deep .el-form-item__content {
      margin-left: 140px;
    }
  }

  .submit_content {
    margin-top: 20px;
    text-align: center;
  }

  ::v-deep .el-form-item {
    margin-bottom: 0px;
    padding-top: 5px;
    border-bottom: 1px solid #f5f7fa;

    .el-form-item__content {
      color: #82848a;
    }
  }

}

.upload {
  display: inline-block;
  height: 36px;
  width: 90px;
  padding: 0 10px;
  line-height: 23px;
  position: relative;
  text-decoration: none;
  border-radius: 3px;
  overflow: hidden;
  text-align: center;
  background: #428bca;
  border-color: #428bca;
  color: #fff;
  margin-right: 5px;

  .select-file {
    height: 36px;
    width: 90px;
    position: absolute;
    overflow: hidden;
    left: 0;
    top: 0;
    opacity: 0;
    font-size: 0;
  }

  .btn-select {
    //给显示在页面上的按钮写样式
    // width: 70px; 
    height: 36px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    border-radius: 24px;
    overflow: hidden;
    position: absolute;
    top: 0;
    left: 10px;
    pointer-events: none; //pointer-events:none用来控制该标签的点击穿透事件
  }
}

.file {
  ::v-deep .el-form-item__content {
    display: flex;
    align-items: center;
  }
}
</style>
