Parser.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <u-form class="jnpf-wrap-form" :model="formData" ref="dataForm"
  3. :label-position="formConf.labelPosition==='top'?'top':'left'"
  4. :label-align="formConf.labelPosition==='right'?'right':'left'"
  5. :label-width="formConf.labelWidth?formConf.labelWidth*1.5:150" :class='formConf.className'>
  6. <template v-for="(item, index) in formConf.fields" :key="item.__config__.renderKey">
  7. <Item :itemData="item" :formConf="formConf" :class="item.__config__.className" :formData="formData"
  8. :ref="item.__vModel__?item.__vModel__: undefined" @toDetail="toDetail" @clickIcon='clickIcon' />
  9. </template>
  10. <u-modal v-model="show" :content="content" width='70%' border-radius="16" :content-style="contentStyle"
  11. :titleStyle="titleStyle" :confirm-style="confirmStyle" :title="title" :confirm-text="$t('common.okText')">
  12. </u-modal>
  13. </u-form>
  14. </template>
  15. <script>
  16. import Item from './Item'
  17. export default {
  18. components: {
  19. Item
  20. },
  21. props: {
  22. formConf: {
  23. type: Object,
  24. required: true
  25. },
  26. formData: {
  27. type: Object,
  28. },
  29. loading: {
  30. type: Boolean,
  31. default: false
  32. }
  33. },
  34. data() {
  35. return {
  36. show: false,
  37. content: '',
  38. contentStyle: {
  39. fontSize: '28rpx',
  40. padding: '20rpx',
  41. lineHeight: '44rpx',
  42. textAlign: 'left'
  43. },
  44. titleStyle: {
  45. padding: '20rpx'
  46. },
  47. confirmStyle: {
  48. height: '80rpx',
  49. lineHeight: '80rpx',
  50. },
  51. title: this.$t('common.tipTitle'),
  52. }
  53. },
  54. methods: {
  55. clickIcon(e) {
  56. if (!e.__config__.tipLabel && !e.helpMessage) return
  57. this.content = e.helpMessage || e.__config__.tipLabel
  58. this.title = e.__config__.label
  59. if (e.__config__.jnpfKey === 'card') this.title = e.header
  60. if (e.__config__.jnpfKey === 'groupTitle') this.title = e.content
  61. this.show = true
  62. },
  63. toDetail(item) {
  64. this.$emit('toDetail', item)
  65. }
  66. }
  67. }
  68. </script>