SelectDeliveryNoticeModal.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. <template>
  2. <a-modal
  3. title="选择发货通知单(Select delivery notice)"
  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="{ style: 'width: 200px' }" @keyup.enter.native="searchQuery">
  14. <a-row :gutter="24">
  15. <a-col :md="6" :sm="8">
  16. <a-form-item label="通知单号(bill code)">
  17. <j-input placeholder="请输入" v-model:value="queryParams.billCode"></j-input>
  18. </a-form-item>
  19. </a-col>
  20. <a-col :md="6" :sm="8">
  21. <a-form-item label="发货日期(delivery date)" >
  22. <a-range-picker value-format="YYYY-MM-DD" v-model:value="deliveryDate" @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="项目(project)">
  28. <ApiSelect
  29. :api="ProjectOption"
  30. showSearch
  31. v-model:value="queryParams.project"
  32. optionFilterProp="label"
  33. resultField="records"
  34. labelField="code"
  35. valueField="id"
  36. :params='{pageSize:-1}'
  37. />
  38. </a-form-item>
  39. </a-col>
  40. <a-col :md="6" :sm="8">
  41. <a-form-item label="优先级(priority)" >
  42. <JDictSelectTag v-model:value="queryParams.priority" placeholder="请选择" dictCode="priority"/>
  43. </a-form-item>
  44. </a-col>
  45. <a-col :md="12" :sm="16">
  46. <a-form-item label="客户(customer)">
  47. <JSelect v-model:value="queryParams.customer" :get-option-url="CustomerOption" :showField="showField"></JSelect>
  48. </a-form-item>
  49. </a-col>
  50. <a-col :md="6" :sm="8">
  51. <a-form-item label="产品分类(production class)" >
  52. <ApiSelect
  53. :api="ClassList"
  54. showSearch
  55. v-model:value="queryParams.productionClass"
  56. optionFilterProp="label"
  57. resultField="records"
  58. labelField="name"
  59. valueField="id"
  60. />
  61. </a-form-item>
  62. </a-col>
  63. <a-col :md="6" :sm="8">
  64. <a-form-item label="机型(model)">
  65. <JDictSelectTag v-model:value="queryParams.headModel" placeholder="请选择" dictCode="model_typer"/>
  66. </a-form-item>
  67. </a-col>
  68. <a-col :md="6" :sm="8">
  69. <a-form-item label="厂家(maker)" >
  70. <j-input placeholder="请输入" v-model:value="queryParams.maker"></j-input>
  71. </a-form-item>
  72. </a-col>
  73. <a-col :md="6" :sm="8">
  74. <a-form-item label="业务员(salesman)">
  75. <j-input placeholder="请输入" v-model:value="queryParams.salesman"></j-input>
  76. </a-form-item>
  77. </a-col>
  78. <a-col :md="6" :sm="8">
  79. <a-form-item label="销售部门(sale department)" >
  80. <j-input placeholder="请输入" v-model:value="queryParams.saleDepartmentName"></j-input>
  81. </a-form-item>
  82. </a-col>
  83. </template>
  84. <a-col :md="6" :sm="8">
  85. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  86. <a-button type="primary" @click="searchQuery" >查询(search)</a-button>
  87. <a-button type="primary" @click="searchReset" style="margin-left: 8px">重置(reset)</a-button>
  88. <a @click="handleToggleSearch" style="margin-left: 8px">
  89. {{ toggleSearchStatus ? '收起' : '展开' }}
  90. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  91. </a>
  92. </span>
  93. </a-col>
  94. </a-row>
  95. </a-form>
  96. </div>
  97. </a-card>
  98. <a-card :body-style="{ padding: '10px' }" :bordered="false" style="margin: 10px;">
  99. <a-alert type="info" show-icon class="alert" style="margin-bottom: 8px">
  100. <template #message>
  101. <template v-if="selectedRowKeys.length > 0">
  102. <span>已选中 {{ selectedRowKeys.length }} 条记录</span>
  103. <a-divider type="vertical" />
  104. <a @click="selectedRowKeys = []">清空</a>
  105. </template>
  106. <template v-else>
  107. <span>未选中任何数据</span>
  108. </template>
  109. </template>
  110. </a-alert>
  111. <a-table
  112. :columns="columns"
  113. :row-key="record => record.id"
  114. :data-source="dataSource"
  115. bordered
  116. size="small"
  117. @change="handleTableChange"
  118. :pagination="pagination"
  119. :scroll="{ x: 3500, y: 400 }"
  120. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  121. >
  122. </a-table>
  123. </a-card>
  124. </div>
  125. </a-modal>
  126. </template>
  127. <script lang="ts" setup>
  128. import {ref, reactive } from 'vue';
  129. import { defHttp} from '/@/utils/http/axios';
  130. import { message } from 'ant-design-vue';
  131. import { filterObj, getFileAccessHttpUrl } from '/@/utils/common/compUtils';
  132. import { JDictSelectTag,JInput,JSelect} from '/@/components/Form';
  133. import { ApiSelect, } from '/@/components/Form/index';
  134. import {ProjectOption,CustomerOption,ClassList} from '../salesInvoiceForm.api';
  135. const emit = defineEmits([ 'addDelivery']); //定义emit
  136. var showField = ref('currency_dictText+name');
  137. var visible = ref(false)
  138. const columns = [
  139. {
  140. type: 'selection',
  141. fixed: 'left',
  142. width:0
  143. },
  144. {
  145. title: '通知单号(bill code)',
  146. dataIndex: 'billCode',
  147. key: 'billCode',
  148. align:"center",
  149. width:250,
  150. ellipsis: true,
  151. },
  152. {
  153. title: '发货日期(delivery date)',
  154. dataIndex: 'deliveryDate',
  155. key: 'deliveryDate',
  156. align:"center",
  157. ellipsis: true,
  158. },
  159. {
  160. title: '项目(project)',
  161. dataIndex: 'projectName',
  162. key: 'projectName',
  163. align:"center",
  164. width:250,
  165. ellipsis: true,
  166. },
  167. {
  168. title: '客户(customer)',
  169. dataIndex: 'customerName',
  170. key: 'customerName',
  171. align:"center",
  172. ellipsis: true,
  173. },
  174. {
  175. title: '优先级(priority)',
  176. dataIndex: 'priority_dictText',
  177. key: 'priority_dictText',
  178. align:"center"
  179. },
  180. {
  181. title: '产品分类(production class)',
  182. dataIndex: 'productClass',
  183. key: 'productClass',
  184. align:"center",
  185. width:250,
  186. ellipsis: true,
  187. },
  188. {
  189. title: '机型(model)',
  190. dataIndex: 'headModel',
  191. key: 'model',
  192. align:"center"
  193. },
  194. {
  195. title: '销售部门(sale department)',
  196. dataIndex: 'saleDepartmentName',
  197. key: 'saleDepartmentName',
  198. align:"center",
  199. width:250,
  200. ellipsis: true,
  201. },
  202. {
  203. title: '业务员(salesman)',
  204. dataIndex: 'salesman',
  205. key: 'salesman',
  206. align:"center"
  207. },
  208. {
  209. title: '产品编码(product code)',
  210. dataIndex: 'productCode',
  211. key: 'productCode',
  212. align:"center"
  213. },
  214. {
  215. title: '产品英文名(english name)',
  216. dataIndex: 'englishName',
  217. key: 'englishName',
  218. align:"center"
  219. },
  220. {
  221. title: '型号(model)',
  222. dataIndex: 'model',
  223. key: 'model',
  224. align:"center"
  225. },
  226. {
  227. title: '厂家(maker)',
  228. dataIndex: 'maker',
  229. key: 'maker',
  230. align:"center",
  231. ellipsis: true,
  232. },
  233. {
  234. title: '质量等级(quality grade)',
  235. dataIndex: 'qualityGrade',
  236. key: 'qualityGrade',
  237. align:"center"
  238. },
  239. {
  240. title: '数量(quantity)',
  241. dataIndex: 'quantity',
  242. key: 'quantity',
  243. align:"center"
  244. },
  245. {
  246. title: '单价(price)',
  247. dataIndex: 'taxPrice',
  248. key: 'taxPrice',
  249. align:"center"
  250. },
  251. {
  252. title: '金额(money)',
  253. dataIndex: 'money',
  254. key: 'money',
  255. align:"center"
  256. },
  257. ];
  258. const labelCol = ref({
  259. xs: { span: 24 },
  260. sm: { span: 9 },
  261. });
  262. const wrapperCol = ref({
  263. xs: { span: 24 },
  264. sm: { span: 15 },
  265. });
  266. const labelCol1 = ref({
  267. xs: { span: 24 },
  268. sm: { span: 12 },
  269. });
  270. const wrapperCol1 = ref({
  271. xs: { span: 24 },
  272. sm: { span: 12 },
  273. });
  274. const dataSource =ref([]);
  275. let selectedRowKeys = ref([]);
  276. let selectedRows = ref([]);
  277. const toggleSearchStatus = ref(false);
  278. var deliveryDate = ref([])
  279. const queryParams = ref({
  280. billCode:'',
  281. project:'',
  282. projectName:'',
  283. productionClass:'',
  284. priority:'',
  285. customerName:'',
  286. customer:'',
  287. headModel:'',
  288. maker:'',
  289. deliveryDate_begin:'',
  290. deliveryDate_end:'',
  291. saleDepartment:'',
  292. salesman:'',
  293. });
  294. let pagination = ref({
  295. current: 1,
  296. pageSize: 10,
  297. total: '', // 假设总共有100条数据
  298. showSizeChanger: true,
  299. showQuickJumper: true,
  300. showTotal: (total, range) => {
  301. return range[0] + "-" + range[1] + " 共" + total + "条"
  302. },
  303. size:'small'
  304. });
  305. function loadData(data){
  306. let params = getQueryParams();
  307. if(data){
  308. queryParams.value.project = data;
  309. }
  310. defHttp.get({ url: '/saleCode/saleDelivery/list',params}, { isTransformResponse: false })
  311. .then((res) => {
  312. if (res.success) {
  313. dataSource.value = res.result.records;
  314. pagination.value.total = res.result.total;
  315. pagination.value.current = res.result.current;
  316. pagination.value.pageSize = res.result.size;
  317. } else {
  318. message.error(res.message);
  319. }
  320. })
  321. .finally(() => {
  322. // loading.value = false;
  323. });
  324. }
  325. function getQueryParams(){
  326. let params = Object.assign(queryParams.value);
  327. params.pageNo = pagination.value.current;
  328. params.pageSize = pagination.value.pageSize;
  329. return filterObj(params);
  330. }
  331. function handleTableChange(paginations, filters, sorter){
  332. pagination.value.total = paginations.total;
  333. pagination.value.current = paginations.current;
  334. pagination.value.pageSize = paginations.pageSize;
  335. loadData()
  336. };
  337. function searchQuery(){
  338. pagination.value.current =1;
  339. loadData();
  340. }
  341. function searchReset(){
  342. deliveryDate.value = []
  343. queryParams.value = {
  344. billCode:'',
  345. project:'',
  346. projectName:'',
  347. productionClass:'',
  348. priority:'',
  349. customerName:'',
  350. customer:'',
  351. headModel:'',
  352. maker:'',
  353. deliveryDate_begin:'',
  354. deliveryDate_end:'',
  355. saleDepartment:'',
  356. salesman:'',
  357. }
  358. pagination.value.current =1;
  359. pagination.value.pageSize = 10;
  360. loadData();
  361. }
  362. function handleToggleSearch(){
  363. toggleSearchStatus.value = !toggleSearchStatus.value;
  364. }
  365. function onSelectChange(keys,rows){
  366. selectedRowKeys.value = keys
  367. selectedRows.value = rows
  368. }
  369. function handleOk(){
  370. if(selectedRowKeys.value.length!==1){
  371. message.error('请勾选一条数据');
  372. }else{
  373. emit('addDelivery', selectedRows.value)
  374. handleCancel()
  375. }
  376. }
  377. function handleCancel(){
  378. visible.value = false
  379. selectedRowKeys.value = []
  380. selectedRows.value=[]
  381. deliveryDate.value = []
  382. queryParams.value = {
  383. billCode:'',
  384. project:'',
  385. projectName:'',
  386. productionClass:'',
  387. priority:'',
  388. customerName:'',
  389. customer:'',
  390. headModel:'',
  391. maker:'',
  392. deliveryDate_begin:'',
  393. deliveryDate_end:'',
  394. saleDepartment:'',
  395. salesman:'',
  396. }
  397. pagination.value.current =1;
  398. pagination.value.pageSize = 10;
  399. }
  400. function getTable(formData){
  401. visible.value = true
  402. loadData(formData.project)
  403. }
  404. function changeBillDate(prop){
  405. if(prop){
  406. deliveryDate.value = prop
  407. queryParams.value.deliveryDate_begin = prop[0]
  408. queryParams.value.deliveryDate_end = prop[1]
  409. }else{
  410. deliveryDate.value = []
  411. queryParams.value.deliveryDate_begin = ''
  412. queryParams.value.deliveryDate_end = ''
  413. }
  414. }
  415. defineExpose({
  416. getTable
  417. });
  418. </script>
  419. <style scoped lang="less">
  420. /deep/.ant-form-item{
  421. margin-bottom: 8px !important;
  422. }
  423. // /deep/.ant-table-wrapper .ant-table-thead > tr > th, .ant-table-wrapper .ant-table-thead > tr > td{
  424. // padding: 8px !important;
  425. // }
  426. </style>