edit.vue 180 KB

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