SelectCustomerInquiryModal.vue 15 KB

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