index.tsx 151 KB

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