SaleInquiryFormList.vue 18 KB

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