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. :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.createBy"
  197. size="small"
  198. placeholder="请输入"
  199. disabled
  200. ></el-input>
  201. </el-form-item>
  202. </el-col>
  203. <el-col :span="6">
  204. <el-form-item label="制单日期">
  205. <el-date-picker
  206. v-model="form.createTime"
  207. size="small"
  208. placeholder="请选择"
  209. format="yyyy-MM-dd"
  210. value-format="yyyy-MM-dd 00:00:00"
  211. disabled
  212. style="width: 100%"
  213. />
  214. </el-form-item>
  215. </el-col>
  216. <el-col :span="6">
  217. <el-form-item label="备注">
  218. <el-input
  219. type="textarea"
  220. v-model="form.fRemarks"
  221. size="small"
  222. placeholder="请输入"
  223. ></el-input>
  224. </el-form-item>
  225. </el-col>
  226. <el-col :span="6">
  227. <el-form-item label="开票备注">
  228. <el-input
  229. type="textarea"
  230. v-model="form.invoiceRemarks"
  231. size="small"
  232. placeholder="请输入"
  233. ></el-input>
  234. </el-form-item>
  235. </el-col>
  236. </el-row>
  237. </el-form>
  238. <div class="head-but">
  239. <div>
  240. <el-button
  241. type="primary"
  242. size="mini"
  243. @click="submit"
  244. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  245. >
  246. 确认对账
  247. </el-button>
  248. <el-button
  249. type="success"
  250. size="mini"
  251. @click="backrRconciliation"
  252. v-if="form.fBillstatus === '6'"
  253. >撤销对账</el-button
  254. >
  255. <el-button
  256. type="danger"
  257. size="mini"
  258. v-if="form.fBillstatus == 4"
  259. @click="backApproval('f_billstatus')"
  260. >撤销审批</el-button
  261. >
  262. <el-button
  263. v-if="readOnly == 3"
  264. size="mini"
  265. @click="goApproval('f_billstatus')"
  266. >审批</el-button
  267. >
  268. <el-button
  269. type="primary"
  270. size="mini"
  271. v-if="form.fBillstatus >= '3'"
  272. @click="addOrUpdateHandle('f_billstatus')"
  273. >查看审批流</el-button
  274. >
  275. <el-button type="success" size="mini" @click="save"> 保存 </el-button>
  276. <el-button
  277. type="warning"
  278. size="mini"
  279. :disabled="!form.fId"
  280. @click="handleExport"
  281. >
  282. 导出
  283. </el-button>
  284. <el-button
  285. type="cyan"
  286. icon="el-icon-search"
  287. size="mini"
  288. @click="Search"
  289. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  290. >
  291. 检索
  292. </el-button>
  293. </div>
  294. <div class="tabSetting">
  295. <div style="margin: 0 12px">
  296. <el-button
  297. icon="el-icon-setting"
  298. size="mini"
  299. circle
  300. @click="colSetting"
  301. ></el-button>
  302. </div>
  303. </div>
  304. </div>
  305. <el-table
  306. :data="tableData"
  307. style="width: 100%"
  308. show-summary
  309. :summary-method="getSummaries"
  310. >
  311. <el-table-column label="序号" type="index" width="50" />
  312. <el-table-column
  313. v-for="(item, index) in tableOption"
  314. :key="index"
  315. :label="item.name"
  316. :width="item.width"
  317. :prop="item.label"
  318. align="center"
  319. :fixed="item.fixed"
  320. :show-overflow-tooltip="true"
  321. >
  322. <template slot-scope="scope">
  323. <span v-if="item.label == 'srcBillNo'">
  324. {{ scope.row.srcBillNo }}
  325. </span>
  326. <span v-if="item.label == 'fName'">
  327. {{ scope.row.fName }}
  328. </span>
  329. <span v-if="item.label == 'fFeeName'">
  330. {{ scope.row.fFeeName }}
  331. </span>
  332. <span v-if="item.label == 'goodName'">
  333. {{ scope.row.goodName }}
  334. </span>
  335. <span v-if="item.label == 'fFeeUnitName'">
  336. {{ scope.row.fFeeUnitName }}
  337. </span>
  338. <span v-if="item.label == 'fQty'">
  339. {{ scope.row.fQty }}
  340. </span>
  341. <span v-if="item.label == 'fUnitPrice'">
  342. {{ scope.row.fUnitPrice }}
  343. </span>
  344. <span v-if="item.label == 'fAmtdr'">
  345. {{ scope.row.fAmtdr }}
  346. </span>
  347. <span v-if="item.label == 'fAmt'">
  348. <el-input
  349. v-model="scope.row.fAmt"
  350. size="small"
  351. placeholder="请输入"
  352. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  353. @change="fAmtChange(scope.row)"
  354. ></el-input>
  355. </span>
  356. <span v-if="item.label == 'fvslName'">
  357. {{ scope.row.fvslName }}
  358. </span>
  359. <span v-if="item.label == 'fvoyName'">
  360. {{ scope.row.fvoyName }}
  361. </span>
  362. <span v-if="item.label == 'fCntrCount'">
  363. {{ scope.row.fCntrCount }}
  364. </span>
  365. <span v-if="item.label == 'cntrName'">
  366. {{ scope.row.cntrName }}
  367. </span>
  368. <span v-if="item.label == 'fLoadPortName'">
  369. {{ scope.row.fLoadPortName }}
  370. </span>
  371. <span v-if="item.label == 'fDestPortName'">
  372. {{ scope.row.fDestPortName }}
  373. </span>
  374. <span v-if="item.label == 'fBillStatusName'">
  375. {{ scope.row.fBillStatusName }}
  376. </span>
  377. <span v-if="item.label == 'createBy'">
  378. {{ scope.row.createBy }}
  379. </span>
  380. <span v-if="item.label == 'createTime'">
  381. {{ scope.row.createTime }}
  382. </span>
  383. <span v-if="item.label == 'fRemarks'">
  384. <el-input
  385. v-model="scope.row.fRemarks"
  386. size="small"
  387. placeholder="请输入"
  388. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  389. ></el-input>
  390. </span>
  391. </template>
  392. </el-table-column>
  393. <el-table-column
  394. label="操作"
  395. align="center"
  396. class-name="small-padding fixed-width"
  397. min-width="180"
  398. fixed="right"
  399. >
  400. <template slot-scope="scope">
  401. <el-button
  402. size="mini"
  403. type="text"
  404. icon="el-icon-delete"
  405. @click="rowDel(scope.row, scope.$index, tableData)"
  406. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  407. >
  408. 删除
  409. </el-button>
  410. </template>
  411. </el-table-column>
  412. </el-table>
  413. <approval-comments
  414. v-if="addOrUpdateVisib"
  415. ref="ApprovalComments"
  416. @refreshDataList="returnData"
  417. />
  418. <add-or-update ref="addOrUpdate" @imporData="imporData" />
  419. <view-approval ref="viewApproval" />
  420. <column-setting
  421. ref="columnSetting"
  422. @reset="reset"
  423. @getRowdata="getRowdata"
  424. tableName="凯和对账详情页"
  425. />
  426. </div>
  427. </template>
  428. <script>
  429. import Cookies from "js-cookie";
  430. import { tableOption2 } from "./js/index";
  431. import {
  432. selectTVesself,
  433. selectTVoyagef,
  434. selectPortName,
  435. save,
  436. listCorps,
  437. confirm,
  438. RevocationApproval,
  439. getdetail,
  440. infoRemove,
  441. revoke,
  442. getExcelInfo,
  443. } from "@/api/finance/kaihe/contrast";
  444. import ApprovalComments from "@/views/startApproval";
  445. import addOrUpdate from "./add-or-update.vue";
  446. import viewApproval from "@/views/viewApproval";
  447. import columnSetting from "@/components/ColumnSetting/index";
  448. import _ from "lodash";
  449. export default {
  450. data() {
  451. return {
  452. form: {
  453. fReconciliation: "0",
  454. fDc: "D",
  455. fSystemType: Cookies.get("sysType"),
  456. },
  457. options: [],
  458. tableData: [],
  459. tableOption: tableOption2,
  460. TVesselfs: [],
  461. TVoyagefs: [],
  462. portNames: [],
  463. corpList: [],
  464. wRtions: [],
  465. approve: false,
  466. addOrUpdateVisib: false,
  467. readOnly: null,
  468. };
  469. },
  470. components: {
  471. ApprovalComments,
  472. addOrUpdate,
  473. viewApproval,
  474. columnSetting,
  475. },
  476. props: {
  477. showDetail: {
  478. type: Boolean,
  479. },
  480. },
  481. created() {},
  482. methods: {
  483. /** 导出按钮操作 */
  484. handleExport() {
  485. let _this = this;
  486. this.$confirm("是否确认导出明细数据?", "警告", {
  487. confirmButtonText: "确定",
  488. cancelButtonText: "取消",
  489. type: "warning",
  490. })
  491. .then(function () {
  492. return getExcelInfo(_this.form.fId);
  493. })
  494. .then((response) => {
  495. this.download(response.msg);
  496. });
  497. },
  498. getRowdata(list) {
  499. this.tableOption = list;
  500. },
  501. reset() {
  502. this.tableOption = this.$options.data().tableOption;
  503. },
  504. colSetting() {
  505. this.$refs.columnSetting.init(this.tableOption);
  506. },
  507. init() {
  508. selectTVesself().then((res) => {
  509. this.TVesselfs = res.rows;
  510. });
  511. selectTVoyagef().then((res) => {
  512. this.TVoyagefs = res.rows;
  513. });
  514. selectPortName().then((res) => {
  515. this.portNames = res.rows;
  516. });
  517. this.getDicts("whether_reconciliation").then((response) => {
  518. if (response.data) {
  519. this.wRtions = response.data;
  520. }
  521. });
  522. listCorps().then((res) => {
  523. this.corpList = res;
  524. });
  525. setTimeout((e) => {
  526. this.$refs.columnSetting.getRow(this.tableOption);
  527. }, 100);
  528. },
  529. fAmtChange(row) {
  530. if (Number(row.fAmt) > Number(row.fAmtdr)) {
  531. row.fAmt = row.fAmtdr;
  532. this.$message.error("实收金额不能超过应收金额");
  533. }
  534. if (Number(row.fAmt) <= 0) {
  535. row.fAmt = row.fAmtdr;
  536. this.$message.error("请正确输入金额");
  537. }
  538. },
  539. rowDel(row, index, rows) {
  540. console.log();
  541. if (row.fId) {
  542. infoRemove(row.fId).then((res) => {
  543. if (res.code == 200) {
  544. rows.splice(index, 1);
  545. this.$message.success("删除成功");
  546. }
  547. });
  548. } else {
  549. rows.splice(index, 1);
  550. this.$message.success("删除成功");
  551. }
  552. },
  553. getSummaries(param) {
  554. const { columns, data } = param;
  555. const sums = [];
  556. if (data.length > 0) {
  557. columns.forEach((column, index) => {
  558. if (index == 0) {
  559. sums[index] = "合计";
  560. }
  561. if (column.label == "应收金额" || column.label == "实收金额") {
  562. const values = data.map((item) => Number(item[column.property]));
  563. if (!values.every((value) => isNaN(value))) {
  564. sums[index] = values.reduce((prev, curr) => {
  565. const value = Number(curr);
  566. if (!isNaN(value)) {
  567. return prev + curr;
  568. } else {
  569. return prev;
  570. }
  571. }, 0);
  572. // sums[index] += "元";
  573. } else {
  574. sums[index] = "0";
  575. // sums[index] = "0元";
  576. }
  577. }
  578. });
  579. }
  580. return sums;
  581. },
  582. info(row, status) {
  583. this.init();
  584. this.readOnly = status;
  585. const id = row.fId ? row.fId : row;
  586. getdetail(id).then((res) => {
  587. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  588. const date = [];
  589. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  590. res.data.tFee.date = date;
  591. }
  592. this.form = res.data.tFee;
  593. this.tableData = res.data.tFeeDo;
  594. });
  595. },
  596. copyData(id) {
  597. this.init();
  598. getdetail(id).then((res) => {
  599. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  600. const date = [];
  601. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  602. res.data.tFee.date = date;
  603. }
  604. delete res.data.tFee.fId;
  605. delete res.data.tFee.fBillstatus;
  606. delete res.data.tFee.fBillno;
  607. delete res.data.tFee.srcBillNo;
  608. delete res.data.tFee.createBy;
  609. delete res.data.tFee.createTime;
  610. delete res.data.tFee.updateBy;
  611. delete res.data.tFee.updateTime;
  612. delete res.data.tFee.fRemarks;
  613. this.form = res.data.tFee;
  614. });
  615. },
  616. returnData() {
  617. this.addOrUpdateVisib = false;
  618. this.homepaGe();
  619. },
  620. homepaGe() {
  621. let view = {
  622. fullPath: "/finance/contrast",
  623. hash: "",
  624. matched: Array(2),
  625. meta: Object,
  626. name: "Contrast",
  627. params: Object,
  628. path: "/finance/contrast",
  629. query: Object,
  630. title: "对账",
  631. };
  632. this.$router.push({ path: "/index" });
  633. this.$store
  634. .dispatch("tagsView/delView", view)
  635. .then(({ visitedViews }) => {
  636. if (this.isActive(view)) {
  637. this.toLastView(visitedViews, view);
  638. }
  639. });
  640. Global.$emit("removeCache", "closeSelectedTag", view);
  641. },
  642. // 审批按钮
  643. goApproval(status) {
  644. this.addOrUpdateVisib = true;
  645. this.$nextTick(() => {
  646. this.$refs.ApprovalComments.init(this.form.fId, status, 430);
  647. });
  648. },
  649. // 撤销审批
  650. backApproval(status) {
  651. let data = {
  652. id: this.form.fId,
  653. actId: 430,
  654. billId: this.form.fId,
  655. fidStatus: status,
  656. };
  657. RevocationApproval(data).then((response) => {
  658. if (response.code === 200) {
  659. this.msgSuccess("撤销审批成功");
  660. this.open = false;
  661. }
  662. });
  663. },
  664. returnData() {
  665. this.$emit("goBack", false);
  666. },
  667. // 查看审批流
  668. addOrUpdateHandle(status) {
  669. this.addOrUpdateVisible = true;
  670. this.addOrUpdateVisib = false;
  671. let id = null;
  672. if (this.form.fId) {
  673. id = this.form.fId;
  674. } else {
  675. id = this.form.id;
  676. }
  677. this.$nextTick(() => {
  678. this.$refs.viewApproval.init(id, 430, status);
  679. });
  680. },
  681. // 撤销对账
  682. backrRconciliation() {
  683. this.form.fBillstatus = "1";
  684. let formDate = new window.FormData();
  685. formDate.append("tFee", JSON.stringify(this.form));
  686. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  687. revoke(formDate).then((response) => {
  688. this.msgSuccess("撤回成功");
  689. this.$emit("goBack", false);
  690. });
  691. },
  692. Search() {
  693. const data = {
  694. fReconciliation: this.form.fReconciliation,
  695. fDc: this.form.fDc,
  696. fSystemType: 3,
  697. fCorpid: this.form.fCorpid,
  698. fVslid: this.form.fVslid,
  699. fVoyid: this.form.fVoyid,
  700. fDestportid: this.form.fDestportid,
  701. fLoadportid: this.form.fLoadportid,
  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>