edit.vue 204 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892
  1. <template>
  2. <div>
  3. <Toptitle
  4. :title="type == 1 ? '新增订单' : type == 2 ? '编辑订单' : '订单详情'"
  5. >
  6. <Button
  7. @click="print"
  8. type="primary"
  9. ghost
  10. v-show="type == 3"
  11. style="margin-right: 10px"
  12. >打印</Button
  13. >
  14. <Button
  15. @click="quoteRoughDraft"
  16. type="primary"
  17. v-show="type == 1"
  18. style="margin-right: 10px"
  19. >引用草稿</Button
  20. >
  21. <Button
  22. @click="saveRoughDraft"
  23. type="primary"
  24. v-show="type == 1"
  25. style="margin-right: 10px"
  26. >保存草稿</Button
  27. >
  28. <Button @click="back" type="primary" ghost style="margin-right: 10px"
  29. >返回</Button
  30. >
  31. <Button
  32. @click="showForms = true"
  33. type="primary"
  34. v-show="type != 3"
  35. style="margin-right: 10px"
  36. >表单设置</Button
  37. >
  38. <Button
  39. type="primary"
  40. v-show="type != 3"
  41. @click="handleSubmit('infoOrder')"
  42. >保存</Button
  43. >
  44. </Toptitle>
  45. <div class="page-edit">
  46. <!-- 表单项 -->
  47. <Form
  48. ref="infoOrder"
  49. inline
  50. :label-width="100"
  51. :model="info"
  52. style="padding: 10px 0"
  53. :rules="infoRules"
  54. >
  55. <!-- 订单编号 -->
  56. <FormItem
  57. v-if="formSetTableData.filter((v) => v.key == 'order_no')[0].is_show"
  58. :label="formSetTableData.filter((v) => v.key == 'order_no')[0].title"
  59. >
  60. <Input
  61. disabled
  62. v-if="type != 3"
  63. v-model="info.order_no"
  64. class="auto-width"
  65. placeholder="自动生成"
  66. />
  67. <span v-else>{{ info.order_no }}</span>
  68. </FormItem>
  69. <!-- 负责人 -->
  70. <FormItem
  71. v-if="
  72. formSetTableData.filter((v) => v.key == 'custom_detail_name')[0]
  73. .is_show
  74. "
  75. :label="
  76. formSetTableData.filter((v) => v.key == 'custom_detail_name')[0]
  77. .title
  78. "
  79. >
  80. <Select
  81. placeholder="请选择负责人"
  82. v-if="type != 3"
  83. clearable
  84. filterable
  85. v-model="info.custom_detail_name"
  86. @on-change="handleClientChargeChange"
  87. class="auto-width"
  88. >
  89. <!-- @on-change="handleClientDetailChange" -->
  90. <Option
  91. v-for="item of clientDetailList_respon"
  92. :key="item.service_name"
  93. :label="item.service_name"
  94. :value="item.service_name"
  95. ></Option>
  96. </Select>
  97. <span v-else>{{ info.custom_detail_name }}</span>
  98. </FormItem>
  99. <!-- 详细地址 -->
  100. <FormItem
  101. v-if="
  102. formSetTableData.filter((v) => v.key == 'custom_detail_id')[0]
  103. .is_show
  104. "
  105. :label="
  106. formSetTableData.filter((v) => v.key == 'custom_detail_id')[0].title
  107. "
  108. >
  109. <Select
  110. clearable
  111. filterable
  112. v-if="type != 3"
  113. class="auto-width"
  114. @on-change="handleClientDetailChange"
  115. v-model="info.custom_detail_id"
  116. >
  117. <Option
  118. v-for="item in clientDetailList_address"
  119. :label="item.address"
  120. :key="item.id"
  121. :value="item.id"
  122. ></Option>
  123. </Select>
  124. <span v-else>{{
  125. clientDetailList.filter((v) => v.id == info.custom_detail_id)
  126. .length > 0
  127. ? clientDetailList.filter((v) => v.id == info.custom_detail_id)[0]
  128. .area_title
  129. : ""
  130. }}</span>
  131. </FormItem>
  132. <!-- 项目名称 -->
  133. <FormItem
  134. v-if="
  135. formSetTableData.filter((v) => v.key == 'residential_name')[0]
  136. .is_show
  137. "
  138. :label="
  139. formSetTableData.filter((v) => v.key == 'residential_name')[0].title
  140. "
  141. prop="residential_name"
  142. >
  143. <Input
  144. v-model="info.residential_name"
  145. v-if="type != 3"
  146. class="auto-width"
  147. placeholder="请输入项目名称"
  148. />
  149. <span v-else>{{ info.residential_name }}</span>
  150. </FormItem>
  151. <!-- 包装 -->
  152. <FormItem
  153. prop="box_id"
  154. v-if="formSetTableData.filter((v) => v.key == 'box_id')[0].is_show"
  155. :label="formSetTableData.filter((v) => v.key == 'box_id')[0].title"
  156. >
  157. <Select
  158. clearable
  159. filterable
  160. v-if="type != 3"
  161. v-model="info.box_id"
  162. class="auto-width"
  163. >
  164. <Option
  165. v-for="item of sub_material_list"
  166. :key="item.id"
  167. :label="item.title"
  168. :value="item.id"
  169. ></Option>
  170. </Select>
  171. <span v-else>{{
  172. sub_material_list.length > 0 && info.box_id
  173. ? sub_material_list.filter((item) => item.id == info.box_id)[0]
  174. .title
  175. : ""
  176. }}</span>
  177. </FormItem>
  178. <!-- 紧急程度 -->
  179. <FormItem
  180. v-if="
  181. formSetTableData.filter((v) => v.key == 'warning_state')[0].is_show
  182. "
  183. :label="
  184. formSetTableData.filter((v) => v.key == 'warning_state')[0].title
  185. "
  186. prop="warning_state"
  187. >
  188. <Select
  189. clearable
  190. class="auto-width"
  191. v-if="type != 3"
  192. v-model="info.warning_state"
  193. >
  194. <Option
  195. :label="_item.title"
  196. v-for="_item in warningList"
  197. :key="_item.id"
  198. :value="_item.id"
  199. ></Option>
  200. </Select>
  201. <span v-else>{{
  202. warningList.length > 0 && info.warning_state
  203. ? warningList.filter((item) => item.id == info.warning_state)[0]
  204. .title
  205. : ""
  206. }}</span>
  207. </FormItem>
  208. <!-- 客户名称 -->
  209. <FormItem
  210. v-if="
  211. formSetTableData.filter((v) => v.key == 'client_name')[0].is_show
  212. "
  213. :label="
  214. formSetTableData.filter((v) => v.key == 'client_name')[0].title
  215. "
  216. prop="custom_id"
  217. >
  218. <Select
  219. clearable
  220. filterable
  221. v-if="type != 3"
  222. class="auto-width"
  223. @on-change="handleClientChange"
  224. v-model="info.custom_id"
  225. >
  226. <Option
  227. v-for="item in clientList"
  228. :label="item.title"
  229. :key="item.id"
  230. :value="item.id"
  231. ></Option>
  232. </Select>
  233. <span v-else>{{
  234. clientList.length > 0 && info.custom_id
  235. ? clientList.filter((item) => item.id == info.custom_id)[0].title
  236. : ""
  237. }}</span>
  238. </FormItem>
  239. <!-- 手机号 -->
  240. <FormItem
  241. v-if="
  242. formSetTableData.filter((v) => v.key == 'custom_detail_mobile')[0]
  243. .is_show
  244. "
  245. :label="
  246. formSetTableData.filter((v) => v.key == 'custom_detail_mobile')[0]
  247. .title
  248. "
  249. >
  250. <Select
  251. clearable
  252. filterable
  253. v-if="type != 3"
  254. class="auto-width"
  255. v-model="info.custom_detail_mobile"
  256. >
  257. <Option
  258. v-for="item in clientDetailList_mobile"
  259. :label="item.mobile"
  260. :key="item.id"
  261. :value="item.mobile"
  262. ></Option>
  263. </Select>
  264. <span v-else>{{ info.custom_detail_mobile }}</span>
  265. </FormItem>
  266. <!-- 开始日期 -->
  267. <FormItem
  268. v-if="
  269. formSetTableData.filter((v) => v.key == 'start_time')[0].is_show
  270. "
  271. :label="
  272. formSetTableData.filter((v) => v.key == 'start_time')[0].title
  273. "
  274. >
  275. <DatePicker
  276. :options="options"
  277. v-if="type != 3"
  278. v-model="info.start_time"
  279. type="date"
  280. placeholder="开始日期"
  281. class="auto-width"
  282. ></DatePicker>
  283. <span v-else>{{ info.start_time }}</span>
  284. </FormItem>
  285. <!-- 交付日期 -->
  286. <FormItem
  287. v-if="formSetTableData.filter((v) => v.key == 'end_time')[0].is_show"
  288. :label="formSetTableData.filter((v) => v.key == 'end_time')[0].title"
  289. >
  290. <DatePicker
  291. :options="options"
  292. v-if="type != 3"
  293. v-model="info.end_time"
  294. type="date"
  295. placeholder="交付日期"
  296. class="auto-width"
  297. ></DatePicker>
  298. <span v-else>{{ info.end_time }}</span>
  299. </FormItem>
  300. <!-- 专营业务员 -->
  301. <FormItem
  302. v-if="
  303. formSetTableData.filter((v) => v.key == 'service_id')[0].is_show
  304. "
  305. :label="
  306. formSetTableData.filter((v) => v.key == 'service_id')[0].title
  307. "
  308. >
  309. <Select
  310. disabled
  311. v-if="type != 3"
  312. placeholder="自动带出"
  313. v-model="info.service_id"
  314. class="auto-width"
  315. >
  316. <Option
  317. v-for="item of users"
  318. :key="item.id"
  319. :label="item.nickname"
  320. :value="item.id"
  321. ></Option>
  322. </Select>
  323. <span v-else>{{
  324. users.length > 0 && info.service_id
  325. ? users.filter((item) => item.id == info.service_id)[0].nickname
  326. : ""
  327. }}</span>
  328. </FormItem>
  329. <!-- 产品总价 -->
  330. <FormItem
  331. v-if="
  332. formSetTableData.filter((v) => v.key == 'predict_price')[0].is_show
  333. "
  334. :label="
  335. formSetTableData.filter((v) => v.key == 'predict_price')[0].title
  336. "
  337. >
  338. <Input
  339. v-model="info.predict_price"
  340. v-if="type != 3"
  341. readonly
  342. class="auto-width"
  343. placeholder="自动生成"
  344. />
  345. <span v-else>{{ info.predict_price }}</span>
  346. </FormItem>
  347. <!-- 折扣金额 -->
  348. <FormItem
  349. v-if="formSetTableData.filter((v) => v.key == 'fax_price')[0].is_show"
  350. :label="formSetTableData.filter((v) => v.key == 'fax_price')[0].title"
  351. >
  352. <Input
  353. v-model="info.fax_price"
  354. v-if="type != 3"
  355. @on-change="handleFaxPriceChange"
  356. class="auto-width"
  357. placeholder="自动生成"
  358. />
  359. <span v-else>{{ info.fax_price }}</span>
  360. </FormItem>
  361. <!-- 订单金额 -->
  362. <FormItem
  363. v-if="
  364. formSetTableData.filter((v) => v.key == 'order_price')[0].is_show
  365. "
  366. :label="
  367. formSetTableData.filter((v) => v.key == 'order_price')[0].title
  368. "
  369. >
  370. <Input
  371. v-model="info.order_price"
  372. v-if="type != 3"
  373. @on-change="handleOrderPriceChange($event)"
  374. class="auto-width"
  375. placeholder="自动生成"
  376. />
  377. <span v-else>{{ info.order_price }}</span>
  378. </FormItem>
  379. <!-- 项目定金 -->
  380. <FormItem
  381. v-if="
  382. formSetTableData.filter((v) => v.key == 'front_money')[0].is_show
  383. "
  384. :label="
  385. formSetTableData.filter((v) => v.key == 'front_money')[0].title
  386. "
  387. >
  388. <Input
  389. v-model="info.front_money"
  390. class="auto-width"
  391. v-if="type != 3"
  392. placeholder="请输入项目定金"
  393. />
  394. <span v-else>{{ info.front_money }}</span>
  395. </FormItem>
  396. <!-- 订单备注 -->
  397. <FormItem
  398. v-if="formSetTableData.filter((v) => v.key == 'remark')[0].is_show"
  399. :label="formSetTableData.filter((v) => v.key == 'remark')[0].title"
  400. >
  401. <Input
  402. v-model="info.remark"
  403. type="textarea"
  404. v-if="type != 3"
  405. class="auto-width"
  406. placeholder="请输入订单备注"
  407. />
  408. <span v-else>{{ info.remark }}</span>
  409. </FormItem>
  410. <!-- 上传附件 -->
  411. <FormItem label="上传附件:">
  412. <div class="product-img">
  413. <div class="product-add">
  414. <div class="items" v-for="(item, index) of info.img" :key="index">
  415. <img
  416. @click="looks(item)"
  417. :src="$store.state.ip + item"
  418. alt=""
  419. />
  420. <Icon
  421. v-if="type != 3"
  422. size="20"
  423. @click="delItems(index, info.img)"
  424. class="delete-img"
  425. type="ios-close-circle"
  426. />
  427. </div>
  428. <div class="add-items" v-if="type != 3">
  429. <div class="item">
  430. <Icon size="50" type="ios-add" />
  431. </div>
  432. <span>支持jpg/png格式</span>
  433. <input
  434. @change="changeIpt($event, info.img)"
  435. type="file"
  436. class="ipt"
  437. />
  438. </div>
  439. </div>
  440. </div>
  441. <!-- <Button type="primary"
  442. style="margin-right:10px;"
  443. ghost>上传附件</Button> -->
  444. <!-- <Upload style="display: inline"
  445. name="your_file"
  446. :show-upload-list="false"
  447. :headers="headers"
  448. multiple
  449. :data="uploadData"
  450. :on-error="uploadError"
  451. :on-progress="onProgress"
  452. :on-success="uploadSuccess"
  453. :action="$store.state.ip + '/api/deep_img_import'">
  454. <Button type="primary"
  455. style="margin-right: 10px">上传附件</Button>
  456. </Upload> -->
  457. </FormItem>
  458. </Form>
  459. <!-- 户型选择 -->
  460. <div class="content">
  461. <vxe-toolbar>
  462. <template #buttons>
  463. <div class="content_header">
  464. <h2>产品信息</h2>
  465. <div>
  466. <!-- <Button
  467. type="primary"
  468. style="margin-right: 10px"
  469. v-show="type != 3"
  470. @click="handleMetalAdd"
  471. >新增五金</Button
  472. > -->
  473. <Button
  474. type="primary"
  475. style="margin-right: 10px"
  476. v-show="type == 3"
  477. @click="handleShowMaterial"
  478. >{{ is_material_show ? "收起" : "查看" }}原材料</Button
  479. >
  480. <!-- <Button
  481. type="primary"
  482. style="margin-right: 10px"
  483. v-show="type != 3"
  484. @click="handleTableAdd"
  485. >新增产品(简)</Button
  486. > -->
  487. <!-- <Button
  488. type="primary"
  489. style="margin-right: 10px"
  490. v-show="type != 3"
  491. @click="handleSet({}, null, 1)"
  492. >新增产品(详)</Button
  493. > -->
  494. </div>
  495. </div>
  496. </template>
  497. </vxe-toolbar>
  498. <vxe-table
  499. border
  500. show-footer
  501. resizable
  502. max-height="500px"
  503. class="my-xtable-iview"
  504. :footer-method="footerMethod"
  505. align="center"
  506. :edit-config="type == 3 ? {} : { trigger: 'click', mode: 'row' }"
  507. :data="tableData"
  508. >
  509. <vxe-column title="操作" min-width="200">
  510. <template #default="{ row, rowIndex }">
  511. <a
  512. @click="handleSet(row, rowIndex, 5)"
  513. style="margin: 0 5px"
  514. v-show="!row.is_metal"
  515. >详情</a
  516. >
  517. <a
  518. @click="handleSet(row, rowIndex, 4)"
  519. v-show="type != 3"
  520. style="margin: 0 5px"
  521. >复制</a
  522. >
  523. <a
  524. @click="handleSet(row, rowIndex, 2)"
  525. v-show="type != 3 && !row.is_metal"
  526. style="margin: 0 5px"
  527. >编辑</a
  528. >
  529. <a
  530. @click="handleSet(row, rowIndex, 3)"
  531. v-show="type != 3"
  532. style="margin: 0 5px"
  533. >删除</a
  534. >
  535. </template>
  536. </vxe-column>
  537. <vxe-column type="seq" min-width="45">
  538. <template #header>
  539. <span>序号</span>
  540. </template>
  541. </vxe-column>
  542. <vxe-column
  543. field="position"
  544. title="位置"
  545. min-width="60"
  546. :edit-render="{}"
  547. >
  548. <template #edit="scope">
  549. <Input
  550. @on-blur="HandleAutoCreateNewLine"
  551. v-if="!scope.row.is_metal"
  552. v-model="scope.row.position"
  553. />
  554. </template>
  555. <template #default="scope">
  556. {{ scope.row.is_metal ? "" : scope.row.position }}
  557. </template>
  558. </vxe-column>
  559. <vxe-column title="产品名称/五金" min-width="120" :edit-render="{}">
  560. <template #edit="scope">
  561. <Select
  562. filterable
  563. clearable
  564. transfer
  565. filter-by-label
  566. label-in-value
  567. v-model="scope.row.select_all_id"
  568. @on-change="
  569. handleSelectProductMetail(
  570. scope.row,
  571. scope.rowIndex,
  572. $event,
  573. scope
  574. )
  575. "
  576. >
  577. <Option
  578. v-for="item in product_metailList"
  579. :tag="item.key"
  580. :value="item.key"
  581. :label="item.title"
  582. :key="item.key"
  583. ></Option>
  584. </Select>
  585. <!-- <Select
  586. filterable
  587. clearable
  588. transfer
  589. filter-by-label
  590. label-in-value
  591. v-model="scope.row.material_id"
  592. @change="$refs.xTable.updateStatus(scope)"
  593. @on-change="
  594. changeEditMetal(scope.row, scope.rowIndex, $event, scope)
  595. "
  596. >
  597. <Option
  598. v-for="item in metalList"
  599. :value="item.id"
  600. :key="item.id"
  601. :label="item.title"
  602. ></Option>
  603. </Select> -->
  604. </template>
  605. <template #default="{ row }">{{
  606. row.is_metal
  607. ? getSelectedLabel(
  608. row.select_all_id,
  609. product_metailList,
  610. "key",
  611. "title"
  612. )
  613. : getSelectedLabel(
  614. row.select_all_id,
  615. product_metailList,
  616. "key",
  617. "title"
  618. )
  619. }}</template>
  620. </vxe-column>
  621. <vxe-column
  622. v-for="process in bpp_list"
  623. :key="process.id + 'bpp'"
  624. :field="process.id + ''"
  625. :title="process.name"
  626. min-width="70"
  627. :edit-render="{}"
  628. >
  629. <template #edit="scope">
  630. <Select
  631. filterable
  632. clearable
  633. transfer
  634. filter-by-label
  635. v-if="!scope.row.is_metal"
  636. label-in-value
  637. v-model="scope.row[process.id]"
  638. @change="$refs.xTable.updateStatus(scope)"
  639. @on-change="changeEditProcess(scope.row, process)"
  640. @on-open-change="
  641. (e) =>
  642. handleGetProductProcess(
  643. e,
  644. null,
  645. scope.row,
  646. scope.row.process_obj.filter((v) => v.id == process.id)[0]
  647. )
  648. "
  649. >
  650. <Option
  651. v-for="item in scope.row.process_obj.filter(
  652. (v) => v.id == process.id
  653. )[0].cld"
  654. :value="item.id"
  655. :key="item.id + 'cld'"
  656. :label="item.title"
  657. ></Option>
  658. </Select>
  659. </template>
  660. <template #default="{ row }">
  661. {{
  662. row.is_metal
  663. ? ""
  664. : getSelectedLabel(
  665. row[process.id],
  666. process.cld,
  667. "id",
  668. "title"
  669. )
  670. }}</template
  671. >
  672. </vxe-column>
  673. <vxe-column
  674. v-for="measure in measure_total"
  675. :key="measure.e_title"
  676. :field="measure.e_title"
  677. :title="measure.title"
  678. min-width="60"
  679. :edit-render="{}"
  680. >
  681. <template #edit="scope">
  682. <Input
  683. v-if="!scope.row.is_metal"
  684. v-model="scope.row[measure.e_title]"
  685. @on-change="
  686. (e) => handleGetProductMeasure(e, measure.e_title, scope)
  687. "
  688. @on-blur="(e) => changeEditMeasure(e, scope.row, measure)"
  689. />
  690. </template>
  691. <template #default="{ row }">
  692. {{ row.is_metal ? "" : row[measure.e_title] }}</template
  693. >
  694. </vxe-column>
  695. <vxe-column
  696. v-for="part_type in part_type_total"
  697. :key="part_type.id + '999'"
  698. :title="part_type.title"
  699. min-width="90"
  700. :edit-render="{}"
  701. >
  702. <template #edit="scope">
  703. <div v-if="!scope.row.is_metal">
  704. <div
  705. v-for="(part_detail, part_index) in scope.row.part"
  706. :key="part_index"
  707. v-show="part_detail.type_id == part_type.id"
  708. :style="
  709. part_index != scope.row.part.length - 1 &&
  710. scope.row.part.length > 1
  711. ? {
  712. borderBottom: '1px solid #e8eaec',
  713. padding: '10px 0',
  714. }
  715. : { padding: '10px 0' }
  716. "
  717. >
  718. <Select
  719. clearable
  720. transfer
  721. filter
  722. filter-by-label
  723. label-in-value
  724. v-model="part_detail.change_id"
  725. @on-change="
  726. (e) =>
  727. changeEditPart(
  728. scope.row,
  729. part_type,
  730. part_detail,
  731. e,
  732. scope.rowIndex
  733. )
  734. "
  735. >
  736. <Option
  737. v-for="ch in part_detail.change"
  738. :key="ch.id + '999'"
  739. :label="ch.part_title"
  740. :value="ch.id"
  741. />
  742. </Select>
  743. </div>
  744. </div>
  745. </template>
  746. <template #default="scope">
  747. <div v-if="!scope.row.is_metal">
  748. <div
  749. v-for="(part_detail, part_index) in scope.row.part"
  750. :key="part_index"
  751. v-show="part_detail.type_id == part_type.id"
  752. :style="
  753. part_index != scope.row.part.length - 1 &&
  754. scope.row.part.length > 1
  755. ? {
  756. borderBottom: '1px solid #e8eaec',
  757. padding: '10px 0',
  758. }
  759. : { padding: '10px 0' }
  760. "
  761. >
  762. {{
  763. part_detail.change_id
  764. ? part_detail.part_title || part_detail.title
  765. : ""
  766. }}
  767. </div>
  768. </div>
  769. </template>
  770. </vxe-column>
  771. <vxe-column title="门头板" min-width="100" :edit-render="{}">
  772. <template #default="scope">
  773. <!-- {{
  774. scope.row.part.filter(
  775. (v) => v.part_title && v.part_title.indexOf("门头板")
  776. )[0].part_title
  777. }} -->
  778. </template>
  779. <template #edit="scope">
  780. <div>
  781. <a v-if="!scope.row.addMTB" @click="handleMTBClick(scope.row)"
  782. >添加</a
  783. >
  784. <div v-else>
  785. <a
  786. @click="handleSet(scope.row, scope.rowIndex, 2)"
  787. style="margin: 0 5px"
  788. >编辑</a
  789. >
  790. </div>
  791. </div>
  792. <div></div>
  793. </template>
  794. </vxe-column>
  795. <vxe-column title="原材料名称" min-width="100">
  796. <template #default="scope">
  797. <div v-if="!scope.row.is_metal">
  798. <div
  799. v-for="part_detail in scope.row.part"
  800. :key="part_detail.order_product_part_id"
  801. v-show="!part_detail.is_metal"
  802. >
  803. <div
  804. v-for="(sub_part_detail, idx) in part_detail.sub_part"
  805. :key="idx + '999'"
  806. v-show="
  807. (
  808. sub_part_detail.title ||
  809. sub_part_detail.material_detail_title
  810. ).indexOf('线条') > 0
  811. "
  812. :style="
  813. idx != part_detail.sub_part.length - 1
  814. ? {
  815. borderBottom: '1px solid #e8eaec',
  816. padding: '10px 0',
  817. }
  818. : { padding: '10px 0' }
  819. "
  820. >
  821. {{
  822. sub_part_detail.title ||
  823. sub_part_detail.material_detail_title
  824. }}
  825. </div>
  826. </div>
  827. </div>
  828. </template>
  829. </vxe-column>
  830. <vxe-column title="原材料规格" min-width="130" :edit-render="{}">
  831. <template #default="scope">
  832. <div v-if="!scope.row.is_metal">
  833. <div
  834. v-for="(part_detail, idx) in scope.row.part"
  835. :key="idx + '999'"
  836. v-show="!part_detail.is_metal"
  837. >
  838. <div
  839. v-for="(sub_part_detail, idx) in part_detail.part_detail"
  840. :key="idx + 'part_detail'"
  841. v-show="
  842. sub_part_detail.title &&
  843. sub_part_detail.title.indexOf('线条') > 0
  844. "
  845. :style="
  846. idx != part_detail.part_detail.length - 1
  847. ? {
  848. borderBottom: '1px solid #e8eaec',
  849. padding: '10px 0',
  850. }
  851. : { padding: '10px 0' }
  852. "
  853. >
  854. {{
  855. sub_part_detail.part_detail_option
  856. ? sub_part_detail.part_detail_option.find(
  857. (v) => v.value == sub_part_detail.material_detail_id
  858. ).label
  859. : ""
  860. }}
  861. </div>
  862. </div>
  863. </div>
  864. </template>
  865. <template #edit="scope">
  866. <div v-if="!scope.row.is_metal">
  867. <div
  868. v-for="part_detail in scope.row.part"
  869. :key="part_detail.order_product_part_id"
  870. v-show="!part_detail.is_metal"
  871. >
  872. <div
  873. v-for="(sub_part_detail, idx) in part_detail.part_detail"
  874. :key="idx + 'part_detail'"
  875. v-show="
  876. sub_part_detail.title &&
  877. sub_part_detail.title.indexOf('线条') > 0
  878. "
  879. :style="
  880. idx != part_detail.part_detail.length - 1
  881. ? {
  882. borderBottom: '1px solid #e8eaec',
  883. padding: '10px 0',
  884. }
  885. : { padding: '10px 0' }
  886. "
  887. >
  888. <Select
  889. filterable
  890. clearable
  891. transfer
  892. label-in-value
  893. @on-change="changeEditLines(scope.row)"
  894. v-model="sub_part_detail.material_detail_id"
  895. >
  896. <Option
  897. v-for="ch in sub_part_detail.part_detail_option"
  898. :key="ch.value"
  899. :label="ch.label"
  900. :value="ch.value"
  901. />
  902. </Select>
  903. </div>
  904. </div>
  905. </div>
  906. </template>
  907. </vxe-column>
  908. <vxe-column title="原材料数量" min-width="90" :edit-render="{}">
  909. <template #default="scope">
  910. <div v-if="!scope.row.is_metal">
  911. <div
  912. v-for="part_detail in scope.row.part"
  913. :key="part_detail.order_product_part_id"
  914. v-show="!part_detail.is_metal"
  915. >
  916. <div
  917. v-for="(sub_part_detail, idx) in part_detail.part_detail"
  918. :key="idx + 'part_detail'"
  919. v-show="
  920. sub_part_detail.title &&
  921. sub_part_detail.title.indexOf('线条') > 0
  922. "
  923. :style="
  924. idx != part_detail.part_detail.length - 1
  925. ? {
  926. borderBottom: '1px solid #e8eaec',
  927. padding: '10px 0',
  928. }
  929. : { padding: '10px 0' }
  930. "
  931. >
  932. {{ sub_part_detail.material_detail_num }}
  933. </div>
  934. </div>
  935. </div>
  936. </template>
  937. <template #edit="scope">
  938. <div v-if="!scope.row.is_metal">
  939. <div
  940. v-for="part_detail in scope.row.part"
  941. :key="part_detail.order_product_part_id"
  942. v-show="!part_detail.is_metal"
  943. >
  944. <div
  945. v-for="(sub_part_detail, idx) in part_detail.part_detail"
  946. :key="idx + 'part_detail'"
  947. v-show="
  948. sub_part_detail.title &&
  949. sub_part_detail.title.indexOf('线条') > 0
  950. "
  951. :style="
  952. idx != part_detail.part_detail.length - 1
  953. ? {
  954. borderBottom: '1px solid #e8eaec',
  955. padding: '10px 0',
  956. }
  957. : { padding: '10px 0' }
  958. "
  959. >
  960. <Input
  961. v-model="sub_part_detail.material_detail_num"
  962. @on-change="changeEditDetailNum(scope.row)"
  963. />
  964. </div>
  965. </div>
  966. </div>
  967. </template>
  968. </vxe-column>
  969. <vxe-column
  970. field="total_num"
  971. title="数量"
  972. min-width="80"
  973. :edit-render="{}"
  974. >
  975. <template #edit="scope">
  976. <Input
  977. v-if="!scope.row.is_metal"
  978. v-model="scope.row.total_num"
  979. @on-change="(e) => changeEditTotalNum(e, scope.row)"
  980. />
  981. <Input
  982. v-else
  983. v-model="scope.row.num"
  984. @on-change="(e) => changeEditMetalNum(e, scope.row)"
  985. />
  986. </template>
  987. <template #default="scope">
  988. {{ scope.row.is_metal ? scope.row.num : scope.row.total_num }}
  989. </template>
  990. </vxe-column>
  991. <vxe-column field="unit" title="单位" min-width="70"> </vxe-column>
  992. <vxe-column field="num" title="核算数量" min-width="40"> </vxe-column>
  993. <vxe-column title="单价" min-width="80" :edit-render="{}">
  994. <template #edit="scope">
  995. <Input
  996. v-if="!scope.row.is_metal"
  997. v-model="scope.row.unit_price"
  998. @on-change="(e) => handleProductUnit_priceChange(e, scope.row)"
  999. />
  1000. <Input
  1001. v-else
  1002. v-model="scope.row.single_price"
  1003. @on-change="(e) => handleMetailPriceChange(e, scope.row)"
  1004. />
  1005. </template>
  1006. <template #default="scope">
  1007. {{
  1008. scope.row.is_metal
  1009. ? scope.row.single_price
  1010. : scope.row.unit_price
  1011. }}
  1012. </template>
  1013. </vxe-column>
  1014. <vxe-column title="附加项" min-width="150" :edit-render="{}">
  1015. <template #edit="scope">
  1016. <div>
  1017. <div
  1018. v-for="(ext_detail, idx) in scope.row.extArray"
  1019. :key="ext_detail.ext_id"
  1020. :style="
  1021. idx != scope.row.extArray.length - 1
  1022. ? {
  1023. borderBottom: '1px solid #e8eaec',
  1024. padding: '10px 0',
  1025. }
  1026. : { padding: '10px 0' }
  1027. "
  1028. v-show="ext_detail.type == 2"
  1029. >
  1030. <Select
  1031. filterable
  1032. clearable
  1033. transfer
  1034. label-in-value
  1035. size="small"
  1036. v-model="ext_detail.id"
  1037. @on-change="(e) => changeEditExt(ext_detail, e, scope.row)"
  1038. style="width: 100px"
  1039. >
  1040. <Option
  1041. v-for="item of extList"
  1042. :key="item.id"
  1043. :label="item.title"
  1044. :value="item.id"
  1045. ></Option>
  1046. </Select>
  1047. <Icon
  1048. style="'margin:0 5px"
  1049. @click="handleExtraAdd(scope.row.extArray, 2)"
  1050. color="#32C800"
  1051. size="20"
  1052. type="ios-add-circle"
  1053. />
  1054. <Icon
  1055. @click="
  1056. handleExtraDele(
  1057. scope.row.extArray,
  1058. ext_detail,
  1059. idx,
  1060. scope.row
  1061. )
  1062. "
  1063. color="#FF5E5C"
  1064. v-show="scope.row.extArray.length > 1"
  1065. size="20"
  1066. type="md-remove-circle"
  1067. />
  1068. </div>
  1069. </div>
  1070. </template>
  1071. <template #default="scope">
  1072. <Tooltip
  1073. max-width="600"
  1074. transfer
  1075. placement="right"
  1076. v-if="!scope.row.is_metal"
  1077. >
  1078. <span slot="content">
  1079. <div
  1080. v-for="(_item, _index) in scope.row.extArray"
  1081. :key="_item.ext_id + 'ext' + _index"
  1082. v-show="_item.type == 2"
  1083. >
  1084. <div style="display:flex;justify-content: space-between;">
  1085. <div style="width:120px">
  1086. {{
  1087. extList.filter((v) => v.id == _item.ext_id).length > 0
  1088. ? extList.filter((v) => v.id == _item.ext_id)[0]
  1089. .title
  1090. : ""
  1091. }}
  1092. </div>
  1093. <div style="width:80px">数量:{{ _item.num }}</div>
  1094. <div style="width:100px">单价:{{ _item.price }}</div>
  1095. <div style="width:120px">
  1096. 金额:{{ _item.num * 1 * _item.price }}
  1097. </div>
  1098. <div style="width:160px">备注:{{ _item.remark }}</div>
  1099. </div>
  1100. </div>
  1101. </span>
  1102. {{
  1103. scope.row.extArray
  1104. ? scope.row.extArray
  1105. .filter((v) => v.type == 2)
  1106. .map((v) => v.title)
  1107. .join("/")
  1108. : ""
  1109. }}
  1110. </Tooltip>
  1111. </template>
  1112. </vxe-column>
  1113. <vxe-column title="附加金额" min-width="40">
  1114. <template #default="scope"
  1115. >{{ scope.row.is_metal ? scope.row.price : scope.row.ext_price }}
  1116. </template>
  1117. </vxe-column>
  1118. <vxe-column field="over_price" title="超标金额" min-width="40">
  1119. </vxe-column>
  1120. <vxe-column title="总金额" min-width="60">
  1121. <template #default="scope"
  1122. >{{ scope.row.is_metal ? scope.row.price : scope.row.price }}
  1123. </template>
  1124. </vxe-column>
  1125. <vxe-column
  1126. field="remark"
  1127. title="备注"
  1128. min-width="100"
  1129. :edit-render="{}"
  1130. >
  1131. <template #edit="scope">
  1132. <Select
  1133. filterable
  1134. clearable
  1135. v-if="!scope.row.is_metal"
  1136. transfer
  1137. v-model="scope.row.remark"
  1138. allow-create
  1139. @on-create="handleRemarkCreate"
  1140. @on-change="changeEditRemark(scope.row)"
  1141. >
  1142. <Option
  1143. v-for="item in support_remark"
  1144. :value="item"
  1145. :key="item"
  1146. >{{ item }}</Option
  1147. >
  1148. </Select>
  1149. <Input v-else v-model="scope.row.remark" />
  1150. </template>
  1151. <template #default="{ row }">
  1152. {{ row.remark }}
  1153. </template>
  1154. </vxe-column>
  1155. </vxe-table>
  1156. <!-- <vxe-table resizable border ref="xTree" :data="tableData">
  1157. <vxe-table-column
  1158. field="position"
  1159. title="位置"
  1160. align="center"
  1161. min-width="80"
  1162. ></vxe-table-column>
  1163. <vxe-table-column
  1164. field="unit"
  1165. title="计量单位"
  1166. align="center"
  1167. min-width="80"
  1168. ></vxe-table-column>
  1169. <vxe-table-column
  1170. field="process_str"
  1171. title="工艺属性"
  1172. align="center"
  1173. min-width="200"
  1174. ></vxe-table-column>
  1175. <vxe-table-column
  1176. field="measurement_no_letter"
  1177. title="尺寸"
  1178. align="center"
  1179. min-width="180"
  1180. ></vxe-table-column>
  1181. <vxe-table-column
  1182. field="total_num"
  1183. title="数量"
  1184. align="center"
  1185. min-width="80"
  1186. ></vxe-table-column>
  1187. <vxe-table-column
  1188. field="num"
  1189. title="核算数量"
  1190. align="center"
  1191. min-width="80"
  1192. >
  1193. <template #default="{ row }">
  1194. {{ row.is_metal ? "" : row.num }}
  1195. </template>
  1196. </vxe-table-column>
  1197. <vxe-table-column
  1198. field="unit_price"
  1199. title="单价"
  1200. align="center"
  1201. min-width="80"
  1202. ></vxe-table-column>
  1203. <vxe-table-column
  1204. field="ext_price"
  1205. title="附加金额"
  1206. align="center"
  1207. min-width="80"
  1208. ></vxe-table-column>
  1209. <vxe-table-column
  1210. field="over_price"
  1211. title="超标金额"
  1212. align="center"
  1213. min-width="80"
  1214. ></vxe-table-column>
  1215. <vxe-table-column
  1216. field="price"
  1217. title="金额"
  1218. align="center"
  1219. min-width="80"
  1220. >
  1221. <template #default="{ row }">
  1222. {{ row.is_metal ? "" : row.price }}
  1223. </template>
  1224. </vxe-table-column>
  1225. <vxe-table-column
  1226. field="url_number"
  1227. title="图号"
  1228. align="center"
  1229. min-width="80"
  1230. ></vxe-table-column>
  1231. <vxe-table-column
  1232. field="remark"
  1233. title="备注"
  1234. align="center"
  1235. min-width="80"
  1236. ></vxe-table-column>
  1237. <vxe-table-column
  1238. field="extra"
  1239. title="附加项"
  1240. align="center"
  1241. min-width="80"
  1242. ></vxe-table-column>
  1243. <vxe-table-column
  1244. field="date"
  1245. title="其他项"
  1246. align="center"
  1247. min-width="80"
  1248. ></vxe-table-column>
  1249. <vxe-table-column
  1250. field=""
  1251. title="操作"
  1252. align="center"
  1253. min-width="180"
  1254. >
  1255. <template #default="{ row, rowIndex }">
  1256. <a
  1257. @click="handleSet(row, rowIndex, 5)"
  1258. v-show="type == 3 && rowIndex >= 0"
  1259. style="margin: 0 5px"
  1260. >详情</a
  1261. >
  1262. <a
  1263. @click="handleSet(row, rowIndex, 4)"
  1264. v-if="type != 3"
  1265. v-show="rowIndex >= 0"
  1266. style="margin: 0 5px"
  1267. >复制</a
  1268. >
  1269. <a
  1270. @click="handleSet(row, rowIndex, 2)"
  1271. v-if="type != 3"
  1272. v-show="rowIndex >= 0"
  1273. style="margin: 0 5px"
  1274. >编辑</a
  1275. >
  1276. <a
  1277. @click="handleSet(row, rowIndex, 3)"
  1278. v-if="type != 3"
  1279. v-show="rowIndex >= 0"
  1280. style="margin: 0 5px"
  1281. >删除</a
  1282. >
  1283. </template>
  1284. </vxe-table-column>
  1285. </vxe-table> -->
  1286. <!-- 原材料 -->
  1287. <!-- v-show="type==3" -->
  1288. <div class="original-part" v-show="type == 3 && is_material_show">
  1289. <Table
  1290. border
  1291. show-summary
  1292. :summary-method="handleSummary"
  1293. :span-method="handleSpan"
  1294. :columns="originalTableColumns"
  1295. :data="originalData"
  1296. ></Table>
  1297. </div>
  1298. </div>
  1299. <div label="线条:" style="margin-left:20px;width:95%">
  1300. <div style="font-size:20px">
  1301. <span>线条:</span>
  1302. <span>{{ print_line_data === "" ? "无" : print_line_data }}</span>
  1303. <!-- <span v-if="wood_title_count.length < 1">无</span>
  1304. <span
  1305. v-else
  1306. v-for="(item, index) in wood_title_count"
  1307. :key="item.title + '' + index"
  1308. >{{ item.title }}:
  1309. <span v-for="(_item, _index) in item.measure_str" :key="_item.id"
  1310. >{{ _item.measure }}={{ _item.num }}{{ item.unit }}
  1311. <span v-show="_index < item.measure_str.length - 1">;</span>
  1312. </span>
  1313. <span v-show="index < wood_title_count.length - 1">;</span>
  1314. </span> -->
  1315. </div>
  1316. </div>
  1317. <div label="合计:" style="margin-left:20px;width:95%">
  1318. <div style="font-size:20px">
  1319. <span>合计:</span>
  1320. <span v-if="parts_title_count.length < 1">无</span>
  1321. <span
  1322. v-else
  1323. v-for="(item, index) in parts_title_count"
  1324. :key="item.title + '' + index"
  1325. v-show="item.title && item.title.indexOf('线条') == -1"
  1326. >{{ item.title }}:{{ item.num }}{{ item.unit }}
  1327. <span v-show="index < parts_title_count.length - 1">;</span>
  1328. </span>
  1329. </div>
  1330. </div>
  1331. <div label="五金:" style="margin-left:20px;width:95%">
  1332. <div style="font-size:20px">
  1333. <span>五金:</span>
  1334. <span v-if="tableData.filter((v) => v.is_metal).length < 1">无</span>
  1335. <span
  1336. v-else
  1337. v-for="(item, index) in tableData.filter((v) => v.is_metal)"
  1338. :key="item.title + '' + index"
  1339. v-show="item.type == 1"
  1340. >{{
  1341. metalList.filter((v) => v.id == item.product_id).length > 0
  1342. ? metalList.filter((v) => v.id == item.product_id)[0].title
  1343. : ""
  1344. }}:{{ item.num
  1345. }}{{
  1346. metalList.filter((v) => v.id == item.product_id).length > 0
  1347. ? metalList.filter((v) => v.id == item.product_id)[0].unit
  1348. : ""
  1349. }}
  1350. <span
  1351. v-show="index < tableData.filter((v) => v.is_metal).length - 1"
  1352. >;</span
  1353. >
  1354. </span>
  1355. </div>
  1356. </div>
  1357. </div>
  1358. <!-- 选择产品弹层--编辑框 -->
  1359. <Modal
  1360. :width="1400"
  1361. class-name="vertical-center-modal"
  1362. :title="title_state == 2 ? '编辑产品' : '查看产品'"
  1363. :mask-closable="false"
  1364. v-model="showEditProduct"
  1365. @on-visible-change="modalVisibleChange"
  1366. >
  1367. <div style="max-height: 800px; overflow: hidden; overflow-y: auto">
  1368. <Tabs value="name">
  1369. <TabPane
  1370. :label="
  1371. (modalData.position ? modalData.position : '位置') +
  1372. '-' +
  1373. modalData.type_name
  1374. "
  1375. name="name"
  1376. >
  1377. <div class="modal_product_info">
  1378. <div class="modal_product_info_title">产品信息</div>
  1379. <div class="modal_product_info_content modal_product">
  1380. <Form :model="modalData" :label-width="100">
  1381. <FormItem label="选择产品:">
  1382. <Tooltip style="width: 120px" transfer>
  1383. <span slot="content">
  1384. <span
  1385. v-for="_item in productList"
  1386. :key="_item.id"
  1387. v-show="_item.id == modalData.product_id"
  1388. >{{ _item.title }}</span
  1389. >
  1390. </span>
  1391. <Select
  1392. filterable
  1393. clearable
  1394. transfer
  1395. filter-by-label
  1396. label-in-value
  1397. :disabled="isCheck"
  1398. size="small"
  1399. v-model="modalData.product_id"
  1400. @on-change="changeEditProduct($event)"
  1401. style="width: 120px"
  1402. >
  1403. <Option
  1404. v-for="item of productList"
  1405. :tag="item.img_url"
  1406. :key="item.id"
  1407. :label="item.title"
  1408. :value="item.id"
  1409. ></Option>
  1410. </Select>
  1411. </Tooltip>
  1412. </FormItem>
  1413. <FormItem label="位置:">
  1414. <Tooltip style="width: 120px" transfer>
  1415. <span slot="content">
  1416. {{ modalData.position }}
  1417. </span>
  1418. <Input
  1419. size="small"
  1420. v-model="modalData.position"
  1421. :disabled="isCheck"
  1422. @on-change="
  1423. (e) => handleProductPositionChange(modalData, e)
  1424. "
  1425. style="width: 120px"
  1426. placeholder="请输入位置"
  1427. />
  1428. </Tooltip>
  1429. </FormItem>
  1430. <FormItem label="计量单位:">
  1431. <Input
  1432. size="small"
  1433. disabled
  1434. style="width: 120px"
  1435. v-model="modalData.unit"
  1436. placeholder="自动带出"
  1437. />
  1438. </FormItem>
  1439. <!-- 工艺属性 -->
  1440. <div
  1441. v-for="(ele, idx) in modalData.process_obj"
  1442. :key="idx + '777'"
  1443. >
  1444. <FormItem
  1445. v-for="(_process, idx) in process_all_list"
  1446. :key="idx + '333' + modalData.id"
  1447. :label="(ele.title || _process.title) + ':'"
  1448. v-show="ele.id == _process.id"
  1449. >
  1450. <Tooltip style="width: 120px" transfer>
  1451. <span slot="content">
  1452. <span
  1453. v-for="_item in ele.cld"
  1454. :key="_item.id + '999'"
  1455. v-show="_item.id == ele.value"
  1456. >{{ _item.title }}</span
  1457. >
  1458. </span>
  1459. <Select
  1460. style="width: 120px"
  1461. filterable
  1462. clearable
  1463. transfer
  1464. label-in-value
  1465. :disabled="isCheck"
  1466. @on-open-change="
  1467. (e) =>
  1468. handleGetProductProcess(e, idx, modalData, ele)
  1469. "
  1470. @on-change="
  1471. (e) =>
  1472. handleProductProcessChange(e, idx, modalData, ele)
  1473. "
  1474. v-model="ele.value"
  1475. size="small"
  1476. >
  1477. <Option
  1478. v-for="option of ele.cld"
  1479. :key="option.id + 'cld'"
  1480. :disabled="option.isDisabled"
  1481. :label="option.title"
  1482. :value="option.id"
  1483. ></Option>
  1484. </Select>
  1485. </Tooltip>
  1486. </FormItem>
  1487. </div>
  1488. <!-- 测量字段 -->
  1489. <FormItem
  1490. v-for="(ele, idx) in modalData.measure"
  1491. :key="idx + '888'"
  1492. :label="ele.title + ':'"
  1493. >
  1494. <Input
  1495. size="small"
  1496. type="text"
  1497. clearable
  1498. :disabled="isCheck"
  1499. :placeholder="ele.e_title"
  1500. v-model="ele.value"
  1501. @on-blur="
  1502. (e) => handleProductMeasureBlur(e, modalData, ele)
  1503. "
  1504. style="width: 120px"
  1505. />
  1506. </FormItem>
  1507. <FormItem label="数量:">
  1508. <Input
  1509. size="small"
  1510. @on-change="(e) => handleProductNumChange(e, modalData)"
  1511. v-model="modalData.total_num"
  1512. :disabled="isCheck"
  1513. style="width: 120px"
  1514. placeholder="请输入产品数量"
  1515. />
  1516. </FormItem>
  1517. <FormItem label="核算数量:">
  1518. <Input
  1519. size="small"
  1520. v-model="modalData.num"
  1521. disabled
  1522. style="width: 120px"
  1523. placeholder="自动带出"
  1524. />
  1525. </FormItem>
  1526. <FormItem label="单价:">
  1527. <Input
  1528. size="small"
  1529. :disabled="isCheck"
  1530. v-model="modalData.unit_price"
  1531. @on-focus="handleUnitPriceFocus"
  1532. @on-change="
  1533. (e) => handleProductUnit_priceChange(e, modalData)
  1534. "
  1535. style="width: 120px"
  1536. placeholder="自动带出"
  1537. />
  1538. </FormItem>
  1539. <FormItem label="附加金额:">
  1540. <Input
  1541. size="small"
  1542. :disabled="isCheck"
  1543. @on-focus="handleExtPriceFocus"
  1544. v-model="modalData.ext_price"
  1545. @on-change="
  1546. (e) => handleProductExt_priceChange(e, modalData)
  1547. "
  1548. style="width: 120px"
  1549. placeholder="自动带出"
  1550. />
  1551. </FormItem>
  1552. <FormItem label="超标金额:">
  1553. <Input
  1554. :disabled="isCheck"
  1555. size="small"
  1556. @on-focus="handleOverPriceFocus"
  1557. @on-change="
  1558. (e) => handleProductOver_priceChange(e, modalData)
  1559. "
  1560. v-model="modalData.over_price"
  1561. style="width: 120px"
  1562. placeholder="自动带出"
  1563. />
  1564. </FormItem>
  1565. <FormItem label="金额:">
  1566. <Input
  1567. :disabled="isCheck"
  1568. size="small"
  1569. @on-focus="handlePriceFocus"
  1570. v-model="modalData.price"
  1571. style="width: 120px"
  1572. placeholder="自动带出"
  1573. />
  1574. </FormItem>
  1575. <FormItem label="图号:">
  1576. <Input
  1577. size="small"
  1578. :disabled="isCheck"
  1579. v-model="modalData.url_number"
  1580. style="width: 120px"
  1581. placeholder="自动带出"
  1582. />
  1583. </FormItem>
  1584. <FormItem
  1585. v-for="(_customize, customize_key) in modalData.customize"
  1586. :label="_customize.style + ':'"
  1587. :key="customize_key + '99'"
  1588. >
  1589. <Input
  1590. v-show="_customize.type == 1"
  1591. :disabled="isCheck"
  1592. size="small"
  1593. type="text"
  1594. v-model="_customize.value"
  1595. style="width: 120px"
  1596. placeholder="请输入"
  1597. />
  1598. <Select
  1599. v-show="_customize.type == 2"
  1600. style="width: 120px"
  1601. :disabled="isCheck"
  1602. filterable
  1603. clearable
  1604. v-model="_customize.value"
  1605. size="small"
  1606. >
  1607. <Option
  1608. v-for="option of _customize.explain"
  1609. :key="option.value"
  1610. :label="option.value"
  1611. :value="option.value"
  1612. ></Option>
  1613. </Select>
  1614. </FormItem>
  1615. <FormItem
  1616. v-for="(outh, outh_key) in modalData.outh"
  1617. :label="outh.title"
  1618. :key="outh_key + 21"
  1619. >
  1620. <img
  1621. v-if="outh.key == 'img' || outh.key == 'url'"
  1622. @click="showPreview(modalData, outh.key)"
  1623. style="
  1624. max-width: 30px;
  1625. max-height: 30px;
  1626. top: 5px;
  1627. position: relative;
  1628. cursor: pointer;
  1629. "
  1630. :src="$store.state.ip + outh.value"
  1631. />
  1632. <Input
  1633. v-if="
  1634. outh.key != 'img' &&
  1635. outh.key != 'url' &&
  1636. outh.key != 'lock'
  1637. "
  1638. disabled
  1639. placeholder="自动生成"
  1640. style="width: 120px"
  1641. size="small"
  1642. v-model="outh.value"
  1643. />
  1644. <Select
  1645. label-in-value
  1646. @on-change="changeLock($event, modalData, index)"
  1647. size="small"
  1648. clearable
  1649. style="width: 120px"
  1650. v-if="outh.key == 'lock'"
  1651. v-model="modalData[outh.key]"
  1652. >
  1653. <Option
  1654. v-for="luck of lock_list"
  1655. :key="luck.id"
  1656. :tag="luck.price"
  1657. :value="luck.id"
  1658. :label="luck.title"
  1659. ></Option>
  1660. <Option :value="0" label="无"></Option>
  1661. </Select>
  1662. </FormItem>
  1663. <FormItem label="备注:">
  1664. <Select
  1665. size="small"
  1666. clearable
  1667. filterable
  1668. :disabled="isCheck"
  1669. style="width: 120px"
  1670. allow-create
  1671. @on-create="handleRemarkCreate"
  1672. v-model="modalData.remark"
  1673. >
  1674. <Option
  1675. v-for="_remark of support_remark"
  1676. :key="_remark"
  1677. :value="_remark"
  1678. :label="_remark"
  1679. ></Option>
  1680. </Select>
  1681. <!-- <Input
  1682. size="small"
  1683. type="textarea"
  1684. :disabled="isCheck"
  1685. v-model="modalData.remark"
  1686. style="width: 120px"
  1687. placeholder="请输入备注"
  1688. /> -->
  1689. </FormItem>
  1690. <FormItem label="产品图:">
  1691. <!-- v-show="modalData.url && modalData.url.length > 0" -->
  1692. <div class="product-img">
  1693. <div class="product-add">
  1694. <div
  1695. class="items"
  1696. v-for="(item, index) of modalData.url"
  1697. :key="index"
  1698. >
  1699. <img
  1700. @click="looks(item)"
  1701. :src="$store.state.ip + item"
  1702. alt=""
  1703. />
  1704. </div>
  1705. </div>
  1706. </div>
  1707. </FormItem>
  1708. </Form>
  1709. </div>
  1710. </div>
  1711. <div class="modal_product_info">
  1712. <div class="modal_product_info_title">部件信息</div>
  1713. <div class="modal_product_info_content modal_parts">
  1714. <Form
  1715. :model="element"
  1716. v-for="(element, idx) in modalData.part"
  1717. :key="element.id + '444' + idx"
  1718. :label-width="50"
  1719. >
  1720. <FormItem
  1721. :label-width="element.isBP ? 1 : 50"
  1722. v-show="!element.is_metal"
  1723. >
  1724. <Radio
  1725. v-show="element.isBP"
  1726. :disabled="isCheck"
  1727. @click.native.prevent="handleRadioClick(element)"
  1728. v-model="element.isChoosed"
  1729. ></Radio>
  1730. <!-- <span v-show="element.isBP">{{ element.part_title }} </span> -->
  1731. </FormItem>
  1732. <FormItem
  1733. label="部件:"
  1734. v-show="element.is_metal ? false : true"
  1735. >
  1736. <Select
  1737. filterable
  1738. clearable
  1739. transfer
  1740. :disabled="isCheck"
  1741. label-in-value
  1742. size="small"
  1743. @on-change="
  1744. handlePartChange(
  1745. $event,
  1746. element,
  1747. modalData.measure,
  1748. modalData.total_num
  1749. )
  1750. "
  1751. v-model="element.change_id"
  1752. style="width: 180px"
  1753. >
  1754. <Option
  1755. v-for="item of element.change"
  1756. :key="item.id"
  1757. :label="item.part_title || item.title"
  1758. :value="item.id"
  1759. ></Option>
  1760. </Select>
  1761. </FormItem>
  1762. <FormItem
  1763. label="高:"
  1764. v-show="
  1765. !element.is_metal &&
  1766. element.hide_measure &&
  1767. !element.hide_measure.filter((v) => v == 'H').length > 0
  1768. "
  1769. >
  1770. <Input
  1771. size="small"
  1772. clearable
  1773. :disabled="isCheck"
  1774. v-model="element.long"
  1775. @on-blur="handleIsSpecialPart(modalData, element)"
  1776. style="width: 50px"
  1777. placeholder="请输入高"
  1778. />
  1779. </FormItem>
  1780. <FormItem
  1781. label="宽:"
  1782. v-show="
  1783. !element.is_metal &&
  1784. element.hide_measure &&
  1785. !element.hide_measure.filter((v) => v == 'W').length > 0
  1786. "
  1787. >
  1788. <Input
  1789. size="small"
  1790. clearable
  1791. :disabled="isCheck"
  1792. v-model="element.wide"
  1793. style="width: 50px"
  1794. placeholder="请输入宽"
  1795. />
  1796. </FormItem>
  1797. <FormItem
  1798. label="厚:"
  1799. v-show="
  1800. !element.is_metal &&
  1801. element.hide_measure &&
  1802. !element.hide_measure.filter((v) => v == 'T').length > 0
  1803. "
  1804. >
  1805. <Input
  1806. size="small"
  1807. clearable
  1808. :disabled="isCheck"
  1809. v-model="element.high"
  1810. style="width: 50px"
  1811. placeholder="请输入厚"
  1812. />
  1813. </FormItem>
  1814. <FormItem
  1815. v-for="(process_detail, idx) in element.process"
  1816. :key="idx + '555' + element.part_id"
  1817. :label="process_detail.name + ':'"
  1818. v-show="
  1819. !element.is_metal &&
  1820. element.hide_process &&
  1821. !element.hide_process.filter(
  1822. (v) => v == process_detail.id
  1823. ).length > 0
  1824. "
  1825. >
  1826. <Tooltip style="width: 120px" transfer>
  1827. <span slot="content">
  1828. <span
  1829. v-for="_item in process_detail.cld"
  1830. :key="_item.id + 'cld'"
  1831. v-show="_item.id == process_detail.value"
  1832. >{{ _item.title }}</span
  1833. >
  1834. </span>
  1835. <Select
  1836. style="width: 120px"
  1837. filterable
  1838. clearable
  1839. transfer
  1840. label-in-value
  1841. :disabled="isCheck"
  1842. @on-change="
  1843. (e) =>
  1844. handlePartProcessChange(
  1845. e,
  1846. idx,
  1847. element,
  1848. process_detail
  1849. )
  1850. "
  1851. v-model="process_detail.value"
  1852. size="small"
  1853. >
  1854. <Option
  1855. v-for="option of process_detail.cld"
  1856. :key="option.id + 'cld'"
  1857. :label="option.title"
  1858. :value="option.id"
  1859. ></Option>
  1860. </Select>
  1861. </Tooltip>
  1862. </FormItem>
  1863. <FormItem v-show="!element.is_metal">
  1864. <Button
  1865. @click="handlePartsApart(element, idx, modalData.part)"
  1866. type="primary"
  1867. v-show="!isCheck"
  1868. v-if="element.isBP"
  1869. style="margin-right: 5px"
  1870. size="small"
  1871. >拆分</Button
  1872. >
  1873. <Button
  1874. @click="handlePartsDele(element, idx, modalData.part)"
  1875. type="primary"
  1876. v-else
  1877. v-show="!isCheck"
  1878. style="margin-right: 5px"
  1879. size="small"
  1880. >删除</Button
  1881. >
  1882. <Button
  1883. @click="handlePartDetailEdit(element, idx)"
  1884. type="primary"
  1885. style="margin-right: 5px"
  1886. size="small"
  1887. >{{
  1888. element.isShowPartDetail
  1889. ? "收起"
  1890. : isCheck
  1891. ? "查看"
  1892. : "修改原材料"
  1893. }}</Button
  1894. >
  1895. </FormItem>
  1896. <div
  1897. :class="[
  1898. 'part_detail_form',
  1899. element.isShowPartDetail ? '' : 'hide_part_detail',
  1900. ]"
  1901. :data-index="idx"
  1902. >
  1903. <FormItem>
  1904. <div
  1905. v-for="(ele, idx) in element.part_detail"
  1906. :key="idx + '999'"
  1907. >
  1908. <Form :model="ele">
  1909. <FormItem>
  1910. <div style="width: 200px">
  1911. {{ ele.title || ele.part_detail_title }}
  1912. </div>
  1913. </FormItem>
  1914. <!-- <FormItem label="厚" :label-width="40">
  1915. <Input
  1916. size="small"
  1917. v-model="ele.long"
  1918. style="width: 80px"
  1919. placeholder="请输入厚"
  1920. />
  1921. </FormItem> -->
  1922. <!-- <FormItem label="宽" :label-width="40">
  1923. <Input
  1924. size="small"
  1925. v-model="ele.wide"
  1926. style="width: 80px"
  1927. placeholder="请输入宽"
  1928. />
  1929. </FormItem> -->
  1930. <!-- <FormItem label="高" :label-width="40">
  1931. <Input
  1932. size="small"
  1933. v-model="ele.high"
  1934. style="width: 80px"
  1935. placeholder="请输入高"
  1936. />
  1937. </FormItem> -->
  1938. <!-- <FormItem label="数量" :label-width="40">
  1939. <Input
  1940. size="small"
  1941. v-model="ele.num"
  1942. @on-change="(e) => handleSubpartNumChange(e, ele)"
  1943. style="width: 80px"
  1944. placeholder="请输入数量"
  1945. />
  1946. </FormItem> -->
  1947. <!-- 原材料 -->
  1948. <Form>
  1949. <FormItem>
  1950. <div style="width: 200px">
  1951. <!-- <Tooltip
  1952. :content="
  1953. ele.material_detail_title || '请选择'
  1954. "
  1955. > -->
  1956. {{ ele.material_detail_title || "请选择" }}
  1957. <!-- </Tooltip> -->
  1958. </div>
  1959. </FormItem>
  1960. <FormItem label="高" :label-width="40">
  1961. <Select
  1962. style="width: 80px"
  1963. filterable
  1964. clearable
  1965. transfer
  1966. :disabled="isCheck"
  1967. v-model="ele.material_detail_id"
  1968. @on-change="(e) => handleMaterialChange(e, ele)"
  1969. placeholder="请选择高"
  1970. size="small"
  1971. >
  1972. <Option
  1973. v-for="option of ele.material_detail_list"
  1974. :key="option.material_detail_id"
  1975. :label="option.long"
  1976. :value="option.material_detail_id"
  1977. ></Option>
  1978. </Select>
  1979. </FormItem>
  1980. <FormItem label="宽" :label-width="40">
  1981. <Select
  1982. style="width: 80px"
  1983. filterable
  1984. clearable
  1985. transfer
  1986. :disabled="isCheck"
  1987. v-model="ele.material_detail_id"
  1988. placeholder="请选择宽"
  1989. size="small"
  1990. >
  1991. <Option
  1992. v-for="option of ele.material_detail_list"
  1993. :key="option.material_detail_id"
  1994. :label="option.wide"
  1995. :value="option.material_detail_id"
  1996. ></Option>
  1997. </Select>
  1998. </FormItem>
  1999. <FormItem label="厚" :label-width="40">
  2000. <Select
  2001. style="width: 80px"
  2002. filterable
  2003. clearable
  2004. transfer
  2005. :disabled="isCheck"
  2006. v-model="ele.material_detail_id"
  2007. placeholder="请选择厚"
  2008. size="small"
  2009. >
  2010. <Option
  2011. v-for="option of ele.material_detail_list"
  2012. :key="option.material_detail_id"
  2013. :label="option.high"
  2014. :value="option.material_detail_id"
  2015. ></Option>
  2016. </Select>
  2017. </FormItem>
  2018. <FormItem label="数量" :label-width="40">
  2019. <Input
  2020. size="small"
  2021. :disabled="isCheck"
  2022. v-model="ele.material_detail_num"
  2023. style="width: 80px"
  2024. placeholder="请输入数量"
  2025. />
  2026. </FormItem>
  2027. </Form>
  2028. </Form>
  2029. </div>
  2030. </FormItem>
  2031. </div>
  2032. </Form>
  2033. </div>
  2034. </div>
  2035. <div class="modal_product_info">
  2036. <div class="modal_product_info_title">
  2037. 附加信息
  2038. <Button
  2039. @click="handleExtraAdd(modalData.extArray, 2)"
  2040. type="primary"
  2041. v-show="!isCheck"
  2042. size="small"
  2043. >新增附加项目</Button
  2044. >
  2045. </div>
  2046. <div class="modal_product_info_content modal_extra">
  2047. <Form
  2048. :model="element"
  2049. v-for="(element, idx) in modalData.extArray"
  2050. :key="element.id"
  2051. v-show="element.type == 2"
  2052. :label-width="80"
  2053. >
  2054. <FormItem label="附加项目:">
  2055. <Select
  2056. filterable
  2057. clearable
  2058. transfer
  2059. label-in-value
  2060. :disabled="isCheck"
  2061. size="small"
  2062. v-model="element.id"
  2063. @on-change="(e) => handleExtChange(element, e, modalData)"
  2064. style="width: 100px"
  2065. >
  2066. <Option
  2067. v-for="item of extList"
  2068. :key="item.id"
  2069. :label="item.title"
  2070. :value="item.id"
  2071. ></Option>
  2072. </Select>
  2073. </FormItem>
  2074. <FormItem label="数量:">
  2075. <Input
  2076. size="small"
  2077. :disabled="isCheck"
  2078. v-model="element.num"
  2079. @on-change="handleTotalPriceCalc(element, modalData)"
  2080. style="width: 100px"
  2081. placeholder="请输入数量"
  2082. />
  2083. </FormItem>
  2084. <FormItem label="单价:">
  2085. <Input
  2086. size="small"
  2087. :disabled="isCheck"
  2088. v-model="element.price"
  2089. @on-change="handleTotalPriceCalc(element, modalData)"
  2090. style="width: 100px"
  2091. placeholder="请输入单价"
  2092. />
  2093. </FormItem>
  2094. <FormItem label="金额:">
  2095. <Input
  2096. size="small"
  2097. :disabled="isCheck"
  2098. v-model="element.total_price"
  2099. @on-change="handleTotalPriceChange(element, modalData)"
  2100. style="width: 100px"
  2101. placeholder="请输入金额"
  2102. />
  2103. </FormItem>
  2104. <FormItem label="备注:">
  2105. <Input
  2106. size="small"
  2107. :disabled="isCheck"
  2108. v-model="element.remark"
  2109. style="width: 100px"
  2110. placeholder="请输入备注"
  2111. />
  2112. </FormItem>
  2113. <FormItem>
  2114. <a
  2115. v-show="!isCheck"
  2116. style="color: red"
  2117. @click="
  2118. handleExtraDele(
  2119. modalData.extArray,
  2120. element,
  2121. idx,
  2122. modalData
  2123. )
  2124. "
  2125. >删除</a
  2126. >
  2127. </FormItem>
  2128. </Form>
  2129. </div>
  2130. </div>
  2131. </TabPane>
  2132. </Tabs>
  2133. </div>
  2134. <div slot="footer">
  2135. <Button @click="cancelModal">取消</Button>
  2136. <Button
  2137. @click="handleEditProductSubmit"
  2138. v-show="!isCheck"
  2139. type="primary"
  2140. >确定</Button
  2141. >
  2142. </div>
  2143. </Modal>
  2144. <Modal
  2145. v-model="showForms"
  2146. @on-ok="postForms(1)"
  2147. class-name="vertical-center-modal"
  2148. style="max-height: 700px; overflow: hidden; overflow-y: auto"
  2149. title="表单设置"
  2150. >
  2151. <Table
  2152. :max-height="600"
  2153. border
  2154. :columns="formSetTableColumns"
  2155. :data="post_formSetTableData"
  2156. >
  2157. </Table>
  2158. </Modal>
  2159. </div>
  2160. </template>
  2161. <script>
  2162. export default {
  2163. beforeRouteLeave(to, from, next) {
  2164. if (this.type == 1 || this.type == 2) {
  2165. if (to.path != "/cms/ordermannage/businessorderlist/list") {
  2166. this.$Modal.confirm({
  2167. title: "提示",
  2168. content: "切换页面会导致数据丢失,是否确认切换?",
  2169. onOk: () => {
  2170. next(() => {});
  2171. },
  2172. onCancel: () => {},
  2173. });
  2174. } else {
  2175. if (this.isAllowLeave) {
  2176. next(() => {});
  2177. } else {
  2178. this.$Modal.confirm({
  2179. title: "提示",
  2180. content: "切换页面会导致数据丢失,是否确认切换?",
  2181. onOk: () => {
  2182. next(() => {});
  2183. },
  2184. onCancel: () => {},
  2185. });
  2186. }
  2187. }
  2188. } else {
  2189. next(() => {});
  2190. }
  2191. },
  2192. data() {
  2193. return {
  2194. currency_edit_index: null,
  2195. measure_total: [],
  2196. part_type_total: [],
  2197. showForms: false,
  2198. forms_list: [],
  2199. type: 1,
  2200. order_no: this.$route.query.order_no,
  2201. modalArray: [],
  2202. modalData: {},
  2203. productList: [],
  2204. product_metailList: [],
  2205. metalList: [],
  2206. extList: [],
  2207. coumstList: [],
  2208. tableWidth: null,
  2209. users: [],
  2210. lock_list: [],
  2211. headers: { Authorization: localStorage.getItem("token") },
  2212. uploadData: {
  2213. order_no: this.$route.query.order_no,
  2214. title: "",
  2215. },
  2216. title_state: 0,
  2217. clientList: [],
  2218. clientDetailList: [],
  2219. clientDetailList_mobile: [],
  2220. clientDetailList_respon: [],
  2221. clientDetailList_address: [],
  2222. tableData: [],
  2223. showEditProduct: false,
  2224. infoRules: {
  2225. residential_name: [{ required: true, message: " ", trigger: "blur" }],
  2226. warning_state: [{ required: true, message: " " }],
  2227. pay_state: [{ required: true, message: "" }],
  2228. predict_price: [{ required: true, message: " " }],
  2229. fax_price: [{ required: true, message: " " }],
  2230. order_price: [{ required: true, message: " " }],
  2231. custom_id: [{ required: true, message: " " }],
  2232. start_time: [{ required: true, message: " " }],
  2233. end_time: [{ required: true, message: " " }],
  2234. box_id: [{ required: true, message: " " }],
  2235. remark: [{ required: true, message: " " }],
  2236. },
  2237. info: {
  2238. residential_name: "", //项目名称
  2239. order_no: "", //订单号
  2240. client_name: "", //客户名称
  2241. address: "", //
  2242. mobile: "", //手机号
  2243. start_time: new Date().toLocaleDateString().replace(/\//g, "-"), //开始时间
  2244. end_time: "", //结束时间
  2245. pay_state: "", //是否支付
  2246. warning_state: 1, //是否紧急
  2247. predict_time: "", //预估交付日期
  2248. service_id: null, //业务员
  2249. predict_price: null, //预估工价,
  2250. predict_working: null, //预估工期
  2251. remark: "",
  2252. img: [],
  2253. front_money: 0,
  2254. },
  2255. process_match_list: [],
  2256. process_all_list: [
  2257. { id: 1, title: "材质" },
  2258. { id: 2, title: "颜色" },
  2259. { id: 3, title: "工艺" },
  2260. ],
  2261. img: [],
  2262. sub_material_list: [],
  2263. showCurrencyOnly: false,
  2264. options: {
  2265. disabledDate(date) {
  2266. return date && date.valueOf() < Date.now() - 86400000;
  2267. },
  2268. },
  2269. editForm: {},
  2270. is_material_show: false,
  2271. currencyIndex: null,
  2272. currentTabIndex: "0",
  2273. parts_title_count: [],
  2274. wood_title_count: [],
  2275. isCheck: false,
  2276. warningList: [],
  2277. originalTableColumns: [
  2278. { title: "原材料名称", align: "center", key: "title" },
  2279. { title: "原材料库存", align: "center", key: "stock" },
  2280. { title: "所需原材料数量", align: "center", key: "num" },
  2281. // { title: '原材料单价', align: 'center', key: 'price' },
  2282. {
  2283. title: "规格型号",
  2284. align: "center",
  2285. key: "specifications",
  2286. render: (h, params) => {
  2287. const { row } = params;
  2288. let text = "";
  2289. row.long ? (text += "L" + row.long + "*") : "";
  2290. row.wide ? (text += "W" + row.wide + "*") : "";
  2291. row.high ? (text += "H" + row.high + "*") : "";
  2292. text = text.substring(0, text.length - 1);
  2293. return h("span", {}, text);
  2294. },
  2295. },
  2296. { title: "原材料单位", align: "center", key: "unit" },
  2297. {
  2298. title: "原材料预估费用",
  2299. align: "center",
  2300. key: "total_price",
  2301. },
  2302. ],
  2303. originalData: [],
  2304. isAllowLeave: false,
  2305. pre_process_obj: {},
  2306. route_id_at_copy: "",
  2307. formSetTableColumns: [
  2308. {
  2309. title: "是否展示",
  2310. align: "center",
  2311. key: "is_show",
  2312. minWidth: 60,
  2313. render: (h, params) => {
  2314. const { index } = params;
  2315. const currentRow = JSON.parse(
  2316. JSON.stringify(this.post_formSetTableData[index])
  2317. );
  2318. return h("Checkbox", {
  2319. props: {
  2320. value: currentRow.is_show,
  2321. disabled:
  2322. currentRow.key == "order_no" ||
  2323. currentRow.key == "residential_name" ||
  2324. currentRow.key == "warning_state" ||
  2325. currentRow.key == "start_time" ||
  2326. currentRow.key == "end_time" ||
  2327. currentRow.key == "client_name" ||
  2328. currentRow.key == "predict_price" ||
  2329. currentRow.key == "box_id" ||
  2330. currentRow.key == "predict_price" ||
  2331. currentRow.key == "order_price" ||
  2332. currentRow.key == "fax_price" ||
  2333. currentRow.key == "remark",
  2334. },
  2335. on: {
  2336. "on-change": (e) => {
  2337. currentRow.is_show = e;
  2338. this.post_formSetTableData.splice(index, 1, currentRow);
  2339. },
  2340. },
  2341. });
  2342. },
  2343. },
  2344. {
  2345. title: "字段名",
  2346. align: "center",
  2347. key: "value",
  2348. minWidth: 100,
  2349. },
  2350. {
  2351. title: "展示名称",
  2352. align: "center",
  2353. key: "title",
  2354. minWidth: 100,
  2355. render: (h, params) => {
  2356. const { index } = params;
  2357. const currentRow = JSON.parse(
  2358. JSON.stringify(this.post_formSetTableData[index])
  2359. );
  2360. return h("Input", {
  2361. props: {
  2362. value: currentRow.title,
  2363. type: "text",
  2364. },
  2365. on: {
  2366. "on-change": (e) => {
  2367. currentRow.title = e.target.value;
  2368. this.post_formSetTableData.splice(index, 1, currentRow);
  2369. },
  2370. },
  2371. });
  2372. },
  2373. },
  2374. ],
  2375. formSetTableData: [
  2376. {
  2377. is_show: true,
  2378. key: "order_no",
  2379. value: "订单编号",
  2380. title: "订单编号",
  2381. },
  2382. {
  2383. is_show: true,
  2384. key: "residential_name",
  2385. value: "项目地址",
  2386. title: "项目地址",
  2387. },
  2388. {
  2389. is_show: true,
  2390. key: "warning_state",
  2391. value: "紧急程度",
  2392. title: "紧急程度",
  2393. },
  2394. {
  2395. is_show: true,
  2396. key: "front_money",
  2397. value: "项目定金",
  2398. title: "项目定金",
  2399. },
  2400. {
  2401. is_show: true,
  2402. key: "start_time",
  2403. value: "开始日期",
  2404. title: "开始日期",
  2405. },
  2406. {
  2407. is_show: true,
  2408. key: "client_name",
  2409. value: "客户名称",
  2410. title: "客户名称",
  2411. },
  2412. {
  2413. is_show: true,
  2414. key: "custom_detail_name",
  2415. value: "负责人",
  2416. title: "负责人",
  2417. },
  2418. {
  2419. is_show: true,
  2420. key: "custom_detail_mobile",
  2421. value: "手机号",
  2422. title: "手机号",
  2423. },
  2424. {
  2425. is_show: true,
  2426. key: "custom_detail_id",
  2427. value: "地址",
  2428. title: "地址",
  2429. },
  2430. {
  2431. is_show: true,
  2432. key: "service_id",
  2433. value: "专营业务员",
  2434. title: "专营业务员",
  2435. },
  2436. {
  2437. is_show: true,
  2438. key: "end_time",
  2439. value: "交付日期",
  2440. title: "交付日期",
  2441. },
  2442. {
  2443. is_show: true,
  2444. key: "predict_price",
  2445. value: "产品总价",
  2446. title: "产品总价",
  2447. },
  2448. {
  2449. is_show: true,
  2450. key: "order_price",
  2451. value: "订单金额",
  2452. title: "订单金额",
  2453. },
  2454. {
  2455. is_show: true,
  2456. key: "fax_price",
  2457. value: "折扣金额",
  2458. title: "折扣金额",
  2459. },
  2460. { is_show: true, key: "box_id", value: "包装", title: "包装" },
  2461. { is_show: true, key: "remark", value: "订单备注", title: "订单备注" },
  2462. ],
  2463. post_formSetTableData: [],
  2464. charge_list: [],
  2465. cus_list: [],
  2466. pre_bp_id: "",
  2467. support_remark: [],
  2468. bpp_list: [],
  2469. process_obj: [],
  2470. timeout: null,
  2471. copiedLinePart: {},
  2472. mentoubanList: [],
  2473. print_line_data: "",
  2474. MTBList: [],
  2475. };
  2476. },
  2477. computed: {
  2478. predict_price_clac() {
  2479. let sum = 0;
  2480. return sum;
  2481. },
  2482. },
  2483. watch: {},
  2484. created() {
  2485. //获取部件分类
  2486. this.axios.get("/api/basics_parts_index").then((res) => {
  2487. res.data.data.map((v, k) => {
  2488. if (v.title == "门头板") {
  2489. this.mentoubanList = res.data.data.splice(k, 1)[0];
  2490. }
  2491. });
  2492. this.part_type_total = res.data.data;
  2493. });
  2494. // 获取测量字段
  2495. this.axios.get("/api/basics_measure_index").then((res) => {
  2496. this.measure_total = res.data.data;
  2497. });
  2498. // 获取工艺属性
  2499. this.axios({
  2500. method: "get",
  2501. url: "/api/bpp_list",
  2502. }).then((res) => {
  2503. if (res.code == 200) {
  2504. this.bpp_list = res.data;
  2505. this.bpp_list.map((v) => {
  2506. this.process_obj.push({
  2507. ...v,
  2508. value: "",
  2509. });
  2510. });
  2511. }
  2512. });
  2513. // 获取负责人列表
  2514. this.axios.get("/api/support_service_name").then((res) => {
  2515. this.clientDetailList_respon = [];
  2516. res.data.map((item) => {
  2517. this.clientDetailList_respon.push({ service_name: item });
  2518. });
  2519. this.charge_list = JSON.parse(
  2520. JSON.stringify(this.clientDetailList_respon)
  2521. );
  2522. });
  2523. // 获取设置表单
  2524. this.get_forms();
  2525. // 获取紧急程度
  2526. this.axios.get("/api/warning_list").then((res) => {
  2527. (this.warningList = res.data.data),
  2528. (this.info.warning_state = this.warningList[0].id);
  2529. });
  2530. // 获取客户列表
  2531. this.axios.get("/api/custom_list").then((res) => {
  2532. this.cus_list = JSON.parse(JSON.stringify(res.data.data));
  2533. this.clientList = res.data.data;
  2534. });
  2535. // 获取五金列表
  2536. this.axios
  2537. .get("/api/material", { params: { sub_type_id: 5 } })
  2538. .then((res) => {
  2539. if (res.code == 200) {
  2540. this.metalList = res.data.data;
  2541. }
  2542. });
  2543. // 获取辅料列表
  2544. this.axios
  2545. .get("/api/material", { params: { sub_type_id: 4 } })
  2546. .then((res) => {
  2547. if (res.code == 200) {
  2548. this.sub_material_list = res.data.data;
  2549. }
  2550. });
  2551. // 获取附加列表
  2552. this.axios.get("/api/project_ext_list").then((res) => {
  2553. if (res.code == 200) {
  2554. this.extList = res.data.data;
  2555. }
  2556. });
  2557. let date1 = new Date();
  2558. let date2 = new Date();
  2559. date2.setDate(date1.getDate() + 30);
  2560. this.info.end_time = date2;
  2561. this.tableWidth = window.innerWidth - 300;
  2562. this.getUsers();
  2563. this.type = this.$route.query.type;
  2564. // this.axios("/api/order_get_forms").then((res) => {
  2565. // if (res.code == 200) {
  2566. // this.forms_list = res.data;
  2567. // this.postForms(0);
  2568. // }
  2569. // });
  2570. this.getCoumstList();
  2571. this.getLockList();
  2572. },
  2573. mounted() {
  2574. if (this.order_no) {
  2575. if (this.order_no) {
  2576. this.info = {};
  2577. }
  2578. this.initData(this.order_no);
  2579. }
  2580. this.getProducts();
  2581. if (this.$route.query.type != 1) {
  2582. this.print_line();
  2583. }
  2584. addEventListener("resize", (e) => {
  2585. this.tableWidth = e.target.innerWidth - 300;
  2586. this.$forceUpdate();
  2587. });
  2588. this.axios
  2589. .get("/api/parts_index", { params: { type_title: "门头板" } })
  2590. .then((res) => {
  2591. if (res.code == 200) {
  2592. this.MTBList = res.data.data;
  2593. }
  2594. });
  2595. },
  2596. methods: {
  2597. quoteRoughDraft() {
  2598. this.axios
  2599. .post("/api/update/get_table", {
  2600. id: "businessorderlist_detail_roughDraft",
  2601. })
  2602. .then((res) => {
  2603. this.post_formSetTableData = res.data.table.post_formSetTableData;
  2604. this.info = res.data.table.info;
  2605. this.formSetTableData = res.data.table.formSetTableData;
  2606. this.handleClientChargeChange(res.data.table.info.custom_detail_name);
  2607. this.tableData = res.data.table.tableData;
  2608. });
  2609. },
  2610. saveRoughDraft() {
  2611. this.axios({
  2612. method: "post",
  2613. url: "/api/update/table",
  2614. data: {
  2615. id: "businessorderlist_detail_roughDraft",
  2616. result: {
  2617. post_formSetTableData: this.post_formSetTableData,
  2618. info: this.info,
  2619. formSetTableData: this.formSetTableData,
  2620. tableData: this.tableData,
  2621. },
  2622. },
  2623. }).then((res) => {
  2624. if (res.code == 200) {
  2625. this.$Message.success(res.msg);
  2626. // this.initData(this.order_no);
  2627. }
  2628. });
  2629. },
  2630. print_line() {
  2631. this.axios({
  2632. method: "get",
  2633. url: "/api/printe_order_detail",
  2634. params: {
  2635. order_no: this.$route.query.order_no,
  2636. box_id: "",
  2637. },
  2638. }).then((res) => {
  2639. this.print_line_data = res.msg.foot.amount_detail;
  2640. });
  2641. },
  2642. handleFaxPriceChange(e) {
  2643. this.info.fax_price = e.target.value;
  2644. this.info.order_price = (
  2645. this.info.predict_price - e.target.value
  2646. ).toFixed(2);
  2647. this.$forceUpdate();
  2648. },
  2649. getSelectedLabel(value, list, valueProp, labelField) {
  2650. const item = list.find((item) => item[valueProp] == value);
  2651. return item ? item[labelField] : null;
  2652. },
  2653. get_forms() {
  2654. this.axios
  2655. .post("/api/update/get_table", { id: "businessorderlist_detail" })
  2656. .then((res) => {
  2657. if (Array.isArray(res.data)) {
  2658. this.post_formSetTableData = JSON.parse(
  2659. JSON.stringify(this.formSetTableData)
  2660. );
  2661. } else {
  2662. if (res.data.table.formSet && res.data.table.formSet.length > 0) {
  2663. this.formSetTableData = JSON.parse(
  2664. JSON.stringify(res.data.table.formSet)
  2665. );
  2666. this.post_formSetTableData = JSON.parse(
  2667. JSON.stringify(res.data.table.formSet)
  2668. );
  2669. } else {
  2670. this.post_formSetTableData = JSON.parse(
  2671. JSON.stringify(this.formSetTableData)
  2672. );
  2673. }
  2674. }
  2675. });
  2676. },
  2677. print() {
  2678. this.$router.push({
  2679. path: "/cms/ordermannage/businessorderlist/printlist",
  2680. query: {
  2681. order_no: this.$route.query.order_no,
  2682. box_id: this.info.box_id,
  2683. },
  2684. });
  2685. },
  2686. back() {
  2687. // this.$router.go(-1);
  2688. this.$router.push({
  2689. path: "/cms/ordermannage/businessorderlist/list",
  2690. });
  2691. },
  2692. postForms(n) {
  2693. this.post_formSetTableData.forEach((element, index) => {
  2694. element.sort = index;
  2695. });
  2696. this.axios({
  2697. method: "post",
  2698. url: "/api/update/table",
  2699. data: {
  2700. id: "businessorderlist_detail",
  2701. result: {
  2702. formSet: this.post_formSetTableData,
  2703. },
  2704. },
  2705. }).then((res) => {
  2706. if (res.code == 200) {
  2707. this.$Message.success(res.msg);
  2708. // this.initData(this.order_no);
  2709. this.get_forms();
  2710. }
  2711. });
  2712. },
  2713. postData() {
  2714. let sendData = JSON.parse(JSON.stringify(this.info));
  2715. // sendData.custom_detail_id = sendData.custom_id
  2716. // let sendList = JSON.parse(JSON.stringify(this.tableData));
  2717. let sendList = this.tableData.filter((v) => !v.is_metal && v.product_id);
  2718. let _save_metal = this.tableData.filter(
  2719. (v) => v.is_metal && v.product_id
  2720. );
  2721. // console.log(_save_metal)
  2722. _save_metal.length > 0 &&
  2723. _save_metal.map((v) => {
  2724. v.type = 1;
  2725. v.material_id = v.product_id;
  2726. v.ext_id = v.product_id;
  2727. });
  2728. console.log(sendList);
  2729. sendList.length > 0 &&
  2730. sendList.map((element, index) => {
  2731. element.ext = element.extArray;
  2732. element.part.map((elem) => {
  2733. if (!elem.is_metal) {
  2734. // elem.part_detail = elem.sub_part;
  2735. if (!elem.part_detail) {
  2736. elem.part_detail = elem.sub_part || [];
  2737. }
  2738. elem.part_detail.map((el) => {
  2739. el.material_num = el.material_detail_num;
  2740. });
  2741. }
  2742. });
  2743. console.log(2);
  2744. if (!element.measurement) {
  2745. element.measurement = "";
  2746. }
  2747. if (!element.measurement_no_letter) {
  2748. element.measurement_no_letter = "";
  2749. }
  2750. let tempStr = "";
  2751. let tempStr_no_letter = "";
  2752. element.measure.forEach((elem) => {
  2753. element[elem.e_title] = elem.value;
  2754. tempStr += elem.measureCalc + elem.value + "*";
  2755. tempStr_no_letter += elem.value + "*";
  2756. });
  2757. element.measurement = tempStr.substring(0, tempStr.length - 1);
  2758. element.measurement_no_letter = tempStr_no_letter.substring(
  2759. 0,
  2760. tempStr_no_letter.length - 1
  2761. );
  2762. });
  2763. sendList.length > 0 &&
  2764. (sendList[0].ext = sendList[0].ext
  2765. ? sendList[0].ext.filter((v) => v.type == 2)
  2766. : "");
  2767. _save_metal.length > 0 && sendList[0].ext.push(..._save_metal);
  2768. try {
  2769. sendData.start_time = new Date(sendData.start_time)
  2770. .toLocaleDateString()
  2771. .replace(/\//g, "-");
  2772. sendData.end_time = new Date(sendData.end_time)
  2773. .toLocaleDateString()
  2774. .replace(/\//g, "-");
  2775. } catch (e) {
  2776. console.log(e);
  2777. }
  2778. let params = { ...sendData, product: sendList, renovation_type: 2 };
  2779. this.axios.post("/api/order_save_new", params).then((res) => {
  2780. if (res.code == 200) {
  2781. this.$Message.success(res.msg);
  2782. this.isAllowLeave = true;
  2783. this.back();
  2784. }
  2785. });
  2786. },
  2787. handleShowMaterial() {
  2788. this.is_material_show = !this.is_material_show;
  2789. },
  2790. initData(order_no) {
  2791. this.axios("/api/order_detail_new", { params: { order_no } }).then(
  2792. (res) => {
  2793. //获取产品
  2794. this.info = res.data;
  2795. this.info.img = this.info.imgs;
  2796. this.tableData = res.data.product_list;
  2797. this.support_remark = Array.from(
  2798. new Set([
  2799. ...res.data.product_list[0].support_remark,
  2800. ...this.support_remark,
  2801. ])
  2802. );
  2803. this.tableData.forEach((element) => {
  2804. //表格编辑用数据
  2805. element.select_all_id = element.product_id + "_1";
  2806. element.num_temp_save = element.num || 1;
  2807. if (element.ext.length > 0) {
  2808. element.ext.map((v, k) => {
  2809. if (v.type == 2) {
  2810. v.id = v.ext_id;
  2811. v.total_price = v.num * v.price;
  2812. } else {
  2813. v.material_id = v.ext_id;
  2814. v.product_id = v.ext_id;
  2815. v.single_price = v.price / v.num;
  2816. }
  2817. });
  2818. } else {
  2819. element.ext.push({
  2820. num: 0,
  2821. price: 0,
  2822. total_price: 0,
  2823. type: 2,
  2824. remark: "",
  2825. title: "",
  2826. id: "",
  2827. is_metal: true,
  2828. });
  2829. }
  2830. element.extArray = element.ext;
  2831. element.type_name = element.title;
  2832. for (const k in element.procedure_properties) {
  2833. const v = element.procedure_properties[k];
  2834. element[k] = v * 1;
  2835. }
  2836. // 数据第一次通过接口获取
  2837. element.get_first_data = true;
  2838. //保存用数据
  2839. element.other = element.customize;
  2840. element.process_str = element.process;
  2841. element.process_obj = JSON.parse(JSON.stringify(this.process_obj));
  2842. // 部件尺寸不展示字母
  2843. element.measurement_no_letter = JSON.parse(
  2844. JSON.stringify(element.measurement)
  2845. );
  2846. element.measure.map((v) => {
  2847. element.measurement_no_letter = element.measurement_no_letter.replace(
  2848. new RegExp(v.e_title, "g"),
  2849. ""
  2850. );
  2851. // 表格编辑时用
  2852. element.value = "";
  2853. v.measureCalc = v.e_title;
  2854. });
  2855. this._measure = JSON.parse(JSON.stringify(element.measure));
  2856. element.part.forEach((elem) => {
  2857. if (!elem.is_metal) {
  2858. if (elem.title.indexOf("门头板") != -1) {
  2859. elem.addMTB = true;
  2860. }
  2861. // 表格数据展示字段
  2862. elem.isBP = true;
  2863. elem.process_str = elem.process;
  2864. elem.process = JSON.parse(JSON.stringify(this.process_obj));
  2865. elem.process.map((v) => {
  2866. v.value = element[v.id];
  2867. });
  2868. elem.measurement = elem.measure;
  2869. elem.longCalc = elem.long;
  2870. elem.wideCalc = elem.wide;
  2871. elem.highCalc = elem.high;
  2872. let measure_arr = elem.measure.split("*");
  2873. elem.long = measure_arr[0];
  2874. elem.wide = measure_arr[1];
  2875. elem.high = measure_arr[2];
  2876. elem.part_detail = elem.sub_part;
  2877. elem.part_detail &&
  2878. elem.part_detail.map((_part_detail) => {
  2879. _part_detail.material_detail_org_num =
  2880. _part_detail.num || 0;
  2881. _part_detail.part_detail_option = [];
  2882. _part_detail.material_detail_list.map((v) => {
  2883. _part_detail.part_detail_option.push({
  2884. label: `${v.long}*${v.wide}*${v.high}`,
  2885. value: v.material_detail_id,
  2886. });
  2887. });
  2888. });
  2889. }
  2890. });
  2891. // 拆分测量字段
  2892. // let product_measure = element.measurement.split('*')
  2893. element.measure.forEach((elem) => {
  2894. element[elem.e_title] = elem.value;
  2895. });
  2896. // 拼五金展示用
  2897. if (element.ext && element.ext.length > 0) {
  2898. element.ext.map((elem) => {
  2899. if (elem.type == 1) {
  2900. elem.total_num = elem.num;
  2901. elem.unit_price = elem.price;
  2902. elem.ext_price = elem.num * elem.price;
  2903. elem.is_metal = true;
  2904. // element.part.push(elem);
  2905. } else {
  2906. if (!element.extra) {
  2907. element.extra = "";
  2908. }
  2909. element.extra += `${elem.title}/`;
  2910. }
  2911. });
  2912. if (element.extra) {
  2913. element.extra = element.extra.substring(
  2914. 0,
  2915. element.extra.length - 1
  2916. );
  2917. }
  2918. }
  2919. });
  2920. this.forms_list = res.tableSet || [];
  2921. // 查看详情时获取原材料信息
  2922. this.originalData = res.data.material_list;
  2923. this.originalData.forEach((element) => {
  2924. element.total_price = (element.num * element.price).toFixed(2);
  2925. });
  2926. this.tableData[0].ext.map((v) => {
  2927. if (v.type === 1) {
  2928. v.is_metal = true;
  2929. v.material_id = v.ext_id;
  2930. v.product_id = v.ext_id;
  2931. v.select_all_id = v.ext_id + "_2";
  2932. this.tableData.push(v);
  2933. }
  2934. });
  2935. this.handleCalcCount(1);
  2936. this.HandleAutoCreateNewLine();
  2937. //获取客户信息
  2938. this.axios
  2939. .get("/api/custom_detail", { params: { id: res.data.custom_id } })
  2940. .then((re) => {
  2941. this.clientDetailList = re.data.list;
  2942. const _temp = this.clientDetailList.filter(
  2943. (item) => item.id == res.data.custom_detail_id
  2944. );
  2945. this.info.custom_detail_name = _temp[0].service_name;
  2946. this.info.custom_detail_mobile = _temp[0].mobile;
  2947. // 去重负责人
  2948. this.clientDetailList_respon = this.unique(re.data.list);
  2949. // 取负责人名字
  2950. // 取出手机号码是该负责人的
  2951. this.clientDetailList_mobile = this.unique(re.data.list);
  2952. this.clientDetailList_mobile = this.clientDetailList.filter(
  2953. (item) => item.service_name == this.info.custom_detail_name
  2954. );
  2955. // 去重手机号码
  2956. this.clientDetailList_mobile = this.unique(
  2957. this.clientDetailList_mobile
  2958. );
  2959. // 取出地址是该负责人的
  2960. this.clientDetailList_address = this.clientDetailList.filter(
  2961. (item) => item.service_name == this.info.custom_detail_name
  2962. );
  2963. this.fax = re.data.detail.fax;
  2964. // 修改价格
  2965. let sum = 0;
  2966. this.tableData.forEach((element) => {
  2967. sum += element.price * 1;
  2968. });
  2969. this.info.service_id = re.data.detail.service_id;
  2970. this.info.predict_price = sum.toFixed(2);
  2971. this.info.order_price = (
  2972. this.info.predict_price - this.info.fax_price
  2973. ).toFixed(2);
  2974. this.$forceUpdate();
  2975. });
  2976. }
  2977. );
  2978. },
  2979. addHours(row) {
  2980. row.push({
  2981. unit: null,
  2982. layer: null,
  2983. number: null,
  2984. product: [{ product_id: "" }],
  2985. });
  2986. },
  2987. getProducts() {
  2988. this.axios("/api/product").then((res) => {
  2989. this.productList = res.data.data;
  2990. this.productList.map((v) => {
  2991. v.label = v.title;
  2992. v.value = v.id;
  2993. });
  2994. });
  2995. this.axios("/api/get_select_all").then((res) => {
  2996. this.product_metailList = res.data;
  2997. });
  2998. },
  2999. cancelModal() {
  3000. this.showEditProduct = false;
  3001. },
  3002. handleSubmit(name) {
  3003. this.$refs[name].validate((valid) => {
  3004. if (valid) {
  3005. this.debounce(500);
  3006. }
  3007. });
  3008. },
  3009. debounce(delay) {
  3010. if (this.timeout) {
  3011. // clearTimeout(this.timeout);
  3012. this.timeout = null;
  3013. } else {
  3014. this.timeout = setTimeout(() => {
  3015. this.postData();
  3016. }, delay);
  3017. }
  3018. },
  3019. handleEditProductSubmit() {
  3020. this.$Modal.confirm({
  3021. content: "请确认线条名称是否正确!",
  3022. onOk: () => {
  3023. const checkArr = this.modalData.part.filter((v) => {
  3024. return !v.change_id && !v.is_metal;
  3025. });
  3026. if (checkArr.length > 0) {
  3027. return this.$Message.warning("部件信息请填写完整!");
  3028. }
  3029. // 工艺属性
  3030. if (!this.modalData.procedure_properties_str) {
  3031. this.modalData.procedure_properties_str = [];
  3032. }
  3033. this.modalData.process_obj &&
  3034. this.modalData.process_obj.forEach((elem, index) => {
  3035. const _temp = elem.cld.filter((item) => item.id == elem.value);
  3036. this.modalData.procedure_properties_str[index] =
  3037. _temp.length > 0 ? _temp[0].title : "";
  3038. });
  3039. this.modalData.process_str = this.modalData.procedure_properties_str.join(
  3040. "/"
  3041. );
  3042. // 尺寸
  3043. if (!this.modalData.measurement) {
  3044. this.modalData.measurement = "";
  3045. }
  3046. if (!this.modalData.measurement_no_letter) {
  3047. this.modalData.measurement_no_letter = "";
  3048. }
  3049. let tempStr = "";
  3050. let tempStr_no_letter = "";
  3051. this.modalData.measure.forEach((elem) => {
  3052. this.modalData[elem.e_title] = elem.value;
  3053. tempStr += elem.measureCalc + elem.value + "*";
  3054. tempStr_no_letter += elem.value + "*";
  3055. });
  3056. this.modalData.measurement = tempStr.substring(0, tempStr.length - 1);
  3057. this.modalData.measurement_no_letter = tempStr_no_letter.substring(
  3058. 0,
  3059. tempStr_no_letter.length - 1
  3060. );
  3061. // 五金、 附加项目
  3062. this.modalData.ext = this.modalData.extArray;
  3063. //其他项
  3064. this.modalData.other = this.modalData.customize;
  3065. // 部件字段
  3066. this.modalData.part.forEach((elem, idx) => {
  3067. if (!elem.is_metal) {
  3068. elem.title ? "" : (elem.title = elem.part_title);
  3069. // if (elem.procedure_properties_str && elem.procedure_properties_str != 0) {
  3070. // elem.process_str = elem.procedure_properties_str.join('/')
  3071. // } else {
  3072. elem.procedure_properties_str = [];
  3073. if (elem.process) {
  3074. elem.process.forEach((item, index) => {
  3075. if (item.cld) {
  3076. let _temp = [];
  3077. item.cld.filter((_cld) => _cld.id == item.value);
  3078. elem.procedure_properties_str[index] =
  3079. _temp.length > 0 ? _temp[0].title : "";
  3080. }
  3081. });
  3082. elem.process_str = elem.procedure_properties_str.join("/");
  3083. elem.procedure_properties = {};
  3084. elem.process.map((item) => {
  3085. elem.procedure_properties[item.id] = item.value;
  3086. });
  3087. }
  3088. // }
  3089. } else {
  3090. this.modalData.part.splice(idx, 1);
  3091. }
  3092. });
  3093. this.modalData.extra = "";
  3094. this.modalData.extArray &&
  3095. this.modalData.extArray.map((item) => {
  3096. const temp = this.extList.filter((it) => it.id == item.ext_id);
  3097. temp && temp.length > 0 && (item.title = temp[0].title);
  3098. });
  3099. this.modalData.extra = this.modalData.extArray
  3100. ? this.modalData.extArray.reduce((pre, cur) => {
  3101. return pre + `${cur.title}/`;
  3102. }, "")
  3103. : "/";
  3104. this.modalData.extra = this.modalData.extra.substring(
  3105. 0,
  3106. this.modalData.extra.length - 1
  3107. );
  3108. const _temp = this.productList.filter(
  3109. (item) => item.id == this.modalData.product_id
  3110. );
  3111. this.modalData.title = _temp[0].title;
  3112. this.tableData.splice(this.currencyIndex, 1, this.modalData);
  3113. this.route_id_at_copy = "";
  3114. // 合计 、 线条 统计价格
  3115. this.handleCalcCount();
  3116. this.showEditProduct = false;
  3117. this.$forceUpdate();
  3118. },
  3119. onCancel: () => {},
  3120. });
  3121. },
  3122. // 合计 、 线条 统计价格
  3123. handleCalcCount(type) {
  3124. let sum = 0;
  3125. this.parts_title_count = [];
  3126. this.wood_title_count = [];
  3127. let total_line_unit = "";
  3128. this.tableData.forEach((element) => {
  3129. sum += element.price * 1;
  3130. if (!element.is_metal) {
  3131. element.part &&
  3132. element.part.forEach((elem) => {
  3133. if (!elem.is_metal) {
  3134. // 统计部件
  3135. const temp = this.parts_title_count.filter(
  3136. (item) => item.title == elem.title
  3137. );
  3138. if (temp && temp.length > 0) {
  3139. this.parts_title_count.map((v) => {
  3140. v.title == elem.title && v.num++;
  3141. });
  3142. } else {
  3143. this.parts_title_count.push({
  3144. change_id: elem.change_id,
  3145. title: elem.title,
  3146. num: elem.num || 1,
  3147. unit: elem.unit,
  3148. });
  3149. }
  3150. // 如果没有点开产品详情的话找不到 part_detail
  3151. if (!elem.part_detail) {
  3152. elem.part_detail = elem.sub_part;
  3153. }
  3154. // 部件中要统计所有线条数量
  3155. elem.part_detail &&
  3156. elem.part_detail.length > 0 &&
  3157. elem.part_detail.forEach((el) => {
  3158. if (el.material_detail_title.indexOf("线条") != -1) {
  3159. const temp = this.wood_title_count.filter(
  3160. (item) => item.title == el.material_detail_title
  3161. );
  3162. if (temp && temp.length > 0) {
  3163. // 匹配规格是否已存在
  3164. const _temp = temp[0].measure_str.filter(
  3165. (item) => item.id == el.material_detail_id
  3166. );
  3167. if (_temp && _temp.length > 0) {
  3168. this.wood_title_count.map((v) => {
  3169. v.title == el.material_detail_title &&
  3170. v.measure_str.map((item) => {
  3171. if (item.id == el.material_detail_id) {
  3172. item.num =
  3173. item.num * 1 + el.material_detail_num * 1;
  3174. }
  3175. });
  3176. });
  3177. } else {
  3178. // 不存在一样规格
  3179. if (
  3180. el.material_detail_list &&
  3181. el.material_detail_list.length > 0
  3182. ) {
  3183. const __temp = el.material_detail_list.filter(
  3184. (item) =>
  3185. item.material_detail_id == el.material_detail_id
  3186. );
  3187. this.wood_title_count.map((v) => {
  3188. v.title == el.material_detail_title &&
  3189. ((v.unit = __temp[0].unit),
  3190. v.measure_str.push({
  3191. num: el.material_detail_num,
  3192. id: __temp[0].material_detail_id,
  3193. measure: `${__temp[0].long || 0}*${__temp[0]
  3194. .wide || 0}*${__temp[0].high || 0}`,
  3195. }));
  3196. });
  3197. } else {
  3198. this.wood_title_count.map((v) => {
  3199. v.title == el.material_detail_title &&
  3200. ((v.unit = el.unit),
  3201. v.measure_str.push({
  3202. num: el.material_detail_num,
  3203. id: el.material_detail_id,
  3204. measure: `${el.long || 0}*${el.wide ||
  3205. 0}*${el.high || 0}`,
  3206. }));
  3207. });
  3208. }
  3209. }
  3210. } else {
  3211. // 不存在就新增
  3212. if (
  3213. el.material_detail_list &&
  3214. el.material_detail_list.length > 0
  3215. ) {
  3216. const _temp = el.material_detail_list.filter(
  3217. (item) =>
  3218. item.material_detail_id == el.material_detail_id
  3219. );
  3220. if (_temp && _temp.length > 0) {
  3221. if (!total_line_unit) {
  3222. total_line_unit = _temp[0].unit;
  3223. }
  3224. this.wood_title_count.push({
  3225. title: el.material_detail_title,
  3226. unit: total_line_unit,
  3227. measure_str: [
  3228. {
  3229. num: el.material_detail_num,
  3230. id: _temp[0].material_detail_id,
  3231. measure: `${_temp[0].long || 0}*${_temp[0]
  3232. .wide || 0}*${_temp[0].high || 0}`,
  3233. unit: _temp[0].unit,
  3234. },
  3235. ],
  3236. });
  3237. }
  3238. } else {
  3239. if (!total_line_unit) {
  3240. total_line_unit = el.unit;
  3241. }
  3242. this.wood_title_count.push({
  3243. title: el.material_detail_title,
  3244. unit: total_line_unit,
  3245. measure_str: [
  3246. {
  3247. num: el.material_detail_num,
  3248. id: el.material_detail_id,
  3249. measure: `${el.long || 0}*${el.wide ||
  3250. 0}*${el.high || 0}`,
  3251. unit: el.unit,
  3252. },
  3253. ],
  3254. });
  3255. }
  3256. }
  3257. }
  3258. });
  3259. }
  3260. });
  3261. }
  3262. });
  3263. // 数线条
  3264. let total_line = 0;
  3265. this.wood_title_count.map((v) => {
  3266. v.measure_str.map((w) => {
  3267. total_line += w.num * 1;
  3268. });
  3269. });
  3270. // 线条合计放进统计
  3271. this.parts_title_count.push({
  3272. title: "线 条",
  3273. num: total_line,
  3274. unit: total_line_unit,
  3275. });
  3276. // 计算价格
  3277. if (type) {
  3278. this.info.order_price = (
  3279. this.info.predict_price - this.info.fax_price
  3280. ).toFixed(2);
  3281. } else {
  3282. this.info.predict_price = sum.toFixed(2);
  3283. this.info.order_price = (
  3284. (this.info.predict_price * this.fax) /
  3285. 100
  3286. ).toFixed(2);
  3287. this.info.fax_price = (
  3288. this.info.predict_price - this.info.order_price
  3289. ).toFixed(2);
  3290. }
  3291. },
  3292. getUsers() {
  3293. this.axios("/api/employee_list").then((res) => (this.users = res.data));
  3294. },
  3295. handleExtraAdd(array, type) {
  3296. array.push({
  3297. num: 0,
  3298. price: 0,
  3299. total_price: 0,
  3300. type,
  3301. remark: "",
  3302. title: "",
  3303. id: "",
  3304. is_metal: true,
  3305. });
  3306. this.handleCalcCount();
  3307. this.$forceUpdate();
  3308. },
  3309. handleExtraDele(array, row, index, modalData) {
  3310. array.splice(index, 1);
  3311. this.handleTotalPriceCalc(row, modalData);
  3312. this.handleCalcCount();
  3313. this.$forceUpdate();
  3314. },
  3315. getCoumstList() {
  3316. this.axios("/api/bpp_list").then((res) => {
  3317. res.data.map((v) => {
  3318. if (v.select) {
  3319. v.cld.map((z) => {
  3320. v.select.map((k) => {
  3321. z.show = k == z.id ? true : false;
  3322. });
  3323. });
  3324. } else {
  3325. v.cld.map((v) => (v.show = false));
  3326. }
  3327. });
  3328. this.coumstList = res.data;
  3329. });
  3330. },
  3331. handleRemarkCreate(val) {
  3332. this.support_remark.push(val);
  3333. },
  3334. handleMTBClick(row) {
  3335. row.addMTB = true;
  3336. const _obj = {
  3337. is_metal: false,
  3338. isBP: false,
  3339. isChoosed: false,
  3340. change_id: "",
  3341. change: this.deepClone(this.MTBList),
  3342. long: "",
  3343. wide: "",
  3344. high: "",
  3345. hide_measure: [],
  3346. process: [],
  3347. part_id: 25, //门头板ID
  3348. hide_process: ["1", "2", "3"],
  3349. part_detail: [
  3350. {
  3351. title: "",
  3352. part_detail_title: "",
  3353. material_detail_title: "",
  3354. material_detail_id: "",
  3355. material_detail_list: [
  3356. {
  3357. material_detail_id: "",
  3358. wide: "",
  3359. high: "",
  3360. long: "",
  3361. material_detail_num: "",
  3362. },
  3363. ],
  3364. },
  3365. ],
  3366. };
  3367. row.part.push(_obj);
  3368. this.$forceUpdate();
  3369. },
  3370. getLockList() {
  3371. this.axios("/api/lock_list").then((res) => (this.lock_list = res.data));
  3372. },
  3373. modalVisibleChange(e) {
  3374. if (!e) {
  3375. this.cancelModal();
  3376. }
  3377. },
  3378. unique(array) {
  3379. let arr = JSON.parse(JSON.stringify(array));
  3380. for (var i = 0; i < arr.length; i++) {
  3381. for (var j = i + 1; j < arr.length; j++) {
  3382. if (arr[i].service_name == arr[j].service_name) {
  3383. //第一个等同于第二个,splice方法删除第二个
  3384. arr.splice(j, 1);
  3385. j--;
  3386. }
  3387. }
  3388. }
  3389. return arr;
  3390. },
  3391. handleClientChange(id) {
  3392. if (id) {
  3393. this.axios({
  3394. method: "get",
  3395. url: "/api/custom_detail",
  3396. params: { id },
  3397. }).then((res) => {
  3398. this.info.custom_id = id;
  3399. this.clientDetailList = res.data.list;
  3400. // 去重负责人
  3401. this.clientDetailList_respon = this.unique(res.data.list);
  3402. // 赋值默认负责人
  3403. this.info.custom_detail_name = this.clientDetailList_respon[0].service_name;
  3404. // 取出手机号码是该负责人的
  3405. this.clientDetailList_mobile = this.clientDetailList.filter(
  3406. (item) => item.service_name == this.info.custom_detail_name
  3407. );
  3408. // 赋值默认手机号码
  3409. this.info.custom_detail_mobile = this.clientDetailList_mobile[0].mobile;
  3410. // 去重手机号码
  3411. this.clientDetailList_mobile = this.unique(
  3412. this.clientDetailList_mobile
  3413. );
  3414. // 取出地址是该负责人的
  3415. this.clientDetailList_address = this.clientDetailList.filter(
  3416. (item) => item.service_name == this.info.custom_detail_name
  3417. );
  3418. // 赋值默认地址
  3419. this.info.custom_detail_id = this.clientDetailList_respon[0].id || 0;
  3420. this.info.service_id = res.data.detail.service_id;
  3421. this.fax = res.data.detail.fax;
  3422. this.HandleAutoCreateNewLine();
  3423. this.$forceUpdate();
  3424. });
  3425. } else {
  3426. this.clientDetailList_respon = JSON.parse(
  3427. JSON.stringify(this.charge_list)
  3428. );
  3429. this.clientList = JSON.parse(JSON.stringify(this.cus_list));
  3430. }
  3431. },
  3432. handleSpan({ row, column, rowIndex, columnIndex }) {
  3433. if (row.end) {
  3434. return [1, 6];
  3435. }
  3436. },
  3437. handleSummary({ columns, data }) {
  3438. const sums = {};
  3439. columns.forEach((column, index) => {
  3440. const key = column.key;
  3441. if (index === 0) {
  3442. sums[key] = {
  3443. key,
  3444. value: "合计",
  3445. };
  3446. return;
  3447. }
  3448. const values = data.map((item) => Number(item[key]));
  3449. if (!values.every((value) => isNaN(value))) {
  3450. const v = values.reduce((prev, curr) => {
  3451. const value = Number(curr);
  3452. if (!isNaN(value)) {
  3453. return prev + curr;
  3454. } else {
  3455. return prev;
  3456. }
  3457. }, 0);
  3458. sums[key] = {
  3459. key,
  3460. value: v,
  3461. };
  3462. } else {
  3463. sums[key] = {
  3464. key,
  3465. value: "",
  3466. };
  3467. }
  3468. });
  3469. return sums;
  3470. },
  3471. handleMetalChange(e, row, n, arr) {
  3472. arr[n].ext_id = e.value;
  3473. arr[n].title = e.label;
  3474. },
  3475. handleClientChargeChange(value) {
  3476. if (value) {
  3477. // if (this.info.custom_id) {
  3478. // this.info.custom_detail_name = value;
  3479. // // 取出手机号码是该负责人的
  3480. // this.clientDetailList_mobile = this.clientDetailList.filter(
  3481. // (item) => item.service_name == this.info.custom_detail_name
  3482. // );
  3483. // // 赋值默认手机号码
  3484. // this.info.custom_detail_mobile = this.clientDetailList_mobile[0].mobile;
  3485. // // 去重手机号码
  3486. // this.clientDetailList_mobile = this.unique(
  3487. // this.clientDetailList_mobile
  3488. // );
  3489. // // 取出地址是该负责人的
  3490. // this.clientDetailList_address = this.clientDetailList.filter(
  3491. // (item) => item.service_name == this.info.custom_detail_name
  3492. // );
  3493. // // 赋值默认地址
  3494. // this.info.custom_detail_id = this.clientDetailList_address[0].id || 0;
  3495. // } else {
  3496. this.axios
  3497. .get("/api/support_custom_for_service", {
  3498. params: { name: this.info.custom_detail_name },
  3499. })
  3500. .then((res) => {
  3501. this.clientList = res.data.data;
  3502. this.info.custom_id = res.data.data[0].id;
  3503. this.axios({
  3504. method: "get",
  3505. url: "/api/custom_detail",
  3506. params: { id: res.data.data[0].id },
  3507. }).then((re) => {
  3508. this.clientDetailList = re.data.list;
  3509. // 取出手机号码是该负责人的
  3510. this.clientDetailList_mobile = this.clientDetailList.filter(
  3511. (item) => item.service_name == value
  3512. );
  3513. // 赋值默认手机号码
  3514. this.info.custom_detail_mobile = this.clientDetailList_mobile[0].mobile;
  3515. // 去重手机号码
  3516. this.clientDetailList_mobile = this.unique(
  3517. this.clientDetailList_mobile
  3518. );
  3519. // 取出地址是该负责人的
  3520. this.clientDetailList_address = this.clientDetailList.filter(
  3521. (item) => item.service_name == value
  3522. );
  3523. // 赋值默认地址
  3524. this.info.custom_detail_id =
  3525. this.clientDetailList_address[0].id || 0;
  3526. this.info.service_id = re.data.detail.service_id;
  3527. this.fax = re.data.detail.fax;
  3528. this.HandleAutoCreateNewLine();
  3529. });
  3530. });
  3531. // }
  3532. } else {
  3533. this.info.custom_detail_mobile = "";
  3534. this.info.custom_detail_id = "";
  3535. this.info.service_id = "";
  3536. this.clientDetailList_respon = JSON.parse(
  3537. JSON.stringify(this.charge_list)
  3538. );
  3539. this.clientList = JSON.parse(JSON.stringify(this.cus_list));
  3540. this.HandleAutoCreateNewLine();
  3541. }
  3542. },
  3543. handleClientDetailChange(value) {
  3544. if (value) {
  3545. // this.clientDetailList_mobile = this.clientDetailList.filter(
  3546. // (item) => item.service_name == this.info.custom_detail_name
  3547. // );
  3548. this.info.custom_detail_id = value;
  3549. // this.info.address = row[0].address;
  3550. // this.info.address = row[0].address;
  3551. // this.info.mobile = row[0].mobile;
  3552. this.$forceUpdate();
  3553. }
  3554. },
  3555. getEditData(modalData, curData) {
  3556. // console.log("modalData :>> ", modalData);
  3557. // console.log("curData :>> ", curData);
  3558. modalData.ext_price = curData.ext_price * 1 || 0;
  3559. modalData.model = curData.model;
  3560. modalData.num = curData.num || 1;
  3561. modalData.num_temp_save = modalData.num;
  3562. modalData.over_price = curData.over_price * 1 || 0;
  3563. modalData.position = curData.position;
  3564. modalData.price = curData.price;
  3565. modalData.product_id = curData.product_id;
  3566. modalData.remark = curData.remark;
  3567. modalData.route_id = curData.route_id;
  3568. modalData.total_num = curData.total_num;
  3569. modalData.unit = curData.unit;
  3570. modalData.unit_price = curData.unit_price * 1 || 0;
  3571. modalData.url_number = curData.url_number;
  3572. modalData.extArray = [];
  3573. // 金额=(产品单价)*核算数量+超标金额+附加金额
  3574. modalData.price =
  3575. (modalData.unit_price * 1 || 0) * (modalData.num * 1 || 1) +
  3576. (modalData.over_price * 1 || 0) +
  3577. (modalData.ext_price * 1 || 0);
  3578. modalData.price = modalData.price.toFixed(2);
  3579. // 获取产品 type_name
  3580. const temprow = this.productList.filter(
  3581. (item) => item.id == curData.product_id
  3582. );
  3583. modalData.type_name = temprow[0].title;
  3584. // 获取工艺属性
  3585. // 如果route_id是0,工艺属性值取procedure_properties
  3586. if (modalData.route_id == 0) {
  3587. modalData.process_obj.map((v) => {
  3588. v.value = modalData.procedure_properties[v.id] * 1;
  3589. });
  3590. } else {
  3591. this.process_match_list.forEach((element) => {
  3592. if (element.id == curData.route_id) {
  3593. modalData.process_ids = element.detail;
  3594. }
  3595. });
  3596. modalData.process_obj.forEach((element) => {
  3597. //赋值测量字段
  3598. for (const key in modalData.process_ids) {
  3599. const ele = modalData.process_ids[key];
  3600. if (element.id == key) {
  3601. element.value = ele * 1;
  3602. }
  3603. }
  3604. });
  3605. }
  3606. // 产品测量字段
  3607. let product_measure = curData.measurement.split("*");
  3608. for (let index = 0; index < product_measure.length; index++) {
  3609. const item = product_measure[index];
  3610. const product_measure_detail = [
  3611. item.substring(0, 1),
  3612. item.substring(1),
  3613. ];
  3614. modalData.measure.forEach((element) => {
  3615. if (element.measureCalc == product_measure_detail[0]) {
  3616. element.value = product_measure_detail[1];
  3617. }
  3618. });
  3619. }
  3620. // 拆分五金、附加信息
  3621. // if (!curData.ext) {
  3622. // curData.ext = curData.ext_list;
  3623. // }
  3624. curData.ext &&
  3625. curData.ext.length > 0 &&
  3626. curData.ext.forEach((element) => {
  3627. element.type == 2 && modalData.extArray.push(element);
  3628. });
  3629. modalData.extArray.forEach((element) => {
  3630. element.id = element.ext_id;
  3631. element.total_price = (element.price * element.num).toFixed(2);
  3632. });
  3633. // 同步 curData 、 modalData
  3634. curData.part.map((ele, idx) => {
  3635. //判断是否存在
  3636. if (modalData.part[idx]) {
  3637. //判断是否相等
  3638. if (modalData.part[idx].part_id != ele.part_id) {
  3639. //不相等情况1,是否为替换项
  3640. /////
  3641. //不相等情况2,是否为另一部件
  3642. // if (
  3643. // modalData.part[idx].change.filter(v=>v.id==ele.id).length>0
  3644. // ) {
  3645. modalData.part.splice(
  3646. idx,
  3647. 0,
  3648. JSON.parse(JSON.stringify(modalData.part[idx - 1]))
  3649. );
  3650. // }
  3651. }
  3652. } else {
  3653. modalData.part.splice(
  3654. idx,
  3655. 0,
  3656. JSON.parse(JSON.stringify(modalData.part[idx - 1]))
  3657. );
  3658. }
  3659. });
  3660. // 处理部件
  3661. curData.part.forEach((element, index) => {
  3662. if (!element.is_metal) {
  3663. modalData.part[index].change_id = element.change_id;
  3664. modalData.part[index].part_title = element.part_title;
  3665. modalData.part[index].org_part_id = modalData.part[index].part_id;
  3666. // 部件测量字段
  3667. if (element.measure && element.measure.length > 0) {
  3668. const part_measure_detail = element.measure.split("*");
  3669. modalData.part[index].long = part_measure_detail[0];
  3670. modalData.part[index].wide = part_measure_detail[1];
  3671. modalData.part[index].high = part_measure_detail[2];
  3672. }
  3673. // 替换项相关 如果选了替换项
  3674. if (element.part_id != modalData.part[index].part_id) {
  3675. const change_obj = modalData.part[index].change.filter(
  3676. (item) => item.part_id == element.part_id
  3677. );
  3678. if (change_obj && change_obj.length > 0) {
  3679. change_obj[0].sub_part.forEach((elem, idx) => {
  3680. modalData.part[index].part_detail[idx].material_detail_title =
  3681. elem.material_detail_list[0].title;
  3682. modalData.part[index].part_detail[idx].material_detail_id =
  3683. elem.material_detail_id;
  3684. modalData.part[index].part_detail[idx].material_detail_list =
  3685. elem.material_detail_list;
  3686. });
  3687. }
  3688. }
  3689. element.sub_part.forEach((elem, idx) => {
  3690. // 零部件字段 、 原材料字段
  3691. modalData.part[index].part_detail[idx].long = elem.long;
  3692. modalData.part[index].part_detail[idx].wide = elem.wide;
  3693. modalData.part[index].part_detail[idx].high = elem.high;
  3694. modalData.part[index].part_detail[idx].material_detail_id =
  3695. elem.material_detail_id;
  3696. modalData.part[index].part_detail[idx].material_detail_num =
  3697. elem.material_detail_num;
  3698. modalData.part[index].part_detail[idx].material_id =
  3699. elem.material_id;
  3700. modalData.part[index].part_detail[idx].num = elem.num;
  3701. });
  3702. modalData.part[index].part_id = element.part_id;
  3703. // // 工艺属性
  3704. // modalData.part[index].procedure_properties = JSON.parse(
  3705. // JSON.stringify(element.process)
  3706. // );
  3707. for (const k in element.process) {
  3708. const v = element.process[k];
  3709. modalData.part[index].process.map((ele) => {
  3710. if (ele.id == k) {
  3711. ele.value = v;
  3712. }
  3713. });
  3714. }
  3715. }
  3716. });
  3717. },
  3718. handleShowAddProductModal(custom_id, route_id_at_copy) {
  3719. this.$addProduct({
  3720. custom_id,
  3721. route_id_at_copy,
  3722. then: (subAddProductData, support_remark) => {
  3723. this.support_remark = Array.from(
  3724. new Set([...support_remark, ...this.support_remark])
  3725. );
  3726. this.modalArray = subAddProductData;
  3727. this.modalArray.map((element) => {
  3728. // 工艺属性
  3729. if (!element.procedure_properties_str) {
  3730. element.procedure_properties_str = [];
  3731. }
  3732. if (!element.procedure_properties) {
  3733. element.procedure_properties = {};
  3734. }
  3735. element.process_obj = element.process;
  3736. element.process_obj.forEach((elem, index) => {
  3737. const _target = elem.cld ? elem.cld : elem.processList;
  3738. const _temp = _target.filter((item) => item.id == elem.value);
  3739. element.procedure_properties_str[index] =
  3740. _temp.length > 0 ? _temp[0].title : "";
  3741. element.procedure_properties[elem.id] =
  3742. _temp.length > 0 ? _temp[0].id : "";
  3743. element[elem.id] = elem.value;
  3744. element.procedure_properties[elem.id] = elem.value;
  3745. });
  3746. element.process_str = element.procedure_properties_str.join("/");
  3747. // 尺寸
  3748. if (!element.measurement) {
  3749. element.measurement = "";
  3750. }
  3751. if (!element.measurement_no_letter) {
  3752. element.measurement_no_letter = "";
  3753. }
  3754. let tempStr = "";
  3755. let tempStr_no_letter = "";
  3756. element.measure.forEach((elem) => {
  3757. tempStr += elem.measureCalc + elem.value + "*";
  3758. tempStr_no_letter += +elem.value + "*";
  3759. //为了表格上展示,拆解赋值到产品上
  3760. element[elem.e_title] = elem.value;
  3761. });
  3762. element.measurement = tempStr.substring(0, tempStr.length - 1);
  3763. element.measurement_no_letter = tempStr_no_letter.substring(
  3764. 0,
  3765. tempStr_no_letter.length - 1
  3766. );
  3767. // 五金、 附加项目
  3768. element.ext = [...element.extArray];
  3769. //其他项
  3770. element.other = element.customize;
  3771. // 部件字段
  3772. element.part.forEach((elem) => {
  3773. if (!elem.is_metal) {
  3774. elem.title ? "" : (elem.title = elem.part_title);
  3775. elem.procedure_properties_str = [];
  3776. elem.process.forEach((item, index) => {
  3777. const _temp = item.cld.filter(
  3778. (_cld) => _cld.id == item.value
  3779. );
  3780. elem.procedure_properties_str[index] =
  3781. _temp.length > 0 ? _temp[0].title : "";
  3782. });
  3783. elem.process_str = elem.procedure_properties_str.join("/");
  3784. elem.part_detail.map((_part_detail) => {
  3785. _part_detail.part_detail_option = [];
  3786. _part_detail.material_detail_list.map((v) => {
  3787. _part_detail.part_detail_option.push({
  3788. label: `${v.long}*${v.wide}*${v.high}`,
  3789. value: v.material_detail_id,
  3790. });
  3791. });
  3792. });
  3793. }
  3794. });
  3795. element.ext &&
  3796. element.ext.length > 0 &&
  3797. (element.ext.map((elem) => {
  3798. if (elem.type == 1) {
  3799. elem.total_num = elem.num;
  3800. elem.unit_price = elem.price;
  3801. elem.ext_price = elem.num * elem.price;
  3802. elem.is_metal = true;
  3803. element.part.push(elem);
  3804. if (!element.extra) {
  3805. element.extra = "";
  3806. }
  3807. } else {
  3808. if (!element.extra) {
  3809. element.extra = "";
  3810. }
  3811. element.extra += `${elem.title}/`;
  3812. }
  3813. }),
  3814. (element.extra = element.extra.substring(
  3815. 0,
  3816. element.extra.length - 1
  3817. )));
  3818. });
  3819. this.modalArray.forEach((element) => {
  3820. element.part.forEach((elem) => {
  3821. if (!elem.is_metal) {
  3822. elem.measurement = `${elem.long}*${elem.wide}*${elem.high}`;
  3823. elem.title = elem.part_title;
  3824. elem.procedure_properties = {};
  3825. elem.process.map((item) => {
  3826. elem.procedure_properties[item.id] = item.value;
  3827. });
  3828. }
  3829. });
  3830. });
  3831. this.tableData = [...this.tableData, ...this.modalArray];
  3832. this.currencyIndex = null;
  3833. this.route_id_at_copy = "";
  3834. // 合计 、 线条 统计价格
  3835. this.handleCalcCount();
  3836. this.showAddProduct = false;
  3837. this.$forceUpdate();
  3838. },
  3839. });
  3840. },
  3841. HandleAutoCreateNewLine() {
  3842. let flag = false;
  3843. this.tableData.map((v) => {
  3844. if (!v.position && !v.product_id) {
  3845. flag = true;
  3846. }
  3847. });
  3848. !flag && this.handleTableAdd();
  3849. },
  3850. handleTableAdd() {
  3851. if (this.info.custom_id) {
  3852. this.currentTabIndex = "0";
  3853. let obj = {
  3854. select_all_id: "", //产品五金ID
  3855. product_id: "", //产品ID
  3856. type_name: "", //展示用产品名称
  3857. position: "", //位置
  3858. over_price: "", //超标单价
  3859. unit_price: "", //单价
  3860. ext_price: "", //附加金额
  3861. price: "", //总金额
  3862. remark: "", //备注
  3863. measurement: "", //测量字段拼接
  3864. total_num: "", //数量
  3865. num: "", //核算数量
  3866. num_formula: "", //核算数量公式
  3867. url_number: "", //图号
  3868. url: [], //图纸
  3869. unit: "", //单位
  3870. title: "", //产品名
  3871. process: "", //工艺属性拼接
  3872. procedure_properties: {}, //工艺属性对象
  3873. overdraft: [], //超标公式
  3874. measure: this._measure, //测量字段数组
  3875. support_remark: this.support_remark, //备注列表
  3876. is_metal: false,
  3877. extArray: [
  3878. {
  3879. num: 0,
  3880. price: 0,
  3881. total_price: 0,
  3882. type: 2,
  3883. remark: "",
  3884. title: "",
  3885. id: "",
  3886. is_metal: true,
  3887. },
  3888. ],
  3889. process_obj: JSON.parse(JSON.stringify(this.process_obj)), //工艺属性含选项对象
  3890. };
  3891. obj.process_obj.map(
  3892. (v) => ((obj[v.id] = ""), (obj.procedure_properties[v.id] = ""))
  3893. );
  3894. this.tableData.push(obj);
  3895. this.$forceUpdate();
  3896. } else {
  3897. this.$Message.warning("请先选择客户");
  3898. }
  3899. },
  3900. handleMetalAdd() {
  3901. this.tableData.push({
  3902. type: 1,
  3903. is_metal: true,
  3904. material_id: "",
  3905. product_id: "",
  3906. title: "",
  3907. price: 0,
  3908. single_price: 0,
  3909. num: 0,
  3910. unit: "",
  3911. });
  3912. },
  3913. handleSet(row, index, type) {
  3914. let obj;
  3915. // 1 新增 2 编辑 3 删除 4复制 5详情
  3916. switch (type) {
  3917. case 1:
  3918. this.title_state = 1;
  3919. if (this.info.custom_id) {
  3920. this.currentTabIndex = "0";
  3921. // this.showAddProduct = true;
  3922. this.handleShowAddProductModal(
  3923. this.info.custom_id,
  3924. this.route_id_at_copy
  3925. );
  3926. } else {
  3927. this.$Message.warning("请先选择客户");
  3928. }
  3929. break;
  3930. case 2:
  3931. this.title_state = 2;
  3932. this.isCheck = false;
  3933. if (this.type == 1) {
  3934. this.showEditProduct = true;
  3935. this.modalData = JSON.parse(JSON.stringify(row));
  3936. this.currencyIndex = index;
  3937. } else if (this.type == 2) {
  3938. //订单编辑点产品编辑
  3939. // if (row.get_first_data && !row.isEdit) {
  3940. // this.axios
  3941. // .get("/api/order_product_detail_new", {
  3942. // params: { order_product_id: row.order_product_id },
  3943. // })
  3944. // .then((res) => {
  3945. // if (res.code == 200) {
  3946. // this.currencyIndex = index;
  3947. // this.modalData = JSON.parse(JSON.stringify(row));
  3948. // this.editForm = res.data;
  3949. // this.changeProductOnEdit(res.data, 0);
  3950. // }
  3951. // });
  3952. // } else {
  3953. // 订单新增点产品编辑
  3954. row.measure.map((v) => {
  3955. v.value = row[v.e_title];
  3956. });
  3957. row.process_obj.map((v) => {
  3958. v.title = v.name;
  3959. v.value = row[v.id];
  3960. });
  3961. this.modalData = JSON.parse(JSON.stringify(row));
  3962. this.currencyIndex = index;
  3963. this.showEditProduct = true;
  3964. // }
  3965. }
  3966. break;
  3967. case 3:
  3968. this.$Modal.confirm({
  3969. title: "确认删除?",
  3970. content: "请确认!",
  3971. onOk: () => {
  3972. this.tableData.splice(index, 1);
  3973. this.handleCalcCount();
  3974. },
  3975. onCancel: () => {},
  3976. });
  3977. break;
  3978. case 4:
  3979. obj = this.deepClone(row);
  3980. obj.isCopied = true;
  3981. if (row.is_metal) {
  3982. console.log(`123`, 123);
  3983. } else {
  3984. obj.position = "";
  3985. obj.measure.map((v) => {
  3986. v.value = "";
  3987. obj[v.e_title] = "";
  3988. });
  3989. if (!row.is_metal) {
  3990. this.route_id_at_copy = row.route_id;
  3991. }
  3992. this.pre_process_obj = JSON.parse(
  3993. JSON.stringify(row.procedure_properties)
  3994. );
  3995. }
  3996. //复制一条数据,更换了产品之后,
  3997. //线条的内容要保留(不管更换的这个产品的默认线条是什么,都是只展示复制下来的)
  3998. //摘自Tower #2004
  3999. obj.part &&
  4000. obj.part.map((v) => {
  4001. if (v.title.indexOf("线条") != -1) {
  4002. this.copiedLinePart = this.deepClone(v);
  4003. }
  4004. });
  4005. //因为是复制,插件id为_XID会相同导致bug,置空后会自动生成
  4006. obj._XID = "";
  4007. this.tableData.splice(index + 1, 0, obj);
  4008. this.handleCalcCount();
  4009. break;
  4010. case 5:
  4011. this.title_state = 3;
  4012. this.isCheck = true;
  4013. // if (row.get_first_data) {
  4014. // this.axios
  4015. // .get("/api/order_product_detail_new", {
  4016. // params: { order_product_id: row.order_product_id },
  4017. // })
  4018. // .then((res) => {
  4019. // if (res.code == 200) {
  4020. // this.currencyIndex = index;
  4021. // this.modalData = JSON.parse(JSON.stringify(row));
  4022. // this.editForm = res.data;
  4023. // this.changeProductOnEdit(res.data, 0);
  4024. // }
  4025. // });
  4026. // } else {
  4027. row.measure.map((v) => {
  4028. v.value = row[v.e_title];
  4029. });
  4030. row.process_obj.map((v) => {
  4031. v.title = v.name;
  4032. v.value = row[v.id];
  4033. });
  4034. this.modalData = JSON.parse(JSON.stringify(row));
  4035. this.currencyIndex = index;
  4036. this.showEditProduct = true;
  4037. // }
  4038. break;
  4039. }
  4040. },
  4041. deepClone(obj) {
  4042. //定义对象来判断当前的参数是数组还是对象
  4043. let objClone = Array.isArray(obj) ? [] : {};
  4044. //如果obj存在并且为对象
  4045. if (obj && typeof obj == "object") {
  4046. for (let key in obj) {
  4047. if (Object.hasOwnProperty.call(obj, key)) {
  4048. //如果obj的子元素为对象,那么递归(层级遍历)
  4049. if (obj[key] && typeof obj[key] == "object") {
  4050. objClone[key] = this.deepClone(obj[key]);
  4051. } else {
  4052. //如果不是,直接赋值
  4053. objClone[key] = obj[key];
  4054. }
  4055. }
  4056. }
  4057. }
  4058. return objClone;
  4059. },
  4060. async handleBeforeUpload(row) {
  4061. // row.name
  4062. this.uploadData.title = row.name.substring(0, row.name.indexOf("."));
  4063. return true;
  4064. },
  4065. uploadError(err) {
  4066. this.$Message.error(err.msg || "上传失败");
  4067. },
  4068. onProgress(e) {
  4069. console.log(e);
  4070. },
  4071. //导入成功
  4072. uploadSuccess(res) {
  4073. if (res.code == 200) {
  4074. this.$Message.success(res.msg || "上传成功");
  4075. // const temp = res.data;
  4076. // let list = [...this.postInfo.children, ...temp];
  4077. } else {
  4078. this.$Message.warning(res.msg || "上传失败");
  4079. }
  4080. },
  4081. handleExtChange(row, { value, label }, item) {
  4082. row.ext_id = value;
  4083. row.title = label;
  4084. const element = this.extList.filter((item) => item.id == value);
  4085. row.num = element[0].num;
  4086. row.price = element[0].price;
  4087. row.total_price = (row.num * row.price).toFixed(2);
  4088. this.handleTotalPriceCalc(row, item);
  4089. this.handleCalcCount();
  4090. },
  4091. handleSameProcessDisabled(array, currencyChooseValue, currencyChooseIndex) {
  4092. let matchIds = array.selected_ids;
  4093. let target = array.same_process;
  4094. let source = array.same_process_compare;
  4095. let chooseable = [];
  4096. source.forEach((element, index) => {
  4097. element.forEach((elem, idx) => {
  4098. if (elem.id == currencyChooseValue) {
  4099. chooseable = [...chooseable, ...element];
  4100. }
  4101. });
  4102. });
  4103. target.forEach((element) => {
  4104. element.option.forEach((elem) => {
  4105. elem.isAllowSelect = true;
  4106. chooseable.forEach((el) => {
  4107. if (el.id == elem.id) {
  4108. elem.isAllowSelect = false;
  4109. }
  4110. });
  4111. });
  4112. });
  4113. this.$forceUpdate();
  4114. },
  4115. changeLock(value, row, idx) {
  4116. if (row.old_lock_price) {
  4117. row.price = parseInt(row.price) - row.old_lock_price;
  4118. }
  4119. row.old_lock_price = parseInt(value.tag || "0");
  4120. row.price = parseInt(row.price) + parseInt(value.tag || "0");
  4121. this.modalArray[idx] = row;
  4122. this.$forceUpdate();
  4123. },
  4124. handleTotalPriceChange(row, item) {
  4125. row.price = (row.total_price / (row.num == 0 ? 1 : row.num)).toFixed(2);
  4126. let sum = 0;
  4127. item.extArray.map((v) => {
  4128. return (sum += v.total_price * 1);
  4129. });
  4130. item.ext_price = sum;
  4131. item.price =
  4132. (item.unit_price * 1 || 0) * (item.num * 1 || 1) +
  4133. (item.over_price * 1 || 0) +
  4134. (item.ext_price * 1 || 0);
  4135. item.price = item.price.toFixed(2);
  4136. this.$forceUpdate();
  4137. },
  4138. handleTotalPriceCalc(row, item) {
  4139. row.total_price = ((row.price || 0) * (row.num || 0)).toFixed(2);
  4140. let sum2 = 0;
  4141. item.extArray &&
  4142. item.extArray.length > 0 &&
  4143. item.extArray.forEach((element) => {
  4144. sum2 += element.total_price * 1 || 0;
  4145. });
  4146. item.ext_price = sum2 * 1;
  4147. item.price =
  4148. (item.unit_price * 1 || 0) * (item.num * 1 || 1) +
  4149. (item.over_price * 1 || 0) +
  4150. (item.ext_price * 1 || 0);
  4151. item.price = item.price.toFixed(2);
  4152. this.$forceUpdate();
  4153. },
  4154. handlePartDetailEdit(element, index) {
  4155. element.isShowPartDetail = !element.isShowPartDetail;
  4156. this.$forceUpdate();
  4157. },
  4158. handlePartsApart(element, index, array) {
  4159. let obj = JSON.parse(JSON.stringify(element));
  4160. obj.isBP = false;
  4161. array.splice(index + 1, 0, obj);
  4162. this.$forceUpdate();
  4163. },
  4164. handlePartsDele(element, index, array) {
  4165. array.splice(index, 1);
  4166. this.handleCalcCount();
  4167. this.$forceUpdate();
  4168. },
  4169. handleProductPositionChange(item, e) {
  4170. item.position = e.target.value;
  4171. this.$forceUpdate();
  4172. },
  4173. handleOrderPriceChange(e) {
  4174. this.info.order_price = e.target.value;
  4175. this.info.fax_price = (this.info.predict_price - e.target.value).toFixed(
  4176. 2
  4177. );
  4178. this.$forceUpdate();
  4179. },
  4180. handleClearExtInfo(modalData, pre_id, cur_id) {
  4181. if (cur_id != pre_id) {
  4182. modalData.extArray = [
  4183. {
  4184. num: 0,
  4185. price: 0,
  4186. total_price: 0,
  4187. type: 2,
  4188. remark: "",
  4189. title: "",
  4190. id: "",
  4191. is_metal: true,
  4192. },
  4193. ];
  4194. } else {
  4195. let sum = 0;
  4196. modalData.extArray.map((v) => {
  4197. return (sum += v.total_price * 1);
  4198. });
  4199. modalData.ext_price = sum;
  4200. modalData.price =
  4201. (modalData.unit_price * 1 || 0) * (modalData.num * 1 || 1) +
  4202. (modalData.over_price * 1 || 0) +
  4203. (modalData.ext_price * 1 || 0);
  4204. modalData.price = modalData.price.toFixed(2);
  4205. }
  4206. this.pre_bp_id = cur_id;
  4207. },
  4208. changeEditProcess(row, obj) {
  4209. row.isEdit = true;
  4210. row.procedure_properties[obj.id] = row[obj.id];
  4211. this.pre_process_obj[obj.id] = row[obj.id];
  4212. row.process_obj.filter((v) => v.id == obj.id)[0].value = row[obj.id];
  4213. row.part.map((item) => {
  4214. if (!item.is_metal) {
  4215. //赋值默认工艺属性
  4216. item.process = JSON.parse(JSON.stringify(this.bpp_list));
  4217. item.procedure_properties[obj.id] = row[obj.id];
  4218. item.process.forEach((elem, index) => {
  4219. row.process_obj.map((v) => {
  4220. if (elem.id == v.id) {
  4221. elem.value = v.value;
  4222. }
  4223. });
  4224. // elem.value = row.process_obj.filter(
  4225. // (v) => v.id == elem.id
  4226. // )[0].value;
  4227. });
  4228. }
  4229. });
  4230. },
  4231. changeEditLines(row) {
  4232. row.isEdit = true;
  4233. this.handleCalcCount();
  4234. },
  4235. changeEditMeasure(e, row, measure) {
  4236. if (e.target.value) {
  4237. row.isEdit = true;
  4238. row.measure.map((v) => {
  4239. if (v.e_title == measure.e_title) {
  4240. v.value = e.target.value;
  4241. }
  4242. });
  4243. this.handleProductMeasureBlur(
  4244. e,
  4245. row,
  4246. row.measure.filter((v) => v.id == measure.id)[0]
  4247. );
  4248. }
  4249. },
  4250. changeEditRemark(row) {
  4251. row.isEdit = true;
  4252. this.handleCalcCount();
  4253. },
  4254. changeEditMetal(row, rowIndex, $event, scope) {
  4255. row.ext_id = row.product_id;
  4256. const match_id = $event.value.split("_")[0];
  4257. row.title = this.metalList.filter((v) => v.id == match_id)[0].title;
  4258. row.unit = this.metalList.filter((v) => v.id == match_id)[0].unit;
  4259. },
  4260. changeEditMetalNum(e, row) {
  4261. row.price = (1 * e.target.value * row.single_price).toFixed(2);
  4262. this.handleCalcCount();
  4263. },
  4264. handleMetailPriceChange(e, row) {
  4265. row.price = 1 * e.target.value * row.num;
  4266. this.handleCalcCount();
  4267. },
  4268. changeEditTotalNum(e, row) {
  4269. row.isEdit = true;
  4270. this.handleProductNumChange(e, row);
  4271. },
  4272. changeEditDetailNum(row) {
  4273. row.isEdit = true;
  4274. this.handleCalcCount();
  4275. },
  4276. changeEditExt(row, e, item) {
  4277. if (e) {
  4278. item.isEdit = true;
  4279. row.ext_id = e.value;
  4280. this.handleExtChange(row, e, item);
  4281. } else {
  4282. row.ext_id = "";
  4283. row.title = "";
  4284. this.handleCalcCount();
  4285. }
  4286. },
  4287. changeEditPart(row, part_type, part_detail, e, rowIndex) {
  4288. if (e) {
  4289. row.isEdit = true;
  4290. part_detail.change_id = e.value;
  4291. part_detail.sub_part = part_detail.change.filter(
  4292. (v) => v.id == e.value
  4293. )[0].sub_part;
  4294. part_detail.title = part_detail.change.filter(
  4295. (v) => v.id == e.value
  4296. )[0].part_title;
  4297. this.handlePartChange(e, part_detail, row.measure, row.total_num);
  4298. this.handleIsSpecialPart(this.tableData[rowIndex]);
  4299. this.handleCalcCount();
  4300. }
  4301. },
  4302. handleSelectProductMetail(row, rowIndex, $event, scope) {
  4303. if ($event) {
  4304. const arr = $event.tag.split("_");
  4305. let obj = {};
  4306. // 分类 1产品 2五金
  4307. if (arr[1] == "1") {
  4308. obj = {
  4309. isCopied: row.isCopied,
  4310. select_all_id: $event.value,
  4311. product_id: arr[0] * 1,
  4312. type_name: "", //展示用产品名称
  4313. position: row.position, //位置
  4314. over_price: "", //超标单价
  4315. unit_price: "", //单价
  4316. ext_price: "", //附加金额
  4317. price: "", //总金额
  4318. remark: "", //备注
  4319. measurement: "", //测量字段拼接
  4320. total_num: "", //数量
  4321. num: "", //核算数量
  4322. num_formula: "", //核算数量公式
  4323. url_number: "", //图号
  4324. url: [], //图纸
  4325. unit: "", //单位
  4326. title: "", //产品名
  4327. process: "", //工艺属性拼接
  4328. procedure_properties: this.pre_process_obj || {}, //工艺属性对象
  4329. overdraft: [], //超标公式
  4330. measure: this._measure, //测量字段数组
  4331. support_remark: this.support_remark, //备注列表
  4332. is_metal: false,
  4333. ext: [],
  4334. extArray: [
  4335. {
  4336. num: 0,
  4337. price: 0,
  4338. total_price: 0,
  4339. type: 2,
  4340. remark: "",
  4341. title: "",
  4342. id: "",
  4343. is_metal: true,
  4344. },
  4345. ],
  4346. process_obj: JSON.parse(JSON.stringify(this.process_obj)), //工艺属性含选项对象
  4347. };
  4348. obj.process_obj.map((v) => (obj[v.id] = ""));
  4349. } else {
  4350. obj = {
  4351. select_all_id: $event.value,
  4352. type: 1,
  4353. is_metal: true,
  4354. material_id: "",
  4355. product_id: arr[0] * 1,
  4356. title: "",
  4357. price: 0,
  4358. single_price: 0,
  4359. num: 0,
  4360. unit: "",
  4361. };
  4362. }
  4363. this.tableData.splice(rowIndex, 1, obj);
  4364. if (arr[1] === "1") {
  4365. this.changeEditTableData(obj, rowIndex, $event, scope);
  4366. } else {
  4367. this.changeEditMetal(obj, rowIndex, $event, scope);
  4368. }
  4369. this.HandleAutoCreateNewLine();
  4370. }
  4371. },
  4372. changeEditTableData(row, rowIndex, $event, scope) {
  4373. const isCopied = row.isCopied || false;
  4374. if ($event) {
  4375. row.type_name = $event.label;
  4376. row.title = $event.label;
  4377. //被编辑过了 标记
  4378. row.isEdit = true;
  4379. this.axios("/api/order_get_product_detail_new", {
  4380. params: {
  4381. product_id: row.product_id,
  4382. custom_id: this.info.custom_id,
  4383. },
  4384. }).then((res) => {
  4385. this.process_match_list = res.data.process.list;
  4386. this.process_all_list = res.data.process_list;
  4387. this.support_remark = Array.from(
  4388. new Set([...res.data.support_remark, ...this.support_remark])
  4389. );
  4390. this.bpp_list.map((v) => (row[v.id] = ""));
  4391. this.measure_total.map((v) => (row[v.e_title] = ""));
  4392. row.url = res.data.url;
  4393. row.total_num = res.data.total_num || 1;
  4394. row.ext_price = res.data.ext_price || 0;
  4395. row.unit_price = res.data.price || 0;
  4396. row.num = res.data.num || 1;
  4397. row.over_price = res.data.over_price || 0;
  4398. row.unit = res.data.unit || "";
  4399. row.remark = res.data.remark || "";
  4400. row.url_number = res.data.url_number || "";
  4401. row.overdraft = res.data.overdraft;
  4402. row.num_formula = res.data.num_formula;
  4403. if (!row.num_formula) {
  4404. row.num_temp_save = 1;
  4405. }
  4406. row.bp_id = res.data.bp_id;
  4407. // 金额=(产品单价)*核算数量 +附加金额 + 超标金额
  4408. row.price =
  4409. (row.unit_price * 1 || 0) * (row.num * 1 || 1) +
  4410. (row.over_price * 1 || 0) +
  4411. (row.ext_price * 1 || 0);
  4412. row.price = row.price.toFixed(2);
  4413. row.selected_ids = [];
  4414. res.data.part.forEach((element) => {
  4415. // 选择不是附加项目的,
  4416. if (!element.is_metal) {
  4417. // 选择不是线条、或者基础档案中要默认为空的部件
  4418. element.isBP = true;
  4419. element.isChoosed = true;
  4420. element.title = element.part_title;
  4421. element.process = JSON.parse(JSON.stringify(this.bpp_list));
  4422. element.process.forEach((elem) => {
  4423. for (const key in res.data.process.title) {
  4424. const ele = res.data.process.title[key];
  4425. if (elem.name == ele) {
  4426. elem.value = "";
  4427. //tower #2056
  4428. // 开始需求是新增之后带上一条填过的工艺属性,后来又不需要,代码保留。
  4429. // 后来又改成只保留颜色跟线条 颜色的key 为2
  4430. if (key == 2 && row.isCopied) {
  4431. // elem.value = this.pre_process_obj[key] * 1;
  4432. elem.process_id = key;
  4433. }
  4434. if (!element.procedure_properties) {
  4435. element.procedure_properties = {};
  4436. }
  4437. //tower #2056
  4438. if (key == 2 && row.isCopied) {
  4439. element.procedure_properties[key] =
  4440. this.pre_process_obj[key] * 1;
  4441. // element.procedure_properties[key] = "";
  4442. }
  4443. }
  4444. }
  4445. });
  4446. if (element.is_null == 1) {
  4447. element.change_id = "";
  4448. // element.part_title = "";
  4449. // element.title = "";
  4450. } else {
  4451. for (const key in this.pre_process_obj) {
  4452. const item = this.pre_process_obj[key];
  4453. if (key == 2 && row.isCopied) {
  4454. row[key] = item * 1;
  4455. }
  4456. }
  4457. element.change_id = element.change[0].id;
  4458. }
  4459. if (isCopied && element.title.indexOf("线条") != -1) {
  4460. delete this.copiedLinePart.change;
  4461. delete this.copiedLinePart.change_id;
  4462. element = Object.assign(element, this.copiedLinePart);
  4463. }
  4464. element.part_detail = element.sub_part;
  4465. //展示非拆分部件
  4466. // 默认替换部件
  4467. //存计算公式
  4468. element.long ? "" : (element.long = 0);
  4469. element.wide ? "" : (element.wide = 0);
  4470. element.high ? "" : (element.high = 0);
  4471. element.longCalc = element.long + "";
  4472. element.wideCalc = element.wide + "";
  4473. element.highCalc = element.high + "";
  4474. element.part_detail.forEach((elem) => {
  4475. elem.material_detail_title = elem.material_detail_list[0].title;
  4476. elem.material_detail_id =
  4477. elem.material_detail_list[0].material_detail_id;
  4478. elem.part_detail_option = [];
  4479. elem.material_detail_list.map((v) => {
  4480. elem.part_detail_option.push({
  4481. label: `${v.long}*${v.wide}*${v.high}`,
  4482. value: v.material_detail_id,
  4483. });
  4484. });
  4485. elem.org_num = elem.num;
  4486. elem.material_detail_org_num = elem.num || 0;
  4487. elem.material_detail_num = elem.num || 0;
  4488. elem.long ? "" : (elem.long = 0);
  4489. elem.wide ? "" : (elem.wide = 0);
  4490. elem.high ? "" : (elem.high = 0);
  4491. elem.longCalc = elem.long + "";
  4492. elem.wideCalc = elem.wide + "";
  4493. elem.highCalc = elem.high + "";
  4494. elem.material_detail_list.forEach((el) => {
  4495. el.long = el.long || "0";
  4496. el.wide = el.wide || "0";
  4497. el.high = el.high || "0";
  4498. });
  4499. });
  4500. }
  4501. });
  4502. row.part = JSON.parse(JSON.stringify(res.data.part));
  4503. // //测量字段
  4504. row.measure = res.data.measure;
  4505. row.measure.forEach((element) => {
  4506. element.value = "";
  4507. element.measureCalc = element.e_title;
  4508. });
  4509. this.tableData.splice(rowIndex, 1, row);
  4510. this.handleClearExtInfo(row, this.pre_bp_id, res.data.bp_id);
  4511. row.get_first_data = false;
  4512. this.handleCalcCount();
  4513. // this.$forceUpdate();
  4514. });
  4515. }
  4516. },
  4517. changeEditProduct($event) {
  4518. if ($event) {
  4519. let id = $event.value;
  4520. this.modalData.type_name = $event.label;
  4521. this.modalData.title = $event.label;
  4522. this.axios("/api/order_get_product_detail_new", {
  4523. params: { product_id: id, custom_id: this.info.custom_id },
  4524. }).then((res) => {
  4525. if (res.code == 200) {
  4526. this.process_match_list = res.data.process.list;
  4527. this.process_all_list = res.data.process_list;
  4528. this.support_remark = Array.from(
  4529. new Set([...res.data.support_remark, ...this.support_remark])
  4530. );
  4531. // 赋值默认工艺路线
  4532. let _temp_obj = {};
  4533. if (res.data.process.list.length > 1) {
  4534. for (const key in res.data.process.list[0].detail) {
  4535. res.data.process.list.reduce((pre, cur) => {
  4536. if (_temp_obj[key] == "") {
  4537. return pre;
  4538. } else {
  4539. if (pre.detail[key] == cur.detail[key]) {
  4540. _temp_obj[key] = pre.detail[key];
  4541. return pre;
  4542. } else {
  4543. _temp_obj[key] = "";
  4544. return pre;
  4545. }
  4546. }
  4547. });
  4548. }
  4549. } else {
  4550. _temp_obj = res.data.process.list[0].detail;
  4551. }
  4552. this.pre_process_obj = JSON.parse(JSON.stringify(_temp_obj));
  4553. this.modalData.url = res.data.url;
  4554. this.modalData.total_num = res.data.total_num || 1;
  4555. this.modalData.ext_price = res.data.ext_price || 0;
  4556. this.modalData.unit_price = res.data.price || 0;
  4557. this.modalData.num = res.data.num || 1;
  4558. this.modalData.over_price = res.data.over_price || 0;
  4559. this.modalData.unit = res.data.unit || "";
  4560. this.modalData.remark = res.data.remark || "";
  4561. this.modalData.url_number = res.data.url_number || "";
  4562. this.modalData.overdraft = res.data.overdraft;
  4563. this.modalData.num_formula = res.data.num_formula;
  4564. if (!this.modalData.num_formula) {
  4565. this.modalData.num_temp_save = 1;
  4566. }
  4567. this.modalData.bp_id = res.data.bp_id;
  4568. // 金额=(产品单价)*核算数量 +附加金额 + 超标金额
  4569. this.modalData.price =
  4570. (this.modalData.unit_price * 1 || 0) *
  4571. (this.modalData.num * 1 || 1) +
  4572. (this.modalData.over_price * 1 || 0) +
  4573. (this.modalData.ext_price * 1 || 0);
  4574. this.modalData.price = this.modalData.price.toFixed(2);
  4575. // this.modalData.model = res.data.model || ''
  4576. // this.modalData.same_process_compare = JSON.parse(JSON.stringify(res.data.intermediate.same_process || []))
  4577. this.modalData.selected_ids = [];
  4578. this.modalData.part = [];
  4579. this.modalData.part = res.data.part;
  4580. // 数据第一次通过接口获取
  4581. this.modalData.get_first_data = false;
  4582. this.modalData.part.forEach((element, index) => {
  4583. // 选择不是附加项目的,
  4584. if (!element.is_metal) {
  4585. // 选择不是线条、或者基础档案中要默认为空的部件
  4586. element.isBP = true;
  4587. element.isChoosed = true;
  4588. if (element.is_null == 1) {
  4589. element.change_id = "";
  4590. } else {
  4591. element.part_detail = element.sub_part;
  4592. //展示非拆分部件
  4593. // 默认替换部件
  4594. element.change_id = element.change[0].id;
  4595. //存计算公式
  4596. element.long ? "" : (element.long = 0);
  4597. element.wide ? "" : (element.wide = 0);
  4598. element.high ? "" : (element.high = 0);
  4599. element.longCalc = element.long + "";
  4600. element.wideCalc = element.wide + "";
  4601. element.highCalc = element.high + "";
  4602. element.part_detail.forEach((elem) => {
  4603. elem.material_detail_id = 0;
  4604. elem.material_detail_title =
  4605. elem.material_detail_list[0].title;
  4606. elem.material_detail_id =
  4607. elem.material_detail_list[0].material_detail_id;
  4608. elem.org_num = elem.num;
  4609. elem.material_detail_org_num = elem.num || 0;
  4610. elem.material_detail_num = elem.num || 0;
  4611. elem.long ? "" : (elem.long = 0);
  4612. elem.wide ? "" : (elem.wide = 0);
  4613. elem.high ? "" : (elem.high = 0);
  4614. elem.longCalc = elem.long || "";
  4615. elem.wideCalc = elem.wide || "";
  4616. elem.highCalc = elem.high || "";
  4617. elem.material_detail_list.forEach((el) => {
  4618. el.long = el.long || "0";
  4619. el.wide = el.wide || "0";
  4620. el.high = el.high || "0";
  4621. });
  4622. });
  4623. element.part_detail.map((_part_detail) => {
  4624. _part_detail.material_detail_org_num =
  4625. _part_detail.num || 0;
  4626. _part_detail.part_detail_option = [];
  4627. _part_detail.material_detail_list.map((v) => {
  4628. _part_detail.part_detail_option.push({
  4629. label: `${v.long}*${v.wide}*${v.high}`,
  4630. value: v.material_detail_id,
  4631. });
  4632. });
  4633. });
  4634. }
  4635. }
  4636. });
  4637. //测量字段
  4638. this.modalData.measure = res.data.measure;
  4639. this.modalData.measure.forEach((element) => {
  4640. element.value = "";
  4641. element.measureCalc = element.e_title;
  4642. });
  4643. //工艺属性
  4644. this.modalData.process_obj = [];
  4645. for (const k in res.data.process.title) {
  4646. this.process_obj.map((v) => {
  4647. if (v.id == k) {
  4648. this.modalData.process_obj.push(v);
  4649. }
  4650. });
  4651. }
  4652. this.modalData.part.forEach((element) => {
  4653. if (!element.is_metal) {
  4654. //赋值默认工艺属性
  4655. element.process = JSON.parse(JSON.stringify(this.bpp_list));
  4656. element.process.forEach((elem, index) => {
  4657. for (const key in res.data.process.title) {
  4658. const ele = res.data.process.title[key];
  4659. if (elem.name == ele) {
  4660. elem.value = this.pre_process_obj[key] * 1;
  4661. elem.process_id = key;
  4662. if (!element.procedure_properties) {
  4663. element.procedure_properties = {};
  4664. }
  4665. element.procedure_properties[key] =
  4666. this.pre_process_obj[key] * 1;
  4667. }
  4668. }
  4669. });
  4670. }
  4671. });
  4672. // this.handleClearExtInfo(
  4673. // this.modalData,
  4674. // this.pre_bp_id,
  4675. // res.data.bp_id
  4676. // );
  4677. // 是否有上一个的工艺属性ID
  4678. this.chooseLastRouteId(this.modalData, res);
  4679. this.$forceUpdate();
  4680. }
  4681. });
  4682. }
  4683. },
  4684. footerMethod({ columns, data }) {
  4685. return [
  4686. columns.map((column, columnIndex) => {
  4687. if (columnIndex === 0) {
  4688. return "合计";
  4689. }
  4690. if (column.title == "附加金额") {
  4691. let sum = 0;
  4692. data.map((v) => {
  4693. v.is_metal ? (sum += v.price * 1) : (sum += v.ext_price * 1);
  4694. });
  4695. return sum;
  4696. }
  4697. if (column.title == "总金额") {
  4698. let sum = 0;
  4699. data.map((v) => {
  4700. v.is_metal ? (sum += v.price * 1) : (sum += v.price * 1);
  4701. });
  4702. this.info.predict_price = sum.toFixed(2);
  4703. return sum.toFixed(2);
  4704. }
  4705. return null;
  4706. }),
  4707. ];
  4708. },
  4709. chooseLastRouteId(modalData, res) {
  4710. // 匹配
  4711. modalData.process_obj.forEach((element) => {
  4712. for (const key in this.pre_process_obj) {
  4713. const item = this.pre_process_obj[key];
  4714. const compare = res.data.process.list.filter(
  4715. (_process) => _process.detail[key] == this.pre_process_obj[key]
  4716. );
  4717. if (element.id == key) {
  4718. if (compare.length > 0) {
  4719. element.value = item * 1;
  4720. } else {
  4721. element.value = "";
  4722. }
  4723. }
  4724. }
  4725. });
  4726. this.$forceUpdate();
  4727. },
  4728. changeProductOnEdit(row, n) {
  4729. if (row) {
  4730. this.modalData.type_name = row.label;
  4731. this.modalData.title = row.label;
  4732. this.axios("/api/order_get_product_detail_new", {
  4733. params: {
  4734. product_id: row.product_id,
  4735. custom_id: this.info.custom_id,
  4736. },
  4737. }).then((res) => {
  4738. if (res.code == 200) {
  4739. this.support_remark = Array.from(
  4740. new Set([...res.data.support_remark, ...this.support_remark])
  4741. );
  4742. this.process_match_list = res.data.process.list;
  4743. this.process_all_list = res.data.process_list;
  4744. //获取产品
  4745. this.modalData.total_num = res.data.total_num || 1;
  4746. this.modalData.ext_price = res.data.ext_price || 0;
  4747. this.modalData.unit_price = res.data.price || 0;
  4748. this.modalData.num = res.data.num || 1;
  4749. this.modalData.num_temp_save = res.data.num || 1;
  4750. this.modalData.over_price = res.data.over_price || 0;
  4751. this.modalData.unit = res.data.unit || "";
  4752. this.modalData.remark = res.data.remark || "";
  4753. this.modalData.url = res.data.url || [];
  4754. this.modalData.url_number = res.data.url_number || "";
  4755. this.modalData.overdraft = res.data.overdraft;
  4756. this.modalData.bp_id = res.data.bp_id;
  4757. // this.modalData.same_process_compare = JSON.parse(JSON.stringify(res.data.intermediate.same_process || []))
  4758. this.modalData.selected_ids = [];
  4759. this.modalData.customize = row.customize;
  4760. this.modalData.get_first_data = false;
  4761. this.modalData.part = res.data.part;
  4762. this.modalData.part.forEach((element) => {
  4763. if (!element.is_metal) {
  4764. element.isBP = true;
  4765. element.isChoosed = true;
  4766. element.part_detail = element.sub_part;
  4767. // 数据第一次通过接口获取
  4768. //展示非拆分部件
  4769. //存计算公式
  4770. element.longCalc = element.long || "";
  4771. element.wideCalc = element.wide || "";
  4772. element.highCalc = element.high || "";
  4773. element.part_detail.forEach((elem) => {
  4774. elem.org_num = elem.num;
  4775. elem.material_detail_id = 0;
  4776. elem.material_detail_title =
  4777. elem.material_detail_list[0].title;
  4778. elem.material_detail_num = elem.num || 0;
  4779. elem.material_detail_org_num = elem.num || 0;
  4780. elem.longCalc = elem.long || "";
  4781. elem.wideCalc = elem.wide || "";
  4782. elem.highCalc = elem.high || "";
  4783. elem.material_detail_list.forEach((el) => {
  4784. el.long = el.long || "0";
  4785. el.wide = el.wide || "0";
  4786. el.high = el.high || "0";
  4787. });
  4788. });
  4789. }
  4790. });
  4791. //测量字段
  4792. this.modalData.measure = res.data.measure;
  4793. this.modalData.measure.forEach((element) => {
  4794. element.measureCalc = element.e_title;
  4795. });
  4796. //工艺属性
  4797. this.modalData.part.forEach((element) => {
  4798. if (!element.is_metal) {
  4799. element.process = JSON.parse(JSON.stringify(this.process_obj));
  4800. element.process.forEach((elem) => {
  4801. elem.value = "";
  4802. });
  4803. }
  4804. });
  4805. this.modalData.process_obj = [];
  4806. for (const k in res.data.process.title) {
  4807. this.process_obj.map((v) => {
  4808. if (v.id == k) {
  4809. this.modalData.process_obj.push(v);
  4810. }
  4811. });
  4812. }
  4813. (this.type == 2 || this.type == 3) &&
  4814. this.getEditData(this.modalData, this.editForm);
  4815. this.showEditProduct = true;
  4816. this.$forceUpdate();
  4817. }
  4818. });
  4819. }
  4820. },
  4821. handeMTBSelection($event, row) {
  4822. this.axios
  4823. .post("/api/get_part_detail_material", {
  4824. id: $event.value,
  4825. })
  4826. .then((res) => {
  4827. this.modalData.part.map((part) => {
  4828. if (part.part_id === 25) {
  4829. res.data.sub_part.map((v) => {
  4830. v.material_detail_id =
  4831. v.material_detail_list[0].material_detail_id;
  4832. v.material_detail_num = 1;
  4833. });
  4834. part.part_detail = res.data.sub_part;
  4835. part.long = res.data.long;
  4836. part.high = res.data.high;
  4837. part.wide = res.data.wide;
  4838. part.route_id = res.data.route_id;
  4839. part.process = res.data.process;
  4840. }
  4841. });
  4842. });
  4843. },
  4844. handlePartChange($event, row, measure, product_num) {
  4845. if (row.part_id === 25) {
  4846. this.handeMTBSelection($event, row);
  4847. } else {
  4848. if ($event) {
  4849. let cur = row.change.filter((item) => item.id == row.change_id);
  4850. row.part_title = cur[0].part_title;
  4851. // row.title = cur[0].part_title;
  4852. row.org_part_id = row.part_id;
  4853. row.part_id = cur[0].part_id;
  4854. row.high = cur[0].high || 0;
  4855. row.highCalc = row.high;
  4856. row.long = cur[0].long || 0;
  4857. row.longCalc = row.long;
  4858. row.wide = cur[0].wide || 0;
  4859. row.wideCalc = row.wide;
  4860. row.sub_part = cur[0].sub_part;
  4861. row.part_detail = row.sub_part;
  4862. row.part_detail.forEach((elem) => {
  4863. elem.longCalc = elem.long || "";
  4864. elem.wideCalc = elem.wide || "";
  4865. elem.highCalc = elem.high || "";
  4866. elem.org_num = elem.num;
  4867. elem.material_detail_org_num = elem.num || 0;
  4868. elem.num =
  4869. ((elem.material_detail_org_num || elem.num) * product_num) | 0;
  4870. elem.material_detail_num =
  4871. elem.material_detail_org_num * product_num;
  4872. });
  4873. row.part_detail.map((_part_detail) => {
  4874. _part_detail.material_detail_org_num = _part_detail.num || 0;
  4875. _part_detail.part_detail_option = [];
  4876. _part_detail.material_detail_list.map((v) => {
  4877. _part_detail.part_detail_option.push({
  4878. label: `${v.long}*${v.wide}*${v.high}`,
  4879. value: v.material_detail_id,
  4880. });
  4881. });
  4882. });
  4883. measure.forEach((element) => {
  4884. if ((row.long + "").indexOf(element.measureCalc) != -1) {
  4885. if (typeof (element.value * 1) == "number") {
  4886. row.long = row.long.replace(
  4887. new RegExp(element.measureCalc, "g"),
  4888. element.value | ""
  4889. );
  4890. row.long = eval(row.long);
  4891. row.long += "";
  4892. } else {
  4893. row.long = "";
  4894. }
  4895. }
  4896. if ((row.wide + "").indexOf(element.measureCalc) != -1) {
  4897. if (typeof (element.value * 1) == "number") {
  4898. row.wide = row.wide.replace(
  4899. new RegExp(element.measureCalc, "g"),
  4900. element.value | ""
  4901. );
  4902. row.wide = eval(row.wide);
  4903. row.wide += "";
  4904. } else {
  4905. row.wide = "";
  4906. }
  4907. }
  4908. if ((row.high + "").indexOf(element.measureCalc) != -1) {
  4909. if (typeof (element.value * 1) == "number") {
  4910. row.high = row.high.replace(
  4911. new RegExp(element.measureCalc, "g"),
  4912. element.value | ""
  4913. );
  4914. row.high = eval(row.high);
  4915. row.high += "";
  4916. } else {
  4917. row.high = "";
  4918. }
  4919. }
  4920. row.part_detail.forEach((item) => {
  4921. item.num =
  4922. row.material_detail_org_num || item.material_detail_org_num;
  4923. if ((item.long || "").indexOf(element.measureCalc) != -1) {
  4924. if (typeof (element.value * 1) == "number") {
  4925. item.long = item.long.replace(
  4926. new RegExp(element.measureCalc, "g"),
  4927. element.value
  4928. );
  4929. try {
  4930. item.long = eval(item.long);
  4931. item.long += "";
  4932. } catch (error) {
  4933. item.long = "";
  4934. }
  4935. }
  4936. }
  4937. if ((item.wide || "").indexOf(element.measureCalc) != -1) {
  4938. if (typeof (element.value * 1) == "number") {
  4939. item.wide = item.wide.replace(
  4940. new RegExp(element.measureCalc, "g"),
  4941. element.value
  4942. );
  4943. try {
  4944. item.wide = eval(item.wide);
  4945. item.wide += "";
  4946. } catch (error) {
  4947. item.wide = "";
  4948. }
  4949. }
  4950. }
  4951. if ((item.high || "").indexOf(element.measureCalc) != -1) {
  4952. if (typeof (element.value * 1) == "number") {
  4953. item.high = item.high.replace(
  4954. new RegExp(element.measureCalc, "g"),
  4955. element.value
  4956. );
  4957. try {
  4958. item.high = eval(item.high);
  4959. item.high += "";
  4960. } catch (error) {
  4961. item.high = "";
  4962. }
  4963. }
  4964. }
  4965. item.material_detail_list.forEach((it) => {
  4966. it.long = it.long || "0";
  4967. it.wide = it.wide || "0";
  4968. it.high = it.high || "0";
  4969. });
  4970. item.long = item.long || "0";
  4971. item.wide = item.wide || "0";
  4972. item.high = item.high || "0";
  4973. item.material_detail_title = item.material_detail_list[0].title;
  4974. item.material_detail_id =
  4975. item.material_detail_list[0].material_detail_id;
  4976. item.material_detail_org_num = item.num || 0;
  4977. });
  4978. });
  4979. } else {
  4980. row.change_id = "";
  4981. }
  4982. }
  4983. this.$forceUpdate();
  4984. },
  4985. handleProductNumChange(e, product) {
  4986. product.part.map((element) => {
  4987. element.part_detail.map((elem) => {
  4988. elem.material_detail_num =
  4989. e.target.value * elem.material_detail_org_num;
  4990. });
  4991. });
  4992. product.total_num = e.target.value;
  4993. product.num = (product.total_num * product.num_temp_save).toFixed(2);
  4994. product.price =
  4995. (product.unit_price * 1 || 0) * (product.num * 1 || 1) +
  4996. (product.over_price * 1 || 0) +
  4997. (product.ext_price * 1 || 0);
  4998. product.price = product.price.toFixed(2);
  4999. this.$forceUpdate();
  5000. },
  5001. handleProductUnit_priceChange(e, product) {
  5002. product.unit_price = e.target.value * 1;
  5003. product.price =
  5004. (product.unit_price * 1 || 0) * (product.num * 1 || 1) +
  5005. (product.over_price * 1 || 0) +
  5006. (product.ext_price * 1 || 0);
  5007. product.price = product.price.toFixed(2);
  5008. this.handleCalcCount();
  5009. // this.$forceUpdate();
  5010. },
  5011. handleProductExt_priceChange(e, product) {
  5012. product.ext_price = e.target.value * 1;
  5013. product.price =
  5014. (product.unit_price * 1 || 0) * (product.num * 1 || 1) +
  5015. (product.over_price * 1 || 0) +
  5016. (product.ext_price * 1 || 0);
  5017. product.price = product.price.toFixed(2);
  5018. this.$forceUpdate();
  5019. },
  5020. handleProductOver_priceChange(e, product) {
  5021. product.over_price = e.target.value * 1;
  5022. product.price =
  5023. (product.unit_price * 1 || 0) * (product.num * 1 || 1) +
  5024. (product.over_price * 1 || 0) +
  5025. (product.ext_price * 1 || 0);
  5026. product.price = product.price.toFixed(2);
  5027. this.$forceUpdate();
  5028. },
  5029. handleGetProductMeasure(e, e_title, scope) {
  5030. if (scope.row.part.filter((v) => !v.change_id).length > 0) {
  5031. scope.row[e_title] = "";
  5032. scope.row.measure.map((v) => {
  5033. v.e_title == e_title && (v.value = "");
  5034. });
  5035. this.tableData.splice(
  5036. scope.rowIndex,
  5037. 1,
  5038. JSON.parse(JSON.stringify(scope.row))
  5039. );
  5040. this.$forceUpdate();
  5041. return this.$Message.warning("请先选择部件!");
  5042. }
  5043. },
  5044. handleGetProductProcess(val, index, product, ele) {
  5045. if (val) {
  5046. let change = [];
  5047. if (product.part.filter((v) => !v.change_id).length > 0) {
  5048. ele.cld = [];
  5049. this.$forceUpdate();
  5050. return this.$Message.warning("请先选择部件!");
  5051. }
  5052. product.part.map((item) => {
  5053. change.push({
  5054. old_id: item.org_part_id || item.part_id,
  5055. new_id: item.change.filter((v) => v.id == item.change_id)[0]
  5056. .part_id,
  5057. });
  5058. });
  5059. let list = product.process_obj.map((item) => {
  5060. return { type_id: item.key || item.id, value: item.value || "" };
  5061. });
  5062. this.axios({
  5063. method: "post",
  5064. url: "/api/order_get_product_process",
  5065. data: {
  5066. product_id: product.product_id,
  5067. type_id: ele.key || ele.id,
  5068. list,
  5069. change,
  5070. },
  5071. }).then((res) => {
  5072. if (res.code == 200) {
  5073. (ele.cld = []), (ele.cld = res.data);
  5074. } else {
  5075. ele.cld = [];
  5076. }
  5077. this.$forceUpdate();
  5078. });
  5079. }
  5080. },
  5081. // 查找最接近
  5082. handleFindNearest(array, value) {
  5083. const temp = JSON.parse(JSON.stringify(array));
  5084. temp.sort((a, b) => {
  5085. return Math.abs(a.long - value) - Math.abs(b.long - value);
  5086. });
  5087. return temp[0].material_detail_id;
  5088. },
  5089. handleCalcPartDetailLong(part_detail, product) {
  5090. for (const key in product.measure) {
  5091. const element = product.measure[key];
  5092. if (element.value) {
  5093. part_detail._longCalc = part_detail.longCalc.replace(
  5094. new RegExp(element.e_title, "g"),
  5095. element.value || ""
  5096. );
  5097. }
  5098. }
  5099. try {
  5100. eval(part_detail._longCalc);
  5101. } catch (error) {
  5102. for (const key in product.measure) {
  5103. const element = product.measure[key];
  5104. part_detail._longCalc = part_detail._longCalc.replace(
  5105. new RegExp(element.e_title, "g"),
  5106. element.value || ""
  5107. );
  5108. }
  5109. }
  5110. return part_detail._longCalc;
  5111. },
  5112. handleIsSpecialPart(product, element) {
  5113. let line = [];
  5114. let flag = false;
  5115. product.part.map((part) => {
  5116. part.part_title.indexOf("线条") != -1 && (line = part.change);
  5117. part.part_title.indexOf("门头板") != -1 && (flag = true);
  5118. });
  5119. this.handleCalcLines(product, line, flag);
  5120. },
  5121. handleCalcLines(product, line, isSpecialPart) {
  5122. const process_ids = product.process_obj.map((v) => {
  5123. return v.value;
  5124. });
  5125. const part_ids = line.map((v) => {
  5126. return v.part_id;
  5127. });
  5128. this.axios
  5129. .post("/api/process_part_for_product", {
  5130. product_id: product.product_id,
  5131. process_ids,
  5132. part_ids,
  5133. })
  5134. .then((res) => {
  5135. for (const key in res.data) {
  5136. const element = res.data[key];
  5137. // 找到部件
  5138. let part_arr = {};
  5139. product.part.map((v) => {
  5140. if (v.part_id == key) {
  5141. part_arr = v;
  5142. }
  5143. });
  5144. for (const k in element) {
  5145. const elem = element[k];
  5146. // 找到零部件
  5147. elem.map((match_item) => {
  5148. // 特殊部件 门头板, 需要在原有产品测量字段H上增加门头板的H
  5149. if (isSpecialPart) {
  5150. product.part.map((v) => {
  5151. if (match_item.e_title == "H") {
  5152. if (
  5153. match_item.max > v.long * 1 + product["H"] * 1 &&
  5154. match_item.min <= v.long * 1 + product["H"] * 1
  5155. ) {
  5156. part_arr &&
  5157. part_arr.part_detail &&
  5158. part_arr.part_detail.map((v) => {
  5159. if (v.part_detail_id == k) {
  5160. v.material_detail_id =
  5161. match_item.material_detail_id;
  5162. v.material_detail_org_num = match_item.num;
  5163. v.material_detail_num = match_item.num;
  5164. }
  5165. });
  5166. }
  5167. } else {
  5168. if (
  5169. match_item.max > product[match_item.e_title] &&
  5170. match_item.min <= product[match_item.e_title]
  5171. ) {
  5172. part_arr &&
  5173. part_arr.part_detail &&
  5174. part_arr.part_detail.map((v) => {
  5175. if (v.part_detail_id == k) {
  5176. v.material_detail_id =
  5177. match_item.material_detail_id;
  5178. v.material_detail_org_num = match_item.num;
  5179. v.material_detail_num = match_item.num;
  5180. }
  5181. });
  5182. }
  5183. }
  5184. });
  5185. } else {
  5186. if (
  5187. match_item.max > product[match_item.e_title] &&
  5188. match_item.min <= product[match_item.e_title]
  5189. ) {
  5190. part_arr &&
  5191. part_arr.part_detail &&
  5192. part_arr.part_detail.map((v) => {
  5193. if (v.part_detail_id == k) {
  5194. v.material_detail_id = match_item.material_detail_id;
  5195. v.material_detail_org_num = match_item.num;
  5196. v.material_detail_num = match_item.num;
  5197. }
  5198. });
  5199. }
  5200. }
  5201. });
  5202. }
  5203. }
  5204. this.handleCalcCount();
  5205. this.$forceUpdate();
  5206. });
  5207. },
  5208. handleProductMeasureBlur(e, product, measure_detail) {
  5209. this.handleProductMeasureChange(e, product, measure_detail);
  5210. if (e.target.value) {
  5211. try {
  5212. measure_detail.value = eval(e.target.value);
  5213. } catch (error) {
  5214. console.log("error :>> ", error);
  5215. }
  5216. product.part.map((part) => {
  5217. part.part_title ? "" : (part.part_title = part.title);
  5218. part.part_title.indexOf("线条") != -1 && (line = part.change);
  5219. part.part_detail &&
  5220. part.part_detail.length > 0 &&
  5221. part.part_detail.map((part_detail) => {
  5222. part_detail._longCalc = this.handleCalcPartDetailLong(
  5223. part_detail,
  5224. product
  5225. );
  5226. if (part_detail.material_detail_list.length > 1) {
  5227. try {
  5228. part_detail.longCalcFinal = eval(part_detail._longCalc);
  5229. // part_detail.material_detail_id = this.handleFindNearest(
  5230. // part_detail.material_detail_list,
  5231. // part_detail.longCalcFinal
  5232. // );
  5233. } catch (error) {
  5234. console.log("error :>> ", error);
  5235. }
  5236. }
  5237. });
  5238. });
  5239. product.process_obj.map((v) => {
  5240. v.value ? "" : (v.value = product[v.id]);
  5241. });
  5242. let line = [];
  5243. let flag = false;
  5244. product.part.map((part) => {
  5245. part.part_title.indexOf("线条") != -1 && (line = part.change);
  5246. part.part_title.indexOf("门头板") != -1 && (flag = true);
  5247. });
  5248. this.handleCalcLines(product, line, flag);
  5249. }
  5250. },
  5251. handleProductMeasureChange(e, product, measure_detail) {
  5252. if (e.target.value) {
  5253. let cur_measure = measure_detail.measureCalc;
  5254. let cur_value = e.target.value;
  5255. product[cur_measure] = cur_value;
  5256. //当前测量字段 L W H 修改部件测量字段
  5257. product.part.forEach((element) => {
  5258. if (!element.is_metal) {
  5259. element.highCalc = element.highCalc + "";
  5260. element.longCalc = element.longCalc + "";
  5261. element.wideCalc = element.wideCalc + "";
  5262. //处理公式
  5263. if (element.highCalc.indexOf(cur_measure) != -1) {
  5264. element.high = element.highCalc.replace(
  5265. new RegExp(cur_measure, "g"),
  5266. cur_value || ""
  5267. );
  5268. }
  5269. if (element.longCalc.indexOf(cur_measure) != -1) {
  5270. element.long = element.longCalc.replace(
  5271. new RegExp(cur_measure, "g"),
  5272. cur_value || ""
  5273. );
  5274. }
  5275. if (element.wideCalc.indexOf(cur_measure) != -1) {
  5276. element.wide = element.wideCalc.replace(
  5277. new RegExp(cur_measure, "g"),
  5278. cur_value || ""
  5279. );
  5280. }
  5281. //判断测量字段公式中是否还含有字母
  5282. let flag_high = false;
  5283. let flag_long = false;
  5284. let flag_wide = false;
  5285. for (let index = 0; index < product.measure.length; index++) {
  5286. const item = product.measure[index];
  5287. if (element.high.indexOf(item.measureCalc) != -1) {
  5288. flag_high = true;
  5289. }
  5290. if (element.long.indexOf(item.measureCalc) != -1) {
  5291. flag_long = true;
  5292. }
  5293. if (element.wide.indexOf(item.measureCalc) != -1) {
  5294. flag_wide = true;
  5295. }
  5296. }
  5297. if (flag_high) {
  5298. } else {
  5299. element.high = eval(element.high);
  5300. element.high += "";
  5301. }
  5302. if (flag_long) {
  5303. } else {
  5304. element.long = eval(element.long);
  5305. element.long += "";
  5306. }
  5307. if (flag_wide) {
  5308. } else {
  5309. element.wide = eval(element.wide);
  5310. element.wide += "";
  5311. }
  5312. element.part_detail.forEach((elem) => {
  5313. elem.highCalc = elem.high + "";
  5314. elem.longCalc = elem.long + "";
  5315. elem.wideCalc = elem.wide + "";
  5316. if (!elem.high) {
  5317. } else if (elem.highCalc.indexOf(cur_measure) != -1) {
  5318. elem.high = elem.highCalc.replace(
  5319. new RegExp(cur_measure, "g"),
  5320. cur_value || ""
  5321. );
  5322. }
  5323. if (!elem.long) {
  5324. } else if (elem.longCalc.indexOf(cur_measure) != -1) {
  5325. elem.long = elem.longCalc.replace(
  5326. new RegExp(cur_measure, "g"),
  5327. cur_value || ""
  5328. );
  5329. }
  5330. if (!elem.wide) {
  5331. } else if (elem.wideCalc.indexOf(cur_measure) != -1) {
  5332. elem.wide = elem.wideCalc.replace(
  5333. new RegExp(cur_measure, "g"),
  5334. cur_value || ""
  5335. );
  5336. }
  5337. //判断测量字段公式中是否还含有字母
  5338. let _flag_high = false;
  5339. let _flag_long = false;
  5340. let _flag_wide = false;
  5341. // Number类型无法使用indexOf
  5342. elem.high += "";
  5343. elem.long += "";
  5344. elem.wide += "";
  5345. for (let index = 0; index < product.measure.length; index++) {
  5346. const item = product.measure[index];
  5347. if (!elem.high) {
  5348. } else if (elem.high.indexOf(item.measureCalc) != -1) {
  5349. _flag_high = true;
  5350. }
  5351. if (!elem.long) {
  5352. } else if (elem.long.indexOf(item.measureCalc) != -1) {
  5353. _flag_long = true;
  5354. }
  5355. if (!elem.wide) {
  5356. } else if (elem.wide.indexOf(item.measureCalc) != -1) {
  5357. _flag_wide = true;
  5358. }
  5359. }
  5360. if (_flag_high) {
  5361. } else {
  5362. elem.high = eval(elem.high);
  5363. elem.high += "";
  5364. elem.high == "null" && (elem.high = 0);
  5365. }
  5366. if (_flag_long) {
  5367. } else {
  5368. elem.long = eval(elem.long);
  5369. elem.long += "";
  5370. elem.long == "null" && (elem.long = 0);
  5371. }
  5372. if (_flag_wide) {
  5373. } else {
  5374. elem.wide = eval(elem.wide);
  5375. elem.wide += "";
  5376. elem.wide == "null" && (elem.wide = 0);
  5377. }
  5378. });
  5379. }
  5380. });
  5381. product.over_price = 0;
  5382. product.part.map((item) => {
  5383. const cur_part = product.overdraft.filter(
  5384. (v) => v.part_id == item.part_id
  5385. );
  5386. cur_part.length > 0 &&
  5387. cur_part.map((element) => {
  5388. // 1 高 2 宽 3 厚
  5389. if (
  5390. element.type == 1 &&
  5391. item.long >= element.min &&
  5392. item.long < element.max
  5393. ) {
  5394. item.formula_temp = JSON.parse(JSON.stringify(element.formula));
  5395. item.formula_temp = item.formula_temp.replace(/H/g, item.long);
  5396. item.formula_temp = item.formula_temp.replace(/W/g, item.wide);
  5397. item.formula_temp = item.formula_temp.replace(/T/g, item.high);
  5398. item.formula_value = eval(item.formula_temp);
  5399. product.over_price =
  5400. product.over_price * 1 + item.formula_value * 1;
  5401. }
  5402. if (
  5403. element.type == 2 &&
  5404. item.wide >= element.min &&
  5405. item.wide < element.max
  5406. ) {
  5407. item.formula_temp = JSON.parse(JSON.stringify(element.formula));
  5408. item.formula_temp = item.formula_temp.replace(/H/g, item.long);
  5409. item.formula_temp = item.formula_temp.replace(/W/g, item.wide);
  5410. item.formula_temp = item.formula_temp.replace(/T/g, item.high);
  5411. item.formula_value = eval(item.formula_temp).toFixed(2);
  5412. product.over_price =
  5413. product.over_price * 1 + item.formula_value * 1;
  5414. }
  5415. if (
  5416. element.type == 3 &&
  5417. item.high >= element.min &&
  5418. item.high < element.max
  5419. ) {
  5420. item.formula_temp = JSON.parse(JSON.stringify(element.formula));
  5421. item.formula_temp = item.formula_temp.replace(/H/g, item.long);
  5422. item.formula_temp = item.formula_temp.replace(/W/g, item.wide);
  5423. item.formula_temp = item.formula_temp.replace(/T/g, item.high);
  5424. item.formula_value = eval(item.formula_temp);
  5425. product.over_price =
  5426. product.over_price * 1 + item.formula_value * 1;
  5427. }
  5428. });
  5429. });
  5430. //修改核算数量
  5431. // 如果没有核算数量公式,核算数量取产品数量
  5432. if (product.num_formula == "") {
  5433. product.total_num = product.num;
  5434. } else {
  5435. product.num_formula_temp = product.num_formula;
  5436. product.measure.forEach((element) => {
  5437. if (product.num_formula.indexOf(element.e_title) != -1) {
  5438. product.num_formula_temp = product.num_formula_temp.replace(
  5439. new RegExp(element.e_title, "g"),
  5440. element.value || 0
  5441. );
  5442. }
  5443. });
  5444. product.num = eval(product.num_formula_temp);
  5445. }
  5446. product.num = Number(product.num).toFixed(2);
  5447. product.over_price = Number(product.over_price).toFixed(2);
  5448. product.num_temp_save = product.num || 1;
  5449. product.price =
  5450. (product.unit_price * 1 || 0) * (product.num * 1 || 1) +
  5451. (product.over_price * 1 || 0) +
  5452. (product.ext_price * 1 || 0);
  5453. product.price = product.price.toFixed(2);
  5454. }
  5455. this.$forceUpdate();
  5456. },
  5457. handleSubpartNumChange(e, row) {
  5458. row.material_detail_num = e.target.value;
  5459. this.$forceUpdate();
  5460. },
  5461. //修改材质/颜色/工艺的
  5462. handleProductProcessChange(e, n, modelData, ele) {
  5463. if (e) {
  5464. this.pre_process_obj[ele.id] = e.value;
  5465. modelData[ele.id] = e.value;
  5466. if (!modelData.procedure_properties_str) {
  5467. modelData.procedure_properties_str = [];
  5468. }
  5469. modelData.procedure_properties_str[ele.id - 1] = e.label;
  5470. if (!modelData.procedure_properties) {
  5471. modelData.procedure_properties = {};
  5472. }
  5473. modelData.procedure_properties[ele.id] = e.value;
  5474. let isStart = true;
  5475. // let match_list = []; //当前选中的list
  5476. // this.process_match_list.map((item) => {
  5477. // if (item.detail[ele.id] == e.value) {
  5478. // match_list.push(item.detail);
  5479. // }
  5480. // });
  5481. // this.process_Select_match_list = match_list;
  5482. modelData.process_obj.forEach((element) => {
  5483. if (element.value == "") {
  5484. isStart = false;
  5485. }
  5486. });
  5487. //匹配工艺路线
  5488. if (isStart) {
  5489. let _target = [];
  5490. let _sorce = JSON.parse(JSON.stringify(this.process_match_list));
  5491. modelData.process_obj.forEach((element) => {
  5492. _target.push(element.value);
  5493. });
  5494. _sorce.forEach((element) => {
  5495. let _str = [];
  5496. for (const key in element.detail) {
  5497. const item = element.detail[key];
  5498. _str.push(item);
  5499. }
  5500. element.new_detail = _str.join(",");
  5501. });
  5502. let target = _target.join(",");
  5503. _sorce.forEach((element) => {
  5504. if (element.new_detail == target) {
  5505. modelData.route_id = element.id;
  5506. }
  5507. });
  5508. }
  5509. // 产品 - 部件 工艺属性联动
  5510. modelData.part.forEach((element) => {
  5511. if (!element.is_metal) {
  5512. element.process.forEach((elem) => {
  5513. if (elem.name == ele.name) {
  5514. elem.value = e.value;
  5515. if (!element.procedure_properties) {
  5516. element.procedure_properties = {};
  5517. }
  5518. if (!element.procedure_properties_str) {
  5519. element.procedure_properties_str = [];
  5520. }
  5521. element.procedure_properties[ele.id] = e.value;
  5522. element.procedure_properties_str[n] = e.label;
  5523. }
  5524. });
  5525. }
  5526. });
  5527. } else {
  5528. modelData.route_id = "";
  5529. if (typeof modelData.procedure_properties == "string") {
  5530. modelData.procedure_properties = modelData.procedure_properties.split(
  5531. ","
  5532. );
  5533. }
  5534. modelData.procedure_properties[ele.id] = "";
  5535. modelData[ele.id] = "";
  5536. }
  5537. this.$forceUpdate();
  5538. },
  5539. handlePriceFocus() {
  5540. if (this.modalData.price == 0.0 || this.modalData.price == 0) {
  5541. this.modalData.price = "";
  5542. }
  5543. },
  5544. handleUnitPriceFocus() {
  5545. if (this.modalData.unit_price == 0.0 || this.modalData.unit_price == 0) {
  5546. this.modalData.unit_price = "";
  5547. }
  5548. },
  5549. handleExtPriceFocus() {
  5550. if (this.modalData.ext_price == 0.0 || this.modalData.ext_price == 0) {
  5551. this.modalData.ext_price = "";
  5552. }
  5553. },
  5554. handleOverPriceFocus() {
  5555. if (this.modalData.over_price == 0.0 || this.modalData.over_price == 0) {
  5556. this.modalData.over_price = "";
  5557. }
  5558. },
  5559. handleMaterialChange(val, row) {
  5560. if (val) {
  5561. let tempRow = row.material_detail_list.filter(
  5562. (item) => item.material_detail_id == val
  5563. );
  5564. row.material_detail_title = tempRow[0].title;
  5565. // row.material_detail_id = tempRow.length > 0 ? tempRow[0].id : 0
  5566. this.$forceUpdate();
  5567. }
  5568. },
  5569. handleRadioClick(row) {
  5570. row.isChoosed = !row.isChoosed;
  5571. this.$forceUpdate();
  5572. },
  5573. handlePartProcessChange(val, n, row, process_detail) {
  5574. if (!row.procedure_properties) {
  5575. row.procedure_properties = {};
  5576. }
  5577. if (!row.procedure_properties_str) {
  5578. row.procedure_properties_str = [];
  5579. }
  5580. if (val) {
  5581. row.procedure_properties[process_detail.id] = val.value;
  5582. row.procedure_properties_str[n] = val.label;
  5583. } else {
  5584. row.procedure_properties[process_detail.id] = "";
  5585. row.procedure_properties_str[n] = "";
  5586. }
  5587. this.$forceUpdate();
  5588. },
  5589. looks(img) {
  5590. const array = [{ img_url: img }];
  5591. this.$previewImg({
  5592. list: array,
  5593. baseUrl: this.$store.state.ip,
  5594. baseImgField: "img_url",
  5595. baseTitleField: "",
  5596. });
  5597. },
  5598. delItems(n, arr) {
  5599. arr.splice(n, 1);
  5600. this.$forceUpdate();
  5601. },
  5602. changeIpt(e, row) {
  5603. if (this.info.img.length >= 3) {
  5604. return this.$Message.warning("图片最多上传3张");
  5605. }
  5606. let file = e.target.files[0];
  5607. this.postImg(file, row);
  5608. e.target.value = null;
  5609. },
  5610. postImg(file, row) {
  5611. let formData = new FormData();
  5612. formData.append("file", file);
  5613. this.axios.post("/api/upload_pic", formData).then((res) => {
  5614. row.push(res.data.url);
  5615. this.$forceUpdate();
  5616. });
  5617. },
  5618. },
  5619. };
  5620. </script>
  5621. <style lang="scss" scoped>
  5622. .product-img {
  5623. padding-top: 10px;
  5624. }
  5625. .product-add {
  5626. padding: 10px 0;
  5627. display: flex;
  5628. flex-wrap: wrap;
  5629. .ipt {
  5630. position: absolute;
  5631. width: 100%;
  5632. height: 100%;
  5633. opacity: 0;
  5634. cursor: pointer;
  5635. outline: none;
  5636. top: 0;
  5637. left: 0;
  5638. }
  5639. .add-items {
  5640. width: 120px;
  5641. height: 120px;
  5642. border: 1px dotted #e7e7e7;
  5643. border-radius: 5px;
  5644. display: flex;
  5645. justify-content: center;
  5646. align-items: center;
  5647. overflow: hidden;
  5648. position: relative;
  5649. flex-direction: column;
  5650. background: #f4f5f7;
  5651. .item {
  5652. width: 46px;
  5653. height: 46px;
  5654. background: #3764ff;
  5655. opacity: 0.6;
  5656. display: flex;
  5657. justify-content: center;
  5658. align-items: center;
  5659. border-radius: 50%;
  5660. color: #fff;
  5661. }
  5662. }
  5663. .items {
  5664. width: 120px;
  5665. height: 120px;
  5666. margin-bottom: 10px;
  5667. display: flex;
  5668. justify-content: center;
  5669. align-items: center;
  5670. background: #e7e7e7;
  5671. margin-right: 10px;
  5672. border-radius: 5px;
  5673. position: relative;
  5674. img {
  5675. max-width: 108px;
  5676. max-height: 108px;
  5677. }
  5678. }
  5679. }
  5680. .delete-img {
  5681. position: absolute;
  5682. right: 0px;
  5683. top: 0px;
  5684. color: red;
  5685. }
  5686. /deep/.ivu-tooltip-rel {
  5687. overflow: hidden;
  5688. text-overflow: ellipsis;
  5689. white-space: nowrap;
  5690. }
  5691. .page-edit {
  5692. overflow: hidden;
  5693. overflow-y: auto;
  5694. position: relative;
  5695. top: 20px;
  5696. height: 85%;
  5697. padding-bottom: 20px;
  5698. /deep/ .ivu-form-item {
  5699. min-width: 300px;
  5700. }
  5701. }
  5702. .auto-width {
  5703. width: 200px;
  5704. }
  5705. .items {
  5706. // box-shadow: 0 2px 7px rgba(0, 0, 0, 0.15);
  5707. border-color: transparent;
  5708. position: relative;
  5709. border-radius: 5px;
  5710. .items-header {
  5711. padding: 10px 20px;
  5712. display: flex;
  5713. justify-content: space-between;
  5714. align-items: center;
  5715. border-bottom: 1px solid #f4f4f4;
  5716. .header-left {
  5717. span {
  5718. margin-left: 10px;
  5719. }
  5720. }
  5721. }
  5722. .form-item {
  5723. padding: 20px;
  5724. }
  5725. }
  5726. .modal-scroll {
  5727. height: 600px;
  5728. overflow: scroll;
  5729. }
  5730. .modal-items {
  5731. border-radius: 5px;
  5732. border: 1px solid #dedede;
  5733. padding: 0px 10px;
  5734. margin-bottom: 40px;
  5735. }
  5736. .modal-footer-button {
  5737. display: flex;
  5738. justify-content: flex-end;
  5739. padding: 10px 0;
  5740. }
  5741. .items-table {
  5742. width: 100%;
  5743. overflow-x: scroll;
  5744. }
  5745. /deep/ .ivu-table-wrapper {
  5746. overflow: visible;
  5747. color: red;
  5748. } //穿透iview
  5749. .original-part {
  5750. padding-top: 20px;
  5751. }
  5752. .column-li {
  5753. display: flex;
  5754. justify-content: space-between;
  5755. align-items: center;
  5756. padding: 2px 5px;
  5757. }
  5758. .hierarchy {
  5759. display: flex;
  5760. justify-content: flex-start;
  5761. align-items: flex-start;
  5762. flex-wrap: wrap;
  5763. .radio-g {
  5764. padding: 10px 0;
  5765. width: 700px;
  5766. display: flex;
  5767. justify-content: flex-start;
  5768. // align-items: flex-start;
  5769. flex-wrap: wrap;
  5770. .radio-us {
  5771. background: #f4f5f7;
  5772. padding: 5px 20px;
  5773. margin-right: 18px;
  5774. margin-bottom: 10px;
  5775. color: #999999;
  5776. border-radius: 15px;
  5777. border: 1px solid #dedede;
  5778. cursor: pointer;
  5779. }
  5780. .radio-us-foc {
  5781. color: #3764ff;
  5782. background: #fff;
  5783. border: 1px solid #3764ff;
  5784. }
  5785. }
  5786. }
  5787. .nav-product {
  5788. width: 100%;
  5789. height: 50px;
  5790. display: flex;
  5791. align-items: center;
  5792. }
  5793. /deep/.ivu-poptip-inner {
  5794. max-width: 90%;
  5795. // display: flex;
  5796. // justify-content: center;
  5797. }
  5798. /deep/.ivu-poptip-body {
  5799. max-height: 600px;
  5800. overflow: hidden;
  5801. overflow-y: auto;
  5802. }
  5803. .content {
  5804. .content_header {
  5805. display: flex;
  5806. justify-content: space-between;
  5807. padding: 0 10px;
  5808. }
  5809. }
  5810. .modal_product_info {
  5811. background-color: #f5f5f5;
  5812. border-radius: 10px;
  5813. padding: 10px;
  5814. margin-bottom: 10px;
  5815. .modal_product_info_title {
  5816. font-size: 20px;
  5817. font-weight: 700;
  5818. margin-bottom: 10px;
  5819. }
  5820. .modal_product_info_content {
  5821. .part_detail_form {
  5822. /deep/.ivu-form {
  5823. display: flex;
  5824. justify-content: flex-start;
  5825. flex-wrap: wrap;
  5826. }
  5827. /deep/ .ivu-form-item {
  5828. display: inline-block;
  5829. min-width: 150px;
  5830. }
  5831. }
  5832. }
  5833. .modal_product {
  5834. /deep/.ivu-form {
  5835. display: flex;
  5836. justify-content: flex-start;
  5837. flex-wrap: wrap;
  5838. }
  5839. /deep/ .ivu-form-item {
  5840. display: inline-block;
  5841. min-width: 200px;
  5842. }
  5843. }
  5844. .modal_parts {
  5845. /deep/.ivu-form {
  5846. display: flex;
  5847. justify-content: flex-start;
  5848. flex-wrap: wrap;
  5849. }
  5850. /deep/ .ivu-form-item {
  5851. display: inline-block;
  5852. min-width: 30px;
  5853. }
  5854. }
  5855. .modal_extra {
  5856. /deep/.ivu-form {
  5857. display: flex;
  5858. justify-content: flex-start;
  5859. flex-wrap: wrap;
  5860. }
  5861. /deep/ .ivu-form-item {
  5862. display: inline-block;
  5863. min-width: 100px;
  5864. }
  5865. }
  5866. }
  5867. /deep/.ivu-modal-body {
  5868. max-height: 800px;
  5869. }
  5870. .hide_part_detail {
  5871. display: none;
  5872. }
  5873. /deep/.ivu-form-item-content {
  5874. span {
  5875. vertical-align: middle;
  5876. }
  5877. }
  5878. /deep/.vxe-table--render-default .vxe-cell {
  5879. padding: 0;
  5880. }
  5881. </style>