settlementDetails.vue 80 KB

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