irc_web/src/views/trials/trials-panel/reading/dicoms/components/Others.vue

72 lines
1.8 KiB
Vue

<template>
<div v-loading="loading">
<div class="base-dialog-body" style="height:380px;overflow-y: auto;">
<el-form ref="otherForm" :model="form">
<!-- -->
<el-form-item
:label="$t('trials:reading:label:autoSwitch')"
prop="AutoCutNextTask"
:rules="[
{ required: true, message: $t('common:ruleMessage:select')}
]"
>
<el-switch v-model="form.AutoCutNextTask" />
</el-form-item>
</el-form>
</div>
<div class="base-dialog-footer" style="text-align:right;margin-top:10px;">
<el-button size="small" type="primary" @click="handleSave"> {{ $t('common:button:save') }}</el-button>
</div>
</div>
</template>
<script>
import { setAutoCutNextTask, getAutoCutNextTask } from '@/api/user'
export default {
name: 'Others',
data() {
return {
form: {
AutoCutNextTask: false
},
loading: false
}
},
mounted() {
this.initForm()
},
methods: {
async initForm() {
this.loading = true
try {
const res = await getAutoCutNextTask()
if (res.IsSuccess) {
this.form.AutoCutNextTask = res.Result.AutoCutNextTask
}
this.loading = false
} catch (e) {
this.loading = false
}
},
async handleSave() {
const valid = await this.$refs.otherForm.validate()
if (!valid) return
this.loading = true
try {
const res = await setAutoCutNextTask(this.form)
if (res.IsSuccess) {
this.$message.success(this.$t('common:message:savedSuccessfully'))
}
this.loading = false
} catch (e) {
this.loading = false
}
}
}
}
</script>
<style lang="scss">
</style>