index.tsx 153 KB

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