kaihe-detail.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822
  1. <template>
  2. <div v-if="showDetail">
  3. <div style="display: flex; justify-content: space-between">
  4. <div style="display: flex; align-items: center">
  5. <el-breadcrumb separator="/">
  6. <el-breadcrumb-item
  7. ><span style="font-weight: 700">对账</span></el-breadcrumb-item
  8. >
  9. <el-breadcrumb-item
  10. ><span style="font-weight: 700"
  11. >对账详情页</span
  12. ></el-breadcrumb-item
  13. >
  14. </el-breadcrumb>
  15. <el-button
  16. style="margin-left: 10px"
  17. size="mini"
  18. icon="el-icon-arrow-left"
  19. @click="cancel"
  20. >返回列表
  21. </el-button>
  22. </div>
  23. <!-- <div v-if="showApproval == 0">
  24. 审核
  25. </div> -->
  26. </div>
  27. <br />
  28. <el-form ref="form" :model="form" label-width="80px">
  29. <el-row>
  30. <el-col :span="6">
  31. <el-form-item
  32. label="客户名称"
  33. :rules="[{ required: true, message: '', trigger: 'blur' }]"
  34. prop="fCorpid"
  35. >
  36. <el-select
  37. v-model="form.fCorpid"
  38. size="small"
  39. placeholder="请选择"
  40. clearable
  41. :disabled="
  42. form.fBillstatus >= 4 || readOnly == 0 || tableData.length > 0
  43. "
  44. style="width: 100%"
  45. >
  46. <el-option
  47. v-for="item in corpList"
  48. :key="item.fId"
  49. :label="item.fName"
  50. :value="item.fId"
  51. />
  52. </el-select>
  53. </el-form-item>
  54. </el-col>
  55. <el-col :span="6">
  56. <el-form-item label="开船日期">
  57. <el-date-picker
  58. v-model="form.date"
  59. type="daterange"
  60. size="small"
  61. placeholder="请选择日期"
  62. format="yyyy-MM-dd"
  63. value-format="yyyy-MM-dd"
  64. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  65. style="width: 100%"
  66. />
  67. </el-form-item>
  68. </el-col>
  69. <el-col :span="6">
  70. <el-form-item label="船名">
  71. <el-select
  72. v-model="form.fVslid"
  73. size="small"
  74. placeholder="请选择"
  75. clearable
  76. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  77. style="width: 100%"
  78. >
  79. <el-option
  80. v-for="item in TVesselfs"
  81. :key="item.fId"
  82. :label="item.fName"
  83. :value="item.fId"
  84. />
  85. </el-select>
  86. </el-form-item>
  87. </el-col>
  88. <el-col :span="6">
  89. <el-form-item label="航次">
  90. <el-select
  91. v-model="form.fVoyid"
  92. size="small"
  93. placeholder="请选择"
  94. clearable
  95. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  96. style="width: 100%"
  97. >
  98. <el-option
  99. v-for="item in TVoyagefs"
  100. :key="item.fId"
  101. :label="item.fNo"
  102. :value="item.fId"
  103. />
  104. </el-select>
  105. </el-form-item>
  106. </el-col>
  107. <el-col :span="6">
  108. <el-form-item label="提单号">
  109. <el-input
  110. v-model="form.tMblno"
  111. size="small"
  112. placeholder="请输入"
  113. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  114. />
  115. </el-form-item>
  116. </el-col>
  117. <el-col :span="6">
  118. <el-form-item label="起运港">
  119. <el-select
  120. v-model="form.fLoadportid"
  121. size="small"
  122. placeholder="请选择"
  123. clearable
  124. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  125. style="width: 100%"
  126. >
  127. <el-option
  128. v-for="item in portNames"
  129. :key="item.fId"
  130. :label="item.fName"
  131. :value="item.fId"
  132. />
  133. </el-select>
  134. </el-form-item>
  135. </el-col>
  136. <el-col :span="6">
  137. <el-form-item label="目的港">
  138. <el-select
  139. v-model="form.fDestportid"
  140. size="small"
  141. placeholder="请选择"
  142. clearable
  143. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  144. style="width: 100%"
  145. >
  146. <el-option
  147. v-for="item in portNames"
  148. :key="item.fId"
  149. :label="item.fName"
  150. :value="item.fId"
  151. />
  152. </el-select>
  153. </el-form-item>
  154. </el-col>
  155. <el-col :span="6">
  156. <el-form-item label="是否对账" prop="fReconciliation">
  157. <el-select
  158. v-model="form.fReconciliation"
  159. size="small"
  160. clearable
  161. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  162. style="width: 100%"
  163. >
  164. <el-option label="是" value="1" />
  165. <el-option label="否" value="0" />
  166. </el-select>
  167. </el-form-item>
  168. </el-col>
  169. <el-col :span="6">
  170. <el-form-item label="应收应付" prop="fDc">
  171. <el-select
  172. v-model="form.fDc"
  173. size="small"
  174. clearable
  175. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  176. style="width: 100%"
  177. >
  178. <el-option label="应收" value="D" />
  179. <el-option label="应付" value="C" />
  180. </el-select>
  181. </el-form-item>
  182. </el-col>
  183. <el-col :span="6">
  184. <el-form-item label="系统编号">
  185. <el-input
  186. v-model="form.srcBillNo"
  187. size="small"
  188. placeholder="请输入"
  189. disabled
  190. ></el-input>
  191. </el-form-item>
  192. </el-col>
  193. <el-col :span="6">
  194. <el-form-item label="备注">
  195. <el-input
  196. v-model="form.fRemarks"
  197. size="small"
  198. placeholder="请输入"
  199. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  200. ></el-input>
  201. </el-form-item>
  202. </el-col>
  203. <el-col :span="6">
  204. <el-form-item label="制单人">
  205. <el-input
  206. v-model="form.createBy"
  207. size="small"
  208. placeholder="请输入"
  209. disabled
  210. ></el-input>
  211. </el-form-item>
  212. </el-col>
  213. <el-col :span="6">
  214. <el-form-item label="制单日期">
  215. <el-date-picker
  216. v-model="form.createTime"
  217. size="small"
  218. placeholder="请选择"
  219. format="yyyy-MM-dd"
  220. value-format="yyyy-MM-dd 00:00:00"
  221. disabled
  222. style="width: 100%"
  223. />
  224. </el-form-item>
  225. </el-col>
  226. </el-row>
  227. </el-form>
  228. <div class="head-but">
  229. <div>
  230. <el-button
  231. type="primary"
  232. size="mini"
  233. @click="submit"
  234. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  235. >
  236. 确认对账
  237. </el-button>
  238. <el-button
  239. type="success"
  240. size="mini"
  241. @click="backrRconciliation"
  242. v-if="form.fBillstatus === '6'"
  243. >撤销对账</el-button
  244. >
  245. <el-button
  246. type="danger"
  247. size="mini"
  248. v-if="form.fBillstatus == 4"
  249. @click="backApproval('f_billstatus')"
  250. >撤销审批</el-button
  251. >
  252. <el-button
  253. v-if="readOnly == 3"
  254. size="mini"
  255. @click="goApproval('f_billstatus')"
  256. >审批</el-button
  257. >
  258. <el-button
  259. type="primary"
  260. size="mini"
  261. v-if="form.fBillstatus >= '3'"
  262. @click="addOrUpdateHandle('f_billstatus')"
  263. >查看审批流</el-button
  264. >
  265. <el-button
  266. type="success"
  267. size="mini"
  268. @click="save"
  269. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  270. >
  271. 保存
  272. </el-button>
  273. <el-button
  274. type="warning"
  275. size="mini"
  276. :disabled="!form.fId"
  277. @click="handleExport"
  278. >
  279. 导出
  280. </el-button>
  281. <el-button
  282. type="cyan"
  283. icon="el-icon-search"
  284. size="mini"
  285. @click="Search"
  286. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  287. >
  288. 检索
  289. </el-button>
  290. </div>
  291. <div class="tabSetting">
  292. <div style="margin: 0 12px">
  293. <el-button
  294. icon="el-icon-setting"
  295. size="mini"
  296. circle
  297. @click="colSetting"
  298. ></el-button>
  299. </div>
  300. </div>
  301. </div>
  302. <el-table
  303. :data="tableData"
  304. style="width: 100%"
  305. show-summary
  306. :summary-method="getSummaries"
  307. >
  308. <el-table-column label="序号" type="index" width="50" />
  309. <el-table-column
  310. v-for="(item, index) in tableOption"
  311. :key="index"
  312. :label="item.name"
  313. :width="item.width"
  314. :prop="item.label"
  315. align="center"
  316. :fixed="item.fixed"
  317. :show-overflow-tooltip="true"
  318. >
  319. <template slot-scope="scope">
  320. <span v-if="item.label == 'srcBillNo'">
  321. {{ scope.row.srcBillNo }}
  322. </span>
  323. <span v-if="item.label == 'fName'">
  324. {{ scope.row.fName }}
  325. </span>
  326. <span v-if="item.label == 'fFeeName'">
  327. {{ scope.row.fFeeName }}
  328. </span>
  329. <span v-if="item.label == 'fFeeUnitName'">
  330. {{ scope.row.fFeeUnitName }}
  331. </span>
  332. <span v-if="item.label == 'fQty'">
  333. {{ scope.row.fQty }}
  334. </span>
  335. <span v-if="item.label == 'fUnitPrice'">
  336. {{ scope.row.fUnitPrice }}
  337. </span>
  338. <span v-if="item.label == 'fAmtdr'">
  339. {{ scope.row.fAmtdr }}
  340. </span>
  341. <span v-if="item.label == 'fAmt'">
  342. <el-input
  343. v-model="scope.row.fAmt"
  344. size="small"
  345. placeholder="请输入"
  346. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  347. @change="fAmtChange(scope.row)"
  348. ></el-input>
  349. </span>
  350. <span v-if="item.label == 'fvslName'">
  351. {{ scope.row.fvslName }}
  352. </span>
  353. <span v-if="item.label == 'fvoyName'">
  354. {{ scope.row.fvoyName }}
  355. </span>
  356. <span v-if="item.label == 'fCntrCount'">
  357. {{ scope.row.fCntrCount }}
  358. </span>
  359. <span v-if="item.label == 'cntrName'">
  360. {{ scope.row.cntrName }}
  361. </span>
  362. <span v-if="item.label == 'fLoadPortName'">
  363. {{ scope.row.fLoadPortName }}
  364. </span>
  365. <span v-if="item.label == 'fDestPortName'">
  366. {{ scope.row.fDestPortName }}
  367. </span>
  368. <span v-if="item.label == 'fBillStatusName'">
  369. {{ scope.row.fBillStatusName }}
  370. </span>
  371. <span v-if="item.label == 'createBy'">
  372. {{ scope.row.createBy }}
  373. </span>
  374. <span v-if="item.label == 'createTime'">
  375. {{ scope.row.createTime }}
  376. </span>
  377. <span v-if="item.label == 'fRemarks'">
  378. <el-input
  379. v-model="scope.row.fRemarks"
  380. size="small"
  381. placeholder="请输入"
  382. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  383. ></el-input>
  384. </span>
  385. </template>
  386. </el-table-column>
  387. <el-table-column
  388. label="操作"
  389. align="center"
  390. class-name="small-padding fixed-width"
  391. min-width="180"
  392. fixed="right"
  393. >
  394. <template slot-scope="scope">
  395. <el-button
  396. size="mini"
  397. type="text"
  398. icon="el-icon-delete"
  399. @click="rowDel(scope.row, scope.$index, tableData)"
  400. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  401. >
  402. 删除
  403. </el-button>
  404. </template>
  405. </el-table-column>
  406. </el-table>
  407. <approval-comments
  408. v-if="addOrUpdateVisib"
  409. ref="ApprovalComments"
  410. @refreshDataList="returnData"
  411. />
  412. <add-or-update ref="addOrUpdate" @imporData="imporData" />
  413. <view-approval ref="viewApproval" />
  414. <column-setting
  415. ref="columnSetting"
  416. @reset="reset"
  417. @getRowdata="getRowdata"
  418. tableName="凯和对账详情页"
  419. />
  420. </div>
  421. </template>
  422. <script>
  423. import Cookies from "js-cookie";
  424. import { tableOption2 } from "./js/index";
  425. import {
  426. selectTVesself,
  427. selectTVoyagef,
  428. selectPortName,
  429. save,
  430. listCorps,
  431. confirm,
  432. RevocationApproval,
  433. getdetail,
  434. infoRemove,
  435. revoke,
  436. getExcelInfo,
  437. } from "@/api/finance/kaihe/contrast";
  438. import ApprovalComments from "@/views/startApproval";
  439. import addOrUpdate from "./add-or-update.vue";
  440. import viewApproval from "@/views/viewApproval";
  441. import columnSetting from "@/components/ColumnSetting/index";
  442. import _ from "lodash";
  443. export default {
  444. data() {
  445. return {
  446. form: {
  447. fReconciliation: "0",
  448. fDc: "D",
  449. fSystemType: Cookies.get("sysType"),
  450. },
  451. options: [],
  452. tableData: [],
  453. tableOption: tableOption2,
  454. TVesselfs: [],
  455. TVoyagefs: [],
  456. portNames: [],
  457. corpList: [],
  458. wRtions: [],
  459. approve: false,
  460. addOrUpdateVisib: false,
  461. readOnly: null,
  462. };
  463. },
  464. components: {
  465. ApprovalComments,
  466. addOrUpdate,
  467. viewApproval,
  468. columnSetting,
  469. },
  470. props: {
  471. showDetail: {
  472. type: Boolean,
  473. },
  474. },
  475. created() {},
  476. methods: {
  477. /** 导出按钮操作 */
  478. handleExport() {
  479. let _this = this;
  480. this.$confirm("是否确认导出明细数据?", "警告", {
  481. confirmButtonText: "确定",
  482. cancelButtonText: "取消",
  483. type: "warning",
  484. })
  485. .then(function () {
  486. return getExcelInfo(_this.form.fId);
  487. })
  488. .then((response) => {
  489. this.download(response.msg);
  490. });
  491. },
  492. getRowdata(list) {
  493. this.tableOption = list;
  494. },
  495. reset() {
  496. this.tableOption = this.$options.data().tableOption;
  497. },
  498. colSetting() {
  499. this.$refs.columnSetting.init(this.tableOption);
  500. },
  501. init() {
  502. selectTVesself().then((res) => {
  503. this.TVesselfs = res.rows;
  504. });
  505. selectTVoyagef().then((res) => {
  506. this.TVoyagefs = res.rows;
  507. });
  508. selectPortName().then((res) => {
  509. this.portNames = res.rows;
  510. });
  511. this.getDicts("whether_reconciliation").then((response) => {
  512. if (response.data) {
  513. this.wRtions = response.data;
  514. }
  515. });
  516. listCorps().then((res) => {
  517. this.corpList = res;
  518. });
  519. setTimeout((e) => {
  520. this.$refs.columnSetting.getRow(this.tableOption);
  521. }, 100);
  522. },
  523. fAmtChange(row) {
  524. if (Number(row.fAmt) > Number(row.fAmtdr)) {
  525. row.fAmt = row.fAmtdr;
  526. this.$message.error("实收金额不能超过应收金额");
  527. }
  528. if (Number(row.fAmt) <= 0) {
  529. row.fAmt = row.fAmtdr;
  530. this.$message.error("请正确输入金额");
  531. }
  532. },
  533. rowDel(row, index, rows) {
  534. console.log();
  535. if (row.fId) {
  536. infoRemove(row.fId).then((res) => {
  537. if (res.code == 200) {
  538. rows.splice(index, 1);
  539. this.$message.success("删除成功");
  540. }
  541. });
  542. } else {
  543. rows.splice(index, 1);
  544. this.$message.success("删除成功");
  545. }
  546. },
  547. getSummaries(param) {
  548. const { columns, data } = param;
  549. const sums = [];
  550. if (data.length > 0) {
  551. columns.forEach((column, index) => {
  552. if (index == 0) {
  553. sums[index] = "合计";
  554. }
  555. if (column.label == "应收金额" || column.label == "实收金额") {
  556. const values = data.map((item) => Number(item[column.property]));
  557. if (!values.every((value) => isNaN(value))) {
  558. sums[index] = values.reduce((prev, curr) => {
  559. const value = Number(curr);
  560. if (!isNaN(value)) {
  561. return prev + curr;
  562. } else {
  563. return prev;
  564. }
  565. }, 0);
  566. // sums[index] += "元";
  567. } else {
  568. sums[index] = "0";
  569. // sums[index] = "0元";
  570. }
  571. }
  572. });
  573. }
  574. return sums;
  575. },
  576. info(row, status) {
  577. this.init();
  578. this.readOnly = status;
  579. const id = row.fId ? row.fId : row;
  580. getdetail(id).then((res) => {
  581. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  582. const date = [];
  583. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  584. res.data.tFee.date = date;
  585. }
  586. this.form = res.data.tFee;
  587. this.tableData = res.data.tFeeDo;
  588. });
  589. },
  590. copyData(id) {
  591. this.init();
  592. getdetail(id).then((res) => {
  593. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  594. const date = [];
  595. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  596. res.data.tFee.date = date;
  597. }
  598. delete res.data.tFee.fId;
  599. delete res.data.tFee.fBillstatus;
  600. delete res.data.tFee.fBillno;
  601. delete res.data.tFee.srcBillNo;
  602. delete res.data.tFee.createBy;
  603. delete res.data.tFee.createTime;
  604. delete res.data.tFee.updateBy;
  605. delete res.data.tFee.updateTime;
  606. delete res.data.tFee.fRemarks;
  607. this.form = res.data.tFee;
  608. });
  609. },
  610. returnData() {
  611. this.addOrUpdateVisib = false;
  612. this.homepaGe();
  613. },
  614. homepaGe() {
  615. let view = {
  616. fullPath: "/finance/contrast",
  617. hash: "",
  618. matched: Array(2),
  619. meta: Object,
  620. name: "Contrast",
  621. params: Object,
  622. path: "/finance/contrast",
  623. query: Object,
  624. title: "对账",
  625. };
  626. this.$router.push({ path: "/index" });
  627. this.$store
  628. .dispatch("tagsView/delView", view)
  629. .then(({ visitedViews }) => {
  630. if (this.isActive(view)) {
  631. this.toLastView(visitedViews, view);
  632. }
  633. });
  634. Global.$emit("removeCache", "closeSelectedTag", view);
  635. },
  636. // 审批按钮
  637. goApproval(status) {
  638. this.addOrUpdateVisib = true;
  639. this.$nextTick(() => {
  640. this.$refs.ApprovalComments.init(this.form.fId, status, 430);
  641. });
  642. },
  643. // 撤销审批
  644. backApproval(status) {
  645. let data = {
  646. id: this.form.fId,
  647. actId: 430,
  648. billId: this.form.fId,
  649. fidStatus: status,
  650. };
  651. RevocationApproval(data).then((response) => {
  652. if (response.code === 200) {
  653. this.msgSuccess("撤销审批成功");
  654. this.open = false;
  655. }
  656. });
  657. },
  658. returnData() {
  659. this.$emit("goBack", false);
  660. },
  661. // 查看审批流
  662. addOrUpdateHandle(status) {
  663. this.addOrUpdateVisible = true;
  664. this.addOrUpdateVisib = false;
  665. let id = null;
  666. if (this.form.fId) {
  667. id = this.form.fId;
  668. } else {
  669. id = this.form.id;
  670. }
  671. this.$nextTick(() => {
  672. this.$refs.viewApproval.init(id, 430, status);
  673. });
  674. },
  675. // 撤销对账
  676. backrRconciliation() {
  677. this.form.fBillstatus = "1";
  678. let formDate = new window.FormData();
  679. formDate.append("tFee", JSON.stringify(this.form));
  680. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  681. revoke(formDate).then((response) => {
  682. this.msgSuccess("撤回成功");
  683. this.$emit("goBack", false);
  684. });
  685. },
  686. Search() {
  687. const data = {
  688. fReconciliation: this.form.fReconciliation,
  689. fDc: this.form.fDc,
  690. fSystemType: 3,
  691. fCorpid: this.form.fCorpid,
  692. fVslid: this.form.fVslid,
  693. fVoyid: this.form.fVoyid,
  694. fDestportid: this.form.fDestportid,
  695. fLoadportid: this.form.fLoadportid,
  696. };
  697. this.$refs["form"].validate((valid) => {
  698. if (valid) {
  699. this.$refs.addOrUpdate.init(data, this.tableData);
  700. } else {
  701. this.$message.error("请选择客户名称");
  702. return false;
  703. }
  704. });
  705. },
  706. imporData(rows) {
  707. this.tableData = this.tableData.concat(rows);
  708. },
  709. lumpSum() {
  710. let fAmtdr = 0;
  711. let fAmtcr = 0;
  712. this.tableData.map((e) => {
  713. fAmtdr = _.add(fAmtdr, Number(e.fAmtdr));
  714. fAmtcr = _.add(fAmtcr, Number(e.fAmt));
  715. });
  716. this.form.fAmtdr = fAmtdr;
  717. this.form.fAmtcr = fAmtcr;
  718. },
  719. submit() {
  720. if (this.form.fCorpid == null) {
  721. return this.$message.error("客户名称不能为空");
  722. }
  723. this.corpList.forEach((e) => {
  724. if (this.form.fCorpid == e.fId) {
  725. this.form.fCtrlcorpid = e.fName;
  726. }
  727. });
  728. if (this.tableData.length == 0) {
  729. return this.$message.error("明细表不能为空");
  730. }
  731. if (this.form.date) {
  732. this.form.fFromDate = this.form.date[0];
  733. this.form.fToDate = this.form.date[1];
  734. }
  735. this.lumpSum();
  736. if (this.form.fId == null) {
  737. return this.$message.error("数据未保存,不能进行确认对账");
  738. }
  739. let formDate = new window.FormData();
  740. formDate.append("tFee", JSON.stringify(this.form));
  741. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  742. formDate.append("billsType", JSON.stringify("KHDZ"));
  743. confirm(formDate).then((res) => {
  744. if (res.code == 200) {
  745. this.$emit("goBack", false);
  746. this.$message.success("对账成功");
  747. }
  748. });
  749. },
  750. save() {
  751. if (this.form.fCorpid == null) {
  752. return this.$message.error("客户名称不能为空");
  753. }
  754. this.corpList.forEach((e) => {
  755. if (this.form.fCorpid == e.fId) {
  756. this.form.fCtrlcorpid = e.fName;
  757. }
  758. });
  759. if (this.form.date) {
  760. this.form.fFromDate = this.form.date[0];
  761. this.form.fToDate = this.form.date[1];
  762. }
  763. this.lumpSum();
  764. let formDate = new window.FormData();
  765. formDate.append("tFee", JSON.stringify(this.form));
  766. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  767. formDate.append("billsType", JSON.stringify("KHDZ"));
  768. save(formDate).then((res) => {
  769. if (res.code == 200) {
  770. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  771. const date = [];
  772. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  773. res.data.tFee.date = date;
  774. }
  775. this.form = res.data.tFee;
  776. this.tableData = res.data.tFeeDo;
  777. this.$emit("refFresh");
  778. this.$message.success("保存成功");
  779. }
  780. });
  781. },
  782. cancel() {
  783. if (this.readOnly != 0) {
  784. this.$confirm("返回列表,是否保存?", "提示", {
  785. confirmButtonText: "保存",
  786. cancelButtonText: "取消",
  787. type: "warning",
  788. })
  789. .then(() => {
  790. this.save();
  791. Object.assign(this.$data, this.$options.data());
  792. this.$emit("goBack", false);
  793. })
  794. .catch(() => {
  795. Object.assign(this.$data, this.$options.data());
  796. this.$emit("goDetail", false);
  797. });
  798. } else {
  799. Object.assign(this.$data, this.$options.data());
  800. this.$emit("goBack", false);
  801. }
  802. },
  803. },
  804. watch: {
  805. info: function (obj) {
  806. console.log(obj);
  807. },
  808. },
  809. };
  810. </script>
  811. <style lang="scss" scoped>
  812. .head-but {
  813. display: flex;
  814. justify-content: space-between;
  815. margin-bottom: 8px;
  816. }
  817. .tabSetting {
  818. display: flex;
  819. justify-content: flex-end;
  820. }
  821. </style>