index.vue 29 KB

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