edit.vue 182 KB

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