salesInvoiceList.vue 16 KB

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