141 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			141 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
| <template>
 | |
|   <el-form
 | |
|     ref="hotKeysForm"
 | |
|     v-loading="loading"
 | |
|     :model="form"
 | |
|     label-width="150px"
 | |
|     size="small"
 | |
|     :rules="rules"
 | |
|     class="email_wrapper"
 | |
|   >
 | |
|     <div class="base-dialog-body">
 | |
|       <!-- 操作名 -->
 | |
|       <el-form-item label="操作名" prop="ShortcutKeyEnum">
 | |
|         <el-select
 | |
|           v-model="form.ShortcutKeyEnum"
 | |
|           style="width:100%;"
 | |
|           size="small"
 | |
|           disabled
 | |
|         >
 | |
|           <el-option
 | |
|             v-for="item of $d.ShortcutKey"
 | |
|             :key="item.id"
 | |
|             :label="item.label"
 | |
|             :value="item.value"
 | |
|           />
 | |
|         </el-select>
 | |
|       </el-form-item>
 | |
|       <!-- 快捷键 -->
 | |
|       <el-form-item label="快捷键" prop="Keyboardkey">
 | |
|         <el-input v-model="form.Keyboardkey" />
 | |
|       </el-form-item>
 | |
| 
 | |
|     </div>
 | |
|     <div class="base-dialog-footer" style="text-align:right;margin-top:10px;">
 | |
|       <el-form-item style="text-align:right;">
 | |
|         <!-- 取消 -->
 | |
|         <el-button size="small" type="primary" @click="close">
 | |
|           {{ $t('common:button:cancel') }}
 | |
|         </el-button>
 | |
|         <!-- 保存 -->
 | |
|         <el-button size="small" type="primary" @click="handleSave">
 | |
|           {{ $t('common:button:save') }}
 | |
|         </el-button>
 | |
|       </el-form-item>
 | |
|     </div>
 | |
|   </el-form>
 | |
| </template>
 | |
| <script>
 | |
| import { setDefaultShortcutKey } from '@/api/user'
 | |
| export default {
 | |
|   props: {
 | |
|     readingTool: {
 | |
|       type: Number,
 | |
|       required: true
 | |
|     }
 | |
|   },
 | |
| 
 | |
|   data() {
 | |
|     return {
 | |
|       form: {
 | |
|         Keyboardkey: null,
 | |
|         ShortcutKeyEnum: null
 | |
|       },
 | |
|       rules: {
 | |
|         ShortcutKeyEnum: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: ['blur'] }]
 | |
|       },
 | |
| 
 | |
|       loading: false
 | |
|     }
 | |
|   },
 | |
|   mounted() {
 | |
|     this.initForm()
 | |
|   },
 | |
|   methods: {
 | |
|     async initForm() {
 | |
|       for (const k in this.form) {
 | |
|         if (this.data.hasOwnProperty(k)) {
 | |
|           this.form[k] = this.data[k]
 | |
|         }
 | |
|       }
 | |
|     },
 | |
| 
 | |
|     // 保存
 | |
|     handleSave() {
 | |
|       this.$refs.emailForm.validate(valid => {
 | |
|         if (!valid) return
 | |
|         this.loading = true
 | |
|         var params = {
 | |
|           imageToolType: this.readingTool,
 | |
|           shortcutKeyList: [
 | |
|             {
 | |
|               keyboardkey: this.form.Keyboardkey,
 | |
|               shortcutKeyEnum: this.form.shortcutKeyEnum
 | |
|             }
 | |
|           ]
 | |
|         }
 | |
|         setDefaultShortcutKey(params).then(res => {
 | |
|           this.loading = false
 | |
|           this.$emit('closeDialog')
 | |
|           this.$emit('getList')
 | |
|           this.$message.success(this.$t('common:message:savedSuccessfully'))
 | |
|         }).catch(() => {
 | |
|           this.loading = false
 | |
|         })
 | |
|       })
 | |
|     },
 | |
|     close() {
 | |
|       this.$emit('closeDialog')
 | |
|     }
 | |
|   }
 | |
| }
 | |
| </script>
 | |
| <style lang="scss" scoped>
 | |
| .email_wrapper{
 | |
|   .upload-container{
 | |
|     >>>.el-upload {
 | |
|     width: 100%;
 | |
|       text-align: left;
 | |
|     }
 | |
|     >>>.el-upload--text {
 | |
|       border: none;
 | |
|       width: 80px;
 | |
|       height: 40px;
 | |
|     }
 | |
|     .el-input--small {
 | |
|       margin-bottom: 5px;
 | |
|     }
 | |
|     .el-icon-circle-check {
 | |
|       color: #00d1b2;
 | |
|       font-size: 13px;
 | |
|     }
 | |
|     .account_item_clear{
 | |
|       .el-tag__close{
 | |
|         display: none !important;
 | |
|       }
 | |
|     }
 | |
|   }
 | |
| 
 | |
| }
 | |
| </style>
 |