ArriveGoodsList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. <template>
  2. <div class="p-2">
  3. <!--查询区域-->
  4. <div class="jeecg-basic-table-form-container">
  5. <a-form ref="formRef" @keyup.enter.native="reload" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
  6. <a-row :gutter="24">
  7. <a-col :lg="8">
  8. <a-form-item name="billCode">
  9. <template #label><span title="到货单号(bill code)">到货单号(bill code)</span></template>
  10. <JInput placeholder="请输入到货单号(bill code)" v-model:value="queryParam.billCode" allow-clear AutoComplete="off" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :lg="8">
  14. <a-form-item name="arrivalDate">
  15. <template #label><span title="到货日期(arrival date)">到货日期(arrival date)</span></template>
  16. <a-range-picker value-format="YYYY-MM-DD" v-model:value="queryParam.arrivalDate" class="query-group-cust" />
  17. </a-form-item>
  18. </a-col>
  19. <template v-if="toggleSearchStatus">
  20. <a-col :lg="8">
  21. <a-form-item name="project" :label-col="labelCol1" :wrapper-col="wrapperCol1">
  22. <template #label><span title="项目(project)">项目(project)</span></template>
  23. <ApiSelect
  24. :api="ProjectOption"
  25. showSearch
  26. v-model:value="queryParam.project"
  27. :filterOption="true"
  28. resultField="records"
  29. labelField="code"
  30. valueField="id"
  31. :params="{ pageSize: -1 }"
  32. optionFilterProp="label"
  33. />
  34. </a-form-item>
  35. </a-col>
  36. <a-col :lg="8">
  37. <a-form-item name="supplier">
  38. <template #label><span title="供应商(supplier)">供应商(supplierName)</span></template>
  39. <ApiSelect
  40. :api="supplierOption"
  41. showSearch
  42. v-model:value="queryParam.supplier"
  43. :filterOption="true"
  44. resultField="records"
  45. labelField="name"
  46. valueField="id"
  47. :params="{ pageSize: -1 }"
  48. optionFilterProp="label"
  49. />
  50. </a-form-item>
  51. </a-col>
  52. <a-col :lg="8">
  53. <a-form-item name="priority">
  54. <template #label><span title="优先级(priority)">优先级(priority)</span></template>
  55. <JDictSelectTag v-model:value="queryParam.priority" placeholder="请选择" dictCode="priority" />
  56. </a-form-item>
  57. </a-col>
  58. <a-col :lg="8">
  59. <a-form-item name="productionClass" :label-col="labelCol1" :wrapper-col="wrapperCol1">
  60. <template #label><span title="产品分类(production class)">产品分类(production class)</span></template>
  61. <ApiSelect
  62. :api="ClassList"
  63. showSearch
  64. v-model:value="queryParam.productionClass"
  65. :filterOption="true"
  66. resultField="records"
  67. labelField="name"
  68. valueField="id"
  69. :params="{ pageSize: -1 }"
  70. optionFilterProp="label"
  71. />
  72. </a-form-item>
  73. </a-col>
  74. <a-col :lg="8">
  75. <a-form-item name="model">
  76. <template #label><span title="机型(model)">机型(model)</span></template>
  77. <JDictSelectTag v-model:value="queryParam.model" placeholder="请选择" dictCode="model_typer" />
  78. </a-form-item>
  79. </a-col>
  80. <a-col :lg="8">
  81. <a-form-item name="maker">
  82. <template #label><span title="厂家(maker)">厂家(maker)</span></template>
  83. <JDictSelectTag v-model:value="queryParam.maker" placeholder="请选择" dictCode="factory" />
  84. </a-form-item>
  85. </a-col>
  86. <!-- <a-col :lg="8">
  87. <a-form-item name="productCode">
  88. <template #label><span title="产品编号(product code)">产品编号(product code)</span></template>
  89. <JInput placeholder="请输入产品编号(product code)" v-model:value="queryParam.productCode" allow-clear ></JInput>
  90. </a-form-item>
  91. </a-col> -->
  92. <a-col :lg="8">
  93. <a-form-item name="purchaseDepartment" :label-col="labelCol1" :wrapper-col="wrapperCol1">
  94. <template #label><span title="采购部门(purchase department)">采购部门(purchase department)</span></template>
  95. <JInput
  96. placeholder="请输入采购部门(purchase department)"
  97. v-model:value="queryParam.purchaseDepartment"
  98. allow-clear
  99. AutoComplete="off"
  100. />
  101. </a-form-item>
  102. </a-col>
  103. <a-col :lg="8">
  104. <a-form-item name="purchaseman">
  105. <template #label><span title="采购员(purchaseman)">采购员(purchaseman)</span></template>
  106. <JInput placeholder="请输入采购员(purchaseman)" v-model:value="queryParam.purchaseman" allow-clear AutoComplete="off" />
  107. </a-form-item>
  108. </a-col>
  109. <a-col :lg="8">
  110. <a-form-item name="submit">
  111. <template #label><span title="提交(submit)">提交(submit)</span></template>
  112. <JDictSelectTag v-model:value="queryParam.submit" placeholder="请选择" dictCode="yes_or_no" />
  113. </a-form-item>
  114. </a-col>
  115. <a-col :lg="8">
  116. <a-form-item name="close" :label-col="labelCol1" :wrapper-col="wrapperCol1">
  117. <template #label><span title="关闭(close)">关闭(close)</span></template>
  118. <JDictSelectTag v-model:value="queryParam.close" placeholder="请选择" dictCode="yes_or_no" />
  119. </a-form-item>
  120. </a-col>
  121. </template>
  122. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  123. <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
  124. <a-col :lg="6">
  125. <a-button type="primary" preIcon="ant-design:search-outlined" @click="reload">查询</a-button>
  126. <a-button preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
  127. <a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">
  128. {{ toggleSearchStatus ? '收起' : '展开' }}
  129. <Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" />
  130. </a>
  131. </a-col>
  132. </span>
  133. </a-col>
  134. </a-row>
  135. </a-form>
  136. </div>
  137. <!--引用表格-->
  138. <BasicTable @register="registerTable" :rowSelection="rowSelection" size="small">
  139. <!--插槽:table标题-->
  140. <template #tableTitle>
  141. <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined" v-auth="'purCode:pur_delivery_note:add'"> 新增(add)</a-button>
  142. <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls" v-auth="'purCode:pur_delivery_note:exportXls'">
  143. 导出(export)</a-button
  144. >
  145. <a-button type="primary" @click="submit"> 提交(submit)</a-button>
  146. <a-button type="primary" @click="cancelSubmit"> 取消提交(cancelSubmit)</a-button>
  147. <a-button type="primary" @click="close"> 关闭(close)</a-button>
  148. <a-button type="primary" @click="cancelClose"> 取消关闭(cancel close)</a-button>
  149. <a-dropdown v-if="selectedRowKeys.length > 0">
  150. <template #overlay>
  151. <a-menu>
  152. <a-menu-item key="1" @click="batchHandleDelete" v-auth="'purCode:pur_delivery_note:deleteBatch'">
  153. <Icon icon="ant-design:delete-outlined" />
  154. 删除(delete)
  155. </a-menu-item>
  156. </a-menu>
  157. </template>
  158. <a-button
  159. >批量操作
  160. <Icon icon="mdi:chevron-down" />
  161. </a-button>
  162. </a-dropdown>
  163. </template>
  164. <!--操作栏-->
  165. <template #action="{ record }">
  166. <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
  167. </template>
  168. <!--字段回显插槽-->
  169. <template #bodyCell="{ column, record, index, text }"> </template>
  170. </BasicTable>
  171. <!-- 表单区域 -->
  172. <ArriveGoodsFormModal @register="registerModal" @success="handleSuccess" />
  173. </div>
  174. </template>
  175. <script lang="ts" name="purchase-purchaseInquiryForm" setup>
  176. import { ref, reactive, computed, unref, onMounted } from 'vue';
  177. import { BasicTable, useTable, TableAction } from '/@/components/Table';
  178. import { useListPage } from '/@/hooks/system/useListPage';
  179. import { useModal } from '/@/components/Modal';
  180. import ArriveGoodsFormModal from './components/ArriveGoodsFormModal.vue';
  181. import { columns } from './ArriveGoodsForm.data';
  182. import {
  183. list,
  184. deleteOne,
  185. batchDelete,
  186. getImportUrl,
  187. bacthClose,
  188. cancelBatchClose,
  189. getExportUrl,
  190. batchSubmit,
  191. cancelBatchSubmit,
  192. ProjectOption,
  193. supplierOption,
  194. ClassList,
  195. } from './ArriveGoodsForm.api';
  196. import { cloneDeep } from 'lodash-es';
  197. import { defHttp } from '/@/utils/http/axios';
  198. import { JDictSelectTag, ApiSelect, JInput } from '/@/components/Form';
  199. import { message } from 'ant-design-vue';
  200. const formRef = ref();
  201. const queryParam = reactive<any>({});
  202. //注册model
  203. const [registerModal, { openModal }] = useModal();
  204. //注册table数据
  205. const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
  206. tableProps: {
  207. title: '到货单',
  208. api: list,
  209. columns,
  210. canResize: false,
  211. useSearchForm: false,
  212. actionColumn: {
  213. width: 300,
  214. fixed: 'right',
  215. },
  216. scroll: {
  217. x: '3000px',
  218. },
  219. beforeFetch: async (params) => {
  220. let rangerQuery = await setRangeQuery();
  221. return Object.assign(params, rangerQuery);
  222. },
  223. },
  224. exportConfig: {
  225. name: '到货单',
  226. url: getExportUrl,
  227. params: queryParam,
  228. },
  229. importConfig: {
  230. url: getImportUrl,
  231. success: handleSuccess,
  232. },
  233. });
  234. const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
  235. /**
  236. * 高级查询事件
  237. */
  238. function handleSuperQuery(params) {
  239. Object.keys(params).map((k) => {
  240. queryParam[k] = params[k];
  241. });
  242. reload();
  243. }
  244. /**
  245. * 新增事件
  246. */
  247. function handleAdd() {
  248. openModal(true, {
  249. isUpdate: false,
  250. showFooter: true,
  251. });
  252. }
  253. /**
  254. * 编辑事件
  255. */
  256. function handleEdit(record: Recordable) {
  257. openModal(true, {
  258. record,
  259. isUpdate: true,
  260. showFooter: true,
  261. });
  262. }
  263. /**
  264. * 详情
  265. */
  266. function handleDetail(record: Recordable) {
  267. openModal(true, {
  268. record,
  269. isUpdate: true,
  270. showFooter: false,
  271. });
  272. }
  273. /**
  274. * 删除事件
  275. */
  276. async function handleDelete(record) {
  277. await deleteOne({ id: record.id }, handleSuccess);
  278. }
  279. /**
  280. * 批量删除事件
  281. */
  282. async function batchHandleDelete() {
  283. await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
  284. }
  285. /**
  286. * 成功回调
  287. */
  288. function handleSuccess() {
  289. (selectedRowKeys.value = []) && reload();
  290. }
  291. /**
  292. * 操作栏
  293. */
  294. function getTableAction(record) {
  295. return [
  296. {
  297. label: '编辑(edit)',
  298. onClick: handleEdit.bind(null, record),
  299. auth: 'purCode:pur_inquiry_form:edit',
  300. ifShow: record.submit == '0' || record.submit == '',
  301. },
  302. {
  303. label: '详情(detail)',
  304. onClick: handleDetail.bind(null, record),
  305. ifShow: record.submit == '1',
  306. },
  307. ];
  308. }
  309. /**
  310. * 下拉操作栏
  311. */
  312. function getDropDownAction(record) {
  313. return [
  314. {
  315. label: '详情(detail)',
  316. onClick: handleDetail.bind(null, record),
  317. ifShow: record.submit == '0' || record.submit == '',
  318. },
  319. {
  320. label: '删除(delete)',
  321. popConfirm: {
  322. title: '是否确认删除',
  323. confirm: handleDelete.bind(null, record),
  324. placement: 'topLeft',
  325. },
  326. auth: 'purCode:pur_delivery_note:delete',
  327. ifShow: record.submit == '0' || record.submit == '',
  328. },
  329. ];
  330. }
  331. function submit() {
  332. if (selectedRowKeys.value.length == 0) {
  333. message.warning('请选择数据');
  334. } else {
  335. var ids = selectedRowKeys.value.join(',');
  336. batchSubmit({ ids: ids }, handleSuccess);
  337. }
  338. }
  339. function cancelSubmit() {
  340. if (selectedRowKeys.value.length == 0) {
  341. message.warning('请选择数据');
  342. } else {
  343. var ids = selectedRowKeys.value.join(',');
  344. cancelBatchSubmit({ ids: ids }, handleSuccess);
  345. }
  346. }
  347. function close() {
  348. if (selectedRowKeys.value.length == 0) {
  349. message.warning('请选择数据');
  350. } else {
  351. var ids = selectedRowKeys.value.join(',');
  352. bacthClose({ ids: ids }, handleSuccess);
  353. }
  354. }
  355. function cancelClose() {
  356. if (selectedRowKeys.value.length == 0) {
  357. message.warning('请选择数据');
  358. } else {
  359. var ids = selectedRowKeys.value.join(',');
  360. cancelBatchClose({ ids: ids }, handleSuccess);
  361. }
  362. }
  363. /* ----------------------以下为原生查询需要添加的-------------------------- */
  364. const toggleSearchStatus = ref<boolean>(false);
  365. const labelCol = reactive({
  366. xs: 24,
  367. sm: 8,
  368. });
  369. const wrapperCol = reactive({
  370. xs: 24,
  371. sm: 16,
  372. });
  373. const labelCol1 = reactive({
  374. xs: 24,
  375. sm: 10,
  376. });
  377. const wrapperCol1 = reactive({
  378. xs: 24,
  379. sm: 14,
  380. });
  381. /**
  382. * 重置
  383. */
  384. function searchReset() {
  385. formRef.value.resetFields();
  386. selectedRowKeys.value = [];
  387. //刷新数据
  388. reload();
  389. }
  390. let rangeField = 'arrivalDate,';
  391. /**
  392. * 设置范围查询条件
  393. */
  394. async function setRangeQuery() {
  395. let queryParamClone = cloneDeep(queryParam);
  396. if (rangeField) {
  397. let fieldsValue = rangeField.split(',');
  398. fieldsValue.forEach((item) => {
  399. if (queryParamClone[item]) {
  400. let range = queryParamClone[item];
  401. queryParamClone[item + '_begin'] = range[0];
  402. queryParamClone[item + '_end'] = range[1];
  403. delete queryParamClone[item];
  404. } else {
  405. queryParamClone[item + '_begin'] = '';
  406. queryParamClone[item + '_end'] = '';
  407. }
  408. });
  409. }
  410. return queryParamClone;
  411. }
  412. </script>
  413. <style lang="less" scoped>
  414. .jeecg-basic-table-form-container {
  415. padding: 0;
  416. .table-page-search-submitButtons {
  417. display: block;
  418. margin-bottom: 8px;
  419. white-space: nowrap;
  420. }
  421. .query-group-cust {
  422. min-width: 100px !important;
  423. }
  424. .query-group-split-cust {
  425. width: 30px;
  426. display: inline-block;
  427. text-align: center;
  428. }
  429. .ant-form-item:not(.ant-form-item-with-help) {
  430. margin-bottom: 8px;
  431. height: 32px;
  432. }
  433. :deep(.ant-picker),
  434. :deep(.ant-input-number) {
  435. width: 100%;
  436. }
  437. }
  438. </style>