index_template.vue 31.1 KB
Newer Older
lvzhuangzhuang's avatar
lvzhuangzhuang committed
1
<template>
lvzhuangzhuang's avatar
lvzhuangzhuang committed
2
  <div class="app-container">
lenovo's avatar
lenovo committed
3
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
4
      <el-form-item label="Excel文件名" prop="templateName" label-width="100px">
lenovo's avatar
lenovo committed
5 6 7 8 9 10
        <el-input
          v-model="queryParams.templateName"
          placeholder="请输入Excel文件名"
          clearable
          @keyup.enter.native="handleQuery"
        />
lvzhuangzhuang's avatar
lvzhuangzhuang committed
11 12
      </el-form-item>
      <el-form-item>
lenovo's avatar
lenovo committed
13
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
lvzhuangzhuang's avatar
lvzhuangzhuang committed
14 15 16
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
lvzhuangzhuang's avatar
lvzhuangzhuang committed
17

lvzhuangzhuang's avatar
lvzhuangzhuang committed
18
    <el-row :gutter="10" class="mb8">
lenovo's avatar
lenovo committed
19 20 21 22 23 24 25 26 27 28
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['SuppliesTemplate:SuppliesTemplate:add']"
        >新增</el-button>
      </el-col>
lvzhuangzhuang's avatar
lvzhuangzhuang committed
29 30 31 32
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
lenovo's avatar
lenovo committed
33 34 35 36 37 38 39 40 41 42 43 44
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['SuppliesTemplate:SuppliesTemplate:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
lvzhuangzhuang's avatar
lvzhuangzhuang committed
45
          size="mini"
lenovo's avatar
lenovo committed
46 47 48 49
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['SuppliesTemplate:SuppliesTemplate:remove']"
        >删除</el-button>
lvzhuangzhuang's avatar
lvzhuangzhuang committed
50
      </el-col>
lenovo's avatar
lenovo committed
51 52

      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
lvzhuangzhuang's avatar
lvzhuangzhuang committed
53
    </el-row>
lenovo's avatar
lenovo committed
54 55 56

    <el-table v-loading="loading" :data="SuppliesTemplateList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
57
      <el-table-column type="index" width="80" align="center" label="序号" :index="indexMethod" />
lenovo's avatar
lenovo committed
58
      <el-table-column label="Excel文件名" align="center" prop="templateName" />
59 60 61
      <el-table-column label="状态" align="center" prop="status" >
        <template slot-scope="scope">
          <div>
62 63 64 65 66 67 68 69
            <el-switch
              @change="toggleEnable(scope.row)"
              v-model="scope.row.status"
              :active-value="0"
              :inactive-value="1"
              active-color="#13ce66"
              inactive-color="#cccccc">
            </el-switch>
70 71 72
          </div>
        </template>
      </el-table-column>
lenovo's avatar
lenovo committed
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleSave(scope.row)"
            v-hasPermi="['SuppliesTemplate:SuppliesTemplate']"
          >详情</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['SuppliesTemplate:SuppliesTemplate:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['SuppliesTemplate:SuppliesTemplate:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改Excel模板对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
        <el-form-item label="状态" prop="status">
          <el-select v-model="form.status" placeholder="请选择状态">
            <el-option label="启用" :value="0"></el-option>
            <el-option label="禁用" :value="1"></el-option>
          </el-select>
        </el-form-item>
<!--        <el-upload-->
<!--          ref="uploadRef"-->
<!--          class="upload-demo"-->
<!--          drag-->
<!--          show-file-list="true"-->
<!--          action="https://jsonplaceholder.typicode.com/posts/"-->
<!--          multiple-->
<!--          :before-upload="beforeUpload"-->
<!--        >-->
<!--          <i class="el-icon-upload"></i>-->
<!--          <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>-->
<!--          <div class="el-upload__tip" slot="tip">只能上传xlsx文件</div>-->
<!--        </el-upload>-->
130 131

        <el-upload
132
          ref="uploadRef"
133 134 135 136 137
          class="upload-demo"
          drag
          action="https://jsonplaceholder.typicode.com/posts/"
          multiple
          :before-upload="beforeUpload"
138 139 140
          :on-change="handleChange"
          :show-file-list="fileListName.length > 0"
          :file-list="fileListName"
141 142 143
        >
          <i class="el-icon-upload"></i>
          <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
144
          <div class="el-upload__tip" slot="tip">只能上传xlsx文件</div>
145
        </el-upload>
lvzhuangzhuang's avatar
lvzhuangzhuang committed
146
      </el-form>
lenovo's avatar
lenovo committed
147 148 149 150 151

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
lvzhuangzhuang's avatar
lvzhuangzhuang committed
152
    </el-dialog>
lenovo's avatar
lenovo committed
153 154 155

    <div id="luckysheet" :style="{ position: positionValue, top: '0', left: '0', right: '0', bottom: '0' }"></div>

lvzhuangzhuang's avatar
lvzhuangzhuang committed
156 157 158
  </div>
</template>

159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
<style>
#luckysheet_info_detail_title {
  display: none;
}
#luckysheet_info_detail_update{
  display: none;
}
#luckysheet_info_detail_save{
  display: none;
}

.luckysheet-share-logo {
  display: none;
}
</style>

lvzhuangzhuang's avatar
lvzhuangzhuang committed
175
<script>
lenovo's avatar
lenovo committed
176 177 178 179 180 181
import {
  listSuppliesTemplate,
  getSuppliesTemplate,
  delSuppliesTemplate,
  addSuppliesTemplate,
  updateSuppliesTemplate,
182
  toggleEnable,toggleDisable,
183
  listSuppliesTemplateId, exportMyluckyexcel
lenovo's avatar
lenovo committed
184 185 186 187 188
} from "@/api/ruoyi-myLuckyexcel/myluckyexcel";
import $ from 'jquery';
import XLSX from 'xlsx';
import LuckyExcel from 'luckyexcel';
import luckysheet from 'luckysheet';
189
import {exportSuppliesrole} from "@/api/system/suppliesrole";
lvzhuangzhuang's avatar
lvzhuangzhuang committed
190

lenovo's avatar
lenovo committed
191 192 193 194 195 196
export default {
  name: "SuppliesTemplate",
  data() {
    return {
      positionValue: 'static',
      fileList: [{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}, {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}],
lvzhuangzhuang's avatar
lvzhuangzhuang committed
197

lenovo's avatar
lenovo committed
198 199 200 201 202 203 204 205 206 207 208 209 210 211
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // Excel模板表格数据
      SuppliesTemplateList: [],
212 213
      //模板详情
      TemplateId:[],
214
      fileListName:[],
lenovo's avatar
lenovo committed
215 216 217 218 219 220 221 222 223 224 225
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      open1: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        detId: null,
        templateName: null,
lenovo's avatar
lenovo committed
226
        templateContent: null,
lenovo's avatar
lenovo committed
227
        status: null,
lvzhuangzhuang's avatar
lvzhuangzhuang committed
228
      },
lenovo's avatar
lenovo committed
229
      form: {
lvzhuangzhuang's avatar
lvzhuangzhuang committed
230
      },
lenovo's avatar
lenovo committed
231
      rules: {
lvzhuangzhuang's avatar
lvzhuangzhuang committed
232
      },
lenovo's avatar
lenovo committed
233 234 235 236 237
    }
  },
  created() {
    this.getList();
    this.positionValue = "static";
238 239 240
  },
  mounted() {
    window.handleReturnButtonClick = this.handleReturnButtonClick;
lenovo's avatar
lenovo committed
241 242
  },
  methods: {
243

244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276

    /**启用 */
    toggleEnable(SuppliesTemplate){
      console.log('你点击了【' + SuppliesTemplate.s+'】的开关控件,当前开关值:' + SuppliesTemplate.status);
      let enableText=['启用','禁用'];
      if(SuppliesTemplate.status == 0) {
        toggleEnable(SuppliesTemplate.id).then((response) =>{
          if(response.code == 200){
            let message = '操作成功,已经将【' + SuppliesTemplate.templateName +'】的状态改为【'+ enableText[SuppliesTemplate.status] +'】 !';
            this.$message({
              message: message,
              type:'success'
            });
          }else {
            this.$message.error(response.message);
          }
        });
      }else {
        toggleDisable(SuppliesTemplate.id).then((response) =>{
          if(response.code == 200){
            let message = '操作成功,已经将【' + SuppliesTemplate.templateName +'】的状态改为【'+ enableText[SuppliesTemplate.status] +'】 !';
            this.$message({
              message: message,
              type:'success'
            });
          }else {
            this.$message.error(response.message);
          }

        });
      }
    },

277 278 279 280 281 282 283 284 285 286 287 288 289
    /**显示序号*/
    indexMethod(index){
      return index + 1;
    },

    /**清空上传文件列表*/
    handleChange(file, fileList){
      // 清空 fileList 中的旧文件
      this.fileListName = [];
      // 添加文件到 fileList 中
      this.fileListName.push(file);
    },

290 291
    /**上传事件 */
    beforeUpload(file){
292

293
      const isJpgOrPng = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
lvzhuangzhuang's avatar
lvzhuangzhuang committed
294

295 296 297
      if (!isJpgOrPng) {
        this.$message.error('只能上传xlsx文件');
      }
lenovo's avatar
lenovo committed
298 299

      LuckyExcel.transformExcelToLucky(file ,(exportJson,lucksheetfile)=>{
300
        this.form.templateName = file.name;
lenovo's avatar
lenovo committed
301
        this.form.templateContent = JSON.stringify(exportJson.sheets);
lenovo's avatar
lenovo committed
302
      });
303

304
      return isJpgOrPng;
lenovo's avatar
lenovo committed
305 306
    },

307 308 309 310 311 312 313 314 315 316
    // handleFileChange(event){
    //   var file = event.target.files[0];
    //   var fileName = file.name;
    //   fileName = fileName + "";
    //   LuckyExcel.transformExcelToLucky(file ,(exportJson,lucksheetfile)=>{
    //     this.form.templateName = fileName;
    //     this.form.templateContent = JSON.stringify(exportJson.sheets);
    //   });
    // },

lenovo's avatar
lenovo committed
317 318
    /** 查询Excel模板列表 */
    getList() {
319
      this.indexMethod(0);
lenovo's avatar
lenovo committed
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
      this.loading = true;
      listSuppliesTemplate(this.queryParams).then(response => {
        this.SuppliesTemplateList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        detId: null,
        name: null,
lenovo's avatar
lenovo committed
338 339
        templateContent: null,
        status: 0,
lenovo's avatar
lenovo committed
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
365
      this.fileListName = [];
lenovo's avatar
lenovo committed
366 367 368 369 370 371
      this.reset();
      this.open = true;
      this.title = "添加Excel模板";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
372
      this.fileListName = [];
lenovo's avatar
lenovo committed
373 374 375 376 377 378 379 380 381 382 383
      this.reset();
      const id = row.id || this.ids
      getSuppliesTemplate(id).then(response => {
        console.log(response.rows[0])
        this.form = response.rows[0];
        this.open = true;
        this.title = "修改Excel模板";
      });
    },
    /** 提交按钮 */
    submitForm() {
384
      this.fileListName = [];
lenovo's avatar
lenovo committed
385 386 387 388 389 390 391 392 393 394 395 396 397 398
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateSuppliesTemplate(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addSuppliesTemplate(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
lvzhuangzhuang's avatar
lvzhuangzhuang committed
399 400
          }
        }
lenovo's avatar
lenovo committed
401 402 403 404 405
      });
    },

    /** 详情按钮操作 */
    handleSave(row) {
406 407 408 409 410 411 412 413 414 415 416 417 418

      listSuppliesTemplateId(row.id).then(response =>{

        this.TemplateId = response.rows;

        this.luckyLook();

      })

    },
    /**展示详情luckysheet */
    luckyLook(){

lenovo's avatar
lenovo committed
419 420 421 422
      this.positionValue = 'absolute';
      luckysheet.destroy();
      luckysheet.create({
        container: "luckysheet", // Luckysheet 的容器元素 ID
423 424
        title: this.TemplateId[0].templateName, // Excel 文件名
        data: JSON.parse(this.TemplateId[0].templateContent), // Excel 数据
lenovo's avatar
lenovo committed
425 426 427 428 429 430
        showtoolbar: false, //是否第二列显示工具栏
        showinfobar: true, //是否显示顶部名称栏
        showsheetbar: false, //是否显示底部表格名称区域
        pointEdit: false, //是否是编辑器插入表格模式
        pointEditUpdate: null, //编辑器表格更新函数
        allowEdit: false,//作用:是否允许前台编辑
431 432
        functionButton: '<button id="exportButton" class="btn btn-primary" style=" padding:3px 6px; font-size: 16px;width: 100px;height: 27px; margin-right: 85px;" onclick="handleReturnButtonClick()">返回</button>',

lenovo's avatar
lenovo committed
433 434
      });

435 436 437 438 439 440 441
    },
    /**详情返回按钮 */
    handleReturnButtonClick(){

      this.positionValue ='static';
      luckysheet.destroy();

lenovo's avatar
lenovo committed
442 443 444 445 446
    },

    /** 删除按钮操作*/
    handleDelete(row) {
      const ids = row.id || this.ids;
447 448 449 450 451
      this.$confirm('是否确认删除Excel模板编号为"' + ids + '"的数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function() {
lenovo's avatar
lenovo committed
452
        return delSuppliesTemplate(ids);
453 454 455 456 457 458 459 460 461 462 463
      }).then((result) => {
        if (result.data==="操作失败"){
          this.getList();
          this.msgError("该模板下存在关联规则,请先删除关联规则!!!");
        }else {
          this.getList();
          this.msgSuccess("删除成功");
        }
      }).catch(()=>{
      })

lenovo's avatar
lenovo committed
464
    },
lvzhuangzhuang's avatar
lvzhuangzhuang committed
465

466 467 468 469 470 471 472 473 474 475 476 477 478
    // /** 导出按钮操作 */
    // handleExport() {
    //   const queryParams = this.queryParams;
    //   this.$confirm('是否确认导出所有导入规则数据项?', "警告", {
    //     confirmButtonText: "确定",
    //     cancelButtonText: "取消",
    //     type: "warning"
    //   }).then(function() {
    //     return exportMyluckyexcel(queryParams);
    //   }).then(response => {
    //     this.download(response.msg);
    //   })
    // }
lenovo's avatar
lenovo committed
479 480
  }
};
lvzhuangzhuang's avatar
lvzhuangzhuang committed
481
</script>
lenovo's avatar
lenovo committed
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964









































<!--<template>-->
<!--  <div class="app-container">-->
<!--    <el-form  ref="queryForm" size="small" :inline="true"  label-width="68px">-->
<!--      <el-form-item label="模板" prop="name">-->
<!--        <el-select v-model="selectedOption" size="mini" @change="handleOptionChange" placeholder="请选择你要查看的模板" >-->
<!--          &lt;!&ndash;          <el-option label="自设的模板名" value="这里是Excel表内容"></el-option>&ndash;&gt;-->
<!--          <el-option-->
<!--            v-for="item in depss"-->
<!--            :key="item.id"-->
<!--            :label="item.name"-->
<!--            :value="item.id"-->
<!--          >-->
<!--          </el-option>-->
<!--        </el-select>-->
<!--      </el-form-item>-->
<!--      <el-form-item>-->
<!--        &lt;!&ndash;<el-button type="primary" icon="el-icon-search" size="mini" >搜索</el-button> &ndash;&gt;-->
<!--        &lt;!&ndash;<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>&ndash;&gt;-->
<!--        &lt;!&ndash;<el-button type="primary" icon="el-icon-search" size="mini" >搜索</el-button>&ndash;&gt;-->
<!--        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>-->
<!--      </el-form-item>-->
<!--    </el-form>-->

<!--    <el-row :gutter="10" class="mb8">-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="success"-->
<!--          plain-->
<!--          icon="el-icon-download"-->
<!--          size="mini"-->
<!--          @click="dialogVisible = true"-->
<!--        >保存</el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="warning"-->
<!--          plain-->
<!--          icon="el-icon-s-promotion"-->
<!--          size="mini"-->
<!--          @click="handleExport"-->
<!--          v-hasPermi="['ruoyi-myexcel:myexcel:export']"-->
<!--        >导出</el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-upload-->
<!--          type="file"-->
<!--          name="file"-->
<!--          ref="upload"-->
<!--          :before-upload="handleFileChange"-->
<!--          action=''-->
<!--          :limit="1"-->
<!--          :file-list="fileList"-->
<!--        >-->
<!--          <el-button  plain size="mini" icon="el-icon-upload2" type="primary">导入</el-button>-->

<!--        </el-upload>-->
<!--      </el-col>-->
<!--      &lt;!&ndash;      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>&ndash;&gt;-->
<!--    </el-row>-->
<!--    &lt;!&ndash; luckysheet容器 &ndash;&gt;-->
<!--    &lt;!&ndash;    <div id="luckysheetContainer"></div>&ndash;&gt;-->
<!--    <div-->
<!--      id="luckysheet"-->
<!--      style="margin: 0px; padding: 0px; position: absolute; width: 100%;height: 800px; left: 0px; top: 110px; bottom: 0px; z-index: 0"-->
<!--    >-->
<!--    </div>-->
<!--    &lt;!&ndash; 用户添加或修改我的Excel表格的弹框 &ndash;&gt;-->
<!--    <el-dialog-->
<!--      title="是否确认保存?"-->
<!--      :visible.sync="dialogVisible"-->
<!--      width="30%"-->
<!--      style="z-index: 1; "-->
<!--      :before-close="handleClose">-->
<!--      <el-form  label-width="80px" @submit.native.prevent>-->
<!--        <el-form-item label="名称" >-->
<!--          &lt;!&ndash;  onkeypress="if (event.keyCode == 13) return false" //关闭enter的触发事件  &ndash;&gt;-->
<!--          <el-input v-model="from_name"-->
<!--                    @keyup.enter.native="handleEnter"-->
<!--                    placeholder="请输入名称" />-->
<!--        </el-form-item>-->
<!--      </el-form>-->
<!--      <span slot="footer" class="dialog-footer">-->
<!--    <el-button @click="dialogVisible = false">取 消</el-button>-->
<!--    <el-button type="primary" @click="submit_from">确 定</el-button>-->
<!--  </span>-->
<!--    </el-dialog>-->
<!--  </div>-->
<!--</template>-->

<!--<script>-->
<!--  import $ from 'jquery'-->
<!--  /*安装插件 npm install xlsx,安装完成后引入 import XLSX from ‘xlsx’*/-->
<!--  import XLSX from 'xlsx'-->
<!--  import {addMyluckyexcel, getMyluckyexcel, listMyluckyexcel} from "@/api/ruoyi-myLuckyexcel/myluckyexcel";-->

<!--  import luckysheet from 'luckysheet'-->
<!--  import LuckyExcel from 'luckyexcel'-->
<!--  //导入库export.js 这个文件是es6的,不能在普通的HTML文件直接引入js文件(虽然都是js文件,但是有区别,具体请百度es6与es5)!需要把es6转es5才可以直接引入使用!-->
<!--  import { exportExcel } from '../../../../public/luckysheet/exportExcel'-->
<!--  export default {-->
<!--    name: "Mymodule",-->
<!--    data() {-->
<!--      return {-->
<!--        //弹出页面的表名-->
<!--        from_name : "",-->
<!--        // 是否显示弹出层-->
<!--        dialogVisible : false,-->
<!--        selectedOption:'',-->
<!--        luckysheetData: '',-->
<!--        fileList:[],-->
<!--        depss:[],-->
<!--        // 表单参数-->
<!--        form: {},-->
<!--        // 查询参数-->
<!--        queryParams: {-->
<!--          pageNum: 1,-->
<!--          pageSize: 10,-->
<!--          name: null,-->
<!--          content: null-->
<!--        },-->
<!--      };-->
<!--    },-->
<!--    created() {-->
<!--//刷新页面时进行的操作-->

<!--      this.getList();-->
<!--    },-->
<!--    mounted() {-->

<!--      this.init();-->
<!--    },-->
<!--    methods:{-->
<!--      /** 页面刷新时展示的数据*/-->
<!--      getList() {-->
<!--        listMyluckyexcel(this.queryParams).then(response => {-->
<!--          this.depss = response.rows;-->
<!--        });-->
<!--      },-->
<!--      /** 下拉选和页面luckysheet绑定 */-->
<!--      handleOptionChange() {-->
<!--        //根据选中的下拉选项值获取相应的信息-->
<!--        getMyluckyexcel(this.selectedOption).then(response => {-->

<!--          const sysSupplies = response.data;-->

<!--          this.luckysheetData = sysSupplies.jsons;-->
<!--          //将接收到的json存到json_data中-->
<!--          //const json_data = response.data;-->
<!--          let json_data = JSON.parse(sysSupplies.jsons);-->
<!--          let filename= sysSupplies.name;-->

<!--          luckysheet.create({-->
<!--            container: "luckysheet", // Luckysheet 的容器元素 ID-->
<!--            title: filename, // Excel 文件名-->
<!--            data: json_data, // Excel 数据-->
<!--            showinfobar: false, //是否显示顶部名称栏-->
<!--            lang:'zh',-->
<!--          });-->

<!--        }).catch(() => {-->
<!--          // 处理错误逻辑,这里是一个空的错误处理函数-->
<!--          this.$message.error('暂停失败,发生未知错误!');-->
<!--        });-->
<!--      },-->
<!--      /** 导出设置 */-->
<!--      handleExport(){-->
<!--        var date =new Date().getTime();-->
<!--        exportExcel(luckysheet.getAllSheets(), '导出'+date)-->
<!--      },-->
<!--      /** 弹出的确认框关闭 */-->
<!--      handleClose(done) {-->
<!--        this.$confirm('确认关闭?')-->
<!--          .then(_ => {-->
<!--            done();-->
<!--          })-->
<!--          .catch(_ => {});-->
<!--      },-->
<!--      /** 回车事件和保存提交绑定 */-->
<!--      handleEnter(event) {-->
<!--        if (event.keyCode === 13) {-->
<!--          event.preventDefault(); // 阻止默认的回车事件-->
<!--          // 触发确定操作-->
<!--          this.submit_from();-->
<!--        }-->
<!--      },-->
<!--      /** 保存到数据库*/-->
<!--      submit_from() {-->
<!--        const name = this.from_name-->
<!--        if(name!=""){-->
<!--          let objsheet = luckysheet.getAllSheets() // 得到表的数据-->
<!--          //LuckyExcel = objsheet // 将表的数据保存本地-->
<!--          let strsheet = JSON.stringify(objsheet)// 对象转化为字符串-->
<!--          const  data={name :name,jsons:strsheet};-->
<!--          addMyluckyexcel(data).then(response => {-->
<!--            if(response.code==200){-->
<!--              this.$message({-->
<!--                message: '保存成功', type: 'success'-->
<!--              });-->
<!--              this.dialogVisible=false;-->
<!--              //this.$router.replace({ path: '/' }); //刷新整个页面会出错-->
<!--              //window.location.reload();//也是全局刷新,不合适-->
<!--              this.$router.go(-1);-->
<!--            }else{-->
<!--              this.$message.error('保存失败');-->
<!--            }-->
<!--          });-->
<!--        }else{-->
<!--          this.$message.error('请输入表格名称后再进行保存!');-->
<!--        }-->

<!--      },-->
<!--      /* 重置按钮操作 */-->
<!--      resetQuery() {-->
<!--        luckysheet.destroy()-->
<!--        let options = {-->
<!--          container: 'luckysheet', //luckysheet为容器id-->
<!--          title:'',-->
<!--          lang:'zh',-->
<!--          showinfobar:false,-->
<!--          data:[-->
<!--            {-->
<!--              "name": "sheet1", //工作表名称-->
<!--              "color": "", //工作表颜色-->
<!--              "index": 0, //工作表索引-->
<!--              "status": 1, //激活状态-->
<!--              "order": 0, //工作表的下标-->
<!--              "hide": 0,//是否隐藏-->
<!--              "row": 20, //行数-->
<!--              "column": 15, //列数-->
<!--              "defaultRowHeight": 19, //自定义行高-->
<!--              "defaultColWidth": 73, //自定义列宽-->
<!--              "celldata": [-->


<!--              ], //初始化使用的单元格数据-->
<!--              "config": {-->
<!--                "merge": {-->
<!--                }, //合并单元格-->
<!--                "rowlen":{}, //表格行高-->
<!--                "columnlen":{}, //表格列宽-->
<!--                "rowhidden":{}, //隐藏行-->
<!--                "colhidden":{}, //隐藏列-->
<!--                "borderInfo":{-->

<!--                }, //边框-->
<!--                "authority":{}, //工作表保护-->

<!--              },-->
<!--            },-->
<!--            /*{-->
<!--              "name": "Sheet2",-->
<!--              "color": "",-->
<!--              "index": 1,-->
<!--              "status": 0,-->
<!--              "order": 1,-->
<!--              "celldata": [],-->
<!--              "config": {}-->
<!--            },-->
<!--            {-->
<!--              "name": "Sheet3",-->
<!--              "color": "",-->
<!--              "index": 2,-->
<!--              "status": 0,-->
<!--              "order": 2,-->
<!--              "celldata": [],-->
<!--              "config": {},-->
<!--            }*/-->
<!--          ]-->

<!--        }-->
<!--        luckysheet.create(options)-->
<!--      },-->
<!--      /*// 表单重置-->
<!--      reset() {-->
<!--        this.form = {-->
<!--          id: null,-->
<!--          name: null,-->
<!--          description: null-->
<!--        };-->
<!--        this.resetForm("form");-->
<!--      },-->
<!--      /!** 搜索按钮操作 *!/-->
<!--      handleQuery() {-->
<!--        this.queryParams.pageNum = 1;-->
<!--        this.getList();-->
<!--      },-->

<!--      // 多选框选中数据-->
<!--      handleSelectionChange(selection) {-->
<!--        this.ids = selection.map(item => item.id)-->
<!--        this.single = selection.length!==1-->
<!--        this.multiple = !selection.length-->
<!--      },-->
<!--      /!** 导出按钮操作 *!/-->
<!--      handleExport() {-->
<!--        this.download('ruoyi-mymodule/mymodule/export', {-->
<!--          ...this.queryParams-->
<!--        }, `mymodule_${new Date().getTime()}.xlsx`)-->
<!--      },*/-->
<!--      /** Luckyexcel文档 */-->
<!--      init() {-->
<!--        let options = {-->
<!--          container: 'luckysheet', //luckysheet为容器id-->
<!--          title:'',-->
<!--          lang:'zh',-->
<!--          showinfobar:false,-->
<!--          data:[-->
<!--            {-->
<!--              "name": "sheet1", //工作表名称-->
<!--              "color": "", //工作表颜色-->
<!--              "index": 0, //工作表索引-->
<!--              "status": 1, //激活状态-->
<!--              "order": 0, //工作表的下标-->
<!--              "hide": 0,//是否隐藏-->
<!--              "row": 20, //行数-->
<!--              "column": 15, //列数-->
<!--              "defaultRowHeight": 19, //自定义行高-->
<!--              "defaultColWidth": 73, //自定义列宽-->
<!--              "celldata": [-->


<!--              ], //初始化使用的单元格数据-->
<!--              "config": {-->
<!--                "merge": {-->
<!--                }, //合并单元格-->
<!--                "rowlen":{}, //表格行高-->
<!--                "columnlen":{}, //表格列宽-->
<!--                "rowhidden":{}, //隐藏行-->
<!--                "colhidden":{}, //隐藏列-->
<!--                "borderInfo":{-->

<!--                }, //边框-->
<!--                "authority":{}, //工作表保护-->

<!--              },-->
<!--            },-->
<!--            /*{-->
<!--              "name": "Sheet2",-->
<!--              "color": "",-->
<!--              "index": 1,-->
<!--              "status": 0,-->
<!--              "order": 1,-->
<!--              "celldata": [],-->
<!--              "config": {}-->
<!--            },-->
<!--            {-->
<!--              "name": "Sheet3",-->
<!--              "color": "",-->
<!--              "index": 2,-->
<!--              "status": 0,-->
<!--              "order": 2,-->
<!--              "celldata": [],-->
<!--              "config": {},-->
<!--            }*/-->
<!--          ]-->

<!--        }-->
<!--        luckysheet.create(options)-->

<!--      },-->
<!--      Excel(e) {-->
<!--        let that = this-->
<!--        // 错误情况判断-->
<!--        const files = e.target.files-->
<!--        if (files.length <= 0) {-->
<!--          return false;-->
<!--        } else if (!/\.(xls|xlsx)$/.test(files[0].name.toLowerCase())) {-->
<!--          this.$message({-->
<!--            message: "上传格式不正确,请上传xls或者xlsx格式",-->
<!--            type: "warning"-->
<!--          });-->
<!--          return false-->
<!--        } else {-->
<!--          that.upload_file = files[0].name-->
<!--        }-->
<!--        // 读取表格-->
<!--        const fileReader = new FileReader()-->
<!--        fileReader.onload = ev => {-->
<!--          try {-->
<!--            const data = ev.target.result;-->
<!--            const workbook = XLSX.read(data, {-->
<!--              type: "binary"-->
<!--            })-->
<!--            // 读取第一张表-->
<!--            const wsname = workbook.SheetNames[0]-->
<!--            const ws = XLSX.utils.sheet_to_json(workbook.Sheets[wsname])-->
<!--            // 打印 ws 就可以看到读取出的表格数据-->
<!--            console.log(ws)-->
<!--            // 定义一个新数组,存放处理后的表格数据-->
<!--            that.lists = []-->
<!--            ws.forEach(item => {-->
<!--              that.lists.push({-->
<!--                // 对ws进行处理后放进lists内-->
<!--              })-->
<!--            })-->
<!--            // 调用方法将lists数组发送给后端-->
<!--            this.submit_form(that.lists)-->
<!--          } catch (e) {-->
<!--            return false-->
<!--          }-->
<!--        }-->
<!--        fileReader.readAsBinaryString(files[0])-->
<!--      },-->
<!--      /** 导入事件*/-->
<!--      handleFileChange(evt) {-->
<!--        let name = evt.name-->
<!--        let suffixArr = name.split('.'),-->
<!--          suffix = suffixArr[suffixArr.length - 1]-->
<!--        if (suffix != 'xlsx') {-->
<!--          alert('当前仅支持导入xlsx文件')-->
<!--          return-->
<!--        }-->
<!--        LuckyExcel.transformExcelToLucky(-->
<!--          evt,-->
<!--          function(exportJson, luckysheetfile) {-->


<!--            if (exportJson.sheets == null || exportJson.sheets.length == 0) {-->
<!--              alert(-->
<!--                '无法读取excel文件的内容,目前不支持xls文件!'-->
<!--              )-->
<!--              return-->
<!--            }-->

<!--            luckysheet.destroy()-->

<!--            luckysheet.create({-->
<!--              container: 'luckysheet', //luckysheet is the container id-->
<!--              title: exportJson.info.name,-->
<!--              lang: 'zh', // 设定表格语言-->
<!--              showinfobar: false,-->
<!--              data: exportJson.sheets,-->
<!--              userInfo: exportJson.info.name.creator-->
<!--            })-->
<!--          }-->
<!--        )-->
<!--      },-->
<!--    }-->
<!--// 配置项-->

<!--  };-->
<!--</script>-->