tools.js 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513
  1. import { message, Select } from 'antd';
  2. import { Tag } from 'antd';
  3. import React from 'react';
  4. import $ from 'jquery/src/ajax';
  5. import moment from 'moment';
  6. import {
  7. formRetrieveList,
  8. projectStatusList,
  9. patentTypeList,
  10. patentStateList,
  11. patentFieldList,
  12. technicalSourceList,
  13. catagoryList,
  14. intellectualGetList,
  15. conversionFormList,
  16. annualReportStateList,
  17. cognizanceStateList,
  18. technologyStateList,
  19. copyrightStateList,
  20. auditStatusList,
  21. scaleList,
  22. companyType,
  23. industryList,
  24. natureList,
  25. contractTypeList,
  26. contractStateList,
  27. demandTypeList,
  28. achievementCategoryList,
  29. techAuditStatusList,
  30. auditStatusLists,
  31. maturityList,
  32. transferModeList,
  33. innovationList,
  34. orderStatusList,
  35. activityForm,
  36. activityType,
  37. boutique,
  38. hot,
  39. statuslist,
  40. customerTyp,
  41. cityArr,
  42. customerStatus,
  43. intentionalService,
  44. newFollow,
  45. sex,
  46. tag,
  47. contactType,
  48. contact,
  49. Whether,
  50. Certification,
  51. currentMember,
  52. lvl,
  53. industry,
  54. socialAttribute,
  55. station,
  56. post,
  57. patternOrganization,
  58. conditionOrganization,
  59. categoryState,
  60. auditStatusL,
  61. gameState,
  62. messageType,
  63. designated,
  64. featured,
  65. actives,
  66. intentProgress,
  67. transactionProgress,
  68. contractProgress,
  69. projectProgress,
  70. orderType,
  71. orderStage,
  72. orderState,
  73. paymentState,
  74. orderChannel,
  75. approvedState,
  76. lock,
  77. paymentMethod,
  78. transactionChannel,
  79. projectState,
  80. transactionProject,
  81. client,
  82. stick,
  83. taskStatus,
  84. publishStatus,
  85. changeState,
  86. distributeState,
  87. customerSource,
  88. slcRedit,
  89. dataGrade,
  90. level,
  91. xiangmoState,
  92. newOrderStatus,
  93. refundStatus,
  94. approval,
  95. projectStatus,
  96. processStatus,
  97. liquidationStatus,
  98. newOrderType,
  99. jsyPaymentType,
  100. customerType,
  101. orderTypes,
  102. bonusState,
  103. jiedian,
  104. cuikuan,
  105. province,
  106. invoiceStatus,
  107. approvalA,
  108. processStatusNew,
  109. contractChangeStatus,
  110. typeList,
  111. channelAllocationStatus,
  112. transferType,
  113. messageReminderStart,
  114. clockState,
  115. clockJournalState,
  116. roleList,
  117. typeLists,
  118. accountType,
  119. vehiclelist,
  120. approvalOptions,
  121. } from "./dataDic.js";
  122. import { provinceList } from './NewDicProvinceList.js';
  123. import ShowModal from './showModal.jsx';
  124. const obj = {
  125. // deepClone: function (data) {
  126. // let type = typeof data;
  127. // let tempValue;
  128. // if (!(type === 'array' || type === 'object')) return data;
  129. // if (type === 'array') {
  130. // tempValue = [];
  131. // data.forEach((item) => {
  132. // tempValue.push(deepClone(item));
  133. // })
  134. // return tempValue;
  135. // } else if (type === 'object') {
  136. // tempValue = {};
  137. // for (const key in data) {
  138. // if (data.hasOwnProperty(key)) {
  139. // tempValue[key] = deepClone(data[key]);
  140. // }
  141. // }
  142. // return tempValue;
  143. // }
  144. // },
  145. onReplace: function (val) {
  146. // 空格变大,便于识别
  147. if (val) {
  148. let text = val.replace(/ /gm, ' ⁠⁡⁢⁣⁤⁠⁡⁢⁣⁤ ⁠⁡⁢⁣⁤⁠⁡⁢⁣⁤⁠⁡⁢⁣⁤⁠⁡⁢⁣⁤⁠⁡ ⁠⁡⁢⁣⁤⁠⁡⁢⁣⁤ ⁠⁡⁢⁣⁤⁠⁡⁢⁣⁤ ⁠⁡⁢⁣⁠⁡⁢⁣⁤⁠')
  149. return text
  150. }
  151. },
  152. getPercentage: function (val) {
  153. return (Math.round(val * 10000)) / 100 + '%';
  154. },
  155. splitUrl: function (string, i, url) {
  156. let theList = [];
  157. let theArr = [];
  158. if (string && string.length) {
  159. theArr = string.split(i);
  160. theArr.map(function (item, i) {
  161. let name = item.substring(item.lastIndexOf("_") + 1);
  162. theList.push({
  163. uid: -i - 1,
  164. name: name,
  165. url: url + item,
  166. response: {
  167. data: item,
  168. },
  169. });
  170. });
  171. }
  172. return theList;
  173. },
  174. getBase64: function (img, callback) {
  175. const reader = new FileReader();
  176. reader.addEventListener("load", () => callback(reader.result));
  177. reader.readAsDataURL(img);
  178. },
  179. beforeUpload: function (file) {
  180. const isLt2M = file.size / 1024 / 1024 < 2;
  181. if (!isLt2M) {
  182. message.error("图片小大必须小于2MB!");
  183. }
  184. return isLt2M;
  185. },
  186. beforeUploadFile: function () {
  187. // debugger
  188. // const isJPG = file.type === 'image/jpeg/document';
  189. // if (!isJPG) {
  190. // message.error('You can only upload JPG file!');
  191. // }
  192. // const isLt2M = file.size / 1024 / 1024 < 2;
  193. // if (!isLt2M) {
  194. // message.error('Image must smaller than 2MB!');
  195. // }
  196. // return isJPG && isLt2M;
  197. },
  198. getTime: function (e, t) {
  199. if (e && !t) {
  200. var d = new Date(e);
  201. d =
  202. d.getFullYear() +
  203. "-" +
  204. (d.getMonth() + 1 < 10 ? "0" + (d.getMonth() + 1) : d.getMonth() + 1) +
  205. "-" +
  206. (d.getDate() < 10 ? "0" + d.getDate() : d.getDate()) +
  207. " ";
  208. // + (d.getHours() < 10 ? "0" + d.getHours() : d.getHours()) + ":" +
  209. // (d.getMinutes() < 10 ? "0" + d.getMinutes() : d.getMinutes()) + ":" +
  210. // (d.getSeconds() < 10 ? "0" + d.getSeconds() : d.getSeconds());
  211. return d;
  212. } else if (e && t) {
  213. var d1 = new Date(e);
  214. var d2 = new Date(e);
  215. d2 = d2.setMonth(d1.getMonth() + t);
  216. d2 = new Date(d2);
  217. d2 =
  218. d2.getFullYear() +
  219. "-" +
  220. (d2.getMonth() + 1 < 10
  221. ? "0" + (d2.getMonth() + 1)
  222. : d2.getMonth() + 1) +
  223. "-" +
  224. (d2.getDate() < 10 ? "0" + d2.getDate() : d2.getDate()) +
  225. " ";
  226. return d2;
  227. } else {
  228. return "";
  229. }
  230. },
  231. getPatentType: function (e) {
  232. let theType = "";
  233. patentTypeList.map(function (item) {
  234. if (item.value == e) {
  235. theType = item.key;
  236. }
  237. });
  238. return theType;
  239. },
  240. getPatentTypeva: function (e) {
  241. if (e) {
  242. let theType = "";
  243. patentTypeList.map(function (item) {
  244. if (item.key == e) {
  245. theType = item.value;
  246. }
  247. });
  248. return theType;
  249. }
  250. },
  251. getPatentState: function (e) {
  252. if (e) {
  253. let theState = "";
  254. patentStateList.map(function (item) {
  255. if (item.value == e) {
  256. theState = item.key;
  257. }
  258. });
  259. return theState;
  260. }
  261. },
  262. getPatentField: function (e) {
  263. if (e) {
  264. let theState = "";
  265. patentFieldList.map(function (item) {
  266. if (item.value == e) {
  267. theState = item.key;
  268. }
  269. });
  270. return theState;
  271. }
  272. },
  273. getTechnicalSource: function (e) {
  274. if (e) {
  275. let theSource = "";
  276. technicalSourceList.map(function (item) {
  277. if (item.value == e) {
  278. theSource = item.key;
  279. }
  280. });
  281. return theSource;
  282. }
  283. },
  284. getCatagory: function (e) {
  285. if (e) {
  286. let theType = "";
  287. catagoryList.map(function (item) {
  288. if (item.value == e) {
  289. theType = item.key;
  290. }
  291. });
  292. return theType;
  293. }
  294. },
  295. getIntellectualObtainWay: function (e) {
  296. if (e) {
  297. let theType = "";
  298. intellectualGetList.map(function (item) {
  299. if (item.value == e) {
  300. theType = item.key;
  301. }
  302. });
  303. return theType;
  304. }
  305. },
  306. getConversionForm: function (e) {
  307. if (e) {
  308. let theType = "";
  309. conversionFormList.map(function (item) {
  310. if (item.value == e) {
  311. theType = item.key;
  312. }
  313. });
  314. return theType;
  315. }
  316. },
  317. getAnnualReportState: function (e) {
  318. if (e) {
  319. let theType = "";
  320. annualReportStateList.map(function (item) {
  321. if (item.value == e) {
  322. theType = item.key;
  323. }
  324. });
  325. return theType;
  326. }
  327. },
  328. getCognizanceState: function (e) {
  329. if (e) {
  330. let theType = "";
  331. cognizanceStateList.map(function (item) {
  332. if (item.value == e) {
  333. theType = item.key;
  334. }
  335. });
  336. return theType;
  337. }
  338. },
  339. getTechnologyState: function (e) {
  340. if (e) {
  341. let theType = "";
  342. technologyStateList.map(function (item) {
  343. if (item.value == e) {
  344. theType = item.key;
  345. }
  346. });
  347. return theType;
  348. }
  349. },
  350. //显示用户认证状态
  351. getAuditState: function (e) {
  352. if (e) {
  353. let theType = "";
  354. auditStatusList.map(function (item) {
  355. if (item.value == e) {
  356. theType = item.key;
  357. }
  358. });
  359. return theType;
  360. }
  361. },
  362. getCopyrightState: function (e) {
  363. if (e) {
  364. let theType = "";
  365. copyrightStateList.map(function (item) {
  366. if (item.value == e) {
  367. theType = item.key;
  368. }
  369. });
  370. return theType;
  371. }
  372. },
  373. downloadFile: function (path, fileName) {
  374. window.open(
  375. globalConfig.context +
  376. "/open/downloadFile?path=" +
  377. path +
  378. "&fileName=" +
  379. fileName
  380. );
  381. },
  382. techDownloadFile: function (url, id) {
  383. window.open(globalConfig.context + url + "?id=" + id);
  384. },
  385. copyrightDownloadFile: function (id, sign, url) {
  386. window.open(globalConfig.context + url + "?id=" + id + "&sign=" + sign);
  387. },
  388. newDownloadFile: function (id, sign, url, type) {
  389. if (!type) {
  390. window.open(globalConfig.context + url + "?id=" + id + "&sign=" + sign);
  391. }
  392. if (type) {
  393. window.open(
  394. globalConfig.context +
  395. url +
  396. "?id=" +
  397. id +
  398. "&sign=" +
  399. sign +
  400. "&type=" +
  401. type
  402. );
  403. }
  404. },
  405. companySearch(input, option) {
  406. return option.props.children.indexOf(input) >= 0;
  407. },
  408. getVacations(ccccc) {
  409. let now = new Date();
  410. let theYear = now.getFullYear();
  411. $.ajax({
  412. type: "get",
  413. dataType: "json",
  414. crossDomain: false,
  415. url: globalConfig.context + "/open/html/json/vacations" + theYear,
  416. success: (data) => {
  417. if (data) {
  418. ccccc(data);
  419. }
  420. },
  421. });
  422. },
  423. getInUrgentTime(date, inUrgent, vocations) {
  424. if (vocations && vocations.length) {
  425. let now = new Date(date);
  426. for (var i = 1; i <= inUrgent;) {
  427. now.setDate(now.getDate() + 1);
  428. let thebool = true;
  429. vocations.map((item) => {
  430. if (item == getKey(now)) {
  431. thebool = false;
  432. }
  433. });
  434. if (thebool) {
  435. i++;
  436. }
  437. }
  438. return now;
  439. }
  440. function getKey(date) {
  441. var year = date.getFullYear(),
  442. month = date.getMonth() + 1,
  443. day = date.getDate();
  444. year = "" + year;
  445. month = (month > 9 ? "" : "0") + month;
  446. day = (day > 9 ? "" : "0") + day;
  447. return year + month + day;
  448. }
  449. },
  450. //各种通过接口获取下拉列表
  451. setPatentStateOption(permission) {
  452. let theArr = [];
  453. patentStateList.map(function (item) {
  454. for (let i = 0; i < permission.length; i++) {
  455. if (item.value == permission[i]) {
  456. theArr.push(item);
  457. }
  458. }
  459. });
  460. return theArr;
  461. },
  462. setUserContactsList() {
  463. let theOption = [];
  464. $.ajax({
  465. method: "get",
  466. dataType: "json",
  467. crossDomain: false,
  468. url: globalConfig.context + "/api/user/getContacts",
  469. success: function (data) {
  470. if (!data.data) {
  471. if (data.error && data.error.length) {
  472. message.warning(data.error[0].message);
  473. }
  474. return;
  475. }
  476. for (let item in data.data) {
  477. let theData = data.data[item];
  478. theOption.push(
  479. <Select.Option value={item} key={theData}>
  480. {theData}
  481. </Select.Option>
  482. );
  483. }
  484. },
  485. });
  486. return theOption;
  487. },
  488. setAdminContactsList(uid) {
  489. let theOption = [];
  490. $.ajax({
  491. method: "get",
  492. dataType: "json",
  493. crossDomain: false,
  494. url: globalConfig.context + "/api/admin/getContacts",
  495. data: { uid: uid },
  496. success: function (data) {
  497. if (!data.data) {
  498. if (data.error && data.error.length) {
  499. message.warning(data.error[0].message);
  500. }
  501. return;
  502. }
  503. for (let item in data.data) {
  504. let theData = data.data[item];
  505. theOption.push(
  506. <Select.Option value={item} key={theData}>
  507. {theData}
  508. </Select.Option>
  509. );
  510. }
  511. },
  512. });
  513. return theOption;
  514. },
  515. //高企培育资料完成情况(比重)
  516. getProportion(uid, callback) {
  517. $.ajax({
  518. method: "get",
  519. dataType: "json",
  520. crossDomain: false,
  521. url: globalConfig.context + "/api/admin/proportion",
  522. data: { uid: uid },
  523. success: function (data) {
  524. if (!data.data) {
  525. if (data.error && data.error.length) {
  526. message.warning(data.error[0].message);
  527. }
  528. data.data = {};
  529. callback(data.data);
  530. }
  531. callback(data.data);
  532. },
  533. });
  534. },
  535. //保存高企培育资料完成情况
  536. saveProportion(id, uid, sign, status) {
  537. $.ajax({
  538. method: "post",
  539. dataType: "json",
  540. crossDomain: false,
  541. url: globalConfig.context + "/api/admin/confirmProportion",
  542. data: {
  543. id: id,
  544. uid: uid,
  545. sign: sign,
  546. status: status,
  547. },
  548. success: function (data) {
  549. if (!data.data) {
  550. if (data.error && data.error.length) {
  551. message.warning(data.error[0].message);
  552. }
  553. return;
  554. }
  555. },
  556. });
  557. },
  558. //获取window.location.search传的值
  559. getSearchUrl(e) {
  560. let searchURL = e;
  561. let theObj = {};
  562. searchURL = searchURL.substring(1, searchURL.length);
  563. theObj[searchURL.split("&")[0].split("=")[0]] = searchURL
  564. .split("&")[0]
  565. .split("=")[1];
  566. if (searchURL.split("&")[1]) {
  567. theObj[searchURL.split("&")[1].split("=")[0]] = searchURL
  568. .split("&")[1]
  569. .split("=")[1];
  570. if (searchURL.split("&")[2]) {
  571. theObj[searchURL.split("&")[2].split("=")[0]] = searchURL
  572. .split("&")[2]
  573. .split("=")[1];
  574. }
  575. }
  576. return theObj;
  577. },
  578. //预览接口
  579. getPreview(id, url, sign, callback) {
  580. $.ajax({
  581. method: "get",
  582. dataType: "json",
  583. crossDomain: false,
  584. url: globalConfig.context + "/api/admin/preview/" + url,
  585. data: {
  586. id: id,
  587. sign: sign,
  588. },
  589. success: function (data) {
  590. if (!data.data) {
  591. if (data.error && data.error.length) {
  592. message.warning(data.error[0].message);
  593. }
  594. }
  595. callback(
  596. "https://view.officeapps.live.com/op/view.aspx?src=" +
  597. encodeURIComponent(
  598. location.origin +
  599. globalConfig.context +
  600. "/open/preview?" +
  601. data.data
  602. )
  603. );
  604. console.log(
  605. "https://view.officeapps.live.com/op/view.aspx?src=" +
  606. (location.origin +
  607. globalConfig.context +
  608. "/open/preview?" +
  609. data.data)
  610. );
  611. console.log(
  612. "https://view.officeapps.live.com/op/view.aspx?src=" +
  613. encodeURIComponent(
  614. location.origin +
  615. globalConfig.context +
  616. "/open/preview?" +
  617. data.data
  618. )
  619. );
  620. },
  621. });
  622. },
  623. //预览接口
  624. getPreviews(id, url, sign, callback) {
  625. $.ajax({
  626. method: "get",
  627. dataType: "json",
  628. crossDomain: false,
  629. url: globalConfig.context + "/api/admin/customer/" + url,
  630. data: {
  631. id: id,
  632. sign: sign,
  633. },
  634. success: function (data) {
  635. if (!data.data) {
  636. if (data.error && data.error.length) {
  637. message.warning(data.error[0].message);
  638. }
  639. }
  640. callback(
  641. "https://view.officeapps.live.com/op/view.aspx?src=" +
  642. encodeURIComponent(
  643. location.origin +
  644. globalConfig.context +
  645. "/open/preview?" +
  646. data.data
  647. )
  648. );
  649. console.log(
  650. "https://view.officeapps.live.com/op/view.aspx?src=" +
  651. (location.origin +
  652. globalConfig.context +
  653. "/open/preview?" +
  654. data.data)
  655. );
  656. console.log(
  657. "https://view.officeapps.live.com/op/view.aspx?src=" +
  658. encodeURIComponent(
  659. location.origin +
  660. globalConfig.context +
  661. "/open/preview?" +
  662. data.data
  663. )
  664. );
  665. },
  666. });
  667. },
  668. //获取企业规模
  669. getScaleState(e) {
  670. if (e) {
  671. let theType = "";
  672. scaleList.map(function (item) {
  673. if (item.value == e) {
  674. theType = item.key;
  675. }
  676. });
  677. return theType;
  678. }
  679. },
  680. //获取企业类型
  681. getCompanyType(type1, type2) {
  682. let companyTypeList = [];
  683. for (let i = 0; i < companyType.length; i++) {
  684. companyTypeList.push({
  685. value: companyType[i].value,
  686. label: companyType[i].label,
  687. });
  688. if (companyType[i].children) {
  689. for (let j = 0; j < companyType[i].children.length; j++) {
  690. companyTypeList.push({
  691. value: companyType[i].children[j].value,
  692. label: companyType[i].children[j].label,
  693. });
  694. }
  695. }
  696. }
  697. companyTypeList.sort(function (a, b) {
  698. return a.value - b.value;
  699. });
  700. let typeKey = "";
  701. companyTypeList.map(function (item) {
  702. if (type1 == item.value) {
  703. typeKey = item.label;
  704. }
  705. if (type2 == item.value) {
  706. typeKey = typeKey + "/" + item.label;
  707. }
  708. });
  709. return typeKey;
  710. },
  711. //获取企业行业
  712. getIndustryType(e) {
  713. if (e) {
  714. let valueArr = [];
  715. if (typeof e == 'string') {
  716. valueArr = e.split(',');
  717. } else if (e instanceof Array) {
  718. valueArr = e;
  719. }
  720. let theType = [];
  721. industryList.map(function (item) {
  722. console.log(valueArr, item)
  723. if (valueArr.indexOf(item.value) > -1) {
  724. // theType = item.key;
  725. theType.push(item.key);
  726. }
  727. });
  728. return theType.join(',');
  729. }
  730. },
  731. //获取客户性质
  732. getNatureType(e, other) {
  733. if (e) {
  734. let theType = "";
  735. natureList.map(function (item) {
  736. if (item.value == e) {
  737. if (e == 0) {
  738. theType = other
  739. } else {
  740. theType = item.key;
  741. }
  742. }
  743. });
  744. return theType;
  745. }
  746. },
  747. //获取合同状态
  748. getContractType: function (e) {
  749. if (e) {
  750. let theType = "";
  751. contractTypeList.map(function (item) {
  752. if (item.value == e) {
  753. theType = item.key;
  754. }
  755. });
  756. return theType;
  757. }
  758. },
  759. //获取合同类型
  760. getContractState: function (e) {
  761. if (e) {
  762. let theType = "";
  763. contractStateList.map(function (item) {
  764. if (item.value == e) {
  765. theType = item.key;
  766. }
  767. });
  768. return theType;
  769. }
  770. },
  771. //获取需求类型
  772. getDemandType: function (e) {
  773. if (e) {
  774. let theType = "";
  775. demandTypeList.map(function (item) {
  776. if (item.value == e) {
  777. theType = item.key;
  778. }
  779. });
  780. return theType;
  781. }
  782. },
  783. //获取成果类型
  784. getAchievementCategory: function (e) {
  785. if (e) {
  786. let theType = "";
  787. achievementCategoryList.map(function (item) {
  788. if (item.value == e) {
  789. theType = item.key;
  790. }
  791. });
  792. return theType;
  793. }
  794. },
  795. //获取需求和成果审核状态
  796. getTechAuditStatus: function (e) {
  797. if (e) {
  798. let theType = "";
  799. techAuditStatusList.map(function (item) {
  800. if (item.value == e) {
  801. theType = item.key;
  802. }
  803. });
  804. return theType;
  805. }
  806. },
  807. //获取政策审核状态
  808. getauditStatus: function (e) {
  809. if (e || e >= 0) {
  810. let tt = e.toString();
  811. let theType = "";
  812. auditStatusLists.map(function (item) {
  813. if (item.value == tt) {
  814. theType = item.key;
  815. }
  816. });
  817. return theType;
  818. }
  819. },
  820. //获取需求和成果审核状态
  821. getMaturity: function (e) {
  822. if (e) {
  823. let theType = "";
  824. maturityList.map(function (item) {
  825. if (item.value == e) {
  826. theType = item.key;
  827. }
  828. });
  829. return theType;
  830. }
  831. },
  832. //获取需求和成果审核状态
  833. getTransferMode: function (e) {
  834. if (e) {
  835. let theType = "";
  836. transferModeList.map(function (item) {
  837. if (item.value == e) {
  838. theType = item.key;
  839. }
  840. });
  841. return theType;
  842. }
  843. },
  844. //获取创新度状态
  845. getInnovation: function (e) {
  846. if (e) {
  847. let theType = "";
  848. innovationList.map(function (item) {
  849. if (item.value == e) {
  850. theType = item.key;
  851. }
  852. });
  853. return theType;
  854. }
  855. },
  856. //获取创新度状态
  857. getOrderStatus: function (e) {
  858. if (e) {
  859. let theType = "";
  860. orderStatusList.map(function (item) {
  861. if (item.value == e) {
  862. theType = item.key;
  863. }
  864. });
  865. return theType;
  866. }
  867. },
  868. //科技管理
  869. //活动圈后台管理
  870. getActivityType: function (e) {
  871. if (e) {
  872. let theType = "";
  873. activityType.map(function (item) {
  874. if (item.value == e) {
  875. theType = item.key;
  876. }
  877. });
  878. return theType;
  879. }
  880. },
  881. getActivityForm: function (e) {
  882. if (e) {
  883. let theType = "";
  884. activityForm.map(function (item) {
  885. if (item.value == e) {
  886. theType = item.key;
  887. }
  888. });
  889. return theType;
  890. }
  891. },
  892. //是否展示在首页
  893. gethot: function (e) {
  894. if (e) {
  895. let theType = "";
  896. hot.map(function (item) {
  897. if (item.value == e) {
  898. theType = item.key;
  899. }
  900. });
  901. return theType;
  902. }
  903. },
  904. //是否精品
  905. getboutique: function (e) {
  906. if (e) {
  907. let theType = "";
  908. boutique.map(function (item) {
  909. if (item.value == e) {
  910. theType = item.key;
  911. }
  912. });
  913. return theType;
  914. }
  915. },
  916. //客户类型
  917. getcustomerTyp: function (e) {
  918. if (e) {
  919. let theType = "";
  920. customerTyp.map(function (item) {
  921. if (item.value == e) {
  922. theType = item.key;
  923. }
  924. });
  925. return theType;
  926. }
  927. },
  928. //省份
  929. getcityArr: function (e) {
  930. if (e) {
  931. let theType = "";
  932. cityArr.map(function (item) {
  933. if (item.value == e) {
  934. theType = item.key;
  935. }
  936. });
  937. return theType;
  938. }
  939. },
  940. //与后端一致省份
  941. getNewDiccityArr: function (e) {
  942. if (e) {
  943. let theType = "";
  944. provinceList.map(function (item) {
  945. if (item.id === e) {
  946. theType = item.name;
  947. }
  948. });
  949. return theType;
  950. }
  951. },
  952. //客户状态
  953. getcustomerStatue: function (e) {
  954. if (e || e == 0) {
  955. let theType = "";
  956. customerStatus.map(function (item) {
  957. if (item.value == e) {
  958. theType = item.key;
  959. }
  960. });
  961. return theType;
  962. }
  963. },
  964. //账户状态
  965. getStatuslist: function (e) {
  966. if (e) {
  967. let theType = "";
  968. statuslist.map(function (item) {
  969. if (item.value == e) {
  970. theType = item.key;
  971. }
  972. });
  973. return theType;
  974. }
  975. },
  976. //意向服务
  977. getCompanyIntention: function (e) {
  978. if (e) {
  979. let theType = "";
  980. intentionalService.map(function (item) {
  981. if (item.value == e) {
  982. theType = item.key;
  983. }
  984. });
  985. return theType;
  986. }
  987. },
  988. //客户标签
  989. getTag: function (e) {
  990. if (e) {
  991. let theType = "";
  992. tag.map(function (item) {
  993. if (item.value == e) {
  994. theType = item.key;
  995. }
  996. });
  997. return theType;
  998. }
  999. },
  1000. //最新跟进
  1001. getfllowSituation: function (e) {
  1002. if (e || e == 0) {
  1003. let theType = "";
  1004. newFollow.map(function (item) {
  1005. if (item.value == e) {
  1006. theType = item.key;
  1007. }
  1008. });
  1009. return theType;
  1010. }
  1011. },
  1012. //性别
  1013. getsex: function (e) {
  1014. if (e) {
  1015. let theType = "";
  1016. sex.map(function (item) {
  1017. if (item.value == e) {
  1018. theType = item.key;
  1019. }
  1020. });
  1021. return theType;
  1022. }
  1023. },
  1024. //联系方式
  1025. getcontact: function (e) {
  1026. if (e) {
  1027. let theType = "";
  1028. contact.map(function (item) {
  1029. if (item.value == e) {
  1030. theType = item.key;
  1031. }
  1032. });
  1033. return theType;
  1034. }
  1035. },
  1036. //是否文字与数字转换
  1037. getWhether: function (e) {
  1038. if (e || e == 0) {
  1039. let theType = "";
  1040. Whether.map(function (item) {
  1041. if (item.value == e) {
  1042. theType = item.key;
  1043. }
  1044. });
  1045. return theType;
  1046. }
  1047. },
  1048. //是否实名认证
  1049. getCertification: function (e) {
  1050. if (e) {
  1051. let theType = "";
  1052. Certification.map(function (item) {
  1053. if (item.value == e) {
  1054. theType = item.key;
  1055. }
  1056. });
  1057. return theType;
  1058. }
  1059. },
  1060. //会员状态
  1061. getCurrentMember: function (e) {
  1062. if (e) {
  1063. let theType = "";
  1064. currentMember.map(function (item) {
  1065. if (item.value == e) {
  1066. theType = item.key;
  1067. }
  1068. });
  1069. return theType;
  1070. }
  1071. },
  1072. //会员等级
  1073. getLvl: function (e) {
  1074. if (e) {
  1075. let theType = "";
  1076. lvl.map(function (item) {
  1077. if (item.value == e) {
  1078. theType = item.key;
  1079. }
  1080. });
  1081. return theType;
  1082. }
  1083. },
  1084. //省份转换
  1085. getprovince: function (e) {
  1086. let nub = parseInt(e);
  1087. let theType = "";
  1088. if (nub <= 34) {
  1089. provinceList.map(function (item) {
  1090. if (item.id == nub) {
  1091. theType = item.name;
  1092. }
  1093. });
  1094. }
  1095. if (nub > 34 && nub < 380) {
  1096. provinceList.map(function (item) {
  1097. item.cityList.map(function (city) {
  1098. if (city.id == nub) {
  1099. theType = city.name;
  1100. }
  1101. });
  1102. });
  1103. }
  1104. if (nub >= 380) {
  1105. provinceList.map(function (item) {
  1106. item.cityList.map(function (city) {
  1107. city.areaList.map(function (areas) {
  1108. if (areas.id == nub) {
  1109. theType = areas.name;
  1110. }
  1111. });
  1112. });
  1113. });
  1114. }
  1115. return theType;
  1116. },
  1117. //我的业务跟进状态
  1118. getStatusFollow: function (e) {
  1119. let theType = "";
  1120. if (e) {
  1121. theType = "跟进中";
  1122. } else {
  1123. theType = "停止跟进";
  1124. }
  1125. return theType;
  1126. },
  1127. //我的业务跟进状态
  1128. getContactType: function (e) {
  1129. if (!isNaN(parseInt(e))) {
  1130. let theType = "";
  1131. contactType.map(function (item) {
  1132. if (item.value == e) {
  1133. theType = item.key;
  1134. }
  1135. });
  1136. return theType;
  1137. }
  1138. },
  1139. //社会属性
  1140. getSocialAttribute: function (e) {
  1141. if (!isNaN(parseInt(e))) {
  1142. let theType = "";
  1143. socialAttribute.map(function (item) {
  1144. if (item.value == e) {
  1145. theType = item.key;
  1146. }
  1147. });
  1148. return theType;
  1149. } else {
  1150. return '未知';
  1151. }
  1152. },
  1153. //获取外联分配状态名
  1154. getChannelAllocationStatus: function (e, isTag) {
  1155. if (!isNaN(parseInt(e))) {
  1156. let theType = "";
  1157. let color = "";
  1158. channelAllocationStatus.map(function (item) {
  1159. if (item.value == e) {
  1160. theType = item.key;
  1161. color = item.color;
  1162. }
  1163. });
  1164. if (isTag) {
  1165. return <Tag color={color}>{theType}</Tag>
  1166. } else {
  1167. return theType;
  1168. }
  1169. } else {
  1170. if (isTag) {
  1171. return <Tag color='#000'>未知</Tag>
  1172. } else {
  1173. return '未知';
  1174. }
  1175. }
  1176. },
  1177. //获取消息提醒状态
  1178. getMessageReminderStart: function (e, isTag) {
  1179. if (!isNaN(parseInt(e))) {
  1180. let theType = "";
  1181. let color = "";
  1182. messageReminderStart.map(function (item) {
  1183. if (item.value == e) {
  1184. theType = item.key;
  1185. color = item.color;
  1186. }
  1187. });
  1188. if (isTag) {
  1189. return <Tag color={color}>{theType}</Tag>
  1190. } else {
  1191. return theType;
  1192. }
  1193. } else {
  1194. if (isTag) {
  1195. return <Tag color='#000'>未知</Tag>
  1196. } else {
  1197. return '未知';
  1198. }
  1199. }
  1200. },
  1201. //获取分配状态名称
  1202. getTransferType: function (id) {
  1203. if (!isNaN(parseInt(id))) {
  1204. let typeName = '';
  1205. transferType.map(function (item) {
  1206. if (item.value == id) {
  1207. typeName = item.label
  1208. }
  1209. });
  1210. return typeName;
  1211. }
  1212. },
  1213. //行业
  1214. getIndustry: function (e) {
  1215. if (e) {
  1216. let valueArr = [];
  1217. if (typeof e == 'string') {
  1218. valueArr = e.split(',');
  1219. } else if (e instanceof Array) {
  1220. valueArr = e;
  1221. }
  1222. let theType = [];
  1223. industry.map(function (item) {
  1224. if (valueArr.indexOf(item.value) > -1) {
  1225. theType.push(item.key);
  1226. }
  1227. });
  1228. return theType.join(',');
  1229. }
  1230. },
  1231. //岗位
  1232. getStation: function (e) {
  1233. if (e) {
  1234. let theType = "";
  1235. station.map(function (item) {
  1236. if (item.value == e) {
  1237. theType = item.key;
  1238. }
  1239. });
  1240. return theType;
  1241. }
  1242. },
  1243. //职务
  1244. getPost: function (e) {
  1245. if (e) {
  1246. let theType = "";
  1247. post.map(function (item) {
  1248. if (item.value == e) {
  1249. theType = item.key;
  1250. }
  1251. });
  1252. return theType;
  1253. }
  1254. },
  1255. //组织类型
  1256. getPattern: function (e) {
  1257. if (e) {
  1258. let theType = "";
  1259. patternOrganization.map(function (item) {
  1260. if (item.value == e) {
  1261. theType = item.key;
  1262. }
  1263. });
  1264. return theType;
  1265. }
  1266. },
  1267. //组织状态
  1268. getCondition: function (e) {
  1269. if (e) {
  1270. let theType = "";
  1271. conditionOrganization.map(function (item) {
  1272. if (item.value == e) {
  1273. theType = item.key;
  1274. }
  1275. });
  1276. return theType;
  1277. }
  1278. },
  1279. //品类状态
  1280. getCategoryState: function (e) {
  1281. if (e) {
  1282. let theType = "";
  1283. categoryState.map(function (item) {
  1284. if (item.value == e) {
  1285. theType = item.key;
  1286. }
  1287. });
  1288. return theType;
  1289. }
  1290. },
  1291. //实名认证
  1292. getAuditStatus: function (index) {
  1293. let e = index ? index.toString() : "";
  1294. if (e) {
  1295. let theType = "";
  1296. auditStatusL.map(function (item) {
  1297. if (item.value == e) {
  1298. theType = item.key;
  1299. }
  1300. });
  1301. return theType;
  1302. }
  1303. },
  1304. //品类状态
  1305. getGameState: function (index) {
  1306. let e = index ? index.toString() : "";
  1307. if (e) {
  1308. let theType = "";
  1309. gameState.map(function (item) {
  1310. if (item.value == e) {
  1311. theType = item.key;
  1312. }
  1313. });
  1314. return theType;
  1315. }
  1316. },
  1317. //消息类型
  1318. getMessageType: function (index) {
  1319. let e = index ? index.toString() : "";
  1320. if (e) {
  1321. let theType = "";
  1322. messageType.map(function (item) {
  1323. if (item.value == e) {
  1324. theType = item.key;
  1325. }
  1326. });
  1327. return theType;
  1328. }
  1329. },
  1330. //发送目标
  1331. getDesignated: function (index) {
  1332. let e = index ? index.toString() : "";
  1333. if (e) {
  1334. let theType = "";
  1335. designated.map(function (item) {
  1336. if (item.value == e) {
  1337. theType = item.key;
  1338. }
  1339. });
  1340. return theType;
  1341. }
  1342. },
  1343. //客户端
  1344. getClient: function (index) {
  1345. let e = index ? index.toString() : "";
  1346. if (e) {
  1347. let theType = "";
  1348. client.map(function (item) {
  1349. if (item.value == e) {
  1350. theType = item.key;
  1351. }
  1352. });
  1353. return theType;
  1354. }
  1355. },
  1356. //是否置顶
  1357. getStick: function (index) {
  1358. let e = index ? index.toString() : "";
  1359. if (e) {
  1360. let theType = "";
  1361. stick.map(function (item) {
  1362. if (item.value == e) {
  1363. theType = item.key;
  1364. }
  1365. });
  1366. return theType;
  1367. }
  1368. },
  1369. getFeatured: function (index) {
  1370. let e = index ? index.toString() : "";
  1371. if (e) {
  1372. let theType = "";
  1373. featured.map(function (item) {
  1374. if (item.value == e) {
  1375. theType = item.key;
  1376. }
  1377. });
  1378. return theType;
  1379. }
  1380. },
  1381. getActives: function (e) {
  1382. if (e) {
  1383. let theType = "";
  1384. actives.map(function (item) {
  1385. if (item.value == e) {
  1386. theType = item.key;
  1387. }
  1388. });
  1389. return theType;
  1390. }
  1391. },
  1392. //意向进度
  1393. getIntentProgress: function (e) {
  1394. if (e) {
  1395. let theType = "";
  1396. intentProgress.map(function (item) {
  1397. if (item.value == e) {
  1398. theType = item.key;
  1399. }
  1400. });
  1401. return theType;
  1402. }
  1403. },
  1404. //交易进度
  1405. getTransactionProgress: function (e) {
  1406. if (e) {
  1407. let theType = "";
  1408. transactionProgress.map(function (item) {
  1409. if (item.value == e) {
  1410. theType = item.key;
  1411. }
  1412. });
  1413. return theType;
  1414. }
  1415. },
  1416. //合同进度
  1417. getContractProgress: function (e) {
  1418. //debugger
  1419. // console.log(e);
  1420. if (e) {
  1421. let theType = "";
  1422. contractProgress.map(function (item) {
  1423. if (item.value == e) {
  1424. theType = item.key;
  1425. }
  1426. });
  1427. return theType;
  1428. }
  1429. },
  1430. //项目进度
  1431. getProjectProgress: function (e) {
  1432. if (e) {
  1433. let theType = "";
  1434. projectProgress.map(function (item) {
  1435. if (item.value == e) {
  1436. theType = item.key;
  1437. }
  1438. });
  1439. return theType;
  1440. }
  1441. },
  1442. //订单类型
  1443. getOrderType: function (e) {
  1444. if (e || e == 0) {
  1445. let str = e.toString();
  1446. let theType = "";
  1447. orderType.map(function (item) {
  1448. if (item.value == str) {
  1449. theType = item.key;
  1450. }
  1451. });
  1452. return theType;
  1453. }
  1454. },
  1455. //订单阶段
  1456. getOrderStage: function (e) {
  1457. if (e || e == 0) {
  1458. let str = e.toString();
  1459. let theType = "";
  1460. orderStage.map(function (item) {
  1461. if (item.value == str) {
  1462. theType = item.key;
  1463. }
  1464. });
  1465. return theType;
  1466. }
  1467. },
  1468. //订单状态o
  1469. getOrderState: function (e) {
  1470. if (e || e == 0) {
  1471. let str = e.toString();
  1472. let theType = "";
  1473. orderState.map(function (item) {
  1474. if (item.value == str) {
  1475. theType = item.key;
  1476. }
  1477. });
  1478. return theType;
  1479. }
  1480. },
  1481. //付款状态
  1482. getPaymentState: function (e) {
  1483. if (e || e == 0) {
  1484. let str = e.toString();
  1485. let theType = "";
  1486. paymentState.map(function (item) {
  1487. if (item.value == str) {
  1488. theType = item.key;
  1489. }
  1490. });
  1491. return theType;
  1492. }
  1493. },
  1494. //订单外联
  1495. getOrderChannel: function (e) {
  1496. if (e || e == 0) {
  1497. let str = e.toString();
  1498. let theType = "";
  1499. orderChannel.map(function (item) {
  1500. if (item.value == str) {
  1501. theType = item.key;
  1502. }
  1503. });
  1504. return theType;
  1505. }
  1506. },
  1507. //特批状态
  1508. getApprovedState: function (e) {
  1509. if (e || e == 0) {
  1510. let str = e.toString();
  1511. let theType = "";
  1512. approvedState.map(function (item) {
  1513. if (item.value == str) {
  1514. theType = item.key;
  1515. }
  1516. });
  1517. return theType;
  1518. }
  1519. },
  1520. //锁定或废除
  1521. getLock: function (e) {
  1522. if (e || e == 0) {
  1523. let str = e.toString();
  1524. let theType = "";
  1525. lock.map(function (item) {
  1526. if (item.value == str) {
  1527. theType = item.key;
  1528. }
  1529. });
  1530. return theType;
  1531. }
  1532. },
  1533. //支付方式
  1534. getPaymentMethod: function (e) {
  1535. if (e || e == 0) {
  1536. let str = e.toString();
  1537. let theType = "";
  1538. paymentMethod.map(function (item) {
  1539. if (item.value == str) {
  1540. theType = item.key;
  1541. }
  1542. });
  1543. return theType;
  1544. }
  1545. },
  1546. //交易外联
  1547. getTransactionChannel: function (e) {
  1548. if (e || e == 0) {
  1549. let str = e.toString();
  1550. let theType = "";
  1551. transactionChannel.map(function (item) {
  1552. if (item.value == str) {
  1553. theType = item.key;
  1554. }
  1555. });
  1556. return theType;
  1557. }
  1558. },
  1559. //交易科目
  1560. getTransactionProject: function (e) {
  1561. if (e || e == 0) {
  1562. let str = e.toString();
  1563. let theType = "";
  1564. transactionProject.map(function (item) {
  1565. if (item.value == str) {
  1566. theType = item.key;
  1567. }
  1568. });
  1569. return theType;
  1570. }
  1571. },
  1572. //项目状态
  1573. getProjectState: function (e) {
  1574. if (e || e == 0) {
  1575. let str = e.toString();
  1576. let theType = "";
  1577. projectState.map(function (item) {
  1578. if (item.value == str) {
  1579. theType = item.key;
  1580. }
  1581. });
  1582. return theType;
  1583. }
  1584. },
  1585. //任务状态
  1586. getTaskStatus: function (e) {
  1587. if (e || e == 0) {
  1588. let str = e.toString();
  1589. let theType = "";
  1590. taskStatus.map(function (item) {
  1591. if (item.value == str) {
  1592. theType = item.key;
  1593. }
  1594. });
  1595. return theType;
  1596. }
  1597. },
  1598. //公示状态
  1599. getPublishStatus: function (e) {
  1600. if (e || e == 0) {
  1601. let str = e.toString();
  1602. let theType = "";
  1603. publishStatus.map(function (item) {
  1604. if (item.value == str) {
  1605. theType = item.key;
  1606. }
  1607. });
  1608. return theType;
  1609. }
  1610. },
  1611. //变更状态
  1612. getChangeState: function (e) {
  1613. if (e || e == 0) {
  1614. let str = e.toString();
  1615. let theType = "";
  1616. changeState.map(function (item) {
  1617. if (item.value == str) {
  1618. theType = item.key;
  1619. }
  1620. });
  1621. return theType;
  1622. }
  1623. },
  1624. //分派情况
  1625. getDistributeState: function (e) {
  1626. if (e || e == 0) {
  1627. let str = e.toString();
  1628. let theType = "";
  1629. distributeState.map(function (item) {
  1630. if (item.value == str) {
  1631. theType = item.key;
  1632. }
  1633. });
  1634. return theType;
  1635. }
  1636. },
  1637. //客户来源
  1638. getCustomerSource: function (e) {
  1639. if (e || e == 0) {
  1640. let str = e.toString();
  1641. let theType = "";
  1642. customerSource.map(function (item) {
  1643. if (item.value == str) {
  1644. theType = item.key;
  1645. }
  1646. });
  1647. return theType;
  1648. }
  1649. },
  1650. //客户来源
  1651. getSlcRedit: function (e) {
  1652. if (e || e == 0) {
  1653. let str = e.toString();
  1654. let theType = "";
  1655. slcRedit.map(function (item) {
  1656. if (item.value == str) {
  1657. theType = item.key;
  1658. }
  1659. });
  1660. return theType;
  1661. }
  1662. },
  1663. //客户来源
  1664. getDataGrade: function (e) {
  1665. if (e || e == 0) {
  1666. let str = e.toString();
  1667. let theType = "";
  1668. dataGrade.map(function (item) {
  1669. if (item.value == str) {
  1670. theType = item.key;
  1671. }
  1672. });
  1673. return theType;
  1674. }
  1675. },
  1676. //客户等级
  1677. getLevel: function (e) {
  1678. if (e || e == 0) {
  1679. let str = e.toString();
  1680. let theType = "";
  1681. level.map(function (item) {
  1682. if (item.value == str) {
  1683. theType = item.key;
  1684. }
  1685. });
  1686. return theType;
  1687. }
  1688. },
  1689. //项目状态
  1690. getXiangmoState: function (e) {
  1691. if (e || e == 0) {
  1692. let str = e.toString();
  1693. let theType = "";
  1694. xiangmoState.map(function (item) {
  1695. if (item.value == str) {
  1696. theType = item.key;
  1697. }
  1698. });
  1699. return theType;
  1700. }
  1701. },
  1702. //订单状态
  1703. getNewOrderStatus: function (e) {
  1704. if (e || e == 0) {
  1705. let str = e.toString();
  1706. let theType = "";
  1707. newOrderStatus.map(function (item) {
  1708. if (item.value == str) {
  1709. theType = item.key;
  1710. }
  1711. });
  1712. return theType;
  1713. }
  1714. },
  1715. //催款状态
  1716. getCuikuan: function (e) {
  1717. if (e || e == 0) {
  1718. let str = e.toString();
  1719. let theType = "";
  1720. cuikuan.map(function (item) {
  1721. if (item.value == str) {
  1722. theType = item.key;
  1723. }
  1724. });
  1725. return theType;
  1726. }
  1727. },
  1728. //分配状态
  1729. // getAllotStatus:function (e) {
  1730. // if (e||e==0) {
  1731. // let str=e.toString()
  1732. // let theType = '';
  1733. // processStatus.map(function (item) {
  1734. // if (item.value == str) {
  1735. // theType = item.key;
  1736. // };
  1737. // });
  1738. // return theType;
  1739. // }
  1740. // },
  1741. //退单状态
  1742. getRefundStatus: function (e) {
  1743. if (e || e == 0) {
  1744. let str = e.toString();
  1745. let theType = "";
  1746. refundStatus.map(function (item) {
  1747. if (item.value == str) {
  1748. theType = item.key;
  1749. }
  1750. });
  1751. return theType;
  1752. }
  1753. },
  1754. //退单状态
  1755. getTaskStatus: function (e) {
  1756. if (e || e == 0) {
  1757. let str = e.toString();
  1758. let theType = "";
  1759. taskStatus.map(function (item) {
  1760. if (item.value == str) {
  1761. theType = item.key;
  1762. }
  1763. });
  1764. return theType;
  1765. }
  1766. },
  1767. getApprovalTag: function (e) {
  1768. if (e == 1) {
  1769. return <Tag color="#faa755">特批待审</Tag>
  1770. } else if (e == 2) {
  1771. return <Tag color="#ff0000">特批通过</Tag>
  1772. } else if (e == 4) {
  1773. return <Tag color="#faa755">特批待审</Tag>
  1774. } else if (e == 5) {
  1775. return <Tag color="#ff0000">特批通过</Tag>
  1776. } else if (e == 7) {
  1777. return <Tag color="#faa755">特批待审</Tag>
  1778. } else if (e == 8) {
  1779. return <Tag color="#ff0000">特批通过</Tag>
  1780. }
  1781. },
  1782. //特批状态
  1783. getApproval: function (e, flag) {
  1784. if (flag) {
  1785. if (e == 0) {
  1786. return "非特批";
  1787. } else if (e == 1) {
  1788. return "特批待审核";
  1789. } else if (e == 2) {
  1790. return "特批通过";
  1791. } else if (e == 3) {
  1792. return "特批驳回";
  1793. } else if (e == 4) {
  1794. return "特批董事长待审核";
  1795. } else if (e == 5) {
  1796. return "特批董事长通过";
  1797. } else if (e == 6) {
  1798. return "特批董事长驳回";
  1799. }
  1800. // else if (e == 7) {
  1801. // return "特批副总裁待审核";
  1802. // } else if (e == 8) {
  1803. // return "特批副总裁通过";
  1804. // } else if (e == 9) {
  1805. // return "特批副总裁驳回";
  1806. // }
  1807. else {
  1808. return "未知";
  1809. }
  1810. }
  1811. if (e || e == 0) {
  1812. let str = e.toString();
  1813. let theType = "";
  1814. approval.map(function (item) {
  1815. if (item.value == str) {
  1816. theType = item.key;
  1817. }
  1818. });
  1819. return theType;
  1820. }
  1821. },
  1822. //流程状态
  1823. getPeople: function (val) {
  1824. if (val == 0) {
  1825. return "已派营销员";
  1826. } else if (val == 1) {
  1827. return "已派营销管理员";
  1828. } else if (val == 2) {
  1829. return "已派咨询师";
  1830. } else if (val == 3) {
  1831. return "已派咨询师经理";
  1832. } else if (val == 4) {
  1833. return "已派咨询师管理员";
  1834. } else if (val == 5) {
  1835. return "已派财务专员";
  1836. } else if (val == 6) {
  1837. return "已派财务总监";
  1838. }
  1839. },
  1840. //第三方信息状态----是否有方案
  1841. getMaterialStatus: function (val) {
  1842. if (val == 0) {
  1843. return "无方案";
  1844. } else if (val == 1) {
  1845. return "有方案";
  1846. }
  1847. },
  1848. //第三方信息状态----加急
  1849. getUrgentStatus: function (val) {
  1850. if (val == 0) {
  1851. return "无加急";
  1852. } else if (val == 1) {
  1853. return "加急3-5个工作日";
  1854. } else if (val == 2) {
  1855. return "加急6-10个工作日";
  1856. } else if (val == 3) {
  1857. return "加急11-15个工作日";
  1858. } else if (val == 4) {
  1859. return "加急16-20个工作日";
  1860. } else if (val == 5) {
  1861. return "加急21-25个工作日";
  1862. } else if (val == 6) {
  1863. return "加急26-30个工作日";
  1864. } else if (val == 7) {
  1865. return "加急45个工作日";
  1866. } else if (val == 8) {
  1867. return "加急60个工作日";
  1868. }
  1869. },
  1870. //审核状态
  1871. getStatus: function (val) {
  1872. if (val == 0) {
  1873. return "未提交";
  1874. } else if (val == 1) {
  1875. return "处理中";
  1876. } else if (val == 2) {
  1877. return "通过";
  1878. } else if (val == 3) {
  1879. return "拒绝";
  1880. } else if (val == 4) {
  1881. return "撤销";
  1882. }
  1883. },
  1884. //项目状态
  1885. getProjectStatus: function (e) {
  1886. let arr = projectStatusList.filter(v => {
  1887. return v.value === e
  1888. });
  1889. if (arr.length) {
  1890. return arr[0].value == 29 ? <Tag color="#FF0000">{arr[0].label}</Tag> : <span>{arr[0].label}</span>
  1891. }
  1892. return '';
  1893. },
  1894. //流程状态
  1895. getProcessStatus: function (e, name, state) {
  1896. if (e || e == 0) {
  1897. let str = e.toString();
  1898. let theType = "";
  1899. let theName = "(" + name + ")"
  1900. processStatus.map(function (item) {
  1901. if (item.value == str) {
  1902. theType = item.key;
  1903. }
  1904. });
  1905. if (e == 0 || e == 6 || e == 7 || !name) {
  1906. theName = ""
  1907. } else if (e == 4) {
  1908. // if (state == "1" || state == "2" || state == "3") {
  1909. // theName = "(公司/部门管理)"
  1910. // } else
  1911. if (state == "4" || state == "5" || state == "6") {
  1912. theName = "(董事长)"
  1913. }
  1914. // else if (state == "7" || state == "8" || state == "9") {
  1915. // theName = "(副总裁)"
  1916. // }
  1917. }
  1918. return theType + theName;
  1919. }
  1920. },
  1921. //结算状态
  1922. getLiquidationStatus: function (e) {
  1923. if (e || e == 0) {
  1924. let str = e.toString();
  1925. let theType = "";
  1926. liquidationStatus.map(function (item) {
  1927. if (item.value == str) {
  1928. theType = item.key;
  1929. }
  1930. });
  1931. return theType;
  1932. }
  1933. },
  1934. //新项目类型
  1935. getNewOrderType: function (e) {
  1936. if (e || e == 0) {
  1937. let str = e.toString();
  1938. let theType = "";
  1939. newOrderType.map(function (item) {
  1940. if (item.value == str) {
  1941. theType = item.key;
  1942. }
  1943. });
  1944. return theType;
  1945. }
  1946. },
  1947. //技术员发款类型
  1948. getJsyPaymentType: function (e) {
  1949. if (e || e == 0) {
  1950. let str = e.toString();
  1951. let theType = "";
  1952. jsyPaymentType.map(function (item) {
  1953. if (item.value == str) {
  1954. theType = item.key;
  1955. }
  1956. });
  1957. return theType;
  1958. }
  1959. },
  1960. //奖金发放状态
  1961. getBonusState: function (e) {
  1962. if (e || e == 0) {
  1963. let str = e.toString();
  1964. let theType = "";
  1965. bonusState.map(function (item) {
  1966. if (item.value == str) {
  1967. theType = item.key;
  1968. }
  1969. });
  1970. return theType;
  1971. }
  1972. },
  1973. //技术员发款类型
  1974. getCustomerType: function (e) {
  1975. if (e || e == 0) {
  1976. let str = e.toString();
  1977. let theType = "";
  1978. customerType.map(function (item) {
  1979. if (item.value == str) {
  1980. theType = item.key;
  1981. }
  1982. });
  1983. return theType;
  1984. }
  1985. },
  1986. //技术员发款类型
  1987. getOrderTypes: function (e) {
  1988. if (e || e == 0) {
  1989. let str = e.toString();
  1990. let theType = "";
  1991. orderTypes.map(function (item) {
  1992. if (item.value == str) {
  1993. theType = item.key;
  1994. }
  1995. });
  1996. return theType;
  1997. }
  1998. },
  1999. //技术员发款类型
  2000. getjiedian: function (e) {
  2001. if (e || e == 0) {
  2002. let str = e.toString();
  2003. let theType = "";
  2004. jiedian.map(function (item) {
  2005. if (item.value == str) {
  2006. theType = item.key;
  2007. }
  2008. });
  2009. return theType;
  2010. }
  2011. },
  2012. //省内外
  2013. getProvinceA: function (e) {
  2014. if (e || e == 0) {
  2015. let str = e.toString();
  2016. let theType = "";
  2017. province.map(function (item) {
  2018. if (item.value == str) {
  2019. theType = item.key;
  2020. }
  2021. });
  2022. return theType;
  2023. }
  2024. },
  2025. //开票状态
  2026. // getInvoiceStatus: function (e, record) {
  2027. // if (record && record.approval == 1) {
  2028. // return "特批待审核";
  2029. // } else {
  2030. // if (e || e == 0) {
  2031. // let str = e.toString();
  2032. // let theType = "";
  2033. // invoiceStatus.map(function (item) {
  2034. // if (item.value == str) {
  2035. // theType = item.key;
  2036. // }
  2037. // });
  2038. // return theType;
  2039. // }
  2040. // }
  2041. // },
  2042. // approval(0非特批 1待审核 2审核通过) status(0未提交 1处理中 2通过 3拒绝 4撤销)
  2043. getInvoiceStatus: function (e, record) {
  2044. let theType = "";
  2045. let name = "(" + record.examineName + ")"
  2046. if (!record.examineName) {
  2047. name = ""
  2048. }
  2049. if (record) {
  2050. if (record.status === 4) {
  2051. theType = "撤销"
  2052. }
  2053. if (record.approval === 1) {
  2054. theType = "特批审核中"
  2055. if (record.status === 3) {
  2056. theType = "特批被拒"
  2057. }
  2058. } else {
  2059. if (record.status === 1) {
  2060. theType = "开票处理中"
  2061. } else if (record.status === 2) {
  2062. theType = "已完成"
  2063. } else if (record.status === 3) {
  2064. theType = "开票被拒"
  2065. }
  2066. }
  2067. } else {
  2068. theType = "";
  2069. }
  2070. return theType + name;
  2071. },
  2072. getApprovalA: function (e) {
  2073. if (e || e == 0) {
  2074. let str = e.toString();
  2075. let theType = "";
  2076. approvalA.map(function (item) {
  2077. if (item.value == str) {
  2078. theType = item.key;
  2079. }
  2080. });
  2081. return theType;
  2082. }
  2083. },
  2084. getProcessStatusNew: function (name, pro, status) {
  2085. let names = "(" + name + ")";
  2086. // if (!name || pro == 0 || pro == 8 || pro == 9 || pro == 10) {
  2087. if (!name) {
  2088. names = ""
  2089. }
  2090. let str = "";
  2091. if (pro == 0) {
  2092. str = "营销员";
  2093. } else if (pro == 1) {
  2094. str = "营销经理";
  2095. } else if (pro == 2) {
  2096. str = "营销管理员";
  2097. } else if (pro == 3) {
  2098. str = "咨询师";
  2099. } else if (pro == 4) {
  2100. str = "咨询师经理";
  2101. } else if (pro == 5) {
  2102. str = "咨询师总监";
  2103. } else if (pro == 6) {
  2104. str = "财务专员";
  2105. } else if (pro == 7) {
  2106. str = "财务总监";
  2107. } else if (pro == 8) {
  2108. str = "运营保障";
  2109. } else if (pro == 9) {
  2110. str = "公司/部门管理";
  2111. } else if (pro == 10) {
  2112. str = "董事长";
  2113. }
  2114. // else if (pro == 11) {
  2115. // str = "副总裁";
  2116. // }
  2117. let num = "";
  2118. if (status == 0) {
  2119. num = "发起";
  2120. } else if (status == 1) {
  2121. num = "审核中";
  2122. } else if (status == 2) {
  2123. num = "通过";
  2124. } else if (status == 3) {
  2125. num = "驳回";
  2126. return num + "到" + str + names;
  2127. }
  2128. // else if (status == 4) {
  2129. // num = "完成";
  2130. // }
  2131. else if (status == 5) {
  2132. num = "取消变更";
  2133. } else if (status == 6) {
  2134. num = "待上传附件";
  2135. }
  2136. if (pro == 8 && status == 2) {
  2137. return `订单变更退票中 (${name}处理中)`;
  2138. } else if (pro == 9 && status == 2) {
  2139. return `订单变更退票中 (${name}处理中)`;
  2140. } else if (pro == 10 && status == 2) {
  2141. return `订单变更退票中 (${name}处理中)`;
  2142. } else if (status == 4) {
  2143. return "订单变更已完成";
  2144. } else if (pro >= 8 && status == 6) {
  2145. return "待上传附件(营销员处理中)";
  2146. } else {
  2147. return str + names + num;
  2148. }
  2149. },
  2150. getContractChangeStatus: function (e) {
  2151. if (e || e == 0) {
  2152. let str = e.toString();
  2153. let theType = "";
  2154. contractChangeStatus.map(function (item) {
  2155. if (item.value == str) {
  2156. theType = item.key;
  2157. }
  2158. });
  2159. return theType;
  2160. }
  2161. },
  2162. // 咨询师以及咨询师经理审核内容显示
  2163. shenghePeo(name, status) {
  2164. if (status == 3) {
  2165. let str = "咨询师(";
  2166. str = str + name;
  2167. return str + ")审核中";
  2168. } else if (status == 4) {
  2169. let str = "咨询师经理(";
  2170. str = str + name;
  2171. return str + ")审核中";
  2172. }
  2173. },
  2174. moneyVerify(e) {
  2175. if (!/^\d{1,3}(,?\d{3})*(\.\d{1,6})?$/.test(e)) {
  2176. message.warning("输入金额不符合规范");
  2177. return true;
  2178. }
  2179. },
  2180. // 消息提醒函数接口
  2181. ShowModal(fn) {
  2182. let flag = true;
  2183. $.ajax({
  2184. method: "get",
  2185. dataType: "json",
  2186. crossDomain: false,
  2187. url: globalConfig.context + "/api/admin/notice/unreadCount",
  2188. data: {},
  2189. success: function (data) {
  2190. if (data.data != 0) {
  2191. fn.setState({
  2192. showModal: true,
  2193. });
  2194. } else {
  2195. fn.setState({
  2196. showModal: false,
  2197. });
  2198. }
  2199. },
  2200. });
  2201. // return flag
  2202. },
  2203. getType(e) {
  2204. if (e || e == 0) {
  2205. let str = e.toString();
  2206. let theType = "";
  2207. typeList.map(function (item) {
  2208. if (item.value == str) {
  2209. theType = item.key;
  2210. }
  2211. });
  2212. return theType;
  2213. }
  2214. },
  2215. changeColor(e) {
  2216. return (
  2217. <span style={{ color: "red", fontWeight: 900, fontSize: 16 }}>{e}</span>
  2218. );
  2219. },
  2220. //
  2221. getProjectName(e) {
  2222. let arr = projectStatusList.filter(v => {
  2223. return v.value === e
  2224. });
  2225. if (arr.length) {
  2226. return arr[0].value == 29 ? <Tag color="#FF0000">{arr[0].label}</Tag> : <span>{arr[0].label}</span>
  2227. }
  2228. return '';
  2229. },
  2230. // 详情--满意度调查
  2231. getFormRetrieve(e, showColor = true) {
  2232. let arr = formRetrieveList.filter(v => {
  2233. return v.value === e
  2234. });
  2235. if (arr.length) {
  2236. return <span style={{ color: showColor && arr[0].color }}>{arr[0].label}</span>
  2237. }
  2238. return '';
  2239. },
  2240. // 列表--满意度调查
  2241. getFormRetrieves(e, i) {
  2242. let str1 = ["未发送", "已发送,未回收", "已回收", "其他"][e]
  2243. let str2 = ""
  2244. if (e == 2) {
  2245. str2 = i == 0
  2246. ? "(非常满意)" : i == 1
  2247. ? "(满意)" : i == 2
  2248. ? "(一般)" : i == 3 && "(不满意)"
  2249. }
  2250. return str1 + str2;
  2251. },
  2252. download(fileName, deleteLv = true) {
  2253. window.open(globalConfig.context + `${'/open/download?fileName=' + fileName + '&delete=' + deleteLv}`);
  2254. },
  2255. getClockState(id, journal = false) {
  2256. let arr = journal ? clockJournalState.filter(v => v.id === id) : clockState.filter(v => v.id === id);
  2257. if (arr.length > 0) {
  2258. return arr[0];
  2259. } else {
  2260. return {};
  2261. }
  2262. },
  2263. // 处理级别层数
  2264. getBarLevel: function (val) {
  2265. let arr = []
  2266. if (!val) {
  2267. arr = ["", "", "", "", ""]
  2268. } else {
  2269. arr = val.split(',')
  2270. }
  2271. let leg = 5 - arr.length
  2272. if (arr.length < 5) {
  2273. for (var i = 0; i < leg; i++) {
  2274. arr.push("")
  2275. }
  2276. }
  2277. return arr
  2278. },
  2279. // 树状数据处理 num需要显示的最低lvl从0开始 默认全部显示
  2280. newTreeData(treeData, num = 6) {
  2281. let newData = [];
  2282. treeData.map(item => {
  2283. let treeObj = item;
  2284. treeObj.children = (item.children && item.lvl < num) ? obj.newTreeData(item.children, num) : [];
  2285. newData.push(treeObj)
  2286. })
  2287. return newData
  2288. },
  2289. // 获取巴权限
  2290. getRole: function (e) {
  2291. if (e || e == 0) {
  2292. let arr = e.split(',')
  2293. let theType = [];
  2294. for (var i = 0; i < roleList.length; i++) {
  2295. for (var j = 0; j < arr.length; j++) {
  2296. if (roleList[i].value == arr[j]) {
  2297. theType.push(roleList[i].key)
  2298. }
  2299. }
  2300. }
  2301. return theType.toString();
  2302. }
  2303. },
  2304. // 项目状态
  2305. // 项目暂停类型 0暂停 1重启
  2306. // 项目暂停状态 0发起 1通过 2拒绝
  2307. getStopStatus(type, status) {
  2308. let str = ""
  2309. str = type == 0 ? "暂停" : "重启"
  2310. if (status == 0) {
  2311. return <span>{"项目" + str + "待审核"}</span>
  2312. } else if (status == 1) {
  2313. return <span style={{ color: "green" }}>{"项目已" + str}</span>
  2314. } else if (status == 2) {
  2315. return <span style={{ color: "red" }}>{"项目" + str + "拒绝"}</span>
  2316. }
  2317. },
  2318. //
  2319. stopStatus(type, status) {
  2320. if (type == 0) {
  2321. if (status == 0) {
  2322. return <span style={{ color: "red" }}>暂停待审核</span>
  2323. } else if (status == 1) {
  2324. return <span style={{ color: "red" }}>项目已暂停,需重启</span>
  2325. } else if (status == 2) {
  2326. return <span style={{ color: "red" }}>暂停被驳回,重新申请暂停</span>
  2327. }
  2328. } else if (type == 1) {
  2329. if (status == 0) {
  2330. return <span style={{ color: "red" }}>重启待审核</span>
  2331. } else if (status == 1) {
  2332. return <span style={{ color: "red" }}>项目已重启</span>
  2333. } else if (status == 2) {
  2334. return <span style={{ color: "red" }}>重启被驳回,重新申请重启</span>
  2335. }
  2336. }
  2337. },
  2338. // 获取报销申请类型
  2339. getAccountName(type, other = "其他") {
  2340. let theType = "";
  2341. accountType.map(function (item) {
  2342. if (item.value == type) {
  2343. theType = item.label;
  2344. if (item.value == 0) {
  2345. theType = "其他(" + other + ")"
  2346. }
  2347. }
  2348. });
  2349. return theType;
  2350. },
  2351. getSecondaryAccountName(type, other = "其他") {
  2352. let theType = "";
  2353. typeLists.map(function (item) {
  2354. if (item.value == type) {
  2355. theType = item.label;
  2356. if (item.value == 0) {
  2357. theType = "其他(" + other + ")"
  2358. }
  2359. }
  2360. });
  2361. return theType;
  2362. },
  2363. // 获取交通工具类型
  2364. getVehicleName(type, other = "其他") {
  2365. let theType = "";
  2366. vehiclelist.map(function (item) {
  2367. if (item.value == type) {
  2368. theType = item.label;
  2369. if (item.value == 0) {
  2370. theType = "其他(" + other + ")"
  2371. }
  2372. }
  2373. });
  2374. return theType;
  2375. },
  2376. // 获取报销费用类型
  2377. getTypeName(type, other = "其他") {
  2378. let theType = "";
  2379. typeLists.map(function (item) {
  2380. if (item.value == type) {
  2381. theType = item.label;
  2382. if (item.value == 0) {
  2383. theType = "其他(" + other + ")"
  2384. }
  2385. }
  2386. });
  2387. return theType;
  2388. },
  2389. // 解决小数求和问题
  2390. commonAdd(number1, number2) {
  2391. let result = 0;
  2392. if (Number.isInteger(number1) && Number.isInteger(number2)) {
  2393. result = number1 + number2;
  2394. } else {
  2395. //
  2396. const number1Array = (number1).toString().split('.');
  2397. const number2Array = (number2).toString().split('.');
  2398. Number.isInteger(number1) && number1Array.push("0")
  2399. Number.isInteger(number2) && number2Array.push("0")
  2400. //最大的除数位数
  2401. let maxBit = 1;
  2402. if (number1Array[1].length >= number2Array[1].length) {
  2403. maxBit = number1Array[1].length + 1;
  2404. } else {
  2405. maxBit = number2Array[1].length + 1;
  2406. }
  2407. const divisor = parseInt('1'.padEnd(maxBit, 0));
  2408. result = (number1 * divisor + number2 * divisor) / divisor;
  2409. }
  2410. return result;
  2411. },
  2412. /** 数字金额大写转换(可以处理整数,小数,负数) */
  2413. dealBigMoney(n) {
  2414. var fraction = ['角', '分'];
  2415. var digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
  2416. var unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']];
  2417. var head = n < 0 ? '欠' : '';
  2418. n = Math.abs(n);
  2419. var s = '';
  2420. for (var i = 0; i < fraction.length; i++) {
  2421. s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
  2422. }
  2423. s = s || '整';
  2424. n = Math.floor(n);
  2425. for (var i = 0; i < unit[0].length && n > 0; i++) {
  2426. var p = '';
  2427. for (var j = 0; j < unit[1].length && n > 0; j++) {
  2428. p = digit[n % 10] + unit[1][j] + p;
  2429. n = Math.floor(n / 10);
  2430. }
  2431. s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
  2432. }
  2433. return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整');
  2434. },
  2435. getToday(status) {
  2436. // status 1 今日 2 昨日 3 近7日 4 近15日 5 近30日
  2437. let list = []
  2438. let startTime = "";
  2439. let endTime = moment().format("YYYY-MM-DD");
  2440. if (status == 1) {
  2441. startTime = moment().format("YYYY-MM-DD");
  2442. } else if (status == 2) {
  2443. startTime = moment().subtract(1, 'days').format("YYYY-MM-DD");
  2444. endTime = moment().subtract(1, 'days').format("YYYY-MM-DD");
  2445. } else if (status == 3) {
  2446. startTime = moment().subtract(7, 'days').format("YYYY-MM-DD");
  2447. } else if (status == 4) {
  2448. startTime = moment().subtract(15, 'days').format("YYYY-MM-DD");
  2449. } else if (status == 5) {
  2450. startTime = moment().subtract(30, 'days').format("YYYY-MM-DD");
  2451. }
  2452. list.push(startTime, endTime)
  2453. return list
  2454. },
  2455. // 特批类型
  2456. getApprovedType: function (e, other, s = 0) {
  2457. if (!!e && e.length > 0) {
  2458. let theType = "";
  2459. for (var i = 0; i < e.length; i++) {
  2460. let item = Number(e[i])
  2461. for (var j = 0; j < approvalOptions.length; j++) {
  2462. if (item == approvalOptions[j].value && item != 0) {
  2463. theType = theType + (theType ? ";" : "") + approvalOptions[j].label
  2464. } else if (item == approvalOptions[j].value && item == 0) {
  2465. theType = theType + (theType ? ";" : "") + `其他(${other})`
  2466. }
  2467. }
  2468. }
  2469. if (s == 1) {
  2470. return !!theType ? ("(" + theType + ")") : theType
  2471. } else {
  2472. return theType;
  2473. }
  2474. }
  2475. },
  2476. compare: function (a, b) {
  2477. if (a === 0 || b === 0) {
  2478. return a === 0 ? 1 : -1;
  2479. }
  2480. return a - b;
  2481. },
  2482. // 数组重组
  2483. getNewArray: function (array, key) {
  2484. let arr = []
  2485. if (array && array.length > 0) {
  2486. array.forEach(e => {
  2487. arr.push(e[key])
  2488. });
  2489. }
  2490. return arr
  2491. },
  2492. };
  2493. module.exports = obj