edit.vue 203 KB

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