orderListDialog.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <el-dialog
  3. title="选择订单"
  4. custom-class="ele-dialog-form long-dialog-form"
  5. :visible.sync="visible"
  6. :before-close="handleClose"
  7. :close-on-click-modal="false"
  8. top="5vh"
  9. :close-on-press-escape="false"
  10. append-to-body
  11. width="70%"
  12. >
  13. <el-card shadow="never">
  14. <searchTable @search="reload"></searchTable>
  15. <ele-pro-table
  16. ref="table"
  17. :columns="columns"
  18. :datasource="datasource"
  19. row-key="id"
  20. height="calc(100vh - 500px)"
  21. class="dict-table"
  22. :selection.sync="selection"
  23. @columns-change="handleColumnChange"
  24. @cell-click="cellClick"
  25. >
  26. <!-- 表头工具栏 -->
  27. <template v-slot:action="{ row }">
  28. <el-radio class="radio" v-model="radio" :label="row.id"
  29. ><i></i
  30. ></el-radio>
  31. </template>
  32. </ele-pro-table>
  33. </el-card>
  34. <div class="btns" slot="footer">
  35. <el-button type="primary" size="small" @click="selected">选择</el-button>
  36. <el-button size="small" @click="handleClose">关闭</el-button>
  37. </div>
  38. </el-dialog>
  39. </template>
  40. <script>
  41. import { contactTypeTree } from '@/api/saleManage/contact';
  42. import searchTable from './components/searchTable.vue';
  43. import { getTableList } from '@/api/saleManage/saleorder';
  44. import AssetTree from '@/components/AssetTree';
  45. import tabMixins from '@/mixins/tableColumnsMixin';
  46. export default {
  47. mixins: [tabMixins],
  48. components: {
  49. AssetTree,
  50. searchTable
  51. },
  52. props: {
  53. contactData: {
  54. type: Object,
  55. default: () => {
  56. return {};
  57. }
  58. }
  59. },
  60. data() {
  61. return {
  62. visible: false,
  63. currentIndex: null,
  64. selection: [],
  65. columns: [
  66. {
  67. width: 45,
  68. type: 'selection',
  69. columnKey: 'selection',
  70. align: 'center'
  71. },
  72. {
  73. columnKey: 'index',
  74. label: '序号',
  75. type: 'index',
  76. width: 55,
  77. align: 'center',
  78. showOverflowTooltip: true,
  79. fixed: 'left'
  80. },
  81. // {
  82. // action: 'action',
  83. // slot: 'action',
  84. // align: 'center',
  85. // label: '选择'
  86. // },
  87. {
  88. prop: 'orderNo',
  89. label: '订单编码',
  90. align: 'center',
  91. slot: 'orderNo',
  92. showOverflowTooltip: true,
  93. minWidth: 200
  94. },
  95. {
  96. prop: 'contractName',
  97. label: '合同名称',
  98. align: 'center',
  99. slot: 'contractName',
  100. showOverflowTooltip: true,
  101. minWidth: 200
  102. },
  103. {
  104. prop: 'deliveryDate',
  105. label: '交货日期',
  106. align: 'center',
  107. showOverflowTooltip: true,
  108. minWidth: 200
  109. },
  110. {
  111. prop: 'saleTypeName',
  112. label: '销售类型',
  113. align: 'center',
  114. showOverflowTooltip: true,
  115. minWidth: 140
  116. },
  117. {
  118. prop: 'partaName',
  119. label: '客户名称',
  120. align: 'center',
  121. showOverflowTooltip: true,
  122. minWidth: 180
  123. },
  124. {
  125. prop: 'partaLinkName',
  126. label: '客户联系人',
  127. align: 'center',
  128. showOverflowTooltip: true,
  129. minWidth: 130
  130. },
  131. {
  132. prop: 'partaTel',
  133. label: '客户联系电话',
  134. align: 'center',
  135. showOverflowTooltip: true,
  136. minWidth: 130
  137. },
  138. {
  139. prop: 'partbName',
  140. label: '售出方名称',
  141. align: 'center',
  142. showOverflowTooltip: true,
  143. minWidth: 130
  144. },
  145. {
  146. prop: 'partbLinkName',
  147. label: '售出方联系人',
  148. align: 'center',
  149. showOverflowTooltip: true,
  150. minWidth: 130
  151. },
  152. {
  153. prop: 'partbTel',
  154. label: '售出方联系电话',
  155. align: 'center',
  156. showOverflowTooltip: true,
  157. minWidth: 130
  158. },
  159. {
  160. prop: 'payAmount',
  161. label: '应付金额(元)',
  162. align: 'center',
  163. showOverflowTooltip: true,
  164. minWidth: 170
  165. },
  166. {
  167. prop: 'createTime',
  168. label: '创建时间',
  169. align: 'center',
  170. showOverflowTooltip: true,
  171. minWidth: 170
  172. }
  173. ],
  174. radio: null
  175. };
  176. },
  177. methods: {
  178. open(item, currentIndex) {
  179. this.currentIndex = currentIndex;
  180. if (item && item.id) {
  181. this.radio = item.id;
  182. }
  183. this.visible = true;
  184. },
  185. /* 表格数据源 */
  186. datasource({ page, limit, where, order }) {
  187. if (this.contactData.id) {
  188. where['contactId'] = this.contactData.id;
  189. }
  190. return getTableList({
  191. pageNum: page,
  192. size: limit,
  193. ...where
  194. });
  195. },
  196. /* 刷新表格 */
  197. reload(where) {
  198. this.$refs.table.reload({ pageNum: 1, where: where });
  199. },
  200. handleNodeClick(data, node) {
  201. this.reload({ categoryId: data.id });
  202. },
  203. // 单击获取id
  204. cellClick(row) {
  205. this.current = row;
  206. console.log(row);
  207. this.radio = row.id;
  208. },
  209. handleClose() {
  210. this.visible = false;
  211. this.current = null;
  212. this.radio = '';
  213. },
  214. selected() {
  215. if (!this.selection.length) {
  216. return this.$message.warning('请至少选择一条数据');
  217. }
  218. let partaIds = this.selection.map((item) => item.partaId);
  219. if (new Set(partaIds).size != 1) {
  220. return this.$message.warning('请选择相同客户的订单!');
  221. }
  222. this.$emit('changeParent', this.selection, this.currentIndex);
  223. this.handleClose();
  224. }
  225. }
  226. };
  227. </script>
  228. <style lang="scss" scoped>
  229. .tree_col {
  230. border: 1px solid #eee;
  231. padding: 10px 0;
  232. box-sizing: border-box;
  233. height: 500px;
  234. overflow: auto;
  235. }
  236. .table_col {
  237. padding-left: 10px;
  238. ::v-deep .el-table th.el-table__cell {
  239. background: #f2f2f2;
  240. }
  241. }
  242. .pagination {
  243. text-align: right;
  244. padding: 10px 0;
  245. }
  246. .btns {
  247. text-align: center;
  248. padding: 10px 0;
  249. }
  250. .topsearch {
  251. margin-bottom: 15px;
  252. }
  253. </style>