kaihe-detail.vue 24 KB

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