SelectDeliveryNoticeModal.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  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. <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="发货日期(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="name"
  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. :filterOption="false"
  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. :filterOption="false"
  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. <a-input placeholder="请输入" v-model:value="queryParams.salesman"></a-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. <a-input placeholder="请输入" v-model:value="queryParams.saleDepartment"></a-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: 300 }"
  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} 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. title: '通知单号(bill code)',
  150. dataIndex: 'billCode',
  151. key: 'billCode',
  152. align:"center",
  153. width:250,
  154. ellipsis: true,
  155. },
  156. {
  157. title: '发货日期(delivery date)',
  158. dataIndex: 'deliveryDate',
  159. key: 'deliveryDate',
  160. align:"center",
  161. ellipsis: true,
  162. },
  163. {
  164. title: '项目(project)',
  165. dataIndex: 'projectName',
  166. key: 'projectName',
  167. align:"center",
  168. width:250,
  169. ellipsis: true,
  170. },
  171. {
  172. title: '客户(customer)',
  173. dataIndex: 'customerName',
  174. key: 'customerName',
  175. align:"center",
  176. ellipsis: true,
  177. },
  178. {
  179. title: '优先级(priority)',
  180. dataIndex: 'priority_dictText',
  181. key: 'priority_dictText',
  182. align:"center"
  183. },
  184. {
  185. title: '产品分类(production class)',
  186. dataIndex: 'productionClass_dictText',
  187. key: 'productionClass_dictText',
  188. align:"center",
  189. width:250,
  190. ellipsis: true,
  191. },
  192. {
  193. title: '机型(model)',
  194. dataIndex: 'model',
  195. key: 'model',
  196. align:"center"
  197. },
  198. {
  199. title: '厂家(maker)',
  200. dataIndex: 'maker',
  201. key: 'maker',
  202. align:"center"
  203. },
  204. {
  205. title: '销售部门(sale department)',
  206. dataIndex: 'saleDepartment',
  207. key: 'saleDepartment',
  208. align:"center",
  209. width:250,
  210. ellipsis: true,
  211. },
  212. {
  213. title: '业务员(salesman)',
  214. dataIndex: 'salesman',
  215. key: 'salesman',
  216. align:"center"
  217. },
  218. ];
  219. const labelCol = ref({
  220. xs: { span: 24 },
  221. sm: { span: 9 },
  222. });
  223. const wrapperCol = ref({
  224. xs: { span: 24 },
  225. sm: { span: 15 },
  226. });
  227. const labelCol1 = ref({
  228. xs: { span: 24 },
  229. sm: { span: 12 },
  230. });
  231. const wrapperCol1 = ref({
  232. xs: { span: 24 },
  233. sm: { span: 12 },
  234. });
  235. const dataSource =ref([]);
  236. let selectedRowKeys = ref([]);
  237. let selectedRows = ref([]);
  238. const toggleSearchStatus = ref(false);
  239. var deliveryDate = ref([])
  240. const queryParams = ref({
  241. billCode:'',
  242. project:'',
  243. projectName:'',
  244. productionClass:'',
  245. priority:'',
  246. customerName:'',
  247. customer:'',
  248. model:'',
  249. maker:'',
  250. deliveryDate_begin:'',
  251. deliveryDate_end:'',
  252. saleDepartment:'',
  253. salesman:'',
  254. submit:'1',
  255. close:'0'
  256. });
  257. let pagination = ref({
  258. current: 1,
  259. pageSize: 10,
  260. total: '', // 假设总共有100条数据
  261. showSizeChanger: true,
  262. showQuickJumper: true,
  263. showTotal: (total, range) => {
  264. return range[0] + "-" + range[1] + " 共" + total + "条"
  265. },
  266. size:'small'
  267. });
  268. function loadData(){
  269. let params = getQueryParams();
  270. defHttp.get({ url: '/saleCode/saleDelivery/list',params}, { isTransformResponse: false })
  271. .then((res) => {
  272. if (res.success) {
  273. dataSource.value = res.result.records;
  274. pagination.value.total = res.result.total;
  275. pagination.value.current = res.result.current;
  276. pagination.value.pageSize = res.result.size;
  277. } else {
  278. message.error(res.message);
  279. }
  280. })
  281. .finally(() => {
  282. // loading.value = false;
  283. });
  284. }
  285. function getQueryParams(){
  286. let params = Object.assign(queryParams.value);
  287. params.pageNo = pagination.value.current;
  288. params.pageSize = pagination.value.pageSize;
  289. return filterObj(params);
  290. }
  291. function handleTableChange(paginations, filters, sorter){
  292. pagination.value.total = paginations.total;
  293. pagination.value.current = paginations.current;
  294. pagination.value.pageSize = paginations.pageSize;
  295. loadData()
  296. };
  297. function searchQuery(){
  298. loadData();
  299. }
  300. function searchReset(){
  301. deliveryDate.value = []
  302. queryParams.value = {
  303. billCode:'',
  304. project:'',
  305. projectName:'',
  306. productionClass:'',
  307. priority:'',
  308. customerName:'',
  309. customer:'',
  310. model:'',
  311. maker:'',
  312. deliveryDate_begin:'',
  313. deliveryDate_end:'',
  314. saleDepartment:'',
  315. salesman:'',
  316. submit:'1',
  317. close:'0'
  318. }
  319. pagination.value.current =1;
  320. pagination.value.pageSize = 10;
  321. loadData();
  322. }
  323. function handleToggleSearch(){
  324. toggleSearchStatus.value = !toggleSearchStatus.value;
  325. }
  326. function onSelectChange(keys,rows){
  327. selectedRowKeys.value = keys
  328. selectedRows.value = rows
  329. }
  330. function handleOk(){
  331. if(selectedRowKeys.value.length==0){
  332. message.error('请勾选数据');
  333. }else{
  334. emit('addDelivery', selectedRows.value)
  335. handleCancel()
  336. }
  337. }
  338. function handleCancel(){
  339. visible.value = false
  340. selectedRowKeys.value = []
  341. selectedRows.value=[]
  342. deliveryDate.value = []
  343. queryParams.value = {
  344. billCode:'',
  345. project:'',
  346. projectName:'',
  347. productionClass:'',
  348. priority:'',
  349. customerName:'',
  350. customer:'',
  351. model:'',
  352. maker:'',
  353. deliveryDate_begin:'',
  354. deliveryDate_end:'',
  355. saleDepartment:'',
  356. salesman:'',
  357. submit:'1',
  358. close:'0'
  359. }
  360. }
  361. function getTable(){
  362. visible.value = true
  363. loadData()
  364. }
  365. function changeBillDate(prop){
  366. if(prop){
  367. deliveryDate.value = prop
  368. queryParams.value.deliveryDate_begin = prop[0]
  369. queryParams.value.deliveryDate_end = prop[1]
  370. }else{
  371. deliveryDate.value = []
  372. queryParams.value.deliveryDate_begin = ''
  373. queryParams.value.deliveryDate_end = ''
  374. }
  375. }
  376. defineExpose({
  377. getTable
  378. });
  379. </script>
  380. <style scoped lang="less">
  381. /deep/.ant-form-item{
  382. margin-bottom: 8px !important;
  383. }
  384. // /deep/.ant-table-wrapper .ant-table-thead > tr > th, .ant-table-wrapper .ant-table-thead > tr > td{
  385. // padding: 8px !important;
  386. // }
  387. </style>