index.tsx 151 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618
  1. import { ref, reactive, computed, toRefs, nextTick, inject } from "vue";
  2. import { Table } from "@/hooks/interface";
  3. import { ColumnProps } from "@/components/LjVxeTable/interface";
  4. import { ALLOW_EDIT_STATE, sys_arry_formulatype } from "@/config/index";
  5. import { CommonDynamicSelect } from "@/api/modules/common";
  6. import { GetComputeMattress, GetMattressImportDW2, GetMattressPackagMx, GetComputeSpring } from "@/api/modules/quote";
  7. import { useUserStore } from "@/stores/modules/user";
  8. import MtrldefSelect from "@/views/system/selector/mtrldef/select.vue";
  9. import BednetSelect from "@/views/system/selector/bednet/select.vue";
  10. import { handleRowAccordingToProp } from "@/utils";
  11. import { ElButton, ElMessage, ElPopconfirm, ElMessageBox, ElNotification, ElTag } from "element-plus";
  12. import { Minus, Plus, InfoFilled } from "@element-plus/icons-vue";
  13. import { DwnameEnum } from "@/enums/dwnameEnum";
  14. import { isArray } from "@/utils/is";
  15. import {
  16. calculateFormula,
  17. formulaPartsFormula,
  18. floatAdd,
  19. floatMul,
  20. formatFixedNumber,
  21. autoMergeCells,
  22. formatCutNumber
  23. } from "@/utils/index";
  24. import { cloneDeep, defaultsDeep, throttle } from "lodash-es";
  25. import { TYPE, useToast, POSITION } from "vue-toastification";
  26. import ToastFormula from "@/components/ToastWidget/Formula/index.vue";
  27. import ToastHistoryPrice from "@/components/ToastWidget/HistoryPrice/index.vue";
  28. import { useRouter } from "vue-router";
  29. import { useGlobalStore } from "@/stores/modules/global";
  30. import { storeToRefs } from "pinia";
  31. // import { title } from "process";
  32. interface defaultState {
  33. /**
  34. * @description 单据当前状态
  35. */
  36. orderStatus: string;
  37. vxeTableRef: any;
  38. LjDetailRef: any;
  39. MtrldefDialogRef: any;
  40. MtrldefDialogProps: any;
  41. BednetDialogRef: any;
  42. BednetDialogProps: any;
  43. /**
  44. * @description 面料tab页拆分
  45. */
  46. fabricMxTabList: any[];
  47. otherMxTabList: any[];
  48. /**
  49. * @description 面料当前tab页
  50. */
  51. fabricMxTabs: any;
  52. // fabricMxRef: any;
  53. fabricMxTab8Ref: any;
  54. fabricMxTab9Ref: any;
  55. fabricMxTab10Ref: any;
  56. fabricMxTab11Ref: any;
  57. fabricMxTab12Ref: any;
  58. fabricMxTab13Ref: any;
  59. bednetMxRef: any;
  60. cushionsMxRef: any;
  61. accessoriesMxRef: any;
  62. packagMxRef: any;
  63. innerClothLayerMxRef: any;
  64. topCottonMxRef: any;
  65. subSpecsRef: any;
  66. fabricMxTab8: any[];
  67. fabricMxTab9: any[];
  68. fabricMxTab10: any[];
  69. fabricMxTab11: any[];
  70. fabricMxTab12: any[];
  71. fabricMxTab13: any[];
  72. /**
  73. * @description 面料明细数据-裥大侧 新增
  74. */
  75. fabricMx10NewMtrlGroup: any[];
  76. /**
  77. * @description 面料明细数据-裥小侧 新增
  78. */
  79. fabricMx11NewMtrlGroup: any[];
  80. /**
  81. * @description 床垫类型枚举
  82. */
  83. mattresstypeEnum: any;
  84. /**
  85. * @description 原始明细数据
  86. */
  87. oriMxData: any;
  88. initParams: any;
  89. /**
  90. * @description 垫层数据
  91. */
  92. cushionsMxData: any;
  93. fabricMxData: any;
  94. /**
  95. * @description 辅料数据
  96. */
  97. accessoriesMxData: any;
  98. /**
  99. * @description 床网数据
  100. */
  101. bednetMxData: any;
  102. /**
  103. * @description 包装数据
  104. */
  105. packagMxData: any;
  106. /**
  107. * @description 公式弹窗-是否展示详细公式
  108. */
  109. showFormula: boolean;
  110. QuoteListDrawerRef: any;
  111. formulaKindEnum: any;
  112. formulaKindDcEnum: any;
  113. packtypeOptions: any;
  114. woodpallettypeOptions: any;
  115. areaOptions: any;
  116. cabinetTypeOptions: any;
  117. diancengAreaEnum: any;
  118. topCottonAddList: any;
  119. AllFormulaRef: any;
  120. LjDrawerRef: any;
  121. bednetDrawerProps: bednetDrawerPropsdata;
  122. cmpFormulas: any;
  123. cmpFormulaReplace: any;
  124. cmpFormulasOri: any;
  125. cmpFormulasBednet: any;
  126. cmpDiffer: any;
  127. specialProcessesMxRef: any;
  128. additionalCostsMxRef: any;
  129. specialProcessesMxData: any;
  130. additionalCostsMxData: any;
  131. specialProcessesMxInitData: any;
  132. additionalCostsMxInitData: any;
  133. specialProcessesEnum: any;
  134. additionalCostsEnum: any;
  135. isShowOriginFormulaMattress: boolean;
  136. }
  137. interface bednetDrawerPropsdata {
  138. deptid?: number;
  139. bednetid?: number;
  140. state?: string;
  141. }
  142. export const useHooks = (t?: any) => {
  143. const state = reactive<defaultState>({
  144. orderStatus: "",
  145. vxeTableRef: null,
  146. LjDetailRef: null,
  147. // fabricMxRef: null,
  148. fabricMxTab8Ref: null,
  149. fabricMxTab9Ref: null,
  150. fabricMxTab10Ref: null,
  151. fabricMxTab11Ref: null,
  152. fabricMxTab12Ref: null,
  153. fabricMxTab13Ref: null,
  154. MtrldefDialogRef: null,
  155. MtrldefDialogProps: {},
  156. BednetDialogRef: null,
  157. BednetDialogProps: {},
  158. fabricMxTabs: "",
  159. fabricMxTabList: [
  160. {
  161. label: "裥面",
  162. name: "tabpage_8",
  163. visible: () => Number(state.mattresstypeEnum?.if_top_side) == 1,
  164. type: [0, 80, 40, 50, 60, 70, 9000],
  165. ref: "fabricMxTab8Ref"
  166. },
  167. {
  168. label: "裥底",
  169. name: "tabpage_9",
  170. visible: () => Number(state.mattresstypeEnum?.if_button_sdie) == 1,
  171. type: [1, 81, 41, 51, 61, 71, 9001],
  172. ref: "fabricMxTab9Ref"
  173. },
  174. {
  175. label: "裥大恻",
  176. name: "tabpage_10",
  177. visible: () => Number(state.mattresstypeEnum?.if_big_side) == 1,
  178. type: [2, 82, 42, 52, 62, 72, 9002],
  179. ref: "fabricMxTab10Ref"
  180. },
  181. {
  182. label: "裥小恻",
  183. name: "tabpage_11",
  184. visible: () => Number(state.mattresstypeEnum?.if_small_side) == 1,
  185. type: [3, 83, 43, 53, 63, 73, 9003],
  186. ref: "fabricMxTab11Ref"
  187. },
  188. {
  189. label: "裥V恻",
  190. name: "tabpage_12",
  191. visible: () => Number(state.mattresstypeEnum?.if_v_side) == 1,
  192. type: [4, 84, 44, 54, 64, 74, 9004],
  193. ref: "fabricMxTab12Ref"
  194. },
  195. {
  196. label: "拉手刺绣及其他工艺",
  197. name: "tabpage_13",
  198. visible: () => true,
  199. type: [
  200. 0, 80, 40, 50, 60, 70, 1, 81, 41, 51, 61, 71, 2, 82, 42, 52, 62, 72, 3, 83, 43, 53, 63, 73, 4, 84, 44, 54, 64, 74, 9000,
  201. 9001, 9002, 9003, 9004, 9005, 9006
  202. ], // not in
  203. ref: "fabricMxTab13Ref"
  204. },
  205. {
  206. label: "床网",
  207. name: "bednetMx",
  208. ref: "bednetMxRef"
  209. },
  210. {
  211. label: "垫层",
  212. name: "cushionsMx",
  213. ref: "cushionsMxRef"
  214. },
  215. {
  216. label: "辅料",
  217. name: "accessoriesMx",
  218. ref: "accessoriesMxRef"
  219. },
  220. {
  221. label: "包装",
  222. name: "packagMx",
  223. ref: "packagMxRef"
  224. },
  225. {
  226. label: "内布套",
  227. name: "innerClothLayerMx",
  228. ref: "innerClothLayerMxRef"
  229. },
  230. {
  231. label: "顶布裥棉",
  232. name: "topCottonMx",
  233. ref: "topCottonMxRef"
  234. },
  235. {
  236. label: "特殊工艺费用",
  237. name: "specialProcesses",
  238. ref: "specialProcessesMxRef"
  239. },
  240. {
  241. label: "材料额外费用",
  242. name: "additionalCosts",
  243. ref: "additionalCostsMxRef"
  244. }
  245. ],
  246. otherMxTabList: [
  247. {
  248. label: "内布套",
  249. name: "tabpage_14",
  250. type: [101, 102, 103, 104, 105, 106]
  251. },
  252. {
  253. label: "外布套",
  254. name: "tabpage_15",
  255. type: [111, 112, 113, 114, 115, 116]
  256. }
  257. ],
  258. fabricMxTab8: [],
  259. fabricMxTab9: [],
  260. fabricMxTab10: [],
  261. fabricMxTab11: [],
  262. fabricMxTab12: [],
  263. fabricMxTab13: [],
  264. fabricMx10NewMtrlGroup: [
  265. {
  266. label: "普通大侧",
  267. value: 1
  268. },
  269. {
  270. label: "上下拼侧1",
  271. value: 2
  272. },
  273. {
  274. label: "上下拼侧2",
  275. value: 3
  276. },
  277. {
  278. label: "上下拼侧3",
  279. value: 4
  280. },
  281. {
  282. label: "左右拼侧1",
  283. value: 5
  284. },
  285. {
  286. label: "左右拼侧2",
  287. value: 6
  288. },
  289. {
  290. label: "左右拼侧3",
  291. value: 7
  292. },
  293. {
  294. label: "左右拼侧4",
  295. value: 8
  296. }
  297. ],
  298. fabricMx11NewMtrlGroup: [
  299. {
  300. label: "小侧1",
  301. value: 1
  302. },
  303. {
  304. label: "小侧1-上下拼侧1",
  305. value: 2
  306. },
  307. {
  308. label: "小侧1-上下拼侧2",
  309. value: 3
  310. },
  311. {
  312. label: "小侧1-上下拼侧3",
  313. value: 4
  314. }
  315. ],
  316. mattresstypeEnum: {},
  317. oriMxData: {},
  318. initParams: { arg_mattressid: 0 },
  319. fabricMxData: [],
  320. bednetMxData: [],
  321. cushionsMxData: [],
  322. accessoriesMxData: [],
  323. packagMxData: [],
  324. showFormula: false,
  325. QuoteListDrawerRef: null,
  326. formulaKindEnum: null,
  327. formulaKindDcEnum: null,
  328. bednetMxRef: null,
  329. cushionsMxRef: null,
  330. accessoriesMxRef: null,
  331. packagMxRef: null,
  332. innerClothLayerMxRef: null,
  333. topCottonMxRef: null,
  334. subSpecsRef: null,
  335. packtypeOptions: [
  336. {
  337. label: "压包",
  338. value: 0
  339. },
  340. {
  341. label: "卷包",
  342. value: 1
  343. },
  344. {
  345. label: "国内",
  346. value: 2
  347. }
  348. ],
  349. woodpallettypeOptions: [
  350. {
  351. label: "普通木托",
  352. value: 0
  353. },
  354. {
  355. label: "夹板木托",
  356. value: 1
  357. },
  358. {
  359. label: "铁管木托",
  360. value: 2
  361. }
  362. ],
  363. areaOptions: [
  364. {
  365. label: "普通地区",
  366. value: "普通地区"
  367. },
  368. {
  369. label: "特定地区",
  370. value: "特定地区"
  371. }
  372. ],
  373. cabinetTypeOptions: [
  374. {
  375. label: "大柜",
  376. value: "大柜"
  377. },
  378. {
  379. label: "小柜",
  380. value: "小柜"
  381. }
  382. ],
  383. diancengAreaEnum: [],
  384. topCottonAddList: [],
  385. AllFormulaRef: null,
  386. LjDrawerRef: null,
  387. bednetDrawerProps: {},
  388. cmpFormulas: [],
  389. cmpFormulaReplace: [],
  390. cmpFormulasOri: [],
  391. cmpFormulasBednet: [],
  392. cmpDiffer: [],
  393. specialProcessesMxRef: null,
  394. additionalCostsMxRef: null,
  395. specialProcessesMxData: [],
  396. additionalCostsMxData: [],
  397. specialProcessesMxInitData: [],
  398. additionalCostsMxInitData: [],
  399. specialProcessesEnum: [],
  400. additionalCostsEnum: [],
  401. isShowOriginFormulaMattress: false
  402. });
  403. const router = useRouter();
  404. /**
  405. * @description 面料分类取值
  406. */
  407. const mtrltypeTabList = [
  408. {
  409. label: "选布料",
  410. formulakinds: [0, 1, 2, 3, 4, 101, 111],
  411. value: 3
  412. },
  413. {
  414. label: "喷胶绵",
  415. formulakinds: [40, 41, 42, 43, 44, 102, 112],
  416. value: 5
  417. },
  418. {
  419. label: "裥绵海绵",
  420. formulakinds: [50, 51, 52, 53, 54, 103, 113],
  421. value: 4
  422. },
  423. {
  424. label: "无纺布",
  425. formulakinds: [60, 61, 62, 63, 64, 104, 114],
  426. value: 30
  427. },
  428. {
  429. label: "裥花图案",
  430. formulakinds: [70, 71, 72, 73, 74, 105, 115],
  431. value: 26
  432. },
  433. {
  434. label: "布料-加工工艺",
  435. formulakinds: [80, 81, 82, 83, 84, 106, 116],
  436. value: 15
  437. },
  438. {
  439. label: "拉手",
  440. formulakinds: [5],
  441. value: 10
  442. },
  443. {
  444. label: "刺绣",
  445. formulakinds: [6],
  446. value: 11
  447. },
  448. {
  449. label: "大侧*压布",
  450. formulakinds: [7],
  451. value: 3
  452. },
  453. {
  454. label: "大侧*边带",
  455. formulakinds: [8, 9],
  456. value: 9
  457. },
  458. {
  459. label: "大侧*上下压线",
  460. formulakinds: [10],
  461. value: 12
  462. },
  463. {
  464. label: "垫层",
  465. formulakinds: [11, 32, 33],
  466. value: 6
  467. },
  468. {
  469. label: "顶布",
  470. formulakinds: [12],
  471. value: 3
  472. },
  473. {
  474. label: "毡类",
  475. formulakinds: [13],
  476. value: 7
  477. },
  478. {
  479. label: "打底无纺布",
  480. formulakinds: [14],
  481. value: 2
  482. },
  483. {
  484. label: "辅料",
  485. formulakinds: [15],
  486. value: 8
  487. },
  488. {
  489. label: "PE",
  490. formulakinds: [16],
  491. value: 16
  492. },
  493. {
  494. label: "外层PE",
  495. formulakinds: [17],
  496. value: 17
  497. },
  498. {
  499. label: "PVC",
  500. formulakinds: [18],
  501. value: 18
  502. },
  503. {
  504. label: "卷包包装",
  505. formulakinds: [19],
  506. value: 19
  507. },
  508. {
  509. label: "牛皮纸袋",
  510. formulakinds: [20],
  511. value: 20
  512. },
  513. {
  514. label: "蓝色PE护角",
  515. formulakinds: [21],
  516. value: 21
  517. },
  518. {
  519. label: "无纺布袋",
  520. formulakinds: [22],
  521. value: 22
  522. },
  523. {
  524. label: "牛皮袋护角",
  525. formulakinds: [23],
  526. value: 23
  527. },
  528. {
  529. label: "编织袋",
  530. formulakinds: [24],
  531. value: 24
  532. },
  533. {
  534. label: "外袋",
  535. formulakinds: [25],
  536. value: 13
  537. },
  538. {
  539. label: "内袋",
  540. formulakinds: [26],
  541. value: 14
  542. },
  543. {
  544. label: "无拉手脚轮",
  545. formulakinds: [27],
  546. value: -1
  547. },
  548. {
  549. label: "拉钮",
  550. formulakinds: [28],
  551. value: -1
  552. },
  553. {
  554. label: "网面布料",
  555. formulakinds: [29],
  556. value: -1
  557. },
  558. {
  559. label: "防火线",
  560. formulakinds: [30],
  561. value: 32
  562. },
  563. {
  564. label: "木托",
  565. formulakinds: [31],
  566. value: -1
  567. },
  568. {
  569. label: "床网",
  570. formulakinds: [99],
  571. value: -1
  572. },
  573. {
  574. label: "拉链",
  575. formulakinds: [202],
  576. value: 31
  577. },
  578. {
  579. label: "席垫",
  580. formulakinds: [203],
  581. value: 32
  582. },
  583. {
  584. label: "车花边",
  585. formulakinds: [205],
  586. value: 32
  587. }
  588. ];
  589. /**
  590. * @description 包装
  591. */
  592. const mtrltypeTabList_packag = [
  593. {
  594. label: "选布料",
  595. formulakinds: [0, 1, 2, 3, 4],
  596. value: 3
  597. },
  598. {
  599. label: "喷胶绵",
  600. formulakinds: [40, 41, 42, 43, 44],
  601. value: 5
  602. },
  603. {
  604. label: "裥绵海绵",
  605. formulakinds: [50, 51, 52, 53, 54],
  606. value: 4
  607. },
  608. {
  609. label: "无纺布",
  610. formulakinds: [60, 61, 62, 63, 64],
  611. value: 2
  612. },
  613. {
  614. label: "裥花图案",
  615. formulakinds: [70, 71, 72, 73, 74],
  616. value: 4
  617. },
  618. {
  619. label: "布料-加工工艺",
  620. formulakinds: [80, 81, 82, 83, 84],
  621. value: 15
  622. },
  623. {
  624. label: "拉手",
  625. formulakinds: [5],
  626. value: 10
  627. },
  628. {
  629. label: "刺绣",
  630. formulakinds: [6],
  631. value: 11
  632. },
  633. {
  634. label: "大侧*压布",
  635. formulakinds: [7],
  636. value: 2
  637. },
  638. {
  639. label: "大侧*边带",
  640. formulakinds: [8, 9],
  641. value: 9
  642. },
  643. {
  644. label: "大侧*上下压线",
  645. formulakinds: [10],
  646. value: 12
  647. },
  648. {
  649. label: "垫层",
  650. formulakinds: [11, 32, 33],
  651. value: 6
  652. },
  653. {
  654. label: "顶布",
  655. formulakinds: [12],
  656. value: 3
  657. },
  658. {
  659. label: "毡类",
  660. formulakinds: [13],
  661. value: 7
  662. },
  663. {
  664. label: "打底无纺布",
  665. formulakinds: [14],
  666. value: 2
  667. },
  668. {
  669. label: "辅料",
  670. formulakinds: [15],
  671. value: 8
  672. },
  673. {
  674. label: "PE",
  675. formulakinds: [16],
  676. value: 16
  677. },
  678. {
  679. label: "外层PE",
  680. formulakinds: [17],
  681. value: 17
  682. },
  683. {
  684. label: "PVC",
  685. formulakinds: [18],
  686. value: 18
  687. },
  688. {
  689. label: "卷包包装",
  690. formulakinds: [19],
  691. value: 19
  692. },
  693. {
  694. label: "牛皮纸袋",
  695. formulakinds: [20],
  696. value: 20
  697. },
  698. {
  699. label: "蓝色PE护角",
  700. formulakinds: [21],
  701. value: 21
  702. },
  703. {
  704. label: "无纺布袋",
  705. formulakinds: [22],
  706. value: 22
  707. },
  708. {
  709. label: "牛皮袋护角",
  710. formulakinds: [23],
  711. value: 23
  712. },
  713. {
  714. label: "编织袋",
  715. formulakinds: [24],
  716. value: 24
  717. },
  718. {
  719. label: "外袋",
  720. formulakinds: [25],
  721. value: 13
  722. },
  723. {
  724. label: "内袋",
  725. formulakinds: [26],
  726. value: 14
  727. },
  728. {
  729. label: "无拉手脚轮",
  730. formulakinds: [27],
  731. value: 19
  732. },
  733. {
  734. label: "拉钮",
  735. formulakinds: [28],
  736. value: -1
  737. },
  738. {
  739. label: "网面布料",
  740. formulakinds: [29],
  741. value: -1
  742. },
  743. {
  744. label: "防火线",
  745. formulakinds: [30],
  746. value: -1
  747. },
  748. {
  749. label: "木托",
  750. formulakinds: [31],
  751. value: 28
  752. },
  753. {
  754. label: "无纺布护角",
  755. formulakinds: [201],
  756. value: 27
  757. },
  758. {
  759. label: "床网",
  760. formulakinds: [99],
  761. value: -1
  762. }
  763. ];
  764. /**
  765. * @description 垫层
  766. */
  767. const mtrltypeTabList_cushions = [
  768. {
  769. label: "垫层",
  770. formulakinds: [11, 32, 33],
  771. value: 6
  772. },
  773. {
  774. label: "顶布",
  775. formulakinds: [12],
  776. value: 29
  777. },
  778. {
  779. label: "毡类",
  780. formulakinds: [13, 35],
  781. value: 7
  782. },
  783. {
  784. label: "打底无纺布",
  785. formulakinds: [14],
  786. value: 2
  787. },
  788. {
  789. label: "网面布料",
  790. formulakinds: [29],
  791. value: 3
  792. },
  793. {
  794. label: "顶布裥棉",
  795. formulakinds: [1201],
  796. value: 1201
  797. }
  798. ];
  799. /**
  800. * @description 辅料
  801. */
  802. const mtrltypeTabList_accessories = [
  803. {
  804. label: "辅料",
  805. formulakinds: [15],
  806. value: 8
  807. }
  808. ];
  809. /**
  810. * @description 内布套
  811. */
  812. const mtrltypeTabList_inner = [
  813. {
  814. label: "选布料",
  815. formulakinds: [0, 1, 2, 3, 4, 101, 111],
  816. value: 3
  817. },
  818. {
  819. label: "喷胶绵",
  820. formulakinds: [40, 41, 42, 43, 44, 102, 112],
  821. value: 5
  822. },
  823. {
  824. label: "裥绵海绵",
  825. formulakinds: [50, 51, 52, 53, 54, 103, 113],
  826. value: 4
  827. },
  828. {
  829. label: "无纺布",
  830. formulakinds: [60, 61, 62, 63, 64, 104, 114],
  831. value: 200
  832. },
  833. {
  834. label: "裥花图案",
  835. formulakinds: [70, 71, 72, 73, 74, 105, 115],
  836. value: 26
  837. },
  838. {
  839. label: "布料-加工工艺",
  840. formulakinds: [80, 81, 82, 83, 84, 106, 116],
  841. value: 15
  842. },
  843. {
  844. label: "拉手",
  845. formulakinds: [5],
  846. value: 10
  847. },
  848. {
  849. label: "刺绣",
  850. formulakinds: [6],
  851. value: 11
  852. },
  853. {
  854. label: "大侧*压布",
  855. formulakinds: [7],
  856. value: 2
  857. },
  858. {
  859. label: "大侧*边带",
  860. formulakinds: [8, 9],
  861. value: 9
  862. },
  863. {
  864. label: "大侧*上下压线",
  865. formulakinds: [10],
  866. value: 12
  867. },
  868. {
  869. label: "垫层",
  870. formulakinds: [11, 32, 33],
  871. value: 6
  872. },
  873. {
  874. label: "顶布",
  875. formulakinds: [12],
  876. value: 3
  877. },
  878. {
  879. label: "毡类",
  880. formulakinds: [13],
  881. value: 7
  882. },
  883. {
  884. label: "打底无纺布",
  885. formulakinds: [14],
  886. value: 2
  887. },
  888. {
  889. label: "辅料",
  890. formulakinds: [15],
  891. value: 8
  892. },
  893. {
  894. label: "PE",
  895. formulakinds: [16],
  896. value: 16
  897. },
  898. {
  899. label: "外层PE",
  900. formulakinds: [17],
  901. value: 17
  902. },
  903. {
  904. label: "PVC",
  905. formulakinds: [18],
  906. value: 18
  907. },
  908. {
  909. label: "卷包包装",
  910. formulakinds: [19],
  911. value: 19
  912. },
  913. {
  914. label: "牛皮纸袋",
  915. formulakinds: [20],
  916. value: 20
  917. },
  918. {
  919. label: "蓝色PE护角",
  920. formulakinds: [21],
  921. value: 21
  922. },
  923. {
  924. label: "无纺布袋",
  925. formulakinds: [22],
  926. value: 22
  927. },
  928. {
  929. label: "牛皮袋护角",
  930. formulakinds: [23],
  931. value: 23
  932. },
  933. {
  934. label: "编织袋",
  935. formulakinds: [24],
  936. value: 24
  937. },
  938. {
  939. label: "外袋",
  940. formulakinds: [25],
  941. value: 13
  942. },
  943. {
  944. label: "内袋",
  945. formulakinds: [26],
  946. value: 14
  947. },
  948. {
  949. label: "无拉手脚轮",
  950. formulakinds: [27],
  951. value: -1
  952. },
  953. {
  954. label: "拉钮",
  955. formulakinds: [28],
  956. value: -1
  957. },
  958. {
  959. label: "网面布料",
  960. formulakinds: [29],
  961. value: -1
  962. },
  963. {
  964. label: "防火线",
  965. formulakinds: [30],
  966. value: -1
  967. },
  968. {
  969. label: "木托",
  970. formulakinds: [31],
  971. value: -1
  972. },
  973. {
  974. label: "床网",
  975. formulakinds: [99],
  976. value: -1
  977. },
  978. {
  979. label: "拉链",
  980. formulakinds: [202],
  981. value: 31
  982. },
  983. {
  984. label: "边带",
  985. formulakinds: [203],
  986. value: 9
  987. }
  988. ];
  989. const { userInfo } = useUserStore();
  990. state.orderStatus = inject("orderStatus", "");
  991. const getData_mx = (params: any) => {
  992. console.log("getData params :>> ", params);
  993. let newParams: any = {};
  994. params.pageNum && (newParams.pageindex = params.pageNum);
  995. params.pageSize && (newParams.pagesize = params.pageSize);
  996. delete params.pageNum;
  997. delete params.pageSize;
  998. newParams.queryParams = params;
  999. console.log("params :>> ", params);
  1000. newParams.dsname = "web_mattress_mx";
  1001. return CommonDynamicSelect(newParams, DwnameEnum.mattressQuoteMx);
  1002. // return [];
  1003. };
  1004. const dataCallback = (data: any) => {
  1005. console.log("dataCallback data :>> ", data);
  1006. if (data.datatable.length > 0) {
  1007. data.datatable = data.datatable.map((item: any) => {
  1008. item.dannum_rate = Number(item.dannum_rate);
  1009. // item.if_w_butao = Boolean(Number(item.if_w_butao));
  1010. return item;
  1011. });
  1012. }
  1013. return {
  1014. list: data.datatable,
  1015. tableinfo: data.tableinfo,
  1016. total: data.totalcnt,
  1017. pageNum: data.pageindex,
  1018. pageSize: data.pagesize
  1019. };
  1020. };
  1021. const dataCallbackMx = (data: any) => {
  1022. console.log("dataCallback data :>> ", data);
  1023. return {
  1024. list: data.datatable,
  1025. tableinfo: data.tableinfo,
  1026. total: data.totalcnt,
  1027. pageNum: data.pageindex,
  1028. pageSize: data.pagesize
  1029. };
  1030. };
  1031. const funcTaxrateChange = async (val: any, data) => {
  1032. data.taxrate = val;
  1033. };
  1034. /**
  1035. * @description 弹窗模块:床网选择
  1036. * @param data 当前数据
  1037. * @param status 当前订单状态
  1038. * @returns Promise
  1039. */
  1040. const fModelChoseBednet = (data: any, params: any, $table?: any) => {
  1041. return new Promise((resolve, reject) => {
  1042. // if (!ALLOW_EDIT_STATE.includes(status)) return;
  1043. let _params = {
  1044. ...params,
  1045. keyword: ""
  1046. };
  1047. state.BednetDialogProps = {
  1048. onSubmit: (res: any) => {
  1049. // submit
  1050. console.log("openCustDialog res", res);
  1051. nextTick(() => {
  1052. rModelSetBednet(data, res.value[0], $table);
  1053. resolve(1);
  1054. });
  1055. },
  1056. onCancel: (error: any) => {
  1057. // cancel 回调
  1058. console.log("openCustDialog error", error);
  1059. }
  1060. };
  1061. state.BednetDialogRef.show(_params);
  1062. });
  1063. };
  1064. /**
  1065. * @description 在床网tab,更新垫层的床网厚度信息
  1066. * @param data 床网订单信息
  1067. * @param item 床网信息
  1068. * @param action 动作,add,set,del,clear
  1069. */
  1070. const wf_rtr_cwdc = (data: any, item: any, action: string) => {
  1071. const $table = state.cushionsMxRef.element;
  1072. let { visibleData } = $table.getTableData();
  1073. console.log("wf_rtr_cwdc data :>> ", data, visibleData, item);
  1074. // fullData.map(item => {
  1075. // if (Number(item.formulakind) == 999 && Number(item.thickness) == 0) {
  1076. // $table.setRow(item, {
  1077. // thickness: data.bednet_height,
  1078. // qty: 1
  1079. // });
  1080. // }
  1081. // });
  1082. const $tableBednet = state.bednetMxRef.element;
  1083. let currentBednetIndex = $tableBednet.getRowSeq(data);
  1084. if (action == "add") {
  1085. let records = cloneDeep(visibleData.find(o => o.formulakind == 999));
  1086. records.thickness = 0;
  1087. records.qty = 0;
  1088. records._X_ROW_KEY = "";
  1089. records.mattressmxid = 0;
  1090. if (item) {
  1091. records.thickness = item?.bednet_height;
  1092. records.qty = 1;
  1093. }
  1094. let bednetList = visibleData.filter(o => Number(o.formulakind) == 999);
  1095. let lastIndex = $table.getRowSeq(bednetList[bednetList.length - 1]);
  1096. console.log("wf_rtr_cwdc lastIndex :>> ", bednetList, lastIndex, records);
  1097. $table.insertAt(records, lastIndex);
  1098. } else {
  1099. console.log("wf_rtr_cwdc currentBednetIndex :>> ", action, currentBednetIndex);
  1100. let index = 1;
  1101. visibleData.map(o => {
  1102. if (Number(o.formulakind) == 999) {
  1103. if (index == currentBednetIndex) {
  1104. if (action == "set") {
  1105. $table.setRow(o, {
  1106. thickness: item?.bednet_height,
  1107. qty: 1
  1108. });
  1109. } else if (action == "clear") {
  1110. $table.setRow(o, {
  1111. thickness: 0,
  1112. qty: 0
  1113. });
  1114. } else if (action == "del") {
  1115. $table.remove(o);
  1116. }
  1117. }
  1118. index++;
  1119. }
  1120. });
  1121. }
  1122. };
  1123. /**
  1124. * @description 更新床网tab的垫层床网信息
  1125. * @param data 床网订单信息
  1126. */
  1127. const wf_rtr_bednet = (data: any, item: any, action: string) => {
  1128. console.log("wf_rtr_cwdc data :>> ", data);
  1129. const $table = state.cushionsMxRef.element;
  1130. let { fullData } = $table.getTableData();
  1131. // fullData.map(item => {
  1132. // if (Number(item.formulakind) == 999 && Number(item.thickness) == 0) {
  1133. // $table.setRow(item, {
  1134. // thickness: data.bednet_height,
  1135. // qty: 1
  1136. // });
  1137. // }
  1138. // });
  1139. // const $tableBednet = state.bednetMxRef.element;
  1140. // let { fullData: bednetFullData } = $tableBednet.getTableData();
  1141. // let currentBednetIndex = $tableBednet.getRowSeq(data);
  1142. // if (action == "add") {
  1143. // let records = cloneDeep(fullData.find(o => o.formulakind == 999));
  1144. // records.thickness = 0;
  1145. // records.qty = 0;
  1146. // records._X_ROW_KEY = "";
  1147. // let bednetList = fullData.filter(o => Number(o.formulakind) == 999);
  1148. // let lastIndex = bednetList[bednetList.length - 1];
  1149. // console.log("wf_rtr_cwdc lastIndex :>> ", bednetList, lastIndex, records);
  1150. // $tableBednet.insertAt(records, lastIndex);
  1151. // } else {
  1152. // console.log("wf_rtr_cwdc currentBednetIndex :>> ", action, currentBednetIndex);
  1153. // let index = 1;
  1154. // fullData.map(o => {
  1155. // if (Number(o.formulakind) == 999) {
  1156. // if (index == currentBednetIndex) {
  1157. // if (action == "set") {
  1158. // $table.setRow(o, {
  1159. // thickness: item?.bednet_height,
  1160. // qty: 1
  1161. // });
  1162. // } else if (action == "clear") {
  1163. // $table.setRow(o, {
  1164. // thickness: 0,
  1165. // qty: 0
  1166. // });
  1167. // } else if (action == "del") {
  1168. // // $table.setRow(o, {
  1169. // // thickness: 0,
  1170. // // qty: 0
  1171. // // });
  1172. // $table.remove(o);
  1173. // }
  1174. // }
  1175. // index++;
  1176. // }
  1177. // });
  1178. // }
  1179. };
  1180. /**
  1181. * @description 垫层tab,公式名选择,联动增删床网tab
  1182. * @param val
  1183. * @param lastVal
  1184. * @param scope
  1185. */
  1186. const cushionsFormulaKindChange = (val: any, lastVal: any, scope: any) => {
  1187. console.log("wf_rtr_cwdc cushionsFormulaKindChange val :>> ", val, lastVal, scope);
  1188. const $table = state.cushionsMxRef.element;
  1189. const $table_bednet = state.bednetMxRef.element;
  1190. const { visibleData } = $table.getTableData();
  1191. if (Number(val) === 999 && Number(lastVal) !== 999) {
  1192. // 新增
  1193. if ($table_bednet) {
  1194. const { visibleData: visibleData_bednet } = $table_bednet.getTableData();
  1195. let curIndex = visibleData_bednet.length - 1;
  1196. // 寻找垫层当前位置,对上一个床网行位置进行复制
  1197. let arr = visibleData.filter((t, i) => t.formulakind == 999 && i < scope.$rowIndex);
  1198. if (arr.length > 0) {
  1199. curIndex = arr.length - 1;
  1200. }
  1201. console.log("wf_rtr_cwdc curIndex :>> ", curIndex);
  1202. rModelClearMtrl(scope.row);
  1203. funcAddMtrlMx({ row: visibleData_bednet[curIndex] }, null, "bednetMxRef", arr.length == 0);
  1204. }
  1205. } else if (Number(val) !== 999 && Number(lastVal) === 999) {
  1206. // 删除
  1207. if ($table_bednet) {
  1208. const { visibleData: visibleData_bednet } = $table_bednet.getTableData();
  1209. let curIndex = visibleData_bednet.length - 1;
  1210. curIndex = visibleData
  1211. .filter(t => t.formulakind == 999 || t._X_ROW_KEY === scope.row._X_ROW_KEY)
  1212. .findIndex(t => t._X_ROW_KEY === scope.row._X_ROW_KEY);
  1213. console.log("wf_rtr_cwdc curIndex :>> ", curIndex);
  1214. if (visibleData_bednet.length == 1) {
  1215. ElMessage.warning("不能全部删除,至少保留一个床网");
  1216. scope.row.formulakind = 999;
  1217. return false;
  1218. }
  1219. rModelClearMtrl(scope.row);
  1220. funcDelBednet({ row: visibleData_bednet[curIndex], data: visibleData_bednet }, null, "bednetMxRef");
  1221. }
  1222. } else {
  1223. rModelClearMtrl(scope.row);
  1224. }
  1225. };
  1226. const rModelSetBednet = (data: any, item: any, $table?: any) => {
  1227. console.log("rModelSetBednet data :>> ", data, item);
  1228. if (item) {
  1229. let _mtrlname =
  1230. item.typename +
  1231. " " +
  1232. item.bednetcode +
  1233. " " +
  1234. item.mattress_width +
  1235. "*" +
  1236. item.mattress_length +
  1237. "*" +
  1238. item.mattress_height;
  1239. data.mtrlid = item.bednetid;
  1240. data.mtrlname = _mtrlname;
  1241. // data.price = item.nottax_factory_cost;
  1242. data.price = item.total_cost;
  1243. data.qty = 1;
  1244. wf_rtr_cwdc(data, item, "set");
  1245. if ($table) {
  1246. $table.clearEdit();
  1247. nextTick(() => {
  1248. $table.setActiveRow(data);
  1249. });
  1250. }
  1251. }
  1252. };
  1253. const rModelClearBednet = (data: any, $table?: any) => {
  1254. console.log("rModelSetBednet data :>> ", data);
  1255. data.mtrlid = 0;
  1256. data.mtrlname = "";
  1257. data.price = 0;
  1258. wf_rtr_cwdc(data, null, "clear");
  1259. if ($table) {
  1260. $table.clearEdit();
  1261. }
  1262. };
  1263. /**
  1264. * @description 弹窗模块:物料选择
  1265. * @param data 当前数据
  1266. * @param status 当前订单状态
  1267. * @returns Promise
  1268. */
  1269. const fModelChoseMtrl = (data: any, params: any, cb: any, label?: string, $table?: any) => {
  1270. return new Promise((resolve, reject) => {
  1271. // if (!ALLOW_EDIT_STATE.includes(status)) return;
  1272. let _params = {
  1273. keyword: "",
  1274. arg_mtrltype: params.mtrltype,
  1275. arg_pricelistid: params.pricelistid
  1276. };
  1277. state.MtrldefDialogProps = {
  1278. onSubmit: (res: any) => {
  1279. // submit
  1280. console.log("openCustDialog res", res);
  1281. nextTick(() => {
  1282. cb(data, res.value[0], $table);
  1283. resolve(1);
  1284. });
  1285. },
  1286. onCancel: (error: any) => {
  1287. // cancel 回调
  1288. console.log("openCustDialog error", error);
  1289. }
  1290. };
  1291. state.MtrldefDialogRef.show(_params, label);
  1292. });
  1293. };
  1294. /**
  1295. * @description 数据赋值:物料信息
  1296. * @param data 当前数据
  1297. * @param item 当前选择的数据
  1298. */
  1299. const rModelSetMtrl = (data: any, item: any, $table?: any) => {
  1300. console.log("rModelSetMtrl data :>> ", data);
  1301. console.log("rModelSetMtrl item :>> ", item);
  1302. if (item) {
  1303. data.mattressid = state.LjDetailRef._mainData.mattressid;
  1304. data.mattressmxid = 0;
  1305. data.mtrlid = item.mtrlid;
  1306. data.price = item.pricelistprice;
  1307. data.gram_weight = item.gram_weight;
  1308. data.cloth_width = item.cloth_width;
  1309. data.if_inputqty = Number(item.if_inputqty);
  1310. data.if_areaprice = item.if_areaprice;
  1311. data.mtrlname = item.mtrlname;
  1312. data.priceunit = item.priceunit;
  1313. data.shrinkage = item.price; // 收缩率
  1314. data.thickness = Number(item.thickness);
  1315. data.price_formula = item.price_formula;
  1316. let _qty = 1;
  1317. if (data.formulakind == 5) {
  1318. //默认4个拉手
  1319. _qty = 4;
  1320. } else if ([7, 8, 9, 202].includes(data.formulakind)) {
  1321. // 拉手刺绣及其他工艺,大侧压压布、拉链等自动带出数量=周长
  1322. let mattress_width = state.LjDetailRef._mainData.mattress_width ?? 0;
  1323. let mattress_length = state.LjDetailRef._mainData.mattress_length ?? 0;
  1324. _qty = (mattress_width / 100 + mattress_length / 100) * 2;
  1325. }
  1326. data.qty = _qty;
  1327. // cb && cb();
  1328. if ($table) {
  1329. $table.clearEdit();
  1330. nextTick(() => {
  1331. $table.setActiveRow(data);
  1332. });
  1333. }
  1334. }
  1335. };
  1336. const rModelClearMtrl = (data: any, $table?: any) => {
  1337. console.log("rModelClearMtrl data :>> ", data);
  1338. data.mattressid = state.LjDetailRef._mainData.mattressid;
  1339. data.mattressmxid = 0;
  1340. data.mtrlid = 0;
  1341. data.price = 0;
  1342. data.gram_weight = 0;
  1343. data.cloth_width = 0;
  1344. data.if_inputqty = 0;
  1345. data.if_areaprice = 0;
  1346. data.mtrlname = "";
  1347. data.priceunit = "";
  1348. data.shrinkage = 0;
  1349. data.thickness = 0;
  1350. data.price_formula = "";
  1351. data.qty = "";
  1352. if ($table) {
  1353. $table.clearEdit();
  1354. }
  1355. };
  1356. /**
  1357. * @description 数据赋值:物料信息
  1358. * @param data 当前数据
  1359. * @param item 当前选择的数据
  1360. */
  1361. const rModelSetMtrlInner = (data: any, item: any, $table?: any) => {
  1362. console.log("rModelSetMtrl data :>> ", data);
  1363. console.log("rModelSetMtrl item :>> ", item);
  1364. if (item) {
  1365. data.mattressid = state.LjDetailRef._mainData.mattressid;
  1366. data.mattressmxid = 0;
  1367. data.mtrlid = item.mtrlid;
  1368. data.price = item.pricelistprice;
  1369. data.gram_weight = item.gram_weight;
  1370. data.cloth_width = item.cloth_width;
  1371. data.if_inputqty = Number(item.if_inputqty);
  1372. data.if_areaprice = item.if_areaprice;
  1373. data.mtrlname = item.mtrlname;
  1374. data.priceunit = item.priceunit;
  1375. data.shrinkage = item.price; // 收缩率
  1376. Number(item?.thickness) > 0 && (data.thickness = item.thickness);
  1377. item?.price_formula != "" && (data.price_formula = item.price_formula);
  1378. let _qty = 1;
  1379. if (data.formulakind == 5) {
  1380. //默认4个拉手
  1381. _qty = 4;
  1382. } else if ([7, 8, 9, 30, 202, 203].includes(data.formulakind)) {
  1383. // 拉手刺绣及其他工艺,大侧压压布7、大侧压边带8、大侧压织带9、防火线30、拉链202、内布套围边边带203,自动带出数量=周长
  1384. let mattress_width = state.LjDetailRef._mainData.mattress_width ?? 0;
  1385. let mattress_length = state.LjDetailRef._mainData.mattress_length ?? 0;
  1386. _qty = (mattress_width / 100 + mattress_length / 100) * 2;
  1387. }
  1388. data.qty = _qty;
  1389. if ($table) {
  1390. $table.clearEdit();
  1391. nextTick(() => {
  1392. $table.setActiveRow(data);
  1393. });
  1394. }
  1395. }
  1396. };
  1397. /**
  1398. * @description 面料-裥大、小侧,增加物料
  1399. */
  1400. const funcAddMxSide = async (params: any, data: any, targetRef?: any) => {
  1401. // arg_array_formulakind
  1402. let newParams: any = {};
  1403. newParams.queryParams = params;
  1404. newParams.dsname = "web_mattress_formulalist";
  1405. let res = await CommonDynamicSelect(newParams);
  1406. console.log("funcAddBigSide res :>> ", res);
  1407. if (res.datatable) {
  1408. if (targetRef) {
  1409. const $table = targetRef.element;
  1410. if ($table) {
  1411. res.datatable.map(itm => {
  1412. let records: any = {
  1413. formulatype: itm.formulatype,
  1414. if_mtrl: Number(itm.if_mtrl),
  1415. formulaid: itm.formulaid,
  1416. sortcode: data.label,
  1417. chastr: data.label,
  1418. costamt: 0,
  1419. formulakind: Number(itm.formulakind),
  1420. formula: itm.formula,
  1421. useformula: itm.useformula,
  1422. gydscrp: itm.gydscrp
  1423. };
  1424. if (records.if_mtrl > 1) {
  1425. records.addmx = "+";
  1426. records.delmx = "-";
  1427. }
  1428. $table.insertAt(records, -1);
  1429. });
  1430. }
  1431. } else {
  1432. let arr = [];
  1433. res.datatable.map(itm => {
  1434. let records: any = {
  1435. formulatype: itm.formulatype,
  1436. if_mtrl: Number(itm.if_mtrl),
  1437. formulaid: itm.formulaid,
  1438. sortcode: data.label,
  1439. chastr: data.label,
  1440. costamt: 0,
  1441. formulakind: Number(itm.formulakind),
  1442. formula: itm.formula,
  1443. useformula: itm.useformula,
  1444. gydscrp: itm.gydscrp
  1445. };
  1446. if (records.if_mtrl > 1) {
  1447. records.addmx = "+";
  1448. records.delmx = "-";
  1449. }
  1450. arr.push(records);
  1451. });
  1452. return arr;
  1453. }
  1454. } else {
  1455. return [];
  1456. }
  1457. };
  1458. const wf_mtrl_find = async (params: any) => {
  1459. let _params: any = {
  1460. dsname: "web_mtrl_choose",
  1461. queryparams: params
  1462. };
  1463. let res = await CommonDynamicSelect(_params);
  1464. if (res?.datatable?.length) {
  1465. return res?.datatable;
  1466. } else {
  1467. return [];
  1468. }
  1469. };
  1470. // /**
  1471. // * @description 垫层配置 和 垫层可选项
  1472. // * @author w_mattress_add wf_add_dianceng_bytype
  1473. // */
  1474. // const wf_add_dianceng_bytype = (dianceng_sort: string) => {
  1475. // let newMxData = [];
  1476. // let _diancengSortStr = dianceng_sort.replace(/,/g, ",").replace(/~r~n/g, "").replace(/~r/g, "").replace(/~n/g, "");
  1477. // let arr = _diancengSortStr.split("/");
  1478. // let formulakindArr = [];
  1479. // arr.map(async (t, index) => {
  1480. // let result = f_pb_split(t);
  1481. // let _formulakind;
  1482. // switch (result.left) {
  1483. // case "垫层":
  1484. // _formulakind = 32;
  1485. // break;
  1486. // case "床网":
  1487. // _formulakind = 999;
  1488. // break;
  1489. // case "顶布":
  1490. // _formulakind = 12;
  1491. // break;
  1492. // case "毡类":
  1493. // _formulakind = 13;
  1494. // break;
  1495. // case "打底无纺布":
  1496. // _formulakind = 14;
  1497. // break;
  1498. // case "网面布料":
  1499. // _formulakind = 29;
  1500. // break;
  1501. // default:
  1502. // _formulakind = -1;
  1503. // break;
  1504. // }
  1505. // let _params = {
  1506. // dsname: "web_mattress_formulalist",
  1507. // queryparams: {
  1508. // arg_array_formulakind: [_formulakind],
  1509. // arg_array_formulatype: [0, 1, 2, 3],
  1510. // pageindex: 1,
  1511. // pagesize: 1
  1512. // }
  1513. // };
  1514. // let res = await CommonDynamicSelect(_params);
  1515. // if (res?.datatable?.length) {
  1516. // res?.datatable.map((item: any) => {
  1517. // let _data: any = {};
  1518. // _data.formulatype = item.formulatype;
  1519. // _data.if_mtrl = 2;
  1520. // _data.formulaid = item.formulaid;
  1521. // _data.sortcode = item.sortcode;
  1522. // _data.formulakind = item.formulakind;
  1523. // _data.formula = item.formula;
  1524. // _data.chastr = wf_set_area_text(result.right);
  1525. // _data.qty = 1;
  1526. // _data.xu = index;
  1527. // _data.useformula = item.useformula;
  1528. // _data.gydscrp = item.gydscrp;
  1529. // newMxData.push(_data);
  1530. // });
  1531. // }
  1532. // });
  1533. // };
  1534. // const wf_add_dianceng_area_bytype = (data: string) => {
  1535. // if (!data) return;
  1536. // let _dataStr = data.replace(/,/g, ",").replace(/~r~n/g, "").replace(/~r/g, "").replace(/~n/g, "");
  1537. // let result: any = _dataStr.split(",");
  1538. // result = result.map(t => {
  1539. // return { value: t, label: t };
  1540. // });
  1541. // return result;
  1542. // };
  1543. // function wf_set_area_text(arg_str) {
  1544. // let ls_rtn = "";
  1545. // if (arg_str.includes("大侧")) {
  1546. // ls_rtn = "大侧";
  1547. // } else if (arg_str.includes("小侧1")) {
  1548. // ls_rtn = "小侧1";
  1549. // } else if (arg_str.includes("小侧2")) {
  1550. // ls_rtn = "小侧2";
  1551. // } else if (arg_str.includes("小侧3")) {
  1552. // ls_rtn = "小侧3";
  1553. // } else if (arg_str.includes("V侧1")) {
  1554. // ls_rtn = "V侧1";
  1555. // } else if (arg_str.includes("V侧2")) {
  1556. // ls_rtn = "V侧2";
  1557. // } else if (arg_str.includes("V侧3")) {
  1558. // ls_rtn = "V侧3";
  1559. // } else {
  1560. // ls_rtn = "";
  1561. // }
  1562. // return ls_rtn;
  1563. // }
  1564. // /**
  1565. // * @description 包装默认物料设置
  1566. // */
  1567. // const wf_default_mtrlid = async () => {
  1568. // // 包装
  1569. // console.log("wf_default_mtrlid state.packagMxData :>> ", state.packagMxData);
  1570. // let _deptid = state.LjDetailRef._mainData.deptid;
  1571. // let deptEnum = state.LjDetailRef.enumMap.get("deptid");
  1572. // let _pricelistid = 0;
  1573. // console.log("deptEnum :>> ", deptEnum);
  1574. // if (deptEnum) {
  1575. // let depItem = deptEnum.find((item: any) => item.value == _deptid);
  1576. // console.log("depItem :>> ", depItem);
  1577. // if (depItem) {
  1578. // _pricelistid = Number(depItem.pricelistid);
  1579. // }
  1580. // }
  1581. // // 根据formulaid,获取全部设置的默认物料信息
  1582. // let defaultMtrlList = [];
  1583. // let _param_mf = {
  1584. // dsname: "web_mtrl_choose",
  1585. // queryparams: {
  1586. // arg_array_formulaid: [16, 17, 18, 19, 27],
  1587. // arg_pricelistid: _pricelistid,
  1588. // arg_array_mtrlid: [46804, 46809, 46811, 46817, 46872]
  1589. // }
  1590. // };
  1591. // let res_mf = await CommonDynamicSelect(_param_mf);
  1592. // if (res_mf?.datatable?.length) {
  1593. // defaultMtrlList = res_mf?.datatable;
  1594. // }
  1595. // // let _mtrlData = await wf_mtrl_find(_pricelistid, [46804, 46809, 46811, 46817, 46872]);
  1596. // console.log("wf_default_mtrlid ccccc state.packagMxData :>> ", state.packagMxData);
  1597. // state.packagMxData.map(itm => {
  1598. // console.log("packagMxData itm :>> ", itm);
  1599. // let _formulakind = Number(itm.formulakind);
  1600. // let _data = null;
  1601. // if (_formulakind == 16) {
  1602. // //默认 pe kind = 16 默认 10C PE袋 mtrlid 46804
  1603. // itm.mtrlid = 46804;
  1604. // } else if (_formulakind == 17) {
  1605. // //默认 外层pe kind = 17 默认 20C mtrlid 46809
  1606. // itm.mtrlid = 46809;
  1607. // } else if (_formulakind == 18) {
  1608. // //默认 pvc kind = 18 默认 15C mtrlid 46811
  1609. // itm.mtrlid = 46811;
  1610. // } else if (_formulakind == 19) {
  1611. // //默认 卷包外包装 kind = 19 默认 彩箱 32*32 46817
  1612. // itm.mtrlid = 46817;
  1613. // } else if (_formulakind == 27) {
  1614. // //默认 拉手脚轮 kind = 27 默认 46872
  1615. // itm.mtrlid = 46872;
  1616. // }
  1617. // _data = defaultMtrlList.find(t => t.mtrlid == itm.mtrlid);
  1618. // console.log("wf_default_mtrlid _data :>> ", _data);
  1619. // if (_data) {
  1620. // itm.mtrlname = _data.mtrlname;
  1621. // itm.price = _data.pricelistprice;
  1622. // itm.gram_weight = _data.gram_weight;
  1623. // itm.cloth_width = _data.cloth_width;
  1624. // itm.if_inputqty = _data.if_inputqty;
  1625. // itm.priceunit = _data.priceunit;
  1626. // itm.shrinkage = _data.shrinkage;
  1627. // itm.qty = 1;
  1628. // if (_data.formula != "") {
  1629. // itm.formula = _data.formula;
  1630. // }
  1631. // }
  1632. // return itm;
  1633. // });
  1634. // console.log("wf_default_mtrlid state.packagMxData :>> ", state.packagMxData);
  1635. // };
  1636. // const wf_default_mtrlid_notbz = async () => {
  1637. // console.log("state.oriMxData.list bf state.oriMxData.list :>> ", state.oriMxData.list);
  1638. // // 收集数据中各种公式的formulaid
  1639. // let _formulaids = [];
  1640. // state.oriMxData.list.forEach((itm: any) => {
  1641. // _formulaids.push(itm.formulaid);
  1642. // });
  1643. // // 数组去重
  1644. // _formulaids = Array.from(new Set(_formulaids));
  1645. // // 部门设置的报价表
  1646. // let _pricelistid = 0;
  1647. // let _deptid = state.LjDetailRef._mainData.deptid;
  1648. // let deptEnum = state.LjDetailRef.enumMap.get("deptid");
  1649. // console.log("deptEnum :>> ", deptEnum);
  1650. // if (deptEnum) {
  1651. // let depItem = deptEnum.find((item: any) => item.value == _deptid);
  1652. // console.log("depItem :>> ", depItem);
  1653. // if (depItem) {
  1654. // _pricelistid = Number(depItem.pricelistid);
  1655. // }
  1656. // }
  1657. // // 根据formulaid,获取全部设置的默认物料信息
  1658. // let defaultMtrlList = [];
  1659. // let _param_mf = {
  1660. // dsname: "web_mtrl_choose",
  1661. // queryparams: {
  1662. // arg_array_formulaid: _formulaids,
  1663. // arg_pricelistid: _pricelistid,
  1664. // arg_array_mtrlid: [46804, 46809, 46811, 46817, 46872]
  1665. // }
  1666. // };
  1667. // let res_mf = await CommonDynamicSelect(_param_mf);
  1668. // if (res_mf?.datatable?.length) {
  1669. // defaultMtrlList = res_mf?.datatable;
  1670. // }
  1671. // state.oriMxData.list.forEach((itm: any) => {
  1672. // let _formulakind = Number(itm.formulakind);
  1673. // let _data = defaultMtrlList.find(t => t.formulaid == itm.formulaid);
  1674. // console.log("wf_default_mtrlid_notbz 查询默认物料_data :>> ", _data);
  1675. // // 包装default
  1676. // if (itm.formulatype == "3") {
  1677. // let changeMtrl = 0;
  1678. // if (_formulakind == 16) {
  1679. // //默认 pe kind = 16 默认 10C PE袋 mtrlid 46804
  1680. // changeMtrl = 46804;
  1681. // } else if (_formulakind == 17) {
  1682. // //默认 外层pe kind = 17 默认 20C mtrlid 46809
  1683. // changeMtrl = 46809;
  1684. // } else if (_formulakind == 18) {
  1685. // //默认 pvc kind = 18 默认 15C mtrlid 46811
  1686. // changeMtrl = 46811;
  1687. // } else if (_formulakind == 19) {
  1688. // //默认 卷包外包装 kind = 19 默认 彩箱 32*32 46817
  1689. // changeMtrl = 46817;
  1690. // } else if (_formulakind == 27) {
  1691. // //默认 拉手脚轮 kind = 27 默认 46872
  1692. // changeMtrl = 46872;
  1693. // }
  1694. // if (changeMtrl && !_data) {
  1695. // _data = defaultMtrlList.find(t => t.mtrlid == changeMtrl);
  1696. // }
  1697. // }
  1698. // if (_data) {
  1699. // itm.mtrlid = _data.mtrlid;
  1700. // itm.mtrlname = _data.mtrlname;
  1701. // itm.price = _data.pricelistprice;
  1702. // itm.gram_weight = _data.gram_weight;
  1703. // itm.cloth_width = _data.cloth_width;
  1704. // itm.if_inputqty = _data.if_inputqty;
  1705. // itm.priceunit = _data.priceunit;
  1706. // itm.shrinkage = _data.shrinkage;
  1707. // itm.qty = 1;
  1708. // if (_data.formula != "") {
  1709. // itm.formula = _data.formula;
  1710. // }
  1711. // }
  1712. // });
  1713. // console.log("state.oriMxData.list affff state.oriMxData.list :>> ", state.oriMxData.list);
  1714. // };
  1715. /**
  1716. * @description 明细,新增
  1717. */
  1718. const funcAddMtrlMx = async (data: any, cb?: Function, refName?: string, firstRow?: any) => {
  1719. console.log("state.LjDetail. :>> ", state.LjDetailRef);
  1720. console.log("funcAddMtrlMx data :>> ", data);
  1721. let { row, $rowIndex, visibleData } = data;
  1722. let tgRefName = "";
  1723. if (refName) {
  1724. tgRefName = refName;
  1725. } else {
  1726. let { tabsActive } = state.LjDetailRef;
  1727. let _target = tabsActive == "fabricMx" ? state.fabricMxTabs : tabsActive;
  1728. let currentTab = state.fabricMxTabList.find(t => t.name == _target);
  1729. tgRefName = currentTab.ref;
  1730. }
  1731. const $table = state[tgRefName].element;
  1732. if ($table) {
  1733. let records = {};
  1734. if (["specialProcessesMxRef", "additionalCostsMxRef"].includes(tgRefName)) {
  1735. records = {
  1736. addmx: "+",
  1737. delmx: "-",
  1738. mattressid: state.LjDetailRef._mainData.mattressid,
  1739. mattressmxid: 0,
  1740. extraid: row?.extraid ?? 0,
  1741. extramxid: row?.extramxid ?? 0,
  1742. extraname: "",
  1743. price: "",
  1744. qty: 1,
  1745. dscrp: ""
  1746. };
  1747. } else {
  1748. records = {
  1749. addmx: "+",
  1750. delmx: "-",
  1751. mattressmxid: 0,
  1752. formulatype: row.formulatype,
  1753. if_mtrl: row.if_mtrl,
  1754. formulaid: row.formulaid,
  1755. sortcode: row.sortcode,
  1756. formulakind: row.formulakind,
  1757. formula: row.formula,
  1758. thickness: 0,
  1759. mtrlid: 0,
  1760. chastr: row.chastr,
  1761. xu: Number(row.xu) + 0.01
  1762. };
  1763. }
  1764. // null 从第一行插入, row: 从当前行下一行插入
  1765. let _rowIdx = firstRow == -1 ? -1 : firstRow ? null : row;
  1766. console.log("funcAddMtrlMx _rowIdx :>> ", firstRow, firstRow == -1, _rowIdx);
  1767. const { row: newRow } = await $table.insertNextAt(records, _rowIdx);
  1768. await $table.setEditCell(newRow, "mtrlname");
  1769. await $table.setCurrentRow(newRow);
  1770. cb && cb();
  1771. }
  1772. };
  1773. /**
  1774. * @description 明细,删除
  1775. */
  1776. const funcDelMtrlMx = (data: any, refName?: string) => {
  1777. let { row } = data;
  1778. let tgRefName = "";
  1779. if (refName) {
  1780. tgRefName = refName;
  1781. } else {
  1782. let { tabsActive } = state.LjDetailRef;
  1783. let _target = tabsActive == "fabricMx" ? state.fabricMxTabs : tabsActive;
  1784. let currentTab = state.fabricMxTabList.find(t => t.name == _target);
  1785. tgRefName = currentTab.ref;
  1786. }
  1787. const $table = state[tgRefName].element;
  1788. if ($table) {
  1789. $table.remove(row);
  1790. }
  1791. };
  1792. /**
  1793. * @description 明细,删除
  1794. */
  1795. const funcDelBednet = (scope: any, cb?: Function, refName?: string) => {
  1796. console.log("funcDelBednet: ", scope);
  1797. if (scope.data.length == 1) {
  1798. ElMessage.warning("不能全部删除,至少保留一个床网");
  1799. return false;
  1800. }
  1801. cb && cb();
  1802. funcDelMtrlMx(scope, refName);
  1803. };
  1804. /**
  1805. * @description 据字符串'myRef'来获取ref
  1806. * @param name
  1807. * @returns
  1808. */
  1809. const dynamicRef = name => {
  1810. return state[name]; // 获取ref的值
  1811. };
  1812. /**
  1813. * @description 获取当前需要显示的面料明细tabs
  1814. */
  1815. const getMattressType = () => {
  1816. const globalStore = useGlobalStore();
  1817. const { enumMap, _mainData } = state.LjDetailRef;
  1818. console.log("getMattressType enumMap :>> ", enumMap, _mainData, state.LjDetailRef);
  1819. let _enum = enumMap.get("mattresstypeid");
  1820. console.log("_enum :>> ", _enum);
  1821. if (_enum) {
  1822. state.mattresstypeEnum = _enum.find(t => t.value == _mainData.mattresstypeid);
  1823. console.log("mattresstypeEnum :>> ", state.mattresstypeEnum);
  1824. }
  1825. let _dwname = DwnameEnum.mattressQuote + "__fabric";
  1826. let _dftabs = "";
  1827. let _fabricShowList = undefined;
  1828. let itmshow = null;
  1829. if (globalStore?.detailtabs && Object.keys(globalStore?.detailtabs).includes(_dwname)) {
  1830. _dftabs = globalStore?.detailtabs[_dwname];
  1831. }
  1832. if (_dftabs) {
  1833. _fabricShowList = state.fabricMxTabList
  1834. .map(o => Object.keys(o).includes("visible") && o?.visible() && o)
  1835. .find(o => o?.name == _dftabs);
  1836. }
  1837. if (_fabricShowList) {
  1838. itmshow = _fabricShowList;
  1839. } else {
  1840. itmshow = state.fabricMxTabList.find(o => Object.keys(o).includes("visible") && o?.visible() && o);
  1841. }
  1842. state.fabricMxTabs = itmshow.name;
  1843. };
  1844. const funcChaifenTab = () => {
  1845. const { _mainData } = state.LjDetailRef;
  1846. // 面料
  1847. state.fabricMxData = state.oriMxData.list.filter(
  1848. t => t.formulatype == 0 || (Number(_mainData.if_bcp_type) == 1 && t.formulatype == 104)
  1849. );
  1850. console.log("funcChaifenTab fabricMxData :>> ", state.fabricMxData);
  1851. let _mx8 = state.fabricMxTabList.find(t => t.name == "tabpage_8");
  1852. state.fabricMxTab8 = state.fabricMxData.filter(t => _mx8.type.includes(Number(t.formulakind)));
  1853. state.fabricMxTab8.forEach((o, i) => {
  1854. o.xu = i + 1;
  1855. });
  1856. console.log("funcChaifenTab fabricMxTab8 :>> ", state.fabricMxTab8);
  1857. let _mx9 = state.fabricMxTabList.find(t => t.name == "tabpage_9");
  1858. state.fabricMxTab9 = state.fabricMxData.filter(t => _mx9.type.includes(Number(t.formulakind)));
  1859. state.fabricMxTab9.forEach((o, i) => {
  1860. o.xu = i + 1;
  1861. });
  1862. let _mx10 = state.fabricMxTabList.find(t => t.name == "tabpage_10");
  1863. state.fabricMxTab10 = state.fabricMxData.filter(t => _mx10.type.includes(Number(t.formulakind)));
  1864. state.fabricMxTab10.forEach((o, i) => {
  1865. o.xu = i + 1;
  1866. });
  1867. let _mx11 = state.fabricMxTabList.find(t => t.name == "tabpage_11");
  1868. state.fabricMxTab11 = state.fabricMxData.filter(t => _mx11.type.includes(Number(t.formulakind)));
  1869. state.fabricMxTab11.forEach((o, i) => {
  1870. o.xu = i + 1;
  1871. });
  1872. console.log("funcChaifenTab state.fabricMxTab11 :>> ", state.fabricMxTab11);
  1873. let _mx12 = state.fabricMxTabList.find(t => t.name == "tabpage_12");
  1874. state.fabricMxTab12 = state.fabricMxData.filter(t => _mx12.type.includes(Number(t.formulakind)));
  1875. state.fabricMxTab12.forEach((o, i) => {
  1876. o.xu = i + 1;
  1877. });
  1878. let _mx13 = state.fabricMxTabList.find(t => t.name == "tabpage_13");
  1879. state.fabricMxTab13 = state.fabricMxData.filter(t => !_mx13.type.includes(Number(t.formulakind)));
  1880. state.fabricMxTab13.forEach((o, i) => {
  1881. o.xu = i + 1;
  1882. });
  1883. // 垫层
  1884. state.cushionsMxData = state.oriMxData.list.filter(t => t.formulatype == 1);
  1885. state.cushionsMxData.forEach((o, i) => {
  1886. o.xu = i + 1;
  1887. });
  1888. // 辅料
  1889. state.accessoriesMxData = state.oriMxData.list.filter(t => t.formulatype == 2);
  1890. state.accessoriesMxData.forEach((o, i) => {
  1891. o.xu = i + 1;
  1892. });
  1893. // 包装
  1894. state.packagMxData = state.oriMxData.list.filter(t => t.formulatype == 3);
  1895. state.packagMxData.forEach((o, i) => {
  1896. o.xu = i + 1;
  1897. });
  1898. // 床网
  1899. state.bednetMxData = state.oriMxData.list.filter(t => t.formulatype == 99);
  1900. state.bednetMxData.forEach((o, i) => {
  1901. o.xu = i + 1;
  1902. });
  1903. };
  1904. /**
  1905. * @description 切换包装方式select,获取默认物料
  1906. * @param val
  1907. */
  1908. const funcPacktypeChange = async (val: any) => {
  1909. console.log("wf_import_bz val :>> ", val);
  1910. let newMxData: any = [];
  1911. const { _mainData, enumMap } = state.LjDetailRef;
  1912. if (val == "0") {
  1913. _mainData.diameter = 0;
  1914. } else if (val == "1") {
  1915. _mainData.packqty = 0;
  1916. } else {
  1917. _mainData.diameter = 0;
  1918. _mainData.packqty = 0;
  1919. }
  1920. let _pricelistid = getPriceid();
  1921. let _params = {
  1922. mattresstypeid: _mainData.mattresstypeid,
  1923. ifbcptype: _mainData.if_bcp_type,
  1924. packtype: _mainData.packtype,
  1925. pricelistid: _pricelistid
  1926. };
  1927. let res = await GetMattressPackagMx(_params);
  1928. if (res) {
  1929. newMxData = res.mattressMx;
  1930. _mainData.biandai_qty = res?.biandai_qty;
  1931. state.diancengAreaEnum = res?.diancengarea;
  1932. }
  1933. state.packagMxData = newMxData;
  1934. };
  1935. /**
  1936. * @description 重新获取明细数据
  1937. * @author w_mattress_add wf_import_dw_2
  1938. */
  1939. const wf_import_dw_2 = async () => {
  1940. // let _biandaiqty = 0;
  1941. let newMxData: any = [];
  1942. /**
  1943. * @description 床垫类别参数
  1944. */
  1945. let mattressTypeData: any = {};
  1946. const { _mainData, enumMap } = state.LjDetailRef;
  1947. let _pricelistid = getPriceid();
  1948. let _params = {
  1949. mattressid: Number(_mainData.mattressid),
  1950. mattresstypeid: _mainData.mattresstypeid,
  1951. ifbcptype: _mainData.if_bcp_type,
  1952. packtype: _mainData.packtype,
  1953. pricelistid: _pricelistid
  1954. };
  1955. let res = await GetMattressImportDW2(_params);
  1956. if (res) {
  1957. newMxData = res.mattressMx;
  1958. _mainData.biandai_qty = res?.biandai_qty;
  1959. state.diancengAreaEnum = res?.diancengarea;
  1960. state.specialProcessesMxData = res?.extraEnum.filter(t => t.typeid == 1);
  1961. state.additionalCostsMxData = res?.extraEnum.filter(t => t.typeid == 2);
  1962. state.specialProcessesEnum = res?.extraTypeEnum.filter(t => t.typeid == 1);
  1963. state.additionalCostsEnum = res?.extraTypeEnum.filter(t => t.typeid == 2);
  1964. state.specialProcessesMxInitData = res?.extraProcessesMx;
  1965. state.additionalCostsMxInitData = res?.extraCostsMx;
  1966. }
  1967. state.oriMxData.list = newMxData;
  1968. getMattressType();
  1969. funcChaifenTab();
  1970. await initExtraData();
  1971. };
  1972. const initExtraData = async () => {
  1973. console.log("initExtraData state.specialProcessesMxInitData :>> ", state.specialProcessesMxInitData);
  1974. console.log("initExtraData state.additionalCostsMxInitData :>> ", state.additionalCostsMxInitData);
  1975. const $tableSpecial = state.specialProcessesMxRef.element;
  1976. const $tableAdditional = state.additionalCostsMxRef.element;
  1977. if ($tableSpecial) {
  1978. $tableSpecial.remove();
  1979. let _arr = [];
  1980. let _mattressId = state.LjDetailRef._mainData.mattressid;
  1981. state.specialProcessesMxInitData.map(o => {
  1982. let _itm = {
  1983. addmx: "+",
  1984. delmx: "-",
  1985. mattressid: _mattressId,
  1986. mattressmxid: 0,
  1987. extraid: o.extraid,
  1988. extraname: o.extraname,
  1989. price: o.price,
  1990. qty: o.qty,
  1991. dscrp: o.dscrp,
  1992. inputtype: o.inputtype,
  1993. typeid: o.typeid
  1994. };
  1995. _arr.push(_itm);
  1996. });
  1997. await $tableSpecial.insertAt(_arr, -1);
  1998. }
  1999. if ($tableAdditional) {
  2000. $tableAdditional.remove();
  2001. let _arr = [];
  2002. let _mattressId = state.LjDetailRef._mainData.mattressid;
  2003. state.additionalCostsMxInitData.map(o => {
  2004. let _itm = {
  2005. addmx: "+",
  2006. delmx: "-",
  2007. mattressid: _mattressId,
  2008. mattressmxid: 0,
  2009. extraid: o.extraid,
  2010. extraname: o.extraname,
  2011. price: o.price,
  2012. qty: o.qty,
  2013. dscrp: o.dscrp,
  2014. inputtype: o.inputtype,
  2015. typeid: o.typeid
  2016. };
  2017. _arr.push(_itm);
  2018. });
  2019. await $tableAdditional.insertAt(_arr, -1);
  2020. }
  2021. };
  2022. /**
  2023. * @description 变更床垫分类时,重载明细数据 dw_1 itemchange
  2024. * @author w_mattress_add dw_1 itemchange
  2025. */
  2026. const funcImportMattressMx = async () => {
  2027. console.log("funcImportMattressMx state.LjDetailRef._mainData :>> ", state.LjDetailRef, state.orderStatus);
  2028. const { _mainData, enumMap, baseformRef } = state.LjDetailRef;
  2029. // let mainData = state.orderStatus == "new" ? initParam : _mainData;
  2030. console.log("mainData :>> ", _mainData);
  2031. if (!Number(_mainData.deptid)) {
  2032. ElMessage.warning("请先选择部门");
  2033. console.log("baseformRef.element :>> ", baseformRef.element);
  2034. baseformRef.element.validateField("deptid");
  2035. _mainData.mattresstypeid = "";
  2036. return;
  2037. }
  2038. let _pricelistid = getPriceid();
  2039. if (!_pricelistid) {
  2040. ElMessage.warning("选择部门未设置价格表,请检查");
  2041. return;
  2042. }
  2043. // if (!_mainData.mattresstypeid) {
  2044. // ElMessage.warning("请先选择床垫类别");
  2045. // return;
  2046. // }
  2047. wf_import_dw_2();
  2048. };
  2049. /**
  2050. * @description 刷新报价清单
  2051. */
  2052. const wf_factory_profitrate = async () => {
  2053. const { _mainData, enumMap } = state.LjDetailRef;
  2054. console.log("wf_factory_profitrate enumMap :>> ", enumMap);
  2055. let _pricelistid = getPriceid();
  2056. let _params = {
  2057. dsname: "web_factory_profitratelist",
  2058. queryparams: {
  2059. arg_deptid: _mainData.deptid,
  2060. arg_bednettypeid_mattresstypeid: _mainData.mattresstypeid,
  2061. kind: 1
  2062. }
  2063. };
  2064. let res = await CommonDynamicSelect(_params);
  2065. if (res?.datatable?.length > 0) {
  2066. _mainData.profitrate = res?.datatable[0].profitrate;
  2067. }
  2068. };
  2069. /**
  2070. * @description 获取部门汇率 和 折扣率
  2071. */
  2072. const wf_get_moneyrate_discount = (val: any, data) => {
  2073. const { _mainData, enumMap } = state.LjDetailRef;
  2074. let deptEnum = enumMap.get("deptid");
  2075. console.log("deptEnum :>> ", deptEnum);
  2076. if (deptEnum) {
  2077. let depItem = deptEnum.find((item: any) => item.value == _mainData.deptid);
  2078. if (depItem) {
  2079. let _moneyrate = !depItem.moneyrate || Number(depItem.moneyrate) == 0 ? 1 : depItem.moneyrate;
  2080. if (val == 0 || !_mainData.if_moneyrate) {
  2081. data.moneyrate = 1;
  2082. } else {
  2083. data.moneyrate = _moneyrate;
  2084. }
  2085. data.discount = depItem.discount;
  2086. }
  2087. }
  2088. };
  2089. /**
  2090. * @description 清除运算结果
  2091. */
  2092. const wf_clear = () => {
  2093. const { _mainData } = state.LjDetailRef;
  2094. _mainData.total_fees_cost = 0;
  2095. _mainData.total_cost = 0;
  2096. _mainData.nottax_factory_cost = 0;
  2097. _mainData.nottax_dept_cost = 0;
  2098. _mainData.taxes = 0;
  2099. _mainData.dept_cost = 0;
  2100. _mainData.foreign_cost = 0;
  2101. _mainData.hrcost = 0;
  2102. _mainData.biandaicost = 0;
  2103. _mainData.fob = 0;
  2104. _mainData.profitrate_point = 0;
  2105. _mainData.butao_point = 0;
  2106. _mainData.chaizhuang_point = 0;
  2107. _mainData.haimian_point = 0;
  2108. state.fabricMxTabList.map(t => {
  2109. if (t.ref && state[t.ref]) {
  2110. console.log("t.ref?.value :>> ", t.ref, state[t.ref]);
  2111. // console.log("state[t.ref].tableData :>> ", state[t.ref].tableData);
  2112. // state[t.ref].tableData.map(item => {
  2113. // item.costamt = 0;
  2114. // item.replace_formula = "";
  2115. // item.if_success = 1;
  2116. // item.thickness = 1;
  2117. // });
  2118. let { fullData } = state[t.ref].element.getTableData();
  2119. state[t.ref].element.setRow(fullData, {
  2120. costamt: 0,
  2121. replace_formula: "",
  2122. if_success: 0
  2123. });
  2124. // console.log("fullData :>> ", fullData);
  2125. // fullData = fullData.map((itm, idx) => {
  2126. // itm.xu = idx + 1;
  2127. // return itm
  2128. // });
  2129. }
  2130. });
  2131. };
  2132. /**
  2133. * @description 更新物料最新 单价等信息
  2134. */
  2135. const wf_cmp_update_mtrl = async () => {
  2136. const { _mainData, enumMap } = state.LjDetailRef;
  2137. let computeList = [
  2138. "tabpage_8",
  2139. "tabpage_9",
  2140. "tabpage_10",
  2141. "tabpage_11",
  2142. "tabpage_12",
  2143. "tabpage_13",
  2144. "cushionsMx",
  2145. "accessoriesMx",
  2146. "packagMx"
  2147. ];
  2148. let arg_array_formulakind = [];
  2149. state.fabricMxTabList.map(t => {
  2150. if (!computeList.includes(t.name)) {
  2151. return;
  2152. }
  2153. if (t.ref && state[t.ref]) {
  2154. let { fullData } = state[t.ref].element.getTableData();
  2155. fullData.map(itm => {
  2156. arg_array_formulakind.push(itm.formulakind);
  2157. });
  2158. }
  2159. });
  2160. // 数组去重
  2161. arg_array_formulakind = Array.from(new Set(arg_array_formulakind));
  2162. let _param = {
  2163. dsname: "web_mattress_formulalist",
  2164. queryparams: {
  2165. arg_array_formulakind: arg_array_formulakind
  2166. }
  2167. };
  2168. let res = await CommonDynamicSelect(_param);
  2169. if (res?.datatable?.length) {
  2170. state.fabricMxTabList.map(t => {
  2171. if (!computeList.includes(t.name)) {
  2172. return;
  2173. }
  2174. if (t.ref && state[t.ref]) {
  2175. let { fullData } = state[t.ref].element.getTableData();
  2176. fullData.map(item => {
  2177. let tFormula = res?.datatable.find(itm => itm.formulakind == item.formulakind);
  2178. state[t.ref].element.setRow(item, {
  2179. formula: tFormula.formula ?? "err",
  2180. useformula: tFormula.useformula ?? "",
  2181. gydscrp: tFormula.gydscrp ?? ""
  2182. });
  2183. });
  2184. }
  2185. });
  2186. }
  2187. //______________________________________________________
  2188. state.fabricMxTabList.map(t => {
  2189. if (!computeList.includes(t.name)) {
  2190. return;
  2191. }
  2192. if (t.ref && state[t.ref]) {
  2193. let { fullData } = state[t.ref].element.getTableData();
  2194. fullData.map(async item => {
  2195. if (item?.mtrlid && Number(item.mtrlid) > 0) {
  2196. let res_mtrls = await wf_mtrl_find({ arg_mtrlid: item.mtrlid, arg_pricelistid: item.pricelistid });
  2197. if (res_mtrls.length > 0) {
  2198. let res_mtrl = res_mtrls[0];
  2199. let _data: any = {
  2200. mtrlname: res_mtrl.mtrlname,
  2201. price: res_mtrl.pricelistprice,
  2202. gram_weight: res_mtrl.gram_weight,
  2203. cloth_width: res_mtrl.cloth_width,
  2204. if_inputqty: res_mtrl.if_inputqty,
  2205. priceunit: res_mtrl.priceunit,
  2206. shrinkage: res_mtrl.shrinkage,
  2207. if_areaprice: res_mtrl.if_areaprice
  2208. };
  2209. if (Number(res_mtrl.if_inputqty) == 1) {
  2210. _data.thickness = res_mtrl.thickness;
  2211. }
  2212. if (!res_mtrl.formula) {
  2213. _data.formula = res_mtrl.formula;
  2214. }
  2215. if (!res_mtrl.qty_formula) {
  2216. _data.useformula = res_mtrl.qty_formula;
  2217. }
  2218. state[t.ref].element.setRow(item, _data);
  2219. }
  2220. }
  2221. });
  2222. }
  2223. });
  2224. };
  2225. /**
  2226. * @description 检查垫层 是否填写正确 并 更新 u_mattress_mx_mtrl_formulaid
  2227. */
  2228. const wf_check_dianceng_ifright = async () => {
  2229. let arg_array_formulakind = [];
  2230. let { fullData: dcData } = state.cushionsMxRef.element.getTableData();
  2231. dcData.map(itm => {
  2232. arg_array_formulakind.push(Number(itm.formulakind));
  2233. });
  2234. // 数组去重
  2235. arg_array_formulakind = Array.from(new Set(arg_array_formulakind));
  2236. let _param = {
  2237. dsname: "web_mattress_formulalist",
  2238. queryparams: {
  2239. arg_array_formulakind: arg_array_formulakind
  2240. }
  2241. };
  2242. let res = await CommonDynamicSelect(_param);
  2243. if (res?.datatable?.length) {
  2244. let { fullData } = state.cushionsMxRef.element.getTableData();
  2245. fullData.map(item => {
  2246. let tFormula = res?.datatable.find(itm => itm.formulakind == item.formulakind);
  2247. state.cushionsMxRef.element.setRow(item, {
  2248. formulaid: tFormula.formulaid
  2249. });
  2250. });
  2251. }
  2252. //检查是否 含有床网
  2253. let lb_flag = arg_array_formulakind.includes(999);
  2254. let lb_re_cmp = false; //批重算
  2255. if (!lb_flag && !lb_re_cmp) {
  2256. // ElMessageBox.confirm("垫层没有包含床网_,是否继续?", "询问", {
  2257. // confirmButtonText: '是',
  2258. // cancelButtonText: "否",
  2259. // type: "warning"
  2260. // })
  2261. // .then(() => {
  2262. // return
  2263. // })
  2264. // .catch((e: TypeError) => {
  2265. // console.log("e :>> ", e);
  2266. ElMessage({
  2267. type: "info",
  2268. message: "垫层没有包含床网_!"
  2269. });
  2270. // });
  2271. }
  2272. };
  2273. // /**
  2274. // * @description 重算床网价格
  2275. // */
  2276. // const wf_cmp_bednet = () => {
  2277. // // bednetMxRef
  2278. // return true;
  2279. // };
  2280. /**
  2281. * @description 公式替换:替换大侧高度
  2282. */
  2283. const wf_replace_height_big_side = (arg_str: string, arg_chastr: string) => {
  2284. if (arg_str.indexOf("【大侧高度】") <= 0) return arg_str;
  2285. // let ls_str = arg_str;
  2286. const { _mainData, enumMap } = state.LjDetailRef;
  2287. let ls_seachstr = "大侧";
  2288. let lde_sum = 0;
  2289. state.cushionsMxRef.element.getTableData().fullData.map(itm => {
  2290. if (itm.chastr.indexOf(ls_seachstr) > 0 && Number(itm.qty) > 0 && Number(itm.thickness) > 0) {
  2291. lde_sum = floatAdd(lde_sum, floatMul(itm.qty, itm.thickness));
  2292. }
  2293. });
  2294. let ls_temp = formatFixedNumber({ val: lde_sum }, 4);
  2295. let ls_formula_big_side = "";
  2296. let mtEnum = enumMap.get("mattresstypeid");
  2297. let _mattresstypeid = _mainData?.mattresstypeid ?? 0;
  2298. console.log("deptEnum :>> ", mtEnum);
  2299. if (mtEnum) {
  2300. let mtItem = mtEnum.find((item: any) => Number(item.value) == _mattresstypeid);
  2301. console.log("wf_replace_height_big_side mtItem :>> ", mtItem);
  2302. ls_formula_big_side = mtItem?.formula_big_side ?? "";
  2303. }
  2304. if (ls_formula_big_side) {
  2305. arg_str = arg_str.replaceAll("【大侧高度】", ` ( ${ls_formula_big_side} ) `);
  2306. }
  2307. if (lde_sum) {
  2308. arg_str = arg_str.replaceAll("【垫层】", ls_temp);
  2309. arg_str = arg_str.replaceAll("【大侧高度】", ls_temp);
  2310. }
  2311. arg_str = arg_str.replaceAll("【位置】", `'${ls_seachstr}'`);
  2312. return arg_str;
  2313. };
  2314. /**
  2315. * @description 公式替换:小侧高度
  2316. */
  2317. const wf_replace_height_small_side = (arg_str: string, arg_chastr: string) => {
  2318. if (arg_str.indexOf("【小侧高度】") <= 0) return arg_str;
  2319. // let ls_str = arg_str;
  2320. const { _mainData, enumMap } = state.LjDetailRef;
  2321. let ls_seachstr = !arg_chastr || arg_chastr == "" ? "小侧1" : arg_chastr;
  2322. let lde_sum = 0;
  2323. state.cushionsMxRef.element.getTableData().fullData.map(itm => {
  2324. if (itm.chastr.indexOf(ls_seachstr) > 0 && Number(itm.qty) > 0 && Number(itm.thickness) > 0) {
  2325. lde_sum = floatAdd(lde_sum, floatMul(itm.qty, itm.thickness));
  2326. }
  2327. });
  2328. let ls_temp = formatFixedNumber({ val: lde_sum }, 4);
  2329. let ls_formula_big_side = "";
  2330. let mtEnum = enumMap.get("mattresstypeid");
  2331. let _mattresstypeid = _mainData?.mattresstypeid ?? 0;
  2332. console.log("deptEnum :>> ", mtEnum);
  2333. if (mtEnum) {
  2334. let mtItem = mtEnum.find((item: any) => Number(item.value) == _mattresstypeid);
  2335. console.log("wf_replace_height_big_side mtItem :>> ", mtItem);
  2336. ls_formula_big_side = mtItem?.formula_big_side ?? "";
  2337. }
  2338. if (ls_formula_big_side) {
  2339. arg_str = arg_str.replaceAll("【小侧高度】", ` ( ${ls_formula_big_side} ) `);
  2340. }
  2341. if (lde_sum) {
  2342. arg_str = arg_str.replaceAll("【垫层】", ls_temp);
  2343. }
  2344. arg_str = arg_str.replaceAll("【位置】", `'${ls_seachstr}'`);
  2345. arg_str = arg_str.replaceAll("【小侧高度】", ls_temp);
  2346. return arg_str;
  2347. };
  2348. /**
  2349. * @description 公式替换:V侧高度
  2350. */
  2351. const wf_replace_height_v_side = (arg_str: string, arg_chastr: string) => {
  2352. if (arg_str.indexOf("【V侧高度】") <= 0) return arg_str;
  2353. // let ls_str = arg_str;
  2354. const { _mainData, enumMap } = state.LjDetailRef;
  2355. let ls_seachstr = !arg_chastr || arg_chastr == "" ? "小侧1" : arg_chastr;
  2356. let lde_sum = 0;
  2357. state.cushionsMxRef.element.getTableData().fullData.map(itm => {
  2358. if (itm.chastr.indexOf(ls_seachstr) > 0 && Number(itm.qty) > 0 && Number(itm.thickness) > 0) {
  2359. lde_sum = floatAdd(lde_sum, floatMul(itm.qty, itm.thickness));
  2360. }
  2361. });
  2362. let ls_temp = formatFixedNumber({ val: lde_sum }, 4);
  2363. let ls_formula_big_side = "";
  2364. let mtEnum = enumMap.get("mattresstypeid");
  2365. let _mattresstypeid = _mainData?.mattresstypeid ?? 0;
  2366. console.log("deptEnum :>> ", mtEnum);
  2367. if (mtEnum) {
  2368. let mtItem = mtEnum.find((item: any) => Number(item.value) == _mattresstypeid);
  2369. console.log("wf_replace_height_big_side mtItem :>> ", mtItem);
  2370. ls_formula_big_side = mtItem?.formula_big_side ?? "";
  2371. }
  2372. if (ls_formula_big_side) {
  2373. arg_str = arg_str.replaceAll("【V侧高度】", ` ( ${ls_formula_big_side} ) `);
  2374. }
  2375. if (lde_sum) {
  2376. arg_str = arg_str.replaceAll("【垫层】", ls_temp);
  2377. }
  2378. arg_str = arg_str.replaceAll("【位置】", `'${ls_seachstr}'`);
  2379. ls_temp = formatFixedNumber({ val: 18 }, 4);
  2380. arg_str = arg_str.replaceAll("【V侧高度】", ls_temp);
  2381. return arg_str;
  2382. };
  2383. /**
  2384. * @description 替换布料幅宽star
  2385. * @returns string
  2386. */
  2387. const wf_replace_cloth_width = (item: any, fullData: any, formulakind: any) => {
  2388. let ls_bl_cloth_width = "";
  2389. // let { fullData: mlData } = state[t.ref].element.getTableData();
  2390. fullData.find(itm => {
  2391. if (!item?.chastr) {
  2392. if (Number(itm.formulakind) == formulakind) {
  2393. ls_bl_cloth_width = formatFixedNumber({ val: itm.cloth_width }, 4);
  2394. return true;
  2395. }
  2396. } else {
  2397. if (Number(itm.formulakind) == formulakind && itm.chastr == item?.chastr) {
  2398. ls_bl_cloth_width = formatFixedNumber({ val: itm.cloth_width }, 4);
  2399. return true;
  2400. }
  2401. }
  2402. });
  2403. // if (Number(ls_bl_cloth_width) > 0) {
  2404. // ls_Expression = ls_Expression.replaceAll('【布料幅宽】', ls_bl_cloth_width);
  2405. // ls_Use_Expression = ls_Use_Expression.replaceAll('【布料幅宽】', ls_bl_cloth_width);
  2406. // }
  2407. return ls_bl_cloth_width;
  2408. };
  2409. /**
  2410. * @description 计算价格
  2411. */
  2412. const wf_cmp_cb = async () => {
  2413. const { _mainData, enumMap, baseformRef } = state.LjDetailRef;
  2414. //wf_paixu 未有
  2415. await wf_factory_profitrate();
  2416. // 佣金
  2417. if (_mainData?.commission == 0 || !_mainData.commission) {
  2418. _mainData.commission = 1;
  2419. }
  2420. if (_mainData?.taxrate == 0 || !_mainData.taxrate) {
  2421. _mainData.taxrate = 1;
  2422. }
  2423. if (_mainData?.other_rate == 0 || !_mainData.other_rate) {
  2424. _mainData.other_rate = 1;
  2425. }
  2426. if (_mainData?.moneyrate == 0 || !_mainData.moneyrate) {
  2427. _mainData.moneyrate = 1;
  2428. }
  2429. if (_mainData?.commission < 1) {
  2430. throw new Error("佣金点数不能小于1");
  2431. }
  2432. if (_mainData?.taxrate < 1) {
  2433. throw new Error("税率不能小于1");
  2434. }
  2435. if (_mainData?.other_rate < 1) {
  2436. throw new Error("额外点数不能小于1");
  2437. }
  2438. if (_mainData?.dept_profitrate == 0) {
  2439. throw new Error("部门利润率不能为0!");
  2440. }
  2441. return true;
  2442. };
  2443. /**
  2444. * @description 展示计算公式
  2445. * @param timeout
  2446. */
  2447. const gotoSummy = async (timeout = 0) => {
  2448. const globalStore = useGlobalStore();
  2449. const { isShowOriginFormulaMattress } = storeToRefs(globalStore);
  2450. state.isShowOriginFormulaMattress = isShowOriginFormulaMattress.value;
  2451. // if (userInfo.usermode == 1) {
  2452. // ElMessage.error("'业务员模式不可以查看计算公式!'");
  2453. // return false;
  2454. // }
  2455. let mattress = state.LjDetailRef._mainData;
  2456. mattress.mattressid = Number(mattress.mattressid ?? 0);
  2457. mattress.xd_flag = Number(mattress.xd_flag ?? 0);
  2458. mattress.js1_flag = Number(mattress.js1_flag ?? 0);
  2459. mattress.flag = Number(mattress.flag ?? 0);
  2460. console.log("bbbbbbbbbbbbbbbbbbbb mattress :>> ", mattress);
  2461. // mattress.if_moneyrate = Number(mattress.if_moneyrate ?? 0);
  2462. // mattress.if_bcp_type = Number(mattress.if_bcp_type ?? 0);
  2463. // mattress.if_d_chai = Number(mattress.if_d_chai ?? 0);
  2464. // mattress.if_m_chai = Number(mattress.if_m_chai ?? 0);
  2465. // mattress.if_m_wbutao_way = Number(mattress.if_m_wbutao_way ?? 0);
  2466. // mattress.if_n_butao = Number(mattress.if_n_butao ?? 0);
  2467. // mattress.if_w_butao = Number(mattress.if_w_butao ?? 0);
  2468. // mattress.if_z_chai = Number(mattress.if_z_chai ?? 0);
  2469. // mattress.if_zhedie_type = Number(mattress.if_zhedie_type ?? 0);
  2470. let mattressMx = [];
  2471. state.fabricMxTabList.map(t => {
  2472. if (t.ref) {
  2473. console.log("t.ref?.value :>> ", t.ref, dynamicRef(t.ref));
  2474. if (dynamicRef(t.ref)) {
  2475. let { fullData } = dynamicRef(t.ref)?.element.getTableData();
  2476. console.log("fullData :>> ", fullData);
  2477. fullData = fullData.map((itm, idx) => {
  2478. itm.xu = idx + 1;
  2479. return itm;
  2480. });
  2481. mattressMx = mattressMx.concat(fullData);
  2482. }
  2483. }
  2484. });
  2485. let _params = {
  2486. mattress,
  2487. mattressMx,
  2488. check_original: Number(state.isShowOriginFormulaMattress)
  2489. };
  2490. let res = await GetComputeMattress(_params);
  2491. console.log("GetComputeBednet res :>> ", res);
  2492. // let summaryData = [];
  2493. // let fieldParams = [];
  2494. let cpData = {};
  2495. if (!res.message) {
  2496. // summaryData = res.formulas;
  2497. // fieldParams = res.replace;
  2498. state.cmpFormulas = res.formulas;
  2499. state.cmpFormulaReplace = res.replace;
  2500. // state.
  2501. state.cmpFormulasOri = res.formulas_origin ?? [];
  2502. state.cmpFormulasBednet = res.formulas_bednet ?? [];
  2503. state.cmpDiffer = res.differ;
  2504. } else {
  2505. setTimeout(() => {
  2506. if (res.message) {
  2507. ElNotification({
  2508. title: "计算失败",
  2509. message: res.message,
  2510. type: "warning"
  2511. });
  2512. }
  2513. }, 100);
  2514. return false;
  2515. }
  2516. // console.log("LjDetailRef.value.mainData :>> ", LjDetailRef.value._mainData, summaryData.value);
  2517. // const { _mainData, enumMap, baseformRef } = state.LjDetailRef;
  2518. // const toast = useToast();
  2519. // let result = await calculateFormula(summaryData.value, fieldParams.value, _mainData);
  2520. // if (result.length) {
  2521. // let _data = cloneDeep(_mainData);
  2522. // result.map((t, i) => {
  2523. // _data[t.field] = t.value;
  2524. // });
  2525. // result.map((t, i) => {
  2526. // _mainData[t.field] = t.value;
  2527. // });
  2528. // console.log("_data :>> ", _mainData, result);
  2529. // toast.clear();
  2530. // toast(
  2531. // {
  2532. // component: ToastFormula,
  2533. // props: {
  2534. // t: t,
  2535. // formulas: summaryData,
  2536. // // data: cpData,
  2537. // fields: fieldParams
  2538. // },
  2539. // listeners: {
  2540. // tomore: () => {
  2541. // console.log("tomore summaryData :>> ", summaryData);
  2542. // state.AllFormulaRef.open(summaryData, fieldParams);
  2543. // toast.clear();
  2544. // },
  2545. // refresh: () => {
  2546. // gotoSummy();
  2547. // }
  2548. // }
  2549. // },
  2550. // {
  2551. // position: POSITION.BOTTOM_RIGHT,
  2552. // icon: false,
  2553. // timeout: timeout,
  2554. // closeButton: false,
  2555. // toastClassName: "longjoe-toast"
  2556. // }
  2557. // );
  2558. // } else {
  2559. // ElMessage.error("计算公式有误");
  2560. // }
  2561. };
  2562. /**
  2563. * @description 展示历史价格
  2564. * @param timeout
  2565. * @param params
  2566. */
  2567. const gotoHisprice = async (timeout = 0, params: any) => {
  2568. const toast = useToast();
  2569. toast(
  2570. {
  2571. component: ToastHistoryPrice,
  2572. props: {
  2573. ...params,
  2574. t: t
  2575. },
  2576. listeners: {
  2577. todetail: (row: any) => {
  2578. console.log("gotoHisprice dd val :>> ", row, router);
  2579. if (Number(row.typeid) == 1) {
  2580. router.push(`/mattressQuote/detail?id=${row.bednetid_mattressid}`);
  2581. // state.bednetDrawerProps.deptid = state.LjDetailRef._mainData.deptid;
  2582. // state.bednetDrawerProps.bednetid = row.bednetid_mattressid;
  2583. // state.bednetDrawerProps.state = "";
  2584. // state.LjDrawerRef.show();
  2585. } else if (Number(row.typeid) == 2) {
  2586. router.push(`/bednetQuote/detail?id=${row.bednetid_mattressid}`);
  2587. }
  2588. }
  2589. }
  2590. },
  2591. {
  2592. position: POSITION.BOTTOM_RIGHT,
  2593. icon: false,
  2594. timeout: timeout,
  2595. closeButton: false,
  2596. toastClassName: "longjoe-toast"
  2597. }
  2598. );
  2599. };
  2600. const getFormulakindEnum = async () => {
  2601. let _params = {
  2602. dsname: "_Mapper_formulakind",
  2603. queryparams: {}
  2604. };
  2605. let res = await CommonDynamicSelect(_params);
  2606. let result = [];
  2607. if (res?.datatable?.length > 0) {
  2608. result = res?.datatable;
  2609. }
  2610. state.formulaKindEnum = result;
  2611. let _params2 = {
  2612. dsname: "_Mapper_formulakind_dc",
  2613. queryparams: {}
  2614. };
  2615. let res2 = await CommonDynamicSelect(_params2);
  2616. let result2 = [];
  2617. if (res2?.datatable?.length > 0) {
  2618. result2 = res2?.datatable;
  2619. state.formulaKindDcEnum = result2;
  2620. }
  2621. console.log("getFormulakindEnum state. state.formulaKindEnum :>> ", state.formulaKindEnum);
  2622. console.log("getFormulakindEnum state.formulaKindDcEnum :>> ", state.formulaKindDcEnum);
  2623. };
  2624. // 表格配置项
  2625. const columns: ColumnProps<any>[] = [
  2626. { type: "checkbox", width: 50, fixed: "left" },
  2627. { title: "#", field: "pid", fixed: "left", width: 80 },
  2628. {
  2629. field: "deptid",
  2630. title: "部门",
  2631. search: {
  2632. el: "select",
  2633. key: "arg_deptid",
  2634. props: {
  2635. filterable: true,
  2636. onChange: val => {
  2637. state.initParams.arg_deptid = val;
  2638. }
  2639. },
  2640. order: 1
  2641. },
  2642. basicinfo: {
  2643. // el: "select",
  2644. // editable: (scope: any) => {
  2645. // console.log(
  2646. // "deptiddeptid scope.searchParam.deptid :>> ",
  2647. // scope.searchParam.deptid,
  2648. // Number(scope.searchParam.deptid) == 0
  2649. // );
  2650. // return Boolean(Number(scope.searchParam.deptid) == 0);
  2651. // },
  2652. // rules: [{ required: true, message: "请先选择部门", trigger: "change" }],
  2653. // props: {
  2654. // filterable: true,
  2655. // clearable: false
  2656. // },
  2657. order: 1,
  2658. group: "单据信息"
  2659. }
  2660. },
  2661. {
  2662. field: "mattressrelcode",
  2663. title: "核价编码",
  2664. basicinfo: {
  2665. el: "input",
  2666. editable: ALLOW_EDIT_STATE
  2667. }
  2668. },
  2669. {
  2670. field: "mattresstypeid",
  2671. title: "床垫类别",
  2672. basicinfo: {
  2673. el: "select",
  2674. editable: ALLOW_EDIT_STATE,
  2675. rules: [{ required: true, message: "请先选择床垫类别", trigger: "change" }],
  2676. props: {
  2677. clearable: false,
  2678. filterable: true,
  2679. onChange: () => funcImportMattressMx()
  2680. }
  2681. }
  2682. },
  2683. {
  2684. field: "mattressname",
  2685. title: "核价名称",
  2686. align: "left",
  2687. table: "u_mattress",
  2688. search: {
  2689. el: "input",
  2690. key: "arg_search",
  2691. titleKey: "searchKw",
  2692. props: {
  2693. placeholder: "唯一码/编码/名称"
  2694. },
  2695. order: 0
  2696. },
  2697. basicinfo: {
  2698. el: "input",
  2699. editable: ALLOW_EDIT_STATE
  2700. },
  2701. treeNode: true,
  2702. render: scope => {
  2703. return !scope.row?.child_count && !scope.row?.parentid ? (
  2704. scope.row?.mattressname
  2705. ) : scope.row?.parentid ? (
  2706. <>
  2707. <el-tag type="warning" effect="light" disable-transitions size="small" class="mr-4">
  2708. </el-tag>
  2709. {scope.row?.mattressname}
  2710. </>
  2711. ) : (
  2712. <>
  2713. <el-tag type="primary" effect="light" disable-transitions size="small" class="mr-4">
  2714. </el-tag>
  2715. {scope.row?.mattressname}
  2716. </>
  2717. );
  2718. }
  2719. },
  2720. {
  2721. field: "flag",
  2722. title: "财务审核",
  2723. table: "u_mattress",
  2724. search: {
  2725. el: "select",
  2726. key: "status_flag",
  2727. titleKey: "status",
  2728. props: {
  2729. clearable: true,
  2730. placeholder: "全部",
  2731. onChange: () => {
  2732. state.vxeTableRef.refresh();
  2733. }
  2734. },
  2735. order: 2,
  2736. render: scope => {
  2737. // let _keys = Object.keys(scope);
  2738. // let _data = _keys.includes("row") ? scope.row : _keys.includes("searchParam") ? scope.searchParam : scope;
  2739. return (
  2740. <el-select v-model={scope.searchParam.status_flag} placeholder="全部" clearable>
  2741. <el-option label="待下单" value="1" />
  2742. <el-option label="已下单" value="2" />
  2743. <el-option label="待财务审核" value="3" />
  2744. <el-option label="已财务审核" value="4" />
  2745. </el-select>
  2746. );
  2747. }
  2748. }
  2749. },
  2750. {
  2751. field: "dept_profitrate_rangli",
  2752. title: "部门让利点数",
  2753. basicinfo: {
  2754. el: "input-number",
  2755. editable: ALLOW_EDIT_STATE,
  2756. order: 2,
  2757. group: "单据信息"
  2758. }
  2759. },
  2760. {
  2761. field: "fees_dscrp",
  2762. title: "额外费用说明",
  2763. basicinfo: {
  2764. el: "input",
  2765. props: { type: "textarea", rows: 2 },
  2766. editable: ALLOW_EDIT_STATE,
  2767. row: 2
  2768. }
  2769. },
  2770. {
  2771. field: "foreign_cost",
  2772. table: "u_mattress",
  2773. title: "外币价",
  2774. basicinfo: {
  2775. titleKey: "bi_foreign_cost"
  2776. }
  2777. },
  2778. {
  2779. field: "nottax_dept_cost",
  2780. table: "u_mattress",
  2781. title: "部门不含税价",
  2782. basicinfo: {
  2783. titleKey: "bi_nottax_dept_cost"
  2784. }
  2785. },
  2786. {
  2787. field: "if_bcp_type",
  2788. title: "半成品",
  2789. basicinfo: {
  2790. labelHidden: true,
  2791. render: (scope: any) => {
  2792. let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
  2793. return (
  2794. <>
  2795. <el-checkbox
  2796. v-model={scope.searchParam.if_bcp_type}
  2797. true-value={1}
  2798. false-value={0}
  2799. disabled={_disabled}
  2800. label="半成品"
  2801. class="mr-8"
  2802. />
  2803. <el-checkbox
  2804. v-model={scope.searchParam.if_zhedie_type}
  2805. true-value={1}
  2806. false-value={0}
  2807. disabled={_disabled}
  2808. label="折叠款"
  2809. />
  2810. </>
  2811. );
  2812. }
  2813. }
  2814. },
  2815. {
  2816. field: "if_m_chai",
  2817. title: "面拆",
  2818. basicinfo: {
  2819. span: 2,
  2820. labelHidden: true,
  2821. render: (scope: any) => {
  2822. let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
  2823. return (
  2824. <>
  2825. <el-checkbox
  2826. v-model={scope.searchParam.if_m_chai}
  2827. true-value={1}
  2828. false-value={0}
  2829. disabled={_disabled}
  2830. label="面拆"
  2831. class="mr-8"
  2832. onChange={val => autoLoadExtraData_chai(val, "if_m_chai")}
  2833. />
  2834. <el-checkbox
  2835. v-model={scope.searchParam.if_z_chai}
  2836. true-value={1}
  2837. false-value={0}
  2838. disabled={_disabled}
  2839. label="中拆"
  2840. class="mr-8"
  2841. onChange={val => autoLoadExtraData_chai(val, "if_z_chai")}
  2842. />
  2843. <el-checkbox
  2844. v-model={scope.searchParam.if_d_chai}
  2845. true-value={1}
  2846. false-value={0}
  2847. disabled={_disabled}
  2848. label="底拆"
  2849. onChange={val => autoLoadExtraData_chai(val, "if_d_chai")}
  2850. />
  2851. </>
  2852. );
  2853. }
  2854. }
  2855. },
  2856. {
  2857. field: "mattress_width",
  2858. title: "床垫宽/CM",
  2859. basicinfo: {
  2860. el: "input-number",
  2861. editable: ALLOW_EDIT_STATE
  2862. }
  2863. },
  2864. {
  2865. field: "mattress_length",
  2866. title: "床垫长/CM",
  2867. basicinfo: {
  2868. el: "input-number",
  2869. editable: ALLOW_EDIT_STATE
  2870. }
  2871. },
  2872. {
  2873. field: "mattress_height",
  2874. title: "床垫高/CM",
  2875. basicinfo: {
  2876. el: "input-number",
  2877. editable: ALLOW_EDIT_STATE
  2878. }
  2879. },
  2880. {
  2881. field: "if_w_butao",
  2882. title: "顶布裥棉",
  2883. basicinfo: {
  2884. // el: "checkbox",
  2885. // editable: ALLOW_EDIT_STATE
  2886. labelHidden: true,
  2887. render: (scope: any) => {
  2888. console.log("if_w_butao scope :>> ", scope);
  2889. let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
  2890. return (
  2891. <>
  2892. <el-checkbox
  2893. v-model={scope.searchParam.if_w_butao}
  2894. true-value={1}
  2895. false-value={0}
  2896. disabled={_disabled}
  2897. label="顶布裥棉"
  2898. class="mr-8"
  2899. />
  2900. </>
  2901. );
  2902. }
  2903. }
  2904. },
  2905. {
  2906. field: "biandai_qty",
  2907. title: "边带数",
  2908. basicinfo: {
  2909. el: "input-number",
  2910. editable: (scope: any) => {
  2911. let someone =
  2912. Number(scope.searchParam?.if_m_chai ?? 0) +
  2913. Number(scope.searchParam?.if_z_chai ?? 0) +
  2914. Number(scope.searchParam?.if_d_chai ?? 0);
  2915. if (ALLOW_EDIT_STATE.includes(scope.status) && someone > 0) {
  2916. return true;
  2917. }
  2918. return false;
  2919. }
  2920. }
  2921. },
  2922. {
  2923. field: "if_n_butao",
  2924. title: "内布套",
  2925. basicinfo: {
  2926. labelHidden: true,
  2927. render: (scope: any) => {
  2928. let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
  2929. return (
  2930. <>
  2931. <el-checkbox
  2932. v-model={scope.searchParam.if_n_butao}
  2933. true-value={1}
  2934. false-value={0}
  2935. disabled={_disabled}
  2936. label="内布套"
  2937. class="mr-8"
  2938. />
  2939. </>
  2940. );
  2941. },
  2942. editvisible: (scope: any) => {
  2943. let someone =
  2944. Number(scope.searchParam?.if_m_chai ?? 0) +
  2945. Number(scope.searchParam?.if_z_chai ?? 0) +
  2946. Number(scope.searchParam?.if_d_chai ?? 0);
  2947. if (someone > 0) {
  2948. return true;
  2949. }
  2950. return false;
  2951. }
  2952. }
  2953. },
  2954. // {
  2955. // field: "s_cover_qty",
  2956. // title: "内布套上覆",
  2957. // basicinfo: {
  2958. // el: "input-number",
  2959. // editable: (scope: any) => {
  2960. // if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.if_n_butao)) {
  2961. // return true;
  2962. // }
  2963. // return false;
  2964. // },
  2965. // editvisible: (scope: any) => {
  2966. // let someone =
  2967. // Number(scope.searchParam?.if_m_chai ?? 0) +
  2968. // Number(scope.searchParam?.if_z_chai ?? 0) +
  2969. // Number(scope.searchParam?.if_d_chai ?? 0);
  2970. // if (someone > 0 && Number(scope.searchParam.if_n_butao)) {
  2971. // return true;
  2972. // }
  2973. // return false;
  2974. // }
  2975. // }
  2976. // },
  2977. // {
  2978. // field: "z_cover_qty",
  2979. // title: "内布套侧覆",
  2980. // basicinfo: {
  2981. // el: "input-number",
  2982. // editable: (scope: any) => {
  2983. // if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.if_n_butao)) {
  2984. // return true;
  2985. // }
  2986. // return false;
  2987. // },
  2988. // editvisible: (scope: any) => {
  2989. // let someone =
  2990. // Number(scope.searchParam?.if_m_chai ?? 0) +
  2991. // Number(scope.searchParam?.if_z_chai ?? 0) +
  2992. // Number(scope.searchParam?.if_d_chai ?? 0);
  2993. // if (someone > 0 && Number(scope.searchParam.if_n_butao)) {
  2994. // return true;
  2995. // }
  2996. // return false;
  2997. // }
  2998. // }
  2999. // },
  3000. // {
  3001. // field: "x_cover_qty",
  3002. // title: "内布套下覆",
  3003. // basicinfo: {
  3004. // el: "input-number",
  3005. // editable: (scope: any) => {
  3006. // if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.if_n_butao)) {
  3007. // return true;
  3008. // }
  3009. // return false;
  3010. // },
  3011. // editvisible: (scope: any) => {
  3012. // let someone =
  3013. // Number(scope.searchParam?.if_m_chai ?? 0) +
  3014. // Number(scope.searchParam?.if_z_chai ?? 0) +
  3015. // Number(scope.searchParam?.if_d_chai ?? 0);
  3016. // if (someone > 0 && Number(scope.searchParam.if_n_butao)) {
  3017. // return true;
  3018. // }
  3019. // return false;
  3020. // }
  3021. // }
  3022. // },
  3023. {
  3024. field: "if_m_wbutao_way",
  3025. title: "面料外布套做法",
  3026. basicinfo: {
  3027. labelHidden: true,
  3028. render: (scope: any) => {
  3029. let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
  3030. return (
  3031. <>
  3032. <el-checkbox
  3033. v-model={scope.searchParam.if_m_wbutao_way}
  3034. true-value={1}
  3035. false-value={0}
  3036. disabled={_disabled}
  3037. label="面料外布套做法"
  3038. class="mr-8"
  3039. />
  3040. </>
  3041. );
  3042. },
  3043. editvisible: (scope: any) => {
  3044. let someone =
  3045. Number(scope.searchParam?.if_m_chai ?? 0) +
  3046. Number(scope.searchParam?.if_z_chai ?? 0) +
  3047. Number(scope.searchParam?.if_d_chai ?? 0);
  3048. if (someone > 0) {
  3049. return true;
  3050. }
  3051. return false;
  3052. }
  3053. }
  3054. },
  3055. {
  3056. field: "s_m_cover_qty",
  3057. title: "面层向大侧覆盖",
  3058. basicinfo: {
  3059. el: "input-number",
  3060. editable: (scope: any) => {
  3061. if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.if_m_wbutao_way)) {
  3062. return true;
  3063. }
  3064. return false;
  3065. },
  3066. editvisible: (scope: any) => {
  3067. let someone =
  3068. Number(scope.searchParam?.if_m_chai ?? 0) +
  3069. Number(scope.searchParam?.if_z_chai ?? 0) +
  3070. Number(scope.searchParam?.if_d_chai ?? 0);
  3071. if (someone > 0 && Number(scope.searchParam.if_m_wbutao_way)) {
  3072. return true;
  3073. }
  3074. return false;
  3075. }
  3076. }
  3077. },
  3078. {
  3079. field: "z_m_cover_qty",
  3080. title: "大侧向底层覆盖",
  3081. basicinfo: {
  3082. el: "input-number",
  3083. editable: (scope: any) => {
  3084. if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.if_m_wbutao_way)) {
  3085. return true;
  3086. }
  3087. return false;
  3088. },
  3089. editvisible: (scope: any) => {
  3090. let someone =
  3091. Number(scope.searchParam?.if_m_chai ?? 0) +
  3092. Number(scope.searchParam?.if_z_chai ?? 0) +
  3093. Number(scope.searchParam?.if_d_chai ?? 0);
  3094. if (someone > 0 && Number(scope.searchParam.if_m_wbutao_way)) {
  3095. return true;
  3096. }
  3097. return false;
  3098. }
  3099. }
  3100. },
  3101. {
  3102. field: "x_m_cover_qty",
  3103. title: "底层向大侧覆盖",
  3104. basicinfo: {
  3105. el: "input-number",
  3106. editable: (scope: any) => {
  3107. if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.if_m_wbutao_way)) {
  3108. return true;
  3109. }
  3110. return false;
  3111. },
  3112. editvisible: (scope: any) => {
  3113. let someone =
  3114. Number(scope.searchParam?.if_m_chai ?? 0) +
  3115. Number(scope.searchParam?.if_z_chai ?? 0) +
  3116. Number(scope.searchParam?.if_d_chai ?? 0);
  3117. if (someone > 0 && Number(scope.searchParam.if_m_wbutao_way)) {
  3118. return true;
  3119. }
  3120. return false;
  3121. }
  3122. }
  3123. },
  3124. {
  3125. field: "commission",
  3126. title: "佣金点数",
  3127. basicinfo: {
  3128. el: "input-number",
  3129. editable: ALLOW_EDIT_STATE
  3130. }
  3131. },
  3132. {
  3133. field: "other_rate",
  3134. title: "额外点数",
  3135. basicinfo: {
  3136. el: "input-number",
  3137. editable: ALLOW_EDIT_STATE
  3138. }
  3139. },
  3140. {
  3141. field: "extras_cost",
  3142. title: "额外费用",
  3143. basicinfo: {
  3144. el: "input-number",
  3145. editable: ALLOW_EDIT_STATE
  3146. }
  3147. },
  3148. {
  3149. field: "taxes",
  3150. title: "税金",
  3151. enum: [
  3152. {
  3153. label: "不含税",
  3154. value: 1
  3155. },
  3156. {
  3157. label: "含税",
  3158. value: 1.07
  3159. }
  3160. ],
  3161. basicinfo: {
  3162. el: "select",
  3163. editable: ALLOW_EDIT_STATE,
  3164. render: (scope: any) => {
  3165. let optionRender = [];
  3166. let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
  3167. console.log("taxrate scope.enum :>> ", scope.enum);
  3168. scope.enum.map(item => {
  3169. optionRender.push(<el-option label={item.label} value={item.value} />);
  3170. });
  3171. let slotprefix = {
  3172. prefix: () => {
  3173. return <>{scope.searchParam.taxrate}</>;
  3174. }
  3175. };
  3176. let _taxrate = Number(scope.searchParam.taxrate);
  3177. return (
  3178. <el-select
  3179. v-model={_taxrate}
  3180. v-slots={slotprefix}
  3181. class="select-text-right"
  3182. disabled={_disabled}
  3183. onChange={val => funcTaxrateChange(val, scope.searchParam)}
  3184. >
  3185. {optionRender}
  3186. </el-select>
  3187. );
  3188. }
  3189. }
  3190. },
  3191. {
  3192. field: "moneyrate",
  3193. title: "币种",
  3194. basicinfo: {
  3195. el: "select",
  3196. editable: ALLOW_EDIT_STATE,
  3197. render: (scope: any) => {
  3198. let optionRender = [];
  3199. let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
  3200. scope.enum.map(item => {
  3201. optionRender.push(<el-option label={item.label} value={item.value} />);
  3202. });
  3203. let slotprefix = {
  3204. prefix: () => {
  3205. return <>{scope.searchParam.moneyrate}</>;
  3206. }
  3207. };
  3208. return (
  3209. <el-select
  3210. v-model={scope.searchParam.if_moneyrate}
  3211. v-slots={slotprefix}
  3212. class="select-text-right"
  3213. disabled={_disabled}
  3214. onChange={val => wf_get_moneyrate_discount(val, scope.searchParam)}
  3215. >
  3216. {optionRender}
  3217. </el-select>
  3218. );
  3219. }
  3220. }
  3221. }
  3222. ];
  3223. const columnsMx: ColumnProps<any>[] = [
  3224. { title: "#", type: "seq", fixed: "left", width: 80 },
  3225. {
  3226. title: "计算成功?",
  3227. field: "if_success",
  3228. datatype: "checkbox",
  3229. limited: () => {
  3230. const { userInfo } = useUserStore();
  3231. return userInfo.usermode != 0;
  3232. },
  3233. render: (scope: any) => {
  3234. if (Number(scope.row.if_success)) {
  3235. return (
  3236. <>
  3237. <ElTag type="danger">异常</ElTag>
  3238. </>
  3239. );
  3240. } else {
  3241. return <></>;
  3242. }
  3243. }
  3244. },
  3245. {
  3246. title: "+",
  3247. field: "addmx",
  3248. width: 80,
  3249. render: (scope: any) => {
  3250. let _if_mtrl = Number(scope.row.if_mtrl);
  3251. if (_if_mtrl > 1) {
  3252. if (state.orderStatus) {
  3253. return <ElButton type="primary" plain circle icon={Plus} onClick={() => funcAddMtrlMx(scope)}></ElButton>;
  3254. } else {
  3255. return <>+</>;
  3256. }
  3257. } else {
  3258. return <></>;
  3259. }
  3260. }
  3261. },
  3262. {
  3263. title: "-",
  3264. field: "delmx",
  3265. width: 80,
  3266. render: (scope: any) => {
  3267. let _if_mtrl = Number(scope.row.if_mtrl);
  3268. if (_if_mtrl > 1) {
  3269. if (state.orderStatus) {
  3270. return (
  3271. <>
  3272. <ElPopconfirm
  3273. width="220"
  3274. icon={InfoFilled}
  3275. title={t("business.tips.mattress.delMx")}
  3276. confirm-button-text={t("common.delText")}
  3277. confirm-button-type="danger"
  3278. onConfirm={() => funcDelMtrlMx(scope)}
  3279. >
  3280. {{
  3281. reference: () => {
  3282. return <ElButton type="danger" plain circle icon={Minus} />;
  3283. }
  3284. }}
  3285. </ElPopconfirm>
  3286. </>
  3287. );
  3288. // return <ElButton type="danger" plain circle icon={Minus} onClick={() => funcDelMtrlMx(scope)}></ElButton>;
  3289. } else {
  3290. return <>-</>;
  3291. }
  3292. } else {
  3293. return <></>;
  3294. }
  3295. }
  3296. },
  3297. {
  3298. title: "位置",
  3299. field: "chastr"
  3300. },
  3301. {
  3302. title: "公式名",
  3303. field: "formulakind",
  3304. table: "u_mattress_formula",
  3305. align: "left",
  3306. isFilterEnum: true,
  3307. fieldNames: { value: "value", label: "label" },
  3308. // enum: async () => {
  3309. // let res = await CommonDynamicSelect({
  3310. // dsname: "_Mapper_formulakind",
  3311. // queryparams: {}
  3312. // });
  3313. // return { data: res.datatable };
  3314. // }
  3315. render: (scope: any) => {
  3316. const { column, row, status } = scope;
  3317. let itmName = state.formulaKindEnum.find(t => t.value == row.formulakind)?.label ?? "";
  3318. return <>{itmName}</>;
  3319. }
  3320. },
  3321. {
  3322. title: "按物料?",
  3323. field: "if_mtrl",
  3324. table: "u_mattress_formula",
  3325. enum: [
  3326. {
  3327. value: "0",
  3328. label: "无物料"
  3329. },
  3330. {
  3331. value: "1",
  3332. label: "单物料"
  3333. },
  3334. {
  3335. value: "2",
  3336. label: "多物料"
  3337. }
  3338. ]
  3339. },
  3340. {
  3341. title: "厚度cm",
  3342. field: "thickness",
  3343. datatype: "number",
  3344. editRender: {},
  3345. editColRender: (scope: any) => {
  3346. const { $table, column, row, status } = scope;
  3347. const _disabled = !(
  3348. (row.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 12, 13, 14, 32, 33].includes(row.formulakind)) ||
  3349. row.formulakind == 202 ||
  3350. row.formulakind == 7
  3351. );
  3352. return <el-input v-model={scope.row.thickness} disabled={_disabled}></el-input>;
  3353. }
  3354. },
  3355. {
  3356. title: "物料",
  3357. field: "mtrlname",
  3358. editRender: {},
  3359. editColRender: (scope: any) => {
  3360. const { $table, column, row, status } = scope;
  3361. let field = column.field;
  3362. let _label = column.title;
  3363. // if (column?.format) {
  3364. // _label = handleRowAccordingToProp(searchParam, field, column?.format);
  3365. // }
  3366. let _pricelistid = getPriceid();
  3367. let _mtrltypeItem: any = mtrltypeTabList.find(t => t.formulakinds.includes(Number(row.formulakind)));
  3368. !_mtrltypeItem && (_mtrltypeItem = { value: -1 });
  3369. let params = {
  3370. mtrltype: _mtrltypeItem.value,
  3371. pricelistid: _pricelistid
  3372. };
  3373. return (
  3374. <>
  3375. <MtrldefSelect
  3376. value={row.mtrlid}
  3377. {...params}
  3378. clearable
  3379. placeholder={_label}
  3380. onOpenModal={() => fModelChoseMtrl(row, params, rModelSetMtrl, _mtrltypeItem.label, $table)}
  3381. onSelect={val => rModelSetMtrl(row, val, $table)}
  3382. onClear={() => rModelClearMtrl(row, $table)}
  3383. >
  3384. {{
  3385. label: () => row.mtrlname
  3386. }}
  3387. </MtrldefSelect>
  3388. </>
  3389. );
  3390. }
  3391. },
  3392. {
  3393. title: "数量/长度",
  3394. field: "qty",
  3395. datatype: "number",
  3396. editRender: {},
  3397. editColRender: (scope: any) => {
  3398. const { $table, column, row, status } = scope;
  3399. // 面料(面、底、侧)的数量/长度,不能输入
  3400. let arr = [
  3401. {
  3402. // label: "裥面",
  3403. type: [0, 80, 40, 50, 60, 70, 9000]
  3404. },
  3405. {
  3406. // label: "裥底",
  3407. type: [1, 81, 41, 51, 61, 71, 9001]
  3408. },
  3409. {
  3410. // label: "裥大恻",
  3411. type: [2, 82, 42, 52, 62, 72, 9002]
  3412. }
  3413. // {
  3414. // // label: "裥小恻",
  3415. // type: [3, 83, 43, 53, 63, 73, 9003]
  3416. // // ref: "fabricMxTab11Ref"
  3417. // },
  3418. // {
  3419. // // label: "裥V恻",
  3420. // type: [4, 84, 44, 54, 64, 74, 9004]
  3421. // // ref: "fabricMxTab12Ref"
  3422. // }
  3423. ];
  3424. let _disabled = arr.some(t => t.type.includes(row.formulakind));
  3425. return <el-input v-model={scope.row.qty} type="number" disabled={row.mtrlid == 0 || _disabled}></el-input>;
  3426. }
  3427. },
  3428. {
  3429. title: "规格宽/CM",
  3430. field: "mattress_width",
  3431. visible: false
  3432. },
  3433. {
  3434. title: "规格长/CM",
  3435. field: "mattress_length",
  3436. visible: false
  3437. },
  3438. {
  3439. title: "物料单价",
  3440. field: "price",
  3441. datatype: "number",
  3442. limited: () => {
  3443. return userInfo.usermode != 0;
  3444. }
  3445. },
  3446. {
  3447. title: "单位",
  3448. field: "priceunit"
  3449. },
  3450. {
  3451. title: "收缩率",
  3452. field: "shrinkage",
  3453. datatype: "number",
  3454. limited: () => {
  3455. return userInfo.usermode != 0;
  3456. }
  3457. },
  3458. {
  3459. title: "克重",
  3460. field: "gram_weight",
  3461. datatype: "number",
  3462. limited: () => {
  3463. return userInfo.usermode != 0;
  3464. }
  3465. },
  3466. {
  3467. title: "幅宽",
  3468. field: "cloth_width",
  3469. datatype: "number",
  3470. limited: () => {
  3471. return userInfo.usermode != 0;
  3472. }
  3473. },
  3474. {
  3475. title: "固定厚度?",
  3476. field: "if_inputqty",
  3477. datatype: "checkbox",
  3478. limited: () => {
  3479. return userInfo.usermode != 0;
  3480. }
  3481. },
  3482. {
  3483. title: "按面积单价?",
  3484. field: "if_areaprice",
  3485. datatype: "checkbox",
  3486. limited: () => {
  3487. return userInfo.usermode != 0;
  3488. }
  3489. },
  3490. {
  3491. title: "成本金额",
  3492. field: "costamt",
  3493. datatype: "number",
  3494. limited: () => {
  3495. return userInfo.usermode != 0;
  3496. }
  3497. },
  3498. {
  3499. title: "标准\r\n成本金额",
  3500. field: "dannum2_rate",
  3501. datatype: "number",
  3502. limited: () => {
  3503. return userInfo.usermode != 0;
  3504. },
  3505. render: (scope: any) => {
  3506. return formatCutNumber({ val: floatMul(scope.row.costamt, 1 + scope.row.dannum2_rate) });
  3507. }
  3508. },
  3509. {
  3510. title: "散单\r\n成本金额",
  3511. field: "dannum1_rate",
  3512. datatype: "number",
  3513. limited: () => {
  3514. return userInfo.usermode != 0;
  3515. },
  3516. render: (scope: any) => {
  3517. return formatCutNumber({ val: floatMul(scope.row.costamt, 1 + scope.row.dannum1_rate) });
  3518. }
  3519. },
  3520. {
  3521. title: "大单\r\n成本金额",
  3522. field: "dannum3_rate",
  3523. datatype: "number",
  3524. limited: () => {
  3525. return userInfo.usermode != 0;
  3526. },
  3527. render: (scope: any) => {
  3528. return formatCutNumber({ val: floatMul(scope.row.costamt, 1 + scope.row.dannum3_rate) });
  3529. }
  3530. },
  3531. {
  3532. title: "小单\r\n成本金额",
  3533. field: "dannum4_rate",
  3534. datatype: "number",
  3535. limited: () => {
  3536. return userInfo.usermode != 0;
  3537. },
  3538. render: (scope: any) => {
  3539. return formatCutNumber({ val: floatMul(scope.row.costamt, 1 + scope.row.dannum4_rate) });
  3540. }
  3541. },
  3542. {
  3543. title: "金额文本公式",
  3544. field: "formula",
  3545. limited: () => {
  3546. return userInfo.usermode != 0;
  3547. }
  3548. },
  3549. {
  3550. title: "金额数字公式",
  3551. field: "replace_formula",
  3552. limited: () => {
  3553. return userInfo.usermode != 0;
  3554. }
  3555. },
  3556. {
  3557. title: "清单用量",
  3558. field: "useqty",
  3559. datatype: "number",
  3560. limited: () => {
  3561. return userInfo.usermode != 0;
  3562. }
  3563. },
  3564. {
  3565. title: "用量文本公式",
  3566. field: "useformula",
  3567. limited: () => {
  3568. return userInfo.usermode != 0;
  3569. }
  3570. },
  3571. {
  3572. title: "用量数字公式",
  3573. field: "replace_useformula",
  3574. limited: () => {
  3575. return userInfo.usermode != 0;
  3576. }
  3577. },
  3578. {
  3579. title: "工艺填写说明",
  3580. field: "gydscrp",
  3581. editRender: {
  3582. name: "input",
  3583. props: {
  3584. type: "textarea"
  3585. }
  3586. }
  3587. }
  3588. ];
  3589. // /**
  3590. // * @description 主表计算公式
  3591. // */
  3592. // const summaryData = ref<any>([
  3593. // {
  3594. // label: "总成本",
  3595. // field: "total_cost",
  3596. // formula:
  3597. // "if([折叠款] = 1, ([总材料成本]*[大小单]+[款式费用]+[边带费用]+[额外费用]+[制造费用]) * 2, [总材料成本]*[大小单]+[款式费用]+[边带费用]+[额外费用]+[制造费用])",
  3598. // power: () => {
  3599. // if (userInfo.empid != 0 && userInfo.usermode != 0) {
  3600. // return false;
  3601. // } else {
  3602. // return true;
  3603. // }
  3604. // }
  3605. // },
  3606. // {
  3607. // label: "不含税出厂价",
  3608. // field: "nottax_factory_cost",
  3609. // formula: "[总成本] * ([工厂利润率] + [利润率点数] + [布套点数] + [拆装点数] + [海绵点数]) * [管理费点]"
  3610. // },
  3611. // {
  3612. // label: "部门售价",
  3613. // field: "nottax_dept_cost",
  3614. // formula: "[dijia_cost] / (1 - ([佣金点数] - 1)) * [额外点数] + [fob]"
  3615. // },
  3616. // {
  3617. // label: "税金",
  3618. // field: "taxes",
  3619. // formula: "([部门售价] * ([税率] - 1)) + [佣金] * 0.05"
  3620. // },
  3621. // {
  3622. // label: "部门含税价",
  3623. // field: "dept_cost",
  3624. // formula: "([部门售价] + [佣金] * 0.06) * [税率] * if([fob] = 0, 1, [折扣率])"
  3625. // },
  3626. // {
  3627. // label: "外币价",
  3628. // field: "foreign_cost",
  3629. // formula: "if([汇率] <> 0, [部门含税价] / [汇率], 0)"
  3630. // },
  3631. // {
  3632. // label: "底价 ",
  3633. // field: "dijia_cost_cp",
  3634. // formula: "if(([dept_profitrate] + [dept_profitrate_rangli] / 100) <> 0, [dijia_cost] ,0 )"
  3635. // },
  3636. // {
  3637. // label: "佣金",
  3638. // field: "commission_cp",
  3639. // formula: "[dijia_cost] / (1 - ([佣金点数] - 1 )) - [dijia_cost]"
  3640. // },
  3641. // {
  3642. // label: "FOB",
  3643. // field: "fob",
  3644. // formula: "[fob]"
  3645. // }
  3646. // ]);
  3647. // /**
  3648. // * @description 主表公式字段照表
  3649. // */
  3650. // const fieldParams = ref<any>([
  3651. // {
  3652. // label: "总成本",
  3653. // field: "total_cost"
  3654. // },
  3655. // {
  3656. // label: "不含税出厂价",
  3657. // field: "nottax_factory_cost"
  3658. // },
  3659. // {
  3660. // label: "部门售价",
  3661. // field: "nottax_dept_cost"
  3662. // },
  3663. // {
  3664. // label: "税金",
  3665. // field: "taxes"
  3666. // },
  3667. // {
  3668. // label: "部门含税价",
  3669. // field: "dept_cost"
  3670. // },
  3671. // {
  3672. // label: "外币价",
  3673. // field: "foreign_cost"
  3674. // },
  3675. // {
  3676. // label: "总材料成本",
  3677. // field: "total_material_cost"
  3678. // },
  3679. // {
  3680. // label: "大小单",
  3681. // field: "dannum_rate"
  3682. // },
  3683. // {
  3684. // label: "款式费用",
  3685. // field: "hrcost"
  3686. // },
  3687. // {
  3688. // label: "边带费用",
  3689. // field: "biandaicost"
  3690. // },
  3691. // {
  3692. // label: "额外费用",
  3693. // field: "extras_cost"
  3694. // },
  3695. // {
  3696. // label: "制造费用",
  3697. // field: "zhizao_amt"
  3698. // },
  3699. // {
  3700. // label: "折叠款",
  3701. // field: "if_zhedie_type"
  3702. // },
  3703. // {
  3704. // label: "管理费点",
  3705. // field: "guanli_rate"
  3706. // },
  3707. // {
  3708. // label: "工厂利润率",
  3709. // field: "profitrate"
  3710. // },
  3711. // {
  3712. // label: "利润率点数",
  3713. // field: "profitrate_point"
  3714. // },
  3715. // {
  3716. // label: "布套点数",
  3717. // field: "butao_point"
  3718. // },
  3719. // {
  3720. // label: "拆装点数",
  3721. // field: "chaizhuang_point"
  3722. // },
  3723. // {
  3724. // label: "海绵点数",
  3725. // field: "haimian_point"
  3726. // },
  3727. // {
  3728. // label: "部门利润率",
  3729. // field: "dept_profitrate"
  3730. // },
  3731. // {
  3732. // label: "部门让利点",
  3733. // field: "dept_profitrate_rangli"
  3734. // },
  3735. // {
  3736. // label: "额外点数",
  3737. // field: "other_rate"
  3738. // },
  3739. // {
  3740. // label: "佣金点数",
  3741. // field: "commission"
  3742. // },
  3743. // {
  3744. // label: "税率",
  3745. // field: "taxrate"
  3746. // },
  3747. // {
  3748. // label: "折扣率",
  3749. // field: "discount"
  3750. // },
  3751. // {
  3752. // label: "汇率",
  3753. // field: "moneyrate"
  3754. // },
  3755. // {
  3756. // label: "底价",
  3757. // field: "dijia_cost"
  3758. // }
  3759. // ]);
  3760. // /**
  3761. // * @description 明细公式字段照表
  3762. // */
  3763. // const fieldMxParams = ref<any>([
  3764. // {
  3765. // label: "名称前2位",
  3766. // field: "ls_temp_left_2"
  3767. // },
  3768. // {
  3769. // label: "规格宽",
  3770. // field: "ls_mattress_width"
  3771. // },
  3772. // {
  3773. // label: "规格长",
  3774. // field: "ls_mattress_length"
  3775. // },
  3776. // {
  3777. // label: "规格高",
  3778. // field: "ls_mattress_height"
  3779. // },
  3780. // {
  3781. // label: "压包数量",
  3782. // field: "ls_packqty"
  3783. // },
  3784. // {
  3785. // label: "卷包直径",
  3786. // field: "ls_diameter"
  3787. // },
  3788. // {
  3789. // label: "顶布裥棉外布套做法",
  3790. // field: "ls_if_db_wbutao_way"
  3791. // },
  3792. // {
  3793. // label: "面料外布套做法",
  3794. // field: "ls_if_m_wbutao_way"
  3795. // },
  3796. // {
  3797. // label: "内布套上覆",
  3798. // field: "ls_s_cover_qty"
  3799. // },
  3800. // {
  3801. // label: "内布套侧覆",
  3802. // field: "ls_z_cover_qty"
  3803. // },
  3804. // {
  3805. // label: "内布套下覆",
  3806. // field: "ls_x_cover_qty"
  3807. // },
  3808. // {
  3809. // label: "面料上覆",
  3810. // field: "ls_s_m_cover_qty"
  3811. // },
  3812. // {
  3813. // label: "面料侧覆",
  3814. // field: "ls_z_m_cover_qty"
  3815. // },
  3816. // {
  3817. // label: "面料下覆",
  3818. // field: "ls_x_m_cover_qty"
  3819. // },
  3820. // {
  3821. // label: "面拆",
  3822. // field: "ls_if_m_chai"
  3823. // },
  3824. // {
  3825. // label: "中拆",
  3826. // field: "ls_if_z_chai"
  3827. // },
  3828. // {
  3829. // label: "底拆",
  3830. // field: "ls_if_d_chai"
  3831. // },
  3832. // {
  3833. // label: "物料单价",
  3834. // field: "ls_price"
  3835. // },
  3836. // {
  3837. // label: "物料克重",
  3838. // field: "ls_gram_weight"
  3839. // },
  3840. // {
  3841. // label: "幅宽",
  3842. // field: "ls_cloth_width"
  3843. // },
  3844. // {
  3845. // label: "数量",
  3846. // field: "ls_qty"
  3847. // },
  3848. // {
  3849. // label: "物料厚度",
  3850. // field: "ls_if_inputqty"
  3851. // },
  3852. // {
  3853. // label: "固定厚度",
  3854. // field: "ls_if_inputqty"
  3855. // },
  3856. // {
  3857. // label: "厚度",
  3858. // field: "ls_thickness"
  3859. // },
  3860. // {
  3861. // label: "按面积单价",
  3862. // field: "ls_if_areaprice"
  3863. // },
  3864. // {
  3865. // label: "物料名称",
  3866. // field: "ls_mtrlname"
  3867. // },
  3868. // {
  3869. // label: "木托方式",
  3870. // field: "ls_woodpallettype",
  3871. // enum: [
  3872. // { label: " '普通木托' ", value: "0" },
  3873. // { label: " '夹板木托' ", value: "1" },
  3874. // { label: " '铁管木托' ", value: "2" }
  3875. // ]
  3876. // }
  3877. // ]);
  3878. // /**
  3879. // * @description 明细表计算公式
  3880. // */
  3881. // const summaryMxData = ref<any>([
  3882. // {
  3883. // label: "计算成本金额",
  3884. // field: "costamt",
  3885. // formula: ""
  3886. // },
  3887. // {
  3888. // label: "计算清单用量",
  3889. // field: "useqty",
  3890. // formula: ""
  3891. // }
  3892. // ]);
  3893. const funcMergeColumn = (columns: any, target: any) => {
  3894. return columns.map(t => {
  3895. let itm = target.find(item => t.field === item.field);
  3896. if (itm) {
  3897. t = defaultsDeep(itm, t);
  3898. }
  3899. return t;
  3900. });
  3901. };
  3902. // const cushionsEdit = reactive<any>({
  3903. // name: "VxeSelect",
  3904. // options: state.formulaKindDcEnum,
  3905. // optionProps: {
  3906. // label: "label",
  3907. // value: "value"
  3908. // }
  3909. // });
  3910. const bednetCoumns: ColumnProps<any>[] = [
  3911. {
  3912. title: "位置",
  3913. field: "chastr",
  3914. visible: false
  3915. },
  3916. {
  3917. title: "床网",
  3918. field: "mtrlname",
  3919. editRender: {},
  3920. width: 250,
  3921. editColRender: (scope: any) => {
  3922. const { column, row, status, $table } = scope;
  3923. let _label = column.title;
  3924. let _deptid = state.LjDetailRef._mainData.deptid;
  3925. let params = {
  3926. deptid: _deptid,
  3927. mattress_width: state.LjDetailRef._mainData.mattress_width,
  3928. mattress_length: state.LjDetailRef._mainData.mattress_length
  3929. };
  3930. return (
  3931. <BednetSelect
  3932. value={row.mtrlid}
  3933. {...params}
  3934. clearable
  3935. placeholder={_label}
  3936. onOpenModal={() => fModelChoseBednet(row, params, $table)}
  3937. onSelect={(val: any) => rModelSetBednet(row, val, $table)}
  3938. onClear={() => rModelClearBednet(row, $table)}
  3939. >
  3940. {{
  3941. label: () => row.mtrlname
  3942. }}
  3943. </BednetSelect>
  3944. );
  3945. }
  3946. },
  3947. {
  3948. title: "+",
  3949. field: "addmx",
  3950. width: 80,
  3951. render: (scope: any) => {
  3952. let _if_mtrl = Number(scope.row.if_mtrl);
  3953. if (_if_mtrl > 1) {
  3954. if (state.orderStatus) {
  3955. return (
  3956. <ElPopconfirm
  3957. width="220"
  3958. icon={InfoFilled}
  3959. title={t("business.tips.mattress.addMx")}
  3960. confirm-button-text={t("common.addText")}
  3961. onConfirm={() => funcAddMtrlMx(scope, () => wf_rtr_cwdc(scope.row, null, "add"))}
  3962. >
  3963. {{
  3964. reference: () => {
  3965. return <ElButton type="primary" plain circle icon={Plus}></ElButton>;
  3966. }
  3967. }}
  3968. </ElPopconfirm>
  3969. );
  3970. } else {
  3971. return "+";
  3972. }
  3973. } else {
  3974. return "";
  3975. }
  3976. }
  3977. },
  3978. {
  3979. title: "-",
  3980. field: "delmx",
  3981. width: 80,
  3982. render: (scope: any) => {
  3983. let _if_mtrl = Number(scope.row.if_mtrl);
  3984. if (_if_mtrl > 1) {
  3985. if (state.orderStatus) {
  3986. return (
  3987. <ElPopconfirm
  3988. width="220"
  3989. icon={InfoFilled}
  3990. title={t("business.tips.mattress.delMx")}
  3991. confirm-button-text={t("common.delText")}
  3992. confirm-button-type="danger"
  3993. onConfirm={() => funcDelBednet(scope, () => wf_rtr_cwdc(scope.row, null, "del"))}
  3994. >
  3995. {{
  3996. reference: () => {
  3997. return <ElButton type="danger" plain circle icon={Minus} />;
  3998. }
  3999. }}
  4000. </ElPopconfirm>
  4001. );
  4002. } else {
  4003. return "-";
  4004. }
  4005. } else {
  4006. return "";
  4007. }
  4008. }
  4009. }
  4010. ];
  4011. const cushionsColumns: ColumnProps<any>[] = [
  4012. {
  4013. title: "位置",
  4014. field: "chastr",
  4015. editRender: {},
  4016. editColRender: (scope: any) => {
  4017. return (
  4018. <el-select v-model={scope.row.chastr}>
  4019. {{
  4020. default: () => {
  4021. let rs = [];
  4022. if (state.diancengAreaEnum.length) {
  4023. state.diancengAreaEnum.map((t: any) => {
  4024. rs.push(<el-option label={t.label} value={t.value} />);
  4025. });
  4026. }
  4027. return rs;
  4028. }
  4029. }}
  4030. </el-select>
  4031. );
  4032. }
  4033. },
  4034. {
  4035. title: "公式名",
  4036. field: "formulakind",
  4037. table: "u_mattress_formula",
  4038. align: "left",
  4039. isFilterEnum: true,
  4040. fieldNames: { value: "value", label: "label" },
  4041. // editRender: {
  4042. // name: "VxeSelect",
  4043. // options: state.formulaKindDcEnum
  4044. // }
  4045. // editRender: cushionsEdit
  4046. // render: (scope: any) => {
  4047. // const { column, row, status } = scope;
  4048. // let itmName = state.formulaKindEnum.find(t => t.value == row.formulakind)?.label ?? "";
  4049. // return <>{itmName}</>;
  4050. // },
  4051. editRender: {},
  4052. editColRender: (scope: any) => {
  4053. let lastVal = scope.row.formulakind;
  4054. return (
  4055. <el-select v-model={scope.row.formulakind} onChange={val => cushionsFormulaKindChange(val, lastVal, scope)}>
  4056. {{
  4057. default: () => {
  4058. let rs = [];
  4059. if (state.formulaKindDcEnum.length) {
  4060. state.formulaKindDcEnum.map((t: any) => {
  4061. rs.push(<el-option label={t.label} value={t.value} />);
  4062. });
  4063. }
  4064. return rs;
  4065. }
  4066. }}
  4067. </el-select>
  4068. );
  4069. }
  4070. },
  4071. {
  4072. title: "+",
  4073. field: "addmx",
  4074. visible: false
  4075. },
  4076. {
  4077. title: "-",
  4078. field: "delmx",
  4079. visible: false
  4080. },
  4081. {
  4082. title: "按物料?",
  4083. field: "if_mtrl",
  4084. visible: false
  4085. },
  4086. {
  4087. title: "物料",
  4088. field: "mtrlname",
  4089. editRender: {},
  4090. editColRender: (scope: any) => {
  4091. const { column, row, status, $table } = scope;
  4092. let _label = column.title;
  4093. let _pricelistid = getPriceid();
  4094. let _mtrltypeItem: any = mtrltypeTabList_cushions.find(t => t.formulakinds.includes(Number(row.formulakind)));
  4095. if (!_mtrltypeItem) {
  4096. // ElMessage.error("不是垫层类型行,不能选物料");
  4097. // return <></>;
  4098. }
  4099. let params = {
  4100. mtrltype: _mtrltypeItem?.value,
  4101. pricelistid: _pricelistid
  4102. };
  4103. return (
  4104. <>
  4105. <MtrldefSelect
  4106. value={row.mtrlid}
  4107. {...params}
  4108. disabled={!_mtrltypeItem}
  4109. clearable
  4110. placeholder={_label}
  4111. onOpenModal={() => fModelChoseMtrl(row, params, rModelSetMtrl, _mtrltypeItem?.label, $table)}
  4112. onSelect={(val: any) => rModelSetMtrl(row, val, $table)}
  4113. onClear={() => rModelClearMtrl(row, $table)}
  4114. >
  4115. {{
  4116. label: () => row.mtrlname
  4117. }}
  4118. </MtrldefSelect>
  4119. </>
  4120. );
  4121. }
  4122. },
  4123. {
  4124. title: "规格宽/CM",
  4125. field: "mattress_width",
  4126. datatype: "number",
  4127. editRender: {
  4128. name: "input"
  4129. },
  4130. visible: true
  4131. },
  4132. {
  4133. title: "规格长/CM",
  4134. field: "mattress_length",
  4135. datatype: "number",
  4136. editRender: {
  4137. name: "input"
  4138. },
  4139. visible: true
  4140. },
  4141. {
  4142. title: "厚度cm",
  4143. field: "thickness",
  4144. datatype: "number",
  4145. editRender: {},
  4146. editColRender: (scope: any) => {
  4147. const { $table, column, row, status } = scope;
  4148. const _disabled = !(
  4149. (row.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 14, 32, 33].includes(row.formulakind)) ||
  4150. row.formulakind == 7 ||
  4151. row.formulakind == 999
  4152. );
  4153. return <el-input v-model={scope.row.thickness} type="number" disabled={_disabled}></el-input>;
  4154. }
  4155. }
  4156. ];
  4157. const accessoriesColumns: ColumnProps<any>[] = [
  4158. {
  4159. title: "位置",
  4160. field: "chastr",
  4161. visible: false
  4162. },
  4163. {
  4164. title: "物料",
  4165. field: "mtrlname",
  4166. editRender: {},
  4167. editColRender: (scope: any) => {
  4168. const { column, row, status, $table } = scope;
  4169. let field = column.field;
  4170. let _label = column.title;
  4171. // if (column?.format) {
  4172. // _label = handleRowAccordingToProp(searchParam, field, column?.format);
  4173. // }
  4174. let _pricelistid = getPriceid();
  4175. let _mtrltypeItem: any = mtrltypeTabList_accessories.find(t => t.formulakinds.includes(Number(row.formulakind)));
  4176. if (!_mtrltypeItem) {
  4177. ElMessage.error("不是辅料类型行,不能选物料");
  4178. return "";
  4179. }
  4180. let params = {
  4181. mtrltype: _mtrltypeItem.value,
  4182. pricelistid: _pricelistid
  4183. };
  4184. return (
  4185. <>
  4186. <MtrldefSelect
  4187. value={row.mtrlid}
  4188. {...params}
  4189. clearable
  4190. placeholder={_label}
  4191. onOpenModal={() => fModelChoseMtrl(row, params, rModelSetMtrl, _mtrltypeItem.label, $table)}
  4192. onSelect={(val: any) => rModelSetMtrl(row, val, $table)}
  4193. onClear={() => rModelClearMtrl(row, $table)}
  4194. >
  4195. {{
  4196. label: () => row.mtrlname
  4197. }}
  4198. </MtrldefSelect>
  4199. </>
  4200. );
  4201. }
  4202. },
  4203. {
  4204. title: "厚度cm",
  4205. field: "thickness",
  4206. limited: true
  4207. }
  4208. ];
  4209. const packagColumns: ColumnProps<any>[] = [
  4210. {
  4211. title: "位置",
  4212. field: "chastr",
  4213. visible: false
  4214. },
  4215. {
  4216. title: "物料",
  4217. field: "mtrlname",
  4218. editRender: {},
  4219. editColRender: (scope: any) => {
  4220. const { column, row, status, $table } = scope;
  4221. let field = column.field;
  4222. let _label = column.title;
  4223. // if (column?.format) {
  4224. // _label = handleRowAccordingToProp(searchParam, field, column?.format);
  4225. // }
  4226. let _pricelistid = getPriceid();
  4227. let _mtrltypeItem: any = mtrltypeTabList_packag.find(t => t.formulakinds.includes(Number(row.formulakind)));
  4228. !_mtrltypeItem && (_mtrltypeItem = { value: -1 });
  4229. let params = {
  4230. mtrltype: _mtrltypeItem.value,
  4231. pricelistid: _pricelistid
  4232. };
  4233. return (
  4234. <>
  4235. <MtrldefSelect
  4236. value={row.mtrlid}
  4237. {...params}
  4238. clearable
  4239. placeholder={_label}
  4240. onOpenModal={() => fModelChoseMtrl(row, params, rModelSetMtrl, _mtrltypeItem.label, $table)}
  4241. onSelect={(val: any) => rModelSetMtrl(row, val, $table)}
  4242. onClear={() => rModelClearMtrl(row, $table)}
  4243. >
  4244. {{
  4245. label: () => row.mtrlname
  4246. }}
  4247. </MtrldefSelect>
  4248. </>
  4249. );
  4250. }
  4251. },
  4252. {
  4253. title: "厚度cm",
  4254. field: "thickness",
  4255. limited: true
  4256. }
  4257. ];
  4258. const columnsMxInnerClothLayer: ColumnProps<any>[] = [
  4259. {
  4260. title: "计算成功?",
  4261. field: "if_success",
  4262. datatype: "checkbox",
  4263. limited: () => {
  4264. const { userInfo } = useUserStore();
  4265. return userInfo.usermode != 0;
  4266. },
  4267. render: (scope: any) => {
  4268. if (Number(scope.row.if_success)) {
  4269. return (
  4270. <>
  4271. <ElTag type="danger">异常</ElTag>
  4272. </>
  4273. );
  4274. } else {
  4275. return <></>;
  4276. }
  4277. }
  4278. },
  4279. {
  4280. title: "位置",
  4281. field: "chastr"
  4282. // treeNode: true
  4283. },
  4284. {
  4285. title: "+",
  4286. field: "addmx",
  4287. width: 80,
  4288. render: (scope: any) => {
  4289. let _if_mtrl = Number(scope.row.if_mtrl);
  4290. if (_if_mtrl > 1) {
  4291. if (state.orderStatus) {
  4292. return (
  4293. <>
  4294. <ElPopconfirm
  4295. width="220"
  4296. icon={InfoFilled}
  4297. title={t("business.tips.mattress.addMx")}
  4298. confirm-button-text={t("common.addText")}
  4299. onConfirm={() => funcAddMtrlMx(scope)}
  4300. >
  4301. {{
  4302. reference: () => {
  4303. return <ElButton type="primary" plain circle icon={Plus}></ElButton>;
  4304. }
  4305. }}
  4306. </ElPopconfirm>
  4307. </>
  4308. );
  4309. // return <ElButton type="primary" plain circle icon={Plus} onClick={() => funcAddMtrlMx(scope)}></ElButton>;
  4310. } else {
  4311. return <>+</>;
  4312. }
  4313. } else {
  4314. return <></>;
  4315. }
  4316. }
  4317. },
  4318. {
  4319. title: "-",
  4320. field: "delmx",
  4321. width: 80,
  4322. render: (scope: any) => {
  4323. let _if_mtrl = Number(scope.row.if_mtrl);
  4324. if (_if_mtrl > 1) {
  4325. if (state.orderStatus) {
  4326. return (
  4327. <>
  4328. <ElPopconfirm
  4329. width="220"
  4330. icon={InfoFilled}
  4331. title={t("business.tips.mattress.delMx")}
  4332. confirm-button-text={t("common.delText")}
  4333. confirm-button-type="danger"
  4334. onConfirm={() => funcDelMtrlMx(scope)}
  4335. >
  4336. {{
  4337. reference: () => {
  4338. return <ElButton type="danger" plain circle icon={Minus} />;
  4339. }
  4340. }}
  4341. </ElPopconfirm>
  4342. </>
  4343. );
  4344. // return <ElButton type="danger" plain circle icon={Minus} onClick={() => funcDelMtrlMx(scope)}></ElButton>;
  4345. } else {
  4346. return <>-</>;
  4347. }
  4348. } else {
  4349. return <></>;
  4350. }
  4351. }
  4352. },
  4353. {
  4354. title: "厚度cm",
  4355. field: "thickness",
  4356. datatype: "number",
  4357. editRender: {},
  4358. editColRender: (scope: any) => {
  4359. const { $table, column, row, status } = scope;
  4360. const _disabled = !(
  4361. (row.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 14, 32, 33].includes(row.formulakind)) ||
  4362. row.formulakind == 202 ||
  4363. row.formulakind == 203
  4364. );
  4365. return <el-input v-model={scope.row.thickness} type="number" disabled={_disabled}></el-input>;
  4366. }
  4367. },
  4368. {
  4369. title: "物料",
  4370. field: "mtrlname",
  4371. editRender: {},
  4372. editColRender: (scope: any) => {
  4373. const { column, row, status, $table } = scope;
  4374. let _label = column.title;
  4375. let _pricelistid = getPriceid();
  4376. let _mtrltypeItem: any = mtrltypeTabList_inner.find(t => t.formulakinds.includes(Number(row.formulakind)));
  4377. !_mtrltypeItem && (_mtrltypeItem = { value: -1 });
  4378. let params = {
  4379. mtrltype: _mtrltypeItem.value,
  4380. pricelistid: _pricelistid
  4381. };
  4382. return (
  4383. <>
  4384. <MtrldefSelect
  4385. value={row.mtrlid}
  4386. {...params}
  4387. clearable
  4388. placeholder={_label}
  4389. onOpenModal={() => fModelChoseMtrl(row, params, rModelSetMtrlInner, _mtrltypeItem.label, $table)}
  4390. onSelect={(val: any) => rModelSetMtrlInner(row, val, $table)}
  4391. onClear={() => rModelClearMtrl(row, $table)}
  4392. >
  4393. {{
  4394. label: () => row.mtrlname
  4395. }}
  4396. </MtrldefSelect>
  4397. </>
  4398. );
  4399. }
  4400. },
  4401. {
  4402. title: "数量/长度",
  4403. field: "qty",
  4404. datatype: "number",
  4405. editRender: {},
  4406. editColRender: (scope: any) => {
  4407. const { $table, column, row, status } = scope;
  4408. return <el-input v-model={scope.row.qty} type="number" disabled={row.mtrlid == 0}></el-input>;
  4409. }
  4410. },
  4411. {
  4412. title: "规格宽/CM",
  4413. field: "mattress_width",
  4414. datatype: "number",
  4415. editRender: {
  4416. name: "input"
  4417. }
  4418. },
  4419. {
  4420. title: "规格长/CM",
  4421. field: "mattress_length",
  4422. datatype: "number",
  4423. editRender: {
  4424. name: "input"
  4425. }
  4426. }
  4427. ];
  4428. const columnsMx_processes: any = [
  4429. { type: "checkbox", width: 50, fixed: "left" },
  4430. {
  4431. title: "+",
  4432. field: "addmx",
  4433. width: 80,
  4434. render: (scope: any) => {
  4435. let oItem = state.specialProcessesMxData.find(o => o.extraid == scope.row.extraid);
  4436. if (!oItem) {
  4437. oItem = {
  4438. inputtype: 1
  4439. };
  4440. }
  4441. if (state.orderStatus) {
  4442. return (
  4443. <ElButton
  4444. type="primary"
  4445. plain
  4446. circle
  4447. icon={Plus}
  4448. disabled={oItem.inputtype == 2}
  4449. onClick={() => funcAddMtrlMx(scope)}
  4450. ></ElButton>
  4451. );
  4452. } else {
  4453. return <>+</>;
  4454. }
  4455. }
  4456. },
  4457. {
  4458. title: "-",
  4459. field: "delmx",
  4460. width: 80,
  4461. render: (scope: any) => {
  4462. let oItem = state.specialProcessesMxData.find(o => o.extraid == scope.row.extraid);
  4463. if (!oItem) {
  4464. oItem = {
  4465. inputtype: 1
  4466. };
  4467. }
  4468. if (state.orderStatus) {
  4469. return (
  4470. <>
  4471. <ElPopconfirm
  4472. width="220"
  4473. icon={InfoFilled}
  4474. title={t("business.tips.mattress.delMx")}
  4475. confirm-button-text={t("common.delText")}
  4476. confirm-button-type="danger"
  4477. onConfirm={() => funcDelMtrlMx(scope)}
  4478. >
  4479. {{
  4480. reference: () => {
  4481. return <ElButton type="danger" plain circle disabled={oItem.inputtype == 2} icon={Minus} />;
  4482. }
  4483. }}
  4484. </ElPopconfirm>
  4485. </>
  4486. );
  4487. // return <ElButton type="danger" plain circle icon={Minus} onClick={() => funcDelMtrlMx(scope)}></ElButton>;
  4488. } else {
  4489. return <>-</>;
  4490. }
  4491. }
  4492. },
  4493. {
  4494. title: "项目类型",
  4495. field: "extraid",
  4496. // editRender: {
  4497. // name: "select"
  4498. // }
  4499. editRender: {},
  4500. editColRender: (scope: any) => {
  4501. return (
  4502. <el-select
  4503. v-model={scope.row.extraid}
  4504. disabled={scope.row.inputtype == 2}
  4505. onChange={val => extratypeOnChange(val, scope)}
  4506. >
  4507. {{
  4508. default: () => {
  4509. let rs = [];
  4510. if (state.specialProcessesEnum.length) {
  4511. state.specialProcessesEnum.map((t: any) => {
  4512. rs.push(<el-option label={t.typename} value={t.extraid} disabled={t.inputtype == 2} />);
  4513. });
  4514. }
  4515. return rs;
  4516. }
  4517. }}
  4518. </el-select>
  4519. );
  4520. },
  4521. render: scope => {
  4522. let item = state.specialProcessesEnum.find(t => t.extraid == scope.row.extraid);
  4523. if (item) {
  4524. return item.typename;
  4525. } else {
  4526. return "";
  4527. }
  4528. }
  4529. },
  4530. {
  4531. title: "项目名称",
  4532. field: "extraname",
  4533. editRender: {},
  4534. editColRender: (scope: any) => {
  4535. let _disabled = scope.row.inputtype == 2;
  4536. if (scope.row.inputtype == 0) {
  4537. return (
  4538. <el-select
  4539. v-model={scope.row.extramxid}
  4540. disabled={_disabled}
  4541. onChange={val => additionalOnChange(val, scope, state.specialProcessesMxData)}
  4542. >
  4543. {{
  4544. default: () => {
  4545. let rs = [];
  4546. if (state.specialProcessesMxData.length) {
  4547. state.specialProcessesMxData
  4548. .filter(t => t.extraid == scope.row.extraid)
  4549. .map((t: any) => {
  4550. rs.push(<el-option label={t.extramxname} value={t.extramxid} />);
  4551. });
  4552. }
  4553. return rs;
  4554. }
  4555. }}
  4556. </el-select>
  4557. );
  4558. } else {
  4559. return (
  4560. <el-autocomplete
  4561. v-model={scope.row.extraname}
  4562. disabled={_disabled}
  4563. value-key="extramxname"
  4564. fetch-suggestions={(queryString: string, callback: any) =>
  4565. querySearch_processes(queryString, callback, scope, state.specialProcessesMxData)
  4566. }
  4567. onSelect={itm => additionalOnSelect(itm, scope)}
  4568. clearable
  4569. />
  4570. );
  4571. }
  4572. }
  4573. },
  4574. {
  4575. title: "金额",
  4576. field: "price",
  4577. datatype: "number",
  4578. editRender: {},
  4579. editColRender: (scope: any) => {
  4580. const { $table, column, row, status } = scope;
  4581. return <el-input v-model={scope.row.price} type="number" disabled={row.inputtype == 2}></el-input>;
  4582. }
  4583. },
  4584. {
  4585. title: "数量",
  4586. field: "qty",
  4587. datatype: "number",
  4588. editRender: {},
  4589. editColRender: (scope: any) => {
  4590. const { $table, column, row, status } = scope;
  4591. return <el-input v-model={scope.row.qty} type="number" disabled={row.inputtype == 2}></el-input>;
  4592. }
  4593. },
  4594. {
  4595. title: "备注",
  4596. field: "dscrp",
  4597. editRender: {
  4598. name: "$input"
  4599. }
  4600. }
  4601. ];
  4602. const columnsMx_additional: any = [
  4603. { type: "checkbox", width: 50, fixed: "left" },
  4604. {
  4605. title: "+",
  4606. field: "addmx",
  4607. width: 80,
  4608. render: (scope: any) => {
  4609. if (state.orderStatus) {
  4610. return <ElButton type="primary" plain circle icon={Plus} onClick={() => funcAddMtrlMx(scope)}></ElButton>;
  4611. } else {
  4612. return <>+</>;
  4613. }
  4614. }
  4615. },
  4616. {
  4617. title: "-",
  4618. field: "delmx",
  4619. width: 80,
  4620. render: (scope: any) => {
  4621. let oItem = state.additionalCostsMxData.find(o => o.extraid == scope.row.extraid);
  4622. if (!oItem) {
  4623. oItem = {
  4624. inputtype: 1
  4625. };
  4626. }
  4627. if (state.orderStatus) {
  4628. return (
  4629. <>
  4630. <ElPopconfirm
  4631. width="220"
  4632. icon={InfoFilled}
  4633. title={t("business.tips.mattress.delMx")}
  4634. confirm-button-text={t("common.delText")}
  4635. confirm-button-type="danger"
  4636. onConfirm={() => funcDelMtrlMx(scope)}
  4637. >
  4638. {{
  4639. reference: () => {
  4640. return <ElButton type="danger" plain circle disabled={oItem.inputtype == 2} icon={Minus} />;
  4641. }
  4642. }}
  4643. </ElPopconfirm>
  4644. </>
  4645. );
  4646. // return <ElButton type="danger" plain circle icon={Minus} onClick={() => funcDelMtrlMx(scope)}></ElButton>;
  4647. } else {
  4648. return <>-</>;
  4649. }
  4650. }
  4651. },
  4652. {
  4653. title: "项目类型",
  4654. field: "extraid",
  4655. editRender: {},
  4656. editColRender: (scope: any) => {
  4657. return (
  4658. <el-select
  4659. v-model={scope.row.extraid}
  4660. disabled={scope.row.inputtype == 2}
  4661. onChange={val => extratypeOnChange(val, scope)}
  4662. >
  4663. {{
  4664. default: () => {
  4665. let rs = [];
  4666. if (state.additionalCostsEnum.length) {
  4667. state.additionalCostsEnum.map((t: any) => {
  4668. rs.push(<el-option label={t.typename} value={t.extraid} disabled={t.inputtype == 2} />);
  4669. });
  4670. }
  4671. return rs;
  4672. }
  4673. }}
  4674. </el-select>
  4675. );
  4676. },
  4677. render: scope => {
  4678. let item = state.additionalCostsEnum.find(t => t.extraid == scope.row.extraid);
  4679. if (item) {
  4680. return item.typename;
  4681. } else {
  4682. return "";
  4683. }
  4684. }
  4685. },
  4686. {
  4687. title: "项目名称",
  4688. field: "extraname",
  4689. editRender: {},
  4690. editColRender: (scope: any) => {
  4691. console.log("editColRender 1111 scope :>> ", scope);
  4692. let _disabled = scope.row.inputtype == 2;
  4693. if (scope.row.inputtype == 0) {
  4694. return (
  4695. <el-select
  4696. v-model={scope.row.extramxid}
  4697. disabled={_disabled}
  4698. onChange={val => additionalOnChange(val, scope, state.additionalCostsMxData)}
  4699. >
  4700. {{
  4701. default: () => {
  4702. let rs = [];
  4703. if (state.additionalCostsMxData.length) {
  4704. state.additionalCostsMxData
  4705. .filter(t => t.extraid == scope.row.extraid)
  4706. .map((t: any) => {
  4707. rs.push(<el-option label={t.extramxname} value={t.extramxid} />);
  4708. });
  4709. }
  4710. return rs;
  4711. }
  4712. }}
  4713. </el-select>
  4714. );
  4715. } else {
  4716. return (
  4717. <el-autocomplete
  4718. v-model={scope.row.extraname}
  4719. disabled={_disabled}
  4720. value-key="extramxname"
  4721. fetch-suggestions={(queryString: string, callback: any) =>
  4722. querySearch_additional(queryString, callback, scope, state.additionalCostsMxData)
  4723. }
  4724. onSelect={itm => additionalOnSelect(itm, scope)}
  4725. clearable
  4726. />
  4727. );
  4728. }
  4729. }
  4730. },
  4731. {
  4732. title: "金额",
  4733. field: "price",
  4734. datatype: "number",
  4735. editRender: {},
  4736. editColRender: (scope: any) => {
  4737. const { $table, column, row, status } = scope;
  4738. return <el-input v-model={scope.row.price} type="number" disabled={row.inputtype == 2}></el-input>;
  4739. }
  4740. },
  4741. {
  4742. title: "数量",
  4743. field: "qty",
  4744. datatype: "number",
  4745. editRender: {},
  4746. editColRender: (scope: any) => {
  4747. const { $table, column, row, status } = scope;
  4748. return <el-input v-model={scope.row.qty} type="number" disabled={row.inputtype == 2}></el-input>;
  4749. }
  4750. },
  4751. {
  4752. title: "备注",
  4753. field: "dscrp",
  4754. editRender: {
  4755. name: "$input"
  4756. }
  4757. }
  4758. ];
  4759. const extratypeOnChange = (value: any, scope: any) => {
  4760. const { row } = scope;
  4761. if (state.specialProcessesEnum.length) {
  4762. let item = state.specialProcessesEnum.find(t => t.extraid == value);
  4763. if (item) {
  4764. row.extramxid = 0;
  4765. row.inputtype = 0;
  4766. row.extraname = "";
  4767. row.price = 0;
  4768. row.qty = 0;
  4769. row.dscrp = "";
  4770. }
  4771. }
  4772. };
  4773. const additionalOnChange = (value: any, scope: any, enumdata: any) => {
  4774. const { row } = scope;
  4775. if (enumdata.length) {
  4776. let item = enumdata.find(t => t.extraid == row.extraid && t.extramxid == value);
  4777. if (item) {
  4778. additionalOnSelect(item, scope);
  4779. }
  4780. }
  4781. };
  4782. const additionalOnSelect = (item: Record<string, any>, scope: any) => {
  4783. const { row } = scope;
  4784. // console.log("additionalOnSelect: >>", item);
  4785. // const $tableAdditional = state.additionalCostsMxRef.element;
  4786. // if ($tableAdditional) {
  4787. // const { visibleData } = $tableAdditional.getTableData();
  4788. // const row = visibleData[$rowIndex];
  4789. // console.log("additionalOnSelect: row >>", row);
  4790. // row.extramxname = item.extramxname;
  4791. row.extramxid = item.extramxid ?? 0;
  4792. row.inputtype = item.inputtype;
  4793. row.extraid = item.extraid;
  4794. row.extraname = item.extramxname;
  4795. // row.typeid = item.typeid;
  4796. row.price = item.price;
  4797. row.qty = item.qty;
  4798. row.dscrp = item.dscrp;
  4799. // $tableAdditional.reloadData(visibleData);
  4800. // }
  4801. };
  4802. const querySearch_processes = (queryString: string, cb: any, data, list) => {
  4803. const { row } = data;
  4804. const results = queryString
  4805. ? list.filter(o => {
  4806. return o.extramxname.indexOf(queryString) > -1 && o.extraid == row.extraid;
  4807. })
  4808. : list.filter(o => o.extraid == row.extraid);
  4809. cb(results);
  4810. };
  4811. const querySearch_additional = (queryString: string, cb: any, data, list) => {
  4812. const { row } = data;
  4813. const results = queryString
  4814. ? list.filter(o => {
  4815. return o.extramxname.indexOf(queryString) > -1 && o.extraid == row.extraid;
  4816. })
  4817. : list.filter(o => o.extraid == row.extraid);
  4818. cb(results);
  4819. };
  4820. const columnsMx_subSpecs: any = [
  4821. { type: "checkbox", width: 50, fixed: "left" },
  4822. {
  4823. title: "床垫宽/CM",
  4824. field: "mattress_width",
  4825. datatype: "number",
  4826. // editRender: {
  4827. // name: "VxeInput",
  4828. // props: {
  4829. // type: "number",
  4830. // onBlur: (e: any) => {
  4831. // const {value} = e
  4832. // console.log("columnsMx_subSpecs: e >>", e);
  4833. // if (value) {
  4834. // setMxSpringQtyWidthAndLength();
  4835. // }
  4836. // }
  4837. // }
  4838. // }
  4839. editRender: {},
  4840. editColRender: (scope: any) => {
  4841. return (
  4842. <>
  4843. <el-input v-model={scope.row.mattress_width} onChange={() => disshow_subspecs(scope)} />
  4844. </>
  4845. );
  4846. }
  4847. },
  4848. {
  4849. title: "床垫长/CM",
  4850. field: "mattress_length",
  4851. datatype: "number",
  4852. // editRender: {
  4853. // name: "$input",
  4854. // props: {
  4855. // type: "number"
  4856. // }
  4857. // }
  4858. editRender: {},
  4859. editColRender: (scope: any) => {
  4860. return (
  4861. <>
  4862. <el-input v-model={scope.row.mattress_length} onChange={() => disshow_subspecs(scope)} />
  4863. </>
  4864. );
  4865. }
  4866. },
  4867. {
  4868. title: "床垫高/CM",
  4869. field: "mattress_height",
  4870. datatype: "number"
  4871. // editRender: {
  4872. // name: "$input",
  4873. // props: {
  4874. // type: "number"
  4875. // }
  4876. // }
  4877. // editRender: {},
  4878. // editColRender: (scope: any) => {
  4879. // return (
  4880. // <>
  4881. // <el-input v-model={scope.row.mattress_height} onChange={() => disshow_subspecs(scope.row)} />
  4882. // </>
  4883. // );
  4884. // }
  4885. },
  4886. {
  4887. title: "弹簧排列个数-宽",
  4888. field: "spring_qty_width",
  4889. datatype: "integer",
  4890. editRender: {
  4891. name: "$input"
  4892. // props: {
  4893. // type: "number"
  4894. // }
  4895. }
  4896. },
  4897. {
  4898. title: "弹簧排列个数-长",
  4899. field: "spring_qty_length",
  4900. datatype: "integer",
  4901. editRender: {
  4902. name: "$input"
  4903. // props: {
  4904. // type: "number"
  4905. // }
  4906. }
  4907. }
  4908. ];
  4909. const handleToImportMxInner = async () => {
  4910. let _params = {
  4911. dsname: "web_mattress_formulalist",
  4912. queryparams: {
  4913. arg_array_formulatype: [101],
  4914. arrg_usetype: 0
  4915. }
  4916. };
  4917. let res = await CommonDynamicSelect(_params);
  4918. let idxStr = "";
  4919. const $table = state.innerClothLayerMxRef.element;
  4920. if ($table) {
  4921. const { visibleData } = $table.getTableData();
  4922. if (visibleData.length) {
  4923. let lastMx = visibleData[visibleData.length - 1];
  4924. idxStr = Number(lastMx.chastr.match(/\d+$/)?.[0] ?? 0) + 1 + "";
  4925. } else {
  4926. idxStr = "";
  4927. }
  4928. }
  4929. if (res?.datatable?.length) {
  4930. const $table = state.innerClothLayerMxRef.element;
  4931. // $table.remove();
  4932. let _rows = res?.datatable.map((item: any, index: number) => {
  4933. let _data: any = {};
  4934. if (Number(item.if_mtrl) > 1) {
  4935. _data.addmx = "+";
  4936. _data.delmx = "-";
  4937. }
  4938. _data.formulatype = item.formulatype;
  4939. _data.if_mtrl = item.if_mtrl;
  4940. _data.formulaid = item.formulaid;
  4941. _data.sortcode = item.sortcode;
  4942. _data.formulakind = item.formulakind;
  4943. _data.formula = item.formula;
  4944. _data.chastr = "内布套" + idxStr;
  4945. _data.useformula = item.useformula;
  4946. _data.gydscrp = item.gydscrp;
  4947. _data.pid = index + 1;
  4948. return _data;
  4949. });
  4950. // let tree = {
  4951. // chastr: "内布套",
  4952. // children: _rows
  4953. // };
  4954. // $table.insertAt(tree, -1);
  4955. await $table.insertAt(_rows, -1);
  4956. ElMessage.success("导入成功");
  4957. }
  4958. resetMergeCellsInner();
  4959. };
  4960. const resetMergeCellsInner = () => {
  4961. setTimeout(() => {
  4962. const $table = state.innerClothLayerMxRef.element;
  4963. if ($table) {
  4964. let mergeCells = autoMergeCells($table, ["chastr"]);
  4965. console.log("resetMergeCellsInner autoMergeCells :>> ", mergeCells);
  4966. $table.setMergeCells(mergeCells);
  4967. }
  4968. }, 200);
  4969. };
  4970. const resetSpecialProcesses = (type: string) => {
  4971. console.log("resetSpecialProcesses type:>> ", type);
  4972. console.log("resetSpecialProcesses additionalCostsMxInitData:>> ", state.additionalCostsMxInitData);
  4973. console.log("resetSpecialProcesses specialProcessesMxInitData:>> ", state.specialProcessesMxInitData);
  4974. // setTimeout(() => {
  4975. // const $table = state.innerClothLayerMxRef.element;
  4976. // if ($table) {
  4977. // let mergeCells = autoMergeCells($table, ["chastr"]);
  4978. // console.log("resetMergeCellsInner autoMergeCells :>> ", mergeCells);
  4979. // $table.setMergeCells(mergeCells);
  4980. // }
  4981. // }, 200);
  4982. };
  4983. const hanleDelMxInner = (type: number) => {
  4984. const $table = state.innerClothLayerMxRef.element;
  4985. if ($table) {
  4986. if (type == 1) {
  4987. // 全部
  4988. $table.remove();
  4989. } else if (type == 0) {
  4990. // 删除选中
  4991. const curRow = $table.getCurrentRecord();
  4992. if (!curRow) {
  4993. ElMessage.warning("请先选择要删除的行");
  4994. return;
  4995. }
  4996. $table.remove(curRow);
  4997. }
  4998. }
  4999. };
  5000. const w_mattress_add_itemname_choose = (type: number) => {
  5001. let arr = [];
  5002. if (type == 1) {
  5003. } else if (type == 2) {
  5004. } else if (type == 3) {
  5005. arr.push({
  5006. label: "内布套",
  5007. value: "内布套"
  5008. });
  5009. arr.push({
  5010. label: "内布套拆装",
  5011. value: "内布套拆装"
  5012. });
  5013. } else if (type == 4) {
  5014. arr.push({
  5015. label: "顶布裥棉1",
  5016. value: "顶布裥棉1"
  5017. });
  5018. arr.push({
  5019. label: "顶布裥棉2",
  5020. value: "顶布裥棉2"
  5021. });
  5022. arr.push({
  5023. label: "顶布裥棉3",
  5024. value: "顶布裥棉3"
  5025. });
  5026. arr.push({
  5027. label: "顶布裥棉4",
  5028. value: "顶布裥棉4"
  5029. });
  5030. }
  5031. return arr;
  5032. };
  5033. const wf_add_w_butao = async (val: any) => {
  5034. console.log("val :>> ", val);
  5035. const $table = state.topCottonMxRef.element;
  5036. if ($table) {
  5037. const { fullData } = $table.getTableData();
  5038. let ifind = fullData.find(t => t.chastr == val.value);
  5039. if (ifind) {
  5040. ElMessage.warning(`该选项${val.value}已存在`);
  5041. return;
  5042. }
  5043. let newParams: any = {};
  5044. newParams.queryParams = {
  5045. arg_array_formulatype: [103],
  5046. arrg_usetype: 0
  5047. };
  5048. newParams.dsname = "web_mattress_formulalist";
  5049. let res = await CommonDynamicSelect(newParams);
  5050. console.log("funcAddBigSide res :>> ", res);
  5051. if (res.datatable) {
  5052. let _rows = res?.datatable.map((item: any) => {
  5053. let _data: any = {};
  5054. if (Number(item.if_mtrl) > 1) {
  5055. _data.addmx = "+";
  5056. _data.delmx = "-";
  5057. }
  5058. _data.formulatype = item.formulatype;
  5059. _data.if_mtrl = item.if_mtrl;
  5060. _data.formulaid = item.formulaid;
  5061. _data.sortcode = item.sortcode;
  5062. _data.formulakind = item.formulakind;
  5063. _data.formula = item.formula;
  5064. _data.chastr = val.value;
  5065. _data.useformula = item.useformula;
  5066. _data.gydscrp = item.gydscrp;
  5067. return _data;
  5068. });
  5069. $table.insertAt(_rows, -1);
  5070. }
  5071. }
  5072. resetMergeCellsTopCotton();
  5073. };
  5074. const resetMergeCellsTopCotton = () => {
  5075. setTimeout(() => {
  5076. const $table = state.topCottonMxRef.element;
  5077. if ($table) {
  5078. let mergeCells = autoMergeCells($table, ["chastr"]);
  5079. console.log("resetMergeCellsInner autoMergeCells :>> ", mergeCells);
  5080. $table.setMergeCells(mergeCells);
  5081. }
  5082. }, 1);
  5083. };
  5084. /**
  5085. * @description 删除顶布裥棉明细
  5086. */
  5087. const wf_del_w_butao = async () => {
  5088. const $table = state.topCottonMxRef.element;
  5089. // 删除选中
  5090. const curRow = $table.getCurrentRecord();
  5091. const { fullData } = $table.getTableData();
  5092. if (!curRow) {
  5093. ElMessage.warning("请先选择要删除的行");
  5094. return;
  5095. }
  5096. let ls_chastr = curRow.chastr;
  5097. ElMessageBox.confirm(`是否确定要删除【${ls_chastr}】的明细行?`, "询问", {
  5098. confirmButtonText: "是",
  5099. cancelButtonText: "否",
  5100. type: "warning"
  5101. }).then(() => {
  5102. let _rows = fullData.filter((item: any) => item.chastr == ls_chastr);
  5103. $table.remove(_rows);
  5104. ElMessage({
  5105. type: "success",
  5106. message: "删除成功"
  5107. });
  5108. });
  5109. };
  5110. /**
  5111. * @description 获取部门的价格表id
  5112. * @returns
  5113. */
  5114. const getPriceid = () => {
  5115. let _deptid = state.LjDetailRef?._mainData?.deptid ?? 0;
  5116. if (!_deptid) {
  5117. ElMessage.warning("请先选择部门");
  5118. state.LjDetailRef?.baseformRef.element.validateField("deptid");
  5119. return 0;
  5120. }
  5121. let deptEnum = state.LjDetailRef.enumMap.get("deptid");
  5122. let _pricelistid = 0;
  5123. if (deptEnum) {
  5124. let depItem = deptEnum.find((item: any) => item.value == _deptid);
  5125. if (depItem) {
  5126. _pricelistid = Number(depItem.pricelistid);
  5127. }
  5128. }
  5129. return _pricelistid;
  5130. };
  5131. // 节流
  5132. const disshow_subspecs = throttle((val: any) => {
  5133. setMxSpringQtyWidthAndLength(val);
  5134. }, 500);
  5135. /**
  5136. * @description 设置床网高度,自动计算宽度,长度
  5137. */
  5138. const setMxSpringQtyWidthAndLength = async scope => {
  5139. console.log("setMxSpringQtyWidthAndLength varow :>> ", scope);
  5140. const { row } = scope;
  5141. const $tableBednet = state.bednetMxRef.element;
  5142. if ($tableBednet) {
  5143. const { visibleData } = $tableBednet.getTableData();
  5144. // 需要填写关键数据
  5145. if (!Number(row.mattress_width) || !Number(row.mattress_length) || !Number(row.mattress_height)) {
  5146. return;
  5147. }
  5148. // 如果表格没有数据/没有选床网,则不执行
  5149. if (!visibleData.length || !visibleData[0].mtrlid) {
  5150. return;
  5151. }
  5152. let _mainData = visibleData[0];
  5153. let _pricelistid = getPriceid();
  5154. let bednet = cloneDeep(_mainData);
  5155. bednet.bednetid = _mainData.mtrlid;
  5156. // bednet.if_doublenet = Number(bednet.if_doublenet);
  5157. // bednet.if_doublespring = Number(bednet.if_doublespring);
  5158. // bednet.if_side_iron = Number(bednet.if_side_iron);
  5159. // bednet.if_rsorwa = Number(bednet.if_rsorwa);
  5160. // bednet.if_sponge_drilling = Number(bednet.if_sponge_drilling);
  5161. // bednet.iffork = Number(bednet.iffork);
  5162. // bednet.ifsaleout = Number(bednet.ifsaleout);
  5163. // bednet.if_jb = Number(bednet.if_jb);
  5164. // bednet.flag = Number(bednet.flag);
  5165. bednet.mattress_length = row.mattress_length;
  5166. bednet.mattress_width = row.mattress_width;
  5167. bednet.pricelistid = _pricelistid;
  5168. let _params: any = {
  5169. bednet: bednet
  5170. // bednetMx: state.vxeTableMxRef?.element.getTableData().fullData ?? [],
  5171. // spring: state.vxeTableMxSpringRef?.element.getTableData().fullData ?? []
  5172. };
  5173. console.log("setMxSpringQtyWidthAndLength _params :>> ", _params);
  5174. let res = await GetComputeSpring(_params);
  5175. console.log("setMxSpringQtyWidthAndLength res :>> ", res);
  5176. console.log("setMxSpringQtyWidthAndLength row :>> ", row);
  5177. if (!res?.message) {
  5178. scope.row.spring_qty_width = res.bednetMx[0].spring_qty_width;
  5179. scope.row.spring_qty_length = res.bednetMx[0].spring_qty_length;
  5180. }
  5181. console.log("setMxSpringQtyWidthAndLength scopes row :>> ", scope.row);
  5182. }
  5183. };
  5184. /**
  5185. * @description 自动导入修改特殊工艺费用
  5186. */
  5187. const autoLoadExtraData_chai = (value?: any, fieldName?: any) => {
  5188. console.log("autoLoadExtraData_chai value :>> ", value);
  5189. let _type = "";
  5190. switch (fieldName) {
  5191. case "if_m_chai":
  5192. _type = "面拆";
  5193. break;
  5194. case "if_z_chai":
  5195. _type = "中拆";
  5196. break;
  5197. case "if_d_chai":
  5198. _type = "底拆";
  5199. break;
  5200. }
  5201. console.log("state. specialProcessesEnum:>> ", state.specialProcessesEnum, state.specialProcessesMxData);
  5202. let result = state.specialProcessesMxData.filter((item: any) => item.extramxname.indexOf(_type) > -1);
  5203. if (result.length) {
  5204. const $tableTarget = state.specialProcessesMxRef.element;
  5205. const { visibleData: tgVisibleData } = $tableTarget.getTableData();
  5206. if (tgVisibleData) {
  5207. let _remove = [];
  5208. tgVisibleData.map(t => {
  5209. let _itm = result.find(i => i.extraid === t.extraid && i.extramxid === t.extramxid);
  5210. if (_itm) {
  5211. _remove.push(t);
  5212. }
  5213. });
  5214. $tableTarget.remove(_remove);
  5215. }
  5216. if (value) {
  5217. // 新增
  5218. if (result.length) {
  5219. let _arr = [];
  5220. let _mattressId = state.LjDetailRef._mainData.mattressid;
  5221. result.map(o => {
  5222. let _itm = {
  5223. mattressid: _mattressId,
  5224. mattressmxid: 0,
  5225. extraid: o.extraid,
  5226. extramxid: o.extramxid,
  5227. extraname: o.extramxname,
  5228. price: o.price,
  5229. qty: o.qty,
  5230. dscrp: o.dscrp,
  5231. inputtype: o.inputtype,
  5232. typeid: o.typeid
  5233. };
  5234. _arr.push(_itm);
  5235. });
  5236. $tableTarget.insertAt(_arr, -1);
  5237. }
  5238. } else {
  5239. // 删除
  5240. }
  5241. }
  5242. };
  5243. const gotoErpapi = (_cur, type) => {
  5244. try {
  5245. if (type === 1) {
  5246. if (_cur.yw_flag == 1) {
  5247. throw new Error(_cur.mattresscode + ":已业务补充审核,无法修改");
  5248. }
  5249. } else if (type === 2) {
  5250. if (_cur.js1_flag == 1) {
  5251. throw new Error(_cur.mattresscode + ":已产品补充审核,无法修改");
  5252. }
  5253. } else if (type === 3) {
  5254. if (_cur.js2_flag == 1) {
  5255. throw new Error(_cur.mattresscode + ":已清单补充审核,无法修改");
  5256. }
  5257. }
  5258. } catch (error) {
  5259. ElMessage.error(error.message);
  5260. return false;
  5261. }
  5262. router.push({
  5263. path: `/erpapi/mattressInterface/edit/${_cur.mattressid}`,
  5264. query: {
  5265. code: _cur.mattresscode,
  5266. type: type
  5267. }
  5268. });
  5269. };
  5270. return {
  5271. ...toRefs(state),
  5272. columns,
  5273. columnsMx,
  5274. columnsMxBednet: funcMergeColumn(columnsMx, bednetCoumns),
  5275. columnsMxCushions: funcMergeColumn(columnsMx, cushionsColumns),
  5276. columnsMxAccessories: funcMergeColumn(columnsMx, accessoriesColumns),
  5277. columnsMxPackag: funcMergeColumn(columnsMx, packagColumns),
  5278. columnsMxInnerClothLayer,
  5279. // summaryData,
  5280. // fieldParams,
  5281. columnsMx_subSpecs,
  5282. columnsMx_processes,
  5283. columnsMx_additional,
  5284. funcAddMxSide,
  5285. funcChaifenTab,
  5286. getData_mx,
  5287. dataCallback,
  5288. dataCallbackMx,
  5289. getMattressType,
  5290. gotoSummy,
  5291. gotoHisprice,
  5292. getFormulakindEnum,
  5293. funcPacktypeChange,
  5294. dynamicRef,
  5295. wf_cmp_cb,
  5296. handleToImportMxInner,
  5297. hanleDelMxInner,
  5298. wf_add_w_butao,
  5299. wf_del_w_butao,
  5300. w_mattress_add_itemname_choose,
  5301. wf_rtr_bednet,
  5302. funcAddMtrlMx,
  5303. resetMergeCellsInner,
  5304. resetSpecialProcesses,
  5305. resetMergeCellsTopCotton,
  5306. wf_rtr_cwdc,
  5307. gotoErpapi
  5308. };
  5309. };