0a4d9c2d5fc7b69160e2530b47b8095eadd7fabf.svn-base 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- table区域-begin -->
  4. <a-table
  5. ref="table"
  6. size="default"
  7. bordered
  8. rowKey="id"
  9. :columns="columns"
  10. :pagination="false"
  11. :dataSource="dataSource">
  12. </a-table>
  13. <!-- table区域-end -->
  14. </a-card>
  15. </template>
  16. <script>
  17. export default {
  18. name: "RowspanTable",
  19. components: {
  20. },
  21. data() {
  22. return {
  23. description: '存放位置设置表管理页面',
  24. levelNum:{},
  25. gridNum:0,
  26. boxNum:0,
  27. cabinetNo:"",
  28. // 表头
  29. columns: [ {
  30. title: '分组一',
  31. align: "center",
  32. dataIndex: 'cabinetNo',
  33. customRender: (value, row, index) => {
  34. const obj = {
  35. children: value,
  36. attrs: {},
  37. };
  38. if(index===0){
  39. obj.attrs.rowSpan = this.dataSource.length;
  40. }else{
  41. obj.attrs.rowSpan = 0;
  42. }
  43. return obj;
  44. },
  45. },
  46. {
  47. title: '分组二',
  48. align: "center",
  49. dataIndex: 'levelNo',
  50. customRender: (value, row, index) => {
  51. const obj = {
  52. children: value,
  53. attrs: {},
  54. };
  55. //当前列跨行的条数
  56. var a = parseInt(this.levelNum);
  57. var b = parseInt(this.gridNum)*parseInt(this.boxNum);
  58. console.log(a);
  59. for(var c=0;c<=a;c++){
  60. if(index === (c*b)){
  61. console.log(1);
  62. console.log(c*b);
  63. obj.attrs.rowSpan = b;
  64. break;
  65. }else{
  66. obj.attrs.rowSpan = 0;
  67. }
  68. }
  69. return obj;
  70. }
  71. },
  72. {
  73. title: '分组三',
  74. align: "center",
  75. dataIndex: 'gridNo',
  76. customRender: (value, row, index) => {
  77. const obj = {
  78. children: value,
  79. attrs: {},
  80. };
  81. var a = parseInt(this.levelNum)*parseInt(this.gridNum);
  82. var b = parseInt(this.boxNum);
  83. for(var c=0;c<=a;c++){
  84. if(index === (c*b)){
  85. obj.attrs.rowSpan = b;
  86. break;
  87. }else{
  88. obj.attrs.rowSpan = 0;
  89. }
  90. }
  91. return obj;
  92. },
  93. }, {
  94. title: '字段一',
  95. align: "center",
  96. dataIndex: 'boxNo'
  97. }, {
  98. title: '字段二',
  99. align: 'center',
  100. dataIndex: 'storedNum'
  101. }, {
  102. title: '字段三',
  103. align: "center",
  104. dataIndex: 'maxNum'
  105. },],
  106. //数据集
  107. dataSource: [{
  108. "id": "cb1dfd12cbeca3f8ba121439ee7e2411",
  109. "attributeId": "e62831f314e1390edbd884e9d9e6aca6",
  110. "cabinetNo": "1",
  111. "levelNo": "1",
  112. "gridNo": "1",
  113. "boxNo": "1",
  114. "storedNum": 2,
  115. "maxNum": 2,
  116. "unitNum": 2,
  117. "assignStatus": "1",
  118. "storageStatus": "1",
  119. "remark": null,
  120. "createBy": "admin",
  121. "createTime": "2019-04-02",
  122. "updateBy": "admin",
  123. "updateTime": "2019-04-02"
  124. }, {
  125. "id": "f903d50d02904b14175dccf2a7948777",
  126. "attributeId": "e62831f314e1390edbd884e9d9e6aca6",
  127. "cabinetNo": "1",
  128. "levelNo": "1",
  129. "gridNo": "1",
  130. "boxNo": "2",
  131. "storedNum": 2,
  132. "maxNum": 2,
  133. "unitNum": 2,
  134. "assignStatus": "1",
  135. "storageStatus": "1",
  136. "remark": null,
  137. "createBy": "admin",
  138. "createTime": "2019-04-02",
  139. "updateBy": "admin",
  140. "updateTime": "2019-04-02"
  141. }, {
  142. "id": "4f04c0ca4202535d678871b07e706cf6",
  143. "attributeId": "e62831f314e1390edbd884e9d9e6aca6",
  144. "cabinetNo": "1",
  145. "levelNo": "1",
  146. "gridNo": "2",
  147. "boxNo": "1",
  148. "storedNum": 2,
  149. "maxNum": 2,
  150. "unitNum": 2,
  151. "assignStatus": "1",
  152. "storageStatus": "1",
  153. "remark": null,
  154. "createBy": "admin",
  155. "createTime": "2019-04-02",
  156. "updateBy": "admin",
  157. "updateTime": "2019-04-02"
  158. }, {
  159. "id": "d0c91dabedfc03efad0126e50ea72e80",
  160. "attributeId": "e62831f314e1390edbd884e9d9e6aca6",
  161. "cabinetNo": "1",
  162. "levelNo": "1",
  163. "gridNo": "2",
  164. "boxNo": "2",
  165. "storedNum": 2,
  166. "maxNum": 2,
  167. "unitNum": 2,
  168. "assignStatus": "1",
  169. "storageStatus": "1",
  170. "remark": null,
  171. "createBy": "admin",
  172. "createTime": "2019-04-02",
  173. "updateBy": "admin",
  174. "updateTime": "2019-04-08"
  175. }, {
  176. "id": "1e8bfcbe4352afbab8878f9fd368e007",
  177. "attributeId": "e62831f314e1390edbd884e9d9e6aca6",
  178. "cabinetNo": "1",
  179. "levelNo": "2",
  180. "gridNo": "1",
  181. "boxNo": "1",
  182. "storedNum": 1,
  183. "maxNum": 2,
  184. "unitNum": 1,
  185. "assignStatus": "1",
  186. "storageStatus": "0",
  187. "remark": null,
  188. "createBy": "admin",
  189. "createTime": "2019-04-02",
  190. "updateBy": "admin",
  191. "updateTime": "2019-04-08"
  192. }, {
  193. "id": "d76087d8d3ebc7a59d43458588f26941",
  194. "attributeId": "e62831f314e1390edbd884e9d9e6aca6",
  195. "cabinetNo": "1",
  196. "levelNo": "2",
  197. "gridNo": "1",
  198. "boxNo": "2",
  199. "storedNum": 0,
  200. "maxNum": 2,
  201. "unitNum": 0,
  202. "assignStatus": "1",
  203. "storageStatus": "0",
  204. "remark": null,
  205. "createBy": "admin",
  206. "createTime": "2019-04-02",
  207. "updateBy": "admin",
  208. "updateTime": "2019-04-02"
  209. }, {
  210. "id": "7bf7754f12e1bf95edcd501cc6b85e62",
  211. "attributeId": "e62831f314e1390edbd884e9d9e6aca6",
  212. "cabinetNo": "1",
  213. "levelNo": "2",
  214. "gridNo": "2",
  215. "boxNo": "1",
  216. "storedNum": 0,
  217. "maxNum": 2,
  218. "unitNum": 0,
  219. "assignStatus": "1",
  220. "storageStatus": "0",
  221. "remark": null,
  222. "createBy": "admin",
  223. "createTime": "2019-04-02",
  224. "updateBy": "admin",
  225. "updateTime": "2019-04-02"
  226. }, {
  227. "id": "9cd08d733657d5b286bec870f12f6ecf",
  228. "attributeId": "e62831f314e1390edbd884e9d9e6aca6",
  229. "cabinetNo": "1",
  230. "levelNo": "2",
  231. "gridNo": "2",
  232. "boxNo": "2",
  233. "storedNum": 0,
  234. "maxNum": 2,
  235. "unitNum": 0,
  236. "assignStatus": "1",
  237. "storageStatus": "0",
  238. "remark": null,
  239. "createBy": "admin",
  240. "createTime": "2019-04-02",
  241. "updateBy": "admin",
  242. "updateTime": "2019-04-02"
  243. }],
  244. isorter: {
  245. column: 'createTime',
  246. order: 'desc',
  247. },
  248. url: {
  249. },
  250. }
  251. },
  252. created() {
  253. this.loadData();
  254. },
  255. methods: {
  256. loadData(){
  257. this.levelNum=4;
  258. this.gridNum = 2;
  259. this.boxNum = 2;
  260. }
  261. }
  262. }
  263. </script>
  264. <style scoped>
  265. .ant-card-body .table-operator{
  266. margin-bottom: 18px;
  267. }
  268. .ant-table-tbody .ant-table-row td{
  269. padding-top:15px;
  270. padding-bottom:15px;
  271. }
  272. .anty-row-operator button{margin: 0 5px}
  273. .ant-btn-danger{background-color: #ffffff}
  274. .ant-modal-cust-warp{height: 100%}
  275. .ant-modal-cust-warp .ant-modal-body{height:calc(100% - 110px) !important;overflow-y: auto}
  276. .ant-modal-cust-warp .ant-modal-content{height:90% !important;overflow-y: hidden}
  277. </style>