SelectCommissionOrderModal.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <a-modal
  3. title="选择佣金订单(Select commission order)"
  4. width="95%"
  5. :visible="visible"
  6. :maskClosable="false"
  7. switchFullscreen
  8. @ok = "handleOk"
  9. @cancel="handleCancel">
  10. <div>
  11. <a-card :body-style="{ padding: '10px' }" :bordered="false" style="margin: 10px;">
  12. <div class="table-page-search-wrapper">
  13. <a-form :model="queryParams" :label-col="labelCol" :wrapper-col="wrapperCol" @keyup.enter.native="searchQuery">
  14. <a-row :gutter="24">
  15. <a-col :md="6" :sm="8">
  16. <a-form-item label="订单编号(bill code)">
  17. <a-input placeholder="请输入" v-model:value="queryParams.billCode"></a-input>
  18. </a-form-item>
  19. </a-col>
  20. <a-col :md="6" :sm="8">
  21. <a-form-item label="单据日期(bill date)" :label-col="labelCol1" :wrapper-col="wrapperCol1">
  22. <a-range-picker value-format="YYYY-MM-DD" v-model:value="billDate" @change="changeBillDate" class="query-group-cust"/>
  23. </a-form-item>
  24. </a-col>
  25. <template v-if="toggleSearchStatus">
  26. <a-col :md="6" :sm="8">
  27. <a-form-item label="供应商(supplier)">
  28. <ApiSelect
  29. :api="listSupplier"
  30. showSearch
  31. v-model:value="queryParams.supplier"
  32. optionFilterProp="label"
  33. resultField="records"
  34. labelField="name"
  35. valueField="id"
  36. />
  37. </a-form-item>
  38. </a-col>
  39. <a-col :md="6" :sm="8">
  40. <a-form-item label="客户(customer)">
  41. <ApiSelect
  42. :api="customerListList"
  43. showSearch
  44. v-model:value="queryParams.customer"
  45. optionFilterProp="label"
  46. resultField="records"
  47. labelField="name"
  48. valueField="id"
  49. />
  50. </a-form-item>
  51. </a-col>
  52. <a-col :md="6" :sm="8">
  53. <a-form-item label="业务员(salesman)">
  54. <a-input placeholder="请输入" v-model:value="queryParams.salesman"></a-input>
  55. </a-form-item>
  56. </a-col>
  57. <a-col :md="6" :sm="8">
  58. <a-form-item label="销售部门(sale department)" :label-col="labelCol1" :wrapper-col="wrapperCol1">
  59. <a-input placeholder="请输入" v-model:value="queryParams.saleDepartment"></a-input>
  60. </a-form-item>
  61. </a-col>
  62. </template>
  63. <a-col :md="6" :sm="8">
  64. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  65. <a-button type="primary" @click="searchQuery" >查询(search)</a-button>
  66. <a-button type="primary" @click="searchReset" style="margin-left: 8px">重置(reset)</a-button>
  67. <a @click="handleToggleSearch" style="margin-left: 8px">
  68. {{ toggleSearchStatus ? '收起' : '展开' }}
  69. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  70. </a>
  71. </span>
  72. </a-col>
  73. </a-row>
  74. </a-form>
  75. </div>
  76. </a-card>
  77. <a-card :body-style="{ padding: '10px' }" :bordered="false" style="margin: 10px;">
  78. <a-alert type="info" show-icon class="alert" style="margin-bottom: 8px">
  79. <template #message>
  80. <template v-if="selectedRowKeys.length > 0">
  81. <span>已选中 {{ selectedRowKeys.length }} 条记录</span>
  82. <a-divider type="vertical" />
  83. <a @click="selectedRowKeys = []">清空</a>
  84. </template>
  85. <template v-else>
  86. <span>未选中任何数据</span>
  87. </template>
  88. </template>
  89. </a-alert>
  90. <a-table
  91. :columns="columns"
  92. :row-key="record => record.id"
  93. :data-source="dataSource"
  94. bordered
  95. size="small"
  96. @change="handleTableChange"
  97. :pagination="pagination"
  98. :scroll="{ x: 2000, y: 300 }"
  99. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  100. >
  101. </a-table>
  102. </a-card>
  103. </div>
  104. </a-modal>
  105. </template>
  106. <script lang="ts" setup>
  107. import {ref, reactive } from 'vue';
  108. import { defHttp} from '/@/utils/http/axios';
  109. import { message } from 'ant-design-vue';
  110. import { filterObj, getFileAccessHttpUrl } from '/@/utils/common/compUtils';
  111. import { JDictSelectTag} from '/@/components/Form';
  112. import { ApiSelect, } from '/@/components/Form/index';
  113. import {listSupplier} from '../salesInvoiceForm.api'
  114. import JSelectInput from '/@/components/Form/src/jeecg/components/JSelectInput.vue';
  115. const emit = defineEmits([ 'addDelivery']); //定义emit
  116. let classOption = ref([])
  117. var visible = ref(false)
  118. const columns = [
  119. {
  120. title: '订单编号(bill code)',
  121. dataIndex: 'billCode',
  122. key: 'billCode',
  123. align:"center",
  124. width:250,
  125. ellipsis: true,
  126. },
  127. {
  128. title: '单据日期(delivery date)',
  129. dataIndex: 'billDate',
  130. key: 'billDate',
  131. align:"center",
  132. ellipsis: true,
  133. },
  134. {
  135. title: '客户(customer)',
  136. dataIndex: 'customerName',
  137. key: 'customerName',
  138. align:"center",
  139. width:250,
  140. ellipsis: true,
  141. },
  142. {
  143. title: '供应商(supplier)',
  144. dataIndex: 'supplierName',
  145. key: 'supplierName',
  146. align:"center",
  147. ellipsis: true,
  148. },
  149. {
  150. title: '销售部门(sale department)',
  151. dataIndex: 'saleDepartment',
  152. key: 'saleDepartment',
  153. align:"center",
  154. width:250,
  155. ellipsis: true,
  156. },
  157. {
  158. title: '业务员(salesman)',
  159. dataIndex: 'salesman',
  160. key: 'salesman',
  161. align:"center"
  162. },
  163. {
  164. title: '产品编码(product code)',
  165. dataIndex: 'productCode',
  166. key: 'productCode',
  167. align:"center"
  168. },
  169. {
  170. title: '产品名(name)',
  171. dataIndex: 'chineseName',
  172. key: 'chineseName',
  173. align:"center"
  174. },
  175. {
  176. title: '佣金(commission)',
  177. dataIndex: 'commission',
  178. key: 'commission',
  179. align:"center"
  180. },
  181. ];
  182. const labelCol = ref({
  183. xs: { span: 24 },
  184. sm: { span: 9 },
  185. });
  186. const wrapperCol = ref({
  187. xs: { span: 24 },
  188. sm: { span: 15 },
  189. });
  190. const labelCol1 = ref({
  191. xs: { span: 24 },
  192. sm: { span: 12 },
  193. });
  194. const wrapperCol1 = ref({
  195. xs: { span: 24 },
  196. sm: { span: 12 },
  197. });
  198. const dataSource =ref([]);
  199. let selectedRowKeys = ref([]);
  200. let selectedRows = ref([]);
  201. const toggleSearchStatus = ref(false);
  202. var billDate = ref([])
  203. const queryParams = ref({
  204. billCode:'',
  205. supplier:'',
  206. supplierName:'',
  207. salesman:'',
  208. saleDepartment:'',
  209. customerName:'',
  210. customer:'',
  211. });
  212. let pagination = ref({
  213. current: 1,
  214. pageSize: 10,
  215. total: '', // 假设总共有100条数据
  216. showSizeChanger: true,
  217. showQuickJumper: true,
  218. showTotal: (total, range) => {
  219. return range[0] + "-" + range[1] + " 共" + total + "条"
  220. },
  221. size:'small'
  222. });
  223. function loadData(){
  224. // let params = getQueryParams();
  225. // defHttp.get({ url: '/saleCode/saleDelivery/list',params}, { isTransformResponse: false })
  226. // .then((res) => {
  227. // if (res.success) {
  228. // dataSource.value = res.result.records;
  229. // pagination.value.total = res.result.total;
  230. // pagination.value.current = res.result.current;
  231. // pagination.value.pageSize = res.result.size;
  232. // } else {
  233. // message.error(res.message);
  234. // }
  235. // })
  236. // .finally(() => {
  237. // // loading.value = false;
  238. // });
  239. }
  240. function getQueryParams(){
  241. let params = Object.assign(queryParams.value);
  242. params.pageNo = pagination.value.current;
  243. params.pageSize = pagination.value.pageSize;
  244. return filterObj(params);
  245. }
  246. function handleTableChange(paginations, filters, sorter){
  247. pagination.value.total = paginations.total;
  248. pagination.value.current = paginations.current;
  249. pagination.value.pageSize = paginations.pageSize;
  250. loadData()
  251. };
  252. function getOptiom(){
  253. defHttp
  254. .get({ url: 'baseCode/baseProductClass/list'}, { isTransformResponse: false })
  255. .then((res) => {
  256. if (res.success) {
  257. classOption.value = []
  258. res.result.records.forEach(element => {
  259. var obj = {
  260. label: element.name?element.name:'无名称请维护',
  261. value: element.id?element.id:''
  262. };
  263. classOption.value.push( obj)
  264. });
  265. }
  266. })
  267. .finally(() => {
  268. // loading.value = false;
  269. });
  270. }
  271. function searchQuery(){
  272. loadData();
  273. }
  274. function searchReset(){
  275. billDate.value = []
  276. queryParams.value = {
  277. billCode:'',
  278. supplier:'',
  279. supplierName:'',
  280. salesman:'',
  281. saleDepartment:'',
  282. customerName:'',
  283. customer:'',
  284. }
  285. pagination.value.current =1;
  286. pagination.value.pageSize = 10;
  287. loadData();
  288. }
  289. function handleToggleSearch(){
  290. toggleSearchStatus.value = !toggleSearchStatus.value;
  291. }
  292. function onSelectChange(keys,rows){
  293. selectedRowKeys.value = keys
  294. selectedRows.value = rows
  295. }
  296. function handleOk(){
  297. if(selectedRowKeys.value.length==0){
  298. message.error('请勾选数据');
  299. }else{
  300. emit('addDelivery', selectedRows.value)
  301. handleCancel()
  302. }
  303. }
  304. function handleCancel(){
  305. visible.value = false
  306. selectedRowKeys.value = []
  307. selectedRows.value=[]
  308. billDate.value = []
  309. queryParams.value = {
  310. billCode:'',
  311. supplier:'',
  312. supplierName:'',
  313. salesman:'',
  314. saleDepartment:'',
  315. customerName:'',
  316. customer:'',
  317. }
  318. }
  319. function getTable(){
  320. visible.value = true
  321. loadData()
  322. getOptiom()
  323. }
  324. function changeBillDate(prop){
  325. if(prop){
  326. billDate.value = prop
  327. queryParams.value.billDate_begin = prop[0]
  328. queryParams.value.billDate_end = prop[1]
  329. }else{
  330. billDate.value = []
  331. queryParams.value.billDate_begin = ''
  332. queryParams.value.billDate_end = ''
  333. }
  334. }
  335. function customerListList(){
  336. let params = {pageSize:-1}
  337. return defHttp.get({url:'/cuspCode/cuspCustomerProfile/list',params});
  338. }
  339. defineExpose({
  340. getTable
  341. });
  342. </script>
  343. <style scoped lang="less">
  344. /deep/.ant-form-item{
  345. margin-bottom: 8px !important;
  346. }
  347. // /deep/.ant-table-wrapper .ant-table-thead > tr > th, .ant-table-wrapper .ant-table-thead > tr > td{
  348. // padding: 8px !important;
  349. // }
  350. </style>