Detail.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
  3. <a-row :gutter="48" slot="extra">
  4. <a-col :md="48" :sm="48">
  5. <span class="table-page-search-submitButtons" style="float: right">
  6. <a-button style="margin-left: 8px" type="default" @click="handleCancel()">返回</a-button>
  7. </span>
  8. </a-col>
  9. </a-row>
  10. <detail-list title="" :col="2">
  11. <!-- <detail-list-item term="模板内容">{{ model.content }}</detail-list-item>-->
  12. <detail-list-item term="类型">{{ BaseTool.Object.getField(this.typeMap,model.type) }}</detail-list-item>
  13. <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
  14. <detail-list-item term="更新日期">{{ model.updateTime }}</detail-list-item>
  15. <detail-list-item term="创建人">{{ model.createdUserId }}</detail-list-item>
  16. <detail-list-item term="更新人">{{ model.updateUserId }}</detail-list-item>
  17. <detail-list-item term="更新人名称">{{ model.updateUserName }}</detail-list-item>
  18. <detail-list-item term="二级类别">{{ model.secondTypeId }}</detail-list-item>
  19. </detail-list>
  20. <title-divider title="字段明细" width="90px"></title-divider>
  21. <a-table
  22. bordered
  23. :data-source="data"
  24. :columns="columns"
  25. tableLayout="auto"
  26. rowKey="fieldName">
  27. <span slot="action" slot-scope="record">
  28. <template>
  29. <a @click="handleOptionList(record)">下拉选项</a>
  30. </template>
  31. </span>
  32. </a-table>
  33. <a-modal
  34. title="下拉选项"
  35. :width="800"
  36. :visible="visibleOptions"
  37. class="ant-modal2"
  38. @cancel="handleCancel2">
  39. <a-table
  40. bordered
  41. :data-source="dataOptions"
  42. :columns="columnOptions"
  43. tableLayout="auto"
  44. rowKey="name">
  45. </a-table>
  46. <template slot="footer">
  47. <a-button :loading="confirmLoading" type="default" @click="handleCancel2()">关闭</a-button>
  48. </template>
  49. </a-modal>
  50. </a-card>
  51. </template>
  52. <script>
  53. import DetailList from '@/components/tools/DetailList'
  54. const DetailListItem = DetailList.Item
  55. export default {
  56. name: 'CustomFieldTemplateDetail',
  57. components: {
  58. DetailList,
  59. DetailListItem
  60. },
  61. data () {
  62. return {
  63. confirmLoading: false,
  64. mdl: {},
  65. modalTitle: null,
  66. visible: false,
  67. visibleOptions: false,
  68. // 下拉框map
  69. typeMap: {},
  70. typeFieldMap: {},
  71. yesNoMap: {},
  72. model: {
  73. 'content': null,
  74. 'type': null,
  75. 'remark': null,
  76. 'updateTime': null,
  77. 'createdUserId': null,
  78. 'updateUserId': null,
  79. 'updateUserName': null,
  80. 'secondTypeId': null
  81. },
  82. data: [],
  83. dataOptions: [],
  84. // 表头
  85. columns: [
  86. {
  87. title: '序号',
  88. dataIndex: 'index',
  89. customRender: (text, record, index) => {
  90. return index + 1
  91. }
  92. },
  93. {
  94. title: '显示名称',
  95. dataIndex: 'label'
  96. },
  97. {
  98. title: '字段名称',
  99. dataIndex: 'fieldName'
  100. },
  101. {
  102. title: '类型',
  103. dataIndex: 'type',
  104. customRender: (text, record, index) => {
  105. return this.BaseTool.Object.getField(this.typeFieldMap, text)
  106. }
  107. },
  108. {
  109. title: '是否必填',
  110. dataIndex: 'required',
  111. customRender: (text, record, index) => {
  112. return this.BaseTool.Object.getField(this.yesNoMap, text)
  113. }
  114. },
  115. {
  116. title: '显示行数',
  117. dataIndex: 'rows',
  118. width: 120
  119. },
  120. {
  121. title: '排序',
  122. dataIndex: 'sort',
  123. width: 150
  124. },
  125. {
  126. title: '默认值',
  127. dataIndex: 'defaultValue',
  128. width: 150
  129. },
  130. {
  131. title: '最小长度',
  132. dataIndex: 'minLength',
  133. width: 150
  134. },
  135. {
  136. title: '最大长度',
  137. dataIndex: 'maxLength',
  138. width: 150
  139. },
  140. {
  141. title: '操作',
  142. key: 'action',
  143. align: 'center',
  144. scopedSlots: { customRender: 'action' }
  145. }
  146. ],
  147. columnOptions: [
  148. {
  149. title: '序号',
  150. dataIndex: 'index',
  151. customRender: (text, record, index) => {
  152. return index + 1
  153. }
  154. },
  155. {
  156. title: '参数名称',
  157. dataIndex: 'name'
  158. },
  159. {
  160. title: '参数值',
  161. dataIndex: 'value'
  162. }
  163. ]
  164. }
  165. },
  166. created () {
  167. // 下拉框map
  168. this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CUSTOM_FIELD_TEMPLATE_TYPE)
  169. this.typeFieldMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CUSTOM_FIELD_TEMPLATE_FILED_TYPE)
  170. this.yesNoMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
  171. },
  172. methods: {
  173. base (record) {
  174. this.visible = true
  175. this.modalTitle = '详情'
  176. this.model = record
  177. this.data = JSON.parse(record.content)
  178. },
  179. handleCancel () {
  180. this.visible = false
  181. this.confirmLoading = false
  182. this.$emit('ok')
  183. },
  184. handleCancel2 () {
  185. this.visibleOptions = false
  186. this.dataOptions = []
  187. },
  188. handleOptionList (record) {
  189. this.visibleOptions = true
  190. this.dataOptions = record.optionList
  191. }
  192. }
  193. }
  194. </script>