index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095
  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. transferMoneyModal.value = true;
  471. };
  472. const formData2 = reactive({
  473. data: {},
  474. });
  475. const transferMoneyConfig = computed(() => {
  476. return [
  477. {
  478. label: "转出信息",
  479. },
  480. {
  481. type: "select",
  482. prop: "accountManagementId",
  483. label: "转出账户",
  484. data: accountList.value,
  485. },
  486. {
  487. type: 'selectInput',
  488. label: '转出金额',
  489. prop: "amount",
  490. itemWidth: 60,
  491. data: accountCurrency.value,
  492. placeholder: '请输入',
  493. selectPlaceholder: '币种',
  494. selectProp: 'currency',
  495. fn: (value) => {
  496. if (value != '') {
  497. if (value.indexOf('.') > -1) {
  498. formData2.data.amount = value.slice(0, value.indexOf('.') + 3)
  499. } else {
  500. formData2.data.amount = value
  501. }
  502. }
  503. formData2.data.inAmount = formData2.data.amount
  504. },
  505. },
  506. {
  507. type: "date",
  508. prop: "transactionTime",
  509. label: "转出时间",
  510. itemType: "datetime",
  511. },
  512. {
  513. label: "转入信息",
  514. },
  515. {
  516. type: "select",
  517. prop: "inAccountManagementId",
  518. label: "转入账户",
  519. data: accountList.value,
  520. },
  521. {
  522. type: 'selectInput',
  523. label: '转入金额',
  524. prop: "inAmount",
  525. itemWidth: 60,
  526. data: accountCurrency.value,
  527. placeholder: '请输入',
  528. selectPlaceholder: '币种',
  529. selectProp: 'inCurrency',
  530. },
  531. {
  532. label: "其他信息",
  533. },
  534. {
  535. type: 'selectInput',
  536. label: '手续费',
  537. prop: "commissionAmount",
  538. itemWidth: 60,
  539. data: accountCurrency.value,
  540. placeholder: '请输入',
  541. selectPlaceholder: '币种',
  542. selectProp: 'commissionCurrency',
  543. },
  544. {
  545. type: "input",
  546. prop: "remarks",
  547. label: "摘要",
  548. itemType: "textarea",
  549. },
  550. ];
  551. });
  552. const transferMoneySubmit = ref(null);
  553. const submitForm2 = () => {
  554. transferMoneySubmit.value.handleSubmit(() => {
  555. loadingDialog.value = true;
  556. proxy.post("/accountRunningWater/internalTransfer", formData2.data).then(
  557. () => {
  558. ElMessage({
  559. message: modalType.value == "add" ? "转账成功" : "转账成功",
  560. type: "success",
  561. });
  562. transferMoneyModal.value = false;
  563. getList();
  564. },
  565. (err) => {
  566. console.log(err);
  567. loadingDialog.value = false;
  568. }
  569. );
  570. });
  571. };
  572. const getCurrency = () => {
  573. return proxy
  574. .post("/dictTenantData/page", {
  575. pageNum: 1,
  576. pageSize: 999,
  577. dictCode: "account_currency",
  578. tenantId: useUserStore().user.tenantId,
  579. })
  580. .then((res) => {
  581. if (res.rows && res.rows.length > 0) {
  582. accountCurrency.value = res.rows.map((item) => {
  583. return {
  584. label: item.dictValue,
  585. value: item.dictKey,
  586. };
  587. });
  588. sourceList.value.pagination.currency = accountCurrency.value[0].value;
  589. }
  590. });
  591. };
  592. const getAccountList = () => {
  593. return proxy
  594. .post("/accountManagement/page", { pageNum: 1, pageSize: 999 })
  595. .then((res) => {
  596. if (res.rows && res.rows.length > 0) {
  597. accountList.value = res.rows.map((item) => {
  598. return {
  599. label: item.alias,
  600. value: item.id,
  601. };
  602. });
  603. sourceList.value.pagination.accountManagementId =
  604. accountList.value[0].value;
  605. }
  606. });
  607. };
  608. const getDict = () => {
  609. // 关联合同
  610. proxy
  611. .post("/contract/page", { pageNum: 1, pageSize: 9999, status: 30 })
  612. .then((res) => {
  613. contractList.value = res.rows;
  614. });
  615. Promise.all([getCurrency(), getAccountList()]).then(() => {
  616. getList();
  617. });
  618. };
  619. const getList = async (req) => {
  620. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  621. loading.value = true;
  622. proxy
  623. .post("/accountRunningWater/page1", sourceList.value.pagination)
  624. .then((res) => {
  625. sourceList.value.data = res.rows;
  626. sourceList.value.pagination.total = res.total;
  627. setTimeout(() => {
  628. loading.value = false;
  629. }, 200);
  630. });
  631. };
  632. getDict();
  633. const modalType = ref("add");
  634. const dialogVisible = ref(false);
  635. const dialogVisibleOne = ref(false);
  636. const loadingDialog = ref(false);
  637. const submit = ref(null);
  638. const submitOne = ref(null);
  639. const formOption = reactive({
  640. inline: true,
  641. labelWidth: 100,
  642. itemWidth: 100,
  643. rules: [],
  644. });
  645. const formData = reactive({
  646. data: {},
  647. dataOne: {
  648. taxRefundDetailsList: [],
  649. },
  650. });
  651. const formConfig = computed(() => {
  652. return [
  653. {
  654. type: "title",
  655. title: "账户信息",
  656. },
  657. {
  658. type: "select",
  659. prop: "accountManagementId",
  660. label: "选择账户",
  661. data: accountList.value,
  662. },
  663. {
  664. type: "title",
  665. title: "交易信息",
  666. },
  667. {
  668. type: "slot",
  669. prop: "transactionTime",
  670. slotName: "transactionTime",
  671. label: "交易时间",
  672. },
  673. {
  674. type: "slot",
  675. prop: "money",
  676. slotName: "money",
  677. label: "交易金额",
  678. },
  679. formData.data.status == "10"
  680. ? {
  681. type: "slot",
  682. prop: "received",
  683. slotName: "received",
  684. label: "合同到账",
  685. }
  686. : {},
  687. {
  688. type: "radio",
  689. prop: "isTransaction",
  690. label: "是否往来",
  691. data: [
  692. {
  693. label: "是",
  694. value: "1",
  695. },
  696. {
  697. label: "否",
  698. value: "0",
  699. },
  700. ],
  701. fn: (val) => {
  702. formData.data.transactionDeptId = ''
  703. formConfig.value[7].data = transactionDepartmentData.value
  704. },
  705. },
  706. {
  707. type: "select",
  708. prop: "transactionDeptId",
  709. label: "往来单位",
  710. data: [],
  711. isShow: formData.data.isTransaction == "1",
  712. isLoad: {
  713. //链接
  714. url: "transactionDepartment/list?pageNum=1&pageSize=999",
  715. method: "get",
  716. //返回数据的路径默认返回data
  717. resUrl: "data",
  718. //参数
  719. req: {},
  720. //返回数据的key
  721. labelKey: "name",
  722. //返回数据的value
  723. labelVal: "id",
  724. },
  725. fn: (val) => {
  726. console.log(formConfig.value)
  727. },
  728. },
  729. {
  730. type: "title",
  731. title: "对方信息",
  732. },
  733. {
  734. type: "input",
  735. prop: "name",
  736. label: "账户名称",
  737. itemType: "text",
  738. },
  739. {
  740. type: "input",
  741. prop: "openingBank",
  742. label: "开户银行",
  743. itemType: "text",
  744. },
  745. {
  746. type: "input",
  747. prop: "accountOpening",
  748. label: "银行账号",
  749. itemType: "text",
  750. },
  751. {
  752. type: "title",
  753. title: "其他信息",
  754. },
  755. {
  756. type: "input",
  757. prop: "remarks",
  758. label: "摘要",
  759. itemType: "textarea",
  760. },
  761. ];
  762. });
  763. const transactionDepartmentData = ref([])
  764. const getTransactionDepartment = () => {
  765. return proxy
  766. .get("transactionDepartment/list?pageNum=1&pageSize=999", {})
  767. .then((res) => {
  768. transactionDepartmentData.value = res.data.map((item) => {
  769. return {
  770. label: item.name,
  771. value: item.id,
  772. };
  773. });
  774. });
  775. };
  776. getTransactionDepartment()
  777. const formConfigOne = computed(() => {
  778. return [
  779. {
  780. type: "title",
  781. title: "账户信息",
  782. },
  783. {
  784. type: "select",
  785. prop: "accountManagementId",
  786. label: "选择账户",
  787. data: accountList.value,
  788. },
  789. {
  790. type: "title",
  791. title: "退税信息",
  792. },
  793. {
  794. type: "date",
  795. itemType: "datetime",
  796. prop: "transactionTime",
  797. label: "退税时间",
  798. },
  799. {
  800. type: "select",
  801. prop: "currency",
  802. label: "货币类型",
  803. data: accountCurrency.value,
  804. itemWidth: 30,
  805. },
  806. {
  807. type: "number",
  808. prop: "amount",
  809. label: "退税金额",
  810. itemWidth: 70,
  811. precision: 2,
  812. min: 0,
  813. controls: false,
  814. style: {
  815. width: "100%",
  816. },
  817. },
  818. {
  819. type: "title",
  820. title: "对方信息",
  821. },
  822. {
  823. type: "input",
  824. prop: "name",
  825. label: "账户名称",
  826. itemType: "text",
  827. },
  828. {
  829. type: "input",
  830. prop: "openingBank",
  831. label: "开户银行",
  832. itemType: "text",
  833. },
  834. {
  835. type: "input",
  836. prop: "accountOpening",
  837. label: "银行账号",
  838. itemType: "text",
  839. },
  840. {
  841. type: "slot",
  842. slotName: "details",
  843. label: "关联合同",
  844. },
  845. {
  846. type: "title",
  847. title: "其他信息",
  848. },
  849. {
  850. type: "input",
  851. prop: "remarks",
  852. label: "摘要",
  853. itemType: "textarea",
  854. },
  855. ];
  856. });
  857. const validatePass = (rule, value, callback) => {
  858. console.log(formData2.data.currency);
  859. if (!formData2.data.currency) {
  860. callback(new Error("请输入金额和选择币种"));
  861. } else {
  862. callback();
  863. }
  864. };
  865. const validatePass2 = (rule, value, callback) => {
  866. if (!formData2.data.inCurrency) {
  867. callback(new Error("请输入金额和选择币种"));
  868. } else {
  869. callback();
  870. }
  871. };
  872. const rules = ref({
  873. accountManagementId: [
  874. { required: true, message: "请选择账户", trigger: "change" },
  875. ],
  876. transactionTime: [
  877. { required: true, message: "请选择交易时间", trigger: "change" },
  878. ],
  879. status: [{ required: true, message: "请选择收支类型", trigger: "change" }],
  880. currency: [{ required: true, message: "请选择币种", trigger: "change" }],
  881. received: [
  882. { required: true, message: "请选择合同是否到账", trigger: "change" },
  883. ],
  884. amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
  885. inAccountManagementId: [{ required: true, message: "请选择账户", trigger: "change" }],
  886. inAmount: [{ required: true, message: "请输入金额和选择币种", trigger: "blur" }, { required: true, validator: validatePass2, trigger: "blur" }],
  887. isTransaction: [{ required: true, message: "请选择是否往来", trigger: "change" }],
  888. transactionDeptId: [{ required: true, message: "请选择往来单位", trigger: "change" }],
  889. // name: [{ required: true, message: "请输入账户名称", trigger: "blur" }],
  890. // openingBank: [{ required: true, message: "请输入开户银行", trigger: "blur" }],
  891. // accountOpening: [{ required: true, message: "请输入银行账号", trigger: "blur" }],
  892. });
  893. const rules2 = ref({
  894. accountManagementId: [{ required: true, message: "请选择账户", trigger: "change" }],
  895. transactionTime: [{ required: true, message: "请选择交易时间", trigger: "change" }],
  896. status: [{ required: true, message: "请选择收支类型", trigger: "change" }],
  897. currency: [{ required: true, message: "请选择币种", trigger: "change" }],
  898. received: [{ required: true, message: "请选择合同是否到账", trigger: "change" }],
  899. inAccountManagementId: [{ required: true, message: "请选择账户", trigger: "change" }],
  900. inAmount: [{ required: true, message: "请输入金额和选择币种", trigger: "blur" }, { required: true, validator: validatePass2, trigger: "blur" }],
  901. isTransaction: [{ required: true, message: "请选择是否往来", trigger: "change" }],
  902. transactionDeptId: [{ required: true, message: "请选择往来单位", trigger: "change" }],
  903. amount: [{ required: true, message: "请输入金额和选择币种", trigger: "blur" }, { required: true, validator: validatePass, trigger: "blur" }]
  904. });
  905. const rulesOne = ref({
  906. accountManagementId: [
  907. { required: true, message: "请选择账户", trigger: "change" },
  908. ],
  909. transactionTime: [
  910. { required: true, message: "请选择退税时间", trigger: "change" },
  911. ],
  912. currency: [{ required: true, message: "请选择币种", trigger: "change" }],
  913. // amount: [{ required: true, message: "请输入退税金额", trigger: "blur" }],
  914. contractId: [{ required: true, message: "请选择合同", trigger: "change" }],
  915. amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
  916. });
  917. const openModal = (val) => {
  918. modalType.value = val;
  919. formData.data = {
  920. isTransaction:'1',
  921. transactionTime: moment().format("yyyy-MM-DD HH:mm:ss"),
  922. };
  923. loadingDialog.value = false;
  924. dialogVisible.value = true;
  925. };
  926. const openModalOne = () => {
  927. modalType.value = "add";
  928. formData.dataOne = {
  929. transactionTime: moment().format("yyyy-MM-DD HH:mm:ss"),
  930. currency: accountCurrency.value[0].value,
  931. taxRefundDetailsList: [],
  932. };
  933. dialogVisibleOne.value = true;
  934. };
  935. const changeStatus = () => {
  936. formData.data.received = "";
  937. };
  938. const submitForm = () => {
  939. submit.value.handleSubmit(() => {
  940. if (!formData.data.amount || Number(formData.data.amount) == 0) {
  941. return ElMessage("交易金额不能为0");
  942. }
  943. loadingDialog.value = true;
  944. proxy.post("/accountRunningWater/" + modalType.value, formData.data).then(
  945. () => {
  946. ElMessage({
  947. message: modalType.value == "add" ? "添加成功" : "编辑成功",
  948. type: "success",
  949. });
  950. dialogVisible.value = false;
  951. getList();
  952. },
  953. (err) => {
  954. console.log(err);
  955. loadingDialog.value = false;
  956. }
  957. );
  958. });
  959. };
  960. const handleAddRow = () => {
  961. formData.dataOne.taxRefundDetailsList.push({
  962. contractId: "",
  963. amount: null,
  964. });
  965. };
  966. const handleRemove = (index) => {
  967. formData.dataOne.taxRefundDetailsList.splice(index, 1);
  968. };
  969. const submitFormOne = () => {
  970. submitOne.value.handleSubmit(() => {
  971. if (!formData.dataOne.taxRefundDetailsList.length > 0) {
  972. return ElMessage({
  973. message: "请关联合同",
  974. type: "info",
  975. });
  976. }
  977. const submitData = { ...formData.dataOne };
  978. for (let i = 0; i < submitData.taxRefundDetailsList.length; i++) {
  979. const e = submitData.taxRefundDetailsList[i];
  980. if (e.amount === 0) {
  981. return ElMessage({
  982. message: "关联金额不能为0",
  983. type: "info",
  984. });
  985. }
  986. }
  987. let total = submitData.taxRefundDetailsList.reduce(
  988. (sum, crr) => (sum += crr.amount),
  989. 0
  990. );
  991. total = parseFloat(total).toFixed(2);
  992. if (Number(total) !== Number(submitData.amount)) {
  993. return ElMessage({
  994. message: "关联合同明细的关联金额总合必须等于退税金额",
  995. type: "info",
  996. });
  997. }
  998. loadingDialog.value = true;
  999. proxy.post("/accountRunningWater/taxRefund", submitData).then(
  1000. () => {
  1001. ElMessage({
  1002. message: modalType.value == "add" ? "添加成功" : "编辑成功",
  1003. type: "success",
  1004. });
  1005. dialogVisibleOne.value = false;
  1006. loadingDialog.value = false;
  1007. getList();
  1008. },
  1009. (err) => {
  1010. console.log(err);
  1011. loadingDialog.value = false;
  1012. }
  1013. );
  1014. });
  1015. };
  1016. const update = (row) => {
  1017. modalType.value = "edit";
  1018. loadingDialog.value = true;
  1019. proxy.post("/accountRunningWater/detail", { id: row.id }).then((res) => {
  1020. formData.data = res;
  1021. loadingDialog.value = false;
  1022. });
  1023. dialogVisible.value = true;
  1024. };
  1025. const deriveExcel = () => {
  1026. let queryParams = proxy.deepClone(sourceList.value.pagination);
  1027. queryParams.pageNum = 1;
  1028. queryParams.pageSize = 9999;
  1029. proxy.postTwo("/accountRunningWater/exportExcel", queryParams).then((res) => {
  1030. exportData(res, "资金流水.xlsx");
  1031. });
  1032. };
  1033. const exportData = (res, name) => {
  1034. const content = res;
  1035. const blob = new Blob([content], { type: "application/ms-excel" });
  1036. const fileName = name;
  1037. if ("download" in document.createElement("a")) {
  1038. // 非IE下载
  1039. const elink = document.createElement("a");
  1040. elink.download = fileName;
  1041. elink.style.display = "none";
  1042. elink.href = URL.createObjectURL(blob);
  1043. document.body.appendChild(elink);
  1044. elink.click();
  1045. URL.revokeObjectURL(elink.href); // 释放URL 对象
  1046. document.body.removeChild(elink);
  1047. } else {
  1048. navigator.msSaveBlob(blob, fileName);
  1049. }
  1050. };
  1051. const openPrint = ref(false);
  1052. const rowData = ref({});
  1053. const openDetails = (val) => {
  1054. rowData.value = {
  1055. code: val,
  1056. };
  1057. openPrint.value = true;
  1058. };
  1059. const printObj = ref({
  1060. id: "printMe",
  1061. popTitle: "",
  1062. extraCss:
  1063. "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",
  1064. extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
  1065. });
  1066. const clickDownload = () => {
  1067. proxy.getPdf("外销合同PDF文件");
  1068. };
  1069. </script>
  1070. <style lang="scss" scoped>
  1071. .tenant {
  1072. padding: 20px;
  1073. }
  1074. ::v-deep(.el-input-number .el-input__inner) {
  1075. text-align: left;
  1076. }
  1077. </style>