index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896
  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. };
  409. transferMoneyModal.value = true;
  410. };
  411. const modalType = ref("add");
  412. const dialogVisible = ref(false);
  413. const loadingDialog = ref(false);
  414. const submit = ref(null);
  415. const formOption = reactive({
  416. inline: true,
  417. labelWidth: 100,
  418. itemWidth: 100,
  419. rules: [],
  420. });
  421. const formData = reactive({
  422. data: {
  423. isTransaction:'1',
  424. },
  425. });
  426. const formData2 = reactive({
  427. data: {},
  428. });
  429. const transferMoneyConfig = computed(() => {
  430. return [
  431. {
  432. label: "转出信息",
  433. },
  434. {
  435. type: "select",
  436. prop: "accountManagementId",
  437. label: "转出账户",
  438. data: accountList.value,
  439. },
  440. {
  441. type: 'selectInput',
  442. label: '转出金额',
  443. prop: "amount",
  444. itemWidth: 60,
  445. data: accountCurrency.value,
  446. placeholder: '请输入',
  447. selectPlaceholder: '币种',
  448. selectProp: 'currency',
  449. fn: (value) => {
  450. if (value != '') {
  451. if (value.indexOf('.') > -1) {
  452. formData2.data.amount = value.slice(0, value.indexOf('.') + 3)
  453. } else {
  454. formData2.data.amount = value
  455. }
  456. }
  457. formData2.data.inAmount = formData2.data.amount
  458. },
  459. },
  460. {
  461. type: "date",
  462. prop: "transactionTime",
  463. label: "转出时间",
  464. itemType: "datetime",
  465. },
  466. {
  467. label: "转入信息",
  468. },
  469. {
  470. type: "select",
  471. prop: "inAccountManagementId",
  472. label: "转入账户",
  473. data: accountList.value,
  474. },
  475. {
  476. type: 'selectInput',
  477. label: '转入金额',
  478. prop: "inAmount",
  479. itemWidth: 60,
  480. data: accountCurrency.value,
  481. placeholder: '请输入',
  482. selectPlaceholder: '币种',
  483. selectProp: 'inCurrency',
  484. },
  485. {
  486. label: "其他信息",
  487. },
  488. {
  489. type: 'selectInput',
  490. label: '手续费',
  491. prop: "commissionAmount",
  492. itemWidth: 60,
  493. data: accountCurrency.value,
  494. placeholder: '请输入',
  495. selectPlaceholder: '币种',
  496. selectProp: 'commissionCurrency',
  497. },
  498. {
  499. type: "input",
  500. prop: "remarks",
  501. label: "摘要",
  502. itemType: "textarea",
  503. },
  504. ];
  505. });
  506. const formConfig = computed(() => {
  507. return [
  508. {
  509. label: "账户信息",
  510. },
  511. {
  512. type: "select",
  513. prop: "accountManagementId",
  514. label: "选择账户",
  515. data: accountList.value,
  516. },
  517. {
  518. label: "交易信息",
  519. },
  520. {
  521. type: "slot",
  522. prop: "transactionTime",
  523. slotName: "transactionTime",
  524. label: "交易时间",
  525. },
  526. {
  527. type: "slot",
  528. prop: "money",
  529. slotName: "money",
  530. label: "交易金额",
  531. },
  532. formData.data.status == "10"
  533. ? {
  534. type: "slot",
  535. prop: "received",
  536. slotName: "received",
  537. label: "合同到账",
  538. }
  539. : {},
  540. // sysUserMenu/list
  541. //单选框
  542. {
  543. type: "radio",
  544. prop: "isTransaction",
  545. label: "是否往来",
  546. data: [
  547. {
  548. label: "是",
  549. value: 1,
  550. },
  551. {
  552. label: "否",
  553. value: 0,
  554. },
  555. ],
  556. fn: (val) => {
  557. formData.data.transactionDeptId = ''
  558. formConfig.value[7].data = transactionDepartmentData.value
  559. },
  560. },
  561. {
  562. type: "select",
  563. prop: "transactionDeptId",
  564. label: "往来单位",
  565. data: [],
  566. isShow: formData.data.isTransaction == 1,
  567. },
  568. {
  569. type: "input",
  570. prop: "name",
  571. label: "账户名称",
  572. itemType: "text",
  573. },
  574. {
  575. type: "input",
  576. prop: "openingBank",
  577. label: "开户银行",
  578. itemType: "text",
  579. },
  580. {
  581. type: "input",
  582. prop: "accountOpening",
  583. label: "银行账号",
  584. itemType: "text",
  585. },
  586. {
  587. label: "对方信息",
  588. },
  589. {
  590. type: "select",
  591. prop: "otherId",
  592. label: "对方名称",
  593. data: [
  594. {
  595. label: "客户",
  596. value: "10",
  597. },
  598. {
  599. label: "供应商",
  600. value: "20",
  601. },
  602. {
  603. label: "其他",
  604. value: "30",
  605. },
  606. ],
  607. },
  608. {
  609. type: "input",
  610. prop: "name",
  611. label: "账户名称",
  612. itemType: "text",
  613. },
  614. {
  615. type: "input",
  616. prop: "openingBank",
  617. label: "开户银行",
  618. itemType: "text",
  619. },
  620. {
  621. type: "input",
  622. prop: "accountOpening",
  623. label: "银行账号",
  624. itemType: "text",
  625. },
  626. {
  627. label: "其他信息",
  628. },
  629. {
  630. type: "input",
  631. prop: "remarks",
  632. label: "摘要",
  633. itemType: "textarea",
  634. },
  635. ];
  636. });
  637. const validatePass = (rule, value, callback) => {
  638. console.log(formData2.data.currency);
  639. if (!formData2.data.currency) {
  640. callback(new Error("请输入金额和选择币种"));
  641. } else {
  642. callback();
  643. }
  644. };
  645. const validatePass2 = (rule, value, callback) => {
  646. if (!formData2.data.inCurrency) {
  647. callback(new Error("请输入金额和选择币种"));
  648. } else {
  649. callback();
  650. }
  651. };
  652. const rules = ref({
  653. accountManagementId: [{ required: true, message: "请选择账户", trigger: "change" }],
  654. transactionTime: [{ required: true, message: "请选择交易时间", trigger: "change" }],
  655. status: [{ required: true, message: "请选择收支类型", trigger: "change" }],
  656. currency: [{ required: true, message: "请选择币种", trigger: "change" }],
  657. received: [{ required: true, message: "请选择合同是否到账", trigger: "change" }],
  658. inAccountManagementId: [{ required: true, message: "请选择账户", trigger: "change" }],
  659. inAmount: [{ required: true, message: "请输入金额和选择币种", trigger: "blur" }, { required: true, validator: validatePass2, trigger: "blur" }],
  660. isTransaction: [{ required: true, message: "请选择是否往来", trigger: "change" }],
  661. transactionDeptId: [{ required: true, message: "请选择往来单位", trigger: "change" }],
  662. amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
  663. });
  664. const rules2 = ref({
  665. accountManagementId: [{ required: true, message: "请选择账户", trigger: "change" }],
  666. transactionTime: [{ required: true, message: "请选择交易时间", trigger: "change" }],
  667. status: [{ required: true, message: "请选择收支类型", trigger: "change" }],
  668. currency: [{ required: true, message: "请选择币种", trigger: "change" }],
  669. received: [{ required: true, message: "请选择合同是否到账", trigger: "change" }],
  670. inAccountManagementId: [{ required: true, message: "请选择账户", trigger: "change" }],
  671. inAmount: [{ required: true, message: "请输入金额和选择币种", trigger: "blur" }, { required: true, validator: validatePass2, trigger: "blur" }],
  672. isTransaction: [{ required: true, message: "请选择是否往来", trigger: "change" }],
  673. transactionDeptId: [{ required: true, message: "请选择往来单位", trigger: "change" }],
  674. amount: [{ required: true, message: "请输入金额和选择币种", trigger: "blur" }, { required: true, validator: validatePass, trigger: "blur" }]
  675. });
  676. const openModal = (val) => {
  677. modalType.value = val;
  678. formData.data = {
  679. transactionTime: moment().format("yyyy-MM-DD HH:mm:ss"),
  680. };
  681. console.log(formConfig.value);
  682. loadingDialog.value = false;
  683. dialogVisible.value = true;
  684. };
  685. const transactionDepartmentData = ref([])
  686. const getTransactionDepartment = () => {
  687. return proxy
  688. .get("transactionDepartment/list?pageNum=1&pageSize=999", {})
  689. .then((res) => {
  690. transactionDepartmentData.value = res.data.map((item) => {
  691. return {
  692. label: item.name,
  693. value: item.id,
  694. };
  695. });
  696. });
  697. };
  698. getTransactionDepartment()
  699. const changeStatus = () => {
  700. formData.data.received = "";
  701. };
  702. const transferMoneySubmit = ref(null);
  703. const submitForm2 = () => {
  704. transferMoneySubmit.value.handleSubmit(() => {
  705. console.log(formData2.data)
  706. loadingDialog.value = true;
  707. proxy.post("/accountRunningWater/internalTransfer", {...formData2.data}).then(
  708. () => {
  709. ElMessage({
  710. message: modalType.value == "add" ? "转账成功" : "转账成功",
  711. type: "success",
  712. });
  713. transferMoneyModal.value = false;
  714. getList();
  715. },
  716. (err) => {
  717. console.log(err);
  718. loadingDialog.value = false;
  719. }
  720. );
  721. });
  722. };
  723. const submitForm = () => {
  724. submit.value.handleSubmit(() => {
  725. if (!formData.data.amount || Number(formData.data.amount) == 0) {
  726. return ElMessage("交易金额不能为0");
  727. }
  728. loadingDialog.value = true;
  729. proxy.post("/accountRunningWater/" + modalType.value, formData.data).then(
  730. () => {
  731. ElMessage({
  732. message: modalType.value == "add" ? "添加成功" : "编辑成功",
  733. type: "success",
  734. });
  735. dialogVisible.value = false;
  736. getList();
  737. },
  738. (err) => {
  739. console.log(err);
  740. loadingDialog.value = false;
  741. }
  742. );
  743. });
  744. };
  745. const update = (row) => {
  746. modalType.value = "edit";
  747. loadingDialog.value = true;
  748. proxy.post("/accountRunningWater/detail", { id: row.id }).then((res) => {
  749. formData.data = res;
  750. loadingDialog.value = false;
  751. });
  752. dialogVisible.value = true;
  753. };
  754. const deriveExcel = () => {
  755. let queryParams = proxy.deepClone(sourceList.value.pagination);
  756. queryParams.pageNum = 1;
  757. queryParams.pageSize = 9999;
  758. proxy.postTwo("/accountRunningWater/exportExcel", queryParams).then((res) => {
  759. exportData(res, "资金流水.xlsx");
  760. });
  761. };
  762. const exportData = (res, name) => {
  763. const content = res;
  764. const blob = new Blob([content], { type: "application/ms-excel" });
  765. const fileName = name;
  766. if ("download" in document.createElement("a")) {
  767. // 非IE下载
  768. const elink = document.createElement("a");
  769. elink.download = fileName;
  770. elink.style.display = "none";
  771. elink.href = URL.createObjectURL(blob);
  772. document.body.appendChild(elink);
  773. elink.click();
  774. URL.revokeObjectURL(elink.href); // 释放URL 对象
  775. document.body.removeChild(elink);
  776. } else {
  777. navigator.msSaveBlob(blob, fileName);
  778. }
  779. };
  780. const openSearch = ref(false);
  781. const formSearchConfig = computed(() => {
  782. return [
  783. {
  784. type: "select",
  785. prop: "accountManagementId",
  786. label: "资金账户",
  787. data: accountList.value,
  788. clearable: true,
  789. },
  790. {
  791. type: "select",
  792. prop: "status",
  793. label: "交易类型",
  794. data: status.value,
  795. itemWidth: 50,
  796. clearable: true,
  797. },
  798. {
  799. type: "select",
  800. prop: "received",
  801. label: "是否合同到账",
  802. data: received.value,
  803. itemWidth: 50,
  804. clearable: true,
  805. },
  806. {
  807. type: "select",
  808. prop: "currency",
  809. label: "币种",
  810. data: accountCurrency.value,
  811. clearable: true,
  812. },
  813. {
  814. type: "slot",
  815. slotName: "money",
  816. label: "交易金额",
  817. },
  818. {
  819. type: "slot",
  820. slotName: "time",
  821. label: "交易时间",
  822. },
  823. {
  824. type: "input",
  825. prop: "remarks",
  826. label: "摘要",
  827. itemType: "text",
  828. },
  829. ];
  830. });
  831. let copySearch = ref({});
  832. const moreSearch = () => {
  833. copySearch.value = proxy.deepClone(sourceList.value.pagination);
  834. openSearch.value = true;
  835. };
  836. const cancelSearch = () => {
  837. sourceList.value.pagination = copySearch.value;
  838. openSearch.value = false;
  839. };
  840. const submitSearch = () => {
  841. if (
  842. sourceList.value.pagination.beginAmount &&
  843. sourceList.value.pagination.endAmount &&
  844. Number(sourceList.value.pagination.beginAmount) > Number(sourceList.value.pagination.endAmount)
  845. ) {
  846. return ElMessage("交易金额输入错误");
  847. }
  848. if (
  849. sourceList.value.pagination.startTime &&
  850. sourceList.value.pagination.stopTime &&
  851. sourceList.value.pagination.startTime > sourceList.value.pagination.stopTime
  852. ) {
  853. return ElMessage("开始时间不能大于结束时间");
  854. }
  855. openSearch.value = false;
  856. sourceList.value.pagination.keyword = '';
  857. sourceList.value.pagination.pageNum = 1;
  858. getList();
  859. };
  860. const openPrint = ref(false);
  861. const rowData = ref({});
  862. const openDetails = (val) => {
  863. rowData.value = {
  864. code: val,
  865. };
  866. openPrint.value = true;
  867. };
  868. const printObj = ref({
  869. id: "printMe",
  870. popTitle: "",
  871. 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",
  872. extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
  873. });
  874. const clickDownload = () => {
  875. proxy.getPdf("外销合同PDF文件");
  876. };
  877. </script>
  878. <style lang="scss" scoped>
  879. .tenant {
  880. padding: 20px;
  881. }
  882. ::v-deep(.el-input-number .el-input__inner) {
  883. text-align: left;
  884. }
  885. </style>