index.tsx 135 KB

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