123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679 |
- import { ref, reactive, computed, toRefs, nextTick, inject } from "vue";
- import { Table } from "@/hooks/interface";
- import { ColumnProps } from "@/components/LjVxeTable/interface";
- import { ALLOW_EDIT_STATE, sys_arry_formulatype } from "@/config/index";
- import { CommonDynamicSelect } from "@/api/modules/common";
- import { GetComputeMattress, GetMattressImportDW2, GetMattressPackagMx, GetComputeSpring } from "@/api/modules/quote";
- import { useUserStore } from "@/stores/modules/user";
- import MtrldefSelect from "@/views/system/selector/mtrldef/select.vue";
- import BednetSelect from "@/views/system/selector/bednet/select.vue";
- import { handleRowAccordingToProp } from "@/utils";
- import { ElButton, ElMessage, ElPopconfirm, ElMessageBox, ElNotification, ElTag } from "element-plus";
- import { Minus, Plus, InfoFilled } from "@element-plus/icons-vue";
- import { DwnameEnum } from "@/enums/dwnameEnum";
- import { isArray } from "@/utils/is";
- import {
- calculateFormula,
- formulaPartsFormula,
- floatAdd,
- floatMul,
- formatFixedNumber,
- autoMergeCells,
- formatCutNumber,
- formatAmount3,
- floatDiv
- } from "@/utils/index";
- import { cloneDeep, defaultsDeep, throttle } from "lodash-es";
- import { TYPE, useToast, POSITION } from "vue-toastification";
- import ToastFormula from "@/components/ToastWidget/Formula/index.vue";
- import ToastHistoryPrice from "@/components/ToastWidget/HistoryPrice/index.vue";
- import { useRouter } from "vue-router";
- import { useGlobalStore } from "@/stores/modules/global";
- import { storeToRefs } from "pinia";
- // import { title } from "process";
- interface defaultState {
- /**
- * @description 单据当前状态
- */
- orderStatus: string;
- vxeTableRef: any;
- LjDetailRef: any;
- MtrldefDialogRef: any;
- MtrldefDialogProps: any;
- BednetDialogRef: any;
- BednetDialogProps: any;
- /**
- * @description 面料tab页拆分
- */
- fabricMxTabList: any[];
- otherMxTabList: any[];
- /**
- * @description 面料当前tab页
- */
- fabricMxTabs: any;
- // fabricMxRef: any;
- fabricMxTab8Ref: any;
- fabricMxTab9Ref: any;
- fabricMxTab10Ref: any;
- fabricMxTab11Ref: any;
- fabricMxTab12Ref: any;
- fabricMxTab13Ref: any;
- bednetMxRef: any;
- cushionsMxRef: any;
- accessoriesMxRef: any;
- packagMxRef: any;
- innerClothLayerMxRef: any;
- topCottonMxRef: any;
- subSpecsRef: any;
- fabricMxTab8: any[];
- fabricMxTab9: any[];
- fabricMxTab10: any[];
- fabricMxTab11: any[];
- fabricMxTab12: any[];
- fabricMxTab13: any[];
- /**
- * @description 面料明细数据-裥大侧 新增
- */
- fabricMx10NewMtrlGroup: any[];
- /**
- * @description 面料明细数据-裥小侧 新增
- */
- fabricMx11NewMtrlGroup: any[];
- /**
- * @description 床垫类型枚举
- */
- mattresstypeEnum: any;
- /**
- * @description 原始明细数据
- */
- oriMxData: any;
- initParams: any;
- /**
- * @description 垫层数据
- */
- cushionsMxData: any;
- fabricMxData: any;
- /**
- * @description 辅料数据
- */
- accessoriesMxData: any;
- /**
- * @description 床网数据
- */
- bednetMxData: any;
- /**
- * @description 包装数据
- */
- packagMxData: any;
- /**
- * @description 公式弹窗-是否展示详细公式
- */
- showFormula: boolean;
- QuoteListDrawerRef: any;
- formulaKindEnum: any;
- formulaKindDcEnum: any;
- packtypeOptions: any;
- woodpallettypeOptions: any;
- areaOptions: any;
- cabinetTypeOptions: any;
- diancengAreaEnum: any;
- topCottonAddList: any;
- AllFormulaRef: any;
- LjDrawerRef: any;
- bednetDrawerProps: bednetDrawerPropsdata;
- cmpFormulas: any;
- cmpFormulaReplace: any;
- cmpFormulasOri: any;
- cmpFormulasBednet: any;
- cmpDiffer: any;
- specialProcessesMxRef: any;
- additionalCostsMxRef: any;
- specialProcessesMxData: any;
- additionalCostsMxData: any;
- specialProcessesMxInitData: any;
- additionalCostsMxInitData: any;
- specialProcessesEnum: any;
- additionalCostsEnum: any;
- isShowOriginFormulaMattress: boolean;
- columnsMx_subSpecs_dis: any[];
- subSpecsData: any[];
- }
- interface bednetDrawerPropsdata {
- deptid?: number;
- bednetid?: number;
- state?: string;
- }
- export const useHooks = (t?: any) => {
- const state = reactive<defaultState>({
- orderStatus: "",
- vxeTableRef: null,
- LjDetailRef: null,
- // fabricMxRef: null,
- fabricMxTab8Ref: null,
- fabricMxTab9Ref: null,
- fabricMxTab10Ref: null,
- fabricMxTab11Ref: null,
- fabricMxTab12Ref: null,
- fabricMxTab13Ref: null,
- MtrldefDialogRef: null,
- MtrldefDialogProps: {},
- BednetDialogRef: null,
- BednetDialogProps: {},
- fabricMxTabs: "",
- fabricMxTabList: [
- {
- label: "裥面",
- name: "tabpage_8",
- visible: () => Number(state.mattresstypeEnum?.if_top_side) == 1,
- type: [0, 80, 40, 50, 60, 70, 9000],
- ref: "fabricMxTab8Ref"
- },
- {
- label: "裥底",
- name: "tabpage_9",
- visible: () => Number(state.mattresstypeEnum?.if_button_sdie) == 1,
- type: [1, 81, 41, 51, 61, 71, 9001],
- ref: "fabricMxTab9Ref"
- },
- {
- label: "裥大恻",
- name: "tabpage_10",
- visible: () => Number(state.mattresstypeEnum?.if_big_side) == 1,
- type: [2, 82, 42, 52, 62, 72, 9002],
- ref: "fabricMxTab10Ref"
- },
- {
- label: "裥小恻",
- name: "tabpage_11",
- visible: () => Number(state.mattresstypeEnum?.if_small_side) == 1,
- type: [3, 83, 43, 53, 63, 73, 9003],
- ref: "fabricMxTab11Ref"
- },
- {
- label: "裥V恻",
- name: "tabpage_12",
- visible: () => Number(state.mattresstypeEnum?.if_v_side) == 1,
- type: [4, 84, 44, 54, 64, 74, 9004],
- ref: "fabricMxTab12Ref"
- },
- {
- label: "拉手刺绣及其他工艺",
- name: "tabpage_13",
- visible: () => true,
- type: [
- 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,
- 9001, 9002, 9003, 9004, 9005, 9006
- ], // not in
- ref: "fabricMxTab13Ref"
- },
- {
- label: "床网",
- name: "bednetMx",
- ref: "bednetMxRef"
- },
- {
- label: "垫层",
- name: "cushionsMx",
- ref: "cushionsMxRef"
- },
- {
- label: "辅料",
- name: "accessoriesMx",
- ref: "accessoriesMxRef"
- },
- {
- label: "包装",
- name: "packagMx",
- ref: "packagMxRef"
- },
- {
- label: "内布套",
- name: "innerClothLayerMx",
- ref: "innerClothLayerMxRef"
- },
- {
- label: "顶布裥棉",
- name: "topCottonMx",
- ref: "topCottonMxRef"
- },
- {
- label: "特殊工艺费用",
- name: "specialProcesses",
- ref: "specialProcessesMxRef"
- },
- {
- label: "材料额外费用",
- name: "additionalCosts",
- ref: "additionalCostsMxRef"
- }
- ],
- otherMxTabList: [
- {
- label: "内布套",
- name: "tabpage_14",
- type: [101, 102, 103, 104, 105, 106]
- },
- {
- label: "外布套",
- name: "tabpage_15",
- type: [111, 112, 113, 114, 115, 116]
- }
- ],
- fabricMxTab8: [],
- fabricMxTab9: [],
- fabricMxTab10: [],
- fabricMxTab11: [],
- fabricMxTab12: [],
- fabricMxTab13: [],
- fabricMx10NewMtrlGroup: [
- {
- label: "普通大侧",
- value: 1
- },
- {
- label: "上下拼侧1",
- value: 2
- },
- {
- label: "上下拼侧2",
- value: 3
- },
- {
- label: "上下拼侧3",
- value: 4
- },
- {
- label: "左右拼侧1",
- value: 5
- },
- {
- label: "左右拼侧2",
- value: 6
- },
- {
- label: "左右拼侧3",
- value: 7
- },
- {
- label: "左右拼侧4",
- value: 8
- }
- ],
- fabricMx11NewMtrlGroup: [
- {
- label: "小侧1",
- value: 1
- },
- {
- label: "小侧1-上下拼侧1",
- value: 2
- },
- {
- label: "小侧1-上下拼侧2",
- value: 3
- },
- {
- label: "小侧1-上下拼侧3",
- value: 4
- }
- ],
- mattresstypeEnum: {},
- oriMxData: {},
- initParams: { arg_mattressid: 0 },
- fabricMxData: [],
- bednetMxData: [],
- cushionsMxData: [],
- accessoriesMxData: [],
- packagMxData: [],
- showFormula: false,
- QuoteListDrawerRef: null,
- formulaKindEnum: null,
- formulaKindDcEnum: null,
- bednetMxRef: null,
- cushionsMxRef: null,
- accessoriesMxRef: null,
- packagMxRef: null,
- innerClothLayerMxRef: null,
- topCottonMxRef: null,
- subSpecsRef: null,
- packtypeOptions: [
- {
- label: "压包",
- value: 0
- },
- {
- label: "卷包",
- value: 1
- },
- {
- label: "国内",
- value: 2
- }
- ],
- woodpallettypeOptions: [
- {
- label: "普通木托",
- value: 0
- },
- {
- label: "夹板木托",
- value: 1
- },
- {
- label: "铁管木托",
- value: 2
- }
- ],
- areaOptions: [
- {
- label: "普通地区",
- value: "普通地区"
- },
- {
- label: "特定地区",
- value: "特定地区"
- }
- ],
- cabinetTypeOptions: [
- {
- label: "大柜",
- value: "大柜"
- },
- {
- label: "小柜",
- value: "小柜"
- }
- ],
- diancengAreaEnum: [],
- topCottonAddList: [],
- AllFormulaRef: null,
- LjDrawerRef: null,
- bednetDrawerProps: {},
- cmpFormulas: [],
- cmpFormulaReplace: [],
- cmpFormulasOri: [],
- cmpFormulasBednet: [],
- cmpDiffer: [],
- specialProcessesMxRef: null,
- additionalCostsMxRef: null,
- specialProcessesMxData: [],
- additionalCostsMxData: [],
- specialProcessesMxInitData: [],
- additionalCostsMxInitData: [],
- specialProcessesEnum: [],
- additionalCostsEnum: [],
- isShowOriginFormulaMattress: false,
- columnsMx_subSpecs_dis: [],
- subSpecsData: []
- });
- const router = useRouter();
- /**
- * @description 面料分类取值
- */
- const mtrltypeTabList = [
- {
- label: "选布料",
- formulakinds: [0, 1, 2, 3, 4, 101, 111],
- value: 3
- },
- {
- label: "喷胶绵",
- formulakinds: [40, 41, 42, 43, 44, 102, 112],
- value: 5
- },
- {
- label: "裥绵海绵",
- formulakinds: [50, 51, 52, 53, 54, 103, 113],
- value: 4
- },
- {
- label: "无纺布",
- formulakinds: [60, 61, 62, 63, 64, 104, 114],
- value: 30
- },
- {
- label: "裥花图案",
- formulakinds: [70, 71, 72, 73, 74, 105, 115],
- value: 26
- },
- {
- label: "布料-加工工艺",
- formulakinds: [80, 81, 82, 83, 84, 106, 116],
- value: 15
- },
- {
- label: "拉手",
- formulakinds: [5],
- value: 10
- },
- {
- label: "刺绣",
- formulakinds: [6],
- value: 11
- },
- {
- label: "大侧*压布",
- formulakinds: [7],
- value: 3
- },
- {
- label: "大侧*边带",
- formulakinds: [8, 9],
- value: 9
- },
- {
- label: "大侧*上下压线",
- formulakinds: [10],
- value: 12
- },
- {
- label: "垫层",
- formulakinds: [11, 32, 33],
- value: 6
- },
- {
- label: "顶布",
- formulakinds: [12],
- value: 3
- },
- {
- label: "毡类",
- formulakinds: [13],
- value: 7
- },
- {
- label: "打底无纺布",
- formulakinds: [14],
- value: 2
- },
- {
- label: "辅料",
- formulakinds: [15],
- value: 8
- },
- {
- label: "PE",
- formulakinds: [16],
- value: 16
- },
- {
- label: "外层PE",
- formulakinds: [17],
- value: 17
- },
- {
- label: "PVC",
- formulakinds: [18],
- value: 18
- },
- {
- label: "卷包包装",
- formulakinds: [19],
- value: 19
- },
- {
- label: "牛皮纸袋",
- formulakinds: [20],
- value: 20
- },
- {
- label: "蓝色PE护角",
- formulakinds: [21],
- value: 21
- },
- {
- label: "无纺布袋",
- formulakinds: [22],
- value: 22
- },
- {
- label: "牛皮袋护角",
- formulakinds: [23],
- value: 23
- },
- {
- label: "编织袋",
- formulakinds: [24],
- value: 24
- },
- {
- label: "外袋",
- formulakinds: [25],
- value: 13
- },
- {
- label: "内袋",
- formulakinds: [26],
- value: 14
- },
- {
- label: "无拉手脚轮",
- formulakinds: [27],
- value: -1
- },
- {
- label: "拉钮",
- formulakinds: [28],
- value: -1
- },
- {
- label: "网面布料",
- formulakinds: [29],
- value: -1
- },
- {
- label: "防火线",
- formulakinds: [30],
- value: 32
- },
- {
- label: "木托",
- formulakinds: [31],
- value: -1
- },
- {
- label: "床网",
- formulakinds: [99],
- value: -1
- },
- {
- label: "拉链",
- formulakinds: [202],
- value: 31
- },
- {
- label: "席垫",
- formulakinds: [203],
- value: 32
- },
- {
- label: "车花边",
- formulakinds: [205],
- value: 32
- },
- {
- label: "骨条",
- formulakinds: [206],
- value: 33
- }
- ];
- /**
- * @description 包装
- */
- const mtrltypeTabList_packag = [
- {
- label: "选布料",
- formulakinds: [0, 1, 2, 3, 4],
- value: 3
- },
- {
- label: "喷胶绵",
- formulakinds: [40, 41, 42, 43, 44],
- value: 5
- },
- {
- label: "裥绵海绵",
- formulakinds: [50, 51, 52, 53, 54],
- value: 4
- },
- {
- label: "无纺布",
- formulakinds: [60, 61, 62, 63, 64],
- value: 2
- },
- {
- label: "裥花图案",
- formulakinds: [70, 71, 72, 73, 74],
- value: 4
- },
- {
- label: "布料-加工工艺",
- formulakinds: [80, 81, 82, 83, 84],
- value: 15
- },
- {
- label: "拉手",
- formulakinds: [5],
- value: 10
- },
- {
- label: "刺绣",
- formulakinds: [6],
- value: 11
- },
- {
- label: "大侧*压布",
- formulakinds: [7],
- value: 2
- },
- {
- label: "大侧*边带",
- formulakinds: [8, 9],
- value: 9
- },
- {
- label: "大侧*上下压线",
- formulakinds: [10],
- value: 12
- },
- {
- label: "垫层",
- formulakinds: [11, 32, 33],
- value: 6
- },
- {
- label: "顶布",
- formulakinds: [12],
- value: 3
- },
- {
- label: "毡类",
- formulakinds: [13],
- value: 7
- },
- {
- label: "打底无纺布",
- formulakinds: [14],
- value: 2
- },
- {
- label: "辅料",
- formulakinds: [15],
- value: 8
- },
- {
- label: "PE",
- formulakinds: [16],
- value: 16
- },
- {
- label: "外层PE",
- formulakinds: [17],
- value: 17
- },
- {
- label: "PVC",
- formulakinds: [18],
- value: 18
- },
- {
- label: "卷包包装",
- formulakinds: [19],
- value: 19
- },
- {
- label: "牛皮纸袋",
- formulakinds: [20],
- value: 20
- },
- {
- label: "蓝色PE护角",
- formulakinds: [21],
- value: 21
- },
- {
- label: "无纺布袋",
- formulakinds: [22],
- value: 22
- },
- {
- label: "牛皮袋护角",
- formulakinds: [23],
- value: 23
- },
- {
- label: "编织袋",
- formulakinds: [24],
- value: 24
- },
- {
- label: "外袋",
- formulakinds: [25],
- value: 13
- },
- {
- label: "内袋",
- formulakinds: [26],
- value: 14
- },
- {
- label: "无拉手脚轮",
- formulakinds: [27],
- value: 19
- },
- {
- label: "拉钮",
- formulakinds: [28],
- value: -1
- },
- {
- label: "网面布料",
- formulakinds: [29],
- value: -1
- },
- {
- label: "防火线",
- formulakinds: [30],
- value: -1
- },
- {
- label: "木托",
- formulakinds: [31],
- value: 28
- },
- {
- label: "无纺布护角",
- formulakinds: [201],
- value: 27
- },
- {
- label: "床网",
- formulakinds: [99],
- value: -1
- }
- ];
- /**
- * @description 垫层
- */
- const mtrltypeTabList_cushions = [
- {
- label: "垫层",
- formulakinds: [11, 32, 33],
- value: 6
- },
- {
- label: "顶布",
- formulakinds: [12],
- value: 29
- },
- {
- label: "毡类",
- formulakinds: [13, 35],
- value: 7
- },
- {
- label: "打底无纺布",
- formulakinds: [14],
- value: 2
- },
- {
- label: "网面布料",
- formulakinds: [29],
- value: 3
- },
- {
- label: "顶布裥棉",
- formulakinds: [1201],
- value: 1201
- }
- ];
- /**
- * @description 辅料
- */
- const mtrltypeTabList_accessories = [
- {
- label: "辅料",
- formulakinds: [15],
- value: 8
- }
- ];
- /**
- * @description 内布套
- */
- const mtrltypeTabList_inner = [
- {
- label: "选布料",
- formulakinds: [0, 1, 2, 3, 4, 101, 111],
- value: 3
- },
- {
- label: "喷胶绵",
- formulakinds: [40, 41, 42, 43, 44, 102, 112],
- value: 5
- },
- {
- label: "裥绵海绵",
- formulakinds: [50, 51, 52, 53, 54, 103, 113],
- value: 4
- },
- {
- label: "无纺布",
- formulakinds: [60, 61, 62, 63, 64, 104, 114],
- value: 200
- },
- {
- label: "裥花图案",
- formulakinds: [70, 71, 72, 73, 74, 105, 115],
- value: 26
- },
- {
- label: "布料-加工工艺",
- formulakinds: [80, 81, 82, 83, 84, 106, 116],
- value: 15
- },
- {
- label: "拉手",
- formulakinds: [5],
- value: 10
- },
- {
- label: "刺绣",
- formulakinds: [6],
- value: 11
- },
- {
- label: "大侧*压布",
- formulakinds: [7],
- value: 2
- },
- {
- label: "大侧*边带",
- formulakinds: [8, 9],
- value: 9
- },
- {
- label: "大侧*上下压线",
- formulakinds: [10],
- value: 12
- },
- {
- label: "垫层",
- formulakinds: [11, 32, 33],
- value: 6
- },
- {
- label: "顶布",
- formulakinds: [12],
- value: 3
- },
- {
- label: "毡类",
- formulakinds: [13],
- value: 7
- },
- {
- label: "打底无纺布",
- formulakinds: [14],
- value: 2
- },
- {
- label: "辅料",
- formulakinds: [15],
- value: 8
- },
- {
- label: "PE",
- formulakinds: [16],
- value: 16
- },
- {
- label: "外层PE",
- formulakinds: [17],
- value: 17
- },
- {
- label: "PVC",
- formulakinds: [18],
- value: 18
- },
- {
- label: "卷包包装",
- formulakinds: [19],
- value: 19
- },
- {
- label: "牛皮纸袋",
- formulakinds: [20],
- value: 20
- },
- {
- label: "蓝色PE护角",
- formulakinds: [21],
- value: 21
- },
- {
- label: "无纺布袋",
- formulakinds: [22],
- value: 22
- },
- {
- label: "牛皮袋护角",
- formulakinds: [23],
- value: 23
- },
- {
- label: "编织袋",
- formulakinds: [24],
- value: 24
- },
- {
- label: "外袋",
- formulakinds: [25],
- value: 13
- },
- {
- label: "内袋",
- formulakinds: [26],
- value: 14
- },
- {
- label: "无拉手脚轮",
- formulakinds: [27],
- value: -1
- },
- {
- label: "拉钮",
- formulakinds: [28],
- value: -1
- },
- {
- label: "网面布料",
- formulakinds: [29],
- value: -1
- },
- {
- label: "防火线",
- formulakinds: [30],
- value: -1
- },
- {
- label: "木托",
- formulakinds: [31],
- value: -1
- },
- {
- label: "床网",
- formulakinds: [99],
- value: -1
- },
- {
- label: "拉链",
- formulakinds: [202],
- value: 31
- },
- {
- label: "边带",
- formulakinds: [203],
- value: 9
- }
- ];
- const { userInfo } = useUserStore();
- state.orderStatus = inject("orderStatus", "");
- const getData_mx = (params: any) => {
- console.log("getData params :>> ", params);
- let newParams: any = {};
- params.pageNum && (newParams.pageindex = params.pageNum);
- params.pageSize && (newParams.pagesize = params.pageSize);
- delete params.pageNum;
- delete params.pageSize;
- newParams.queryParams = params;
- console.log("params :>> ", params);
- newParams.dsname = "web_mattress_mx";
- return CommonDynamicSelect(newParams, DwnameEnum.mattressQuoteMx);
- // return [];
- };
- const dataCallback = (data: any) => {
- console.log("dataCallback data :>> ", data);
- if (data.datatable.length > 0) {
- data.datatable = data.datatable.map((item: any) => {
- item.dannum_rate = Number(item.dannum_rate);
- // item.if_w_butao = Boolean(Number(item.if_w_butao));
- return item;
- });
- }
- return {
- list: data.datatable,
- tableinfo: data.tableinfo,
- total: data.totalcnt,
- pageNum: data.pageindex,
- pageSize: data.pagesize
- };
- };
- const dataCallbackMx = (data: any) => {
- console.log("dataCallback data :>> ", data);
- return {
- list: data.datatable,
- tableinfo: data.tableinfo,
- total: data.totalcnt,
- pageNum: data.pageindex,
- pageSize: data.pagesize
- };
- };
- const funcTaxrateChange = async (val: any, data) => {
- data.taxrate = val;
- };
- /**
- * @description 弹窗模块:床网选择
- * @param data 当前数据
- * @param status 当前订单状态
- * @returns Promise
- */
- const fModelChoseBednet = (data: any, params: any, $table?: any) => {
- return new Promise((resolve, reject) => {
- // if (!ALLOW_EDIT_STATE.includes(status)) return;
- let _params = {
- ...params,
- keyword: ""
- };
- state.BednetDialogProps = {
- onSubmit: (res: any) => {
- // submit
- console.log("openCustDialog res", res);
- nextTick(() => {
- rModelSetBednet(data, res.value[0], $table);
- resolve(1);
- });
- },
- onCancel: (error: any) => {
- // cancel 回调
- console.log("openCustDialog error", error);
- }
- };
- state.BednetDialogRef.show(_params);
- });
- };
- /**
- * @description 在床网tab,更新垫层的床网厚度信息
- * @param data 床网明细信息
- * @param item 床网信息
- * @param action 动作,add,set,del,clear
- */
- const wf_rtr_cwdc = (data: any, item: any, action: string) => {
- const $table = state.cushionsMxRef.element;
- let { visibleData } = $table.getTableData();
- console.log("wf_rtr_cwdc data :>> ", data, visibleData, item);
- // fullData.map(item => {
- // if (Number(item.formulakind) == 999 && Number(item.thickness) == 0) {
- // $table.setRow(item, {
- // thickness: data.bednet_height,
- // qty: 1
- // });
- // }
- // });
- const $tableBednet = state.bednetMxRef.element;
- let currentBednetIndex = $tableBednet.getRowSeq(data);
- if (action == "add") {
- let records = cloneDeep(visibleData.find(o => o.formulakind == 999));
- records.thickness = 0;
- records.qty = 0;
- records._X_ROW_KEY = "";
- records.mattressmxid = 0;
- if (item) {
- records.thickness = item?.bednet_height;
- records.qty = 1;
- }
- let bednetList = visibleData.filter(o => Number(o.formulakind) == 999);
- let lastIndex = $table.getRowSeq(bednetList[bednetList.length - 1]);
- console.log("wf_rtr_cwdc lastIndex :>> ", bednetList, lastIndex, records);
- $table.insertAt(records, lastIndex);
- } else {
- console.log("wf_rtr_cwdc currentBednetIndex :>> ", action, currentBednetIndex);
- let index = 1;
- visibleData.map(o => {
- if (Number(o.formulakind) == 999) {
- if (index == currentBednetIndex) {
- if (action == "set") {
- $table.setRow(o, {
- thickness: item?.bednet_height,
- qty: 1
- });
- } else if (action == "clear") {
- $table.setRow(o, {
- thickness: 0,
- qty: 0
- });
- } else if (action == "del") {
- $table.remove(o);
- }
- }
- index++;
- }
- });
- }
- };
- /**
- * @description 更新床网tab的垫层床网信息
- * @param data 垫层明细信息
- */
- const wf_rtr_bednet = (data: any) => {
- console.log("wf_rtr_bednet data :>> ", data);
- const $table = state.cushionsMxRef.element;
- let { visibleData } = $table.getTableData();
- let currentcushionsIndex = $table.getRowSeq(data);
- console.log("currentcushionsIndex :>> ", currentcushionsIndex);
- const $tableBednet = state.bednetMxRef.element;
- let { visibleData: visibleData_bednet } = $tableBednet.getTableData();
- let currentBednetIndex = 0;
- let index = 0;
- visibleData.map((o, idx) => {
- if (Number(o.formulakind) == 999) {
- if (idx + 1 == currentcushionsIndex) {
- currentBednetIndex = index;
- }
- index++;
- }
- });
- console.log("wf_rtr_bednet currentBednetIndex :>> ", currentBednetIndex);
- if (visibleData_bednet.length == 1) {
- visibleData_bednet[0].mtrlid = 0;
- visibleData_bednet[0].mtrlname = "";
- visibleData_bednet[0].price = 0;
- $tableBednet.reloadData(visibleData_bednet);
- } else {
- funcDelMtrlMx({ row: visibleData_bednet[currentBednetIndex], data: visibleData_bednet }, "bednetMxRef");
- }
- // 床网与主副规格互联
- nextTick(() => {
- updateSubspecsTable();
- });
- };
- /**
- * @description 垫层tab,公式名选择,联动增删床网tab
- * @param val
- * @param lastVal
- * @param scope
- */
- const cushionsFormulaKindChange = (val: any, lastVal: any, scope: any) => {
- console.log("wf_rtr_cwdc cushionsFormulaKindChange val :>> ", val, lastVal, scope);
- const $table = state.cushionsMxRef.element;
- const $table_bednet = state.bednetMxRef.element;
- const { visibleData } = $table.getTableData();
- if (Number(val) === 999 && Number(lastVal) !== 999) {
- // 新增
- if ($table_bednet) {
- const { visibleData: visibleData_bednet } = $table_bednet.getTableData();
- let curIndex = visibleData_bednet.length - 1;
- // 寻找垫层当前位置,对上一个床网行位置进行复制
- let arr = visibleData.filter((t, i) => t.formulakind == 999 && i < scope.$rowIndex);
- if (arr.length > 0) {
- curIndex = arr.length - 1;
- }
- console.log("wf_rtr_cwdc curIndex :>> ", curIndex);
- rModelClearMtrl(scope.row);
- funcAddMtrlMx({ row: visibleData_bednet[curIndex] }, null, "bednetMxRef", arr.length == 0);
- // 床网与主副规格互联
- nextTick(() => {
- updateSubspecsTable();
- });
- }
- } else if (Number(val) !== 999 && Number(lastVal) === 999) {
- // 删除
- if ($table_bednet) {
- const { visibleData: visibleData_bednet } = $table_bednet.getTableData();
- let curIndex = visibleData_bednet.length - 1;
- curIndex = visibleData
- .filter(t => t.formulakind == 999 || t._X_ROW_KEY === scope.row._X_ROW_KEY)
- .findIndex(t => t._X_ROW_KEY === scope.row._X_ROW_KEY);
- console.log("wf_rtr_cwdc curIndex :>> ", curIndex);
- if (visibleData_bednet.length == 1) {
- ElMessage.warning("不能全部删除,至少保留一个床网");
- scope.row.formulakind = 999;
- return false;
- }
- rModelClearMtrl(scope.row);
- funcDelBednet({ row: visibleData_bednet[curIndex], data: visibleData_bednet }, null, "bednetMxRef");
- // 床网与主副规格互联
- nextTick(() => {
- updateSubspecsTable();
- });
- }
- } else {
- rModelClearMtrl(scope.row);
- }
- };
- const rModelSetBednet = (data: any, item: any, $table?: any) => {
- console.log("rModelSetBednet data :>> ", data, item);
- if (item) {
- let _mtrlname =
- item.typename +
- " " +
- item.bednetcode +
- " " +
- item.mattress_width +
- "*" +
- item.mattress_length +
- "*" +
- item.mattress_height;
- data.mtrlid = item.bednetid;
- data.mtrlname = _mtrlname;
- // data.price = item.nottax_factory_cost;
- data.price = item.total_cost;
- data.qty = 1;
- wf_rtr_cwdc(data, item, "set");
- if ($table) {
- $table.clearEdit();
- nextTick(() => {
- $table.setActiveRow(data);
- // 床网与主副规格互联
- updateSubspecsTable();
- });
- }
- }
- };
- const rModelClearBednet = (data: any, $table?: any) => {
- console.log("rModelSetBednet data :>> ", data);
- data.mtrlid = 0;
- data.mtrlname = "";
- data.price = 0;
- wf_rtr_cwdc(data, null, "clear");
- if ($table) {
- $table.clearEdit();
- nextTick(() => {
- // 床网与主副规格互联
- updateSubspecsTable();
- });
- }
- };
- /**
- * @description 弹窗模块:物料选择
- * @param data 当前数据
- * @param status 当前订单状态
- * @returns Promise
- */
- const fModelChoseMtrl = (data: any, params: any, cb: any, label?: string, $table?: any) => {
- return new Promise((resolve, reject) => {
- // if (!ALLOW_EDIT_STATE.includes(status)) return;
- let _params = {
- keyword: "",
- arg_mtrltype: params.mtrltype,
- arg_pricelistid: params.pricelistid
- };
- state.MtrldefDialogProps = {
- onSubmit: (res: any) => {
- // submit
- console.log("openCustDialog res", res);
- nextTick(() => {
- cb(data, res.value[0], $table);
- resolve(1);
- });
- },
- onCancel: (error: any) => {
- // cancel 回调
- console.log("openCustDialog error", error);
- }
- };
- state.MtrldefDialogRef.show(_params, label);
- });
- };
- /**
- * @description 数据赋值:物料信息
- * @param data 当前数据
- * @param item 当前选择的数据
- */
- const rModelSetMtrl = (data: any, item: any, $table?: any) => {
- console.log("rModelSetMtrl data :>> ", data);
- console.log("rModelSetMtrl item :>> ", item);
- if (item) {
- data.mattressid = state.LjDetailRef._mainData.mattressid;
- data.mattressmxid = 0;
- data.mtrlid = item.mtrlid;
- data.price = item.pricelistprice;
- data.gram_weight = item.gram_weight;
- data.cloth_width = item.cloth_width;
- data.if_inputqty = Number(item.if_inputqty);
- data.if_areaprice = item.if_areaprice;
- data.if_subspecs = item.if_subspecs;
- data.mtrlname = item.mtrlname;
- data.priceunit = item.priceunit;
- data.shrinkage = item.price; // 收缩率
- if (item.if_inputqty == 1 || Number(data.thickness) == 0) {
- data.thickness = Number(item.thickness);
- }
- data.price_formula = item.price_formula;
- let _qty = 1;
- if (data.formulakind == 5) {
- //默认4个拉手
- _qty = 4;
- } else if ([7, 8, 9, 202].includes(data.formulakind)) {
- // 拉手刺绣及其他工艺,大侧压压布、拉链等自动带出数量=周长
- let mattress_width = state.LjDetailRef._mainData.mattress_width ?? 0;
- let mattress_length = state.LjDetailRef._mainData.mattress_length ?? 0;
- _qty = (mattress_width / 100 + mattress_length / 100) * 2;
- }
- data.qty = _qty;
- // cb && cb();
- if ($table) {
- $table.clearEdit();
- nextTick(() => {
- $table.setActiveRow(data);
- console.log("rModelSetMtrl data.formulatype == 99 :>> ", data.formulatype == 1);
- if (data.formulatype == 1) {
- // 床网与主副规格互联
- updateSubspecsTable();
- }
- });
- }
- }
- };
- const rModelClearMtrl = (data: any, $table?: any) => {
- console.log("rModelClearMtrl data :>> ", data);
- data.mattressid = state.LjDetailRef._mainData.mattressid;
- data.mattressmxid = 0;
- data.mtrlid = 0;
- data.price = 0;
- data.gram_weight = 0;
- data.cloth_width = 0;
- data.if_inputqty = 0;
- data.if_areaprice = 0;
- data.if_subspecs = 0;
- data.mtrlname = "";
- data.priceunit = "";
- data.shrinkage = 0;
- data.thickness = 0;
- data.price_formula = "";
- data.qty = "";
- if ($table) {
- $table.clearEdit();
- console.log("rModelClearMtrl data.formulatype == 99 :>> ", data.formulatype == 1);
- nextTick(() => {
- if (data.formulatype == 1) {
- // 床网与主副规格互联
- updateSubspecsTable();
- }
- });
- }
- };
- /**
- * @description 数据赋值:物料信息
- * @param data 当前数据
- * @param item 当前选择的数据
- */
- const rModelSetMtrlInner = (data: any, item: any, $table?: any) => {
- console.log("rModelSetMtrl data :>> ", data);
- console.log("rModelSetMtrl item :>> ", item);
- if (item) {
- data.mattressid = state.LjDetailRef._mainData.mattressid;
- data.mattressmxid = 0;
- data.mtrlid = item.mtrlid;
- data.price = item.pricelistprice;
- data.gram_weight = item.gram_weight;
- data.cloth_width = item.cloth_width;
- data.if_inputqty = Number(item.if_inputqty);
- data.if_areaprice = item.if_areaprice;
- data.mtrlname = item.mtrlname;
- data.priceunit = item.priceunit;
- data.shrinkage = item.price; // 收缩率
- if (item.if_inputqty == 1 || Number(data.thickness) == 0) {
- data.thickness = Number(item.thickness);
- }
- item?.price_formula != "" && (data.price_formula = item.price_formula);
- let _qty = 1;
- if (data.formulakind == 5) {
- //默认4个拉手
- _qty = 4;
- } else if ([7, 8, 9, 30, 202, 203].includes(data.formulakind)) {
- // 拉手刺绣及其他工艺,大侧压压布7、大侧压边带8、大侧压织带9、防火线30、拉链202、内布套围边边带203,自动带出数量=周长
- let mattress_width = state.LjDetailRef._mainData.mattress_width ?? 0;
- let mattress_length = state.LjDetailRef._mainData.mattress_length ?? 0;
- _qty = (mattress_width / 100 + mattress_length / 100) * 2;
- }
- data.qty = _qty;
- if ($table) {
- $table.clearEdit();
- nextTick(() => {
- $table.setActiveRow(data);
- });
- }
- }
- };
- /**
- * @description 面料-裥大、小侧,增加物料
- */
- const funcAddMxSide = async (params: any, data: any, targetRef?: any) => {
- // arg_array_formulakind
- let newParams: any = {};
- newParams.queryParams = params;
- newParams.dsname = "web_mattress_formulalist";
- let res = await CommonDynamicSelect(newParams);
- console.log("funcAddBigSide res :>> ", res);
- if (res.datatable) {
- if (targetRef) {
- const $table = targetRef.element;
- if ($table) {
- res.datatable.map(itm => {
- let records: any = {
- formulatype: itm.formulatype,
- if_mtrl: Number(itm.if_mtrl),
- formulaid: itm.formulaid,
- sortcode: data.label,
- chastr: data.label,
- costamt: 0,
- formulakind: Number(itm.formulakind),
- formula: itm.formula,
- useformula: itm.useformula,
- gydscrp: itm.gydscrp
- };
- if (records.if_mtrl > 1) {
- records.addmx = "+";
- records.delmx = "-";
- }
- $table.insertAt(records, -1);
- });
- }
- } else {
- let arr = [];
- res.datatable.map(itm => {
- let records: any = {
- formulatype: itm.formulatype,
- if_mtrl: Number(itm.if_mtrl),
- formulaid: itm.formulaid,
- sortcode: data.label,
- chastr: data.label,
- costamt: 0,
- formulakind: Number(itm.formulakind),
- formula: itm.formula,
- useformula: itm.useformula,
- gydscrp: itm.gydscrp
- };
- if (records.if_mtrl > 1) {
- records.addmx = "+";
- records.delmx = "-";
- }
- arr.push(records);
- });
- return arr;
- }
- } else {
- return [];
- }
- };
- const wf_mtrl_find = async (params: any) => {
- let _params: any = {
- dsname: "web_mtrl_choose",
- queryparams: params
- };
- let res = await CommonDynamicSelect(_params);
- if (res?.datatable?.length) {
- return res?.datatable;
- } else {
- return [];
- }
- };
- // /**
- // * @description 垫层配置 和 垫层可选项
- // * @author w_mattress_add wf_add_dianceng_bytype
- // */
- // const wf_add_dianceng_bytype = (dianceng_sort: string) => {
- // let newMxData = [];
- // let _diancengSortStr = dianceng_sort.replace(/,/g, ",").replace(/~r~n/g, "").replace(/~r/g, "").replace(/~n/g, "");
- // let arr = _diancengSortStr.split("/");
- // let formulakindArr = [];
- // arr.map(async (t, index) => {
- // let result = f_pb_split(t);
- // let _formulakind;
- // switch (result.left) {
- // case "垫层":
- // _formulakind = 32;
- // break;
- // case "床网":
- // _formulakind = 999;
- // break;
- // case "顶布":
- // _formulakind = 12;
- // break;
- // case "毡类":
- // _formulakind = 13;
- // break;
- // case "打底无纺布":
- // _formulakind = 14;
- // break;
- // case "网面布料":
- // _formulakind = 29;
- // break;
- // default:
- // _formulakind = -1;
- // break;
- // }
- // let _params = {
- // dsname: "web_mattress_formulalist",
- // queryparams: {
- // arg_array_formulakind: [_formulakind],
- // arg_array_formulatype: [0, 1, 2, 3],
- // pageindex: 1,
- // pagesize: 1
- // }
- // };
- // let res = await CommonDynamicSelect(_params);
- // if (res?.datatable?.length) {
- // res?.datatable.map((item: any) => {
- // let _data: any = {};
- // _data.formulatype = item.formulatype;
- // _data.if_mtrl = 2;
- // _data.formulaid = item.formulaid;
- // _data.sortcode = item.sortcode;
- // _data.formulakind = item.formulakind;
- // _data.formula = item.formula;
- // _data.chastr = wf_set_area_text(result.right);
- // _data.qty = 1;
- // _data.xu = index;
- // _data.useformula = item.useformula;
- // _data.gydscrp = item.gydscrp;
- // newMxData.push(_data);
- // });
- // }
- // });
- // };
- // const wf_add_dianceng_area_bytype = (data: string) => {
- // if (!data) return;
- // let _dataStr = data.replace(/,/g, ",").replace(/~r~n/g, "").replace(/~r/g, "").replace(/~n/g, "");
- // let result: any = _dataStr.split(",");
- // result = result.map(t => {
- // return { value: t, label: t };
- // });
- // return result;
- // };
- // function wf_set_area_text(arg_str) {
- // let ls_rtn = "";
- // if (arg_str.includes("大侧")) {
- // ls_rtn = "大侧";
- // } else if (arg_str.includes("小侧1")) {
- // ls_rtn = "小侧1";
- // } else if (arg_str.includes("小侧2")) {
- // ls_rtn = "小侧2";
- // } else if (arg_str.includes("小侧3")) {
- // ls_rtn = "小侧3";
- // } else if (arg_str.includes("V侧1")) {
- // ls_rtn = "V侧1";
- // } else if (arg_str.includes("V侧2")) {
- // ls_rtn = "V侧2";
- // } else if (arg_str.includes("V侧3")) {
- // ls_rtn = "V侧3";
- // } else {
- // ls_rtn = "";
- // }
- // return ls_rtn;
- // }
- // /**
- // * @description 包装默认物料设置
- // */
- // const wf_default_mtrlid = async () => {
- // // 包装
- // console.log("wf_default_mtrlid state.packagMxData :>> ", state.packagMxData);
- // let _deptid = state.LjDetailRef._mainData.deptid;
- // let deptEnum = state.LjDetailRef.enumMap.get("deptid");
- // let _pricelistid = 0;
- // console.log("deptEnum :>> ", deptEnum);
- // if (deptEnum) {
- // let depItem = deptEnum.find((item: any) => item.value == _deptid);
- // console.log("depItem :>> ", depItem);
- // if (depItem) {
- // _pricelistid = Number(depItem.pricelistid);
- // }
- // }
- // // 根据formulaid,获取全部设置的默认物料信息
- // let defaultMtrlList = [];
- // let _param_mf = {
- // dsname: "web_mtrl_choose",
- // queryparams: {
- // arg_array_formulaid: [16, 17, 18, 19, 27],
- // arg_pricelistid: _pricelistid,
- // arg_array_mtrlid: [46804, 46809, 46811, 46817, 46872]
- // }
- // };
- // let res_mf = await CommonDynamicSelect(_param_mf);
- // if (res_mf?.datatable?.length) {
- // defaultMtrlList = res_mf?.datatable;
- // }
- // // let _mtrlData = await wf_mtrl_find(_pricelistid, [46804, 46809, 46811, 46817, 46872]);
- // console.log("wf_default_mtrlid ccccc state.packagMxData :>> ", state.packagMxData);
- // state.packagMxData.map(itm => {
- // console.log("packagMxData itm :>> ", itm);
- // let _formulakind = Number(itm.formulakind);
- // let _data = null;
- // if (_formulakind == 16) {
- // //默认 pe kind = 16 默认 10C PE袋 mtrlid 46804
- // itm.mtrlid = 46804;
- // } else if (_formulakind == 17) {
- // //默认 外层pe kind = 17 默认 20C mtrlid 46809
- // itm.mtrlid = 46809;
- // } else if (_formulakind == 18) {
- // //默认 pvc kind = 18 默认 15C mtrlid 46811
- // itm.mtrlid = 46811;
- // } else if (_formulakind == 19) {
- // //默认 卷包外包装 kind = 19 默认 彩箱 32*32 46817
- // itm.mtrlid = 46817;
- // } else if (_formulakind == 27) {
- // //默认 拉手脚轮 kind = 27 默认 46872
- // itm.mtrlid = 46872;
- // }
- // _data = defaultMtrlList.find(t => t.mtrlid == itm.mtrlid);
- // console.log("wf_default_mtrlid _data :>> ", _data);
- // if (_data) {
- // itm.mtrlname = _data.mtrlname;
- // itm.price = _data.pricelistprice;
- // itm.gram_weight = _data.gram_weight;
- // itm.cloth_width = _data.cloth_width;
- // itm.if_inputqty = _data.if_inputqty;
- // itm.priceunit = _data.priceunit;
- // itm.shrinkage = _data.shrinkage;
- // itm.qty = 1;
- // if (_data.formula != "") {
- // itm.formula = _data.formula;
- // }
- // }
- // return itm;
- // });
- // console.log("wf_default_mtrlid state.packagMxData :>> ", state.packagMxData);
- // };
- // const wf_default_mtrlid_notbz = async () => {
- // console.log("state.oriMxData.list bf state.oriMxData.list :>> ", state.oriMxData.list);
- // // 收集数据中各种公式的formulaid
- // let _formulaids = [];
- // state.oriMxData.list.forEach((itm: any) => {
- // _formulaids.push(itm.formulaid);
- // });
- // // 数组去重
- // _formulaids = Array.from(new Set(_formulaids));
- // // 部门设置的报价表
- // let _pricelistid = 0;
- // let _deptid = state.LjDetailRef._mainData.deptid;
- // let deptEnum = state.LjDetailRef.enumMap.get("deptid");
- // console.log("deptEnum :>> ", deptEnum);
- // if (deptEnum) {
- // let depItem = deptEnum.find((item: any) => item.value == _deptid);
- // console.log("depItem :>> ", depItem);
- // if (depItem) {
- // _pricelistid = Number(depItem.pricelistid);
- // }
- // }
- // // 根据formulaid,获取全部设置的默认物料信息
- // let defaultMtrlList = [];
- // let _param_mf = {
- // dsname: "web_mtrl_choose",
- // queryparams: {
- // arg_array_formulaid: _formulaids,
- // arg_pricelistid: _pricelistid,
- // arg_array_mtrlid: [46804, 46809, 46811, 46817, 46872]
- // }
- // };
- // let res_mf = await CommonDynamicSelect(_param_mf);
- // if (res_mf?.datatable?.length) {
- // defaultMtrlList = res_mf?.datatable;
- // }
- // state.oriMxData.list.forEach((itm: any) => {
- // let _formulakind = Number(itm.formulakind);
- // let _data = defaultMtrlList.find(t => t.formulaid == itm.formulaid);
- // console.log("wf_default_mtrlid_notbz 查询默认物料_data :>> ", _data);
- // // 包装default
- // if (itm.formulatype == "3") {
- // let changeMtrl = 0;
- // if (_formulakind == 16) {
- // //默认 pe kind = 16 默认 10C PE袋 mtrlid 46804
- // changeMtrl = 46804;
- // } else if (_formulakind == 17) {
- // //默认 外层pe kind = 17 默认 20C mtrlid 46809
- // changeMtrl = 46809;
- // } else if (_formulakind == 18) {
- // //默认 pvc kind = 18 默认 15C mtrlid 46811
- // changeMtrl = 46811;
- // } else if (_formulakind == 19) {
- // //默认 卷包外包装 kind = 19 默认 彩箱 32*32 46817
- // changeMtrl = 46817;
- // } else if (_formulakind == 27) {
- // //默认 拉手脚轮 kind = 27 默认 46872
- // changeMtrl = 46872;
- // }
- // if (changeMtrl && !_data) {
- // _data = defaultMtrlList.find(t => t.mtrlid == changeMtrl);
- // }
- // }
- // if (_data) {
- // itm.mtrlid = _data.mtrlid;
- // itm.mtrlname = _data.mtrlname;
- // itm.price = _data.pricelistprice;
- // itm.gram_weight = _data.gram_weight;
- // itm.cloth_width = _data.cloth_width;
- // itm.if_inputqty = _data.if_inputqty;
- // itm.priceunit = _data.priceunit;
- // itm.shrinkage = _data.shrinkage;
- // itm.qty = 1;
- // if (_data.formula != "") {
- // itm.formula = _data.formula;
- // }
- // }
- // });
- // console.log("state.oriMxData.list affff state.oriMxData.list :>> ", state.oriMxData.list);
- // };
- /**
- * @description 明细,新增
- */
- const funcAddMtrlMx = async (data: any, cb?: Function, refName?: string, firstRow?: any) => {
- console.log("state.LjDetail. :>> ", state.LjDetailRef);
- console.log("funcAddMtrlMx data :>> ", data);
- let { row, $rowIndex, visibleData } = data;
- let tgRefName = "";
- if (refName) {
- tgRefName = refName;
- } else {
- let { tabsActive } = state.LjDetailRef;
- let _target = tabsActive == "fabricMx" ? state.fabricMxTabs : tabsActive;
- let currentTab = state.fabricMxTabList.find(t => t.name == _target);
- tgRefName = currentTab.ref;
- }
- const $table = state[tgRefName].element;
- if ($table) {
- let records = {};
- if (["specialProcessesMxRef", "additionalCostsMxRef"].includes(tgRefName)) {
- records = {
- addmx: "+",
- delmx: "-",
- mattressid: state.LjDetailRef._mainData.mattressid,
- mattressmxid: 0,
- extraid: row?.extraid ?? 0,
- extramxid: row?.extramxid ?? 0,
- extraname: "",
- price: "",
- qty: 1,
- dscrp: ""
- };
- } else {
- records = {
- addmx: "+",
- delmx: "-",
- mattressmxid: 0,
- formulatype: row.formulatype,
- if_mtrl: row.if_mtrl,
- formulaid: row.formulaid,
- sortcode: row.sortcode,
- formulakind: row.formulakind,
- formula: row.formula,
- thickness: 0,
- mtrlid: 0,
- chastr: row.chastr,
- xu: Number(row.xu) + 0.01
- };
- }
- // null 从第一行插入, row: 从当前行下一行插入
- let _rowIdx = firstRow == -1 ? -1 : firstRow ? null : row;
- console.log("funcAddMtrlMx _rowIdx :>> ", firstRow, firstRow == -1, _rowIdx);
- const { row: newRow } = await $table.insertNextAt(records, _rowIdx);
- await $table.setEditCell(newRow, "mtrlname");
- await $table.setCurrentRow(newRow);
- cb && cb();
- }
- };
- /**
- * @description 明细,删除
- */
- const funcDelMtrlMx = (data: any, refName?: string) => {
- let { row } = data;
- let tgRefName = "";
- if (refName) {
- tgRefName = refName;
- } else {
- let { tabsActive } = state.LjDetailRef;
- let _target = tabsActive == "fabricMx" ? state.fabricMxTabs : tabsActive;
- let currentTab = state.fabricMxTabList.find(t => t.name == _target);
- tgRefName = currentTab.ref;
- }
- const $table = state[tgRefName].element;
- if ($table) {
- $table.remove(row);
- }
- };
- /**
- * @description 明细,删除
- */
- const funcDelBednet = (scope: any, cb?: Function, refName?: string) => {
- console.log("funcDelBednet: ", scope);
- if (scope.data.length == 1) {
- ElMessage.warning("不能全部删除,至少保留一个床网");
- return false;
- }
- cb && cb();
- funcDelMtrlMx(scope, refName);
- // 床网与主副规格互联
- nextTick(() => {
- updateSubspecsTable();
- });
- };
- /**
- * @description 据字符串'myRef'来获取ref
- * @param name
- * @returns
- */
- const dynamicRef = name => {
- return state[name]; // 获取ref的值
- };
- /**
- * @description 获取当前需要显示的面料明细tabs
- */
- const getMattressType = () => {
- const globalStore = useGlobalStore();
- const { enumMap, _mainData } = state.LjDetailRef;
- console.log("getMattressType enumMap :>> ", enumMap, _mainData, state.LjDetailRef);
- let _enum = enumMap.get("mattresstypeid");
- console.log("_enum :>> ", _enum);
- if (_enum) {
- state.mattresstypeEnum = _enum.find(t => t.value == _mainData.mattresstypeid);
- console.log("mattresstypeEnum :>> ", state.mattresstypeEnum);
- }
- let _dwname = DwnameEnum.mattressQuote + "__fabric";
- let _dftabs = "";
- let _fabricShowList = undefined;
- let itmshow = null;
- if (globalStore?.detailtabs && Object.keys(globalStore?.detailtabs).includes(_dwname)) {
- _dftabs = globalStore?.detailtabs[_dwname];
- }
- if (_dftabs) {
- _fabricShowList = state.fabricMxTabList
- .map(o => Object.keys(o).includes("visible") && o?.visible() && o)
- .find(o => o?.name == _dftabs);
- }
- if (_fabricShowList) {
- itmshow = _fabricShowList;
- } else {
- itmshow = state.fabricMxTabList.find(o => Object.keys(o).includes("visible") && o?.visible() && o);
- }
- state.fabricMxTabs = itmshow.name;
- };
- const funcChaifenTab = () => {
- const { _mainData } = state.LjDetailRef;
- // 面料
- state.fabricMxData = state.oriMxData.list.filter(
- t => t.formulatype == 0 || (Number(_mainData.if_bcp_type) == 1 && t.formulatype == 104)
- );
- console.log("funcChaifenTab fabricMxData :>> ", state.fabricMxData);
- let _mx8 = state.fabricMxTabList.find(t => t.name == "tabpage_8");
- state.fabricMxTab8 = state.fabricMxData.filter(t => _mx8.type.includes(Number(t.formulakind)));
- state.fabricMxTab8.forEach((o, i) => {
- o.xu = i + 1;
- });
- console.log("funcChaifenTab fabricMxTab8 :>> ", state.fabricMxTab8);
- let _mx9 = state.fabricMxTabList.find(t => t.name == "tabpage_9");
- state.fabricMxTab9 = state.fabricMxData.filter(t => _mx9.type.includes(Number(t.formulakind)));
- state.fabricMxTab9.forEach((o, i) => {
- o.xu = i + 1;
- });
- let _mx10 = state.fabricMxTabList.find(t => t.name == "tabpage_10");
- state.fabricMxTab10 = state.fabricMxData.filter(t => _mx10.type.includes(Number(t.formulakind)));
- state.fabricMxTab10.forEach((o, i) => {
- o.xu = i + 1;
- });
- let _mx11 = state.fabricMxTabList.find(t => t.name == "tabpage_11");
- state.fabricMxTab11 = state.fabricMxData.filter(t => _mx11.type.includes(Number(t.formulakind)));
- state.fabricMxTab11.forEach((o, i) => {
- o.xu = i + 1;
- });
- console.log("funcChaifenTab state.fabricMxTab11 :>> ", state.fabricMxTab11);
- let _mx12 = state.fabricMxTabList.find(t => t.name == "tabpage_12");
- state.fabricMxTab12 = state.fabricMxData.filter(t => _mx12.type.includes(Number(t.formulakind)));
- state.fabricMxTab12.forEach((o, i) => {
- o.xu = i + 1;
- });
- let _mx13 = state.fabricMxTabList.find(t => t.name == "tabpage_13");
- state.fabricMxTab13 = state.fabricMxData.filter(t => !_mx13.type.includes(Number(t.formulakind)));
- state.fabricMxTab13.forEach((o, i) => {
- o.xu = i + 1;
- });
- // 垫层
- state.cushionsMxData = state.oriMxData.list.filter(t => t.formulatype == 1);
- state.cushionsMxData.forEach((o, i) => {
- o.xu = i + 1;
- });
- // 辅料
- state.accessoriesMxData = state.oriMxData.list.filter(t => t.formulatype == 2);
- state.accessoriesMxData.forEach((o, i) => {
- o.xu = i + 1;
- });
- // 包装
- state.packagMxData = state.oriMxData.list.filter(t => t.formulatype == 3);
- state.packagMxData.forEach((o, i) => {
- o.xu = i + 1;
- });
- // 床网
- state.bednetMxData = state.oriMxData.list.filter(t => t.formulatype == 99);
- state.bednetMxData.forEach((o, i) => {
- o.xu = i + 1;
- });
- };
- /**
- * @description 切换包装方式select,获取默认物料
- * @param val
- */
- const funcPacktypeChange = async (val: any) => {
- console.log("wf_import_bz val :>> ", val);
- let newMxData: any = [];
- const { _mainData, enumMap } = state.LjDetailRef;
- if (val == "0") {
- _mainData.diameter = 0;
- } else if (val == "1") {
- _mainData.packqty = 0;
- } else {
- _mainData.diameter = 0;
- _mainData.packqty = 0;
- }
- let _pricelistid = getPriceid();
- let _params = {
- mattresstypeid: _mainData.mattresstypeid,
- ifbcptype: _mainData.if_bcp_type,
- packtype: _mainData.packtype,
- pricelistid: _pricelistid
- };
- let res = await GetMattressPackagMx(_params);
- if (res) {
- newMxData = res.mattressMx;
- _mainData.biandai_qty = res?.biandai_qty;
- state.diancengAreaEnum = res?.diancengarea;
- }
- state.packagMxData = newMxData;
- };
- /**
- * @description 重新获取明细数据
- * @author w_mattress_add wf_import_dw_2
- */
- const wf_import_dw_2 = async () => {
- // let _biandaiqty = 0;
- let newMxData: any = [];
- /**
- * @description 床垫类别参数
- */
- let mattressTypeData: any = {};
- const { _mainData, enumMap } = state.LjDetailRef;
- let _pricelistid = getPriceid();
- let _params = {
- mattressid: Number(_mainData.mattressid),
- mattresstypeid: _mainData.mattresstypeid,
- ifbcptype: _mainData.if_bcp_type,
- packtype: _mainData.packtype,
- pricelistid: _pricelistid
- };
- let res = await GetMattressImportDW2(_params);
- if (res) {
- newMxData = res.mattressMx;
- _mainData.biandai_qty = res?.biandai_qty;
- state.diancengAreaEnum = res?.diancengarea;
- state.specialProcessesMxData = res?.extraEnum.filter(t => t.typeid == 1);
- state.additionalCostsMxData = res?.extraEnum.filter(t => t.typeid == 2);
- state.specialProcessesEnum = res?.extraTypeEnum.filter(t => t.typeid == 1);
- state.additionalCostsEnum = res?.extraTypeEnum.filter(t => t.typeid == 2);
- state.specialProcessesMxInitData = res?.extraProcessesMx;
- state.additionalCostsMxInitData = res?.extraCostsMx;
- }
- state.oriMxData.list = newMxData;
- getMattressType();
- funcChaifenTab();
- await initExtraData();
- };
- const initExtraData = async () => {
- console.log("initExtraData state.specialProcessesMxInitData :>> ", state.specialProcessesMxInitData);
- console.log("initExtraData state.additionalCostsMxInitData :>> ", state.additionalCostsMxInitData);
- const $tableSpecial = state.specialProcessesMxRef.element;
- const $tableAdditional = state.additionalCostsMxRef.element;
- if ($tableSpecial) {
- $tableSpecial.remove();
- let _arr = [];
- let _mattressId = state.LjDetailRef._mainData.mattressid;
- state.specialProcessesMxInitData.map(o => {
- let _itm = {
- addmx: "+",
- delmx: "-",
- mattressid: _mattressId,
- mattressmxid: 0,
- extraid: o.extraid,
- extraname: o.extraname,
- price: o.price,
- qty: o.qty,
- dscrp: o.dscrp,
- inputtype: o.inputtype,
- typeid: o.typeid
- };
- _arr.push(_itm);
- });
- await $tableSpecial.insertAt(_arr, -1);
- }
- if ($tableAdditional) {
- $tableAdditional.remove();
- let _arr = [];
- let _mattressId = state.LjDetailRef._mainData.mattressid;
- state.additionalCostsMxInitData.map(o => {
- let _itm = {
- addmx: "+",
- delmx: "-",
- mattressid: _mattressId,
- mattressmxid: 0,
- extraid: o.extraid,
- extraname: o.extraname,
- price: o.price,
- qty: o.qty,
- dscrp: o.dscrp,
- inputtype: o.inputtype,
- typeid: o.typeid
- };
- _arr.push(_itm);
- });
- await $tableAdditional.insertAt(_arr, -1);
- }
- };
- /**
- * @description 变更床垫分类时,重载明细数据 dw_1 itemchange
- * @author w_mattress_add dw_1 itemchange
- */
- const funcImportMattressMx = async () => {
- console.log("funcImportMattressMx state.LjDetailRef._mainData :>> ", state.LjDetailRef, state.orderStatus);
- const { _mainData, enumMap, baseformRef } = state.LjDetailRef;
- // let mainData = state.orderStatus == "new" ? initParam : _mainData;
- console.log("mainData :>> ", _mainData);
- if (!Number(_mainData.deptid)) {
- ElMessage.warning("请先选择部门");
- console.log("baseformRef.element :>> ", baseformRef.element);
- baseformRef.element.validateField("deptid");
- _mainData.mattresstypeid = "";
- return;
- }
- let _pricelistid = getPriceid();
- if (!_pricelistid) {
- ElMessage.warning("选择部门未设置价格表,请检查");
- return;
- }
- // if (!_mainData.mattresstypeid) {
- // ElMessage.warning("请先选择床垫类别");
- // return;
- // }
- wf_import_dw_2();
- };
- /**
- * @description 刷新报价清单
- */
- const wf_factory_profitrate = async () => {
- const { _mainData, enumMap } = state.LjDetailRef;
- console.log("wf_factory_profitrate enumMap :>> ", enumMap);
- let _pricelistid = getPriceid();
- let _params = {
- dsname: "web_factory_profitratelist",
- queryparams: {
- arg_deptid: _mainData.deptid,
- arg_bednettypeid_mattresstypeid: _mainData.mattresstypeid,
- kind: 1
- }
- };
- let res = await CommonDynamicSelect(_params);
- if (res?.datatable?.length > 0) {
- _mainData.profitrate = res?.datatable[0].profitrate;
- }
- };
- /**
- * @description 获取部门汇率 和 折扣率
- */
- const wf_get_moneyrate_discount = (val: any, data) => {
- const { _mainData, enumMap } = state.LjDetailRef;
- let deptEnum = enumMap.get("deptid");
- console.log("deptEnum :>> ", deptEnum);
- if (deptEnum) {
- let depItem = deptEnum.find((item: any) => item.value == _mainData.deptid);
- if (depItem) {
- let _moneyrate = !depItem.moneyrate || Number(depItem.moneyrate) == 0 ? 1 : depItem.moneyrate;
- if (val == 0 || !_mainData.if_moneyrate) {
- data.moneyrate = 1;
- } else {
- data.moneyrate = _moneyrate;
- }
- data.discount = depItem.discount;
- }
- }
- };
- /**
- * @description 计算价格
- */
- const wf_cmp_cb = async () => {
- const { _mainData, enumMap, baseformRef } = state.LjDetailRef;
- //wf_paixu 未有
- await wf_factory_profitrate();
- // 佣金
- if (_mainData?.commission == 0 || !_mainData.commission) {
- _mainData.commission = 1;
- }
- if (_mainData?.taxrate == 0 || !_mainData.taxrate) {
- _mainData.taxrate = 1;
- }
- if (_mainData?.other_rate == 0 || !_mainData.other_rate) {
- _mainData.other_rate = 1;
- }
- if (_mainData?.moneyrate == 0 || !_mainData.moneyrate) {
- _mainData.moneyrate = 1;
- }
- if (_mainData?.commission < 1) {
- throw new Error("佣金点数不能小于1");
- }
- if (_mainData?.taxrate < 1) {
- throw new Error("税率不能小于1");
- }
- if (_mainData?.other_rate < 1) {
- throw new Error("额外点数不能小于1");
- }
- if (_mainData?.dept_profitrate == 0) {
- throw new Error("部门利润率不能为0!");
- }
- return true;
- };
- /**
- * @description 展示计算公式
- * @param timeout
- */
- const gotoSummy = async (timeout = 0) => {
- const globalStore = useGlobalStore();
- const { isShowOriginFormulaMattress } = storeToRefs(globalStore);
- state.isShowOriginFormulaMattress = isShowOriginFormulaMattress.value;
- // if (userInfo.usermode == 1) {
- // ElMessage.error("'业务员模式不可以查看计算公式!'");
- // return false;
- // }
- let mattress = state.LjDetailRef._mainData;
- mattress.mattressid = Number(mattress.mattressid ?? 0);
- mattress.xd_flag = Number(mattress.xd_flag ?? 0);
- mattress.js1_flag = Number(mattress.js1_flag ?? 0);
- mattress.flag = Number(mattress.flag ?? 0);
- console.log("bbbbbbbbbbbbbbbbbbbb mattress :>> ", mattress);
- // mattress.if_moneyrate = Number(mattress.if_moneyrate ?? 0);
- // mattress.if_bcp_type = Number(mattress.if_bcp_type ?? 0);
- // mattress.if_d_chai = Number(mattress.if_d_chai ?? 0);
- // mattress.if_m_chai = Number(mattress.if_m_chai ?? 0);
- // mattress.if_m_wbutao_way = Number(mattress.if_m_wbutao_way ?? 0);
- // mattress.if_n_butao = Number(mattress.if_n_butao ?? 0);
- // mattress.if_w_butao = Number(mattress.if_w_butao ?? 0);
- // mattress.if_z_chai = Number(mattress.if_z_chai ?? 0);
- // mattress.if_zhedie_type = Number(mattress.if_zhedie_type ?? 0);
- let mattressMx = [];
- state.fabricMxTabList.map(t => {
- if (t.ref) {
- console.log("t.ref?.value :>> ", t.ref, dynamicRef(t.ref));
- if (dynamicRef(t.ref)) {
- let { fullData } = dynamicRef(t.ref)?.element.getTableData();
- console.log("fullData :>> ", fullData);
- fullData = fullData.map((itm, idx) => {
- itm.xu = idx + 1;
- return itm;
- });
- mattressMx = mattressMx.concat(fullData);
- }
- }
- });
- let _params = {
- mattress,
- mattressMx,
- check_original: Number(state.isShowOriginFormulaMattress)
- };
- let res = await GetComputeMattress(_params);
- console.log("GetComputeBednet res :>> ", res);
- // let summaryData = [];
- // let fieldParams = [];
- let cpData = {};
- if (!res.message) {
- // summaryData = res.formulas;
- // fieldParams = res.replace;
- state.cmpFormulas = res.formulas;
- state.cmpFormulaReplace = res.replace;
- // state.
- state.cmpFormulasOri = res.formulas_origin ?? [];
- state.cmpFormulasBednet = res.formulas_bednet ?? [];
- state.cmpDiffer = res.differ;
- // 更新床网tab大小单单价显示
- if (state.cmpDiffer.length > 0) {
- let costArr = [];
- state.cmpDiffer.forEach(o => {
- let bednetMatch = o.replace.filter(itm => itm.label.indexOf("床网车间成本") > -1 && itm.label.indexOf("总") == -1);
- if (!costArr.length) {
- // 先加入空对象
- bednetMatch.forEach(itm => {
- costArr.push({
- dannum2_cost: 0, // 标准
- dannum1_cost: 0, // 散单
- dannum3_cost: 0, // 大单
- dannum4_cost: 0 // 小单
- });
- });
- }
- // 取文本出现的数字
- let reg = /\d+/g;
- if (bednetMatch.length) {
- bednetMatch.forEach(itm => {
- let matchIdx = itm.label.match(reg);
- if (matchIdx && matchIdx.length) {
- let idx = Number(matchIdx[0]);
- costArr[idx - 1][`dannum${o.type}_cost`] = itm.value;
- }
- });
- }
- });
- state.bednetMxData = state.bednetMxData.map((o, idx) => {
- o.dannum2_cost = costArr[idx]?.dannum2_cost;
- o.dannum1_cost = costArr[idx]?.dannum1_cost;
- o.dannum3_cost = costArr[idx]?.dannum3_cost;
- o.dannum4_cost = costArr[idx]?.dannum4_cost;
- return o;
- });
- console.log("床网报价cost :>> ", costArr, state.bednetMxData);
- }
- } else {
- setTimeout(() => {
- if (res.message) {
- ElNotification({
- title: "计算失败",
- message: res.message,
- type: "warning"
- });
- }
- }, 100);
- return false;
- }
- // console.log("LjDetailRef.value.mainData :>> ", LjDetailRef.value._mainData, summaryData.value);
- // const { _mainData, enumMap, baseformRef } = state.LjDetailRef;
- // const toast = useToast();
- // let result = await calculateFormula(summaryData.value, fieldParams.value, _mainData);
- // if (result.length) {
- // let _data = cloneDeep(_mainData);
- // result.map((t, i) => {
- // _data[t.field] = t.value;
- // });
- // result.map((t, i) => {
- // _mainData[t.field] = t.value;
- // });
- // console.log("_data :>> ", _mainData, result);
- // toast.clear();
- // toast(
- // {
- // component: ToastFormula,
- // props: {
- // t: t,
- // formulas: summaryData,
- // // data: cpData,
- // fields: fieldParams
- // },
- // listeners: {
- // tomore: () => {
- // console.log("tomore summaryData :>> ", summaryData);
- // state.AllFormulaRef.open(summaryData, fieldParams);
- // toast.clear();
- // },
- // refresh: () => {
- // gotoSummy();
- // }
- // }
- // },
- // {
- // position: POSITION.BOTTOM_RIGHT,
- // icon: false,
- // timeout: timeout,
- // closeButton: false,
- // toastClassName: "longjoe-toast"
- // }
- // );
- // } else {
- // ElMessage.error("计算公式有误");
- // }
- };
- /**
- * @description 展示历史价格
- * @param timeout
- * @param params
- */
- const gotoHisprice = async (timeout = 0, params: any) => {
- const toast = useToast();
- toast(
- {
- component: ToastHistoryPrice,
- props: {
- ...params,
- t: t
- },
- listeners: {
- todetail: (row: any) => {
- console.log("gotoHisprice dd val :>> ", row, router);
- if (Number(row.typeid) == 1) {
- router.push(`/mattressQuote/detail?id=${row.bednetid_mattressid}`);
- // state.bednetDrawerProps.deptid = state.LjDetailRef._mainData.deptid;
- // state.bednetDrawerProps.bednetid = row.bednetid_mattressid;
- // state.bednetDrawerProps.state = "";
- // state.LjDrawerRef.show();
- } else if (Number(row.typeid) == 2) {
- router.push(`/bednetQuote/detail?id=${row.bednetid_mattressid}`);
- }
- }
- }
- },
- {
- position: POSITION.BOTTOM_RIGHT,
- icon: false,
- timeout: timeout,
- closeButton: false,
- toastClassName: "longjoe-toast"
- }
- );
- };
- const getFormulakindEnum = async () => {
- let _params = {
- dsname: "_Mapper_formulakind",
- queryparams: {}
- };
- let res = await CommonDynamicSelect(_params);
- let result = [];
- if (res?.datatable?.length > 0) {
- result = res?.datatable;
- }
- state.formulaKindEnum = result;
- let _params2 = {
- dsname: "_Mapper_formulakind_dc",
- queryparams: {}
- };
- let res2 = await CommonDynamicSelect(_params2);
- let result2 = [];
- if (res2?.datatable?.length > 0) {
- result2 = res2?.datatable;
- state.formulaKindDcEnum = result2;
- }
- console.log("getFormulakindEnum state. state.formulaKindEnum :>> ", state.formulaKindEnum);
- console.log("getFormulakindEnum state.formulaKindDcEnum :>> ", state.formulaKindDcEnum);
- };
- // 表格配置项
- const columns: ColumnProps<any>[] = [
- { type: "checkbox", width: 40, fixed: "left" },
- { title: "#", type: "seq", fixed: "left", width: 80 },
- {
- field: "deptid",
- title: "部门",
- search: {
- el: "select",
- key: "arg_deptid",
- props: {
- filterable: true,
- onChange: val => {
- state.initParams.arg_deptid = val;
- }
- },
- order: 2
- },
- basicinfo: {
- // el: "select",
- // editable: (scope: any) => {
- // console.log(
- // "deptiddeptid scope.searchParam.deptid :>> ",
- // scope.searchParam.deptid,
- // Number(scope.searchParam.deptid) == 0
- // );
- // return Boolean(Number(scope.searchParam.deptid) == 0);
- // },
- // rules: [{ required: true, message: "请先选择部门", trigger: "change" }],
- // props: {
- // filterable: true,
- // clearable: false
- // },
- order: 1,
- group: "单据信息"
- }
- },
- {
- field: "mattressrelcode",
- title: "核价编码",
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE
- }
- },
- {
- field: "mattresstypeid",
- title: "床垫类别",
- basicinfo: {
- el: "select",
- editable: ALLOW_EDIT_STATE,
- rules: [{ required: true, message: "请先选择床垫类别", trigger: "change" }],
- props: {
- clearable: false,
- filterable: true,
- onChange: () => funcImportMattressMx()
- }
- }
- },
- {
- field: "mattressname",
- title: "核价名称",
- align: "left",
- table: "u_mattress",
- search: {
- el: "input",
- key: "arg_search",
- titleKey: "searchKw",
- props: {
- placeholder: "唯一码/编码/名称"
- },
- order: 1
- },
- basicinfo: {
- el: "input",
- editable: ALLOW_EDIT_STATE
- },
- treeNode: true,
- render: scope => {
- return !scope.row?.child_count && !scope.row?.parentid ? (
- scope.row?.mattressname
- ) : scope.row?.parentid ? (
- <div class="flx-justify-between">
- <span class="mle">{scope.row?.mattressname}</span>
- <el-tag type="warning" effect="light" disable-transitions size="small" round class="ml-4">
- 副
- </el-tag>
- </div>
- ) : (
- <div class="flx-justify-between">
- <span class="mle">{scope.row?.mattressname}</span>
- <el-tag type="primary" effect="light" disable-transitions size="small" round class="ml-4">
- 主
- </el-tag>
- </div>
- );
- }
- },
- {
- field: "flag",
- title: "财务审核",
- table: "u_mattress",
- search: {
- el: "select",
- key: "status_flag",
- titleKey: "status",
- props: {
- clearable: true,
- placeholder: "全部",
- onChange: () => {
- state.vxeTableRef.refresh();
- }
- },
- order: 3,
- render: scope => {
- // let _keys = Object.keys(scope);
- // let _data = _keys.includes("row") ? scope.row : _keys.includes("searchParam") ? scope.searchParam : scope;
- return (
- <el-select v-model={scope.searchParam.status_flag} placeholder="全部" clearable>
- <el-option label="待下单" value="1" />
- <el-option label="已下单" value="2" />
- <el-option label="待财务审核" value="3" />
- <el-option label="已财务审核" value="4" />
- </el-select>
- );
- }
- }
- },
- {
- field: "dept_profitrate_rangli",
- title: "部门让利点数",
- basicinfo: {
- el: "input-number",
- editable: ALLOW_EDIT_STATE,
- order: 2,
- group: "单据信息"
- }
- },
- {
- field: "fees_dscrp",
- title: "额外费用说明",
- basicinfo: {
- el: "input",
- props: { type: "textarea", rows: 2 },
- editable: ALLOW_EDIT_STATE,
- row: 2
- }
- },
- {
- field: "foreign_cost",
- table: "u_mattress",
- title: "外币价",
- basicinfo: {
- titleKey: "bi_foreign_cost"
- }
- },
- {
- field: "nottax_dept_cost",
- table: "u_mattress",
- title: "部门不含税价",
- basicinfo: {
- titleKey: "bi_nottax_dept_cost"
- }
- },
- {
- field: "if_bcp_type",
- title: "半成品",
- basicinfo: {
- labelHidden: true,
- render: (scope: any) => {
- let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
- return (
- <>
- <el-checkbox
- v-model={scope.searchParam.if_bcp_type}
- true-value={1}
- false-value={0}
- disabled={_disabled}
- label="半成品"
- class="mr-8"
- />
- <el-checkbox
- v-model={scope.searchParam.if_zhedie_type}
- true-value={1}
- false-value={0}
- disabled={_disabled}
- label="折叠款"
- />
- </>
- );
- }
- }
- },
- {
- field: "if_m_chai",
- title: "面拆",
- basicinfo: {
- span: 2,
- labelHidden: true,
- render: (scope: any) => {
- let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
- return (
- <>
- <el-checkbox
- v-model={scope.searchParam.if_m_chai}
- true-value={1}
- false-value={0}
- disabled={_disabled}
- label="面拆"
- class="mr-8"
- onChange={val => autoLoadExtraData_chai(val, "if_m_chai")}
- />
- <el-checkbox
- v-model={scope.searchParam.if_z_chai}
- true-value={1}
- false-value={0}
- disabled={_disabled}
- label="中拆"
- class="mr-8"
- onChange={val => autoLoadExtraData_chai(val, "if_z_chai")}
- />
- <el-checkbox
- v-model={scope.searchParam.if_d_chai}
- true-value={1}
- false-value={0}
- disabled={_disabled}
- label="底拆"
- onChange={val => autoLoadExtraData_chai(val, "if_d_chai")}
- />
- </>
- );
- }
- }
- },
- {
- field: "erp_mtrlcode",
- title: "L1物料编码",
- search: {
- el: "input",
- key: "arg_erp_mtrlcode",
- props: {
- placeholder: "L1物料编码"
- },
- order: 0
- }
- },
- {
- field: "mattress_width",
- title: "床垫宽/CM",
- basicinfo: {
- el: "input-number",
- editable: ALLOW_EDIT_STATE
- }
- },
- {
- field: "mattress_length",
- title: "床垫长/CM",
- basicinfo: {
- el: "input-number",
- editable: ALLOW_EDIT_STATE
- }
- },
- {
- field: "mattress_height",
- title: "床垫高/CM",
- basicinfo: {
- el: "input-number",
- props: {
- onChange: (val: any) => {
- const $table = state.subSpecsRef?.element;
- if ($table) {
- const { visibleData } = $table.getTableData();
- visibleData.forEach((o: any) => {
- o.mattress_height = val;
- });
- }
- }
- },
- editable: ALLOW_EDIT_STATE
- }
- },
- {
- field: "if_w_butao",
- title: "顶布裥棉",
- basicinfo: {
- // el: "checkbox",
- // editable: ALLOW_EDIT_STATE
- labelHidden: true,
- render: (scope: any) => {
- console.log("if_w_butao scope :>> ", scope);
- let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
- return (
- <>
- <el-checkbox
- v-model={scope.searchParam.if_w_butao}
- true-value={1}
- false-value={0}
- disabled={_disabled}
- label="顶布裥棉"
- class="mr-8"
- />
- </>
- );
- }
- }
- },
- {
- field: "biandai_qty",
- title: "边带数",
- basicinfo: {
- el: "input-number",
- editable: (scope: any) => {
- let someone =
- Number(scope.searchParam?.if_m_chai ?? 0) +
- Number(scope.searchParam?.if_z_chai ?? 0) +
- Number(scope.searchParam?.if_d_chai ?? 0);
- if (ALLOW_EDIT_STATE.includes(scope.status) && someone > 0) {
- return true;
- }
- return false;
- }
- }
- },
- {
- field: "if_n_butao",
- title: "内布套",
- basicinfo: {
- labelHidden: true,
- render: (scope: any) => {
- let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
- return (
- <>
- <el-checkbox
- v-model={scope.searchParam.if_n_butao}
- true-value={1}
- false-value={0}
- disabled={_disabled}
- label="内布套"
- class="mr-8"
- />
- </>
- );
- },
- editvisible: (scope: any) => {
- let someone =
- Number(scope.searchParam?.if_m_chai ?? 0) +
- Number(scope.searchParam?.if_z_chai ?? 0) +
- Number(scope.searchParam?.if_d_chai ?? 0);
- if (someone > 0) {
- return true;
- }
- return false;
- }
- }
- },
- // {
- // field: "s_cover_qty",
- // title: "内布套上覆",
- // basicinfo: {
- // el: "input-number",
- // editable: (scope: any) => {
- // if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.if_n_butao)) {
- // return true;
- // }
- // return false;
- // },
- // editvisible: (scope: any) => {
- // let someone =
- // Number(scope.searchParam?.if_m_chai ?? 0) +
- // Number(scope.searchParam?.if_z_chai ?? 0) +
- // Number(scope.searchParam?.if_d_chai ?? 0);
- // if (someone > 0 && Number(scope.searchParam.if_n_butao)) {
- // return true;
- // }
- // return false;
- // }
- // }
- // },
- // {
- // field: "z_cover_qty",
- // title: "内布套侧覆",
- // basicinfo: {
- // el: "input-number",
- // editable: (scope: any) => {
- // if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.if_n_butao)) {
- // return true;
- // }
- // return false;
- // },
- // editvisible: (scope: any) => {
- // let someone =
- // Number(scope.searchParam?.if_m_chai ?? 0) +
- // Number(scope.searchParam?.if_z_chai ?? 0) +
- // Number(scope.searchParam?.if_d_chai ?? 0);
- // if (someone > 0 && Number(scope.searchParam.if_n_butao)) {
- // return true;
- // }
- // return false;
- // }
- // }
- // },
- // {
- // field: "x_cover_qty",
- // title: "内布套下覆",
- // basicinfo: {
- // el: "input-number",
- // editable: (scope: any) => {
- // if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.if_n_butao)) {
- // return true;
- // }
- // return false;
- // },
- // editvisible: (scope: any) => {
- // let someone =
- // Number(scope.searchParam?.if_m_chai ?? 0) +
- // Number(scope.searchParam?.if_z_chai ?? 0) +
- // Number(scope.searchParam?.if_d_chai ?? 0);
- // if (someone > 0 && Number(scope.searchParam.if_n_butao)) {
- // return true;
- // }
- // return false;
- // }
- // }
- // },
- {
- field: "if_m_wbutao_way",
- title: "面料外布套做法",
- basicinfo: {
- labelHidden: true,
- render: (scope: any) => {
- let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
- return (
- <>
- <el-checkbox
- v-model={scope.searchParam.if_m_wbutao_way}
- true-value={1}
- false-value={0}
- disabled={_disabled}
- label="面料外布套做法"
- class="mr-8"
- />
- </>
- );
- },
- editvisible: (scope: any) => {
- let someone =
- Number(scope.searchParam?.if_m_chai ?? 0) +
- Number(scope.searchParam?.if_z_chai ?? 0) +
- Number(scope.searchParam?.if_d_chai ?? 0);
- if (someone > 0) {
- return true;
- }
- return false;
- }
- }
- },
- {
- field: "s_m_cover_qty",
- title: "面层向大侧覆盖",
- basicinfo: {
- el: "input-number",
- editable: (scope: any) => {
- if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.if_m_wbutao_way)) {
- return true;
- }
- return false;
- },
- editvisible: (scope: any) => {
- let someone =
- Number(scope.searchParam?.if_m_chai ?? 0) +
- Number(scope.searchParam?.if_z_chai ?? 0) +
- Number(scope.searchParam?.if_d_chai ?? 0);
- if (someone > 0 && Number(scope.searchParam.if_m_wbutao_way)) {
- return true;
- }
- return false;
- }
- }
- },
- {
- field: "z_m_cover_qty",
- title: "大侧向底层覆盖",
- basicinfo: {
- el: "input-number",
- editable: (scope: any) => {
- if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.if_m_wbutao_way)) {
- return true;
- }
- return false;
- },
- editvisible: (scope: any) => {
- let someone =
- Number(scope.searchParam?.if_m_chai ?? 0) +
- Number(scope.searchParam?.if_z_chai ?? 0) +
- Number(scope.searchParam?.if_d_chai ?? 0);
- if (someone > 0 && Number(scope.searchParam.if_m_wbutao_way)) {
- return true;
- }
- return false;
- }
- }
- },
- {
- field: "x_m_cover_qty",
- title: "底层向大侧覆盖",
- basicinfo: {
- el: "input-number",
- editable: (scope: any) => {
- if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.if_m_wbutao_way)) {
- return true;
- }
- return false;
- },
- editvisible: (scope: any) => {
- let someone =
- Number(scope.searchParam?.if_m_chai ?? 0) +
- Number(scope.searchParam?.if_z_chai ?? 0) +
- Number(scope.searchParam?.if_d_chai ?? 0);
- if (someone > 0 && Number(scope.searchParam.if_m_wbutao_way)) {
- return true;
- }
- return false;
- }
- }
- },
- {
- field: "commission",
- title: "佣金点数",
- basicinfo: {
- el: "input-number",
- editable: ALLOW_EDIT_STATE
- }
- },
- {
- field: "other_rate",
- title: "额外点数",
- basicinfo: {
- el: "input-number",
- editable: ALLOW_EDIT_STATE
- }
- },
- {
- field: "extras_cost",
- title: "额外费用",
- basicinfo: {
- el: "input-number",
- editable: ALLOW_EDIT_STATE
- }
- },
- {
- field: "taxes",
- title: "税金",
- enum: [
- {
- label: "不含税",
- value: 1
- },
- {
- label: "含税",
- value: 1.07
- }
- ],
- basicinfo: {
- el: "select",
- editable: ALLOW_EDIT_STATE,
- render: (scope: any) => {
- let optionRender = [];
- let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
- console.log("taxrate scope.enum :>> ", scope.enum);
- scope.enum.map(item => {
- optionRender.push(<el-option label={item.label} value={item.value} />);
- });
- let slotprefix = {
- prefix: () => {
- return <>{scope.searchParam.taxrate}</>;
- }
- };
- let _taxrate = Number(scope.searchParam.taxrate);
- return (
- <el-select
- v-model={_taxrate}
- v-slots={slotprefix}
- class="select-text-right"
- disabled={_disabled}
- onChange={val => funcTaxrateChange(val, scope.searchParam)}
- >
- {optionRender}
- </el-select>
- );
- }
- }
- },
- {
- field: "moneyrate",
- title: "币种",
- render: (scope: any) => {
- return (
- <>
- <div class="flx-justify-between">
- <span>
- <>{scope.row.moneyrate > 1 ? `美元` : "人民币"}</>
- </span>
- {scope.row.moneyrate > 1 && (
- <span>
- <>{scope.row.moneyrate}</>
- </span>
- )}
- </div>
- </>
- );
- },
- basicinfo: {
- el: "select",
- editable: ALLOW_EDIT_STATE,
- render: (scope: any) => {
- let optionRender = [];
- let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
- scope.enum.map(item => {
- optionRender.push(<el-option label={item.label} value={item.value} />);
- });
- let slotprefix = {
- prefix: () => {
- return <>{scope.searchParam.moneyrate}</>;
- }
- };
- return (
- <el-select
- v-model={scope.searchParam.if_moneyrate}
- v-slots={slotprefix}
- class="select-text-right"
- disabled={_disabled}
- onChange={val => wf_get_moneyrate_discount(val, scope.searchParam)}
- >
- {optionRender}
- </el-select>
- );
- }
- }
- },
- {
- field: "packtype",
- enum: state.packtypeOptions
- },
- {
- field: "dannum_cost1",
- render: (scope: any) => {
- if (scope.row?.moneyrate > 1) {
- return (
- <div>
- <span class="text-f-s" style="color: var(--lj-color-gray-7)">
- $
- </span>
- {formatAmount3({ val: floatDiv(scope.row?.dannum_cost1 ?? 0, scope.row.moneyrate) })}
- </div>
- );
- } else {
- return formatAmount3({ val: scope.row?.dannum_cost1 ?? 0 });
- }
- }
- },
- {
- field: "dannum_cost2",
- render: (scope: any) => {
- if (scope.row?.moneyrate > 1) {
- return (
- <div>
- <span class="text-f-s" style="color: var(--lj-color-gray-7)">
- $
- </span>
- {formatAmount3({ val: floatDiv(scope.row?.dannum_cost2 ?? 0, scope.row.moneyrate) })}
- </div>
- );
- } else {
- return formatAmount3({ val: scope.row?.dannum_cost2 ?? 0 });
- }
- }
- },
- {
- field: "dannum_cost3",
- render: (scope: any) => {
- if (scope.row?.moneyrate > 1) {
- return (
- <div>
- <span class="text-f-s" style="color: var(--lj-color-gray-7)">
- $
- </span>
- {formatAmount3({ val: floatDiv(scope.row?.dannum_cost3 ?? 0, scope.row.moneyrate) })}
- </div>
- );
- } else {
- return formatAmount3({ val: scope.row?.dannum_cost3 ?? 0 });
- }
- }
- },
- {
- field: "dannum_cost4",
- render: (scope: any) => {
- console.log("scope.row.moneyrate :>> ", scope);
- if (scope.row?.moneyrate > 1) {
- return (
- <div>
- <span class="text-f-s" style="color: var(--lj-color-gray-7)">
- $
- </span>
- {formatAmount3({ val: floatDiv(scope.row?.dannum_cost4 ?? 0, scope.row.moneyrate) })}
- </div>
- );
- } else {
- return formatAmount3({ val: scope.row?.dannum_cost4 ?? 0 });
- }
- }
- }
- ];
- const columnsMx: ColumnProps<any>[] = [
- { title: "#", type: "seq", fixed: "left", width: 80 },
- {
- title: "计算成功?",
- field: "if_success",
- datatype: "checkbox",
- limited: () => {
- const { userInfo } = useUserStore();
- return userInfo.usermode != 0;
- },
- render: (scope: any) => {
- if (Number(scope.row.if_success)) {
- return (
- <>
- <ElTag type="danger">异常</ElTag>
- </>
- );
- } else {
- return <></>;
- }
- }
- },
- {
- title: "+",
- field: "addmx",
- width: 80,
- render: (scope: any) => {
- let _if_mtrl = Number(scope.row.if_mtrl);
- if (_if_mtrl > 1) {
- if (state.orderStatus) {
- return <ElButton type="primary" plain circle icon={Plus} onClick={() => funcAddMtrlMx(scope)}></ElButton>;
- } else {
- return <>+</>;
- }
- } else {
- return <></>;
- }
- }
- },
- {
- title: "-",
- field: "delmx",
- width: 80,
- render: (scope: any) => {
- let _if_mtrl = Number(scope.row.if_mtrl);
- if (_if_mtrl > 1) {
- if (state.orderStatus) {
- return (
- <>
- <ElPopconfirm
- width="220"
- icon={InfoFilled}
- title={t("business.tips.mattress.delMx")}
- confirm-button-text={t("common.delText")}
- confirm-button-type="danger"
- onConfirm={() => funcDelMtrlMx(scope)}
- >
- {{
- reference: () => {
- return <ElButton type="danger" plain circle icon={Minus} />;
- }
- }}
- </ElPopconfirm>
- </>
- );
- // return <ElButton type="danger" plain circle icon={Minus} onClick={() => funcDelMtrlMx(scope)}></ElButton>;
- } else {
- return <>-</>;
- }
- } else {
- return <></>;
- }
- }
- },
- {
- title: "位置",
- field: "chastr"
- },
- {
- title: "公式名",
- field: "formulakind",
- table: "u_mattress_formula",
- align: "left",
- isFilterEnum: true,
- fieldNames: { value: "value", label: "label" },
- // enum: async () => {
- // let res = await CommonDynamicSelect({
- // dsname: "_Mapper_formulakind",
- // queryparams: {}
- // });
- // return { data: res.datatable };
- // }
- render: (scope: any) => {
- const { column, row, status } = scope;
- let itmName = state.formulaKindEnum.find(t => t.value == row.formulakind)?.label ?? "";
- return <>{itmName}</>;
- }
- },
- {
- title: "按物料?",
- field: "if_mtrl",
- table: "u_mattress_formula",
- enum: [
- {
- value: "0",
- label: "无物料"
- },
- {
- value: "1",
- label: "单物料"
- },
- {
- value: "2",
- label: "多物料"
- }
- ]
- },
- {
- title: "厚度cm",
- field: "thickness",
- datatype: "number",
- editRender: {},
- editColRender: (scope: any) => {
- const { $table, column, row, status } = scope;
- const _disabled = !(
- (row.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 12, 13, 14, 32, 33].includes(row.formulakind)) ||
- row.formulakind == 202 ||
- row.formulakind == 7
- );
- return <el-input v-model={scope.row.thickness} disabled={_disabled}></el-input>;
- }
- },
- {
- title: "物料",
- field: "mtrlname",
- editRender: {},
- editColRender: (scope: any) => {
- const { $table, column, row, status } = scope;
- let field = column.field;
- let _label = column.title;
- // if (column?.format) {
- // _label = handleRowAccordingToProp(searchParam, field, column?.format);
- // }
- let _pricelistid = getPriceid();
- let _mtrltypeItem: any = mtrltypeTabList.find(t => t.formulakinds.includes(Number(row.formulakind)));
- !_mtrltypeItem && (_mtrltypeItem = { value: -1 });
- let params = {
- mtrltype: _mtrltypeItem.value,
- pricelistid: _pricelistid
- };
- return (
- <>
- <MtrldefSelect
- value={row.mtrlid}
- {...params}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseMtrl(row, params, rModelSetMtrl, _mtrltypeItem.label, $table)}
- onSelect={val => rModelSetMtrl(row, val, $table)}
- onClear={() => rModelClearMtrl(row, $table)}
- >
- {{
- label: () => row.mtrlname
- }}
- </MtrldefSelect>
- </>
- );
- }
- },
- {
- title: "数量/长度",
- field: "qty",
- datatype: "number",
- editRender: {},
- editColRender: (scope: any) => {
- const { $table, column, row, status } = scope;
- // 面料(面、底、侧)的数量/长度,不能输入
- let arr = [
- {
- // label: "裥面",
- type: [0, 80, 40, 50, 60, 70, 9000]
- },
- {
- // label: "裥底",
- type: [1, 81, 41, 51, 61, 71, 9001]
- },
- {
- // label: "裥大恻",
- type: [2, 82, 42, 52, 62, 72, 9002]
- }
- // {
- // // label: "裥小恻",
- // type: [3, 83, 43, 53, 63, 73, 9003]
- // // ref: "fabricMxTab11Ref"
- // },
- // {
- // // label: "裥V恻",
- // type: [4, 84, 44, 54, 64, 74, 9004]
- // // ref: "fabricMxTab12Ref"
- // }
- ];
- let _disabled = arr.some(t => t.type.includes(row.formulakind));
- return <el-input v-model={scope.row.qty} type="number" disabled={row.mtrlid == 0 || _disabled}></el-input>;
- }
- },
- {
- title: "规格宽/CM",
- field: "mattress_width",
- visible: false
- },
- {
- title: "规格长/CM",
- field: "mattress_length",
- visible: false
- },
- {
- title: "物料单价",
- field: "price",
- datatype: "number",
- limited: () => {
- return userInfo.usermode != 0;
- }
- },
- {
- title: "单位",
- field: "priceunit"
- },
- {
- title: "收缩率",
- field: "shrinkage",
- datatype: "number",
- limited: () => {
- return userInfo.usermode != 0;
- }
- },
- {
- title: "克重",
- field: "gram_weight",
- datatype: "number",
- limited: () => {
- return userInfo.usermode != 0;
- }
- },
- {
- title: "幅宽",
- field: "cloth_width",
- datatype: "number",
- limited: () => {
- return userInfo.usermode != 0;
- }
- },
- {
- title: "固定厚度?",
- field: "if_inputqty",
- datatype: "checkbox",
- limited: () => {
- return userInfo.usermode != 0;
- }
- },
- {
- title: "按面积单价?",
- field: "if_areaprice",
- datatype: "checkbox",
- limited: () => {
- return userInfo.usermode != 0;
- }
- },
- {
- title: "成本金额",
- field: "costamt",
- datatype: "number",
- limited: () => {
- return userInfo.usermode != 0;
- }
- },
- {
- title: "标准\r\n成本金额",
- field: "dannum2_rate",
- datatype: "number",
- limited: () => {
- return userInfo.usermode != 0;
- },
- render: (scope: any) => {
- if (scope.row.hasOwnProperty("dannum2_cost")) {
- return formatCutNumber({ val: scope.row.dannum2_cost });
- }
- return formatCutNumber({ val: floatMul(scope.row.costamt, 1 + scope.row.dannum2_rate) });
- }
- },
- {
- title: "散单\r\n成本金额",
- field: "dannum1_rate",
- datatype: "number",
- limited: () => {
- return userInfo.usermode != 0;
- },
- render: (scope: any) => {
- if (scope.row.hasOwnProperty("dannum1_cost")) {
- return formatCutNumber({ val: scope.row.dannum1_cost });
- }
- return formatCutNumber({ val: floatMul(scope.row.costamt, 1 + scope.row.dannum1_rate) });
- }
- },
- {
- title: "大单\r\n成本金额",
- field: "dannum3_rate",
- datatype: "number",
- limited: () => {
- return userInfo.usermode != 0;
- },
- render: (scope: any) => {
- if (scope.row.hasOwnProperty("dannum3_cost")) {
- return formatCutNumber({ val: scope.row.dannum3_cost });
- }
- return formatCutNumber({ val: floatMul(scope.row.costamt, 1 + scope.row.dannum3_rate) });
- }
- },
- {
- title: "小单\r\n成本金额",
- field: "dannum4_rate",
- datatype: "number",
- limited: () => {
- return userInfo.usermode != 0;
- },
- render: (scope: any) => {
- if (scope.row.hasOwnProperty("dannum4_cost")) {
- return formatCutNumber({ val: scope.row.dannum4_cost });
- }
- return formatCutNumber({ val: floatMul(scope.row.costamt, 1 + scope.row.dannum4_rate) });
- }
- },
- {
- title: "金额文本公式",
- field: "formula",
- limited: () => {
- return userInfo.usermode != 0;
- }
- },
- {
- title: "金额数字公式",
- field: "replace_formula",
- limited: () => {
- return userInfo.usermode != 0;
- }
- },
- {
- title: "清单用量",
- field: "useqty",
- datatype: "number",
- limited: () => {
- return userInfo.usermode != 0;
- }
- },
- {
- title: "用量文本公式",
- field: "useformula",
- limited: () => {
- return userInfo.usermode != 0;
- }
- },
- {
- title: "用量数字公式",
- field: "replace_useformula",
- limited: () => {
- return userInfo.usermode != 0;
- }
- },
- {
- title: "工艺填写说明",
- field: "gydscrp",
- editRender: {
- name: "input",
- props: {
- type: "textarea"
- }
- }
- }
- ];
- // /**
- // * @description 主表计算公式
- // */
- // const summaryData = ref<any>([
- // {
- // label: "总成本",
- // field: "total_cost",
- // formula:
- // "if([折叠款] = 1, ([总材料成本]*[大小单]+[款式费用]+[边带费用]+[额外费用]+[制造费用]) * 2, [总材料成本]*[大小单]+[款式费用]+[边带费用]+[额外费用]+[制造费用])",
- // power: () => {
- // if (userInfo.empid != 0 && userInfo.usermode != 0) {
- // return false;
- // } else {
- // return true;
- // }
- // }
- // },
- // {
- // label: "不含税出厂价",
- // field: "nottax_factory_cost",
- // formula: "[总成本] * ([工厂利润率] + [利润率点数] + [布套点数] + [拆装点数] + [海绵点数]) * [管理费点]"
- // },
- // {
- // label: "部门售价",
- // field: "nottax_dept_cost",
- // formula: "[dijia_cost] / (1 - ([佣金点数] - 1)) * [额外点数] + [fob]"
- // },
- // {
- // label: "税金",
- // field: "taxes",
- // formula: "([部门售价] * ([税率] - 1)) + [佣金] * 0.05"
- // },
- // {
- // label: "部门含税价",
- // field: "dept_cost",
- // formula: "([部门售价] + [佣金] * 0.06) * [税率] * if([fob] = 0, 1, [折扣率])"
- // },
- // {
- // label: "外币价",
- // field: "foreign_cost",
- // formula: "if([汇率] <> 0, [部门含税价] / [汇率], 0)"
- // },
- // {
- // label: "底价 ",
- // field: "dijia_cost_cp",
- // formula: "if(([dept_profitrate] + [dept_profitrate_rangli] / 100) <> 0, [dijia_cost] ,0 )"
- // },
- // {
- // label: "佣金",
- // field: "commission_cp",
- // formula: "[dijia_cost] / (1 - ([佣金点数] - 1 )) - [dijia_cost]"
- // },
- // {
- // label: "FOB",
- // field: "fob",
- // formula: "[fob]"
- // }
- // ]);
- // /**
- // * @description 主表公式字段照表
- // */
- // const fieldParams = ref<any>([
- // {
- // label: "总成本",
- // field: "total_cost"
- // },
- // {
- // label: "不含税出厂价",
- // field: "nottax_factory_cost"
- // },
- // {
- // label: "部门售价",
- // field: "nottax_dept_cost"
- // },
- // {
- // label: "税金",
- // field: "taxes"
- // },
- // {
- // label: "部门含税价",
- // field: "dept_cost"
- // },
- // {
- // label: "外币价",
- // field: "foreign_cost"
- // },
- // {
- // label: "总材料成本",
- // field: "total_material_cost"
- // },
- // {
- // label: "大小单",
- // field: "dannum_rate"
- // },
- // {
- // label: "款式费用",
- // field: "hrcost"
- // },
- // {
- // label: "边带费用",
- // field: "biandaicost"
- // },
- // {
- // label: "额外费用",
- // field: "extras_cost"
- // },
- // {
- // label: "制造费用",
- // field: "zhizao_amt"
- // },
- // {
- // label: "折叠款",
- // field: "if_zhedie_type"
- // },
- // {
- // label: "管理费点",
- // field: "guanli_rate"
- // },
- // {
- // label: "工厂利润率",
- // field: "profitrate"
- // },
- // {
- // label: "利润率点数",
- // field: "profitrate_point"
- // },
- // {
- // label: "布套点数",
- // field: "butao_point"
- // },
- // {
- // label: "拆装点数",
- // field: "chaizhuang_point"
- // },
- // {
- // label: "海绵点数",
- // field: "haimian_point"
- // },
- // {
- // label: "部门利润率",
- // field: "dept_profitrate"
- // },
- // {
- // label: "部门让利点",
- // field: "dept_profitrate_rangli"
- // },
- // {
- // label: "额外点数",
- // field: "other_rate"
- // },
- // {
- // label: "佣金点数",
- // field: "commission"
- // },
- // {
- // label: "税率",
- // field: "taxrate"
- // },
- // {
- // label: "折扣率",
- // field: "discount"
- // },
- // {
- // label: "汇率",
- // field: "moneyrate"
- // },
- // {
- // label: "底价",
- // field: "dijia_cost"
- // }
- // ]);
- // /**
- // * @description 明细公式字段照表
- // */
- // const fieldMxParams = ref<any>([
- // {
- // label: "名称前2位",
- // field: "ls_temp_left_2"
- // },
- // {
- // label: "规格宽",
- // field: "ls_mattress_width"
- // },
- // {
- // label: "规格长",
- // field: "ls_mattress_length"
- // },
- // {
- // label: "规格高",
- // field: "ls_mattress_height"
- // },
- // {
- // label: "压包数量",
- // field: "ls_packqty"
- // },
- // {
- // label: "卷包直径",
- // field: "ls_diameter"
- // },
- // {
- // label: "顶布裥棉外布套做法",
- // field: "ls_if_db_wbutao_way"
- // },
- // {
- // label: "面料外布套做法",
- // field: "ls_if_m_wbutao_way"
- // },
- // {
- // label: "内布套上覆",
- // field: "ls_s_cover_qty"
- // },
- // {
- // label: "内布套侧覆",
- // field: "ls_z_cover_qty"
- // },
- // {
- // label: "内布套下覆",
- // field: "ls_x_cover_qty"
- // },
- // {
- // label: "面料上覆",
- // field: "ls_s_m_cover_qty"
- // },
- // {
- // label: "面料侧覆",
- // field: "ls_z_m_cover_qty"
- // },
- // {
- // label: "面料下覆",
- // field: "ls_x_m_cover_qty"
- // },
- // {
- // label: "面拆",
- // field: "ls_if_m_chai"
- // },
- // {
- // label: "中拆",
- // field: "ls_if_z_chai"
- // },
- // {
- // label: "底拆",
- // field: "ls_if_d_chai"
- // },
- // {
- // label: "物料单价",
- // field: "ls_price"
- // },
- // {
- // label: "物料克重",
- // field: "ls_gram_weight"
- // },
- // {
- // label: "幅宽",
- // field: "ls_cloth_width"
- // },
- // {
- // label: "数量",
- // field: "ls_qty"
- // },
- // {
- // label: "物料厚度",
- // field: "ls_if_inputqty"
- // },
- // {
- // label: "固定厚度",
- // field: "ls_if_inputqty"
- // },
- // {
- // label: "厚度",
- // field: "ls_thickness"
- // },
- // {
- // label: "按面积单价",
- // field: "ls_if_areaprice"
- // },
- // {
- // label: "物料名称",
- // field: "ls_mtrlname"
- // },
- // {
- // label: "木托方式",
- // field: "ls_woodpallettype",
- // enum: [
- // { label: " '普通木托' ", value: "0" },
- // { label: " '夹板木托' ", value: "1" },
- // { label: " '铁管木托' ", value: "2" }
- // ]
- // }
- // ]);
- // /**
- // * @description 明细表计算公式
- // */
- // const summaryMxData = ref<any>([
- // {
- // label: "计算成本金额",
- // field: "costamt",
- // formula: ""
- // },
- // {
- // label: "计算清单用量",
- // field: "useqty",
- // formula: ""
- // }
- // ]);
- const funcMergeColumn = (columns: any, target: any) => {
- return columns.map(t => {
- let itm = target.find(item => t.field === item.field);
- if (itm) {
- t = defaultsDeep(itm, t);
- }
- return t;
- });
- };
- // const cushionsEdit = reactive<any>({
- // name: "VxeSelect",
- // options: state.formulaKindDcEnum,
- // optionProps: {
- // label: "label",
- // value: "value"
- // }
- // });
- const bednetCoumns: ColumnProps<any>[] = [
- {
- title: "位置",
- field: "chastr",
- visible: false
- },
- {
- title: "床网",
- field: "mtrlname",
- editRender: {},
- width: 250,
- editColRender: (scope: any) => {
- const { column, row, status, $table } = scope;
- let _label = column.title;
- let _deptid = state.LjDetailRef._mainData.deptid;
- let params = {
- deptid: _deptid,
- mattress_width: state.LjDetailRef._mainData.mattress_width,
- mattress_length: state.LjDetailRef._mainData.mattress_length
- };
- return (
- <BednetSelect
- value={row.mtrlid}
- {...params}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseBednet(row, params, $table)}
- onSelect={(val: any) => rModelSetBednet(row, val, $table)}
- onClear={() => rModelClearBednet(row, $table)}
- >
- {{
- label: () => row.mtrlname
- }}
- </BednetSelect>
- );
- }
- },
- {
- title: "+",
- field: "addmx",
- width: 80,
- render: (scope: any) => {
- let _if_mtrl = Number(scope.row.if_mtrl);
- if (_if_mtrl > 1) {
- if (state.orderStatus) {
- return (
- <ElPopconfirm
- width="220"
- icon={InfoFilled}
- title={t("business.tips.mattress.addMx")}
- confirm-button-text={t("common.addText")}
- onConfirm={() => funcAddMtrlMx(scope, () => wf_rtr_cwdc(scope.row, null, "add"))}
- >
- {{
- reference: () => {
- return <ElButton type="primary" plain circle icon={Plus}></ElButton>;
- }
- }}
- </ElPopconfirm>
- );
- } else {
- return "+";
- }
- } else {
- return "";
- }
- }
- },
- {
- title: "-",
- field: "delmx",
- width: 80,
- render: (scope: any) => {
- let _if_mtrl = Number(scope.row.if_mtrl);
- if (_if_mtrl > 1) {
- if (state.orderStatus) {
- return (
- <ElPopconfirm
- width="220"
- icon={InfoFilled}
- title={t("business.tips.mattress.delMx")}
- confirm-button-text={t("common.delText")}
- confirm-button-type="danger"
- onConfirm={() => funcDelBednet(scope, () => wf_rtr_cwdc(scope.row, null, "del"))}
- >
- {{
- reference: () => {
- return <ElButton type="danger" plain circle icon={Minus} />;
- }
- }}
- </ElPopconfirm>
- );
- } else {
- return "-";
- }
- } else {
- return "";
- }
- }
- }
- ];
- const cushionsColumns: ColumnProps<any>[] = [
- {
- title: "位置",
- field: "chastr",
- editRender: {},
- editColRender: (scope: any) => {
- return (
- <el-select v-model={scope.row.chastr}>
- {{
- default: () => {
- let rs = [];
- if (state.diancengAreaEnum.length) {
- state.diancengAreaEnum.map((t: any) => {
- rs.push(<el-option label={t.label} value={t.value} />);
- });
- }
- return rs;
- }
- }}
- </el-select>
- );
- }
- },
- {
- title: "公式名",
- field: "formulakind",
- table: "u_mattress_formula",
- align: "left",
- isFilterEnum: true,
- fieldNames: { value: "value", label: "label" },
- // editRender: {
- // name: "VxeSelect",
- // options: state.formulaKindDcEnum
- // }
- // editRender: cushionsEdit
- // render: (scope: any) => {
- // const { column, row, status } = scope;
- // let itmName = state.formulaKindEnum.find(t => t.value == row.formulakind)?.label ?? "";
- // return <>{itmName}</>;
- // },
- editRender: {},
- editColRender: (scope: any) => {
- let lastVal = scope.row.formulakind;
- return (
- <el-select v-model={scope.row.formulakind} onChange={val => cushionsFormulaKindChange(val, lastVal, scope)}>
- {{
- default: () => {
- let rs = [];
- if (state.formulaKindDcEnum.length) {
- state.formulaKindDcEnum.map((t: any) => {
- rs.push(<el-option label={t.label} value={t.value} />);
- });
- }
- return rs;
- }
- }}
- </el-select>
- );
- }
- },
- {
- title: "+",
- field: "addmx",
- visible: false
- },
- {
- title: "-",
- field: "delmx",
- visible: false
- },
- {
- title: "按物料?",
- field: "if_mtrl",
- visible: false
- },
- {
- title: "物料",
- field: "mtrlname",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status, $table } = scope;
- let _label = column.title;
- let _pricelistid = getPriceid();
- let _mtrltypeItem: any = mtrltypeTabList_cushions.find(t => t.formulakinds.includes(Number(row.formulakind)));
- if (!_mtrltypeItem) {
- // ElMessage.error("不是垫层类型行,不能选物料");
- // return <></>;
- }
- console.log("垫层 row.formulakind :>> ", row.formulakind, _mtrltypeItem);
- let params = {
- mtrltype: _mtrltypeItem?.value,
- pricelistid: _pricelistid
- };
- return (
- <>
- <MtrldefSelect
- value={row.mtrlid}
- {...params}
- disabled={!_mtrltypeItem}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseMtrl(row, params, rModelSetMtrl, _mtrltypeItem?.label, $table)}
- onSelect={(val: any) => rModelSetMtrl(row, val, $table)}
- onClear={() => rModelClearMtrl(row, $table)}
- >
- {{
- label: () => row.mtrlname
- }}
- </MtrldefSelect>
- </>
- );
- }
- },
- {
- title: "规格宽/CM",
- field: "mattress_width",
- datatype: "number",
- editRender: {
- name: "input"
- },
- visible: true
- },
- {
- title: "规格长/CM",
- field: "mattress_length",
- datatype: "number",
- editRender: {
- name: "input"
- },
- visible: true
- },
- {
- title: "厚度cm",
- field: "thickness",
- datatype: "number",
- editRender: {},
- editColRender: (scope: any) => {
- const { $table, column, row, status } = scope;
- const _disabled = !(
- (row.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 14, 32, 33].includes(row.formulakind)) ||
- row.formulakind == 7 ||
- row.formulakind == 999
- );
- return <el-input v-model={scope.row.thickness} type="number" disabled={_disabled}></el-input>;
- }
- }
- ];
- const accessoriesColumns: ColumnProps<any>[] = [
- {
- title: "位置",
- field: "chastr",
- visible: false
- },
- {
- title: "物料",
- field: "mtrlname",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status, $table } = scope;
- let field = column.field;
- let _label = column.title;
- // if (column?.format) {
- // _label = handleRowAccordingToProp(searchParam, field, column?.format);
- // }
- let _pricelistid = getPriceid();
- let _mtrltypeItem: any = mtrltypeTabList_accessories.find(t => t.formulakinds.includes(Number(row.formulakind)));
- if (!_mtrltypeItem) {
- ElMessage.error("不是辅料类型行,不能选物料");
- return "";
- }
- let params = {
- mtrltype: _mtrltypeItem.value,
- pricelistid: _pricelistid
- };
- return (
- <>
- <MtrldefSelect
- value={row.mtrlid}
- {...params}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseMtrl(row, params, rModelSetMtrl, _mtrltypeItem.label, $table)}
- onSelect={(val: any) => rModelSetMtrl(row, val, $table)}
- onClear={() => rModelClearMtrl(row, $table)}
- >
- {{
- label: () => row.mtrlname
- }}
- </MtrldefSelect>
- </>
- );
- }
- },
- {
- title: "厚度cm",
- field: "thickness",
- limited: true
- }
- ];
- const packagColumns: ColumnProps<any>[] = [
- {
- title: "位置",
- field: "chastr",
- visible: false
- },
- {
- title: "物料",
- field: "mtrlname",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status, $table } = scope;
- let field = column.field;
- let _label = column.title;
- // if (column?.format) {
- // _label = handleRowAccordingToProp(searchParam, field, column?.format);
- // }
- let _pricelistid = getPriceid();
- let _mtrltypeItem: any = mtrltypeTabList_packag.find(t => t.formulakinds.includes(Number(row.formulakind)));
- !_mtrltypeItem && (_mtrltypeItem = { value: -1 });
- let params = {
- mtrltype: _mtrltypeItem.value,
- pricelistid: _pricelistid
- };
- return (
- <>
- <MtrldefSelect
- value={row.mtrlid}
- {...params}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseMtrl(row, params, rModelSetMtrl, _mtrltypeItem.label, $table)}
- onSelect={(val: any) => rModelSetMtrl(row, val, $table)}
- onClear={() => rModelClearMtrl(row, $table)}
- >
- {{
- label: () => row.mtrlname
- }}
- </MtrldefSelect>
- </>
- );
- }
- },
- {
- title: "厚度cm",
- field: "thickness",
- limited: true
- }
- ];
- const columnsMxInnerClothLayer: ColumnProps<any>[] = [
- {
- title: "计算成功?",
- field: "if_success",
- datatype: "checkbox",
- limited: () => {
- const { userInfo } = useUserStore();
- return userInfo.usermode != 0;
- },
- render: (scope: any) => {
- if (Number(scope.row.if_success)) {
- return (
- <>
- <ElTag type="danger">异常</ElTag>
- </>
- );
- } else {
- return <></>;
- }
- }
- },
- {
- title: "位置",
- field: "chastr"
- // treeNode: true
- },
- {
- title: "+",
- field: "addmx",
- width: 80,
- render: (scope: any) => {
- let _if_mtrl = Number(scope.row.if_mtrl);
- if (_if_mtrl > 1) {
- if (state.orderStatus) {
- return (
- <>
- <ElPopconfirm
- width="220"
- icon={InfoFilled}
- title={t("business.tips.mattress.addMx")}
- confirm-button-text={t("common.addText")}
- onConfirm={() => funcAddMtrlMx(scope)}
- >
- {{
- reference: () => {
- return <ElButton type="primary" plain circle icon={Plus}></ElButton>;
- }
- }}
- </ElPopconfirm>
- </>
- );
- // return <ElButton type="primary" plain circle icon={Plus} onClick={() => funcAddMtrlMx(scope)}></ElButton>;
- } else {
- return <>+</>;
- }
- } else {
- return <></>;
- }
- }
- },
- {
- title: "-",
- field: "delmx",
- width: 80,
- render: (scope: any) => {
- let _if_mtrl = Number(scope.row.if_mtrl);
- if (_if_mtrl > 1) {
- if (state.orderStatus) {
- return (
- <>
- <ElPopconfirm
- width="220"
- icon={InfoFilled}
- title={t("business.tips.mattress.delMx")}
- confirm-button-text={t("common.delText")}
- confirm-button-type="danger"
- onConfirm={() => funcDelMtrlMx(scope)}
- >
- {{
- reference: () => {
- return <ElButton type="danger" plain circle icon={Minus} />;
- }
- }}
- </ElPopconfirm>
- </>
- );
- // return <ElButton type="danger" plain circle icon={Minus} onClick={() => funcDelMtrlMx(scope)}></ElButton>;
- } else {
- return <>-</>;
- }
- } else {
- return <></>;
- }
- }
- },
- {
- title: "厚度cm",
- field: "thickness",
- datatype: "number",
- editRender: {},
- editColRender: (scope: any) => {
- const { $table, column, row, status } = scope;
- const _disabled = !(
- (row.if_inputqty == 0 && [50, 51, 52, 53, 54, 104, 114, 11, 14, 32, 33].includes(row.formulakind)) ||
- row.formulakind == 202 ||
- row.formulakind == 203
- );
- return <el-input v-model={scope.row.thickness} type="number" disabled={_disabled}></el-input>;
- }
- },
- {
- title: "物料",
- field: "mtrlname",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status, $table } = scope;
- let _label = column.title;
- let _pricelistid = getPriceid();
- let _mtrltypeItem: any = mtrltypeTabList_inner.find(t => t.formulakinds.includes(Number(row.formulakind)));
- !_mtrltypeItem && (_mtrltypeItem = { value: -1 });
- let params = {
- mtrltype: _mtrltypeItem.value,
- pricelistid: _pricelistid
- };
- return (
- <>
- <MtrldefSelect
- value={row.mtrlid}
- {...params}
- clearable
- placeholder={_label}
- onOpenModal={() => fModelChoseMtrl(row, params, rModelSetMtrlInner, _mtrltypeItem.label, $table)}
- onSelect={(val: any) => rModelSetMtrlInner(row, val, $table)}
- onClear={() => rModelClearMtrl(row, $table)}
- >
- {{
- label: () => row.mtrlname
- }}
- </MtrldefSelect>
- </>
- );
- }
- },
- {
- title: "数量/长度",
- field: "qty",
- datatype: "number",
- editRender: {},
- editColRender: (scope: any) => {
- const { $table, column, row, status } = scope;
- return <el-input v-model={scope.row.qty} type="number" disabled={row.mtrlid == 0}></el-input>;
- }
- },
- {
- title: "规格宽/CM",
- field: "mattress_width",
- datatype: "number",
- editRender: {
- name: "input"
- }
- },
- {
- title: "规格长/CM",
- field: "mattress_length",
- datatype: "number",
- editRender: {
- name: "input"
- }
- },
- {
- title: "标准\r\n成本金额",
- field: "dannum2_rate",
- datatype: "number",
- limited: () => {
- return userInfo.usermode != 0;
- },
- render: (scope: any) => {
- return formatCutNumber({ val: floatMul(scope.row.costamt, 1 + scope.row.dannum2_rate) });
- }
- },
- {
- title: "散单\r\n成本金额",
- field: "dannum1_rate",
- datatype: "number",
- limited: () => {
- return userInfo.usermode != 0;
- },
- render: (scope: any) => {
- return formatCutNumber({ val: floatMul(scope.row.costamt, 1 + scope.row.dannum1_rate) });
- }
- },
- {
- title: "大单\r\n成本金额",
- field: "dannum3_rate",
- datatype: "number",
- limited: () => {
- return userInfo.usermode != 0;
- },
- render: (scope: any) => {
- return formatCutNumber({ val: floatMul(scope.row.costamt, 1 + scope.row.dannum3_rate) });
- }
- },
- {
- title: "小单\r\n成本金额",
- field: "dannum4_rate",
- datatype: "number",
- limited: () => {
- return userInfo.usermode != 0;
- },
- render: (scope: any) => {
- return formatCutNumber({ val: floatMul(scope.row.costamt, 1 + scope.row.dannum4_rate) });
- }
- }
- ];
- const columnsMx_processes: any = [
- { type: "checkbox", width: 50, fixed: "left" },
- {
- title: "+",
- field: "addmx",
- width: 80,
- render: (scope: any) => {
- let oItem = state.specialProcessesMxData.find(o => o.extraid == scope.row.extraid);
- if (!oItem) {
- oItem = {
- inputtype: 1
- };
- }
- if (state.orderStatus) {
- return (
- <ElButton
- type="primary"
- plain
- circle
- icon={Plus}
- disabled={oItem.inputtype == 2}
- onClick={() => funcAddMtrlMx(scope)}
- ></ElButton>
- );
- } else {
- return <>+</>;
- }
- }
- },
- {
- title: "-",
- field: "delmx",
- width: 80,
- render: (scope: any) => {
- let oItem = state.specialProcessesMxData.find(o => o.extraid == scope.row.extraid);
- if (!oItem) {
- oItem = {
- inputtype: 1
- };
- }
- if (state.orderStatus) {
- return (
- <>
- <ElPopconfirm
- width="220"
- icon={InfoFilled}
- title={t("business.tips.mattress.delMx")}
- confirm-button-text={t("common.delText")}
- confirm-button-type="danger"
- onConfirm={() => funcDelMtrlMx(scope)}
- >
- {{
- reference: () => {
- return <ElButton type="danger" plain circle disabled={oItem.inputtype == 2} icon={Minus} />;
- }
- }}
- </ElPopconfirm>
- </>
- );
- // return <ElButton type="danger" plain circle icon={Minus} onClick={() => funcDelMtrlMx(scope)}></ElButton>;
- } else {
- return <>-</>;
- }
- }
- },
- {
- title: "项目类型",
- field: "extraid",
- // editRender: {
- // name: "select"
- // }
- editRender: {},
- editColRender: (scope: any) => {
- return (
- <el-select
- v-model={scope.row.extraid}
- disabled={scope.row.inputtype == 2}
- onChange={val => extratypeOnChange(val, scope)}
- >
- {{
- default: () => {
- let rs = [];
- if (state.specialProcessesEnum.length) {
- state.specialProcessesEnum.map((t: any) => {
- rs.push(<el-option label={t.typename} value={t.extraid} disabled={t.inputtype == 2} />);
- });
- }
- return rs;
- }
- }}
- </el-select>
- );
- },
- render: scope => {
- let item = state.specialProcessesEnum.find(t => t.extraid == scope.row.extraid);
- if (item) {
- return item.typename;
- } else {
- return "";
- }
- }
- },
- {
- title: "项目名称",
- field: "extraname",
- editRender: {},
- editColRender: (scope: any) => {
- let _disabled = scope.row.inputtype == 2;
- if (scope.row.inputtype == 0) {
- return (
- <el-select
- v-model={scope.row.extramxid}
- disabled={_disabled}
- onChange={val => additionalOnChange(val, scope, state.specialProcessesMxData)}
- >
- {{
- default: () => {
- let rs = [];
- if (state.specialProcessesMxData.length) {
- state.specialProcessesMxData
- .filter(t => t.extraid == scope.row.extraid)
- .map((t: any) => {
- rs.push(<el-option label={t.extramxname} value={t.extramxid} />);
- });
- }
- return rs;
- }
- }}
- </el-select>
- );
- } else {
- return (
- <el-autocomplete
- v-model={scope.row.extraname}
- disabled={_disabled}
- value-key="extramxname"
- fetch-suggestions={(queryString: string, callback: any) =>
- querySearch_processes(queryString, callback, scope, state.specialProcessesMxData)
- }
- onSelect={itm => additionalOnSelect(itm, scope)}
- clearable
- />
- );
- }
- }
- },
- {
- title: "金额",
- field: "price",
- datatype: "number",
- editRender: {},
- editColRender: (scope: any) => {
- const { $table, column, row, status } = scope;
- return <el-input v-model={scope.row.price} type="number" disabled={row.inputtype == 2}></el-input>;
- }
- },
- {
- title: "数量",
- field: "qty",
- datatype: "number",
- editRender: {},
- editColRender: (scope: any) => {
- const { $table, column, row, status } = scope;
- return <el-input v-model={scope.row.qty} type="number" disabled={row.inputtype == 2}></el-input>;
- }
- },
- {
- title: "备注",
- field: "dscrp",
- editRender: {
- name: "$input"
- }
- }
- ];
- const columnsMx_additional: any = [
- { type: "checkbox", width: 50, fixed: "left" },
- {
- title: "+",
- field: "addmx",
- width: 80,
- render: (scope: any) => {
- if (state.orderStatus) {
- return <ElButton type="primary" plain circle icon={Plus} onClick={() => funcAddMtrlMx(scope)}></ElButton>;
- } else {
- return <>+</>;
- }
- }
- },
- {
- title: "-",
- field: "delmx",
- width: 80,
- render: (scope: any) => {
- let oItem = state.additionalCostsMxData.find(o => o.extraid == scope.row.extraid);
- if (!oItem) {
- oItem = {
- inputtype: 1
- };
- }
- if (state.orderStatus) {
- return (
- <>
- <ElPopconfirm
- width="220"
- icon={InfoFilled}
- title={t("business.tips.mattress.delMx")}
- confirm-button-text={t("common.delText")}
- confirm-button-type="danger"
- onConfirm={() => funcDelMtrlMx(scope)}
- >
- {{
- reference: () => {
- return <ElButton type="danger" plain circle disabled={oItem.inputtype == 2} icon={Minus} />;
- }
- }}
- </ElPopconfirm>
- </>
- );
- // return <ElButton type="danger" plain circle icon={Minus} onClick={() => funcDelMtrlMx(scope)}></ElButton>;
- } else {
- return <>-</>;
- }
- }
- },
- {
- title: "项目类型",
- field: "extraid",
- editRender: {},
- editColRender: (scope: any) => {
- return (
- <el-select
- v-model={scope.row.extraid}
- disabled={scope.row.inputtype == 2}
- onChange={val => extratypeOnChange(val, scope)}
- >
- {{
- default: () => {
- let rs = [];
- if (state.additionalCostsEnum.length) {
- state.additionalCostsEnum.map((t: any) => {
- rs.push(<el-option label={t.typename} value={t.extraid} disabled={t.inputtype == 2} />);
- });
- }
- return rs;
- }
- }}
- </el-select>
- );
- },
- render: scope => {
- let item = state.additionalCostsEnum.find(t => t.extraid == scope.row.extraid);
- if (item) {
- return item.typename;
- } else {
- return "";
- }
- }
- },
- {
- title: "项目名称",
- field: "extraname",
- editRender: {},
- editColRender: (scope: any) => {
- console.log("editColRender 1111 scope :>> ", scope);
- let _disabled = scope.row.inputtype == 2;
- if (scope.row.inputtype == 0) {
- return (
- <el-select
- v-model={scope.row.extramxid}
- disabled={_disabled}
- onChange={val => additionalOnChange(val, scope, state.additionalCostsMxData)}
- >
- {{
- default: () => {
- let rs = [];
- if (state.additionalCostsMxData.length) {
- state.additionalCostsMxData
- .filter(t => t.extraid == scope.row.extraid)
- .map((t: any) => {
- rs.push(<el-option label={t.extramxname} value={t.extramxid} />);
- });
- }
- return rs;
- }
- }}
- </el-select>
- );
- } else {
- return (
- <el-autocomplete
- v-model={scope.row.extraname}
- disabled={_disabled}
- value-key="extramxname"
- fetch-suggestions={(queryString: string, callback: any) =>
- querySearch_additional(queryString, callback, scope, state.additionalCostsMxData)
- }
- onSelect={itm => additionalOnSelect(itm, scope)}
- clearable
- />
- );
- }
- }
- },
- {
- title: "金额",
- field: "price",
- datatype: "number",
- editRender: {},
- editColRender: (scope: any) => {
- const { $table, column, row, status } = scope;
- return <el-input v-model={scope.row.price} type="number" disabled={row.inputtype == 2}></el-input>;
- }
- },
- {
- title: "数量",
- field: "qty",
- datatype: "number",
- editRender: {},
- editColRender: (scope: any) => {
- const { $table, column, row, status } = scope;
- return <el-input v-model={scope.row.qty} type="number" disabled={row.inputtype == 2}></el-input>;
- }
- },
- {
- title: "备注",
- field: "dscrp",
- editRender: {
- name: "$input"
- }
- }
- ];
- const extratypeOnChange = (value: any, scope: any) => {
- const { row } = scope;
- if (state.specialProcessesEnum.length) {
- let item = state.specialProcessesEnum.find(t => t.extraid == value);
- if (item) {
- row.extramxid = 0;
- row.inputtype = 0;
- row.extraname = "";
- row.price = 0;
- row.qty = 0;
- row.dscrp = "";
- }
- }
- };
- const additionalOnChange = (value: any, scope: any, enumdata: any) => {
- const { row } = scope;
- if (enumdata.length) {
- let item = enumdata.find(t => t.extraid == row.extraid && t.extramxid == value);
- if (item) {
- additionalOnSelect(item, scope);
- }
- }
- };
- const additionalOnSelect = (item: Record<string, any>, scope: any) => {
- const { row } = scope;
- // console.log("additionalOnSelect: >>", item);
- // const $tableAdditional = state.additionalCostsMxRef.element;
- // if ($tableAdditional) {
- // const { visibleData } = $tableAdditional.getTableData();
- // const row = visibleData[$rowIndex];
- // console.log("additionalOnSelect: row >>", row);
- // row.extramxname = item.extramxname;
- row.extramxid = item.extramxid ?? 0;
- row.inputtype = item.inputtype;
- row.extraid = item.extraid;
- row.extraname = item.extramxname;
- // row.typeid = item.typeid;
- row.price = item.price;
- row.qty = item.qty;
- row.dscrp = item.dscrp;
- // $tableAdditional.reloadData(visibleData);
- // }
- };
- const querySearch_processes = (queryString: string, cb: any, data, list) => {
- const { row } = data;
- const results = queryString
- ? list.filter(o => {
- return o.extramxname.indexOf(queryString) > -1 && o.extraid == row.extraid;
- })
- : list.filter(o => o.extraid == row.extraid);
- cb(results);
- };
- const querySearch_additional = (queryString: string, cb: any, data, list) => {
- const { row } = data;
- const results = queryString
- ? list.filter(o => {
- return o.extramxname.indexOf(queryString) > -1 && o.extraid == row.extraid;
- })
- : list.filter(o => o.extraid == row.extraid);
- cb(results);
- };
- const columnsMx_subSpecs: any = [
- { type: "checkbox", width: 50, fixed: "left" },
- {
- title: "核价编码",
- field: "mattressrelcode",
- editRender: {
- name: "$input"
- }
- },
- {
- title: "核价名称",
- field: "mattressname",
- editRender: {
- name: "$input"
- }
- },
- {
- title: "床垫宽/CM",
- field: "mattress_width",
- datatype: "number",
- // editRender: {
- // name: "VxeInput",
- // props: {
- // type: "number",
- // onBlur: (e: any) => {
- // const {value} = e
- // console.log("columnsMx_subSpecs: e >>", e);
- // if (value) {
- // setMxSpringQtyWidthAndLength();
- // }
- // }
- // }
- // }
- editRender: {},
- editColRender: (scope: any) => {
- return (
- <>
- <el-input v-model={scope.row.mattress_width} onChange={() => disshow_subspecs(scope)} />
- </>
- );
- }
- },
- {
- title: "床垫长/CM",
- field: "mattress_length",
- datatype: "number",
- // editRender: {
- // name: "$input",
- // props: {
- // type: "number"
- // }
- // }
- editRender: {},
- editColRender: (scope: any) => {
- return (
- <>
- <el-input v-model={scope.row.mattress_length} onChange={() => disshow_subspecs(scope)} />
- </>
- );
- }
- },
- {
- title: "床垫高/CM",
- field: "mattress_height",
- datatype: "number"
- // editRender: {
- // name: "$input",
- // props: {
- // type: "number"
- // }
- // }
- // editRender: {},
- // editColRender: (scope: any) => {
- // return (
- // <>
- // <el-input v-model={scope.row.mattress_height} onChange={() => disshow_subspecs(scope.row)} />
- // </>
- // );
- // }
- }
- // {
- // title: "弹簧排列个数-宽",
- // field: "spring_qty_width",
- // datatype: "integer",
- // editRender: {
- // name: "$input"
- // // props: {
- // // type: "number"
- // // }
- // }
- // },
- // {
- // title: "弹簧排列个数-长",
- // field: "spring_qty_length",
- // datatype: "integer",
- // editRender: {
- // name: "$input"
- // // props: {
- // // type: "number"
- // // }
- // }
- // }
- ];
- const handleToImportMxInner = async () => {
- let _params = {
- dsname: "web_mattress_formulalist",
- queryparams: {
- arg_array_formulatype: [101],
- arrg_usetype: 0
- }
- };
- let res = await CommonDynamicSelect(_params);
- let idxStr = "";
- const $table = state.innerClothLayerMxRef.element;
- if ($table) {
- const { visibleData } = $table.getTableData();
- if (visibleData.length) {
- let lastMx = visibleData[visibleData.length - 1];
- idxStr = Number(lastMx.chastr.match(/\d+$/)?.[0] ?? 0) + 1 + "";
- } else {
- idxStr = "";
- }
- }
- if (res?.datatable?.length) {
- const $table = state.innerClothLayerMxRef.element;
- // $table.remove();
- let _rows = res?.datatable.map((item: any, index: number) => {
- let _data: any = {};
- if (Number(item.if_mtrl) > 1) {
- _data.addmx = "+";
- _data.delmx = "-";
- }
- _data.formulatype = item.formulatype;
- _data.if_mtrl = item.if_mtrl;
- _data.formulaid = item.formulaid;
- _data.sortcode = item.sortcode;
- _data.formulakind = item.formulakind;
- _data.formula = item.formula;
- _data.chastr = "内布套" + idxStr;
- _data.useformula = item.useformula;
- _data.gydscrp = item.gydscrp;
- _data.pid = index + 1;
- return _data;
- });
- // let tree = {
- // chastr: "内布套",
- // children: _rows
- // };
- // $table.insertAt(tree, -1);
- await $table.insertAt(_rows, -1);
- ElMessage.success("导入成功");
- }
- resetMergeCellsInner();
- };
- const resetMergeCellsInner = () => {
- setTimeout(() => {
- const $table = state.innerClothLayerMxRef.element;
- if ($table) {
- let mergeCells = autoMergeCells($table, ["chastr"]);
- console.log("resetMergeCellsInner autoMergeCells :>> ", mergeCells);
- $table.setMergeCells(mergeCells);
- }
- }, 200);
- };
- const resetSpecialProcesses = (type: string) => {
- console.log("resetSpecialProcesses type:>> ", type);
- console.log("resetSpecialProcesses additionalCostsMxInitData:>> ", state.additionalCostsMxInitData);
- console.log("resetSpecialProcesses specialProcessesMxInitData:>> ", state.specialProcessesMxInitData);
- // setTimeout(() => {
- // const $table = state.innerClothLayerMxRef.element;
- // if ($table) {
- // let mergeCells = autoMergeCells($table, ["chastr"]);
- // console.log("resetMergeCellsInner autoMergeCells :>> ", mergeCells);
- // $table.setMergeCells(mergeCells);
- // }
- // }, 200);
- };
- const hanleDelMxInner = (type: number) => {
- const $table = state.innerClothLayerMxRef.element;
- if ($table) {
- if (type == 1) {
- // 全部
- $table.remove();
- } else if (type == 0) {
- // 删除选中
- const curRow = $table.getCurrentRecord();
- if (!curRow) {
- ElMessage.warning("请先选择要删除的行");
- return;
- }
- $table.remove(curRow);
- }
- }
- };
- const w_mattress_add_itemname_choose = (type: number) => {
- let arr = [];
- if (type == 1) {
- } else if (type == 2) {
- } else if (type == 3) {
- arr.push({
- label: "内布套",
- value: "内布套"
- });
- arr.push({
- label: "内布套拆装",
- value: "内布套拆装"
- });
- } else if (type == 4) {
- arr.push({
- label: "顶布裥棉1",
- value: "顶布裥棉1"
- });
- arr.push({
- label: "顶布裥棉2",
- value: "顶布裥棉2"
- });
- arr.push({
- label: "顶布裥棉3",
- value: "顶布裥棉3"
- });
- arr.push({
- label: "顶布裥棉4",
- value: "顶布裥棉4"
- });
- }
- return arr;
- };
- const wf_add_w_butao = async (val: any) => {
- console.log("val :>> ", val);
- const $table = state.topCottonMxRef.element;
- if ($table) {
- const { fullData } = $table.getTableData();
- let ifind = fullData.find(t => t.chastr == val.value);
- if (ifind) {
- ElMessage.warning(`该选项${val.value}已存在`);
- return;
- }
- let newParams: any = {};
- newParams.queryParams = {
- arg_array_formulatype: [103],
- arrg_usetype: 0
- };
- newParams.dsname = "web_mattress_formulalist";
- let res = await CommonDynamicSelect(newParams);
- console.log("funcAddBigSide res :>> ", res);
- if (res.datatable) {
- let _rows = res?.datatable.map((item: any) => {
- let _data: any = {};
- if (Number(item.if_mtrl) > 1) {
- _data.addmx = "+";
- _data.delmx = "-";
- }
- _data.formulatype = item.formulatype;
- _data.if_mtrl = item.if_mtrl;
- _data.formulaid = item.formulaid;
- _data.sortcode = item.sortcode;
- _data.formulakind = item.formulakind;
- _data.formula = item.formula;
- _data.chastr = val.value;
- _data.useformula = item.useformula;
- _data.gydscrp = item.gydscrp;
- return _data;
- });
- $table.insertAt(_rows, -1);
- }
- }
- resetMergeCellsTopCotton();
- };
- const resetMergeCellsTopCotton = () => {
- setTimeout(() => {
- const $table = state.topCottonMxRef.element;
- if ($table) {
- let mergeCells = autoMergeCells($table, ["chastr"]);
- console.log("resetMergeCellsInner autoMergeCells :>> ", mergeCells);
- $table.setMergeCells(mergeCells);
- }
- }, 1);
- };
- /**
- * @description 删除顶布裥棉明细
- */
- const wf_del_w_butao = async () => {
- const $table = state.topCottonMxRef.element;
- // 删除选中
- const curRow = $table.getCurrentRecord();
- const { fullData } = $table.getTableData();
- if (!curRow) {
- ElMessage.warning("请先选择要删除的行");
- return;
- }
- let ls_chastr = curRow.chastr;
- ElMessageBox.confirm(`是否确定要删除【${ls_chastr}】的明细行?`, "询问", {
- confirmButtonText: "是",
- cancelButtonText: "否",
- type: "warning"
- }).then(() => {
- let _rows = fullData.filter((item: any) => item.chastr == ls_chastr);
- $table.remove(_rows);
- ElMessage({
- type: "success",
- message: "删除成功"
- });
- });
- };
- /**
- * @description 获取部门的价格表id
- * @returns
- */
- const getPriceid = () => {
- let _deptid = state.LjDetailRef?._mainData?.deptid ?? 0;
- if (!_deptid) {
- ElMessage.warning("请先选择部门");
- state.LjDetailRef?.baseformRef.element.validateField("deptid");
- return 0;
- }
- let deptEnum = state.LjDetailRef.enumMap.get("deptid");
- let _pricelistid = 0;
- if (deptEnum) {
- let depItem = deptEnum.find((item: any) => item.value == _deptid);
- if (depItem) {
- _pricelistid = Number(depItem.pricelistid);
- }
- }
- return _pricelistid;
- };
- // 节流
- const disshow_subspecs = throttle((val: any) => {
- setMxSpringQtyWidthAndLength(val);
- }, 500);
- /**
- * @description 设置床网高度,自动计算宽度,长度
- */
- const setMxSpringQtyWidthAndLength = async scope => {
- console.log("setMxSpringQtyWidthAndLength varow :>> ", scope);
- const { row } = scope;
- const $tableBednet = state.bednetMxRef.element;
- if ($tableBednet) {
- const { visibleData } = $tableBednet.getTableData();
- // 需要填写关键数据
- if (!Number(row.mattress_width) || !Number(row.mattress_length) || !Number(row.mattress_height)) {
- return;
- }
- // 如果表格没有数据/没有选床网,则不执行
- if (!visibleData.length || !visibleData[0].mtrlid) {
- return;
- }
- let _pricelistid = getPriceid();
- for (let i = 0; i < visibleData.length; i++) {
- let _mainData = visibleData[i];
- if (_mainData.mtrlid > 0) {
- let bednet = cloneDeep(_mainData);
- bednet.bednetid = _mainData.mtrlid;
- // bednet.if_doublenet = Number(bednet.if_doublenet);
- // bednet.if_doublespring = Number(bednet.if_doublespring);
- // bednet.if_side_iron = Number(bednet.if_side_iron);
- // bednet.if_rsorwa = Number(bednet.if_rsorwa);
- // bednet.if_sponge_drilling = Number(bednet.if_sponge_drilling);
- // bednet.iffork = Number(bednet.iffork);
- // bednet.ifsaleout = Number(bednet.ifsaleout);
- // bednet.if_jb = Number(bednet.if_jb);
- // bednet.flag = Number(bednet.flag);
- bednet.mattress_length = row.mattress_length;
- bednet.mattress_width = row.mattress_width;
- bednet.pricelistid = _pricelistid;
- let _params: any = {
- bednet: bednet
- // bednetMx: state.vxeTableMxRef?.element.getTableData().fullData ?? [],
- // spring: state.vxeTableMxSpringRef?.element.getTableData().fullData ?? []
- };
- console.log("setMxSpringQtyWidthAndLength _params :>> ", _params);
- let res = await GetComputeSpring(_params);
- console.log("setMxSpringQtyWidthAndLength res :>> ", res);
- console.log("setMxSpringQtyWidthAndLength row :>> ", row);
- if (!res?.message) {
- scope.row["spring_qty_width_" + (i + 1)] = res.bednetMx[0].spring_qty_width;
- scope.row["spring_qty_length_" + (i + 1)] = res.bednetMx[0].spring_qty_length;
- }
- console.log("setMxSpringQtyWidthAndLength scopes row :>> ", scope.row);
- }
- }
- }
- };
- /**
- * @description 自动导入修改特殊工艺费用
- */
- const autoLoadExtraData_chai = (value?: any, fieldName?: any) => {
- console.log("autoLoadExtraData_chai value :>> ", value);
- let _type = "";
- switch (fieldName) {
- case "if_m_chai":
- _type = "面拆";
- break;
- case "if_z_chai":
- _type = "中拆";
- break;
- case "if_d_chai":
- _type = "底拆";
- break;
- }
- console.log("state. specialProcessesEnum:>> ", state.specialProcessesEnum, state.specialProcessesMxData);
- let result = state.specialProcessesMxData.filter((item: any) => item.extramxname.indexOf(_type) > -1);
- if (result.length) {
- const $tableTarget = state.specialProcessesMxRef.element;
- const { visibleData: tgVisibleData } = $tableTarget.getTableData();
- if (tgVisibleData) {
- let _remove = [];
- tgVisibleData.map(t => {
- let _itm = result.find(i => i.extraid === t.extraid && i.extramxid === t.extramxid);
- if (_itm) {
- _remove.push(t);
- }
- });
- $tableTarget.remove(_remove);
- }
- if (value) {
- // 新增
- if (result.length) {
- let _arr = [];
- let _mattressId = state.LjDetailRef._mainData.mattressid;
- result.map(o => {
- let _itm = {
- mattressid: _mattressId,
- mattressmxid: 0,
- extraid: o.extraid,
- extramxid: o.extramxid,
- extraname: o.extramxname,
- price: o.price,
- qty: o.qty,
- dscrp: o.dscrp,
- inputtype: o.inputtype,
- typeid: o.typeid
- };
- _arr.push(_itm);
- });
- $tableTarget.insertAt(_arr, -1);
- }
- } else {
- // 删除
- }
- }
- };
- const gotoErpapi = (_cur, type) => {
- try {
- if (type === 1) {
- if (_cur.yw_flag == 1) {
- throw new Error(_cur.mattresscode + ":已业务补充审核,无法修改");
- }
- } else if (type === 2) {
- if (_cur.js1_flag == 1) {
- throw new Error(_cur.mattresscode + ":已产品补充审核,无法修改");
- }
- } else if (type === 3) {
- if (_cur.js2_flag == 1) {
- throw new Error(_cur.mattresscode + ":已清单补充审核,无法修改");
- }
- }
- } catch (error) {
- ElMessage.error(error.message);
- return false;
- }
- router.push({
- path: `/erpapi/mattressInterface/edit/${_cur.mattressid}`,
- query: {
- code: _cur.mattresscode,
- type: type
- }
- });
- };
- /**
- * @description 更新主副规格表结构
- */
- const updateSubspecsTable = () => {
- // state.columnsMx_subSpecs_dis = [];
- // 检查床网
- console.log("updateSubspecsTable state.columnsMx_subSpecs_dis :>> ", state.columnsMx_subSpecs_dis);
- const $tableBendet = state.bednetMxRef.element;
- const $tableSubspecs = state.subSpecsRef?.element;
- let cols = [];
- let visibleData = [];
- if ($tableSubspecs) {
- visibleData = $tableSubspecs.getTableData().visibleData;
- }
- if ($tableBendet) {
- const { visibleData: bednetVisibleData } = $tableBendet.getTableData();
- if (bednetVisibleData && bednetVisibleData.length) {
- // let filedsName = state.columnsMx_subSpecs_dis
- // .filter((item: any) => item.field && item.field.indexOf("spring_qty_width_") > -1)
- // .map(item => item.field);
- // let bednetFieldsName = bednetVisibleData
- // .filter((item: any) => item.mtrlid)
- // .map(item => "spring_qty_width_" + item.mtrlid);
- console.log(
- 'filedsName.join(",") != bednetFieldsName.join(",") :>> ',
- // filedsName.join(","),
- // bednetFieldsName.join(","),
- bednetVisibleData
- );
- // if (filedsName.join(",") != bednetFieldsName.join(",")) {
- bednetVisibleData.map((item: any, idx: any) => {
- if (item.mtrlid) {
- cols.push({
- title: "弹簧排列个数-宽" + "-床网" + (idx + 1),
- field: "spring_qty_width_" + (idx + 1),
- datatype: "integer",
- editRender: {
- name: "$input"
- }
- });
- cols.push({
- title: "弹簧排列个数-宽" + "-床网" + (idx + 1),
- field: "spring_qty_length_" + (idx + 1),
- datatype: "integer",
- editRender: {
- name: "$input"
- }
- });
- // 床网使用弹叉
- cols.push({
- title: "弹叉数量" + "-床网" + (idx + 1),
- field: "bednet_fork_qty_" + (idx + 1),
- datatype: "integer",
- editRender: {
- name: "$input"
- }
- });
- }
- });
- // }
- }
- }
- const $tableCushions = state.cushionsMxRef.element;
- if ($tableCushions) {
- const { visibleData: cushionsVisibleData } = $tableCushions.getTableData();
- if (cushionsVisibleData && cushionsVisibleData.length) {
- // let filedsName = state.columnsMx_subSpecs_dis
- // .filter((item: any) => item.field && item.field.indexOf("cushions_subspecs_") > -1)
- // .map(item => item.field);
- // let cushionsFieldsName = cushionsVisibleData
- // .filter((item: any) => item.mtrlid && item.if_subspecs)
- // .map(item => "cushions_subspecs_" + item.mtrlid);
- // console.log('filedsName.join(",") ', filedsName.join(","));
- // console.log(' cushionsFieldsName.join(",") :>> ', cushionsFieldsName.join(","));
- // if (filedsName.join(",") != cushionsFieldsName.join(",")) {
- let idx = 0;
- cushionsVisibleData.map((item: any, index: any) => {
- if (item.mtrlid && item.if_subspecs) {
- let _field = "cushions_subspecs_" + (idx + 1);
- let _mtrlname = "cushions_subspecs_mtrlname_" + (idx + 1);
- let _formulakind = "cushions_subspecs_formulakind_" + (idx + 1);
- idx++;
- visibleData = visibleData.map(itm => {
- itm[_formulakind] = item.formulakind;
- return itm;
- });
- cols.push({
- title: "垫层物料-" + item.chastr + " " + (index + 1),
- field: _mtrlname,
- width: "200",
- datatype: "integer",
- editRender: {},
- editColRender: (scope: any) => {
- const { column, row, status, $table } = scope;
- let _label = column.title;
- let _pricelistid = getPriceid();
- let _mtrltypeItem: any = mtrltypeTabList_cushions.find(t => t.formulakinds.includes(Number(row[_formulakind])));
- if (!_mtrltypeItem) {
- // ElMessage.error("不是垫层类型行,不能选物料");
- // return <></>;
- }
- console.log("updateSubspecsTable _mtrltypeItem :>> ", _mtrltypeItem);
- let params = {
- mtrltype: _mtrltypeItem?.value,
- pricelistid: _pricelistid
- };
- return (
- <>
- <MtrldefSelect
- value={row[_field]}
- {...params}
- disabled={!_mtrltypeItem}
- clearable
- placeholder={_label}
- onOpenModal={() =>
- fModelChoseMtrl(
- row,
- params,
- (data, val: any) => {
- row[_field] = val.mtrlid;
- row[_mtrlname] = val.mtrlname;
- },
- _mtrltypeItem?.label,
- $table
- )
- }
- onSelect={(val: any) => {
- row[_field] = val.mtrlid;
- row[_mtrlname] = val.mtrlname;
- }}
- onClear={() => {
- row[_field] = 0;
- row[_mtrlname] = "";
- }}
- >
- {{
- label: () => row[_mtrlname]
- }}
- </MtrldefSelect>
- </>
- );
- }
- });
- }
- });
- // }
- }
- }
- // if (cols.length > 0) {
- state.columnsMx_subSpecs_dis = columnsMx_subSpecs.concat(cols);
- console.log("updateSubspecsTable state.columnsMx_subSpecs_dis 321:>> ", state.columnsMx_subSpecs_dis);
- nextTick(() => {
- // state.subSpecsRef.element.loadColumn(state.columnsMx_subSpecs_dis);
- state.subSpecsRef.loadColumns(state.columnsMx_subSpecs_dis);
- console.log("visibleData :>> ", visibleData);
- if ($tableSubspecs) {
- state.subSpecsData = visibleData;
- }
- });
- // }
- };
- return {
- ...toRefs(state),
- columns,
- columnsMx,
- columnsMxBednet: funcMergeColumn(columnsMx, bednetCoumns),
- columnsMxCushions: funcMergeColumn(columnsMx, cushionsColumns),
- columnsMxAccessories: funcMergeColumn(columnsMx, accessoriesColumns),
- columnsMxPackag: funcMergeColumn(columnsMx, packagColumns),
- columnsMxInnerClothLayer,
- // summaryData,
- // fieldParams,
- columnsMx_subSpecs,
- columnsMx_processes,
- columnsMx_additional,
- funcAddMxSide,
- funcChaifenTab,
- getData_mx,
- dataCallback,
- dataCallbackMx,
- getMattressType,
- gotoSummy,
- gotoHisprice,
- getFormulakindEnum,
- funcPacktypeChange,
- dynamicRef,
- wf_cmp_cb,
- handleToImportMxInner,
- hanleDelMxInner,
- wf_add_w_butao,
- wf_del_w_butao,
- w_mattress_add_itemname_choose,
- wf_rtr_bednet,
- funcAddMtrlMx,
- resetMergeCellsInner,
- resetSpecialProcesses,
- resetMergeCellsTopCotton,
- wf_rtr_cwdc,
- gotoErpapi,
- updateSubspecsTable
- };
- };
|