kaihe-detail.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885
  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. return prev + curr;
  596. } else {
  597. return prev;
  598. }
  599. }, 0);
  600. // sums[index] += "元";
  601. } else {
  602. sums[index] = "0";
  603. // sums[index] = "0元";
  604. }
  605. }
  606. });
  607. }
  608. return sums;
  609. },
  610. info(row, status) {
  611. this.init();
  612. this.readOnly = status;
  613. const id = row.fId ? row.fId : row;
  614. getdetail(id).then((res) => {
  615. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  616. const date = [];
  617. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  618. res.data.tFee.date = date;
  619. }
  620. this.form = res.data.tFee;
  621. this.tableData = res.data.tFeeDo;
  622. });
  623. },
  624. copyData(id) {
  625. this.init();
  626. getdetail(id).then((res) => {
  627. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  628. const date = [];
  629. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  630. res.data.tFee.date = date;
  631. }
  632. delete res.data.tFee.fId;
  633. delete res.data.tFee.fBillstatus;
  634. delete res.data.tFee.fBillno;
  635. delete res.data.tFee.srcBillNo;
  636. delete res.data.tFee.createBy;
  637. delete res.data.tFee.createTime;
  638. delete res.data.tFee.updateBy;
  639. delete res.data.tFee.updateTime;
  640. delete res.data.tFee.fRemarks;
  641. this.form = res.data.tFee;
  642. });
  643. },
  644. returnData() {
  645. this.addOrUpdateVisib = false;
  646. this.homepaGe();
  647. },
  648. homepaGe() {
  649. let view = {
  650. fullPath: "/finance/contrast",
  651. hash: "",
  652. matched: Array(2),
  653. meta: Object,
  654. name: "Contrast",
  655. params: Object,
  656. path: "/finance/contrast",
  657. query: Object,
  658. title: "对账",
  659. };
  660. this.$router.push({ path: "/index" });
  661. this.$store
  662. .dispatch("tagsView/delView", view)
  663. .then(({ visitedViews }) => {
  664. if (this.isActive(view)) {
  665. this.toLastView(visitedViews, view);
  666. }
  667. });
  668. Global.$emit("removeCache", "closeSelectedTag", view);
  669. },
  670. // 审批按钮
  671. goApproval(status) {
  672. this.addOrUpdateVisib = true;
  673. this.$nextTick(() => {
  674. this.$refs.ApprovalComments.init(this.form.fId, status, 430);
  675. });
  676. },
  677. // 撤销审批
  678. backApproval(status) {
  679. let data = {
  680. id: this.form.fId,
  681. actId: 430,
  682. billId: this.form.fId,
  683. fidStatus: status,
  684. };
  685. this.subLoading = true;
  686. RevocationApproval(data).then((response) => {
  687. if (response.code === 200) {
  688. this.msgSuccess("撤销审批成功");
  689. const id = this.form.fId;
  690. getdetail(id)
  691. .then((res) => {
  692. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  693. const date = [];
  694. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  695. res.data.tFee.date = date;
  696. }
  697. this.form = res.data.tFee;
  698. this.tableData = res.data.tFeeDo;
  699. })
  700. .finally(() => {
  701. this.subLoading = false;
  702. });
  703. }
  704. });
  705. },
  706. returnData() {
  707. this.$emit("goBack", false);
  708. },
  709. // 查看审批流
  710. addOrUpdateHandle(status) {
  711. this.addOrUpdateVisible = true;
  712. this.addOrUpdateVisib = false;
  713. let id = null;
  714. if (this.form.fId) {
  715. id = this.form.fId;
  716. } else {
  717. id = this.form.id;
  718. }
  719. this.$nextTick(() => {
  720. this.$refs.viewApproval.init(id, 430, status);
  721. });
  722. },
  723. // 撤销对账
  724. backrRconciliation() {
  725. this.form.fBillstatus = "1";
  726. this.subLoading = true;
  727. let formDate = new window.FormData();
  728. formDate.append("tFee", JSON.stringify(this.form));
  729. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  730. revoke(formDate)
  731. .then((response) => {
  732. this.msgSuccess("撤回成功");
  733. Object.assign(this.$data, this.$options.data());
  734. this.$emit("goBack", false);
  735. })
  736. .finally(() => {
  737. this.subLoading = false;
  738. });
  739. },
  740. Search() {
  741. const data = {
  742. fReconciliation: this.form.fReconciliation,
  743. fDc: this.form.fDc,
  744. fSystemType: 3,
  745. fCorpid: this.form.fCorpid,
  746. fVslid: this.form.fVslid,
  747. fVoyid: this.form.fVoyid,
  748. fDestportid: this.form.fDestportid,
  749. fLoadportid: this.form.fLoadportid,
  750. fMblno: this.form.tMblno,
  751. fFromDate: this.form.date ? this.form.date[0] : null,
  752. fToDate: this.form.date ? this.form.date[1] : null,
  753. };
  754. this.$refs.addOrUpdate.init(data, this.tableData);
  755. },
  756. imporData(rows) {
  757. this.tableData = this.tableData.concat(rows);
  758. },
  759. lumpSum() {
  760. let fAmtdr = 0;
  761. let fAmtcr = 0;
  762. this.tableData.map((e) => {
  763. fAmtdr = _.add(fAmtdr, Number(e.fAmtdr));
  764. fAmtcr = _.add(fAmtcr, Number(e.fAmt));
  765. });
  766. this.form.fAmtdr = fAmtdr;
  767. this.form.fAmtcr = fAmtcr;
  768. },
  769. submit() {
  770. if (this.form.fCorpid == null) {
  771. return this.$message.error("客户名称不能为空");
  772. }
  773. this.corpList.forEach((e) => {
  774. if (this.form.fCorpid == e.fId) {
  775. this.form.fCtrlcorpid = e.fName;
  776. }
  777. });
  778. if (this.tableData.length == 0) {
  779. return this.$message.error("明细表不能为空");
  780. }
  781. if (this.form.date) {
  782. this.form.fFromDate = this.form.date[0];
  783. this.form.fToDate = this.form.date[1];
  784. }
  785. this.lumpSum();
  786. if (this.form.fId == null) {
  787. return this.$message.error("数据未保存,不能进行确认对账");
  788. }
  789. this.subLoading = true;
  790. let formDate = new window.FormData();
  791. formDate.append("tFee", JSON.stringify(this.form));
  792. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  793. formDate.append("billsType", JSON.stringify("KHDZ"));
  794. confirm(formDate)
  795. .then((res) => {
  796. if (res.code == 200) {
  797. this.$message.success("对账成功");
  798. Object.assign(this.$data, this.$options.data());
  799. this.$emit("goBack", false);
  800. }
  801. })
  802. .finally(() => {
  803. this.subLoading = false;
  804. });
  805. },
  806. save(type) {
  807. if (this.form.fCorpid == null) {
  808. return this.$message.error("客户名称不能为空");
  809. }
  810. this.corpList.forEach((e) => {
  811. if (this.form.fCorpid == e.fId) {
  812. this.form.fCtrlcorpid = e.fName;
  813. }
  814. });
  815. if (this.form.date) {
  816. this.form.fFromDate = this.form.date[0];
  817. this.form.fToDate = this.form.date[1];
  818. }
  819. this.lumpSum();
  820. this.subLoading = true;
  821. let formDate = new window.FormData();
  822. formDate.append("tFee", JSON.stringify(this.form));
  823. formDate.append("tFeeDo", JSON.stringify(this.tableData));
  824. formDate.append("billsType", JSON.stringify("KHDZ"));
  825. save(formDate)
  826. .then((res) => {
  827. if (res.code == 200) {
  828. if (!type) {
  829. if (res.data.tFee.fFromDate && res.data.tFee.fToDate) {
  830. const date = [];
  831. date.push(res.data.tFee.fFromDate, res.data.tFee.fToDate);
  832. res.data.tFee.date = date;
  833. }
  834. }
  835. this.form = res.data.tFee;
  836. this.tableData = res.data.tFeeDo;
  837. this.$emit("refFresh");
  838. this.$message.success("保存成功");
  839. }
  840. })
  841. .finally(() => {
  842. this.subLoading = false;
  843. });
  844. },
  845. cancel() {
  846. if (this.readOnly != 0) {
  847. this.$confirm("返回列表,是否保存?", "提示", {
  848. confirmButtonText: "保存",
  849. cancelButtonText: "取消",
  850. type: "warning",
  851. })
  852. .then(() => {
  853. this.save("back");
  854. Object.assign(this.$data, this.$options.data());
  855. this.$emit("goBack", false);
  856. })
  857. .catch(() => {
  858. Object.assign(this.$data, this.$options.data());
  859. this.$emit("goDetail", false);
  860. });
  861. } else {
  862. Object.assign(this.$data, this.$options.data());
  863. this.$emit("goBack", false);
  864. }
  865. },
  866. },
  867. watch: {
  868. info: function (obj) {
  869. console.log(obj);
  870. },
  871. },
  872. };
  873. </script>
  874. <style lang="scss" scoped>
  875. .head-but {
  876. display: flex;
  877. justify-content: space-between;
  878. margin-bottom: 8px;
  879. }
  880. .tabSetting {
  881. display: flex;
  882. justify-content: flex-end;
  883. }
  884. </style>