kaihe-detail.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829
  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 == 'fFeeUnitName'">
  333. {{ scope.row.fFeeUnitName }}
  334. </span>
  335. <span v-if="item.label == 'fQty'">
  336. {{ scope.row.fQty }}
  337. </span>
  338. <span v-if="item.label == 'fUnitPrice'">
  339. {{ scope.row.fUnitPrice }}
  340. </span>
  341. <span v-if="item.label == 'fAmtdr'">
  342. {{ scope.row.fAmtdr }}
  343. </span>
  344. <span v-if="item.label == 'fAmt'">
  345. <el-input
  346. v-model="scope.row.fAmt"
  347. size="small"
  348. placeholder="请输入"
  349. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  350. @change="fAmtChange(scope.row)"
  351. ></el-input>
  352. </span>
  353. <span v-if="item.label == 'fvslName'">
  354. {{ scope.row.fvslName }}
  355. </span>
  356. <span v-if="item.label == 'fvoyName'">
  357. {{ scope.row.fvoyName }}
  358. </span>
  359. <span v-if="item.label == 'fCntrCount'">
  360. {{ scope.row.fCntrCount }}
  361. </span>
  362. <span v-if="item.label == 'cntrName'">
  363. {{ scope.row.cntrName }}
  364. </span>
  365. <span v-if="item.label == 'fLoadPortName'">
  366. {{ scope.row.fLoadPortName }}
  367. </span>
  368. <span v-if="item.label == 'fDestPortName'">
  369. {{ scope.row.fDestPortName }}
  370. </span>
  371. <span v-if="item.label == 'fBillStatusName'">
  372. {{ scope.row.fBillStatusName }}
  373. </span>
  374. <span v-if="item.label == 'createBy'">
  375. {{ scope.row.createBy }}
  376. </span>
  377. <span v-if="item.label == 'createTime'">
  378. {{ scope.row.createTime }}
  379. </span>
  380. <span v-if="item.label == 'fRemarks'">
  381. <el-input
  382. v-model="scope.row.fRemarks"
  383. size="small"
  384. placeholder="请输入"
  385. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  386. ></el-input>
  387. </span>
  388. </template>
  389. </el-table-column>
  390. <el-table-column
  391. label="操作"
  392. align="center"
  393. class-name="small-padding fixed-width"
  394. min-width="180"
  395. fixed="right"
  396. >
  397. <template slot-scope="scope">
  398. <el-button
  399. size="mini"
  400. type="text"
  401. icon="el-icon-delete"
  402. @click="rowDel(scope.row, scope.$index, tableData)"
  403. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  404. >
  405. 删除
  406. </el-button>
  407. </template>
  408. </el-table-column>
  409. </el-table>
  410. <approval-comments
  411. v-if="addOrUpdateVisib"
  412. ref="ApprovalComments"
  413. @refreshDataList="returnData"
  414. />
  415. <add-or-update ref="addOrUpdate" @imporData="imporData" />
  416. <view-approval ref="viewApproval" />
  417. <column-setting
  418. ref="columnSetting"
  419. @reset="reset"
  420. @getRowdata="getRowdata"
  421. tableName="凯和对账详情页"
  422. />
  423. </div>
  424. </template>
  425. <script>
  426. import Cookies from "js-cookie";
  427. import { tableOption2 } from "./js/index";
  428. import {
  429. selectTVesself,
  430. selectTVoyagef,
  431. selectPortName,
  432. save,
  433. listCorps,
  434. confirm,
  435. RevocationApproval,
  436. getdetail,
  437. infoRemove,
  438. revoke,
  439. getExcelInfo,
  440. } from "@/api/finance/kaihe/contrast";
  441. import ApprovalComments from "@/views/startApproval";
  442. import addOrUpdate from "./add-or-update.vue";
  443. import viewApproval from "@/views/viewApproval";
  444. import columnSetting from "@/components/ColumnSetting/index";
  445. import _ from "lodash";
  446. export default {
  447. data() {
  448. return {
  449. form: {
  450. fReconciliation: "0",
  451. fDc: "D",
  452. fSystemType: Cookies.get("sysType"),
  453. },
  454. options: [],
  455. tableData: [],
  456. tableOption: tableOption2,
  457. TVesselfs: [],
  458. TVoyagefs: [],
  459. portNames: [],
  460. corpList: [],
  461. wRtions: [],
  462. approve: false,
  463. addOrUpdateVisib: false,
  464. readOnly: null,
  465. };
  466. },
  467. components: {
  468. ApprovalComments,
  469. addOrUpdate,
  470. viewApproval,
  471. columnSetting,
  472. },
  473. props: {
  474. showDetail: {
  475. type: Boolean,
  476. },
  477. },
  478. created() {},
  479. methods: {
  480. /** 导出按钮操作 */
  481. handleExport() {
  482. let _this = this;
  483. this.$confirm("是否确认导出明细数据?", "警告", {
  484. confirmButtonText: "确定",
  485. cancelButtonText: "取消",
  486. type: "warning",
  487. })
  488. .then(function () {
  489. return getExcelInfo(_this.form.fId);
  490. })
  491. .then((response) => {
  492. this.download(response.msg);
  493. });
  494. },
  495. getRowdata(list) {
  496. this.tableOption = list;
  497. },
  498. reset() {
  499. this.tableOption = this.$options.data().tableOption;
  500. },
  501. colSetting() {
  502. this.$refs.columnSetting.init(this.tableOption);
  503. },
  504. init() {
  505. selectTVesself().then((res) => {
  506. this.TVesselfs = res.rows;
  507. });
  508. selectTVoyagef().then((res) => {
  509. this.TVoyagefs = res.rows;
  510. });
  511. selectPortName().then((res) => {
  512. this.portNames = res.rows;
  513. });
  514. this.getDicts("whether_reconciliation").then((response) => {
  515. if (response.data) {
  516. this.wRtions = response.data;
  517. }
  518. });
  519. listCorps().then((res) => {
  520. this.corpList = res;
  521. });
  522. setTimeout((e) => {
  523. this.$refs.columnSetting.getRow(this.tableOption);
  524. }, 100);
  525. },
  526. fAmtChange(row) {
  527. if (Number(row.fAmt) > Number(row.fAmtdr)) {
  528. row.fAmt = row.fAmtdr;
  529. this.$message.error("实收金额不能超过应收金额");
  530. }
  531. if (Number(row.fAmt) <= 0) {
  532. row.fAmt = row.fAmtdr;
  533. this.$message.error("请正确输入金额");
  534. }
  535. },
  536. rowDel(row, index, rows) {
  537. console.log();
  538. if (row.fId) {
  539. infoRemove(row.fId).then((res) => {
  540. if (res.code == 200) {
  541. rows.splice(index, 1);
  542. this.$message.success("删除成功");
  543. }
  544. });
  545. } else {
  546. rows.splice(index, 1);
  547. this.$message.success("删除成功");
  548. }
  549. },
  550. getSummaries(param) {
  551. const { columns, data } = param;
  552. const sums = [];
  553. if (data.length > 0) {
  554. columns.forEach((column, index) => {
  555. if (index == 0) {
  556. sums[index] = "合计";
  557. }
  558. if (column.label == "应收金额" || column.label == "实收金额") {
  559. const values = data.map((item) => Number(item[column.property]));
  560. if (!values.every((value) => isNaN(value))) {
  561. sums[index] = values.reduce((prev, curr) => {
  562. const value = Number(curr);
  563. if (!isNaN(value)) {
  564. return prev + curr;
  565. } else {
  566. return prev;
  567. }
  568. }, 0);
  569. // sums[index] += "元";
  570. } else {
  571. sums[index] = "0";
  572. // sums[index] = "0元";
  573. }
  574. }
  575. });
  576. }
  577. return sums;
  578. },
  579. info(row, status) {
  580. this.init();
  581. this.readOnly = status;
  582. const id = row.fId ? row.fId : row;
  583. getdetail(id).then((res) => {
  584. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  585. const date = [];
  586. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  587. res.data.tFee.date = date;
  588. }
  589. this.form = res.data.tFee;
  590. this.tableData = res.data.tFeeDo;
  591. });
  592. },
  593. copyData(id) {
  594. this.init();
  595. getdetail(id).then((res) => {
  596. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  597. const date = [];
  598. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  599. res.data.tFee.date = date;
  600. }
  601. delete res.data.tFee.fId;
  602. delete res.data.tFee.fBillstatus;
  603. delete res.data.tFee.fBillno;
  604. delete res.data.tFee.srcBillNo;
  605. delete res.data.tFee.createBy;
  606. delete res.data.tFee.createTime;
  607. delete res.data.tFee.updateBy;
  608. delete res.data.tFee.updateTime;
  609. delete res.data.tFee.fRemarks;
  610. this.form = res.data.tFee;
  611. });
  612. },
  613. returnData() {
  614. this.addOrUpdateVisib = false;
  615. this.homepaGe();
  616. },
  617. homepaGe() {
  618. let view = {
  619. fullPath: "/finance/contrast",
  620. hash: "",
  621. matched: Array(2),
  622. meta: Object,
  623. name: "Contrast",
  624. params: Object,
  625. path: "/finance/contrast",
  626. query: Object,
  627. title: "对账",
  628. };
  629. this.$router.push({ path: "/index" });
  630. this.$store
  631. .dispatch("tagsView/delView", view)
  632. .then(({ visitedViews }) => {
  633. if (this.isActive(view)) {
  634. this.toLastView(visitedViews, view);
  635. }
  636. });
  637. Global.$emit("removeCache", "closeSelectedTag", view);
  638. },
  639. // 审批按钮
  640. goApproval(status) {
  641. this.addOrUpdateVisib = true;
  642. this.$nextTick(() => {
  643. this.$refs.ApprovalComments.init(this.form.fId, status, 430);
  644. });
  645. },
  646. // 撤销审批
  647. backApproval(status) {
  648. let data = {
  649. id: this.form.fId,
  650. actId: 430,
  651. billId: this.form.fId,
  652. fidStatus: status,
  653. };
  654. RevocationApproval(data).then((response) => {
  655. if (response.code === 200) {
  656. this.msgSuccess("撤销审批成功");
  657. this.open = false;
  658. }
  659. });
  660. },
  661. returnData() {
  662. this.$emit("goBack", false);
  663. },
  664. // 查看审批流
  665. addOrUpdateHandle(status) {
  666. this.addOrUpdateVisible = true;
  667. this.addOrUpdateVisib = false;
  668. let id = null;
  669. if (this.form.fId) {
  670. id = this.form.fId;
  671. } else {
  672. id = this.form.id;
  673. }
  674. this.$nextTick(() => {
  675. this.$refs.viewApproval.init(id, 430, status);
  676. });
  677. },
  678. // 撤销对账
  679. backrRconciliation() {
  680. this.form.fBillstatus = "1";
  681. let formDate = new window.FormData();
  682. formDate.append("tFee", JSON.stringify(this.form));
  683. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  684. revoke(formDate).then((response) => {
  685. this.msgSuccess("撤回成功");
  686. this.$emit("goBack", false);
  687. });
  688. },
  689. Search() {
  690. const data = {
  691. fReconciliation: this.form.fReconciliation,
  692. fDc: this.form.fDc,
  693. fSystemType: 3,
  694. fCorpid: this.form.fCorpid,
  695. fVslid: this.form.fVslid,
  696. fVoyid: this.form.fVoyid,
  697. fDestportid: this.form.fDestportid,
  698. fLoadportid: this.form.fLoadportid,
  699. fFromDate: this.form.date ? this.form.date[0] : null,
  700. fToDate: this.form.date ? this.form.date[1] : null,
  701. };
  702. this.$refs["form"].validate((valid) => {
  703. if (valid) {
  704. this.$refs.addOrUpdate.init(data, this.tableData);
  705. } else {
  706. this.$message.error("请选择客户名称");
  707. return false;
  708. }
  709. });
  710. },
  711. imporData(rows) {
  712. this.tableData = this.tableData.concat(rows);
  713. },
  714. lumpSum() {
  715. let fAmtdr = 0;
  716. let fAmtcr = 0;
  717. this.tableData.map((e) => {
  718. fAmtdr = _.add(fAmtdr, Number(e.fAmtdr));
  719. fAmtcr = _.add(fAmtcr, Number(e.fAmt));
  720. });
  721. this.form.fAmtdr = fAmtdr;
  722. this.form.fAmtcr = fAmtcr;
  723. },
  724. submit() {
  725. if (this.form.fCorpid == null) {
  726. return this.$message.error("客户名称不能为空");
  727. }
  728. this.corpList.forEach((e) => {
  729. if (this.form.fCorpid == e.fId) {
  730. this.form.fCtrlcorpid = e.fName;
  731. }
  732. });
  733. if (this.tableData.length == 0) {
  734. return this.$message.error("明细表不能为空");
  735. }
  736. if (this.form.date) {
  737. this.form.fFromDate = this.form.date[0];
  738. this.form.fToDate = this.form.date[1];
  739. }
  740. this.lumpSum();
  741. if (this.form.fId == null) {
  742. return this.$message.error("数据未保存,不能进行确认对账");
  743. }
  744. let formDate = new window.FormData();
  745. formDate.append("tFee", JSON.stringify(this.form));
  746. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  747. formDate.append("billsType", JSON.stringify("KHDZ"));
  748. confirm(formDate).then((res) => {
  749. if (res.code == 200) {
  750. this.$emit("goBack", false);
  751. this.$message.success("对账成功");
  752. }
  753. });
  754. },
  755. save(type) {
  756. if (this.form.fCorpid == null) {
  757. return this.$message.error("客户名称不能为空");
  758. }
  759. this.corpList.forEach((e) => {
  760. if (this.form.fCorpid == e.fId) {
  761. this.form.fCtrlcorpid = e.fName;
  762. }
  763. });
  764. if (this.form.date) {
  765. this.form.fFromDate = this.form.date[0];
  766. this.form.fToDate = this.form.date[1];
  767. }
  768. this.lumpSum();
  769. let formDate = new window.FormData();
  770. formDate.append("tFee", JSON.stringify(this.form));
  771. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  772. formDate.append("billsType", JSON.stringify("KHDZ"));
  773. save(formDate).then((res) => {
  774. if (res.code == 200) {
  775. if (!type) {
  776. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  777. const date = [];
  778. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  779. res.data.tFee.date = date;
  780. }
  781. this.form = res.data.tFee;
  782. this.tableData = res.data.tFeeDo;
  783. }
  784. this.$emit("refFresh");
  785. this.$message.success("保存成功");
  786. }
  787. });
  788. },
  789. cancel() {
  790. if (this.readOnly != 0) {
  791. this.$confirm("返回列表,是否保存?", "提示", {
  792. confirmButtonText: "保存",
  793. cancelButtonText: "取消",
  794. type: "warning",
  795. })
  796. .then(() => {
  797. this.save("back");
  798. Object.assign(this.$data, this.$options.data());
  799. this.$emit("goBack", false);
  800. })
  801. .catch(() => {
  802. Object.assign(this.$data, this.$options.data());
  803. this.$emit("goDetail", false);
  804. });
  805. } else {
  806. Object.assign(this.$data, this.$options.data());
  807. this.$emit("goBack", false);
  808. }
  809. },
  810. },
  811. watch: {
  812. info: function (obj) {
  813. console.log(obj);
  814. },
  815. },
  816. };
  817. </script>
  818. <style lang="scss" scoped>
  819. .head-but {
  820. display: flex;
  821. justify-content: space-between;
  822. margin-bottom: 8px;
  823. }
  824. .tabSetting {
  825. display: flex;
  826. justify-content: flex-end;
  827. }
  828. </style>