settlementDetails.vue 69 KB

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