selectArrivalList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. <template>
  2. <a-modal
  3. title="选择到货单(Select arrival Order)"
  4. width="95%"
  5. :visible="visible"
  6. :maskClosable="false"
  7. switchFullscreen
  8. @ok = "handleOk"
  9. @cancel="handleCancel">
  10. <div>
  11. <a-card :body-style="{ padding: '10px' }" :bordered="false" style="margin: 10px;">
  12. <div class="table-page-search-wrapper">
  13. <a-form :model="queryParams" :label-col="labelCol" :wrapper-col="wrapperCol" @keyup.enter.native="searchQuery">
  14. <a-row :gutter="24">
  15. <a-col :md="6" :sm="8">
  16. <a-form-item label="到货单号(bill code)">
  17. <j-input placeholder="请输入" v-model:value="queryParams.billCode"></j-input>
  18. </a-form-item>
  19. </a-col>
  20. <a-col :md="6" :sm="8">
  21. <a-form-item label="到货日期(arrival date)">
  22. <a-range-picker value-format="YYYY-MM-DD" v-model:value="arrivalDate" @change="changeBillDate" class="query-group-cust"/>
  23. </a-form-item>
  24. </a-col>
  25. <template v-if="toggleSearchStatus">
  26. <a-col :md="6" :sm="8">
  27. <a-form-item label="项目(project)">
  28. <ApiSelect
  29. :api="ProjectOption"
  30. showSearch
  31. v-model:value="queryParams.project"
  32. optionFilterProp="label"
  33. resultField="records"
  34. labelField="name"
  35. valueField="id"
  36. :params='{pageSize:-1}'
  37. :disabled="fatherProject!==''"
  38. />
  39. </a-form-item>
  40. </a-col>
  41. <a-col :md="6" :sm="8">
  42. <a-form-item label="产品分类(production class)" :label-col="labelCol1" :wrapper-col="wrapperCol1">
  43. <ApiSelect
  44. :api="ClassList"
  45. showSearch
  46. v-model:value="queryParams.productionClass"
  47. optionFilterProp="label"
  48. resultField="records"
  49. labelField="name"
  50. valueField="id"
  51. :params='{pageSize:-1}'
  52. />
  53. </a-form-item>
  54. </a-col>
  55. <a-col :md="6" :sm="8">
  56. <a-form-item label="供应商(supplier)">
  57. <ApiSelect
  58. :api="supplierOption"
  59. showSearch
  60. v-model:value="queryParams.supplier"
  61. optionFilterProp="label"
  62. resultField="records"
  63. labelField="name"
  64. valueField="id"
  65. :params='{pageSize:-1}'
  66. />
  67. </a-form-item>
  68. </a-col>
  69. <a-col :md="6" :sm="8">
  70. <a-form-item label="优先级(priority)" >
  71. <JDictSelectTag v-model:value="queryParams.priority" placeholder="请选择" dictCode="priority" style="width: 100%;"/>
  72. </a-form-item>
  73. </a-col>
  74. <a-col :md="6" :sm="8">
  75. <a-form-item label="机型(model)">
  76. <JDictSelectTag v-model:value="queryParams.model" placeholder="请选择" dictCode="model_typer"/>
  77. </a-form-item>
  78. </a-col>
  79. <a-col :md="6" :sm="8">
  80. <a-form-item label="产品编码(product code)" :label-col="labelCol1" :wrapper-col="wrapperCol1">
  81. <j-input placeholder="请输入" v-model:value="queryParams.productCode"></j-input>
  82. </a-form-item>
  83. </a-col>
  84. </template>
  85. <a-col :md="6" :sm="8">
  86. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  87. <a-button type="primary" @click="searchQuery" >查询(search)</a-button>
  88. <a-button type="primary" @click="searchReset" style="margin-left: 8px">重置(reset)</a-button>
  89. <a @click="handleToggleSearch" style="margin-left: 8px">
  90. {{ toggleSearchStatus ? '收起' : '展开' }}
  91. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  92. </a>
  93. </span>
  94. </a-col>
  95. </a-row>
  96. </a-form>
  97. </div>
  98. </a-card>
  99. <a-card :body-style="{ padding: '10px' }" :bordered="false" style="margin: 10px;">
  100. <a-alert type="info" show-icon class="alert" style="margin-bottom: 8px">
  101. <template #message>
  102. <template v-if="selectedRowKeys.length > 0">
  103. <span>已选中 {{ selectedRowKeys.length }} 条记录</span>
  104. <a-divider type="vertical" />
  105. <a @click="selectedRowKeys = []">清空</a>
  106. </template>
  107. <template v-else>
  108. <span>未选中任何数据</span>
  109. </template>
  110. </template>
  111. </a-alert>
  112. <a-table
  113. :columns="columns"
  114. :row-key="record => record.childId"
  115. :data-source="dataSource"
  116. bordered
  117. size="small"
  118. @change="handleTableChange"
  119. :pagination="pagination"
  120. :scroll="{ x: 3200, y: 300 }"
  121. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  122. >
  123. </a-table>
  124. </a-card>
  125. </div>
  126. </a-modal>
  127. </template>
  128. <script lang="ts" setup>
  129. import {ref, reactive } from 'vue';
  130. import { defHttp} from '/@/utils/http/axios';
  131. import { message } from 'ant-design-vue';
  132. import { filterObj} from '/@/utils/common/compUtils';
  133. import { JDictSelectTag,ApiSelect,JInput} from '/@/components/Form';
  134. const emit = defineEmits([ 'selectArrrivalOrder']); //定义emit
  135. import {supplierOption,ProjectOption,ClassList} from '../inventiry/purchaseIn/purchaseInForm.api';
  136. var visible = ref(false)
  137. var fatherProject = ref('')
  138. var fatherSourceCode = ref('')
  139. const columns = [
  140. {
  141. type: 'selection',
  142. fixed: 'left',
  143. width:0
  144. },
  145. {
  146. title: '到货单号(bill code)',
  147. dataIndex: 'billCode',
  148. key: 'billCode',
  149. align:"center",
  150. width:250,
  151. },
  152. {
  153. title: '到货日期(arrival date)',
  154. dataIndex: 'arrivalDate',
  155. key: 'arrivalDate',
  156. align:"center"
  157. },
  158. {
  159. title: '项目(project)',
  160. dataIndex: 'projectName',
  161. key: 'projectName',
  162. align:"center",
  163. width:250,
  164. },
  165. {
  166. title: '供应商(supplier)',
  167. dataIndex: 'supplierName',
  168. key: 'supplierName',
  169. align:"center"
  170. },
  171. {
  172. title: '优先级(priority)',
  173. dataIndex: 'priority_dictText',
  174. key: 'priority_dictText',
  175. align:"center"
  176. },
  177. {
  178. title: '产品分类(production class)',
  179. dataIndex: 'productionClass_dictText',
  180. key: 'productionClass_dictText',
  181. align:"center",
  182. width:250,
  183. },
  184. {
  185. title: '机型(model)',
  186. dataIndex: 'model',
  187. key: 'model',
  188. align:"center"
  189. },
  190. {
  191. title: '采购部门(puechase department)',
  192. dataIndex: 'purchaseDepartment',
  193. key: 'purchaseDepartment',
  194. align:"center"
  195. },
  196. {
  197. title: '采购员(puechaseman)',
  198. dataIndex: 'purchaseman',
  199. key: 'purchaseman',
  200. align:"center"
  201. },
  202. {
  203. title: '产品英文名(English name)',
  204. key: 'englishName',
  205. dataIndex: 'englishName',
  206. align:"center",
  207. width:250,
  208. },
  209. {
  210. title: '型号(childModel)',
  211. key: 'childModel',
  212. dataIndex: 'childModel',
  213. align:"center"
  214. },
  215. {
  216. title: '厂家(factory)',
  217. key: 'factory',
  218. dataIndex: 'factory',
  219. align:"center",
  220. width:250
  221. },
  222. {
  223. title: '质量等级(quantity grade)',
  224. key: 'qualityGrade',
  225. dataIndex: 'qualityGrade',
  226. align:"center",
  227. width:250,
  228. },
  229. ];
  230. const labelCol = ref({
  231. xs: { span: 24 },
  232. sm: { span: 9 },
  233. });
  234. const wrapperCol = ref({
  235. xs: { span: 24 },
  236. sm: { span: 15 },
  237. });
  238. const labelCol1 = ref({
  239. xs: { span: 24 },
  240. sm: { span: 10 },
  241. });
  242. const wrapperCol1 = ref({
  243. xs: { span: 24 },
  244. sm: { span: 14 },
  245. });
  246. const dataSource =ref([]);
  247. let selectedRowKeys = ref([]);
  248. let selectedRows = ref([]);
  249. const toggleSearchStatus = ref(false);
  250. var arrivalDate = ref([])
  251. const queryParams = ref({
  252. billCode:'',
  253. project:'',
  254. projectName:'',
  255. productionClass:'',
  256. priority:'',
  257. supplier:'',
  258. supplierName:'',
  259. model:'',
  260. productCode:'',
  261. arrivalDate_begin:'',
  262. arrivalDate_end:'',
  263. });
  264. let pagination = ref({
  265. current: 1,
  266. pageSize: 10,
  267. total: '', // 假设总共有100条数据
  268. showSizeChanger: true,
  269. showQuickJumper: true,
  270. showTotal: (total, range) => {
  271. return range[0] + "-" + range[1] + " 共" + total + "条"
  272. },
  273. size:'small'
  274. });
  275. function loadData(){
  276. let params = getQueryParams();
  277. defHttp.get({ url: '/purCode/purDeliveryNote/purDeliveryNoteArrivalAlert',params}, { isTransformResponse: false })
  278. .then((res) => {
  279. if (res.success) {
  280. dataSource.value = res.result.records;
  281. pagination.value.total = res.result.total;
  282. pagination.value.current = res.result.current;
  283. pagination.value.pageSize = res.result.size;
  284. } else {
  285. message.error(res.message);
  286. }
  287. })
  288. .finally(() => {
  289. // loading.value = false;
  290. });
  291. }
  292. function getQueryParams(){
  293. let params = Object.assign(queryParams.value);
  294. params.pageNo = pagination.value.current;
  295. params.pageSize = pagination.value.pageSize;
  296. if(fatherProject.value&&fatherProject.value!==''){
  297. queryParams.value.project = fatherProject.value
  298. }else {
  299. queryParams.value.project = params.project
  300. }
  301. return filterObj(params);
  302. }
  303. function handleTableChange(paginations, filters, sorter){
  304. pagination.value.total = paginations.total;
  305. pagination.value.current = paginations.current;
  306. pagination.value.pageSize = paginations.pageSize;
  307. loadData()
  308. };
  309. function searchQuery(){
  310. pagination.value.current =1;
  311. loadData();
  312. }
  313. function searchReset(){
  314. arrivalDate.value = []
  315. queryParams.value = {
  316. billCode:'',
  317. project:'',
  318. projectName:'',
  319. productionClass:'',
  320. priority:'',
  321. supplier:'',
  322. supplierName:'',
  323. model:'',
  324. productCode:'',
  325. arrivalDate_begin:'',
  326. arrivalDate_end:'',
  327. }
  328. pagination.value.current =1;
  329. pagination.value.pageSize = 10;
  330. loadData();
  331. }
  332. function handleToggleSearch(){
  333. toggleSearchStatus.value = !toggleSearchStatus.value;
  334. }
  335. function onSelectChange(keys,rows){
  336. selectedRowKeys.value = keys
  337. selectedRows.value = rows
  338. }
  339. function handleOk(){
  340. var arr = []
  341. selectedRows.value.map(item=>arr.push(item.billCode))
  342. if(fatherSourceCode.value&&fatherSourceCode.value!==''){
  343. arr.push(fatherSourceCode.value)
  344. }
  345. if(selectedRowKeys.value.length==0){
  346. message.error('请勾选数据');
  347. }else if(new Set(arr).size!==1){
  348. message.error('请勾选到货单号相同的数据');
  349. }else{
  350. emit('selectArrrivalOrder', selectedRows.value)
  351. handleCancel()
  352. }
  353. }
  354. function handleCancel(){
  355. visible.value = false
  356. selectedRowKeys.value = []
  357. selectedRows.value=[]
  358. queryParams.value = {
  359. billCode:'',
  360. project:'',
  361. projectName:'',
  362. productionClass:'',
  363. priority:'',
  364. supplier:'',
  365. supplierName:'',
  366. model:'',
  367. productCode:'',
  368. arrivalDate_begin:'',
  369. arrivalDate_end:'',
  370. }
  371. pagination.value.current =1;
  372. pagination.value.pageSize = 10;
  373. }
  374. function getTable(formData){
  375. visible.value = true
  376. if(formData.projectName&&formData.projectName!==''){
  377. fatherProject.value = formData.project
  378. }else{
  379. fatherProject.value = ''
  380. }
  381. if(formData.sourceCode&&formData.sourceCode!==''){
  382. fatherSourceCode.value = formData.sourceCode
  383. }else{
  384. fatherSourceCode.value = ''
  385. }
  386. loadData()
  387. }
  388. function changeBillDate(prop){
  389. if(prop){
  390. arrivalDate.value = prop
  391. queryParams.value.arrivalDate_begin = prop[0]
  392. queryParams.value.arrivalDate_end = prop[1]
  393. }else{
  394. arrivalDate.value = []
  395. queryParams.value.arrivalDate_begin = ''
  396. queryParams.value.arrivalDate_end = ''
  397. }
  398. }
  399. defineExpose({
  400. getTable
  401. });
  402. </script>
  403. <style scoped lang="less">
  404. /deep/.ant-form-item{
  405. margin-bottom: 8px !important;
  406. }
  407. // /deep/.ant-table-wrapper .ant-table-thead > tr > th, .ant-table-wrapper .ant-table-thead > tr > td{
  408. // padding: 8px !important;
  409. // }
  410. </style>