kaihe-detail.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886
  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 label="客户名称" prop="fCorpid">
  32. <el-select
  33. v-model="form.fCorpid"
  34. size="small"
  35. placeholder="请选择"
  36. clearable
  37. :disabled="
  38. form.fBillstatus >= 4 || readOnly == 0 || form.fId != null
  39. "
  40. style="width: 100%"
  41. filterable
  42. >
  43. <el-option
  44. v-for="item in corpList"
  45. :key="item.fId"
  46. :label="item.fName"
  47. :value="item.fId"
  48. />
  49. </el-select>
  50. </el-form-item>
  51. </el-col>
  52. <el-col :span="6">
  53. <el-form-item label="开船日期">
  54. <el-date-picker
  55. v-model="form.date"
  56. type="daterange"
  57. size="small"
  58. placeholder="请选择日期"
  59. format="yyyy-MM-dd"
  60. value-format="yyyy-MM-dd"
  61. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  62. style="width: 100%"
  63. />
  64. </el-form-item>
  65. </el-col>
  66. <el-col :span="6">
  67. <el-form-item label="船名">
  68. <el-select
  69. v-model="form.fVslid"
  70. size="small"
  71. placeholder="请选择"
  72. clearable
  73. @change="fvslChange"
  74. @clear="fvslClear"
  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. :loading="subLoading"
  245. >
  246. 确认对账
  247. </el-button>
  248. <el-button
  249. type="success"
  250. size="mini"
  251. @click="backrRconciliation"
  252. v-if="form.fBillstatus === '6'"
  253. :loading="subLoading"
  254. v-hasPermi="['finance:contrast:revoke']"
  255. >撤销对账</el-button
  256. >
  257. <el-button
  258. type="danger"
  259. size="mini"
  260. v-if="form.fBillstatus == 4"
  261. :loading="subLoading"
  262. @click="backApproval('f_billstatus')"
  263. >撤销审批</el-button
  264. >
  265. <el-button
  266. v-if="readOnly == 3"
  267. size="mini"
  268. @click="goApproval('f_billstatus')"
  269. >审批</el-button
  270. >
  271. <el-button
  272. type="primary"
  273. size="mini"
  274. v-if="form.fBillstatus >= '3'"
  275. @click="addOrUpdateHandle('f_billstatus')"
  276. >查看审批流</el-button
  277. >
  278. <el-button
  279. type="success"
  280. size="mini"
  281. @click="save"
  282. :loading="subLoading"
  283. >
  284. 保存
  285. </el-button>
  286. <el-button
  287. type="warning"
  288. size="mini"
  289. :disabled="!form.fId"
  290. @click="handleExport"
  291. >
  292. 导出
  293. </el-button>
  294. <el-button
  295. type="cyan"
  296. icon="el-icon-search"
  297. size="mini"
  298. @click="Search"
  299. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  300. >
  301. 检索
  302. </el-button>
  303. </div>
  304. <div class="tabSetting">
  305. <div style="margin: 0 12px">
  306. <el-button
  307. icon="el-icon-setting"
  308. size="mini"
  309. circle
  310. @click="colSetting"
  311. ></el-button>
  312. </div>
  313. </div>
  314. </div>
  315. <el-table
  316. :data="tableData"
  317. style="width: 100%"
  318. show-summary
  319. :summary-method="getSummaries"
  320. >
  321. <el-table-column label="序号" type="index" width="50" />
  322. <el-table-column
  323. v-for="(item, index) in tableOption"
  324. :key="index"
  325. :label="item.name"
  326. :width="item.width"
  327. :prop="item.label"
  328. align="center"
  329. :fixed="item.fixed"
  330. sortable
  331. :show-overflow-tooltip="true"
  332. >
  333. <template slot-scope="scope">
  334. <span v-if="item.label == 'srcBillNo'">
  335. {{ scope.row.srcBillNo }}
  336. </span>
  337. <span v-if="item.label == 'fName'">
  338. {{ scope.row.fName }}
  339. </span>
  340. <span v-if="item.label == 'fFeeName'">
  341. {{ scope.row.fFeeName }}
  342. </span>
  343. <span v-if="item.label == 'goodName'">
  344. {{ scope.row.goodName }}
  345. </span>
  346. <span v-if="item.label == 'fFeeUnitName'">
  347. {{ scope.row.fFeeUnitName }}
  348. </span>
  349. <span v-if="item.label == 'fQty'">
  350. {{ scope.row.fQty }}
  351. </span>
  352. <span v-if="item.label == 'fUnitPrice'">
  353. {{ scope.row.fUnitPrice }}
  354. </span>
  355. <span v-if="item.label == 'fAmtdr'">
  356. {{ scope.row.fAmtdr }}
  357. </span>
  358. <span v-if="item.label == 'fAmt'">
  359. <el-input
  360. v-model="scope.row.fAmt"
  361. size="small"
  362. placeholder="请输入"
  363. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  364. @change="fAmtChange(scope.row)"
  365. ></el-input>
  366. </span>
  367. <span v-if="item.label == 'fvslName'">
  368. {{ scope.row.fvslName }}
  369. </span>
  370. <span v-if="item.label == 'fvoyName'">
  371. {{ scope.row.fvoyName }}
  372. </span>
  373. <span v-if="item.label == 'fCntrCount'">
  374. {{ scope.row.fCntrCount }}
  375. </span>
  376. <span v-if="item.label == 'cntrName'">
  377. {{ scope.row.cntrName }}
  378. </span>
  379. <span v-if="item.label == 'fLoadPortName'">
  380. {{ scope.row.fLoadPortName }}
  381. </span>
  382. <span v-if="item.label == 'fDestPortName'">
  383. {{ scope.row.fDestPortName }}
  384. </span>
  385. <span v-if="item.label == 'fBillStatusName'">
  386. {{ scope.row.fBillStatusName }}
  387. </span>
  388. <span v-if="item.label == 'createBy'">
  389. {{ scope.row.createBy }}
  390. </span>
  391. <span v-if="item.label == 'createTime'">
  392. {{ scope.row.createTime }}
  393. </span>
  394. <span v-if="item.label == 'fRemarks'">
  395. <el-input
  396. v-model="scope.row.fRemarks"
  397. size="small"
  398. placeholder="请输入"
  399. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  400. ></el-input>
  401. </span>
  402. </template>
  403. </el-table-column>
  404. <el-table-column
  405. label="操作"
  406. align="center"
  407. class-name="small-padding fixed-width"
  408. min-width="180"
  409. fixed="right"
  410. >
  411. <template slot-scope="scope">
  412. <el-button
  413. size="mini"
  414. type="text"
  415. icon="el-icon-delete"
  416. @click="rowDel(scope.row, scope.$index, tableData)"
  417. :disabled="form.fBillstatus >= 4 || readOnly == 0"
  418. >
  419. 删除
  420. </el-button>
  421. </template>
  422. </el-table-column>
  423. </el-table>
  424. <approval-comments
  425. v-if="addOrUpdateVisib"
  426. ref="ApprovalComments"
  427. @refreshDataList="returnData"
  428. />
  429. <add-or-update ref="addOrUpdate" @imporData="imporData" />
  430. <view-approval ref="viewApproval" />
  431. <column-setting
  432. ref="columnSetting"
  433. @reset="reset"
  434. @getRowdata="getRowdata"
  435. tableName="凯和对账详情页"
  436. />
  437. </div>
  438. </template>
  439. <script>
  440. import Cookies from "js-cookie";
  441. import { tableOption2 } from "./js/index";
  442. import {
  443. selectTVesself,
  444. selectTVoyagef,
  445. selectPortName,
  446. save,
  447. listCorps,
  448. confirm,
  449. RevocationApproval,
  450. getdetail,
  451. infoRemove,
  452. revoke,
  453. getExcelInfo,
  454. } from "@/api/finance/kaihe/contrast";
  455. import ApprovalComments from "@/views/startApproval";
  456. import addOrUpdate from "./add-or-update.vue";
  457. import viewApproval from "@/views/viewApproval";
  458. import columnSetting from "@/components/ColumnSetting/index";
  459. import _ from "lodash";
  460. export default {
  461. data() {
  462. return {
  463. form: {
  464. fReconciliation: "0",
  465. fDc: "D",
  466. fSystemType: Cookies.get("sysType"),
  467. fVoyid: null,
  468. },
  469. options: [],
  470. tableData: [],
  471. tableOption: tableOption2,
  472. TVesselfs: [],
  473. TVoyagefs: [],
  474. portNames: [],
  475. corpList: [],
  476. wRtions: [],
  477. approve: false,
  478. addOrUpdateVisib: false,
  479. readOnly: null,
  480. subLoading: false,
  481. };
  482. },
  483. components: {
  484. ApprovalComments,
  485. addOrUpdate,
  486. viewApproval,
  487. columnSetting,
  488. },
  489. props: {
  490. showDetail: {
  491. type: Boolean,
  492. },
  493. },
  494. created() {},
  495. methods: {
  496. fvslChange(id) {
  497. selectTVoyagef({ fPid: id }).then((res) => {
  498. this.TVoyagefs = res.rows;
  499. });
  500. this.form.fVoyid = null;
  501. },
  502. fvslClear() {
  503. selectTVoyagef().then((res) => {
  504. this.TVoyagefs = res.rows;
  505. });
  506. this.form.fVoyid = null;
  507. },
  508. /** 导出按钮操作 */
  509. handleExport() {
  510. if (this.form.fCorpid == null) {
  511. return this.$message.error("客户名称不能为空");
  512. }
  513. let _this = this;
  514. this.$confirm("是否确认导出明细数据?", "警告", {
  515. confirmButtonText: "确定",
  516. cancelButtonText: "取消",
  517. type: "warning",
  518. })
  519. .then(function () {
  520. return getExcelInfo(_this.form.fId);
  521. })
  522. .then((response) => {
  523. this.download(response.msg);
  524. });
  525. },
  526. getRowdata(list) {
  527. this.tableOption = list;
  528. },
  529. reset() {
  530. this.tableOption = this.$options.data().tableOption;
  531. },
  532. colSetting() {
  533. this.$refs.columnSetting.init(this.tableOption);
  534. },
  535. init() {
  536. selectTVesself().then((res) => {
  537. this.TVesselfs = res.rows;
  538. });
  539. selectTVoyagef().then((res) => {
  540. this.TVoyagefs = res.rows;
  541. });
  542. selectPortName().then((res) => {
  543. this.portNames = res.rows;
  544. });
  545. this.getDicts("whether_reconciliation").then((response) => {
  546. if (response.data) {
  547. this.wRtions = response.data;
  548. }
  549. });
  550. listCorps().then((res) => {
  551. this.corpList = res;
  552. });
  553. setTimeout((e) => {
  554. this.$refs.columnSetting.getRow(this.tableOption);
  555. }, 100);
  556. },
  557. fAmtChange(row) {
  558. if (Number(row.fAmt) > Number(row.fAmtdr)) {
  559. row.fAmt = row.fAmtdr;
  560. this.$message.error("实收金额不能超过应收金额");
  561. }
  562. if (Number(row.fAmt) <= 0) {
  563. row.fAmt = row.fAmtdr;
  564. this.$message.error("请正确输入金额");
  565. }
  566. },
  567. rowDel(row, index, rows) {
  568. console.log();
  569. if (row.fId) {
  570. infoRemove(row.fId).then((res) => {
  571. if (res.code == 200) {
  572. rows.splice(index, 1);
  573. this.$message.success("删除成功");
  574. }
  575. });
  576. } else {
  577. rows.splice(index, 1);
  578. this.$message.success("删除成功");
  579. }
  580. },
  581. getSummaries(param) {
  582. const { columns, data } = param;
  583. const sums = [];
  584. if (data.length > 0) {
  585. columns.forEach((column, index) => {
  586. if (index == 0) {
  587. sums[index] = "合计";
  588. }
  589. if (column.label == "应收金额" || column.label == "实收金额") {
  590. const values = data.map((item) => Number(item[column.property]));
  591. if (!values.every((value) => isNaN(value))) {
  592. sums[index] = values.reduce((prev, curr) => {
  593. const value = Number(curr);
  594. if (!isNaN(value)) {
  595. let sum = Number(prev) + Number(curr);
  596. return Number(sum).toFixed(2);
  597. } else {
  598. return Number(prev).toFixed(2);
  599. }
  600. }, 0);
  601. // sums[index] += "元";
  602. } else {
  603. sums[index] = "0.00";
  604. // sums[index] = "0元";
  605. }
  606. }
  607. });
  608. }
  609. return sums;
  610. },
  611. info(row, status) {
  612. this.init();
  613. this.readOnly = status;
  614. const id = row.fId ? row.fId : row;
  615. getdetail(id).then((res) => {
  616. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  617. const date = [];
  618. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  619. res.data.tFee.date = date;
  620. }
  621. this.form = res.data.tFee;
  622. this.tableData = res.data.tFeeDo;
  623. });
  624. },
  625. copyData(id) {
  626. this.init();
  627. getdetail(id).then((res) => {
  628. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  629. const date = [];
  630. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  631. res.data.tFee.date = date;
  632. }
  633. delete res.data.tFee.fId;
  634. delete res.data.tFee.fBillstatus;
  635. delete res.data.tFee.fBillno;
  636. delete res.data.tFee.srcBillNo;
  637. delete res.data.tFee.createBy;
  638. delete res.data.tFee.createTime;
  639. delete res.data.tFee.updateBy;
  640. delete res.data.tFee.updateTime;
  641. delete res.data.tFee.fRemarks;
  642. this.form = res.data.tFee;
  643. });
  644. },
  645. returnData() {
  646. this.addOrUpdateVisib = false;
  647. this.homepaGe();
  648. },
  649. homepaGe() {
  650. let view = {
  651. fullPath: "/finance/contrast",
  652. hash: "",
  653. matched: Array(2),
  654. meta: Object,
  655. name: "Contrast",
  656. params: Object,
  657. path: "/finance/contrast",
  658. query: Object,
  659. title: "对账",
  660. };
  661. this.$router.push({ path: "/index" });
  662. this.$store
  663. .dispatch("tagsView/delView", view)
  664. .then(({ visitedViews }) => {
  665. if (this.isActive(view)) {
  666. this.toLastView(visitedViews, view);
  667. }
  668. });
  669. Global.$emit("removeCache", "closeSelectedTag", view);
  670. },
  671. // 审批按钮
  672. goApproval(status) {
  673. this.addOrUpdateVisib = true;
  674. this.$nextTick(() => {
  675. this.$refs.ApprovalComments.init(this.form.fId, status, 430);
  676. });
  677. },
  678. // 撤销审批
  679. backApproval(status) {
  680. let data = {
  681. id: this.form.fId,
  682. actId: 430,
  683. billId: this.form.fId,
  684. fidStatus: status,
  685. };
  686. this.subLoading = true;
  687. RevocationApproval(data).then((response) => {
  688. if (response.code === 200) {
  689. this.msgSuccess("撤销审批成功");
  690. const id = this.form.fId;
  691. getdetail(id)
  692. .then((res) => {
  693. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  694. const date = [];
  695. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  696. res.data.tFee.date = date;
  697. }
  698. this.form = res.data.tFee;
  699. this.tableData = res.data.tFeeDo;
  700. })
  701. .finally(() => {
  702. this.subLoading = false;
  703. });
  704. }
  705. });
  706. },
  707. returnData() {
  708. this.$emit("goBack", false);
  709. },
  710. // 查看审批流
  711. addOrUpdateHandle(status) {
  712. this.addOrUpdateVisible = true;
  713. this.addOrUpdateVisib = false;
  714. let id = null;
  715. if (this.form.fId) {
  716. id = this.form.fId;
  717. } else {
  718. id = this.form.id;
  719. }
  720. this.$nextTick(() => {
  721. this.$refs.viewApproval.init(id, 430, status);
  722. });
  723. },
  724. // 撤销对账
  725. backrRconciliation() {
  726. this.form.fBillstatus = "1";
  727. this.subLoading = true;
  728. let formDate = new window.FormData();
  729. formDate.append("tFee", JSON.stringify(this.form));
  730. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  731. revoke(formDate)
  732. .then((response) => {
  733. this.msgSuccess("撤回成功");
  734. Object.assign(this.$data, this.$options.data());
  735. this.$emit("goBack", false);
  736. })
  737. .finally(() => {
  738. this.subLoading = false;
  739. });
  740. },
  741. Search() {
  742. const data = {
  743. fReconciliation: this.form.fReconciliation,
  744. fDc: this.form.fDc,
  745. fSystemType: 3,
  746. fCorpid: this.form.fCorpid,
  747. fVslid: this.form.fVslid,
  748. fVoyid: this.form.fVoyid,
  749. fDestportid: this.form.fDestportid,
  750. fLoadportid: this.form.fLoadportid,
  751. fMblno: this.form.tMblno,
  752. fFromDate: this.form.date ? this.form.date[0] : null,
  753. fToDate: this.form.date ? this.form.date[1] : null,
  754. };
  755. this.$refs.addOrUpdate.init(data, this.tableData);
  756. },
  757. imporData(rows) {
  758. this.tableData = this.tableData.concat(rows);
  759. },
  760. lumpSum() {
  761. let fAmtdr = 0;
  762. let fAmtcr = 0;
  763. this.tableData.map((e) => {
  764. fAmtdr = _.add(fAmtdr, Number(e.fAmtdr));
  765. fAmtcr = _.add(fAmtcr, Number(e.fAmt));
  766. });
  767. this.form.fAmtdr = fAmtdr;
  768. this.form.fAmtcr = fAmtcr;
  769. },
  770. submit() {
  771. if (!this.form.fCorpid) {
  772. return this.$message.error("客户名称不能为空");
  773. }
  774. this.corpList.forEach((e) => {
  775. if (this.form.fCorpid == e.fId) {
  776. this.form.fCtrlcorpid = e.fName;
  777. }
  778. });
  779. if (this.tableData.length == 0) {
  780. return this.$message.error("明细表不能为空");
  781. }
  782. if (this.form.date) {
  783. this.form.fFromDate = this.form.date[0];
  784. this.form.fToDate = this.form.date[1];
  785. }
  786. this.lumpSum();
  787. if (this.form.fId == null) {
  788. return this.$message.error("数据未保存,不能进行确认对账");
  789. }
  790. this.subLoading = true;
  791. let formDate = new window.FormData();
  792. formDate.append("tFee", JSON.stringify(this.form));
  793. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  794. formDate.append("billsType", JSON.stringify("KHDZ"));
  795. confirm(formDate)
  796. .then((res) => {
  797. if (res.code == 200) {
  798. this.$message.success("对账成功");
  799. Object.assign(this.$data, this.$options.data());
  800. this.$emit("goBack", false);
  801. }
  802. })
  803. .finally(() => {
  804. this.subLoading = false;
  805. });
  806. },
  807. save(type) {
  808. if (!this.form.fCorpid) {
  809. return this.$message.error("客户名称不能为空");
  810. }
  811. this.corpList.forEach((e) => {
  812. if (this.form.fCorpid == e.fId) {
  813. this.form.fCtrlcorpid = e.fName;
  814. }
  815. });
  816. if (this.form.date) {
  817. this.form.fFromDate = this.form.date[0];
  818. this.form.fToDate = this.form.date[1];
  819. }
  820. this.lumpSum();
  821. this.subLoading = true;
  822. let formDate = new window.FormData();
  823. formDate.append("tFee", JSON.stringify(this.form));
  824. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  825. formDate.append("billsType", JSON.stringify("KHDZ"));
  826. save(formDate)
  827. .then((res) => {
  828. if (res.code == 200) {
  829. if (!type) {
  830. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  831. const date = [];
  832. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  833. res.data.tFee.date = date;
  834. }
  835. }
  836. this.form = res.data.tFee;
  837. this.tableData = res.data.tFeeDo;
  838. this.$emit("refFresh");
  839. this.$message.success("保存成功");
  840. }
  841. })
  842. .finally(() => {
  843. this.subLoading = false;
  844. });
  845. },
  846. cancel() {
  847. if (this.readOnly != 0) {
  848. this.$confirm("返回列表,是否保存?", "提示", {
  849. confirmButtonText: "保存",
  850. cancelButtonText: "取消",
  851. type: "warning",
  852. })
  853. .then(() => {
  854. this.save("back");
  855. Object.assign(this.$data, this.$options.data());
  856. this.$emit("goBack", false);
  857. })
  858. .catch(() => {
  859. Object.assign(this.$data, this.$options.data());
  860. this.$emit("goDetail", false);
  861. });
  862. } else {
  863. Object.assign(this.$data, this.$options.data());
  864. this.$emit("goBack", false);
  865. }
  866. },
  867. },
  868. watch: {
  869. info: function (obj) {
  870. console.log(obj);
  871. },
  872. },
  873. };
  874. </script>
  875. <style lang="scss" scoped>
  876. .head-but {
  877. display: flex;
  878. justify-content: space-between;
  879. margin-bottom: 8px;
  880. }
  881. .tabSetting {
  882. display: flex;
  883. justify-content: flex-end;
  884. }
  885. </style>