SelectDeliveryNoticeModal.vue 14 KB

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