SelectSaleOrderModal.vue 16 KB

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