SelectSupplierInquiryModal.vue 15 KB

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