edit.vue 200 KB

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