index.vue 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090
  1. <template>
  2. <div class="user">
  3. <div class="content">
  4. <byTable
  5. :source="sourceList.data"
  6. :pagination="sourceList.pagination"
  7. :config="config"
  8. :loading="loading"
  9. highlight-current-row
  10. :selectConfig="selectConfig"
  11. :table-events="{
  12. select: select,
  13. }"
  14. :action-list="[]"
  15. @moreSearch="moreSearch"
  16. @get-list="getList"
  17. >
  18. <template #amount="{ item }">
  19. <div style="width: 100%">
  20. <span>{{ item.currency }} {{ item.amount }}</span>
  21. </div>
  22. </template>
  23. <template #file="{ item }">
  24. <div style="width: 100%">
  25. <el-button type="primary" text @click="handleOpenFile(item)"
  26. >查看</el-button
  27. >
  28. </div>
  29. </template>
  30. </byTable>
  31. </div>
  32. <el-dialog
  33. title="打款"
  34. v-if="dialogVisible"
  35. v-model="dialogVisible"
  36. width="500"
  37. v-loading="loading"
  38. >
  39. <byForm
  40. :formConfig="formConfig"
  41. :formOption="formOption"
  42. v-model="formData.data"
  43. :rules="rules"
  44. ref="byform"
  45. >
  46. <template #fileSlot>
  47. <div style="width: 100%">
  48. <el-upload
  49. v-model:fileList="fileList"
  50. action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
  51. :data="uploadData"
  52. multiple
  53. :before-upload="uploadFile"
  54. :on-preview="onPreviewFile"
  55. >
  56. <el-button type="primary">文件上传</el-button>
  57. </el-upload>
  58. </div>
  59. </template>
  60. </byForm>
  61. <template #footer>
  62. <el-button @click="dialogVisible = false" size="large">取 消</el-button>
  63. <el-button
  64. type="primary"
  65. @click="submitForm()"
  66. size="large"
  67. :loading="submitLoading"
  68. v-show="submitType === 'add'"
  69. >
  70. 确 定
  71. </el-button>
  72. </template>
  73. </el-dialog>
  74. <el-dialog
  75. title="高级检索"
  76. v-if="openSearch"
  77. v-model="openSearch"
  78. width="600"
  79. :before-close="cancelSearch"
  80. >
  81. <byForm
  82. :formConfig="formSearchConfig"
  83. :formOption="formOptionTwo"
  84. v-model="sourceList.pagination"
  85. >
  86. <template #departmentId>
  87. <div>
  88. <el-tree-select
  89. v-model="sourceList.pagination.departmentId"
  90. :data="deptTreeData"
  91. check-strictly
  92. :render-after-expand="false"
  93. node-key="deptId"
  94. style="width: 100%"
  95. :props="defaultProps"
  96. clearable
  97. />
  98. </div>
  99. </template>
  100. <template #time>
  101. <div style="width: 100%">
  102. <el-row :gutter="10">
  103. <el-col :span="11">
  104. <el-date-picker
  105. v-model="sourceList.pagination.beginCreateTime"
  106. type="datetime"
  107. placeholder="请选择"
  108. style="width: 100%"
  109. value-format="YYYY-MM-DD HH:mm:ss"
  110. />
  111. </el-col>
  112. <el-col :span="2" style="text-align: center">到</el-col>
  113. <el-col :span="11">
  114. <el-date-picker
  115. v-model="sourceList.pagination.endCreateTime"
  116. type="datetime"
  117. placeholder="请选择"
  118. style="width: 100%"
  119. value-format="YYYY-MM-DD HH:mm:ss"
  120. />
  121. </el-col>
  122. </el-row>
  123. </div>
  124. </template>
  125. <template #timeTwo>
  126. <div style="width: 100%">
  127. <el-row :gutter="10">
  128. <el-col :span="11">
  129. <el-date-picker
  130. v-model="sourceList.pagination.beginTime"
  131. type="datetime"
  132. placeholder="请选择"
  133. style="width: 100%"
  134. value-format="YYYY-MM-DD HH:mm:ss"
  135. />
  136. </el-col>
  137. <el-col :span="2" style="text-align: center">到</el-col>
  138. <el-col :span="11">
  139. <el-date-picker
  140. v-model="sourceList.pagination.endTime"
  141. type="datetime"
  142. placeholder="请选择"
  143. style="width: 100%"
  144. value-format="YYYY-MM-DD HH:mm:ss"
  145. />
  146. </el-col>
  147. </el-row>
  148. </div>
  149. </template>
  150. <template #money>
  151. <div style="width: 100%">
  152. <el-row :gutter="10">
  153. <el-col :span="11">
  154. <el-input-number
  155. onmousewheel="return false;"
  156. v-model="sourceList.pagination.startAmount"
  157. placeholder="请输入"
  158. style="width: 100%"
  159. :precision="2"
  160. :controls="false"
  161. :min="0"
  162. />
  163. </el-col>
  164. <el-col :span="2" style="text-align: center">到</el-col>
  165. <el-col :span="11">
  166. <el-input-number
  167. onmousewheel="return false;"
  168. v-model="sourceList.pagination.endAmount"
  169. placeholder="请输入"
  170. style="width: 100%"
  171. :precision="2"
  172. :controls="false"
  173. :min="0"
  174. />
  175. </el-col>
  176. </el-row>
  177. </div>
  178. </template>
  179. </byForm>
  180. <template #footer>
  181. <el-button @click="cancelSearch()" size="large">取 消</el-button>
  182. <el-button type="primary" @click="submitSearch()" size="large"
  183. >确 定</el-button
  184. >
  185. </template>
  186. </el-dialog>
  187. <el-dialog title="打印" v-if="openPrint" v-model="openPrint" width="840px">
  188. <FundsPDF v-if="rowData.type != '20'" :rowData="rowData"></FundsPDF>
  189. <PaymentPDF v-else :rowData="rowData"></PaymentPDF>
  190. <template #footer>
  191. <el-button @click="openPrint = false" size="large">取消</el-button>
  192. <el-button type="primary" v-print="printObj" size="large"
  193. >打印</el-button
  194. >
  195. <el-button type="primary" @click="clickDownload()" size="large"
  196. >下载PDF</el-button
  197. >
  198. </template>
  199. </el-dialog>
  200. <el-dialog
  201. title="冲销"
  202. v-if="openCancelledOut"
  203. v-model="openCancelledOut"
  204. width="500"
  205. >
  206. <byForm
  207. :formConfig="formCancelledOutConfig"
  208. :formOption="formOptionTwo"
  209. v-model="formCancelledOutData.data"
  210. :rules="rulesCancelledOut"
  211. ref="cancelledOut"
  212. >
  213. <template #detail>
  214. <div style="width: 100%">
  215. <el-button
  216. type="primary"
  217. style="margin-left: -15px"
  218. @click="clickDetail"
  219. text
  220. >查看详情</el-button
  221. >
  222. </div>
  223. </template>
  224. </byForm>
  225. <template #footer>
  226. <el-button @click="openCancelledOut = false" size="large"
  227. >取 消</el-button
  228. >
  229. <el-button
  230. type="danger"
  231. @click="submitCancelledOutForm()"
  232. size="large"
  233. :loading="submitCancelledOutLoading"
  234. >冲 销</el-button
  235. >
  236. </template>
  237. </el-dialog>
  238. <el-dialog
  239. title="关联附件"
  240. v-if="openFileDialog"
  241. v-model="openFileDialog"
  242. width="500"
  243. >
  244. <byForm
  245. :formConfig="fileConfig"
  246. :formOption="formOption"
  247. v-model="fileData.data"
  248. >
  249. <template #businessFile>
  250. <div
  251. style="width: 100%"
  252. v-if="fileData.data && fileData.data.fileList.length > 0"
  253. >
  254. <div v-for="(item, index) in fileData.data.fileList" :key="index">
  255. <div
  256. style="cursor: pointer; color: #409eff"
  257. @click="openFile(item)"
  258. >
  259. {{ item.fileName }}
  260. </div>
  261. </div>
  262. </div>
  263. <div v-else>暂无关联</div>
  264. </template>
  265. <template #fundsFile>
  266. <div
  267. style="width: 100%"
  268. v-if="fileData.data && fileData.data.fileListOne.length > 0"
  269. >
  270. <div
  271. v-for="(item, index) in fileData.data.fileListOne"
  272. :key="index"
  273. >
  274. <div
  275. style="cursor: pointer; color: #409eff"
  276. @click="openFile(item)"
  277. >
  278. {{ item.fileName }}
  279. </div>
  280. </div>
  281. </div>
  282. <div v-else>暂无关联</div>
  283. </template>
  284. </byForm>
  285. <template #footer>
  286. <el-button @click="openFileDialog = false" size="large"
  287. >取 消</el-button
  288. >
  289. </template>
  290. </el-dialog>
  291. </div>
  292. </template>
  293. <script setup>
  294. import { ElMessage, ElMessageBox } from "element-plus";
  295. import byTable from "@/components/byTable/index";
  296. import byForm from "@/components/byForm/index";
  297. import { computed, reactive, ref } from "vue";
  298. import moment from "moment";
  299. import useUserStore from "@/store/modules/user";
  300. import FundsPDF from "@/components/PDF/fundsPDF.vue";
  301. import PaymentPDF from "@/components/PDF/paymentPDF.vue";
  302. const loading = ref(false);
  303. const submitLoading = ref(false);
  304. const sourceList = ref({
  305. data: [],
  306. pagination: {
  307. total: 0,
  308. pageNum: 1,
  309. pageSize: 10,
  310. keyword: "",
  311. corporationId: "",
  312. departmentId: "",
  313. createUser: "",
  314. beginCreateTime: "",
  315. endCreateTime: "",
  316. beginTime: "",
  317. endTime: "",
  318. currency: "",
  319. startAmount: undefined,
  320. endAmount: undefined,
  321. paymentStatus: "",
  322. paymentRemark: "",
  323. type: "",
  324. },
  325. });
  326. let dialogVisible = ref(false);
  327. let rules = ref({
  328. productClassifyId: [
  329. { required: true, message: "请选择物料分类", trigger: "change" },
  330. ],
  331. type: [{ required: true, message: "请选择物料类型", trigger: "change" }],
  332. });
  333. const submitType = ref("add");
  334. const accountCurrency = ref([]);
  335. const accountList = ref([]);
  336. const companyData = ref([]);
  337. const deptTreeData = ref([]);
  338. const userList = ref([]);
  339. const fundsType = ref([]);
  340. const fundsPaymentMethod = ref([]);
  341. const { proxy } = getCurrentInstance();
  342. const selectConfig = computed(() => {
  343. return [
  344. {
  345. label: "打款状态",
  346. prop: "paymentStatus",
  347. data: paymentType.value,
  348. },
  349. ];
  350. });
  351. const config = computed(() => {
  352. return [
  353. {
  354. attrs: {
  355. label: "归属公司",
  356. prop: "corporationName",
  357. width: 160,
  358. },
  359. },
  360. {
  361. attrs: {
  362. label: "归属部门",
  363. prop: "deptName",
  364. width: 160,
  365. },
  366. },
  367. {
  368. attrs: {
  369. label: "付款类型",
  370. prop: "type",
  371. width: 130,
  372. },
  373. render(type) {
  374. if (type != "20") {
  375. return "请款: " + proxy.dictValueLabel(type, fundsType.value);
  376. } else {
  377. return "采购付款 - 申请";
  378. }
  379. },
  380. },
  381. {
  382. attrs: {
  383. label: "申请人",
  384. prop: "userName",
  385. width: 140,
  386. },
  387. },
  388. {
  389. attrs: {
  390. label: "申请时间",
  391. prop: "createTime",
  392. width: 160,
  393. },
  394. },
  395. {
  396. attrs: {
  397. label: "用款时间",
  398. prop: "paymentTime",
  399. width: 160,
  400. },
  401. },
  402. {
  403. attrs: {
  404. label: "金额",
  405. slot: "amount",
  406. width: 120,
  407. align: "right",
  408. },
  409. },
  410. {
  411. attrs: {
  412. label: "款项说明",
  413. prop: "paymentRemark",
  414. "min-width": 200,
  415. },
  416. },
  417. {
  418. attrs: {
  419. label: "关联附件",
  420. slot: "file",
  421. width: 80,
  422. align: "left",
  423. },
  424. },
  425. {
  426. attrs: {
  427. label: "打款状态",
  428. prop: "status",
  429. width: 120,
  430. },
  431. render(status) {
  432. return proxy.dictValueLabel(status, paymentType.value);
  433. },
  434. },
  435. {
  436. attrs: {
  437. label: "操作",
  438. width: "180",
  439. align: "center",
  440. fixed: "right",
  441. },
  442. renderHTML(row) {
  443. return [
  444. row.status == "20"
  445. ? {
  446. attrs: {
  447. label: "打款",
  448. type: "primary",
  449. text: true,
  450. },
  451. el: "button",
  452. click() {
  453. formOption.disabled = false;
  454. submitType.value = "add";
  455. getDtl(row);
  456. },
  457. }
  458. : {
  459. attrs: {
  460. label: "冲销",
  461. type: "danger",
  462. text: true,
  463. },
  464. el: "button",
  465. click(item) {
  466. ElMessageBox.confirm(
  467. "冲销后,已生成的资金流水数据会被删除,且关联的数据状态会由“已打款”退回至“未打款”,并支持重新打款。是否继续?",
  468. "提示",
  469. {
  470. confirmButtonText: "继续",
  471. cancelButtonText: "取消",
  472. type: "warning",
  473. }
  474. )
  475. .then(() => {
  476. rowData.value = item;
  477. formCancelledOutData.data = {
  478. accountPaymentId: item.id,
  479. remark: "",
  480. };
  481. openCancelledOut.value = true;
  482. })
  483. .catch(() => {});
  484. },
  485. },
  486. {
  487. attrs: {
  488. label: "打印",
  489. type: "primary",
  490. text: true,
  491. },
  492. el: "button",
  493. click() {
  494. clickPrint(row);
  495. },
  496. },
  497. {
  498. attrs: {
  499. label: "查看",
  500. type: "primary",
  501. text: true,
  502. },
  503. el: "button",
  504. click() {
  505. formOption.disabled = true;
  506. submitType.value = "edit";
  507. getDtl(row);
  508. },
  509. },
  510. ];
  511. },
  512. },
  513. ];
  514. });
  515. let formData = reactive({
  516. data: {
  517. fileList: [],
  518. },
  519. });
  520. const formOption = reactive({
  521. inline: true,
  522. labelWidth: 100,
  523. itemWidth: 100,
  524. rules: [],
  525. disabled: false,
  526. });
  527. const formOptionTwo = reactive({
  528. inline: true,
  529. labelWidth: 100,
  530. itemWidth: 100,
  531. rules: [],
  532. disabled: false,
  533. });
  534. const byform = ref(null);
  535. const treeListData = ref([]);
  536. const formConfig = computed(() => {
  537. return [
  538. {
  539. type: "title",
  540. label: "请款信息",
  541. },
  542. {
  543. type: "input",
  544. prop: "businessManagementName",
  545. label: "付款账户",
  546. disabled: true,
  547. },
  548. {
  549. type: "input",
  550. prop: "incomeAmount",
  551. label: "请款金额",
  552. disabled: true,
  553. },
  554. {
  555. type: "select",
  556. prop: "paymentMethod",
  557. label: "付款方式",
  558. disabled: true,
  559. data: fundsPaymentMethod.value,
  560. },
  561. {
  562. type: "input",
  563. prop: "name",
  564. label: "户名",
  565. disabled: true,
  566. },
  567. {
  568. type: "input",
  569. prop: "accountOpening",
  570. label: "银行账号",
  571. disabled: true,
  572. },
  573. {
  574. type: "input",
  575. prop: "openingBank",
  576. label: "开户银行",
  577. disabled: true,
  578. },
  579. {
  580. type: "input",
  581. prop: "interbankNumber",
  582. label: "联行号 / SWIFT Code",
  583. disabled: true,
  584. },
  585. {
  586. type: "input",
  587. prop: "paymentRemark",
  588. label: "摘要",
  589. disabled: true,
  590. itemType: "textarea",
  591. },
  592. {
  593. type: "title",
  594. title: "付款信息",
  595. },
  596. {
  597. type: "select",
  598. prop: "accountManagementId",
  599. label: "付款账户",
  600. required: true,
  601. data: accountList.value,
  602. },
  603. {
  604. type: "selectInput",
  605. label: "付款金额",
  606. itemWidth: 60,
  607. prop: "amount",
  608. data: accountCurrency.value,
  609. placeholder: "请输入",
  610. selectPlaceholder: "币种",
  611. selectProp: "currency",
  612. disabled: true,
  613. },
  614. {
  615. type: "date",
  616. itemType: "datetime",
  617. prop: "expensesTime",
  618. label: "打款时间",
  619. format: "YYYY-MM-DD HH:mm:ss",
  620. },
  621. {
  622. type: "input",
  623. prop: "remark",
  624. label: "摘要",
  625. itemType: "textarea",
  626. },
  627. {
  628. type: "slot",
  629. label: "上传附件",
  630. prop: "fileList",
  631. slotName: "fileSlot",
  632. },
  633. ];
  634. });
  635. const fileList = ref([]);
  636. const uploadData = ref({});
  637. const uploadFile = async (file) => {
  638. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  639. uploadData.value = res.uploadBody;
  640. file.id = res.id;
  641. file.fileName = res.fileName;
  642. file.fileUrl = res.fileUrl;
  643. return true;
  644. };
  645. const onPreviewFile = (file) => {
  646. window.open(file.raw.fileUrl, "_blank");
  647. };
  648. const recursive = (data) => {
  649. data.map((item) => {
  650. item.label = item.deptName;
  651. item.id = item.corporationId;
  652. if (item.children) {
  653. recursive(item.children);
  654. } else {
  655. item.children = [];
  656. }
  657. });
  658. };
  659. const getDict = () => {
  660. proxy
  661. .getDict(["account_currency", "founds_type", "funds_payment_method"])
  662. .then((res) => {
  663. accountCurrency.value = res.account_currency.map((item) => {
  664. return {
  665. label: item.dictValue,
  666. value: item.dictKey,
  667. };
  668. });
  669. fundsType.value = res.founds_type.map((item) => {
  670. return {
  671. label: item.dictValue,
  672. value: item.dictKey,
  673. };
  674. });
  675. fundsPaymentMethod.value = res.funds_payment_method.map((item) => {
  676. return {
  677. label: item.dictValue,
  678. value: item.dictKey,
  679. };
  680. });
  681. });
  682. proxy
  683. .post("/accountManagement/page", { pageNum: 1, pageSize: 9999 })
  684. .then((res) => {
  685. if (res.rows && res.rows.length > 0) {
  686. accountList.value = res.rows.map((item) => {
  687. return {
  688. label: item.alias + " (" + item.name + ")",
  689. value: item.id,
  690. };
  691. });
  692. }
  693. });
  694. proxy
  695. .post("/corporation/page", { pageNum: 1, pageSize: 9999 })
  696. .then((res) => {
  697. if (res.rows && res.rows.length > 0) {
  698. companyData.value = res.rows.map((item) => {
  699. return {
  700. label: item.name,
  701. value: item.id,
  702. };
  703. });
  704. }
  705. });
  706. proxy
  707. .get("/tenantDept/list", {
  708. pageNum: 1,
  709. pageSize: 9999,
  710. tenantId: useUserStore().user.tenantId,
  711. })
  712. .then((message) => {
  713. recursive(message.data);
  714. deptTreeData.value = [];
  715. let data = proxy.handleTree(message.data, "deptId");
  716. if (data && data.length > 0) {
  717. for (let i = 0; i < data.length; i++) {
  718. if (data[i].children && data[i].children.length > 0) {
  719. deptTreeData.value = deptTreeData.value.concat(data[i].children);
  720. }
  721. }
  722. }
  723. });
  724. proxy
  725. .get("/tenantUser/list", {
  726. pageNum: 1,
  727. pageSize: 10000,
  728. tenantId: useUserStore().user.tenantId,
  729. })
  730. .then((res) => {
  731. if (res.rows && res.rows.length > 0) {
  732. userList.value = res.rows.map((item) => {
  733. return {
  734. deptId: item.deptId,
  735. label: item.nickName,
  736. value: item.userId,
  737. };
  738. });
  739. }
  740. });
  741. };
  742. getDict();
  743. const getList = async (req) => {
  744. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  745. loading.value = true;
  746. proxy
  747. .post("/accountPayment/page", sourceList.value.pagination)
  748. .then((message) => {
  749. sourceList.value.data = message.rows;
  750. sourceList.value.pagination.total = message.total;
  751. setTimeout(() => {
  752. loading.value = false;
  753. }, 200);
  754. });
  755. };
  756. const paymentType = ref([
  757. {
  758. label: "已打款",
  759. value: 10,
  760. },
  761. {
  762. label: "未打款",
  763. value: 20,
  764. },
  765. ]);
  766. const selection = ref({
  767. data: [],
  768. });
  769. const select = (_selection, row) => {
  770. selection.value.data = _selection;
  771. };
  772. const submitForm = () => {
  773. byform.value.handleSubmit(() => {
  774. if (fileList.value && fileList.value.length > 0) {
  775. formData.data.fileList = fileList.value.map((item) => {
  776. return {
  777. id: item.raw.id,
  778. fileName: item.raw.fileName,
  779. fileUrl: item.raw.fileUrl,
  780. };
  781. });
  782. } else {
  783. formData.data.fileList = [];
  784. }
  785. submitLoading.value = true;
  786. proxy.post("/accountPayment/add", formData.data).then(
  787. () => {
  788. ElMessage({
  789. message: "打款成功",
  790. type: "success",
  791. });
  792. dialogVisible.value = false;
  793. submitLoading.value = false;
  794. getList();
  795. },
  796. () => {
  797. submitLoading.value = false;
  798. }
  799. );
  800. });
  801. };
  802. const getTreeList = () => {
  803. proxy
  804. .post("/productClassify/tree", {
  805. parentId: "",
  806. name: "",
  807. definition: "2",
  808. })
  809. .then((message) => {
  810. treeListData.value = message;
  811. formConfig.value[0].data = message;
  812. });
  813. };
  814. const getDtl = (row) => {
  815. proxy.post("/accountPayment/detail", { id: row.id }).then((res) => {
  816. formData.data = res;
  817. if (submitType.value === "add") {
  818. formData.data.expensesTime = moment().format("yyyy-MM-DD HH:mm:ss");
  819. formData.data.currency = row.currency;
  820. }
  821. proxy
  822. .post("/fileInfo/getList", { businessIdList: [row.id] })
  823. .then((fileObj) => {
  824. formData.data.fileList = fileObj[row.id] || [];
  825. if (formData.data.fileList && formData.data.fileList.length > 0) {
  826. fileList.value = formData.data.fileList.map((item) => {
  827. return {
  828. raw: item,
  829. name: item.fileName,
  830. url: item.fileUrl,
  831. };
  832. });
  833. } else {
  834. fileList.value = [];
  835. }
  836. });
  837. dialogVisible.value = true;
  838. });
  839. };
  840. getTreeList();
  841. getList();
  842. const openSearch = ref(false);
  843. const formSearchConfig = computed(() => {
  844. return [
  845. {
  846. type: "select",
  847. prop: "corporationId",
  848. label: "归属公司",
  849. data: companyData.value,
  850. clearable: true,
  851. },
  852. {
  853. type: "slot",
  854. slotName: "departmentId",
  855. label: "归属部门",
  856. },
  857. {
  858. type: "select",
  859. prop: "createUser",
  860. label: "请款人",
  861. data: userList.value,
  862. clearable: true,
  863. },
  864. {
  865. type: "select",
  866. prop: "type",
  867. label: "付款类型",
  868. data: fundsType.value,
  869. clearable: true,
  870. },
  871. {
  872. type: "slot",
  873. slotName: "time",
  874. label: "请款时间",
  875. },
  876. {
  877. type: "slot",
  878. slotName: "timeTwo",
  879. label: "用款时间",
  880. },
  881. {
  882. type: "select",
  883. prop: "currency",
  884. label: "币种",
  885. data: accountCurrency.value,
  886. clearable: true,
  887. itemWidth: 50,
  888. },
  889. {
  890. type: "input",
  891. prop: "oppositeAccountName",
  892. label: "对方账户",
  893. itemWidth: 50,
  894. },
  895. {
  896. type: "slot",
  897. slotName: "money",
  898. label: "交易金额",
  899. },
  900. {
  901. type: "select",
  902. prop: "paymentStatus",
  903. label: "打款状态",
  904. data: paymentType.value,
  905. clearable: true,
  906. },
  907. {
  908. type: "input",
  909. itemType: "textarea",
  910. prop: "paymentRemark",
  911. label: "款项说明",
  912. },
  913. ];
  914. });
  915. let copySearch = ref({});
  916. const moreSearch = () => {
  917. copySearch.value = proxy.deepClone(sourceList.value.pagination);
  918. openSearch.value = true;
  919. };
  920. const cancelSearch = () => {
  921. sourceList.value.pagination = copySearch.value;
  922. openSearch.value = false;
  923. };
  924. const submitSearch = () => {
  925. if (
  926. sourceList.value.pagination.startAmount &&
  927. sourceList.value.pagination.endAmount &&
  928. Number(sourceList.value.pagination.startAmount) >
  929. Number(sourceList.value.pagination.endAmount)
  930. ) {
  931. return ElMessage("交易金额输入错误");
  932. }
  933. if (
  934. sourceList.value.pagination.beginCreateTime &&
  935. sourceList.value.pagination.endCreateTime &&
  936. sourceList.value.pagination.beginCreateTime >
  937. sourceList.value.pagination.endCreateTime
  938. ) {
  939. return ElMessage("开始时间不能大于结束时间");
  940. }
  941. if (
  942. sourceList.value.pagination.beginTime &&
  943. sourceList.value.pagination.endTime &&
  944. sourceList.value.pagination.beginTime > sourceList.value.pagination.endTime
  945. ) {
  946. return ElMessage("开始时间不能大于结束时间");
  947. }
  948. openSearch.value = false;
  949. sourceList.value.pagination.keyword = "";
  950. sourceList.value.pagination.pageNum = 1;
  951. getList();
  952. };
  953. const openPrint = ref(false);
  954. const rowData = ref({});
  955. const clickPrint = (row) => {
  956. rowData.value = {
  957. id: row.businessId,
  958. type: row.type,
  959. };
  960. openPrint.value = true;
  961. };
  962. const clickDownload = () => {
  963. if (rowData.value.type != "20") {
  964. proxy.getPdf("请款PDF文件");
  965. } else {
  966. proxy.getPdf("采购付款PDF文件");
  967. }
  968. };
  969. let formCancelledOutData = reactive({
  970. data: {},
  971. });
  972. const cancelledOut = ref(null);
  973. const formCancelledOutConfig = computed(() => {
  974. return [
  975. {
  976. type: "slot",
  977. label: "打款明细",
  978. slotName: "detail",
  979. },
  980. {
  981. type: "input",
  982. itemType: "textarea",
  983. prop: "remark",
  984. label: "冲销原因",
  985. },
  986. ];
  987. });
  988. let rulesCancelledOut = ref({
  989. remark: [{ required: true, message: "请输入冲销原因", trigger: "blur" }],
  990. });
  991. const openCancelledOut = ref(false);
  992. const submitCancelledOutLoading = ref(false);
  993. const submitCancelledOutForm = () => {
  994. cancelledOut.value.handleSubmit(() => {
  995. submitCancelledOutLoading.value = true;
  996. proxy.post("/writeOffRecords/add", formCancelledOutData.data).then(
  997. () => {
  998. ElMessage({
  999. message: "冲销完成",
  1000. type: "success",
  1001. });
  1002. openCancelledOut.value = false;
  1003. submitCancelledOutLoading.value = false;
  1004. getList();
  1005. },
  1006. () => {
  1007. submitCancelledOutLoading.value = false;
  1008. }
  1009. );
  1010. });
  1011. };
  1012. const clickDetail = () => {
  1013. formOption.disabled = true;
  1014. submitType.value = "edit";
  1015. getDtl(rowData.value);
  1016. };
  1017. const fileData = reactive({
  1018. data: {},
  1019. });
  1020. const fileConfig = computed(() => [
  1021. {
  1022. type: "title",
  1023. title: "业务附件",
  1024. },
  1025. {
  1026. type: "slot",
  1027. slotName: "businessFile",
  1028. // label: "业务附件",
  1029. },
  1030. {
  1031. type: "title",
  1032. title: "打款附件",
  1033. },
  1034. {
  1035. type: "slot",
  1036. slotName: "fundsFile",
  1037. // label: "打款附件",
  1038. },
  1039. ]);
  1040. const openFileDialog = ref(false);
  1041. const handleOpenFile = (row) => {
  1042. fileData.data = {
  1043. fileList: [],
  1044. fileListOne: [],
  1045. };
  1046. proxy
  1047. .post("/fileInfo/getList", { businessIdList: [row.businessId] })
  1048. .then((fileObj) => {
  1049. if (fileObj[row.businessId] && fileObj[row.businessId].length > 0) {
  1050. fileData.data.fileList = fileObj[row.businessId];
  1051. }
  1052. });
  1053. proxy
  1054. .post("/fileInfo/getList", { businessIdList: [row.id] })
  1055. .then((fileObj) => {
  1056. if (fileObj[row.id] && fileObj[row.id].length > 0) {
  1057. fileData.data.fileListOne = fileObj[row.id];
  1058. }
  1059. });
  1060. openFileDialog.value = true;
  1061. };
  1062. const openFile = (item) => {
  1063. window.open(item.fileUrl, "_blank");
  1064. };
  1065. const printObj = ref({
  1066. id: "pdfDom",
  1067. popTitle: "",
  1068. extraCss:
  1069. "https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.compat.css, https://cdn.bootcdn.net/ajax/libs/hover.css/2.3.1/css/hover-min.css",
  1070. extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
  1071. });
  1072. </script>
  1073. <style lang="scss" scoped>
  1074. .user {
  1075. padding: 20px;
  1076. }
  1077. ::v-deep(.el-input-number .el-input__inner) {
  1078. text-align: left;
  1079. }
  1080. </style>