advancePaymentList.vue 12 KB

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