receiptOrdertList.vue 11 KB

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