orderListDialog.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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. needProduces: {
  60. type: String,
  61. default: ''
  62. }
  63. },
  64. data() {
  65. return {
  66. visible: false,
  67. currentIndex: null,
  68. selection: [],
  69. columns: [
  70. {
  71. width: 45,
  72. type: 'selection',
  73. columnKey: 'selection',
  74. align: 'center'
  75. },
  76. {
  77. columnKey: 'index',
  78. label: '序号',
  79. type: 'index',
  80. width: 55,
  81. align: 'center',
  82. showOverflowTooltip: true,
  83. fixed: 'left'
  84. },
  85. // {
  86. // action: 'action',
  87. // slot: 'action',
  88. // align: 'center',
  89. // label: '选择'
  90. // },
  91. {
  92. prop: 'orderNo',
  93. label: '订单编码',
  94. align: 'center',
  95. slot: 'orderNo',
  96. showOverflowTooltip: true,
  97. minWidth: 200
  98. },
  99. {
  100. prop: 'needProduce',
  101. label: '订单类型',
  102. align: 'center',
  103. showOverflowTooltip: true,
  104. minWidth: 150,
  105. formatter: (_row, _column, cellValue) => {
  106. let businessType =
  107. cellValue == 1
  108. ? '有客户生产性订单'
  109. : cellValue == 2
  110. ? '无客户生产性订单'
  111. : cellValue == 4
  112. ? '不定向订单'
  113. : cellValue == 5
  114. ? '委外订单'
  115. : '库存式订单';
  116. return businessType;
  117. }
  118. },
  119. {
  120. prop: 'contractName',
  121. label: '合同名称',
  122. align: 'center',
  123. slot: 'contractName',
  124. showOverflowTooltip: true,
  125. minWidth: 200
  126. },
  127. {
  128. prop: 'deliveryDate',
  129. label: '交货日期',
  130. align: 'center',
  131. showOverflowTooltip: true,
  132. minWidth: 200
  133. },
  134. {
  135. prop: 'saleTypeName',
  136. label: '销售类型',
  137. align: 'center',
  138. showOverflowTooltip: true,
  139. minWidth: 140
  140. },
  141. {
  142. prop: 'partaName',
  143. label: '客户名称',
  144. align: 'center',
  145. showOverflowTooltip: true,
  146. minWidth: 180
  147. },
  148. {
  149. prop: 'partaLinkName',
  150. label: '客户联系人',
  151. align: 'center',
  152. showOverflowTooltip: true,
  153. minWidth: 130
  154. },
  155. {
  156. prop: 'partaTel',
  157. label: '客户联系电话',
  158. align: 'center',
  159. showOverflowTooltip: true,
  160. minWidth: 130
  161. },
  162. {
  163. prop: 'partbName',
  164. label: '售出方名称',
  165. align: 'center',
  166. showOverflowTooltip: true,
  167. minWidth: 130
  168. },
  169. {
  170. prop: 'partbLinkName',
  171. label: '售出方联系人',
  172. align: 'center',
  173. showOverflowTooltip: true,
  174. minWidth: 130
  175. },
  176. {
  177. prop: 'partbTel',
  178. label: '售出方联系电话',
  179. align: 'center',
  180. showOverflowTooltip: true,
  181. minWidth: 130
  182. },
  183. {
  184. prop: 'payAmount',
  185. label: '应付金额(元)',
  186. align: 'center',
  187. showOverflowTooltip: true,
  188. minWidth: 170
  189. },
  190. {
  191. prop: 'createTime',
  192. label: '创建时间',
  193. align: 'center',
  194. showOverflowTooltip: true,
  195. minWidth: 170
  196. }
  197. ],
  198. radio: null
  199. };
  200. },
  201. methods: {
  202. open(item, currentIndex) {
  203. this.currentIndex = currentIndex;
  204. this.selection = [];
  205. // if (item && item.id) {
  206. // this.radio = item.id;
  207. // }
  208. this.visible = true;
  209. },
  210. /* 表格数据源 */
  211. datasource({ page, limit, where, order }) {
  212. if (this.contactData.id) {
  213. where['contactId'] = this.contactData.id;
  214. }
  215. if (this.needProduces) {
  216. where['needProduces'] = this.needProduces;
  217. }
  218. return getTableList({
  219. pageNum: page,
  220. size: limit,
  221. ...where
  222. });
  223. },
  224. /* 刷新表格 */
  225. reload(where) {
  226. this.$refs.table.reload({ pageNum: 1, where: where });
  227. },
  228. handleNodeClick(data, node) {
  229. this.reload({ categoryId: data.id });
  230. },
  231. // 单击获取id
  232. cellClick(row) {
  233. this.current = row;
  234. console.log(row);
  235. this.radio = row.id;
  236. },
  237. handleClose() {
  238. this.visible = false;
  239. this.current = null;
  240. this.radio = '';
  241. },
  242. selected() {
  243. if (!this.selection.length) {
  244. return this.$message.warning('请至少选择一条数据');
  245. }
  246. // let partaIds = this.selection.map((item) => item.partaId);
  247. // if (new Set(partaIds).size != 1) {
  248. // return this.$message.warning('请选择相同客户的订单!');
  249. // }
  250. this.$emit('changeParent', this.selection, this.currentIndex);
  251. this.handleClose();
  252. }
  253. }
  254. };
  255. </script>
  256. <style lang="scss" scoped>
  257. .tree_col {
  258. border: 1px solid #eee;
  259. padding: 10px 0;
  260. box-sizing: border-box;
  261. height: 500px;
  262. overflow: auto;
  263. }
  264. .table_col {
  265. padding-left: 10px;
  266. ::v-deep .el-table th.el-table__cell {
  267. background: #f2f2f2;
  268. }
  269. }
  270. .pagination {
  271. text-align: right;
  272. padding: 10px 0;
  273. }
  274. .btns {
  275. text-align: center;
  276. padding: 10px 0;
  277. }
  278. .topsearch {
  279. margin-bottom: 15px;
  280. }
  281. </style>