fileRename.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <el-dialog
  3. :visible.sync="diaShow"
  4. :close-on-click-modal="false"
  5. :modal-append-to-body='false'
  6. :title="diaTitle"
  7. @close="closeHandle"
  8. center
  9. width="480px">
  10. <div class="dialog-main">
  11. <el-form
  12. ref="diaForm"
  13. label-position="top"
  14. hide-required-asterisk
  15. :model="formData">
  16. <el-form-item label="文件名称" :rules="{required:true,message:'文件名称必填',trigger:'blur'}" prop="name">
  17. <el-input v-model="formData.name" style="width: 100%" placeholder="请输入文件名称"></el-input>
  18. </el-form-item>
  19. </el-form>
  20. <div class="dia-bot">
  21. <el-button type="primary" plain style="margin-right:20px;min-width:120px ;" @click="cancelHandle">取消</el-button>
  22. <el-button type="primary" @click="saveHandle" style="min-width:120px;">保存</el-button>
  23. </div>
  24. </div>
  25. </el-dialog>
  26. </template>
  27. <script>
  28. import { asrInterface } from '../../../../api/modules/semanticsApi'
  29. export default {
  30. name:"fileRename",
  31. props:{
  32. formData:{
  33. type:Object,
  34. default:()=>{
  35. return {}
  36. }
  37. },
  38. diaShow:{
  39. type:Boolean,
  40. default:false
  41. }
  42. },
  43. watch:{
  44. diaShow(value){
  45. if(value){
  46. this.$refs.diaForm && this.$nextTick(()=>{
  47. this.$refs.diaForm.clearValidate()
  48. })
  49. }
  50. }
  51. },
  52. data() {
  53. return {
  54. diaTitle:'重命名',
  55. }
  56. },
  57. methods: {
  58. cancelHandle(){
  59. this.$emit("update:diaShow",false)
  60. },
  61. saveHandle(){
  62. this.$refs.diaForm.validate(valid=>{
  63. if(valid){
  64. asrInterface.speechRename({SpeechRecognitionId:this.formData.id,FileName:this.formData.name}).then(res=>{
  65. if(res.Ret == 200){
  66. this.$message.success(this.diaTitle+"成功")
  67. this.$emit("renameSuccess")
  68. this.$emit("update:diaShow",false)
  69. }
  70. })
  71. }
  72. })
  73. },
  74. closeHandle(){
  75. this.$emit("update:diaShow",false)
  76. }
  77. },
  78. }
  79. </script>
  80. <style lang="scss" scoped>
  81. .dialog-main{
  82. padding: 5px 35px 35px;
  83. .dia-bot{
  84. text-align: center;
  85. margin-top: 60px;
  86. }
  87. }
  88. </style>