inquiryList.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <el-dialog
  3. title="选择核价单"
  4. :visible.sync="visible"
  5. :before-close="handleClose"
  6. :close-on-click-modal="false"
  7. top="5vh"
  8. :close-on-press-escape="false"
  9. append-to-body
  10. width="80%"
  11. >
  12. <el-card shadow="never">
  13. <searchProduct @search="reload"></searchProduct>
  14. <ele-pro-table
  15. ref="table"
  16. :columns="columns"
  17. :datasource="datasource"
  18. :selection.sync="selection"
  19. cache-key="eomContactPageTable"
  20. height="calc(100vh - 350px)"
  21. class="dict-table"
  22. >
  23. </ele-pro-table>
  24. </el-card>
  25. <div class="btns">
  26. <el-button type="primary" size="small" @click="selected"
  27. >生成合同</el-button
  28. >
  29. <el-button size="small" @click="handleClose">关闭</el-button>
  30. </div>
  31. </el-dialog>
  32. </template>
  33. <script>
  34. import {
  35. getTableList,
  36. generateContract
  37. } from '@/api/purchasingManage/inquiryManage';
  38. import searchProduct from '@/views/purchasingManage/inquiryManage/components/searchQuotation.vue';
  39. export default {
  40. components: {
  41. searchProduct
  42. },
  43. data() {
  44. return {
  45. visible: false,
  46. currentIndex: null,
  47. selection: [],
  48. columns: [
  49. {
  50. width: 45,
  51. type: 'selection',
  52. columnKey: 'selection',
  53. align: 'center'
  54. },
  55. {
  56. columnKey: 'index',
  57. label: '序号',
  58. type: 'index',
  59. width: 55,
  60. align: 'center',
  61. showOverflowTooltip: true,
  62. fixed: 'left'
  63. },
  64. {
  65. prop: 'inquiryCode',
  66. slot: 'inquiryCode',
  67. label: '采购询价编码',
  68. align: 'center',
  69. showOverflowTooltip: true,
  70. minWidth: 200
  71. },
  72. {
  73. prop: 'planCode',
  74. slot: 'planCode',
  75. label: '采购计划编码',
  76. align: 'center',
  77. showOverflowTooltip: true,
  78. minWidth: 200
  79. },
  80. {
  81. prop: 'supplierNames',
  82. label: '供应商名称',
  83. align: 'center',
  84. showOverflowTooltip: true,
  85. minWidth: 200
  86. },
  87. {
  88. prop: 'winnerName',
  89. label: '中标供应商',
  90. align: 'center',
  91. showOverflowTooltip: true,
  92. minWidth: 200
  93. },
  94. {
  95. prop: 'createTime',
  96. label: '创建时间',
  97. align: 'center',
  98. showOverflowTooltip: true,
  99. minWidth: 180
  100. },
  101. {
  102. prop: 'remark',
  103. label: '备注',
  104. align: 'center',
  105. showOverflowTooltip: true,
  106. minWidth: 170
  107. }
  108. ]
  109. };
  110. },
  111. watch: {},
  112. methods: {
  113. open() {
  114. this.visible = true;
  115. },
  116. /* 表格数据源 */
  117. datasource({ page, limit, where, order }) {
  118. return getTableList({
  119. pageNum: page,
  120. size: limit,
  121. ...where,
  122. status:2
  123. });
  124. },
  125. /* 刷新表格 */
  126. reload(where) {
  127. this.$refs.table.reload({ pageNum: 1, where: where });
  128. },
  129. //新增合同
  130. async addGenerateContract() {
  131. let { verify, text, ids } = this.verify();
  132. if (!verify) {
  133. this.$message.warning(text);
  134. return;
  135. }
  136. let data = await generateContract(ids);
  137. return data;
  138. },
  139. // 合同验证
  140. verify() {
  141. let verify = true;
  142. let text = '';
  143. let ids = [];
  144. let winnerIds = this.selection
  145. .filter((item) => item.winnerId)
  146. .map((item) => item.winnerId);
  147. this.selection.forEach((item) => {
  148. this.selection.forEach((val) => {
  149. if (item.winnerId != val.winnerId) {
  150. verify = false;
  151. text = '中标供应商不一致';
  152. }
  153. });
  154. });
  155. if (winnerIds.length != this.selection.length) {
  156. verify = false;
  157. text = '核价单中标供应商为空';
  158. }
  159. if (verify) {
  160. ids = this.selection.map((item) => item.id);
  161. }
  162. return { verify, text, ids };
  163. },
  164. handleClose() {
  165. this.visible = false;
  166. this.current = null;
  167. },
  168. async selected() {
  169. if (this.selection.length == 0) {
  170. return this.$message.warning('请至少选择一条数据');
  171. }
  172. let data = await this.addGenerateContract();
  173. if (data) {
  174. data.contractVO.contractName=data.contractVO.partbName
  175. this.$emit('changeParent', {data,sourceCode:this.selection.map(item=>item.inquiryCode).toString()});
  176. this.handleClose();
  177. }
  178. }
  179. }
  180. };
  181. </script>
  182. <style lang="scss" scoped>
  183. .tree_col {
  184. border: 1px solid #eee;
  185. padding: 10px 0;
  186. box-sizing: border-box;
  187. height: 500px;
  188. overflow: auto;
  189. }
  190. .table_col {
  191. padding-left: 10px;
  192. ::v-deep .el-table th.el-table__cell {
  193. background: #f2f2f2;
  194. }
  195. }
  196. .pagination {
  197. text-align: right;
  198. padding: 10px 0;
  199. }
  200. .btns {
  201. text-align: center;
  202. padding: 10px 0;
  203. }
  204. .topsearch {
  205. margin-bottom: 15px;
  206. }
  207. </style>