SelectSupplierQuotation.vue 15 KB

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