irc_web/.svn/pristine/21/21eb3df85b39262a192ac92013f...

138 lines
4.1 KiB
Plaintext

<template>
<el-form ref="equipmentForm" :model="form" :rules="rules" label-width="150px">
<div class="base-dialog-body">
<!-- 扫描设备 -->
<el-form-item :label="$t('trials:equiptResearch:form:equipment')" prop="EquipmentTypeId">
<el-select
v-model="form.EquipmentTypeId"
style="width:100%"
>
<!-- <el-option
v-for="item of dictionaryList.SiteSurvey_ScanEquipmentType"
:key="item.Id"
:label="item.Value"
:value="item.Id"
/> -->
<el-option
v-for="item of $d.Modality"
:key="item.id"
:label="item.label"
:value="item.id"
/>
</el-select>
</el-form-item>
<!-- 扫描参数 -->
<el-form-item :label="$t('trials:equiptResearch:form:param')">
<el-input v-model="form.Parameters" />
</el-form-item>
<!-- 扫描仪器制造商名称 -->
<el-form-item :label="$t('trials:equiptResearch:form:manufacturer')">
<el-input v-model="form.ManufacturerName" />
</el-form-item>
<!-- 扫描仪型号 -->
<el-form-item :label="$t('trials:equiptResearch:form:model')">
<el-input v-model="form.ScannerType" />
</el-form-item>
<!-- 备注 -->
<el-form-item :label="$t('trials:equiptResearch:form:remark')">
<el-input v-model="form.Note" />
</el-form-item>
</div>
<div class="base-dialog-footer" style="text-align:right;margin-top:10px;">
<el-form-item>
<!-- 取消 -->
<el-button size="small" type="primary" :disabled="btnLoading" @click="handleCancel">
{{ $t('common:button:cancel') }}
</el-button>
<!-- 保存 -->
<el-button size="small" type="primary" :loading="btnLoading" @click="handleSave">
{{ $t('common:button:save') }}
</el-button>
</el-form-item>
</div>
</el-form>
</template>
<script>
import { addOrUpdateTrialSiteEquipmentSurvey } from '@/api/research'
import { getQueryString } from '@/utils/history.js'
import { getBasicDataSelects } from '@/api/dictionary/dictionary'
export default {
name: 'ResearchEquipmentForm',
props: {
data: {
type: Object,
default() {
return {}
}
},
trialSiteSurveyEquipmentType: {
type: String,
default: ''
}
},
data() {
return {
form: {
Id: '',
EquipmentTypeId: '',
Parameters: '',
ManufacturerName: '',
ScannerType: '',
Note: '',
TrialSiteSurveyId: ''
},
rules: {
EquipmentTypeId: [
{ required: true, message: this.$t('trials:researchForm:formRule:select'), trigger: ['blur', 'change'] }
]
},
btnLoading: false,
dictionaryList: {}
}
},
mounted() {
this.initForm()
},
methods: {
async initForm() {
// await this.getDicData()
Object.keys(this.data).forEach(key => {
this.form[key] = this.data[key]
})
},
// 保存参与者信息
handleSave() {
this.$refs['equipmentForm'].validate(valid => {
if (!valid) return
this.btnLoading = true
if (!this.form.TrialSiteSurveyId) {
this.form.TrialSiteSurveyId = getQueryString('trialSiteSurveyId')
}
const trialId = getQueryString('trialId')
addOrUpdateTrialSiteEquipmentSurvey(trialId, this.form).then(res => {
this.btnLoading = false
if (res.IsSuccess) {
this.$message.success(this.$t('common:message:savedSuccessfully'))
this.$emit('getList')
this.$emit('close')
}
}).catch(() => { this.btnLoading = false })
})
},
// 取消保存
handleCancel() {
this.$emit('close')
},
// 获取下拉框
getDicData() {
getBasicDataSelects(['SiteSurvey_ScanEquipmentType']).then(res => {
this.dictionaryList = { ...res.Result }
}).catch(() => {
})
}
}
}
</script>