50cd863faa2d76bf1ee3eee9c0a012129b2bddad.svn-base 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <#--noinspection JSDuplicatedDeclaration-->
  2. <#list subTables as sub>
  3. #segment#${sub.entityName}SubTable.vue
  4. <template>
  5. <a-table
  6. rowKey="id"
  7. size="middle"
  8. bordered
  9. :loading="loading"
  10. :columns="columns"
  11. :dataSource="dataSource"
  12. :pagination="false"
  13. >
  14. <template slot="htmlSlot" slot-scope="text">
  15. <div v-html="text"></div>
  16. </template>
  17. <template slot="imgSlot" slot-scope="text">
  18. <div style="font-size: 12px;font-style: italic;">
  19. <span v-if="!text">无图片</span>
  20. <img v-else :src="getImgView(text)" alt="" style="max-width:80px;height:25px;"/>
  21. </div>
  22. </template>
  23. <template slot="fileSlot" slot-scope="text">
  24. <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  25. <a-button
  26. v-else
  27. ghost
  28. type="primary"
  29. icon="download"
  30. size="small"
  31. @click="downloadFile(text)"
  32. >
  33. <span>下载</span>
  34. </a-button>
  35. </template>
  36. </a-table>
  37. </template>
  38. <script>
  39. import { getAction } from '@api/manage'
  40. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  41. export default {
  42. name: '${sub.entityName}SubTable',
  43. mixins: [JeecgListMixin],
  44. props: {
  45. record: {
  46. type: Object,
  47. default: null,
  48. }
  49. },
  50. data() {
  51. return {
  52. description: '${sub.ftlDescription}内嵌列表',
  53. disableMixinCreated: true,
  54. loading: false,
  55. dataSource: [],
  56. columns: [
  57. <#-- begin 遍历表头 -->
  58. <#list sub.originalColumns as po>
  59. <#if po.isShowList == 'Y'>
  60. {
  61. title: '${po.filedComment}',
  62. align: 'center',
  63. <#if po.classType == 'date'>
  64. dataIndex: '${po.fieldName}',
  65. <#elseif po.fieldDbType=='Blob'>
  66. dataIndex: '${po.fieldName}String'
  67. <#elseif po.classType=='umeditor'>
  68. dataIndex: '${po.fieldName}',
  69. scopedSlots: {customRender: 'htmlSlot'}
  70. <#elseif po.classType=='file'>
  71. dataIndex: '${po.fieldName}',
  72. scopedSlots: {customRender: 'fileSlot'}
  73. <#elseif po.classType=='image'>
  74. dataIndex: '${po.fieldName}',
  75. scopedSlots: {customRender: 'imgSlot'}
  76. <#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
  77. dataIndex: '${po.fieldName}_dictText'
  78. <#elseif po.classType=='cat_tree'>
  79. <#if list_need_category>
  80. dataIndex: '${po.fieldName}',
  81. customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : '')
  82. <#else>
  83. dataIndex: '${po.fieldName}',
  84. customRender: (text, record) => (text ? record['${po.dictText}'] : '')
  85. </#if>
  86. <#elseif po.classType=='switch'>
  87. dataIndex: '${po.fieldName}',
  88. <#if po.dictField != 'is_open'>
  89. customRender: (text) => (!text ? "" : (text == ${po.dictField}[0] ? "是" : "否"))
  90. <#else>
  91. customRender: (text) => (!text ? "" : (text == "Y" ? "是" : "否"))
  92. </#if>
  93. <#else>
  94. dataIndex: '${po.fieldName}',
  95. </#if>
  96. },
  97. </#if>
  98. </#list>
  99. <#-- end 遍历表头 -->
  100. ],
  101. <#assign urlPrefix="/${entityPackage}/${entityName?uncap_first}">
  102. url: {
  103. listByMainId: '${urlPrefix}/query${sub.entityName}ByMainId',
  104. },
  105. }
  106. },
  107. watch: {
  108. record: {
  109. immediate: true,
  110. handler() {
  111. if (this.record != null) {
  112. this.loadData(this.record)
  113. }
  114. }
  115. }
  116. },
  117. methods: {
  118. loadData(record) {
  119. this.loading = true
  120. this.dataSource = []
  121. getAction(this.url.listByMainId, {
  122. id: record.id
  123. }).then((res) => {
  124. if (res.success) {
  125. this.dataSource = res.result.records
  126. }
  127. }).finally(() => {
  128. this.loading = false
  129. })
  130. },
  131. },
  132. }
  133. </script>
  134. <style scoped>
  135. </style>
  136. </#list>