finstlbillsDetails.vue 67 KB

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