index.vue 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067
  1. <template>
  2. <div>
  3. <el-row v-show="isShow">
  4. <el-col :span="5">
  5. <div class="box">
  6. <el-scrollbar>
  7. <basic-container>
  8. <avue-tree :option="treeOption" :data="customTypeData" @node-click="nodeClick">
  9. <template slot="addBtn">
  10. <el-tooltip class="item" effect="dark" content="新建分类" placement="top">
  11. <i class="el-icon-setting" style="font-size:18px;line-height: 30px;width: 20px;padding: 0 10px;"
  12. @click="corpTypeVisible = true"></i>
  13. </el-tooltip>
  14. </template>
  15. </avue-tree>
  16. </basic-container>
  17. </el-scrollbar>
  18. </div>
  19. </el-col>
  20. <el-col :span="19">
  21. <basic-container class="page-crad">
  22. <!-- :on-change="handleChange" -->
  23. <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :permission="permissionList"
  24. id="out-table" :header-cell-class-name="headerClassName" :search.sync="query" :before-open="beforeOpen"
  25. v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel"
  26. @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
  27. @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange"
  28. @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 304)"
  29. @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 304)" @on-load="onLoad">
  30. <template slot="cnName" slot-scope="scope">
  31. <div style="color: #1e9fff;cursor: pointer;" @click.stop="editOpen(scope.row)">
  32. {{scope.row.cnName}}
  33. </div>
  34. </template>
  35. <template slot="status" slot-scope="scope">
  36. <div v-for="(item,index) of ifInvoiceData" :key="index" v-if="scope.row.status == item.dictKey"
  37. class="statusClass" :style="'background:' + item.colour">{{item.dictValue}}</div>
  38. </template>
  39. <template slot="menuLeft">
  40. <el-button type="warning" size="small" icon="el-icon-printer" @click="excelBox = true">导入
  41. </el-button>
  42. <el-button type="success" size="small" @click="handleExport" icon="el-icon-printer">导出</el-button>
  43. <!--<el-button type="success" size="small" @click="handleReportDesigner" icon="el-icon-printer">设计报表</el-button>-->
  44. <!--<el-button type="success" size="small" @click="handleReportPreview" icon="el-icon-printer">预览报表</el-button>-->
  45. </template>
  46. <template slot-scope="{ row, index }" slot="menu">
  47. <el-button icon="el-icon-edit" type="text" size="small" @click.stop="editOpen(row)">
  48. 编辑
  49. </el-button>
  50. <el-button icon="el-icon-delete" type="text" size="small" @click.stop="rowDel(row, index)">
  51. 删除
  52. </el-button>
  53. <el-button icon="el-icon-turn-off" v-if="row.status == 1" type="text" style="color: #85e967" size="small"
  54. @click.stop="statusfun(row.id,0)">
  55. 启用
  56. </el-button>
  57. <el-button icon="el-icon-turn-off" v-if="row.status == 0" type="text" style="color: #e83c3a" size="small"
  58. @click.stop="statusfun(row.id,1)">
  59. 停用
  60. </el-button>
  61. </template>
  62. </avue-crud>
  63. </basic-container>
  64. </el-col>
  65. </el-row>
  66. <reportContainer ref="reportContainer"></reportContainer>
  67. <detailPage v-if="!isShow" ref="detail" @goBack="goBack" @copyOrder="copyOrder" :detailData="detailData"></detailPage>
  68. <!--类别弹窗-->
  69. <el-dialog title="类别" v-dialogdrag :visible.sync="corpTypeVisible" append-to-body width="60%" :before-close="corpTypeClose">
  70. <div>
  71. <bcorpstypedefine></bcorpstypedefine>
  72. </div>
  73. <span slot="footer" class="dialog-footer">
  74. <el-button @click="corpTypeVisible = false">取 消</el-button>
  75. <el-button type="primary" @click="corpTypeVisible = false">确 定</el-button>
  76. </span>
  77. </el-dialog>
  78. <el-dialog title="导入往来单位" append-to-body :visible.sync="excelBox" width="555px" :close-on-click-modal="false"
  79. v-dialog-drag>
  80. <avue-form :option="excelOption" v-model="excelForm" :table-loading="excelLoading" :upload-before="uploadBefore"
  81. :upload-after="onSuccess">
  82. <template slot="excelTemplate">
  83. <el-button type="primary" @click="handleGet">
  84. 点击下载<i class="el-icon-download el-icon--right"></i>
  85. </el-button>
  86. </template>
  87. </avue-form>
  88. <p style="text-align: center;color: #DC0505">
  89. 温馨提示 第一次导入时请先下载模板
  90. </p>
  91. </el-dialog>
  92. </div>
  93. </template>
  94. <script>
  95. import { getToken } from "@/util/auth";
  96. import detailPage from "./detailsPage";
  97. import { BcorpsList, getBcorpsDetail, addBcorps, updateBcorps, removeBcorps, downLoadBcorpsTemplate } from "@/api/iosBasicData/bcorps";
  98. import { mapGetters } from "vuex";
  99. import { bcorpstypedefineList } from "@/api/iosBasicData/bcorpstypedefine"
  100. import bcorpstypedefine from "@/views/iosBasicData/bcorps/bcorpstypedefine.vue"
  101. import reportContainer from "@/views/iosBasicData/report-container/report-container.vue"
  102. import {getWorkDicts} from "@/api/system/dictbiz";
  103. import {bcountrysList} from "@/api/iosBasicData/bcountrys";
  104. export default {
  105. components: {
  106. detailPage,
  107. bcorpstypedefine,
  108. reportContainer
  109. },
  110. data() {
  111. return {
  112. headers: { "Blade-Auth": "Bearer " + getToken() },
  113. // 类别弹窗的开启
  114. corpTypeVisible: false,
  115. treeOption: {
  116. nodeKey: "id",
  117. lazy: true,
  118. treeLoad: function (node, resolve) {
  119. const parentId = node.level === 0 ? 0 : node.data.id;
  120. },
  121. addBtn: false,
  122. menu: false,
  123. size: "small",
  124. props: {
  125. labelText: "标题",
  126. label: "cnName",
  127. value: "id",
  128. children: "children"
  129. }
  130. },
  131. excelForm: {},
  132. excelLoading: false,
  133. excelOption: {
  134. submitBtn: false,
  135. emptyBtn: false,
  136. column: [
  137. {
  138. label: "模板下载",
  139. prop: "excelTemplate",
  140. formslot: true,
  141. span: 24
  142. },
  143. {
  144. label: "模板上传",
  145. prop: "excelFile",
  146. type: "upload",
  147. drag: true,
  148. loadText: "模板上传中,请稍等",
  149. span: 24,
  150. propsHttp: {
  151. res: "data"
  152. },
  153. tip: "请上传 .xls,.xlsx 标准格式文件",
  154. action: "/api/blade-los/bcorps/importBCorps"
  155. }
  156. ]
  157. },
  158. // 客户类别数据
  159. customTypeData: [],
  160. excelBox: false,
  161. form: {},
  162. query: {},
  163. detailData: {},
  164. isShow: true,
  165. loading: true,
  166. page: {
  167. pageSize: 10,
  168. currentPage: 1,
  169. total: 0,
  170. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  171. },
  172. selectionList: [],
  173. option: {},
  174. optionBack: {
  175. height: 'auto',
  176. calcHeight: 30,
  177. tip: false,
  178. searchIcon: true,
  179. searchIndex: 3,
  180. searchShow: true,
  181. searchMenuSpan: 6,
  182. border: true,
  183. index: true,
  184. viewBtn: true,
  185. selection: true,
  186. addBtnText: '新建往来单位',
  187. dialogClickModal: false,
  188. menuWidth: 220,
  189. column: [
  190. {
  191. label: "编码",
  192. prop: "code",
  193. width: "180",
  194. search: true,
  195. rules: [{
  196. required: true,
  197. message: "请输入单位编码",
  198. trigger: "blur"
  199. }],
  200. overHidden:true,
  201. },
  202. {
  203. label: "中文名称",
  204. prop: "cnName",
  205. width: "180",
  206. search: true,
  207. rules: [{
  208. required: true,
  209. message: "请输入中文名称",
  210. trigger: "blur"
  211. }],
  212. overHidden:true,
  213. },
  214. {
  215. label: "英文名称",
  216. prop: "enName",
  217. width: "180",
  218. search: true,
  219. rules: [{
  220. required: true,
  221. message: "请输入英文名称",
  222. trigger: "blur"
  223. }],
  224. overHidden:true,
  225. },
  226. {
  227. label: "统一社会信用代码",
  228. prop: "uscc",
  229. width: 160,
  230. rules: [{
  231. required: true,
  232. message: "请输入统一社会信用代码",
  233. trigger: "blur"
  234. }],
  235. overHidden:true,
  236. },
  237. // {
  238. // label: "首字母",
  239. // prop: "initials",
  240. // rules: [{
  241. // required: true,
  242. // message: "请输入首字母",
  243. // trigger: "blur"
  244. // }]
  245. // },
  246. {
  247. label: "简称",
  248. prop: "shortName",
  249. width: "180",
  250. rules: [{
  251. required: true,
  252. message: "请输入简称",
  253. trigger: "blur"
  254. }],
  255. overHidden:true,
  256. },
  257. // {
  258. // label: "国家代码",
  259. // prop: "cntyCode",
  260. // rules: [{
  261. // required: true,
  262. // message: "请输入国家代码",
  263. // trigger: "blur"
  264. // }]
  265. // },
  266. {
  267. label: "国家",
  268. prop: "cntyName",
  269. width: 140,
  270. overHidden:true,
  271. search: true,
  272. type: "select",
  273. filterable:true,
  274. remote:true,
  275. dicUrl: "/api/blade-los/bcountrys/list?cnName={{key}}",
  276. dicData:[],
  277. props: {
  278. label: 'cnName',
  279. value: 'cnName',
  280. res:"data.records"
  281. },
  282. },
  283. {
  284. label: "中文地址",
  285. prop: "cnAddr",
  286. width: "200",
  287. search: true,
  288. rules: [{
  289. required: true,
  290. message: "请输入中文地址",
  291. trigger: "blur"
  292. }],
  293. overHidden:true,
  294. },
  295. {
  296. label: "英文地址",
  297. prop: "enAddr",
  298. width: "200",
  299. search: true,
  300. rules: [{
  301. required: true,
  302. message: "请输入英文地址",
  303. trigger: "blur"
  304. }],
  305. overHidden:true,
  306. },
  307. {
  308. label: "电话",
  309. prop: "tel",
  310. width: "120",
  311. search: true,
  312. rules: [{
  313. required: true,
  314. message: "请输入电话",
  315. trigger: "blur"
  316. }],
  317. overHidden:true,
  318. },
  319. {
  320. label: "负责人姓名",
  321. prop: "mgrName",
  322. width: 100,
  323. rules: [{
  324. required: true,
  325. message: "请输入负责人姓名",
  326. trigger: "blur"
  327. }],
  328. overHidden:true,
  329. },
  330. {
  331. label: "联系人姓名",
  332. prop: "attnName",
  333. width: 100,
  334. rules: [{
  335. required: true,
  336. message: "请输入联系人姓名",
  337. trigger: "blur"
  338. }],
  339. overHidden:true,
  340. },
  341. {
  342. label: "联系人电话",
  343. prop: "attnTel",
  344. width: 100,
  345. rules: [{
  346. required: true,
  347. message: "请输入联系人电话",
  348. trigger: "blur"
  349. }],
  350. overHidden:true,
  351. },
  352. {
  353. label: "客户类型",
  354. prop: "corpTypeName",
  355. width: "140",
  356. rules: [{
  357. required: true,
  358. message: "请输入客户类型",
  359. trigger: "blur"
  360. }],
  361. overHidden:true,
  362. },
  363. {
  364. label: "分管员",
  365. prop: "adminProfilesName",
  366. width: "100",
  367. rules: [{
  368. required: true,
  369. message: "请输入分管员",
  370. trigger: "blur"
  371. }],
  372. overHidden:true,
  373. },
  374. {
  375. label: "状态",
  376. prop: "status",
  377. type: 'select',
  378. search: true,
  379. dicData: [{
  380. label: '启用',
  381. value: 0
  382. }, {
  383. label: '停用',
  384. value: 1
  385. }],
  386. rules: [{
  387. required: true,
  388. message: "请输入状态",
  389. trigger: "blur"
  390. }],
  391. overHidden:true,
  392. },
  393. {
  394. label: "备注",
  395. prop: "remarks",
  396. span: 24,
  397. type: 'textarea',
  398. width: "180",
  399. slot: true,
  400. minRows: 3,
  401. overHidden:true,
  402. },
  403. ],
  404. designer: null,
  405. },
  406. data: [],
  407. // 字典数据
  408. ifInvoiceData:[],
  409. };
  410. },
  411. props:{
  412. // 是否的弹窗状态打开
  413. eldialog:{
  414. type:Boolean,
  415. default:false
  416. }
  417. },
  418. computed: {
  419. ...mapGetters(["permission"]),
  420. permissionList() {
  421. return {
  422. // addBtn: this.vaildData(this.permission.bcorps_add, false),
  423. viewBtn: this.vaildData(this.permission.bcorps_view, false),
  424. delBtn: this.vaildData(this.permission.bcorps_delete, false),
  425. editBtn: this.vaildData(this.permission.bcorps_edit, false)
  426. };
  427. },
  428. ids() {
  429. let ids = [];
  430. this.selectionList.forEach(ele => {
  431. ids.push(ele.id);
  432. });
  433. return ids.join(",");
  434. }
  435. },
  436. async created() {
  437. this.option = await this.getColumnData(this.getColumnName(304), this.optionBack);
  438. // 这个是从海运出口跳进来的
  439. if (this.$route.query.corpType) {
  440. this.isShow = false
  441. this.$store.commit("DOMIO_IN_CUL");
  442. }
  443. // 付费申请开户账号点击跳过来的
  444. if (this.$route.query.id) {
  445. this.detailData.id = this.$route.query.id
  446. this.$nextTick(()=>{
  447. this.$refs.detail.activeName = "yhxx" // tabs切换成银行信息
  448. this.$refs.detail.getBcorpsDetailfun(this.$route.query.id)
  449. })
  450. this.isShow = false
  451. this.$store.commit("DOMIO_IN_CUL");
  452. }
  453. this.$store.commit("DOMIO_IN_CUL");
  454. this.bcountrysListfun() // 获取国家数据
  455. this.bcorpstypedefineListfun() // 获取客户类别
  456. this.ifInvoiceGetWorkDictsfun() // 字典状态
  457. },
  458. activated(){
  459. this.$store.commit("DOMIO_OUT_CUL");
  460. },
  461. methods: {
  462. // 获取国家数据
  463. bcountrysListfun(){
  464. bcountrysList(1,10).then(res=>{
  465. this.findObject(this.option.column, "cntyName").dicData = res.data.data.records
  466. })
  467. },
  468. // 获取状态字典数据
  469. ifInvoiceGetWorkDictsfun(){
  470. getWorkDicts('ifInvoice').then(res=>{
  471. this.ifInvoiceData = res.data.data
  472. })
  473. },
  474. // 禁用启用按钮
  475. statusfun(id,status){
  476. this.$confirm("确定将选择数据更改状态?", {
  477. confirmButtonText: "确定",
  478. cancelButtonText: "取消",
  479. type: "warning"
  480. }).then(()=>{
  481. this.loading = true
  482. getBcorpsDetail(id).then(res => {
  483. let obj = res.data.data;
  484. obj.status = status
  485. updateBcorps(obj).then(res=>{
  486. this.onLoad(this.page);
  487. this.$message({
  488. type: "success",
  489. message: "操作成功!"
  490. });
  491. })
  492. });
  493. })
  494. },
  495. // 导入
  496. // handleChange(file, fileLis) {
  497. // console.log('daoru');
  498. // // this.$Export.xlsx(file.raw)
  499. // // .then(data => {
  500. // // this.data=data.results;
  501. // // })
  502. // },
  503. // 导出
  504. handleExport() {
  505. var condition = ''
  506. for (const key in this.query) {
  507. var value = this.query[key]
  508. if (value) {
  509. condition += `&${key}=${this.query[key]}`
  510. }
  511. }
  512. this.$confirm('是否导出客户资料?', '提示', {
  513. confirmButtonText: '确定',
  514. cancelButtonText: '取消',
  515. type: 'warning'
  516. }).then(() => {
  517. window.open(
  518. `/api/blade-los/bcorps/exportBCorps?${this.website.tokenHeader
  519. }=${getToken()}${condition}`
  520. );
  521. }).catch(() => {
  522. this.$message({
  523. type: 'info',
  524. message: '已取消' //
  525. });
  526. })
  527. },
  528. // 下载模板
  529. handleGet() {
  530. window.open(
  531. `/api/blade-los/bcorps/exportBCorps/template?${this.website.tokenHeader
  532. }=${getToken()}`
  533. );
  534. },
  535. // 上传成功
  536. onSuccess(res, done, loading, column) {
  537. this.excelBox = false;
  538. this.$message.success("导入成功!");
  539. loading = false;
  540. this.onLoad(this.page);
  541. done();
  542. },
  543. uploadBefore(file, done, loading) {
  544. done();
  545. loading = true;
  546. },
  547. onError(err, file, fileList) {
  548. err += ''
  549. // console.log(JSON.stringify(err.match(/{(\S*)}/)[1]));
  550. var data = err.match(/{(\S*)}/)[1]
  551. this.$message.error(data.split("msg\":")[1]);
  552. },
  553. // 左侧点击回调
  554. nodeClick(data) {
  555. // var reqiestData = this.search;
  556. // // console.log(data, 904)
  557. // reqiestData.corpType = data.id
  558. // if (this.search.corpType == null) {
  559. this.query.corpType = data.id
  560. // } else {
  561. // this.search.corpType = null
  562. // }
  563. this.onLoad(this.page, this.query);
  564. // this.onLoad(this.page, reqiestData);
  565. },
  566. // 获取客户类别
  567. bcorpstypedefineListfun() {
  568. bcorpstypedefineList(1,30).then(res => {
  569. this.customTypeData = res.data.data.records
  570. })
  571. },
  572. editOpen(row) {
  573. this.detailData = {
  574. id: row.id
  575. };
  576. this.isShow = false;
  577. },
  578. rowSave(row, done, loading) {
  579. addBcorps(row).then(() => {
  580. this.onLoad(this.page);
  581. this.$message({
  582. type: "success",
  583. message: "操作成功!"
  584. });
  585. done();
  586. }, error => {
  587. loading();
  588. window.console.log(error);
  589. });
  590. },
  591. rowUpdate(row, index, done, loading) {
  592. updateBcorps(row).then(() => {
  593. this.onLoad(this.page);
  594. this.$message({
  595. type: "success",
  596. message: "操作成功!"
  597. });
  598. done();
  599. }, error => {
  600. loading();
  601. console.log(error);
  602. });
  603. },
  604. rowDel(row) {
  605. if (row.status === 1) {
  606. this.$confirm("确定将选择数据删除?", {
  607. confirmButtonText: "确定",
  608. cancelButtonText: "取消",
  609. type: "warning"
  610. })
  611. .then(() => {
  612. return removeBcorps(row.id);
  613. })
  614. .then(() => {
  615. this.onLoad(this.page);
  616. this.$message({
  617. type: "success",
  618. message: "操作成功!"
  619. });
  620. });
  621. } else {
  622. this.$message({
  623. message: '非禁用状态无法删除',
  624. type: 'warning'
  625. });
  626. }
  627. },
  628. handleDelete() {
  629. if (this.selectionList.length === 0) {
  630. this.$message.warning("请选择至少一条数据");
  631. return;
  632. }
  633. this.$confirm("确定将选择数据删除?", {
  634. confirmButtonText: "确定",
  635. cancelButtonText: "取消",
  636. type: "warning"
  637. })
  638. .then(() => {
  639. return removeBcorps(this.ids);
  640. })
  641. .then(() => {
  642. this.onLoad(this.page);
  643. this.$message({
  644. type: "success",
  645. message: "操作成功!"
  646. });
  647. this.$refs.crud.toggleSelection();
  648. });
  649. },
  650. beforeOpen(done, type) {
  651. this.detailData = {};
  652. if (this.query.corpType != null) {
  653. this.detailData.corpType = this.query.corpType
  654. }
  655. this.isShow = false;
  656. // if (["edit", "view"].includes(type)) {
  657. // getBcorpsDetail(this.form.id).then(res => {
  658. // this.form = res.data.data;
  659. // });
  660. // }
  661. // done();
  662. },
  663. searchReset() {
  664. this.query = {};
  665. this.onLoad(this.page);
  666. },
  667. searchChange(params, done) {
  668. this.query = params;
  669. this.page.currentPage = 1;
  670. this.onLoad(this.page, params);
  671. done();
  672. },
  673. selectionChange(list) {
  674. if(this.eldialog){
  675. this.$emit('selectionChange',list)
  676. }else {
  677. this.selectionList = list;
  678. }
  679. },
  680. selectionClear() {
  681. this.selectionList = [];
  682. this.$refs.crud.toggleSelection();
  683. },
  684. currentChange(currentPage) {
  685. this.page.currentPage = currentPage;
  686. },
  687. sizeChange(pageSize) {
  688. this.page.pageSize = pageSize;
  689. },
  690. refreshChange() {
  691. this.onLoad(this.page, this.query);
  692. },
  693. onLoad(page, params = {}) {
  694. this.loading = true;
  695. BcorpsList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  696. const data = res.data.data;
  697. this.page.total = data.total;
  698. this.data = data.records;
  699. this.loading = false;
  700. this.selectionClear();
  701. });
  702. },
  703. goBack() {
  704. if (JSON.stringify(this.$route.query) != "{}") {
  705. this.$router.$avueRouter.closeTag();
  706. this.$router.push({
  707. path: "/iosBasicData/bcorps/index"
  708. });
  709. }
  710. this.isShow = true;
  711. this.detailData = {};
  712. this.onLoad(this.page);
  713. },
  714. // 类别弹窗关闭
  715. corpTypeClose(done) {
  716. this.$confirm('确认关闭?')
  717. .then(_ => {
  718. done();
  719. })
  720. .catch(_ => { });
  721. },
  722. //自定义列保存
  723. async saveColumnTwo(ref, option, optionBack, code) {
  724. /**
  725. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  726. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  727. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  728. */
  729. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  730. if (inSave) {
  731. this.$message.success("保存成功");
  732. //关闭窗口
  733. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  734. }
  735. },
  736. //自定义列重置
  737. async resetColumnTwo(ref, option, optionBack, code) {
  738. this[option] = this[optionBack];
  739. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  740. if (inSave) {
  741. this.$message.success("重置成功");
  742. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  743. }
  744. },
  745. // 更改表格颜色
  746. headerClassName(tab) {
  747. //颜色间隔
  748. let back = ""
  749. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  750. if (tab.columnIndex % 2 === 0) {
  751. back = "back-one"
  752. } else if (tab.columnIndex % 2 === 1) {
  753. back = "back-two"
  754. }
  755. }
  756. return back;
  757. },
  758. // 报表加载格式和数据
  759. // report 报表实例
  760. // content 报表设计模板, data:application/zip;base64,UEsDBAoAAAAIAClHSlfgHxo4LgwDAHeJBQAPAAAAcmVwb3J0Zml...
  761. // data 报表数据 JSON Object
  762. loadReport(report, content, data){
  763. var mimeString = content
  764. .split(',')[0]
  765. .split(':')[1]
  766. .split(';')[0]
  767. var byteString = atob(content.split(',')[1])
  768. var ab = new ArrayBuffer(byteString.length)
  769. var ia = new Uint8Array(ab)
  770. for (var i = 0; i < byteString.length; i++) {
  771. ia[i] = byteString.charCodeAt(i)
  772. }
  773. var blob = new Blob([ab])
  774. JSZip.loadAsync(blob).then(function(unziped) {
  775. unziped
  776. .file('reportfile.json')
  777. .async('string')
  778. .then(res => {
  779. report.load(res)
  780. if (!!data) {
  781. var dataSet = new Stimulsoft.System.Data.DataSet(
  782. 'reportData'
  783. )
  784. dataSet.readJson(data)
  785. report.regData('reportData', 'reportData', dataSet)
  786. }
  787. })
  788. })
  789. },
  790. createDesignerButtons(e) {
  791. if (!!e) {
  792. try {
  793. this.designer.jsObject.options.menus.localizationMenu.addEventListener(
  794. 'click',
  795. this.createDesignerButtons
  796. )
  797. } catch (error) {
  798. }
  799. }
  800. let toolBarRow = this.designer.jsObject.options.toolBar.firstChild.tr[0]
  801. let customButton = this.designer.jsObject.StatusPanelButton(
  802. 'exitButton',
  803. '关闭',
  804. 'LoginControls.Window.CloseWhite.png',
  805. '关闭',
  806. null,
  807. 30,
  808. 60
  809. )
  810. customButton.image.style.width = customButton.image.style.height = '16px'
  811. let buttonCell = document.createElement('td')
  812. buttonCell.className = 'stiDesignerToolButtonCell'
  813. buttonCell.appendChild(customButton)
  814. toolBarRow.appendChild(buttonCell)
  815. let that=this
  816. customButton.action = function(e) {
  817. let jsObject = this.jsObject
  818. if (jsObject.options.reportIsModified) {
  819. var messageForm = jsObject.MessageFormForSave()
  820. messageForm.changeVisibleState(true)
  821. messageForm.action = function(state) {
  822. if (state) {
  823. jsObject.SendCommandSaveReport()
  824. setTimeout(() => {
  825. jsObject.SendCommandCloseReport()
  826. jsObject.designer.invokeExit()
  827. if (that.$refs.reportContainer)
  828. that.$refs.reportContainer.hideContainer()
  829. }, 250)
  830. } else {
  831. jsObject.SendCommandCloseReport()
  832. jsObject.designer.invokeExit()
  833. if (that.$refs.reportContainer)
  834. that.$refs.reportContainer.hideContainer()
  835. }
  836. }
  837. } else {
  838. jsObject.SendCommandCloseReport()
  839. jsObject.designer.invokeExit()
  840. if (that.$refs.reportContainer)
  841. that.$refs.reportContainer.hideContainer()
  842. }
  843. }
  844. },
  845. handleReportDesigner(){
  846. Stimulsoft.Base.StiLicense.key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHn0s4gy0Fr5YoUZ9V00Y0igCSFQzwEqYBh/N77k4f0fWXTHW5rqeBNLkaurJDenJ9o97TyqHs9HfvINK18Uwzsc/bG01Rq+x3H3Rf+g7AY92gvWmp7VA2Uxa30Q97f61siWz2dE5kdBVcCnSFzC6awE74JzDcJMj8OuxplqB1CYcpoPcOjKy1PiATlC3UsBaLEXsok1xxtRMQ283r282tkh8XQitsxtTczAJBxijuJNfziYhci2jResWXK51ygOOEbVAxmpflujkJ8oEVHkOA/CjX6bGx05pNZ6oSIu9H8deF94MyqIwcdeirCe60GbIQByQtLimfxbIZnO35X3fs/94av0ODfELqrQEpLrpU6FNeHttvlMc5UVrT4K+8lPbqR8Hq0PFWmFrbVIYSi7tAVFMMe2D1C59NWyLu3AkrD3No7YhLVh7LV0Tttr/8FrcZ8xirBPcMZCIGrRIesrHxOsZH2V8t/t0GXCnLLAWX+TNvdNXkB8cF2y9ZXf1enI064yE5dwMs2fQ0yOUG/xornE'
  847. // Stimulsoft.Base.StiLicense.Key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHkcgIvwL0jnpsDqRpWg5FI5kt2G7A0tYIcUygBh1sPs7plofUOqPB1a4HBIXJB621mau2oiAIj+ysU7gKUXfjn/D5BocmduNB+ZMiDGPxFrAp3PoD0nYNkkWh8r7gBZ1v/JZSXGE3bQDrCQCNSy6mgby+iFAMV8/PuZ1z77U+Xz3fkpbm6MYQXYp3cQooLGLUti7k1TFWrnawT0iEEDJ2iRcU9wLqn2g9UiWesEZtKwI/UmEI2T7nv5NbgV+CHguu6QU4WWzFpIgW+3LUnKCT/vCDY+ymzgycw9A9+HFSzARiPzgOaAuQYrFDpzhXV+ZeX31AxWlnzjDWqpfluygSNPtGul5gyNt2CEoJD1Yom0VN9fvRonYsMsimkFFx2AwyVpPcs+JfVBtpPbTcZscnzUdmiIvxv8Gcin6sNSibM6in/uUKFt3bVgW/XeMYa7MLGF53kvBSwi78poUDigA2n12SmghLR0AHxyEDIgZGOTbNI33GWu7ZsPBeUdGu55R8w='
  848. Stimulsoft.Base.Localization.StiLocalization.addLocalizationFile( '/reports/stimulsoft/Localization/zh-CHS.xml', true, 'zh-CHS')
  849. Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile('/reports/stimulsoft/Localization/zh-CHS.xml' )
  850. var options = new Stimulsoft.Designer.StiDesignerOptions()
  851. options.appearance.fullScreenMode = true
  852. options.allowChangeWindowTitle = false
  853. options.toolbar.showSaveDialog = false
  854. options.toolbar.showFileMenuSave = false
  855. options.toolbar.showFileMenuAbout = false
  856. options.toolbar.showFileMenuClose = false
  857. options.toolbar.showFileMenuExit = false
  858. options.toolbar.showFileMenuInfo = false
  859. options.toolbar.showFileMenuHelp = false
  860. options.toolbar.showFileMenuNew = false
  861. options.appearance.showTooltips = false
  862. options.appearance.showDialogsHelp = false
  863. options.toolbar.showSetupToolboxButton = true
  864. options.appearance.htmlRenderMode = Stimulsoft.Report.Export.StiHtmlExportMode.Table
  865. let designer = new Stimulsoft.Designer.StiDesigner(
  866. options,
  867. 'StiDesigner',
  868. false
  869. )
  870. designer.onSaveReport = (e)=>{
  871. console.log('onSaveReport')
  872. /*
  873. let jsObject = this.jsObject
  874. if (!e.report.isModified)
  875. return
  876. var jsonString = e.report.saveToJsonString()
  877. var zip = new JSZip()
  878. zip.file('reportfile.json', jsonString)
  879. zip.generateAsync({
  880. type: 'blob',
  881. compression: 'DEFLATE',
  882. compressionOptions: {
  883. level: 9
  884. }
  885. }).then(content => {
  886. var reader = new FileReader()
  887. reader.onload = event => {
  888. var reportContent = reader.result
  889. // 此处将报表模版保存到数据库
  890. // save content to database
  891. e.report.isModified = false
  892. }
  893. reader.readAsDataURL(content)
  894. })
  895. */
  896. }
  897. let report = new window.Stimulsoft.Report.StiReport();
  898. report.styles.loadFile('static/Plugins/reports/css/Styles.sts')
  899. report.applyStyles()
  900. // 加载文件
  901. console.log("从 url 报表");
  902. report.loadFile("/reports/stimulsoft/demos/SimpleList.mrt");
  903. // 从模版和数据加载报表
  904. // loadReport(report, '', {})
  905. designer.report = report
  906. this.designer=designer
  907. this.$refs.reportContainer.showContainer(
  908. ()=> {
  909. setTimeout(() => {
  910. designer.renderHtml('reportContainer')
  911. this.createDesignerButtons()
  912. }, 50)
  913. },
  914. ()=>{
  915. },
  916. )
  917. },
  918. createViewerButtons (viewer){
  919. viewer.jsObject.collections.images['myClose.png'] =
  920. 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAA0ElEQVQ4ja3TO05CQRQG4A8iOwAbtYWETndAaecK7NwCKmETtJZsSBNLobEz8ZFIJQ0UnOGSm3DnYviTybzO/895DQXGWGCVGQuMEqkRcwcfuMOLalziCaf4TIe9UG9nyMJmFRzNGoRK1BU4xxx9G7cfwostciGk+x8MqgySwDXe4tU53hVV+MNtTmAoX84JGv9NYgrHyR6DV8wUSW7hItZLm36ZVoVQxsFJLOMsPOrH/h7dQwR2cdxOTEn8DtUbPGc4V2H7Vb4Yqfedf/GYSGt8VUmxgyfuBAAAAABJRU5ErkJggg=='
  921. const closeBtn = viewer.jsObject.SmallButton(
  922. 'closeBtn',
  923. '关闭',
  924. 'myClose.png'
  925. )
  926. const toolbarTable = viewer.jsObject.controls.toolbar.firstChild.firstChild
  927. const buttonsTable = toolbarTable.rows[0].lastChild.lastChild
  928. const userButtonCell = buttonsTable.rows[0].insertCell(0)
  929. userButtonCell.className = 'stiJsViewerClearAllStyles'
  930. userButtonCell.appendChild(closeBtn)
  931. let that=this
  932. closeBtn.action = function() {
  933. console.log(that.$refs.ReportContainer)
  934. if (that.$refs.reportContainer)
  935. that.$refs.reportContainer.hideContainer()
  936. }
  937. },
  938. handleReportPreview(){
  939. Stimulsoft.Base.StiLicense.key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHn0s4gy0Fr5YoUZ9V00Y0igCSFQzwEqYBh/N77k4f0fWXTHW5rqeBNLkaurJDenJ9o97TyqHs9HfvINK18Uwzsc/bG01Rq+x3H3Rf+g7AY92gvWmp7VA2Uxa30Q97f61siWz2dE5kdBVcCnSFzC6awE74JzDcJMj8OuxplqB1CYcpoPcOjKy1PiATlC3UsBaLEXsok1xxtRMQ283r282tkh8XQitsxtTczAJBxijuJNfziYhci2jResWXK51ygOOEbVAxmpflujkJ8oEVHkOA/CjX6bGx05pNZ6oSIu9H8deF94MyqIwcdeirCe60GbIQByQtLimfxbIZnO35X3fs/94av0ODfELqrQEpLrpU6FNeHttvlMc5UVrT4K+8lPbqR8Hq0PFWmFrbVIYSi7tAVFMMe2D1C59NWyLu3AkrD3No7YhLVh7LV0Tttr/8FrcZ8xirBPcMZCIGrRIesrHxOsZH2V8t/t0GXCnLLAWX+TNvdNXkB8cF2y9ZXf1enI064yE5dwMs2fQ0yOUG/xornE'
  940. // Stimulsoft.Base.StiLicense.Key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHkcgIvwL0jnpsDqRpWg5FI5kt2G7A0tYIcUygBh1sPs7plofUOqPB1a4HBIXJB621mau2oiAIj+ysU7gKUXfjn/D5BocmduNB+ZMiDGPxFrAp3PoD0nYNkkWh8r7gBZ1v/JZSXGE3bQDrCQCNSy6mgby+iFAMV8/PuZ1z77U+Xz3fkpbm6MYQXYp3cQooLGLUti7k1TFWrnawT0iEEDJ2iRcU9wLqn2g9UiWesEZtKwI/UmEI2T7nv5NbgV+CHguu6QU4WWzFpIgW+3LUnKCT/vCDY+ymzgycw9A9+HFSzARiPzgOaAuQYrFDpzhXV+ZeX31AxWlnzjDWqpfluygSNPtGul5gyNt2CEoJD1Yom0VN9fvRonYsMsimkFFx2AwyVpPcs+JfVBtpPbTcZscnzUdmiIvxv8Gcin6sNSibM6in/uUKFt3bVgW/XeMYa7MLGF53kvBSwi78poUDigA2n12SmghLR0AHxyEDIgZGOTbNI33GWu7ZsPBeUdGu55R8w='
  941. Stimulsoft.Base.Localization.StiLocalization.addLocalizationFile( '/reports/stimulsoft/Localization/zh-CHS.xml', true, 'zh-CHS')
  942. Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile('/reports/stimulsoft/Localization/zh-CHS.xml' )
  943. // 工具栏
  944. var options = new Stimulsoft.Viewer.StiViewerOptions()
  945. options.height = '100%'
  946. options.appearance.scrollbarsMode = true
  947. options.toolbar.showDesignButton = false
  948. options.toolbar.showAboutButton = false
  949. options.toolbar.showResourcesButton = false
  950. options.toolbar.showFullScreenButton = false
  951. options.toolbar.showOpenButton = false
  952. options.appearance.showTooltips = false
  953. options.appearance.showDialogsHelp = false
  954. options.exports.showExportToDocument = false
  955. options.toolbar.showParametersButton = true
  956. options.appearance.bookmarksPrint = true
  957. options.toolbar.printDestination = Stimulsoft.Viewer.StiPrintDestination.Direct
  958. options.appearance.htmlRenderMode = Stimulsoft.Report.Export.StiHtmlExportMode.Table
  959. let viewer = new Stimulsoft.Viewer.StiViewer(options, 'StiViewer', false)
  960. // 报表
  961. console.log("创建一个报表实例");
  962. let report = new window.Stimulsoft.Report.StiReport();
  963. // 加载文件
  964. console.log("从url加载报表");
  965. report.loadFile("/reports/stimulsoft/demos/SimpleList.mrt");
  966. // 从模版和数据加载报表
  967. // loadReport(report, '', {})
  968. viewer.report = report;
  969. this.$refs.reportContainer.showContainer(
  970. ()=> {
  971. setTimeout(() => {
  972. viewer.renderHtml('reportContainer')
  973. this.createViewerButtons(viewer)
  974. }, 50)
  975. },
  976. ()=>{
  977. },
  978. )
  979. console.log("加载成功完成!");
  980. },
  981. }
  982. };
  983. </script>
  984. <style lang="scss" scoped>
  985. ::v-deep#out-table .back-one {
  986. background: #ecf5ff !important;
  987. }
  988. ::v-deep#out-table .back-two {
  989. background: #ecf5ff !important;
  990. }
  991. ::v-deep .el-input-group__append {
  992. padding: 0 0px !important;
  993. }
  994. /deep/ .el-tree-node__content>.el-tree-node__expand-icon {
  995. visibility: hidden;
  996. }
  997. /deep/ .el-col-md-8 {
  998. width: 24.33333%;
  999. }
  1000. .statusClass {
  1001. border-radius: 10px;
  1002. color: #fff;
  1003. text-align: center;
  1004. }
  1005. </style>