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