kaihe-detail.vue 25 KB

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