SelectContractModal.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. <template>
  2. <a-modal
  3. title="选择合同(Select Contract)"
  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="合同编码(contract 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 name="billDate">
  22. <template #label><span title="单据日期(bill date)">单据日期(bill date)</span></template>
  23. <a-range-picker value-format="YYYY-MM-DD" v-model:value="billDate" class="query-group-cust" @change="changeBillDate"/>
  24. </a-form-item>
  25. </a-col>
  26. <template v-if="toggleSearchStatus">
  27. <a-col :md="6" :sm="8">
  28. <a-form-item label="项目(project)">
  29. <a-input placeholder="请输入" v-model:value="queryParams.quotationProject" :disabled="fatherProject!==''"></a-input>
  30. </a-form-item>
  31. </a-col>
  32. <a-col :md="6" :sm="8">
  33. <a-form-item label="产品分类(production class)" :label-col="labelCol1" :wrapper-col="wrapperCol1">
  34. <!-- <a-input placeholder="请输入" v-model:value="queryParams.classId"></a-input> -->
  35. <JSelectInput v-model:value="queryParams.productionClass" placeholder="请选择" :options="classOption" ></JSelectInput>
  36. </a-form-item>
  37. </a-col>
  38. <a-col :md="6" :sm="8">
  39. <a-form-item label="优先级(priority)" >
  40. <JDictSelectTag v-model:value="queryParams.priority" placeholder="请选择" dictCode="priority"/>
  41. </a-form-item>
  42. </a-col>
  43. <a-col :md="6" :sm="8">
  44. <a-form-item label="客户(customer)">
  45. <a-input placeholder="请输入" v-model:value="queryParams.quotationCustomer"></a-input>
  46. </a-form-item>
  47. </a-col>
  48. <a-col :md="6" :sm="8">
  49. <a-form-item label="机型(model)">
  50. <a-input placeholder="请输入" v-model:value="queryParams.headModel"></a-input>
  51. </a-form-item>
  52. </a-col>
  53. <a-col :md="6" :sm="8">
  54. <a-form-item label="产品英文名(English name)" :label-col="labelCol1" :wrapper-col="wrapperCol1">
  55. <a-input placeholder="请输入" v-model:value="queryParams.englishName"></a-input>
  56. </a-form-item>
  57. </a-col>
  58. <a-col :md="6" :sm="8">
  59. <a-form-item label="产品编码(product code)">
  60. <a-input placeholder="请输入" v-model:value="queryParams.productCode"></a-input>
  61. </a-form-item>
  62. </a-col>
  63. <a-col :md="6" :sm="8">
  64. <a-form-item label="型号(model)">
  65. <a-input placeholder="请输入" v-model:value="queryParams.childModel"></a-input>
  66. </a-form-item>
  67. </a-col>
  68. <a-col :md="6" :sm="8">
  69. <a-form-item label="业务员(salesman)" >
  70. <JDictSelectTag v-model:value="queryParams.salesman" placeholder="请选择" dictCode="yes_or_no"/>
  71. </a-form-item>
  72. </a-col>
  73. <a-col :md="6" :sm="8">
  74. <a-form-item label="销售部门(sale department)" :label-col="labelCol1" :wrapper-col="wrapperCol1">
  75. <a-input placeholder="请输入" v-model:value="queryParams.saleDepartment"></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, getFileAccessHttpUrl } from '/@/utils/common/compUtils';
  127. import { JDictSelectTag} from '/@/components/Form';
  128. import JSelectInput from '/@/components/Form/src/jeecg/components/JSelectInput.vue';
  129. const emit = defineEmits([ 'selectContract']); //定义emit
  130. let classOption = ref([])
  131. var visible = ref(false)
  132. var fatherProject = ref('')
  133. var fatherSourceCode = ref('')
  134. const columns = [
  135. {
  136. title: '合同编码(bill code)',
  137. dataIndex: 'billCode',
  138. key: 'billCode',
  139. align:"center",
  140. width:250,
  141. },
  142. {
  143. title: '单据日期(bill date)',
  144. dataIndex: 'billDate',
  145. key: 'billDate',
  146. align:"center"
  147. },
  148. {
  149. title: '项目(project)',
  150. dataIndex: 'quotationProjectName',
  151. key: 'quotationProjectName',
  152. align:"center"
  153. },
  154. {
  155. title: '客户(custormer)',
  156. dataIndex: 'quotationCustomerName',
  157. key: 'quotationCustomerName',
  158. align:"center"
  159. },
  160. {
  161. title: '优先级(priority)',
  162. dataIndex: 'priority',
  163. key: 'priority',
  164. align:"center"
  165. },
  166. {
  167. title: '产品分类(production class)',
  168. dataIndex: 'productClass',
  169. key: 'productClass',
  170. align:"center",
  171. width:250,
  172. },
  173. {
  174. title: '机型(model)',
  175. dataIndex: 'headModel',
  176. key: 'headModel',
  177. align:"center"
  178. },
  179. {
  180. title: '销售部门(sale department)',
  181. dataIndex: 'saleDepartment',
  182. key: 'saleDepartment',
  183. align:"center",
  184. width:250,
  185. },
  186. {
  187. title: '业务员(salesman)',
  188. dataIndex: 'salesman',
  189. key: 'salesman',
  190. align:"center"
  191. },
  192. {
  193. title: '产品编码(product code)',
  194. dataIndex: 'productCode',
  195. key: 'productCode',
  196. align:"center",
  197. width:250,
  198. },
  199. {
  200. title: '产品英文名(English name)',
  201. key: 'englishName',
  202. dataIndex: 'englishName',
  203. align:"center",
  204. width:250,
  205. },
  206. // {
  207. // title: '规格(specifications)',
  208. // key: 'specifications',
  209. // dataIndex: 'specifications',
  210. // align:"center"
  211. // },
  212. {
  213. title: '型号(model)',
  214. key: 'childModel',
  215. dataIndex: 'childModel',
  216. align:"center"
  217. },
  218. {
  219. title: '厂家(factory)',
  220. key: 'factory',
  221. dataIndex: 'factory',
  222. align:"center",
  223. width:250
  224. },
  225. {
  226. title: '质量等级(quantity grade)',
  227. key: 'quantityGrade',
  228. dataIndex: 'quantityGrade',
  229. align:"center",
  230. width:250,
  231. },
  232. {
  233. title: '数量(quanlity)',
  234. key: 'quanlity',
  235. dataIndex: 'quanlity',
  236. align:"center",
  237. width:250,
  238. },
  239. {
  240. title: '单价(price)',
  241. key: 'taxPrice',
  242. dataIndex: 'taxPrice',
  243. align:"center",
  244. width:250,
  245. },
  246. {
  247. title: '价税合计(tax money)',
  248. key: 'taxMoney',
  249. dataIndex: 'taxMoney',
  250. align:"center",
  251. width:250,
  252. },
  253. ];
  254. const labelCol = ref({
  255. xs: { span: 24 },
  256. sm: { span: 9 },
  257. });
  258. const wrapperCol = ref({
  259. xs: { span: 24 },
  260. sm: { span: 15 },
  261. });
  262. const labelCol1 = ref({
  263. xs: { span: 24 },
  264. sm: { span: 12 },
  265. });
  266. const wrapperCol1 = ref({
  267. xs: { span: 24 },
  268. sm: { span: 12 },
  269. });
  270. const dataSource =ref([]);
  271. let selectedRowKeys = ref([]);
  272. let selectedRows = ref([]);
  273. const toggleSearchStatus = ref(false);
  274. var billDate = ref([])
  275. const queryParams = ref({
  276. billCode:'',
  277. quotationProject:'',
  278. quotationProjectName:'',
  279. productionClass:'',
  280. priority:'',
  281. quotationCustomer:'',
  282. quotationCustomerName:'',
  283. headModel:'',
  284. englishName:'',
  285. productCode:'',
  286. childModel:'',
  287. saleDepartment:'',
  288. salesman:'',
  289. billDate_begin:'',
  290. billDate_end:'',
  291. });
  292. let pagination = ref({
  293. current: 1,
  294. pageSize: 10,
  295. total: '', // 假设总共有100条数据
  296. showSizeChanger: true,
  297. showQuickJumper: true,
  298. showTotal: (total, range) => {
  299. return range[0] + "-" + range[1] + " 共" + total + "条"
  300. },
  301. size:'small'
  302. });
  303. function loadData(){
  304. let params = getQueryParams();
  305. defHttp
  306. .get({ url: '/saleCode/saleContract/selectContractDetailAlert',params}, { isTransformResponse: false })
  307. .then((res) => {
  308. if (res.success) {
  309. dataSource.value = res.result.records;
  310. pagination.value.total = res.result.total;
  311. pagination.value.current = res.result.current;
  312. pagination.value.pageSize = res.result.size;
  313. } else {
  314. message.error(res.message);
  315. }
  316. })
  317. .finally(() => {
  318. // loading.value = false;
  319. });
  320. }
  321. function getQueryParams(){
  322. let params = Object.assign(queryParams.value);
  323. params.pageNo = pagination.value.current;
  324. params.pageSize = pagination.value.pageSize;
  325. if(fatherProject.value&&fatherProject.value!==''){
  326. queryParams.value.quotationProject = fatherProject.value
  327. }else {
  328. queryParams.value.quotationProject = params.quotationProject
  329. }
  330. return filterObj(params);
  331. }
  332. function handleTableChange(paginations, filters, sorter){
  333. pagination.value.total = paginations.total;
  334. pagination.value.current = paginations.current;
  335. pagination.value.pageSize = paginations.pageSize;
  336. loadData()
  337. };
  338. function getOptiom(){
  339. defHttp
  340. .get({ url: 'baseCode/baseProductClass/list'}, { isTransformResponse: false })
  341. .then((res) => {
  342. if (res.success) {
  343. classOption.value = []
  344. res.result.records.forEach(element => {
  345. var obj = {
  346. label: element.name?element.name:'无名称请维护',
  347. value: element.id?element.id:''
  348. };
  349. classOption.value.push( obj)
  350. });
  351. }
  352. })
  353. .finally(() => {
  354. // loading.value = false;
  355. });
  356. }
  357. function searchQuery(){
  358. loadData();
  359. }
  360. function searchReset(){
  361. billDate.value = []
  362. queryParams.value = {
  363. billCode:'',
  364. quotationProject:'',
  365. quotationProjectName:'',
  366. productionClass:'',
  367. priority:'',
  368. quotationCustomer:'',
  369. quotationCustomerName:'',
  370. headModel:'',
  371. englishName:'',
  372. productCode:'',
  373. childModel:'',
  374. saleDepartment:'',
  375. salesman:'',
  376. billDate_begin:'',
  377. billDate_end:'',
  378. }
  379. pagination.value.current =1;
  380. pagination.value.pageSize = 10;
  381. loadData();
  382. }
  383. function handleToggleSearch(){
  384. toggleSearchStatus.value = !toggleSearchStatus.value;
  385. }
  386. function onSelectChange(keys,rows){
  387. selectedRowKeys.value = keys
  388. selectedRows.value = rows
  389. }
  390. function handleOk(){
  391. var arr = []
  392. selectedRows.value.map(item=>arr.push(item.billCode))
  393. if(fatherSourceCode.value&&fatherSourceCode.value!==''){
  394. arr.push(fatherSourceCode.value)
  395. }
  396. if(selectedRowKeys.value.length==0){
  397. message.error('请勾选数据');
  398. }else if(new Set(arr).size!==1){
  399. message.error('请勾选询价单号相同的数据');
  400. }else{
  401. emit('selectContract', selectedRows.value)
  402. handleCancel()
  403. }
  404. }
  405. function handleCancel(){
  406. visible.value = false
  407. selectedRowKeys.value = []
  408. selectedRows.value=[]
  409. billDate.value = []
  410. queryParams.value = {
  411. billCode:'',
  412. quotationProject:'',
  413. quotationProjectName:'',
  414. productionClass:'',
  415. priority:'',
  416. quotationCustomer:'',
  417. quotationCustomerName:'',
  418. headModel:'',
  419. englishName:'',
  420. productCode:'',
  421. childModel:'',
  422. saleDepartment:'',
  423. salesman:'',
  424. billDate_begin:'',
  425. billDate_end:'',
  426. }
  427. }
  428. function getTable(formData){
  429. visible.value = true
  430. if(formData.projectName&&formData.projectName!==''){
  431. fatherProject.value = formData.project
  432. }else{
  433. fatherProject.value = ''
  434. }
  435. if(formData.sourceCode2&&formData.sourceCode2!==''){
  436. fatherSourceCode.value = formData.sourceCode2
  437. }else{
  438. fatherSourceCode.value = ''
  439. }
  440. loadData()
  441. getOptiom()
  442. }
  443. function changeBillDate(prop){
  444. if(prop){
  445. billDate.value = prop
  446. queryParams.value.billDate_begin = prop[0]
  447. queryParams.value.billDate_end = prop[1]
  448. }else{
  449. billDate.value = []
  450. queryParams.value.billDate_begin = ''
  451. queryParams.value.billDate_end = ''
  452. }
  453. }
  454. defineExpose({
  455. getTable
  456. });
  457. </script>
  458. <style scoped lang="less">
  459. /deep/.ant-form-item{
  460. margin-bottom: 8px !important;
  461. }
  462. // /deep/.ant-table-wrapper .ant-table-thead > tr > th, .ant-table-wrapper .ant-table-thead > tr > td{
  463. // padding: 8px !important;
  464. // }
  465. </style>