BasicList.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <page-header-wrapper>
  3. <a-card :bordered="false">
  4. <a-row>
  5. <a-col :sm="8" :xs="24">
  6. <info title="我的待办" value="8个任务" :bordered="true" />
  7. </a-col>
  8. <a-col :sm="8" :xs="24">
  9. <info title="本周任务平均处理时间" value="32分钟" :bordered="true" />
  10. </a-col>
  11. <a-col :sm="8" :xs="24">
  12. <info title="本周完成任务数" value="24个" />
  13. </a-col>
  14. </a-row>
  15. </a-card>
  16. <a-card
  17. style="margin-top: 24px"
  18. :bordered="false"
  19. title="标准列表">
  20. <div slot="extra">
  21. <a-radio-group v-model="status">
  22. <a-radio-button value="all">全部</a-radio-button>
  23. <a-radio-button value="processing">进行中</a-radio-button>
  24. <a-radio-button value="waiting">等待中</a-radio-button>
  25. </a-radio-group>
  26. <a-input-search style="margin-left: 16px; width: 272px;" />
  27. </div>
  28. <div class="operate">
  29. <a-button type="dashed" style="width: 100%" icon="plus" @click="add">添加</a-button>
  30. </div>
  31. <a-list size="large" :pagination="{showSizeChanger: true, showQuickJumper: true, pageSize: 5, total: 50}">
  32. <a-list-item :key="index" v-for="(item, index) in data">
  33. <a-list-item-meta :description="item.description">
  34. <a-avatar slot="avatar" size="large" shape="square" :src="item.avatar"/>
  35. <a slot="title">{{ item.title }}</a>
  36. </a-list-item-meta>
  37. <div slot="actions">
  38. <a @click="edit(item)">编辑</a>
  39. </div>
  40. <div slot="actions">
  41. <a-dropdown>
  42. <a-menu slot="overlay">
  43. <a-menu-item><a>编辑</a></a-menu-item>
  44. <a-menu-item><a>删除</a></a-menu-item>
  45. </a-menu>
  46. <a>更多<a-icon type="down"/></a>
  47. </a-dropdown>
  48. </div>
  49. <div class="list-content">
  50. <div class="list-content-item">
  51. <span>Owner</span>
  52. <p>{{ item.owner }}</p>
  53. </div>
  54. <div class="list-content-item">
  55. <span>开始时间</span>
  56. <p>{{ item.startAt }}</p>
  57. </div>
  58. <div class="list-content-item">
  59. <a-progress :percent="item.progress.value" :status="!item.progress.status ? null : item.progress.status" style="width: 180px" />
  60. </div>
  61. </div>
  62. </a-list-item>
  63. </a-list>
  64. </a-card>
  65. </page-header-wrapper>
  66. </template>
  67. <script>
  68. // 演示如何使用 this.$dialog 封装 modal 组件
  69. import TaskForm from './modules/TaskForm'
  70. import Info from './components/Info'
  71. const data = []
  72. data.push({
  73. title: 'Alipay',
  74. avatar: 'https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png',
  75. description: '那是一种内在的东西, 他们到达不了,也无法触及的',
  76. owner: '付晓晓',
  77. startAt: '2018-07-26 22:44',
  78. progress: {
  79. value: 90
  80. }
  81. })
  82. data.push({
  83. title: 'Angular',
  84. avatar: 'https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png',
  85. description: '希望是一个好东西,也许是最好的,好东西是不会消亡的',
  86. owner: '曲丽丽',
  87. startAt: '2018-07-26 22:44',
  88. progress: {
  89. value: 54
  90. }
  91. })
  92. data.push({
  93. title: 'Ant Design',
  94. avatar: 'https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png',
  95. description: '生命就像一盒巧克力,结果往往出人意料',
  96. owner: '林东东',
  97. startAt: '2018-07-26 22:44',
  98. progress: {
  99. value: 66
  100. }
  101. })
  102. data.push({
  103. title: 'Ant Design Pro',
  104. avatar: 'https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png',
  105. description: '城镇中有那么多的酒馆,她却偏偏走进了我的酒馆',
  106. owner: '周星星',
  107. startAt: '2018-07-26 22:44',
  108. progress: {
  109. value: 30
  110. }
  111. })
  112. data.push({
  113. title: 'Bootstrap',
  114. avatar: 'https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png',
  115. description: '那时候我只会想自己想要什么,从不想自己拥有什么',
  116. owner: '吴加好',
  117. startAt: '2018-07-26 22:44',
  118. progress: {
  119. status: 'exception',
  120. value: 100
  121. }
  122. })
  123. export default {
  124. name: 'StandardList',
  125. components: {
  126. TaskForm,
  127. Info
  128. },
  129. data () {
  130. return {
  131. data,
  132. status: 'all'
  133. }
  134. },
  135. methods: {
  136. add () {
  137. this.$dialog(TaskForm,
  138. // component props
  139. {
  140. record: {},
  141. on: {
  142. ok () {
  143. console.log('ok 回调')
  144. },
  145. cancel () {
  146. console.log('cancel 回调')
  147. },
  148. close () {
  149. console.log('modal close 回调')
  150. }
  151. }
  152. },
  153. // modal props
  154. {
  155. title: '新增',
  156. width: 700,
  157. centered: true,
  158. maskClosable: false,
  159. drag: true
  160. })
  161. },
  162. edit (record) {
  163. console.log('record', record)
  164. this.$dialog(TaskForm,
  165. // component props
  166. {
  167. record,
  168. on: {
  169. ok () {
  170. console.log('ok 回调')
  171. },
  172. cancel () {
  173. console.log('cancel 回调')
  174. },
  175. close () {
  176. console.log('modal close 回调')
  177. }
  178. }
  179. },
  180. // modal props
  181. {
  182. title: '操作',
  183. width: 700,
  184. centered: true,
  185. maskClosable: false,
  186. drag: true
  187. })
  188. }
  189. }
  190. }
  191. </script>
  192. <style lang="less" scoped>
  193. .ant-avatar-lg {
  194. width: 48px;
  195. height: 48px;
  196. line-height: 48px;
  197. }
  198. .list-content-item {
  199. color: rgba(0, 0, 0, .45);
  200. display: inline-block;
  201. vertical-align: middle;
  202. font-size: 14px;
  203. margin-left: 40px;
  204. span {
  205. line-height: 20px;
  206. }
  207. p {
  208. margin-top: 4px;
  209. margin-bottom: 0;
  210. line-height: 22px;
  211. }
  212. }
  213. </style>