purPaymentRequesttList.vue 11 KB

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