ai-form-item-template.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <template>
  2. <ai-form-item :prop="renderRule.fieldName">
  3. <view class="flex-1 fx-col">
  4. <slot :name="slotName"/>
  5. </view>
  6. </ai-form-item>
  7. <uv-text v-if="renderRule.tips" type="tips" size="12" :text="renderRule.tips" prefix-icon="info-circle"
  8. :icon-style="{color: 'var(--warning-color)', fontSize: '14px'}"/>
  9. </template>
  10. <script>
  11. import AiFormItem from "@/pages/ie/components/ai-form/ai-form-item.vue";
  12. import MxConst from "@/common/MxConst";
  13. export default {
  14. name: "ai-form-item-template",
  15. components: {AiFormItem},
  16. props: {
  17. renderRule: {
  18. type: Object,
  19. default: () => ({})
  20. }
  21. },
  22. computed: {
  23. slotName() {
  24. const types = Object.entries(MxConst.enum.ai.inputType)
  25. const match = types.find(t => t[1] == this.renderRule.enumInputType)
  26. if (!match) console.warn(`渲染类型不在预定的类型范畴[enumInputType:${this.renderRule.enumInputType}],将按text模式渲染`)
  27. return match ? match[0] : 'text'
  28. }
  29. }
  30. }
  31. </script>
  32. <style scoped>
  33. </style>