DocumentCenter.vue 42 KB

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