businessReports.vue 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084
  1. <template>
  2. <div>
  3. <el-dialog append-to-body title="预览报表" class="el-dialogDeep" :visible.sync="previewDialog" width="60%"
  4. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  5. <avue-crud :option="selecList.length || type ? optionBack : optionPrinting" :table-loading="loading" :data="data"
  6. :page.sync="page" :permission="permissionList" v-model="form" ref="crud" id="out-table"
  7. :header-cell-class-name="headerClassName" :search.sync="query" @search-change="searchChange"
  8. @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
  9. @size-change="sizeChange" @refresh-change="refreshChange">
  10. <template slot-scope="scope" slot="menu">
  11. <el-link type="primary" :disabled="scope.row.status == 1"
  12. @click="reportsGetReportDatafun(scope.row.url, scope.row)">预览报表</el-link>
  13. </template>
  14. <template slot="curCode" slot-scope="{ row }">
  15. <dic-select v-model="row.curCode" placeholder="币别" key="id" keyValue="key" label="code"
  16. :mockData="curCodeList" :filterable="true" :activateCreated="false"></dic-select>
  17. </template>
  18. </avue-crud>
  19. </el-dialog>
  20. <reportContainer ref="reportContainer"></reportContainer>
  21. <mail-component ref="mailComponentRef" />
  22. </div>
  23. </template>
  24. <script>
  25. import { getList, getDetail, add, update, remove, printingUpdate } from "@/api/boxManagement/reports";
  26. import { reportsGetReportData } from "@/api/boxManagement/reports";
  27. import { getUserApprovalList } from "@/api/approval/processConfig";
  28. import { mapGetters } from "vuex";
  29. import { billsDetail } from '@/api/iosBasicData/bills'
  30. import { bbusinesstypeList } from "@/api/iosBasicData/bbusinesstype";
  31. import reportContainer from "@/views/iosBasicData/report-container/report-container.vue"
  32. import { getFeeCenterCorpIds } from "@/api/iosBasicData/feecenter";
  33. import dicSelect from "@/components/dicSelect/main";
  34. import mailComponent from "@/components/iosbasic-data/mail-component.vue";
  35. export default {
  36. components: {
  37. dicSelect,
  38. reportContainer,
  39. mailComponent
  40. },
  41. props: {
  42. id: {
  43. type: String
  44. },
  45. disabled: {
  46. type: Boolean,
  47. default: false,
  48. },
  49. businessValue: {
  50. type: String,
  51. default: ''
  52. },
  53. classifyCode: {
  54. type: String,
  55. default: ''
  56. },
  57. groupCode: {
  58. type: String,
  59. default: ''
  60. },
  61. selecList: {
  62. type: Array,
  63. default: []
  64. },
  65. itemIds: {
  66. type: String,
  67. default: null
  68. },
  69. type: {
  70. type: Boolean,
  71. default: false,
  72. },
  73. },
  74. data() {
  75. return {
  76. roleName: localStorage.getItem("roleName"),
  77. curCodeList: [
  78. {
  79. key: null,
  80. code: '全部'
  81. },
  82. {
  83. key: 'CNY',
  84. code: 'CNY'
  85. },
  86. {
  87. key: 'USD',
  88. code: 'USD'
  89. }
  90. ],
  91. userList: [],
  92. previewDialog: false,
  93. isPrintTheBoxNumber: false,
  94. bbDisabled: false,
  95. form: {},
  96. formReport: {},
  97. query: {
  98. classifyCode: '业务',
  99. },
  100. loading: true,
  101. page: {
  102. pageSize: 10,
  103. currentPage: 1,
  104. total: 0
  105. },
  106. optionPrinting: {
  107. stripe: true,
  108. height: 400,
  109. calcHeight: 30,
  110. tip: false,
  111. searchShow: true,
  112. searchMenuSpan: 6,
  113. border: true,
  114. selection: true,
  115. dialogClickModal: false,
  116. refreshBtn: false,
  117. columnBtn: false,
  118. addBtn: false,
  119. viewBtn: false,
  120. delBtn: false,
  121. editBtn: false,
  122. menuWidth: '100',
  123. header: false,
  124. // menu:false,
  125. column: [
  126. // {
  127. // label: "币别",
  128. // prop: "curCode",
  129. // overHidden: true,
  130. // },
  131. {
  132. label: "客户名称",
  133. prop: "cnName",
  134. overHidden: true,
  135. },
  136. {
  137. label: "客户编号",
  138. prop: "code",
  139. overHidden: true,
  140. },
  141. ]
  142. },
  143. selectionList: [],
  144. option: {},
  145. optionBack: {
  146. height: 400,
  147. calcHeight: 30,
  148. tip: false,
  149. searchShow: false,
  150. searchMenuSpan: 6,
  151. border: true,
  152. index: true,
  153. viewBtn: true,
  154. selection: true,
  155. searchBtn: false,
  156. emptyBtn: false,
  157. dialogClickModal: false,
  158. menuWidth: 100,
  159. column: [
  160. {
  161. label: "组别",
  162. prop: "groupCode",
  163. overHidden: true,
  164. rules: [{
  165. required: true,
  166. message: "请输入组别",
  167. trigger: "blur"
  168. }]
  169. },
  170. {
  171. label: "业务类别",
  172. prop: "classifyCode",
  173. overHidden: true,
  174. },
  175. {
  176. label: "报表编码",
  177. prop: "code",
  178. overHidden: true,
  179. rules: [{
  180. required: true,
  181. message: "请输入报表编码",
  182. trigger: "blur"
  183. }]
  184. },
  185. {
  186. label: "中文名称",
  187. prop: "cnName",
  188. overHidden: true,
  189. rules: [{
  190. required: true,
  191. message: "请输入中文名称",
  192. trigger: "blur"
  193. }]
  194. },
  195. {
  196. label: "英文名称",
  197. prop: "enName",
  198. overHidden: true,
  199. },
  200. {
  201. label: "报表格式",
  202. prop: "content",
  203. overHidden: true,
  204. rules: [{
  205. required: true,
  206. message: "请输入报表格式",
  207. trigger: "blur"
  208. }]
  209. },
  210. {
  211. label: "备注",
  212. prop: "remarks",
  213. overHidden: true,
  214. },
  215. ]
  216. },
  217. data: [],
  218. };
  219. },
  220. async created() {
  221. // this.option = await this.getColumnData(this.getColumnName(397), this.optionBack);
  222. getUserApprovalList().then(res => {
  223. this.findObject(this.option.column, "authorizedUsersId").dicData = res.data.data
  224. })
  225. // 获取业务类型
  226. bbusinesstypeList(1, 20).then(res => {
  227. this.findObject(this.option.column, "businessType").dicData = res.data.data.records
  228. })
  229. },
  230. computed: {
  231. ...mapGetters(["permission"]),
  232. permissionList() {
  233. return {
  234. addBtn: this.vaildData(this.permission.reports_add, false),
  235. viewBtn: this.vaildData(this.permission.reports_view, false),
  236. delBtn: this.vaildData(this.permission.reports_delete, false),
  237. editBtn: this.vaildData(this.permission.reports_edit, false)
  238. };
  239. },
  240. ids() {
  241. let ids = [];
  242. this.selectionList.forEach(ele => {
  243. ids.push(ele.id);
  244. });
  245. return ids.join(",");
  246. }
  247. },
  248. methods: {
  249. openDialog() {
  250. this.previewDialog = true
  251. this.onLoad(this.page, this.query);
  252. },
  253. // 设计报表
  254. async reportDesignButton(url) {
  255. Stimulsoft.Base.StiLicense.key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHn0s4gy0Fr5YoUZ9V00Y0igCSFQzwEqYBh/N77k4f0fWXTHW5rqeBNLkaurJDenJ9o97TyqHs9HfvINK18Uwzsc/bG01Rq+x3H3Rf+g7AY92gvWmp7VA2Uxa30Q97f61siWz2dE5kdBVcCnSFzC6awE74JzDcJMj8OuxplqB1CYcpoPcOjKy1PiATlC3UsBaLEXsok1xxtRMQ283r282tkh8XQitsxtTczAJBxijuJNfziYhci2jResWXK51ygOOEbVAxmpflujkJ8oEVHkOA/CjX6bGx05pNZ6oSIu9H8deF94MyqIwcdeirCe60GbIQByQtLimfxbIZnO35X3fs/94av0ODfELqrQEpLrpU6FNeHttvlMc5UVrT4K+8lPbqR8Hq0PFWmFrbVIYSi7tAVFMMe2D1C59NWyLu3AkrD3No7YhLVh7LV0Tttr/8FrcZ8xirBPcMZCIGrRIesrHxOsZH2V8t/t0GXCnLLAWX+TNvdNXkB8cF2y9ZXf1enI064yE5dwMs2fQ0yOUG/xornE'
  256. // Stimulsoft.Base.StiLicense.Key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHkcgIvwL0jnpsDqRpWg5FI5kt2G7A0tYIcUygBh1sPs7plofUOqPB1a4HBIXJB621mau2oiAIj+ysU7gKUXfjn/D5BocmduNB+ZMiDGPxFrAp3PoD0nYNkkWh8r7gBZ1v/JZSXGE3bQDrCQCNSy6mgby+iFAMV8/PuZ1z77U+Xz3fkpbm6MYQXYp3cQooLGLUti7k1TFWrnawT0iEEDJ2iRcU9wLqn2g9UiWesEZtKwI/UmEI2T7nv5NbgV+CHguu6QU4WWzFpIgW+3LUnKCT/vCDY+ymzgycw9A9+HFSzARiPzgOaAuQYrFDpzhXV+ZeX31AxWlnzjDWqpfluygSNPtGul5gyNt2CEoJD1Yom0VN9fvRonYsMsimkFFx2AwyVpPcs+JfVBtpPbTcZscnzUdmiIvxv8Gcin6sNSibM6in/uUKFt3bVgW/XeMYa7MLGF53kvBSwi78poUDigA2n12SmghLR0AHxyEDIgZGOTbNI33GWu7ZsPBeUdGu55R8w='
  257. Stimulsoft.Base.Localization.StiLocalization.addLocalizationFile('/reports/stimulsoft/Localization/zh-CHS.xml', true, 'zh-CHS')
  258. Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile('/reports/stimulsoft/Localization/zh-CHS.xml')
  259. var options = new Stimulsoft.Designer.StiDesignerOptions()
  260. options.appearance.fullScreenMode = true
  261. options.allowChangeWindowTitle = false
  262. options.toolbar.showSaveDialog = false
  263. options.toolbar.showFileMenuSave = false
  264. options.toolbar.showFileMenuAbout = false
  265. options.toolbar.showFileMenuClose = false
  266. options.toolbar.showFileMenuExit = false
  267. options.toolbar.showFileMenuInfo = false
  268. options.toolbar.showFileMenuHelp = false
  269. options.toolbar.showFileMenuNew = false
  270. options.appearance.showTooltips = false
  271. options.appearance.showDialogsHelp = false
  272. options.toolbar.showSetupToolboxButton = true
  273. options.appearance.htmlRenderMode = Stimulsoft.Report.Export.StiHtmlExportMode.Table
  274. let designer = new Stimulsoft.Designer.StiDesigner(
  275. options,
  276. 'StiDesigner',
  277. false
  278. )
  279. designer.onSaveReport = (e) => {
  280. console.log('onSaveReport')
  281. // let jsObject = this.jsObject
  282. if (!e.report.isModified)
  283. return
  284. var jsonString = e.report.saveToJsonString()
  285. // console.log(jsonString)
  286. this.form.url = jsonString;
  287. console.log('保存url')
  288. console.log(jsonString)
  289. console.log('保存url结束')
  290. }
  291. let report = new window.Stimulsoft.Report.StiReport();
  292. report.styles.loadFile('static/Plugins/reports/css/Styles.sts')
  293. report.applyStyles()
  294. console.log("从 url 报表");
  295. console.log(url)
  296. console.log("结束");
  297. if (url) {
  298. report.load(url)
  299. }
  300. // 加载文件
  301. // if (this.id) {
  302. // billsDetail(this.id).then(res => {
  303. // var data = res.data.data
  304. // data.pageOne = 'Page : 1 of 1'
  305. // // 处理超长数据
  306. // if (data.hshipperDetails) {
  307. // var consignerIndex2 = data.hshipperDetails.indexOf( '\n' )
  308. // for (let i = 0; i < 4; i++) {
  309. // consignerIndex2 = data.hshipperDetails.indexOf( '\n', consignerIndex2 + 1 );
  310. // }
  311. // if (consignerIndex2 != -1) {
  312. // var hshipperDetails = data.hshipperDetails.substring(consignerIndex2 + 2, data.hshipperDetails.length)
  313. // data.hshipperDetails = data.hshipperDetails.substring(0, consignerIndex2) + ' *'
  314. // data.commodityDescr += '\n*' + hshipperDetails
  315. // }
  316. // }
  317. //
  318. // if (data.hconsigneeDetails) {
  319. // var consigneeIndex2 = data.hconsigneeDetails.indexOf( '\n' )
  320. // for (let i = 0; i < 3; i++) {
  321. // consigneeIndex2 = data.hconsigneeDetails.indexOf( '\n', consigneeIndex2 + 1 );
  322. // }
  323. // if (consigneeIndex2 != -1) {
  324. // var hconsigneeDetails = data.hconsigneeDetails.substring(consigneeIndex2 + 2, data.hconsigneeDetails.length)
  325. // data.hconsigneeDetails = data.hconsigneeDetails.substring(0, consigneeIndex2) + ' **'
  326. // data.commodityDescr += '\n**' + hconsigneeDetails
  327. // }
  328. // }
  329. //
  330. // if (data.hnotifyDetails) {
  331. // var notifierIndex2 = data.hnotifyDetails.indexOf( '\n' )
  332. // for (let i = 0; i < 3; i++) {
  333. // notifierIndex2 = data.hnotifyDetails.indexOf( '\n', notifierIndex2 + 1 );
  334. // }
  335. // if (notifierIndex2 != -1) {
  336. // var hnotifyDetails = data.hnotifyDetails.substring(notifierIndex2 + 2, data.hnotifyDetails.length)
  337. // data.hnotifyDetails = data.hnotifyDetails.substring(0, notifierIndex2) + ' ***'
  338. // data.commodityDescr += '\n***' + hnotifyDetails
  339. // }
  340. // }
  341. //
  342. // // 处理箱号
  343. // if (this.isPrintTheBoxNumber) {
  344. // data.commodityDescr += '\n.\n.\n'
  345. // }
  346. //
  347. // // PLACE & DATE OF ISSUE
  348. // data.placeAndDateOfIssue = ''
  349. // if (data.issueAt) {
  350. // data.placeAndDateOfIssue += data.issueAt
  351. // }
  352. // if (data.issueDate) {
  353. // let date = new Date(data.issueDate.replace(/-/g,'/'));
  354. // let yyyy = date.getFullYear();
  355. // let mmmm = date.toDateString().split(" ")[1]
  356. // let dd = date.getDate()
  357. // data.placeAndDateOfIssue += ', ' + dd + '-' + mmmm + '-' + yyyy
  358. // }
  359. //
  360. // // Total number of containers or packages received by the Carriers
  361. // if (data.preContainersList) {
  362. // let boxMap = new Map();
  363. // for (let boxQuantity of data.preContainersList) {
  364. // if (boxMap.get(boxQuantity.cntrTypeCode)) {
  365. // let v = boxMap.get(boxQuantity.cntrTypeCode)
  366. // boxMap.set(boxQuantity.cntrTypeCode, v + boxQuantity.quantity)
  367. // } else {
  368. // boxMap.set(boxQuantity.cntrTypeCode, boxQuantity.quantity)
  369. // }
  370. // }
  371. // let boxs = ''
  372. // boxMap.forEach(function (value, key, map) {
  373. // boxs += value + 'x' + key + ', '
  374. // })
  375. // boxs = boxs.substring(0, boxs.length - 2)
  376. //
  377. // data.boxQuantity = boxs + ' CONTAINER(S) ONLY'
  378. // }
  379. //
  380. // // Number of original B/Ls
  381. // if (data.numberOfObl) {
  382. // data.numberOfObl += ' (' + data.numberOfOblDigit + ')'
  383. // }
  384. //
  385. // if (data.commodityDescr) {
  386. // var descriptionIndex2 = data.commodityDescr.indexOf( '\n' )
  387. // for (let i = 0; i < 19; i++) {
  388. // descriptionIndex2 = data.commodityDescr.indexOf( '\n', descriptionIndex2 + 1 );
  389. // }
  390. // if (descriptionIndex2 != -1) {
  391. // data.pageOne = 'Page : 1 of 2'
  392. // data.pageTwo = 'Page : 2 of 2'
  393. // var extraLongText = data.commodityDescr.substring(descriptionIndex2 + 2, data.commodityDescr.length)
  394. // data.commodityDescr = data.commodityDescr.substring(0, descriptionIndex2)
  395. // data.extraLongTips = '** TO BE CONTINUED ON ATTACHED LIST **'
  396. // data.extraLongText = extraLongText
  397. // }
  398. // }
  399. // var dataSet = new Stimulsoft.System.Data.DataSet(
  400. // 'reportData'
  401. // )
  402. // dataSet.readJson(data)
  403. // report.regData('reportData', 'reportData', dataSet)
  404. // // 从模版和数据加载报表
  405. // // loadReport(report, '', {})
  406. //
  407. // designer.report = report
  408. // })
  409. // }
  410. // let data = [
  411. // {
  412. // id: 2,
  413. // billNo: 'JOB NO',
  414. // billDate: 'DATE',
  415. // operatorName: 'OP',
  416. // bookingNo: 'bookingNo',
  417. // mblno: 'ob/l no',
  418. // carrierCnName: 'CARRIER',
  419. // polCnName: 'POL',
  420. // vesselCnName: 'vsl/voy',
  421. // voyageNo: 'vsl/voy',
  422. // podCnName: 'POD',
  423. // cyCnName: 'DEPOT',
  424. // etd: 'etd/eta',
  425. // eta: 'etd/eta',
  426. // mpaymode: 'freight / freight',
  427. // volume: '箱型箱量',
  428. // hblno: 'hb/l no',
  429. // srcType: 'analysis1',
  430. // srcCnName: 'analysis2',
  431. // corpCnName: 'analysis3',
  432. // list: [
  433. // {
  434. // id:1,
  435. // pid:2,
  436. // feeCnNameData: 'fee list1',
  437. // usd: 'usd',
  438. // rmb: 'rmb',
  439. // tr: '税',
  440. // corpCnName: 'customer',
  441. // },
  442. // {
  443. // id:2,
  444. // pid:2,
  445. // feeCnNameData: 'fee list2',
  446. // usd: 'usd',
  447. // rmb: 'rmb',
  448. // tr: '税',
  449. // corpCnName: 'customer',
  450. // },
  451. // ]
  452. //
  453. // }, {
  454. // id:3,
  455. // billNo: 'JOB NO',
  456. // billDate: 'DATE',
  457. // operatorName: 'OP',
  458. // bookingNo: 'bookingNo',
  459. // mblno: 'ob/l no',
  460. // carrierCnName: 'CARRIER',
  461. // polCnName: 'POL',
  462. // vesselCnName: 'vsl/voy',
  463. // voyageNo: 'vsl/voy',
  464. // podCnName: 'POD',
  465. // cyCnName: 'DEPOT',
  466. // etd: 'etd/eta',
  467. // eta: 'etd/eta',
  468. // mpaymode: 'freight / freight',
  469. // volume: '箱型箱量',
  470. //
  471. // hblno: 'hb/l no',
  472. // srcType: 'analysis1',
  473. // srcCnName: 'analysis2',
  474. // corpCnName: 'analysis3',
  475. // list: [
  476. // {
  477. // id:3,
  478. // pid:3,
  479. // feeCnNameData: 'fee list',
  480. // usd: 'usd',
  481. // rmb: 'rmb',
  482. // tr: '税',
  483. // corpCnName: 'customer',
  484. // },
  485. // {
  486. // id:4,
  487. // pid:3,
  488. // feeCnNameData: 'fee list',
  489. // usd: 'usd',
  490. // rmb: 'rmb',
  491. // tr: '税',
  492. // corpCnName: 'customer',
  493. // },
  494. // ]
  495. //
  496. // }, {
  497. // id:4,
  498. // billNo: 'JOB NO',
  499. // billDate: 'DATE',
  500. // operatorName: 'OP',
  501. // bookingNo: 'bookingNo',
  502. // mblno: 'ob/l no',
  503. // carrierCnName: 'CARRIER',
  504. // polCnName: 'POL',
  505. // vesselCnName: 'vsl/voy',
  506. // voyageNo: 'vsl/voy',
  507. // podCnName: 'POD',
  508. // cyCnName: 'DEPOT',
  509. // etd: 'etd/eta',
  510. // eta: 'etd/eta',
  511. // mpaymode: 'freight / freight',
  512. // volume: '箱型箱量',
  513. //
  514. // hblno: 'hb/l no',
  515. // srcType: 'analysis1',
  516. // srcCnName: 'analysis2',
  517. // corpCnName: 'analysis3',
  518. // list: [
  519. // {
  520. // id:10,
  521. // pid:4,
  522. // feeCnNameData: 'fee list',
  523. // usd: 'usd',
  524. // rmb: 'rmb',
  525. // tr: '税',
  526. // corpCnName: 'customer',
  527. // },
  528. // {
  529. // id:11,
  530. // pid:4,
  531. // feeCnNameData: 'fee list',
  532. // usd: 'usd',
  533. // rmb: 'rmb',
  534. // tr: '税',
  535. // corpCnName: 'customer',
  536. // },
  537. // ]
  538. // },
  539. // ]
  540. // 获取报表数据
  541. const res = await reportsGetReportData({
  542. billId: this.id,
  543. reportCode: this.form.code,
  544. groupCode: this.form.groupCode,
  545. itemIds: this.itemIds,
  546. type: this.businessValue
  547. })
  548. // 获取的数据赋值
  549. console.log(res.data.data, 584)
  550. if (!res.data.data.data) {
  551. var data = res.data.data.data
  552. } else {
  553. var data = res.data.data.data
  554. // var data = res.data.data.data.map((item,index)=>{
  555. // item.index = index
  556. // item.feeCenterList.forEach(ite=>{
  557. // ite.ppid = index
  558. // })
  559. // return item
  560. // })
  561. }
  562. var dataSet = new Stimulsoft.System.Data.DataSet(
  563. 'reportData'
  564. )
  565. dataSet.readJson(data)
  566. report.regData('reportData', 'reportData', dataSet)
  567. // 从模版和数据加载报表
  568. // loadReport(report, '', {})
  569. designer.report = report
  570. this.designer = designer
  571. this.$refs.reportContainer.showContainer(
  572. () => {
  573. setTimeout(() => {
  574. designer.renderHtml('reportContainer')
  575. this.createDesignerButtons()
  576. }, 50)
  577. },
  578. () => { },
  579. )
  580. },
  581. // 打印报表获取数据
  582. reportsGetReportDatafun(url, row) {
  583. printingUpdate({ id: this.id })
  584. let obj = {}
  585. if (this.selecList.length || this.type) {
  586. obj = {
  587. billId: this.id,
  588. reportCode: row.classifyCode,
  589. groupCode: row.groupCode,
  590. itemIds: this.itemIds,
  591. type: this.businessValue
  592. }
  593. } else {
  594. obj = {
  595. billId: this.id,
  596. reportCode: this.classifyCode,
  597. groupCode: this.groupCode,
  598. type: this.businessValue,
  599. corpIds: row.id
  600. }
  601. }
  602. reportsGetReportData(obj).then(res => {
  603. if (this.selecList.length || this.type) {
  604. this.handleReportPreview(url, res.data.data.data)
  605. } else {
  606. this.handleReportPreview(this.url, res.data.data.data)
  607. }
  608. })
  609. },
  610. testMail(e) {
  611. console.info('eeeeeeeeeeeeeeeeeeee----', e)
  612. this.$refs.mailComponentRef.dialogVisible = true
  613. this.$refs.mailComponentRef.formData.attachments = e.fileName
  614. this.$refs.mailComponentRef.formData.fileType = e.formatName
  615. this.$refs.mailComponentRef.formData.fileContent = e.data
  616. },
  617. // 预览报表
  618. handleReportPreview(url, row) {
  619. Stimulsoft.Base.StiLicense.key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHn0s4gy0Fr5YoUZ9V00Y0igCSFQzwEqYBh/N77k4f0fWXTHW5rqeBNLkaurJDenJ9o97TyqHs9HfvINK18Uwzsc/bG01Rq+x3H3Rf+g7AY92gvWmp7VA2Uxa30Q97f61siWz2dE5kdBVcCnSFzC6awE74JzDcJMj8OuxplqB1CYcpoPcOjKy1PiATlC3UsBaLEXsok1xxtRMQ283r282tkh8XQitsxtTczAJBxijuJNfziYhci2jResWXK51ygOOEbVAxmpflujkJ8oEVHkOA/CjX6bGx05pNZ6oSIu9H8deF94MyqIwcdeirCe60GbIQByQtLimfxbIZnO35X3fs/94av0ODfELqrQEpLrpU6FNeHttvlMc5UVrT4K+8lPbqR8Hq0PFWmFrbVIYSi7tAVFMMe2D1C59NWyLu3AkrD3No7YhLVh7LV0Tttr/8FrcZ8xirBPcMZCIGrRIesrHxOsZH2V8t/t0GXCnLLAWX+TNvdNXkB8cF2y9ZXf1enI064yE5dwMs2fQ0yOUG/xornE'
  620. // Stimulsoft.Base.StiLicense.Key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHkcgIvwL0jnpsDqRpWg5FI5kt2G7A0tYIcUygBh1sPs7plofUOqPB1a4HBIXJB621mau2oiAIj+ysU7gKUXfjn/D5BocmduNB+ZMiDGPxFrAp3PoD0nYNkkWh8r7gBZ1v/JZSXGE3bQDrCQCNSy6mgby+iFAMV8/PuZ1z77U+Xz3fkpbm6MYQXYp3cQooLGLUti7k1TFWrnawT0iEEDJ2iRcU9wLqn2g9UiWesEZtKwI/UmEI2T7nv5NbgV+CHguu6QU4WWzFpIgW+3LUnKCT/vCDY+ymzgycw9A9+HFSzARiPzgOaAuQYrFDpzhXV+ZeX31AxWlnzjDWqpfluygSNPtGul5gyNt2CEoJD1Yom0VN9fvRonYsMsimkFFx2AwyVpPcs+JfVBtpPbTcZscnzUdmiIvxv8Gcin6sNSibM6in/uUKFt3bVgW/XeMYa7MLGF53kvBSwi78poUDigA2n12SmghLR0AHxyEDIgZGOTbNI33GWu7ZsPBeUdGu55R8w='
  621. Stimulsoft.Base.Localization.StiLocalization.addLocalizationFile('/reports/stimulsoft/Localization/zh-CHS.xml', true, 'zh-CHS')
  622. Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile('/reports/stimulsoft/Localization/zh-CHS.xml')
  623. // 工具栏
  624. var options = new Stimulsoft.Viewer.StiViewerOptions()
  625. options.height = '100%'
  626. options.appearance.scrollbarsMode = true // 滚动条模式
  627. options.toolbar.showDesignButton = false // 显示设计按钮
  628. options.toolbar.showAboutButton = false // 显示关于按钮
  629. options.toolbar.showResourcesButton = false // 显示资源按钮
  630. options.toolbar.showFullScreenButton = false // 显示全屏按钮
  631. options.toolbar.showOpenButton = false // 显示打开按钮
  632. options.appearance.showTooltips = false // 显示工具提示
  633. options.appearance.showDialogsHelp = false // 显示对话框帮助
  634. options.exports.showExportToDocument = false // 显示导出到文档
  635. options.toolbar.showParametersButton = true // 显示参数按钮
  636. options.appearance.bookmarksPrint = true // 书签打印
  637. // options.toolbar.showPrintButton = false // 打印按钮是否显示 下面直接自定义控制打印弹窗是否开启
  638. options.toolbar.showSendEmailButton = true // 显示发送邮件按钮
  639. options.email.showEmailDialog = false
  640. options.email.showExportDialog = false
  641. // printDestination 参数:用于指定报表打印的目标位置,可以是打印机、PDF 文件或者直接打印到浏览器等。
  642. // Stimulsoft.Viewer.StiPrintDestination.Direct:表示直接打印到打印机,即将报表内容直接发送至打印机进行打印。
  643. // 通过设置不同的 printDestination 参数,你可以控制报表打印的行为,例如是直接打印到打印机,还是生成 PDF 文件,或者直接在浏览器中预览打印内容等。
  644. options.toolbar.printDestination = Stimulsoft.Viewer.StiPrintDestination.Direct
  645. // htmlRenderMode html渲染模式
  646. options.appearance.htmlRenderMode = Stimulsoft.Report.Export.StiHtmlExportMode.Table
  647. // 是创建一个 Stimulsoft 报表查看器的实例的代码
  648. let viewer = new Stimulsoft.Viewer.StiViewer(options, 'StiViewer', false)
  649. viewer.onEmailReport = this.testMail
  650. // 报表
  651. console.log("创建一个报表实例");
  652. let report = new window.Stimulsoft.Report.StiReport();
  653. // 加载文件
  654. console.log("从url加载报表");
  655. // report.loadFile("/reports/stimulsoft/demos/SimpleList.mrt");
  656. report.load(url)
  657. // 获取报表数据
  658. var data = row
  659. data.pageOne = 'Page : 1 of 1'
  660. // 处理超长数据
  661. if (data.hshipperDetails) {
  662. var consignerIndex2 = data.hshipperDetails.indexOf('\n')
  663. for (let i = 0; i < 4; i++) {
  664. consignerIndex2 = data.hshipperDetails.indexOf('\n', consignerIndex2 + 1);
  665. }
  666. if (consignerIndex2 != -1) {
  667. var hshipperDetails = data.hshipperDetails.substring(consignerIndex2 + 2, data.hshipperDetails.length)
  668. data.hshipperDetails = data.hshipperDetails.substring(0, consignerIndex2) + ' *'
  669. data.commodityDescr += '\n*' + hshipperDetails
  670. }
  671. }
  672. if (data.hconsigneeDetails) {
  673. var consigneeIndex2 = data.hconsigneeDetails.indexOf('\n')
  674. for (let i = 0; i < 3; i++) {
  675. consigneeIndex2 = data.hconsigneeDetails.indexOf('\n', consigneeIndex2 + 1);
  676. }
  677. if (consigneeIndex2 != -1) {
  678. var hconsigneeDetails = data.hconsigneeDetails.substring(consigneeIndex2 + 2, data.hconsigneeDetails.length)
  679. data.hconsigneeDetails = data.hconsigneeDetails.substring(0, consigneeIndex2) + ' **'
  680. data.commodityDescr += '\n**' + hconsigneeDetails
  681. }
  682. }
  683. if (data.hnotifyDetails) {
  684. var notifierIndex2 = data.hnotifyDetails.indexOf('\n')
  685. for (let i = 0; i < 3; i++) {
  686. notifierIndex2 = data.hnotifyDetails.indexOf('\n', notifierIndex2 + 1);
  687. }
  688. if (notifierIndex2 != -1) {
  689. var hnotifyDetails = data.hnotifyDetails.substring(notifierIndex2 + 2, data.hnotifyDetails.length)
  690. data.hnotifyDetails = data.hnotifyDetails.substring(0, notifierIndex2) + ' ***'
  691. data.commodityDescr += '\n***' + hnotifyDetails
  692. }
  693. }
  694. // 处理箱号
  695. if (this.isPrintTheBoxNumber) {
  696. data.commodityDescr += '\n.\n.\n'
  697. }
  698. // PLACE & DATE OF ISSUE
  699. data.placeAndDateOfIssue = ''
  700. if (data.issueAt) {
  701. data.placeAndDateOfIssue += data.issueAt
  702. }
  703. if (data.issueDate) {
  704. let date = new Date(data.issueDate.replace(/-/g, '/'));
  705. let yyyy = date.getFullYear();
  706. let mmmm = date.toDateString().split(" ")[1]
  707. let dd = date.getDate()
  708. data.placeAndDateOfIssue += ', ' + dd + '-' + mmmm + '-' + yyyy
  709. }
  710. // Total number of containers or packages received by the Carriers
  711. if (data.preContainersList) {
  712. let boxMap = new Map();
  713. for (let boxQuantity of data.preContainersList) {
  714. if (boxMap.get(boxQuantity.cntrTypeCode)) {
  715. let v = boxMap.get(boxQuantity.cntrTypeCode)
  716. boxMap.set(boxQuantity.cntrTypeCode, v + boxQuantity.quantity)
  717. } else {
  718. boxMap.set(boxQuantity.cntrTypeCode, boxQuantity.quantity)
  719. }
  720. }
  721. let boxs = ''
  722. boxMap.forEach(function (value, key, map) {
  723. boxs += value + 'x' + key + ', '
  724. })
  725. boxs = boxs.substring(0, boxs.length - 2)
  726. data.boxQuantity = boxs + ' CONTAINER(S) ONLY'
  727. }
  728. // Number of original B/Ls
  729. if (data.numberOfObl) {
  730. data.numberOfObl += ' (' + data.numberOfOblDigit + ')'
  731. }
  732. if (data.commodityDescr) {
  733. var descriptionIndex2 = data.commodityDescr.indexOf('\n')
  734. for (let i = 0; i < 19; i++) {
  735. descriptionIndex2 = data.commodityDescr.indexOf('\n', descriptionIndex2 + 1);
  736. }
  737. if (descriptionIndex2 != -1) {
  738. data.pageOne = 'Page : 1 of 2'
  739. data.pageTwo = 'Page : 2 of 2'
  740. var extraLongText = data.commodityDescr.substring(descriptionIndex2 + 2, data.commodityDescr.length)
  741. data.commodityDescr = data.commodityDescr.substring(0, descriptionIndex2)
  742. data.extraLongTips = '** TO BE CONTINUED ON ATTACHED LIST **'
  743. data.extraLongText = extraLongText
  744. }
  745. }
  746. // console.log(data.hshipperDetails, 'hshipperDetails2')
  747. // 创建一个 Stimulsoft 数据集(DataSet)的实例的代码
  748. var dataSet = new Stimulsoft.System.Data.DataSet(
  749. 'reportData'
  750. )
  751. dataSet.readJson(data) // 用于将 JSON 格式的数据加载到数据集中。data 是包含报表数据的 JSON 对象。
  752. // 这是一个方法调用,用于在报表中注册数据源。参数 'reportData' 是数据源的名称,
  753. // 第二个 'reportData' 是数据源的别名,dataSet 则是之前创建的数据集实例
  754. report.regData('reportData', 'reportData', dataSet)
  755. // 从模版和数据加载报表
  756. // loadReport(report, '', {})
  757. // 这是将报表对象指定给报表查看器的属性。viewer 是报表查看器的实例,而 report 是之前创建的报表对象。
  758. viewer.report = report;
  759. this.$refs.reportContainer.showContainer(
  760. () => {
  761. setTimeout(() => {
  762. viewer.renderHtml('reportContainer')
  763. this.createViewerButtons(viewer)
  764. }, 50)
  765. },
  766. () => {
  767. },
  768. )
  769. console.log("加载成功完成!");
  770. },
  771. loadReport(report, content, data) {
  772. var mimeString = content
  773. .split(',')[0]
  774. .split(':')[1]
  775. .split(';')[0]
  776. var byteString = atob(content.split(',')[1])
  777. var ab = new ArrayBuffer(byteString.length)
  778. var ia = new Uint8Array(ab)
  779. for (var i = 0; i < byteString.length; i++) {
  780. ia[i] = byteString.charCodeAt(i)
  781. }
  782. var blob = new Blob([ab])
  783. JSZip.loadAsync(blob).then(function (unziped) {
  784. unziped
  785. .file('reportfile.json')
  786. .async('string')
  787. .then(res => {
  788. report.load(res)
  789. if (!!data) {
  790. var dataSet = new Stimulsoft.System.Data.DataSet(
  791. 'reportData'
  792. )
  793. dataSet.readJson(data)
  794. report.regData('reportData', 'reportData', dataSet)
  795. }
  796. })
  797. })
  798. },
  799. createDesignerButtons(e) {
  800. console.log(e, 936)
  801. if (!!e) {
  802. try {
  803. this.designer.jsObject.options.menus.localizationMenu.addEventListener(
  804. 'click',
  805. this.createDesignerButtons
  806. )
  807. } catch (error) {
  808. }
  809. }
  810. let toolBarRow = this.designer.jsObject.options.toolBar.firstChild.tr[0]
  811. let customButton = this.designer.jsObject.StatusPanelButton(
  812. 'exitButton',
  813. '关闭',
  814. 'LoginControls.Window.CloseWhite.png',
  815. '关闭',
  816. null,
  817. 30,
  818. 60
  819. )
  820. customButton.image.style.width = customButton.image.style.height = '16px'
  821. let buttonCell = document.createElement('td')
  822. buttonCell.className = 'stiDesignerToolButtonCell'
  823. buttonCell.appendChild(customButton)
  824. toolBarRow.appendChild(buttonCell)
  825. let that = this
  826. customButton.action = function (e) {
  827. let jsObject = this.jsObject
  828. if (jsObject.options.reportIsModified) {
  829. var messageForm = jsObject.MessageFormForSave()
  830. messageForm.changeVisibleState(true)
  831. messageForm.action = function (state) {
  832. if (state) {
  833. jsObject.SendCommandSaveReport()
  834. setTimeout(() => {
  835. jsObject.SendCommandCloseReport()
  836. jsObject.designer.invokeExit()
  837. if (that.$refs.reportContainer)
  838. that.$refs.reportContainer.hideContainer()
  839. }, 250)
  840. } else {
  841. jsObject.SendCommandCloseReport()
  842. jsObject.designer.invokeExit()
  843. if (that.$refs.reportContainer)
  844. that.$refs.reportContainer.hideContainer()
  845. }
  846. }
  847. } else {
  848. jsObject.SendCommandCloseReport()
  849. jsObject.designer.invokeExit()
  850. if (that.$refs.reportContainer)
  851. that.$refs.reportContainer.hideContainer()
  852. }
  853. }
  854. },
  855. createViewerButtons(viewer) {
  856. viewer.jsObject.collections.images['myClose.png'] =
  857. 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAA0ElEQVQ4ja3TO05CQRQG4A8iOwAbtYWETndAaecK7NwCKmETtJZsSBNLobEz8ZFIJQ0UnOGSm3DnYviTybzO/895DQXGWGCVGQuMEqkRcwcfuMOLalziCaf4TIe9UG9nyMJmFRzNGoRK1BU4xxx9G7cfwostciGk+x8MqgySwDXe4tU53hVV+MNtTmAoX84JGv9NYgrHyR6DV8wUSW7hItZLm36ZVoVQxsFJLOMsPOrH/h7dQwR2cdxOTEn8DtUbPGc4V2H7Vb4Yqfedf/GYSGt8VUmxgyfuBAAAAABJRU5ErkJggg=='
  858. const closeBtn = viewer.jsObject.SmallButton(
  859. 'closeBtn',
  860. '关闭',
  861. 'myClose.png'
  862. )
  863. // 增加打印弹窗配置
  864. const printBtn = viewer.jsObject.SmallButton(
  865. 'printBtn',
  866. '打印报表',
  867. 'myClose.png'
  868. )
  869. // console.log(viewer.jsObject.print(),'1013')
  870. // 获取 关闭按钮的dom元素位置
  871. const toolbarTable = viewer.jsObject.controls.toolbar.firstChild.firstChild
  872. const buttonsTable = toolbarTable.rows[0].lastChild.lastChild
  873. const userButtonCell = buttonsTable.rows[0].insertCell(0)
  874. // 获取打印按钮的位置
  875. const buttonsTablePrint = toolbarTable.rows[0].childNodes[0].lastChild // 打印按钮
  876. const userButtonPrint = buttonsTablePrint.rows[0].childNodes[0] // 打印按钮dom位置
  877. userButtonPrint.addEventListener("click", (event) => {
  878. console.log("打印点击");
  879. // event.preventDefault()
  880. });
  881. userButtonPrint.addEventListener("mouseover", (event) => {
  882. console.log("移入打印按钮");
  883. console.log(event, 1035)
  884. });
  885. userButtonCell.className = 'stiJsViewerClearAllStyles'
  886. userButtonCell.appendChild(closeBtn) // 添加关闭节点
  887. // userButtonPrint.prepend(printBtn) // 在 printBtn 节点里最前面增加一个子级节点
  888. let that = this
  889. // 关闭按钮的监听点击
  890. closeBtn.action = function () {
  891. console.log(that.$refs.reportContainer, '1022')
  892. if (that.$refs.reportContainer)
  893. that.$refs.reportContainer.hideContainer()
  894. }
  895. // // // 打印按钮监听
  896. // printBtn.action = (e)=>{
  897. // console.log('打印')
  898. // window.print()
  899. // }
  900. },
  901. searchReset() {
  902. this.query = {};
  903. this.onLoad(this.page);
  904. },
  905. searchChange(params, done) {
  906. this.query = params;
  907. this.page.currentPage = 1;
  908. this.onLoad(this.page, params);
  909. done();
  910. },
  911. selectionChange(list) {
  912. this.selectionList = list;
  913. },
  914. selectionClear() {
  915. this.selectionList = [];
  916. this.$refs.crud.toggleSelection();
  917. },
  918. currentChange(currentPage) {
  919. this.page.currentPage = currentPage;
  920. },
  921. sizeChange(pageSize) {
  922. this.page.pageSize = pageSize;
  923. },
  924. refreshChange() {
  925. this.onLoad(this.page, this.query);
  926. },
  927. onLoad(page, params = {}) {
  928. this.loading = true;
  929. params.businessType = this.businessValue
  930. params.classifyCode = this.classifyCode
  931. params.groupCode = this.groupCode
  932. if (this.selecList.length || this.type) {
  933. getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  934. this.page.total = res.data.data.total;
  935. this.data = res.data.data.records;
  936. this.selectionClear();
  937. }).finally(() => {
  938. this.loading = false;
  939. })
  940. } else {
  941. getFeeCenterCorpIds({
  942. billId: this.id,
  943. dc: this.groupCode == '应收' ? 'D' : 'C',
  944. type: this.businessValue,
  945. }).then(res => {
  946. this.data = res.data.data;
  947. getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  948. this.url = res.data.data.records.length ? res.data.data.records[0].url : null;
  949. })
  950. this.selectionClear();
  951. }).finally(() => {
  952. this.loading = false;
  953. })
  954. }
  955. },
  956. //自定义列保存
  957. async saveColumnTwo(ref, option, optionBack, code) {
  958. /**
  959. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  960. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  961. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  962. */
  963. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  964. if (inSave) {
  965. this.$message.success("保存成功");
  966. //关闭窗口
  967. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  968. }
  969. },
  970. //自定义列重置
  971. async resetColumnTwo(ref, option, optionBack, code) {
  972. this[option] = this[optionBack];
  973. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  974. if (inSave) {
  975. this.$message.success("重置成功");
  976. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  977. }
  978. },
  979. // 更改表格颜色
  980. headerClassName(tab) {
  981. //颜色间隔
  982. let back = ""
  983. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  984. if (tab.columnIndex % 2 === 0) {
  985. back = "back-one"
  986. } else if (tab.columnIndex % 2 === 1) {
  987. back = "back-two"
  988. }
  989. }
  990. return back;
  991. },
  992. }
  993. };
  994. </script>
  995. <style lang="scss" scoped>
  996. ::v-deep#out-table .back-one {
  997. background: #ecf5ff !important;
  998. }
  999. ::v-deep#out-table .back-two {
  1000. background: #ecf5ff !important;
  1001. }
  1002. ::v-deep .el-input-group__append {
  1003. padding: 0 0px !important;
  1004. }
  1005. /deep/ .el-tree-node__content>.el-tree-node__expand-icon {
  1006. visibility: hidden;
  1007. }
  1008. /deep/ .el-col-md-8 {
  1009. width: 24.33333%;
  1010. }
  1011. </style>