reportsJc.vue 43 KB

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