SelectDeliveryModal.vue 17 KB

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