a624b4b4dc134b090f788e726f79b8dcdcca9220.svn-base 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline">
  6. <a-row :gutter="24">
  7. <a-col :md="6" :sm="24">
  8. <a-form-item label="订单号">
  9. <a-input placeholder="请输入订单号" v-model="queryParam.orderCode"></a-input>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="24">
  13. <a-form-item label="订单类型">
  14. <a-select placeholder="请输入订单类型" v-model="queryParam.ctype">
  15. <a-select-option value="1">国内订单</a-select-option>
  16. <a-select-option value="2">国际订单</a-select-option>
  17. </a-select>
  18. </a-form-item>
  19. </a-col>
  20. <a-col :md="6" :sm="24">
  21. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  22. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  23. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  24. </span>
  25. </a-col>
  26. </a-row>
  27. </a-form>
  28. </div>
  29. <!-- 操作按钮区域 -->
  30. <div class="table-operator">
  31. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  32. <a-dropdown v-if="selectedRowKeys.length > 0">
  33. <a-menu slot="overlay">
  34. <a-menu-item key="1" @click="batchDel">
  35. <a-icon type="delete"/>
  36. 删除
  37. </a-menu-item>
  38. </a-menu>
  39. <a-button style="margin-left: 8px"> 批量操作
  40. <a-icon type="down"/>
  41. </a-button>
  42. </a-dropdown>
  43. </div>
  44. <!-- table区域-begin -->
  45. <div>
  46. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  47. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  48. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  49. </div>
  50. <a-table
  51. ref="table"
  52. bordered
  53. rowKey="id"
  54. :columns="columns"
  55. :dataSource="dataSource"
  56. :pagination="false"
  57. :expandedRowKeys= "expandedRowKeys"
  58. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  59. @change="handleTableChange"
  60. @expand="handleExpand"
  61. >
  62. <span slot="action" slot-scope="text, record">
  63. <a @click="handleEdit(record)">编辑</a>
  64. <a-divider type="vertical"/>
  65. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  66. <a>删除</a>
  67. </a-popconfirm>
  68. </span>
  69. <a-table
  70. slot="expandedRowRender"
  71. slot-scope="text"
  72. :columns="innerColumns"
  73. :dataSource="innerData"
  74. size="middle"
  75. bordered
  76. rowKey="id"
  77. :pagination="false"
  78. :loading="loading"
  79. >
  80. </a-table>
  81. </a-table>
  82. </div>
  83. <!-- table区域-end -->
  84. <!-- 表单区域 -->
  85. <jeecgOrderDMain-modal ref="modalForm" @ok="modalFormOk"></jeecgOrderDMain-modal>
  86. </a-card>
  87. </template>
  88. <script>
  89. import { getAction } from '@/api/manage'
  90. import JeecgOrderDMainModal from '@/views/jeecg/tablist/form/JeecgOrderDMainModal'
  91. import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  92. export default {
  93. name: "TableDemo",
  94. mixins: [JeecgListMixin],
  95. components: {
  96. JeecgOrderDMainModal
  97. },
  98. data() {
  99. return {
  100. // 子表表头
  101. innerColumns: [
  102. {
  103. title: '客户名',
  104. align: "center",
  105. width: 100,
  106. dataIndex: 'name',
  107. key: 'name',
  108. },
  109. {
  110. title: '性别',
  111. align: "center",
  112. dataIndex: 'sex',
  113. customRender: function (text) {
  114. if (text == 1) {
  115. return "男";
  116. } else if (text == 2) {
  117. return "女";
  118. } else {
  119. return text;
  120. }
  121. }
  122. },
  123. {
  124. title: '身份证号码',
  125. align: "center",
  126. dataIndex: 'idcard',
  127. },
  128. {
  129. title: '电话',
  130. dataIndex: 'telphone',
  131. align: "center",
  132. },
  133. ],
  134. innerData: [],
  135. expandedRowKeys: [],
  136. id: ' ',
  137. description: '列表展开子表Demo',
  138. // 列表表头
  139. columns: [{
  140. title: '#',
  141. dataIndex: '',
  142. key: 'rowIndex',
  143. width: 60,
  144. align: "center",
  145. customRender: function (t, r, index) {
  146. return parseInt(index) + 1;
  147. }
  148. },
  149. {
  150. title: '订单号',
  151. align: "center",
  152. dataIndex: 'orderCode'
  153. },
  154. {
  155. title: '订单类型',
  156. align: "center",
  157. dataIndex: 'ctype',
  158. customRender: (text) => {
  159. let re = "";
  160. if (text === '1') {
  161. re = "国内订单";
  162. } else if (text === '2') {
  163. re = "国际订单";
  164. }
  165. return re;
  166. }
  167. },
  168. {
  169. title: '订单日期',
  170. align: "center",
  171. dataIndex: 'orderDate'
  172. },
  173. {
  174. title: '订单金额',
  175. align: "center",
  176. dataIndex: 'orderMoney'
  177. },
  178. {
  179. title: '订单备注',
  180. align: "center",
  181. dataIndex: 'content'
  182. },
  183. {
  184. title: '操作',
  185. dataIndex: 'action',
  186. align: "center",
  187. scopedSlots: {customRender: 'action'},
  188. }],
  189. // 分页参数
  190. type: "radio",
  191. url: {
  192. list: "/test/order/orderList",
  193. delete: "/test/order/delete",
  194. deleteBatch: "/test/order/deleteBatch",
  195. customerListByMainId: "/test/order/listOrderCustomerByMainId",
  196. },
  197. }
  198. },
  199. computed: {
  200. currentId(){
  201. return this.id;
  202. }
  203. },
  204. methods: {
  205. handleExpand(expanded, record){
  206. this.expandedRowKeys=[];
  207. this.innerData=[];
  208. if(expanded===true){
  209. this.loading = true;
  210. this.expandedRowKeys.push(record.id);
  211. getAction(this.url.customerListByMainId, {mainId: record.id}).then((res) => {
  212. if (res.success) {
  213. this.loading = false;
  214. this.innerData = res.result.records;
  215. }
  216. });
  217. }
  218. },
  219. }
  220. }
  221. </script>
  222. <style scoped>
  223. .ant-card-body .table-operator {
  224. margin-bottom: 18px;
  225. }
  226. .ant-table-tbody .ant-table-row td {
  227. padding-top: 15px;
  228. padding-bottom: 15px;
  229. }
  230. .anty-row-operator button {
  231. margin: 0 5px
  232. }
  233. .ant-btn-danger {
  234. background-color: #ffffff
  235. }
  236. .ant-modal-cust-warp {
  237. height: 100%
  238. }
  239. .ant-modal-cust-warp .ant-modal-body {
  240. height: calc(100% - 110px) !important;
  241. overflow-y: auto
  242. }
  243. .ant-modal-cust-warp .ant-modal-content {
  244. height: 90% !important;
  245. overflow-y: hidden
  246. }
  247. </style>