| | |
| | | }) |
| | | } |
| | | |
| | | |
| | | |
| | | post(url, data, options = {}) { |
| | | return this.request({ |
| | | url, |
| | |
| | | BASE_URL = '/jeecg-boot' // ç产ç¯å¢ |
| | | } |
| | | let staticDomainURL ='/sys/common/static'; |
| | | let staticURL ='http://192.168.4.20:9999/jeecg-boot/sys/common/static'; |
| | | let staticURL ='https://192.168.100.105:9999/jeecg-boot/sys/common/static'; |
| | | const configService = { |
| | | apiUrl: BASE_URL, |
| | | staticDomainURL: staticDomainURL, |
| | |
| | | export const os = { |
| | | data:[ |
| | | { |
| | | title:"ç¹æ£", |
| | | title:"å¾
ç¹æ£", |
| | | icon:icon_prefix+"xinwen.png", |
| | | description:"设å¤ç¹æ£", |
| | | useCount:10000, |
| | | page:'checkList' |
| | | },{ |
| | | title:"å¨ä¿", |
| | | title:"å¾
å¨ä¿", |
| | | icon:icon_prefix+"toupiao.png", |
| | | description:"设å¤å¨ä¿", |
| | | useCount:10000, |
| | |
| | | icon:icon_prefix+"xinwen.png", |
| | | description:"è®¾å¤æ¥ä¿®", |
| | | useCount:10000, |
| | | page:'reportRepair' |
| | | page:'reportRepairList' |
| | | },{ |
| | | title:"ç»´ä¿®", |
| | | title:"å¾
ç»´ä¿®", |
| | | icon:icon_prefix+"toupiao.png", |
| | | description:"设å¤ç»´ä¿®", |
| | | useCount:10000, |
| | |
| | | "proxy": { |
| | | /**é
ç½®æå¡å¨è·¯å¾**/ |
| | | "/jeecg-boot": { |
| | | "target": "https://192.168.4.20:9999", // ç®æ æå¡å¨ |
| | | "target": "https://192.168.100.105:9999", // ç®æ æå¡å¨ |
| | | "changeOrigin": true |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | # Changelog |
| | | All notable changes to this project will be documented in this file. |
| | | |
| | | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), |
| | | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
| | | |
| | | ## [2.0.5] - 2020-11-18 |
| | | |
| | | - Fix server side rendering |
| | | |
| | | ## [2.0.2] - 2019-05-14 |
| | | |
| | | - Catching an exception on Send (HEAD) ([#534]) |
| | | |
| | | ## [2.0.0] - 2018-10-17 |
| | | |
| | | - Removed eval to resolve CSP ([#465]) |
| | | |
| | | ## [2.0.0-rc.4] - 2018-10-17 |
| | | |
| | | - Donât throw on module.exports |
| | | |
| | | ## [2.0.0-rc.3] - 2018-09-27 |
| | | |
| | | - Switch export method |
| | | |
| | | ## [2.0.0-rc.2] - 2018-09-26 |
| | | |
| | | - Added a changelog.md |
| | | - Reverted `a.click()` to use dispatch with a try-catch ([#465], [#382]) |
| | | - Made third argument to an object where you have to pass `{ autoBom: true }` |
| | | - boolean are depricated but still works |
| | | |
| | | ## [2.0.0-rc.1] - 2018-09-26 |
| | | |
| | | - saveAs don't return anything |
| | | - The object that dispatched `writestart progress write writeend` are gone |
| | | - detecting such features was never possible and nobody seems to use it. |
| | | - Removed the demo folder |
| | | - Removed date/version from top of the file |
| | | - Dosen't crash in web workers ([#449]) |
| | | - Support saving urls ([#260] with workarounds for cross origin) |
| | | - Uses babel universal module pattern (UMD) to export the package |
| | | - Provides source map now as well. |
| | | - use a[download] before msSaveAs ([#193], [#294]) |
| | | - removed dist from .gitignore (npm uses it if it don't find a .npmignore) |
| | | - autoBom is now reversed so you have to tell when you want to use autoBom ([#432]) |
| | | - `a.click()` since there are new and depricated event constructors that works differently ([#382]) |
| | | - opens up a new popup (tab) directly for the fallback method since the FileReader is async |
| | | - removed the explicitly MSIE [1-9] check |
| | | - Uses new anchor link for each save (might solve multiple download problems) |
| | | |
| | | [#382]: https://github.com/eligrey/FileSaver.js/issues/382 |
| | | [#449]: https://github.com/eligrey/FileSaver.js/issues/449 |
| | | [#260]: https://github.com/eligrey/FileSaver.js/issues/260 |
| | | [#193]: https://github.com/eligrey/FileSaver.js/issues/193 |
| | | [#294]: https://github.com/eligrey/FileSaver.js/issues/294 |
| | | [#432]: https://github.com/eligrey/FileSaver.js/issues/432 |
| | | [#382]: https://github.com/eligrey/FileSaver.js/issues/382 |
| | | [#465]: https://github.com/eligrey/FileSaver.js/issues/465 |
| | | [#469]: https://github.com/eligrey/FileSaver.js/issues/469 |
| | | [#470]: https://github.com/eligrey/FileSaver.js/issues/470 |
| | | [#491]: https://github.com/eligrey/FileSaver.js/issues/491 |
| | | [#534]: https://github.com/eligrey/FileSaver.js/issues/534 |
¶Ô±ÈÐÂÎļþ |
| | |
| | | The MIT License |
| | | |
| | | Copyright © 2016 [Eli Grey][1]. |
| | | |
| | | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
| | | |
| | | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
| | | |
| | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| | | |
| | | [1]: http://eligrey.com |
¶Ô±ÈÐÂÎļþ |
| | |
| | | If you need to save really large files bigger than the blob's size limitation or don't have |
| | | enough RAM, then have a look at the more advanced [StreamSaver.js][7] |
| | | that can save data directly to the hard drive asynchronously with the power of the new streams API. That will have |
| | | support for progress, cancelation and knowing when it's done writing |
| | | |
| | | FileSaver.js |
| | | ============ |
| | | |
| | | FileSaver.js is the solution to saving files on the client-side, and is perfect for |
| | | web apps that generates files on the client, However if the file is coming from the |
| | | server we recommend you to first try to use [Content-Disposition][8] attachment response header as it has more cross-browser compatiblity. |
| | | |
| | | Looking for `canvas.toBlob()` for saving canvases? Check out |
| | | [canvas-toBlob.js][2] for a cross-browser implementation. |
| | | |
| | | Supported Browsers |
| | | ------------------ |
| | | |
| | | | Browser | Constructs as | Filenames | Max Blob Size | Dependencies | |
| | | | -------------- | ------------- | ------------ | ------------- | ------------ | |
| | | | Firefox 20+ | Blob | Yes | 800 MiB | None | |
| | | | Firefox < 20 | data: URI | No | n/a | [Blob.js](https://github.com/eligrey/Blob.js) | |
| | | | Chrome | Blob | Yes | [2GB][3] | None | |
| | | | Chrome for Android | Blob | Yes | [RAM/5][3] | None | |
| | | | Edge | Blob | Yes | ? | None | |
| | | | IE 10+ | Blob | Yes | 600 MiB | None | |
| | | | Opera 15+ | Blob | Yes | 500 MiB | None | |
| | | | Opera < 15 | data: URI | No | n/a | [Blob.js](https://github.com/eligrey/Blob.js) | |
| | | | Safari 6.1+* | Blob | No | ? | None | |
| | | | Safari < 6 | data: URI | No | n/a | [Blob.js](https://github.com/eligrey/Blob.js) | |
| | | | Safari 10.1+  | Blob     | Yes     | n/a      | None | |
| | | |
| | | Feature detection is possible: |
| | | |
| | | ```js |
| | | try { |
| | | var isFileSaverSupported = !!new Blob; |
| | | } catch (e) {} |
| | | ``` |
| | | |
| | | ### IE < 10 |
| | | |
| | | It is possible to save text files in IE < 10 without Flash-based polyfills. |
| | | See [ChenWenBrian and koffsyrup's `saveTextAs()`](https://github.com/koffsyrup/FileSaver.js#examples) for more details. |
| | | |
| | | ### Safari 6.1+ |
| | | |
| | | Blobs may be opened instead of saved sometimesâyou may have to direct your Safari users to manually |
| | | press <kbd>â</kbd>+<kbd>S</kbd> to save the file after it is opened. Using the `application/octet-stream` MIME type to force downloads [can cause issues in Safari](https://github.com/eligrey/FileSaver.js/issues/12#issuecomment-47247096). |
| | | |
| | | ### iOS |
| | | |
| | | saveAs must be run within a user interaction event such as onTouchDown or onClick; setTimeout will prevent saveAs from triggering. Due to restrictions in iOS saveAs opens in a new window instead of downloading, if you want this fixed please [tell Apple how this WebKit bug is affecting you](https://bugs.webkit.org/show_bug.cgi?id=167341). |
| | | |
| | | Syntax |
| | | ------ |
| | | ### Import `saveAs()` from file-saver |
| | | ```js |
| | | import { saveAs } from 'file-saver'; |
| | | ``` |
| | | |
| | | ```js |
| | | FileSaver saveAs(Blob/File/Url, optional DOMString filename, optional Object { autoBom }) |
| | | ``` |
| | | |
| | | Pass `{ autoBom: true }` if you want FileSaver.js to automatically provide Unicode text encoding hints (see: [byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark)). Note that this is only done if your blob type has `charset=utf-8` set. |
| | | |
| | | Examples |
| | | -------- |
| | | |
| | | ### Saving text using `require()` |
| | | ```js |
| | | var FileSaver = require('file-saver'); |
| | | var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"}); |
| | | FileSaver.saveAs(blob, "hello world.txt"); |
| | | ``` |
| | | |
| | | ### Saving text |
| | | |
| | | ```js |
| | | var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"}); |
| | | FileSaver.saveAs(blob, "hello world.txt"); |
| | | ``` |
| | | |
| | | ### Saving URLs |
| | | |
| | | ```js |
| | | FileSaver.saveAs("https://httpbin.org/image", "image.jpg"); |
| | | ``` |
| | | Using URLs within the same origin will just use `a[download]`. |
| | | Otherwise, it will first check if it supports cors header with a synchronous head request. |
| | | If it does, it will download the data and save using blob URLs. |
| | | If not, it will try to download it using `a[download]`. |
| | | |
| | | The standard W3C File API [`Blob`][4] interface is not available in all browsers. |
| | | [Blob.js][5] is a cross-browser `Blob` implementation that solves this. |
| | | |
| | | ### Saving a canvas |
| | | ```js |
| | | var canvas = document.getElementById("my-canvas"); |
| | | canvas.toBlob(function(blob) { |
| | | saveAs(blob, "pretty image.png"); |
| | | }); |
| | | ``` |
| | | |
| | | Note: The standard HTML5 `canvas.toBlob()` method is not available in all browsers. |
| | | [canvas-toBlob.js][6] is a cross-browser `canvas.toBlob()` that polyfills this. |
| | | |
| | | ### Saving File |
| | | |
| | | You can save a File constructor without specifying a filename. If the |
| | | file itself already contains a name, there is a hand full of ways to get a file |
| | | instance (from storage, file input, new constructor, clipboard event). |
| | | If you still want to change the name, then you can change it in the 2nd argument. |
| | | |
| | | ```js |
| | | // Note: Ie and Edge don't support the new File constructor, |
| | | // so it's better to construct blobs and use saveAs(blob, filename) |
| | | var file = new File(["Hello, world!"], "hello world.txt", {type: "text/plain;charset=utf-8"}); |
| | | FileSaver.saveAs(file); |
| | | ``` |
| | | |
| | | |
| | | |
| | |  |
| | | |
| | | [1]: http://eligrey.com/demos/FileSaver.js/ |
| | | [2]: https://github.com/eligrey/canvas-toBlob.js |
| | | [3]: https://bugs.chromium.org/p/chromium/issues/detail?id=375297#c107 |
| | | [4]: https://developer.mozilla.org/en-US/docs/DOM/Blob |
| | | [5]: https://github.com/eligrey/Blob.js |
| | | [6]: https://github.com/eligrey/canvas-toBlob.js |
| | | [7]: https://github.com/jimmywarting/StreamSaver.js |
| | | [8]: https://github.com/eligrey/FileSaver.js/wiki/Saving-a-remote-file#using-http-header |
| | | |
| | | Installation |
| | | ------------------ |
| | | |
| | | ```bash |
| | | # Basic Node.JS installation |
| | | npm install file-saver --save |
| | | bower install file-saver |
| | | ``` |
| | | |
| | | Additionally, TypeScript definitions can be installed via: |
| | | |
| | | ```bash |
| | | # Additional typescript definitions |
| | | npm install @types/file-saver --save-dev |
| | | ``` |
¶Ô±ÈÐÂÎļþ |
| | |
| | | (function (global, factory) { |
| | | if (typeof define === "function" && define.amd) { |
| | | define([], factory); |
| | | } else if (typeof exports !== "undefined") { |
| | | factory(); |
| | | } else { |
| | | var mod = { |
| | | exports: {} |
| | | }; |
| | | factory(); |
| | | global.FileSaver = mod.exports; |
| | | } |
| | | })(this, function () { |
| | | "use strict"; |
| | | |
| | | /* |
| | | * FileSaver.js |
| | | * A saveAs() FileSaver implementation. |
| | | * |
| | | * By Eli Grey, http://eligrey.com |
| | | * |
| | | * License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT) |
| | | * source : http://purl.eligrey.com/github/FileSaver.js |
| | | */ |
| | | // The one and only way of getting global scope in all environments |
| | | // https://stackoverflow.com/q/3277182/1008999 |
| | | var _global = typeof window === 'object' && window.window === window ? window : typeof self === 'object' && self.self === self ? self : typeof global === 'object' && global.global === global ? global : void 0; |
| | | |
| | | function bom(blob, opts) { |
| | | if (typeof opts === 'undefined') opts = { |
| | | autoBom: false |
| | | };else if (typeof opts !== 'object') { |
| | | console.warn('Deprecated: Expected third argument to be a object'); |
| | | opts = { |
| | | autoBom: !opts |
| | | }; |
| | | } // prepend BOM for UTF-8 XML and text/* types (including HTML) |
| | | // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF |
| | | |
| | | if (opts.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) { |
| | | return new Blob([String.fromCharCode(0xFEFF), blob], { |
| | | type: blob.type |
| | | }); |
| | | } |
| | | |
| | | return blob; |
| | | } |
| | | |
| | | function download(url, name, opts) { |
| | | var xhr = new XMLHttpRequest(); |
| | | xhr.open('GET', url); |
| | | xhr.responseType = 'blob'; |
| | | |
| | | xhr.onload = function () { |
| | | saveAs(xhr.response, name, opts); |
| | | }; |
| | | |
| | | xhr.onerror = function () { |
| | | console.error('could not download file'); |
| | | }; |
| | | |
| | | xhr.send(); |
| | | } |
| | | |
| | | function corsEnabled(url) { |
| | | var xhr = new XMLHttpRequest(); // use sync to avoid popup blocker |
| | | |
| | | xhr.open('HEAD', url, false); |
| | | |
| | | try { |
| | | xhr.send(); |
| | | } catch (e) {} |
| | | |
| | | return xhr.status >= 200 && xhr.status <= 299; |
| | | } // `a.click()` doesn't work for all browsers (#465) |
| | | |
| | | |
| | | function click(node) { |
| | | try { |
| | | node.dispatchEvent(new MouseEvent('click')); |
| | | } catch (e) { |
| | | var evt = document.createEvent('MouseEvents'); |
| | | evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null); |
| | | node.dispatchEvent(evt); |
| | | } |
| | | } // Detect WebView inside a native macOS app by ruling out all browsers |
| | | // We just need to check for 'Safari' because all other browsers (besides Firefox) include that too |
| | | // https://www.whatismybrowser.com/guides/the-latest-user-agent/macos |
| | | |
| | | |
| | | var isMacOSWebView = _global.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent); |
| | | var saveAs = _global.saveAs || ( // probably in some web worker |
| | | typeof window !== 'object' || window !== _global ? function saveAs() {} |
| | | /* noop */ |
| | | // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView |
| | | : 'download' in HTMLAnchorElement.prototype && !isMacOSWebView ? function saveAs(blob, name, opts) { |
| | | var URL = _global.URL || _global.webkitURL; |
| | | var a = document.createElement('a'); |
| | | name = name || blob.name || 'download'; |
| | | a.download = name; |
| | | a.rel = 'noopener'; // tabnabbing |
| | | // TODO: detect chrome extensions & packaged apps |
| | | // a.target = '_blank' |
| | | |
| | | if (typeof blob === 'string') { |
| | | // Support regular links |
| | | a.href = blob; |
| | | |
| | | if (a.origin !== location.origin) { |
| | | corsEnabled(a.href) ? download(blob, name, opts) : click(a, a.target = '_blank'); |
| | | } else { |
| | | click(a); |
| | | } |
| | | } else { |
| | | // Support blobs |
| | | a.href = URL.createObjectURL(blob); |
| | | setTimeout(function () { |
| | | URL.revokeObjectURL(a.href); |
| | | }, 4E4); // 40s |
| | | |
| | | setTimeout(function () { |
| | | click(a); |
| | | }, 0); |
| | | } |
| | | } // Use msSaveOrOpenBlob as a second approach |
| | | : 'msSaveOrOpenBlob' in navigator ? function saveAs(blob, name, opts) { |
| | | name = name || blob.name || 'download'; |
| | | |
| | | if (typeof blob === 'string') { |
| | | if (corsEnabled(blob)) { |
| | | download(blob, name, opts); |
| | | } else { |
| | | var a = document.createElement('a'); |
| | | a.href = blob; |
| | | a.target = '_blank'; |
| | | setTimeout(function () { |
| | | click(a); |
| | | }); |
| | | } |
| | | } else { |
| | | navigator.msSaveOrOpenBlob(bom(blob, opts), name); |
| | | } |
| | | } // Fallback to using FileReader and a popup |
| | | : function saveAs(blob, name, opts, popup) { |
| | | // Open a popup immediately do go around popup blocker |
| | | // Mostly only available on user interaction and the fileReader is async so... |
| | | popup = popup || open('', '_blank'); |
| | | |
| | | if (popup) { |
| | | popup.document.title = popup.document.body.innerText = 'downloading...'; |
| | | } |
| | | |
| | | if (typeof blob === 'string') return download(blob, name, opts); |
| | | var force = blob.type === 'application/octet-stream'; |
| | | |
| | | var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari; |
| | | |
| | | var isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent); |
| | | |
| | | if ((isChromeIOS || force && isSafari || isMacOSWebView) && typeof FileReader !== 'undefined') { |
| | | // Safari doesn't allow downloading of blob URLs |
| | | var reader = new FileReader(); |
| | | |
| | | reader.onloadend = function () { |
| | | var url = reader.result; |
| | | url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;'); |
| | | if (popup) popup.location.href = url;else location = url; |
| | | popup = null; // reverse-tabnabbing #460 |
| | | }; |
| | | |
| | | reader.readAsDataURL(blob); |
| | | } else { |
| | | var URL = _global.URL || _global.webkitURL; |
| | | var url = URL.createObjectURL(blob); |
| | | if (popup) popup.location = url;else location.href = url; |
| | | popup = null; // reverse-tabnabbing #460 |
| | | |
| | | setTimeout(function () { |
| | | URL.revokeObjectURL(url); |
| | | }, 4E4); // 40s |
| | | } |
| | | }); |
| | | _global.saveAs = saveAs.saveAs = saveAs; |
| | | |
| | | if (typeof module !== 'undefined') { |
| | | module.exports = saveAs; |
| | | } |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | (function(a,b){if("function"==typeof define&&define.amd)define([],b);else if("undefined"!=typeof exports)b();else{b(),a.FileSaver={exports:{}}.exports}})(this,function(){"use strict";function b(a,b){return"undefined"==typeof b?b={autoBom:!1}:"object"!=typeof b&&(console.warn("Deprecated: Expected third argument to be a object"),b={autoBom:!b}),b.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function c(a,b,c){var d=new XMLHttpRequest;d.open("GET",a),d.responseType="blob",d.onload=function(){g(d.response,b,c)},d.onerror=function(){console.error("could not download file")},d.send()}function d(a){var b=new XMLHttpRequest;b.open("HEAD",a,!1);try{b.send()}catch(a){}return 200<=b.status&&299>=b.status}function e(a){try{a.dispatchEvent(new MouseEvent("click"))}catch(c){var b=document.createEvent("MouseEvents");b.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(b)}}var f="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0,a=f.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),g=f.saveAs||("object"!=typeof window||window!==f?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(b,g,h){var i=f.URL||f.webkitURL,j=document.createElement("a");g=g||b.name||"download",j.download=g,j.rel="noopener","string"==typeof b?(j.href=b,j.origin===location.origin?e(j):d(j.href)?c(b,g,h):e(j,j.target="_blank")):(j.href=i.createObjectURL(b),setTimeout(function(){i.revokeObjectURL(j.href)},4E4),setTimeout(function(){e(j)},0))}:"msSaveOrOpenBlob"in navigator?function(f,g,h){if(g=g||f.name||"download","string"!=typeof f)navigator.msSaveOrOpenBlob(b(f,h),g);else if(d(f))c(f,g,h);else{var i=document.createElement("a");i.href=f,i.target="_blank",setTimeout(function(){e(i)})}}:function(b,d,e,g){if(g=g||open("","_blank"),g&&(g.document.title=g.document.body.innerText="downloading..."),"string"==typeof b)return c(b,d,e);var h="application/octet-stream"===b.type,i=/constructor/i.test(f.HTMLElement)||f.safari,j=/CriOS\/[\d]+/.test(navigator.userAgent);if((j||h&&i||a)&&"undefined"!=typeof FileReader){var k=new FileReader;k.onloadend=function(){var a=k.result;a=j?a:a.replace(/^data:[^;]*;/,"data:attachment/file;"),g?g.location.href=a:location=a,g=null},k.readAsDataURL(b)}else{var l=f.URL||f.webkitURL,m=l.createObjectURL(b);g?g.location=m:location.href=m,g=null,setTimeout(function(){l.revokeObjectURL(m)},4E4)}});f.saveAs=g.saveAs=g,"undefined"!=typeof module&&(module.exports=g)}); |
| | | |
| | | //# sourceMappingURL=FileSaver.min.js.map |
¶Ô±ÈÐÂÎļþ |
| | |
| | | {"version":3,"sources":["../src/FileSaver.js"],"names":[],"mappings":"uLAkBA,QAAS,CAAA,CAAT,CAAc,CAAd,CAAoB,CAApB,CAA0B,OACJ,WAAhB,QAAO,CAAA,CADa,CACS,CAAI,CAAG,CAAE,OAAO,GAAT,CADhB,CAEC,QAAhB,QAAO,CAAA,CAFQ,GAGtB,OAAO,CAAC,IAAR,CAAa,oDAAb,CAHsB,CAItB,CAAI,CAAG,CAAE,OAAO,CAAE,CAAC,CAAZ,CAJe,EASpB,CAAI,CAAC,OAAL,EAAgB,6EAA6E,IAA7E,CAAkF,CAAI,CAAC,IAAvF,CATI,CAUf,GAAI,CAAA,IAAJ,CAAS,UAA8B,CAA9B,CAAT,CAA8C,CAAE,IAAI,CAAE,CAAI,CAAC,IAAb,CAA9C,CAVe,CAYjB,CACR,CAED,QAAS,CAAA,CAAT,CAAmB,CAAnB,CAAwB,CAAxB,CAA8B,CAA9B,CAAoC,CAClC,GAAI,CAAA,CAAG,CAAG,GAAI,CAAA,cAAd,CACA,CAAG,CAAC,IAAJ,CAAS,KAAT,CAAgB,CAAhB,CAFkC,CAGlC,CAAG,CAAC,YAAJ,CAAmB,MAHe,CAIlC,CAAG,CAAC,MAAJ,CAAa,UAAY,CACvB,CAAM,CAAC,CAAG,CAAC,QAAL,CAAe,CAAf,CAAqB,CAArB,CACP,CANiC,CAOlC,CAAG,CAAC,OAAJ,CAAc,UAAY,CACxB,OAAO,CAAC,KAAR,CAAc,yBAAd,CACD,CATiC,CAUlC,CAAG,CAAC,IAAJ,EACD,CAED,QAAS,CAAA,CAAT,CAAsB,CAAtB,CAA2B,CACzB,GAAI,CAAA,CAAG,CAAG,GAAI,CAAA,cAAd,CAEA,CAAG,CAAC,IAAJ,CAAS,MAAT,CAAiB,CAAjB,IAHyB,CAIzB,GAAI,CACF,CAAG,CAAC,IAAJ,EACD,CAAC,MAAO,CAAP,CAAU,CAAE,CACd,MAAqB,IAAd,EAAA,CAAG,CAAC,MAAJ,EAAmC,GAAd,EAAA,CAAG,CAAC,MACjC,CAGD,QAAS,CAAA,CAAT,CAAgB,CAAhB,CAAsB,CACpB,GAAI,CACF,CAAI,CAAC,aAAL,CAAmB,GAAI,CAAA,UAAJ,CAAe,OAAf,CAAnB,CACD,CAAC,MAAO,CAAP,CAAU,CACV,GAAI,CAAA,CAAG,CAAG,QAAQ,CAAC,WAAT,CAAqB,aAArB,CAAV,CACA,CAAG,CAAC,cAAJ,CAAmB,OAAnB,OAAwC,MAAxC,CAAgD,CAAhD,CAAmD,CAAnD,CAAsD,CAAtD,CAAyD,EAAzD,CACsB,EADtB,aACsD,CADtD,CACyD,IADzD,CAFU,CAIV,CAAI,CAAC,aAAL,CAAmB,CAAnB,CACD,CACF,C,GAtDG,CAAA,CAAO,CAAqB,QAAlB,QAAO,CAAA,MAAP,EAA8B,MAAM,CAAC,MAAP,GAAkB,MAAhD,CACV,MADU,CACe,QAAhB,QAAO,CAAA,IAAP,EAA4B,IAAI,CAAC,IAAL,GAAc,IAA1C,CACT,IADS,CACgB,QAAlB,QAAO,CAAA,MAAP,EAA8B,MAAM,CAAC,MAAP,GAAkB,MAAhD,CACP,MADO,O,CAyDP,CAAc,CAAG,CAAO,CAAC,SAAR,EAAqB,YAAY,IAAZ,CAAiB,SAAS,CAAC,SAA3B,CAArB,EAA8D,cAAc,IAAd,CAAmB,SAAS,CAAC,SAA7B,CAA9D,EAAyG,CAAC,SAAS,IAAT,CAAc,SAAS,CAAC,SAAxB,C,CAE3H,CAAM,CAAG,CAAO,CAAC,MAAR,GAEQ,QAAlB,QAAO,CAAA,MAAP,EAA8B,MAAM,GAAK,CAA1C,CACI,UAAmB,CAAc,CADrC,CAIG,YAAc,CAAA,iBAAiB,CAAC,SAAhC,EAA6C,CAAC,CAA/C,CACA,SAAiB,CAAjB,CAAuB,CAAvB,CAA6B,CAA7B,CAAmC,IAC/B,CAAA,CAAG,CAAG,CAAO,CAAC,GAAR,EAAe,CAAO,CAAC,SADE,CAE/B,CAAC,CAAG,QAAQ,CAAC,aAAT,CAAuB,GAAvB,CAF2B,CAGnC,CAAI,CAAG,CAAI,EAAI,CAAI,CAAC,IAAb,EAAqB,UAHO,CAKnC,CAAC,CAAC,QAAF,CAAa,CALsB,CAMnC,CAAC,CAAC,GAAF,CAAQ,UAN2B,CAWf,QAAhB,QAAO,CAAA,CAXwB,EAajC,CAAC,CAAC,IAAF,CAAS,CAbwB,CAc7B,CAAC,CAAC,MAAF,GAAa,QAAQ,CAAC,MAdO,CAmB/B,CAAK,CAAC,CAAD,CAnB0B,CAe/B,CAAW,CAAC,CAAC,CAAC,IAAH,CAAX,CACI,CAAQ,CAAC,CAAD,CAAO,CAAP,CAAa,CAAb,CADZ,CAEI,CAAK,CAAC,CAAD,CAAI,CAAC,CAAC,MAAF,CAAW,QAAf,CAjBsB,GAuBjC,CAAC,CAAC,IAAF,CAAS,CAAG,CAAC,eAAJ,CAAoB,CAApB,CAvBwB,CAwBjC,UAAU,CAAC,UAAY,CAAE,CAAG,CAAC,eAAJ,CAAoB,CAAC,CAAC,IAAtB,CAA6B,CAA5C,CAA8C,GAA9C,CAxBuB,CAyBjC,UAAU,CAAC,UAAY,CAAE,CAAK,CAAC,CAAD,CAAK,CAAzB,CAA2B,CAA3B,CAzBuB,CA2BpC,CA5BC,CA+BA,oBAAsB,CAAA,SAAtB,CACA,SAAiB,CAAjB,CAAuB,CAAvB,CAA6B,CAA7B,CAAmC,CAGnC,GAFA,CAAI,CAAG,CAAI,EAAI,CAAI,CAAC,IAAb,EAAqB,UAE5B,CAAoB,QAAhB,QAAO,CAAA,CAAX,CAUE,SAAS,CAAC,gBAAV,CAA2B,CAAG,CAAC,CAAD,CAAO,CAAP,CAA9B,CAA4C,CAA5C,CAVF,KACE,IAAI,CAAW,CAAC,CAAD,CAAf,CACE,CAAQ,CAAC,CAAD,CAAO,CAAP,CAAa,CAAb,CADV,KAEO,CACL,GAAI,CAAA,CAAC,CAAG,QAAQ,CAAC,aAAT,CAAuB,GAAvB,CAAR,CACA,CAAC,CAAC,IAAF,CAAS,CAFJ,CAGL,CAAC,CAAC,MAAF,CAAW,QAHN,CAIL,UAAU,CAAC,UAAY,CAAE,CAAK,CAAC,CAAD,CAAK,CAAzB,CACX,CAIJ,CAhBC,CAmBA,SAAiB,CAAjB,CAAuB,CAAvB,CAA6B,CAA7B,CAAmC,CAAnC,CAA0C,CAS1C,GANA,CAAK,CAAG,CAAK,EAAI,IAAI,CAAC,EAAD,CAAK,QAAL,CAMrB,CALI,CAKJ,GAJE,CAAK,CAAC,QAAN,CAAe,KAAf,CACA,CAAK,CAAC,QAAN,CAAe,IAAf,CAAoB,SAApB,CAAgC,gBAGlC,EAAoB,QAAhB,QAAO,CAAA,CAAX,CAA8B,MAAO,CAAA,CAAQ,CAAC,CAAD,CAAO,CAAP,CAAa,CAAb,CAAf,CATY,GAWtC,CAAA,CAAK,CAAiB,0BAAd,GAAA,CAAI,CAAC,IAXyB,CAYtC,CAAQ,CAAG,eAAe,IAAf,CAAoB,CAAO,CAAC,WAA5B,GAA4C,CAAO,CAAC,MAZzB,CAatC,CAAW,CAAG,eAAe,IAAf,CAAoB,SAAS,CAAC,SAA9B,CAbwB,CAe1C,GAAI,CAAC,CAAW,EAAK,CAAK,EAAI,CAAzB,EAAsC,CAAvC,GAAgF,WAAtB,QAAO,CAAA,UAArE,CAAiG,CAE/F,GAAI,CAAA,CAAM,CAAG,GAAI,CAAA,UAAjB,CACA,CAAM,CAAC,SAAP,CAAmB,UAAY,CAC7B,GAAI,CAAA,CAAG,CAAG,CAAM,CAAC,MAAjB,CACA,CAAG,CAAG,CAAW,CAAG,CAAH,CAAS,CAAG,CAAC,OAAJ,CAAY,cAAZ,CAA4B,uBAA5B,CAFG,CAGzB,CAHyB,CAGlB,CAAK,CAAC,QAAN,CAAe,IAAf,CAAsB,CAHJ,CAIxB,QAAQ,CAAG,CAJa,CAK7B,CAAK,CAAG,IACT,CAT8F,CAU/F,CAAM,CAAC,aAAP,CAAqB,CAArB,CACD,CAXD,IAWO,IACD,CAAA,CAAG,CAAG,CAAO,CAAC,GAAR,EAAe,CAAO,CAAC,SAD5B,CAED,CAAG,CAAG,CAAG,CAAC,eAAJ,CAAoB,CAApB,CAFL,CAGD,CAHC,CAGM,CAAK,CAAC,QAAN,CAAiB,CAHvB,CAIA,QAAQ,CAAC,IAAT,CAAgB,CAJhB,CAKL,CAAK,CAAG,IALH,CAML,UAAU,CAAC,UAAY,CAAE,CAAG,CAAC,eAAJ,CAAoB,CAApB,CAA0B,CAAzC,CAA2C,GAA3C,CACX,CACF,CA1FU,C,CA6Fb,CAAO,CAAC,MAAR,CAAiB,CAAM,CAAC,MAAP,CAAgB,C,CAEX,WAAlB,QAAO,CAAA,M,GACT,MAAM,CAAC,OAAP,CAAiB,C","file":"FileSaver.min.js","sourcesContent":["/*\n* FileSaver.js\n* A saveAs() FileSaver implementation.\n*\n* By Eli Grey, http://eligrey.com\n*\n* License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT)\n* source : http://purl.eligrey.com/github/FileSaver.js\n*/\n\n// The one and only way of getting global scope in all environments\n// https://stackoverflow.com/q/3277182/1008999\nvar _global = typeof window === 'object' && window.window === window\n ? window : typeof self === 'object' && self.self === self\n ? self : typeof global === 'object' && global.global === global\n ? global\n : this\n\nfunction bom (blob, opts) {\n if (typeof opts === 'undefined') opts = { autoBom: false }\n else if (typeof opts !== 'object') {\n console.warn('Deprecated: Expected third argument to be a object')\n opts = { autoBom: !opts }\n }\n\n // prepend BOM for UTF-8 XML and text/* types (including HTML)\n // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF\n if (opts.autoBom && /^\\s*(?:text\\/\\S*|application\\/xml|\\S*\\/\\S*\\+xml)\\s*;.*charset\\s*=\\s*utf-8/i.test(blob.type)) {\n return new Blob([String.fromCharCode(0xFEFF), blob], { type: blob.type })\n }\n return blob\n}\n\nfunction download (url, name, opts) {\n var xhr = new XMLHttpRequest()\n xhr.open('GET', url)\n xhr.responseType = 'blob'\n xhr.onload = function () {\n saveAs(xhr.response, name, opts)\n }\n xhr.onerror = function () {\n console.error('could not download file')\n }\n xhr.send()\n}\n\nfunction corsEnabled (url) {\n var xhr = new XMLHttpRequest()\n // use sync to avoid popup blocker\n xhr.open('HEAD', url, false)\n try {\n xhr.send()\n } catch (e) {}\n return xhr.status >= 200 && xhr.status <= 299\n}\n\n// `a.click()` doesn't work for all browsers (#465)\nfunction click (node) {\n try {\n node.dispatchEvent(new MouseEvent('click'))\n } catch (e) {\n var evt = document.createEvent('MouseEvents')\n evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80,\n 20, false, false, false, false, 0, null)\n node.dispatchEvent(evt)\n }\n}\n\n// Detect WebView inside a native macOS app by ruling out all browsers\n// We just need to check for 'Safari' because all other browsers (besides Firefox) include that too\n// https://www.whatismybrowser.com/guides/the-latest-user-agent/macos\nvar isMacOSWebView = _global.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent)\n\nvar saveAs = _global.saveAs || (\n // probably in some web worker\n (typeof window !== 'object' || window !== _global)\n ? function saveAs () { /* noop */ }\n\n // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView\n : ('download' in HTMLAnchorElement.prototype && !isMacOSWebView)\n ? function saveAs (blob, name, opts) {\n var URL = _global.URL || _global.webkitURL\n var a = document.createElement('a')\n name = name || blob.name || 'download'\n\n a.download = name\n a.rel = 'noopener' // tabnabbing\n\n // TODO: detect chrome extensions & packaged apps\n // a.target = '_blank'\n\n if (typeof blob === 'string') {\n // Support regular links\n a.href = blob\n if (a.origin !== location.origin) {\n corsEnabled(a.href)\n ? download(blob, name, opts)\n : click(a, a.target = '_blank')\n } else {\n click(a)\n }\n } else {\n // Support blobs\n a.href = URL.createObjectURL(blob)\n setTimeout(function () { URL.revokeObjectURL(a.href) }, 4E4) // 40s\n setTimeout(function () { click(a) }, 0)\n }\n }\n\n // Use msSaveOrOpenBlob as a second approach\n : 'msSaveOrOpenBlob' in navigator\n ? function saveAs (blob, name, opts) {\n name = name || blob.name || 'download'\n\n if (typeof blob === 'string') {\n if (corsEnabled(blob)) {\n download(blob, name, opts)\n } else {\n var a = document.createElement('a')\n a.href = blob\n a.target = '_blank'\n setTimeout(function () { click(a) })\n }\n } else {\n navigator.msSaveOrOpenBlob(bom(blob, opts), name)\n }\n }\n\n // Fallback to using FileReader and a popup\n : function saveAs (blob, name, opts, popup) {\n // Open a popup immediately do go around popup blocker\n // Mostly only available on user interaction and the fileReader is async so...\n popup = popup || open('', '_blank')\n if (popup) {\n popup.document.title =\n popup.document.body.innerText = 'downloading...'\n }\n\n if (typeof blob === 'string') return download(blob, name, opts)\n\n var force = blob.type === 'application/octet-stream'\n var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari\n var isChromeIOS = /CriOS\\/[\\d]+/.test(navigator.userAgent)\n\n if ((isChromeIOS || (force && isSafari) || isMacOSWebView) && typeof FileReader !== 'undefined') {\n // Safari doesn't allow downloading of blob URLs\n var reader = new FileReader()\n reader.onloadend = function () {\n var url = reader.result\n url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;')\n if (popup) popup.location.href = url\n else location = url\n popup = null // reverse-tabnabbing #460\n }\n reader.readAsDataURL(blob)\n } else {\n var URL = _global.URL || _global.webkitURL\n var url = URL.createObjectURL(blob)\n if (popup) popup.location = url\n else location.href = url\n popup = null // reverse-tabnabbing #460\n setTimeout(function () { URL.revokeObjectURL(url) }, 4E4) // 40s\n }\n }\n)\n\n_global.saveAs = saveAs.saveAs = saveAs\n\nif (typeof module !== 'undefined') {\n module.exports = saveAs;\n}\n"]} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "_from": "file-saver", |
| | | "_id": "file-saver@2.0.5", |
| | | "_inBundle": false, |
| | | "_integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==", |
| | | "_location": "/file-saver", |
| | | "_phantomChildren": {}, |
| | | "_requested": { |
| | | "type": "tag", |
| | | "registry": true, |
| | | "raw": "file-saver", |
| | | "name": "file-saver", |
| | | "escapedName": "file-saver", |
| | | "rawSpec": "", |
| | | "saveSpec": null, |
| | | "fetchSpec": "latest" |
| | | }, |
| | | "_requiredBy": [ |
| | | "#USER", |
| | | "/" |
| | | ], |
| | | "_resolved": "https://registry.npmmirror.com/file-saver/-/file-saver-2.0.5.tgz", |
| | | "_shasum": "d61cfe2ce059f414d899e9dd6d4107ee25670c38", |
| | | "_spec": "file-saver", |
| | | "_where": "D:\\HBuilderProjects\\JeecgUniapp-2.0.1", |
| | | "author": { |
| | | "name": "Eli Grey", |
| | | "email": "me@eligrey.com" |
| | | }, |
| | | "bugs": { |
| | | "url": "https://github.com/eligrey/FileSaver.js/issues" |
| | | }, |
| | | "bundleDependencies": false, |
| | | "deprecated": false, |
| | | "description": "An HTML5 saveAs() FileSaver implementation", |
| | | "devDependencies": { |
| | | "@babel/cli": "^7.1.0", |
| | | "@babel/core": "^7.1.0", |
| | | "@babel/plugin-transform-modules-umd": "^7.1.0", |
| | | "babel-preset-minify": "^0.4.3" |
| | | }, |
| | | "files": [ |
| | | "dist/FileSaver.js", |
| | | "dist/FileSaver.min.js", |
| | | "dist/FileSaver.min.js.map", |
| | | "src/FileSaver.js" |
| | | ], |
| | | "homepage": "https://github.com/eligrey/FileSaver.js#readme", |
| | | "keywords": [ |
| | | "filesaver", |
| | | "saveas", |
| | | "blob" |
| | | ], |
| | | "license": "MIT", |
| | | "main": "dist/FileSaver.min.js", |
| | | "name": "file-saver", |
| | | "repository": { |
| | | "type": "git", |
| | | "url": "git+https://github.com/eligrey/FileSaver.js.git" |
| | | }, |
| | | "scripts": { |
| | | "build": "npm run build:development && npm run build:production", |
| | | "build:development": "babel -o dist/FileSaver.js --plugins @babel/plugin-transform-modules-umd src/FileSaver.js", |
| | | "build:production": "babel -o dist/FileSaver.min.js -s --plugins @babel/plugin-transform-modules-umd --presets minify src/FileSaver.js", |
| | | "prepublishOnly": "npm run build", |
| | | "test": "echo \"Error: no test specified\" && exit 0" |
| | | }, |
| | | "version": "2.0.5" |
| | | } |
| | |
| | | "resolved": "https://registry.npmmirror.com/@dcloudio/uni-ui/-/uni-ui-1.5.7.tgz", |
| | | "integrity": "sha512-DugxSIrQrze1FLdUOj9a+JEQ0bHGjnJTcGUK1mN/MivKg7nuKJBRWk5Ipa9sUdoBznX6ndz5h2e7Uao6x1CdCw==" |
| | | }, |
| | | "file-saver": { |
| | | "version": "2.0.5", |
| | | "resolved": "https://registry.npmmirror.com/file-saver/-/file-saver-2.0.5.tgz", |
| | | "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==" |
| | | }, |
| | | "html5-qrcode": { |
| | | "version": "2.3.8", |
| | | "resolved": "https://registry.npmmirror.com/html5-qrcode/-/html5-qrcode-2.3.8.tgz", |
| | |
| | | case (name === 'å¨ä¿æ§è¡' && type === '设å¤å¨ä¿'): |
| | | url = '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure'; |
| | | break; |
| | | case (name === 'å¨ä¿é¢å' && type === '设å¤å¨ä¿'): |
| | | url = '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure'; |
| | | break; |
| | | case (name === 'çç»é¿ç¡®è®¤' && type === '设å¤ç¹æ£'): |
| | | url = '/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure'; |
| | | break; |
| | |
| | | </uni-collapse> |
| | | |
| | | |
| | | <uni-forms ref="form" :modelValue="ScanData" validate-trigger="bind" err-show-type="undertext"> |
| | | <uni-forms v-show="isShowSure" ref="form" :modelValue="ScanData" validate-trigger="bind" err-show-type="undertext"> |
| | | <uni-group top="1"> |
| | | <view class="divider"><text>çç»é¿ç¡®è®¤ä¿¡æ¯</text></view> |
| | | <!-- <view class="text-gray margin-bottom-lg">âââââââââçç»é¿ç¡®è®¤ä¿¡æ¯ââââââââââ</view> --> |
| | |
| | | <uni-easyinput type="textarea" v-model="ScanData.initialAcceptanceComment" placeholder="请è¾å
¥æè§" |
| | | :disabled="isShowLast" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="80" required name="randomInspectionFlag" label="æ½æ£æ è®°:"> |
| | | <uni-forms-item :label-width="80" name="randomInspectionFlag" label="æ½æ£æ è®°:"> |
| | | <uni-data-select v-model="ScanData.InspectionFlagName" |
| | | :localdata="ScanData.randomInspectionFlagList" @change="changehandlingInspectionFlag" |
| | | placeholder="è¯·éæ©" :disabled="isShowLast"/> |
| | | placeholder="è¯·éæ©" :disabled="isShowLast"/> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="80" name="outNum" label="åéªæ¶éä»¶:"> |
| | | <uni-file-picker limit="9" :value="fileList" :image-styles="imageStyles" |
| | |
| | | <uni-easyinput type="textarea" v-model="ScanData.finalAcceptanceComment" placeholder="请è¾å
¥æè§" |
| | | :disabled="isfinal" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="80" required name="finalFlagName" label="æ½æ£æ è®°:"> |
| | | <uni-forms-item :label-width="80" name="finalFlagName" label="æ½æ£æ è®°:"> |
| | | <uni-data-select v-model="ScanData.finalFlagName" :localdata="ScanData.finalInspectionFlagList" |
| | | @change="changehandlingFinalFlag" placeholder="è¯·éæ©" :disabled="isfinal" /> |
| | | </uni-forms-item> |
| | |
| | | */ |
| | | case 'WAIT_FINAL_ACCEPTANCE': |
| | | if (this.flag == 'task') { |
| | | this.title = 'ç»éª' |
| | | this.title = '详æ
' |
| | | this.readonly = true |
| | | this.readonlyFirst = true |
| | | this.isHideFist = true; |
| | |
| | | |
| | | break |
| | | case 'COMPLETE': |
| | | this.isShowSure = true; |
| | | this.isShowSure = true |
| | | this.isHideLast = true |
| | | this.isHideFist = true |
| | | this.isShowLast = true |
| | |
| | | this.isShowBtn = false |
| | | this.title = '详æ
' |
| | | break |
| | | |
| | | case 'UNDER_MAINTENANCE': |
| | | |
| | | this.isfinal = true |
| | | this.readonlyFirst = true |
| | | this.readonly = true |
| | | this.readonlyFirstFanl = true |
| | | this.isShowBtn = false |
| | | this.title = '详æ
' |
| | | break |
| | | |
| | | } |
| | | this.ScanData.initialAcceptanceComment = this.announcement1.initialAcceptanceComment |
| | | this.ScanData.typeName = this.announcement1.confirmDealType |
| | |
| | | <script> |
| | | import index from "../../../../store"; |
| | | import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; |
| | | import configService from "@/common/service/config.service.js"; |
| | | export default { |
| | | mixins: [MescrollMixin], // 使ç¨mixin |
| | | data() { |
| | |
| | | sourceType: ['album', 'camera'], |
| | | isClick: false, |
| | | scrollLeft: 0, |
| | | ipAndPort: configService.staticURL, |
| | | searchValue: '', |
| | | imgList: [], |
| | | equipmentList: [], |
| | |
| | | this.standardId = this.announcement1.standardId |
| | | this.getStandardFile() |
| | | } |
| | | this.formData.num = this.announcement1.equipmentId, |
| | | this.formData.orderNum = this.announcement1.orderNum, |
| | | this.formData.operator = this.announcement1.operator, |
| | | this.formData.inspectionDate = this.announcement1.inspectionDate, |
| | | this.hasInspectionDateArrived(); |
| | | this.formData.num = this.announcement1.equipmentId |
| | | this.formData.remark = this.announcement1.remark |
| | | this.formData.orderNum = this.announcement1.orderNum |
| | | this.formData.operator = this.announcement1.operator |
| | | this.formData.inspectionDate = this.announcement1.inspectionDate |
| | | this.hasInspectionDateArrived(); |
| | | |
| | | |
| | | } |
| | |
| | | <!-- <view class="text-gray margin-bottom-lg">âââââââââ管çåé¢ç¨å¤ä»¶ââââââââââ</view> --> |
| | | <uni-forms-item :label-width="100" required name="sparePartDescription" label="å¤ä»¶æè¿°:"> |
| | | <uni-easyinput type="textarea" v-model="ScanData.sparePartDescription" placeholder="请è¾å
¥å¤ä»¶æè¿°" |
| | | :disabled="isRuning" /> |
| | | :disabled="isRuning"/> |
| | | </uni-forms-item> |
| | | |
| | | </uni-group> |
| | |
| | | } |
| | | |
| | | |
| | | // if (this.formData.reportStatus == 'UNDER_REPAIR' && this.formData.isSpare == 0 && this.flag !== 'task') { |
| | | // if (this.formData.faultReason == undefined || this.formData.faultReason == null || |
| | | // this |
| | | // .formData.faultReason == |
| | | // '') { |
| | | |
| | | // uni.showToast({ |
| | | // icon: 'none', |
| | | // title: 'æ
éåå ä¸è½ä¸ºç©º' |
| | | // }); |
| | | // return false; |
| | | // } |
| | | // if (this.formData.repairDescription == undefined || this.formData.repairDescription == null || |
| | | // this |
| | | // .formData.repairDescription == |
| | | // '') { |
| | | |
| | | // uni.showToast({ |
| | | // icon: 'none', |
| | | // title: 'ç»´ä¿®ç»æä¸è½ä¸ºç©º' |
| | | // }); |
| | | // return false; |
| | | // } |
| | | |
| | | // } |
| | | // if (this.formData.reportStatus == 'UNDER_REPAIR' && this.formData.isSpare == 1 && this.flag !== 'task') { |
| | | // if (this.formData.faultReason == undefined || this.formData.faultReason == null || |
| | | // this |
| | | // .formData.faultReason == |
| | | // '') { |
| | | |
| | | // uni.showToast({ |
| | | // icon: 'none', |
| | | // title: 'æ
éåå ä¸è½ä¸ºç©º' |
| | | // }); |
| | | // return false; |
| | | // } |
| | | // if (this.formData.repairDescription == undefined || this.formData.repairDescription == null || |
| | | // this |
| | | // .formData.repairDescription == |
| | | // '') { |
| | | |
| | | // uni.showToast({ |
| | | // icon: 'none', |
| | | // title: 'ç»´ä¿®ç»æä¸è½ä¸ºç©º' |
| | | // }); |
| | | // return false; |
| | | // } |
| | | |
| | | // } |
| | | if (this.formData.reportStatus == 'UNDER_REPAIR' && this.flag !== 'task') { |
| | | |
| | | if (this.formData.reportStatus == 'UNDER_REPAIR' && this.flag !== 'task' && this.formData.isSpare == 0) { |
| | | if (this.formData.faultReason == undefined || this.formData.faultReason == null || this.formData.faultReason == '') { |
| | | uni.showToast({ |
| | | icon: 'none', |
| | |
| | | announcement1: [], |
| | | msg1Count: 0, |
| | | msg2Count: 0, |
| | | msg1Title: "" |
| | | msg1Title: "", |
| | | equipmentId:'' |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | this.mescroll.resetUpScroll() |
| | | } |
| | | }, |
| | | |
| | | onLoad: function(options) { |
| | | this.equipmentId = options.equipmentId ? |
| | | decodeURIComponent(options.equipmentId) : |
| | | ''; |
| | | }, |
| | | created() {}, |
| | | methods: { |
| | | changehandlingInspectionFlag(e) { |
| | |
| | | pageSize: page.size, |
| | | order: 'desc', |
| | | column: 'createTime', |
| | | maintenanceStatus: 'WAIT_MAINTENANCE' |
| | | maintenanceStatus: 'WAIT_MAINTENANCE', |
| | | equipmentId: this.equipmentId || '' |
| | | }, |
| | | |
| | | }).then(res => { |
| | |
| | | mixins: [MescrollMixin], // 使ç¨mixin |
| | | data() { |
| | | return { |
| | | equipmentList:[], |
| | | equipmentList: [], |
| | | type: 'top', |
| | | scrollLeft: 0, |
| | | formData: { |
| | |
| | | announcement1: [], |
| | | msg1Count: 0, |
| | | msg2Count: 0, |
| | | msg1Title: "" |
| | | msg1Title: "", |
| | | equipmentId: '' |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | this.mescroll.resetUpScroll() |
| | | } |
| | | }, |
| | | |
| | | onLoad: function(options) { |
| | | this.equipmentId = options.equipmentId ? |
| | | decodeURIComponent(options.equipmentId) : |
| | | ''; |
| | | }, |
| | | created() { |
| | | this.getEquipment() |
| | | }, |
| | |
| | | pageSize: 9999, |
| | | order: 'desc', |
| | | column: 'createTime' |
| | | |
| | | }, |
| | | |
| | | |
| | | }).then(res => { |
| | | //设置åè¡¨æ°æ® |
| | | if (res.data.success) { |
| | |
| | | title: res.data.message, |
| | | duration: 2000 |
| | | }); |
| | | |
| | | |
| | | } |
| | | }).catch(() => { |
| | | this.$tip.error("èç½å¤±è´¥") |
| | |
| | | search() { |
| | | this.$refs.popup.open(); |
| | | }, |
| | | |
| | | |
| | | upCallback(page) { |
| | | // ç¡®ä¿ equipmentId å§ç»ä½ä¸ºåæ°ä¼ éï¼å¼ä¸ºææå符串æç©ºå符串 |
| | | const params = { |
| | | pageNo: page.num, |
| | | pageSize: page.size, |
| | | order: 'desc', |
| | | column: 'createTime', |
| | | inspectionStatus: 'WAIT_INSPECTION', |
| | | equipmentId: this.equipmentId || '' |
| | | }; |
| | | |
| | | this.$http.get(this.url.stallList, { |
| | | params |
| | | }) |
| | | .then(res => { |
| | | if (!res.data.success) { |
| | | throw new Error('è·åæ°æ®å¤±è´¥: ' + res.data.message); |
| | | } |
| | | |
| | | const records = res.data.result.records || []; |
| | | const total = res.data.result.total || 0; |
| | | |
| | | // æ´æ°æ¶æ¯è®¡æ°åæ é¢ |
| | | this.msg1Count = total; |
| | | this.msg1Title = `éç¥(${total})`; |
| | | |
| | | // æ´æ°åè¡¨æ°æ® |
| | | this.msgList = page.num === 1 ? [...records] : [...this.msgList, ...records]; |
| | | |
| | | // ç»æå è½½ç¶æ |
| | | this.mescroll.endSuccess(records.length); |
| | | console.log('è¯·æ±æå', res.data); |
| | | }) |
| | | .catch(error => { |
| | | console.error('请æ±å¤±è´¥', error); |
| | | this.mescroll.endErr(); |
| | | }); |
| | | }, |
| | | |
| | | |
| | | // upCallback(page) { |
| | | // this.$http.get(this.url.stallList, { |
| | | // params: { |
| | | // pageNo: page.num, |
| | | // pageSize: page.size, |
| | | // order: 'desc', |
| | | // column: 'createTime', |
| | | // inspectionStatus: 'WAIT_INSPECTION', |
| | | // equipmentId:this.equipmentId || '' |
| | | // }, |
| | | |
| | | // }).then(res => { |
| | | // this.announcement1 = res.data.result.records |
| | | // this.mescroll.endSuccess(this.announcement1.length); |
| | | // console.log("url", res) |
| | | // //设置åè¡¨æ°æ® |
| | | // if (res.data.success) { |
| | | // console.log("res", res.data) |
| | | // this.msg1Count = res.data.result.total |
| | | // this.msg1Title = "éç¥(" + res.data.result.total + ")"; |
| | | // for (let annItem of this.announcement1) { |
| | | // this.msgList.push(annItem) |
| | | // } |
| | | // } |
| | | // if (page.num == 1) { |
| | | // this.msgList = []; //妿æ¯ç¬¬ä¸é¡µéæå¨å¶ç©ºå表 |
| | | // this.msgList = this.msgList.concat(this.announcement1); //è¿½å æ°æ°æ® |
| | | // } |
| | | |
| | | // }).catch(() => { |
| | | // //èç½å¤±è´¥, ç»æå è½½ |
| | | // this.mescroll.endErr(); |
| | | // }) |
| | | |
| | | // }, |
| | | |
| | | |
| | | resetTask() { |
| | | this.formData.orderNum = '' |
| | | this.formData.num = '' |
| | | this.$refs.popup.close(); |
| | | this.mescroll.resetUpScroll() |
| | | |
| | | }, |
| | | /* æ£ç´¢ */ |
| | | getSera() { |
| | | this.$refs.popup.close(); |
| | | this.msgList = []; |
| | | this.$http.get(this.url.stallList, { |
| | | params: { |
| | | pageNo: page.num, |
| | | pageSize: page.size, |
| | | order: 'desc', |
| | | column: 'createTime', |
| | | inspectionStatus: 'WAIT_INSPECTION' |
| | | }, |
| | | pageNo: 1, |
| | | pageSize: 999, |
| | | order: "desc", |
| | | column: "createTime", |
| | | inspectionStatus: 'WAIT_INSPECTION', |
| | | equipmentId: this.formData.num, |
| | | orderNum: this.formData.orderNum |
| | | |
| | | } |
| | | }).then(res => { |
| | | //èç½æåçåè°,éè䏿巿°å䏿å è½½çç¶æ; |
| | | |
| | | this.announcement1 = res.data.result.records |
| | | this.mescroll.endSuccess(this.announcement1.length); |
| | | console.log("url", res) |
| | |
| | | //èç½å¤±è´¥, ç»æå è½½ |
| | | this.mescroll.endErr(); |
| | | }) |
| | | |
| | | }, |
| | | |
| | | |
| | | resetTask() { |
| | | this.formData.orderNum = '' |
| | | this.formData.num = '' |
| | | this.$refs.popup.close(); |
| | | this.mescroll.resetUpScroll() |
| | | |
| | | }, |
| | | /* æ£ç´¢ */ |
| | | getSera() { |
| | | this.$refs.popup.close(); |
| | | this.msgList = []; |
| | | this.$http.get(this.url.stallList, { |
| | | params: { |
| | | pageNo: 1, |
| | | pageSize: 999, |
| | | order: "desc", |
| | | column: "createTime", |
| | | inspectionStatus: 'WAIT_INSPECTION', |
| | | equipmentId: this.formData.num, |
| | | orderNum: this.formData.orderNum |
| | | |
| | | } |
| | | }).then(res => { |
| | | //èç½æåçåè°,éè䏿巿°å䏿å è½½çç¶æ; |
| | | |
| | | this.announcement1 = res.data.result.records |
| | | this.mescroll.endSuccess(this.announcement1.length); |
| | | console.log("url", res) |
| | | //设置åè¡¨æ°æ® |
| | | if (res.data.success) { |
| | | console.log("res", res.data) |
| | | this.msg1Count = res.data.result.total |
| | | this.msg1Title = "éç¥(" + res.data.result.total + ")"; |
| | | for (let annItem of this.announcement1) { |
| | | this.msgList.push(annItem) |
| | | } |
| | | } |
| | | if (page.num == 1) { |
| | | this.msgList = []; //妿æ¯ç¬¬ä¸é¡µéæå¨å¶ç©ºå表 |
| | | this.msgList = this.msgList.concat(this.announcement1); //è¿½å æ°æ°æ® |
| | | } |
| | | |
| | | }).catch(() => { |
| | | //èç½å¤±è´¥, ç»æå è½½ |
| | | this.mescroll.endErr(); |
| | | }) |
| | | }, |
| | | |
| | | |
| | |
| | | </view> |
| | | </view> |
| | | <view class="flex"> |
| | | <view class="flex-sub text-light bg-white padding-xs margin-xs radius">ç»´ä¿®ç¶æ::</view> |
| | | <view class="flex-sub text-light bg-white padding-xs margin-xs radius">ç»´ä¿®ç¶æ:</view> |
| | | <view class="flex-sub bg-white padding-xs margin-xs text-orange radius text-right"> |
| | | {{item.assetStatus_dictText}} |
| | | </view> |
| | |
| | | }, |
| | | computed: { |
| | | top() { |
| | | return this.CustomBar * 2 + 160 |
| | | return this.CustomBar * 2 + 100 |
| | | }, |
| | | style() { |
| | | var StatusBar = this.StatusBar; |
| | |
| | | |
| | | <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> |
| | | <uni-group top="1"> |
| | | |
| | | <uni-forms-item :label-width="100" required name="num" label="设å¤ç¼å·:"> |
| | | <uni-easyinput v-model="formData.equipmentCode" :disabled="true" /> |
| | | </uni-forms-item> |
| | | |
| | | <uni-forms-item :label-width="100" name="remark" label="设å¤åç§°:"> |
| | | <uni-easyinput v-model="formData.equipmentName" :disabled="true" /> |
| | | </uni-forms-item> |
| | | <!-- <uni-forms-item :label-width="100" name="outNum" label="å
³é®è®¾å¤æ è¯:"> |
| | | |
| | | <uni-forms-item :label-width="100" required name="num" label="设å¤ç¼å·:"> |
| | | <uni-easyinput v-model="formData.equipmentCode" :disabled="true" /> |
| | | </uni-forms-item> |
| | | |
| | | <uni-forms-item :label-width="100" name="remark" label="设å¤åç§°:"> |
| | | <uni-easyinput v-model="formData.equipmentName" :disabled="true" /> |
| | | </uni-forms-item> |
| | | <!-- <uni-forms-item :label-width="100" name="outNum" label="å
³é®è®¾å¤æ è¯:"> |
| | | <uni-easyinput v-model="formData.equipmentImportance" :disabled="true" /> |
| | | </uni-forms-item> --> |
| | | <view class="text-gray margin-bottom-lg">ââââââââââ åºæ¬ä¿¡æ¯ ââââââââââ</view> |
| | | <uni-forms-item :label-width="100" name="taskCode" label="ç»´ä¿®ç¶æ:"> |
| | | <uni-easyinput :disabled="true" v-model="formData.repairStatus_dictText" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="100" name="endLocation" label="ä¿å
»ç¶æ:"> |
| | | <uni-easyinput :disabled="true" v-model="formData.maintenanceStatus_dictText" /> |
| | | |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="100" name="endLocation" label="使ç¨è½¦é´:"> |
| | | <uni-easyinput :disabled="true" v-model="formData.orgId_dictText" /> |
| | | |
| | | </uni-forms-item> |
| | | |
| | | <uni-forms-item :label-width="100" name="endLocation" label="å®è£
ä½ç½®:"> |
| | | <uni-easyinput :disabled="true" v-model="formData.installationPosition" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="100" name="endLocation" label="ææ¯ç¶æ:"> |
| | | <uni-easyinput :disabled="true" v-model="formData.technologyStatus_dictText" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="100" name="endLocation" label="设å¤ç®¡çå:"> |
| | | <uni-easyinput :disabled="true" v-model="formData.equipmentManager_dictText" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="100" name="endLocation" label="åºåæ¥æ:"> |
| | | <uni-easyinput :disabled="true" v-model="formData.leaveFactoryDate" /> |
| | | </uni-forms-item> |
| | | <view class="text-gray margin-bottom-lg">ââââââââââ åºæ¬ä¿¡æ¯ ââââââââââ</view> |
| | | <uni-forms-item :label-width="100" name="taskCode" label="ç»´ä¿®ç¶æ:"> |
| | | <uni-easyinput :disabled="true" v-model="formData.repairStatus_dictText" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="100" name="endLocation" label="ä¿å
»ç¶æ:"> |
| | | <uni-easyinput :disabled="true" v-model="formData.maintenanceStatus_dictText" /> |
| | | |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="100" name="endLocation" label="使ç¨è½¦é´:"> |
| | | <uni-easyinput :disabled="true" v-model="formData.orgId_dictText" /> |
| | | |
| | | </uni-forms-item> |
| | | |
| | | <uni-forms-item :label-width="100" name="endLocation" label="å®è£
ä½ç½®:"> |
| | | <uni-easyinput :disabled="true" v-model="formData.installationPosition" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="100" name="endLocation" label="ææ¯ç¶æ:"> |
| | | <uni-easyinput :disabled="true" v-model="formData.technologyStatus_dictText" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="100" name="endLocation" label="设å¤ç®¡çå:"> |
| | | <uni-easyinput :disabled="true" v-model="formData.equipmentManager_dictText" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="100" name="endLocation" label="åºåæ¥æ:"> |
| | | <uni-easyinput :disabled="true" v-model="formData.leaveFactoryDate" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item :label-width="100" name="outNum" label="è®¾å¤ææ¡£:"> |
| | | <uni-file-picker v-model="fileLists" :extension="['.pdf']" @fail="uploadFail" |
| | | :list-styles="listStyles" :delIcon="del" :max-count="5" file-mediatype="all" |
| | | @downloadFile="downloadFile" @select="onFileSelect" @delete="onFileDelete"> |
| | | <button size="mini" type="primary">ç¹å»ä¸ä¼ </button> |
| | | </uni-file-picker> |
| | | </uni-forms-item> |
| | | </uni-group> |
| | | </uni-forms> |
| | | |
| | | |
| | | <view class="file-list margin-sm"> |
| | | <view class="file-item" v-for="(file, index) in this.selectedFiles" :key="index"> |
| | | <view class="file-icon"> |
| | | <!-- æä»¶å¾æ --> |
| | | <image src="/static/icon_file.png" style="height: 25px; width: 25px; margin-right: 10px;" |
| | | mode='aspectFit' class="zai-logo "></image> |
| | | |
| | | </view> |
| | | <view class="file-name"> |
| | | <!-- æä»¶å --> |
| | | {{file.fileName}} |
| | | </view> |
| | | <view class="file-actions"> |
| | | <!-- ä¸è½½æé® --> |
| | | <image v-show="showBtn" src="/static/icon_down.png" @click="downloadFile(file)" |
| | | style="height: 25px; width: 25px; margin-right: 10px;"></image> |
| | | <!-- <button size="mini" @click="downloadFile(file)"> |
| | | <view class="icon-download">ä¸è½½</view> |
| | | </button> --> |
| | | <!-- å é¤æé® --> |
| | | <image v-show="showBtn" src="/static/icon_del.png" @click="deleteFile(index)" |
| | | style="height: 25px; width: 25px;"></image> |
| | | </button> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="flex margin-bottom-xs"> |
| | | <button class="flex-sub cu-btn bg-blue margin-sm lg" hover-class="is-hover" |
| | | @click="goReportRepair()">æ¥ä¿®</button> |
| | |
| | | |
| | | <script> |
| | | import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; |
| | | import { |
| | | saveAs |
| | | } from 'file-saver'; // å¼å
¥ file-saver åº |
| | | export default { |
| | | mixins: [MescrollMixin], // 使ç¨mixin |
| | | data() { |
| | | return { |
| | | showBtn: true, |
| | | listStyles: { |
| | | "borderStyle": { |
| | | "width": "0", // è¾¹æ¡å®½åº¦ |
| | | }, |
| | | "border": false, // æ¯å¦æ¾ç¤ºè¾¹æ¡ |
| | | "dividline": false |
| | | }, |
| | | |
| | | del: true, |
| | | scrollLeft: 0, |
| | | searchValue: '', |
| | | formData: {}, |
| | | NavBarColor: this.NavBarColor, |
| | | url: { |
| | | stallList: "/eam/equipment/queryById" |
| | | fileList: 'eam/equipmentAttachment/list', |
| | | stallList: "/eam/equipment/queryById", |
| | | upload: "/eam/sysFiles/batch_upload", |
| | | add: 'eam/equipmentAttachment/add', |
| | | downloadFile: 'eam/equipmentAttachment/downloadFile' |
| | | }, |
| | | uploading: false, // æ¯å¦æ£å¨ä¸ä¼ |
| | | selectedFiles: [], |
| | | formData: { |
| | | fileLists: [] |
| | | }, |
| | | fileLists: [], |
| | | id: '', |
| | | upOption: { |
| | | page: { |
| | |
| | | }, |
| | | created() { |
| | | this.upCallback() |
| | | this.getFileList() |
| | | }, |
| | | methods: { |
| | | goHome() { |
| | | uni.reLaunch({ |
| | | url: '/pages/index/index' |
| | | downloadFile(item) { |
| | | uni.showModal({ |
| | | title: 'æç¤º', |
| | | content: '确认è¦ä¸è½½å', |
| | | cancelText: 'åæ¶', |
| | | confirmText: '确认', |
| | | success: res => { |
| | | if (res.confirm) { |
| | | this.downFile(item) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | |
| | | |
| | | downFile(item) { |
| | | this.$http.download(this.url.downloadFile, { |
| | | params: { |
| | | id: item.id |
| | | }, |
| | | responseType: 'blob' // ç¡®ä¿ååºç±»å为 blob |
| | | }).then(response => { |
| | | console.log('Response:', response); // æ¥ç宿´ååºç»æ |
| | | |
| | | // è·å tempFilePathï¼Blob URLï¼ |
| | | const tempFilePath = response.tempFilePath; |
| | | |
| | | if (!tempFilePath) { |
| | | uni.showToast({ |
| | | title: 'æä»¶ä¸è½½å¤±è´¥', |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | let fileName = item.fileName; |
| | | |
| | | // å建 <a> æ ç¾å¹¶è§¦åä¸è½½ |
| | | const link = document.createElement('a'); |
| | | link.href = tempFilePath; |
| | | link.setAttribute('download', fileName); |
| | | link.style.display = 'none'; |
| | | |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | |
| | | // æ¸
çèµæº |
| | | document.body.removeChild(link); |
| | | |
| | | }).catch(err => { |
| | | console.error('Download error:', err); |
| | | uni.showToast({ |
| | | title: 'æä»¶ä¸è½½å¤±è´¥', |
| | | icon: 'none' |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | |
| | | |
| | | |
| | | // downFile(item) { |
| | | // this.$http.download(this.url.downloadFile, { |
| | | // params: { |
| | | // id:item.id |
| | | // }, |
| | | // }).then(res => { |
| | | // if (!res) { |
| | | // this.$message.warning('æä»¶ä¸è½½å¤±è´¥') |
| | | // return |
| | | // } else { |
| | | // let fileName = item.fileName; |
| | | // if (typeof window.navigator.msSaveBlob !== 'undefined') { |
| | | // window.navigator.msSaveBlob(new Blob([res]), fileName); |
| | | // } else { |
| | | // let url = window.URL.createObjectURL(new Blob([res])); |
| | | // let link = document.createElement('a'); |
| | | // link.style.display = 'none'; |
| | | // link.href = url; |
| | | // link.setAttribute('download', fileName); |
| | | // document.body.appendChild(link); |
| | | // link.click() |
| | | // document.body.removeChild(link) //ä¸è½½å®æç§»é¤å
ç´ |
| | | // window.URL.revokeObjectURL(url) //éæ¾æblob对象 |
| | | // } |
| | | // } |
| | | // }).catch((err) => { |
| | | // uni.showToast({ |
| | | // title: 'è·åæä»¶å表失败', |
| | | // icon: 'none' |
| | | // }); |
| | | // }); |
| | | // }, |
| | | |
| | | |
| | | getFileList() { |
| | | this.$http.get(this.url.fileList, { |
| | | params: { |
| | | equipmentId: this.id, |
| | | pageNo: 1, |
| | | pageSize: 999, |
| | | column: 'createTime', |
| | | order: 'desc' |
| | | }, |
| | | }).then(res => { |
| | | if (res.data.success) { |
| | | this.selectedFiles = res.data.result.records || []; |
| | | |
| | | } |
| | | }).catch(() => { |
| | | uni.showToast({ |
| | | title: 'è·åæä»¶å表失败', |
| | | icon: 'none' |
| | | }); |
| | | }); |
| | | }, |
| | | uploadFail(e) { |
| | | console.log('ä¸ä¼ 失败ï¼', e) |
| | | }, |
| | | |
| | | |
| | | |
| | | onFileSelect(e) { |
| | | const tempFilePaths = e.tempFilePaths; |
| | | |
| | | uni.showLoading({ |
| | | title: 'ä¸ä¼ ä¸...' |
| | | }); |
| | | |
| | | const uploadPromises = tempFilePaths.map((filePath, index) => { |
| | | return new Promise((resolve, reject) => { |
| | | this.$http.upload(this.url.upload, { |
| | | filePath: filePath, |
| | | name: 'file' |
| | | }) |
| | | .then(uploadRes => { |
| | | const serverFile = uploadRes.data.result[0]; |
| | | console.log(serverFile); |
| | | // æåfileSuffixå¹¶æ¼æ¥ |
| | | if (serverFile.fileSuffix && serverFile.fileName && !serverFile |
| | | .fileName.includes('.')) { |
| | | serverFile.fileName += '.' + serverFile.fileSuffix; |
| | | } |
| | | this.fileLists = []; |
| | | // 鲿¢é夿·»å ï¼æ ¹æ® id æ fileName å¤æï¼ |
| | | if (!this.fileLists.some(file => file.id === serverFile.id)) { |
| | | this.fileLists.push(serverFile); |
| | | } |
| | | resolve(); |
| | | }) |
| | | .catch(err => { |
| | | console.error(`æä»¶ ${index + 1} ä¸ä¼ 失败`, err); |
| | | uni.showToast({ |
| | | title: `第 ${index + 1} 个æä»¶ä¸ä¼ 失败`, |
| | | icon: 'none' |
| | | }); |
| | | reject(err); |
| | | }); |
| | | }); |
| | | }); |
| | | |
| | | Promise.all(uploadPromises) |
| | | .then(() => { |
| | | uni.hideLoading(); |
| | | uni.showToast({ |
| | | title: 'å
¨é¨ä¸ä¼ æåï¼æ£å¨æäº¤...' |
| | | }); |
| | | this.submitFileList(); // èªå¨æäº¤æææä»¶ |
| | | }) |
| | | .catch(() => { |
| | | uni.hideLoading(); |
| | | uni.showToast({ |
| | | title: 'é¨åä¸ä¼ 失败', |
| | | icon: 'none' |
| | | }); |
| | | }); |
| | | }, |
| | | // æä»¶å é¤åè° |
| | | onFileDelete(e) { |
| | | console.log('å 餿件:', e.index); |
| | | }, |
| | | |
| | | // å é¤å个æä»¶ |
| | | deleteFile(index) { |
| | | this.fileLists.splice(index, 1); |
| | | }, |
| | | |
| | | |
| | | submitFileList() { |
| | | if (!this.fileLists.length) { |
| | | uni.showToast({ |
| | | title: '没æå¯æäº¤çæä»¶', |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | | } |
| | | console.log(this.fileLists) |
| | | this.$http.post(this.url.add, { |
| | | equipmentId: this.id, |
| | | fileList: this.fileLists |
| | | }).then(res => { |
| | | if (res.data.success) { |
| | | uni.showToast({ |
| | | title: 'æäº¤æå' |
| | | }); |
| | | this.getFileList(); |
| | | } else { |
| | | uni.showToast({ |
| | | title: 'æäº¤å¤±è´¥', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }).catch(err => { |
| | | uni.showToast({ |
| | | title: 'æäº¤å¼å¸¸', |
| | | icon: 'none' |
| | | }); |
| | | console.error('æäº¤å¤±è´¥:', err); |
| | | }); |
| | | }, |
| | | /** |
| | | * æ¥ä¿® |
| | | */ |
| | | goReportRepair() { |
| | | console.log('getSera æ¹æ³è¢«è°ç¨'); |
| | | uni.navigateTo({ |
| | | url: `/pages/reportRepair/reportRepair?equipmentId=${encodeURIComponent(this.id)}`, |
| | | uni.redirectTo({ |
| | | url: `/pages/reportRepair/reportRepair?equipmentId=${encodeURIComponent(this.id)}` |
| | | }); |
| | | }, |
| | | /** |
| | | * ç¹æ£ |
| | | */ |
| | | goCheck() { |
| | | uni.navigateTo({ |
| | | url: '/pages/checkList/checkList', |
| | | uni.redirectTo({ |
| | | // url: '/pages/checkList/checkList', |
| | | url: `/pages/checkList/checkList?equipmentId=${encodeURIComponent(this.id)}` |
| | | }); |
| | | }, |
| | | /** |
| | | * å¨ä¿ |
| | | */ |
| | | goBaoZhou() { |
| | | uni.navigateTo({ |
| | | url: '/pages/baoZhou/baoZhou', |
| | | uni.redirectTo({ |
| | | // url: '/pages/baoZhou/baoZhou', |
| | | url: `/pages/baoZhou/baoZhou?equipmentId=${encodeURIComponent(this.id)}` |
| | | }); |
| | | }, |
| | | /** |
| | | * ç»´ä¿® |
| | | */ |
| | | goMaintenance() { |
| | | uni.navigateTo({ |
| | | url: '/pages/maintenanceReport/maintenanceReport', |
| | | uni.redirectTo({ |
| | | // url: '/pages/maintenanceReport/maintenanceReport', |
| | | url: `/pages/maintenanceReport/maintenanceReport?equipmentId=${encodeURIComponent(this.id)}` |
| | | }); |
| | | }, |
| | | |
| | | |
| | | upCallback() { |
| | | this.$http.get(this.url.stallList, { |
| | | params: { |
| | |
| | | </script> |
| | | |
| | | <style> |
| | | .file-list { |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .file-item { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | padding: 10px; |
| | | border-bottom: 1px solid #eee; |
| | | } |
| | | |
| | | .file-item text { |
| | | flex: 1; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | .is-hover { |
| | | color: rgba(255, 255, 255, 0.6); |
| | | background-color: #55aaff; |
| | |
| | | margin-top: 85px; |
| | | height: auto; |
| | | } |
| | | |
| | | .file-list { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 10px; |
| | | } |
| | | |
| | | .file-item { |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 10px; |
| | | border: 1px solid #ddd; |
| | | border-radius: 4px; |
| | | } |
| | | |
| | | .file-icon img { |
| | | width: 32px; |
| | | height: 32px; |
| | | margin-right: 10px; |
| | | } |
| | | |
| | | .file-name { |
| | | flex: 1; |
| | | font-size: 16px; |
| | | } |
| | | |
| | | .file-actions button { |
| | | background: none; |
| | | border: none; |
| | | cursor: pointer; |
| | | margin-left: 10px; |
| | | } |
| | | |
| | | .file-actions .icon-download, |
| | | .file-actions .icon-delete { |
| | | font-size: 18px; |
| | | color: #555; |
| | | } |
| | | |
| | | .file-actions .icon-download:hover, |
| | | .file-actions .icon-delete:hover { |
| | | color: #007bff; |
| | | } |
| | | </style> |
| | |
| | | */ |
| | | goReportRepair() { |
| | | console.log('getSera æ¹æ³è¢«è°ç¨'); |
| | | uni.navigateTo({ |
| | | url: `/pages/reportRepair/reportRepair?equipmentId=${encodeURIComponent(this.id)}`, |
| | | uni.redirectTo({ |
| | | url: `/pages/reportRepair/reportRepair?equipmentId=${encodeURIComponent(this.id)}` |
| | | }); |
| | | }, |
| | | /** |
| | | * ç¹æ£ |
| | | */ |
| | | goCheck() { |
| | | uni.navigateTo({ |
| | | url: '/pages/checkList/checkList', |
| | | uni.redirectTo({ |
| | | // url: '/pages/checkList/checkList', |
| | | url: `/pages/checkList/checkList?equipmentId=${encodeURIComponent(this.id)}` |
| | | }); |
| | | }, |
| | | /** |
| | | * å¨ä¿ |
| | | */ |
| | | goBaoZhou() { |
| | | uni.navigateTo({ |
| | | url: '/pages/baoZhou/baoZhou', |
| | | uni.redirectTo({ |
| | | // url: '/pages/baoZhou/baoZhou', |
| | | url: `/pages/baoZhou/baoZhou?equipmentId=${encodeURIComponent(this.id)}` |
| | | }); |
| | | }, |
| | | /** |
| | | * å¨ä¿ |
| | | */ |
| | | goMaintenance() { |
| | | uni.navigateTo({ |
| | | url: '/pages/maintenanceReport/maintenanceReport', |
| | | uni.redirectTo({ |
| | | // url: '/pages/maintenanceReport/maintenanceReport', |
| | | url: `/pages/maintenanceReport/maintenanceReport?equipmentId=${encodeURIComponent(this.id)}` |
| | | }); |
| | | }, |
| | | upCallback() { |
| | |
| | | <view> |
| | | <scroll-view> |
| | | <!-- è½®æ --> |
| | | <swiper class="screen-swiper square-dot" :indicator-dots="true" :circular="true" |
| | | :autoplay="true" interval="5000" duration="500" :style="[{animation: 'show 0.2s 1'}]"> |
| | | <swiper class="screen-swiper square-dot" :indicator-dots="true" :circular="true" :autoplay="true" |
| | | interval="5000" duration="500" :style="[{animation: 'show 0.2s 1'}]"> |
| | | <swiper-item v-for="(item,index) in swiperList" :key="index"> |
| | | <image :src="item.url" mode="aspectFill" v-if="item.type=='image'"></image> |
| | | <video :src="item.url" autoplay loop muted :show-play-btn="false" :controls="false" objectFit="cover" v-if="item.type=='video'"></video> |
| | | <video :src="item.url" autoplay loop muted :show-play-btn="false" :controls="false" |
| | | objectFit="cover" v-if="item.type=='video'"></video> |
| | | </swiper-item> |
| | | </swiper> |
| | | |
| | | |
| | | <!-- 设å¤ç»´ä¿® --> |
| | | <view class="cu-bar bg-white solid-bottom" :style="[{animation: 'show 0.5s 1'}]"> |
| | | <view class="action"> |
| | | <text class='cuIcon-title text-blue'></text>å·¥ä½å° |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="cu-list grid col-4 text-sm"> |
| | | |
| | | <!-- <view class="cu-list grid col-4 text-sm"> |
| | | <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]" v-for="(item,index) in usList" :key="index" @tap="goPage(item.page)"> |
| | | <view class="padding text-center"> |
| | | <image :src="item.icon" style="width:28px;height:28px;"> |
| | |
| | | <view class="margin-top-xs">{{item.title}}</view> |
| | | </view> |
| | | </view> |
| | | </view> --> |
| | | <view class="cu-list grid col-4 text-sm"> |
| | | <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]" |
| | | v-for="(item, index) in usList" :key="index" @tap="goPage(item.page)"> |
| | | <view class="padding text-center"> |
| | | <image :src="item.icon" style="width:28px;height:28px;"> |
| | | <view class="cu-tag badge margin-top-sm" style="margin-left:1.2em" |
| | | v-if="getTtemDotInfo(item)"></view> |
| | | </image> |
| | | <view class="margin-top-xs">{{ item.title }}</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | <!-- 设å¤ä¿å
» --> |
| | | <view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.6s 1'}]"> |
| | | <view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.6s 1'}]"> |
| | | <view class="action"> |
| | | <text class='cuIcon-title text-yellow'></text>ä¿å
» |
| | | <text class='cuIcon-title text-yellow'></text>ä¿å
» |
| | | </view> |
| | | </view> |
| | | <view class="cu-list grid col-4 text-sm"> |
| | | <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.1 + 's'}]" v-for="(item,index) in osList" :key="index" @tap="goPage(item.page)"> |
| | | <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.1 + 's'}]" |
| | | v-for="(item,index) in osList" :key="index" @tap="goPage(item.page)"> |
| | | <view class="padding text-center"> |
| | | <image :src="item.icon" style="width:28px;height:28px;"/> |
| | | <image :src="item.icon" style="width:28px;height:28px;" /> |
| | | <view class="margin-top-xs">{{item.title}}</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | |
| | | |
| | | <!-- 设å¤ç»´ä¿® --> |
| | | <view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.6s 1'}]"> |
| | | <view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.6s 1'}]"> |
| | | <view class="action"> |
| | | <text class='cuIcon-title text-blue'></text>ç»´ä¿® |
| | | <text class='cuIcon-title text-blue'></text>ç»´ä¿® |
| | | </view> |
| | | </view> |
| | | <view class="cu-list grid col-4 text-sm"> |
| | | <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.1 + 's'}]" v-for="(item,index) in wsList" :key="index" @tap="goPage(item.page)"> |
| | | <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.1 + 's'}]" |
| | | v-for="(item,index) in wsList" :key="index" @tap="goPage(item.page)"> |
| | | <view class="padding text-center"> |
| | | <image :src="item.icon" style="width:28px;height:28px;"/> |
| | | <image :src="item.icon" style="width:28px;height:28px;" /> |
| | | <view class="margin-top-xs">{{item.title}}</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | </scroll-view> |
| | | <view class="cu-tabbar-height margin-top"></view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import { us,os,ws} from '@/common/util/work.js' |
| | | import { |
| | | ACCESS_TOKEN |
| | | } from '@/common/util/constants.js' |
| | | import { |
| | | us, |
| | | os, |
| | | ws |
| | | } from '@/common/util/work.js' |
| | | import socket from '@/common/js-sdk/socket/socket.js' |
| | | export default { |
| | | name: 'home', |
| | | props:{ |
| | | cur:String, |
| | | props: { |
| | | cur: String, |
| | | }, |
| | | watch: { |
| | | cur: { |
| | | immediate: true, |
| | | handler:function(val,oldVal){ |
| | | console.log('cur',val,oldVal) |
| | | this.initMenu() |
| | | handler: function(val, oldVal) { |
| | | console.log('cur', val, oldVal) |
| | | this.initMenu() |
| | | }, |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | swiperList: [ |
| | | {id:1,type: 'image',url: '/static/banner/eam_banner1.png', link: ''}, |
| | | {id:2,type: 'image',url: '/static/banner/eam_banner2.png', link: ''}, |
| | | {id:3,type: 'image',url: '/static/banner/eam_banner3.png', link: ''}, |
| | | {id:4,type: 'image',url: '/static/banner/eam_banner4.png', link: ''}, |
| | | url: { |
| | | bindingThirdPhone: '/sys/permission/getUserPermissionByToken', |
| | | countItem: '/assign/flow/taskCountBySelf' |
| | | }, |
| | | swiperList: [{ |
| | | id: 1, |
| | | type: 'image', |
| | | url: '/static/banner/eam_banner1.png', |
| | | link: '' |
| | | }, |
| | | { |
| | | id: 2, |
| | | type: 'image', |
| | | url: '/static/banner/eam_banner2.png', |
| | | link: '' |
| | | }, |
| | | { |
| | | id: 3, |
| | | type: 'image', |
| | | url: '/static/banner/eam_banner3.png', |
| | | link: '' |
| | | }, |
| | | { |
| | | id: 4, |
| | | type: 'image', |
| | | url: '/static/banner/eam_banner4.png', |
| | | link: '' |
| | | }, |
| | | ], |
| | | middleApps: [ |
| | | {icon: 'line2_icon1.png', title: '审æ¹', 'text': '个人审æ¹'}, |
| | | {icon: 'line2_icon2.png', title: '审æ¹ç¨¿', 'text': '审æ¹è稿箱'}, |
| | | middleApps: [{ |
| | | icon: 'line2_icon1.png', |
| | | title: '审æ¹', |
| | | 'text': '个人审æ¹' |
| | | }, |
| | | { |
| | | icon: 'line2_icon2.png', |
| | | title: '审æ¹ç¨¿', |
| | | 'text': '审æ¹è稿箱' |
| | | }, |
| | | ], |
| | | usList:us.data, |
| | | osList:os.data, |
| | | wsList:ws.data, |
| | | msgCount:0, |
| | | dot:{ |
| | | mailHome:false |
| | | usList: us.data, |
| | | osList: os.data, |
| | | wsList: ws.data, |
| | | msgCount: 0, |
| | | toDomsgCount: 0, |
| | | |
| | | dot: { |
| | | mailHome: false |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | initMenu(){ |
| | | initMenu() { |
| | | console.log("-----------home------------") |
| | | this.onSocketOpen() |
| | | this.onSocketReceive() |
| | | this.loadCount(0); |
| | | this.onSocketOpen() |
| | | this.onSocketReceive() |
| | | this.saveClientId() |
| | | this.taskCountBySelf(); |
| | | this.loadCount(0); |
| | | }, |
| | | goPage(page){ |
| | | if(!page){ |
| | | goPage(page) { |
| | | if (!page) { |
| | | return false; |
| | | } |
| | | if(page==='annotationList'){ |
| | | this.msgCount = 0 |
| | | if (page === 'annotationList') { |
| | | this.msgCount = 0 |
| | | } |
| | | this.dot[page]=false |
| | | this.$Router.push({name: page}) |
| | | this.dot[page] = false |
| | | this.$Router.push({ |
| | | name: page |
| | | }) |
| | | }, |
| | | // å¯å¨webSocket |
| | | onSocketOpen() { |
| | | socket.init('websocket'); |
| | | }, |
| | | onSocketReceive() { |
| | | var _this=this |
| | | socket.acceptMessage = function(res){ |
| | | var _this = this |
| | | socket.acceptMessage = function(res) { |
| | | // console.log("页颿¶å°çæ¶æ¯", res); |
| | | if(res.cmd == "topic"){ |
| | | //ç³»ç»éç¥ |
| | | _this.loadCount('1') |
| | | }else if(res.cmd == "user"){ |
| | | //ç¨æ·æ¶æ¯ |
| | | _this.loadCount('2') |
| | | } else if(res.cmd == 'email'){ |
| | | //é®ä»¶æ¶æ¯ |
| | | _this.loadEmailCount() |
| | | if (res.cmd == "topic") { |
| | | //ç³»ç»éç¥ |
| | | _this.loadCount('1') |
| | | } else if (res.cmd == "user") { |
| | | //ç¨æ·æ¶æ¯ |
| | | _this.loadCount('2') |
| | | } else if (res.cmd == 'email') { |
| | | //é®ä»¶æ¶æ¯ |
| | | _this.loadEmailCount() |
| | | } |
| | | } |
| | | }, |
| | | loadCount(flag){ |
| | | console.log("loadCount::flag",flag) |
| | | let url = '/sys/annountCement/listByUser'; |
| | | this.$http.get(url).then(res=>{ |
| | | console.log("res::",res) |
| | | if(res.data.success){ |
| | | let msg1Count = res.data.result.anntMsgTotal; |
| | | let msg2Count = res.data.result.sysMsgTotal; |
| | | this.msgCount = msg1Count + msg2Count |
| | | console.log("this.msgCount",this.msgCount) |
| | | } |
| | | |
| | | taskCountBySelf() { |
| | | let token = uni.getStorageSync(ACCESS_TOKEN) |
| | | this.$http.get(this.url.countItem).then(res => { |
| | | console.log("res::taskCountBySelf>", res) |
| | | this.toDomsgCount = res.data.result |
| | | }) |
| | | }, |
| | | loadEmailCount(){ |
| | | loadCount(flag) { |
| | | console.log("loadCount::flag", flag) |
| | | let url = '/sys/annountCement/listByUser'; |
| | | this.$http.get(url).then(res => { |
| | | console.log("res::", res) |
| | | if (res.data.success) { |
| | | let msg1Count = res.data.result.anntMsgTotal; |
| | | let msg2Count = res.data.result.sysMsgTotal; |
| | | this.msgCount = msg1Count + msg2Count |
| | | console.log("this.msgCount", this.msgCount) |
| | | } |
| | | }) |
| | | }, |
| | | saveClientId() { |
| | | let token = uni.getStorageSync(ACCESS_TOKEN) |
| | | this.$http.get(this.url.bindingThirdPhone, { |
| | | params: { |
| | | token: token |
| | | } |
| | | }).then(res => { |
| | | const authData = res.data.result.auth |
| | | |
| | | // ç¡®ä¿æ¯æ°ç» |
| | | if (!Array.isArray(authData)) { |
| | | console.warn('auth 䏿¯æ°ç»:', authData) |
| | | return |
| | | } |
| | | |
| | | // åå
¥ store |
| | | this.$store.dispatch('saveAuth', authData) |
| | | console.log('å½å store ä¸ç auth:', this.$store.getters.getAuth) |
| | | }).catch(err => { |
| | | console.error("è·å auth 失败:", err) |
| | | }) |
| | | }, |
| | | |
| | | loadEmailCount() { |
| | | this.dot.mailHome = true |
| | | }, |
| | | getTtemDotInfo(item){ |
| | | if(item.page==='annotationList' && this.msgCount>0){ |
| | | return this.msgCount |
| | | getTtemDotInfo(item) { |
| | | if (item.page === 'ToDoList' && this.toDomsgCount > 0) { |
| | | // return this.toDomsgCount |
| | | return true |
| | | } |
| | | return ''; |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | <style scoped> |
| | | .cu-list.grid>.cu-item { |
| | | padding: 0px 0px; |
| | | padding: 0px 0px; |
| | | } |
| | | .line2-icon { |
| | | width: 60px; |
| | | height: 60px; |
| | | } |
| | | |
| | | </style> |
| | | |
| | | .line2-icon { |
| | | width: 60px; |
| | | height: 60px; |
| | | } |
| | | </style> |
| | |
| | | |
| | | <view class="flex"> |
| | | <view class="flex-sub text-light bg-white padding-xs margin-xs radius">æä½:</view> |
| | | <view class="flex-sub bg-blue padding-xs margin-xs radius text-sm text-center" |
| | | <view v-if="authIncludes('eam:repair:collect')" |
| | | class="flex-sub bg-blue padding-xs margin-xs radius text-sm text-center" |
| | | @click.stop="handleStartWork(item)" hover-class="is-hover">é¢å</view> |
| | | |
| | | </view> |
| | |
| | | announcement1: [], |
| | | msg1Count: 0, |
| | | msg2Count: 0, |
| | | msg1Title: "" |
| | | msg1Title: "", |
| | | equipmentId: '' |
| | | } |
| | | }, |
| | | mounted() { |
| | | console.log('ä» store è·åç auth:', this.$store.getters.getAuth) |
| | | }, |
| | | computed: { |
| | | authList() { |
| | | return this.$store.getters.getAuth || [] |
| | | }, |
| | | top() { |
| | | return this.CustomBar * 2 + 50 |
| | | }, |
| | |
| | | }, |
| | | |
| | | |
| | | |
| | | |
| | | onShow() { |
| | | if (this.mescroll) { |
| | | this.mescroll.resetUpScroll() |
| | | } |
| | | }, |
| | | |
| | | onLoad: function(options) { |
| | | this.equipmentId = options.equipmentId ? |
| | | decodeURIComponent(options.equipmentId) : |
| | | ''; |
| | | }, |
| | | created() {}, |
| | | methods: { |
| | | |
| | | /** |
| | | * @param {Object} codeæé®æé |
| | | */ |
| | | authIncludes(code) { |
| | | return this.authList.some(auth => auth.action === code) |
| | | }, |
| | | /** |
| | | * é¢å |
| | | */ |
| | |
| | | pageSize: page.size, |
| | | order: 'desc', |
| | | column: 'createTime', |
| | | reportStatus: 'WAIT_REPAIR' |
| | | reportStatus: 'WAIT_REPAIR', |
| | | equipmentId: this.equipmentId || '' |
| | | }, |
| | | |
| | | }).then(res => { |
| | |
| | | |
| | | <view class="padding flex flex-direction"> |
| | | <view class="flex-sub bg-blue padding-sm margin-xl radius text-sm text-center text-white" |
| | | @click.stop="ProductionTask()" hover-class="is-hover">æäº¤</view> |
| | | @click.stop="ProductionTask()" hover-class="is-hover">æäº¤</view> |
| | | </view> |
| | | |
| | | |
| | |
| | | import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; |
| | | export default { |
| | | mixins: [MescrollMixin], // 使ç¨mixin |
| | | |
| | | data() { |
| | | return { |
| | | // å¾çåæ¾ |
| | |
| | | faultNameList: [], |
| | | faultName: '', |
| | | faultType: '', |
| | | breakdownFlag: '', |
| | | breakdownFlag: '1', |
| | | loadTime: Date.now(), |
| | | faultDescription: '' |
| | | }, |
| | |
| | | announcement1: [], |
| | | msg1Count: 0, |
| | | msg2Count: 0, |
| | | msg1Title: "" |
| | | msg1Title: "", |
| | | equipmentId: '', |
| | | AuthLsit:[] |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | this.getSera() |
| | | }, |
| | | created() { |
| | | // this.getEquipment(); |
| | | |
| | | this.getfaultReasonList(); |
| | | }, |
| | | methods: { |
| | |
| | | console.log(this.announcement1); |
| | | //设置åè¡¨æ°æ® |
| | | if (res.data.success) { |
| | | this.equipmentId = this.announcement1.id |
| | | this.formData.numSear = this.announcement1.equipmentCode + '[' + this.announcement1 |
| | | .equipmentName + |
| | | ']' |
| | |
| | | }); |
| | | return false |
| | | } |
| | | if (this.formData.breakdownFlag == 0 || this.formData.breakdownFlag == undefined) { |
| | | uni.showToast({ |
| | | icon: "none", |
| | | title: 'æ¯å¦åæºä¸ºç©º!', |
| | | duration: 2000 |
| | | }); |
| | | return false |
| | | } |
| | | // 请æ±å¼å§ å¢å é®ç½©å± |
| | | uni.showLoading({ |
| | | mask: true, |
| | |
| | | title: 'æäº¤æå', |
| | | duration: 2000 |
| | | }); |
| | | this.$Router.replaceAll({ |
| | | name: 'index' |
| | | console.log(this.equipmentId) |
| | | uni.reLaunch({ |
| | | url: `/pages/reportRepair/reportRepairList/reportRepairList?equipmentId=${this.equipmentId}` |
| | | }) |
| | | |
| | | } else { |
| | | uni.showToast({ |
| | | icon: "error", |
| | | title: res.data.message, |
| | | duration: 2000 |
| | | }); |
| | | } |
| | | }).catch(() => { |
| | | this.$tip.loaded(); |
| | | uni.hideLoading(); |
| | | uni.showToast({ |
| | | icon: "error", |
| | | title: 'æäº¤å¤±è´¥', |
| | | title: 'ç½ç»è¿æ¥å¤±è´¥', |
| | | duration: 2000 |
| | | }); |
| | | }); |
| | |
| | | <uni-data-select v-model="formData.num" :localdata="equipmentList" @change="changeEquipmentList" |
| | | placeholder="è¯·éæ©" :disabled="true" /> |
| | | </uni-forms-item> |
| | | |
| | | <uni-forms-item name="remark" :label-width="80" label="æ
éç®ç§°:"> |
| | | <!-- <uni-forms-item name="equipmentName" :label-width="80" label="设å¤åç§°:"> |
| | | <uni-easyinput v-model="formData.equipmentName" :disabled="true" /> |
| | | </uni-forms-item> --> |
| | | <uni-forms-item name="reportStatus_dictText" :label-width="80" label="æ¥ä¿®ç¶æ:"> |
| | | <uni-easyinput v-model="formData.reportStatus_dictText" :disabled="true" /> |
| | | </uni-forms-item> |
| | | |
| | | <uni-forms-item name="faultType" :label-width="80" label="æ
éåç±»:"> |
| | | <uni-easyinput v-model="formData.faultType" :disabled="true" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item name="faultName" :label-width="80" label="æ
éç®ç§°:"> |
| | | <uni-easyinput v-model="formData.faultName" :disabled="true" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item name="remark" :label-width="80" label="æ
éå¼å§æ¶é´:"> |
| | | <uni-forms-item name="faultStartTime" :label-width="80" label="æ
éå¼å§æ¶é´:"> |
| | | <uni-easyinput v-model="formData.faultStartTime" :disabled="true" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item name="outNum" :label-width="80" label="æ¯å¦åæº:"> |
| | | <uni-forms-item name="breakdownFlag_dictText" :label-width="80" label="æ¯å¦åæº:"> |
| | | <uni-easyinput v-model="formData.breakdownFlag_dictText" :disabled="true" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item name="outNum" :label-width="80" label="æ
éæè¿°:"> |
| | | <uni-forms-item name="faultDescription" :label-width="80" label="æ
éæè¿°:"> |
| | | <uni-easyinput v-model="formData.faultDescription" :disabled="true" /> |
| | | </uni-forms-item> |
| | | <!-- <uni-forms-item name="installationPosition" :label-width="80" label="å®è£
ä½ç½®:"> |
| | | <uni-easyinput v-model="formData.installationPosition" :disabled="true" /> |
| | | </uni-forms-item> --> |
| | | |
| | | <uni-forms-item name="remark" :label-width="80" label="夿³¨:"> |
| | | <uni-easyinput v-model="formData.remark" :disabled="true" /> |
| | | </uni-forms-item> |
| | |
| | | <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" |
| | | :data-url="imgList[index]"> |
| | | <image :src="imgList[index]" mode="aspectFill"></image> |
| | | <view class="cu-tag bg-red radius" @tap.stop="DelImg" :data-index="index"> |
| | | <text class='cuIcon-close'></text> |
| | | </view> |
| | | </view> |
| | | <view class="solids" v-if="imgList.length<1"> |
| | | <text class='cuIcon-cameraadd'></text> |
| | |
| | | NavBarColor: this.NavBarColor, |
| | | url: { |
| | | stallList: "/eam/eamReportRepair/queryById", |
| | | getEquipmentList:'eam/equipment/list' |
| | | getEquipmentList: 'eam/equipment/list' |
| | | // getEquipmentList: "eam/equipment/asyncLoadEquipment" |
| | | }, |
| | | id: '', |
| | |
| | | order: 'desc', |
| | | column: 'createTime' |
| | | }, |
| | | |
| | | |
| | | }).then(res => { |
| | | //设置åè¡¨æ°æ® |
| | | if (res.data.success) { |
| | |
| | | this.formData.faultDescription = this.announcement1.faultDescription |
| | | this.formData.faultName = this.announcement1.faultName |
| | | this.formData.remark = this.announcement1.remark |
| | | // this.formData.equipmentName=this.announcement1.equipmentName |
| | | this.formData.faultStartTime = this.announcement1.faultStartTime |
| | | this.formData.breakdownFlag_dictText = this.announcement1.breakdownFlag_dictText |
| | | this.formData.reportStatus_dictText=this.announcement1.reportStatus_dictText |
| | | // this.formData.installationPosition=this.announcement1.installationPosition |
| | | this.formData.faultType=this.announcement1.faultType |
| | | this.formData.avatar = this.announcement1.imageFiles |
| | | const imageObjects = JSON.parse(this.formData.avatar); |
| | | // æå filePath å¹¶æ¼æ¥ IP åç«¯å£ |
| | |
| | | <cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask"> |
| | | <block slot="backText">è¿å</block> |
| | | <block slot="content">æ¥ä¿®</block> |
| | | <block slot="right"> |
| | | <view @click="search"> |
| | | <image class="search" src="/static/icon/sear.png" style="width: 25px; height: 25px;" alt="" /> |
| | | </view> |
| | | </block> |
| | | </cu-custom> |
| | | |
| | | <view style="width: 100%;"> |
| | |
| | | <!-- åºç¡è¡¨åæ ¡éª --> |
| | | <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> |
| | | <uni-group title="" top="0"> |
| | | <uni-forms-item name="numbers" label="颿ç³è¯·åå·:"> |
| | | <uni-easyinput type="text" v-model="formData.num" placeholder="请è¾å
¥é¢æç³è¯·åå·æ£ç´¢" /> |
| | | <uni-forms-item name="numbers" label="æ¥ä¿®ç¶æ:"> |
| | | <uni-data-select v-model="formData.reportStatus" :localdata="reportStatusList" |
| | | @change="changetypeList" placeholder="è¯·éæ©æ¥ä¿®ç¶æ" /> |
| | | </uni-forms-item> |
| | | <uni-forms-item name="name" label="é¢æäº§å:"> |
| | | <uni-easyinput v-model="formData.partNumNameModel" placeholder="请è¾å
¥é¢æäº§å" /> |
| | |
| | | </view> |
| | | </uni-popup> |
| | | </view> |
| | | <view class="flex"> |
| | | <view class="flex" v-if="authIncludes('eam:reportRepair:add')"> |
| | | |
| | | <view |
| | | class="cuIcon-add flex-sub bg-blue padding-sm margin-xs margin-left-lg margin-right-lg text-sm text-center" |
| | | class="cuIcon-add radius flex-sub bg-blue padding-sm margin-xs margin-left-lg margin-right-lg text-sm text-center" |
| | | @click="getAdd()">æ°å¢ |
| | | </view> |
| | | </view> |
| | |
| | | <view class="flex"> |
| | | <view class="flex-sub text-light bg-white padding-xs margin-xs radius">设å¤ç¼å·:</view> |
| | | <view class="flex-sub bg-white padding-xs margin-xs text-bold radius text-right"> |
| | | {{item.equipmentId_dictText}} |
| | | {{item.equipmentCode}} |
| | | </view> |
| | | </view> |
| | | <view class="flex"> |
| | | <view class="flex-sub text-light bg-white padding-xs margin-xs radius">设å¤åç§°:</view> |
| | | <view class="flex-sub bg-white padding-xs margin-xs text-bold radius text-right"> |
| | | {{item.equipmentName}} |
| | | </view> |
| | | </view> |
| | | <view class="flex"> |
| | |
| | | {{item.breakdownFlag_dictText}} |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="flex"> |
| | | <view class="flex-sub text-light bg-white padding-xs margin-xs radius">å®è£
ä½ç½®:</view> |
| | | <view class="flex-sub bg-white padding-xs margin-xs text-blue radius text-right"> |
| | | {{item.installationPosition}} |
| | | </view> |
| | | </view> |
| | | <!-- <view class="flex"> |
| | | <view class="flex-sub text-light bg-white padding-xs margin-xs radius">æä½:</view> |
| | | <view class="flex-sub bg-blue padding-xs margin-xs radius text-sm text-center" |
| | |
| | | mixins: [MescrollMixin], // 使ç¨mixin |
| | | data() { |
| | | return { |
| | | |
| | | type: 'top', |
| | | scrollLeft: 0, |
| | | formData: { |
| | | num: '', |
| | | partNumNameModel: '' |
| | | reportStatus: '' |
| | | |
| | | }, |
| | | reportStatusList: [], |
| | | NavBarColor: this.NavBarColor, |
| | | activeColor: '#5277A6', |
| | | url: { |
| | | stallList: "/eam/eamReportRepair/list" |
| | | stallList: "/eam/eamReportRepair/list", |
| | | flowType: "/sys/dict/getDictItems/report_repair_status", |
| | | }, |
| | | |
| | | upOption: { |
| | |
| | | announcement1: [], |
| | | msg1Count: 0, |
| | | msg2Count: 0, |
| | | msg1Title: "" |
| | | msg1Title: "", |
| | | equipmentId: '' |
| | | } |
| | | }, |
| | | mounted() { |
| | | console.log('ä» store è·åç auth:', this.$store.getters.getAuth) |
| | | }, |
| | | computed: { |
| | | authList() { |
| | | return this.$store.getters.getAuth || [] |
| | | }, |
| | | top() { |
| | | return this.CustomBar * 2 + 100 |
| | | }, |
| | |
| | | } |
| | | }, |
| | | |
| | | created() {}, |
| | | onLoad: function(option) { |
| | | console.log(option) |
| | | let queryData = {}; |
| | | try { |
| | | queryData = JSON.parse(option.query); |
| | | } catch (e) { |
| | | console.error('è§£æ query 失败', e); |
| | | } |
| | | |
| | | const equipmentId = queryData.equipmentId; |
| | | |
| | | console.log('设å¤ID:', equipmentId); |
| | | |
| | | // ä½ å¯ä»¥å¨è¿éç»§ç»ä½¿ç¨ equipmentId è¯·æ±æ°æ®æèµå¼ç» data |
| | | this.equipmentId = equipmentId; |
| | | }, |
| | | created() { |
| | | this.getTypeList() |
| | | }, |
| | | methods: { |
| | | authIncludes(code) { |
| | | return this.authList.some(auth => auth.action === code) |
| | | }, |
| | | |
| | | /** |
| | | * æ¥ä¿®ç¶æå表äºä»¶ |
| | | */ |
| | | getTypeList() { |
| | | this.$http.get(this.url.flowType).then(res => { |
| | | //设置åè¡¨æ°æ® |
| | | if (res.data.success) { |
| | | console.log(res) |
| | | this.reportStatusList = res.data.result |
| | | } |
| | | }).catch(() => { |
| | | //èç½å¤±è´¥, ç»æå è½½ |
| | | }) |
| | | |
| | | }, |
| | | changetypeList(e) { |
| | | this.formData.reportStatus = e; |
| | | }, |
| | | getAdd() { |
| | | uni.redirectTo({ |
| | | url: '/pages/reportRepair/reportRepair' |
| | |
| | | pageNo: page.num, |
| | | pageSize: page.size, |
| | | order: 'asc', |
| | | column: 'createTime' |
| | | |
| | | column: 'createTime', |
| | | equipmentId: this.equipmentId |
| | | }, |
| | | |
| | | }).then(res => { |
| | |
| | | this.msgList = this.msgList.concat(this.announcement1); //è¿½å æ°æ°æ® |
| | | } |
| | | |
| | | }).catch(() => { |
| | | }).catch((err) => { |
| | | //èç½å¤±è´¥, ç»æå è½½ |
| | | this.mescroll.endErr(); |
| | | uni.showToast({ |
| | | title: 'ç½ç»å¼å¸¸ï¼è¯·ç¨ååè¯', |
| | | icon: 'none' |
| | | }); |
| | | }) |
| | | |
| | | }, |
| | |
| | | /* æ£ç´¢ */ |
| | | getSera() { |
| | | this.$refs.popup.close(); |
| | | let keyword = this.TabCur |
| | | this.msgList = []; |
| | | this.$http.get(this.url.stallList, { |
| | | params: { |
| | | pageNo: 1, |
| | | pageSize: 9999, |
| | | order: "desc", |
| | | column: "createTime", |
| | | reportStatus: this.formData.reportStatus |
| | | } |
| | | }).then(res => { |
| | | //èç½æåçåè°,éè䏿巿°å䏿å è½½çç¶æ; |
| | | |
| | | if (keyword == 0) { |
| | | this.$http.get(this.url.stallList, { |
| | | params: { |
| | | pageNo: 1, |
| | | pageSize: 999, |
| | | order: "desc", |
| | | column: "createTime", |
| | | num: '*' + this.formData.num + '*', |
| | | partNumNameModel: '*' + this.formData.partNumNameModel + '*', |
| | | status: 'published' |
| | | this.announcement1 = res.data.result.records |
| | | this.mescroll.endSuccess(this.announcement1.length); |
| | | console.log("url", res) |
| | | //设置åè¡¨æ°æ® |
| | | if (res.data.success) { |
| | | console.log("res", res.data) |
| | | this.msg1Count = res.data.result.total |
| | | this.msg1Title = "éç¥(" + res.data.result.total + ")"; |
| | | for (let annItem of this.announcement1) { |
| | | this.msgList.push(annItem) |
| | | } |
| | | }).then(res => { |
| | | //èç½æåçåè°,éè䏿巿°å䏿å è½½çç¶æ; |
| | | } |
| | | if (page.num == 1) { |
| | | this.msgList = []; //妿æ¯ç¬¬ä¸é¡µéæå¨å¶ç©ºå表 |
| | | this.msgList = this.msgList.concat(this.announcement1); //è¿½å æ°æ°æ® |
| | | } |
| | | |
| | | this.announcement1 = res.data.result.records |
| | | this.mescroll.endSuccess(this.announcement1.length); |
| | | console.log("url", res) |
| | | //设置åè¡¨æ°æ® |
| | | if (res.data.success) { |
| | | console.log("res", res.data) |
| | | this.msg1Count = res.data.result.total |
| | | this.msg1Title = "éç¥(" + res.data.result.total + ")"; |
| | | for (let annItem of this.announcement1) { |
| | | this.msgList.push(annItem) |
| | | } |
| | | } |
| | | if (page.num == 1) { |
| | | this.msgList = []; //妿æ¯ç¬¬ä¸é¡µéæå¨å¶ç©ºå表 |
| | | this.msgList = this.msgList.concat(this.announcement1); //è¿½å æ°æ°æ® |
| | | } |
| | | |
| | | }).catch(() => { |
| | | //èç½å¤±è´¥, ç»æå è½½ |
| | | this.mescroll.endErr(); |
| | | }) |
| | | |
| | | } else if (keyword == 1) { |
| | | this.$http.get(this.url.stallList, { |
| | | params: { |
| | | pageNo: 1, |
| | | pageSize: 999, |
| | | order: "desc", |
| | | column: "createTime", |
| | | status: 'training', |
| | | num: '*' + this.formData.num + '*', |
| | | partNumNameModel: '*' + this.formData.partNumNameModel + '*' |
| | | |
| | | } |
| | | }).then(res => { |
| | | //èç½æåçåè°,éè䏿巿°å䏿å è½½çç¶æ; |
| | | |
| | | this.announcement1 = res.data.result.records |
| | | this.mescroll.endSuccess(this.announcement1.length); |
| | | console.log("url", res) |
| | | //设置åè¡¨æ°æ® |
| | | if (res.data.success) { |
| | | console.log("res", res.data) |
| | | this.msg1Count = res.data.result.total |
| | | this.msg2Title = "éç¥(" + res.data.result.total + ")"; |
| | | for (let annItem of this.announcement1) { |
| | | this.msgList.push(annItem) |
| | | } |
| | | } |
| | | if (page.num == 1) { |
| | | this.msgList = []; //妿æ¯ç¬¬ä¸é¡µéæå¨å¶ç©ºå表 |
| | | this.msgList = this.msgList.concat(this.announcement1); //è¿½å æ°æ°æ® |
| | | } |
| | | |
| | | }).catch(() => { |
| | | //èç½å¤±è´¥, ç»æå è½½ |
| | | this.mescroll.endErr(); |
| | | }) |
| | | |
| | | } else if (keyword == 2) { |
| | | this.$http.get(this.url.stallList, { |
| | | params: { |
| | | pageNo: 1, |
| | | pageSize: 999, |
| | | order: "desc", |
| | | column: "createTime", |
| | | status: 'completed', |
| | | num: '*' + this.formData.num + '*', |
| | | partNumNameModel: '*' + this.formData.partNumNameModel + '*' |
| | | |
| | | } |
| | | }).then(res => { |
| | | //èç½æåçåè°,éè䏿巿°å䏿å è½½çç¶æ; |
| | | |
| | | this.announcement1 = res.data.result.records |
| | | this.mescroll.endSuccess(this.announcement1.length); |
| | | console.log("url", res) |
| | | //设置åè¡¨æ°æ® |
| | | if (res.data.success) { |
| | | console.log("res", res.data) |
| | | this.msg3Count = res.data.result.total |
| | | this.msg1Title = "éç¥(" + res.data.result.total + ")"; |
| | | for (let annItem of this.announcement1) { |
| | | this.msgList.push(annItem) |
| | | } |
| | | } |
| | | if (page.num == 1) { |
| | | this.msgList = []; //妿æ¯ç¬¬ä¸é¡µéæå¨å¶ç©ºå表 |
| | | this.msgList = this.msgList.concat(this.announcement1); //è¿½å æ°æ°æ® |
| | | } |
| | | |
| | | }).catch(() => { |
| | | //èç½å¤±è´¥, ç»æå è½½ |
| | | this.mescroll.endErr(); |
| | | }) |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | }).catch((err) => { |
| | | //èç½å¤±è´¥, ç»æå è½½ |
| | | this.mescroll.endErr(); |
| | | uni.showToast({ |
| | | title: 'ç½ç»å¼å¸¸ï¼è¯·ç¨ååè¯', |
| | | icon: 'none' |
| | | }); |
| | | }) |
| | | }, |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | .popupView { |
| | | margin-top: 85px; |
| | | margin-top: 50px; |
| | | height: auto; |
| | | } |
| | | </style> |
| | |
| | | import Vue from 'vue' |
| | | import Vuex from 'vuex' |
| | | import api from "@/api/api" |
| | | import MinCache from'@/common/util/MinCache.js' |
| | | import { ACCESS_TOKEN,USER_NAME,USER_INFO,X_TENANT_ID } from "@/common/util/constants" |
| | | import MinCache from '@/common/util/MinCache.js' |
| | | import { |
| | | ACCESS_TOKEN, |
| | | USER_NAME, |
| | | USER_INFO, |
| | | X_TENANT_ID |
| | | } from "@/common/util/constants" |
| | | |
| | | Vue.use(Vuex) |
| | | |
| | | export default new Vuex.Store({ |
| | | state: { |
| | | token: '', |
| | | userid:'', |
| | | username: '', |
| | | realname: '', |
| | | welcome: '', |
| | | avatar: '' |
| | | }, |
| | | mutations: { |
| | | SET_TOKEN: (state, token) => { |
| | | state.token = token |
| | | }, |
| | | SET_NAME: (state, { username, realname, welcome }) => { |
| | | state.username = username |
| | | state.realname = realname |
| | | state.welcome = welcome |
| | | }, |
| | | SET_AVATAR: (state, avatar) => { |
| | | state.avatar = avatar |
| | | } |
| | | }, |
| | | actions: { |
| | | // ç»å½ |
| | | mLogin({ commit }, userInfo) { |
| | | return new Promise((resolve, reject) => { |
| | | api.login(userInfo).then(response => { |
| | | if(response.data.code ==200){ |
| | | const result = response.data.result |
| | | const userInfo = result.userInfo |
| | | uni.setStorageSync(ACCESS_TOKEN,result.token); |
| | | uni.setStorageSync("isLogin",true); |
| | | uni.setStorageSync("userId", userInfo.id); |
| | | uni.setStorageSync(USER_INFO,userInfo); |
| | | commit('SET_TOKEN', result.token) |
| | | commit('SET_AVATAR', userInfo.avatar) |
| | | commit('SET_NAME', { username: userInfo.username,realname: userInfo.realname}) |
| | | resolve(response) |
| | | }else{ |
| | | resolve(response) |
| | | } |
| | | }).catch(error => { |
| | | console.log("catch===>response",response) |
| | | reject(error) |
| | | }) |
| | | }) |
| | | }, |
| | | //ææºå·ç»å½ |
| | | PhoneLogin({ commit }, userInfo) { |
| | | return new Promise((resolve, reject) => { |
| | | api.phoneNoLogin(userInfo).then(response => { |
| | | if(response.data.code ==200){ |
| | | const result = response.data.result |
| | | const userInfo = result.userInfo |
| | | uni.setStorageSync(ACCESS_TOKEN,result.token); |
| | | uni.setStorageSync(USER_INFO,userInfo); |
| | | commit('SET_TOKEN', result.token) |
| | | commit('SET_NAME', { username: userInfo.username,realname: userInfo.realname}) |
| | | commit('SET_AVATAR', userInfo.avatar) |
| | | resolve(response) |
| | | }else{ |
| | | reject(response) |
| | | } |
| | | }).catch(error => { |
| | | reject(error) |
| | | }) |
| | | }) |
| | | }, |
| | | // ç¬¬ä¸æ¹ç»å½ |
| | | ThirdLogin({ commit }, param) { |
| | | return new Promise((resolve, reject) => { |
| | | api.thirdLogin(param.token,param.thirdType,param.tenantId).then(response => { |
| | | if(response.data.code =='200'){ |
| | | const result = response.data.result |
| | | const userInfo = result.userInfo |
| | | uni.setStorageSync(ACCESS_TOKEN,result.token); |
| | | uni.setStorageSync(USER_INFO,userInfo); |
| | | uni.setStorageSync(X_TENANT_ID,userInfo.loginTenantId); |
| | | state: { |
| | | auth: [], |
| | | token: '', |
| | | userid: '', |
| | | username: '', |
| | | realname: '', |
| | | welcome: '', |
| | | avatar: '' |
| | | }, |
| | | mutations: { |
| | | SET_AUTH(state, auth) { |
| | | state.auth = auth |
| | | }, |
| | | SET_TOKEN: (state, token) => { |
| | | state.token = token |
| | | }, |
| | | SET_NAME: (state, { |
| | | username, |
| | | realname, |
| | | welcome |
| | | }) => { |
| | | state.username = username |
| | | state.realname = realname |
| | | state.welcome = welcome |
| | | }, |
| | | SET_AVATAR: (state, avatar) => { |
| | | state.avatar = avatar |
| | | } |
| | | }, |
| | | actions: { |
| | | // ç»å½ |
| | | mLogin({ |
| | | commit |
| | | }, userInfo) { |
| | | return new Promise((resolve, reject) => { |
| | | api.login(userInfo).then(response => { |
| | | if (response.data.code == 200) { |
| | | const result = response.data.result |
| | | const userInfo = result.userInfo |
| | | uni.setStorageSync(ACCESS_TOKEN, result.token); |
| | | uni.setStorageSync("isLogin", true); |
| | | uni.setStorageSync("userId", userInfo.id); |
| | | uni.setStorageSync(USER_INFO, userInfo); |
| | | commit('SET_TOKEN', result.token) |
| | | commit('SET_AVATAR', userInfo.avatar) |
| | | commit('SET_NAME', { |
| | | username: userInfo.username, |
| | | realname: userInfo.realname |
| | | }) |
| | | resolve(response) |
| | | } else { |
| | | resolve(response) |
| | | } |
| | | }).catch(error => { |
| | | console.log("catch===>response", response) |
| | | reject(error) |
| | | }) |
| | | }) |
| | | }, |
| | | //ææºå·ç»å½ |
| | | PhoneLogin({ |
| | | commit |
| | | }, userInfo) { |
| | | return new Promise((resolve, reject) => { |
| | | api.phoneNoLogin(userInfo).then(response => { |
| | | if (response.data.code == 200) { |
| | | const result = response.data.result |
| | | const userInfo = result.userInfo |
| | | uni.setStorageSync(ACCESS_TOKEN, result.token); |
| | | uni.setStorageSync(USER_INFO, userInfo); |
| | | commit('SET_TOKEN', result.token) |
| | | commit('SET_NAME', { |
| | | username: userInfo.username, |
| | | realname: userInfo.realname |
| | | }) |
| | | commit('SET_AVATAR', userInfo.avatar) |
| | | resolve(response) |
| | | } else { |
| | | reject(response) |
| | | } |
| | | }).catch(error => { |
| | | reject(error) |
| | | }) |
| | | }) |
| | | }, |
| | | // ç¬¬ä¸æ¹ç»å½ |
| | | ThirdLogin({ |
| | | commit |
| | | }, param) { |
| | | return new Promise((resolve, reject) => { |
| | | api.thirdLogin(param.token, param.thirdType, param.tenantId).then(response => { |
| | | if (response.data.code == '200') { |
| | | const result = response.data.result |
| | | const userInfo = result.userInfo |
| | | uni.setStorageSync(ACCESS_TOKEN, result.token); |
| | | uni.setStorageSync(USER_INFO, userInfo); |
| | | uni.setStorageSync(X_TENANT_ID, userInfo.loginTenantId); |
| | | |
| | | commit('SET_TOKEN', result.token) |
| | | commit('SET_AVATAR', userInfo.avatar) |
| | | commit('SET_NAME', { username: userInfo.username,realname: userInfo.realname }) |
| | | commit('SET_ID', userInfo.id) |
| | | commit('SET_INFO', userInfo) |
| | | commit('SET_TENANTID', userInfo.loginTenantId) |
| | | resolve(response) |
| | | }else{ |
| | | reject(response) |
| | | } |
| | | }).catch(error => { |
| | | reject(error) |
| | | }) |
| | | }) |
| | | }, |
| | | // ç»åº |
| | | Logout({ commit, state }) { |
| | | return new Promise((resolve) => { |
| | | let logoutToken = state.token; |
| | | commit('SET_TOKEN', '') |
| | | uni.removeStorageSync(ACCESS_TOKEN) |
| | | api.logout(logoutToken).then(() => { |
| | | resolve() |
| | | }).catch(() => { |
| | | resolve() |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | }, |
| | | getters:{ |
| | | token: state => state.token, |
| | | username: state => {state.userid=uni.getStorageSync(USER_INFO).username; return state.username}, |
| | | nickname: state => {state.userid=uni.getStorageSync(USER_INFO).realname; return state.user.realname}, |
| | | avatar: state => {state.userid=uni.getStorageSync(USER_INFO).avatar; return state.user.avatar}, |
| | | userid:state => {state.userid=uni.getStorageSync(USER_INFO).id; return state.userid}, |
| | | } |
| | | }) |
| | | commit('SET_TOKEN', result.token) |
| | | commit('SET_AVATAR', userInfo.avatar) |
| | | commit('SET_NAME', { |
| | | username: userInfo.username, |
| | | realname: userInfo.realname |
| | | }) |
| | | commit('SET_ID', userInfo.id) |
| | | commit('SET_INFO', userInfo) |
| | | commit('SET_TENANTID', userInfo.loginTenantId) |
| | | resolve(response) |
| | | } else { |
| | | reject(response) |
| | | } |
| | | }).catch(error => { |
| | | reject(error) |
| | | }) |
| | | }) |
| | | }, |
| | | // ç»åº |
| | | Logout({ |
| | | commit, |
| | | state |
| | | }) { |
| | | return new Promise((resolve) => { |
| | | let logoutToken = state.token; |
| | | commit('SET_TOKEN', '') |
| | | uni.removeStorageSync(ACCESS_TOKEN) |
| | | api.logout(logoutToken).then(() => { |
| | | resolve() |
| | | }).catch(() => { |
| | | resolve() |
| | | }) |
| | | }) |
| | | }, |
| | | saveAuth({ |
| | | commit |
| | | }, auth) { |
| | | commit('SET_AUTH', auth) |
| | | } |
| | | }, |
| | | getters: { |
| | | getAuth: state => state.auth, |
| | | token: state => state.token, |
| | | username: state => { |
| | | state.userid = uni.getStorageSync(USER_INFO).username; |
| | | return state.username |
| | | }, |
| | | nickname: state => { |
| | | state.userid = uni.getStorageSync(USER_INFO).realname; |
| | | return state.user.realname |
| | | }, |
| | | avatar: state => { |
| | | state.userid = uni.getStorageSync(USER_INFO).avatar; |
| | | return state.user.avatar |
| | | }, |
| | | userid: state => { |
| | | state.userid = uni.getStorageSync(USER_INFO).id; |
| | | return state.userid |
| | | }, |
| | | } |
| | | }) |
| | |
| | | } |
| | | |
| | | .uni-select__selector__disabled { |
| | | opacity: 0.4; |
| | | opacity: 0.2; |
| | | cursor: default; |
| | | } |
| | | |
| | |
| | | |
| | | .is-disabled { |
| | | background-color: #f7f6f6; |
| | | color: #d5d5d5; |
| | | color: #878787; |
| | | |
| | | .uni-easyinput__placeholder-class { |
| | | color: #d5d5d5; |
| | |
| | | </upload-image> |
| | | <upload-file v-if="fileMediatype !== 'image' || showType !== 'grid'" :readonly="readonly" |
| | | :list-styles="listStyles" :files-list="filesList" :showType="showType" :delIcon="delIcon" |
| | | @uploadFiles="uploadFiles" @choose="choose" @delFile="delFile"> |
| | | @uploadFiles="uploadFiles" @choose="choose" @delFile="delFile" @downloadFile="downloadFile"> |
| | | <slot><button type="primary" size="mini">éæ©æä»¶</button></slot> |
| | | </upload-file> |
| | | </view> |
| | |
| | | options: { |
| | | virtualHost: true |
| | | }, |
| | | emits: ['select', 'success', 'fail', 'progress', 'delete', 'update:modelValue', 'input'], |
| | | emits: ['select', 'success', 'fail', 'progress', 'delete', 'update:modelValue', 'input', 'downloadFile'], |
| | | props: { |
| | | modelValue: { |
| | | type: [Array, Object], |
| | |
| | | sourceType: { |
| | | type: Array, |
| | | default () { |
| | | return ['album', 'camera'] |
| | | return ['album', 'camera'] |
| | | } |
| | | }, |
| | | provider: { |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | /** |
| | | * å
¬å¼ç¨æ·ä½¿ç¨ï¼æ¸
空æä»¶ |
| | | * @param {Object} index |
| | | */ |
| | | clearFiles(index) { |
| | | if (index !== 0 && !index) { |
| | | this.files = [] |
| | | this.$nextTick(() => { |
| | | this.setEmit() |
| | | }) |
| | | } else { |
| | | this.files.splice(index, 1) |
| | | } |
| | | this.$nextTick(() => { |
| | | this.setEmit() |
| | | }) |
| | | }, |
| | | /** |
| | | * å
¬å¼ç¨æ·ä½¿ç¨ï¼ç»§ç»ä¸ä¼ |
| | | */ |
| | | upload() { |
| | | let files = [] |
| | | this.files.forEach((v, index) => { |
| | | if (v.status === 'ready' || v.status === 'error') { |
| | | files.push(Object.assign({}, v)) |
| | | } |
| | | }) |
| | | return this.uploadFiles(files) |
| | | }, |
| | | async setValue(newVal, oldVal) { |
| | | const newData = async (v) => { |
| | | const reg = /cloud:\/\/([\w.]+\/?)\S*/ |
| | | let url = '' |
| | | if(v.fileID){ |
| | | url = v.fileID |
| | | }else{ |
| | | url = v.url |
| | | } |
| | | if (reg.test(url)) { |
| | | v.fileID = url |
| | | v.url = await this.getTempFileURL(url) |
| | | } |
| | | if(v.url) v.path = v.url |
| | | return v |
| | | } |
| | | if (this.returnType === 'object') { |
| | | if (newVal) { |
| | | await newData(newVal) |
| | | } else { |
| | | newVal = {} |
| | | } |
| | | } else { |
| | | if (!newVal) newVal = [] |
| | | for(let i =0 ;i < newVal.length ;i++){ |
| | | let v = newVal[i] |
| | | await newData(v) |
| | | } |
| | | } |
| | | this.localValue = newVal |
| | | if (this.form && this.formItem &&!this.is_reset) { |
| | | this.is_reset = false |
| | | this.formItem.setValue(this.localValue) |
| | | } |
| | | let filesData = Object.keys(newVal).length > 0 ? newVal : []; |
| | | this.files = [].concat(filesData) |
| | | }, |
| | | |
| | | /** |
| | | * éæ©æä»¶ |
| | | */ |
| | | choose() { |
| | | if (this.disabled) return |
| | | if (this.files.length >= Number(this.limitLength) && this.showType !== 'grid' && this.returnType === |
| | | 'array') { |
| | | downloadFile(item) { |
| | | console.log('åå¤ä¸è½½:', item); |
| | | |
| | | if (!item.url) { |
| | | uni.showToast({ |
| | | title: `æ¨æå¤éæ© ${this.limitLength} 个æä»¶`, |
| | | title: 'æä»¶ä¸å¯ä¸è½½', |
| | | icon: 'none' |
| | | }) |
| | | return |
| | | }); |
| | | return; |
| | | } |
| | | this.chooseFiles() |
| | | }, |
| | | |
| | | /** |
| | | * éæ©æä»¶å¹¶ä¸ä¼ |
| | | */ |
| | | chooseFiles() { |
| | | const _extname = get_extname(this.fileExtname) |
| | | // è·ååç¼ |
| | | uniCloud |
| | | .chooseAndUploadFile({ |
| | | type: this.fileMediatype, |
| | | compressed: false, |
| | | sizeType: this.sizeType, |
| | | sourceType: this.sourceType, |
| | | // TODO å¦æä¸ºç©ºï¼video æé®é¢ |
| | | extension: _extname.length > 0 ? _extname : undefined, |
| | | count: this.limitLength - this.files.length, //é»è®¤9 |
| | | onChooseFile: this.chooseFileCallback, |
| | | onUploadProgress: progressEvent => { |
| | | this.setProgress(progressEvent, progressEvent.index) |
| | | // #ifdef H5 |
| | | const a = document.createElement('a'); |
| | | a.href = item.url; |
| | | a.download = item.name || 'file'; |
| | | document.body.appendChild(a); |
| | | a.click(); |
| | | document.body.removeChild(a); |
| | | // #endif |
| | | |
| | | // #ifndef H5 |
| | | uni.downloadFile({ |
| | | url: item.url, |
| | | success: (res) => { |
| | | if (res.statusCode === 200) { |
| | | uni.openDocument({ |
| | | filePath: res.tempFilePath, |
| | | success: () => { |
| | | console.log('æå¼ææ¡£æå'); |
| | | }, |
| | | fail: () => { |
| | | uni.showToast({ |
| | | title: 'æ æ³æå¼æ¤ææ¡£ç±»å', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | .then(result => { |
| | | this.setSuccessAndError(result.tempFiles) |
| | | }) |
| | | .catch(err => { |
| | | console.log('éæ©å¤±è´¥', err) |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * éæ©æä»¶åè° |
| | | * @param {Object} res |
| | | */ |
| | | async chooseFileCallback(res) { |
| | | const _extname = get_extname(this.fileExtname) |
| | | const is_one = (Number(this.limitLength) === 1 && |
| | | this.disablePreview && |
| | | !this.disabled) || |
| | | this.returnType === 'object' |
| | | // å¦æè¿æä¸ä¸ªæä»¶ ï¼éè¦æ¸
空æ¬å°ç¼åæ°æ® |
| | | if (is_one) { |
| | | this.files = [] |
| | | } |
| | | |
| | | let { |
| | | filePaths, |
| | | files |
| | | } = get_files_and_is_max(res, _extname) |
| | | if (!(_extname && _extname.length > 0)) { |
| | | filePaths = res.tempFilePaths |
| | | files = res.tempFiles |
| | | } |
| | | |
| | | let currentData = [] |
| | | for (let i = 0; i < files.length; i++) { |
| | | if (this.limitLength - this.files.length <= 0) break |
| | | files[i].uuid = Date.now() |
| | | let filedata = await get_file_data(files[i], this.fileMediatype) |
| | | filedata.progress = 0 |
| | | filedata.status = 'ready' |
| | | this.files.push(filedata) |
| | | currentData.push({ |
| | | ...filedata, |
| | | file: files[i] |
| | | }) |
| | | } |
| | | this.$emit('select', { |
| | | tempFiles: currentData, |
| | | tempFilePaths: filePaths |
| | | }) |
| | | res.tempFiles = files |
| | | // 忢èªå¨ä¸ä¼ |
| | | if (!this.autoUpload || this.noSpace) { |
| | | res.tempFiles = [] |
| | | } |
| | | res.tempFiles.forEach((fileItem, index) => { |
| | | this.provider && (fileItem.provider = this.provider); |
| | | const fileNameSplit = fileItem.name.split('.') |
| | | const ext = fileNameSplit.pop() |
| | | const fileName = fileNameSplit.join('.').replace(/[\s\/\?<>\\:\*\|":]/g, '_') |
| | | fileItem.cloudPath = fileName + '_' + Date.now() + '_' + index + '.' + ext |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * æ¹ä¼ |
| | | * @param {Object} e |
| | | */ |
| | | uploadFiles(files) { |
| | | files = [].concat(files) |
| | | return uploadCloudFiles.call(this, files, 5, res => { |
| | | this.setProgress(res, res.index, true) |
| | | }) |
| | | .then(result => { |
| | | this.setSuccessAndError(result) |
| | | return result; |
| | | }) |
| | | .catch(err => { |
| | | console.log(err) |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * æåæå¤±è´¥ |
| | | */ |
| | | async setSuccessAndError(res, fn) { |
| | | let successData = [] |
| | | let errorData = [] |
| | | let tempFilePath = [] |
| | | let errorTempFilePath = [] |
| | | for (let i = 0; i < res.length; i++) { |
| | | const item = res[i] |
| | | const index = item.uuid ? this.files.findIndex(p => p.uuid === item.uuid) : item.index |
| | | |
| | | if (index === -1 || !this.files) break |
| | | if (item.errMsg === 'request:fail') { |
| | | this.files[index].url = item.path |
| | | this.files[index].status = 'error' |
| | | this.files[index].errMsg = item.errMsg |
| | | // this.files[index].progress = -1 |
| | | errorData.push(this.files[index]) |
| | | errorTempFilePath.push(this.files[index].url) |
| | | } else { |
| | | this.files[index].errMsg = '' |
| | | this.files[index].fileID = item.url |
| | | const reg = /cloud:\/\/([\w.]+\/?)\S*/ |
| | | if (reg.test(item.url)) { |
| | | this.files[index].url = await this.getTempFileURL(item.url) |
| | | }else{ |
| | | this.files[index].url = item.url |
| | | } |
| | | |
| | | this.files[index].status = 'success' |
| | | this.files[index].progress += 1 |
| | | successData.push(this.files[index]) |
| | | tempFilePath.push(this.files[index].fileID) |
| | | }, |
| | | fail: () => { |
| | | uni.showToast({ |
| | | title: 'ä¸è½½å¤±è´¥', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | } |
| | | |
| | | if (successData.length > 0) { |
| | | this.setEmit() |
| | | // ç¶ææ¹åè¿å |
| | | this.$emit('success', { |
| | | tempFiles: this.backObject(successData), |
| | | tempFilePaths: tempFilePath |
| | | }) |
| | | } |
| | | |
| | | if (errorData.length > 0) { |
| | | this.$emit('fail', { |
| | | tempFiles: this.backObject(errorData), |
| | | tempFilePaths: errorTempFilePath |
| | | }) |
| | | } |
| | | }); |
| | | // #endif |
| | | }, |
| | | |
| | | |
| | | /** |
| | | * è·åè¿åº¦ |
| | | * @param {Object} progressEvent |
| | | * @param {Object} index |
| | | * @param {Object} type |
| | | */ |
| | | setProgress(progressEvent, index, type) { |
| | | const fileLenth = this.files.length |
| | | const percentNum = (index / fileLenth) * 100 |
| | | const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total) |
| | | let idx = index |
| | | if (!type) { |
| | | idx = this.files.findIndex(p => p.uuid === progressEvent.tempFile.uuid) |
| | | } |
| | | if (idx === -1 || !this.files[idx]) return |
| | | // fix by mehaotian 100 就伿¶å¤±ï¼-1 æ¯ä¸ºäºè®©è¿åº¦æ¡æ¶å¤± |
| | | this.files[idx].progress = percentCompleted - 1 |
| | | // ä¸ä¼ ä¸ |
| | | this.$emit('progress', { |
| | | index: idx, |
| | | progress: parseInt(percentCompleted), |
| | | tempFile: this.files[idx] |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * å 餿件 |
| | | * @param {Object} index |
| | | */ |
| | | delFile(index) { |
| | | this.$emit('delete', { |
| | | index, |
| | | tempFile: this.files[index], |
| | | tempFilePath: this.files[index].url |
| | | }) |
| | | this.files.splice(index, 1) |
| | | /** |
| | | * å
¬å¼ç¨æ·ä½¿ç¨ï¼æ¸
空æä»¶ |
| | | * @param {Object} index |
| | | */ |
| | | clearFiles(index) { |
| | | if (index !== 0 && !index) { |
| | | this.files = [] |
| | | this.$nextTick(() => { |
| | | this.setEmit() |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * è·åæä»¶åååç¼ |
| | | * @param {Object} name |
| | | */ |
| | | getFileExt(name) { |
| | | const last_len = name.lastIndexOf('.') |
| | | const len = name.length |
| | | return { |
| | | name: name.substring(0, last_len), |
| | | ext: name.substring(last_len + 1, len) |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * å¤çè¿åäºä»¶ |
| | | */ |
| | | setEmit() { |
| | | let data = [] |
| | | if (this.returnType === 'object') { |
| | | data = this.backObject(this.files)[0] |
| | | this.localValue = data?data:null |
| | | } else { |
| | | data = this.backObject(this.files) |
| | | if (!this.localValue) { |
| | | this.localValue = [] |
| | | } |
| | | this.localValue = [...data] |
| | | } |
| | | // #ifdef VUE3 |
| | | this.$emit('update:modelValue', this.localValue) |
| | | // #endif |
| | | // #ifndef VUE3 |
| | | this.$emit('input', this.localValue) |
| | | // #endif |
| | | }, |
| | | |
| | | /** |
| | | * å¤çè¿ååæ° |
| | | * @param {Object} files |
| | | */ |
| | | backObject(files) { |
| | | let newFilesData = [] |
| | | files.forEach(v => { |
| | | newFilesData.push({ |
| | | extname: v.extname, |
| | | fileType: v.fileType, |
| | | image: v.image, |
| | | name: v.name, |
| | | path: v.path, |
| | | size: v.size, |
| | | fileID:v.fileID, |
| | | url: v.url, |
| | | // ä¿®æ¹å é¤ä¸ä¸ªæä»¶åä¸è½åä¸ä¼ çbug, #694 |
| | | uuid: v.uuid, |
| | | status: v.status, |
| | | cloudPath: v.cloudPath |
| | | }) |
| | | }) |
| | | return newFilesData |
| | | }, |
| | | async getTempFileURL(fileList) { |
| | | fileList = { |
| | | fileList: [].concat(fileList) |
| | | } |
| | | const urls = await uniCloud.getTempFileURL(fileList) |
| | | return urls.fileList[0].tempFileURL || '' |
| | | }, |
| | | /** |
| | | * è·åç¶å
ç´ å®ä¾ |
| | | */ |
| | | getForm(name = 'uniForms') { |
| | | let parent = this.$parent; |
| | | let parentName = parent.$options.name; |
| | | while (parentName !== name) { |
| | | parent = parent.$parent; |
| | | if (!parent) return false; |
| | | parentName = parent.$options.name; |
| | | } |
| | | return parent; |
| | | } else { |
| | | this.files.splice(index, 1) |
| | | } |
| | | this.$nextTick(() => { |
| | | this.setEmit() |
| | | }) |
| | | }, |
| | | /** |
| | | * å
¬å¼ç¨æ·ä½¿ç¨ï¼ç»§ç»ä¸ä¼ |
| | | */ |
| | | upload() { |
| | | let files = [] |
| | | this.files.forEach((v, index) => { |
| | | if (v.status === 'ready' || v.status === 'error') { |
| | | files.push(Object.assign({}, v)) |
| | | } |
| | | }) |
| | | return this.uploadFiles(files) |
| | | }, |
| | | async setValue(newVal, oldVal) { |
| | | const newData = async (v) => { |
| | | const reg = /cloud:\/\/([\w.]+\/?)\S*/ |
| | | let url = '' |
| | | if (v.fileID) { |
| | | url = v.fileID |
| | | } else { |
| | | url = v.url |
| | | } |
| | | if (reg.test(url)) { |
| | | v.fileID = url |
| | | v.url = await this.getTempFileURL(url) |
| | | } |
| | | if (v.url) v.path = v.url |
| | | return v |
| | | } |
| | | if (this.returnType === 'object') { |
| | | if (newVal) { |
| | | await newData(newVal) |
| | | } else { |
| | | newVal = {} |
| | | } |
| | | } else { |
| | | if (!newVal) newVal = [] |
| | | for (let i = 0; i < newVal.length; i++) { |
| | | let v = newVal[i] |
| | | await newData(v) |
| | | } |
| | | } |
| | | this.localValue = newVal |
| | | if (this.form && this.formItem && !this.is_reset) { |
| | | this.is_reset = false |
| | | this.formItem.setValue(this.localValue) |
| | | } |
| | | let filesData = Object.keys(newVal).length > 0 ? newVal : []; |
| | | this.files = [].concat(filesData) |
| | | }, |
| | | |
| | | /** |
| | | * éæ©æä»¶ |
| | | */ |
| | | choose() { |
| | | if (this.disabled) return |
| | | if (this.files.length >= Number(this.limitLength) && this.showType !== 'grid' && this.returnType === |
| | | 'array') { |
| | | uni.showToast({ |
| | | title: `æ¨æå¤éæ© ${this.limitLength} 个æä»¶`, |
| | | icon: 'none' |
| | | }) |
| | | return |
| | | } |
| | | this.chooseFiles() |
| | | }, |
| | | |
| | | /** |
| | | * éæ©æä»¶å¹¶ä¸ä¼ |
| | | */ |
| | | chooseFiles() { |
| | | const _extname = get_extname(this.fileExtname) |
| | | // è·ååç¼ |
| | | uniCloud |
| | | .chooseAndUploadFile({ |
| | | type: this.fileMediatype, |
| | | compressed: false, |
| | | sizeType: this.sizeType, |
| | | sourceType: this.sourceType, |
| | | // TODO å¦æä¸ºç©ºï¼video æé®é¢ |
| | | extension: _extname.length > 0 ? _extname : undefined, |
| | | count: this.limitLength - this.files.length, //é»è®¤9 |
| | | onChooseFile: this.chooseFileCallback, |
| | | onUploadProgress: progressEvent => { |
| | | this.setProgress(progressEvent, progressEvent.index) |
| | | } |
| | | }) |
| | | .then(result => { |
| | | this.setSuccessAndError(result.tempFiles) |
| | | }) |
| | | .catch(err => { |
| | | console.log('éæ©å¤±è´¥', err) |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * éæ©æä»¶åè° |
| | | * @param {Object} res |
| | | */ |
| | | async chooseFileCallback(res) { |
| | | const _extname = get_extname(this.fileExtname) |
| | | const is_one = (Number(this.limitLength) === 1 && |
| | | this.disablePreview && |
| | | !this.disabled) || |
| | | this.returnType === 'object' |
| | | // å¦æè¿æä¸ä¸ªæä»¶ ï¼éè¦æ¸
空æ¬å°ç¼åæ°æ® |
| | | if (is_one) { |
| | | this.files = [] |
| | | } |
| | | |
| | | let { |
| | | filePaths, |
| | | files |
| | | } = get_files_and_is_max(res, _extname) |
| | | if (!(_extname && _extname.length > 0)) { |
| | | filePaths = res.tempFilePaths |
| | | files = res.tempFiles |
| | | } |
| | | |
| | | let currentData = [] |
| | | for (let i = 0; i < files.length; i++) { |
| | | if (this.limitLength - this.files.length <= 0) break |
| | | files[i].uuid = Date.now() |
| | | let filedata = await get_file_data(files[i], this.fileMediatype) |
| | | filedata.progress = 0 |
| | | filedata.status = 'ready' |
| | | this.files.push(filedata) |
| | | currentData.push({ |
| | | ...filedata, |
| | | file: files[i] |
| | | }) |
| | | } |
| | | this.$emit('select', { |
| | | tempFiles: currentData, |
| | | tempFilePaths: filePaths |
| | | }) |
| | | res.tempFiles = files |
| | | // 忢èªå¨ä¸ä¼ |
| | | if (!this.autoUpload || this.noSpace) { |
| | | res.tempFiles = [] |
| | | } |
| | | res.tempFiles.forEach((fileItem, index) => { |
| | | this.provider && (fileItem.provider = this.provider); |
| | | const fileNameSplit = fileItem.name.split('.') |
| | | const ext = fileNameSplit.pop() |
| | | const fileName = fileNameSplit.join('.').replace(/[\s\/\?<>\\:\*\|":]/g, '_') |
| | | fileItem.cloudPath = fileName + '_' + Date.now() + '_' + index + '.' + ext |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * æ¹ä¼ |
| | | * @param {Object} e |
| | | */ |
| | | uploadFiles(files) { |
| | | files = [].concat(files) |
| | | return uploadCloudFiles.call(this, files, 5, res => { |
| | | this.setProgress(res, res.index, true) |
| | | }) |
| | | .then(result => { |
| | | this.setSuccessAndError(result) |
| | | return result; |
| | | }) |
| | | .catch(err => { |
| | | console.log(err) |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * æåæå¤±è´¥ |
| | | */ |
| | | async setSuccessAndError(res, fn) { |
| | | let successData = [] |
| | | let errorData = [] |
| | | let tempFilePath = [] |
| | | let errorTempFilePath = [] |
| | | for (let i = 0; i < res.length; i++) { |
| | | const item = res[i] |
| | | const index = item.uuid ? this.files.findIndex(p => p.uuid === item.uuid) : item.index |
| | | |
| | | if (index === -1 || !this.files) break |
| | | if (item.errMsg === 'request:fail') { |
| | | this.files[index].url = item.path |
| | | this.files[index].status = 'error' |
| | | this.files[index].errMsg = item.errMsg |
| | | // this.files[index].progress = -1 |
| | | errorData.push(this.files[index]) |
| | | errorTempFilePath.push(this.files[index].url) |
| | | } else { |
| | | this.files[index].errMsg = '' |
| | | this.files[index].fileID = item.url |
| | | const reg = /cloud:\/\/([\w.]+\/?)\S*/ |
| | | if (reg.test(item.url)) { |
| | | this.files[index].url = await this.getTempFileURL(item.url) |
| | | } else { |
| | | this.files[index].url = item.url |
| | | } |
| | | |
| | | this.files[index].status = 'success' |
| | | this.files[index].progress += 1 |
| | | successData.push(this.files[index]) |
| | | tempFilePath.push(this.files[index].fileID) |
| | | } |
| | | } |
| | | |
| | | if (successData.length > 0) { |
| | | this.setEmit() |
| | | // ç¶ææ¹åè¿å |
| | | this.$emit('success', { |
| | | tempFiles: this.backObject(successData), |
| | | tempFilePaths: tempFilePath |
| | | }) |
| | | } |
| | | |
| | | if (errorData.length > 0) { |
| | | this.$emit('fail', { |
| | | tempFiles: this.backObject(errorData), |
| | | tempFilePaths: errorTempFilePath |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * è·åè¿åº¦ |
| | | * @param {Object} progressEvent |
| | | * @param {Object} index |
| | | * @param {Object} type |
| | | */ |
| | | setProgress(progressEvent, index, type) { |
| | | const fileLenth = this.files.length |
| | | const percentNum = (index / fileLenth) * 100 |
| | | const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total) |
| | | let idx = index |
| | | if (!type) { |
| | | idx = this.files.findIndex(p => p.uuid === progressEvent.tempFile.uuid) |
| | | } |
| | | if (idx === -1 || !this.files[idx]) return |
| | | // fix by mehaotian 100 就伿¶å¤±ï¼-1 æ¯ä¸ºäºè®©è¿åº¦æ¡æ¶å¤± |
| | | this.files[idx].progress = percentCompleted - 1 |
| | | // ä¸ä¼ ä¸ |
| | | this.$emit('progress', { |
| | | index: idx, |
| | | progress: parseInt(percentCompleted), |
| | | tempFile: this.files[idx] |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * å 餿件 |
| | | * @param {Object} index |
| | | */ |
| | | delFile(index) { |
| | | this.$emit('delete', { |
| | | index, |
| | | tempFile: this.files[index], |
| | | tempFilePath: this.files[index].url |
| | | }) |
| | | this.files.splice(index, 1) |
| | | this.$nextTick(() => { |
| | | this.setEmit() |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * è·åæä»¶åååç¼ |
| | | * @param {Object} name |
| | | */ |
| | | getFileExt(name) { |
| | | const last_len = name.lastIndexOf('.') |
| | | const len = name.length |
| | | return { |
| | | name: name.substring(0, last_len), |
| | | ext: name.substring(last_len + 1, len) |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * å¤çè¿åäºä»¶ |
| | | */ |
| | | setEmit() { |
| | | let data = [] |
| | | if (this.returnType === 'object') { |
| | | data = this.backObject(this.files)[0] |
| | | this.localValue = data ? data : null |
| | | } else { |
| | | data = this.backObject(this.files) |
| | | if (!this.localValue) { |
| | | this.localValue = [] |
| | | } |
| | | this.localValue = [...data] |
| | | } |
| | | // #ifdef VUE3 |
| | | this.$emit('update:modelValue', this.localValue) |
| | | // #endif |
| | | // #ifndef VUE3 |
| | | this.$emit('input', this.localValue) |
| | | // #endif |
| | | }, |
| | | |
| | | /** |
| | | * å¤çè¿ååæ° |
| | | * @param {Object} files |
| | | */ |
| | | backObject(files) { |
| | | let newFilesData = [] |
| | | files.forEach(v => { |
| | | newFilesData.push({ |
| | | extname: v.extname, |
| | | fileType: v.fileType, |
| | | image: v.image, |
| | | name: v.name, |
| | | path: v.path, |
| | | size: v.size, |
| | | fileID: v.fileID, |
| | | url: v.url, |
| | | // ä¿®æ¹å é¤ä¸ä¸ªæä»¶åä¸è½åä¸ä¼ çbug, #694 |
| | | uuid: v.uuid, |
| | | status: v.status, |
| | | cloudPath: v.cloudPath |
| | | }) |
| | | }) |
| | | return newFilesData |
| | | }, |
| | | async getTempFileURL(fileList) { |
| | | fileList = { |
| | | fileList: [].concat(fileList) |
| | | } |
| | | const urls = await uniCloud.getTempFileURL(fileList) |
| | | return urls.fileList[0].tempFileURL || '' |
| | | }, |
| | | /** |
| | | * è·åç¶å
ç´ å®ä¾ |
| | | */ |
| | | getForm(name = 'uniForms') { |
| | | let parent = this.$parent; |
| | | let parentName = parent.$options.name; |
| | | while (parentName !== name) { |
| | | parent = parent.$parent; |
| | | if (!parent) return false; |
| | | parentName = parent.$options.name; |
| | | } |
| | | return parent; |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | |
| | | position: absolute; |
| | | transform: rotate(90deg); |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <view v-if="list.length > 0" class="uni-file-picker__lists is-text-box" :style="borderStyle"> |
| | | <!-- ,'is-list-card':showType === 'list-card' --> |
| | | |
| | | <view class="uni-file-picker__lists-box" v-for="(item ,index) in list" :key="index" :class="{ |
| | | 'files-border':index !== 0 && styles.dividline}" |
| | | :style="index !== 0 && styles.dividline &&borderLineStyle"> |
| | | <!-- <view class="uni-file-picker__lists-box" v-for="(item ,index) in list" :key="index" :class="{ |
| | | 'files-border':index !== 0 && styles.dividline}" :style="index !== 0 && styles.dividline &&borderLineStyle"> |
| | | <view class="uni-file-picker__item"> |
| | | <!-- :class="{'is-text-image':showType === 'list'}" --> |
| | | <!-- <view class="files__image is-text-image"> |
| | | <image class="header-image" :src="item.logo" mode="aspectFit"></image> |
| | | </view> --> |
| | | |
| | | <view class="files__image is-text-image"> |
| | | <image class="cuIcon-down icon-down" @click.stop="downloadFile(item,index)"></image> |
| | | </view> |
| | | <view class="files__name">{{item.name}}</view> |
| | | <view v-if="delIcon&&!readonly" class="icon-del-box icon-files" @click="delFile(index)"> |
| | | <view class="icon-del icon-files"></view> |
| | | <view class="icon-del rotate"></view> |
| | | </view> |
| | | </view> |
| | | <view v-if="(item.progress && item.progress !== 100) ||item.progress===0 " class="file-picker__progress"> |
| | | <progress class="file-picker__progress-item" :percent="item.progress === -1?0:item.progress" stroke-width="4" |
| | | :backgroundColor="item.errMsg?'#ff5a5f':'#EBEBEB'" /> |
| | | <view v-if="(item.progress && item.progress !== 100) ||item.progress===0 " |
| | | class="file-picker__progress"> |
| | | <progress class="file-picker__progress-item" :percent="item.progress === -1?0:item.progress" |
| | | stroke-width="4" :backgroundColor="item.errMsg?'#ff5a5f':'#EBEBEB'" /> |
| | | </view> |
| | | <view v-if="item.status === 'error'" class="file-picker__mask" @click.stop="uploadFiles(item,index)"> |
| | | ç¹å»éè¯ |
| | | </view> |
| | | </view> |
| | | </view> --> |
| | | |
| | | </view> |
| | | </view> |
| | |
| | | <script> |
| | | export default { |
| | | name: "uploadFile", |
| | | emits:['uploadFiles','choose','delFile'], |
| | | emits: ['uploadFiles', 'choose', 'delFile','downloadFile'], |
| | | props: { |
| | | filesList: { |
| | | type: Array, |
| | |
| | | } |
| | | } |
| | | }, |
| | | readonly:{ |
| | | type:Boolean, |
| | | default:false |
| | | readonly: { |
| | | type: Boolean, |
| | | default: false |
| | | } |
| | | }, |
| | | computed: { |
| | | list() { |
| | | let files = [] |
| | | this.filesList.forEach(v => { |
| | | console.log(v); |
| | | files.push(v) |
| | | }) |
| | | return files |
| | |
| | | index |
| | | }) |
| | | }, |
| | | |
| | | downloadFile(item,index){ |
| | | this.$emit("downloadFile", { |
| | | item, |
| | | index |
| | | }) |
| | | }, |
| | | choose() { |
| | | this.$emit("choose") |
| | | }, |
| | |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | .icon-down { |
| | | margin-top: 7px; |
| | | } |
| | | |
| | | .uni-file-picker__files { |
| | | /* #ifndef APP-NVUE */ |
| | | display: flex; |
| | |
| | | } |
| | | |
| | | /* #endif */ |
| | | </style> |
| | | </style> |