edit.vue 203 KB

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