settlementDetails.vue 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224
  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"
  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="finstlbillsConfirmSettlementfun">确认结算
  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"
  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"
  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"
  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"
  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"
  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="JOB NO" prop="businessNo">
  130. <el-input style="width: 100%;" v-model="form.businessNo"
  131. size="small" autocomplete="off"
  132. :disabled="editSave"
  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"
  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"
  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"
  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"
  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"
  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"
  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"
  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="finstlbillslistAccBillV1fun(appendType)" >检 索
  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 append-to-body title="设计报表" class="el-dialogDeep" :visible.sync="DesignreportDialog" width="70%"
  293. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  294. <reports :id="form.id" businessValue="FFSQ"></reports>
  295. </el-dialog>
  296. <!--预览-->
  297. <el-dialog
  298. title="打印"
  299. :visible.sync="selectPrintingDialog"
  300. append-to-body
  301. width="70%"
  302. :close-on-click-modal="false"
  303. :destroy-on-close="true"
  304. :close-on-press-escape="false"
  305. v-dialog-drag>
  306. <div>
  307. <reportformsList ref="reportformsList" @reportRadio="reportRadio"></reportformsList>
  308. </div>
  309. <span slot="footer" class="dialog-footer">
  310. <el-button size="small" @click="selectPrintingDialog = false;">取 消</el-button>
  311. </span>
  312. </el-dialog>
  313. <!--报表组件-->
  314. <reportContainer ref="reportContainer"></reportContainer>
  315. </div>
  316. </template>
  317. <script>
  318. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  319. import {getRateList} from "@/api/iosBasicData/rateManagement";
  320. import {bcorpsbankList, getBcorpslistByType} from "@/api/iosBasicData/bcorps";
  321. import {
  322. finstlbillsDetail, finstlbillsitemsRemove,
  323. finstlbillslistAccBillV1,
  324. finstlbillsSubmit, finstlbillsConfirmSettlement, finstlbillsRevokeSettlement, finstlbillsGetByDetail
  325. } from '@/api/iosBasicData/finstlbills'
  326. import expand from "@/components/basic-container/expand.vue";
  327. import finstlbillsitems from "@/views/iosBasicData/PaymentApplication/assembly/finstlbillsitems.vue";
  328. import reports from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reports.vue";
  329. import reportformsList from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reportformsList.vue";
  330. import {getList as getreportsList, reportsGetReportData} from "@/api/iosBasicData/reports";
  331. import reportContainer from "@/views/iosBasicData/report-container/report-container.vue";
  332. import { generateFinStlBills} from "@/api/iosBasicData/fininvoices";
  333. export default {
  334. components: {reportContainer, reportformsList, reports, SearchQuery,expand,finstlbillsitems},
  335. props:{
  336. // 编辑还是保存
  337. editSave:{
  338. type:Boolean,
  339. default:true
  340. },
  341. },
  342. data(){
  343. return {
  344. invoiceAmountCNY:0, // 费用明细开票金额输入框CNY
  345. invoiceAmountUSD:0, // 费用明细开票金额输入框USD
  346. settlementdistar:false, // 结算挑进来的
  347. DesignreportDialog:false, // 设计报表弹窗
  348. selectPrintingDialog:false, // 预览报表
  349. // 收/付数据
  350. dcData: [{
  351. label: '全部',
  352. value: null
  353. },{
  354. label: '收',
  355. value: 'D'
  356. }, {
  357. label: '付',
  358. value: 'C'
  359. }],
  360. appendType:'检索', // 是否追加
  361. tableData:[],
  362. pageLoading:false, // 全屏加载动画
  363. saveLoading:false, // 按钮动画
  364. // 绑定的数据
  365. form:{
  366. dc:'C'
  367. },
  368. handleSelectionData:[], // 表格选择的数据
  369. corpData:[], // 结算单位 数据
  370. bankData:[], // 查询银行数据
  371. curCodeData:[],// 币别
  372. srcforParameter:{},
  373. // 业务类型
  374. businessTypesData:[
  375. {
  376. label:'海运出口',
  377. value:'SE'
  378. },{
  379. label:'海运进口',
  380. value:'SI'
  381. }
  382. ],
  383. rules: {
  384. corpCnName: [
  385. {required: true, message: '请输入付费对象', trigger: 'blur'},
  386. ],
  387. bankId: [
  388. {required: true, message: '请输入开户银行', trigger: 'blur'},
  389. ],
  390. remarks: [
  391. {required: true, message: '请输入付费事由', trigger: 'blur'},
  392. ],
  393. estimatedTime: [
  394. {required: true, message: '请输入预计收回', trigger: 'blur'},
  395. ],
  396. collectionSituation: [
  397. {required: true, message: '请输入收款情况', trigger: 'blur'},
  398. ],
  399. },
  400. }
  401. },
  402. created() {
  403. },
  404. methods:{
  405. // 打印
  406. reportRadio(val){
  407. // 获取报表数据
  408. reportsGetReportData({
  409. billId:this.form.id,
  410. reportCode:val.classifyCode,
  411. groupCode:val.groupCode,
  412. }).then(res=>{
  413. this.handleReportPreview(val.url,res.data.data.data)
  414. })
  415. },
  416. // 报表预览
  417. previewreportfun(){
  418. getreportsList(1,10,{
  419. businessType:'FFSQ',
  420. classifyCode:'结算中心',
  421. // groupCode:'付费结算'
  422. }).then(res=>{
  423. if (res.data.data.records.length == 1){
  424. this.reportRadio(res.data.data.records[0])
  425. }else {
  426. this.saveLoading = true
  427. this.selectPrintingDialog = true
  428. this.saveLoading = false
  429. let page = {
  430. pageSize: 10,
  431. currentPage: 1,
  432. total: 0
  433. }
  434. this.$nextTick(()=>{
  435. this.$refs.reportformsList.onLoad(page,{
  436. businessType:'FFSQ',
  437. classifyCode:'结算中心',
  438. // groupCode:'付费结算'
  439. })
  440. })
  441. }
  442. })
  443. },
  444. // 费用明细开票匹配
  445. invoiceMatchingfun(){
  446. if (this.invoiceAmountCNY != 0 || this.invoiceAmountUSD != 0) {
  447. let dataCNY = JSON.parse(JSON.stringify(this.invoiceAmountCNY))
  448. let dataUSD = JSON.parse(JSON.stringify(this.invoiceAmountUSD))
  449. for (let item of this.tableData) {
  450. this.$refs.finstlbillsitems.$refs.tableRef.toggleRowSelection(item,false)
  451. if (this.invoiceAmountCNY != 0) {
  452. if (dataCNY < 0) {
  453. dataCNY = 0
  454. }
  455. if (dataCNY > 1500) {
  456. if (item.currentStlCurCode == 'CNY') {
  457. this.$set(item,'currentStlAmountRMB',1500)
  458. this.$refs.finstlbillsitems.$refs.tableRef.toggleRowSelection(item,true)
  459. dataCNY -= 1500
  460. }
  461. }else {
  462. if (item.currentStlCurCode == 'CNY') {
  463. if (dataCNY != 0) {
  464. this.$refs.finstlbillsitems.$refs.tableRef.toggleRowSelection(item,true)
  465. }
  466. this.$set(item,'currentStlAmountRMB',dataCNY)
  467. dataCNY -= 1500
  468. }
  469. }
  470. }
  471. if (this.invoiceAmountUSD != 0) {
  472. if (dataUSD < 0) {
  473. dataUSD = 0
  474. }
  475. if (dataUSD > 1500) {
  476. if (item.currentStlCurCode == 'USD') {
  477. this.$set(item,'currentStlAmountUSD',1500)
  478. this.$refs.finstlbillsitems.$refs.tableRef.toggleRowSelection(item,true)
  479. dataUSD -= 1500
  480. }
  481. }else {
  482. if (item.currentStlCurCode == 'USD') {
  483. this.$set(item,'currentStlAmountUSD',dataUSD)
  484. if (dataUSD != 0) {
  485. this.$refs.finstlbillsitems.$refs.tableRef.toggleRowSelection(item,true)
  486. }
  487. dataUSD -= 1500
  488. }
  489. }
  490. }
  491. }
  492. }
  493. },
  494. // 批量删除
  495. batchDeletefun(){
  496. if (this.handleSelectionData.length == 0) {
  497. return this.$message.warning('请选择要删除的数据')
  498. }
  499. this.$confirm("确定将选择数据删除?", {
  500. confirmButtonText: "确定",
  501. cancelButtonText: "取消",
  502. type: "warning"
  503. }).then(()=>{
  504. // 获取有id 的数据
  505. const itemsWithId = this.handleSelectionData.filter(item => item.hasOwnProperty('id'));
  506. let arrIds = itemsWithId.map(item=>item.id) // 获取id 数据
  507. // 把选中的删除掉
  508. this.handleSelectionData.forEach((item)=>{
  509. for (let index in this.tableData) {
  510. if (item.accBillNo == this.tableData[index].accBillNo) {
  511. this.tableData.splice(index,1)
  512. }
  513. }
  514. })
  515. // 有id 的处理
  516. if(itemsWithId.length != 0) {
  517. finstlbillsitemsRemove(arrIds.join(',')).then(res=>{
  518. this.$message.success('操作成功')
  519. })
  520. }
  521. })
  522. },
  523. // 删除
  524. finstlbillsitemsRemovefun(id,index){
  525. this.$confirm("确定将选择数据删除?", {
  526. confirmButtonText: "确定",
  527. cancelButtonText: "取消",
  528. type: "warning"
  529. }).then(()=>{
  530. if (id) {
  531. finstlbillsitemsRemove(id).then(res=>{
  532. this.$message.success('操作成功')
  533. })
  534. }
  535. this.tableData.splice(index,1)
  536. })
  537. },
  538. // 下拉回调
  539. corpChange(value,name){
  540. // 结算单位
  541. if (name == 'corpCnName') {
  542. if (!value) {
  543. this.$set(this.form,'corpId','')
  544. this.$set(this.form,'corpCnName','')
  545. this.$set(this.form,'corpEnName','')
  546. this.$set(this.form,'corpArgreementNo','')
  547. }
  548. for(let item of this.corpData) {
  549. if (item.cnName == value) {
  550. this.$set(this.form,'corpId',item.id)
  551. this.$set(this.form,'corpCnName',item.cnName)
  552. this.$set(this.form,'corpEnName',item.enName)
  553. this.$set(this.form,'corpArgreementNo',item.enName)
  554. }
  555. }
  556. }
  557. else if (name == 'bankId') {
  558. if (!value) {
  559. this.$set(this.form,'bankId','')
  560. this.$set(this.form,'bankAccountName','')
  561. this.$set(this.form,'bankAccountBank','')
  562. this.$set(this.form,'bankAccountNo','')
  563. }
  564. for(let item of this.bankData) {
  565. if (item.id == value) {
  566. this.$set(this.form,'bankId',item.id)
  567. this.$set(this.form,'bankAccountName',item.accountName)
  568. this.$set(this.form,'bankAccountBank',item.accountBank)
  569. this.$set(this.form,'bankAccountNo',item.accountNo)
  570. }
  571. }
  572. }
  573. else {
  574. this.$set(this.form,name,value)
  575. }
  576. },
  577. // 编辑
  578. editHandle(){
  579. this.editSave = false
  580. },
  581. // 保存
  582. editCustomer(){
  583. this.$refs.form.validate((valid) => {
  584. if (!valid) return
  585. if (!this.form.id) {
  586. // 是否选择从表数据
  587. if (this.handleSelectionData.length == 0) {
  588. this.$message.warning('请选择结算数据');
  589. return;
  590. }
  591. }
  592. for (let item of this.handleSelectionData) {
  593. if (!item.currentStlCurCode) {
  594. this.$message.warning('请选择本次结算币种');
  595. return;
  596. }
  597. }
  598. this.saveLoading = true // 打开按钮动画
  599. if(this.form.estimatedTime) {
  600. this.form.estimatedTime = this.form.estimatedTime + ' 00:00:00'
  601. }
  602. this.saveLoading = true // 加载动画
  603. this.form.billNoFormat = 'STL'
  604. this.form.businessTypeCode = 'STL'
  605. this.form.businessType = 'STL' // 结算单
  606. this.form.businessTypes = this.form.businessTypes?this.form.businessTypes.join(','):'' // 业务类型
  607. this.form.businessDateStart = this.form.businessDateStart?this.form.businessDateStart.slice(0,10) + ' 00:00:00':null // 财务开始日期
  608. this.form.businessDateEnd = this.form.businessDateEnd?this.form.businessDateEnd.slice(0,10) + ' 00:00:00':null // 财务开始日期
  609. this.form.billDate = this.form.billDate?this.form.billDate.slice(0,10) + ' 00:00:00':null
  610. this.form.auditDateTo = this.form.auditDateTo?this.form.auditDateTo.slice(0,10) + ' 00:00:00':null
  611. this.form.settlementType = this.settlementType
  612. this.form.finStlBillsItemsList = this.handleSelectionData.map((item,index)=>{
  613. if (item.currentStlCurCode == 'CNY') {
  614. item.currentStlAmount = item.currentStlAmountRMB
  615. }else {
  616. item.currentStlAmount = item.currentStlAmountUSD
  617. }
  618. if (!this.form.id) {
  619. delete item.businessType
  620. delete item.billDate
  621. delete item.accountDc
  622. }
  623. return item
  624. })
  625. finstlbillsSubmit(this.form).then(res=>{
  626. this.saveLoading = false
  627. this.$message.success('操作成功');
  628. this.saveLoading = false // 关闭按钮动画
  629. this.finstlbillsDetailfun(res.data.data.id)
  630. })
  631. })
  632. },
  633. // 详情接口
  634. finstlbillsDetailfun(id){
  635. this.pageLoading = true
  636. finstlbillsDetail(id).then(res=>{
  637. this.form = res.data.data
  638. this.form.businessTypes = this.form.businessTypes?this.form.businessTypes.split(','):[] // 业务类型转换成数组显示
  639. this.tableData = this.form.finStlBillsItemsList.map(item=>{
  640. item.stlTtlAmountNet = Number(item.stlTtlAmount) - (Number(item.stlTtlAmount) * (Number(item.taxRate) + Number(item.surchargeRate)))
  641. item.currentStlAmountNet = Number(item.unsettledAmount) - (Number(item.unsettledAmount) * (Number(item.taxRate) + Number(item.surchargeRate)))
  642. if(item.curCode == 'CNY') {
  643. this.$set(item,'currentInvoiceAmountRMB',item.currentInvoiceAmount)
  644. this.$set(item,'amountRMB',item.amount)
  645. this.$set(item,'amountNetRMB',item.amountNet)
  646. this.$set(item,'stlTtlAmountRMB',item.stlTtlAmount)
  647. this.$set(item,'stlTtlAmountNetRMB',item.stlTtlAmountNet)
  648. this.$set(item,'currentStlAmountNetRMB',item.currentStlAmountNet)
  649. this.$set(item,'currentStlAmountRMB',item.currentStlAmount)
  650. }else {
  651. this.$set(item,'currentInvoiceAmountUSD',item.currentInvoiceAmount)
  652. this.$set(item,'amountUSD',item.amount)
  653. this.$set(item,'amountNetUSD',item.amountNet)
  654. this.$set(item,'stlTtlAmountNetUSD',item.stlTtlAmountNet)
  655. this.$set(item,'stlTtlAmountUSD',item.stlTtlAmount)
  656. this.$set(item,'currentStlAmountNetUSD',item.currentStlAmountNet)
  657. this.$set(item,'currentStlAmountUSD',item.currentStlAmount)
  658. }
  659. if (item.srcIdInvoices) {
  660. this.settlementdistar = true
  661. }
  662. return item
  663. })
  664. this.pageLoading = false
  665. this.bcorpsbankListfun() // 查银行数据
  666. }).catch(err=>{
  667. this.pageLoading = false
  668. })
  669. },
  670. // 结算按钮
  671. generateFinStlBillsfun(id,dc){
  672. this.pageLoading = true
  673. if (dc == 'C' || dc == 'D') {
  674. this.settlementType = dc
  675. }
  676. generateFinStlBills({
  677. billId:id,
  678. dc:dc
  679. }).then(res=>{
  680. this.form = res.data.data
  681. this.form.businessTypes = this.form.businessTypes?this.form.businessTypes.split(','):[] // 业务类型转换成数组显示
  682. this.tableData = this.form.finStlBillsItemsList.map(item=>{
  683. item.stlTtlAmountNet = Number(item.stlTtlAmount) - (Number(item.stlTtlAmount) * (Number(item.taxRate) + Number(item.surchargeRate)))
  684. item.currentStlAmountNet = Number(item.unsettledAmount) - (Number(item.unsettledAmount) * (Number(item.taxRate) + Number(item.surchargeRate)))
  685. if(item.curCode == 'CNY') {
  686. this.$set(item,'currentInvoiceAmountRMB',item.currentInvoiceAmount)
  687. this.$set(item,'amountRMB',item.amount)
  688. this.$set(item,'amountNetRMB',item.amountNet)
  689. this.$set(item,'stlTtlAmountRMB',item.stlTtlAmount)
  690. this.$set(item,'stlTtlAmountNetRMB',item.stlTtlAmountNet)
  691. this.$set(item,'currentStlAmountNetRMB',item.currentStlAmountNet)
  692. this.$set(item,'currentStlAmountRMB',item.currentStlAmount)
  693. }else {
  694. this.$set(item,'currentInvoiceAmountUSD',item.currentInvoiceAmount)
  695. this.$set(item,'amountUSD',item.amount)
  696. this.$set(item,'amountNetUSD',item.amountNet)
  697. this.$set(item,'stlTtlAmountNetUSD',item.stlTtlAmountNet)
  698. this.$set(item,'stlTtlAmountUSD',item.stlTtlAmount)
  699. this.$set(item,'currentStlAmountNetUSD',item.currentStlAmountNet)
  700. this.$set(item,'currentStlAmountUSD',item.currentStlAmount)
  701. }
  702. if (item.srcIdInvoices) {
  703. this.settlementdistar = true
  704. }
  705. return item
  706. })
  707. this.pageLoading = false
  708. this.bcorpsbankListfun() // 查银行数据
  709. }).catch(err=>{
  710. this.pageLoading = false
  711. })
  712. },
  713. // 重置条件
  714. ResetFilter(){
  715. this.form = {}
  716. },
  717. // 检索接口
  718. finstlbillslistAccBillV1fun(type){
  719. // 对账单位
  720. if (!this.form.corpId) {
  721. this.$message.warning('请选择对账单位');
  722. return
  723. }
  724. let obj = {}
  725. obj.type = '2'
  726. obj.curCode = this.form.curCode // 币别
  727. obj.dc = this.form.dc // 收付 D=收 C=付
  728. obj.accBillNo = this.form.accountNo // 账单编号 ACCT NO
  729. obj.billNo = this.form.businessNo // 单据编号 JOB NO
  730. obj.mblno = this.form.mblno // MB/L NO
  731. obj.hblno = this.form.hblno // HB/L NO
  732. obj.queryAmount = this.form.queryAmount // 查询金额
  733. obj.businessType = this.form.businessTypes?this.form.businessTypes.join(','):'' // 业务类型
  734. obj.vesselCnName = this.form.vesselCnName // 中文船名
  735. obj.receivableAdvance = this.form.receivableAdvance // 预收帐款
  736. obj.voyageNo = this.form.voyageNo // 航次
  737. obj.signforDateList = this.form.signforDateList // 签收日期
  738. obj.auditStatus = '0'
  739. obj.businessDateStart = this.form.businessDateStart // 业务开始日期
  740. obj.businessDateEnd = this.form.businessDateEnd // 业务开始日期
  741. // 判断是否有对账单号
  742. if (this.form.checkNo) {
  743. obj.corpId = this.form.corpId // 结算单位
  744. obj.checkNo = this.form.checkNo // CHK NO 对账单号
  745. finstlbillsGetByDetail(obj).then(res=>{
  746. let arr = res.data.data.finStlBillsItemsList.map((item)=>{
  747. delete item.id
  748. if(item.curCode == 'CNY') {
  749. // 发票
  750. this.$set(item,'currentInvoiceAmountRMB',item.currentInvoiceAmount)
  751. // 应结算金额
  752. this.$set(item,'amountRMB',item.amount)
  753. // 已结算金额
  754. this.$set(item,'stlTtlAmountRMB',item.stlTtlAmount)
  755. if (item.dc == 'D') {
  756. // 本次金额
  757. this.$set(item,'currentStlAmountRMB',item.currentStlAmount)
  758. }else {
  759. // 本次金额
  760. this.$set(item,'currentStlAmountRMB',item.appliedCurrentStlAmount)
  761. }
  762. }else {
  763. // 发票
  764. this.$set(item,'currentInvoiceAmountUSD',item.currentInvoiceAmount)
  765. // 应结算金额
  766. this.$set(item,'amountUSD',item.amount)
  767. // 已结算金额
  768. this.$set(item,'stlTtlAmountUSD',item.stlTtlAmount)
  769. // 本次金额
  770. if (item.dc == 'D') {
  771. // 本次金额
  772. this.$set(item,'currentStlAmountUSD',item.currentStlAmount)
  773. }else {
  774. // 本次金额
  775. this.$set(item,'currentStlAmountUSD',item.appliedCurrentStlAmount)
  776. }
  777. }
  778. return item
  779. })
  780. if (type == '追加') {
  781. let a = [...this.tableData,...arr,]
  782. this.tableData = a.filter((obj, index) => {
  783. return a.findIndex((elem) => {
  784. return elem.accBillNo === obj.accBillNo
  785. }) === index;
  786. });
  787. }else {
  788. // 获取有id 的数据
  789. const itemsWithId = this.tableData.filter(item => item.hasOwnProperty('id'));
  790. let arrIds = itemsWithId.map(item=>item.id) // 获取id 数据
  791. // 有id 的处理
  792. if(itemsWithId.length != 0) {
  793. finstlbillsitemsRemove(arrIds.join(',')).then(res=>{
  794. this.$message.success('操作成功')
  795. })
  796. }
  797. this.tableData = arr
  798. }
  799. })
  800. }else {
  801. obj.corpCnName = this.form.corpId // 结算单位
  802. obj.checkBillNo = this.form.checkNo // CHK NO 对账单号
  803. finstlbillslistAccBillV1(obj).then(res=>{
  804. let arr = res.data.data.map((item,index)=>{
  805. item.accBillId = item.id
  806. delete item.id
  807. // 账单编号
  808. item.accBillNo = item.billNo
  809. item.currentStlCurCode = item.curCode // 币别
  810. item.currentStlExrate = item.exrate
  811. // isCleared
  812. item.lineNo = Number(index) + 1
  813. item.pType = item.businessType
  814. item.billNo = item.businessBillDivideNo?item.businessBillDivideNo:item.businessBillNo
  815. item.accDate = item.billDate
  816. item.dc = item.accountDc // 收付
  817. if(item.curCode == 'CNY') {
  818. // 发票
  819. this.$set(item,'currentInvoiceAmountRMB',item.currentInvoiceAmount)
  820. // 应结算金额
  821. this.$set(item,'amountRMB',item.amount)
  822. // 已结算金额
  823. this.$set(item,'stlTtlAmountRMB',item.stlTtlAmount)
  824. // 本次金额
  825. if (item.dc == 'D') {
  826. // 本次金额
  827. this.$set(item,'currentStlAmountRMB',item.currentStlAmount)
  828. }else {
  829. // 本次金额
  830. this.$set(item,'currentStlAmountRMB',item.appliedCurrentStlAmount)
  831. }
  832. }else {
  833. // 发票
  834. this.$set(item,'currentInvoiceAmountUSD',item.currentInvoiceAmount)
  835. // 应结算金额
  836. this.$set(item,'amountUSD',item.amount)
  837. // 已结算金额
  838. this.$set(item,'stlTtlAmountUSD',item.stlTtlAmount)
  839. // 本次金额
  840. if (item.dc == 'D') {
  841. // 本次金额
  842. this.$set(item,'currentStlAmountUSD',item.currentStlAmount)
  843. }else {
  844. // 本次金额
  845. this.$set(item,'currentStlAmountUSD',item.appliedCurrentStlAmount)
  846. }
  847. }
  848. return item
  849. })
  850. if (type == '追加') {
  851. let a = [...this.tableData,...arr,]
  852. this.tableData = a.filter((obj, index) => {
  853. return a.findIndex((elem) => {
  854. return elem.accBillNo === obj.accBillNo
  855. }) === index;
  856. });
  857. }else {
  858. // 获取有id 的数据
  859. const itemsWithId = this.tableData.filter(item => item.hasOwnProperty('id'));
  860. let arrIds = itemsWithId.map(item=>item.id) // 获取id 数据
  861. // 有id 的处理
  862. if(itemsWithId.length != 0) {
  863. finstlbillsitemsRemove(arrIds.join(',')).then(res=>{
  864. this.$message.success('操作成功')
  865. })
  866. }
  867. this.tableData = arr
  868. }
  869. })
  870. }
  871. },
  872. // 结算确认
  873. finstlbillsConfirmSettlementfun(){
  874. this.$confirm("确定进行结算操作?", {
  875. confirmButtonText: "确定",
  876. cancelButtonText: "取消",
  877. type: "warning"
  878. }).then(()=>{
  879. this.pageLoading = true
  880. this.form.businessTypes = this.form.businessTypes?this.form.businessTypes.join(','):'' // 业务类型
  881. this.form.businessDateStart = this.form.businessDateStart?this.form.businessDateStart.slice(0,10) + ' 00:00:00':null // 财务开始日期
  882. this.form.businessDateEnd = this.form.businessDateEnd?this.form.businessDateEnd.slice(0,10) + ' 00:00:00':null // 财务开始日期
  883. this.form.billDate = this.form.billDate?this.form.billDate.slice(0,10) + ' 00:00:00':null
  884. this.form.auditDateTo = this.form.auditDateTo?this.form.auditDateTo.slice(0,10) + ' 00:00:00':null
  885. this.form.url = '/iosBasicData/ComputationCenter/index',
  886. this.form.pageStatus = "this.$store.getters.SettlementCenterF"
  887. this.form.pageLabel = "结算中心(F)"
  888. finstlbillsConfirmSettlement(this.form).then(res=>{
  889. this.pageLoading = false
  890. this.$message.success('操作成功');
  891. this.finstlbillsDetailfun(res.data.data.id)
  892. }).catch(err=>{
  893. this.pageLoading = false
  894. })
  895. })
  896. },
  897. // 结算撤销
  898. finstlbillsRevokeSettlementfun(){
  899. this.$confirm("确定进行撤销对账操作?", {
  900. confirmButtonText: "确定",
  901. cancelButtonText: "取消",
  902. type: "warning"
  903. }).then(()=>{
  904. this.pageLoading = true
  905. this.form.businessTypes = this.form.businessTypes?this.form.businessTypes.join(','):'' // 业务类型
  906. this.form.businessDateStart = this.form.businessDateStart?this.form.businessDateStart.slice(0,10) + ' 00:00:00':null // 财务开始日期
  907. this.form.businessDateEnd = this.form.businessDateEnd?this.form.businessDateEnd.slice(0,10) + ' 00:00:00':null // 财务开始日期
  908. this.form.billDate = this.form.billDate?this.form.billDate.slice(0,10) + ' 00:00:00':null
  909. this.form.auditDateTo = this.form.auditDateTo?this.form.auditDateTo.slice(0,10) + ' 00:00:00':null
  910. finstlbillsRevokeSettlement(this.form).then(res=>{
  911. this.pageLoading = false
  912. this.$message.success('操作成功');
  913. this.finstlbillsDetailfun(res.data.data.id)
  914. })
  915. }).catch(err=>{
  916. this.pageLoading = false
  917. })
  918. },
  919. // 确认选定行
  920. SelectedRows(){
  921. this.editCustomer()
  922. },
  923. // 下面表格多选
  924. handleSelectionChange(arr){
  925. this.handleSelectionData = arr
  926. },
  927. //返回列表
  928. backToList() {
  929. this.$emit('goBack')
  930. },
  931. // 请求的接口
  932. // 获取币别数据
  933. getRateListfun(cnName){
  934. getRateList({current:1,size:10,cnName}).then(res=>{
  935. this.curCodeData = res.data.data.records
  936. })
  937. },
  938. // 获取结算单位数据
  939. corpBcorpsListfun(cnName){
  940. getBcorpslistByType(1,10,{cnName}).then(res=>{
  941. this.corpData = res.data.data.records
  942. })
  943. },
  944. // 获取银行数据
  945. bcorpsbankListfun(){
  946. bcorpsbankList(1,50,{pid:this.form.corpId}).then(res=>{
  947. this.bankData = res.data.data.records.map(item=>{
  948. item.accountBankNo = item.accountBank + ' - ' + item.accountNo
  949. return item
  950. })
  951. })
  952. },
  953. // 预览报表
  954. handleReportPreview(url,data){
  955. console.log(url,1670)
  956. console.log(data,1671)
  957. Stimulsoft.Base.StiLicense.key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHn0s4gy0Fr5YoUZ9V00Y0igCSFQzwEqYBh/N77k4f0fWXTHW5rqeBNLkaurJDenJ9o97TyqHs9HfvINK18Uwzsc/bG01Rq+x3H3Rf+g7AY92gvWmp7VA2Uxa30Q97f61siWz2dE5kdBVcCnSFzC6awE74JzDcJMj8OuxplqB1CYcpoPcOjKy1PiATlC3UsBaLEXsok1xxtRMQ283r282tkh8XQitsxtTczAJBxijuJNfziYhci2jResWXK51ygOOEbVAxmpflujkJ8oEVHkOA/CjX6bGx05pNZ6oSIu9H8deF94MyqIwcdeirCe60GbIQByQtLimfxbIZnO35X3fs/94av0ODfELqrQEpLrpU6FNeHttvlMc5UVrT4K+8lPbqR8Hq0PFWmFrbVIYSi7tAVFMMe2D1C59NWyLu3AkrD3No7YhLVh7LV0Tttr/8FrcZ8xirBPcMZCIGrRIesrHxOsZH2V8t/t0GXCnLLAWX+TNvdNXkB8cF2y9ZXf1enI064yE5dwMs2fQ0yOUG/xornE'
  958. // Stimulsoft.Base.StiLicense.Key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHkcgIvwL0jnpsDqRpWg5FI5kt2G7A0tYIcUygBh1sPs7plofUOqPB1a4HBIXJB621mau2oiAIj+ysU7gKUXfjn/D5BocmduNB+ZMiDGPxFrAp3PoD0nYNkkWh8r7gBZ1v/JZSXGE3bQDrCQCNSy6mgby+iFAMV8/PuZ1z77U+Xz3fkpbm6MYQXYp3cQooLGLUti7k1TFWrnawT0iEEDJ2iRcU9wLqn2g9UiWesEZtKwI/UmEI2T7nv5NbgV+CHguu6QU4WWzFpIgW+3LUnKCT/vCDY+ymzgycw9A9+HFSzARiPzgOaAuQYrFDpzhXV+ZeX31AxWlnzjDWqpfluygSNPtGul5gyNt2CEoJD1Yom0VN9fvRonYsMsimkFFx2AwyVpPcs+JfVBtpPbTcZscnzUdmiIvxv8Gcin6sNSibM6in/uUKFt3bVgW/XeMYa7MLGF53kvBSwi78poUDigA2n12SmghLR0AHxyEDIgZGOTbNI33GWu7ZsPBeUdGu55R8w='
  959. Stimulsoft.Base.Localization.StiLocalization.addLocalizationFile( '/reports/stimulsoft/Localization/zh-CHS.xml', true, 'zh-CHS')
  960. Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile('/reports/stimulsoft/Localization/zh-CHS.xml' )
  961. // 工具栏
  962. var options = new Stimulsoft.Viewer.StiViewerOptions()
  963. options.height = '100%'
  964. options.appearance.scrollbarsMode = true // 滚动条模式
  965. options.toolbar.showDesignButton = false // 显示设计按钮
  966. options.toolbar.showAboutButton = false // 显示关于按钮
  967. options.toolbar.showResourcesButton = false // 显示资源按钮
  968. options.toolbar.showFullScreenButton = false // 显示全屏按钮
  969. options.toolbar.showOpenButton = false // 显示打开按钮
  970. options.appearance.showTooltips = false // 显示工具提示
  971. options.appearance.showDialogsHelp = false // 显示对话框帮助
  972. options.exports.showExportToDocument = false // 显示导出到文档
  973. options.toolbar.showParametersButton = true // 显示参数按钮
  974. options.appearance.bookmarksPrint = true // 书签打印
  975. // options.toolbar.showPrintButton = false // 打印按钮是否显示 下面直接自定义控制打印弹窗是否开启
  976. // printDestination 参数:用于指定报表打印的目标位置,可以是打印机、PDF 文件或者直接打印到浏览器等。
  977. // Stimulsoft.Viewer.StiPrintDestination.Direct:表示直接打印到打印机,即将报表内容直接发送至打印机进行打印。
  978. // 通过设置不同的 printDestination 参数,你可以控制报表打印的行为,例如是直接打印到打印机,还是生成 PDF 文件,或者直接在浏览器中预览打印内容等。
  979. options.toolbar.printDestination = Stimulsoft.Viewer.StiPrintDestination.Direct
  980. // htmlRenderMode html渲染模式
  981. options.appearance.htmlRenderMode = Stimulsoft.Report.Export.StiHtmlExportMode.Table
  982. // 是创建一个 Stimulsoft 报表查看器的实例的代码
  983. let viewer = new Stimulsoft.Viewer.StiViewer(options, 'StiViewer', false)
  984. // 报表
  985. console.log("创建一个报表实例");
  986. console.log()
  987. let report = new window.Stimulsoft.Report.StiReport();
  988. // 加载文件
  989. console.log("从url加载报表");
  990. // report.loadFile("/reports/stimulsoft/demos/SimpleList.mrt");
  991. report.load(url)
  992. data.pageOne = 'Page : 1 of 1'
  993. // 处理超长数据
  994. if (data.hshipperDetails) {
  995. var consignerIndex2 = data.hshipperDetails.indexOf( '\n' )
  996. for (let i = 0; i < 4; i++) {
  997. consignerIndex2 = data.hshipperDetails.indexOf( '\n', consignerIndex2 + 1 );
  998. }
  999. if (consignerIndex2 != -1) {
  1000. var hshipperDetails = data.hshipperDetails.substring(consignerIndex2 + 2, data.hshipperDetails.length)
  1001. data.hshipperDetails = data.hshipperDetails.substring(0, consignerIndex2) + ' *'
  1002. data.commodityDescr += '\n*' + hshipperDetails
  1003. }
  1004. }
  1005. if (data.hconsigneeDetails) {
  1006. var consigneeIndex2 = data.hconsigneeDetails.indexOf( '\n' )
  1007. for (let i = 0; i < 3; i++) {
  1008. consigneeIndex2 = data.hconsigneeDetails.indexOf( '\n', consigneeIndex2 + 1 );
  1009. }
  1010. if (consigneeIndex2 != -1) {
  1011. var hconsigneeDetails = data.hconsigneeDetails.substring(consigneeIndex2 + 2, data.hconsigneeDetails.length)
  1012. data.hconsigneeDetails = data.hconsigneeDetails.substring(0, consigneeIndex2) + ' **'
  1013. data.commodityDescr += '\n**' + hconsigneeDetails
  1014. }
  1015. }
  1016. if (data.hnotifyDetails) {
  1017. var notifierIndex2 = data.hnotifyDetails.indexOf( '\n' )
  1018. for (let i = 0; i < 3; i++) {
  1019. notifierIndex2 = data.hnotifyDetails.indexOf( '\n', notifierIndex2 + 1 );
  1020. }
  1021. if (notifierIndex2 != -1) {
  1022. var hnotifyDetails = data.hnotifyDetails.substring(notifierIndex2 + 2, data.hnotifyDetails.length)
  1023. data.hnotifyDetails = data.hnotifyDetails.substring(0, notifierIndex2) + ' ***'
  1024. data.commodityDescr += '\n***' + hnotifyDetails
  1025. }
  1026. }
  1027. // 处理箱号
  1028. if (this.isPrintTheBoxNumber) {
  1029. data.commodityDescr += '\n.\n.\n'
  1030. }
  1031. // PLACE & DATE OF ISSUE
  1032. data.placeAndDateOfIssue = ''
  1033. if (data.issueAt) {
  1034. data.placeAndDateOfIssue += data.issueAt
  1035. }
  1036. if (data.issueDate) {
  1037. let date = new Date(data.issueDate.replace(/-/g,'/'));
  1038. let yyyy = date.getFullYear();
  1039. let mmmm = date.toDateString().split(" ")[1]
  1040. let dd = date.getDate()
  1041. data.placeAndDateOfIssue += ', ' + dd + '-' + mmmm + '-' + yyyy
  1042. }
  1043. // Total number of containers or packages received by the Carriers
  1044. if (data.preContainersList) {
  1045. let boxMap = new Map();
  1046. for (let boxQuantity of data.preContainersList) {
  1047. if (boxMap.get(boxQuantity.cntrTypeCode)) {
  1048. let v = boxMap.get(boxQuantity.cntrTypeCode)
  1049. boxMap.set(boxQuantity.cntrTypeCode, v + boxQuantity.quantity)
  1050. } else {
  1051. boxMap.set(boxQuantity.cntrTypeCode, boxQuantity.quantity)
  1052. }
  1053. }
  1054. let boxs = ''
  1055. boxMap.forEach(function (value, key, map) {
  1056. boxs += value + 'x' + key + ', '
  1057. })
  1058. boxs = boxs.substring(0, boxs.length - 2)
  1059. data.boxQuantity = boxs + ' CONTAINER(S) ONLY'
  1060. }
  1061. // Number of original B/Ls
  1062. if (data.numberOfObl) {
  1063. data.numberOfObl += ' (' + data.numberOfOblDigit + ')'
  1064. }
  1065. if (data.commodityDescr) {
  1066. var descriptionIndex2 = data.commodityDescr.indexOf( '\n' )
  1067. for (let i = 0; i < 19; i++) {
  1068. descriptionIndex2 = data.commodityDescr.indexOf( '\n', descriptionIndex2 + 1 );
  1069. }
  1070. if (descriptionIndex2 != -1) {
  1071. data.pageOne = 'Page : 1 of 2'
  1072. data.pageTwo = 'Page : 2 of 2'
  1073. var extraLongText = data.commodityDescr.substring(descriptionIndex2 + 2, data.commodityDescr.length)
  1074. data.commodityDescr = data.commodityDescr.substring(0, descriptionIndex2)
  1075. data.extraLongTips = '** TO BE CONTINUED ON ATTACHED LIST **'
  1076. data.extraLongText = extraLongText
  1077. }
  1078. }
  1079. // console.log(data.hshipperDetails, 'hshipperDetails2')
  1080. // 创建一个 Stimulsoft 数据集(DataSet)的实例的代码
  1081. var dataSet = new Stimulsoft.System.Data.DataSet(
  1082. 'reportData'
  1083. )
  1084. dataSet.readJson(data) // 用于将 JSON 格式的数据加载到数据集中。data 是包含报表数据的 JSON 对象。
  1085. // 这是一个方法调用,用于在报表中注册数据源。参数 'reportData' 是数据源的名称,
  1086. // 第二个 'reportData' 是数据源的别名,dataSet 则是之前创建的数据集实例
  1087. report.regData('reportData', 'reportData', dataSet)
  1088. // 从模版和数据加载报表
  1089. // loadReport(report, '', {})
  1090. // 这是将报表对象指定给报表查看器的属性。viewer 是报表查看器的实例,而 report 是之前创建的报表对象。
  1091. viewer.report = report;
  1092. this.$refs.reportContainer.showContainer(
  1093. ()=> {
  1094. setTimeout(() => {
  1095. viewer.renderHtml('reportContainer')
  1096. this.createViewerButtons(viewer)
  1097. }, 50)
  1098. },
  1099. ()=>{
  1100. },
  1101. )
  1102. console.log("加载成功完成!");
  1103. },
  1104. createViewerButtons (viewer){
  1105. viewer.jsObject.collections.images['myClose.png'] =
  1106. 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAA0ElEQVQ4ja3TO05CQRQG4A8iOwAbtYWETndAaecK7NwCKmETtJZsSBNLobEz8ZFIJQ0UnOGSm3DnYviTybzO/895DQXGWGCVGQuMEqkRcwcfuMOLalziCaf4TIe9UG9nyMJmFRzNGoRK1BU4xxx9G7cfwostciGk+x8MqgySwDXe4tU53hVV+MNtTmAoX84JGv9NYgrHyR6DV8wUSW7hItZLm36ZVoVQxsFJLOMsPOrH/h7dQwR2cdxOTEn8DtUbPGc4V2H7Vb4Yqfedf/GYSGt8VUmxgyfuBAAAAABJRU5ErkJggg=='
  1107. const closeBtn = viewer.jsObject.SmallButton(
  1108. 'closeBtn',
  1109. '关闭',
  1110. 'myClose.png'
  1111. )
  1112. // 增加打印弹窗配置
  1113. const printBtn = viewer.jsObject.SmallButton(
  1114. 'printBtn',
  1115. '打印报表',
  1116. 'myClose.png'
  1117. )
  1118. // console.log(viewer.jsObject.print(),'1013')
  1119. // 获取 关闭按钮的dom元素位置
  1120. const toolbarTable = viewer.jsObject.controls.toolbar.firstChild.firstChild
  1121. const buttonsTable = toolbarTable.rows[0].lastChild.lastChild
  1122. const userButtonCell = buttonsTable.rows[0].insertCell(0)
  1123. // 获取打印按钮的位置
  1124. const buttonsTablePrint = toolbarTable.rows[0].childNodes[0].lastChild // 打印按钮
  1125. const userButtonPrint = buttonsTablePrint.rows[0].childNodes[0] // 打印按钮dom位置
  1126. userButtonPrint.addEventListener("click", (event)=>{
  1127. console.log("打印点击");
  1128. // event.preventDefault()
  1129. });
  1130. userButtonPrint.addEventListener("mouseover", (event) => {
  1131. console.log("移入打印按钮");
  1132. console.log(event,1035)
  1133. });
  1134. userButtonCell.className = 'stiJsViewerClearAllStyles'
  1135. userButtonCell.appendChild(closeBtn) // 添加关闭节点
  1136. // userButtonPrint.prepend(printBtn) // 在 printBtn 节点里最前面增加一个子级节点
  1137. let that=this
  1138. // 关闭按钮的监听点击
  1139. closeBtn.action = function() {
  1140. console.log(that.$refs.ReportContainer,'1022')
  1141. if (that.$refs.reportContainer)
  1142. that.$refs.reportContainer.hideContainer()
  1143. }
  1144. // // // 打印按钮监听
  1145. // printBtn.action = (e)=>{
  1146. // console.log('打印')
  1147. // window.print()
  1148. // }
  1149. },
  1150. }
  1151. }
  1152. </script>
  1153. <style scoped>
  1154. ::v-deep.el-form-item {
  1155. margin-bottom: 0;
  1156. }
  1157. .bottomFlex {
  1158. display: flex;
  1159. align-items: center;
  1160. }
  1161. .weightfont {
  1162. font-size: 20px;
  1163. font-weight: bold;
  1164. }
  1165. .weightnum {
  1166. font-size: 18px;
  1167. font-weight: 500;
  1168. }
  1169. /deep/.el-dialog .el-dialog__body {
  1170. padding: 0px 20px;
  1171. }
  1172. </style>