12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784 |
- 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 } 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 } from "@/utils/index";
- import { cloneDeep, defaultsDeep } 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";
- interface defaultState {
- /**
- * @description 单据当前状态
- */
- orderStatus: string;
- 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;
- }
- interface bednetDrawerPropsdata {
- deptid?: number;
- bednetid?: number;
- state?: string;
- }
- export const useHooks = (t?: any) => {
- const state = reactive<defaultState>({
- orderStatus: "",
- 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: []
- });
- 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 funcMoneyrateChange = async (val: any, data) => {
- let newParams = {
- dsname: "_Mapper_deptid",
- queryparams: {
- deptid: data.deptid
- }
- };
- let res = await CommonDynamicSelect(newParams);
- let _discount = 1;
- let _moneyrate = 1;
- if (res.datatable?.length > 0) {
- _discount = res.datatable[0].discount;
- _moneyrate = res.datatable[0].moneyrate;
- }
- data.moneyrate = _moneyrate;
- data.discount = _discount;
- };
- 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 更新垫层的床网厚度信息
- * @param data 床网订单信息
- */
- const wf_rtr_cwdc = (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 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 = $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;
- 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的垫层床网信息
- * @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);
- };
- function f_pb_split(arg_source) {
- // 检查输入字符串是否为空
- if (arg_source === "") {
- return;
- }
- // 查找逗号的位置
- const commaPos = arg_source.indexOf(",");
- let arg_left_str, arg_right_str;
- if (commaPos > -1) {
- // 如果存在逗号,分割字符串
- arg_left_str = arg_source.substring(0, commaPos).trim();
- arg_right_str = arg_source.substring(commaPos + 1).trim();
- } else {
- // 如果不存在逗号,整个字符串作为左部分,右部分为空字符串
- arg_left_str = arg_source.trim();
- arg_right_str = "";
- }
- // 返回结果
- return { left: arg_left_str, right: arg_right_str };
- }
- /**
- * @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 deptEnum = state.LjDetailRef.enumMap.get("deptid");
- let _deptid = state.LjDetailRef._mainData.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);
- }
- }
- 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 deptEnum = state.LjDetailRef.enumMap.get("deptid");
- let _deptid = state.LjDetailRef._mainData.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);
- }
- }
- 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 deptEnum = enumMap.get("deptid");
- let _pricelistid = 0;
- if (deptEnum) {
- let depItem = deptEnum.find((item: any) => item.value == _mainData.deptid);
- console.log("depItem :>> ", depItem);
- if (depItem) {
- _pricelistid = Number(depItem.pricelistid);
- }
- }
- 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 deptEnum = enumMap.get("deptid");
- console.log("deptEnum :>> ", deptEnum);
- if (deptEnum) {
- let depItem = deptEnum.find((item: any) => item.value == _mainData.deptid);
- console.log("depItem :>> ", depItem);
- if (depItem) {
- _mainData.dept_profitrate = Number(depItem.profitrate);
- }
- }
- 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 = () => {
- 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);
- console.log("wf_get_moneyrate_discount depItem :>> ", depItem);
- if (depItem) {
- let _moneyrate = !depItem.moneyrate || Number(depItem.moneyrate) == 0 ? 1 : depItem.moneyrate;
- console.log("_mainData.if_moneyrate == 0 :>> ", _mainData.if_moneyrate == "0");
- if (_mainData.if_moneyrate == "0" || !_mainData.if_moneyrate) {
- _mainData.moneyrate = 1;
- } else {
- _mainData.moneyrate = _moneyrate;
- }
- _mainData.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) => {
- // 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
- };
- 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;
- } 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
- },
- order: 1
- },
- basicinfo: {
- el: "select",
- editable: ALLOW_EDIT_STATE,
- 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
- },
- {
- field: "flag",
- title: "财务审核",
- table: "u_mattress",
- search: {
- el: "select",
- key: "status_flag",
- titleKey: "status",
- props: {
- clearable: true,
- placeholder: "全部"
- },
- 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 => funcMoneyrateChange(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 (
- <>
- <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: "位置",
- 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: {
- name: "$input",
- props: {
- type: "number"
- }
- }
- },
- {
- 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 _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);
- }
- }
- 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: {
- name: "input",
- props: {
- type: "number"
- }
- }
- },
- {
- 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: "金额文本公式",
- 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 _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);
- }
- }
- 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>
- </>
- );
- }
- }
- ];
- 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 _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);
- }
- }
- 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 _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);
- }
- }
- 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: {
- name: "$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 _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);
- }
- }
- 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: {
- name: "input"
- }
- }
- ];
- const columnsMx_subSpecs = [
- { type: "checkbox", width: 50, fixed: "left" },
- {
- field: "mattress_width",
- datatype: "number",
- editRender: {
- name: "$input",
- props: {
- type: "number"
- }
- }
- },
- {
- field: "mattress_length",
- datatype: "number",
- editRender: {
- name: "$input",
- props: {
- type: "number"
- }
- }
- },
- {
- field: "mattress_height",
- datatype: "number",
- 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: "删除成功"
- });
- });
- };
- 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,
- 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
- };
- };
|