index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935
  1. <template>
  2. <div class="tenant">
  3. <div class="content">
  4. <byTable
  5. :source="sourceList.data"
  6. :pagination="sourceList.pagination"
  7. :config="config"
  8. :loading="loading"
  9. :selectConfig="selectConfig"
  10. highlight-current-row
  11. :action-list="[
  12. {
  13. text: '导出Excel',
  14. action: () => deriveExcel(),
  15. },
  16. {
  17. text: '添加流水',
  18. action: () => openModal('add'),
  19. },
  20. {
  21. text: '内部转账',
  22. action: () => openTransferMoney('add'),
  23. },
  24. ]"
  25. @moreSearch="moreSearch"
  26. @get-list="getList">
  27. <template #amount="{ item }">
  28. <div :style="'color: ' + (item.status === '10' ? '#04cb04;' : 'red;')">
  29. <span style="padding-right: 4px" v-if="item.currency">{{ item.currency }}</span>
  30. <span style="padding-right: 4px" v-else>
  31. {{ accountCurrency[0].value }}
  32. </span>
  33. <span v-if="item.status === '20'">-</span>
  34. <span>{{ moneyFormat(item.amount, 2) }}</span>
  35. </div>
  36. </template>
  37. <template #contractCodes="{ item }">
  38. <div style="width: 100%">
  39. <div v-if="item.contractCodes">
  40. <div v-for="(contract, index) in item.contractCodes.split(',')" :key="index">
  41. <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="openDetails(contract)">{{ contract }}</a>
  42. </div>
  43. </div>
  44. </div>
  45. </template>
  46. </byTable>
  47. </div>
  48. <el-dialog :title="modalType == 'add' ? '添加流水' : '编辑流水'" v-if="dialogVisible" v-model="dialogVisible" width="600" v-loading="loadingDialog">
  49. <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
  50. <template #transactionTime>
  51. <div>
  52. <el-date-picker v-model="formData.data.transactionTime" type="datetime" placeholder="请选择交易时间" value-format="YYYY-MM-DD HH:mm:ss" />
  53. </div>
  54. </template>
  55. <template #money>
  56. <div style="width: 100%">
  57. <el-row :gutter="10">
  58. <el-col :span="6">
  59. <el-form-item prop="status">
  60. <el-select v-model="formData.data.status" placeholder="请选择" style="width: 100%" @change="changeStatus()">
  61. <el-option v-for="item in status" :key="item.value" :label="item.label" :value="item.value" />
  62. </el-select>
  63. </el-form-item>
  64. </el-col>
  65. <el-col :span="6">
  66. <el-form-item prop="currency">
  67. <el-select v-model="formData.data.currency" placeholder="请选择" style="width: 100%">
  68. <el-option v-for="item in accountCurrency" :key="item.value" :label="item.label" :value="item.value" />
  69. </el-select>
  70. </el-form-item>
  71. </el-col>
  72. <el-col :span="12">
  73. <el-form-item prop="amount">
  74. <el-input-number
  75. onmousewheel="return false;"
  76. v-model="formData.data.amount"
  77. placeholder="请输入金额"
  78. style="width: 100%"
  79. :precision="2"
  80. :controls="false"
  81. :min="0" />
  82. </el-form-item>
  83. </el-col>
  84. </el-row>
  85. </div>
  86. </template>
  87. <template #received>
  88. <div>
  89. <el-form-item prop="received">
  90. <el-radio-group v-model="formData.data.received">
  91. <el-radio v-for="item in received" :key="item.value" :label="item.value" border>{{ item.label }}</el-radio>
  92. </el-radio-group>
  93. </el-form-item>
  94. </div>
  95. </template>
  96. </byForm>
  97. <template #footer>
  98. <el-button @click="dialogVisible = false" size="large">取 消</el-button>
  99. <el-button type="primary" @click="submitForm()" size="large">确 定</el-button>
  100. </template>
  101. </el-dialog>
  102. <el-dialog title="内部转账" v-if="transferMoneyModal" v-model="transferMoneyModal" width="600" v-loading="loadingDialog">
  103. <byForm :formConfig="transferMoneyConfig" :formOption="formOption" v-model="formData2.data" :rules="rules2" ref="transferMoneySubmit">
  104. </byForm>
  105. <template #footer>
  106. <el-button @click="transferMoneyModal = false" size="large">取 消</el-button>
  107. <el-button type="primary" @click="submitForm2()" size="large">确 定</el-button>
  108. </template>
  109. </el-dialog>
  110. <el-dialog title="高级检索" v-if="openSearch" v-model="openSearch" width="600" :before-close="cancelSearch">
  111. <byForm :formConfig="formSearchConfig" :formOption="formOption" v-model="sourceList.pagination">
  112. <template #money>
  113. <div style="width: 100%">
  114. <el-row :gutter="10">
  115. <el-col :span="11">
  116. <el-input-number
  117. onmousewheel="return false;"
  118. v-model="sourceList.pagination.beginAmount"
  119. placeholder="请输入"
  120. style="width: 100%"
  121. :precision="2"
  122. :controls="false"
  123. :min="0" />
  124. </el-col>
  125. <el-col :span="2" style="text-align: center">到</el-col>
  126. <el-col :span="11">
  127. <el-input-number
  128. onmousewheel="return false;"
  129. v-model="sourceList.pagination.endAmount"
  130. placeholder="请输入"
  131. style="width: 100%"
  132. :precision="2"
  133. :controls="false"
  134. :min="0" />
  135. </el-col>
  136. </el-row>
  137. </div>
  138. </template>
  139. <template #time>
  140. <div style="width: 100%">
  141. <el-row :gutter="10">
  142. <el-col :span="11">
  143. <el-date-picker
  144. v-model="sourceList.pagination.startTime"
  145. type="datetime"
  146. placeholder="请选择"
  147. style="width: 100%"
  148. value-format="YYYY-MM-DD HH:mm:ss" />
  149. </el-col>
  150. <el-col :span="2" style="text-align: center">到</el-col>
  151. <el-col :span="11">
  152. <el-date-picker
  153. v-model="sourceList.pagination.stopTime"
  154. type="datetime"
  155. placeholder="请选择"
  156. style="width: 100%"
  157. value-format="YYYY-MM-DD HH:mm:ss" />
  158. </el-col>
  159. </el-row>
  160. </div>
  161. </template>
  162. </byForm>
  163. <template #footer>
  164. <el-button @click="cancelSearch()" size="large">取 消</el-button>
  165. <el-button type="primary" @click="submitSearch()" size="large">确 定</el-button>
  166. </template>
  167. </el-dialog>
  168. <el-dialog title="打印" v-if="openPrint" v-model="openPrint" width="860">
  169. <ContractPDF :rowData="rowData"></ContractPDF>
  170. <template #footer>
  171. <el-button @click="openPrint = false" size="large">取消</el-button>
  172. <el-button v-print="printObj" size="large">打印</el-button>
  173. <el-button type="primary" @click="clickDownload()" size="large">下载PDF</el-button>
  174. </template>
  175. </el-dialog>
  176. </div>
  177. </template>
  178. <script setup>
  179. import { computed, ref } from "vue";
  180. import byTable from "@/components/byTable/index";
  181. import byForm from "@/components/byForm/index";
  182. import useUserStore from "@/store/modules/user";
  183. import { ElMessage, ElMessageBox } from "element-plus";
  184. import moment from "moment";
  185. import ContractPDF from "@/components/PDF/contractPDF.vue";
  186. const { proxy } = getCurrentInstance();
  187. const accountCurrency = ref([]);
  188. const accountList = ref([]);
  189. const status = ref([
  190. {
  191. label: "收入",
  192. value: "10",
  193. },
  194. {
  195. label: "支出",
  196. value: "20",
  197. },
  198. ]);
  199. const received = ref([
  200. {
  201. label: "是",
  202. value: "10",
  203. },
  204. {
  205. label: "否",
  206. value: "20",
  207. },
  208. ]);
  209. const sourceList = ref({
  210. data: [],
  211. pagination: {
  212. total: 0,
  213. pageNum: 1,
  214. pageSize: 10,
  215. keyword: "",
  216. accountManagementId: "",
  217. currency: "",
  218. status: "",
  219. received: "",
  220. beginAmount: undefined,
  221. endAmount: undefined,
  222. startTime: "",
  223. stopTime: "",
  224. remarks: "",
  225. },
  226. });
  227. const loading = ref(false);
  228. const selectConfig = computed(() => {
  229. return [
  230. {
  231. label: "收支类型",
  232. prop: "status",
  233. data: status.value,
  234. },
  235. {
  236. label: "资金账户",
  237. prop: "accountManagementId",
  238. data: accountList.value,
  239. },
  240. {
  241. label: "币种",
  242. prop: "currency",
  243. data: accountCurrency.value,
  244. },
  245. ];
  246. });
  247. const config = computed(() => {
  248. return [
  249. {
  250. attrs: {
  251. label: "归属公司",
  252. prop: "corporationName",
  253. width: 160,
  254. },
  255. },
  256. {
  257. attrs: {
  258. label: "关联销售合同",
  259. slot: "contractCodes",
  260. width: 160,
  261. },
  262. },
  263. {
  264. attrs: {
  265. label: "资金账户",
  266. prop: "accountManagementName",
  267. width: 200,
  268. },
  269. },
  270. {
  271. attrs: {
  272. label: "交易时间",
  273. prop: "transactionTime",
  274. width: 160,
  275. },
  276. },
  277. {
  278. attrs: {
  279. label: "交易金额",
  280. slot: "amount",
  281. width: 200,
  282. },
  283. },
  284. {
  285. attrs: {
  286. label: "对方账户",
  287. prop: "name",
  288. width: 200,
  289. },
  290. },
  291. {
  292. attrs: {
  293. label: "对方银行",
  294. prop: "openingBank",
  295. width: 200,
  296. },
  297. },
  298. {
  299. attrs: {
  300. label: "对方账号",
  301. prop: "accountOpening",
  302. width: 240,
  303. },
  304. },
  305. {
  306. attrs: {
  307. label: "摘要",
  308. prop: "remarks",
  309. },
  310. },
  311. {
  312. attrs: {
  313. label: "操作",
  314. width: "120",
  315. align: "center",
  316. },
  317. renderHTML(row) {
  318. return [
  319. {
  320. attrs: {
  321. label: "修改",
  322. type: "primary",
  323. text: true,
  324. },
  325. el: "button",
  326. click() {
  327. update(row);
  328. },
  329. },
  330. {
  331. attrs: {
  332. label: "删除",
  333. type: "primary",
  334. text: true,
  335. },
  336. el: "button",
  337. click() {
  338. ElMessageBox.confirm("此操作将永久删除该数据, 是否继续?", "提示", {
  339. confirmButtonText: "确定",
  340. cancelButtonText: "取消",
  341. type: "warning",
  342. }).then(() => {
  343. proxy
  344. .post("/accountRunningWater/delete", {
  345. id: row.id,
  346. })
  347. .then(() => {
  348. ElMessage({
  349. message: "删除成功",
  350. type: "success",
  351. });
  352. getList();
  353. });
  354. });
  355. },
  356. },
  357. ];
  358. },
  359. },
  360. ];
  361. });
  362. const getDict = () => {
  363. proxy
  364. .post("/dictTenantData/page", {
  365. pageNum: 1,
  366. pageSize: 999,
  367. dictCode: "account_currency",
  368. tenantId: useUserStore().user.tenantId,
  369. })
  370. .then((res) => {
  371. if (res.rows && res.rows.length > 0) {
  372. accountCurrency.value = res.rows.map((item) => {
  373. return {
  374. label: item.dictValue,
  375. value: item.dictKey,
  376. };
  377. });
  378. }
  379. });
  380. proxy.post("/accountManagement/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  381. if (res.rows && res.rows.length > 0) {
  382. accountList.value = res.rows.map((item) => {
  383. return {
  384. label: item.alias,
  385. value: item.id,
  386. };
  387. });
  388. }
  389. });
  390. };
  391. const getList = async (req) => {
  392. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  393. loading.value = true;
  394. proxy.post("/accountRunningWater/page", sourceList.value.pagination).then((res) => {
  395. sourceList.value.data = res.rows;
  396. sourceList.value.pagination.total = res.total;
  397. setTimeout(() => {
  398. loading.value = false;
  399. }, 200);
  400. });
  401. };
  402. getDict();
  403. getList();
  404. let transferMoneyModal = ref(false);
  405. const openTransferMoney = () => {
  406. formData2.data = {
  407. transactionTime: moment().format("yyyy-MM-DD HH:mm:ss"),
  408. isTransaction: '0'
  409. };
  410. transferMoneyModal.value = true;
  411. };
  412. const modalType = ref("add");
  413. const dialogVisible = ref(false);
  414. const loadingDialog = ref(false);
  415. const submit = ref(null);
  416. const formOption = reactive({
  417. inline: true,
  418. labelWidth: 100,
  419. itemWidth: 100,
  420. rules: [],
  421. });
  422. const formData = reactive({
  423. data: {
  424. isTransaction:'1',
  425. },
  426. });
  427. const formData2 = reactive({
  428. data: {},
  429. });
  430. const transferMoneyConfig = computed(() => {
  431. return [
  432. {
  433. label: "转出信息",
  434. },
  435. {
  436. type: "select",
  437. prop: "accountManagementId",
  438. label: "转出账户",
  439. data: accountList.value,
  440. },
  441. {
  442. type: 'selectInput',
  443. label: '转出金额',
  444. prop: "amount",
  445. itemWidth: 60,
  446. data: accountCurrency.value,
  447. placeholder: '请输入',
  448. selectPlaceholder: '币种',
  449. selectProp: 'currency',
  450. fn: (value) => {
  451. //判断value的类型
  452. if(isNaN(value)){
  453. formData2.data.inCurrency = formData2.data.currency
  454. formData2.data.commissionCurrency = formData2.data.currency
  455. }else{
  456. if (value != '') {
  457. if (value.indexOf('.') > -1) {
  458. formData2.data.amount = value.slice(0, value.indexOf('.') + 3)
  459. } else {
  460. formData2.data.amount = value
  461. }
  462. }
  463. formData2.data.inAmount = formData2.data.amount
  464. }
  465. },
  466. },
  467. {
  468. type: "date",
  469. prop: "transactionTime",
  470. label: "转出时间",
  471. itemType: "datetime",
  472. },
  473. {
  474. label: "转入信息",
  475. },
  476. {
  477. type: "select",
  478. prop: "inAccountManagementId",
  479. label: "转入账户",
  480. data: accountList.value,
  481. },
  482. {
  483. type: 'selectInput',
  484. label: '转入金额',
  485. prop: "inAmount",
  486. itemWidth: 60,
  487. data: accountCurrency.value,
  488. placeholder: '请输入',
  489. selectPlaceholder: '币种',
  490. selectProp: 'inCurrency',
  491. },
  492. {
  493. label: "其他信息",
  494. },
  495. {
  496. type: "radio",
  497. prop: "isTransaction",
  498. label: "是否往来",
  499. data: [
  500. {
  501. label: "是",
  502. value: '1',
  503. },
  504. {
  505. label: "否",
  506. value: '0',
  507. },
  508. ],
  509. },
  510. {
  511. type: 'selectInput',
  512. label: '手续费',
  513. prop: "commissionAmount",
  514. itemWidth: 60,
  515. data: accountCurrency.value,
  516. placeholder: '请输入',
  517. selectPlaceholder: '币种',
  518. selectProp: 'commissionCurrency',
  519. },
  520. {
  521. type: "input",
  522. prop: "remarks",
  523. label: "摘要",
  524. itemType: "textarea",
  525. },
  526. ];
  527. });
  528. const formConfig = computed(() => {
  529. return [
  530. {
  531. label: "账户信息",
  532. },
  533. {
  534. type: "select",
  535. prop: "accountManagementId",
  536. label: "选择账户",
  537. data: accountList.value,
  538. },
  539. {
  540. label: "交易信息",
  541. },
  542. {
  543. type: "slot",
  544. prop: "transactionTime",
  545. slotName: "transactionTime",
  546. label: "交易时间",
  547. },
  548. {
  549. type: "slot",
  550. prop: "money",
  551. slotName: "money",
  552. label: "交易金额",
  553. },
  554. formData.data.status == "10"
  555. ? {
  556. type: "slot",
  557. prop: "received",
  558. slotName: "received",
  559. label: "合同到账",
  560. }
  561. : {},
  562. // sysUserMenu/list
  563. //单选框
  564. {
  565. type: "radio",
  566. prop: "isTransaction",
  567. label: "是否往来",
  568. data: [
  569. {
  570. label: "是",
  571. value: 1,
  572. },
  573. {
  574. label: "否",
  575. value: 0,
  576. },
  577. ],
  578. fn: (val) => {
  579. formData.data.transactionDeptId = ''
  580. formData.data.deptType = "";
  581. formConfig.value[7].data = transactionDepartmentData.value
  582. },
  583. },
  584. {
  585. type: "select",
  586. prop: "transactionDeptId",
  587. label: "往来单位",
  588. data: [],
  589. isShow: formData.data.isTransaction == 1,
  590. fn: (val) => {
  591. if (val) {
  592. let list = transactionDepartmentData.value.filter((item) => item.id === val);
  593. if (list && list.length > 0) {
  594. formData.data.deptType = list[0].deptType;
  595. } else {
  596. formData.data.deptType = "";
  597. }
  598. } else {
  599. formData.data.deptType = "";
  600. }
  601. },
  602. },
  603. {
  604. type: "input",
  605. prop: "name",
  606. label: "账户名称",
  607. itemType: "text",
  608. },
  609. {
  610. type: "input",
  611. prop: "openingBank",
  612. label: "开户银行",
  613. itemType: "text",
  614. },
  615. {
  616. type: "input",
  617. prop: "accountOpening",
  618. label: "银行账号",
  619. itemType: "text",
  620. },
  621. {
  622. label: "对方信息",
  623. },
  624. {
  625. type: "select",
  626. prop: "otherId",
  627. label: "对方名称",
  628. data: [
  629. {
  630. label: "客户",
  631. value: "10",
  632. },
  633. {
  634. label: "供应商",
  635. value: "20",
  636. },
  637. {
  638. label: "其他",
  639. value: "30",
  640. },
  641. ],
  642. },
  643. {
  644. type: "input",
  645. prop: "name",
  646. label: "账户名称",
  647. itemType: "text",
  648. },
  649. {
  650. type: "input",
  651. prop: "openingBank",
  652. label: "开户银行",
  653. itemType: "text",
  654. },
  655. {
  656. type: "input",
  657. prop: "accountOpening",
  658. label: "银行账号",
  659. itemType: "text",
  660. },
  661. {
  662. label: "其他信息",
  663. },
  664. {
  665. type: "input",
  666. prop: "remarks",
  667. label: "摘要",
  668. itemType: "textarea",
  669. },
  670. ];
  671. });
  672. const validatePass = (rule, value, callback) => {
  673. console.log(formData2.data.currency);
  674. if (!formData2.data.currency) {
  675. callback(new Error("请输入金额和选择币种"));
  676. } else {
  677. callback();
  678. }
  679. };
  680. const validatePass2 = (rule, value, callback) => {
  681. if (!formData2.data.inCurrency) {
  682. callback(new Error("请输入金额和选择币种"));
  683. } else {
  684. callback();
  685. }
  686. };
  687. const rules = ref({
  688. accountManagementId: [{ required: true, message: "请选择账户", trigger: "change" }],
  689. transactionTime: [{ required: true, message: "请选择交易时间", trigger: "change" }],
  690. status: [{ required: true, message: "请选择收支类型", trigger: "change" }],
  691. currency: [{ required: true, message: "请选择币种", trigger: "change" }],
  692. received: [{ required: true, message: "请选择合同是否到账", trigger: "change" }],
  693. inAccountManagementId: [{ required: true, message: "请选择账户", trigger: "change" }],
  694. inAmount: [{ required: true, message: "请输入金额和选择币种", trigger: "blur" }, { required: true, validator: validatePass2, trigger: "blur" }],
  695. isTransaction: [{ required: true, message: "请选择是否往来", trigger: "change" }],
  696. transactionDeptId: [{ required: true, message: "请选择往来单位", trigger: "change" }],
  697. amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
  698. });
  699. const rules2 = ref({
  700. accountManagementId: [{ required: true, message: "请选择账户", trigger: "change" }],
  701. transactionTime: [{ required: true, message: "请选择交易时间", trigger: "change" }],
  702. status: [{ required: true, message: "请选择收支类型", trigger: "change" }],
  703. currency: [{ required: true, message: "请选择币种", trigger: "change" }],
  704. received: [{ required: true, message: "请选择合同是否到账", trigger: "change" }],
  705. inAccountManagementId: [{ required: true, message: "请选择账户", trigger: "change" }],
  706. inAmount: [{ required: true, message: "请输入金额和选择币种", trigger: "blur" }, { required: true, validator: validatePass2, trigger: "blur" }],
  707. isTransaction: [{ required: true, message: "请选择是否往来", trigger: "change" }],
  708. transactionDeptId: [{ required: true, message: "请选择往来单位", trigger: "change" }],
  709. amount: [{ required: true, message: "请输入金额和选择币种", trigger: "blur" }, { required: true, validator: validatePass, trigger: "blur" }]
  710. });
  711. const openModal = (val) => {
  712. modalType.value = val;
  713. formData.data = {
  714. transactionTime: moment().format("yyyy-MM-DD HH:mm:ss"),
  715. };
  716. console.log(formConfig.value);
  717. loadingDialog.value = false;
  718. dialogVisible.value = true;
  719. };
  720. const transactionDepartmentData = ref([])
  721. const getTransactionDepartment = () => {
  722. return proxy
  723. .get("transactionDepartment/list?pageNum=1&pageSize=999", {})
  724. .then((res) => {
  725. transactionDepartmentData.value = res.data.map((item) => {
  726. return {
  727. label: item.name,
  728. value: item.id,
  729. };
  730. });
  731. formConfig.value[7].data = transactionDepartmentData.value
  732. formConfig.value = {...formConfig.value}
  733. });
  734. };
  735. getTransactionDepartment()
  736. const changeStatus = () => {
  737. formData.data.received = "";
  738. };
  739. const transferMoneySubmit = ref(null);
  740. const submitForm2 = () => {
  741. transferMoneySubmit.value.handleSubmit(() => {
  742. console.log(formData2.data)
  743. loadingDialog.value = true;
  744. proxy.post("/accountRunningWater/internalTransfer", {...formData2.data}).then(
  745. () => {
  746. ElMessage({
  747. message: modalType.value == "add" ? "转账成功" : "转账成功",
  748. type: "success",
  749. });
  750. transferMoneyModal.value = false;
  751. getList();
  752. },
  753. (err) => {
  754. console.log(err);
  755. loadingDialog.value = false;
  756. }
  757. );
  758. });
  759. };
  760. const submitForm = () => {
  761. submit.value.handleSubmit(() => {
  762. if (!formData.data.amount || Number(formData.data.amount) == 0) {
  763. return ElMessage("交易金额不能为0");
  764. }
  765. loadingDialog.value = true;
  766. proxy.post("/accountRunningWater/" + modalType.value, formData.data).then(
  767. () => {
  768. ElMessage({
  769. message: modalType.value == "add" ? "添加成功" : "编辑成功",
  770. type: "success",
  771. });
  772. dialogVisible.value = false;
  773. getList();
  774. },
  775. (err) => {
  776. console.log(err);
  777. loadingDialog.value = false;
  778. }
  779. );
  780. });
  781. };
  782. const update = (row) => {
  783. modalType.value = "edit";
  784. loadingDialog.value = true;
  785. proxy.post("/accountRunningWater/detail", { id: row.id }).then((res) => {
  786. formData.data = res;
  787. loadingDialog.value = false;
  788. getTransactionDepartment()
  789. });
  790. dialogVisible.value = true;
  791. };
  792. const deriveExcel = () => {
  793. let queryParams = proxy.deepClone(sourceList.value.pagination);
  794. queryParams.pageNum = 1;
  795. queryParams.pageSize = 9999;
  796. proxy.postTwo("/accountRunningWater/exportExcel", queryParams).then((res) => {
  797. exportData(res, "资金流水.xlsx");
  798. });
  799. };
  800. const exportData = (res, name) => {
  801. const content = res;
  802. const blob = new Blob([content], { type: "application/ms-excel" });
  803. const fileName = name;
  804. if ("download" in document.createElement("a")) {
  805. // 非IE下载
  806. const elink = document.createElement("a");
  807. elink.download = fileName;
  808. elink.style.display = "none";
  809. elink.href = URL.createObjectURL(blob);
  810. document.body.appendChild(elink);
  811. elink.click();
  812. URL.revokeObjectURL(elink.href); // 释放URL 对象
  813. document.body.removeChild(elink);
  814. } else {
  815. navigator.msSaveBlob(blob, fileName);
  816. }
  817. };
  818. const openSearch = ref(false);
  819. const formSearchConfig = computed(() => {
  820. return [
  821. {
  822. type: "select",
  823. prop: "accountManagementId",
  824. label: "资金账户",
  825. data: accountList.value,
  826. clearable: true,
  827. },
  828. {
  829. type: "select",
  830. prop: "status",
  831. label: "交易类型",
  832. data: status.value,
  833. itemWidth: 50,
  834. clearable: true,
  835. },
  836. {
  837. type: "select",
  838. prop: "received",
  839. label: "是否合同到账",
  840. data: received.value,
  841. itemWidth: 50,
  842. clearable: true,
  843. },
  844. {
  845. type: "select",
  846. prop: "currency",
  847. label: "币种",
  848. data: accountCurrency.value,
  849. clearable: true,
  850. },
  851. {
  852. type: "slot",
  853. slotName: "money",
  854. label: "交易金额",
  855. },
  856. {
  857. type: "slot",
  858. slotName: "time",
  859. label: "交易时间",
  860. },
  861. {
  862. type: "input",
  863. prop: "remarks",
  864. label: "摘要",
  865. itemType: "text",
  866. },
  867. ];
  868. });
  869. let copySearch = ref({});
  870. const moreSearch = () => {
  871. copySearch.value = proxy.deepClone(sourceList.value.pagination);
  872. openSearch.value = true;
  873. };
  874. const cancelSearch = () => {
  875. sourceList.value.pagination = copySearch.value;
  876. openSearch.value = false;
  877. };
  878. const submitSearch = () => {
  879. if (
  880. sourceList.value.pagination.beginAmount &&
  881. sourceList.value.pagination.endAmount &&
  882. Number(sourceList.value.pagination.beginAmount) > Number(sourceList.value.pagination.endAmount)
  883. ) {
  884. return ElMessage("交易金额输入错误");
  885. }
  886. if (
  887. sourceList.value.pagination.startTime &&
  888. sourceList.value.pagination.stopTime &&
  889. sourceList.value.pagination.startTime > sourceList.value.pagination.stopTime
  890. ) {
  891. return ElMessage("开始时间不能大于结束时间");
  892. }
  893. openSearch.value = false;
  894. sourceList.value.pagination.keyword = '';
  895. sourceList.value.pagination.pageNum = 1;
  896. getList();
  897. };
  898. const openPrint = ref(false);
  899. const rowData = ref({});
  900. const openDetails = (val) => {
  901. rowData.value = {
  902. code: val,
  903. };
  904. openPrint.value = true;
  905. };
  906. const printObj = ref({
  907. id: "printMe",
  908. popTitle: "",
  909. extraCss: "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",
  910. extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
  911. });
  912. const clickDownload = () => {
  913. proxy.getPdf("外销合同PDF文件");
  914. };
  915. </script>
  916. <style lang="scss" scoped>
  917. .tenant {
  918. padding: 20px;
  919. }
  920. ::v-deep(.el-input-number .el-input__inner) {
  921. text-align: left;
  922. }
  923. </style>