settlementDetails.vue 69 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList">返回列表
  7. </el-button>
  8. </div>
  9. <div class="add-customer-btn">
  10. <el-button size="small" style="margin-right: 8px"
  11. :loading="saveLoading" :disabled="!form.id" @click="previewreportfun" >预 览
  12. </el-button>
  13. <el-button size="small" style="margin-right: 8px" v-if="roleName.indexOf('admin') != -1"
  14. :loading="saveLoading" :disabled="!form.id" @click="DesignreportDialog = true" >报表设计
  15. </el-button>
  16. <el-button size="small" type="warning" plain style="margin-right: 8px" :disabled="!form.id" v-if="form.isCleared == 1"
  17. :loading="saveLoading" @click="finstlbillsRevokeSettlementfun">撤销结算
  18. </el-button>
  19. <el-button size="small" type="success" plain style="margin-right: 8px" :disabled="!form.id" v-else
  20. :loading="saveLoading" @click="editCustomer('结算')">确认结算
  21. </el-button>
  22. <el-button size="small" type="primary" style="margin-right: 8px" :disabled="form.isCleared == 1" v-if="editSave"
  23. :loading="saveLoading" @click="editHandle">编 辑
  24. </el-button>
  25. <el-button size="small" type="primary" style="margin-right: 8px" :disabled="form.isCleared == 1" v-else
  26. :loading="saveLoading" @click="editCustomer()">保 存
  27. </el-button>
  28. </div>
  29. </div>
  30. <div style="margin: 55px 5px 0px 5px;'">
  31. <el-card class="box-card">
  32. <el-form :model="form" ref="form" label-width="90px" :rules="rules" class="demo-ruleForm">
  33. <el-row>
  34. <el-row>
  35. <el-col :span="5">
  36. <el-form-item label="往来单位" prop="corpCnName">
  37. <search-query :datalist="corpData"
  38. :selectValue="form.corpCnName"
  39. :clearable="true"
  40. :disabled="editSave || tableData.length != 0 || tableData.length > 0"
  41. :filterable="true"
  42. :remote="true"
  43. :buttonIf="false"
  44. :forParameter="{ key:'id', label:'cnName', value:'cnName'}"
  45. @corpChange="corpChange($event,'corpCnName')"
  46. @remoteMethod="corpBcorpsListfun"
  47. @corpFocus="corpBcorpsListfun" >
  48. </search-query>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :span="10">
  52. <el-form-item label="开户帐号" prop="bankId">
  53. <search-query :datalist="bankData"
  54. :selectValue="form.bankId"
  55. :clearable="true"
  56. :disabled="editSave || !form.corpId"
  57. :filterable="true"
  58. :buttonIf="false"
  59. :forParameter="{ key:'id', label:'accountBankNo', value:'id'}"
  60. @corpChange="corpChange($event,'bankId')"
  61. @corpFocus="bcorpsbankListfun" >
  62. </search-query>
  63. </el-form-item>
  64. </el-col>
  65. <el-col :span="9">
  66. <el-form-item label="事由" prop="remarks">
  67. <el-input style="width: 100%;" v-model="form.remarks"
  68. size="small" autocomplete="off"
  69. :disabled="editSave"
  70. clearable placeholder="请输入付费事由" >
  71. </el-input>
  72. </el-form-item>
  73. </el-col>
  74. <el-col :span="4">
  75. <el-form-item label="业务开始" prop="businessDateStart">
  76. <el-date-picker v-model="form.businessDateStart" clearable
  77. style="width: 100%;"
  78. type="date" size="small"
  79. :disabled="editSave || tableData.length > 0"
  80. format="yyyy-MM-dd"
  81. value-format="yyyy-MM-dd"
  82. placeholder="选择业务开始日期">
  83. </el-date-picker>
  84. </el-form-item>
  85. </el-col>
  86. <el-col :span="4">
  87. <el-form-item label="业务结束" prop="businessDateEnd">
  88. <el-date-picker v-model="form.businessDateEnd" clearable
  89. style="width: 100%;"
  90. type="date" size="small"
  91. :disabled="editSave || tableData.length > 0"
  92. format="yyyy-MM-dd"
  93. value-format="yyyy-MM-dd"
  94. placeholder="选择业务结束日期">
  95. </el-date-picker>
  96. </el-form-item>
  97. </el-col>
  98. <el-col :span="3">
  99. <el-form-item label="收/付" prop="queryAmount">
  100. <search-query :datalist="dcData"
  101. :selectValue="form.dc"
  102. :filterable="true"
  103. :clearable="true"
  104. :remote="true"
  105. :buttonIf="false"
  106. :disabled="editSave || tableData.length > 0"
  107. placeholder="请选择方向"
  108. @corpChange="corpChange($event,'dc')">
  109. </search-query>
  110. </el-form-item>
  111. </el-col>
  112. <el-col :span="3">
  113. <el-form-item label="币别" prop="curCode">
  114. <search-query :datalist="curCodeData"
  115. :selectValue="form.curCode"
  116. :clearable="true"
  117. :disabled="editSave || tableData.length > 0"
  118. :buttonIf="false"
  119. :filterable="true"
  120. :remote="true"
  121. :forParameter="{ key:'id', label:'code', value:'code'}"
  122. @corpChange="corpChange($event,'curCode')"
  123. @remoteMethod="getRateListfun"
  124. @corpFocus="getRateListfun" >
  125. </search-query>
  126. </el-form-item>
  127. </el-col>
  128. <el-col :span="5">
  129. <el-form-item label="业务编号" prop="businessNo">
  130. <el-input style="width: 100%;" v-model="form.businessNo"
  131. size="small" autocomplete="off"
  132. :disabled="editSave || tableData.length > 0"
  133. clearable placeholder="请输入JOB NO" >
  134. </el-input>
  135. </el-form-item>
  136. </el-col>
  137. <el-col :span="5">
  138. <el-form-item label="ACCT NO" prop="accountNo">
  139. <el-input style="width: 100%;" v-model="form.accountNo"
  140. size="small" autocomplete="off"
  141. :disabled="editSave || tableData.length > 0"
  142. clearable placeholder="请输入ACCT NO" >
  143. </el-input>
  144. </el-form-item>
  145. </el-col>
  146. <el-col :span="5">
  147. <el-form-item label="MBL NO" prop="mblno">
  148. <el-input style="width: 100%;" v-model="form.mblno"
  149. size="small" autocomplete="off"
  150. :disabled="editSave || tableData.length > 0"
  151. clearable placeholder="请输入MBL NO" >
  152. </el-input>
  153. </el-form-item>
  154. </el-col>
  155. <el-col :span="5">
  156. <el-form-item label="HBL NO" prop="hblno">
  157. <el-input style="width: 100%;" v-model="form.hblno"
  158. size="small" autocomplete="off"
  159. :disabled="editSave || tableData.length > 0"
  160. clearable placeholder="请输入HBL NO" >
  161. </el-input>
  162. </el-form-item>
  163. </el-col>
  164. <el-col :span="4">
  165. <el-form-item label="对账单号" prop="checkNo">
  166. <el-input style="width: 100%;" v-model="form.checkNo"
  167. size="small" autocomplete="off"
  168. :disabled="editSave || tableData.length > 0"
  169. clearable placeholder="请输入CHK NO" >
  170. </el-input>
  171. </el-form-item>
  172. </el-col>
  173. <el-col :span="5">
  174. <el-form-item label="业务类型" prop="businessTypes" >
  175. <search-query :datalist="businessTypesData"
  176. :selectValue="form.businessTypes"
  177. :clearable="true"
  178. :disabled="editSave || tableData.length > 0"
  179. :buttonIf="false"
  180. :multiple="true"
  181. @corpChange="corpChange($event,'businessTypes')">
  182. </search-query>
  183. </el-form-item>
  184. </el-col>
  185. <el-col :span="5">
  186. <el-form-item label="船 名" prop="vesselCnName" >
  187. <el-input style="width: 100%;" v-model="form.vesselCnName"
  188. size="small" autocomplete="off"
  189. :disabled="editSave || tableData.length > 0"
  190. clearable placeholder="请选择船名" ></el-input>
  191. </el-form-item>
  192. </el-col>
  193. </el-row>
  194. <expand :showBtn="true" :showSpan="true">
  195. <el-row>
  196. <el-col :span="5">
  197. <el-form-item label="航 次" prop="voyageNo" >
  198. <el-input style="width: 100%;" v-model="form.voyageNo"
  199. size="small" autocomplete="off"
  200. :disabled="editSave || tableData.length > 0"
  201. clearable placeholder="请选择航次" ></el-input>
  202. </el-form-item>
  203. </el-col>
  204. </el-row>
  205. </expand>
  206. <el-row>
  207. <el-col span="24">
  208. <div style="text-align: right">
  209. <!--<el-button size="small" type="" style="margin-right: 8px" :disabled="settlementdistar || editSave"-->
  210. <!-- :loading="saveLoading" @click="ResetFilter">重置条件-->
  211. <!--</el-button>-->
  212. <el-checkbox v-model="appendType" :disabled="settlementdistar || editSave" false-label="检索" true-label="追加">追加</el-checkbox>
  213. <el-button size="small" type="primary" style="margin-right: 8px" :disabled="settlementdistar || editSave"
  214. :loading="saveLoading" @click="retrievalfun" >检 索
  215. </el-button>
  216. </div>
  217. </el-col>
  218. </el-row>
  219. </el-row>
  220. </el-form>
  221. </el-card>
  222. <el-card style="margin-top: 10px">
  223. <div style="margin-bottom: 10px">
  224. <el-button size="small" type="info" :disabled="editSave"
  225. :loading="saveLoading" @click="SelectedRows">确认选定行
  226. </el-button>
  227. <el-button size="small" type="danger" style="margin-left: 10px" :disabled="editSave"
  228. :loading="saveLoading" @click="batchDeletefun" >一键删除
  229. </el-button>
  230. <el-input style="width: 10%;margin-left: 10px;" v-model="invoiceAmountCNY"
  231. size="small" autocomplete="off" type="numbers"
  232. clearable placeholder="开票金额" >
  233. <span style="line-height: 32px;" slot="suffix" >CNY</span>
  234. </el-input>
  235. <el-input style="width: 10%;margin-left: 5px;" v-model="invoiceAmountUSD"
  236. size="small" autocomplete="off" type="numbers"
  237. clearable placeholder="开票金额" >
  238. <span style="line-height: 32px;" slot="suffix" >USD</span>
  239. </el-input>
  240. <el-button style="margin-left: 10px" :disabled="editSave" size="small" type="primary" @click="invoiceMatchingfun()" >匹配金额</el-button>
  241. </div>
  242. <finstlbillsitems ref="finstlbillsitems" :tableData="tableData"
  243. :editSave="editSave"
  244. :settlementdistar="settlementdistar"
  245. :handleSelectionData="handleSelectionData"
  246. @handleSelectionChange="handleSelectionChange"
  247. @deletefun="finstlbillsitemsRemovefun">
  248. </finstlbillsitems>
  249. </el-card>
  250. </div>
  251. <el-card style="margin-top: 10px">
  252. <el-row>
  253. <el-col :span="3">
  254. <div class="bottomFlex" style="color: #6BBCD1">
  255. <span>应付:</span>
  256. <span class="weightnum">¥{{form.amountCr || 0}}</span>
  257. </div>
  258. </el-col>
  259. <el-col :span="3">
  260. <div class="bottomFlex" style="color: #6BBCD1">
  261. <span>应付:</span>
  262. <span class="weightnum">${{form.amountCrUsd || 0}}</span>
  263. </div>
  264. </el-col>
  265. <el-col :span="3">
  266. <div class="bottomFlex" style="color: #6BBCD1">
  267. <span>应付合计:</span>
  268. <span class="weightnum">¥{{form.amountCrLoc || 0}}</span>
  269. </div>
  270. </el-col>
  271. <el-col :span="3">
  272. <div class="bottomFlex" style="color: #81B337">
  273. <span>应收:</span>
  274. <span class="weightnum">¥{{form.amountDr || 0}}</span>
  275. </div>
  276. </el-col>
  277. <el-col :span="3">
  278. <div class="bottomFlex" style="color: #81B337">
  279. <span>应收:</span>
  280. <span class="weightnum">${{form.amountDrUsd || 0}}</span>
  281. </div>
  282. </el-col>
  283. <el-col :span="3">
  284. <div class="bottomFlex" style="color: #81B337">
  285. <span>应收合计:</span>
  286. <span class="weightnum">¥{{form.amountDrLoc || 0}}</span>
  287. </div>
  288. </el-col>
  289. </el-row>
  290. </el-card>
  291. <!--选择数据弹窗-->
  292. <el-dialog
  293. title="选择数据"
  294. class="el-dialogDeep"
  295. :visible.sync="retrievePopupsType"
  296. append-to-body
  297. width="70%"
  298. :close-on-click-modal="false">
  299. <div>
  300. <avue-crud
  301. :option="retrievePopupsOption"
  302. :data="retrievePopupsData"
  303. ref="retrievePopupsRef"
  304. id="out-table">
  305. <template slot="menu" slot-scope="{ row }">
  306. <el-button
  307. type="text"
  308. size="small"
  309. @click.stop="retrievePopupsSelect(row)"
  310. >选择
  311. </el-button>
  312. </template>
  313. </avue-crud>
  314. </div>
  315. </el-dialog>
  316. <!--设计报表弹窗-->
  317. <el-dialog append-to-body title="设计报表" class="el-dialogDeep" :visible.sync="DesignreportDialog" width="70%"
  318. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  319. <reports :id="form.id" :assemblyForm="form" businessValue="JSZX"></reports>
  320. </el-dialog>
  321. <!--预览-->
  322. <el-dialog
  323. title="打印"
  324. :visible.sync="selectPrintingDialog"
  325. append-to-body
  326. width="70%"
  327. :close-on-click-modal="false"
  328. :destroy-on-close="true"
  329. :close-on-press-escape="false"
  330. v-dialog-drag>
  331. <div>
  332. <reportformsList ref="reportformsList" @reportRadio="reportRadio"></reportformsList>
  333. </div>
  334. <span slot="footer" class="dialog-footer">
  335. <el-button size="small" @click="selectPrintingDialog = false;">取 消</el-button>
  336. </span>
  337. </el-dialog>
  338. <!--报表组件-->
  339. <reportContainer ref="reportContainer"></reportContainer>
  340. </div>
  341. </template>
  342. <script>
  343. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  344. import {getRateList} from "@/api/iosBasicData/rateManagement";
  345. import {bcorpsbankList, getBcorpslistByType} from "@/api/iosBasicData/bcorps";
  346. import {
  347. finstlbillsDetail,
  348. finstlbillsitemsRemove,
  349. finstlbillslistAccBillV1,
  350. finstlbillsSubmit,
  351. finstlbillsConfirmSettlement,
  352. finstlbillsRevokeSettlement,
  353. finstlbillsGetByDetail,
  354. finstlbillslistAccBillByCorp
  355. } from '@/api/iosBasicData/finstlbills'
  356. import expand from "@/components/basic-container/expand.vue";
  357. import finstlbillsitems from "@/views/iosBasicData/PaymentApplication/assembly/finstlbillsitems.vue";
  358. import reports from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reports.vue";
  359. import reportformsList from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reportformsList.vue";
  360. import {getList as getreportsList, reportsGetReportData} from "@/api/iosBasicData/reports";
  361. import reportContainer from "@/views/iosBasicData/report-container/report-container.vue";
  362. import { generateFinStlBills} from "@/api/iosBasicData/fininvoices";
  363. export default {
  364. components: {reportContainer, reportformsList, reports, SearchQuery,expand,finstlbillsitems},
  365. props:{
  366. // 编辑还是保存
  367. editSave:{
  368. type:Boolean,
  369. default:true
  370. },
  371. },
  372. data(){
  373. return {
  374. retrievePopupsType:false, // 弹窗开启关闭
  375. retrievePopupsData:[], // 选择弹窗数据
  376. retrievePopupsOption: {
  377. border: true,
  378. calcHeight: 30,
  379. tip: false,
  380. height: 'auto',
  381. index: true,
  382. addBtn: false,
  383. viewBtn: false,
  384. delBtn: false,
  385. editBtn: false,
  386. refreshBtn: false,
  387. columnBtn: false,
  388. menuWidth: '60',
  389. column: [
  390. {
  391. label: "客户中文名",
  392. prop: "cnName",
  393. overHidden: true,
  394. },
  395. {
  396. label: "客户英文文名",
  397. prop: "cnName",
  398. overHidden: true,
  399. },
  400. ]
  401. },
  402. invoiceAmountCNY:0, // 费用明细开票金额输入框CNY
  403. invoiceAmountUSD:0, // 费用明细开票金额输入框USD
  404. settlementdistar:false, // 结算挑进来的
  405. DesignreportDialog:false, // 设计报表弹窗
  406. selectPrintingDialog:false, // 预览报表
  407. // 收/付数据
  408. dcData: [{
  409. label: '全部',
  410. value: null
  411. },{
  412. label: '收',
  413. value: 'D'
  414. }, {
  415. label: '付',
  416. value: 'C'
  417. }],
  418. appendType:'检索', // 是否追加
  419. tableData:[],
  420. pageLoading:false, // 全屏加载动画
  421. saveLoading:false, // 按钮动画
  422. // 绑定的数据
  423. form:{
  424. dc:'C'
  425. },
  426. handleSelectionData:[], // 表格选择的数据
  427. corpData:[], // 结算单位 数据
  428. bankData:[], // 查询银行数据
  429. curCodeData:[],// 币别
  430. srcforParameter:{},
  431. // 业务类型
  432. businessTypesData:[
  433. {
  434. label:'海运出口',
  435. value:'SE'
  436. },{
  437. label:'海运进口',
  438. value:'SI'
  439. }
  440. ],
  441. rules: {
  442. corpCnName: [
  443. {required: true, message: '请输入付费对象', trigger: 'blur'},
  444. ],
  445. bankId: [
  446. {required: true, message: '请输入开户银行', trigger: 'blur'},
  447. ],
  448. remarks: [
  449. {required: true, message: '请输入付费事由', trigger: 'blur'},
  450. ],
  451. estimatedTime: [
  452. {required: true, message: '请输入预计收回', trigger: 'blur'},
  453. ],
  454. collectionSituation: [
  455. {required: true, message: '请输入收款情况', trigger: 'blur'},
  456. ],
  457. },
  458. roleName:[], // 当前的角色权限
  459. }
  460. },
  461. created() {
  462. this.roleName = localStorage.getItem('roleName').split(',')
  463. },
  464. methods:{
  465. // 打印
  466. reportRadio(val){
  467. // 获取报表数据
  468. reportsGetReportData({
  469. billId:this.form.id,
  470. reportCode:val.classifyCode,
  471. groupCode:val.groupCode,
  472. type:'JSZX'
  473. }).then(res=>{
  474. this.handleReportPreview(val.url,res.data.data.data)
  475. })
  476. },
  477. // 报表预览
  478. previewreportfun(){
  479. getreportsList(1,10,{
  480. businessType:'JSZX',
  481. // classifyCode:'结算中心',
  482. // groupCode:'付费结算'
  483. }).then(res=>{
  484. if (res.data.data.records.length == 1){
  485. this.reportRadio(res.data.data.records[0])
  486. }else {
  487. this.saveLoading = true
  488. this.selectPrintingDialog = true
  489. this.saveLoading = false
  490. let page = {
  491. pageSize: 10,
  492. currentPage: 1,
  493. total: 0
  494. }
  495. this.$nextTick(()=>{
  496. this.$refs.reportformsList.onLoad(page,{
  497. businessType:'JSZX',
  498. // classifyCode:'结算中心',
  499. // groupCode:'付费结算'
  500. })
  501. })
  502. }
  503. })
  504. },
  505. // 费用明细开票匹配
  506. invoiceMatchingfun(){
  507. if (this.invoiceAmountCNY != 0 || this.invoiceAmountUSD != 0) {
  508. let dataCNY = JSON.parse(JSON.stringify(this.invoiceAmountCNY))
  509. let dataUSD = JSON.parse(JSON.stringify(this.invoiceAmountUSD))
  510. for (let item of this.tableData) {
  511. this.$refs.finstlbillsitems.$refs.tableRef.toggleRowSelection(item,false)
  512. if (this.invoiceAmountCNY != 0) {
  513. if (dataCNY < 0) {
  514. dataCNY = 0
  515. }
  516. if (dataCNY > 1500) {
  517. if (item.currentStlCurCode == 'CNY') {
  518. this.$set(item,'currentStlAmountRMB',1500)
  519. this.$refs.finstlbillsitems.$refs.tableRef.toggleRowSelection(item,true)
  520. dataCNY -= 1500
  521. }
  522. }else {
  523. if (item.currentStlCurCode == 'CNY') {
  524. if (dataCNY != 0) {
  525. this.$refs.finstlbillsitems.$refs.tableRef.toggleRowSelection(item,true)
  526. }
  527. this.$set(item,'currentStlAmountRMB',dataCNY)
  528. dataCNY -= 1500
  529. }
  530. }
  531. }
  532. if (this.invoiceAmountUSD != 0) {
  533. if (dataUSD < 0) {
  534. dataUSD = 0
  535. }
  536. if (dataUSD > 1500) {
  537. if (item.currentStlCurCode == 'USD') {
  538. this.$set(item,'currentStlAmountUSD',1500)
  539. this.$refs.finstlbillsitems.$refs.tableRef.toggleRowSelection(item,true)
  540. dataUSD -= 1500
  541. }
  542. }else {
  543. if (item.currentStlCurCode == 'USD') {
  544. this.$set(item,'currentStlAmountUSD',dataUSD)
  545. if (dataUSD != 0) {
  546. this.$refs.finstlbillsitems.$refs.tableRef.toggleRowSelection(item,true)
  547. }
  548. dataUSD -= 1500
  549. }
  550. }
  551. }
  552. }
  553. }
  554. },
  555. // 一键删除
  556. batchDeletefun(){
  557. if (this.handleSelectionData.length == 0) {
  558. return this.$message.warning('请选择要删除的数据')
  559. }
  560. this.$confirm("确定将选择数据删除?", {
  561. confirmButtonText: "确定",
  562. cancelButtonText: "取消",
  563. type: "warning"
  564. }).then(()=>{
  565. // 获取有id 的数据
  566. const itemsWithId = this.handleSelectionData.filter(item => item.hasOwnProperty('id'));
  567. let arrIds = itemsWithId.map(item=>item.id) // 获取id 数据
  568. // 把选中的删除掉
  569. this.handleSelectionData.forEach((item)=>{
  570. for (let index in this.tableData) {
  571. if (item.accBillNo == this.tableData[index].accBillNo) {
  572. this.tableData.splice(Number(index),1)
  573. }
  574. }
  575. })
  576. // 有id 的处理
  577. if(itemsWithId.length != 0) {
  578. finstlbillsitemsRemove(arrIds.join(',')).then(res=>{
  579. this.$message.success('操作成功')
  580. })
  581. }
  582. })
  583. },
  584. // 删除
  585. finstlbillsitemsRemovefun(id,index){
  586. this.$confirm("确定将选择数据删除?", {
  587. confirmButtonText: "确定",
  588. cancelButtonText: "取消",
  589. type: "warning"
  590. }).then(()=>{
  591. if (id) {
  592. finstlbillsitemsRemove(id).then(res=>{
  593. this.$message.success('操作成功')
  594. })
  595. }
  596. this.tableData.splice(index,1)
  597. })
  598. },
  599. // 下拉回调
  600. corpChange(value,name){
  601. // 结算单位
  602. if (name == 'corpCnName') {
  603. // 开户银行
  604. this.$set(this.form,'bankId','')
  605. this.$set(this.form,'bankAccountName','')
  606. this.$set(this.form,'bankAccountBank','')
  607. this.$set(this.form,'bankAccountNo','')
  608. if (!value) {
  609. this.$set(this.form,'corpId','')
  610. this.$set(this.form,'corpCnName','')
  611. this.$set(this.form,'corpEnName','')
  612. this.$set(this.form,'corpArgreementNo','')
  613. }
  614. for(let item of this.corpData) {
  615. if (item.cnName == value) {
  616. this.$set(this.form,'corpId',item.id)
  617. this.$set(this.form,'corpCnName',item.cnName)
  618. this.$set(this.form,'corpEnName',item.enName)
  619. this.$set(this.form,'corpArgreementNo',item.enName)
  620. this.bcorpsbankListfun()
  621. }
  622. }
  623. }
  624. else if (name == 'bankId') {
  625. if (!value) {
  626. this.$set(this.form,'bankId','')
  627. this.$set(this.form,'bankAccountName','')
  628. this.$set(this.form,'bankAccountBank','')
  629. this.$set(this.form,'bankAccountNo','')
  630. }
  631. for(let item of this.bankData) {
  632. if (item.id == value) {
  633. this.$set(this.form,'bankId',item.id)
  634. this.$set(this.form,'bankAccountName',item.accountName)
  635. this.$set(this.form,'bankAccountBank',item.accountBank)
  636. this.$set(this.form,'bankAccountNo',item.accountNo)
  637. }
  638. }
  639. }
  640. else {
  641. this.$set(this.form,name,value)
  642. }
  643. },
  644. // 编辑
  645. editHandle(){
  646. this.editSave = false
  647. },
  648. // 保存
  649. editCustomer(type){
  650. this.$refs.form.validate((valid) => {
  651. if (!valid) return
  652. if (!this.form.id) {
  653. // 是否选择从表数据
  654. if (this.handleSelectionData.length == 0) {
  655. this.$message.warning('请选择结算数据');
  656. return;
  657. }
  658. }
  659. for (let item of this.handleSelectionData) {
  660. if (!item.currentStlCurCode) {
  661. this.$message.warning('请选择本次结算币种');
  662. return;
  663. }
  664. }
  665. this.saveLoading = true // 打开按钮动画
  666. if(this.form.estimatedTime) {
  667. this.form.estimatedTime = this.form.estimatedTime + ' 00:00:00'
  668. }
  669. this.saveLoading = true // 加载动画
  670. this.form.billNoFormat = 'STL'
  671. this.form.businessTypeCode = 'STL'
  672. this.form.businessType = 'STL' // 结算单
  673. this.form.businessTypes = this.form.businessTypes?this.form.businessTypes.join(','):'' // 业务类型
  674. this.form.businessDateStart = this.form.businessDateStart?this.form.businessDateStart.slice(0,10) + ' 00:00:00':null // 财务开始日期
  675. this.form.businessDateEnd = this.form.businessDateEnd?this.form.businessDateEnd.slice(0,10) + ' 00:00:00':null // 财务开始日期
  676. this.form.billDate = this.form.billDate?this.form.billDate.slice(0,10) + ' 00:00:00':null
  677. this.form.auditDateTo = this.form.auditDateTo?this.form.auditDateTo.slice(0,10) + ' 00:00:00':null
  678. this.form.settlementType = this.settlementType
  679. if (this.form.id) {
  680. this.form.finStlBillsItemsList = this.form.finStlBillsItemsList.map((item,index)=>{
  681. if (item.currentStlCurCode == 'CNY') {
  682. item.currentStlAmount = item.currentStlAmountRMB
  683. }else {
  684. item.currentStlAmount = item.currentStlAmountUSD
  685. }
  686. return item
  687. })
  688. }else {
  689. this.form.finStlBillsItemsList = this.handleSelectionData.map((item,index)=>{
  690. if (item.currentStlCurCode == 'CNY') {
  691. item.currentStlAmount = item.currentStlAmountRMB
  692. }else {
  693. item.currentStlAmount = item.currentStlAmountUSD
  694. }
  695. if (!this.form.id) {
  696. delete item.businessType
  697. delete item.billDate
  698. delete item.accountDc
  699. }
  700. return item
  701. })
  702. }
  703. // 判断是结算还是保存
  704. if (type == '结算') {
  705. this.$confirm("确定进行结算操作?", {
  706. confirmButtonText: "确定",
  707. cancelButtonText: "取消",
  708. type: "warning"
  709. }).then(()=>{
  710. finstlbillsSubmit(this.form).then(res=>{
  711. this.form = res.data.data
  712. this.finstlbillsConfirmSettlementfun()
  713. })
  714. }).catch(()=>{
  715. this.saveLoading = false // 关闭按钮动画
  716. })
  717. }else {
  718. finstlbillsSubmit(this.form).then(res=>{
  719. this.$message.success('操作成功');
  720. this.saveLoading = false // 关闭按钮动画
  721. this.finstlbillsDetailfun(res.data.data.id)
  722. })
  723. }
  724. })
  725. },
  726. // 详情接口
  727. finstlbillsDetailfun(id){
  728. this.pageLoading = true
  729. finstlbillsDetail(id).then(res=>{
  730. this.form = res.data.data
  731. this.form.businessTypes = this.form.businessTypes?this.form.businessTypes.split(','):[] // 业务类型转换成数组显示
  732. this.tableData = this.form.finStlBillsItemsList.map(item=>{
  733. item.stlTtlAmountNet = Number(item.stlTtlAmount) - (Number(item.stlTtlAmount) * (Number(item.taxRate) + Number(item.surchargeRate)))
  734. item.currentStlAmountNet = Number(item.unsettledAmount) - (Number(item.unsettledAmount) * (Number(item.taxRate) + Number(item.surchargeRate)))
  735. if(item.curCode == 'CNY') {
  736. this.$set(item,'currentInvoiceAmountRMB',item.currentInvoiceAmount)
  737. this.$set(item,'amountRMB',item.amount)
  738. this.$set(item,'amountNetRMB',item.amountNet)
  739. this.$set(item,'stlTtlAmountRMB',item.stlTtlAmount)
  740. this.$set(item,'stlTtlAmountNetRMB',item.stlTtlAmountNet)
  741. this.$set(item,'currentStlAmountNetRMB',item.currentStlAmountNet)
  742. this.$set(item,'currentStlAmountRMB',item.currentStlAmount)
  743. }else {
  744. this.$set(item,'currentInvoiceAmountUSD',item.currentInvoiceAmount)
  745. this.$set(item,'amountUSD',item.amount)
  746. this.$set(item,'amountNetUSD',item.amountNet)
  747. this.$set(item,'stlTtlAmountNetUSD',item.stlTtlAmountNet)
  748. this.$set(item,'stlTtlAmountUSD',item.stlTtlAmount)
  749. this.$set(item,'currentStlAmountNetUSD',item.currentStlAmountNet)
  750. this.$set(item,'currentStlAmountUSD',item.currentStlAmount)
  751. }
  752. if (item.srcIdInvoices) {
  753. this.settlementdistar = true
  754. }
  755. return item
  756. })
  757. this.pageLoading = false
  758. this.bcorpsbankListfun() // 查银行数据
  759. }).catch(err=>{
  760. this.pageLoading = false
  761. })
  762. },
  763. // 结算按钮
  764. generateFinStlBillsfun(id,dc){
  765. this.pageLoading = true
  766. if (dc == 'C' || dc == 'D') {
  767. this.settlementType = dc
  768. }
  769. generateFinStlBills({
  770. billId:id,
  771. dc:dc
  772. }).then(res=>{
  773. this.form = res.data.data
  774. this.form.businessTypes = this.form.businessTypes?this.form.businessTypes.split(','):[] // 业务类型转换成数组显示
  775. this.tableData = this.form.finStlBillsItemsList.map(item=>{
  776. item.stlTtlAmountNet = Number(item.stlTtlAmount) - (Number(item.stlTtlAmount) * (Number(item.taxRate) + Number(item.surchargeRate)))
  777. item.currentStlAmountNet = Number(item.unsettledAmount) - (Number(item.unsettledAmount) * (Number(item.taxRate) + Number(item.surchargeRate)))
  778. if(item.curCode == 'CNY') {
  779. this.$set(item,'currentInvoiceAmountRMB',item.currentInvoiceAmount)
  780. this.$set(item,'amountRMB',item.amount)
  781. this.$set(item,'amountNetRMB',item.amountNet)
  782. this.$set(item,'stlTtlAmountRMB',item.stlTtlAmount)
  783. this.$set(item,'stlTtlAmountNetRMB',item.stlTtlAmountNet)
  784. this.$set(item,'currentStlAmountNetRMB',item.currentStlAmountNet)
  785. this.$set(item,'currentStlAmountRMB',item.currentStlAmount)
  786. }else {
  787. this.$set(item,'currentInvoiceAmountUSD',item.currentInvoiceAmount)
  788. this.$set(item,'amountUSD',item.amount)
  789. this.$set(item,'amountNetUSD',item.amountNet)
  790. this.$set(item,'stlTtlAmountNetUSD',item.stlTtlAmountNet)
  791. this.$set(item,'stlTtlAmountUSD',item.stlTtlAmount)
  792. this.$set(item,'currentStlAmountNetUSD',item.currentStlAmountNet)
  793. this.$set(item,'currentStlAmountUSD',item.currentStlAmount)
  794. }
  795. if (item.srcIdInvoices) {
  796. this.settlementdistar = true
  797. }
  798. return item
  799. })
  800. this.pageLoading = false
  801. this.bcorpsbankListfun() // 查银行数据
  802. }).catch(err=>{
  803. this.pageLoading = false
  804. })
  805. },
  806. // 重置条件
  807. ResetFilter(){
  808. this.form = {}
  809. },
  810. // 弹窗选择
  811. retrievePopupsSelect(row){
  812. // this.form = row
  813. this.$set(this.form,'corpId',row.id)
  814. this.$set(this.form,'corpCnName',row.cnName)
  815. this.$set(this.form,'corpEnName',row.enName)
  816. this.$set(this.form,'corpArgreementNo',row.enName)
  817. this.retrievePopupsType = false
  818. this.bcorpsbankListfun()
  819. this.finstlbillslistAccBillV1fun(this.appendType)
  820. },
  821. // 检索
  822. retrievalfun(){
  823. // 判断是否有对账单位
  824. if (!this.form.corpId && (this.form.businessNo || this.form.accountNo || this.form.hblno || this.form.mblno)) {
  825. console.log('新接口')
  826. this.finstlbillslistAccBillByCorpfun()
  827. }else {
  828. if (!this.form.corpId) {
  829. return this.$message.warning('请填写对账单位')
  830. }
  831. console.log('原来的接口')
  832. this.finstlbillslistAccBillV1fun(this.appendType)
  833. }
  834. },
  835. // 检索弹窗数据
  836. finstlbillslistAccBillByCorpfun(){
  837. let obj = {}
  838. obj.type = '2'
  839. obj.curCode = this.form.curCode // 币别
  840. obj.dc = this.form.dc // 收付 D=收 C=付
  841. obj.accBillNo = this.form.accountNo // 账单编号 ACCT NO
  842. obj.billNo = this.form.businessNo // 单据编号 JOB NO
  843. obj.mblno = this.form.mblno // MB/L NO
  844. obj.hblno = this.form.hblno // HB/L NO
  845. obj.queryAmount = this.form.queryAmount // 查询金额
  846. obj.businessType = this.form.businessTypes?this.form.businessTypes.join(','):'' // 业务类型
  847. obj.vesselCnName = this.form.vesselCnName // 中文船名
  848. obj.receivableAdvance = this.form.receivableAdvance // 预收帐款
  849. obj.voyageNo = this.form.voyageNo // 航次
  850. obj.signforDateList = this.form.signforDateList // 签收日期
  851. obj.auditStatus = '0'
  852. obj.businessDateStart = this.form.businessDateStart // 业务开始日期
  853. obj.businessDateEnd = this.form.businessDateEnd // 业务开始日期
  854. finstlbillslistAccBillByCorp(obj).then(res=>{
  855. this.retrievePopupsType = true
  856. this.retrievePopupsData = res.data.data
  857. })
  858. },
  859. // 检索接口
  860. finstlbillslistAccBillV1fun(type){
  861. // 对账单位
  862. if (!this.form.corpId) {
  863. this.$message.warning('请选择对账单位');
  864. return
  865. }
  866. let obj = {}
  867. obj.type = '2'
  868. obj.curCode = this.form.curCode // 币别
  869. obj.dc = this.form.dc // 收付 D=收 C=付
  870. obj.accBillNo = this.form.accountNo // 账单编号 ACCT NO
  871. obj.billNo = this.form.businessNo // 单据编号 JOB NO
  872. obj.mblno = this.form.mblno // MB/L NO
  873. obj.hblno = this.form.hblno // HB/L NO
  874. obj.queryAmount = this.form.queryAmount // 查询金额
  875. obj.businessType = this.form.businessTypes?this.form.businessTypes.join(','):'' // 业务类型
  876. obj.vesselCnName = this.form.vesselCnName // 中文船名
  877. obj.receivableAdvance = this.form.receivableAdvance // 预收帐款
  878. obj.voyageNo = this.form.voyageNo // 航次
  879. obj.signforDateList = this.form.signforDateList // 签收日期
  880. obj.auditStatus = '0'
  881. obj.businessDateStart = this.form.businessDateStart // 业务开始日期
  882. obj.businessDateEnd = this.form.businessDateEnd // 业务开始日期
  883. // 判断是否有对账单号
  884. if (this.form.checkNo) {
  885. obj.corpId = this.form.corpId // 结算单位
  886. obj.checkNo = this.form.checkNo // CHK NO 对账单号
  887. finstlbillsGetByDetail(obj).then(res=>{
  888. let arr = res.data.data.finStlBillsItemsList.map((item)=>{
  889. delete item.id
  890. if(item.curCode == 'CNY') {
  891. // 发票
  892. this.$set(item,'currentInvoiceAmountRMB',item.currentInvoiceAmount)
  893. // 应结算金额
  894. this.$set(item,'amountRMB',item.amount)
  895. // 已结算金额
  896. this.$set(item,'stlTtlAmountRMB',item.stlTtlAmount)
  897. if (item.dc == 'D') {
  898. // 本次金额
  899. this.$set(item,'currentStlAmountRMB',item.currentStlAmount)
  900. }else {
  901. // 本次金额
  902. this.$set(item,'currentStlAmountRMB',item.appliedCurrentStlAmount)
  903. }
  904. }else {
  905. // 发票
  906. this.$set(item,'currentInvoiceAmountUSD',item.currentInvoiceAmount)
  907. // 应结算金额
  908. this.$set(item,'amountUSD',item.amount)
  909. // 已结算金额
  910. this.$set(item,'stlTtlAmountUSD',item.stlTtlAmount)
  911. // 本次金额
  912. if (item.dc == 'D') {
  913. // 本次金额
  914. this.$set(item,'currentStlAmountUSD',item.currentStlAmount)
  915. }else {
  916. // 本次金额
  917. this.$set(item,'currentStlAmountUSD',item.appliedCurrentStlAmount)
  918. }
  919. }
  920. return item
  921. })
  922. if (type == '追加') {
  923. let a = [...this.tableData,...arr,]
  924. this.tableData = a.filter((obj, index) => {
  925. return a.findIndex((elem) => {
  926. return elem.accBillNo === obj.accBillNo
  927. }) === index;
  928. });
  929. }else {
  930. // 获取有id 的数据
  931. const itemsWithId = this.tableData.filter(item => item.hasOwnProperty('id'));
  932. let arrIds = itemsWithId.map(item=>item.id) // 获取id 数据
  933. // 有id 的处理
  934. if(itemsWithId.length != 0) {
  935. finstlbillsitemsRemove(arrIds.join(',')).then(res=>{
  936. this.$message.success('操作成功')
  937. })
  938. }
  939. if(arr.length == 0){
  940. this.$message.warning('当前检索暂无数据!')
  941. }
  942. this.tableData = arr
  943. }
  944. })
  945. }else {
  946. obj.corpCnName = this.form.corpId // 结算单位
  947. obj.checkBillNo = this.form.checkNo // CHK NO 对账单号
  948. finstlbillslistAccBillV1(obj).then(res=>{
  949. let arr = res.data.data.map((item,index)=>{
  950. item.accBillId = item.id
  951. delete item.id
  952. // 账单编号
  953. item.accBillNo = item.billNo
  954. item.currentStlCurCode = item.curCode // 币别
  955. item.currentStlExrate = item.exrate
  956. // isCleared
  957. item.lineNo = Number(index) + 1
  958. item.pType = item.businessType
  959. item.billNo = item.businessBillDivideNo?item.businessBillDivideNo:item.businessBillNo
  960. item.accDate = item.billDate
  961. item.dc = item.accountDc // 收付
  962. if(item.curCode == 'CNY') {
  963. // 发票
  964. this.$set(item,'currentInvoiceAmountRMB',item.currentInvoiceAmount)
  965. // 应结算金额
  966. this.$set(item,'amountRMB',item.amount)
  967. // 已结算金额
  968. this.$set(item,'stlTtlAmountRMB',item.stlTtlAmount)
  969. // 本次金额
  970. if (item.dc == 'D') {
  971. // 本次金额
  972. this.$set(item,'currentStlAmountRMB',item.appliedInvoiceCurrentStlAmount)
  973. }else {
  974. // 本次金额
  975. this.$set(item,'currentStlAmountRMB',item.appliedCurrentStlAmount)
  976. }
  977. }else {
  978. // 发票
  979. this.$set(item,'currentInvoiceAmountUSD',item.currentInvoiceAmount)
  980. // 应结算金额
  981. this.$set(item,'amountUSD',item.amount)
  982. // 已结算金额
  983. this.$set(item,'stlTtlAmountUSD',item.stlTtlAmount)
  984. // 本次金额
  985. if (item.dc == 'D') {
  986. // 本次金额
  987. this.$set(item,'currentStlAmountUSD',item.appliedInvoiceCurrentStlAmount)
  988. }else {
  989. // 本次金额
  990. this.$set(item,'currentStlAmountUSD',item.appliedCurrentStlAmount)
  991. }
  992. }
  993. return item
  994. })
  995. if (type == '追加') {
  996. let a = [...this.tableData,...arr,]
  997. this.tableData = a.filter((obj, index) => {
  998. return a.findIndex((elem) => {
  999. return elem.accBillNo === obj.accBillNo
  1000. }) === index;
  1001. });
  1002. }else {
  1003. // 获取有id 的数据
  1004. const itemsWithId = this.tableData.filter(item => item.hasOwnProperty('id'));
  1005. let arrIds = itemsWithId.map(item=>item.id) // 获取id 数据
  1006. // 有id 的处理
  1007. if(itemsWithId.length != 0) {
  1008. finstlbillsitemsRemove(arrIds.join(',')).then(res=>{
  1009. this.$message.success('操作成功')
  1010. })
  1011. }
  1012. if(arr.length == 0){
  1013. this.$message.warning('当前检索暂无数据!')
  1014. }
  1015. this.tableData = arr
  1016. }
  1017. })
  1018. }
  1019. },
  1020. // 结算确认
  1021. finstlbillsConfirmSettlementfun(){
  1022. this.pageLoading = true
  1023. this.form.businessTypes = this.form.businessTypes?this.form.businessTypes.join(','):'' // 业务类型
  1024. this.form.businessDateStart = this.form.businessDateStart?this.form.businessDateStart.slice(0,10) + ' 00:00:00':null // 财务开始日期
  1025. this.form.businessDateEnd = this.form.businessDateEnd?this.form.businessDateEnd.slice(0,10) + ' 00:00:00':null // 财务开始日期
  1026. this.form.billDate = this.form.billDate?this.form.billDate.slice(0,10) + ' 00:00:00':null
  1027. this.form.auditDateTo = this.form.auditDateTo?this.form.auditDateTo.slice(0,10) + ' 00:00:00':null
  1028. this.form.url = '/iosBasicData/ComputationCenter/index',
  1029. this.form.pageStatus = "this.$store.getters.SettlementCenterF"
  1030. this.form.pageLabel = "结算中心(F)"
  1031. finstlbillsConfirmSettlement(this.form).then(res=>{
  1032. this.pageLoading = false
  1033. this.saveLoading = false
  1034. this.$message.success('操作成功');
  1035. this.finstlbillsDetailfun(res.data.data.id)
  1036. }).catch(err=>{
  1037. this.pageLoading = false
  1038. this.saveLoading = false
  1039. })
  1040. },
  1041. // 结算撤销
  1042. finstlbillsRevokeSettlementfun(){
  1043. this.$confirm("确定进行撤销对账操作?", {
  1044. confirmButtonText: "确定",
  1045. cancelButtonText: "取消",
  1046. type: "warning"
  1047. }).then(()=>{
  1048. this.pageLoading = true
  1049. this.form.businessTypes = this.form.businessTypes?this.form.businessTypes.join(','):'' // 业务类型
  1050. this.form.businessDateStart = this.form.businessDateStart?this.form.businessDateStart.slice(0,10) + ' 00:00:00':null // 财务开始日期
  1051. this.form.businessDateEnd = this.form.businessDateEnd?this.form.businessDateEnd.slice(0,10) + ' 00:00:00':null // 财务开始日期
  1052. this.form.billDate = this.form.billDate?this.form.billDate.slice(0,10) + ' 00:00:00':null
  1053. this.form.auditDateTo = this.form.auditDateTo?this.form.auditDateTo.slice(0,10) + ' 00:00:00':null
  1054. finstlbillsRevokeSettlement(this.form).then(res=>{
  1055. this.pageLoading = false
  1056. this.$message.success('操作成功');
  1057. this.finstlbillsDetailfun(res.data.data.id)
  1058. })
  1059. }).catch(err=>{
  1060. this.pageLoading = false
  1061. })
  1062. },
  1063. // 确认选定行
  1064. SelectedRows(){
  1065. this.editCustomer()
  1066. },
  1067. // 下面表格多选
  1068. handleSelectionChange(arr){
  1069. this.handleSelectionData = arr
  1070. },
  1071. //返回列表
  1072. backToList() {
  1073. this.$emit('goBack')
  1074. },
  1075. // 请求的接口
  1076. // 获取币别数据
  1077. getRateListfun(cnName){
  1078. getRateList({current:1,size:10,cnName}).then(res=>{
  1079. this.curCodeData = res.data.data.records
  1080. })
  1081. },
  1082. // 获取结算单位数据
  1083. corpBcorpsListfun(cnName){
  1084. getBcorpslistByType(1,10,{cnName}).then(res=>{
  1085. this.corpData = res.data.data.records
  1086. })
  1087. },
  1088. // 获取银行数据
  1089. bcorpsbankListfun(){
  1090. bcorpsbankList(1,50,{pid:this.form.corpId}).then(res=>{
  1091. this.bankData = res.data.data.records.map(item=>{
  1092. item.accountBankNo = item.accountBank + ' - ' + item.accountNo
  1093. return item
  1094. })
  1095. if (!this.form.bankId) {
  1096. this.$set(this.form,'bankId',res.data.data.records[0].id)
  1097. this.$set(this.form,'bankAccountName',res.data.data.records[0].accountName)
  1098. this.$set(this.form,'bankAccountBank',res.data.data.records[0].accountBank)
  1099. this.$set(this.form,'bankAccountNo',res.data.data.records[0].accountNo)
  1100. }
  1101. })
  1102. },
  1103. // 预览报表
  1104. handleReportPreview(url,data){
  1105. console.log(url,1670)
  1106. console.log(data,1671)
  1107. Stimulsoft.Base.StiLicense.key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHn0s4gy0Fr5YoUZ9V00Y0igCSFQzwEqYBh/N77k4f0fWXTHW5rqeBNLkaurJDenJ9o97TyqHs9HfvINK18Uwzsc/bG01Rq+x3H3Rf+g7AY92gvWmp7VA2Uxa30Q97f61siWz2dE5kdBVcCnSFzC6awE74JzDcJMj8OuxplqB1CYcpoPcOjKy1PiATlC3UsBaLEXsok1xxtRMQ283r282tkh8XQitsxtTczAJBxijuJNfziYhci2jResWXK51ygOOEbVAxmpflujkJ8oEVHkOA/CjX6bGx05pNZ6oSIu9H8deF94MyqIwcdeirCe60GbIQByQtLimfxbIZnO35X3fs/94av0ODfELqrQEpLrpU6FNeHttvlMc5UVrT4K+8lPbqR8Hq0PFWmFrbVIYSi7tAVFMMe2D1C59NWyLu3AkrD3No7YhLVh7LV0Tttr/8FrcZ8xirBPcMZCIGrRIesrHxOsZH2V8t/t0GXCnLLAWX+TNvdNXkB8cF2y9ZXf1enI064yE5dwMs2fQ0yOUG/xornE'
  1108. // Stimulsoft.Base.StiLicense.Key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHkcgIvwL0jnpsDqRpWg5FI5kt2G7A0tYIcUygBh1sPs7plofUOqPB1a4HBIXJB621mau2oiAIj+ysU7gKUXfjn/D5BocmduNB+ZMiDGPxFrAp3PoD0nYNkkWh8r7gBZ1v/JZSXGE3bQDrCQCNSy6mgby+iFAMV8/PuZ1z77U+Xz3fkpbm6MYQXYp3cQooLGLUti7k1TFWrnawT0iEEDJ2iRcU9wLqn2g9UiWesEZtKwI/UmEI2T7nv5NbgV+CHguu6QU4WWzFpIgW+3LUnKCT/vCDY+ymzgycw9A9+HFSzARiPzgOaAuQYrFDpzhXV+ZeX31AxWlnzjDWqpfluygSNPtGul5gyNt2CEoJD1Yom0VN9fvRonYsMsimkFFx2AwyVpPcs+JfVBtpPbTcZscnzUdmiIvxv8Gcin6sNSibM6in/uUKFt3bVgW/XeMYa7MLGF53kvBSwi78poUDigA2n12SmghLR0AHxyEDIgZGOTbNI33GWu7ZsPBeUdGu55R8w='
  1109. Stimulsoft.Base.Localization.StiLocalization.addLocalizationFile( '/reports/stimulsoft/Localization/zh-CHS.xml', true, 'zh-CHS')
  1110. Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile('/reports/stimulsoft/Localization/zh-CHS.xml' )
  1111. // 工具栏
  1112. var options = new Stimulsoft.Viewer.StiViewerOptions()
  1113. options.height = '100%'
  1114. options.appearance.scrollbarsMode = true // 滚动条模式
  1115. options.toolbar.showDesignButton = false // 显示设计按钮
  1116. options.toolbar.showAboutButton = false // 显示关于按钮
  1117. options.toolbar.showResourcesButton = false // 显示资源按钮
  1118. options.toolbar.showFullScreenButton = false // 显示全屏按钮
  1119. options.toolbar.showOpenButton = false // 显示打开按钮
  1120. options.appearance.showTooltips = false // 显示工具提示
  1121. options.appearance.showDialogsHelp = false // 显示对话框帮助
  1122. options.exports.showExportToDocument = false // 显示导出到文档
  1123. options.toolbar.showParametersButton = true // 显示参数按钮
  1124. options.appearance.bookmarksPrint = true // 书签打印
  1125. // options.toolbar.showPrintButton = false // 打印按钮是否显示 下面直接自定义控制打印弹窗是否开启
  1126. // printDestination 参数:用于指定报表打印的目标位置,可以是打印机、PDF 文件或者直接打印到浏览器等。
  1127. // Stimulsoft.Viewer.StiPrintDestination.Direct:表示直接打印到打印机,即将报表内容直接发送至打印机进行打印。
  1128. // 通过设置不同的 printDestination 参数,你可以控制报表打印的行为,例如是直接打印到打印机,还是生成 PDF 文件,或者直接在浏览器中预览打印内容等。
  1129. options.toolbar.printDestination = Stimulsoft.Viewer.StiPrintDestination.Direct
  1130. // htmlRenderMode html渲染模式
  1131. options.appearance.htmlRenderMode = Stimulsoft.Report.Export.StiHtmlExportMode.Table
  1132. // 是创建一个 Stimulsoft 报表查看器的实例的代码
  1133. let viewer = new Stimulsoft.Viewer.StiViewer(options, 'StiViewer', false)
  1134. // 报表
  1135. console.log("创建一个报表实例");
  1136. console.log()
  1137. let report = new window.Stimulsoft.Report.StiReport();
  1138. // 加载文件
  1139. console.log("从url加载报表");
  1140. // report.loadFile("/reports/stimulsoft/demos/SimpleList.mrt");
  1141. report.load(url)
  1142. data.pageOne = 'Page : 1 of 1'
  1143. // 处理超长数据
  1144. if (data.hshipperDetails) {
  1145. var consignerIndex2 = data.hshipperDetails.indexOf( '\n' )
  1146. for (let i = 0; i < 4; i++) {
  1147. consignerIndex2 = data.hshipperDetails.indexOf( '\n', consignerIndex2 + 1 );
  1148. }
  1149. if (consignerIndex2 != -1) {
  1150. var hshipperDetails = data.hshipperDetails.substring(consignerIndex2 + 2, data.hshipperDetails.length)
  1151. data.hshipperDetails = data.hshipperDetails.substring(0, consignerIndex2) + ' *'
  1152. data.commodityDescr += '\n*' + hshipperDetails
  1153. }
  1154. }
  1155. if (data.hconsigneeDetails) {
  1156. var consigneeIndex2 = data.hconsigneeDetails.indexOf( '\n' )
  1157. for (let i = 0; i < 3; i++) {
  1158. consigneeIndex2 = data.hconsigneeDetails.indexOf( '\n', consigneeIndex2 + 1 );
  1159. }
  1160. if (consigneeIndex2 != -1) {
  1161. var hconsigneeDetails = data.hconsigneeDetails.substring(consigneeIndex2 + 2, data.hconsigneeDetails.length)
  1162. data.hconsigneeDetails = data.hconsigneeDetails.substring(0, consigneeIndex2) + ' **'
  1163. data.commodityDescr += '\n**' + hconsigneeDetails
  1164. }
  1165. }
  1166. if (data.hnotifyDetails) {
  1167. var notifierIndex2 = data.hnotifyDetails.indexOf( '\n' )
  1168. for (let i = 0; i < 3; i++) {
  1169. notifierIndex2 = data.hnotifyDetails.indexOf( '\n', notifierIndex2 + 1 );
  1170. }
  1171. if (notifierIndex2 != -1) {
  1172. var hnotifyDetails = data.hnotifyDetails.substring(notifierIndex2 + 2, data.hnotifyDetails.length)
  1173. data.hnotifyDetails = data.hnotifyDetails.substring(0, notifierIndex2) + ' ***'
  1174. data.commodityDescr += '\n***' + hnotifyDetails
  1175. }
  1176. }
  1177. // 处理箱号
  1178. if (this.isPrintTheBoxNumber) {
  1179. data.commodityDescr += '\n.\n.\n'
  1180. }
  1181. // PLACE & DATE OF ISSUE
  1182. data.placeAndDateOfIssue = ''
  1183. if (data.issueAt) {
  1184. data.placeAndDateOfIssue += data.issueAt
  1185. }
  1186. if (data.issueDate) {
  1187. let date = new Date(data.issueDate.replace(/-/g,'/'));
  1188. let yyyy = date.getFullYear();
  1189. let mmmm = date.toDateString().split(" ")[1]
  1190. let dd = date.getDate()
  1191. data.placeAndDateOfIssue += ', ' + dd + '-' + mmmm + '-' + yyyy
  1192. }
  1193. // Total number of containers or packages received by the Carriers
  1194. if (data.preContainersList) {
  1195. let boxMap = new Map();
  1196. for (let boxQuantity of data.preContainersList) {
  1197. if (boxMap.get(boxQuantity.cntrTypeCode)) {
  1198. let v = boxMap.get(boxQuantity.cntrTypeCode)
  1199. boxMap.set(boxQuantity.cntrTypeCode, v + boxQuantity.quantity)
  1200. } else {
  1201. boxMap.set(boxQuantity.cntrTypeCode, boxQuantity.quantity)
  1202. }
  1203. }
  1204. let boxs = ''
  1205. boxMap.forEach(function (value, key, map) {
  1206. boxs += value + 'x' + key + ', '
  1207. })
  1208. boxs = boxs.substring(0, boxs.length - 2)
  1209. data.boxQuantity = boxs + ' CONTAINER(S) ONLY'
  1210. }
  1211. // Number of original B/Ls
  1212. if (data.numberOfObl) {
  1213. data.numberOfObl += ' (' + data.numberOfOblDigit + ')'
  1214. }
  1215. if (data.commodityDescr) {
  1216. var descriptionIndex2 = data.commodityDescr.indexOf( '\n' )
  1217. for (let i = 0; i < 19; i++) {
  1218. descriptionIndex2 = data.commodityDescr.indexOf( '\n', descriptionIndex2 + 1 );
  1219. }
  1220. if (descriptionIndex2 != -1) {
  1221. data.pageOne = 'Page : 1 of 2'
  1222. data.pageTwo = 'Page : 2 of 2'
  1223. var extraLongText = data.commodityDescr.substring(descriptionIndex2 + 2, data.commodityDescr.length)
  1224. data.commodityDescr = data.commodityDescr.substring(0, descriptionIndex2)
  1225. data.extraLongTips = '** TO BE CONTINUED ON ATTACHED LIST **'
  1226. data.extraLongText = extraLongText
  1227. }
  1228. }
  1229. // console.log(data.hshipperDetails, 'hshipperDetails2')
  1230. // 创建一个 Stimulsoft 数据集(DataSet)的实例的代码
  1231. var dataSet = new Stimulsoft.System.Data.DataSet(
  1232. 'reportData'
  1233. )
  1234. dataSet.readJson(data) // 用于将 JSON 格式的数据加载到数据集中。data 是包含报表数据的 JSON 对象。
  1235. // 这是一个方法调用,用于在报表中注册数据源。参数 'reportData' 是数据源的名称,
  1236. // 第二个 'reportData' 是数据源的别名,dataSet 则是之前创建的数据集实例
  1237. report.regData('reportData', 'reportData', dataSet)
  1238. // 从模版和数据加载报表
  1239. // loadReport(report, '', {})
  1240. // 这是将报表对象指定给报表查看器的属性。viewer 是报表查看器的实例,而 report 是之前创建的报表对象。
  1241. viewer.report = report;
  1242. this.$refs.reportContainer.showContainer(
  1243. ()=> {
  1244. setTimeout(() => {
  1245. viewer.renderHtml('reportContainer')
  1246. this.createViewerButtons(viewer)
  1247. }, 50)
  1248. },
  1249. ()=>{
  1250. },
  1251. )
  1252. console.log("加载成功完成!");
  1253. },
  1254. createViewerButtons (viewer){
  1255. viewer.jsObject.collections.images['myClose.png'] =
  1256. 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAA0ElEQVQ4ja3TO05CQRQG4A8iOwAbtYWETndAaecK7NwCKmETtJZsSBNLobEz8ZFIJQ0UnOGSm3DnYviTybzO/895DQXGWGCVGQuMEqkRcwcfuMOLalziCaf4TIe9UG9nyMJmFRzNGoRK1BU4xxx9G7cfwostciGk+x8MqgySwDXe4tU53hVV+MNtTmAoX84JGv9NYgrHyR6DV8wUSW7hItZLm36ZVoVQxsFJLOMsPOrH/h7dQwR2cdxOTEn8DtUbPGc4V2H7Vb4Yqfedf/GYSGt8VUmxgyfuBAAAAABJRU5ErkJggg=='
  1257. const closeBtn = viewer.jsObject.SmallButton(
  1258. 'closeBtn',
  1259. '关闭',
  1260. 'myClose.png'
  1261. )
  1262. // 增加打印弹窗配置
  1263. const printBtn = viewer.jsObject.SmallButton(
  1264. 'printBtn',
  1265. '打印报表',
  1266. 'myClose.png'
  1267. )
  1268. // console.log(viewer.jsObject.print(),'1013')
  1269. // 获取 关闭按钮的dom元素位置
  1270. const toolbarTable = viewer.jsObject.controls.toolbar.firstChild.firstChild
  1271. const buttonsTable = toolbarTable.rows[0].lastChild.lastChild
  1272. const userButtonCell = buttonsTable.rows[0].insertCell(0)
  1273. // 获取打印按钮的位置
  1274. const buttonsTablePrint = toolbarTable.rows[0].childNodes[0].lastChild // 打印按钮
  1275. const userButtonPrint = buttonsTablePrint.rows[0].childNodes[0] // 打印按钮dom位置
  1276. userButtonPrint.addEventListener("click", (event)=>{
  1277. console.log("打印点击");
  1278. // event.preventDefault()
  1279. });
  1280. userButtonPrint.addEventListener("mouseover", (event) => {
  1281. console.log("移入打印按钮");
  1282. console.log(event,1035)
  1283. });
  1284. userButtonCell.className = 'stiJsViewerClearAllStyles'
  1285. userButtonCell.appendChild(closeBtn) // 添加关闭节点
  1286. // userButtonPrint.prepend(printBtn) // 在 printBtn 节点里最前面增加一个子级节点
  1287. let that=this
  1288. // 关闭按钮的监听点击
  1289. closeBtn.action = function() {
  1290. console.log(that.$refs.ReportContainer,'1022')
  1291. if (that.$refs.reportContainer)
  1292. that.$refs.reportContainer.hideContainer()
  1293. }
  1294. // // // 打印按钮监听
  1295. // printBtn.action = (e)=>{
  1296. // console.log('打印')
  1297. // window.print()
  1298. // }
  1299. },
  1300. }
  1301. }
  1302. </script>
  1303. <style scoped>
  1304. ::v-deep.el-form-item {
  1305. margin-bottom: 0;
  1306. }
  1307. .bottomFlex {
  1308. display: flex;
  1309. align-items: center;
  1310. }
  1311. .weightfont {
  1312. font-size: 20px;
  1313. font-weight: bold;
  1314. }
  1315. .weightnum {
  1316. font-size: 18px;
  1317. font-weight: 500;
  1318. }
  1319. /deep/.el-dialog .el-dialog__body {
  1320. padding: 0px 20px;
  1321. }
  1322. </style>