SelectSupplierQuotation.vue 14 KB

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