@smart100/spu-web-plugin 0.0.12 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,3 +4,12 @@
4
4
 
5
5
  ## 文档
6
6
  [@smart100/spu-web-plugin](https://tarymee.github.io/spu-web-plugin/)
7
+
8
+
9
+ ## 发布
10
+
11
+ + 修改代码
12
+ + 修改 package.json 版本号
13
+ + 执行 npm i 同步版本号到 package-lock.json 文件
14
+ + 执行 npm run build 构建打包文件到 dist 目录
15
+ + 执行 npm publish
@@ -1,4 +1,4 @@
1
- var version = "0.0.12";
1
+ var version = "0.0.14";
2
2
 
3
3
  function ownKeys(e, r) {
4
4
  var t = Object.keys(e);
@@ -43551,8 +43551,17 @@ var getAttributes = function getAttributes(ele) {
43551
43551
  return attrs;
43552
43552
  };
43553
43553
 
43554
+ var img$3 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAxlBMVEUAAAA8wVJRx2RGw1pax2pqzXhky3OC1o9qy3iG1ZB81IiC1Y0+wVNqy3Zoy3Y7wlI9wlJVxmlAv1BpzHZozXhAv1BDw1hAwlVIxFxLxV9ZyGpXyGhVx2dbyWyU2Z5NxWA+wlRgym9Tx2ViynFdyW1Fw1pmy3RPxmJRxmT///9ny3ZGxFppzHdky3NQxmM9wVKR2JuG1ZLT8dfy+/Si4at71In6/vr6/vvq+Ozk9uew5bje9eK46MDB68es5bWP25zH7c1pzHiJwsQ3AAAAFnRSTlMAgEBAQH9A/n9qVmDwf39wWC0g72AQ9ie3zwAAAYtJREFUSMe90elOwkAUBeAq0LqgLCq0LGUXDgKW0rIv+v4v5Q0Q504zk05i4jm53DKTL/1R6xI795y7yz3RSPve0uR1ok6gEy/jibKBRthjTQJfLex3TQJfCENA4lEBppoQUAq71+tNe5TkJsAEB3SvGAJqYXfoWjEEruIhCTQhIIQZUAu73+/0VTP31SLb1+Q74IKDpqadeP4bpyRA0yhZBmomZaBmFA7qJmWgbhQOGiYV4LZhlFsGuqL+dutcnrbbiH5FGeiyOCvszg8hEPELCYxY98CedgSE7JTKwEjKDitnNFpgLR9zMJPiLLCZhVj5MzkMDOUcgRA4DBPhoCU3BLChLZeBVjIrIE6eScCTewAQ0pbLgCfntMQaiLxE9GCNhbfBItaCjOu551x2iGXkxkuErnyeYYAnAr5oHYE9P9YD+sTu9UWxDnwMRHdYns5PMX1w2qIM0L9B+vA3VAaV9GGgYpL/BVWj/AGUqm2TCmDl2+32Z9rk3wQo5uksrUWLpVy4SUmhbJ3zA7AU1w7QNm3yAAAAAElFTkSuQmCC";
43555
+
43556
+ var img$2 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAvVBMVEUAAAAahf8ji/8wlf89nv9ms/85nv84m/83nP9lsf8ahf8wk/86ov9ns/8chv86nf9ksP9Xqf9lsf8chv88nv8ggP8uk/8giv8diP8rkf8jjP8bhv8ylv8mjv81mf91uv8oj/8wlf85nP84m/82mv////88nf96uv9ksf9hrf/O5v/H4v+z2P/X6v/y+f/s9f/k8f/5/P9Bn/+93f/e7v+n0f+czP+ayv+Nw//l8v+93P9lr/+83P9yuP9Xqv9BYQ4kAAAAFnRSTlMAgEBAP+E/QBzyZTAW9PDf3OjcwEQQ8VTcBgAAAY5JREFUSMe9zQ1TgkAQBmArS1OzbxT1BNST7o5vUEir//+zWjoGTzniZmp8d5aFvXuGVpH2Tbtd6ZdWXfr3i8ViXenoqQ7AfVki46HmB8uFtCKjRnSWeeDGyQRgXEvBCo4lDQCEFMizNmpEZ76SFgC5uJrLA4CLgTrguR0oA7m4ms2lBaAU3WNQk8+DuOuqgC9DKgBY/EJlRuStzKMALMua5fX7PAZacwtAszStuUWglLMCXdP15haBUv4ALsvd1n13t3wmjp6xfGezfQWY8GlCOdhlNGT6FlNGMdtjB/axp/NzEfDYOIangwkNYDLPTBKYPi2OqyAOy5eYmNyaGc4kAP0UC1DxtvNx4MAMHUT9YocEgHiYj8rYH2GAkJsgb1dsJGCD7fwqzlyHf0Gn2K4HyPdtZPsBol6KCA1h43kBkoEJLxJgjF0yIS5MbwMbih148hLApAxJCX9J7clpRCDL/4KRSglgpJIzg7FKCWCskvOC6XQ8be7WIcOpQp4F0FO4P+y3hHR7Fw3pvfKb3xOOvDxv0VGJAAAAAElFTkSuQmCC";
43557
+
43558
+ var img$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAqFBMVEUAAADyWlr6eXn1aGj3cnLzX1/5oaH4n5/4np74bGz/hIT/gID5oKDyW1v5d3fyWlr0e3v3kZH4oaHzXFzxWVnvWFj2bGz0YmL0X1/5dXX3bm72aWn1Z2fzXFz4cHD1ZGT5ra3zXl7zW1v4cnL919f0YWH////5d3f+7e34nZ36uLj6t7f+5OT5oqL5fX35enr80dH5lJT/8vL5q6v93Nz80ND7wsL4hYWj0DrhAAAAFnRSTlMAgD9AQEDg8twwGxb08N9gC+jlwHAgxSfCsQAAAW1JREFUSMe9zYlygjAQgGF6V61HL1CMirgsKYf16PH+b9Zd7Ehig4njTP+dJROYb/B+uzTmNdXqpaaW902gN0p50lQ/l1GDaI3MLaMGcd0MotsTAQt38B6ZBYPFyLAMWAz+gIU5BtxT50QQ3XUOwdQ4aWQSDKbmCOxF2wq4bS0e2i5gHZkEgzAMjfu9ftv3qIDQqRpc0c23rQb80Pdpw6On9gffZdQ/uHQWGNPVuhpw6iwgqimBWpXjjM8vegNV/I1HAXTjMiwANlgCAhQohUDJQIjd98M/MMjoxBUg3da4EgjVe8MfuArQEz8JUB+SgKgzggJAYrkDQICTBjATNAw2UkIpAPnOoMizPBKi+q6BXTnm1QnIT1nMEGZKx0FeYHkEBDwM+CRAFdtZQCCoRwGBS/8KbpIkSOyrgGEyHFpXA06dBeYuo4C5SxqYuIwCJk7pILavV9edxHFs22cF9GN73Zan9PpyYak/8Kp+AFR/vMTYdPmnAAAAAElFTkSuQmCC";
43559
+
43560
+ var img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAtFBMVEUAAAD/sx3/yVz/ujD/vjz/wUf/25P/tiX/0ID/xVL/14b/tB//tzH/x1j/tB7/yV3/sx7/yVz/yVv/1X//yF//yV7/uCv/tyb/ui7/uzL/357/vDb/vz//tSP/tCD/wUX/vjv/wEL/wkn/////xU//yFn/x1b/vTj/xlP/yVz/xEz/2In/sx7/787/5rP/5K3//PX/9eD/8ND/6sD/0HD/y2T/8tf/7Mf/3Jb/25P/1YH/2pAYG69eAAAAFnRSTlMAgH9AQED4QCZAJvAgQHBXUO/v7IMTAWGuxQAAAVxJREFUSMe9z2tvgjAUgGE2dc7hbTenVVEsVzsQGMzL/v//Gl2hbUJPaEKy9+Qk9MMTWoM1nt0rensygGbPobIHSLy4oWpCBIiJqy5ElWgCTzUlAMTE413jmPCDi6h4bIKRF3ge2y+MT/V3CQAxClhXhFD5h6COAiYAkGL8E0h5CBAjhxWfzxdCcqeuAkIIwKNv4IcACaEERZ6f0hRJABCDI6t8AznKXZRCgO8kIa4bCJAjtRgcePQNB1FxI7zXdxAADSSw+xt6Jcc5sFNzJLBj0Ufv4JogLIo4y4gGsHkZxsgGEqBvs05RlOiBjb3ZlJthGqLfqu1LgBVVAKgL2LMqsAfqBHw6HPjqkYDPqoAPJIE16xbRwjWQAL21Vj0JrHRGAiudOoGlVt3AYtm6Mlho1QEM9cBQgA+t/hVsteoCLGtrte/Y4JmWRqYhmpvWZ9uYc0NqPL1raVpd6BfZWcm10dJwMwAAAABJRU5ErkJggg==";
43561
+
43562
+ // console.log(icon_csv)
43554
43563
  var renderTemplate = (function (ele) {
43555
- return "\n<style>\n:host {\n display: block;\n width: 100%;\n height: 100%;\n position: fixed;\n top: 0;\n left: 0px;\n right: 0px;\n bottom: 0px;\n}\n\n.hide {\n display: none!important;\n}\n\n.spu-expandexp {\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n overflow: auto;\n}\n\n\n\n\n.modal {\n width: 80%;\n max-width: 800px;\n min-width: 500px;\n margin: 50px auto 0;\n border-radius: 2px;\n overflow: hidden;\n}\n.modal-th {\n height: 40px;\n background-color: #409eff;\n}\n.modal-th .title {\n float: left;\n line-height: 40px;\n color: #fff;\n font-size: 16px;\n margin-left: 16px;\n}\n.modal-th .close {\n float: right;\n line-height: 40px;\n height: 40px;\n width: 40px;\n color: #fff;\n font-size: 16px;\n text-align: center;\n cursor: pointer;\n}\n.modal-tb {\n padding: 16px;\n background-color: #fff;\n}\n\n.export {}\n.export-wait {\n line-height: 32px;\n height: 32px;\n text-align: center;\n background-color: rgba(255, 73, 73, .1);\n color: #333;\n}\n.export-wait span {\n color: red;\n margin: 0 4px;\n}\n.export-tit {\n line-height: 32px;\n height: 32px;\n}\n\n.export-sel {\n margin-bottom: 12px;\n}\n.export-sel-title {\n margin-bottom: 12px;\n}\n.export-sel-con {\n display: flex;\n}\n.export-sel-con-item {\n display: flex;\n align-items: center;\n margin-right: 32px;\n cursor: pointer;\n}\n.export-sel-con-item label {\n font-size: 14px;\n font-weight: bold;\n cursor: pointer;\n}\n.export-sel-con-item input {\n cursor: pointer;\n margin: 4px;\n}\n\n.export-section-wrap {}\n.export-section {\n border: 1px solid #ddd;\n padding: 12px;\n}\n\n.export-file {\n height: 28px;\n line-height: 28px;\n display: flex;\n justify-content: space-between;\n // margin-bottom: 12px;\n}\n.export-file-l {\n flex: 1;\n display: flex;\n}\n.export-file-l img {\n flex: none;\n display: block;\n height: 28px;\n width: 28px;\n margin-right: 4px;\n}\n.export-file-l-filename {\n flex: 1;\n}\n.export-file-l-filesize {\n flex: none;\n}\n.export-file-r {\n display: flex;\n width: 80px;\n flex-direction: row-reverse;\n}\n.export-file-r-download {\n line-height: 26px;\n border-radius: 3px;\n background-color: #67c23a;\n border: 1px solid #67c23a;\n color: #fff;\n padding: 0 12px;\n font-size: 14px;\n cursor: pointer;\n}\n.export-file-r-download:hover {\n background: #85ce61;\n border-color: #85ce61;\n}\n.export-file-r-cancel {\n line-height: 26px;\n width: 26px;\n border-radius: 14px;\n color: #f56c6c;\n background: #fef0f0;\n border: 1px solid #fbc4c4;\n text-align: center;\n font-size: 14px;\n cursor: pointer;\n}\n.export-file-r-cancel:hover {\n background: #f56c6c;\n border-color: #f56c6c;\n color: #fff;\n}\n\n\n\n.export-progress {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 30px;\n}\n.export-progress-outer {\n flex: 1;\n height: 8px;\n background-color: #EBEEF5;\n overflow: hidden;\n position: relative;\n vertical-align: middle;\n}\n.export-progress-inner {\n animation-duration: 3s;\n height: 100%;\n width: 0;\n background-color: #417AE7;\n -webkit-transition: width .6s ease;\n transition: width .6s ease;\n}\n.export-progress-inner.error {\n background: red;\n}\n.export-progress-inner.success {\n background: #67C23A;\n}\n.export-progress-text {\n flex: none;\n width: 50px;\n font-size: 14px;\n line-height: 30px;\n text-align: right;\n}\n\n\n\n.export-result {\n height: 28px;\n line-height: 28px;\n text-align: right;\n font-size: 12px;\n padding: 0px 8px;\n}\n.export-result.error {\n background: #fdf1ef;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.export-result.success {\n background: #e5f7f3;\n}\n\n\n.export-tip {\n height: 28px;\n line-height: 28px;\n margin-top: 8px;\n font-size: 12px;\n text-align: right;\n color: #999;\n}\n\n.export-btnwrap {\n margin-top: 12px;\n display: flex;\n flex-direction: row-reverse;\n}\n.btn {\n line-height: 38px;\n line-height: 38px;\n border: 1px solid #409eff;\n background-color: #409eff;\n border-radius: 5px;\n color: #fff;\n padding: 0 20px;\n font-size: 16px;\n cursor: pointer;\n}\n.btn:hover {\n background: #66b1ff;\n border-color: #66b1ff;\n}\n</style>\n\n <div class=\"spu-expandexp\">\n <div class=\"modal\">\n <div class=\"modal-th\">\n <div class=\"title\">\n \u6570\u636E\u5BFC\u51FA\n </div>\n <div class=\"close\">\n x\n </div>\n </div>\n <div class=\"modal-tb\">\n <div class=\"export\">\n <div class=\"export-wait hide\">\n \u5BFC\u51FA\u7B49\u5F85\u961F\u5217\u4E2D\uFF1A\u8FD8\u6709<span></span>\u4F4D\uFF0C\u8BF7\u8010\u5FC3\u7A0D\u7B49...\n </div>\n\n <div class=\"export-sel hide\">\n <div class=\"export-sel-title\">\u8BF7\u9009\u62E9\u5BFC\u51FA\u5185\u5BB9</div>\n <div class=\"export-sel-con\"></div>\n </div>\n\n <div class=\"export-section-wrap hide\">\n <div class=\"export-tit\"></div>\n <div class=\"export-section\">\n <div class=\"export-file\">\n <div class=\"export-file-l\">\n <img src=\"\" class=\"hide\" />\n <span class=\"export-file-l-filename\"></span>\n <span class=\"export-file-l-filesize\"></span>\n </div>\n <div class=\"export-file-r\">\n <div class=\"export-file-r-download hide\">\u4E0B\u8F7D</div>\n <div class=\"export-file-r-cancel hide\">x</div>\n </div>\n </div>\n\n <div class=\"export-progress\">\n <div class=\"export-progress-outer\">\n <div class=\"export-progress-inner\"></div>\n </div>\n <div class=\"export-progress-text\"></div>\n </div>\n\n <div class=\"export-result hide\"></div>\n\n <div class=\"export-tip hide\">\u60A8\u53EF\u4EE5\u968F\u65F6\u5173\u95ED\u8BE5\u5F39\u6846\uFF0C\u4E4B\u540E\u5728\u5BFC\u5165\u5BFC\u51FA\u5217\u8868\u4E2D\u67E5\u770B\u7ED3\u679C\u3002</div>\n </div>\n </div>\n\n <div class=\"export-btnwrap\">\n <div class=\"btn\">\u5BFC\u51FA</div>\n </div>\n\n </div>\n </div>\n </div>\n </div>\n ";
43564
+ return "\n<style>\n:host {\n display: block;\n width: 100%;\n height: 100%;\n position: fixed;\n top: 0;\n left: 0px;\n right: 0px;\n bottom: 0px;\n z-index: 9000;\n}\n\n.hide {\n display: none!important;\n}\n\n.spu-expandexp {\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n overflow: auto;\n}\n\n\n.modal {\n width: 80%;\n max-width: 800px;\n min-width: 500px;\n margin: 50px auto 0;\n border-radius: 2px;\n overflow: hidden;\n}\n.modal-th {\n height: 40px;\n background-color: #409eff;\n}\n.modal-th .title {\n float: left;\n line-height: 40px;\n color: #fff;\n font-size: 16px;\n margin-left: 16px;\n}\n.modal-th .close {\n float: right;\n line-height: 40px;\n height: 40px;\n width: 40px;\n color: #fff;\n font-size: 16px;\n text-align: center;\n cursor: pointer;\n}\n.modal-tb {\n padding: 16px;\n background-color: #fff;\n}\n\n.export {}\n.export-wait {\n line-height: 32px;\n height: 32px;\n text-align: center;\n background-color: rgba(255, 73, 73, .1);\n color: #333;\n}\n.export-wait span {\n color: red;\n margin: 0 4px;\n}\n.export-tit {\n line-height: 32px;\n height: 32px;\n}\n\n.export-sel {\n margin-bottom: 12px;\n}\n.export-sel-title {\n margin-bottom: 12px;\n}\n.export-sel-con {\n display: flex;\n}\n.export-sel-con-item {\n display: flex;\n align-items: center;\n margin-right: 32px;\n cursor: pointer;\n}\n.export-sel-con-item label {\n font-size: 14px;\n font-weight: bold;\n cursor: pointer;\n}\n.export-sel-con-item input {\n cursor: pointer;\n margin: 4px;\n}\n\n.export-section-wrap {}\n.export-section {\n border: 1px solid #ddd;\n padding: 12px;\n}\n\n.export-file {\n height: 28px;\n line-height: 28px;\n display: flex;\n justify-content: space-between;\n // margin-bottom: 12px;\n}\n.export-file-l {\n flex: 1;\n display: flex;\n align-items: center;\n font-size: 14px;\n}\n.export-file-l-img {\n flex: none;\n display: block;\n height: 20px;\n width: 20px;\n margin-right: 4px;\n background-size: cover;\n background-position: center center;\n background-repeat: no-repeat;\n}\n.export-file-l-img.excel {\n background-image: url(".concat(img$3, ");\n}\n.export-file-l-img.csv {\n background-image: url(").concat(img$2, ");\n}\n.export-file-l-img.pdf {\n background-image: url(").concat(img$1, ");\n}\n.export-file-l-img.zip {\n background-image: url(").concat(img, ");\n}\n.export-file-l-filename {\n flex: 1;\n}\n.export-file-l-filesize {\n flex: none;\n}\n.export-file-r {\n display: flex;\n width: 80px;\n flex-direction: row-reverse;\n}\n.export-file-r-download {\n line-height: 26px;\n border-radius: 3px;\n background-color: #67c23a;\n border: 1px solid #67c23a;\n color: #fff;\n padding: 0 12px;\n font-size: 14px;\n cursor: pointer;\n}\n.export-file-r-download:hover {\n background: #85ce61;\n border-color: #85ce61;\n}\n.export-file-r-cancel {\n line-height: 26px;\n width: 26px;\n border-radius: 14px;\n color: #f56c6c;\n background: #fef0f0;\n border: 1px solid #fbc4c4;\n text-align: center;\n font-size: 14px;\n cursor: pointer;\n}\n.export-file-r-cancel:hover {\n background: #f56c6c;\n border-color: #f56c6c;\n color: #fff;\n}\n\n\n\n.export-progress {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 30px;\n}\n.export-progress-outer {\n flex: 1;\n height: 8px;\n background-color: #EBEEF5;\n overflow: hidden;\n position: relative;\n vertical-align: middle;\n}\n.export-progress-inner {\n animation-duration: 3s;\n height: 100%;\n width: 0;\n background-color: #417AE7;\n -webkit-transition: width .6s ease;\n transition: width .6s ease;\n}\n.export-progress-inner.error {\n background: red;\n}\n.export-progress-inner.success {\n background: #67C23A;\n}\n.export-progress-text {\n flex: none;\n width: 50px;\n font-size: 14px;\n line-height: 30px;\n text-align: right;\n}\n\n\n\n.export-result {\n height: 28px;\n line-height: 28px;\n text-align: right;\n font-size: 12px;\n padding: 0px 8px;\n}\n.export-result.error {\n background: #fdf1ef;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.export-result.success {\n background: #e5f7f3;\n}\n\n\n.export-tip {\n height: 28px;\n line-height: 28px;\n margin-top: 8px;\n font-size: 12px;\n text-align: right;\n color: #999;\n}\n\n.export-btnwrap {\n margin-top: 12px;\n display: flex;\n flex-direction: row-reverse;\n}\n.btn {\n line-height: 38px;\n line-height: 38px;\n border: 1px solid #409eff;\n background-color: #409eff;\n border-radius: 5px;\n color: #fff;\n padding: 0 20px;\n font-size: 16px;\n cursor: pointer;\n}\n.btn:hover {\n background: #66b1ff;\n border-color: #66b1ff;\n}\n</style>\n\n <div class=\"spu-expandexp\">\n <div class=\"modal\">\n <div class=\"modal-th\">\n <div class=\"title\">\n \u6570\u636E\u5BFC\u51FA\n </div>\n <div class=\"close\">\n x\n </div>\n </div>\n <div class=\"modal-tb\">\n <div class=\"export\">\n <div class=\"export-wait hide\">\n \u5BFC\u51FA\u7B49\u5F85\u961F\u5217\u4E2D\uFF1A\u8FD8\u6709<span></span>\u4F4D\uFF0C\u8BF7\u8010\u5FC3\u7A0D\u7B49...\n </div>\n\n <div class=\"export-sel hide\">\n <div class=\"export-sel-title\">\u8BF7\u9009\u62E9\u5BFC\u51FA\u5185\u5BB9</div>\n <div class=\"export-sel-con\"></div>\n </div>\n\n <div class=\"export-section-wrap hide\">\n <div class=\"export-tit\"></div>\n <div class=\"export-section\">\n <div class=\"export-file\">\n <div class=\"export-file-l\">\n <div class=\"export-file-l-img\"></div>\n <span class=\"export-file-l-filename\"></span>\n <span class=\"export-file-l-filesize\"></span>\n </div>\n <div class=\"export-file-r\">\n <div class=\"export-file-r-download hide\">\u4E0B\u8F7D</div>\n <div class=\"export-file-r-cancel hide\">x</div>\n </div>\n </div>\n\n <div class=\"export-progress\">\n <div class=\"export-progress-outer\">\n <div class=\"export-progress-inner\"></div>\n </div>\n <div class=\"export-progress-text\"></div>\n </div>\n\n <div class=\"export-result hide\"></div>\n\n <div class=\"export-tip hide\">\u60A8\u53EF\u4EE5\u968F\u65F6\u5173\u95ED\u8BE5\u5F39\u6846\uFF0C\u4E4B\u540E\u5728\u5BFC\u5165\u5BFC\u51FA\u5217\u8868\u4E2D\u67E5\u770B\u7ED3\u679C\u3002</div>\n </div>\n </div>\n\n <div class=\"export-btnwrap\">\n <div class=\"btn\">\u5BFC\u51FA</div>\n </div>\n\n </div>\n </div>\n </div>\n </div>\n ");
43556
43565
  });
43557
43566
 
43558
43567
  var Step = /*#__PURE__*/function () {
@@ -43742,6 +43751,7 @@ var SpuExpandexp = /*#__PURE__*/function (_HTMLElement) {
43742
43751
  var $exportTip = _this2.shadow.querySelector('.export-tip');
43743
43752
  var $exportTit = _this2.shadow.querySelector('.export-tit');
43744
43753
  var $exportResult = _this2.shadow.querySelector('.export-result');
43754
+ var $fileimg = _this2.shadow.querySelector('.export-file-l-img');
43745
43755
  var $filename = _this2.shadow.querySelector('.export-file-l-filename');
43746
43756
  var $filesize = _this2.shadow.querySelector('.export-file-l-filesize');
43747
43757
  var $wait = _this2.shadow.querySelector('.export-wait');
@@ -43813,7 +43823,15 @@ var SpuExpandexp = /*#__PURE__*/function (_HTMLElement) {
43813
43823
  $exportResult.classList.add('error');
43814
43824
  } else {
43815
43825
  $exportResult.classList.remove('success');
43816
- $exportResult.classList.remove('success');
43826
+ }
43827
+ }
43828
+ if (key === 'exportcontent') {
43829
+ if (exportcontent === 'link') {
43830
+ $fileimg.classList.add('zip');
43831
+ $fileimg.classList.remove('excel');
43832
+ } else {
43833
+ $fileimg.classList.add('excel');
43834
+ $fileimg.classList.remove('zip');
43817
43835
  }
43818
43836
  }
43819
43837
  if (key === 'fileName' || key === 'filetype' || key === 'exportcontent') {
@@ -43977,8 +43995,6 @@ var SpuExpandexp = /*#__PURE__*/function (_HTMLElement) {
43977
43995
  }
43978
43996
  });
43979
43997
  } else {
43980
- this.data.filewatermark = '0';
43981
- this.data.iscompress = '0';
43982
43998
  apaasAxios.post('/api/expandexp/global/searchExpGloConfig', {
43983
43999
  key: 'export-config-switch',
43984
44000
  tenantcode: login.getUser('tenantcode'),
@@ -44000,22 +44016,26 @@ var SpuExpandexp = /*#__PURE__*/function (_HTMLElement) {
44000
44016
  if (_this5.data.expandStatus === '1') {
44001
44017
  _this5.data.exportcontentArray = ['excel'];
44002
44018
  _this5.data.exportcontent = 'excel';
44003
- }
44004
- // 获取文件水印开关
44005
- apaasAxios.post('/api/expandexp/global/searchWatermarkConfig', '', {
44006
- isShowLoading: false
44007
- }).then(function (res) {
44008
- var _res$data2;
44009
- if (res.code === 200 && res !== null && res !== void 0 && (_res$data2 = res.data) !== null && _res$data2 !== void 0 && _res$data2.configjson) {
44010
- _this5.data.filewatermarkGlobalConfig = JSON.parse(res.data.configjson).isWatermark === '1' ? '1' : '0';
44011
- } else {
44019
+ _this5.data.filewatermark = '0';
44020
+ _this5.data.iscompress = '0';
44021
+ } else if (_this5.data.expandStatus === '2') {
44022
+ _this5.data.iscompress = '1';
44023
+ // 获取文件水印开关
44024
+ apaasAxios.post('/api/expandexp/global/searchWatermarkConfig', '', {
44025
+ isShowLoading: false
44026
+ }).then(function (res) {
44027
+ var _res$data2;
44028
+ if (res.code === 200 && res !== null && res !== void 0 && (_res$data2 = res.data) !== null && _res$data2 !== void 0 && _res$data2.configjson) {
44029
+ _this5.data.filewatermarkGlobalConfig = JSON.parse(res.data.configjson).isWatermark === '1' ? '1' : '0';
44030
+ } else {
44031
+ _this5.data.filewatermarkGlobalConfig = '0';
44032
+ }
44033
+ })["catch"](function () {
44012
44034
  _this5.data.filewatermarkGlobalConfig = '0';
44013
- }
44014
- })["catch"](function () {
44015
- _this5.data.filewatermarkGlobalConfig = '0';
44016
- })["finally"](function () {
44017
- _this5.data.filewatermark = _this5.data.filewatermarkGlobalConfig === '1' ? '1' : '0';
44018
- });
44035
+ })["finally"](function () {
44036
+ _this5.data.filewatermark = _this5.data.filewatermarkGlobalConfig === '1' ? '1' : '0';
44037
+ });
44038
+ }
44019
44039
  });
44020
44040
  }
44021
44041
  case 5:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smart100/spu-web-plugin",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "rollup -c -w",
@@ -51,7 +51,6 @@ export default class SpuExpandexp extends HTMLElement {
51
51
  imagesizepercolumn: '5',
52
52
  imageheightcm: '2',
53
53
 
54
-
55
54
  expandStatus: '1', // 1普通导出(没有做图片导出服务) 2服务端导出(做了图片导出服务未SPU化) 3安装了图片导出SPU
56
55
  filewatermarkGlobalConfig: '0', // 全局文件水印开关
57
56
  exportcontentArray: ['excel', 'link', 'photo'], // 当 expandStatus = 2 | 3时才显示导出内容给用户选择
@@ -83,6 +82,7 @@ export default class SpuExpandexp extends HTMLElement {
83
82
  const $exportTip = this.shadow.querySelector('.export-tip') as any
84
83
  const $exportTit = this.shadow.querySelector('.export-tit') as any
85
84
  const $exportResult = this.shadow.querySelector('.export-result') as any
85
+ const $fileimg = this.shadow.querySelector('.export-file-l-img') as any
86
86
  const $filename = this.shadow.querySelector('.export-file-l-filename') as any
87
87
  const $filesize = this.shadow.querySelector('.export-file-l-filesize') as any
88
88
  const $wait = this.shadow.querySelector('.export-wait') as any
@@ -173,7 +173,16 @@ export default class SpuExpandexp extends HTMLElement {
173
173
  $exportResult.classList.add('error')
174
174
  } else {
175
175
  $exportResult.classList.remove('success')
176
- $exportResult.classList.remove('success')
176
+ }
177
+ }
178
+
179
+ if (key === 'exportcontent') {
180
+ if (exportcontent === 'link') {
181
+ $fileimg.classList.add('zip')
182
+ $fileimg.classList.remove('excel')
183
+ } else {
184
+ $fileimg.classList.add('excel')
185
+ $fileimg.classList.remove('zip')
177
186
  }
178
187
  }
179
188
 
@@ -332,8 +341,6 @@ export default class SpuExpandexp extends HTMLElement {
332
341
  }
333
342
  })
334
343
  } else {
335
- this.data.filewatermark = '0'
336
- this.data.iscompress = '0'
337
344
  apaasAxios
338
345
  .post('/api/expandexp/global/searchExpGloConfig', {
339
346
  key: 'export-config-switch',
@@ -358,25 +365,29 @@ export default class SpuExpandexp extends HTMLElement {
358
365
  if (this.data.expandStatus === '1') {
359
366
  this.data.exportcontentArray = ['excel']
360
367
  this.data.exportcontent = 'excel'
361
- }
362
-
363
- // 获取文件水印开关
364
- apaasAxios
365
- .post('/api/expandexp/global/searchWatermarkConfig', '', {
366
- isShowLoading: false
367
- })
368
- .then((res: any) => {
369
- if (res.code === 200 && res?.data?.configjson) {
370
- this.data.filewatermarkGlobalConfig = JSON.parse(res.data.configjson).isWatermark === '1' ? '1' : '0'
371
- } else {
368
+ this.data.filewatermark = '0'
369
+ this.data.iscompress = '0'
370
+ } else if (this.data.expandStatus === '2') {
371
+ this.data.iscompress = '1'
372
+
373
+ // 获取文件水印开关
374
+ apaasAxios
375
+ .post('/api/expandexp/global/searchWatermarkConfig', '', {
376
+ isShowLoading: false
377
+ })
378
+ .then((res: any) => {
379
+ if (res.code === 200 && res?.data?.configjson) {
380
+ this.data.filewatermarkGlobalConfig = JSON.parse(res.data.configjson).isWatermark === '1' ? '1' : '0'
381
+ } else {
382
+ this.data.filewatermarkGlobalConfig = '0'
383
+ }
384
+ })
385
+ .catch(() => {
372
386
  this.data.filewatermarkGlobalConfig = '0'
373
- }
374
- })
375
- .catch(() => {
376
- this.data.filewatermarkGlobalConfig = '0'
377
- }).finally(() => {
378
- this.data.filewatermark = this.data.filewatermarkGlobalConfig === '1' ? '1' : '0'
379
- })
387
+ }).finally(() => {
388
+ this.data.filewatermark = this.data.filewatermarkGlobalConfig === '1' ? '1' : '0'
389
+ })
390
+ }
380
391
  })
381
392
  }
382
393
  }
@@ -1,5 +1,12 @@
1
1
  import SpuExpandexp from './index'
2
2
 
3
+ import icon_excel from './icons/icon_excel.png'
4
+ import icon_csv from './icons/icon_csv.png'
5
+ import icon_pdf from './icons/icon_pdf.png'
6
+ import icon_zip from './icons/icon_zip.png'
7
+
8
+ // console.log(icon_csv)
9
+
3
10
  export default (ele: SpuExpandexp) => {
4
11
  return `
5
12
  <style>
@@ -12,6 +19,7 @@ export default (ele: SpuExpandexp) => {
12
19
  left: 0px;
13
20
  right: 0px;
14
21
  bottom: 0px;
22
+ z-index: 9000;
15
23
  }
16
24
 
17
25
  .hide {
@@ -26,8 +34,6 @@ export default (ele: SpuExpandexp) => {
26
34
  }
27
35
 
28
36
 
29
-
30
-
31
37
  .modal {
32
38
  width: 80%;
33
39
  max-width: 800px;
@@ -120,13 +126,30 @@ export default (ele: SpuExpandexp) => {
120
126
  .export-file-l {
121
127
  flex: 1;
122
128
  display: flex;
129
+ align-items: center;
130
+ font-size: 14px;
123
131
  }
124
- .export-file-l img {
132
+ .export-file-l-img {
125
133
  flex: none;
126
134
  display: block;
127
- height: 28px;
128
- width: 28px;
135
+ height: 20px;
136
+ width: 20px;
129
137
  margin-right: 4px;
138
+ background-size: cover;
139
+ background-position: center center;
140
+ background-repeat: no-repeat;
141
+ }
142
+ .export-file-l-img.excel {
143
+ background-image: url(${icon_excel});
144
+ }
145
+ .export-file-l-img.csv {
146
+ background-image: url(${icon_csv});
147
+ }
148
+ .export-file-l-img.pdf {
149
+ background-image: url(${icon_pdf});
150
+ }
151
+ .export-file-l-img.zip {
152
+ background-image: url(${icon_zip});
130
153
  }
131
154
  .export-file-l-filename {
132
155
  flex: 1;
@@ -285,7 +308,7 @@ export default (ele: SpuExpandexp) => {
285
308
  <div class="export-section">
286
309
  <div class="export-file">
287
310
  <div class="export-file-l">
288
- <img src="" class="hide" />
311
+ <div class="export-file-l-img"></div>
289
312
  <span class="export-file-l-filename"></span>
290
313
  <span class="export-file-l-filesize"></span>
291
314
  </div>
@@ -1,820 +0,0 @@
1
- <template>
2
- <div class="spu-export">
3
- <div
4
- v-if="!state.isOldVersionService && state.runningTaskCount > 0"
5
- style="text-align: center; justify-content: center"
6
- class="el-alert el-alert--error is-light"
7
- >
8
- <div class="el-alert__content">
9
- <span
10
- class="el-alert__title"
11
- v-html="
12
- `导出等待队列中:还有<span style='color: #f5222d;'> ${state.runningTaskCount} </span>位,请耐心稍等...`
13
- "
14
- ></span>
15
- </div>
16
- </div>
17
-
18
- <section class="title-container">
19
- <section class="title-tip-container">{{ step.statusText }}</section>
20
- </section>
21
-
22
- <div class="select-container" v-if="config.expandStatus !== '1' && step.statusName === 'initial'">
23
- <section class="title">请选择导出内容</section>
24
- <div>
25
- <el-radio-group class="column-checkbox-group" v-model="extconfigParams.exportcontent">
26
- <el-radio v-for="option in exportcontentOptions" :key="option.value" :label="option.value">{{
27
- option.label
28
- }}</el-radio>
29
- </el-radio-group>
30
- </div>
31
- </div>
32
-
33
- <div class="select-container" v-if="config.expandStatus == '1' && step.statusName === 'initial'">
34
- <section class="title">请选择导出文件类型</section>
35
- <div>
36
- <el-radio-group class="column-checkbox-group" v-model="extconfigParams.filetype">
37
- <el-radio v-for="option in filetypeOptions" :key="option.value" :label="option.value">{{
38
- option.label
39
- }}</el-radio>
40
- </el-radio-group>
41
- </div>
42
- </div>
43
-
44
- <div class="file-container" v-if="step.statusName !== 'initial'">
45
- <!-- <div class="file-container"> -->
46
- <div class="file-msg-container">
47
- <span class="name">
48
- <span style="padding-right: 10px" v-if="extconfigParams.exportcontent === 'link'">
49
- <img style="width: 24px" src="./icons/icon_zip.png" />
50
- </span>
51
- <span style="padding-right: 10px" v-else>
52
- <img style="width: 24px" v-if="extconfigParams.filetype === '1'" src="./icons/icon_excel.png" />
53
- <img style="width: 24px" v-else-if="extconfigParams.filetype === '2'" src="./icons/icon_csv.png" />
54
- <img style="width: 24px" v-else-if="extconfigParams.filetype === '3'" src="./icons/icon_pdf.png" />
55
- </span>
56
- <span class="name-text">{{ filename }}</span>
57
- </span>
58
- <span class="size">{{ state.fileSize }}</span>
59
- </div>
60
- <el-button
61
- size="small"
62
- v-if="(step.statusName === 'error' || step.statusName === 'success') && state.exportDataItem.exportfileurl"
63
- style="float: right; position: absolute; right: 15px; top: 16px"
64
- type="primary"
65
- :class="{
66
- 'success-color': step.statusName === 'success',
67
- 'error-color': step.statusName === 'error'
68
- }"
69
- @click="downloadResultFile"
70
- >
71
- 下载
72
- </el-button>
73
- <!-- 取消 -->
74
- <span
75
- class="self-icon icon-close status-icon delete-icon"
76
- @click="cancelHandler"
77
- v-if="
78
- (step.statusName === 'running' || step.statusName === 'ready') &&
79
- (!state.exportDataItem.exportstate ||
80
- state.exportDataItem.exportstate === 'readyrun' ||
81
- state.exportDataItem.exportstate === 'running')
82
- "
83
- />
84
- <el-progress
85
- v-if="
86
- step.statusName === 'running' ||
87
- step.statusName === 'success' ||
88
- step.statusName === 'error' ||
89
- step.statusName === 'ext_readyrun' ||
90
- step.statusName === 'ext_running'
91
- "
92
- :percentage="state.percentage"
93
- :stroke-width="8"
94
- :show-text="state.percentage == 100 ? false : true"
95
- :status="
96
- state.percentage != 100
97
- ? ''
98
- : step.statusName == 'success'
99
- ? 'success'
100
- : step.statusName == 'error'
101
- ? 'exception'
102
- : ''
103
- "
104
- />
105
-
106
- <div
107
- :class="{
108
- 'result-container': true,
109
- success: step.statusName === 'success',
110
- error: step.statusName === 'error'
111
- }"
112
- v-if="state.resultMessage"
113
- >
114
- {{ state.resultMessage }}
115
- </div>
116
- <div
117
- class="result-tip"
118
- v-if="
119
- step.statusName === 'running' ||
120
- step.statusName === 'ready' ||
121
- step.statusName === 'ext_readyrun' ||
122
- step.statusName === 'ext_running' ||
123
- step.statusName === 'success'
124
- "
125
- >
126
- 您可以随时关闭该弹框,之后在导入导出列表中查看结果。
127
- </div>
128
- </div>
129
-
130
- <div class="btnwrap" v-if="step.statusName === 'initial'">
131
- <el-button type="primary" @click="handleExport">导出</el-button>
132
- </div>
133
- </div>
134
- </template>
135
- <script lang="ts" setup>
136
- import { ElMessageBox, ElMessage } from 'element-plus'
137
- import {
138
- watchEffect,
139
- computed,
140
- nextTick,
141
- onBeforeUnmount,
142
- onMounted,
143
- onBeforeMount,
144
- PropType,
145
- reactive,
146
- ref
147
- } from 'vue'
148
- import { Step } from './step'
149
- import { merge } from 'lodash-es'
150
- import {
151
- apaasAxios,
152
- spuAxios,
153
- getUniqueid,
154
- spuConfig,
155
- downloadService,
156
- getUser,
157
- lsProxy
158
- } from '@smart100/spu-web-plugin'
159
- import { dealResultMessage } from './util'
160
- import { dealFileSize } from './util'
161
- import { downloadFileForUrl } from '@/utils/index'
162
-
163
- const props = withDefaults(
164
- defineProps<{
165
- exportApi: string
166
- sheetname: string
167
- pagecode?: string
168
- data?: any
169
- }>(),
170
- {
171
- sheetname: '',
172
- pagecode: '',
173
- data: {}
174
- }
175
- )
176
-
177
- const config = reactive({
178
- expandStatus: '1', // 1普通导出(没有做图片导出服务) 2服务端导出(做了图片导出服务未SPU化) 3安装了图片导出SPU
179
- exportcontentArray: ['excel', 'link', 'photo'], // 当 expandStatus = 2 | 3时才显示导出内容给用户选择
180
- // 新导出的文件类型选择
181
- filetypeArray: ['1', '2']
182
- })
183
-
184
- const extconfigParams = reactive<any>({
185
- filetype: '1', // 导出文件类型 1: xls 2: csv 3: pdf 目前spu的导出只实现了xls 因此写死xls
186
- exportcontent: 'excel', // excel.仅导出单据,link,导出单据和本地链接,photo.导出单据和图片
187
- filewatermark: '0', // 1.开启文件水印,0.关闭文件水印
188
- iscompress: '0', // 1.压缩,0.原图
189
- displaytype: 'horizontal', // horizontal:横向排列 vertical:纵向排列 multi-row:分行展示
190
- imagetype: 'origin', // 导出图片类型 png jpg origin 默认origin
191
- imagename: '', // 图片命名规则
192
- // imagesizepercolumn 和 imageheightcm 为 图片导出SPU新增配置项
193
- imagesizepercolumn: '5',
194
- imageheightcm: '2'
195
- })
196
-
197
- const filename = computed(() => {
198
- let filename = ''
199
- if (extconfigParams.exportcontent === 'link') {
200
- filename = props.sheetname + '.zip'
201
- } else {
202
- if (extconfigParams.filetype === '1') {
203
- filename = props.sheetname + '.xlsx'
204
- } else if (extconfigParams.filetype === '2') {
205
- filename = props.sheetname + '.csv'
206
- } else if (extconfigParams.filetype === '3') {
207
- filename = props.sheetname + '.pdf'
208
- }
209
- }
210
- return filename
211
- })
212
-
213
- const exportcontentOptions = computed(() => {
214
- const mapTitle: any = {
215
- excel: '仅导出单据',
216
- link: '导出单据和本地链接',
217
- photo: '导出单据和图片'
218
- }
219
- return config.exportcontentArray.map((item) => {
220
- return {
221
- label: mapTitle[item],
222
- value: item
223
- }
224
- })
225
- })
226
-
227
- const filetypeOptions = computed(() => {
228
- const mapTitle: any = {
229
- '1': 'xlsx',
230
- '2': 'csv',
231
- '3': 'pdf'
232
- }
233
- const options = config.filetypeArray.map((item) => {
234
- return {
235
- label: mapTitle[item],
236
- value: item
237
- }
238
- })
239
- if (extconfigParams.exportcontent === 'link' || extconfigParams.exportcontent === 'photo') {
240
- return options.filter((v) => {
241
- return v.value !== '2' && v.value !== '3'
242
- })
243
- } else {
244
- return options
245
- }
246
- })
247
-
248
- watchEffect(() => {
249
- if (extconfigParams.exportcontent === 'link' || extconfigParams.exportcontent === 'photo') {
250
- // 当选择了 link 或者 photo 时 文件类型只能选择导出xlsx
251
- extconfigParams.filetype = '1'
252
- }
253
- })
254
-
255
- const step = ref(new Step())
256
-
257
- const state = reactive<any>({
258
- percentage: 0,
259
- resultMessage: '',
260
- exportDataItem: {},
261
- exportId: '',
262
- fileSize: '',
263
- runningTaskCount: 0,
264
- isOldVersionService: false
265
- })
266
-
267
- // 获取导出服务配置
268
- const getConfig = async () => {
269
- let isInstallexpandexp = false
270
- // isInstallexpandexp = true
271
- if (window?.Module?.checkPermission) {
272
- isInstallexpandexp = window.Module.checkPermission({
273
- modulekey: 'expandexp'
274
- })
275
- }
276
-
277
- if (isInstallexpandexp) {
278
- config.expandStatus = '3'
279
- config.filetypeArray = ['1']
280
- extconfigParams.filewatermark = '1'
281
- extconfigParams.iscompress = '1'
282
-
283
- if (window?.Module?.apiRequest) {
284
- console.log('调用 window.Module.apiRequest')
285
- window.Module.apiRequest({
286
- modulekey: 'expandexp',
287
- apitag: 'imageConfig-getByPageCode',
288
- body: {
289
- pagecode: props.pagecode
290
- },
291
- complete: (code: any, data: any, msg: any) => {
292
- // console.log('imageConfig', code, data, msg)
293
- if (code === 200) {
294
- config.exportcontentArray = data.exportcontent
295
-
296
- extconfigParams.iscompress = data.iscompress.toString()
297
- extconfigParams.filewatermark = data.filewatermark.toString()
298
- extconfigParams.imagesizepercolumn = data.imagesizepercolumn.toString()
299
- extconfigParams.imageheightcm = data.imageheightcm.toString()
300
- }
301
- }
302
- })
303
- } else {
304
- apaasAxios
305
- .post('/api/expandexp/v1.0/imageConfig/getByPageCode', {
306
- pagecode: props.pagecode
307
- })
308
- .then((res: any) => {
309
- // console.log(res)
310
- // debugger
311
- if (res?.data?.code === 200 && res?.data?.data) {
312
- const data = res.data.data
313
- config.exportcontentArray = data.exportcontent
314
-
315
- extconfigParams.iscompress = data.iscompress.toString()
316
- extconfigParams.filewatermark = data.filewatermark.toString()
317
- extconfigParams.imagesizepercolumn = data.imagesizepercolumn.toString()
318
- extconfigParams.imageheightcm = data.imageheightcm.toString()
319
- }
320
- })
321
- }
322
- } else {
323
- extconfigParams.filewatermark = '0'
324
- extconfigParams.iscompress = '0'
325
- apaasAxios
326
- .post('/api/expandexp/global/searchExpGloConfig', {
327
- key: 'export-config-switch',
328
- tenantcode: getUser('tenantcode'),
329
- productcode: getUser('productcode')
330
- })
331
- .then((res: any) => {
332
- // res.data.exttype = '1'
333
- // res.data.exttype: 2开启了为服务端导出 1为普通导出
334
- if (res.code === 200 && res?.data?.exttype === '2') {
335
- config.expandStatus = '2'
336
- config.filetypeArray = ['1']
337
- } else {
338
- config.expandStatus = '1'
339
- config.filetypeArray = ['1', '2']
340
- }
341
- })
342
- .catch((err: Error) => {
343
- config.expandStatus = '1'
344
- config.filetypeArray = ['1', '2']
345
- })
346
- // 获取文件水印开关
347
- apaasAxios
348
- .post('/api/expandexp/global/searchWatermarkConfig', '')
349
- .then((res: any) => {
350
- if (res.code === 200 && res?.data?.configjson) {
351
- extconfigParams.filewatermark = JSON.parse(res.data.configjson).isWatermark === '1' ? '1' : '0'
352
- } else {
353
- extconfigParams.filewatermark = '0'
354
- }
355
- })
356
- .catch(() => {
357
- extconfigParams.filewatermark = '0'
358
- })
359
- }
360
- }
361
-
362
- let statusTimer: number | null = null
363
-
364
- const handleExport = async () => {
365
- // window.setInterval(() => {
366
- // step.value.next()
367
- // }, 2000)
368
- // return false
369
-
370
- step.value.next()
371
- state.fileSize = dealFileSize('')
372
-
373
- // console.log({
374
- // expfile: {
375
- // pagecode: props.pagecode,
376
- // sheetname: props.sheetname,
377
- // filename: filename.value,
378
- // filetype: extconfigParams.filetype,
379
- // // exttype 1.普通导出,2.服务端导出
380
- // // 如果为1 或没有这个属性,视为不拓展,前端做兼容
381
- // // 如果是仅导出单据 默认走普通导出 exttype = '1'
382
- // // 因为如果仅导出单据 + 支持水印,又要传 exttype = '2',很麻烦,改为后端处理,如果 expandStatus = 2 | 3 ,exttype就传2,其他情况传1
383
- // // exttype: (config.exportcontentValue === 'excel' || config.expandStatus === '1') ? '1' : '2',
384
- // exttype: config.expandStatus === '1' ? '1' : '2',
385
- // // 扩展导出参数
386
- // extconfig: {
387
- // ...extconfigParams
388
- // }
389
- // }
390
- // })
391
- // debugger
392
-
393
- const post = merge(props.data, {
394
- expfile: {
395
- pagecode: props.pagecode,
396
- sheetname: props.sheetname,
397
- filename: filename.value,
398
- filetype: extconfigParams.filetype,
399
- // exttype 1.普通导出,2.服务端导出
400
- // 如果为1 或没有这个属性,视为不拓展,前端做兼容
401
- // 如果是仅导出单据 默认走普通导出 exttype = '1'
402
- // 因为如果仅导出单据 + 支持水印,又要传 exttype = '2',很麻烦,改为后端处理,如果 expandStatus = 2 | 3 ,exttype就传2,其他情况传1
403
- // exttype: (config.exportcontentValue === 'excel' || config.expandStatus === '1') ? '1' : '2',
404
- exttype: config.expandStatus === '1' ? '1' : '2',
405
- // 扩展导出参数
406
- extconfig: {
407
- ...extconfigParams
408
- }
409
- }
410
- })
411
- apaasAxios
412
- .post(props.exportApi, post)
413
- .then((res: any) => {
414
- // console.log(res)
415
- // debugger
416
- if (res?.data?.code === 200 && res?.data?.data) {
417
- state.exportId = res.data.data
418
- state.percentage = 0
419
- // 到ready
420
- step.value.go('ready')
421
- nextTick(() => {
422
- updateStatus()
423
- })
424
- statusTimer = window.setInterval(() => {
425
- updateStatus()
426
- }, 2000)
427
- } else {
428
- step.value.go('error')
429
- state.percentage = 100
430
- state.resultMessage = res?.data?.msg || '网络连接错误'
431
- stopInterval()
432
- }
433
- })
434
- .catch((error: any) => {
435
- // debugger
436
- step.value.go('error')
437
- state.percentage = 100
438
- state.resultMessage = '网络连接错误'
439
- // if (!error || error.response.status === 0 || error.response.status === 404) {
440
- // state.resultMessage = '网络连接错误'
441
- // } else {
442
- // state.resultMessage = '网络连接错误'
443
- // }
444
- stopInterval()
445
- })
446
- }
447
-
448
- const updateStatus = async () => {
449
- apaasAxios
450
- .post(`/api/teapi/queue/impexp/expStatus?dynamicid=${state.exportId}`)
451
- .then((res: any) => {
452
- let responseData = res?.data?.states
453
- let currentData = null
454
- if (!responseData) {
455
- state.isOldVersionService = true
456
- return
457
- } else {
458
- if (Array.isArray(responseData)) {
459
- state.isOldVersionService = true
460
- if (responseData.length > 1) {
461
- responseData = responseData.filter((item: any) => {
462
- return item.dynamicid === state.exportId
463
- })
464
- }
465
- currentData = responseData[0]
466
- } else {
467
- state.isOldVersionService = false
468
- state.runningTaskCount = responseData.queuesize
469
- if (responseData.states && responseData.states.length > 1) {
470
- responseData.states = responseData.states.filter((item: any) => {
471
- return item.dynamicid === state.exportId
472
- })
473
- }
474
- currentData = responseData.states && responseData.states[0]
475
- }
476
- }
477
- if (!currentData) {
478
- return
479
- }
480
-
481
- if (currentData.exportstate === 'complete') {
482
- const data = currentData
483
- state.percentage = 100
484
- if (data.errorfileurl || data.fatalerrormsg) {
485
- step.value.go('error')
486
- } else {
487
- step.value.go('success')
488
- }
489
- if (data.filesize) {
490
- // 普通导出服务返回 4000 服务端导出返回 4kb
491
- // 这里做兼容处理
492
- state.fileSize = dealFileSize(data.filesize)
493
- }
494
- state.exportDataItem = data
495
- state.resultMessage = dealResultMessage(data)
496
- stopInterval()
497
- } else if (currentData.exportstate === 'readyrun') {
498
- step.value.go('ready')
499
- } else if (currentData.exportstate === 'fatalerror') {
500
- state.percentage = 100
501
- step.value.go('error')
502
- state.resultMessage = dealResultMessage(currentData)
503
- stopInterval()
504
- } else if (currentData.exportstate === 'cancel') {
505
- console.log('cancel')
506
- } else if (currentData.exportstate === 'ext_readyrun') {
507
- step.value.go('ext_readyrun')
508
- if (currentData) {
509
- state.percentage = +currentData.finishRate * 0.5 + 50
510
- }
511
- } else if (currentData.exportstate === 'ext_running') {
512
- step.value.go('ext_running')
513
- // debugger
514
- if (currentData) {
515
- state.percentage = +currentData.finishRate * 0.5 + 50
516
- }
517
- } else {
518
- step.value.go('running')
519
- if (currentData) {
520
- state.percentage = +currentData.finishRate * 0.5
521
- // state.percentage = +currentData.finishRate
522
- }
523
- }
524
- })
525
- .catch((err: any) => {
526
- console.error(err)
527
- step.value.go('error')
528
- state.percentage = 100
529
- if (err.status === 0) {
530
- state.resultMessage = '网络链接错误'
531
- stopInterval()
532
- }
533
- })
534
- }
535
-
536
- const downloadResultFile = async () => {
537
- // // 下载错误的数据
538
- // let fixExportFileUrl = this.exportDataItem.exportfileurl[0] === '/' ? this.exportDataItem.exportfileurl : '/' + this.exportDataItem.exportfileurl
539
- // let exportFileName = this.exportDataItem.filename
540
- // let date = this.exportDataItem.initdate
541
- // DownloadService.downloadFile(this, fixExportFileUrl, date, exportFileName, 'att', 'storage-1d')
542
-
543
- const fixExportFileUrl =
544
- state.exportDataItem.exportfileurl[0] === '/'
545
- ? state.exportDataItem.exportfileurl
546
- : '/' + state.exportDataItem.exportfileurl
547
- const exportFileName = state.exportDataItem.filename
548
- // const date = state.exportDataItem.initdate + ''
549
- // downloadFile(fixExportFileUrl, date, {
550
- // storage: 'storage-1d',
551
- // uploadType: 'att',
552
- // fileName: exportFileName
553
- // })
554
-
555
- const cloudserv: any = JSON.parse(lsProxy.getItem('cloudserv') as string)
556
- const endpoint = cloudserv?.storage?.cloudserv_storage_storageendpoint
557
- const bucket = cloudserv?.storage?.cloudserv_storage_storagebucket
558
- downloadFileForUrl(`https://${bucket}.${endpoint}${fixExportFileUrl}`, exportFileName)
559
- }
560
-
561
- const cancelHandler = () => {
562
- // ElMessageBox.confirm('确认是否取消该任务?', '提示', {
563
- // distinguishCancelAndClose: true,
564
- // confirmButtonText: '确定取消',
565
- // cancelButtonText: '放弃'
566
- // })
567
- // .then(async () => {
568
- // try {
569
- // await cancelFormImportExport(state.exportId)
570
- // step.value.go('cancel')
571
- // state.resultMessage = $t('任务已取消')
572
- // ElMessage.success($t('任务已取消'))
573
- // } catch (error) {
574
- // window.$logger.error(error)
575
- // ElMessage.error($t('删除失败'))
576
- // }
577
- // })
578
- // .catch(() => { })
579
- }
580
-
581
- const stopInterval = () => {
582
- if (statusTimer) {
583
- window.clearInterval(statusTimer)
584
- statusTimer = null
585
- }
586
- }
587
-
588
- onBeforeMount(() => {
589
- getConfig()
590
- })
591
-
592
- onBeforeUnmount(() => {
593
- stopInterval()
594
- })
595
- </script>
596
-
597
- <style lang="less">
598
- .spu-export {
599
- padding: 0 12px;
600
-
601
- .title-container {
602
- display: flex;
603
- justify-content: space-between;
604
- vertical-align: baseline;
605
- align-content: space-between;
606
- .title-tip-container {
607
- line-height: 32px;
608
- }
609
- }
610
-
611
- .select-container {
612
- .title {
613
- margin-bottom: 20px;
614
- margin-top: 10px;
615
- position: relative;
616
-
617
- &:before {
618
- content: '*';
619
- display: inline;
620
- color: #e53c51;
621
- padding-right: 2px;
622
- font-size: 24px;
623
- vertical-align: middle;
624
- position: absolute;
625
- left: -12px;
626
- top: 1px;
627
- }
628
- }
629
-
630
- .error-tips {
631
- font-size: 12px;
632
- color: #e53c51;
633
- position: absolute;
634
- left: 0px;
635
- top: 18px;
636
- }
637
-
638
- .el-radio-group {
639
- width: 100%;
640
- padding-bottom: 10px;
641
-
642
- .el-radio {
643
- padding: 4px 0;
644
- }
645
- }
646
-
647
- .el-checkbox,
648
- .el-radio-wrapper {
649
- width: 50%;
650
- line-height: 2;
651
- margin-right: 0px;
652
- }
653
-
654
- .column-checkbox-container {
655
- display: block;
656
-
657
- .column-checkbox-group {
658
- width: 100%;
659
- display: block;
660
- }
661
- }
662
-
663
- .el-checkbox {
664
- display: inline-flex;
665
- margin-bottom: 8px;
666
-
667
- .el-checkbox__label {
668
- flex: 1;
669
- white-space: break-spaces;
670
- }
671
- }
672
-
673
- .select-all-columns {
674
- float: right;
675
- }
676
- }
677
-
678
- .file-container {
679
- border: 1px solid #d9d9d9;
680
- min-height: 98px;
681
- padding: 15px;
682
- position: relative;
683
-
684
- .file-msg-container {
685
- display: flex;
686
- margin-bottom: 10px;
687
- width: calc(100% - 72px);
688
- position: relative;
689
- justify-content: space-between;
690
- // align-items: baseline;
691
- align-content: center;
692
-
693
- .icon {
694
- font-size: 32px;
695
- }
696
-
697
- .self-icon {
698
- font-size: 28px;
699
- }
700
-
701
- .icon-inoutbox {
702
- color: #1989fa;
703
- }
704
-
705
- .name {
706
- line-height: 32px;
707
- height: 32px;
708
- margin-right: 10px;
709
- white-space: nowrap;
710
- overflow: hidden;
711
- text-overflow: ellipsis;
712
- display: flex;
713
- align-items: center;
714
-
715
- .name-text {
716
- margin-left: 4px;
717
- font-size: 14px;
718
- color: #333333;
719
- }
720
- }
721
-
722
- .size {
723
- line-height: 32px;
724
- white-space: nowrap;
725
- padding-right: 20px;
726
- }
727
- }
728
-
729
- .delete-icon {
730
- position: absolute;
731
- right: 15px;
732
- top: 26px;
733
- font-size: 22px;
734
- width: 22px;
735
- height: 22px;
736
- line-height: 22px;
737
- border-radius: 11px;
738
- color: #999;
739
- cursor: pointer;
740
- /*background: #d9d9d9;*/
741
- padding-top: 3px;
742
- }
743
-
744
- .status-icon {
745
- position: absolute;
746
- right: 15px;
747
- top: 26px;
748
- font-size: 22px;
749
- width: 22px;
750
- height: 22px;
751
- line-height: 22px;
752
-
753
- &.success-icon {
754
- color: #13ce66;
755
- }
756
- }
757
-
758
- .self-icon.icon-download {
759
- font-size: 13px;
760
- }
761
-
762
- .error-color {
763
- background: #e75b41;
764
- }
765
-
766
- .success-color {
767
- background: #00b389;
768
- border-color: #00b389;
769
- }
770
-
771
- .result-container {
772
- height: 28px;
773
- line-height: 28px;
774
- text-align: right;
775
- font-size: 12px;
776
- padding: 0px 8px;
777
-
778
- &.error {
779
- background: #fdf1ef;
780
- white-space: nowrap;
781
- text-overflow: ellipsis;
782
- overflow: hidden;
783
- }
784
-
785
- &.success {
786
- background: #e5f7f3;
787
- }
788
- }
789
-
790
- .result-tip {
791
- height: 28px;
792
- line-height: 28px;
793
- margin-top: 8px;
794
- font-size: 12px;
795
- text-align: right;
796
- color: #999;
797
- }
798
- }
799
-
800
- .el-progress--line {
801
- .el-progress__text {
802
- display: none;
803
- }
804
-
805
- .el-progress-bar__outer {
806
- border-radius: 0px;
807
- }
808
-
809
- .el-progress-bar__inner {
810
- border-radius: 0px;
811
- }
812
- }
813
-
814
- .btnwrap {
815
- margin-top: 12px;
816
- display: flex;
817
- flex-direction: row-reverse;
818
- }
819
- }
820
- </style>