DocumentCenter.vue 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022
  1. <template>
  2. <div>
  3. <el-row>
  4. <el-col :span="5">
  5. <el-scrollbar>
  6. <basic-container>
  7. <avue-tree :option="treeOption" :data="reportTypeData" @node-click="nodeClick">
  8. </avue-tree>
  9. </basic-container>
  10. </el-scrollbar>
  11. </el-col>
  12. <el-col :span="19">
  13. <basic-container>
  14. <avue-crud :option="documentOption" :table-loading="loading" :data="documentData"
  15. :page.sync="documentPage" :search.sync="documentSearch" id="out-table"
  16. :header-cell-class-name="headerClassName" :before-open="beforeOpen" ref="documentCrud"
  17. @search-change="searchChange" @search-reset="searchReset" @refresh-change="refreshChange"
  18. @on-load="reportslogListfun"
  19. @resetColumn="resetColumnTwo('documentCrud', 'documentOption', 'documentOptionBack', 312.1)"
  20. @saveColumn="saveColumnTwo('documentCrud', 'documentOption', 'documentOptionBack', 312.1)">
  21. <template slot="menuLeft">
  22. <el-button type="primary" size="small" icon="el-icon-plus" :disabled="disabled"
  23. @click="addbtnfun()">新增
  24. </el-button>
  25. </template>
  26. <template slot-scope="scope" slot="menu">
  27. <el-button type="text" size="small" :disabled="disabled"
  28. @click="printEditing(scope.row)">编辑</el-button>
  29. <el-button type="text" size="small" :disabled="disabled" @click="printDelete(scope.row)">
  30. <span v-if="disabled">删除</span>
  31. <span v-else style="color: red">删除</span>
  32. </el-button>
  33. <el-button type="text" size="small" @click="dialogPreviewfun(scope.row)">打印预览</el-button>
  34. </template>
  35. </avue-crud>
  36. </basic-container>
  37. </el-col>
  38. </el-row>
  39. <!--添加编辑弹窗-->
  40. <el-dialog :title="businesstypeData.label" :close-on-click-modal="false" :visible.sync="documentVisible"
  41. append-to-body width="60%" :before-close="corpTypeClose">
  42. <Dispatch-Notice v-if="businesstypeData.reportsType == 'PCTZD'"
  43. :documentForm="documentForm"></Dispatch-Notice>
  44. <Purchase-Notice v-else-if="businesstypeData.reportsType == 'RHTZ'"
  45. :documentForm="documentForm"></Purchase-Notice>
  46. <BillofLadingDetails
  47. v-else-if="businesstypeData.reportsType == 'TDXQ' || businesstypeData.reportsType == 'DCWTS'"
  48. :documentForm="documentForm"></BillofLadingDetails>
  49. <BillofLadingDetailsM v-else-if="businesstypeData.reportsType == 'MBL BOOKING SHEET'"
  50. :documentForm="documentForm"></BillofLadingDetailsM>
  51. <BillofLadingDetailsJMS v-else-if="businesstypeData.reportsType == 'JMS-BILL'"
  52. :documentForm="documentForm"></BillofLadingDetailsJMS>
  53. <BillofLadingDetailsCTO v-else-if="businesstypeData.reportsType == 'CTO'"
  54. :documentForm="documentForm"></BillofLadingDetailsCTO>
  55. <FreightNote v-else-if="businesstypeData.reportsType == 'FREIGHT NOTE'"
  56. :documentForm="documentForm"></FreightNote>
  57. <span slot="footer" class="dialog-footer">
  58. <!--<el-button type="success" @click="documentSubmit(true)" >保存并打印</el-button>-->
  59. <el-button v-if="addShow" type="success" :disabled="!documentForm.id"
  60. @click="dialogPreviewfun(editData)">打印</el-button>
  61. <el-button @click="printingCanceling">取 消</el-button>
  62. <el-button type="primary" @click="documentSubmit(false)">保 存</el-button>
  63. </span>
  64. </el-dialog>
  65. <!--费用打印-->
  66. <reportContainer ref="reportContainer"></reportContainer>
  67. <!--打印预览弹窗-->
  68. <el-dialog append-to-body title="预览报表" class="el-dialogDeep" :visible.sync="previewDialog" width="60%"
  69. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag
  70. :before-close="corpTypeClose">
  71. <avue-crud :option="PreviewOption" :table-loading="loading" :data="PreviewData" :page.sync="PreviewPage"
  72. :search.sync="PreviewQuery" ref="crud" id="out-table" :header-cell-class-name="headerClassName"
  73. @resetColumn="resetColumnTwo('crud', 'PreviewOption', 'PreviewOptionBack', 312.3)"
  74. @saveColumn="saveColumnTwo('crud', 'PreviewOption', 'PreviewOptionBack', 312.3)"
  75. @search-change="PreviewSearchChange" @search-reset="PreviewSearchReset"
  76. @current-change="PreviewCurrentChange" @size-change="PreviewSizeChange"
  77. @refresh-change="PreviewRefreshChange">
  78. <template slot-scope="scope" slot="menu">
  79. <el-link type="primary" :disabled="scope.row.status == 1"
  80. @click="handleReportPreview(scope.row.url, documentForm)">预览报表</el-link>
  81. </template>
  82. </avue-crud>
  83. </el-dialog>
  84. </div>
  85. </template>
  86. <script>
  87. import {
  88. getList as reportsList,
  89. reportsGetReportData,
  90. reportsDetail,
  91. reportsRemove,
  92. getList
  93. } from "@/api/iosBasicData/reports";
  94. import { reportslogList, reportslogSubmit } from "@/api/iosBasicData/bills";
  95. import { bbusinesstypeList } from "@/api/iosBasicData/bbusinesstype";
  96. import bbusinesstype from "@/views/iosBasicData/bbusinesstype/index.vue";
  97. import reportformsList from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reportformsList.vue";
  98. import DispatchNotice from '@/views/iosBasicData/SeafreightExportF/bills/assembly/reportformsFrame/DispatchNotice.vue'
  99. import PurchaseNotice from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reportformsFrame/PurchaseNotice.vue";
  100. import reportContainer from "@/views/iosBasicData/report-container/report-container.vue";
  101. import BillofLadingDetails
  102. from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reportformsFrame/BillofLadingDetails.vue";
  103. import BillofLadingDetailsM
  104. from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reportformsFrame/BillofLadingDetailsM.vue";
  105. import BillofLadingDetailsJMS
  106. from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reportformsFrame/BillofLadingDetailsJMS.vue";
  107. import BillofLadingDetailsCTO
  108. from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reportformsFrame/BillofLadingDetailsCTO.vue";
  109. import FreightNote
  110. from "@/views/iosBasicData/SeafreightExportF/bills/assembly/reportformsFrame/FreightNote.vue";
  111. import businessReports from "@/views/iosBasicData/SeafreightExportF/bills/assembly/businessReports.vue";
  112. import losaudit from "@/views/wel/components/losAssembly/losaudit.vue";
  113. import { dateFormat } from "@/util/date";
  114. import { isProcurement } from "@/api/basicData/configuration";
  115. export default {
  116. components: {
  117. businessReports,
  118. DispatchNotice,
  119. PurchaseNotice,
  120. BillofLadingDetails,
  121. BillofLadingDetailsM,
  122. BillofLadingDetailsJMS,
  123. BillofLadingDetailsCTO,
  124. FreightNote,
  125. reportContainer,
  126. reportformsList,
  127. bbusinesstype,
  128. },
  129. data() {
  130. return {
  131. textareaNumber: 5,
  132. previewDialog: false, // 打印预览弹窗
  133. PreviewOption: {}, // 打印预览弹窗的配置项
  134. PreviewOptionBack: {
  135. height: 'auto',
  136. calcHeight: 30,
  137. tip: false,
  138. searchShow: true,
  139. searchMenuSpan: 6,
  140. border: true,
  141. index: true,
  142. selection: true,
  143. dialogClickModal: false,
  144. menuWidth: 100,
  145. addBtn: false,
  146. viewBtn: false,
  147. delBtn: false,
  148. editBtn: false,
  149. column: [
  150. {
  151. label: "组别",
  152. prop: "groupCode",
  153. rules: [{
  154. required: true,
  155. message: "请输入组别",
  156. trigger: "blur"
  157. }]
  158. },
  159. {
  160. label: "报表编码",
  161. prop: "code",
  162. rules: [{
  163. required: true,
  164. message: "请输入报表编码",
  165. trigger: "blur"
  166. }]
  167. },
  168. {
  169. label: "中文名称",
  170. prop: "cnName",
  171. rules: [{
  172. required: true,
  173. message: "请输入中文名称",
  174. trigger: "blur"
  175. }]
  176. },
  177. {
  178. label: "英文名称",
  179. prop: "enName"
  180. },
  181. {
  182. label: "报表格式",
  183. prop: "content",
  184. rules: [{
  185. required: true,
  186. message: "请输入报表格式",
  187. trigger: "blur"
  188. }]
  189. },
  190. {
  191. label: "备注",
  192. prop: "remarks"
  193. },
  194. ]
  195. },
  196. PreviewData: [], // 打印预览弹窗获取的数据
  197. PreviewQuery: {}, // 搜索项
  198. // 打印预览弹窗分页数据
  199. PreviewPage: {
  200. pageSize: 10,
  201. currentPage: 1,
  202. total: 0
  203. },
  204. documentVisible: false, // 单证添加编辑弹窗
  205. editData: {}, // 编辑弹窗的数据
  206. documentForm: {}, // 添加编辑弹窗的数据
  207. documenturl: '', // 报表的url 暂存
  208. // 左侧配置项
  209. treeOption: {
  210. nodeKey: "id",
  211. // lazy: true,
  212. addBtn: false,
  213. menu: false,
  214. size: "small",
  215. props: {
  216. labelText: "标题",
  217. label: "label",
  218. value: "value",
  219. children: "children"
  220. }
  221. },
  222. reportTypeData: [
  223. {
  224. label: '入货通知',
  225. cnName: '入货通知',
  226. classifyCode: '单证',
  227. groupCode: '入货通知',
  228. reportsType: 'RHTZ',
  229. businessType: 'HYCK',
  230. params: "",
  231. },
  232. {
  233. label: '派车通知单',
  234. cnName: '派车通知单',
  235. classifyCode: '单证',
  236. groupCode: '派车通知单',
  237. reportsType: 'PCTZD',
  238. businessType: 'HYCK',
  239. params: "",
  240. },
  241. {
  242. label: 'HBL BOOKING SHEET',
  243. cnName: '提单详情(H)',
  244. classifyCode: '单证',
  245. groupCode: '提单详情(H)',
  246. reportsType: 'TDXQ',
  247. businessType: 'HYCK',
  248. params: "",
  249. },
  250. {
  251. label: 'MBL BOOKING SHEET',
  252. cnName: '提单详情(M)',
  253. classifyCode: '单证',
  254. groupCode: '提单详情(M)',
  255. reportsType: 'MBL BOOKING SHEET',
  256. businessType: 'HYCK',
  257. params: "",
  258. },
  259. {
  260. label: 'JMS 提单',
  261. cnName: 'JMS 提单',
  262. classifyCode: '单证',
  263. groupCode: 'JMS提单',
  264. reportsType: 'JMS-BILL',
  265. businessType: 'HYCK',
  266. params: {
  267. // 件重尺是否添加箱型箱量
  268. NumOfContainersOrPackagesAddPreCntrQty: true,
  269. // 货描首行添加字符
  270. commodityDescrFirstLine: "SHIPPER'S LOAD,COUNT AND SEAL",
  271. // 唛头是否添加箱封号
  272. marksAddCntrNoSealNoList: true,
  273. // 唛头是否添加箱号件重尺
  274. marksAddCntrPGVList: true,
  275. },
  276. },
  277. {
  278. label: 'CTO',
  279. cnName: 'CTO',
  280. classifyCode: '单证',
  281. groupCode: 'CTO',
  282. reportsType: 'CTO',
  283. businessType: 'HYCK',
  284. params: {
  285. // 件重尺是否添加箱型箱量
  286. NumOfContainersOrPackagesAddPreCntrQty: true,
  287. // 货描首行添加字符
  288. commodityDescrFirstLine: "SHIPPER'S LOAD,COUNT AND SEAL",
  289. // 唛头是否添加箱封号
  290. marksAddCntrNoSealNoList: true,
  291. // 唛头是否添加箱号件重尺
  292. marksAddCntrPGVList: true,
  293. },
  294. },
  295. {
  296. label: '订舱委托书',
  297. cnName: '订舱委托书',
  298. classifyCode: '单证',
  299. groupCode: '提单详情',
  300. reportsType: 'DCWTS',
  301. businessType: 'HYCK',
  302. params: "",
  303. },
  304. {
  305. label: '运费证明',
  306. cnName: 'FREIGHT NOTE',
  307. classifyCode: '单证',
  308. groupCode: 'FREIGHT NOTE',
  309. reportsType: 'FREIGHT NOTE',
  310. businessType: 'HYCK',
  311. params: "",
  312. },
  313. ], // 左侧获取的数据
  314. documentOption: {},
  315. documentOptionBack: {
  316. dialogDrag: true,
  317. height: 'auto',
  318. calcHeight: 30,
  319. tip: false,
  320. searchShow: true,
  321. searchMenuSpan: 6,
  322. border: true,
  323. index: true,
  324. selection: true,
  325. dialogClickModal: false,
  326. addBtn: false,
  327. viewBtn: false,
  328. delBtn: false,
  329. editBtn: false,
  330. menuWidth: '160',
  331. column: [
  332. {
  333. label: "报表编码",
  334. prop: "reportsCode",
  335. overHidden: true,
  336. },
  337. {
  338. label: "单据类型",
  339. prop: "groupCode",
  340. overHidden: true,
  341. },
  342. {
  343. label: "创建人",
  344. prop: "createUserName",
  345. overHidden: true,
  346. },
  347. {
  348. label: "创建时间",
  349. prop: "createTime",
  350. overHidden: true,
  351. },
  352. ]
  353. },
  354. documentSearch: {},
  355. documentPage: {
  356. pageSize: 10,
  357. currentPage: 1,
  358. total: 0,
  359. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  360. },
  361. query: {},
  362. documentData: [],
  363. loading: false,
  364. businesstypeData: {}, // 左侧选择的数据
  365. addShow: false,
  366. }
  367. },
  368. props: {
  369. assemblyForm: {
  370. type: Object,
  371. default: {}
  372. },
  373. detailData: {
  374. type: Object,
  375. default: {}
  376. },
  377. disabled: {
  378. type: Boolean,
  379. default: false,
  380. },
  381. },
  382. async created() {
  383. this.documentOption = await this.getColumnData(this.getColumnName(312.1), this.documentOptionBack);
  384. this.PreviewOption = await this.getColumnData(this.getColumnName(312.3), this.PreviewOptionBack);
  385. isProcurement({ "param": "textarea.number" }).then(res => {
  386. if (res.data.data) {
  387. this.textareaNumber = res.data.data
  388. }
  389. })
  390. // this.reportsListfun()
  391. },
  392. methods: {
  393. // 打印预览按钮
  394. async dialogPreviewfun(row) {
  395. this.editData = row
  396. if (row.printContent) {
  397. this.documentForm = JSON.parse(row.printContent).data
  398. }
  399. this.PreviewPage.currentPage = 1;
  400. const data = await this.PreviewOnLoad(this.PreviewPage, {
  401. businessType: 'HYCK',
  402. classifyCode: '单证',
  403. groupCode: row.groupCode == '提单详情(H)' ? '提单详情' : row.groupCode
  404. });
  405. this.$nextTick(() => {
  406. if (data.length == 1) {
  407. this.handleReportPreview(data[0].url, this.documentForm)
  408. } else {
  409. this.previewDialog = true
  410. this.documentVisible = false
  411. }
  412. })
  413. // let obj = {businessType:'HYCK',classifyCode:'单证',groupCode:row.groupCode}
  414. // let documentaa = null // 暂存url数据
  415. // reportsList(1,20,{
  416. // businessType:'HYCK',
  417. // classifyCode:'单证',
  418. // groupCode:row.groupCode,
  419. // }).then(resz=>{
  420. // const h = this.$createElement;
  421. // const that = this
  422. // this.$msgbox({
  423. // title: "请选择数据",
  424. // message: h('el-select',
  425. // {
  426. // props: {
  427. // value: documentaa,
  428. // filterable: true,
  429. // size:'small'
  430. // },
  431. // ref: 'selectView',
  432. // on: {
  433. // change:e => {
  434. // documentaa = e
  435. // that.$refs.selectView.value = e // select下拉框值改变,回显到页面上
  436. // },
  437. // },
  438. // },
  439. // [
  440. // resz.data.data.records.map(it => {
  441. // return h('el-option', {
  442. // props: {
  443. // label: it.cnName,
  444. // key: it.id,
  445. // value: it.url,
  446. // },
  447. // });
  448. // })
  449. // ]
  450. // ),
  451. // showCancelButton: true,
  452. // closeOnClickModal: false,
  453. // confirmButtonText: '确定',
  454. // cancelButtonText: '取消',
  455. // }).then( _ => {
  456. // // 成功操作。。。。
  457. // this.documenturl = documentaa
  458. // this.handleReportPreview(this.documenturl,JSON.parse(row.printContent).data)
  459. // }).catch(msg => {
  460. // // 取消操作。。。。
  461. // });
  462. // })
  463. },
  464. PreviewSearchReset() {
  465. this.PreviewQuery = {};
  466. this.PreviewOnLoad(this.PreviewPage, {
  467. businessType: 'HYCK',
  468. classifyCode: '单证',
  469. groupCode: this.editData.groupCode
  470. });
  471. },
  472. PreviewSearchChange(params, done) {
  473. this.PreviewQuery = params;
  474. this.PreviewPage.currentPage = 1;
  475. this.PreviewOnLoad(this.PreviewPage, params);
  476. done();
  477. },
  478. PreviewCurrentChange(currentPage) {
  479. this.PreviewPage.currentPage = currentPage;
  480. },
  481. PreviewSizeChange(pageSize) {
  482. this.PreviewPage.pageSize = pageSize;
  483. },
  484. PreviewRefreshChange() {
  485. this.PreviewOnLoad(this.PreviewPage, {
  486. businessType: 'HYCK',
  487. classifyCode: '单证',
  488. groupCode: this.editData.groupCode
  489. });
  490. },
  491. // 打印预览弹窗数据
  492. async PreviewOnLoad(page, params = {}) {
  493. const res = await reportsList(page.currentPage, page.pageSize, Object.assign(params, this.PreviewQuery))
  494. const data = res.data.data;
  495. this.PreviewPage.total = data.total;
  496. this.PreviewData = data.records;
  497. return data.records
  498. },
  499. // 新建单证按钮
  500. addbtnfun() {
  501. console.log("this.businesstypeData", this.businesstypeData)
  502. if (!this.assemblyForm.id) {
  503. this.$message.warning("请先保存数据");
  504. return;
  505. }
  506. if (!this.businesstypeData.cnName) {
  507. this.$message.warning("请先选择报表类型");
  508. return
  509. }
  510. this.addShow = false
  511. reportsGetReportData({
  512. billId: this.assemblyForm.id,
  513. reportCode: this.businesstypeData.classifyCode,
  514. groupCode: this.businesstypeData.groupCode,
  515. reportsType: this.businesstypeData.reportsType,
  516. type: 'HYCK',
  517. params: this.businesstypeData.params,
  518. }).then(res => {
  519. this.editData.groupCode = this.businesstypeData.groupCode
  520. this.documentForm = res.data.data.data
  521. // 联系人
  522. this.documentForm.corpAttnName = this.documentForm.corpAttnName + '' + this.documentForm.corpAttnTel
  523. // this.documentForm.prepaidAt = this.documentForm.mpaymode=='FREIGHT PREPAID'?this.documentForm.mpayplace:null
  524. // this.documentForm.payableAt = this.documentForm.mpaymode=='FREIGHT COLLECT'?this.documentForm.mpayplace:null
  525. // this.documenturl = this.businesstypeData.url;
  526. // 打开报表选择框
  527. this.documentVisible = true
  528. })
  529. },
  530. // 编辑
  531. printEditing(row) {
  532. if (!this.businesstypeData.cnName) {
  533. this.$message.warning("请先选择报表类型");
  534. return
  535. }
  536. // this.businesstypeData.code = row.reportsCode
  537. this.addShow = true
  538. this.editData = row
  539. this.documentForm = JSON.parse(row.printContent).data
  540. // this.documenturl = JSON.parse(row.printContent).url;
  541. this.documentVisible = true
  542. },
  543. // 删除
  544. printDelete(row) {
  545. this.$confirm("确定将选择数据删除?", {
  546. confirmButtonText: "确定",
  547. cancelButtonText: "取消",
  548. type: "warning"
  549. }).then(() => {
  550. reportsRemove(row.id).then(res => {
  551. this.$message.success('操作成功')
  552. this.reportslogListfun(this.documentPage, this.query);
  553. })
  554. })
  555. },
  556. // 单证弹窗的确认按钮
  557. documentSubmit(type) {
  558. let obj = {}
  559. if (this.editData.id) {
  560. obj = this.editData
  561. } else {
  562. obj.remarks = this.assemblyForm.remarks
  563. obj.businessType = this.assemblyForm.businessType
  564. obj.billId = this.assemblyForm.id
  565. obj.billNo = this.assemblyForm.billNo
  566. obj.mblno = this.assemblyForm.mblno
  567. obj.hblno = this.assemblyForm.hblno
  568. obj.reportsCode = this.businesstypeData.reportsType
  569. obj.groupCode = this.businesstypeData.groupCode
  570. obj.reportsType = this.businesstypeData.reportsType
  571. }
  572. console.log(this.documentForm)
  573. obj.printContent = JSON.stringify({
  574. data: {
  575. ...this.documentForm,
  576. to: this.documentForm.corpCnName,
  577. attn: this.documentForm.corpAttnName,
  578. fm: this.documentForm.createUserName,
  579. fax: this.documentForm.fax,
  580. cc: this.documentForm.cc,
  581. email: this.documentForm.ematl,
  582. department: this.documentForm.corpAttnName,
  583. operate: this.documentForm.operatorName,
  584. mobilePhone: this.documentForm.mobilePhone,
  585. remarks: this.documentForm.remarks,
  586. contacts: this.documentForm.cyContacts,
  587. deliverylocation: this.documentForm.cyCnName,
  588. shippingAgency: this.documentForm.bookingAgentCnName,
  589. Telephone: this.documentForm.cyTel,
  590. datetime: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss')
  591. }
  592. // url:this.documenturl
  593. })
  594. console.log(obj)
  595. // 保存
  596. reportslogSubmit(obj).then(res => {
  597. if (type) {
  598. let documentaa = null // 暂存url数据
  599. reportsList(1, 20, {
  600. businessType: 'HYCK',
  601. classifyCode: '单证',
  602. groupCode: res.data.data.groupCode,
  603. }).then(resz => {
  604. const h = this.$createElement;
  605. const that = this
  606. this.$msgbox({
  607. title: "请选择数据",
  608. message: h('el-select',
  609. {
  610. props: {
  611. value: documentaa,
  612. filterable: true,
  613. size: 'small'
  614. },
  615. ref: 'selectView',
  616. on: {
  617. change: e => {
  618. documentaa = e
  619. that.$refs.selectView.value = e // select下拉框值改变,回显到页面上
  620. },
  621. },
  622. },
  623. [
  624. resz.data.data.records.map(it => {
  625. return h('el-option', {
  626. props: {
  627. label: it.cnName,
  628. key: it.id,
  629. value: it.url,
  630. },
  631. });
  632. })
  633. ]
  634. ),
  635. showCancelButton: true,
  636. closeOnClickModal: false,
  637. confirmButtonText: '确定',
  638. cancelButtonText: '取消',
  639. }).then(_ => {
  640. // 成功操作。。。。
  641. this.documenturl = documentaa
  642. this.handleReportPreview(this.documenturl, this.documentForm)
  643. this.reportslogListfun(this.documentPage, { ...this.query, reportsCode: res.data.data.reportsCode });
  644. this.editData = {}
  645. this.documentForm = {}
  646. this.documenturl = {}
  647. this.documentVisible = false
  648. }).catch(msg => {
  649. // 取消操作。。。。
  650. });
  651. })
  652. } else {
  653. this.$message.success('操作成功')
  654. this.reportslogListfun(this.documentPage, { ...this.query, reportsCode: res.data.data.reportsCode });
  655. this.editData = {}
  656. this.documentForm = {}
  657. this.documenturl = {}
  658. this.documentVisible = false
  659. }
  660. })
  661. },
  662. // 打印取消
  663. printingCanceling() {
  664. this.editData = {}
  665. this.documentForm = {}
  666. this.documenturl = {}
  667. this.documentVisible = false
  668. },
  669. // 左侧筛选
  670. nodeClick(data) {
  671. this.editData = {}
  672. this.documentForm = {}
  673. this.businesstypeData = {}
  674. this.businesstypeData = data
  675. this.reportslogListfun(this.documentPage, { reportsType: data.reportsType });
  676. },
  677. // 左侧数据获取
  678. // reportsListfun(){
  679. // reportsList(1,20,{
  680. // businessType:'HYCK',
  681. // classifyCode:'单证',
  682. // groupCode:'派车通知单,入货通知,提单详情',
  683. // code:'BZRHTZ,TDXQ,PCTZD,'
  684. // }).then(res=>{
  685. // this.reportTypeData = res.data.data.records
  686. // })
  687. // },
  688. // 类别弹窗关闭
  689. corpTypeClose(done) {
  690. console.log(1111)
  691. this.editData = {}
  692. this.documentForm = {}
  693. this.businesstypeData = {}
  694. done();
  695. },
  696. // 点击搜索触发
  697. searchChange(params, done) {
  698. this.query = params;
  699. this.documentPage.currentPage = 1;
  700. this.reportslogListfun(this.documentPage, params);
  701. done();
  702. },
  703. // 清空搜索回调方法
  704. searchReset() {
  705. this.query = {};
  706. this.reportslogListfun(this.documentPage);
  707. },
  708. // 点击刷新按钮
  709. refreshChange() {
  710. this.reportslogListfun(this.documentPage, { ...this.query, reportsCode: this.businesstypeData.content });
  711. },
  712. // 打开前的回调
  713. beforeOpen(done, type) {
  714. // 编辑和查看
  715. if (["edit", "view"].includes(type)) {
  716. }
  717. },
  718. // 单证中心数据获取
  719. reportslogListfun(documentPage, params = {}) {
  720. if (!this.assemblyForm.id) {
  721. return
  722. }
  723. this.loading = true;
  724. reportslogList(documentPage.currentPage, documentPage.pageSize, {
  725. ...Object.assign(params, this.query),
  726. billId: this.assemblyForm.id
  727. }).then(res => {
  728. const data = res.data.data;
  729. this.documentPage.total = data.total;
  730. this.documentData = data.records;
  731. this.loading = false;
  732. })
  733. },
  734. // 预览报表
  735. handleReportPreview(url, data) {
  736. console.log(url, 1670)
  737. console.log(data, 1671)
  738. // 处理时间
  739. data.end = data.end ? data.end.slice(0, 10) : ''
  740. data.goodsTime = data.goodsTime ? data.goodsTime.slice(0, 10) : ''
  741. data.clearanceTime = data.clearanceTime ? data.clearanceTime.slice(0, 10) : ''
  742. data.vgmDeadline = data.vgmDeadline ? data.vgmDeadline.slice(0, 10) : ''
  743. Stimulsoft.Base.StiLicense.key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHn0s4gy0Fr5YoUZ9V00Y0igCSFQzwEqYBh/N77k4f0fWXTHW5rqeBNLkaurJDenJ9o97TyqHs9HfvINK18Uwzsc/bG01Rq+x3H3Rf+g7AY92gvWmp7VA2Uxa30Q97f61siWz2dE5kdBVcCnSFzC6awE74JzDcJMj8OuxplqB1CYcpoPcOjKy1PiATlC3UsBaLEXsok1xxtRMQ283r282tkh8XQitsxtTczAJBxijuJNfziYhci2jResWXK51ygOOEbVAxmpflujkJ8oEVHkOA/CjX6bGx05pNZ6oSIu9H8deF94MyqIwcdeirCe60GbIQByQtLimfxbIZnO35X3fs/94av0ODfELqrQEpLrpU6FNeHttvlMc5UVrT4K+8lPbqR8Hq0PFWmFrbVIYSi7tAVFMMe2D1C59NWyLu3AkrD3No7YhLVh7LV0Tttr/8FrcZ8xirBPcMZCIGrRIesrHxOsZH2V8t/t0GXCnLLAWX+TNvdNXkB8cF2y9ZXf1enI064yE5dwMs2fQ0yOUG/xornE'
  744. // Stimulsoft.Base.StiLicense.Key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHkcgIvwL0jnpsDqRpWg5FI5kt2G7A0tYIcUygBh1sPs7plofUOqPB1a4HBIXJB621mau2oiAIj+ysU7gKUXfjn/D5BocmduNB+ZMiDGPxFrAp3PoD0nYNkkWh8r7gBZ1v/JZSXGE3bQDrCQCNSy6mgby+iFAMV8/PuZ1z77U+Xz3fkpbm6MYQXYp3cQooLGLUti7k1TFWrnawT0iEEDJ2iRcU9wLqn2g9UiWesEZtKwI/UmEI2T7nv5NbgV+CHguu6QU4WWzFpIgW+3LUnKCT/vCDY+ymzgycw9A9+HFSzARiPzgOaAuQYrFDpzhXV+ZeX31AxWlnzjDWqpfluygSNPtGul5gyNt2CEoJD1Yom0VN9fvRonYsMsimkFFx2AwyVpPcs+JfVBtpPbTcZscnzUdmiIvxv8Gcin6sNSibM6in/uUKFt3bVgW/XeMYa7MLGF53kvBSwi78poUDigA2n12SmghLR0AHxyEDIgZGOTbNI33GWu7ZsPBeUdGu55R8w='
  745. Stimulsoft.Base.Localization.StiLocalization.addLocalizationFile('/reports/stimulsoft/Localization/zh-CHS.xml', true, 'zh-CHS')
  746. Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile('/reports/stimulsoft/Localization/zh-CHS.xml')
  747. // 工具栏
  748. var options = new Stimulsoft.Viewer.StiViewerOptions()
  749. options.height = '100%'
  750. options.appearance.scrollbarsMode = true // 滚动条模式
  751. options.toolbar.showDesignButton = false // 显示设计按钮
  752. options.toolbar.showAboutButton = false // 显示关于按钮
  753. options.toolbar.showResourcesButton = false // 显示资源按钮
  754. options.toolbar.showFullScreenButton = false // 显示全屏按钮
  755. options.toolbar.showOpenButton = false // 显示打开按钮
  756. options.appearance.showTooltips = false // 显示工具提示
  757. options.appearance.showDialogsHelp = false // 显示对话框帮助
  758. options.exports.showExportToDocument = false // 显示导出到文档
  759. options.toolbar.showParametersButton = true // 显示参数按钮
  760. options.appearance.bookmarksPrint = true // 书签打印
  761. // options.toolbar.showPrintButton = false // 打印按钮是否显示 下面直接自定义控制打印弹窗是否开启
  762. // printDestination 参数:用于指定报表打印的目标位置,可以是打印机、PDF 文件或者直接打印到浏览器等。
  763. // Stimulsoft.Viewer.StiPrintDestination.Direct:表示直接打印到打印机,即将报表内容直接发送至打印机进行打印。
  764. // 通过设置不同的 printDestination 参数,你可以控制报表打印的行为,例如是直接打印到打印机,还是生成 PDF 文件,或者直接在浏览器中预览打印内容等。
  765. options.toolbar.printDestination = Stimulsoft.Viewer.StiPrintDestination.Direct
  766. // htmlRenderMode html渲染模式
  767. options.appearance.htmlRenderMode = Stimulsoft.Report.Export.StiHtmlExportMode.Table
  768. // 是创建一个 Stimulsoft 报表查看器的实例的代码
  769. let viewer = new Stimulsoft.Viewer.StiViewer(options, 'StiViewer', false)
  770. // 报表
  771. console.log("创建一个报表实例");
  772. console.log()
  773. let report = new window.Stimulsoft.Report.StiReport();
  774. // 加载文件
  775. console.log("从url加载报表");
  776. // report.loadFile("/reports/stimulsoft/demos/SimpleList.mrt");
  777. report.load(url)
  778. data.pageOne = 'Page : 1 of 1'
  779. // 处理超长数据
  780. if (data.hshipperDetails) {
  781. let arrDeteil = []
  782. arrDeteil = data.hshipperDetails.split('\n')
  783. if (arrDeteil.length > this.textareaNumber) {
  784. data.hshipperDetails = arrDeteil.slice(0, this.textareaNumber).join('\n') + '*'
  785. data.commodityDescr += "\n*" + arrDeteil.slice(this.textareaNumber, arrDeteil.length).join('\n')
  786. } else {
  787. data.hshipperDetails = data.hshipperDetails
  788. }
  789. }
  790. if (data.hconsigneeDetails) {
  791. let arrDeteil = []
  792. arrDeteil = data.hconsigneeDetails.split('\n')
  793. if (arrDeteil.length > this.textareaNumber) {
  794. data.hconsigneeDetails = arrDeteil.slice(0, this.textareaNumber).join('\n') + '**'
  795. data.commodityDescr += "\n**" + arrDeteil.slice(this.textareaNumber, arrDeteil.length).join('\n')
  796. } else {
  797. data.hconsigneeDetails = data.hconsigneeDetails
  798. }
  799. }
  800. if (data.hnotifyDetails) {
  801. let arrDeteil = []
  802. arrDeteil = data.hnotifyDetails.split('\n')
  803. if (arrDeteil.length > this.textareaNumber) {
  804. data.hnotifyDetails = arrDeteil.slice(0, this.textareaNumber).join('\n') + '***'
  805. data.commodityDescr += "\n***" + arrDeteil.slice(this.textareaNumber, arrDeteil.length).join('\n')
  806. } else {
  807. data.hnotifyDetails = data.hnotifyDetails
  808. }
  809. }
  810. // 处理箱号
  811. if (this.isPrintTheBoxNumber) {
  812. data.commodityDescr += '\n.\n.\n'
  813. }
  814. // PLACE & DATE OF ISSUE
  815. data.placeAndDateOfIssue = ''
  816. if (data.issueAt) {
  817. data.placeAndDateOfIssue += data.issueAt
  818. }
  819. if (data.issueDate) {
  820. let date = new Date(data.issueDate.replace(/-/g, '/'));
  821. let yyyy = date.getFullYear();
  822. let mmmm = date.toDateString().split(" ")[1]
  823. let dd = date.getDate()
  824. data.placeAndDateOfIssue += ', ' + dd + '-' + mmmm + '-' + yyyy
  825. }
  826. // Total number of containers or packages received by the Carriers
  827. if (data.preContainersList) {
  828. let boxMap = new Map();
  829. for (let boxQuantity of data.preContainersList) {
  830. if (boxMap.get(boxQuantity.cntrTypeCode)) {
  831. let v = boxMap.get(boxQuantity.cntrTypeCode)
  832. boxMap.set(boxQuantity.cntrTypeCode, v + boxQuantity.quantity)
  833. } else {
  834. boxMap.set(boxQuantity.cntrTypeCode, boxQuantity.quantity)
  835. }
  836. }
  837. let boxs = ''
  838. boxMap.forEach(function (value, key, map) {
  839. boxs += value + 'x' + key + ', '
  840. })
  841. boxs = boxs.substring(0, boxs.length - 2)
  842. data.boxQuantity = boxs + ' CONTAINER(S) ONLY'
  843. }
  844. // Number of original B/Ls
  845. // if (data.numberOfObl) {
  846. // data.numberOfObl += ' (' + data.numberOfOblDigit + ')'
  847. // }
  848. if (data.commodityDescr) {
  849. var descriptionIndex2 = data.commodityDescr.indexOf('\n')
  850. for (let i = 0; i < 19; i++) {
  851. descriptionIndex2 = data.commodityDescr.indexOf('\n', descriptionIndex2 + 1);
  852. }
  853. if (descriptionIndex2 != -1) {
  854. data.pageOne = 'Page : 1 of 2'
  855. data.pageTwo = 'Page : 2 of 2'
  856. var extraLongText = data.commodityDescr.substring(descriptionIndex2 + 2, data.commodityDescr.length)
  857. // data.commodityDescr = data.commodityDescr.substring(0, descriptionIndex2)
  858. data.extraLongTips = '** TO BE CONTINUED ON ATTACHED LIST **'
  859. data.extraLongText = extraLongText
  860. }
  861. }
  862. // console.log(data.hshipperDetails, 'hshipperDetails2')
  863. // 创建一个 Stimulsoft 数据集(DataSet)的实例的代码
  864. var dataSet = new Stimulsoft.System.Data.DataSet(
  865. 'reportData'
  866. )
  867. dataSet.readJson(data) // 用于将 JSON 格式的数据加载到数据集中。data 是包含报表数据的 JSON 对象。
  868. // 这是一个方法调用,用于在报表中注册数据源。参数 'reportData' 是数据源的名称,
  869. // 第二个 'reportData' 是数据源的别名,dataSet 则是之前创建的数据集实例
  870. report.regData('reportData', 'reportData', dataSet)
  871. // 从模版和数据加载报表
  872. // loadReport(report, '', {})
  873. // 这是将报表对象指定给报表查看器的属性。viewer 是报表查看器的实例,而 report 是之前创建的报表对象。
  874. viewer.report = report;
  875. this.$refs.reportContainer.showContainer(
  876. () => {
  877. setTimeout(() => {
  878. viewer.renderHtml('reportContainer')
  879. this.createViewerButtons(viewer)
  880. }, 50)
  881. },
  882. () => {
  883. },
  884. )
  885. console.log("加载成功完成!");
  886. },
  887. createViewerButtons(viewer) {
  888. viewer.jsObject.collections.images['myClose.png'] =
  889. 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAA0ElEQVQ4ja3TO05CQRQG4A8iOwAbtYWETndAaecK7NwCKmETtJZsSBNLobEz8ZFIJQ0UnOGSm3DnYviTybzO/895DQXGWGCVGQuMEqkRcwcfuMOLalziCaf4TIe9UG9nyMJmFRzNGoRK1BU4xxx9G7cfwostciGk+x8MqgySwDXe4tU53hVV+MNtTmAoX84JGv9NYgrHyR6DV8wUSW7hItZLm36ZVoVQxsFJLOMsPOrH/h7dQwR2cdxOTEn8DtUbPGc4V2H7Vb4Yqfedf/GYSGt8VUmxgyfuBAAAAABJRU5ErkJggg=='
  890. const closeBtn = viewer.jsObject.SmallButton(
  891. 'closeBtn',
  892. '关闭',
  893. 'myClose.png'
  894. )
  895. // 增加打印弹窗配置
  896. const printBtn = viewer.jsObject.SmallButton(
  897. 'printBtn',
  898. '打印报表',
  899. 'myClose.png'
  900. )
  901. // console.log(viewer.jsObject.print(),'1013')
  902. // 获取 关闭按钮的dom元素位置
  903. const toolbarTable = viewer.jsObject.controls.toolbar.firstChild.firstChild
  904. const buttonsTable = toolbarTable.rows[0].lastChild.lastChild
  905. const userButtonCell = buttonsTable.rows[0].insertCell(0)
  906. // 获取打印按钮的位置
  907. const buttonsTablePrint = toolbarTable.rows[0].childNodes[0].lastChild // 打印按钮
  908. const userButtonPrint = buttonsTablePrint.rows[0].childNodes[0] // 打印按钮dom位置
  909. userButtonPrint.addEventListener("click", (event) => {
  910. console.log("打印点击");
  911. // event.preventDefault()
  912. });
  913. userButtonPrint.addEventListener("mouseover", (event) => {
  914. console.log("移入打印按钮");
  915. console.log(event, 1035)
  916. });
  917. userButtonCell.className = 'stiJsViewerClearAllStyles'
  918. userButtonCell.appendChild(closeBtn) // 添加关闭节点
  919. // userButtonPrint.prepend(printBtn) // 在 printBtn 节点里最前面增加一个子级节点
  920. let that = this
  921. // 关闭按钮的监听点击
  922. closeBtn.action = function () {
  923. console.log(that.$refs.ReportContainer, '1022')
  924. if (that.$refs.reportContainer)
  925. that.$refs.reportContainer.hideContainer()
  926. }
  927. // // // 打印按钮监听
  928. // printBtn.action = (e)=>{
  929. // console.log('打印')
  930. // window.print()
  931. // }
  932. },
  933. //自定义列保存
  934. async saveColumnTwo(ref, option, optionBack, code) {
  935. /**
  936. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  937. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  938. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  939. */
  940. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  941. if (inSave) {
  942. this.$message.success("保存成功");
  943. //关闭窗口
  944. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  945. }
  946. },
  947. //自定义列重置
  948. async resetColumnTwo(ref, option, optionBack, code) {
  949. this[option] = this[optionBack];
  950. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  951. if (inSave) {
  952. this.$message.success("重置成功");
  953. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  954. }
  955. },
  956. // 更改表格颜色
  957. headerClassName(tab) {
  958. //颜色间隔
  959. let back = ""
  960. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  961. if (tab.columnIndex % 2 === 0) {
  962. back = "back-one"
  963. } else if (tab.columnIndex % 2 === 1) {
  964. back = "back-two"
  965. }
  966. }
  967. return back;
  968. },
  969. }
  970. }
  971. </script>
  972. <style scoped>
  973. ::v-deep#out-table .back-one {
  974. background: #ecf5ff !important;
  975. }
  976. ::v-deep#out-table .back-two {
  977. background: #ecf5ff !important;
  978. }
  979. </style>