commissionAdvancePayList.vue 11 KB

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