tools.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <script setup lang="ts">
  2. import { ref, watch, watchEffect } from 'vue'
  3. import { storeToRefs } from 'pinia'
  4. import { options } from '@/entrypoints/sidepanel/mock'
  5. import { Reading, Upload, Paperclip, Scissor, AlarmClock, CirclePlus, Edit } from '@element-plus/icons-vue'
  6. import { useMsgStore } from '@/store/modules/msg'
  7. import { ElMessage } from 'element-plus'
  8. const { AIModel } = storeToRefs(useMsgStore())
  9. const selectInput = ref(null)
  10. const emit = defineEmits(['readClick', 'uploadFile', 'handleCapture', 'addNewDialogue', 'hisRecords', 'handleCurrentChange', 'handelIntelligentFillingClick'])
  11. watchEffect(() => {
  12. selectInput.value = AIModel.value?.value
  13. })
  14. const handleUpload = (e) => {
  15. if (!props.upload) {
  16. e.stopPropagation()
  17. ElMessage.warning('智能填表需要先发送指令,再上传文件')
  18. }
  19. }
  20. const props = defineProps({
  21. upload: {
  22. type: Boolean,
  23. },
  24. })
  25. </script>
  26. <template>
  27. <div class="px-3 py-2 flex justify-between items-center w-full max-w-[720px]">
  28. <div class="flex items-center">
  29. <el-select placement="top" v-model="selectInput" placeholder="选择"
  30. @change="(e: any) => emit('handleCurrentChange', e)" style="width: 120px;margin-right: 2px">
  31. <el-option-group v-for="group in options" :key="group.label" :label="group.label">
  32. <el-option v-for="item in group.options" :key="item.value" :label="item.label" :value="item.value" />
  33. </el-option-group>
  34. </el-select>
  35. <el-tooltip effect="dark" content="阅读此页,开启后将会根据左侧网页中的内容做出回答" placement="top">
  36. <el-button class="tools_btn" link :icon="Reading" @click="emit('readClick')" />
  37. </el-tooltip>
  38. <el-upload style="display:inline-block" :before-upload="(file: any) => emit('uploadFile', file)" :multiple="false"
  39. name="file" :show-file-list="false" :accept="'.xlsx,.pdf,.doc,.docx'">
  40. <el-tooltip effect="dark" content="文件上传" placement="top">
  41. <el-button class="tools_btn" link :icon="Paperclip" @click="handleUpload"/>
  42. </el-tooltip>
  43. </el-upload>
  44. <!-- <el-tooltip effect="dark" content="截屏" placement="top">
  45. <el-button class="tools_btn" link :icon="Scissor" @click="emit('handleCapture')" />
  46. </el-tooltip> -->
  47. <el-tooltip effect="dark" content="智能填表:选择后,在输入框描述填表流程" placement="top">
  48. <el-button class="tools_btn" link @click="emit('handelIntelligentFillingClick')">
  49. <span class="iconfont icon-zhinengtianxie"></span>
  50. </el-button>
  51. </el-tooltip>
  52. </div>
  53. <div class="flex items-center">
  54. <el-tooltip effect="dark" content="历史记录" placement="top">
  55. <el-button class="tools_btn1" link @click="emit('hisRecords')">
  56. <span class="iconfont icon-shouye"></span>
  57. </el-button>
  58. </el-tooltip>
  59. <el-tooltip effect="dark" content="新对话" placement="top">
  60. <el-button class="tools_btn1" link @click="emit('addNewDialogue')">
  61. <span class="iconfont icon-xinjianduihua"></span>
  62. </el-button>
  63. </el-tooltip>
  64. </div>
  65. </div>
  66. </template>
  67. <style lang="scss" scoped>
  68. .tools_btn {
  69. font-size: 18px;
  70. margin-left: 0 !important;
  71. }
  72. .tools_btn1 {
  73. font-size: 18px;
  74. margin-left: 0 !important;
  75. }
  76. </style>