SelectQuotationModal.vue 16 KB

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