edit.vue 177 KB

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