FreightPurchaseOrderList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  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="{ style: 'width: 200px' }">
  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="billDate">
  15. <template #label><span title="申请日期(bill date)">申请日期(bill date)</span></template>
  16. <a-range-picker value-format="YYYY-MM-DD" v-model:value="queryParam.billDate" 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="currency">
  22. <template #label><span title="币种(currency)">币种(currency)</span></template>
  23. <JDictSelectTag v-model:value="queryParam.currency" placeholder="请选择" dictCode="currency" />
  24. </a-form-item>
  25. </a-col>
  26. <a-col :lg="16">
  27. <a-form-item name="supplierName">
  28. <template #label><span title="供应商(supplierName)">供应商(supplierName)</span></template>
  29. <JSelect v-model:value="queryParam.supplier" :get-option-url="Supplierlist" :showField="showField" :param="{status:1}"></JSelect>
  30. </a-form-item>
  31. </a-col>
  32. </template>
  33. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  34. <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
  35. <a-col :lg="6">
  36. <a-button type="primary" preIcon="ant-design:search-outlined" @click="reload">查询</a-button>
  37. <a-button preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
  38. <a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">
  39. {{ toggleSearchStatus ? '收起' : '展开' }}
  40. <Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" />
  41. </a>
  42. </a-col>
  43. </span>
  44. </a-col>
  45. </a-row>
  46. </a-form>
  47. </div>
  48. <!--引用表格-->
  49. <BasicTable @register="registerTable" :rowSelection="rowSelection" size="small">
  50. <!--插槽:table标题-->
  51. <template #tableTitle>
  52. <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined" v-auth="'purCode:pur_shipping_fee:add'"> 新增(add)</a-button>
  53. <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls" v-auth="'purCode:pur_shipping_fee:exportXls'">
  54. 导出(export)</a-button
  55. >
  56. <a-button type="primary" v-auth="'purCode:pur_shipping_fee:submit'" @click="submit"> 提交(submit)</a-button>
  57. <a-button type="primary" v-auth="'purCode:pur_shipping_fee:cancelSubmit'" @click="cancelSubmit"> 取消提交(cancelSubmit)</a-button>
  58. <!-- <a-button type="primary" @click="close" v-auth="'purCode:pur_shipping_fee:close'"> 关闭(close)</a-button> -->
  59. <!-- <a-button type="primary" @click="cancelClose"> 取消关闭(cancel close)</a-button> -->
  60. <!-- <a-button type="primary" v-auth="'purCode:pur_shipping_fee:add'" @click="confirm"> 确认(confirm)</a-button> -->
  61. <!-- <a-button type="primary" v-auth="'purCode:pur_shipping_fee:add'" @click="cancelConfirm"> 取消确认(cancel confirm)</a-button> -->
  62. <a-dropdown v-if="selectedRowKeys.length > 0">
  63. <template #overlay>
  64. <a-menu>
  65. <a-menu-item key="1" @click="batchHandleDelete" v-auth="'purCode:pur_delivery_note:deleteBatch'">
  66. <Icon icon="ant-design:delete-outlined" />
  67. 删除(delete)
  68. </a-menu-item>
  69. </a-menu>
  70. </template>
  71. <a-button
  72. >批量操作
  73. <Icon icon="mdi:chevron-down" />
  74. </a-button>
  75. </a-dropdown>
  76. </template>
  77. <!--操作栏-->
  78. <template #action="{ record }">
  79. <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
  80. </template>
  81. <!--字段回显插槽-->
  82. <template #bodyCell="{ column, record, index, text }"> </template>
  83. </BasicTable>
  84. <!-- 表单区域 -->
  85. <FreightPurOrderModal @register="registerModal" @success="handleSuccess" />
  86. <SetCloseReasonModal ref="SetCloseReasonModalRef" @success="successfullyClosed"></SetCloseReasonModal>
  87. </div>
  88. </template>
  89. <script lang="ts" name="purchase-purchaseInquiryForm" setup>
  90. import { ref, reactive, computed, unref, onMounted } from 'vue';
  91. import { BasicTable, useTable, TableAction } from '/@/components/Table';
  92. import { useListPage } from '/@/hooks/system/useListPage';
  93. import { useModal } from '/@/components/Modal';
  94. import FreightPurOrderModal from './components/FreightPurOrderModal.vue';
  95. import SetCloseReasonModal from '../../publicComponents/SetCloseReasonModal.vue'
  96. import { columns } from './FreightPurOrderForm.data';
  97. import {
  98. list,
  99. deleteOne,
  100. batchDelete,
  101. getImportUrl,
  102. bacthClose,
  103. cancelBatchClose,
  104. getExportUrl,
  105. batchSubmit,
  106. cancelBatchSubmit,
  107. Supplierlist,
  108. BatchConfirm,
  109. CancelBatchConfirm,
  110. } from './FreightPurOrder.api';
  111. import { cloneDeep } from 'lodash-es';
  112. import { JDictSelectTag, JInput,JSelect,ApiSelect } from '/@/components/Form';
  113. import { message } from 'ant-design-vue';
  114. const formRef = ref();
  115. const queryParam = reactive<any>({});
  116. var SetCloseReasonModalRef = ref();
  117. var showField = ref('currency_dictText+name');
  118. //注册model
  119. const [registerModal, { openModal }] = useModal();
  120. //注册table数据
  121. const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
  122. tableProps: {
  123. title: '运费采购订单',
  124. api: list,
  125. columns,
  126. canResize: false,
  127. useSearchForm: false,
  128. actionColumn: {
  129. width: 300,
  130. fixed: 'right',
  131. },
  132. scroll: {
  133. x: '2500px',
  134. y:'calc(100vh - 400px)',
  135. },
  136. beforeFetch: async (params) => {
  137. let rangerQuery = await setRangeQuery();
  138. return Object.assign(params, rangerQuery);
  139. },
  140. },
  141. exportConfig: {
  142. name: '运费采购订单',
  143. url: getExportUrl,
  144. params: queryParam,
  145. },
  146. importConfig: {
  147. url: getImportUrl,
  148. success: handleSuccess,
  149. },
  150. });
  151. const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
  152. /**
  153. * 高级查询事件
  154. */
  155. function handleSuperQuery(params) {
  156. Object.keys(params).map((k) => {
  157. queryParam[k] = params[k];
  158. });
  159. reload();
  160. }
  161. /**
  162. * 新增事件
  163. */
  164. function handleAdd() {
  165. openModal(true, {
  166. isUpdate: false,
  167. showFooter: true,
  168. });
  169. }
  170. /**
  171. * 编辑事件
  172. */
  173. function handleEdit(record: Recordable) {
  174. openModal(true, {
  175. record,
  176. isUpdate: true,
  177. showFooter: true,
  178. });
  179. }
  180. /**
  181. * 详情
  182. */
  183. function handleDetail(record: Recordable) {
  184. openModal(true, {
  185. record,
  186. isUpdate: true,
  187. showFooter: false,
  188. });
  189. }
  190. /**
  191. * 删除事件
  192. */
  193. async function handleDelete(record) {
  194. await deleteOne({ id: record.id }, handleSuccess);
  195. }
  196. /**
  197. * 批量删除事件
  198. */
  199. async function batchHandleDelete() {
  200. await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
  201. }
  202. /**
  203. * 成功回调
  204. */
  205. function handleSuccess() {
  206. (selectedRowKeys.value = []) && reload();
  207. }
  208. /**
  209. * 操作栏
  210. */
  211. function getTableAction(record) {
  212. return [
  213. {
  214. label: '编辑(edit)',
  215. onClick: handleEdit.bind(null, record),
  216. auth: 'purCode:pur_shipping_fee:edit',
  217. ifShow: record.submit == '0' || record.submit == '',
  218. },
  219. {
  220. label: '详情(detail)',
  221. onClick: handleDetail.bind(null, record),
  222. ifShow: record.submit == '1',
  223. },
  224. ];
  225. }
  226. /**
  227. * 下拉操作栏
  228. */
  229. function getDropDownAction(record) {
  230. return [
  231. {
  232. label: '详情(detail)',
  233. onClick: handleDetail.bind(null, record),
  234. ifShow: record.submit == '0' || record.submit == '',
  235. },
  236. {
  237. label: '删除(delete)',
  238. popConfirm: {
  239. title: '是否确认删除',
  240. confirm: handleDelete.bind(null, record),
  241. placement: 'topLeft',
  242. },
  243. auth: 'purCode:pur_shipping_fee:delete',
  244. ifShow: record.submit == '0' || record.submit == '',
  245. },
  246. ];
  247. }
  248. function submit() {
  249. if (selectedRowKeys.value.length == 0) {
  250. message.warning('请选择数据');
  251. } else {
  252. var ids = selectedRowKeys.value.join(',');
  253. batchSubmit({ ids: ids }, handleSuccess);
  254. }
  255. }
  256. function cancelSubmit() {
  257. if (selectedRowKeys.value.length == 0) {
  258. message.warning('请选择数据');
  259. } else {
  260. var ids = selectedRowKeys.value.join(',');
  261. cancelBatchSubmit({ ids: ids }, handleSuccess);
  262. }
  263. }
  264. function close() {
  265. if (selectedRowKeys.value.length == 0) {
  266. message.warning('请选择数据');
  267. } else {
  268. var ids = selectedRowKeys.value.join(',');
  269. SetCloseReasonModalRef.value.getTable(ids)
  270. }
  271. }
  272. function successfullyClosed(reason,id){
  273. var params={
  274. ids: id,
  275. closeReason: reason
  276. }
  277. bacthClose(params,handleSuccess);
  278. }
  279. function cancelClose() {
  280. if (selectedRowKeys.value.length == 0) {
  281. message.warning('请选择数据');
  282. } else {
  283. var ids = selectedRowKeys.value.join(',');
  284. cancelBatchClose({ ids: ids }, handleSuccess);
  285. }
  286. }
  287. function confirm() {
  288. if (selectedRowKeys.value.length == 0) {
  289. message.warning('请选择数据');
  290. } else {
  291. var ids = selectedRowKeys.value.join(',');
  292. BatchConfirm({ ids: ids }, handleSuccess);
  293. }
  294. }
  295. function cancelConfirm() {
  296. if (selectedRowKeys.value.length == 0) {
  297. message.warning('请选择数据');
  298. } else {
  299. var ids = selectedRowKeys.value.join(',');
  300. CancelBatchConfirm({ ids: ids }, handleSuccess);
  301. }
  302. }
  303. /* ----------------------以下为原生查询需要添加的-------------------------- */
  304. const toggleSearchStatus = ref<boolean>(false);
  305. const labelCol = reactive({
  306. xs: 24,
  307. sm: 8,
  308. });
  309. const wrapperCol = reactive({
  310. xs: 24,
  311. sm: 16,
  312. });
  313. /**
  314. * 重置
  315. */
  316. function searchReset() {
  317. formRef.value.resetFields();
  318. queryParam.supplier = '';
  319. selectedRowKeys.value = [];
  320. //刷新数据
  321. reload();
  322. }
  323. let rangeField = 'billDate,';
  324. /**
  325. * 设置范围查询条件
  326. */
  327. async function setRangeQuery() {
  328. let queryParamClone = cloneDeep(queryParam);
  329. if (rangeField) {
  330. let fieldsValue = rangeField.split(',');
  331. fieldsValue.forEach((item) => {
  332. if (queryParamClone[item]) {
  333. let range = queryParamClone[item];
  334. queryParamClone[item + '_begin'] = range[0];
  335. queryParamClone[item + '_end'] = range[1];
  336. delete queryParamClone[item];
  337. } else {
  338. queryParamClone[item + '_begin'] = '';
  339. queryParamClone[item + '_end'] = '';
  340. }
  341. });
  342. }
  343. return queryParamClone;
  344. }
  345. </script>
  346. <style lang="less" scoped>
  347. .jeecg-basic-table-form-container {
  348. padding: 0;
  349. .table-page-search-submitButtons {
  350. display: block;
  351. margin-bottom: 8px;
  352. white-space: nowrap;
  353. }
  354. .query-group-cust {
  355. min-width: 100px !important;
  356. }
  357. .query-group-split-cust {
  358. width: 30px;
  359. display: inline-block;
  360. text-align: center;
  361. }
  362. .ant-form-item:not(.ant-form-item-with-help) {
  363. margin-bottom: 8px;
  364. height: 32px;
  365. }
  366. :deep(.ant-picker),
  367. :deep(.ant-input-number) {
  368. width: 100%;
  369. }
  370. }
  371. </style>