SelectSupplierQuotation.vue 15 KB

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