advancePaymentList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  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. var classOption = ref([]);
  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: 200,
  130. fixed:'right'
  131. },
  132. scroll:{
  133. x:'4000px'
  134. },
  135. beforeFetch: async (params) => {
  136. let rangerQuery = await setRangeQuery();
  137. return Object.assign(params, rangerQuery);
  138. },
  139. },
  140. exportConfig: {
  141. name:"预付款",
  142. url: getExportUrl,
  143. params: queryParam,
  144. },
  145. importConfig: {
  146. url: getImportUrl,
  147. success: handleSuccess
  148. },
  149. })
  150. const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
  151. // 自动请求并暴露内部方法
  152. onMounted(() => {
  153. getOptiom()
  154. });
  155. /**
  156. * 新增事件
  157. */
  158. function handleAdd() {
  159. openModal(true, {
  160. isUpdate: false,
  161. showFooter: true,
  162. isRevise: false
  163. });
  164. }
  165. /**
  166. * 编辑事件
  167. */
  168. function handleEdit(record: Recordable) {
  169. openModal(true, {
  170. record,
  171. isUpdate: true,
  172. showFooter: true,
  173. isRevise: false
  174. });
  175. }
  176. // 产品分类
  177. function getOptiom(){
  178. defHttp
  179. .get({ url: 'baseCode/baseProductClass/list'}, { isTransformResponse: false })
  180. .then((res) => {
  181. if (res.success) {
  182. classOption.value = []
  183. res.result.records.forEach(element => {
  184. var obj = {
  185. label: element.name?element.name:'无名称请维护',
  186. value: element.id?element.id:''
  187. };
  188. classOption.value.push( obj)
  189. });
  190. }
  191. })
  192. .finally(() => {
  193. // loading.value = false;
  194. });
  195. }
  196. /**
  197. * 详情
  198. */
  199. function handleDetail(record: Recordable) {
  200. openModal(true, {
  201. record,
  202. isUpdate: true,
  203. showFooter: false,
  204. });
  205. }
  206. /**
  207. * 删除事件
  208. */
  209. async function handleDelete(record) {
  210. await deleteOne({id: record.id}, handleSuccess);
  211. }
  212. /**
  213. * 批量删除事件
  214. */
  215. async function batchHandleDelete() {
  216. await batchDelete({ids: selectedRowKeys.value},handleSuccess);
  217. }
  218. /**
  219. * 成功回调
  220. */
  221. function handleSuccess() {
  222. (selectedRowKeys.value = []) && reload();
  223. }
  224. /**
  225. * 操作栏
  226. */
  227. function getTableAction(record){
  228. return [
  229. {
  230. label: '编辑(edit)',
  231. onClick: handleEdit.bind(null, record),
  232. auth: 'saleCode:sale_order:edit',
  233. ifShow: record.submit=='0'||!record.submit
  234. },
  235. {
  236. label: '详情(detail)',
  237. onClick: handleDetail.bind(null, record),
  238. ifShow: record.submit=='1'
  239. },
  240. ]
  241. }
  242. /**
  243. * 下拉操作栏
  244. */
  245. function getDropDownAction(record){
  246. return [
  247. {
  248. label: '详情(detail)',
  249. onClick: handleDetail.bind(null, record),
  250. ifShow: record.submit=='0'||!record.submit
  251. },
  252. {
  253. label: '删除(delete)',
  254. popConfirm: {
  255. title: '是否确认删除',
  256. confirm: handleDelete.bind(null, record),
  257. placement: 'topLeft'
  258. },
  259. auth: 'saleCode:sale_order:delete',
  260. ifShow: record.submit=='0'||!record.submit
  261. }
  262. ]
  263. }
  264. function submit(){
  265. if(selectedRowKeys.value.length==0){
  266. message.warning('请选择数据')
  267. }else{
  268. var ids=selectedRowKeys.value.join(',')
  269. batchSubmit({ids: ids},handleSuccess);
  270. }
  271. }
  272. function cancelSubmit(){
  273. if(selectedRowKeys.value.length==0){
  274. message.warning('请选择数据')
  275. }else{
  276. var ids=selectedRowKeys.value.join(',')
  277. cancelBatchSubmit({ids: ids},handleSuccess);
  278. }
  279. }
  280. /* ----------------------以下为原生查询需要添加的-------------------------- */
  281. const toggleSearchStatus = ref<boolean>(false);
  282. const labelCol = reactive({
  283. xs:24,
  284. sm:8,
  285. });
  286. const wrapperCol = reactive({
  287. xs: 24,
  288. sm: 16,
  289. });
  290. const labelCol1 = reactive({
  291. xs:24,
  292. sm:12,
  293. });
  294. const wrapperCol1 = reactive({
  295. xs: 24,
  296. sm: 12,
  297. });
  298. /**
  299. * 重置
  300. */
  301. function searchReset() {
  302. formRef.value.resetFields();
  303. selectedRowKeys.value = [];
  304. //刷新数据
  305. reload();
  306. }
  307. let rangeField = 'billDate,'
  308. /**
  309. * 设置范围查询条件
  310. */
  311. async function setRangeQuery(){
  312. let queryParamClone = cloneDeep(queryParam);
  313. if (rangeField) {
  314. let fieldsValue = rangeField.split(',');
  315. fieldsValue.forEach(item => {
  316. if (queryParamClone[item]) {
  317. let range = queryParamClone[item];
  318. queryParamClone[item+'_begin'] = range[0];
  319. queryParamClone[item+'_end'] = range[1];
  320. delete queryParamClone[item];
  321. } else {
  322. queryParamClone[item+'_begin'] = '';
  323. queryParamClone[item+'_end'] = '';
  324. }
  325. })
  326. }
  327. return queryParamClone;
  328. }
  329. </script>
  330. <style lang="less" scoped>
  331. .jeecg-basic-table-form-container {
  332. padding: 0;
  333. .table-page-search-submitButtons {
  334. display: block;
  335. margin-bottom: 8px;
  336. white-space: nowrap;
  337. }
  338. .query-group-cust{
  339. min-width: 100px !important;
  340. }
  341. .query-group-split-cust{
  342. width: 30px;
  343. display: inline-block;
  344. text-align: center
  345. }
  346. .ant-form-item:not(.ant-form-item-with-help){
  347. margin-bottom: 8px;
  348. height: 32px;
  349. }
  350. :deep(.ant-picker),:deep(.ant-input-number){
  351. width: 100%;
  352. }
  353. }
  354. </style>