edit.vue 203 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884
  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. let _temp = [];
  3077. if (item.cld) {
  3078. item.cld.filter((_cld) => _cld.id == item.value);
  3079. }
  3080. elem.procedure_properties_str[index] =
  3081. _temp.length > 0 ? _temp[0].title : "";
  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. if (temp && temp.length > 0) {
  3164. // 匹配规格是否已存在
  3165. const _temp = temp[0].measure_str.filter(
  3166. (item) => item.id == el.material_detail_id
  3167. );
  3168. if (_temp && _temp.length > 0) {
  3169. this.wood_title_count.map((v) => {
  3170. v.title == el.material_detail_title &&
  3171. v.measure_str.map((item) => {
  3172. if (item.id == el.material_detail_id) {
  3173. item.num =
  3174. item.num * 1 + el.material_detail_num * 1;
  3175. }
  3176. });
  3177. });
  3178. } else {
  3179. // 不存在一样规格
  3180. if (
  3181. el.material_detail_list &&
  3182. el.material_detail_list.length > 0
  3183. ) {
  3184. const __temp = el.material_detail_list.filter(
  3185. (item) =>
  3186. item.material_detail_id == el.material_detail_id
  3187. );
  3188. this.wood_title_count.map((v) => {
  3189. v.title == el.material_detail_title &&
  3190. ((v.unit = __temp[0].unit),
  3191. v.measure_str.push({
  3192. num: el.material_detail_num,
  3193. id: __temp[0].material_detail_id,
  3194. measure: `${__temp[0].long || 0}*${__temp[0]
  3195. .wide || 0}*${__temp[0].high || 0}`,
  3196. }));
  3197. });
  3198. } else {
  3199. this.wood_title_count.map((v) => {
  3200. v.title == el.material_detail_title &&
  3201. ((v.unit = el.unit),
  3202. v.measure_str.push({
  3203. num: el.material_detail_num,
  3204. id: el.material_detail_id,
  3205. measure: `${el.long || 0}*${el.wide ||
  3206. 0}*${el.high || 0}`,
  3207. }));
  3208. });
  3209. }
  3210. }
  3211. } else {
  3212. // 不存在就新增
  3213. if (
  3214. el.material_detail_list &&
  3215. el.material_detail_list.length > 0
  3216. ) {
  3217. const _temp = el.material_detail_list.filter(
  3218. (item) =>
  3219. item.material_detail_id == el.material_detail_id
  3220. );
  3221. if (_temp && _temp.length > 0) {
  3222. if (!total_line_unit) {
  3223. total_line_unit = _temp[0].unit;
  3224. }
  3225. this.wood_title_count.push({
  3226. title: el.material_detail_title,
  3227. unit: total_line_unit,
  3228. measure_str: [
  3229. {
  3230. num: el.material_detail_num,
  3231. id: _temp[0].material_detail_id,
  3232. measure: `${_temp[0].long || 0}*${_temp[0]
  3233. .wide || 0}*${_temp[0].high || 0}`,
  3234. unit: _temp[0].unit,
  3235. },
  3236. ],
  3237. });
  3238. }
  3239. } else {
  3240. if (!total_line_unit) {
  3241. total_line_unit = el.unit;
  3242. }
  3243. this.wood_title_count.push({
  3244. title: el.material_detail_title,
  3245. unit: total_line_unit,
  3246. measure_str: [
  3247. {
  3248. num: el.material_detail_num,
  3249. id: el.material_detail_id,
  3250. measure: `${el.long || 0}*${el.wide ||
  3251. 0}*${el.high || 0}`,
  3252. unit: el.unit,
  3253. },
  3254. ],
  3255. });
  3256. }
  3257. }
  3258. }
  3259. });
  3260. }
  3261. });
  3262. }
  3263. });
  3264. // 数线条
  3265. let total_line = 0;
  3266. this.wood_title_count.map((v) => {
  3267. v.measure_str.map((w) => {
  3268. total_line += w.num * 1;
  3269. });
  3270. });
  3271. // 线条合计放进统计
  3272. this.parts_title_count.push({
  3273. title: "线 条",
  3274. num: total_line,
  3275. unit: total_line_unit,
  3276. });
  3277. // 计算价格
  3278. if (type) {
  3279. this.info.order_price = (
  3280. this.info.predict_price - this.info.fax_price
  3281. ).toFixed(2);
  3282. } else {
  3283. this.info.predict_price = sum.toFixed(2);
  3284. this.info.order_price = (
  3285. (this.info.predict_price * this.fax) /
  3286. 100
  3287. ).toFixed(2);
  3288. this.info.fax_price = (
  3289. this.info.predict_price - this.info.order_price
  3290. ).toFixed(2);
  3291. }
  3292. },
  3293. getUsers() {
  3294. this.axios("/api/employee_list").then((res) => (this.users = res.data));
  3295. },
  3296. handleExtraAdd(array, type) {
  3297. array.push({
  3298. num: 0,
  3299. price: 0,
  3300. total_price: 0,
  3301. type,
  3302. remark: "",
  3303. title: "",
  3304. id: "",
  3305. is_metal: true,
  3306. });
  3307. this.handleCalcCount();
  3308. this.$forceUpdate();
  3309. },
  3310. handleExtraDele(array, row, index, modalData) {
  3311. array.splice(index, 1);
  3312. this.handleTotalPriceCalc(row, modalData);
  3313. this.handleCalcCount();
  3314. this.$forceUpdate();
  3315. },
  3316. getCoumstList() {
  3317. this.axios("/api/bpp_list").then((res) => {
  3318. res.data.map((v) => {
  3319. if (v.select) {
  3320. v.cld.map((z) => {
  3321. v.select.map((k) => {
  3322. z.show = k == z.id ? true : false;
  3323. });
  3324. });
  3325. } else {
  3326. v.cld.map((v) => (v.show = false));
  3327. }
  3328. });
  3329. this.coumstList = res.data;
  3330. });
  3331. },
  3332. handleRemarkCreate(val) {
  3333. this.support_remark.push(val);
  3334. },
  3335. handleMTBClick(row) {
  3336. row.addMTB = true;
  3337. const _obj = {
  3338. is_metal: false,
  3339. isBP: false,
  3340. isChoosed: false,
  3341. change_id: "",
  3342. change: this.deepClone(this.MTBList),
  3343. long: "",
  3344. wide: "",
  3345. high: "",
  3346. hide_measure: [],
  3347. process: [],
  3348. part_id: 25, //门头板ID
  3349. hide_process: ["1", "2", "3"],
  3350. part_detail: [
  3351. {
  3352. title: "",
  3353. part_detail_title: "",
  3354. material_detail_title: "",
  3355. material_detail_id: "",
  3356. material_detail_list: [
  3357. {
  3358. material_detail_id: "",
  3359. wide: "",
  3360. high: "",
  3361. long: "",
  3362. material_detail_num: "",
  3363. },
  3364. ],
  3365. },
  3366. ],
  3367. };
  3368. row.part.push(_obj);
  3369. this.$forceUpdate();
  3370. },
  3371. getLockList() {
  3372. this.axios("/api/lock_list").then((res) => (this.lock_list = res.data));
  3373. },
  3374. modalVisibleChange(e) {
  3375. if (!e) {
  3376. this.cancelModal();
  3377. }
  3378. },
  3379. unique(array) {
  3380. let arr = JSON.parse(JSON.stringify(array));
  3381. for (var i = 0; i < arr.length; i++) {
  3382. for (var j = i + 1; j < arr.length; j++) {
  3383. if (arr[i].service_name == arr[j].service_name) {
  3384. //第一个等同于第二个,splice方法删除第二个
  3385. arr.splice(j, 1);
  3386. j--;
  3387. }
  3388. }
  3389. }
  3390. return arr;
  3391. },
  3392. handleClientChange(id) {
  3393. if (id) {
  3394. this.axios({
  3395. method: "get",
  3396. url: "/api/custom_detail",
  3397. params: { id },
  3398. }).then((res) => {
  3399. this.info.custom_id = id;
  3400. this.clientDetailList = res.data.list;
  3401. // 去重负责人
  3402. this.clientDetailList_respon = this.unique(res.data.list);
  3403. // 赋值默认负责人
  3404. this.info.custom_detail_name = this.clientDetailList_respon[0].service_name;
  3405. // 取出手机号码是该负责人的
  3406. this.clientDetailList_mobile = this.clientDetailList.filter(
  3407. (item) => item.service_name == this.info.custom_detail_name
  3408. );
  3409. // 赋值默认手机号码
  3410. this.info.custom_detail_mobile = this.clientDetailList_mobile[0].mobile;
  3411. // 去重手机号码
  3412. this.clientDetailList_mobile = this.unique(
  3413. this.clientDetailList_mobile
  3414. );
  3415. // 取出地址是该负责人的
  3416. this.clientDetailList_address = this.clientDetailList.filter(
  3417. (item) => item.service_name == this.info.custom_detail_name
  3418. );
  3419. // 赋值默认地址
  3420. this.info.custom_detail_id = this.clientDetailList_respon[0].id || 0;
  3421. this.info.service_id = res.data.detail.service_id;
  3422. this.fax = res.data.detail.fax;
  3423. this.HandleAutoCreateNewLine();
  3424. this.$forceUpdate();
  3425. });
  3426. } else {
  3427. this.clientDetailList_respon = JSON.parse(
  3428. JSON.stringify(this.charge_list)
  3429. );
  3430. this.clientList = JSON.parse(JSON.stringify(this.cus_list));
  3431. }
  3432. },
  3433. handleSpan({ row, column, rowIndex, columnIndex }) {
  3434. if (row.end) {
  3435. return [1, 6];
  3436. }
  3437. },
  3438. handleSummary({ columns, data }) {
  3439. const sums = {};
  3440. columns.forEach((column, index) => {
  3441. const key = column.key;
  3442. if (index === 0) {
  3443. sums[key] = {
  3444. key,
  3445. value: "合计",
  3446. };
  3447. return;
  3448. }
  3449. const values = data.map((item) => Number(item[key]));
  3450. if (!values.every((value) => isNaN(value))) {
  3451. const v = values.reduce((prev, curr) => {
  3452. const value = Number(curr);
  3453. if (!isNaN(value)) {
  3454. return prev + curr;
  3455. } else {
  3456. return prev;
  3457. }
  3458. }, 0);
  3459. sums[key] = {
  3460. key,
  3461. value: v,
  3462. };
  3463. } else {
  3464. sums[key] = {
  3465. key,
  3466. value: "",
  3467. };
  3468. }
  3469. });
  3470. return sums;
  3471. },
  3472. handleMetalChange(e, row, n, arr) {
  3473. arr[n].ext_id = e.value;
  3474. arr[n].title = e.label;
  3475. },
  3476. handleClientChargeChange(value) {
  3477. if (value) {
  3478. // if (this.info.custom_id) {
  3479. // this.info.custom_detail_name = value;
  3480. // // 取出手机号码是该负责人的
  3481. // this.clientDetailList_mobile = this.clientDetailList.filter(
  3482. // (item) => item.service_name == this.info.custom_detail_name
  3483. // );
  3484. // // 赋值默认手机号码
  3485. // this.info.custom_detail_mobile = this.clientDetailList_mobile[0].mobile;
  3486. // // 去重手机号码
  3487. // this.clientDetailList_mobile = this.unique(
  3488. // this.clientDetailList_mobile
  3489. // );
  3490. // // 取出地址是该负责人的
  3491. // this.clientDetailList_address = this.clientDetailList.filter(
  3492. // (item) => item.service_name == this.info.custom_detail_name
  3493. // );
  3494. // // 赋值默认地址
  3495. // this.info.custom_detail_id = this.clientDetailList_address[0].id || 0;
  3496. // } else {
  3497. this.axios
  3498. .get("/api/support_custom_for_service", {
  3499. params: { name: this.info.custom_detail_name },
  3500. })
  3501. .then((res) => {
  3502. this.clientList = res.data.data;
  3503. this.info.custom_id = res.data.data[0].id;
  3504. this.axios({
  3505. method: "get",
  3506. url: "/api/custom_detail",
  3507. params: { id: res.data.data[0].id },
  3508. }).then((re) => {
  3509. this.clientDetailList = re.data.list;
  3510. // 取出手机号码是该负责人的
  3511. this.clientDetailList_mobile = this.clientDetailList.filter(
  3512. (item) => item.service_name == value
  3513. );
  3514. // 赋值默认手机号码
  3515. this.info.custom_detail_mobile = this.clientDetailList_mobile[0].mobile;
  3516. // 去重手机号码
  3517. this.clientDetailList_mobile = this.unique(
  3518. this.clientDetailList_mobile
  3519. );
  3520. // 取出地址是该负责人的
  3521. this.clientDetailList_address = this.clientDetailList.filter(
  3522. (item) => item.service_name == value
  3523. );
  3524. // 赋值默认地址
  3525. this.info.custom_detail_id =
  3526. this.clientDetailList_address[0].id || 0;
  3527. this.info.service_id = re.data.detail.service_id;
  3528. this.fax = re.data.detail.fax;
  3529. this.HandleAutoCreateNewLine();
  3530. });
  3531. });
  3532. // }
  3533. } else {
  3534. this.info.custom_detail_mobile = "";
  3535. this.info.custom_detail_id = "";
  3536. this.info.service_id = "";
  3537. this.clientDetailList_respon = JSON.parse(
  3538. JSON.stringify(this.charge_list)
  3539. );
  3540. this.clientList = JSON.parse(JSON.stringify(this.cus_list));
  3541. this.HandleAutoCreateNewLine();
  3542. }
  3543. },
  3544. handleClientDetailChange(value) {
  3545. if (value) {
  3546. // this.clientDetailList_mobile = this.clientDetailList.filter(
  3547. // (item) => item.service_name == this.info.custom_detail_name
  3548. // );
  3549. this.info.custom_detail_id = value;
  3550. // this.info.address = row[0].address;
  3551. // this.info.address = row[0].address;
  3552. // this.info.mobile = row[0].mobile;
  3553. this.$forceUpdate();
  3554. }
  3555. },
  3556. getEditData(modalData, curData) {
  3557. // console.log("modalData :>> ", modalData);
  3558. // console.log("curData :>> ", curData);
  3559. modalData.ext_price = curData.ext_price * 1 || 0;
  3560. modalData.model = curData.model;
  3561. modalData.num = curData.num || 1;
  3562. modalData.num_temp_save = modalData.num;
  3563. modalData.over_price = curData.over_price * 1 || 0;
  3564. modalData.position = curData.position;
  3565. modalData.price = curData.price;
  3566. modalData.product_id = curData.product_id;
  3567. modalData.remark = curData.remark;
  3568. modalData.route_id = curData.route_id;
  3569. modalData.total_num = curData.total_num;
  3570. modalData.unit = curData.unit;
  3571. modalData.unit_price = curData.unit_price * 1 || 0;
  3572. modalData.url_number = curData.url_number;
  3573. modalData.extArray = [];
  3574. // 金额=(产品单价)*核算数量+超标金额+附加金额
  3575. modalData.price =
  3576. (modalData.unit_price * 1 || 0) * (modalData.num * 1 || 1) +
  3577. (modalData.over_price * 1 || 0) +
  3578. (modalData.ext_price * 1 || 0);
  3579. modalData.price = modalData.price.toFixed(2);
  3580. // 获取产品 type_name
  3581. const temprow = this.productList.filter(
  3582. (item) => item.id == curData.product_id
  3583. );
  3584. modalData.type_name = temprow[0].title;
  3585. // 获取工艺属性
  3586. // 如果route_id是0,工艺属性值取procedure_properties
  3587. if (modalData.route_id == 0) {
  3588. modalData.process_obj.map((v) => {
  3589. v.value = modalData.procedure_properties[v.id] * 1;
  3590. });
  3591. } else {
  3592. this.process_match_list.forEach((element) => {
  3593. if (element.id == curData.route_id) {
  3594. modalData.process_ids = element.detail;
  3595. }
  3596. });
  3597. modalData.process_obj.forEach((element) => {
  3598. //赋值测量字段
  3599. for (const key in modalData.process_ids) {
  3600. const ele = modalData.process_ids[key];
  3601. if (element.id == key) {
  3602. element.value = ele * 1;
  3603. }
  3604. }
  3605. });
  3606. }
  3607. // 产品测量字段
  3608. let product_measure = curData.measurement.split("*");
  3609. for (let index = 0; index < product_measure.length; index++) {
  3610. const item = product_measure[index];
  3611. const product_measure_detail = [
  3612. item.substring(0, 1),
  3613. item.substring(1),
  3614. ];
  3615. modalData.measure.forEach((element) => {
  3616. if (element.measureCalc == product_measure_detail[0]) {
  3617. element.value = product_measure_detail[1];
  3618. }
  3619. });
  3620. }
  3621. // 拆分五金、附加信息
  3622. // if (!curData.ext) {
  3623. // curData.ext = curData.ext_list;
  3624. // }
  3625. curData.ext &&
  3626. curData.ext.length > 0 &&
  3627. curData.ext.forEach((element) => {
  3628. element.type == 2 && modalData.extArray.push(element);
  3629. });
  3630. modalData.extArray.forEach((element) => {
  3631. element.id = element.ext_id;
  3632. element.total_price = (element.price * element.num).toFixed(2);
  3633. });
  3634. // 同步 curData 、 modalData
  3635. curData.part.map((ele, idx) => {
  3636. //判断是否存在
  3637. if (modalData.part[idx]) {
  3638. //判断是否相等
  3639. if (modalData.part[idx].part_id != ele.part_id) {
  3640. //不相等情况1,是否为替换项
  3641. /////
  3642. //不相等情况2,是否为另一部件
  3643. // if (
  3644. // modalData.part[idx].change.filter(v=>v.id==ele.id).length>0
  3645. // ) {
  3646. modalData.part.splice(
  3647. idx,
  3648. 0,
  3649. JSON.parse(JSON.stringify(modalData.part[idx - 1]))
  3650. );
  3651. // }
  3652. }
  3653. } else {
  3654. modalData.part.splice(
  3655. idx,
  3656. 0,
  3657. JSON.parse(JSON.stringify(modalData.part[idx - 1]))
  3658. );
  3659. }
  3660. });
  3661. // 处理部件
  3662. curData.part.forEach((element, index) => {
  3663. if (!element.is_metal) {
  3664. modalData.part[index].change_id = element.change_id;
  3665. modalData.part[index].part_title = element.part_title;
  3666. modalData.part[index].org_part_id = modalData.part[index].part_id;
  3667. // 部件测量字段
  3668. if (element.measure && element.measure.length > 0) {
  3669. const part_measure_detail = element.measure.split("*");
  3670. modalData.part[index].long = part_measure_detail[0];
  3671. modalData.part[index].wide = part_measure_detail[1];
  3672. modalData.part[index].high = part_measure_detail[2];
  3673. }
  3674. // 替换项相关 如果选了替换项
  3675. if (element.part_id != modalData.part[index].part_id) {
  3676. const change_obj = modalData.part[index].change.filter(
  3677. (item) => item.part_id == element.part_id
  3678. );
  3679. if (change_obj && change_obj.length > 0) {
  3680. change_obj[0].sub_part.forEach((elem, idx) => {
  3681. modalData.part[index].part_detail[idx].material_detail_title =
  3682. elem.material_detail_list[0].title;
  3683. modalData.part[index].part_detail[idx].material_detail_id =
  3684. elem.material_detail_id;
  3685. modalData.part[index].part_detail[idx].material_detail_list =
  3686. elem.material_detail_list;
  3687. });
  3688. }
  3689. }
  3690. element.sub_part.forEach((elem, idx) => {
  3691. // 零部件字段 、 原材料字段
  3692. modalData.part[index].part_detail[idx].long = elem.long;
  3693. modalData.part[index].part_detail[idx].wide = elem.wide;
  3694. modalData.part[index].part_detail[idx].high = elem.high;
  3695. modalData.part[index].part_detail[idx].material_detail_id =
  3696. elem.material_detail_id;
  3697. modalData.part[index].part_detail[idx].material_detail_num =
  3698. elem.material_detail_num;
  3699. modalData.part[index].part_detail[idx].material_id =
  3700. elem.material_id;
  3701. modalData.part[index].part_detail[idx].num = elem.num;
  3702. });
  3703. modalData.part[index].part_id = element.part_id;
  3704. // // 工艺属性
  3705. // modalData.part[index].procedure_properties = JSON.parse(
  3706. // JSON.stringify(element.process)
  3707. // );
  3708. for (const k in element.process) {
  3709. const v = element.process[k];
  3710. modalData.part[index].process.map((ele) => {
  3711. if (ele.id == k) {
  3712. ele.value = v;
  3713. }
  3714. });
  3715. }
  3716. }
  3717. });
  3718. },
  3719. handleShowAddProductModal(custom_id, route_id_at_copy) {
  3720. this.$addProduct({
  3721. custom_id,
  3722. route_id_at_copy,
  3723. then: (subAddProductData, support_remark) => {
  3724. this.support_remark = Array.from(
  3725. new Set([...support_remark, ...this.support_remark])
  3726. );
  3727. this.modalArray = subAddProductData;
  3728. this.modalArray.map((element) => {
  3729. // 工艺属性
  3730. if (!element.procedure_properties_str) {
  3731. element.procedure_properties_str = [];
  3732. }
  3733. if (!element.procedure_properties) {
  3734. element.procedure_properties = {};
  3735. }
  3736. element.process_obj = element.process;
  3737. element.process_obj.forEach((elem, index) => {
  3738. const _target = elem.cld ? elem.cld : elem.processList;
  3739. const _temp = _target.filter((item) => item.id == elem.value);
  3740. element.procedure_properties_str[index] =
  3741. _temp.length > 0 ? _temp[0].title : "";
  3742. element.procedure_properties[elem.id] =
  3743. _temp.length > 0 ? _temp[0].id : "";
  3744. element[elem.id] = elem.value;
  3745. element.procedure_properties[elem.id] = elem.value;
  3746. });
  3747. element.process_str = element.procedure_properties_str.join("/");
  3748. // 尺寸
  3749. if (!element.measurement) {
  3750. element.measurement = "";
  3751. }
  3752. if (!element.measurement_no_letter) {
  3753. element.measurement_no_letter = "";
  3754. }
  3755. let tempStr = "";
  3756. let tempStr_no_letter = "";
  3757. element.measure.forEach((elem) => {
  3758. tempStr += elem.measureCalc + elem.value + "*";
  3759. tempStr_no_letter += +elem.value + "*";
  3760. //为了表格上展示,拆解赋值到产品上
  3761. element[elem.e_title] = elem.value;
  3762. });
  3763. element.measurement = tempStr.substring(0, tempStr.length - 1);
  3764. element.measurement_no_letter = tempStr_no_letter.substring(
  3765. 0,
  3766. tempStr_no_letter.length - 1
  3767. );
  3768. // 五金、 附加项目
  3769. element.ext = [...element.extArray];
  3770. //其他项
  3771. element.other = element.customize;
  3772. // 部件字段
  3773. element.part.forEach((elem) => {
  3774. if (!elem.is_metal) {
  3775. elem.title ? "" : (elem.title = elem.part_title);
  3776. elem.procedure_properties_str = [];
  3777. elem.process.forEach((item, index) => {
  3778. const _temp = item.cld.filter(
  3779. (_cld) => _cld.id == item.value
  3780. );
  3781. elem.procedure_properties_str[index] =
  3782. _temp.length > 0 ? _temp[0].title : "";
  3783. });
  3784. elem.process_str = elem.procedure_properties_str.join("/");
  3785. elem.part_detail.map((_part_detail) => {
  3786. _part_detail.part_detail_option = [];
  3787. _part_detail.material_detail_list.map((v) => {
  3788. _part_detail.part_detail_option.push({
  3789. label: `${v.long}*${v.wide}*${v.high}`,
  3790. value: v.material_detail_id,
  3791. });
  3792. });
  3793. });
  3794. }
  3795. });
  3796. element.ext &&
  3797. element.ext.length > 0 &&
  3798. (element.ext.map((elem) => {
  3799. if (elem.type == 1) {
  3800. elem.total_num = elem.num;
  3801. elem.unit_price = elem.price;
  3802. elem.ext_price = elem.num * elem.price;
  3803. elem.is_metal = true;
  3804. element.part.push(elem);
  3805. if (!element.extra) {
  3806. element.extra = "";
  3807. }
  3808. } else {
  3809. if (!element.extra) {
  3810. element.extra = "";
  3811. }
  3812. element.extra += `${elem.title}/`;
  3813. }
  3814. }),
  3815. (element.extra = element.extra.substring(
  3816. 0,
  3817. element.extra.length - 1
  3818. )));
  3819. });
  3820. this.modalArray.forEach((element) => {
  3821. element.part.forEach((elem) => {
  3822. if (!elem.is_metal) {
  3823. elem.measurement = `${elem.long}*${elem.wide}*${elem.high}`;
  3824. elem.title = elem.part_title;
  3825. elem.procedure_properties = {};
  3826. elem.process.map((item) => {
  3827. elem.procedure_properties[item.id] = item.value;
  3828. });
  3829. }
  3830. });
  3831. });
  3832. this.tableData = [...this.tableData, ...this.modalArray];
  3833. this.currencyIndex = null;
  3834. this.route_id_at_copy = "";
  3835. // 合计 、 线条 统计价格
  3836. this.handleCalcCount();
  3837. this.showAddProduct = false;
  3838. this.$forceUpdate();
  3839. },
  3840. });
  3841. },
  3842. HandleAutoCreateNewLine() {
  3843. let flag = false;
  3844. this.tableData.map((v) => {
  3845. if (!v.position && !v.product_id) {
  3846. flag = true;
  3847. }
  3848. });
  3849. if (flag) {
  3850. return;
  3851. } else {
  3852. this.handleTableAdd();
  3853. }
  3854. },
  3855. handleTableAdd() {
  3856. if (this.info.custom_id) {
  3857. this.currentTabIndex = "0";
  3858. let obj = {
  3859. select_all_id: "", //产品五金ID
  3860. product_id: "", //产品ID
  3861. type_name: "", //展示用产品名称
  3862. position: "", //位置
  3863. over_price: "", //超标单价
  3864. unit_price: "", //单价
  3865. ext_price: "", //附加金额
  3866. price: "", //总金额
  3867. remark: "", //备注
  3868. measurement: "", //测量字段拼接
  3869. total_num: "", //数量
  3870. num: "", //核算数量
  3871. num_formula: "", //核算数量公式
  3872. url_number: "", //图号
  3873. url: [], //图纸
  3874. unit: "", //单位
  3875. title: "", //产品名
  3876. process: "", //工艺属性拼接
  3877. procedure_properties: {}, //工艺属性对象
  3878. overdraft: [], //超标公式
  3879. measure: this._measure, //测量字段数组
  3880. support_remark: this.support_remark, //备注列表
  3881. is_metal: false,
  3882. extArray: [
  3883. {
  3884. num: 0,
  3885. price: 0,
  3886. total_price: 0,
  3887. type: 2,
  3888. remark: "",
  3889. title: "",
  3890. id: "",
  3891. is_metal: true,
  3892. },
  3893. ],
  3894. process_obj: JSON.parse(JSON.stringify(this.process_obj)), //工艺属性含选项对象
  3895. };
  3896. obj.process_obj.map(
  3897. (v) => ((obj[v.id] = ""), (obj.procedure_properties[v.id] = ""))
  3898. );
  3899. this.tableData.push(obj);
  3900. this.$forceUpdate();
  3901. } else {
  3902. this.$Message.warning("请先选择客户");
  3903. }
  3904. },
  3905. handleMetalAdd() {
  3906. this.tableData.push({
  3907. type: 1,
  3908. is_metal: true,
  3909. material_id: "",
  3910. product_id: "",
  3911. title: "",
  3912. price: 0,
  3913. single_price: 0,
  3914. num: 0,
  3915. unit: "",
  3916. });
  3917. },
  3918. handleSet(row, index, type) {
  3919. let obj;
  3920. // 1 新增 2 编辑 3 删除 4复制 5详情
  3921. switch (type) {
  3922. case 1:
  3923. this.title_state = 1;
  3924. if (this.info.custom_id) {
  3925. this.currentTabIndex = "0";
  3926. // this.showAddProduct = true;
  3927. this.handleShowAddProductModal(
  3928. this.info.custom_id,
  3929. this.route_id_at_copy
  3930. );
  3931. } else {
  3932. this.$Message.warning("请先选择客户");
  3933. }
  3934. break;
  3935. case 2:
  3936. this.title_state = 2;
  3937. this.isCheck = false;
  3938. if (this.type == 1) {
  3939. this.showEditProduct = true;
  3940. this.modalData = JSON.parse(JSON.stringify(row));
  3941. this.currencyIndex = index;
  3942. } else if (this.type == 2) {
  3943. //订单编辑点产品编辑
  3944. // if (row.get_first_data && !row.isEdit) {
  3945. // this.axios
  3946. // .get("/api/order_product_detail_new", {
  3947. // params: { order_product_id: row.order_product_id },
  3948. // })
  3949. // .then((res) => {
  3950. // if (res.code == 200) {
  3951. // this.currencyIndex = index;
  3952. // this.modalData = JSON.parse(JSON.stringify(row));
  3953. // this.editForm = res.data;
  3954. // this.changeProductOnEdit(res.data, 0);
  3955. // }
  3956. // });
  3957. // } else {
  3958. // 订单新增点产品编辑
  3959. row.measure.map((v) => {
  3960. v.value = row[v.e_title];
  3961. });
  3962. row.process_obj.map((v) => {
  3963. v.title = v.name;
  3964. v.value = row[v.id];
  3965. });
  3966. this.modalData = JSON.parse(JSON.stringify(row));
  3967. this.currencyIndex = index;
  3968. this.showEditProduct = true;
  3969. // }
  3970. }
  3971. break;
  3972. case 3:
  3973. this.$Modal.confirm({
  3974. title: "确认删除?",
  3975. content: "请确认!",
  3976. onOk: () => {
  3977. this.tableData.splice(index, 1);
  3978. this.handleCalcCount();
  3979. },
  3980. onCancel: () => {},
  3981. });
  3982. break;
  3983. case 4:
  3984. obj = this.deepClone(row);
  3985. obj.isCopied = true;
  3986. if (row.is_metal) {
  3987. } else {
  3988. obj.position = "";
  3989. obj.measure.map((v) => {
  3990. v.value = "";
  3991. obj[v.e_title] = "";
  3992. });
  3993. if (!row.is_metal) {
  3994. this.route_id_at_copy = row.route_id;
  3995. }
  3996. this.pre_process_obj = JSON.parse(
  3997. JSON.stringify(row.procedure_properties)
  3998. );
  3999. }
  4000. //复制一条数据,更换了产品之后,
  4001. //线条的内容要保留(不管更换的这个产品的默认线条是什么,都是只展示复制下来的)
  4002. //摘自Tower #2004
  4003. obj.part.map((v) => {
  4004. if (v.title.indexOf("线条") != -1) {
  4005. this.copiedLinePart = this.deepClone(v);
  4006. }
  4007. });
  4008. //因为是复制,插件id为_XID会相同导致bug,置空后会自动生成
  4009. obj._XID = "";
  4010. this.tableData.splice(index + 1, 0, obj);
  4011. this.handleCalcCount();
  4012. break;
  4013. case 5:
  4014. this.title_state = 3;
  4015. this.isCheck = true;
  4016. // if (row.get_first_data) {
  4017. // this.axios
  4018. // .get("/api/order_product_detail_new", {
  4019. // params: { order_product_id: row.order_product_id },
  4020. // })
  4021. // .then((res) => {
  4022. // if (res.code == 200) {
  4023. // this.currencyIndex = index;
  4024. // this.modalData = JSON.parse(JSON.stringify(row));
  4025. // this.editForm = res.data;
  4026. // this.changeProductOnEdit(res.data, 0);
  4027. // }
  4028. // });
  4029. // } else {
  4030. row.measure.map((v) => {
  4031. v.value = row[v.e_title];
  4032. });
  4033. row.process_obj.map((v) => {
  4034. v.title = v.name;
  4035. v.value = row[v.id];
  4036. });
  4037. this.modalData = JSON.parse(JSON.stringify(row));
  4038. this.currencyIndex = index;
  4039. this.showEditProduct = true;
  4040. // }
  4041. break;
  4042. }
  4043. },
  4044. deepClone(obj) {
  4045. //定义对象来判断当前的参数是数组还是对象
  4046. let objClone = Array.isArray(obj) ? [] : {};
  4047. //如果obj存在并且为对象
  4048. if (obj && typeof obj == "object") {
  4049. for (let key in obj) {
  4050. if (Object.hasOwnProperty.call(obj, key)) {
  4051. //如果obj的子元素为对象,那么递归(层级遍历)
  4052. if (obj[key] && typeof obj[key] == "object") {
  4053. objClone[key] = this.deepClone(obj[key]);
  4054. } else {
  4055. //如果不是,直接赋值
  4056. objClone[key] = obj[key];
  4057. }
  4058. }
  4059. }
  4060. }
  4061. return objClone;
  4062. },
  4063. async handleBeforeUpload(row) {
  4064. // row.name
  4065. this.uploadData.title = row.name.substring(0, row.name.indexOf("."));
  4066. return true;
  4067. },
  4068. uploadError(err) {
  4069. this.$Message.error(err.msg || "上传失败");
  4070. },
  4071. onProgress(e) {
  4072. console.log(e);
  4073. },
  4074. //导入成功
  4075. uploadSuccess(res) {
  4076. if (res.code == 200) {
  4077. this.$Message.success(res.msg || "上传成功");
  4078. // const temp = res.data;
  4079. // let list = [...this.postInfo.children, ...temp];
  4080. } else {
  4081. this.$Message.warning(res.msg || "上传失败");
  4082. }
  4083. },
  4084. handleExtChange(row, { value, label }, item) {
  4085. row.ext_id = value;
  4086. row.title = label;
  4087. const element = this.extList.filter((item) => item.id == value);
  4088. row.num = element[0].num;
  4089. row.price = element[0].price;
  4090. row.total_price = (row.num * row.price).toFixed(2);
  4091. this.handleTotalPriceCalc(row, item);
  4092. this.handleCalcCount();
  4093. },
  4094. handleSameProcessDisabled(array, currencyChooseValue, currencyChooseIndex) {
  4095. let matchIds = array.selected_ids;
  4096. let target = array.same_process;
  4097. let source = array.same_process_compare;
  4098. let chooseable = [];
  4099. source.forEach((element, index) => {
  4100. element.forEach((elem, idx) => {
  4101. if (elem.id == currencyChooseValue) {
  4102. chooseable = [...chooseable, ...element];
  4103. }
  4104. });
  4105. });
  4106. target.forEach((element) => {
  4107. element.option.forEach((elem) => {
  4108. elem.isAllowSelect = true;
  4109. chooseable.forEach((el) => {
  4110. if (el.id == elem.id) {
  4111. elem.isAllowSelect = false;
  4112. }
  4113. });
  4114. });
  4115. });
  4116. this.$forceUpdate();
  4117. },
  4118. changeLock(value, row, idx) {
  4119. if (row.old_lock_price) {
  4120. row.price = parseInt(row.price) - row.old_lock_price;
  4121. }
  4122. row.old_lock_price = parseInt(value.tag || "0");
  4123. row.price = parseInt(row.price) + parseInt(value.tag || "0");
  4124. this.modalArray[idx] = row;
  4125. this.$forceUpdate();
  4126. },
  4127. handleTotalPriceChange(row, item) {
  4128. row.price = (row.total_price / (row.num == 0 ? 1 : row.num)).toFixed(2);
  4129. let sum = 0;
  4130. item.extArray.map((v) => {
  4131. return (sum += v.total_price * 1);
  4132. });
  4133. item.ext_price = sum;
  4134. item.price =
  4135. (item.unit_price * 1 || 0) * (item.num * 1 || 1) +
  4136. (item.over_price * 1 || 0) +
  4137. (item.ext_price * 1 || 0);
  4138. item.price = item.price.toFixed(2);
  4139. this.$forceUpdate();
  4140. },
  4141. handleTotalPriceCalc(row, item) {
  4142. row.total_price = ((row.price || 0) * (row.num || 0)).toFixed(2);
  4143. let sum2 = 0;
  4144. item.extArray &&
  4145. item.extArray.length > 0 &&
  4146. item.extArray.forEach((element) => {
  4147. sum2 += element.total_price * 1 || 0;
  4148. });
  4149. item.ext_price = sum2 * 1;
  4150. item.price =
  4151. (item.unit_price * 1 || 0) * (item.num * 1 || 1) +
  4152. (item.over_price * 1 || 0) +
  4153. (item.ext_price * 1 || 0);
  4154. item.price = item.price.toFixed(2);
  4155. this.$forceUpdate();
  4156. },
  4157. handlePartDetailEdit(element, index) {
  4158. element.isShowPartDetail = !element.isShowPartDetail;
  4159. this.$forceUpdate();
  4160. },
  4161. handlePartsApart(element, index, array) {
  4162. let obj = JSON.parse(JSON.stringify(element));
  4163. obj.isBP = false;
  4164. array.splice(index + 1, 0, obj);
  4165. this.$forceUpdate();
  4166. },
  4167. handlePartsDele(element, index, array) {
  4168. array.splice(index, 1);
  4169. this.handleCalcCount();
  4170. this.$forceUpdate();
  4171. },
  4172. handleProductPositionChange(item, e) {
  4173. item.position = e.target.value;
  4174. this.$forceUpdate();
  4175. },
  4176. handleOrderPriceChange(e) {
  4177. this.info.order_price = e.target.value;
  4178. this.info.fax_price = (this.info.predict_price - e.target.value).toFixed(
  4179. 2
  4180. );
  4181. this.$forceUpdate();
  4182. },
  4183. handleClearExtInfo(modalData, pre_id, cur_id) {
  4184. if (cur_id != pre_id) {
  4185. modalData.extArray = [
  4186. {
  4187. num: 0,
  4188. price: 0,
  4189. total_price: 0,
  4190. type: 2,
  4191. remark: "",
  4192. title: "",
  4193. id: "",
  4194. is_metal: true,
  4195. },
  4196. ];
  4197. } else {
  4198. let sum = 0;
  4199. modalData.extArray.map((v) => {
  4200. return (sum += v.total_price * 1);
  4201. });
  4202. modalData.ext_price = sum;
  4203. modalData.price =
  4204. (modalData.unit_price * 1 || 0) * (modalData.num * 1 || 1) +
  4205. (modalData.over_price * 1 || 0) +
  4206. (modalData.ext_price * 1 || 0);
  4207. modalData.price = modalData.price.toFixed(2);
  4208. }
  4209. this.pre_bp_id = cur_id;
  4210. },
  4211. changeEditProcess(row, obj) {
  4212. row.isEdit = true;
  4213. row.procedure_properties[obj.id] = row[obj.id];
  4214. this.pre_process_obj[obj.id] = row[obj.id];
  4215. row.process_obj.filter((v) => v.id == obj.id)[0].value = row[obj.id];
  4216. row.part.map((item) => {
  4217. if (!item.is_metal) {
  4218. //赋值默认工艺属性
  4219. item.process = JSON.parse(JSON.stringify(this.bpp_list));
  4220. item.procedure_properties[obj.id] = row[obj.id];
  4221. item.process.forEach((elem, index) => {
  4222. row.process_obj.map((v) => {
  4223. if (elem.id == v.id) {
  4224. elem.value = v.value;
  4225. }
  4226. });
  4227. // elem.value = row.process_obj.filter(
  4228. // (v) => v.id == elem.id
  4229. // )[0].value;
  4230. });
  4231. }
  4232. });
  4233. },
  4234. changeEditLines(row) {
  4235. row.isEdit = true;
  4236. this.handleCalcCount();
  4237. },
  4238. changeEditMeasure(e, row, measure) {
  4239. if (e.target.value) {
  4240. row.isEdit = true;
  4241. row.measure.map((v) => {
  4242. if (v.e_title == measure.e_title) {
  4243. v.value = e.target.value;
  4244. }
  4245. });
  4246. this.handleProductMeasureBlur(
  4247. e,
  4248. row,
  4249. row.measure.filter((v) => v.id == measure.id)[0]
  4250. );
  4251. }
  4252. },
  4253. changeEditRemark(row) {
  4254. row.isEdit = true;
  4255. this.handleCalcCount();
  4256. },
  4257. changeEditMetal(row, rowIndex, $event, scope) {
  4258. row.ext_id = row.product_id;
  4259. row.title = this.metalList.filter((v) => v.id == $event.value)[0].title;
  4260. row.unit = this.metalList.filter((v) => v.id == $event.value)[0].unit;
  4261. },
  4262. changeEditMetalNum(e, row) {
  4263. row.price = (1 * e.target.value * row.single_price).toFixed(2);
  4264. this.handleCalcCount();
  4265. },
  4266. handleMetailPriceChange(e, row) {
  4267. row.price = 1 * e.target.value * row.num;
  4268. this.handleCalcCount();
  4269. },
  4270. changeEditTotalNum(e, row) {
  4271. row.isEdit = true;
  4272. this.handleProductNumChange(e, row);
  4273. },
  4274. changeEditDetailNum(row) {
  4275. row.isEdit = true;
  4276. this.handleCalcCount();
  4277. },
  4278. changeEditExt(row, e, item) {
  4279. if (e) {
  4280. item.isEdit = true;
  4281. row.ext_id = e.value;
  4282. this.handleExtChange(row, e, item);
  4283. } else {
  4284. row.ext_id = "";
  4285. row.title = "";
  4286. this.handleCalcCount();
  4287. }
  4288. },
  4289. changeEditPart(row, part_type, part_detail, e, rowIndex) {
  4290. if (e) {
  4291. row.isEdit = true;
  4292. part_detail.change_id = e.value;
  4293. part_detail.sub_part = part_detail.change.filter(
  4294. (v) => v.id == e.value
  4295. )[0].sub_part;
  4296. part_detail.title = part_detail.change.filter(
  4297. (v) => v.id == e.value
  4298. )[0].part_title;
  4299. this.handlePartChange(e, part_detail, row.measure, row.total_num);
  4300. this.handleIsSpecialPart(this.tableData[rowIndex]);
  4301. this.handleCalcCount();
  4302. }
  4303. },
  4304. handleSelectProductMetail(row, rowIndex, $event, scope) {
  4305. if ($event) {
  4306. const arr = $event.tag.split("_");
  4307. let obj = {};
  4308. // 分类 1产品 2五金
  4309. if (arr[1] == "1") {
  4310. obj = {
  4311. isCopied: row.isCopied,
  4312. select_all_id: $event.value,
  4313. product_id: arr[0] * 1,
  4314. type_name: "", //展示用产品名称
  4315. position: row.position, //位置
  4316. over_price: "", //超标单价
  4317. unit_price: "", //单价
  4318. ext_price: "", //附加金额
  4319. price: "", //总金额
  4320. remark: "", //备注
  4321. measurement: "", //测量字段拼接
  4322. total_num: "", //数量
  4323. num: "", //核算数量
  4324. num_formula: "", //核算数量公式
  4325. url_number: "", //图号
  4326. url: [], //图纸
  4327. unit: "", //单位
  4328. title: "", //产品名
  4329. process: "", //工艺属性拼接
  4330. procedure_properties: this.pre_process_obj || {}, //工艺属性对象
  4331. overdraft: [], //超标公式
  4332. measure: this._measure, //测量字段数组
  4333. support_remark: this.support_remark, //备注列表
  4334. is_metal: false,
  4335. ext: [],
  4336. extArray: [
  4337. {
  4338. num: 0,
  4339. price: 0,
  4340. total_price: 0,
  4341. type: 2,
  4342. remark: "",
  4343. title: "",
  4344. id: "",
  4345. is_metal: true,
  4346. },
  4347. ],
  4348. process_obj: JSON.parse(JSON.stringify(this.process_obj)), //工艺属性含选项对象
  4349. };
  4350. obj.process_obj.map((v) => (obj[v.id] = ""));
  4351. } else {
  4352. obj = {
  4353. select_all_id: $event.value,
  4354. type: 1,
  4355. is_metal: true,
  4356. material_id: "",
  4357. product_id: arr[0] * 1,
  4358. title: "",
  4359. price: 0,
  4360. single_price: 0,
  4361. num: 0,
  4362. unit: "",
  4363. };
  4364. }
  4365. this.tableData.splice(rowIndex, 1, obj);
  4366. if (arr[1] === "1") {
  4367. this.changeEditTableData(obj, rowIndex, $event, scope);
  4368. } else {
  4369. this.changeEditMetal(obj, rowIndex, $event, scope);
  4370. }
  4371. this.HandleAutoCreateNewLine();
  4372. }
  4373. },
  4374. changeEditTableData(row, rowIndex, $event, scope) {
  4375. const isCopied = row.isCopied || false;
  4376. if ($event) {
  4377. row.type_name = $event.label;
  4378. row.title = $event.label;
  4379. //被编辑过了 标记
  4380. row.isEdit = true;
  4381. this.axios("/api/order_get_product_detail_new", {
  4382. params: {
  4383. product_id: row.product_id,
  4384. custom_id: this.info.custom_id,
  4385. },
  4386. }).then((res) => {
  4387. this.process_match_list = res.data.process.list;
  4388. this.process_all_list = res.data.process_list;
  4389. this.support_remark = Array.from(
  4390. new Set([...res.data.support_remark, ...this.support_remark])
  4391. );
  4392. this.bpp_list.map((v) => (row[v.id] = ""));
  4393. this.measure_total.map((v) => (row[v.e_title] = ""));
  4394. row.url = res.data.url;
  4395. row.total_num = res.data.total_num || 1;
  4396. row.ext_price = res.data.ext_price || 0;
  4397. row.unit_price = res.data.price || 0;
  4398. row.num = res.data.num || 1;
  4399. row.over_price = res.data.over_price || 0;
  4400. row.unit = res.data.unit || "";
  4401. row.remark = res.data.remark || "";
  4402. row.url_number = res.data.url_number || "";
  4403. row.overdraft = res.data.overdraft;
  4404. row.num_formula = res.data.num_formula;
  4405. if (!row.num_formula) {
  4406. row.num_temp_save = 1;
  4407. }
  4408. row.bp_id = res.data.bp_id;
  4409. // 金额=(产品单价)*核算数量 +附加金额 + 超标金额
  4410. row.price =
  4411. (row.unit_price * 1 || 0) * (row.num * 1 || 1) +
  4412. (row.over_price * 1 || 0) +
  4413. (row.ext_price * 1 || 0);
  4414. row.price = row.price.toFixed(2);
  4415. row.selected_ids = [];
  4416. // row.part = [];
  4417. // row.part = res.data.part;
  4418. res.data.part.forEach((element, index) => {
  4419. // 选择不是附加项目的,
  4420. if (!element.is_metal) {
  4421. // 选择不是线条、或者基础档案中要默认为空的部件
  4422. element.isBP = true;
  4423. element.isChoosed = true;
  4424. element.title = element.part_title;
  4425. element.process = JSON.parse(JSON.stringify(this.bpp_list));
  4426. element.process.forEach((elem, index) => {
  4427. for (const key in res.data.process.title) {
  4428. const ele = res.data.process.title[key];
  4429. if (elem.name == ele) {
  4430. elem.value = this.pre_process_obj[key] * 1;
  4431. elem.process_id = key;
  4432. if (!element.procedure_properties) {
  4433. element.procedure_properties = {};
  4434. }
  4435. element.procedure_properties[key] =
  4436. this.pre_process_obj[key] * 1;
  4437. }
  4438. }
  4439. });
  4440. if (element.is_null == 1) {
  4441. element.change_id = "";
  4442. // element.part_title = "";
  4443. // element.title = "";
  4444. } else {
  4445. for (const key in this.pre_process_obj) {
  4446. const item = this.pre_process_obj[key];
  4447. row[key] = item * 1;
  4448. }
  4449. element.change_id = element.change[0].id;
  4450. }
  4451. if (isCopied && element.title.indexOf("线条") != -1) {
  4452. element = Object.assign(element, this.copiedLinePart);
  4453. }
  4454. element.part_detail = element.sub_part;
  4455. //展示非拆分部件
  4456. // 默认替换部件 pre_process_obj
  4457. //存计算公式
  4458. element.long ? "" : (element.long = 0);
  4459. element.wide ? "" : (element.wide = 0);
  4460. element.high ? "" : (element.high = 0);
  4461. element.longCalc = element.long + "";
  4462. element.wideCalc = element.wide + "";
  4463. element.highCalc = element.high + "";
  4464. element.part_detail.forEach((elem) => {
  4465. elem.material_detail_title = elem.material_detail_list[0].title;
  4466. elem.material_detail_id =
  4467. elem.material_detail_list[0].material_detail_id;
  4468. elem.part_detail_option = [];
  4469. elem.material_detail_list.map((v) => {
  4470. elem.part_detail_option.push({
  4471. label: `${v.long}*${v.wide}*${v.high}`,
  4472. value: v.material_detail_id,
  4473. });
  4474. });
  4475. elem.org_num = elem.num;
  4476. elem.material_detail_org_num = elem.num || 0;
  4477. elem.material_detail_num = elem.num || 0;
  4478. elem.long ? "" : (elem.long = 0);
  4479. elem.wide ? "" : (elem.wide = 0);
  4480. elem.high ? "" : (elem.high = 0);
  4481. elem.longCalc = elem.long + "";
  4482. elem.wideCalc = elem.wide + "";
  4483. elem.highCalc = elem.high + "";
  4484. elem.material_detail_list.forEach((el) => {
  4485. el.long = el.long || "0";
  4486. el.wide = el.wide || "0";
  4487. el.high = el.high || "0";
  4488. });
  4489. });
  4490. }
  4491. });
  4492. row.part = JSON.parse(JSON.stringify(res.data.part));
  4493. // //测量字段
  4494. row.measure = res.data.measure;
  4495. row.measure.forEach((element) => {
  4496. element.value = "";
  4497. element.measureCalc = element.e_title;
  4498. });
  4499. this.tableData.splice(rowIndex, 1, row);
  4500. this.handleClearExtInfo(row, this.pre_bp_id, res.data.bp_id);
  4501. row.get_first_data = false;
  4502. this.handleCalcCount();
  4503. // this.$forceUpdate();
  4504. });
  4505. }
  4506. // row.part=[]
  4507. },
  4508. changeEditProduct($event) {
  4509. if ($event) {
  4510. let id = $event.value;
  4511. this.modalData.type_name = $event.label;
  4512. this.modalData.title = $event.label;
  4513. this.axios("/api/order_get_product_detail_new", {
  4514. params: { product_id: id, custom_id: this.info.custom_id },
  4515. }).then((res) => {
  4516. if (res.code == 200) {
  4517. this.process_match_list = res.data.process.list;
  4518. this.process_all_list = res.data.process_list;
  4519. this.support_remark = Array.from(
  4520. new Set([...res.data.support_remark, ...this.support_remark])
  4521. );
  4522. // 赋值默认工艺路线
  4523. let _temp_obj = {};
  4524. if (res.data.process.list.length > 1) {
  4525. for (const key in res.data.process.list[0].detail) {
  4526. res.data.process.list.reduce((pre, cur) => {
  4527. if (_temp_obj[key] == "") {
  4528. return pre;
  4529. } else {
  4530. if (pre.detail[key] == cur.detail[key]) {
  4531. _temp_obj[key] = pre.detail[key];
  4532. return pre;
  4533. } else {
  4534. _temp_obj[key] = "";
  4535. return pre;
  4536. }
  4537. }
  4538. });
  4539. }
  4540. } else {
  4541. _temp_obj = res.data.process.list[0].detail;
  4542. }
  4543. this.pre_process_obj = JSON.parse(JSON.stringify(_temp_obj));
  4544. this.modalData.url = res.data.url;
  4545. this.modalData.total_num = res.data.total_num || 1;
  4546. this.modalData.ext_price = res.data.ext_price || 0;
  4547. this.modalData.unit_price = res.data.price || 0;
  4548. this.modalData.num = res.data.num || 1;
  4549. this.modalData.over_price = res.data.over_price || 0;
  4550. this.modalData.unit = res.data.unit || "";
  4551. this.modalData.remark = res.data.remark || "";
  4552. this.modalData.url_number = res.data.url_number || "";
  4553. this.modalData.overdraft = res.data.overdraft;
  4554. this.modalData.num_formula = res.data.num_formula;
  4555. if (!this.modalData.num_formula) {
  4556. this.modalData.num_temp_save = 1;
  4557. }
  4558. this.modalData.bp_id = res.data.bp_id;
  4559. // 金额=(产品单价)*核算数量 +附加金额 + 超标金额
  4560. this.modalData.price =
  4561. (this.modalData.unit_price * 1 || 0) *
  4562. (this.modalData.num * 1 || 1) +
  4563. (this.modalData.over_price * 1 || 0) +
  4564. (this.modalData.ext_price * 1 || 0);
  4565. this.modalData.price = this.modalData.price.toFixed(2);
  4566. // this.modalData.model = res.data.model || ''
  4567. // this.modalData.same_process_compare = JSON.parse(JSON.stringify(res.data.intermediate.same_process || []))
  4568. this.modalData.selected_ids = [];
  4569. this.modalData.part = [];
  4570. this.modalData.part = res.data.part;
  4571. // 数据第一次通过接口获取
  4572. this.modalData.get_first_data = false;
  4573. this.modalData.part.forEach((element, index) => {
  4574. // 选择不是附加项目的,
  4575. if (!element.is_metal) {
  4576. // 选择不是线条、或者基础档案中要默认为空的部件
  4577. element.isBP = true;
  4578. element.isChoosed = true;
  4579. if (element.is_null == 1) {
  4580. element.change_id = "";
  4581. } else {
  4582. element.part_detail = element.sub_part;
  4583. //展示非拆分部件
  4584. // 默认替换部件
  4585. element.change_id = element.change[0].id;
  4586. //存计算公式
  4587. element.long ? "" : (element.long = 0);
  4588. element.wide ? "" : (element.wide = 0);
  4589. element.high ? "" : (element.high = 0);
  4590. element.longCalc = element.long + "";
  4591. element.wideCalc = element.wide + "";
  4592. element.highCalc = element.high + "";
  4593. element.part_detail.forEach((elem) => {
  4594. elem.material_detail_id = 0;
  4595. elem.material_detail_title =
  4596. elem.material_detail_list[0].title;
  4597. elem.material_detail_id =
  4598. elem.material_detail_list[0].material_detail_id;
  4599. elem.org_num = elem.num;
  4600. elem.material_detail_org_num = elem.num || 0;
  4601. elem.material_detail_num = elem.num || 0;
  4602. elem.long ? "" : (elem.long = 0);
  4603. elem.wide ? "" : (elem.wide = 0);
  4604. elem.high ? "" : (elem.high = 0);
  4605. elem.longCalc = elem.long || "";
  4606. elem.wideCalc = elem.wide || "";
  4607. elem.highCalc = elem.high || "";
  4608. elem.material_detail_list.forEach((el) => {
  4609. el.long = el.long || "0";
  4610. el.wide = el.wide || "0";
  4611. el.high = el.high || "0";
  4612. });
  4613. });
  4614. element.part_detail.map((_part_detail) => {
  4615. _part_detail.material_detail_org_num =
  4616. _part_detail.num || 0;
  4617. _part_detail.part_detail_option = [];
  4618. _part_detail.material_detail_list.map((v) => {
  4619. _part_detail.part_detail_option.push({
  4620. label: `${v.long}*${v.wide}*${v.high}`,
  4621. value: v.material_detail_id,
  4622. });
  4623. });
  4624. });
  4625. }
  4626. }
  4627. });
  4628. //测量字段
  4629. this.modalData.measure = res.data.measure;
  4630. this.modalData.measure.forEach((element) => {
  4631. element.value = "";
  4632. element.measureCalc = element.e_title;
  4633. });
  4634. //工艺属性
  4635. this.modalData.process_obj = [];
  4636. for (const k in res.data.process.title) {
  4637. this.process_obj.map((v) => {
  4638. if (v.id == k) {
  4639. this.modalData.process_obj.push(v);
  4640. }
  4641. });
  4642. }
  4643. this.modalData.part.forEach((element) => {
  4644. if (!element.is_metal) {
  4645. //赋值默认工艺属性
  4646. element.process = JSON.parse(JSON.stringify(this.bpp_list));
  4647. element.process.forEach((elem, index) => {
  4648. for (const key in res.data.process.title) {
  4649. const ele = res.data.process.title[key];
  4650. if (elem.name == ele) {
  4651. elem.value = this.pre_process_obj[key] * 1;
  4652. elem.process_id = key;
  4653. if (!element.procedure_properties) {
  4654. element.procedure_properties = {};
  4655. }
  4656. element.procedure_properties[key] =
  4657. this.pre_process_obj[key] * 1;
  4658. }
  4659. }
  4660. });
  4661. }
  4662. });
  4663. // this.handleClearExtInfo(
  4664. // this.modalData,
  4665. // this.pre_bp_id,
  4666. // res.data.bp_id
  4667. // );
  4668. // 是否有上一个的工艺属性ID
  4669. this.chooseLastRouteId(this.modalData, res);
  4670. this.$forceUpdate();
  4671. }
  4672. });
  4673. }
  4674. },
  4675. footerMethod({ columns, data }) {
  4676. return [
  4677. columns.map((column, columnIndex) => {
  4678. if (columnIndex === 0) {
  4679. return "合计";
  4680. }
  4681. if (column.title == "附加金额") {
  4682. let sum = 0;
  4683. data.map((v) => {
  4684. v.is_metal ? (sum += v.price * 1) : (sum += v.ext_price * 1);
  4685. });
  4686. return sum;
  4687. }
  4688. if (column.title == "总金额") {
  4689. let sum = 0;
  4690. data.map((v) => {
  4691. v.is_metal ? (sum += v.price * 1) : (sum += v.price * 1);
  4692. });
  4693. this.info.predict_price = sum.toFixed(2);
  4694. return sum.toFixed(2);
  4695. }
  4696. return null;
  4697. }),
  4698. ];
  4699. },
  4700. chooseLastRouteId(modalData, res) {
  4701. // 匹配
  4702. modalData.process_obj.forEach((element) => {
  4703. for (const key in this.pre_process_obj) {
  4704. const item = this.pre_process_obj[key];
  4705. const compare = res.data.process.list.filter(
  4706. (_process) => _process.detail[key] == this.pre_process_obj[key]
  4707. );
  4708. if (element.id == key) {
  4709. if (compare.length > 0) {
  4710. element.value = item * 1;
  4711. } else {
  4712. element.value = "";
  4713. }
  4714. }
  4715. }
  4716. });
  4717. this.$forceUpdate();
  4718. },
  4719. changeProductOnEdit(row, n) {
  4720. if (row) {
  4721. this.modalData.type_name = row.label;
  4722. this.modalData.title = row.label;
  4723. this.axios("/api/order_get_product_detail_new", {
  4724. params: {
  4725. product_id: row.product_id,
  4726. custom_id: this.info.custom_id,
  4727. },
  4728. }).then((res) => {
  4729. if (res.code == 200) {
  4730. this.support_remark = Array.from(
  4731. new Set([...res.data.support_remark, ...this.support_remark])
  4732. );
  4733. this.process_match_list = res.data.process.list;
  4734. this.process_all_list = res.data.process_list;
  4735. //获取产品
  4736. this.modalData.total_num = res.data.total_num || 1;
  4737. this.modalData.ext_price = res.data.ext_price || 0;
  4738. this.modalData.unit_price = res.data.price || 0;
  4739. this.modalData.num = res.data.num || 1;
  4740. this.modalData.num_temp_save = res.data.num || 1;
  4741. this.modalData.over_price = res.data.over_price || 0;
  4742. this.modalData.unit = res.data.unit || "";
  4743. this.modalData.remark = res.data.remark || "";
  4744. this.modalData.url = res.data.url || [];
  4745. this.modalData.url_number = res.data.url_number || "";
  4746. this.modalData.overdraft = res.data.overdraft;
  4747. this.modalData.bp_id = res.data.bp_id;
  4748. // this.modalData.same_process_compare = JSON.parse(JSON.stringify(res.data.intermediate.same_process || []))
  4749. this.modalData.selected_ids = [];
  4750. this.modalData.customize = row.customize;
  4751. this.modalData.get_first_data = false;
  4752. this.modalData.part = res.data.part;
  4753. this.modalData.part.forEach((element) => {
  4754. if (!element.is_metal) {
  4755. element.isBP = true;
  4756. element.isChoosed = true;
  4757. element.part_detail = element.sub_part;
  4758. // 数据第一次通过接口获取
  4759. //展示非拆分部件
  4760. //存计算公式
  4761. element.longCalc = element.long || "";
  4762. element.wideCalc = element.wide || "";
  4763. element.highCalc = element.high || "";
  4764. element.part_detail.forEach((elem) => {
  4765. elem.org_num = elem.num;
  4766. elem.material_detail_id = 0;
  4767. elem.material_detail_title =
  4768. elem.material_detail_list[0].title;
  4769. elem.material_detail_num = elem.num || 0;
  4770. elem.material_detail_org_num = elem.num || 0;
  4771. elem.longCalc = elem.long || "";
  4772. elem.wideCalc = elem.wide || "";
  4773. elem.highCalc = elem.high || "";
  4774. elem.material_detail_list.forEach((el) => {
  4775. el.long = el.long || "0";
  4776. el.wide = el.wide || "0";
  4777. el.high = el.high || "0";
  4778. });
  4779. });
  4780. }
  4781. });
  4782. //测量字段
  4783. this.modalData.measure = res.data.measure;
  4784. this.modalData.measure.forEach((element) => {
  4785. element.measureCalc = element.e_title;
  4786. });
  4787. //工艺属性
  4788. this.modalData.part.forEach((element) => {
  4789. if (!element.is_metal) {
  4790. element.process = JSON.parse(JSON.stringify(this.process_obj));
  4791. element.process.forEach((elem) => {
  4792. elem.value = "";
  4793. });
  4794. }
  4795. });
  4796. this.modalData.process_obj = [];
  4797. for (const k in res.data.process.title) {
  4798. this.process_obj.map((v) => {
  4799. if (v.id == k) {
  4800. this.modalData.process_obj.push(v);
  4801. }
  4802. });
  4803. }
  4804. (this.type == 2 || this.type == 3) &&
  4805. this.getEditData(this.modalData, this.editForm);
  4806. this.showEditProduct = true;
  4807. this.$forceUpdate();
  4808. }
  4809. });
  4810. }
  4811. },
  4812. handeMTBSelection($event, row) {
  4813. this.axios
  4814. .post("/api/get_part_detail_material", {
  4815. id: $event.value,
  4816. })
  4817. .then((res) => {
  4818. this.modalData.part.map((part) => {
  4819. console.log(`part`, part);
  4820. if (part.part_id === 25) {
  4821. res.data.sub_part.map((v) => {
  4822. v.material_detail_id =
  4823. v.material_detail_list[0].material_detail_id;
  4824. v.material_detail_num = 1;
  4825. });
  4826. part.part_detail = res.data.sub_part;
  4827. part.long = res.data.long;
  4828. part.high = res.data.high;
  4829. part.wide = res.data.wide;
  4830. part.route_id = res.data.route_id;
  4831. part.process = res.data.process;
  4832. }
  4833. });
  4834. });
  4835. },
  4836. handlePartChange($event, row, measure, product_num) {
  4837. if (row.part_id === 25) {
  4838. this.handeMTBSelection($event, row);
  4839. } else {
  4840. if ($event) {
  4841. let cur = row.change.filter((item) => item.id == row.change_id);
  4842. row.part_title = cur[0].part_title;
  4843. // row.title = cur[0].part_title;
  4844. row.org_part_id = row.part_id;
  4845. row.part_id = cur[0].part_id;
  4846. row.high = cur[0].high || 0;
  4847. row.highCalc = row.high;
  4848. row.long = cur[0].long || 0;
  4849. row.longCalc = row.long;
  4850. row.wide = cur[0].wide || 0;
  4851. row.wideCalc = row.wide;
  4852. row.sub_part = cur[0].sub_part;
  4853. row.part_detail = row.sub_part;
  4854. row.part_detail.forEach((elem) => {
  4855. elem.longCalc = elem.long || "";
  4856. elem.wideCalc = elem.wide || "";
  4857. elem.highCalc = elem.high || "";
  4858. elem.org_num = elem.num;
  4859. elem.material_detail_org_num = elem.num || 0;
  4860. elem.num =
  4861. ((elem.material_detail_org_num || elem.num) * product_num) | 0;
  4862. elem.material_detail_num =
  4863. elem.material_detail_org_num * product_num;
  4864. });
  4865. row.part_detail.map((_part_detail) => {
  4866. _part_detail.material_detail_org_num = _part_detail.num || 0;
  4867. _part_detail.part_detail_option = [];
  4868. _part_detail.material_detail_list.map((v) => {
  4869. _part_detail.part_detail_option.push({
  4870. label: `${v.long}*${v.wide}*${v.high}`,
  4871. value: v.material_detail_id,
  4872. });
  4873. });
  4874. });
  4875. measure.forEach((element) => {
  4876. if ((row.long + "").indexOf(element.measureCalc) != -1) {
  4877. if (typeof (element.value * 1) == "number") {
  4878. row.long = row.long.replace(
  4879. new RegExp(element.measureCalc, "g"),
  4880. element.value | ""
  4881. );
  4882. row.long = eval(row.long);
  4883. row.long += "";
  4884. } else {
  4885. row.long = "";
  4886. }
  4887. }
  4888. if ((row.wide + "").indexOf(element.measureCalc) != -1) {
  4889. if (typeof (element.value * 1) == "number") {
  4890. row.wide = row.wide.replace(
  4891. new RegExp(element.measureCalc, "g"),
  4892. element.value | ""
  4893. );
  4894. row.wide = eval(row.wide);
  4895. row.wide += "";
  4896. } else {
  4897. row.wide = "";
  4898. }
  4899. }
  4900. if ((row.high + "").indexOf(element.measureCalc) != -1) {
  4901. if (typeof (element.value * 1) == "number") {
  4902. row.high = row.high.replace(
  4903. new RegExp(element.measureCalc, "g"),
  4904. element.value | ""
  4905. );
  4906. row.high = eval(row.high);
  4907. row.high += "";
  4908. } else {
  4909. row.high = "";
  4910. }
  4911. }
  4912. row.part_detail.forEach((item) => {
  4913. item.num =
  4914. row.material_detail_org_num || item.material_detail_org_num;
  4915. if ((item.long || "").indexOf(element.measureCalc) != -1) {
  4916. if (typeof (element.value * 1) == "number") {
  4917. item.long = item.long.replace(
  4918. new RegExp(element.measureCalc, "g"),
  4919. element.value
  4920. );
  4921. try {
  4922. item.long = eval(item.long);
  4923. item.long += "";
  4924. } catch (error) {
  4925. item.long = "";
  4926. }
  4927. }
  4928. }
  4929. if ((item.wide || "").indexOf(element.measureCalc) != -1) {
  4930. if (typeof (element.value * 1) == "number") {
  4931. item.wide = item.wide.replace(
  4932. new RegExp(element.measureCalc, "g"),
  4933. element.value
  4934. );
  4935. try {
  4936. item.wide = eval(item.wide);
  4937. item.wide += "";
  4938. } catch (error) {
  4939. item.wide = "";
  4940. }
  4941. }
  4942. }
  4943. if ((item.high || "").indexOf(element.measureCalc) != -1) {
  4944. if (typeof (element.value * 1) == "number") {
  4945. item.high = item.high.replace(
  4946. new RegExp(element.measureCalc, "g"),
  4947. element.value
  4948. );
  4949. try {
  4950. item.high = eval(item.high);
  4951. item.high += "";
  4952. } catch (error) {
  4953. item.high = "";
  4954. }
  4955. }
  4956. }
  4957. item.material_detail_list.forEach((it) => {
  4958. it.long = it.long || "0";
  4959. it.wide = it.wide || "0";
  4960. it.high = it.high || "0";
  4961. });
  4962. item.long = item.long || "0";
  4963. item.wide = item.wide || "0";
  4964. item.high = item.high || "0";
  4965. item.material_detail_title = item.material_detail_list[0].title;
  4966. item.material_detail_id =
  4967. item.material_detail_list[0].material_detail_id;
  4968. item.material_detail_org_num = item.num || 0;
  4969. });
  4970. });
  4971. } else {
  4972. row.change_id = "";
  4973. }
  4974. }
  4975. this.$forceUpdate();
  4976. },
  4977. handleProductNumChange(e, product) {
  4978. product.part.map((element) => {
  4979. element.part_detail.map((elem) => {
  4980. elem.material_detail_num =
  4981. e.target.value * elem.material_detail_org_num;
  4982. });
  4983. });
  4984. product.total_num = e.target.value;
  4985. product.num = (product.total_num * product.num_temp_save).toFixed(2);
  4986. product.price =
  4987. (product.unit_price * 1 || 0) * (product.num * 1 || 1) +
  4988. (product.over_price * 1 || 0) +
  4989. (product.ext_price * 1 || 0);
  4990. product.price = product.price.toFixed(2);
  4991. this.$forceUpdate();
  4992. },
  4993. handleProductUnit_priceChange(e, product) {
  4994. product.unit_price = e.target.value * 1;
  4995. product.price =
  4996. (product.unit_price * 1 || 0) * (product.num * 1 || 1) +
  4997. (product.over_price * 1 || 0) +
  4998. (product.ext_price * 1 || 0);
  4999. product.price = product.price.toFixed(2);
  5000. this.handleCalcCount();
  5001. // this.$forceUpdate();
  5002. },
  5003. handleProductExt_priceChange(e, product) {
  5004. product.ext_price = e.target.value * 1;
  5005. product.price =
  5006. (product.unit_price * 1 || 0) * (product.num * 1 || 1) +
  5007. (product.over_price * 1 || 0) +
  5008. (product.ext_price * 1 || 0);
  5009. product.price = product.price.toFixed(2);
  5010. this.$forceUpdate();
  5011. },
  5012. handleProductOver_priceChange(e, product) {
  5013. product.over_price = e.target.value * 1;
  5014. product.price =
  5015. (product.unit_price * 1 || 0) * (product.num * 1 || 1) +
  5016. (product.over_price * 1 || 0) +
  5017. (product.ext_price * 1 || 0);
  5018. product.price = product.price.toFixed(2);
  5019. this.$forceUpdate();
  5020. },
  5021. handleGetProductMeasure(e, e_title, scope) {
  5022. if (scope.row.part.filter((v) => !v.change_id).length > 0) {
  5023. scope.row[e_title] = "";
  5024. scope.row.measure.map((v) => {
  5025. v.e_title == e_title && (v.value = "");
  5026. });
  5027. this.tableData.splice(
  5028. scope.rowIndex,
  5029. 1,
  5030. JSON.parse(JSON.stringify(scope.row))
  5031. );
  5032. this.$forceUpdate();
  5033. return this.$Message.warning("请先选择部件!");
  5034. }
  5035. },
  5036. handleGetProductProcess(val, index, product, ele) {
  5037. if (val) {
  5038. let change = [];
  5039. if (product.part.filter((v) => !v.change_id).length > 0) {
  5040. ele.cld = [];
  5041. this.$forceUpdate();
  5042. return this.$Message.warning("请先选择部件!");
  5043. }
  5044. product.part.map((item) => {
  5045. change.push({
  5046. old_id: item.org_part_id || item.part_id,
  5047. new_id: item.change.filter((v) => v.id == item.change_id)[0]
  5048. .part_id,
  5049. });
  5050. });
  5051. let list = product.process_obj.map((item) => {
  5052. return { type_id: item.key || item.id, value: item.value || "" };
  5053. });
  5054. this.axios({
  5055. method: "post",
  5056. url: "/api/order_get_product_process",
  5057. data: {
  5058. product_id: product.product_id,
  5059. type_id: ele.key || ele.id,
  5060. list,
  5061. change,
  5062. },
  5063. }).then((res) => {
  5064. if (res.code == 200) {
  5065. (ele.cld = []), (ele.cld = res.data);
  5066. } else {
  5067. ele.cld = [];
  5068. }
  5069. this.$forceUpdate();
  5070. });
  5071. }
  5072. },
  5073. // 查找最接近
  5074. handleFindNearest(array, value) {
  5075. const temp = JSON.parse(JSON.stringify(array));
  5076. temp.sort((a, b) => {
  5077. return Math.abs(a.long - value) - Math.abs(b.long - value);
  5078. });
  5079. return temp[0].material_detail_id;
  5080. },
  5081. handleCalcPartDetailLong(part_detail, product) {
  5082. for (const key in product.measure) {
  5083. const element = product.measure[key];
  5084. if (element.value) {
  5085. part_detail._longCalc = part_detail.longCalc.replace(
  5086. new RegExp(element.e_title, "g"),
  5087. element.value || ""
  5088. );
  5089. }
  5090. }
  5091. try {
  5092. eval(part_detail._longCalc);
  5093. } catch (error) {
  5094. for (const key in product.measure) {
  5095. const element = product.measure[key];
  5096. part_detail._longCalc = part_detail._longCalc.replace(
  5097. new RegExp(element.e_title, "g"),
  5098. element.value || ""
  5099. );
  5100. }
  5101. }
  5102. return part_detail._longCalc;
  5103. },
  5104. handleIsSpecialPart(product, element) {
  5105. let line = [];
  5106. let flag = false;
  5107. product.part.map((part) => {
  5108. part.part_title.indexOf("线条") != -1 && (line = part.change);
  5109. part.part_title.indexOf("门头板") != -1 && (flag = true);
  5110. });
  5111. this.handleCalcLines(product, line, flag);
  5112. },
  5113. handleCalcLines(product, line, isSpecialPart) {
  5114. const process_ids = product.process_obj.map((v) => {
  5115. return v.value;
  5116. });
  5117. const part_ids = line.map((v) => {
  5118. return v.part_id;
  5119. });
  5120. this.axios
  5121. .post("/api/process_part_for_product", {
  5122. product_id: product.product_id,
  5123. process_ids,
  5124. part_ids,
  5125. })
  5126. .then((res) => {
  5127. for (const key in res.data) {
  5128. const element = res.data[key];
  5129. // 找到部件
  5130. let part_arr = {};
  5131. product.part.map((v) => {
  5132. if (v.part_id == key) {
  5133. part_arr = v;
  5134. }
  5135. });
  5136. for (const k in element) {
  5137. const elem = element[k];
  5138. // 找到零部件
  5139. elem.map((match_item) => {
  5140. // 特殊部件 门头板, 需要在原有产品测量字段H上增加门头板的H
  5141. if (isSpecialPart) {
  5142. product.part.map((v) => {
  5143. if (match_item.e_title == "H") {
  5144. if (
  5145. match_item.max > v.long * 1 + product["H"] * 1 &&
  5146. match_item.min <= v.long * 1 + product["H"] * 1
  5147. ) {
  5148. part_arr &&
  5149. part_arr.part_detail &&
  5150. part_arr.part_detail.map((v) => {
  5151. if (v.part_detail_id == k) {
  5152. v.material_detail_id =
  5153. match_item.material_detail_id;
  5154. v.material_detail_org_num = match_item.num;
  5155. v.material_detail_num = match_item.num;
  5156. }
  5157. });
  5158. }
  5159. } else {
  5160. if (
  5161. match_item.max > product[match_item.e_title] &&
  5162. match_item.min <= product[match_item.e_title]
  5163. ) {
  5164. part_arr &&
  5165. part_arr.part_detail &&
  5166. part_arr.part_detail.map((v) => {
  5167. if (v.part_detail_id == k) {
  5168. v.material_detail_id =
  5169. match_item.material_detail_id;
  5170. v.material_detail_org_num = match_item.num;
  5171. v.material_detail_num = match_item.num;
  5172. }
  5173. });
  5174. }
  5175. }
  5176. });
  5177. } else {
  5178. if (
  5179. match_item.max > product[match_item.e_title] &&
  5180. match_item.min <= product[match_item.e_title]
  5181. ) {
  5182. part_arr &&
  5183. part_arr.part_detail &&
  5184. part_arr.part_detail.map((v) => {
  5185. if (v.part_detail_id == k) {
  5186. v.material_detail_id = match_item.material_detail_id;
  5187. v.material_detail_org_num = match_item.num;
  5188. v.material_detail_num = match_item.num;
  5189. }
  5190. });
  5191. }
  5192. }
  5193. });
  5194. }
  5195. }
  5196. this.handleCalcCount();
  5197. this.$forceUpdate();
  5198. });
  5199. },
  5200. handleProductMeasureBlur(e, product, measure_detail) {
  5201. this.handleProductMeasureChange(e, product, measure_detail);
  5202. if (e.target.value) {
  5203. try {
  5204. measure_detail.value = eval(e.target.value);
  5205. } catch (error) {
  5206. console.log("error :>> ", error);
  5207. }
  5208. product.part.map((part) => {
  5209. part.part_title ? "" : (part.part_title = part.title);
  5210. part.part_title.indexOf("线条") != -1 && (line = part.change);
  5211. part.part_detail &&
  5212. part.part_detail.length > 0 &&
  5213. part.part_detail.map((part_detail) => {
  5214. part_detail._longCalc = this.handleCalcPartDetailLong(
  5215. part_detail,
  5216. product
  5217. );
  5218. if (part_detail.material_detail_list.length > 1) {
  5219. try {
  5220. part_detail.longCalcFinal = eval(part_detail._longCalc);
  5221. // part_detail.material_detail_id = this.handleFindNearest(
  5222. // part_detail.material_detail_list,
  5223. // part_detail.longCalcFinal
  5224. // );
  5225. } catch (error) {
  5226. console.log("error :>> ", error);
  5227. }
  5228. }
  5229. });
  5230. });
  5231. product.process_obj.map((v) => {
  5232. v.value ? "" : (v.value = product[v.id]);
  5233. });
  5234. let line = [];
  5235. let flag = false;
  5236. product.part.map((part) => {
  5237. part.part_title.indexOf("线条") != -1 && (line = part.change);
  5238. part.part_title.indexOf("门头板") != -1 && (flag = true);
  5239. });
  5240. this.handleCalcLines(product, line, flag);
  5241. }
  5242. },
  5243. handleProductMeasureChange(e, product, measure_detail) {
  5244. if (e.target.value) {
  5245. let cur_measure = measure_detail.measureCalc;
  5246. let cur_value = e.target.value;
  5247. product[cur_measure] = cur_value;
  5248. //当前测量字段 L W H 修改部件测量字段
  5249. product.part.forEach((element) => {
  5250. if (!element.is_metal) {
  5251. element.highCalc = element.highCalc + "";
  5252. element.longCalc = element.longCalc + "";
  5253. element.wideCalc = element.wideCalc + "";
  5254. //处理公式
  5255. if (element.highCalc.indexOf(cur_measure) != -1) {
  5256. element.high = element.highCalc.replace(
  5257. new RegExp(cur_measure, "g"),
  5258. cur_value || ""
  5259. );
  5260. }
  5261. if (element.longCalc.indexOf(cur_measure) != -1) {
  5262. element.long = element.longCalc.replace(
  5263. new RegExp(cur_measure, "g"),
  5264. cur_value || ""
  5265. );
  5266. }
  5267. if (element.wideCalc.indexOf(cur_measure) != -1) {
  5268. element.wide = element.wideCalc.replace(
  5269. new RegExp(cur_measure, "g"),
  5270. cur_value || ""
  5271. );
  5272. }
  5273. //判断测量字段公式中是否还含有字母
  5274. let flag_high = false;
  5275. let flag_long = false;
  5276. let flag_wide = false;
  5277. for (let index = 0; index < product.measure.length; index++) {
  5278. const item = product.measure[index];
  5279. if (element.high.indexOf(item.measureCalc) != -1) {
  5280. flag_high = true;
  5281. }
  5282. if (element.long.indexOf(item.measureCalc) != -1) {
  5283. flag_long = true;
  5284. }
  5285. if (element.wide.indexOf(item.measureCalc) != -1) {
  5286. flag_wide = true;
  5287. }
  5288. }
  5289. if (flag_high) {
  5290. } else {
  5291. element.high = eval(element.high);
  5292. element.high += "";
  5293. }
  5294. if (flag_long) {
  5295. } else {
  5296. element.long = eval(element.long);
  5297. element.long += "";
  5298. }
  5299. if (flag_wide) {
  5300. } else {
  5301. element.wide = eval(element.wide);
  5302. element.wide += "";
  5303. }
  5304. element.part_detail.forEach((elem) => {
  5305. elem.highCalc = elem.high + "";
  5306. elem.longCalc = elem.long + "";
  5307. elem.wideCalc = elem.wide + "";
  5308. if (!elem.high) {
  5309. } else if (elem.highCalc.indexOf(cur_measure) != -1) {
  5310. elem.high = elem.highCalc.replace(
  5311. new RegExp(cur_measure, "g"),
  5312. cur_value || ""
  5313. );
  5314. }
  5315. if (!elem.long) {
  5316. } else if (elem.longCalc.indexOf(cur_measure) != -1) {
  5317. elem.long = elem.longCalc.replace(
  5318. new RegExp(cur_measure, "g"),
  5319. cur_value || ""
  5320. );
  5321. }
  5322. if (!elem.wide) {
  5323. } else if (elem.wideCalc.indexOf(cur_measure) != -1) {
  5324. elem.wide = elem.wideCalc.replace(
  5325. new RegExp(cur_measure, "g"),
  5326. cur_value || ""
  5327. );
  5328. }
  5329. //判断测量字段公式中是否还含有字母
  5330. let _flag_high = false;
  5331. let _flag_long = false;
  5332. let _flag_wide = false;
  5333. // Number类型无法使用indexOf
  5334. elem.high += "";
  5335. elem.long += "";
  5336. elem.wide += "";
  5337. for (let index = 0; index < product.measure.length; index++) {
  5338. const item = product.measure[index];
  5339. if (!elem.high) {
  5340. } else if (elem.high.indexOf(item.measureCalc) != -1) {
  5341. _flag_high = true;
  5342. }
  5343. if (!elem.long) {
  5344. } else if (elem.long.indexOf(item.measureCalc) != -1) {
  5345. _flag_long = true;
  5346. }
  5347. if (!elem.wide) {
  5348. } else if (elem.wide.indexOf(item.measureCalc) != -1) {
  5349. _flag_wide = true;
  5350. }
  5351. }
  5352. if (_flag_high) {
  5353. } else {
  5354. elem.high = eval(elem.high);
  5355. elem.high += "";
  5356. elem.high == "null" && (elem.high = 0);
  5357. }
  5358. if (_flag_long) {
  5359. } else {
  5360. elem.long = eval(elem.long);
  5361. elem.long += "";
  5362. elem.long == "null" && (elem.long = 0);
  5363. }
  5364. if (_flag_wide) {
  5365. } else {
  5366. elem.wide = eval(elem.wide);
  5367. elem.wide += "";
  5368. elem.wide == "null" && (elem.wide = 0);
  5369. }
  5370. });
  5371. }
  5372. });
  5373. product.over_price = 0;
  5374. product.part.map((item) => {
  5375. const cur_part = product.overdraft.filter(
  5376. (v) => v.part_id == item.part_id
  5377. );
  5378. cur_part.length > 0 &&
  5379. cur_part.map((element) => {
  5380. // 1 高 2 宽 3 厚
  5381. if (
  5382. element.type == 1 &&
  5383. item.long >= element.min &&
  5384. item.long < element.max
  5385. ) {
  5386. item.formula_temp = JSON.parse(JSON.stringify(element.formula));
  5387. item.formula_temp = item.formula_temp.replace(/H/g, item.long);
  5388. item.formula_temp = item.formula_temp.replace(/W/g, item.wide);
  5389. item.formula_temp = item.formula_temp.replace(/T/g, item.high);
  5390. item.formula_value = eval(item.formula_temp);
  5391. product.over_price =
  5392. product.over_price * 1 + item.formula_value * 1;
  5393. }
  5394. if (
  5395. element.type == 2 &&
  5396. item.wide >= element.min &&
  5397. item.wide < element.max
  5398. ) {
  5399. item.formula_temp = JSON.parse(JSON.stringify(element.formula));
  5400. item.formula_temp = item.formula_temp.replace(/H/g, item.long);
  5401. item.formula_temp = item.formula_temp.replace(/W/g, item.wide);
  5402. item.formula_temp = item.formula_temp.replace(/T/g, item.high);
  5403. item.formula_value = eval(item.formula_temp).toFixed(2);
  5404. product.over_price =
  5405. product.over_price * 1 + item.formula_value * 1;
  5406. }
  5407. if (
  5408. element.type == 3 &&
  5409. item.high >= element.min &&
  5410. item.high < element.max
  5411. ) {
  5412. item.formula_temp = JSON.parse(JSON.stringify(element.formula));
  5413. item.formula_temp = item.formula_temp.replace(/H/g, item.long);
  5414. item.formula_temp = item.formula_temp.replace(/W/g, item.wide);
  5415. item.formula_temp = item.formula_temp.replace(/T/g, item.high);
  5416. item.formula_value = eval(item.formula_temp);
  5417. product.over_price =
  5418. product.over_price * 1 + item.formula_value * 1;
  5419. }
  5420. });
  5421. });
  5422. //修改核算数量
  5423. // 如果没有核算数量公式,核算数量取产品数量
  5424. if (product.num_formula == "") {
  5425. product.total_num = product.num;
  5426. } else {
  5427. product.num_formula_temp = product.num_formula;
  5428. product.measure.forEach((element) => {
  5429. if (product.num_formula.indexOf(element.e_title) != -1) {
  5430. product.num_formula_temp = product.num_formula_temp.replace(
  5431. new RegExp(element.e_title, "g"),
  5432. element.value || 0
  5433. );
  5434. }
  5435. });
  5436. product.num = eval(product.num_formula_temp);
  5437. }
  5438. product.num = Number(product.num).toFixed(2);
  5439. product.over_price = Number(product.over_price).toFixed(2);
  5440. product.num_temp_save = product.num || 1;
  5441. product.price =
  5442. (product.unit_price * 1 || 0) * (product.num * 1 || 1) +
  5443. (product.over_price * 1 || 0) +
  5444. (product.ext_price * 1 || 0);
  5445. product.price = product.price.toFixed(2);
  5446. }
  5447. this.$forceUpdate();
  5448. },
  5449. handleSubpartNumChange(e, row) {
  5450. row.material_detail_num = e.target.value;
  5451. this.$forceUpdate();
  5452. },
  5453. //修改材质/颜色/工艺的
  5454. handleProductProcessChange(e, n, modelData, ele) {
  5455. if (e) {
  5456. this.pre_process_obj[ele.id] = e.value;
  5457. modelData[ele.id] = e.value;
  5458. if (!modelData.procedure_properties_str) {
  5459. modelData.procedure_properties_str = [];
  5460. }
  5461. modelData.procedure_properties_str[ele.id - 1] = e.label;
  5462. if (!modelData.procedure_properties) {
  5463. modelData.procedure_properties = {};
  5464. }
  5465. modelData.procedure_properties[ele.id] = e.value;
  5466. let isStart = true;
  5467. // let match_list = []; //当前选中的list
  5468. // this.process_match_list.map((item) => {
  5469. // if (item.detail[ele.id] == e.value) {
  5470. // match_list.push(item.detail);
  5471. // }
  5472. // });
  5473. // this.process_Select_match_list = match_list;
  5474. modelData.process_obj.forEach((element) => {
  5475. if (element.value == "") {
  5476. isStart = false;
  5477. }
  5478. });
  5479. //匹配工艺路线
  5480. if (isStart) {
  5481. let _target = [];
  5482. let _sorce = JSON.parse(JSON.stringify(this.process_match_list));
  5483. modelData.process_obj.forEach((element) => {
  5484. _target.push(element.value);
  5485. });
  5486. _sorce.forEach((element) => {
  5487. let _str = [];
  5488. for (const key in element.detail) {
  5489. const item = element.detail[key];
  5490. _str.push(item);
  5491. }
  5492. element.new_detail = _str.join(",");
  5493. });
  5494. let target = _target.join(",");
  5495. _sorce.forEach((element) => {
  5496. if (element.new_detail == target) {
  5497. modelData.route_id = element.id;
  5498. }
  5499. });
  5500. }
  5501. // 产品 - 部件 工艺属性联动
  5502. modelData.part.forEach((element) => {
  5503. if (!element.is_metal) {
  5504. element.process.forEach((elem) => {
  5505. if (elem.name == ele.name) {
  5506. elem.value = e.value;
  5507. if (!element.procedure_properties) {
  5508. element.procedure_properties = {};
  5509. }
  5510. if (!element.procedure_properties_str) {
  5511. element.procedure_properties_str = [];
  5512. }
  5513. element.procedure_properties[ele.id] = e.value;
  5514. element.procedure_properties_str[n] = e.label;
  5515. }
  5516. });
  5517. }
  5518. });
  5519. } else {
  5520. modelData.route_id = "";
  5521. if (typeof modelData.procedure_properties == "string") {
  5522. modelData.procedure_properties = modelData.procedure_properties.split(
  5523. ","
  5524. );
  5525. }
  5526. modelData.procedure_properties[ele.id] = "";
  5527. modelData[ele.id] = "";
  5528. }
  5529. this.$forceUpdate();
  5530. },
  5531. handlePriceFocus() {
  5532. if (this.modalData.price == 0.0 || this.modalData.price == 0) {
  5533. this.modalData.price = "";
  5534. }
  5535. },
  5536. handleUnitPriceFocus() {
  5537. if (this.modalData.unit_price == 0.0 || this.modalData.unit_price == 0) {
  5538. this.modalData.unit_price = "";
  5539. }
  5540. },
  5541. handleExtPriceFocus() {
  5542. if (this.modalData.ext_price == 0.0 || this.modalData.ext_price == 0) {
  5543. this.modalData.ext_price = "";
  5544. }
  5545. },
  5546. handleOverPriceFocus() {
  5547. if (this.modalData.over_price == 0.0 || this.modalData.over_price == 0) {
  5548. this.modalData.over_price = "";
  5549. }
  5550. },
  5551. handleMaterialChange(val, row) {
  5552. if (val) {
  5553. let tempRow = row.material_detail_list.filter(
  5554. (item) => item.material_detail_id == val
  5555. );
  5556. row.material_detail_title = tempRow[0].title;
  5557. // row.material_detail_id = tempRow.length > 0 ? tempRow[0].id : 0
  5558. this.$forceUpdate();
  5559. }
  5560. },
  5561. handleRadioClick(row) {
  5562. row.isChoosed = !row.isChoosed;
  5563. this.$forceUpdate();
  5564. },
  5565. handlePartProcessChange(val, n, row, process_detail) {
  5566. if (!row.procedure_properties) {
  5567. row.procedure_properties = {};
  5568. }
  5569. if (!row.procedure_properties_str) {
  5570. row.procedure_properties_str = [];
  5571. }
  5572. if (val) {
  5573. row.procedure_properties[process_detail.id] = val.value;
  5574. row.procedure_properties_str[n] = val.label;
  5575. } else {
  5576. row.procedure_properties[process_detail.id] = "";
  5577. row.procedure_properties_str[n] = "";
  5578. }
  5579. this.$forceUpdate();
  5580. },
  5581. looks(img) {
  5582. const array = [{ img_url: img }];
  5583. this.$previewImg({
  5584. list: array,
  5585. baseUrl: this.$store.state.ip,
  5586. baseImgField: "img_url",
  5587. baseTitleField: "",
  5588. });
  5589. },
  5590. delItems(n, arr) {
  5591. arr.splice(n, 1);
  5592. this.$forceUpdate();
  5593. },
  5594. changeIpt(e, row) {
  5595. if (this.info.img.length >= 3) {
  5596. return this.$Message.warning("图片最多上传3张");
  5597. }
  5598. let file = e.target.files[0];
  5599. this.postImg(file, row);
  5600. e.target.value = null;
  5601. },
  5602. postImg(file, row) {
  5603. let formData = new FormData();
  5604. formData.append("file", file);
  5605. this.axios.post("/api/upload_pic", formData).then((res) => {
  5606. row.push(res.data.url);
  5607. this.$forceUpdate();
  5608. });
  5609. },
  5610. },
  5611. };
  5612. </script>
  5613. <style lang="scss" scoped>
  5614. .product-img {
  5615. padding-top: 10px;
  5616. }
  5617. .product-add {
  5618. padding: 10px 0;
  5619. display: flex;
  5620. flex-wrap: wrap;
  5621. .ipt {
  5622. position: absolute;
  5623. width: 100%;
  5624. height: 100%;
  5625. opacity: 0;
  5626. cursor: pointer;
  5627. outline: none;
  5628. top: 0;
  5629. left: 0;
  5630. }
  5631. .add-items {
  5632. width: 120px;
  5633. height: 120px;
  5634. border: 1px dotted #e7e7e7;
  5635. border-radius: 5px;
  5636. display: flex;
  5637. justify-content: center;
  5638. align-items: center;
  5639. overflow: hidden;
  5640. position: relative;
  5641. flex-direction: column;
  5642. background: #f4f5f7;
  5643. .item {
  5644. width: 46px;
  5645. height: 46px;
  5646. background: #3764ff;
  5647. opacity: 0.6;
  5648. display: flex;
  5649. justify-content: center;
  5650. align-items: center;
  5651. border-radius: 50%;
  5652. color: #fff;
  5653. }
  5654. }
  5655. .items {
  5656. width: 120px;
  5657. height: 120px;
  5658. margin-bottom: 10px;
  5659. display: flex;
  5660. justify-content: center;
  5661. align-items: center;
  5662. background: #e7e7e7;
  5663. margin-right: 10px;
  5664. border-radius: 5px;
  5665. position: relative;
  5666. img {
  5667. max-width: 108px;
  5668. max-height: 108px;
  5669. }
  5670. }
  5671. }
  5672. .delete-img {
  5673. position: absolute;
  5674. right: 0px;
  5675. top: 0px;
  5676. color: red;
  5677. }
  5678. /deep/.ivu-tooltip-rel {
  5679. overflow: hidden;
  5680. text-overflow: ellipsis;
  5681. white-space: nowrap;
  5682. }
  5683. .page-edit {
  5684. overflow: hidden;
  5685. overflow-y: auto;
  5686. position: relative;
  5687. top: 20px;
  5688. height: 85%;
  5689. padding-bottom: 20px;
  5690. /deep/ .ivu-form-item {
  5691. min-width: 300px;
  5692. }
  5693. }
  5694. .auto-width {
  5695. width: 200px;
  5696. }
  5697. .items {
  5698. // box-shadow: 0 2px 7px rgba(0, 0, 0, 0.15);
  5699. border-color: transparent;
  5700. position: relative;
  5701. border-radius: 5px;
  5702. .items-header {
  5703. padding: 10px 20px;
  5704. display: flex;
  5705. justify-content: space-between;
  5706. align-items: center;
  5707. border-bottom: 1px solid #f4f4f4;
  5708. .header-left {
  5709. span {
  5710. margin-left: 10px;
  5711. }
  5712. }
  5713. }
  5714. .form-item {
  5715. padding: 20px;
  5716. }
  5717. }
  5718. .modal-scroll {
  5719. height: 600px;
  5720. overflow: scroll;
  5721. }
  5722. .modal-items {
  5723. border-radius: 5px;
  5724. border: 1px solid #dedede;
  5725. padding: 0px 10px;
  5726. margin-bottom: 40px;
  5727. }
  5728. .modal-footer-button {
  5729. display: flex;
  5730. justify-content: flex-end;
  5731. padding: 10px 0;
  5732. }
  5733. .items-table {
  5734. width: 100%;
  5735. overflow-x: scroll;
  5736. }
  5737. /deep/ .ivu-table-wrapper {
  5738. overflow: visible;
  5739. color: red;
  5740. } //穿透iview
  5741. .original-part {
  5742. padding-top: 20px;
  5743. }
  5744. .column-li {
  5745. display: flex;
  5746. justify-content: space-between;
  5747. align-items: center;
  5748. padding: 2px 5px;
  5749. }
  5750. .hierarchy {
  5751. display: flex;
  5752. justify-content: flex-start;
  5753. align-items: flex-start;
  5754. flex-wrap: wrap;
  5755. .radio-g {
  5756. padding: 10px 0;
  5757. width: 700px;
  5758. display: flex;
  5759. justify-content: flex-start;
  5760. // align-items: flex-start;
  5761. flex-wrap: wrap;
  5762. .radio-us {
  5763. background: #f4f5f7;
  5764. padding: 5px 20px;
  5765. margin-right: 18px;
  5766. margin-bottom: 10px;
  5767. color: #999999;
  5768. border-radius: 15px;
  5769. border: 1px solid #dedede;
  5770. cursor: pointer;
  5771. }
  5772. .radio-us-foc {
  5773. color: #3764ff;
  5774. background: #fff;
  5775. border: 1px solid #3764ff;
  5776. }
  5777. }
  5778. }
  5779. .nav-product {
  5780. width: 100%;
  5781. height: 50px;
  5782. display: flex;
  5783. align-items: center;
  5784. }
  5785. /deep/.ivu-poptip-inner {
  5786. max-width: 90%;
  5787. // display: flex;
  5788. // justify-content: center;
  5789. }
  5790. /deep/.ivu-poptip-body {
  5791. max-height: 600px;
  5792. overflow: hidden;
  5793. overflow-y: auto;
  5794. }
  5795. .content {
  5796. .content_header {
  5797. display: flex;
  5798. justify-content: space-between;
  5799. padding: 0 10px;
  5800. }
  5801. }
  5802. .modal_product_info {
  5803. background-color: #f5f5f5;
  5804. border-radius: 10px;
  5805. padding: 10px;
  5806. margin-bottom: 10px;
  5807. .modal_product_info_title {
  5808. font-size: 20px;
  5809. font-weight: 700;
  5810. margin-bottom: 10px;
  5811. }
  5812. .modal_product_info_content {
  5813. .part_detail_form {
  5814. /deep/.ivu-form {
  5815. display: flex;
  5816. justify-content: flex-start;
  5817. flex-wrap: wrap;
  5818. }
  5819. /deep/ .ivu-form-item {
  5820. display: inline-block;
  5821. min-width: 150px;
  5822. }
  5823. }
  5824. }
  5825. .modal_product {
  5826. /deep/.ivu-form {
  5827. display: flex;
  5828. justify-content: flex-start;
  5829. flex-wrap: wrap;
  5830. }
  5831. /deep/ .ivu-form-item {
  5832. display: inline-block;
  5833. min-width: 200px;
  5834. }
  5835. }
  5836. .modal_parts {
  5837. /deep/.ivu-form {
  5838. display: flex;
  5839. justify-content: flex-start;
  5840. flex-wrap: wrap;
  5841. }
  5842. /deep/ .ivu-form-item {
  5843. display: inline-block;
  5844. min-width: 30px;
  5845. }
  5846. }
  5847. .modal_extra {
  5848. /deep/.ivu-form {
  5849. display: flex;
  5850. justify-content: flex-start;
  5851. flex-wrap: wrap;
  5852. }
  5853. /deep/ .ivu-form-item {
  5854. display: inline-block;
  5855. min-width: 100px;
  5856. }
  5857. }
  5858. }
  5859. /deep/.ivu-modal-body {
  5860. max-height: 800px;
  5861. }
  5862. .hide_part_detail {
  5863. display: none;
  5864. }
  5865. /deep/.ivu-form-item-content {
  5866. span {
  5867. vertical-align: middle;
  5868. }
  5869. }
  5870. /deep/.vxe-table--render-default .vxe-cell {
  5871. padding: 0;
  5872. }
  5873. </style>