1. <template>
    2. <div class="common-project-container">
    3. <div class="tools-line">
    4. <div class="tools-line-left" v-if="showListAndCard">
    5. <a-select
    6. label-in-value
    7. :default-value="{ key: 'list' }"
    8. style="width: 80px"
    9. @change="handleChange"
    10. >
    11. <a-select-option value="list">列表</a-select-option>
    12. <a-select-option value="card">卡片</a-select-option>
    13. </a-select>
    14. </div>
    15. <div class="tools-line-left">
    16. <slot name="toolLeft"></slot>
    17. </div>
    18. <a-space>
    19. <search-content
    20. v-if="isSearch"
    21. ref="searchContentRef"
    22. style="margin: 0 10px"
    23. v-bind="searchContentObj"
    24. @searchdata="handleToolSearch"
    25. :UNTASK="UNTASK"
    26. :simpleModel="simpleModel"
    27. :timeInputDefault="timeInputDefault"
    28. ></search-content>
    29. <select-content
    30. v-if="isSelectContent"
    31. v-bind="selectContentObj"
    32. @getSelectData="getSelectData"
    33. ></select-content>
    34. <a-button
    35. v-if="buttonInfo.isButton"
    36. @click="buttonInfo.btnClick"
    37. type="primary"
    38. >新建</a-button
    39. >
    40. </a-space>
    41. </div>
    42. <slot name="alert"></slot>
    43. <a-table ref="innerTable" v-bind="$props" v-on="$listeners">
    44. <template
    45. slot-scope="text, record, index"
    46. :slot="slot"
    47. v-for="slot in Object.keys($scopedSlots).filter(
    48. item => item != 'alert'
    49. )"
    50. >
    51. <!-- v-for="slot in Object.keys($scopedSlots).filter(key => key !== 'expandedRowRender')" -->
    52. <slot :name="slot" v-bind="{ text, record, index }"></slot>
    53. </template>
    54. </a-table>
    55. <card-table v-bind="$props" v-if="showListAndCard"></card-table>
    56. </div>
    57. </template>
    58. <script>
    59. //这里包含了三个部分,search,table主体,列设置,将三者包装成为了一个组件,可分开使用。
    60. import { Table } from 'ant-design-vue'
    61. import SelectContent from '@/common/SelectContent'
    62. import SearchContent from '@/common/searchcontent/index'
    63. import CardTable from '@/common/cardtable'
    64. export default {
    65. inheritAttrs: false,
    66. components: {
    67. SelectContent,
    68. SearchContent,
    69. CardTable
    70. },
    71. props: {
    72. ...Table.props,
    73. selectContentObj: Object,
    74. searchContentObj: Object,
    75. buttonInfo: {
    76. type: Object,
    77. default() {
    78. return {
    79. isButton: false,
    80. btnClick() {}
    81. }
    82. }
    83. },
    84. isSelectContent: {
    85. type: Boolean,
    86. default() {
    87. return true
    88. }
    89. },
    90. isSearch: {
    91. type: Boolean,
    92. default() {
    93. return true
    94. }
    95. },
    96. showListAndCard: {
    97. type: Boolean,
    98. default() {
    99. return false
    100. }
    101. },
    102. UNTASK: {
    103. type: Boolean,
    104. default: true
    105. },
    106. simpleModel: {
    107. type: Boolean,
    108. default: false
    109. },
    110. timeInputDefault:{
    111. type: Array,
    112. default: function () {
    113. return []
    114. }
    115. }
    116. },
    117. data() {
    118. return {
    119. slotNode: null,
    120. scopedSlots: this.$scopedSlots,
    121. viewFlag: false
    122. }
    123. },
    124. methods: {
    125. handleToolSearch(value, complexSearch) {
    126. this.searchContentObj.handleToolSearch(value, complexSearch)
    127. },
    128. getSelectData(value) {
    129. this.selectContentObj.getSelectData(value)
    130. },
    131. resetFilterSearchContent() {
    132. this.$refs.searchContentRef.resetSearch()
    133. },
    134. /**
    135. * 改变展示视图 卡片/列表
    136. */
    137. handleChange(value) {}
    138. },
    139. beforeCreate() {},
    140. created() {},
    141. mounted() {}
    142. }
    143. </script>
    144. <style lang="scss" scoped>
    145. .common-project-container {
    146. padding: 0 16px;
    147. width: 100%;
    148. height: 100%;
    149. display: flex;
    150. flex-direction: column;
    151. // align-items: flex-end;
    152. overflow-y: auto;
    153. .tools-line-left {
    154. flex: 1;
    155. }
    156. .tools-line {
    157. // width: 100%;
    158. display: flex;
    159. justify-content: flex-end;
    160. align-items: center;
    161. margin-bottom: 8px;
    162. button {
    163. margin-right: 16px;
    164. }
    165. }
    166. ::v-deep .ant-table-wrapper {
    167. width: 100%;
    168. height: 100%;
    169. /* .ant-table-fixed-left {
    170. .ant-table-header.ant-table-hide-scrollbar {
    171. // width: 582px !important;
    172. }
    173. } */
    174. }
    175. .type-container {
    176. span {
    177. margin-right: 5px;
    178. }
    179. }
    180. .tags-container {
    181. line-height: 24px;
    182. span {
    183. margin-right: 4px;
    184. padding: 4px;
    185. white-space: nowrap;
    186. }
    187. }
    188. .action-container {
    189. i {
    190. margin: 0 4px;
    191. }
    192. }
    193. }
    194. </style>