commissionOrder.vue 12 KB

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