SelecSaleInquiryModal.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <!-- //复制子表功能 -->
  2. <template>
  3. <a-modal
  4. title="选择销售询价单(select sale inquiry)"
  5. width="95%"
  6. :visible="visible"
  7. :maskClosable="false"
  8. switchFullscreen
  9. @ok = "handleOk"
  10. @cancel="handleCancel">
  11. <div>
  12. <!-- <a-card :body-style="{ padding: '10px' }" :bordered="false" style="margin: 10px;">
  13. <div class="table-page-search-wrapper">
  14. <a-form :model="queryParams" :label-col="labelCol" :wrapper-col="wrapperCol" @keyup.enter.native="searchQuery">
  15. </a-form>
  16. </div>
  17. </a-card> -->
  18. <a-card >
  19. <a-alert type="info" show-icon class="alert" style="margin-bottom: 8px">
  20. <template #message>
  21. <template v-if="selectedRowKeys.length > 0">
  22. <span>已选中 {{ selectedRowKeys.length }} 条记录</span>
  23. <a-divider type="vertical" />
  24. <a @click="selectedRowKeys = []">清空</a>
  25. </template>
  26. <template v-else>
  27. <span>未选中任何数据</span>
  28. </template>
  29. </template>
  30. </a-alert>
  31. <a-table
  32. :columns="columns"
  33. :row-key="record => record.id"
  34. :data-source="dataSource"
  35. bordered
  36. size="small"
  37. @change="handleTableChange"
  38. :pagination="false"
  39. :scroll="{ x: 3500, y: 400 }"
  40. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  41. >
  42. </a-table>
  43. </a-card>
  44. </div>
  45. </a-modal>
  46. </template>
  47. <script lang="ts" setup>
  48. import {ref, reactive } from 'vue';
  49. import { defHttp } from '/@/utils/http/axios';
  50. import { message } from 'ant-design-vue';
  51. import { filterObj, getFileAccessHttpUrl } from '/@/utils/common/compUtils';
  52. const emit = defineEmits([ 'copyProduct']); //定义emit
  53. var visible = ref(false)
  54. const columns = [
  55. {
  56. title: '产品英文名(english name)',
  57. dataIndex: 'englishName',
  58. key: 'englishName',
  59. align:"center",
  60. ellipsis:true
  61. },
  62. {
  63. title: '备件号(partno)',
  64. dataIndex: 'partno',
  65. key: 'productClass',
  66. align:"center"
  67. },
  68. {
  69. title: '产品中文名(chinese name)',
  70. key: 'chineseName',
  71. dataIndex: 'chineseName',
  72. align:"center"
  73. },
  74. {
  75. title: '产品编码(product code)',
  76. dataIndex: 'productCode',
  77. key: 'productCode',
  78. align:"center",
  79. },
  80. {
  81. title: '订货号(orderno)',
  82. key: 'orderno',
  83. dataIndex: 'orderno',
  84. align:"center"
  85. },
  86. {
  87. title: '图号(drawingno',
  88. key: 'drawingno',
  89. dataIndex: 'drawingno',
  90. align:"center",
  91. width:250
  92. },
  93. {
  94. title: '质量等级(quality grade)',
  95. key: 'qualityGrade',
  96. dataIndex: 'qualityGrade',
  97. align:"center",
  98. },
  99. {
  100. title: '数量(quantity)',
  101. key: 'quantity',
  102. dataIndex: 'quantity',
  103. align:"center",
  104. },
  105. {
  106. title: '单位(unit)',
  107. key: 'unit',
  108. dataIndex: 'unit',
  109. align:"center",
  110. },
  111. {
  112. title: '需要船检证书(need Ship inspection c',
  113. key: 'needShip',
  114. dataIndex: 'needShip',
  115. align:"center",
  116. },
  117. {
  118. title: '船检证书(ship Inspection certificate)',
  119. key: 'shipInspection',
  120. dataIndex: 'shipInspection',
  121. align:"center",
  122. },
  123. {
  124. title: '备注(note)',
  125. key: 'note',
  126. dataIndex: 'note',
  127. align:"center",
  128. },
  129. {
  130. title: '型号(model)',
  131. key: 'model',
  132. dataIndex: 'model',
  133. align:"center",
  134. },
  135. ];
  136. const labelCol = ref({
  137. xs: { span: 24 },
  138. sm: { span: 9 },
  139. });
  140. const wrapperCol = ref({
  141. xs: { span: 24 },
  142. sm: { span: 15 },
  143. });
  144. const dataSource =ref([]);
  145. let selectedRowKeys = ref([]);
  146. let selectedRows = ref([]);
  147. const toggleSearchStatus = ref(false);
  148. var mainId = ref('')
  149. const queryParams = ref({
  150. productionClass:'',
  151. productClass:'',
  152. englishName:'',
  153. productCode:'',
  154. chineseName:'',
  155. id:'',
  156. pageSize:''
  157. });
  158. function loadData(){
  159. let params = getQueryParams();
  160. defHttp
  161. .get({ url: '/saleCode/saleInquiryForm/querySaleInquiryFormProductByMainId',params}, { isTransformResponse: false })
  162. .then((res) => {
  163. if (res.success) {
  164. dataSource.value = res.result
  165. } else {
  166. message.error(res.message);
  167. }
  168. })
  169. .finally(() => {
  170. // loading.value = false;
  171. });
  172. }
  173. function getQueryParams(){
  174. let params = Object.assign(queryParams.value);
  175. params.id = mainId.value
  176. params.pageSize = '-1'
  177. return filterObj(params);
  178. }
  179. function handleTableChange(paginations, filters, sorter){
  180. loadData()
  181. };
  182. function searchQuery(){
  183. loadData();
  184. }
  185. function searchReset(){
  186. queryParams.value = {
  187. productionClass:'',
  188. productClass:'',
  189. englishName:'',
  190. productCode:'',
  191. chineseName:'',
  192. id:'',
  193. pageSize:''
  194. }
  195. loadData();
  196. }
  197. function handleToggleSearch(){
  198. toggleSearchStatus.value = !toggleSearchStatus.value;
  199. }
  200. function onSelectChange(keys,rows){
  201. selectedRowKeys.value = keys
  202. selectedRows.value = rows
  203. }
  204. function handleOk(){
  205. if(selectedRowKeys.value.length==0){
  206. message.error('请选择数据')
  207. }else{
  208. emit('copyProduct',selectedRows.value,mainId)
  209. handleCancel()
  210. }
  211. }
  212. function handleCancel(){
  213. visible.value = false
  214. selectedRowKeys.value = []
  215. selectedRows.value=[]
  216. }
  217. function getTable(record){
  218. mainId.value = record.id
  219. visible.value = true
  220. loadData()
  221. }
  222. defineExpose({
  223. getTable
  224. });
  225. </script>
  226. <style scoped lang="less">
  227. // /deep/.ant-form-item{
  228. // margin-bottom: 8px !important;
  229. // }
  230. // /deep/.ant-table-wrapper .ant-table-thead > tr > th, .ant-table-wrapper .ant-table-thead > tr > td{
  231. // padding: 8px !important;
  232. // }
  233. </style>