index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941
  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. console.log(transactionDepartmentData.value);
  593. let list = transactionDepartmentData.value.filter((item) => {
  594. if(item.value == val) return item
  595. });
  596. console.log(list);
  597. if (list && list.length > 0) {
  598. formData.data.deptType = list[0].deptType;
  599. } else {
  600. formData.data.deptType = "";
  601. }
  602. } else {
  603. formData.data.deptType = "";
  604. }
  605. },
  606. },
  607. {
  608. type: "input",
  609. prop: "name",
  610. label: "账户名称",
  611. itemType: "text",
  612. },
  613. {
  614. type: "input",
  615. prop: "openingBank",
  616. label: "开户银行",
  617. itemType: "text",
  618. },
  619. {
  620. type: "input",
  621. prop: "accountOpening",
  622. label: "银行账号",
  623. itemType: "text",
  624. },
  625. {
  626. label: "对方信息",
  627. },
  628. {
  629. type: "select",
  630. prop: "otherId",
  631. label: "对方名称",
  632. data: [
  633. {
  634. label: "客户",
  635. value: "10",
  636. },
  637. {
  638. label: "供应商",
  639. value: "20",
  640. },
  641. {
  642. label: "其他",
  643. value: "30",
  644. },
  645. ],
  646. },
  647. {
  648. type: "input",
  649. prop: "name",
  650. label: "账户名称",
  651. itemType: "text",
  652. },
  653. {
  654. type: "input",
  655. prop: "openingBank",
  656. label: "开户银行",
  657. itemType: "text",
  658. },
  659. {
  660. type: "input",
  661. prop: "accountOpening",
  662. label: "银行账号",
  663. itemType: "text",
  664. },
  665. {
  666. label: "其他信息",
  667. },
  668. {
  669. type: "input",
  670. prop: "remarks",
  671. label: "摘要",
  672. itemType: "textarea",
  673. },
  674. ];
  675. });
  676. const validatePass = (rule, value, callback) => {
  677. console.log(formData2.data.currency);
  678. if (!formData2.data.currency) {
  679. callback(new Error("请输入金额和选择币种"));
  680. } else {
  681. callback();
  682. }
  683. };
  684. const validatePass2 = (rule, value, callback) => {
  685. if (!formData2.data.inCurrency) {
  686. callback(new Error("请输入金额和选择币种"));
  687. } else {
  688. callback();
  689. }
  690. };
  691. const rules = ref({
  692. accountManagementId: [{ required: true, message: "请选择账户", trigger: "change" }],
  693. transactionTime: [{ required: true, message: "请选择交易时间", trigger: "change" }],
  694. status: [{ required: true, message: "请选择收支类型", trigger: "change" }],
  695. currency: [{ required: true, message: "请选择币种", trigger: "change" }],
  696. received: [{ required: true, message: "请选择合同是否到账", trigger: "change" }],
  697. inAccountManagementId: [{ required: true, message: "请选择账户", trigger: "change" }],
  698. inAmount: [{ required: true, message: "请输入金额和选择币种", trigger: "blur" }, { required: true, validator: validatePass2, trigger: "blur" }],
  699. isTransaction: [{ required: true, message: "请选择是否往来", trigger: "change" }],
  700. transactionDeptId: [{ required: true, message: "请选择往来单位", trigger: "change" }],
  701. amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
  702. });
  703. const rules2 = ref({
  704. accountManagementId: [{ required: true, message: "请选择账户", trigger: "change" }],
  705. transactionTime: [{ required: true, message: "请选择交易时间", trigger: "change" }],
  706. status: [{ required: true, message: "请选择收支类型", trigger: "change" }],
  707. currency: [{ required: true, message: "请选择币种", trigger: "change" }],
  708. received: [{ required: true, message: "请选择合同是否到账", trigger: "change" }],
  709. inAccountManagementId: [{ required: true, message: "请选择账户", trigger: "change" }],
  710. inAmount: [{ required: true, message: "请输入金额和选择币种", trigger: "blur" }, { required: true, validator: validatePass2, trigger: "blur" }],
  711. isTransaction: [{ required: true, message: "请选择是否往来", trigger: "change" }],
  712. transactionDeptId: [{ required: true, message: "请选择往来单位", trigger: "change" }],
  713. amount: [{ required: true, message: "请输入金额和选择币种", trigger: "blur" }, { required: true, validator: validatePass, trigger: "blur" }]
  714. });
  715. const openModal = (val) => {
  716. modalType.value = val;
  717. formData.data = {
  718. transactionTime: moment().format("yyyy-MM-DD HH:mm:ss"),
  719. };
  720. console.log(formConfig.value);
  721. loadingDialog.value = false;
  722. dialogVisible.value = true;
  723. };
  724. const transactionDepartmentData = ref([])
  725. const getTransactionDepartment = () => {
  726. return proxy
  727. .get("transactionDepartment/list?pageNum=1&pageSize=999", {})
  728. .then((res) => {
  729. transactionDepartmentData.value = res.data.map((item) => {
  730. return {
  731. label: item.name,
  732. value: item.id,
  733. deptType: item.deptType,
  734. };
  735. });
  736. formConfig.value[7].data = transactionDepartmentData.value
  737. formConfig.value = {...formConfig.value}
  738. });
  739. };
  740. getTransactionDepartment()
  741. const changeStatus = () => {
  742. formData.data.received = "";
  743. };
  744. const transferMoneySubmit = ref(null);
  745. const submitForm2 = () => {
  746. transferMoneySubmit.value.handleSubmit(() => {
  747. console.log(formData2.data)
  748. loadingDialog.value = true;
  749. proxy.post("/accountRunningWater/internalTransfer", {...formData2.data}).then(
  750. () => {
  751. ElMessage({
  752. message: modalType.value == "add" ? "转账成功" : "转账成功",
  753. type: "success",
  754. });
  755. transferMoneyModal.value = false;
  756. getList();
  757. },
  758. (err) => {
  759. console.log(err);
  760. loadingDialog.value = false;
  761. }
  762. );
  763. });
  764. };
  765. const submitForm = () => {
  766. submit.value.handleSubmit(() => {
  767. if (!formData.data.amount || Number(formData.data.amount) == 0) {
  768. return ElMessage("交易金额不能为0");
  769. }
  770. loadingDialog.value = true;
  771. proxy.post("/accountRunningWater/" + modalType.value, formData.data).then(
  772. () => {
  773. ElMessage({
  774. message: modalType.value == "add" ? "添加成功" : "编辑成功",
  775. type: "success",
  776. });
  777. dialogVisible.value = false;
  778. getList();
  779. },
  780. (err) => {
  781. console.log(err);
  782. loadingDialog.value = false;
  783. }
  784. );
  785. });
  786. };
  787. const update = (row) => {
  788. modalType.value = "edit";
  789. loadingDialog.value = true;
  790. proxy.post("/accountRunningWater/detail", { id: row.id }).then((res) => {
  791. formData.data = res;
  792. loadingDialog.value = false;
  793. getTransactionDepartment()
  794. });
  795. dialogVisible.value = true;
  796. };
  797. const deriveExcel = () => {
  798. let queryParams = proxy.deepClone(sourceList.value.pagination);
  799. queryParams.pageNum = 1;
  800. queryParams.pageSize = 9999;
  801. proxy.postTwo("/accountRunningWater/exportExcel", queryParams).then((res) => {
  802. exportData(res, "资金流水.xlsx");
  803. });
  804. };
  805. const exportData = (res, name) => {
  806. const content = res;
  807. const blob = new Blob([content], { type: "application/ms-excel" });
  808. const fileName = name;
  809. if ("download" in document.createElement("a")) {
  810. // 非IE下载
  811. const elink = document.createElement("a");
  812. elink.download = fileName;
  813. elink.style.display = "none";
  814. elink.href = URL.createObjectURL(blob);
  815. document.body.appendChild(elink);
  816. elink.click();
  817. URL.revokeObjectURL(elink.href); // 释放URL 对象
  818. document.body.removeChild(elink);
  819. } else {
  820. navigator.msSaveBlob(blob, fileName);
  821. }
  822. };
  823. const openSearch = ref(false);
  824. const formSearchConfig = computed(() => {
  825. return [
  826. {
  827. type: "select",
  828. prop: "accountManagementId",
  829. label: "资金账户",
  830. data: accountList.value,
  831. clearable: true,
  832. },
  833. {
  834. type: "select",
  835. prop: "status",
  836. label: "交易类型",
  837. data: status.value,
  838. itemWidth: 50,
  839. clearable: true,
  840. },
  841. {
  842. type: "select",
  843. prop: "received",
  844. label: "是否合同到账",
  845. data: received.value,
  846. itemWidth: 50,
  847. clearable: true,
  848. },
  849. {
  850. type: "select",
  851. prop: "currency",
  852. label: "币种",
  853. data: accountCurrency.value,
  854. clearable: true,
  855. },
  856. {
  857. type: "slot",
  858. slotName: "money",
  859. label: "交易金额",
  860. },
  861. {
  862. type: "slot",
  863. slotName: "time",
  864. label: "交易时间",
  865. },
  866. {
  867. type: "input",
  868. prop: "remarks",
  869. label: "摘要",
  870. itemType: "text",
  871. },
  872. ];
  873. });
  874. let copySearch = ref({});
  875. const moreSearch = () => {
  876. copySearch.value = proxy.deepClone(sourceList.value.pagination);
  877. openSearch.value = true;
  878. };
  879. const cancelSearch = () => {
  880. sourceList.value.pagination = copySearch.value;
  881. openSearch.value = false;
  882. };
  883. const submitSearch = () => {
  884. if (
  885. sourceList.value.pagination.beginAmount &&
  886. sourceList.value.pagination.endAmount &&
  887. Number(sourceList.value.pagination.beginAmount) > Number(sourceList.value.pagination.endAmount)
  888. ) {
  889. return ElMessage("交易金额输入错误");
  890. }
  891. if (
  892. sourceList.value.pagination.startTime &&
  893. sourceList.value.pagination.stopTime &&
  894. sourceList.value.pagination.startTime > sourceList.value.pagination.stopTime
  895. ) {
  896. return ElMessage("开始时间不能大于结束时间");
  897. }
  898. openSearch.value = false;
  899. sourceList.value.pagination.keyword = '';
  900. sourceList.value.pagination.pageNum = 1;
  901. getList();
  902. };
  903. const openPrint = ref(false);
  904. const rowData = ref({});
  905. const openDetails = (val) => {
  906. rowData.value = {
  907. code: val,
  908. };
  909. openPrint.value = true;
  910. };
  911. const printObj = ref({
  912. id: "printMe",
  913. popTitle: "",
  914. 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",
  915. extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
  916. });
  917. const clickDownload = () => {
  918. proxy.getPdf("外销合同PDF文件");
  919. };
  920. </script>
  921. <style lang="scss" scoped>
  922. .tenant {
  923. padding: 20px;
  924. }
  925. ::v-deep(.el-input-number .el-input__inner) {
  926. text-align: left;
  927. }
  928. </style>