SImportModal.js 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168
  1. var tt = Object.defineProperty;
  2. var je = Object.getOwnPropertySymbols;
  3. var nt = Object.prototype.hasOwnProperty, ot = Object.prototype.propertyIsEnumerable;
  4. var Be = (e, t, o) => t in e ? tt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, pe = (e, t) => {
  5. for (var o in t || (t = {}))
  6. nt.call(t, o) && Be(e, o, t[o]);
  7. if (je)
  8. for (var o of je(t))
  9. ot.call(t, o) && Be(e, o, t[o]);
  10. return e;
  11. };
  12. import { defineComponent as ce, ref as V, onMounted as xe, onBeforeUnmount as Ve, createVNode as f, shallowRef as ge, watch as Ae, computed as ne, Transition as lt, withDirectives as he, vShow as we, watchEffect as at, triggerRef as it, TransitionGroup as rt, toRef as st, resolveComponent as ct, openBlock as Y, createBlock as oe, withCtx as K, createElementVNode as L, toDisplayString as E, createTextVNode as ee, createCommentVNode as ie, createElementBlock as $e, Fragment as Me, renderList as dt } from "vue";
  13. import { aI as ut, aG as pt, aX as ft, D as mt, _ as A, cJ as vt, i as Le, bm as I, bp as fe, e as ae, bn as J, bo as se, l as Ce, d as R, u as Ee, ba as gt, an as ht, am as wt, al as yt, y as $t, b8 as bt, b9 as It, cK as St, cL as Ct, a1 as Ne, cM as xt, E as _t, B as Ue, bb as Ft, cN as Ge, t as We, cw as Ke, cd as Rt, g as Dt, m as Pt, b7 as Ot, r as Tt, U as Ut, Y as At, L as Lt, h as Fe, b3 as Et, b5 as jt, c as me, bO as Bt, n as Mt, a6 as Nt, I as zt } from "./index2.js";
  14. import { P as Ht, _ as Xt, S as kt } from "./index11.js";
  15. import { b as qt } from "./index5.js";
  16. import { _ as Vt } from "./index14.js";
  17. function Gt(e, t, o, n) {
  18. for (var a = -1, i = e == null ? 0 : e.length; ++a < i; ) {
  19. var l = e[a];
  20. t(n, l, o(l), e);
  21. }
  22. return n;
  23. }
  24. function Wt(e) {
  25. return function(t, o, n) {
  26. for (var a = -1, i = Object(t), l = n(t), c = l.length; c--; ) {
  27. var w = l[++a];
  28. if (o(i[w], w, i) === !1)
  29. break;
  30. }
  31. return t;
  32. };
  33. }
  34. var Kt = Wt();
  35. function Jt(e, t) {
  36. return e && Kt(e, t, ut);
  37. }
  38. function Yt(e, t) {
  39. return function(o, n) {
  40. if (o == null)
  41. return o;
  42. if (!pt(o))
  43. return e(o, n);
  44. for (var a = o.length, i = -1, l = Object(o); ++i < a && n(l[i], i, l) !== !1; )
  45. ;
  46. return o;
  47. };
  48. }
  49. var Zt = Yt(Jt);
  50. function Qt(e, t, o, n) {
  51. return Zt(e, function(a, i, l) {
  52. t(n, a, o(a), l);
  53. }), n;
  54. }
  55. function en(e, t) {
  56. return function(o, n) {
  57. var a = ft(o) ? Gt : Qt, i = t ? t() : {};
  58. return a(o, e, qt(n), i);
  59. };
  60. }
  61. var tn = en(function(e, t, o) {
  62. e[o ? 0 : 1].push(t);
  63. }, function() {
  64. return [[], []];
  65. });
  66. function nn(e, t) {
  67. const o = `cannot ${e.method} ${e.action} ${t.status}'`, n = new Error(o);
  68. return n.status = t.status, n.method = e.method, n.url = e.action, n;
  69. }
  70. function ze(e) {
  71. const t = e.responseText || e.response;
  72. if (!t)
  73. return t;
  74. try {
  75. return JSON.parse(t);
  76. } catch (o) {
  77. return t;
  78. }
  79. }
  80. function on(e) {
  81. const t = new XMLHttpRequest();
  82. e.onProgress && t.upload && (t.upload.onprogress = function(i) {
  83. i.total > 0 && (i.percent = i.loaded / i.total * 100), e.onProgress(i);
  84. });
  85. const o = new FormData();
  86. e.data && Object.keys(e.data).forEach((a) => {
  87. const i = e.data[a];
  88. if (Array.isArray(i)) {
  89. i.forEach((l) => {
  90. o.append(`${a}[]`, l);
  91. });
  92. return;
  93. }
  94. o.append(a, i);
  95. }), e.file instanceof Blob ? o.append(e.filename, e.file, e.file.name) : o.append(e.filename, e.file), t.onerror = function(i) {
  96. e.onError(i);
  97. }, t.onload = function() {
  98. return t.status < 200 || t.status >= 300 ? e.onError(nn(e, t), ze(t)) : e.onSuccess(ze(t), t);
  99. }, t.open(e.method, e.action, !0), e.withCredentials && "withCredentials" in t && (t.withCredentials = !0);
  100. const n = e.headers || {};
  101. return n["X-Requested-With"] !== null && t.setRequestHeader("X-Requested-With", "XMLHttpRequest"), Object.keys(n).forEach((a) => {
  102. n[a] !== null && t.setRequestHeader(a, n[a]);
  103. }), t.send(o), {
  104. abort() {
  105. t.abort();
  106. }
  107. };
  108. }
  109. const ln = +/* @__PURE__ */ new Date();
  110. let an = 0;
  111. function Re() {
  112. return `vc-upload-${ln}-${++an}`;
  113. }
  114. const De = (e, t) => {
  115. if (e && t) {
  116. const o = Array.isArray(t) ? t : t.split(","), n = e.name || "", a = e.type || "", i = a.replace(/\/.*$/, "");
  117. return o.some((l) => {
  118. const c = l.trim();
  119. if (/^\*(\/\*)?$/.test(l))
  120. return !0;
  121. if (c.charAt(0) === ".") {
  122. const w = n.toLowerCase(), F = c.toLowerCase();
  123. let g = [F];
  124. return (F === ".jpg" || F === ".jpeg") && (g = [".jpg", ".jpeg"]), g.some((D) => w.endsWith(D));
  125. }
  126. return /\/\*$/.test(c) ? i === c.replace(/\/.*$/, "") : a === c ? !0 : /^\w+$/.test(c) ? (mt(!1, `Upload takes an invalidate 'accept' type '${c}'.Skip for check.`), !0) : !1;
  127. });
  128. }
  129. return !0;
  130. };
  131. function rn(e, t) {
  132. const o = e.createReader();
  133. let n = [];
  134. function a() {
  135. o.readEntries((i) => {
  136. const l = Array.prototype.slice.apply(i);
  137. n = n.concat(l), !l.length ? t(n) : a();
  138. });
  139. }
  140. a();
  141. }
  142. const sn = (e, t, o) => {
  143. const n = (a, i) => {
  144. a.path = i || "", a.isFile ? a.file((l) => {
  145. o(l) && (a.fullPath && !l.webkitRelativePath && (Object.defineProperties(l, {
  146. webkitRelativePath: {
  147. writable: !0
  148. }
  149. }), l.webkitRelativePath = a.fullPath.replace(/^\//, ""), Object.defineProperties(l, {
  150. webkitRelativePath: {
  151. writable: !1
  152. }
  153. })), t([l]));
  154. }) : a.isDirectory && rn(a, (l) => {
  155. l.forEach((c) => {
  156. n(c, `${i}${a.name}/`);
  157. });
  158. });
  159. };
  160. e.forEach((a) => {
  161. n(a.webkitGetAsEntry());
  162. });
  163. }, Je = () => ({
  164. capture: [Boolean, String],
  165. multipart: {
  166. type: Boolean,
  167. default: void 0
  168. },
  169. name: String,
  170. disabled: {
  171. type: Boolean,
  172. default: void 0
  173. },
  174. componentTag: String,
  175. action: [String, Function],
  176. method: String,
  177. directory: {
  178. type: Boolean,
  179. default: void 0
  180. },
  181. data: [Object, Function],
  182. headers: Object,
  183. accept: String,
  184. multiple: {
  185. type: Boolean,
  186. default: void 0
  187. },
  188. onBatchStart: Function,
  189. onReject: Function,
  190. onStart: Function,
  191. onError: Function,
  192. onSuccess: Function,
  193. onProgress: Function,
  194. beforeUpload: Function,
  195. customRequest: Function,
  196. withCredentials: {
  197. type: Boolean,
  198. default: void 0
  199. },
  200. openFileDialogOnClick: {
  201. type: Boolean,
  202. default: void 0
  203. },
  204. prefixCls: String,
  205. id: String,
  206. onMouseenter: Function,
  207. onMouseleave: Function,
  208. onClick: Function
  209. });
  210. var cn = function(e, t, o, n) {
  211. function a(i) {
  212. return i instanceof o ? i : new o(function(l) {
  213. l(i);
  214. });
  215. }
  216. return new (o || (o = Promise))(function(i, l) {
  217. function c(g) {
  218. try {
  219. F(n.next(g));
  220. } catch (D) {
  221. l(D);
  222. }
  223. }
  224. function w(g) {
  225. try {
  226. F(n.throw(g));
  227. } catch (D) {
  228. l(D);
  229. }
  230. }
  231. function F(g) {
  232. g.done ? i(g.value) : a(g.value).then(c, w);
  233. }
  234. F((n = n.apply(e, t || [])).next());
  235. });
  236. }, dn = function(e, t) {
  237. var o = {};
  238. for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]);
  239. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var a = 0, n = Object.getOwnPropertySymbols(e); a < n.length; a++)
  240. t.indexOf(n[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[a]) && (o[n[a]] = e[n[a]]);
  241. return o;
  242. };
  243. const un = ce({
  244. compatConfig: {
  245. MODE: 3
  246. },
  247. name: "AjaxUploader",
  248. inheritAttrs: !1,
  249. props: Je(),
  250. setup(e, t) {
  251. let {
  252. slots: o,
  253. attrs: n,
  254. expose: a
  255. } = t;
  256. const i = V(Re()), l = {}, c = V();
  257. let w = !1;
  258. const F = (p, y) => cn(this, void 0, void 0, function* () {
  259. const {
  260. beforeUpload: C
  261. } = e;
  262. let b = p;
  263. if (C) {
  264. try {
  265. b = yield C(p, y);
  266. } catch (v) {
  267. b = !1;
  268. }
  269. if (b === !1)
  270. return {
  271. origin: p,
  272. parsedFile: null,
  273. action: null,
  274. data: null
  275. };
  276. }
  277. const {
  278. action: T
  279. } = e;
  280. let U;
  281. typeof T == "function" ? U = yield T(p) : U = T;
  282. const {
  283. data: H
  284. } = e;
  285. let B;
  286. typeof H == "function" ? B = yield H(p) : B = H;
  287. const k = (
  288. // string type is from legacy `transformFile`.
  289. // Not sure if this will work since no related test case works with it
  290. (typeof b == "object" || typeof b == "string") && b ? b : p
  291. );
  292. let u;
  293. k instanceof File ? u = k : u = new File([k], p.name, {
  294. type: p.type
  295. });
  296. const m = u;
  297. return m.uid = p.uid, {
  298. origin: p,
  299. data: B,
  300. parsedFile: m,
  301. action: U
  302. };
  303. }), g = (p) => {
  304. let {
  305. data: y,
  306. origin: C,
  307. action: b,
  308. parsedFile: T
  309. } = p;
  310. if (!w)
  311. return;
  312. const {
  313. onStart: U,
  314. customRequest: H,
  315. name: B,
  316. headers: k,
  317. withCredentials: u,
  318. method: m
  319. } = e, {
  320. uid: v
  321. } = C, h = H || on, $ = {
  322. action: b,
  323. filename: B,
  324. data: y,
  325. file: T,
  326. headers: k,
  327. withCredentials: u,
  328. method: m || "post",
  329. onProgress: (x) => {
  330. const {
  331. onProgress: P
  332. } = e;
  333. P == null || P(x, T);
  334. },
  335. onSuccess: (x, P) => {
  336. const {
  337. onSuccess: r
  338. } = e;
  339. r == null || r(x, T, P), delete l[v];
  340. },
  341. onError: (x, P) => {
  342. const {
  343. onError: r
  344. } = e;
  345. r == null || r(x, P, T), delete l[v];
  346. }
  347. };
  348. U(C), l[v] = h($);
  349. }, D = () => {
  350. i.value = Re();
  351. }, _ = (p) => {
  352. if (p) {
  353. const y = p.uid ? p.uid : p;
  354. l[y] && l[y].abort && l[y].abort(), delete l[y];
  355. } else
  356. Object.keys(l).forEach((y) => {
  357. l[y] && l[y].abort && l[y].abort(), delete l[y];
  358. });
  359. };
  360. xe(() => {
  361. w = !0;
  362. }), Ve(() => {
  363. w = !1, _();
  364. });
  365. const O = (p) => {
  366. const y = [...p], C = y.map((b) => (b.uid = Re(), F(b, y)));
  367. Promise.all(C).then((b) => {
  368. const {
  369. onBatchStart: T
  370. } = e;
  371. T == null || T(b.map((U) => {
  372. let {
  373. origin: H,
  374. parsedFile: B
  375. } = U;
  376. return {
  377. file: H,
  378. parsedFile: B
  379. };
  380. })), b.filter((U) => U.parsedFile !== null).forEach((U) => {
  381. g(U);
  382. });
  383. });
  384. }, j = (p) => {
  385. const {
  386. accept: y,
  387. directory: C
  388. } = e, {
  389. files: b
  390. } = p.target, T = [...b].filter((U) => !C || De(U, y));
  391. O(T), D();
  392. }, s = (p) => {
  393. const y = c.value;
  394. if (!y)
  395. return;
  396. const {
  397. onClick: C
  398. } = e;
  399. y.click(), C && C(p);
  400. }, S = (p) => {
  401. p.key === "Enter" && s(p);
  402. }, N = (p) => {
  403. const {
  404. multiple: y
  405. } = e;
  406. if (p.preventDefault(), p.type !== "dragover")
  407. if (e.directory)
  408. sn(Array.prototype.slice.call(p.dataTransfer.items), O, (C) => De(C, e.accept));
  409. else {
  410. const C = tn(Array.prototype.slice.call(p.dataTransfer.files), (U) => De(U, e.accept));
  411. let b = C[0];
  412. const T = C[1];
  413. y === !1 && (b = b.slice(0, 1)), O(b), T.length && e.onReject && e.onReject(T);
  414. }
  415. };
  416. return a({
  417. abort: _
  418. }), () => {
  419. var p;
  420. const {
  421. componentTag: y,
  422. prefixCls: C,
  423. disabled: b,
  424. id: T,
  425. multiple: U,
  426. accept: H,
  427. capture: B,
  428. directory: k,
  429. openFileDialogOnClick: u,
  430. onMouseenter: m,
  431. onMouseleave: v
  432. } = e, h = dn(e, ["componentTag", "prefixCls", "disabled", "id", "multiple", "accept", "capture", "directory", "openFileDialogOnClick", "onMouseenter", "onMouseleave"]), $ = {
  433. [C]: !0,
  434. [`${C}-disabled`]: b,
  435. [n.class]: !!n.class
  436. }, x = k ? {
  437. directory: "directory",
  438. webkitdirectory: "webkitdirectory"
  439. } : {};
  440. return f(y, A(A({}, b ? {} : {
  441. onClick: u ? s : () => {
  442. },
  443. onKeydown: u ? S : () => {
  444. },
  445. onMouseenter: m,
  446. onMouseleave: v,
  447. onDrop: N,
  448. onDragover: N,
  449. tabindex: "0"
  450. }), {}, {
  451. class: $,
  452. role: "button",
  453. style: n.style
  454. }), {
  455. default: () => [f("input", A(A(A({}, vt(h, {
  456. aria: !0,
  457. data: !0
  458. })), {}, {
  459. id: T,
  460. type: "file",
  461. ref: c,
  462. onClick: (r) => r.stopPropagation(),
  463. onCancel: (r) => r.stopPropagation(),
  464. key: i.value,
  465. style: {
  466. display: "none"
  467. },
  468. accept: H
  469. }, x), {}, {
  470. multiple: U,
  471. onChange: j
  472. }, B != null ? {
  473. capture: B
  474. } : {}), null), (p = o.default) === null || p === void 0 ? void 0 : p.call(o)]
  475. });
  476. };
  477. }
  478. });
  479. function Pe() {
  480. }
  481. const He = ce({
  482. compatConfig: {
  483. MODE: 3
  484. },
  485. name: "Upload",
  486. inheritAttrs: !1,
  487. props: Le(Je(), {
  488. componentTag: "span",
  489. prefixCls: "rc-upload",
  490. data: {},
  491. headers: {},
  492. name: "file",
  493. multipart: !1,
  494. onStart: Pe,
  495. onError: Pe,
  496. onSuccess: Pe,
  497. multiple: !1,
  498. beforeUpload: null,
  499. customRequest: null,
  500. withCredentials: !1,
  501. openFileDialogOnClick: !0
  502. }),
  503. setup(e, t) {
  504. let {
  505. slots: o,
  506. attrs: n,
  507. expose: a
  508. } = t;
  509. const i = V();
  510. return a({
  511. abort: (c) => {
  512. var w;
  513. (w = i.value) === null || w === void 0 || w.abort(c);
  514. }
  515. }), () => f(un, A(A(A({}, e), n), {}, {
  516. ref: i
  517. }), o);
  518. }
  519. });
  520. function Ye() {
  521. return {
  522. capture: fe([Boolean, String]),
  523. type: se(),
  524. name: String,
  525. defaultFileList: Ce(),
  526. fileList: Ce(),
  527. action: fe([String, Function]),
  528. directory: J(),
  529. data: fe([Object, Function]),
  530. method: se(),
  531. headers: ae(),
  532. showUploadList: fe([Boolean, Object]),
  533. multiple: J(),
  534. accept: String,
  535. beforeUpload: I(),
  536. onChange: I(),
  537. "onUpdate:fileList": I(),
  538. onDrop: I(),
  539. listType: se(),
  540. onPreview: I(),
  541. onDownload: I(),
  542. onReject: I(),
  543. onRemove: I(),
  544. /** @deprecated Please use `onRemove` directly */
  545. remove: I(),
  546. supportServerRender: J(),
  547. disabled: J(),
  548. prefixCls: String,
  549. customRequest: I(),
  550. withCredentials: J(),
  551. openFileDialogOnClick: J(),
  552. locale: ae(),
  553. id: String,
  554. previewFile: I(),
  555. /** @deprecated Please use `beforeUpload` directly */
  556. transformFile: I(),
  557. iconRender: I(),
  558. isImageUrl: I(),
  559. progress: ae(),
  560. itemRender: I(),
  561. /** Config max count of `fileList`. Will replace current one when `maxCount` is 1 */
  562. maxCount: Number,
  563. height: fe([Number, String]),
  564. removeIcon: I(),
  565. downloadIcon: I(),
  566. previewIcon: I()
  567. };
  568. }
  569. function pn() {
  570. return {
  571. listType: se(),
  572. onPreview: I(),
  573. onDownload: I(),
  574. onRemove: I(),
  575. items: Ce(),
  576. progress: ae(),
  577. prefixCls: se(),
  578. showRemoveIcon: J(),
  579. showDownloadIcon: J(),
  580. showPreviewIcon: J(),
  581. removeIcon: I(),
  582. downloadIcon: I(),
  583. previewIcon: I(),
  584. locale: ae(void 0),
  585. previewFile: I(),
  586. iconRender: I(),
  587. isImageUrl: I(),
  588. appendAction: I(),
  589. appendActionVisible: J(),
  590. itemRender: I()
  591. };
  592. }
  593. function be(e) {
  594. return R(R({}, e), {
  595. lastModified: e.lastModified,
  596. lastModifiedDate: e.lastModifiedDate,
  597. name: e.name,
  598. size: e.size,
  599. type: e.type,
  600. uid: e.uid,
  601. percent: 0,
  602. originFileObj: e
  603. });
  604. }
  605. function Ie(e, t) {
  606. const o = [...t], n = o.findIndex((a) => {
  607. let {
  608. uid: i
  609. } = a;
  610. return i === e.uid;
  611. });
  612. return n === -1 ? o.push(e) : o[n] = e, o;
  613. }
  614. function Oe(e, t) {
  615. const o = e.uid !== void 0 ? "uid" : "name";
  616. return t.filter((n) => n[o] === e[o])[0];
  617. }
  618. function fn(e, t) {
  619. const o = e.uid !== void 0 ? "uid" : "name", n = t.filter((a) => a[o] !== e[o]);
  620. return n.length === t.length ? null : n;
  621. }
  622. const mn = function() {
  623. const t = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "").split("/"), n = t[t.length - 1].split(/#|\?/)[0];
  624. return (/\.[^./\\]*$/.exec(n) || [""])[0];
  625. }, Ze = (e) => e.indexOf("image/") === 0, vn = (e) => {
  626. if (e.type && !e.thumbUrl)
  627. return Ze(e.type);
  628. const t = e.thumbUrl || e.url || "", o = mn(t);
  629. return /^data:image\//.test(t) || /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(o) ? !0 : !(/^data:/.test(t) || o);
  630. }, le = 200;
  631. function gn(e) {
  632. return new Promise((t) => {
  633. if (!e.type || !Ze(e.type)) {
  634. t("");
  635. return;
  636. }
  637. const o = document.createElement("canvas");
  638. o.width = le, o.height = le, o.style.cssText = `position: fixed; left: 0; top: 0; width: ${le}px; height: ${le}px; z-index: 9999; display: none;`, document.body.appendChild(o);
  639. const n = o.getContext("2d"), a = new Image();
  640. if (a.onload = () => {
  641. const {
  642. width: i,
  643. height: l
  644. } = a;
  645. let c = le, w = le, F = 0, g = 0;
  646. i > l ? (w = l * (le / i), g = -(w - c) / 2) : (c = i * (le / l), F = -(c - w) / 2), n.drawImage(a, F, g, c, w);
  647. const D = o.toDataURL();
  648. document.body.removeChild(o), t(D);
  649. }, a.crossOrigin = "anonymous", e.type.startsWith("image/svg+xml")) {
  650. const i = new FileReader();
  651. i.addEventListener("load", () => {
  652. i.result && (a.src = i.result);
  653. }), i.readAsDataURL(e);
  654. } else
  655. a.src = window.URL.createObjectURL(e);
  656. });
  657. }
  658. const hn = () => ({
  659. prefixCls: String,
  660. locale: ae(void 0),
  661. file: ae(),
  662. items: Ce(),
  663. listType: se(),
  664. isImgUrl: I(),
  665. showRemoveIcon: J(),
  666. showDownloadIcon: J(),
  667. showPreviewIcon: J(),
  668. removeIcon: I(),
  669. downloadIcon: I(),
  670. previewIcon: I(),
  671. iconRender: I(),
  672. actionIconRender: I(),
  673. itemRender: I(),
  674. onPreview: I(),
  675. onClose: I(),
  676. onDownload: I(),
  677. progress: ae()
  678. }), wn = ce({
  679. compatConfig: {
  680. MODE: 3
  681. },
  682. name: "ListItem",
  683. inheritAttrs: !1,
  684. props: hn(),
  685. setup(e, t) {
  686. let {
  687. slots: o,
  688. attrs: n
  689. } = t;
  690. var a;
  691. const i = ge(!1), l = ge();
  692. xe(() => {
  693. l.value = setTimeout(() => {
  694. i.value = !0;
  695. }, 300);
  696. }), Ve(() => {
  697. clearTimeout(l.value);
  698. });
  699. const c = ge((a = e.file) === null || a === void 0 ? void 0 : a.status);
  700. Ae(() => {
  701. var g;
  702. return (g = e.file) === null || g === void 0 ? void 0 : g.status;
  703. }, (g) => {
  704. g !== "removed" && (c.value = g);
  705. });
  706. const {
  707. rootPrefixCls: w
  708. } = Ee("upload", e), F = ne(() => gt(`${w.value}-fade`));
  709. return () => {
  710. var g, D;
  711. const {
  712. prefixCls: _,
  713. locale: O,
  714. listType: j,
  715. file: s,
  716. items: S,
  717. progress: N,
  718. iconRender: p = o.iconRender,
  719. actionIconRender: y = o.actionIconRender,
  720. itemRender: C = o.itemRender,
  721. isImgUrl: b,
  722. showPreviewIcon: T,
  723. showRemoveIcon: U,
  724. showDownloadIcon: H,
  725. previewIcon: B = o.previewIcon,
  726. removeIcon: k = o.removeIcon,
  727. downloadIcon: u = o.downloadIcon,
  728. onPreview: m,
  729. onDownload: v,
  730. onClose: h
  731. } = e, {
  732. class: $,
  733. style: x
  734. } = n, P = p({
  735. file: s
  736. });
  737. let r = f("div", {
  738. class: `${_}-text-icon`
  739. }, [P]);
  740. if (j === "picture" || j === "picture-card")
  741. if (c.value === "uploading" || !s.thumbUrl && !s.url) {
  742. const Q = {
  743. [`${_}-list-item-thumbnail`]: !0,
  744. [`${_}-list-item-file`]: c.value !== "uploading"
  745. };
  746. r = f("div", {
  747. class: Q
  748. }, [P]);
  749. } else {
  750. const Q = b != null && b(s) ? f("img", {
  751. src: s.thumbUrl || s.url,
  752. alt: s.name,
  753. class: `${_}-list-item-image`,
  754. crossorigin: s.crossOrigin
  755. }, null) : P, Qe = {
  756. [`${_}-list-item-thumbnail`]: !0,
  757. [`${_}-list-item-file`]: b && !b(s)
  758. };
  759. r = f("a", {
  760. class: Qe,
  761. onClick: (et) => m(s, et),
  762. href: s.url || s.thumbUrl,
  763. target: "_blank",
  764. rel: "noopener noreferrer"
  765. }, [Q]);
  766. }
  767. const d = {
  768. [`${_}-list-item`]: !0,
  769. [`${_}-list-item-${c.value}`]: !0
  770. }, M = typeof s.linkProps == "string" ? JSON.parse(s.linkProps) : s.linkProps, Z = U ? y({
  771. customIcon: k ? k({
  772. file: s
  773. }) : f(ht, null, null),
  774. callback: () => h(s),
  775. prefixCls: _,
  776. title: O.removeFile
  777. }) : null, z = H && c.value === "done" ? y({
  778. customIcon: u ? u({
  779. file: s
  780. }) : f(wt, null, null),
  781. callback: () => v(s),
  782. prefixCls: _,
  783. title: O.downloadFile
  784. }) : null, G = j !== "picture-card" && f("span", {
  785. key: "download-delete",
  786. class: [`${_}-list-item-actions`, {
  787. picture: j === "picture"
  788. }]
  789. }, [z, Z]), X = `${_}-list-item-name`, W = s.url ? [f("a", A(A({
  790. key: "view",
  791. target: "_blank",
  792. rel: "noopener noreferrer",
  793. class: X,
  794. title: s.name
  795. }, M), {}, {
  796. href: s.url,
  797. onClick: (Q) => m(s, Q)
  798. }), [s.name]), G] : [f("span", {
  799. key: "view",
  800. class: X,
  801. onClick: (Q) => m(s, Q),
  802. title: s.name
  803. }, [s.name]), G], te = {
  804. pointerEvents: "none",
  805. opacity: 0.5
  806. }, re = T ? f("a", {
  807. href: s.url || s.thumbUrl,
  808. target: "_blank",
  809. rel: "noopener noreferrer",
  810. style: s.url || s.thumbUrl ? void 0 : te,
  811. onClick: (Q) => m(s, Q),
  812. title: O.previewFile
  813. }, [B ? B({
  814. file: s
  815. }) : f(yt, null, null)]) : null, q = j === "picture-card" && c.value !== "uploading" && f("span", {
  816. class: `${_}-list-item-actions`
  817. }, [re, c.value === "done" && z, Z]), de = f("div", {
  818. class: d
  819. }, [r, W, q, i.value && f(lt, F.value, {
  820. default: () => [he(f("div", {
  821. class: `${_}-list-item-progress`
  822. }, ["percent" in s ? f(Ht, A(A({}, N), {}, {
  823. type: "line",
  824. percent: s.percent
  825. }), null) : null]), [[we, c.value === "uploading"]])]
  826. })]), _e = {
  827. [`${_}-list-item-container`]: !0,
  828. [`${$}`]: !!$
  829. }, ue = s.response && typeof s.response == "string" ? s.response : ((g = s.error) === null || g === void 0 ? void 0 : g.statusText) || ((D = s.error) === null || D === void 0 ? void 0 : D.message) || O.uploadError, ye = c.value === "error" ? f($t, {
  830. title: ue,
  831. getPopupContainer: (Q) => Q.parentNode
  832. }, {
  833. default: () => [de]
  834. }) : de;
  835. return f("div", {
  836. class: _e,
  837. style: x
  838. }, [C ? C({
  839. originNode: ye,
  840. file: s,
  841. fileList: S,
  842. actions: {
  843. download: v.bind(null, s),
  844. preview: m.bind(null, s),
  845. remove: h.bind(null, s)
  846. }
  847. }) : ye]);
  848. };
  849. }
  850. }), yn = (e, t) => {
  851. let {
  852. slots: o
  853. } = t;
  854. var n;
  855. return Ft((n = o.default) === null || n === void 0 ? void 0 : n.call(o))[0];
  856. }, $n = ce({
  857. compatConfig: {
  858. MODE: 3
  859. },
  860. name: "AUploadList",
  861. props: Le(pn(), {
  862. listType: "text",
  863. progress: {
  864. strokeWidth: 2,
  865. showInfo: !1
  866. },
  867. showRemoveIcon: !0,
  868. showDownloadIcon: !1,
  869. showPreviewIcon: !0,
  870. previewFile: gn,
  871. isImageUrl: vn,
  872. items: [],
  873. appendActionVisible: !0
  874. }),
  875. setup(e, t) {
  876. let {
  877. slots: o,
  878. expose: n
  879. } = t;
  880. const a = ge(!1);
  881. xe(() => {
  882. a.value == !0;
  883. });
  884. const i = ge([]);
  885. Ae(() => e.items, function() {
  886. let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
  887. i.value = s.slice();
  888. }, {
  889. immediate: !0,
  890. deep: !0
  891. }), at(() => {
  892. if (e.listType !== "picture" && e.listType !== "picture-card")
  893. return;
  894. let s = !1;
  895. (e.items || []).forEach((S, N) => {
  896. typeof document == "undefined" || typeof window == "undefined" || !window.FileReader || !window.File || !(S.originFileObj instanceof File || S.originFileObj instanceof Blob) || S.thumbUrl !== void 0 || (S.thumbUrl = "", e.previewFile && e.previewFile(S.originFileObj).then((p) => {
  897. const y = p || "";
  898. y !== S.thumbUrl && (i.value[N].thumbUrl = y, s = !0);
  899. }));
  900. }), s && it(i);
  901. });
  902. const l = (s, S) => {
  903. if (e.onPreview)
  904. return S == null || S.preventDefault(), e.onPreview(s);
  905. }, c = (s) => {
  906. typeof e.onDownload == "function" ? e.onDownload(s) : s.url && window.open(s.url);
  907. }, w = (s) => {
  908. var S;
  909. (S = e.onRemove) === null || S === void 0 || S.call(e, s);
  910. }, F = (s) => {
  911. let {
  912. file: S
  913. } = s;
  914. const N = e.iconRender || o.iconRender;
  915. if (N)
  916. return N({
  917. file: S,
  918. listType: e.listType
  919. });
  920. const p = S.status === "uploading", y = e.isImageUrl && e.isImageUrl(S) ? f(St, null, null) : f(Ct, null, null);
  921. let C = p ? f(Ne, null, null) : f(xt, null, null);
  922. return e.listType === "picture" ? C = p ? f(Ne, null, null) : y : e.listType === "picture-card" && (C = p ? e.locale.uploading : y), C;
  923. }, g = (s) => {
  924. const {
  925. customIcon: S,
  926. callback: N,
  927. prefixCls: p,
  928. title: y
  929. } = s, C = {
  930. type: "text",
  931. size: "small",
  932. title: y,
  933. onClick: () => {
  934. N();
  935. },
  936. class: `${p}-list-item-action`
  937. };
  938. return _t(S) ? f(Ue, C, {
  939. icon: () => S
  940. }) : f(Ue, C, {
  941. default: () => [f("span", null, [S])]
  942. });
  943. };
  944. n({
  945. handlePreview: l,
  946. handleDownload: c
  947. });
  948. const {
  949. prefixCls: D,
  950. rootPrefixCls: _
  951. } = Ee("upload", e), O = ne(() => ({
  952. [`${D.value}-list`]: !0,
  953. [`${D.value}-list-${e.listType}`]: !0
  954. })), j = ne(() => {
  955. const s = R({}, bt(`${_.value}-motion-collapse`));
  956. delete s.onAfterAppear, delete s.onAfterEnter, delete s.onAfterLeave;
  957. const S = R(R({}, It(`${D.value}-${e.listType === "picture-card" ? "animate-inline" : "animate"}`)), {
  958. class: O.value,
  959. appear: a.value
  960. });
  961. return e.listType !== "picture-card" ? R(R({}, s), S) : S;
  962. });
  963. return () => {
  964. const {
  965. listType: s,
  966. locale: S,
  967. isImageUrl: N,
  968. showPreviewIcon: p,
  969. showRemoveIcon: y,
  970. showDownloadIcon: C,
  971. removeIcon: b,
  972. previewIcon: T,
  973. downloadIcon: U,
  974. progress: H,
  975. appendAction: B,
  976. itemRender: k,
  977. appendActionVisible: u
  978. } = e, m = B == null ? void 0 : B(), v = i.value;
  979. return f(rt, A(A({}, j.value), {}, {
  980. tag: "div"
  981. }), {
  982. default: () => [v.map((h) => {
  983. const {
  984. uid: $
  985. } = h;
  986. return f(wn, {
  987. key: $,
  988. locale: S,
  989. prefixCls: D.value,
  990. file: h,
  991. items: v,
  992. progress: H,
  993. listType: s,
  994. isImgUrl: N,
  995. showPreviewIcon: p,
  996. showRemoveIcon: y,
  997. showDownloadIcon: C,
  998. onPreview: l,
  999. onDownload: c,
  1000. onClose: w,
  1001. removeIcon: b,
  1002. previewIcon: T,
  1003. downloadIcon: U,
  1004. itemRender: k
  1005. }, R(R({}, o), {
  1006. iconRender: F,
  1007. actionIconRender: g
  1008. }));
  1009. }), B ? he(f(yn, {
  1010. key: "__ant_upload_appendAction"
  1011. }, {
  1012. default: () => m
  1013. }), [[we, !!u]]) : null]
  1014. });
  1015. };
  1016. }
  1017. }), bn = (e) => {
  1018. const {
  1019. componentCls: t,
  1020. iconCls: o
  1021. } = e;
  1022. return {
  1023. [`${t}-wrapper`]: {
  1024. [`${t}-drag`]: {
  1025. position: "relative",
  1026. width: "100%",
  1027. height: "100%",
  1028. textAlign: "center",
  1029. background: e.colorFillAlter,
  1030. border: `${e.lineWidth}px dashed ${e.colorBorder}`,
  1031. borderRadius: e.borderRadiusLG,
  1032. cursor: "pointer",
  1033. transition: `border-color ${e.motionDurationSlow}`,
  1034. [t]: {
  1035. padding: `${e.padding}px 0`
  1036. },
  1037. [`${t}-btn`]: {
  1038. display: "table",
  1039. width: "100%",
  1040. height: "100%",
  1041. outline: "none"
  1042. },
  1043. [`${t}-drag-container`]: {
  1044. display: "table-cell",
  1045. verticalAlign: "middle"
  1046. },
  1047. [`&:not(${t}-disabled):hover`]: {
  1048. borderColor: e.colorPrimaryHover
  1049. },
  1050. [`p${t}-drag-icon`]: {
  1051. marginBottom: e.margin,
  1052. [o]: {
  1053. color: e.colorPrimary,
  1054. fontSize: e.uploadThumbnailSize
  1055. }
  1056. },
  1057. [`p${t}-text`]: {
  1058. margin: `0 0 ${e.marginXXS}px`,
  1059. color: e.colorTextHeading,
  1060. fontSize: e.fontSizeLG
  1061. },
  1062. [`p${t}-hint`]: {
  1063. color: e.colorTextDescription,
  1064. fontSize: e.fontSize
  1065. },
  1066. // ===================== Disabled =====================
  1067. [`&${t}-disabled`]: {
  1068. cursor: "not-allowed",
  1069. [`p${t}-drag-icon ${o},
  1070. p${t}-text,
  1071. p${t}-hint
  1072. `]: {
  1073. color: e.colorTextDisabled
  1074. }
  1075. }
  1076. }
  1077. }
  1078. };
  1079. }, In = (e) => {
  1080. const {
  1081. componentCls: t,
  1082. antCls: o,
  1083. iconCls: n,
  1084. fontSize: a,
  1085. lineHeight: i
  1086. } = e, l = `${t}-list-item`, c = `${l}-actions`, w = `${l}-action`, F = Math.round(a * i);
  1087. return {
  1088. [`${t}-wrapper`]: {
  1089. [`${t}-list`]: R(R({}, Ge()), {
  1090. lineHeight: e.lineHeight,
  1091. [l]: {
  1092. position: "relative",
  1093. height: e.lineHeight * a,
  1094. marginTop: e.marginXS,
  1095. fontSize: a,
  1096. display: "flex",
  1097. alignItems: "center",
  1098. transition: `background-color ${e.motionDurationSlow}`,
  1099. "&:hover": {
  1100. backgroundColor: e.controlItemBgHover
  1101. },
  1102. [`${l}-name`]: R(R({}, We), {
  1103. padding: `0 ${e.paddingXS}px`,
  1104. lineHeight: i,
  1105. flex: "auto",
  1106. transition: `all ${e.motionDurationSlow}`
  1107. }),
  1108. [c]: {
  1109. [w]: {
  1110. opacity: 0
  1111. },
  1112. [`${w}${o}-btn-sm`]: {
  1113. height: F,
  1114. border: 0,
  1115. lineHeight: 1,
  1116. // FIXME: should not override small button
  1117. "> span": {
  1118. transform: "scale(1)"
  1119. }
  1120. },
  1121. [`
  1122. ${w}:focus,
  1123. &.picture ${w}
  1124. `]: {
  1125. opacity: 1
  1126. },
  1127. [n]: {
  1128. color: e.colorTextDescription,
  1129. transition: `all ${e.motionDurationSlow}`
  1130. },
  1131. [`&:hover ${n}`]: {
  1132. color: e.colorText
  1133. }
  1134. },
  1135. [`${t}-icon ${n}`]: {
  1136. color: e.colorTextDescription,
  1137. fontSize: a
  1138. },
  1139. [`${l}-progress`]: {
  1140. position: "absolute",
  1141. bottom: -e.uploadProgressOffset,
  1142. width: "100%",
  1143. paddingInlineStart: a + e.paddingXS,
  1144. fontSize: a,
  1145. lineHeight: 0,
  1146. pointerEvents: "none",
  1147. "> div": {
  1148. margin: 0
  1149. }
  1150. }
  1151. },
  1152. [`${l}:hover ${w}`]: {
  1153. opacity: 1,
  1154. color: e.colorText
  1155. },
  1156. [`${l}-error`]: {
  1157. color: e.colorError,
  1158. [`${l}-name, ${t}-icon ${n}`]: {
  1159. color: e.colorError
  1160. },
  1161. [c]: {
  1162. [`${n}, ${n}:hover`]: {
  1163. color: e.colorError
  1164. },
  1165. [w]: {
  1166. opacity: 1
  1167. }
  1168. }
  1169. },
  1170. [`${t}-list-item-container`]: {
  1171. transition: `opacity ${e.motionDurationSlow}, height ${e.motionDurationSlow}`,
  1172. // For smooth removing animation
  1173. "&::before": {
  1174. display: "table",
  1175. width: 0,
  1176. height: 0,
  1177. content: '""'
  1178. }
  1179. }
  1180. })
  1181. }
  1182. };
  1183. }, Xe = new Ke("uploadAnimateInlineIn", {
  1184. from: {
  1185. width: 0,
  1186. height: 0,
  1187. margin: 0,
  1188. padding: 0,
  1189. opacity: 0
  1190. }
  1191. }), ke = new Ke("uploadAnimateInlineOut", {
  1192. to: {
  1193. width: 0,
  1194. height: 0,
  1195. margin: 0,
  1196. padding: 0,
  1197. opacity: 0
  1198. }
  1199. }), Sn = (e) => {
  1200. const {
  1201. componentCls: t
  1202. } = e, o = `${t}-animate-inline`;
  1203. return [{
  1204. [`${t}-wrapper`]: {
  1205. [`${o}-appear, ${o}-enter, ${o}-leave`]: {
  1206. animationDuration: e.motionDurationSlow,
  1207. animationTimingFunction: e.motionEaseInOutCirc,
  1208. animationFillMode: "forwards"
  1209. },
  1210. [`${o}-appear, ${o}-enter`]: {
  1211. animationName: Xe
  1212. },
  1213. [`${o}-leave`]: {
  1214. animationName: ke
  1215. }
  1216. }
  1217. }, Xe, ke];
  1218. }, Cn = (e) => {
  1219. const {
  1220. componentCls: t,
  1221. iconCls: o,
  1222. uploadThumbnailSize: n,
  1223. uploadProgressOffset: a
  1224. } = e, i = `${t}-list`, l = `${i}-item`;
  1225. return {
  1226. [`${t}-wrapper`]: {
  1227. // ${listCls} 增加优先级
  1228. [`${i}${i}-picture, ${i}${i}-picture-card`]: {
  1229. [l]: {
  1230. position: "relative",
  1231. height: n + e.lineWidth * 2 + e.paddingXS * 2,
  1232. padding: e.paddingXS,
  1233. border: `${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,
  1234. borderRadius: e.borderRadiusLG,
  1235. "&:hover": {
  1236. background: "transparent"
  1237. },
  1238. [`${l}-thumbnail`]: R(R({}, We), {
  1239. width: n,
  1240. height: n,
  1241. lineHeight: `${n + e.paddingSM}px`,
  1242. textAlign: "center",
  1243. flex: "none",
  1244. [o]: {
  1245. fontSize: e.fontSizeHeading2,
  1246. color: e.colorPrimary
  1247. },
  1248. img: {
  1249. display: "block",
  1250. width: "100%",
  1251. height: "100%",
  1252. overflow: "hidden"
  1253. }
  1254. }),
  1255. [`${l}-progress`]: {
  1256. bottom: a,
  1257. width: `calc(100% - ${e.paddingSM * 2}px)`,
  1258. marginTop: 0,
  1259. paddingInlineStart: n + e.paddingXS
  1260. }
  1261. },
  1262. [`${l}-error`]: {
  1263. borderColor: e.colorError,
  1264. // Adjust the color of the error icon : https://github.com/ant-design/ant-design/pull/24160
  1265. [`${l}-thumbnail ${o}`]: {
  1266. "svg path[fill='#e6f7ff']": {
  1267. fill: e.colorErrorBg
  1268. },
  1269. "svg path[fill='#1890ff']": {
  1270. fill: e.colorError
  1271. }
  1272. }
  1273. },
  1274. [`${l}-uploading`]: {
  1275. borderStyle: "dashed",
  1276. [`${l}-name`]: {
  1277. marginBottom: a
  1278. }
  1279. }
  1280. }
  1281. }
  1282. };
  1283. }, xn = (e) => {
  1284. const {
  1285. componentCls: t,
  1286. iconCls: o,
  1287. fontSizeLG: n,
  1288. colorTextLightSolid: a
  1289. } = e, i = `${t}-list`, l = `${i}-item`, c = e.uploadPicCardSize;
  1290. return {
  1291. [`${t}-wrapper${t}-picture-card-wrapper`]: R(R({}, Ge()), {
  1292. display: "inline-block",
  1293. width: "100%",
  1294. [`${t}${t}-select`]: {
  1295. width: c,
  1296. height: c,
  1297. marginInlineEnd: e.marginXS,
  1298. marginBottom: e.marginXS,
  1299. textAlign: "center",
  1300. verticalAlign: "top",
  1301. backgroundColor: e.colorFillAlter,
  1302. border: `${e.lineWidth}px dashed ${e.colorBorder}`,
  1303. borderRadius: e.borderRadiusLG,
  1304. cursor: "pointer",
  1305. transition: `border-color ${e.motionDurationSlow}`,
  1306. [`> ${t}`]: {
  1307. display: "flex",
  1308. alignItems: "center",
  1309. justifyContent: "center",
  1310. height: "100%",
  1311. textAlign: "center"
  1312. },
  1313. [`&:not(${t}-disabled):hover`]: {
  1314. borderColor: e.colorPrimary
  1315. }
  1316. },
  1317. // list
  1318. [`${i}${i}-picture-card`]: {
  1319. [`${i}-item-container`]: {
  1320. display: "inline-block",
  1321. width: c,
  1322. height: c,
  1323. marginBlock: `0 ${e.marginXS}px`,
  1324. marginInline: `0 ${e.marginXS}px`,
  1325. verticalAlign: "top"
  1326. },
  1327. "&::after": {
  1328. display: "none"
  1329. },
  1330. [l]: {
  1331. height: "100%",
  1332. margin: 0,
  1333. "&::before": {
  1334. position: "absolute",
  1335. zIndex: 1,
  1336. width: `calc(100% - ${e.paddingXS * 2}px)`,
  1337. height: `calc(100% - ${e.paddingXS * 2}px)`,
  1338. backgroundColor: e.colorBgMask,
  1339. opacity: 0,
  1340. transition: `all ${e.motionDurationSlow}`,
  1341. content: '" "'
  1342. }
  1343. },
  1344. [`${l}:hover`]: {
  1345. [`&::before, ${l}-actions`]: {
  1346. opacity: 1
  1347. }
  1348. },
  1349. [`${l}-actions`]: {
  1350. position: "absolute",
  1351. insetInlineStart: 0,
  1352. zIndex: 10,
  1353. width: "100%",
  1354. whiteSpace: "nowrap",
  1355. textAlign: "center",
  1356. opacity: 0,
  1357. transition: `all ${e.motionDurationSlow}`,
  1358. [`${o}-eye, ${o}-download, ${o}-delete`]: {
  1359. zIndex: 10,
  1360. width: n,
  1361. margin: `0 ${e.marginXXS}px`,
  1362. fontSize: n,
  1363. cursor: "pointer",
  1364. transition: `all ${e.motionDurationSlow}`
  1365. }
  1366. },
  1367. [`${l}-actions, ${l}-actions:hover`]: {
  1368. [`${o}-eye, ${o}-download, ${o}-delete`]: {
  1369. color: new Rt(a).setAlpha(0.65).toRgbString(),
  1370. "&:hover": {
  1371. color: a
  1372. }
  1373. }
  1374. },
  1375. [`${l}-thumbnail, ${l}-thumbnail img`]: {
  1376. position: "static",
  1377. display: "block",
  1378. width: "100%",
  1379. height: "100%",
  1380. objectFit: "contain"
  1381. },
  1382. [`${l}-name`]: {
  1383. display: "none",
  1384. textAlign: "center"
  1385. },
  1386. [`${l}-file + ${l}-name`]: {
  1387. position: "absolute",
  1388. bottom: e.margin,
  1389. display: "block",
  1390. width: `calc(100% - ${e.paddingXS * 2}px)`
  1391. },
  1392. [`${l}-uploading`]: {
  1393. [`&${l}`]: {
  1394. backgroundColor: e.colorFillAlter
  1395. },
  1396. [`&::before, ${o}-eye, ${o}-download, ${o}-delete`]: {
  1397. display: "none"
  1398. }
  1399. },
  1400. [`${l}-progress`]: {
  1401. bottom: e.marginXL,
  1402. width: `calc(100% - ${e.paddingXS * 2}px)`,
  1403. paddingInlineStart: 0
  1404. }
  1405. }
  1406. })
  1407. };
  1408. }, _n = (e) => {
  1409. const {
  1410. componentCls: t
  1411. } = e;
  1412. return {
  1413. [`${t}-rtl`]: {
  1414. direction: "rtl"
  1415. }
  1416. };
  1417. }, Fn = (e) => {
  1418. const {
  1419. componentCls: t,
  1420. colorTextDisabled: o
  1421. } = e;
  1422. return {
  1423. [`${t}-wrapper`]: R(R({}, Tt(e)), {
  1424. [t]: {
  1425. outline: 0,
  1426. "input[type='file']": {
  1427. cursor: "pointer"
  1428. }
  1429. },
  1430. [`${t}-select`]: {
  1431. display: "inline-block"
  1432. },
  1433. [`${t}-disabled`]: {
  1434. color: o,
  1435. cursor: "not-allowed"
  1436. }
  1437. })
  1438. };
  1439. }, Rn = Dt("Upload", (e) => {
  1440. const {
  1441. fontSizeHeading3: t,
  1442. fontSize: o,
  1443. lineHeight: n,
  1444. lineWidth: a,
  1445. controlHeightLG: i
  1446. } = e, l = Math.round(o * n), c = Pt(e, {
  1447. uploadThumbnailSize: t * 2,
  1448. uploadProgressOffset: l / 2 + a,
  1449. uploadPicCardSize: i * 2.55
  1450. });
  1451. return [Fn(c), bn(c), Cn(c), xn(c), In(c), Sn(c), _n(c), Ot(c)];
  1452. });
  1453. var Dn = function(e, t, o, n) {
  1454. function a(i) {
  1455. return i instanceof o ? i : new o(function(l) {
  1456. l(i);
  1457. });
  1458. }
  1459. return new (o || (o = Promise))(function(i, l) {
  1460. function c(g) {
  1461. try {
  1462. F(n.next(g));
  1463. } catch (D) {
  1464. l(D);
  1465. }
  1466. }
  1467. function w(g) {
  1468. try {
  1469. F(n.throw(g));
  1470. } catch (D) {
  1471. l(D);
  1472. }
  1473. }
  1474. function F(g) {
  1475. g.done ? i(g.value) : a(g.value).then(c, w);
  1476. }
  1477. F((n = n.apply(e, t || [])).next());
  1478. });
  1479. }, Pn = function(e, t) {
  1480. var o = {};
  1481. for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]);
  1482. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var a = 0, n = Object.getOwnPropertySymbols(e); a < n.length; a++)
  1483. t.indexOf(n[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[a]) && (o[n[a]] = e[n[a]]);
  1484. return o;
  1485. };
  1486. const ve = `__LIST_IGNORE_${Date.now()}__`, Se = ce({
  1487. compatConfig: {
  1488. MODE: 3
  1489. },
  1490. name: "AUpload",
  1491. inheritAttrs: !1,
  1492. props: Le(Ye(), {
  1493. type: "select",
  1494. multiple: !1,
  1495. action: "",
  1496. data: {},
  1497. accept: "",
  1498. showUploadList: !0,
  1499. listType: "text",
  1500. supportServerRender: !0
  1501. }),
  1502. setup(e, t) {
  1503. let {
  1504. slots: o,
  1505. attrs: n,
  1506. expose: a
  1507. } = t;
  1508. const i = Ut(), {
  1509. prefixCls: l,
  1510. direction: c,
  1511. disabled: w
  1512. } = Ee("upload", e), [F, g] = Rn(l), D = At(), _ = ne(() => {
  1513. var u;
  1514. return (u = w.value) !== null && u !== void 0 ? u : D.value;
  1515. }), [O, j] = Lt(e.defaultFileList || [], {
  1516. value: st(e, "fileList"),
  1517. postState: (u) => {
  1518. const m = Date.now();
  1519. return (u != null ? u : []).map((v, h) => (!v.uid && !Object.isFrozen(v) && (v.uid = `__AUTO__${m}_${h}__`), v));
  1520. }
  1521. }), s = V("drop"), S = V(null);
  1522. xe(() => {
  1523. Fe(e.fileList !== void 0 || n.value === void 0, "Upload", "`value` is not a valid prop, do you mean `fileList`?"), Fe(e.transformFile === void 0, "Upload", "`transformFile` is deprecated. Please use `beforeUpload` directly."), Fe(e.remove === void 0, "Upload", "`remove` props is deprecated. Please use `remove` event.");
  1524. });
  1525. const N = (u, m, v) => {
  1526. var h, $;
  1527. let x = [...m];
  1528. e.maxCount === 1 ? x = x.slice(-1) : e.maxCount && (x = x.slice(0, e.maxCount)), j(x);
  1529. const P = {
  1530. file: u,
  1531. fileList: x
  1532. };
  1533. v && (P.event = v), (h = e["onUpdate:fileList"]) === null || h === void 0 || h.call(e, P.fileList), ($ = e.onChange) === null || $ === void 0 || $.call(e, P), i.onFieldChange();
  1534. }, p = (u, m) => Dn(this, void 0, void 0, function* () {
  1535. const {
  1536. beforeUpload: v,
  1537. transformFile: h
  1538. } = e;
  1539. let $ = u;
  1540. if (v) {
  1541. const x = yield v(u, m);
  1542. if (x === !1)
  1543. return !1;
  1544. if (delete u[ve], x === ve)
  1545. return Object.defineProperty(u, ve, {
  1546. value: !0,
  1547. configurable: !0
  1548. }), !1;
  1549. typeof x == "object" && x && ($ = x);
  1550. }
  1551. return h && ($ = yield h($)), $;
  1552. }), y = (u) => {
  1553. const m = u.filter(($) => !$.file[ve]);
  1554. if (!m.length)
  1555. return;
  1556. const v = m.map(($) => be($.file));
  1557. let h = [...O.value];
  1558. v.forEach(($) => {
  1559. h = Ie($, h);
  1560. }), v.forEach(($, x) => {
  1561. let P = $;
  1562. if (m[x].parsedFile)
  1563. $.status = "uploading";
  1564. else {
  1565. const {
  1566. originFileObj: r
  1567. } = $;
  1568. let d;
  1569. try {
  1570. d = new File([r], r.name, {
  1571. type: r.type
  1572. });
  1573. } catch (M) {
  1574. d = new Blob([r], {
  1575. type: r.type
  1576. }), d.name = r.name, d.lastModifiedDate = /* @__PURE__ */ new Date(), d.lastModified = (/* @__PURE__ */ new Date()).getTime();
  1577. }
  1578. d.uid = $.uid, P = d;
  1579. }
  1580. N(P, h);
  1581. });
  1582. }, C = (u, m, v) => {
  1583. try {
  1584. typeof u == "string" && (u = JSON.parse(u));
  1585. } catch (x) {
  1586. }
  1587. if (!Oe(m, O.value))
  1588. return;
  1589. const h = be(m);
  1590. h.status = "done", h.percent = 100, h.response = u, h.xhr = v;
  1591. const $ = Ie(h, O.value);
  1592. N(h, $);
  1593. }, b = (u, m) => {
  1594. if (!Oe(m, O.value))
  1595. return;
  1596. const v = be(m);
  1597. v.status = "uploading", v.percent = u.percent;
  1598. const h = Ie(v, O.value);
  1599. N(v, h, u);
  1600. }, T = (u, m, v) => {
  1601. if (!Oe(v, O.value))
  1602. return;
  1603. const h = be(v);
  1604. h.error = u, h.response = m, h.status = "error";
  1605. const $ = Ie(h, O.value);
  1606. N(h, $);
  1607. }, U = (u) => {
  1608. let m;
  1609. const v = e.onRemove || e.remove;
  1610. Promise.resolve(typeof v == "function" ? v(u) : v).then((h) => {
  1611. var $, x;
  1612. if (h === !1)
  1613. return;
  1614. const P = fn(u, O.value);
  1615. P && (m = R(R({}, u), {
  1616. status: "removed"
  1617. }), ($ = O.value) === null || $ === void 0 || $.forEach((r) => {
  1618. const d = m.uid !== void 0 ? "uid" : "name";
  1619. r[d] === m[d] && !Object.isFrozen(r) && (r.status = "removed");
  1620. }), (x = S.value) === null || x === void 0 || x.abort(m), N(m, P));
  1621. });
  1622. }, H = (u) => {
  1623. var m;
  1624. s.value = u.type, u.type === "drop" && ((m = e.onDrop) === null || m === void 0 || m.call(e, u));
  1625. };
  1626. a({
  1627. onBatchStart: y,
  1628. onSuccess: C,
  1629. onProgress: b,
  1630. onError: T,
  1631. fileList: O,
  1632. upload: S
  1633. });
  1634. const [B] = Et("Upload", jt.Upload, ne(() => e.locale)), k = (u, m) => {
  1635. const {
  1636. removeIcon: v,
  1637. previewIcon: h,
  1638. downloadIcon: $,
  1639. previewFile: x,
  1640. onPreview: P,
  1641. onDownload: r,
  1642. isImageUrl: d,
  1643. progress: M,
  1644. itemRender: Z,
  1645. iconRender: z,
  1646. showUploadList: G
  1647. } = e, {
  1648. showDownloadIcon: X,
  1649. showPreviewIcon: W,
  1650. showRemoveIcon: te
  1651. } = typeof G == "boolean" ? {} : G;
  1652. return G ? f($n, {
  1653. prefixCls: l.value,
  1654. listType: e.listType,
  1655. items: O.value,
  1656. previewFile: x,
  1657. onPreview: P,
  1658. onDownload: r,
  1659. onRemove: U,
  1660. showRemoveIcon: !_.value && te,
  1661. showPreviewIcon: W,
  1662. showDownloadIcon: X,
  1663. removeIcon: v,
  1664. previewIcon: h,
  1665. downloadIcon: $,
  1666. iconRender: z,
  1667. locale: B.value,
  1668. isImageUrl: d,
  1669. progress: M,
  1670. itemRender: Z,
  1671. appendActionVisible: m,
  1672. appendAction: u
  1673. }, R({}, o)) : u == null ? void 0 : u();
  1674. };
  1675. return () => {
  1676. var u, m, v;
  1677. const {
  1678. listType: h,
  1679. type: $
  1680. } = e, {
  1681. class: x,
  1682. style: P
  1683. } = n, r = Pn(n, ["class", "style"]), d = R(R(R({
  1684. onBatchStart: y,
  1685. onError: T,
  1686. onProgress: b,
  1687. onSuccess: C
  1688. }, r), e), {
  1689. id: (u = e.id) !== null && u !== void 0 ? u : i.id.value,
  1690. prefixCls: l.value,
  1691. beforeUpload: p,
  1692. onChange: void 0,
  1693. disabled: _.value
  1694. });
  1695. delete d.remove, (!o.default || _.value) && delete d.id;
  1696. const M = {
  1697. [`${l.value}-rtl`]: c.value === "rtl"
  1698. };
  1699. if ($ === "drag") {
  1700. const X = me(l.value, {
  1701. [`${l.value}-drag`]: !0,
  1702. [`${l.value}-drag-uploading`]: O.value.some((W) => W.status === "uploading"),
  1703. [`${l.value}-drag-hover`]: s.value === "dragover",
  1704. [`${l.value}-disabled`]: _.value,
  1705. [`${l.value}-rtl`]: c.value === "rtl"
  1706. }, n.class, g.value);
  1707. return F(f("span", A(A({}, n), {}, {
  1708. class: me(`${l.value}-wrapper`, M, x, g.value)
  1709. }), [f("div", {
  1710. class: X,
  1711. onDrop: H,
  1712. onDragover: H,
  1713. onDragleave: H,
  1714. style: n.style
  1715. }, [f(He, A(A({}, d), {}, {
  1716. ref: S,
  1717. class: `${l.value}-btn`
  1718. }), A({
  1719. default: () => [f("div", {
  1720. class: `${l.value}-drag-container`
  1721. }, [(m = o.default) === null || m === void 0 ? void 0 : m.call(o)])]
  1722. }, o))]), k()]));
  1723. }
  1724. const Z = me(l.value, {
  1725. [`${l.value}-select`]: !0,
  1726. [`${l.value}-select-${h}`]: !0,
  1727. [`${l.value}-disabled`]: _.value,
  1728. [`${l.value}-rtl`]: c.value === "rtl"
  1729. }), z = Bt((v = o.default) === null || v === void 0 ? void 0 : v.call(o)), G = (X) => f("div", {
  1730. class: Z,
  1731. style: X
  1732. }, [f(He, A(A({}, d), {}, {
  1733. ref: S
  1734. }), o)]);
  1735. return F(h === "picture-card" ? f("span", A(A({}, n), {}, {
  1736. class: me(`${l.value}-wrapper`, `${l.value}-picture-card-wrapper`, M, n.class, g.value)
  1737. }), [k(G, !!(z && z.length))]) : f("span", A(A({}, n), {}, {
  1738. class: me(`${l.value}-wrapper`, M, n.class, g.value)
  1739. }), [G(z && z.length ? void 0 : {
  1740. display: "none"
  1741. }), k()]));
  1742. };
  1743. }
  1744. });
  1745. var qe = function(e, t) {
  1746. var o = {};
  1747. for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]);
  1748. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var a = 0, n = Object.getOwnPropertySymbols(e); a < n.length; a++)
  1749. t.indexOf(n[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[a]) && (o[n[a]] = e[n[a]]);
  1750. return o;
  1751. };
  1752. const Te = ce({
  1753. compatConfig: {
  1754. MODE: 3
  1755. },
  1756. name: "AUploadDragger",
  1757. inheritAttrs: !1,
  1758. props: Ye(),
  1759. setup(e, t) {
  1760. let {
  1761. slots: o,
  1762. attrs: n
  1763. } = t;
  1764. return () => {
  1765. const {
  1766. height: a
  1767. } = e, i = qe(e, ["height"]), {
  1768. style: l
  1769. } = n, c = qe(n, ["style"]), w = R(R(R({}, i), c), {
  1770. type: "drag",
  1771. style: R(R({}, l), {
  1772. height: typeof a == "number" ? `${a}px` : a
  1773. })
  1774. });
  1775. return f(Se, w, o);
  1776. };
  1777. }
  1778. }), On = R(Se, {
  1779. Dragger: Te,
  1780. LIST_IGNORE: ve,
  1781. install(e) {
  1782. return e.component(Se.name, Se), e.component(Te.name, Te), e;
  1783. }
  1784. }), Tn = { class: "header-steps" }, Un = { class: "import-main" }, An = { class: "upload" }, Ln = { class: "up_right" }, En = { class: "title" }, jn = { class: "tip" }, Bn = { class: "upload" }, Mn = { class: "up_right" }, Nn = { class: "title" }, zn = { class: "tip" }, Hn = { class: "extra-select-wrapper" }, Xn = { class: "import-main" }, kn = { class: "import-main" }, qn = {
  1785. key: 0,
  1786. class: "success"
  1787. }, Vn = { class: "success-title" }, Gn = { class: "success-tip" }, Wn = {
  1788. key: 1,
  1789. class: "unsuccess"
  1790. }, Kn = { class: "upload error-show" }, Jn = { class: "up_right" }, Yn = { class: "tip success-tip" }, Zn = { class: "tip error-tip" }, Qn = { class: "conTips" }, eo = /* @__PURE__ */ Object.assign({ name: "SImportModal" }, {
  1791. __name: "SImportModal",
  1792. props: {
  1793. value: { type: Boolean, default: !1 },
  1794. title: { type: String, default: () => window.$l("批量导入") },
  1795. width: { type: [String, Number], default: 1e3 },
  1796. // 文件上传地址(完整网关地址,如 /monitor/DeviceInfo/Uploader)
  1797. uploadUrl: { type: String, default: "" },
  1798. // 预览/结果表格列:[{ title, dataIndex, width }],作为默认列,接口返回 headerRow 后以接口为准
  1799. columns: { type: Array, default: () => [] },
  1800. // 四个导入接口方法:{ templateDownload, importPreview, importData, exportExceptionData }
  1801. apis: {
  1802. type: Object,
  1803. default: () => ({})
  1804. },
  1805. // 可选的业务参数下拉(如设备分类):{ options: [{ label, value }], value, placeholder, loading }
  1806. // 选中值会以 { extraKey: value } 的形式随各接口一起提交
  1807. typeSelect: { type: Object, default: null },
  1808. // typeSelect 选中值提交时的字段名
  1809. extraKey: { type: String, default: "deviceTypeId" }
  1810. },
  1811. emits: ["update:value", "reload"],
  1812. setup(e, { expose: t, emit: o }) {
  1813. const n = e, a = o, i = V(0), l = V(""), c = V([]), w = V(!1), F = V(!1), g = V([]), D = V([]), _ = V({}), O = V([]), j = V(void 0), s = ne({
  1814. get: () => n.value,
  1815. set: (r) => a("update:value", r)
  1816. }), S = ne(() => [
  1817. { width: 50, title: window.$l("序号"), align: "center", customRender: ({ index: r }) => r + 1 },
  1818. ...D.value,
  1819. { title: window.$l("操作"), dataIndex: "action", key: "action", width: 50, fixed: "right" }
  1820. ]), N = ne(() => [
  1821. { width: 50, title: window.$l("序号"), align: "center", customRender: ({ index: r }) => r + 1 },
  1822. ...D.value,
  1823. { title: window.$l("异常原因"), dataIndex: "errorsInfo", width: 150, fixed: "right" }
  1824. ]), p = ne(() => n.typeSelect ? j.value ? { [n.extraKey]: j.value } : {} : {});
  1825. Ae(
  1826. () => {
  1827. var r;
  1828. return (r = n.typeSelect) == null ? void 0 : r.options;
  1829. },
  1830. (r) => {
  1831. r && r.length && (r.some((M) => M.value === j.value) || (j.value = r[0].value));
  1832. },
  1833. { immediate: !0, deep: !0 }
  1834. );
  1835. const y = () => {
  1836. var r;
  1837. i.value = 0, l.value = "", c.value = [], w.value = !1, g.value = [], D.value = [], _.value = {}, O.value = [], n.typeSelect && (j.value = (r = n.typeSelect.options) != null && r.length ? n.typeSelect.options[0].value : void 0);
  1838. }, C = () => {
  1839. s.value = !0, y();
  1840. }, b = (r) => r && Object.prototype.hasOwnProperty.call(r, "data") ? r.data : r, T = (r) => (r || []).map((d) => ({
  1841. title: d.fullName || "",
  1842. dataIndex: d.id || "",
  1843. key: d.id || ""
  1844. })), U = ({ file: r, onSuccess: d, onError: M }) => {
  1845. var G;
  1846. const Z = (G = window.$utils) == null ? void 0 : G.http;
  1847. if (!Z) {
  1848. window.$message.error(window.$l("未获取到请求工具,无法上传")), M && M(new Error("http not found"));
  1849. return;
  1850. }
  1851. const z = new FormData();
  1852. return z.append("file", r), Z({
  1853. url: n.uploadUrl,
  1854. method: "post",
  1855. data: z,
  1856. headers: { "Content-Type": "multipart/form-data" }
  1857. }).then((X) => {
  1858. var re, q;
  1859. const W = b(X) || {}, te = (q = (re = W == null ? void 0 : W.name) != null ? re : W == null ? void 0 : W.fileName) != null ? q : "";
  1860. if (!te) throw new Error(window.$l("上传返回文件名无效"));
  1861. l.value = te, d && d(X);
  1862. }).catch((X) => {
  1863. window.$message.error(typeof (X == null ? void 0 : X.msg) == "string" ? X.msg : window.$l("上传失败")), M && M(X);
  1864. });
  1865. }, H = (r) => {
  1866. const d = r.name.replace(/.+\./, "");
  1867. return ["xls", "xlsx"].indexOf(d.toLowerCase()) !== -1 ? r.size / 1024 >= 500 ? (window.$message.error(window.$l("文件大小超过500KB")), !1) : !0 : (window.$message.error(window.$l("文件格式不正确")), !1);
  1868. }, B = (r) => new Promise((d, M) => {
  1869. window.$modal.confirm({
  1870. title: window.$l("提示"),
  1871. content: `${window.$l("确定移除")}${r.name}?`,
  1872. onOk: () => {
  1873. l.value = "", d();
  1874. },
  1875. onCancel: () => M()
  1876. });
  1877. }), k = () => {
  1878. (c.value.length || l.value) && y();
  1879. }, u = () => {
  1880. i.value != 0 && (i.value -= 1);
  1881. }, m = () => {
  1882. if (i.value == 0) {
  1883. if (!c.value.length || !l.value) {
  1884. window.$message.warning(window.$l("请先上传文件"));
  1885. return;
  1886. }
  1887. if (n.typeSelect && !j.value) {
  1888. window.$message.warning(
  1889. n.typeSelect.placeholder ? `${window.$l("请先")}${n.typeSelect.placeholder}` : window.$l("请先选择业务参数")
  1890. );
  1891. return;
  1892. }
  1893. w.value = !0, n.apis.importPreview(pe({ fileName: l.value }, p.value)).then((r) => {
  1894. const d = b(r) || {};
  1895. g.value = d.dataRow || [], D.value = T(d.headerRow), w.value = !1, i.value += 1;
  1896. }).catch(() => {
  1897. w.value = !1;
  1898. });
  1899. return;
  1900. }
  1901. if (i.value == 1) {
  1902. if (!g.value.length) {
  1903. window.$message.warning(window.$l("导入数据为空"));
  1904. return;
  1905. }
  1906. w.value = !0, n.apis.importData(pe({ list: g.value }, p.value)).then((r) => {
  1907. const d = b(r) || {};
  1908. _.value = d, O.value = d.failResult || [], w.value = !1, i.value += 1, a("reload");
  1909. }).catch(() => {
  1910. w.value = !1;
  1911. });
  1912. }
  1913. }, v = (r) => {
  1914. if (!r) {
  1915. window.$message.error(window.$l("未获取到下载地址"));
  1916. return;
  1917. }
  1918. const d = document.createElement("a");
  1919. d.href = r, d.download = "", document.body.appendChild(d), d.click(), document.body.removeChild(d);
  1920. }, h = () => {
  1921. if (n.typeSelect && !j.value) {
  1922. window.$message.warning(
  1923. n.typeSelect.placeholder ? `${window.$l("请先")}${window.$l(n.typeSelect.placeholder)}` : window.$l("请先选择业务参数")
  1924. );
  1925. return;
  1926. }
  1927. F.value = !0, n.apis.templateDownload(pe({}, p.value)).then((r) => {
  1928. const d = b(r) || {};
  1929. v(d == null ? void 0 : d.url);
  1930. }).catch(() => window.$message.error(window.$l("模板下载失败"))).finally(() => {
  1931. F.value = !1;
  1932. });
  1933. }, $ = () => {
  1934. F.value = !0, n.apis.exportExceptionData(pe({ list: O.value }, p.value)).then((r) => {
  1935. const d = b(r) || {};
  1936. v(d == null ? void 0 : d.url);
  1937. }).catch(() => window.$message.error(window.$l("异常数据导出失败"))).finally(() => {
  1938. F.value = !1;
  1939. });
  1940. }, x = (r) => {
  1941. g.value.splice(r, 1);
  1942. }, P = (r = !1) => {
  1943. s.value = !1, r && a("reload");
  1944. };
  1945. return t({ show: C, resetState: y }), (r, d) => {
  1946. const M = kt, Z = Xt, z = Ue, G = On, X = Nt, W = zt, te = Vt, re = ct("s-modal");
  1947. return Y(), oe(re, {
  1948. value: s.value,
  1949. "onUpdate:value": d[4] || (d[4] = (q) => s.value = q),
  1950. title: r.$l(e.title),
  1951. width: e.width,
  1952. "mask-closable": !1,
  1953. "show-full-screen": !1,
  1954. onHandCancel: P
  1955. }, {
  1956. footer: K(() => [
  1957. i.value == 0 ? (Y(), oe(z, {
  1958. key: 0,
  1959. onClick: P
  1960. }, {
  1961. default: K(() => [
  1962. ee(E(r.$l("取消")), 1)
  1963. ]),
  1964. _: 1
  1965. })) : ie("", !0),
  1966. i.value === 1 ? (Y(), oe(z, {
  1967. key: 1,
  1968. onClick: u
  1969. }, {
  1970. default: K(() => [
  1971. ee(E(r.$l("上一步")), 1)
  1972. ]),
  1973. _: 1
  1974. })) : ie("", !0),
  1975. i.value < 2 ? (Y(), oe(z, {
  1976. key: 2,
  1977. type: "primary",
  1978. loading: w.value,
  1979. disabled: i.value === 0 && (!l.value || e.typeSelect && !j.value),
  1980. onClick: m
  1981. }, {
  1982. default: K(() => [
  1983. ee(E(r.$l("下一步")), 1)
  1984. ]),
  1985. _: 1
  1986. }, 8, ["loading", "disabled"])) : (Y(), oe(z, {
  1987. key: 3,
  1988. type: "primary",
  1989. onClick: d[3] || (d[3] = (q) => P(!0))
  1990. }, {
  1991. default: K(() => [
  1992. ee(E(r.$l("关闭")), 1)
  1993. ]),
  1994. _: 1
  1995. }))
  1996. ]),
  1997. default: K(() => [
  1998. L("div", Tn, [
  1999. f(Z, {
  2000. current: i.value,
  2001. "onUpdate:current": d[0] || (d[0] = (q) => i.value = q),
  2002. type: "navigation",
  2003. size: "small"
  2004. }, {
  2005. default: K(() => [
  2006. f(M, {
  2007. title: r.$l("上传文件"),
  2008. disabled: !0
  2009. }, null, 8, ["title"]),
  2010. f(M, {
  2011. title: r.$l("数据预览"),
  2012. disabled: !0
  2013. }, null, 8, ["title"]),
  2014. f(M, {
  2015. title: r.$l("导入数据"),
  2016. disabled: !0
  2017. }, null, 8, ["title"])
  2018. ]),
  2019. _: 1
  2020. }, 8, ["current"])
  2021. ]),
  2022. he(L("div", Un, [
  2023. L("div", An, [
  2024. L("div", Ln, [
  2025. L("p", En, E(r.$l("上传填好的数据表")), 1),
  2026. L("p", jn, E(r.$l("文件后缀名必须是xls或xlsx,文件大小不超过500KB,最多支持导入1000条数据")), 1),
  2027. f(G, {
  2028. "file-list": c.value,
  2029. "onUpdate:fileList": d[1] || (d[1] = (q) => c.value = q),
  2030. class: "upload-area",
  2031. accept: ".xls,.xlsx",
  2032. "max-count": 1,
  2033. "custom-request": U,
  2034. "before-upload": H,
  2035. onRemove: B
  2036. }, {
  2037. default: K(() => [
  2038. f(z, { type: "link" }, {
  2039. default: K(() => [
  2040. ee(E(r.$l("上传文件")), 1)
  2041. ]),
  2042. _: 1
  2043. })
  2044. ]),
  2045. _: 1
  2046. }, 8, ["file-list"])
  2047. ])
  2048. ]),
  2049. L("div", Bn, [
  2050. L("div", Mn, [
  2051. L("p", Nn, E(r.$l("填写导入数据信息")), 1),
  2052. L("p", zn, E(r.$l("请按照数据模板的格式准备导入数据,模板中的表头名称不可更改,表头行不能删除")), 1),
  2053. L("div", Hn, [
  2054. e.typeSelect ? (Y(), oe(X, {
  2055. key: 0,
  2056. value: j.value,
  2057. "onUpdate:value": d[2] || (d[2] = (q) => j.value = q),
  2058. options: e.typeSelect.options,
  2059. loading: e.typeSelect.loading,
  2060. placeholder: e.typeSelect.placeholder || r.$l("请选择"),
  2061. style: { width: "200px", "margin-right": "12px" },
  2062. onChange: k
  2063. }, null, 8, ["value", "options", "loading", "placeholder"])) : ie("", !0),
  2064. f(z, {
  2065. type: "link",
  2066. loading: F.value,
  2067. onClick: h
  2068. }, {
  2069. default: K(() => [
  2070. ee(E(r.$l("下载模板")), 1)
  2071. ]),
  2072. _: 1
  2073. }, 8, ["loading"])
  2074. ])
  2075. ])
  2076. ])
  2077. ], 512), [
  2078. [we, i.value == 0]
  2079. ]),
  2080. he(L("div", Xn, [
  2081. f(te, {
  2082. "data-source": g.value,
  2083. columns: S.value,
  2084. size: "small",
  2085. pagination: !1,
  2086. scroll: { x: "max-content", y: "420px" },
  2087. class: "import-preview-table"
  2088. }, {
  2089. bodyCell: K(({ column: q, record: de, index: _e }) => [
  2090. (Y(!0), $e(Me, null, dt(D.value, (ue) => (Y(), $e(Me, {
  2091. key: ue.dataIndex
  2092. }, [
  2093. q.dataIndex === ue.dataIndex ? (Y(), oe(W, {
  2094. key: 0,
  2095. value: de[q.dataIndex],
  2096. "onUpdate:value": (ye) => de[q.dataIndex] = ye
  2097. }, null, 8, ["value", "onUpdate:value"])) : ie("", !0)
  2098. ], 64))), 128)),
  2099. q.dataIndex === "action" ? (Y(), oe(z, {
  2100. key: 0,
  2101. class: "action-btn",
  2102. type: "link",
  2103. danger: "",
  2104. onClick: (ue) => x(_e),
  2105. size: "small"
  2106. }, {
  2107. default: K(() => [
  2108. ee(E(r.$l("删除")), 1)
  2109. ]),
  2110. _: 1
  2111. }, 8, ["onClick"])) : ie("", !0)
  2112. ]),
  2113. _: 1
  2114. }, 8, ["data-source", "columns"])
  2115. ], 512), [
  2116. [we, i.value == 1]
  2117. ]),
  2118. he(L("div", kn, [
  2119. _.value.resultType ? ie("", !0) : (Y(), $e("div", qn, [
  2120. L("p", Vn, E(r.$l("批量导入成功")), 1),
  2121. L("p", Gn, E(r.$l("您已成功导入")) + E(_.value.snum) + E(r.$l("条数据")), 1)
  2122. ])),
  2123. _.value.resultType ? (Y(), $e("div", Wn, [
  2124. L("div", Kn, [
  2125. L("div", Jn, [
  2126. L("p", Yn, [
  2127. ee(E(r.$l("正常数据条数")) + ":", 1),
  2128. L("span", null, E(_.value.snum) + E(r.$l("条")), 1)
  2129. ]),
  2130. L("p", Zn, [
  2131. ee(E(r.$l("异常数据条数")) + ":", 1),
  2132. L("span", null, E(_.value.fnum) + E(r.$l("条")), 1)
  2133. ])
  2134. ])
  2135. ]),
  2136. L("div", Qn, [
  2137. L("p", null, E(r.$l("以下文件数据为导入异常数据")), 1),
  2138. f(z, {
  2139. type: "link",
  2140. loading: F.value,
  2141. onClick: $
  2142. }, {
  2143. default: K(() => [
  2144. ee(E(r.$l("导出异常数据")), 1)
  2145. ]),
  2146. _: 1
  2147. }, 8, ["loading"])
  2148. ]),
  2149. f(te, {
  2150. "data-source": O.value,
  2151. columns: N.value,
  2152. size: "small",
  2153. pagination: !1,
  2154. scroll: { x: "max-content", y: "205px" }
  2155. }, null, 8, ["data-source", "columns"])
  2156. ])) : ie("", !0)
  2157. ], 512), [
  2158. [we, i.value == 2]
  2159. ])
  2160. ]),
  2161. _: 1
  2162. }, 8, ["value", "title", "width"]);
  2163. };
  2164. }
  2165. }), ro = /* @__PURE__ */ Mt(eo, [["__scopeId", "data-v-28b884e7"]]);
  2166. export {
  2167. ro as default
  2168. };