SaleInquiryFormList.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <template>
  2. <div class="p-2">
  3. <!--查询区域-->
  4. <div class="jeecg-basic-table-form-container">
  5. <a-form ref="formRef" @keyup.enter.native="reload" :model="queryParam">
  6. <a-row :gutter="24">
  7. <a-col :lg="8">
  8. <a-form-item name="billDate" :label-col="{ style: 'width: 280px' }">
  9. <template #label><span title="单据日期(bill date)">单据日期(bill date)</span></template>
  10. <a-range-picker value-format="YYYY-MM-DD" v-model:value="queryParam.billDate" class="query-group-cust" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :lg="8">
  14. <a-form-item name="inquiryProject" :label-col="{ style: 'width: 200px' }">
  15. <template #label><span title="询价项目(inquiry project)" AutoComplete="off">询价项目(inquiry project)</span></template>
  16. <ApiSelect
  17. :api="ProjectOption"
  18. showSearch
  19. v-model:value="queryParam.inquiryProject"
  20. :filterOption="true"
  21. resultField="records"
  22. labelField="code"
  23. valueField="id"
  24. :params="{ pageSize: -1 }"
  25. optionFilterProp="label"
  26. />
  27. </a-form-item>
  28. </a-col>
  29. <template v-if="toggleSearchStatus">
  30. <a-col :lg="8">
  31. <a-form-item name="billCode" :label-col="{ style: 'width: 280px' }">
  32. <template #label><span title="询价单号(bill code)">询价单号(bill code)</span></template>
  33. <JInput placeholder="请输入询价单号(bill code)" v-model:value="queryParam.billCode" allow-clear AutoComplete="off" />
  34. </a-form-item>
  35. </a-col>
  36. <a-col :lg="16">
  37. <a-form-item name="inquiryCustomer" :label-col="{ style: 'width: 280px' }">
  38. <template #label><span title="询价客户(inquiry customer)">询价客户(inquiry customer)</span></template>
  39. <JSelect v-model:value="queryParam.inquiryCustomer" :get-option-url="CustomerOption" :showField="showField"></JSelect>
  40. </a-form-item>
  41. </a-col>
  42. <a-col :lg="8">
  43. <a-form-item name="shipName" :label-col="{ style: 'width: 280px' }">
  44. <template #label><span title="船(shipName)">船(shipName)</span></template>
  45. <JInput placeholder="请输入船(shipName)" v-model:value="queryParam.shipName" allow-clear ></JInput>
  46. </a-form-item>
  47. </a-col>
  48. <a-col :lg="8">
  49. <a-form-item name="imo" :label-col="{ style: 'width: 280px' }">
  50. <template #label><span title="船IMO(imo)">船IMO(imo)</span></template>
  51. <JInput placeholder="请输入船IMO(imo)" v-model:value="queryParam.imo" allow-clear ></JInput>
  52. </a-form-item>
  53. </a-col>
  54. <a-col :lg="8">
  55. <a-form-item name="priority" :label-col="{ style: 'width: 280px' }">
  56. <template #label><span title="优先级(priority)">优先级(priority)</span></template>
  57. <JDictSelectTag v-model:value="queryParam.priority" placeholder="请选择" dictCode="priority" />
  58. </a-form-item>
  59. </a-col>
  60. <a-col :lg="8">
  61. <a-form-item name="productionClass" :label-col="{ style: 'width: 280px' }">
  62. <template #label><span title="产品分类(production class)">产品分类(production class)</span></template>
  63. <ApiSelect
  64. :api="ClassOption"
  65. showSearch
  66. v-model:value="queryParam.productionClass"
  67. :filterOption="true"
  68. resultField="records"
  69. labelField="name"
  70. valueField="id"
  71. :params="{ pageSize: -1 }"
  72. optionFilterProp="label"
  73. />
  74. </a-form-item>
  75. </a-col>
  76. <a-col :lg="8">
  77. <a-form-item name="model" :label-col="{ style: 'width: 200px' }">
  78. <template #label><span title="机型(model)">机型(model)</span></template>
  79. <JDictSelectTag v-model:value="queryParam.model" placeholder="请选择" dictCode="model_typer" />
  80. </a-form-item>
  81. </a-col>
  82. <a-col :lg="8">
  83. <a-form-item name="maker" :label-col="{ style: 'width: 280px' }">
  84. <template #label><span title="厂家(maker)">厂家(maker)</span></template>
  85. <JInput placeholder="请输入厂家(maker)" v-model:value="queryParam.maker" allow-clear AutoComplete="off" />
  86. </a-form-item>
  87. </a-col>
  88. <a-col :lg="8">
  89. <a-form-item name="saleDepartment" :label-col="{ style: 'width: 280px' }">
  90. <template #label><span title="销售部门(sale department)">销售部门(sale department)</span></template>
  91. <JSelectDept v-model:value="queryParam.saleDepartment" :multiple="false" />
  92. </a-form-item>
  93. </a-col>
  94. <a-col :lg="8">
  95. <a-form-item name="status" :label-col="{ style: 'width: 200px' }">
  96. <template #label><span title="状态(status)">状态(status)</span></template>
  97. <JDictSelectTag v-model:value="queryParam.status" placeholder="请选择" dictCode="inquiry_status" />
  98. </a-form-item>
  99. </a-col>
  100. <a-col :lg="8">
  101. <a-form-item name="inquiryPlatform" :label-col="{ style: 'width: 280px' }">
  102. <template #label><span title="询价平台(inquiry platform)">询价平台(inquiry platform)</span></template>
  103. <JDictSelectTag v-model:value="queryParam.inquiryPlatform" placeholder="请选择" dictCode="inquiry_platform" />
  104. </a-form-item>
  105. </a-col>
  106. <a-col :lg="8">
  107. <a-form-item name="inquiryTeam" :label-col="{ style: 'width: 280px' }">
  108. <template #label><span title="采购询价组(procurement inquiry team)">采购询价组(procurement inquiry team)</span></template>
  109. <JSelectDept v-model:value="queryParam.inquiryTeam" :multiple="false" />
  110. </a-form-item>
  111. </a-col>
  112. <a-col :lg="8">
  113. <a-form-item name="salesman" :label-col="{ style: 'width: 200px' }">
  114. <template #label><span title="业务员(salesman)">业务员(salesman)</span></template>
  115. <ApiSelect
  116. :api="SaleManOption"
  117. showSearch
  118. v-model:value="queryParam.salesman"
  119. :filterOption="true"
  120. resultField="records"
  121. labelField="realname"
  122. valueField="username"
  123. :params="{ pageSize: -1 }"
  124. optionFilterProp="label"
  125. />
  126. <!-- <JSelectUser v-model:value="queryParam.salesman" placeholder="请选择" :multiple="false" /> -->
  127. </a-form-item>
  128. </a-col>
  129. <a-col :lg="8">
  130. <a-form-item name="submit" :label-col="{ style: 'width: 280px' }">
  131. <template #label><span title="提交(submit)">提交(submit)</span></template>
  132. <JDictSelectTag v-model:value="queryParam.submit" placeholder="请选择" dictCode="yes_or_no" />
  133. </a-form-item>
  134. </a-col>
  135. <a-col :lg="8">
  136. <a-form-item name="customerInquiryNumber" :label-col="{ style: 'width: 280px' }">
  137. <template #label><span title="客户询价单号(customer inquiry number)">客户询价单号(customer inquiry number)</span></template>
  138. <JInput
  139. placeholder="请输入客户询价单号(customer inquiry number)"
  140. v-model:value="queryParam.customerInquiryNumber"
  141. allow-clear
  142. AutoComplete="off"
  143. />
  144. </a-form-item>
  145. </a-col>
  146. <a-col :lg="8">
  147. <a-form-item name="otherStatus" :label-col="{ style: 'width: 200px' }">
  148. <template #label><span title="其他状态(other status)">其他状态(other statu)</span></template>
  149. <JInput placeholder="其他状态(other status)" v-model:value="queryParam.otherStatus" allow-clear />
  150. </a-form-item>
  151. </a-col>
  152. </template>
  153. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  154. <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
  155. <a-col :lg="6">
  156. <a-button type="primary" preIcon="ant-design:search-outlined" @click="reload">查询</a-button>
  157. <a-button preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
  158. <a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">
  159. {{ toggleSearchStatus ? '收起' : '展开' }}
  160. <Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" />
  161. </a>
  162. </a-col>
  163. </span>
  164. </a-col>
  165. </a-row>
  166. </a-form>
  167. </div>
  168. <!--引用表格-->
  169. <BasicTable @register="registerTable" :rowSelection="rowSelection" size="small">
  170. <!--插槽:table标题-->
  171. <template #tableTitle>
  172. <a-button type="primary" v-auth="'saleCode:sale_inquiry_form:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增(add)</a-button>
  173. <a-button type="primary" v-auth="'saleCode:sale_inquiry_form:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls">
  174. 导出(export)</a-button
  175. >
  176. <a-button type="primary" @click="setStatus"> 设置其他状态(set other status)</a-button>
  177. <a-button type="primary" @click="SubmitBatch" v-auth="'saleCode:sale_inquiry_form:submitBatch'"> 提交(batch submit)</a-button>
  178. <a-button type="primary" @click="cancelSubmit" v-auth="'saleCode:sale_inquiry_form:returnSubmitBatch'"> 取消提交(cancelSubmit)</a-button>
  179. <a-dropdown v-if="selectedRowKeys.length > 0">
  180. <template #overlay>
  181. <a-menu>
  182. <a-menu-item key="1" @click="batchHandleDelete" v-auth="'saleCode:sale_inquiry_form:deleteBatch'">
  183. <Icon icon="ant-design:delete-outlined" />
  184. 删除(delete)
  185. </a-menu-item>
  186. </a-menu>
  187. </template>
  188. <a-button v-auth="'saleCode:sale_inquiry_form:deleteBatch'"
  189. >批量操作
  190. <Icon icon="mdi:chevron-down" />
  191. </a-button>
  192. </a-dropdown>
  193. </template>
  194. <!--操作栏-->
  195. <template #action="{ record }">
  196. <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
  197. </template>
  198. <!--字段回显插槽-->
  199. <template #bodyCell="{ column, record, index, text }"> </template>
  200. </BasicTable>
  201. <!-- 表单区域 -->
  202. <SaleInquiryFormModal @register="registerModal" @success="handleSuccess" />
  203. <SetOtherStatus ref="SetOtherStatusRef" @success="handleSuccess" />
  204. <SelecSaleInquiryModal ref="SelecSaleInquiryModalRef" @copy-product="handleCopyProduct"></SelecSaleInquiryModal>
  205. </div>
  206. </template>
  207. <script lang="ts" name="saleCode-saleInquiryForm" setup>
  208. import { ref, reactive, computed, unref, onMounted } from 'vue';
  209. import { BasicTable, useTable, TableAction } from '/@/components/Table';
  210. import { useListPage } from '/@/hooks/system/useListPage';
  211. import { useModal } from '/@/components/Modal';
  212. import SaleInquiryFormModal from './components/SaleInquiryFormModal.vue';
  213. import { columns, superQuerySchema } from './SaleInquiryForm.data';
  214. import {
  215. list,
  216. deleteOne,
  217. batchDelete,
  218. getImportUrl,
  219. getExportUrl,
  220. batchSubmit,
  221. cancelBatchSubmit,
  222. ProjectOption,
  223. CustomerOption,
  224. ClassOption,
  225. SaleManOption
  226. } from './SaleInquiryForm.api';
  227. import { cloneDeep } from 'lodash-es';
  228. import { defHttp } from '/@/utils/http/axios';
  229. import { JDictSelectTag, ApiSelect, JInput ,JSelect} from '/@/components/Form';
  230. import JSelectUser from '/@/components/Form/src/jeecg/components/JSelectUser.vue';
  231. import JSelectDept from '/@/components/Form/src/jeecg/components/JSelectDept.vue';
  232. import SelecSaleInquiryModal from './components/SelecSaleInquiryModal.vue';
  233. import SetOtherStatus from './components/SetOtherStatus.vue';
  234. import { message } from 'ant-design-vue';
  235. const formRef = ref();
  236. const queryParam = reactive<any>({});
  237. const checkedKeys = ref<Array<string | number>>([]);
  238. //注册model
  239. const [registerModal, { openModal }] = useModal();
  240. var showField = ref('currency+name');
  241. var classOption = ref([]);
  242. var SetOtherStatusRef = ref();
  243. var SelecSaleInquiryModalRef = ref();
  244. //注册table数据
  245. const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
  246. tableProps: {
  247. title: '销售询价单',
  248. api: list,
  249. columns,
  250. canResize: false,
  251. useSearchForm: false,
  252. actionColumn: {
  253. width: 300,
  254. fixed: 'right',
  255. },
  256. scroll: {
  257. x: '4000px',
  258. y:'calc(100vh - 400px)',
  259. },
  260. beforeFetch: async (params) => {
  261. let rangerQuery = await setRangeQuery();
  262. return Object.assign(params, rangerQuery);
  263. },
  264. },
  265. exportConfig: {
  266. name: '销售询价单',
  267. url: getExportUrl,
  268. params: queryParam,
  269. },
  270. importConfig: {
  271. url: getImportUrl,
  272. success: handleSuccess,
  273. },
  274. });
  275. const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
  276. // 高级查询配置
  277. const superQueryConfig = reactive(superQuerySchema);
  278. /**
  279. * 高级查询事件
  280. */
  281. function handleSuperQuery(params) {
  282. Object.keys(params).map((k) => {
  283. queryParam[k] = params[k];
  284. });
  285. reload();
  286. }
  287. // 自动请求并暴露内部方法
  288. onMounted(() => {
  289. getOptiom();
  290. });
  291. /**
  292. * 新增事件
  293. */
  294. function handleAdd() {
  295. openModal(true, {
  296. isUpdate: false,
  297. showFooter: true,
  298. });
  299. }
  300. /**
  301. * 编辑事件
  302. */
  303. function handleEdit(record: Recordable) {
  304. openModal(true, {
  305. record,
  306. isUpdate: true,
  307. showFooter: true,
  308. });
  309. }
  310. // 产品分类
  311. function getOptiom() {
  312. defHttp
  313. .get({ url: 'baseCode/baseProductClass/list' }, { isTransformResponse: false })
  314. .then((res) => {
  315. if (res.success) {
  316. classOption.value = [];
  317. res.result.records.forEach((element) => {
  318. var obj = {
  319. label: element.name ? element.name : '无名称请维护',
  320. value: element.id ? element.id : '',
  321. };
  322. classOption.value.push(obj);
  323. });
  324. }
  325. })
  326. .finally(() => {
  327. // loading.value = false;
  328. });
  329. }
  330. /**
  331. * 详情
  332. */
  333. function handleDetail(record: Recordable) {
  334. openModal(true, {
  335. record,
  336. isUpdate: true,
  337. showFooter: false,
  338. });
  339. }
  340. /**
  341. * 删除事件
  342. */
  343. async function handleDelete(record) {
  344. await deleteOne({ id: record.id }, handleSuccess);
  345. }
  346. /**
  347. * 批量删除事件
  348. */
  349. async function batchHandleDelete() {
  350. await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
  351. }
  352. /**
  353. * 成功回调
  354. */
  355. function handleSuccess() {
  356. (selectedRowKeys.value = []) && reload();
  357. }
  358. /**
  359. * 操作栏
  360. */
  361. function getTableAction(record) {
  362. return [
  363. {
  364. label: '编辑(edit)',
  365. onClick: handleEdit.bind(null, record),
  366. auth: 'saleCode:sale_inquiry_form:edit',
  367. ifShow: record.submit == '0',
  368. // ifShow: record.submit=='0'||!record.submit
  369. },
  370. {
  371. label: '详情(detail)',
  372. onClick: handleDetail.bind(null, record),
  373. ifShow: record.submit == '1',
  374. // ifShow: record.submit='1'
  375. },
  376. {
  377. label: '复制(copy)',
  378. onClick: handleCopy.bind(null, record),
  379. // ifShow: record.submit='1'
  380. },
  381. ];
  382. }
  383. /**
  384. * 下拉操作栏
  385. */
  386. function getDropDownAction(record) {
  387. return [
  388. {
  389. label: '详情(detail)',
  390. onClick: handleDetail.bind(null, record),
  391. ifShow: record.submit == '0',
  392. // ifShow: record.submit=='0'||!record.submit
  393. },
  394. {
  395. label: '删除(delete)',
  396. popConfirm: {
  397. title: '是否确认删除',
  398. confirm: handleDelete.bind(null, record),
  399. placement: 'topLeft',
  400. },
  401. auth: 'saleCode:sale_inquiry_form:delete',
  402. ifShow: record.submit == '0',
  403. // ifShow:record.submit=='0'||!record.submit
  404. },
  405. ];
  406. }
  407. function setStatus() {
  408. if (selectedRowKeys.value.length == 0) {
  409. message.warning('请选择数据');
  410. } else {
  411. var ids = selectedRowKeys.value.join(',');
  412. SetOtherStatusRef.value.getTable(ids);
  413. }
  414. }
  415. function SubmitBatch() {
  416. if (selectedRowKeys.value.length == 0) {
  417. message.warning('请选择数据');
  418. } else {
  419. var ids = selectedRowKeys.value.join(',');
  420. batchSubmit({ ids: ids }, handleSuccess);
  421. }
  422. }
  423. function cancelSubmit() {
  424. if (selectedRowKeys.value.length == 0) {
  425. message.warning('请选择数据');
  426. } else {
  427. var ids = selectedRowKeys.value.join(',');
  428. cancelBatchSubmit({ ids: ids }, handleSuccess);
  429. }
  430. }
  431. //复制
  432. function handleCopy(record: Recordable) {
  433. SelecSaleInquiryModalRef.value.getTable(record);
  434. }
  435. function handleCopyProduct(data, mainId) {
  436. openModal(true, {
  437. data,
  438. mainId,
  439. isUpdate: false,
  440. showFooter: true,
  441. isCopy: true,
  442. });
  443. }
  444. /* ----------------------以下为原生查询需要添加的-------------------------- */
  445. const toggleSearchStatus = ref<boolean>(false);
  446. /**
  447. * 重置
  448. */
  449. function searchReset() {
  450. formRef.value.resetFields();
  451. selectedRowKeys.value = [];
  452. //刷新数据
  453. reload();
  454. }
  455. let rangeField = 'billDate,';
  456. /**
  457. * 设置范围查询条件
  458. */
  459. async function setRangeQuery() {
  460. let queryParamClone = cloneDeep(queryParam);
  461. if (rangeField) {
  462. let fieldsValue = rangeField.split(',');
  463. fieldsValue.forEach((item) => {
  464. if (queryParamClone[item]) {
  465. let range = queryParamClone[item];
  466. queryParamClone[item + '_begin'] = range[0];
  467. queryParamClone[item + '_end'] = range[1];
  468. delete queryParamClone[item];
  469. } else {
  470. queryParamClone[item + '_begin'] = '';
  471. queryParamClone[item + '_end'] = '';
  472. }
  473. });
  474. }
  475. return queryParamClone;
  476. }
  477. </script>
  478. <style lang="less" scoped>
  479. .jeecg-basic-table-form-container {
  480. padding: 0;
  481. .table-page-search-submitButtons {
  482. display: block;
  483. margin-bottom: 8px;
  484. white-space: nowrap;
  485. }
  486. .query-group-cust {
  487. min-width: 100px !important;
  488. }
  489. .query-group-split-cust {
  490. width: 30px;
  491. display: inline-block;
  492. text-align: center;
  493. }
  494. .ant-form-item:not(.ant-form-item-with-help) {
  495. margin-bottom: 8px;
  496. height: 32px;
  497. }
  498. :deep(.ant-picker),
  499. :deep(.ant-input-number) {
  500. width: 100%;
  501. }
  502. }
  503. </style>