deorderdetail.vue 83 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660
  1. <template>
  2. <div class="BidSystemProductDeOrderDeorderdetail">
  3. <Toptitle :title="type == 1 ? '拆单编辑' : '拆单详情'">
  4. <slot name="titleButton">
  5. <Button
  6. @click="goback()"
  7. type="primary"
  8. ghost
  9. style="margin-right: 10px"
  10. >返回</Button
  11. >
  12. <Button
  13. @click="postData()"
  14. type="primary"
  15. v-if="type == 1"
  16. ghost
  17. style="margin-right: 10px"
  18. >保存</Button
  19. >
  20. </slot>
  21. </Toptitle>
  22. <div class="top_info">
  23. <div><span>产品名称:</span>{{ formData.title }}</div>
  24. <div><span>计量单位:</span>{{ formData.unit }}</div>
  25. <div><span>数量:</span>{{ formData.num }}</div>
  26. <!-- <div><span>价格:</span>{{ formData.price }}</div> -->
  27. <div><span>规格:</span>{{ formData.measure }}</div>
  28. <div><span>工艺属性:</span>{{ formData.process_property }}</div>
  29. <div>
  30. <span>图纸:</span>
  31. <div>
  32. <span
  33. v-for="item in formData.url"
  34. :key="item"
  35. @click="checkImg(formData.url)"
  36. >
  37. <img :src="$store.state.ip + item" alt="" />
  38. </span>
  39. </div>
  40. </div>
  41. <div><span>图号:</span>{{ formData.url_number }}</div>
  42. <div><span>备注:</span>{{ formData.remark }}</div>
  43. </div>
  44. <div class="similar_product">
  45. <!-- <div>
  46. <span>价格:</span>
  47. <Input
  48. type="text"
  49. size="small"
  50. :disabled="type == 2"
  51. v-model="formData.real_price"
  52. style="width: 150px; margin-right: 10px"
  53. placeholder="请输入价格"
  54. />
  55. </div> -->
  56. <div>
  57. <span>型号:</span>
  58. <Input
  59. type="text"
  60. size="small"
  61. :disabled="type == 2"
  62. v-model="formData.model"
  63. style="width: 150px; margin-right: 10px"
  64. placeholder="请输入型号"
  65. />
  66. </div>
  67. <div>
  68. <div
  69. style="
  70. display: flex;
  71. align-items: center;
  72. width: 100%;
  73. margin-right: 10px;
  74. "
  75. >
  76. <Dropdown>
  77. <a :disabled="type == 2">选择产品分类</a>
  78. <DropdownMenu slot="list">
  79. <Downtree
  80. @childByValue="handleClick"
  81. :parent="productTypes"
  82. ></Downtree>
  83. </DropdownMenu>
  84. </Dropdown>
  85. <a
  86. :disabled="type == 2"
  87. style="margin-left: 20px"
  88. v-if="nowSelectObj.title"
  89. >{{ nowSelectObj.title || "" }}</a
  90. >
  91. </div>
  92. </div>
  93. <Button
  94. @click="handleSimilarProductShow"
  95. type="primary"
  96. :disabled="type == 2"
  97. style="margin-right: 10px"
  98. >选择相似产品</Button
  99. >
  100. </div>
  101. <div
  102. class="parts"
  103. v-for="(partsItem, partsIndex) in formData.parts"
  104. :key="partsIndex"
  105. >
  106. <div class="parts_title">
  107. <h2>部件{{ partsIndex + 1 }}</h2>
  108. <div>
  109. <Button
  110. @click="handlePartAdd(partsItem, partsIndex)"
  111. type="success"
  112. size="small"
  113. :disabled="type == 2"
  114. style="margin-right: 10px"
  115. >新增部件</Button
  116. >
  117. <Button
  118. @click="handlePartCopy(partsItem, partsIndex)"
  119. type="primary"
  120. :disabled="type == 2"
  121. size="small"
  122. style="margin-right: 10px"
  123. >复制部件</Button
  124. >
  125. <Button
  126. @click="handlePartDele(partsItem, partsIndex)"
  127. v-show="formData.parts.length > 1"
  128. type="error"
  129. :disabled="type == 2"
  130. size="small"
  131. style="margin-right: 10px"
  132. >删除部件</Button
  133. >
  134. </div>
  135. </div>
  136. <div class="parts_top">
  137. <Form :model="partsItem" :label-width="100">
  138. <FormItem label="部件分类名称:">
  139. <Select
  140. v-model="partsItem.parts_type"
  141. size="small"
  142. clearable
  143. filterable
  144. :disabled="type == 2"
  145. @on-change="(e) => handlePartsSelect(e, partsItem)"
  146. style="width: 150px"
  147. >
  148. <Option
  149. v-for="sitem in partsList"
  150. :key="sitem.id"
  151. :label="sitem.title"
  152. :value="sitem.id"
  153. >
  154. </Option>
  155. </Select>
  156. </FormItem>
  157. <FormItem label="标签:">
  158. <RadioGroup v-model="partsItem.pay_state" size="small">
  159. <Radio :label="1" :disabled="type == 2">是</Radio>
  160. <Radio :label="0" :disabled="type == 2">否</Radio>
  161. </RadioGroup>
  162. </FormItem>
  163. <FormItem label="部件名称:">
  164. <Select
  165. v-model="partsItem.part_id"
  166. size="small"
  167. clearable
  168. filterable
  169. allow-create
  170. label-in-value
  171. :disabled="type == 2"
  172. @on-create="(e) => handlePartTitleCreate(partsItem, e)"
  173. @on-change="(e) => handlePartsNameSelect(partsItem, e)"
  174. style="width: 150px"
  175. >
  176. <Option
  177. v-for="sitem in partsItem.partsNameList"
  178. :key="sitem.id"
  179. :label="sitem.title"
  180. :value="sitem.id"
  181. >
  182. </Option>
  183. </Select>
  184. </FormItem>
  185. <FormItem label="单位:">
  186. <Input
  187. type="text"
  188. size="small"
  189. :disabled="type == 2"
  190. v-model="partsItem.company"
  191. style="width: 150px"
  192. placeholder="请输入单位"
  193. />
  194. </FormItem>
  195. <FormItem label="工艺组合名称:">
  196. <Select
  197. v-model="partsItem.processCombination"
  198. size="small"
  199. clearable
  200. filterable
  201. allow-create
  202. label-in-value
  203. :disabled="type == 2"
  204. @on-create="(e) => handleProcessRouteCreate(partsItem, e)"
  205. @on-change="(e) => handleProcessRouteSelect(partsItem, e)"
  206. style="width: 150px"
  207. >
  208. <Option
  209. v-for="sitem in partsItem.partsProcessRouteList"
  210. :key="sitem.id"
  211. :label="sitem.title"
  212. :value="sitem.id"
  213. >
  214. </Option>
  215. </Select>
  216. </FormItem>
  217. <FormItem label="工艺价格:">
  218. <Input
  219. type="text"
  220. size="small"
  221. :disabled="!partsItem.isAddProcessRoute || type == 2"
  222. v-model="partsItem.process_price"
  223. style="width: 150px"
  224. placeholder="请输入工艺价格"
  225. />
  226. </FormItem>
  227. <FormItem label="高:">
  228. <Input
  229. type="text"
  230. size="small"
  231. @on-focus="openKey(partsIndex, -1, 'long', partsItem)"
  232. :disabled="type == 2"
  233. v-model="partsItem.long"
  234. style="width: 150px"
  235. placeholder="请输入高"
  236. />
  237. </FormItem>
  238. <FormItem label="宽:">
  239. <Input
  240. type="text"
  241. size="small"
  242. @on-focus="openKey(partsIndex, -1, 'wide', partsItem)"
  243. :disabled="type == 2"
  244. v-model="partsItem.wide"
  245. style="width: 150px"
  246. placeholder="请输入宽"
  247. />
  248. </FormItem>
  249. <FormItem label="厚:">
  250. <Input
  251. type="text"
  252. size="small"
  253. @on-focus="openKey(partsIndex, -1, 'thick', partsItem)"
  254. :disabled="type == 2"
  255. v-model="partsItem.thick"
  256. style="width: 150px"
  257. placeholder="请输入厚"
  258. />
  259. </FormItem>
  260. <FormItem label="产值比例(%):">
  261. <Input
  262. type="text"
  263. size="small"
  264. :disabled="type == 2"
  265. @on-blur="(e) => handleProportionEdit(e, partsItem, partsIndex)"
  266. v-model="partsItem.proportion"
  267. style="width: 150px"
  268. placeholder="请输入产值比"
  269. />
  270. </FormItem>
  271. </Form>
  272. </div>
  273. <div class="parts_content">
  274. <span>工艺属性:</span>
  275. <div
  276. class="hierarchy"
  277. v-for="(item, index) of partsItem.ProcessAttrList"
  278. :key="item.id"
  279. >
  280. <span>{{ item.name || item.title }}(单选):</span>
  281. <div
  282. v-for="_item in item.cld"
  283. class="radio-g"
  284. :key="_item.type_title"
  285. >
  286. <!-- v-show="_item.display" -->
  287. <!-- v-show="_item.list && _item.list.length > 0" -->
  288. <div class="tit_box">
  289. <span :class="['box-us']" @click="setBoxChange(item, _item)">{{
  290. _item.type_title
  291. }}</span>
  292. </div>
  293. <div class="radio-box">
  294. <div
  295. v-for="__item in _item.list"
  296. @click="
  297. setRadioChange(_item, __item, index, partsItem, item.cld)
  298. "
  299. :class="['radio-us', __item.show ? 'radio-us-foc' : '']"
  300. :key="__item.id"
  301. >
  302. {{ __item.title }}
  303. </div>
  304. </div>
  305. </div>
  306. <!-- <div class="radio-g">
  307. <div @click="setRadioChange(item, _item, index, partsItem)"
  308. :class="[
  309. 'radio-us',
  310. _item.show ? 'radio-us-foc' : '',
  311. _item.display ? 'radio-us-none' : '',
  312. ]"
  313. v-for="_item of item.cld"
  314. :key="_item.id">
  315. {{ _item.title }}
  316. </div>
  317. </div> -->
  318. </div>
  319. <div style="padding: 10px 0">
  320. <span>工艺路线:</span>
  321. <Tooltip max-width="200px">
  322. <div
  323. slot="content"
  324. v-show="!partsItem.isAddProcessRoute || type == 2"
  325. >
  326. 若要编辑工艺路线,请先选择或更改工艺组合
  327. </div>
  328. <Button
  329. :disabled="!partsItem.isAddProcessRoute || type == 2"
  330. @click="editRouter(partsItem, partsIndex)"
  331. >选择工艺路线</Button
  332. >
  333. {{ partsItem.process_name }}
  334. </Tooltip>
  335. </div>
  336. <div class="parts_content_lineTable">
  337. <Table
  338. :columns="partsProcessLineColumns"
  339. border
  340. :data="partsItem.partsProcessLineTableData"
  341. >
  342. <!-- <template slot="processLineSet" slot-scope="{ row, index }">
  343. <a
  344. :style="
  345. type == 2
  346. ? 'margin: 0 5px; color: #ccc'
  347. : 'margin: 0 5px; color: red'
  348. "
  349. :disabled="!partsItem.isAddProcessRoute || type == 2"
  350. @click="handleProcessLineDele(row, index, partsIndex)"
  351. >删除</a
  352. >
  353. </template> -->
  354. </Table>
  355. </div>
  356. <div class="parts_content_part">
  357. <span>零部件添加</span>
  358. <Button
  359. @click="handlePartWoodAdd(partsIndex)"
  360. type="primary"
  361. size="small"
  362. ghost
  363. :disabled="!partsItem.isAddPart || type == 2"
  364. style="margin-right: 10px"
  365. >新增木板</Button
  366. >
  367. </div>
  368. <div class="parts_content_partTable">
  369. <Table
  370. :columns="partsPartColumns"
  371. border
  372. :data="partsItem.partsWoodTableData"
  373. >
  374. <template slot-scope="{ index }" slot="partNameSet">
  375. <Input
  376. placeholder="名称"
  377. :disabled="!partsItem.isAddPart || type == 2"
  378. v-model="partsItem.partsWoodTableData[index].spare_parts"
  379. />
  380. </template>
  381. <template slot-scope="{ row, index }" slot="partSpare_partsSet">
  382. <div>
  383. <Select
  384. filterable
  385. clearable
  386. :disabled="!partsItem.isAddPart || type == 2"
  387. label-in-value
  388. @on-change="changeSe($event, index, partsIndex, row)"
  389. v-model="partsItem.partsWoodTableData[index].material_id"
  390. >
  391. <Option
  392. :data-unit="item.unit"
  393. :tag="item.high"
  394. v-for="item of materialWoodList"
  395. :key="item.id"
  396. :value="item.id"
  397. :label="item.title"
  398. ></Option>
  399. </Select>
  400. </div>
  401. </template>
  402. <template slot-scope="{ index }" slot="partNumberSet">
  403. <Input
  404. placeholder="数量"
  405. :disabled="!partsItem.isAddPart || type == 2"
  406. v-model="partsItem.partsWoodTableData[index].number"
  407. />
  408. </template>
  409. <template slot-scope="{ index }" slot="partLongSet">
  410. <Input
  411. @on-focus="openKey(partsIndex, index, 'long', partsItem)"
  412. :disabled="!partsItem.isAddPart || type == 2"
  413. placeholder="高"
  414. v-model="partsItem.partsWoodTableData[index].long"
  415. />
  416. </template>
  417. <template slot-scope="{ index }" slot="partWideSet">
  418. <Input
  419. @on-focus="openKey(partsIndex, index, 'wide', partsItem)"
  420. :disabled="!partsItem.isAddPart || type == 2"
  421. placeholder="宽"
  422. v-model="partsItem.partsWoodTableData[index].wide"
  423. />
  424. </template>
  425. <template slot-scope="{ index }" slot="partRequirementSet">
  426. <Select
  427. placeholder="工艺要求"
  428. filterable
  429. clearable
  430. :disabled="!partsItem.isAddPart || type == 2"
  431. v-model="
  432. partsItem.partsWoodTableData[index]
  433. .technological_requirement_id
  434. "
  435. >
  436. <Option
  437. v-for="item in processRequireList"
  438. :key="item.id"
  439. :value="item.id"
  440. :label="item.title"
  441. ></Option>
  442. </Select>
  443. </template>
  444. <template slot-scope="{ index }" slot="partSub_numSet">
  445. <Select
  446. placeholder="贴面数"
  447. filterable
  448. clearable
  449. :disabled="!partsItem.isAddPart || type == 2"
  450. v-model="partsItem.partsWoodTableData[index].sub_num"
  451. >
  452. <Option :value="0" label="0"></Option>
  453. <Option :value="1" label="1"></Option>
  454. <Option :value="2" label="2"></Option>
  455. </Select>
  456. </template>
  457. <template slot-scope="{ index }" slot="partVeneer_idSet">
  458. <Select
  459. placeholder="贴木皮"
  460. filterable
  461. clearable
  462. :disabled="!partsItem.isAddPart || type == 2"
  463. v-model="partsItem.partsWoodTableData[index].veneer_id"
  464. >
  465. <Option
  466. v-for="item in materialWoodSkinList"
  467. :key="item.id"
  468. :value="item.id"
  469. :label="item.title"
  470. ></Option>
  471. </Select>
  472. </template>
  473. <template slot-scope="{ index }" slot="partPaint_idSet">
  474. <Select
  475. placeholder="油漆"
  476. filterable
  477. clearable
  478. :disabled="!partsItem.isAddPart || type == 2"
  479. v-model="partsItem.partsWoodTableData[index].paint_id"
  480. >
  481. <Option
  482. v-for="item in materialPaintList"
  483. :key="item.id"
  484. :value="item.id"
  485. :label="item.title"
  486. ></Option>
  487. </Select>
  488. </template>
  489. <template slot-scope="{ index }" slot="partLabelSet">
  490. <Select
  491. placeholder="标签"
  492. filterable
  493. clearable
  494. :disabled="!partsItem.isAddPart || type == 2"
  495. v-model="partsItem.partsWoodTableData[index].label"
  496. >
  497. <Option :value="1" label="小芯片"></Option>
  498. <Option :value="2" label="大芯片"></Option>
  499. <Option :value="3" label="否"></Option>
  500. <Option :value="4" label="标签"></Option>
  501. </Select>
  502. </template>
  503. <template slot-scope="{ index }" slot="partPrint_numSet">
  504. <Input
  505. placeholder="打印数量"
  506. :disabled="!partsItem.isAddPart || type == 2"
  507. v-model="partsItem.partsWoodTableData[index].print_num"
  508. />
  509. </template>
  510. <template slot="partSet" slot-scope="{ row, index }">
  511. <a
  512. style="margin: 0 5px"
  513. :disabled="!partsItem.isAddPart || type == 2"
  514. @click="handlePartWoodCopy(row, index, partsIndex)"
  515. >复制</a
  516. >
  517. <a
  518. :style="
  519. !partsItem.isAddPart || type == 2
  520. ? 'margin: 0 5px; color: #ccc'
  521. : 'margin: 0 5px; color: red'
  522. "
  523. :disabled="!partsItem.isAddPart || type == 2"
  524. @click="handlePartWoodDele(row, index, partsIndex)"
  525. >删除</a
  526. >
  527. </template>
  528. </Table>
  529. </div>
  530. <div class="parts_content_metals">
  531. <Button
  532. @click="handlePartMetalsAdd(partsIndex)"
  533. type="primary"
  534. size="small"
  535. :disabled="!partsItem.isAddPart || type == 2"
  536. ghost
  537. style="margin-right: 10px"
  538. >新增五金</Button
  539. >
  540. </div>
  541. <div class="parts_content_metalsTable">
  542. <Table
  543. :columns="partsMetalseColunms"
  544. border
  545. :data="partsItem.partsMetalseData"
  546. >
  547. <template slot="metalSpare_partsSet" slot-scope="{ index }">
  548. <Select
  549. filterable
  550. clearable
  551. :disabled="!partsItem.isAddPart || type == 2"
  552. @on-change="changeMetal($event, index, partsIndex)"
  553. label-in-value
  554. placeholder="请选择"
  555. v-model="partsItem.partsMetalseData[index].material_id"
  556. >
  557. <Option
  558. v-for="item in metalsList"
  559. :key="item.id"
  560. :data-unit="item.unit"
  561. :value="item.id"
  562. :label="item.title"
  563. ></Option>
  564. </Select>
  565. </template>
  566. <template slot-scope="{ index }" slot="metalNumberSet">
  567. <Input
  568. placeholder="数量"
  569. :disabled="!partsItem.isAddPart || type == 2"
  570. v-model="partsItem.partsMetalseData[index].number"
  571. />
  572. </template>
  573. <template slot-scope="{ index }" slot="metalPriceSet">
  574. <Input
  575. placeholder="单价"
  576. :disabled="!partsItem.isAddPart || type == 2"
  577. v-model="partsItem.partsMetalseData[index].price"
  578. />
  579. </template>
  580. <template slot="metalTotal_priceSet" slot-scope="{ row }">
  581. {{ row.number * row.price }}
  582. </template>
  583. <template slot="metalsSet" slot-scope="{ row, index }">
  584. <a
  585. style="margin: 0 5px"
  586. :disabled="!partsItem.isAddPart || type == 2"
  587. @click="handlePartMetalsCopy(row, index, partsIndex)"
  588. >复制</a
  589. >
  590. <a
  591. :style="
  592. !partsItem.isAddPart || type == 2
  593. ? 'margin: 0 5px; color: #ccc'
  594. : 'margin: 0 5px; color: red'
  595. "
  596. :disabled="!partsItem.isAddPart || type == 2"
  597. @click="handlePartMetalsDele(row, index, partsIndex)"
  598. >删除</a
  599. >
  600. </template>
  601. </Table>
  602. </div>
  603. </div>
  604. </div>
  605. <li v-for="item in formData.parts" v-show="false" :key="item.id"></li>
  606. <!-- 相似产品弹窗 -->
  607. <el-dialog
  608. title="选择相似产品"
  609. :visible="showSimilarProductModal"
  610. :close-on-click-modal="false"
  611. :close-on-press-escape="false"
  612. class="similarProductModal"
  613. width="1000px"
  614. >
  615. <Form :label-width="100" :model="similarProductData">
  616. <FormItem label="产品分类">
  617. <el-cascader
  618. clearable
  619. v-model="similarProductData.type_name"
  620. size="small"
  621. style="width: 120px"
  622. :show-all-levels="false"
  623. :options="PDTTypeList"
  624. :props="{
  625. expandTrigger: 'hover',
  626. children: 'child',
  627. value: 'title',
  628. label: 'title',
  629. checkStrictly: true,
  630. emitPath: false,
  631. }"
  632. @change="(e) => hanndleAddPDTTypeChange(similarProductData, e)"
  633. ></el-cascader>
  634. <!-- <Select
  635. v-model="similarProductData.type_name"
  636. placeholder="请选择"
  637. style="width: 120px"
  638. size="small"
  639. >
  640. <Option
  641. v-for="item in PDTTypeList"
  642. :value="item.title"
  643. :key="item.title"
  644. :label="item.title"
  645. ></Option>
  646. </Select> -->
  647. </FormItem>
  648. <FormItem label="产品名称:">
  649. <Input
  650. type="text"
  651. size="small"
  652. clearable
  653. v-model="similarProductData.title"
  654. style="width: 120px"
  655. />
  656. </FormItem>
  657. <FormItem label="产品型号">
  658. <Input
  659. type="text"
  660. size="small"
  661. clearable
  662. v-model="similarProductData.model"
  663. placeholder="请输入"
  664. style="width: 120px"
  665. />
  666. </FormItem>
  667. <FormItem label="图号:">
  668. <Input
  669. type="text"
  670. size="small"
  671. clearable
  672. v-model="similarProductData.url_number"
  673. style="width: 120px"
  674. />
  675. </FormItem>
  676. <Button
  677. type="primary"
  678. style="margin: 0 10px"
  679. @click="handleSimilarProductSearch"
  680. >搜索</Button
  681. >
  682. </Form>
  683. <Table
  684. :columns="similarProductColunms"
  685. border
  686. highlight-row
  687. :disabled-hover="true"
  688. @on-current-change="handleSimilarProductSelected"
  689. :loading="similarProductLoading"
  690. :data="similarProductData.similarProductList"
  691. >
  692. </Table>
  693. <div class="page">
  694. <Page
  695. @on-change="changeSimilarProductPage"
  696. :current="similarProductData.page_index"
  697. show-total
  698. :total="similarProductData.total"
  699. size="small"
  700. :page_size="similarProductData.page_size"
  701. />
  702. </div>
  703. <div class="modal-footer" slot="footer">
  704. <Button
  705. style="margin-right:10px"
  706. @click="showSimilarProductModal = false"
  707. >取消</Button
  708. >
  709. <Button
  710. type="primary"
  711. @click="handleSimilarProductConfirm(tempSimilarProductData.id)"
  712. >确认</Button
  713. >
  714. </div>
  715. </el-dialog>
  716. <!-- 选择工艺路线弹窗 -->
  717. <Modal
  718. class-name="vertical-center-modal"
  719. v-model="showProcessLineModal"
  720. title="选择工艺路线"
  721. >
  722. <div class="modal_process_route">
  723. <div class="modal_process_route_top">
  724. <div>
  725. <span>工艺路线名称:</span>
  726. <Input
  727. v-model="tempProcessLine.title"
  728. style="width: 120px"
  729. placeholder="请输入"
  730. >
  731. </Input>
  732. </div>
  733. <Button
  734. type="primary"
  735. @click="handleSearchProcessLine(tempProcessLine.title)"
  736. >搜索</Button
  737. >
  738. </div>
  739. <div class="modal_process_route_content">
  740. <Table
  741. border
  742. :columns="processLineColumns"
  743. :data="processLineTableData"
  744. >
  745. <template slot="processLineSet" slot-scope="{ row, index }">
  746. <a style="margin: 0 5px" @click="handleProcessLineSet(row, index)"
  747. >选择</a
  748. >
  749. </template>
  750. </Table>
  751. </div>
  752. </div>
  753. </Modal>
  754. <Modal
  755. class-name="vertical-center-modal vertical-center-modal1"
  756. v-model="showProcessLineDetailModal"
  757. width="80%"
  758. :mask-closable="false"
  759. title="工艺路线"
  760. >
  761. <div class="modal_process_route modal_process_route1">
  762. <div>
  763. <span style="width: 100px">id: </span
  764. ><Input
  765. v-model="info.id"
  766. disabled
  767. placeholder="自动生成"
  768. style="width: 150px"
  769. size="small"
  770. />
  771. </div>
  772. <div>
  773. <span style="width: 100px">工艺路线名称: </span
  774. ><Input
  775. v-model="info.title"
  776. placeholder="请输入工艺路线名称"
  777. size="small"
  778. style="width: 250px"
  779. />
  780. </div>
  781. </div>
  782. <div class="modal_content">
  783. <div class="modal_content_left">
  784. <span>已选:</span>
  785. <SlickList
  786. :distance="10"
  787. :lockToContainerEdges="true"
  788. axis="x,y,xy"
  789. lockAxis="xy"
  790. v-model="selectTags"
  791. class="SortableList"
  792. @input="getChangeLists"
  793. >
  794. <SlickItem
  795. style="z-index: 9999"
  796. v-for="(item, key) of selectTags"
  797. :key="key"
  798. class="SortableItem"
  799. :index="key"
  800. >
  801. <Tooltip>
  802. <div slot="content">
  803. <p>工时:{{ item.time }}</p>
  804. <p>工价:{{ item.wages }}</p>
  805. <p>产能:{{ item.capacity }}</p>
  806. </div>
  807. <div class="tag-modal">
  808. <div class="before">{{ key + 1 }}</div>
  809. <Tag
  810. @on-close="closeTag(key, selectTags, item)"
  811. color="primary"
  812. type="border"
  813. closable
  814. >{{ item.title }}</Tag
  815. >
  816. </div>
  817. </Tooltip>
  818. </SlickItem>
  819. </SlickList>
  820. </div>
  821. <div class="modal_content_right">
  822. <div v-for="(item, index) of info.bps" :key="index">
  823. <div v-if="item.cld && item.cld.length > 0">
  824. <span style="font-weight:bold">{{ item.title }}</span>
  825. <div
  826. style="display: flex;justify-content: flex-start;flex-wrap: wrap;"
  827. >
  828. <div
  829. v-for="(_item, _index) in item.cld"
  830. :key="_index"
  831. :style="
  832. _item.p_id
  833. ? [{ 'margin-left': '10px' }]
  834. : [{ 'margin-left': '10px' }, { width: '100%' }]
  835. "
  836. >
  837. <div v-if="_item.cld && _item.cld.length > 0">
  838. <div>
  839. <div style="font-weight:bold;width:100%">
  840. {{ _item.title }}:
  841. </div>
  842. <div
  843. style="display: flex;justify-content: flex-start;flex-wrap: wrap;"
  844. >
  845. <div
  846. v-for="(__item, __index) in _item.cld"
  847. :key="__index"
  848. :style="
  849. __item.p_id
  850. ? [{ 'margin-left': '10px' }]
  851. : [{ 'margin-left': '10px' }, { width: '100%' }]
  852. "
  853. >
  854. <div v-if="__item.cld && __item.cld.length > 0">
  855. <span style="font-weight:bold"
  856. >{{ __item.title }}:</span
  857. >
  858. <div
  859. style="display: flex;justify-content: flex-start;flex-wrap: wrap;"
  860. >
  861. <Tooltip
  862. v-for="(___item, ___index) of __item.cld"
  863. :key="___index"
  864. >
  865. <div slot="content">
  866. <p>工时:{{ ___item.time }}</p>
  867. <p>工价:{{ ___item.wages }}</p>
  868. <p>产能:{{ ___item.capacity }}</p>
  869. </div>
  870. <Checkbox
  871. @on-change="
  872. changeCheck($event, ___item, selectTags)
  873. "
  874. v-model="___item.show"
  875. style="padding: 0px 5px"
  876. >{{ ___item.title }}</Checkbox
  877. >
  878. </Tooltip>
  879. </div>
  880. </div>
  881. <div v-else>
  882. <Tooltip v-if="__item.p_id">
  883. <div slot="content">
  884. <p>工时:{{ __item.time }}</p>
  885. <p>工价:{{ __item.wages }}</p>
  886. <p>产能:{{ __item.capacity }}</p>
  887. </div>
  888. <Checkbox
  889. @on-change="
  890. changeCheck($event, __item, selectTags)
  891. "
  892. v-model="__item.show"
  893. style="padding: 0px 5px"
  894. >{{ __item.title }}</Checkbox
  895. >
  896. </Tooltip>
  897. </div>
  898. </div>
  899. </div>
  900. </div>
  901. </div>
  902. <div v-else>
  903. <Tooltip v-if="_item.p_id">
  904. <div slot="content">
  905. <p>工时:{{ _item.time }}</p>
  906. <p>工价:{{ _item.wages }}</p>
  907. <p>产能:{{ _item.capacity }}</p>
  908. </div>
  909. <Checkbox
  910. @on-change="changeCheck($event, _item, selectTags)"
  911. v-model="_item.show"
  912. style="padding: 0px 5px"
  913. >{{ _item.title }}</Checkbox
  914. >
  915. </Tooltip>
  916. <!-- <span v-else>{{ _item.title }}</span> -->
  917. </div>
  918. </div>
  919. </div>
  920. </div>
  921. <!-- <div v-else>{{ item.title }}</div> -->
  922. </div>
  923. </div>
  924. </div>
  925. <div slot="footer">
  926. <Button
  927. @click="
  928. showProcessLineDetailModal = false;
  929. showProcessLineModal = true;
  930. "
  931. type="primary"
  932. ghost
  933. >取消</Button
  934. >
  935. <Button @click="saveTableData()" type="primary">确定</Button>
  936. </div>
  937. </Modal>
  938. <!-- 输入框弹窗 -->
  939. <Modal
  940. v-model="showKey"
  941. :width="1250"
  942. :mask-closable="false"
  943. :closable="false"
  944. >
  945. <div>
  946. <KeyBoard
  947. :rightData="measureList"
  948. @cancel="cancelKey"
  949. @success="successKey"
  950. class="key-co"
  951. />
  952. </div>
  953. <div slot="footer"></div>
  954. </Modal>
  955. </div>
  956. </template>
  957. <script>
  958. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  959. // 例如:import 《组件名称》 from '《组件路径》';
  960. import { SlickList, SlickItem } from "vue-slicksort";
  961. import KeyBoard from "../../../components/keyboard/index";
  962. import Downtree from "../../../components/drowDown/index";
  963. export default {
  964. name: "BidSystemProductDeOrderDeorderdetail",
  965. components: {
  966. SlickList,
  967. SlickItem,
  968. KeyBoard,
  969. Downtree,
  970. },
  971. props: {},
  972. // import引入的组件需要注入到对象中才能使用
  973. data() {
  974. // 这里存放数据
  975. return {
  976. // 1拆单 2详情
  977. type: this.$route.query.type,
  978. formData: {
  979. title: "", //产品名称
  980. num: "", //数量
  981. // price: "", //价格
  982. measure: "", //规格
  983. process_property: "", //工艺属性
  984. url: [], //图纸
  985. url_number: "", //图号
  986. remark: "", //备注
  987. parts: [
  988. //产品列表
  989. {
  990. isAddPart: true, //是否为新增部件
  991. isAddProcessRoute: true, //是否为新增工艺组合
  992. long: "",
  993. width: "",
  994. thick: "",
  995. parts_type: "", //部件分类名称
  996. pay_state: "", //标签
  997. part_id: "", //部件名称
  998. company: "", //单位
  999. processCombination: "", //工艺组合名称
  1000. process_price: "", //工艺价格
  1001. proportion: "", //产值比例
  1002. properties: [], //工艺属性
  1003. ProcessAttrList: [
  1004. {
  1005. id: "",
  1006. cld: [{ id: "", title: "" }],
  1007. },
  1008. ], //工艺属性列表
  1009. partsProcessLineTableData: [
  1010. // {
  1011. // id: '',
  1012. // type: '',
  1013. // title: '',
  1014. // time: '',
  1015. // wages: '',
  1016. // capacity: '',
  1017. // }
  1018. ], //工艺路线表格
  1019. partsWoodTableData: [
  1020. {
  1021. title: "",
  1022. spare_parts: "",
  1023. number: "",
  1024. company: "",
  1025. long: "",
  1026. wide: "",
  1027. thick: "",
  1028. technological_requirement_id: "",
  1029. sub_num: "",
  1030. veneer_id: "",
  1031. paint_id: "",
  1032. label: "",
  1033. print_num: "",
  1034. },
  1035. ], //木板表格
  1036. partsMetalseData: [
  1037. {
  1038. spare_parts: "",
  1039. number: "",
  1040. company: "",
  1041. price: "",
  1042. total_price: "",
  1043. },
  1044. ], //五金表格
  1045. partsNameList: [{ id: "", title: "" }], //部件名称列表
  1046. partsProcessRouteList: [{ id: "", title: "" }], //工艺组合名称列表
  1047. checkBox: [],
  1048. },
  1049. ],
  1050. },
  1051. tempProcessLine: {
  1052. title: "",
  1053. },
  1054. processLineTableData: [],
  1055. processRouteId: "",
  1056. processRouteName: "",
  1057. partsProcessLineColumns: [
  1058. { title: "序号", type: "index", minWidth: 30, align: "center" },
  1059. // { title: "工序分类", key: "type", align: "center" },
  1060. { title: "工序名称", key: "title", align: "center" },
  1061. { title: "工时", key: "time", align: "center" },
  1062. { title: "工价", key: "wages", align: "center" },
  1063. { title: "产能", key: "capacity", align: "center" },
  1064. // { title: "操作", key: "set", align: "center", slot: "processLineSet" },
  1065. ], //工艺路线表头
  1066. partsPartColumns: [
  1067. {
  1068. title: "名称",
  1069. key: "spare_parts",
  1070. align: "center",
  1071. minWidth: 120,
  1072. slot: "partNameSet",
  1073. },
  1074. {
  1075. title: "木板",
  1076. key: "title",
  1077. align: "center",
  1078. minWidth: 120,
  1079. slot: "partSpare_partsSet",
  1080. },
  1081. {
  1082. title: "数量",
  1083. key: "number",
  1084. align: "center",
  1085. minWidth: 100,
  1086. slot: "partNumberSet",
  1087. },
  1088. { title: "单位", key: "company", align: "center", minWidth: 80 },
  1089. {
  1090. title: "高",
  1091. key: "long",
  1092. align: "center",
  1093. minWidth: 120,
  1094. slot: "partLongSet",
  1095. },
  1096. {
  1097. title: "宽",
  1098. key: "wide",
  1099. align: "center",
  1100. minWidth: 120,
  1101. slot: "partWideSet",
  1102. },
  1103. { title: "厚", key: "thick", align: "center", minWidth: 120 },
  1104. {
  1105. title: "工艺要求",
  1106. key: "technological_requirement_id",
  1107. align: "center",
  1108. minWidth: 140,
  1109. slot: "partRequirementSet",
  1110. },
  1111. {
  1112. title: "贴面数",
  1113. key: "sub_num",
  1114. align: "center",
  1115. minWidth: 120,
  1116. slot: "partSub_numSet",
  1117. },
  1118. {
  1119. title: "贴木皮名称",
  1120. key: "veneer_id",
  1121. align: "center",
  1122. minWidth: 140,
  1123. slot: "partVeneer_idSet",
  1124. },
  1125. {
  1126. title: "油漆组合",
  1127. key: "paint_id",
  1128. align: "center",
  1129. minWidth: 140,
  1130. slot: "partPaint_idSet",
  1131. },
  1132. {
  1133. title: "标签",
  1134. key: "label",
  1135. align: "center",
  1136. minWidth: 120,
  1137. slot: "partLabelSet",
  1138. },
  1139. {
  1140. title: "打印数量",
  1141. key: "print_num",
  1142. align: "center",
  1143. minWidth: 100,
  1144. slot: "partPrint_numSet",
  1145. },
  1146. {
  1147. title: "操作",
  1148. key: "name",
  1149. align: "center",
  1150. slot: "partSet",
  1151. fixed: "right",
  1152. minWidth: 140,
  1153. },
  1154. ], //零部件表头
  1155. processLineColumns: [
  1156. { title: "ID", align: "center", key: "id" },
  1157. { title: "工艺路线名称", align: "center", key: "title" },
  1158. { title: "操作", align: "center", key: "id", slot: "processLineSet" },
  1159. ],
  1160. partsMetalseColunms: [
  1161. {
  1162. title: "五金",
  1163. key: "material_id",
  1164. align: "center",
  1165. minWidth: 80,
  1166. slot: "metalSpare_partsSet",
  1167. },
  1168. {
  1169. title: "数量",
  1170. key: "number",
  1171. align: "center",
  1172. minWidth: 80,
  1173. slot: "metalNumberSet",
  1174. },
  1175. { title: "单位", key: "company", align: "center", minWidth: 80 },
  1176. {
  1177. title: "单价",
  1178. key: "price",
  1179. align: "center",
  1180. minWidth: 80,
  1181. slot: "metalPriceSet",
  1182. },
  1183. {
  1184. title: "总价",
  1185. key: "total_price",
  1186. align: "center",
  1187. minWidth: 80,
  1188. slot: "metalTotal_priceSet",
  1189. },
  1190. {
  1191. title: "操作",
  1192. key: "name",
  1193. align: "center",
  1194. minWidth: 80,
  1195. slot: "metalsSet",
  1196. },
  1197. ], //五金表头
  1198. showSimilarProductModal: false,
  1199. similarProductLoading: false,
  1200. PDTTypeList: [{ id: "", title: "" }], //产品分类列表
  1201. ProcessAttrList: [], //工艺属性列表
  1202. partsList: [{ id: "", title: "" }], //部件分类名称列表
  1203. similarProductData: {
  1204. type_name: "",
  1205. title: "",
  1206. model: "",
  1207. url_number: "",
  1208. similarProductList: [
  1209. {
  1210. type: "",
  1211. title: "",
  1212. model: "",
  1213. url_number: "",
  1214. },
  1215. ],
  1216. page_index: 1,
  1217. page_size: 10,
  1218. total: 0,
  1219. },
  1220. similarProductColunms: [
  1221. {
  1222. title: "选择",
  1223. key: "",
  1224. align: "center",
  1225. minWidth: 60,
  1226. render: (h, params) => {
  1227. let id = params.row.id;
  1228. let flag = false;
  1229. if (this.tempSimilarProductData.id == id) {
  1230. flag = true;
  1231. } else {
  1232. flag = false;
  1233. }
  1234. let self = this;
  1235. return h("div", [
  1236. h("Radio", {
  1237. props: {
  1238. value: flag,
  1239. },
  1240. on: {
  1241. "on-change": () => {
  1242. self.tempSimilarProductData = params.row;
  1243. },
  1244. },
  1245. }),
  1246. ]);
  1247. },
  1248. },
  1249. { title: "产品分类", key: "type_name", align: "center", minWidth: 80 },
  1250. { title: "产品名称", key: "title", align: "center", minWidth: 80 },
  1251. { title: "产品型号", key: "model", align: "center", minWidth: 80 },
  1252. { title: "图号", key: "url_number", align: "center", minWidth: 80 },
  1253. ],
  1254. processLineData: {
  1255. title: "",
  1256. processLineList: [
  1257. {
  1258. id: "",
  1259. title: "",
  1260. },
  1261. ],
  1262. page_index: 1,
  1263. page_size: 10,
  1264. total: 0,
  1265. },
  1266. processLineColunms: [
  1267. { title: "ID", key: "name", align: "center", minWidth: 80 },
  1268. { title: "工艺路线名称", key: "name", align: "center", minWidth: 80 },
  1269. {
  1270. title: "操作",
  1271. key: "name",
  1272. align: "center",
  1273. minWidth: 80,
  1274. slot: "processLineSet",
  1275. },
  1276. ],
  1277. showProcessLineModal: false,
  1278. showProcessLineDetailModal: false,
  1279. showKey: false,
  1280. processLineLoading: false,
  1281. tempSimilarProductData: {},
  1282. tempProcessLineData: {},
  1283. order_no: this.$route.query.order_no,
  1284. orders_area_product_detail_id: this.$route.query
  1285. .orders_area_product_detail_id,
  1286. selectTags: [], //已选列表
  1287. info: {
  1288. title: "",
  1289. price: "",
  1290. parts_id: "",
  1291. id: null,
  1292. properties: [], //工序号
  1293. procedure: [], //工艺属性id
  1294. ProcessAttrList: [],
  1295. bps: [],
  1296. },
  1297. tempSelectedPartIndex: 0,
  1298. // 工艺属性暂存
  1299. tempProcessAttrList: [],
  1300. // 输入框弹窗
  1301. measureList: [
  1302. // { e_title: 'H', title: '高', id: 1, sort: 0 },
  1303. // { e_title: 'W', title: '宽', id: 1, sort: 0 },
  1304. // { e_title: 'D', title: '深', id: 1, sort: 0 },
  1305. ],
  1306. attrIndex: "",
  1307. attrName: "",
  1308. materialWoodList: [], // 木板列表
  1309. processRequireList: [], // 工艺要求列表
  1310. materialWoodSkinList: [], // 木皮列表
  1311. materialPaintList: [], // 油漆列表
  1312. metalsList: [], // 五金列表
  1313. productTypes: [],
  1314. nowSelectObj: {},
  1315. temp_info_bps: [],
  1316. process_name: "",
  1317. // 判断工艺路线是否新增
  1318. isNewProcess: false,
  1319. };
  1320. },
  1321. // 生命周期 - 创建完成(可以访问当前this实例)
  1322. created() {
  1323. // 获取产品分类
  1324. this.axios("/api/parts_product_list").then((res) => {
  1325. this.productTypes = res.data;
  1326. });
  1327. this.axios("/api/bp_list").then((res) => {
  1328. this.info.bps = res.data;
  1329. for (const key in this.info.bps) {
  1330. const element = this.info.bps[key];
  1331. element.cld &&
  1332. element.cld.length > 0 &&
  1333. element.cld.forEach((z) => {
  1334. z.show = false;
  1335. z.cld &&
  1336. z.cld.length > 0 &&
  1337. z.cld.forEach((elem) => {
  1338. elem.show = false;
  1339. elem.cld &&
  1340. elem.cld.length > 0 &&
  1341. elem.cld.forEach((el) => {
  1342. el.show = false;
  1343. });
  1344. });
  1345. });
  1346. }
  1347. this.temp_info_bps = JSON.parse(JSON.stringify(this.info.bps));
  1348. });
  1349. this.axios("/api/bpp_list_new").then((res) => {
  1350. res.data.map((v) => {
  1351. if (v.select) {
  1352. v.cld.map((z) => {
  1353. v.select.map((k) => {
  1354. z.show = k == z.id ? true : false;
  1355. });
  1356. });
  1357. } else {
  1358. v.cld.map((v) => (v.show = false));
  1359. }
  1360. });
  1361. this.tempProcessAttrList = JSON.parse(JSON.stringify(res.data));
  1362. this.formData.parts.forEach((element) => {
  1363. element.ProcessAttrList = res.data;
  1364. });
  1365. });
  1366. },
  1367. // 生命周期 - 挂载完成(可以访问DOM元素)
  1368. mounted() {
  1369. // 获取产品分类列表
  1370. this.axios("/api/parts_product_list").then((res) => {
  1371. this.PDTTypeList = res.data;
  1372. });
  1373. // 获取工艺要求列表
  1374. this.axios("/api/technological_requirement").then((res) => {
  1375. this.processRequireList = res.data.data;
  1376. });
  1377. // 获取贴木皮列表
  1378. this.axios("/api/material", { params: { sub_type_id: 2 } }).then((res) => {
  1379. this.materialWoodSkinList = res.data.data;
  1380. });
  1381. // 获取油漆列表
  1382. this.axios("/api/material_combination").then((res) => {
  1383. this.materialPaintList = res.data.data;
  1384. });
  1385. // 获取五金列表
  1386. this.axios("/api/material", { params: { sub_type_id: 5 } }).then((res) => {
  1387. this.metalsList = res.data.data;
  1388. });
  1389. // 获取部件分类列表
  1390. this.axios("/api/basics_parts_index").then((res) => {
  1391. this.partsList = res.data.data;
  1392. });
  1393. // 获取木板列表
  1394. this.axios("/api/material", { params: { sub_type_id: 1 } }).then((res) => {
  1395. this.materialWoodList = res.data.data;
  1396. });
  1397. this.initData(this.order_no, this.orders_area_product_detail_id);
  1398. },
  1399. methods: {
  1400. initData(order_no, orders_area_product_detail_id) {
  1401. this.axios({
  1402. method: "get",
  1403. url: "/api/order_area_explode_detail",
  1404. params: {
  1405. order_no,
  1406. orders_area_product_detail_id,
  1407. },
  1408. }).then((res) => {
  1409. this.formData = res.data;
  1410. // this.formData.basic_product_id = 8;
  1411. // 获取产品分类、测量字段
  1412. this.handleMatchBP(this.productTypes, this.formData.basic_product_id);
  1413. this.handleClick(JSON.stringify(this.nowSelectObj));
  1414. if (this.formData.parts.length == 0) {
  1415. this.formData.parts = [
  1416. {
  1417. isAddPart: true, //是否为新增部件
  1418. isAddProcessRoute: true, //是否为新增工艺组合
  1419. long: "",
  1420. width: "",
  1421. thick: "",
  1422. parts_type: "", //部件分类名称
  1423. pay_state: "", //标签
  1424. part_id: "", //部件名称
  1425. company: "", //单位
  1426. processCombination: "", //工艺组合名称
  1427. process_price: "", //工艺价格
  1428. proportion: "", //产值比例
  1429. properties: [], //工艺属性
  1430. ProcessAttrList: JSON.parse(
  1431. JSON.stringify(this.tempProcessAttrList)
  1432. ), //工艺属性列表
  1433. partsProcessLineTableData: [], //工艺路线表格
  1434. partsWoodTableData: [
  1435. {
  1436. title: "",
  1437. spare_parts: "",
  1438. number: "",
  1439. company: "",
  1440. long: "",
  1441. wide: "",
  1442. thick: "",
  1443. technological_requirement_id: "",
  1444. sub_num: "",
  1445. veneer_id: "",
  1446. paint_id: "",
  1447. label: "",
  1448. print_num: "",
  1449. },
  1450. ], //木板表格
  1451. partsMetalseData: [
  1452. {
  1453. spare_parts: "",
  1454. number: "",
  1455. company: "",
  1456. price: "",
  1457. total_price: "",
  1458. },
  1459. ], //五金表格
  1460. partsNameList: [{ id: "", title: "" }], //部件名称列表
  1461. partsProcessRouteList: [{ id: "", title: "" }], //工艺组合名称列表
  1462. checkBox: [],
  1463. },
  1464. ];
  1465. } else {
  1466. this.formData.parts.map(v=>{
  1467. this.handleSimilarProductConfirm(res.data.product_id, v);
  1468. })
  1469. }
  1470. });
  1471. },
  1472. handleMatchBP(array, id) {
  1473. array.forEach((element, index) => {
  1474. if (element.id != id) {
  1475. if (element.child && element.child.length > 0) {
  1476. return this.handleMatchBP(element.child, id);
  1477. }
  1478. } else {
  1479. this.nowSelectObj = element;
  1480. }
  1481. });
  1482. },
  1483. getChangeLists(e) {},
  1484. saveTableData(row, index) {
  1485. if (this.isNewProcess) {
  1486. let temparr = [];
  1487. this.selectTags.forEach((el) => {
  1488. temparr.push(el.id);
  1489. });
  1490. this.axios({
  1491. method: "post",
  1492. url: "/api/technological_route_edit",
  1493. data: {
  1494. id: "",
  1495. title: this.info.title,
  1496. procedure_id: temparr.join(","),
  1497. },
  1498. }).then((res) => {
  1499. if (res.code == 200) {
  1500. this.formData.parts[
  1501. this.tempSelectedPartIndex
  1502. ].partsProcessLineTableData = [];
  1503. this.formData.parts[
  1504. this.tempSelectedPartIndex
  1505. ].partsProcessLineTableData = this.formData.parts[
  1506. this.tempSelectedPartIndex
  1507. ].partsProcessLineTableData.concat(this.selectTags);
  1508. this.showProcessLineDetailModal = false;
  1509. this.formData.parts[
  1510. this.tempSelectedPartIndex
  1511. ].process_name = this.info.title;
  1512. }
  1513. });
  1514. } else {
  1515. this.formData.parts[
  1516. this.tempSelectedPartIndex
  1517. ].partsProcessLineTableData = [];
  1518. this.formData.parts[
  1519. this.tempSelectedPartIndex
  1520. ].partsProcessLineTableData = this.formData.parts[
  1521. this.tempSelectedPartIndex
  1522. ].partsProcessLineTableData.concat(this.selectTags);
  1523. this.showProcessLineDetailModal = false;
  1524. }
  1525. },
  1526. // 删除工艺路线列表项
  1527. handleProcessLineDele(row, i, index) {
  1528. let formData = JSON.parse(JSON.stringify(this.formData));
  1529. formData.parts[index].partsProcessLineTableData.splice(i, 1);
  1530. this.formData = formData;
  1531. },
  1532. //选择相似产品
  1533. handleSimilarProductShow() {
  1534. this.showSimilarProductModal = true;
  1535. this.similarProductLoading = true;
  1536. this.similarProductData.type_name = "";
  1537. this.similarProductData.title = "";
  1538. this.similarProductData.model = "";
  1539. this.similarProductData.url_number = "";
  1540. this.axios("/api/product", {
  1541. params: {
  1542. type_name: this.similarProductData.type_name,
  1543. title: this.similarProductData.title,
  1544. model: this.similarProductData.model,
  1545. url_number: this.similarProductData.url_number,
  1546. page_size: this.similarProductData.page_size,
  1547. page_index: this.similarProductData.page_index,
  1548. },
  1549. }).then((res) => {
  1550. this.similarProductLoading = false;
  1551. this.similarProductData.similarProductList = res.data.data;
  1552. this.similarProductData.total = res.data.total;
  1553. });
  1554. },
  1555. changeSimilarProductPage(e) {
  1556. this.similarProductLoading = true;
  1557. this.axios("/api/product", {
  1558. params: {
  1559. type_name: this.similarProductData.type_name,
  1560. title: this.similarProductData.title,
  1561. model: this.similarProductData.model,
  1562. url_number: this.similarProductData.url_number,
  1563. page_size: this.similarProductData.page_size,
  1564. page_index: e,
  1565. },
  1566. }).then((res) => {
  1567. this.similarProductLoading = false;
  1568. this.similarProductData.similarProductList = res.data.data;
  1569. this.similarProductData.similarProductList.forEach((el) => {
  1570. el.selected = false;
  1571. });
  1572. this.similarProductData.total = res.data.total;
  1573. });
  1574. },
  1575. handleSimilarProductSearch() {
  1576. this.similarProductLoading = true;
  1577. this.axios("/api/product", {
  1578. params: {
  1579. type_name: this.similarProductData.type_name,
  1580. title: this.similarProductData.title,
  1581. model: this.similarProductData.model,
  1582. url_number: this.similarProductData.url_number,
  1583. page_size: this.similarProductData.page_size,
  1584. page_index: this.similarProductData.page_index,
  1585. },
  1586. }).then((res) => {
  1587. this.similarProductLoading = false;
  1588. this.similarProductData.similarProductList = res.data.data;
  1589. this.similarProductData.similarProductList.forEach((el) => {
  1590. el.selected = false;
  1591. });
  1592. this.similarProductData.total = res.data.total;
  1593. });
  1594. },
  1595. // 产值比校验
  1596. handleProportionEdit(e, row, index) {
  1597. // e.target.value
  1598. },
  1599. handleSimilarProductSelected(row, oldrow) {
  1600. this.tempSimilarProductData = row;
  1601. },
  1602. handleSimilarProductConfirm(id, isEditItem) {
  1603. if (id) {
  1604. this.axios({
  1605. method: "get",
  1606. url: "/api/product",
  1607. params: {
  1608. id,
  1609. },
  1610. }).then((res) => {
  1611. if (res.code == 200) {
  1612. res.data.part.forEach((element) => {
  1613. this.formData.parts.forEach((ele) => {
  1614. if (element.part_id == ele.part_id) {
  1615. element.process_ids = ele.process_ids;
  1616. element.route_id = ele.route_id;
  1617. }
  1618. });
  1619. });
  1620. this.formData.parts = res.data.part;
  1621. //label
  1622. // this.formData.title = res.data.title;
  1623. // this.formData.unit = res.data.unit;
  1624. // this.formData.remark = res.data.remark;
  1625. // this.formData.url = res.data.url;
  1626. // this.formData.url_number = res.data.url_number;
  1627. // this.formData.measure = res.data.measure_id
  1628. // if (isEditItem) {
  1629. // res.data.part.forEach((element, index) => {
  1630. // Object.assign(element, this.formData.parts[index]);
  1631. // });
  1632. // }
  1633. this.formData.parts.map((element) => {
  1634. element.partsProcessLineTableData = [];
  1635. element.proportion = element.ratio;
  1636. element.wide = element.formula_w;
  1637. element.thick = element.formula_h;
  1638. element.long = element.formula_l;
  1639. element.ProcessAttrList = JSON.parse(
  1640. JSON.stringify(this.tempProcessAttrList)
  1641. ); //工艺属性列表
  1642. this.axios("/api/parts_detail", {
  1643. params: { id: element.part_id },
  1644. }).then((re) => {
  1645. // element.company = re.data.company
  1646. element.isAddPart = true;
  1647. element.isAddProcessRoute = true;
  1648. element.parts_type = re.data.p_id;
  1649. // element.part_id = re.data.title
  1650. this.axios({
  1651. method: "get",
  1652. url: "/api/parts_index",
  1653. params: {
  1654. bp_id: element.parts_type,
  1655. },
  1656. }).then((r) => {
  1657. element.partsNameList = r.data.data;
  1658. if (isEditItem) {
  1659. let item = isEditItem;
  1660. // let item = JSON.parse(JSON.stringify(isEditItem));
  1661. item.parts.forEach((element) => {
  1662. element.processCombination = element.route_id;
  1663. let obj = { value: element.route_id, label: "" };
  1664. this.handleProcessRouteSelect(element, obj);
  1665. });
  1666. isEditItem = item;
  1667. }
  1668. this.$forceUpdate();
  1669. });
  1670. element.company = re.data.company;
  1671. // element.partsNameList = [{ id: re.data.id, title: re.data.title }]
  1672. element.pay_state = re.data.label;
  1673. // element.partsWoodTableData = re.data.detail;
  1674. this.showSimilarProductModal = false;
  1675. });
  1676. let obj = { value: element.part_id };
  1677. this.handlePartsNameSelect(element, obj);
  1678. });
  1679. }
  1680. });
  1681. } else {
  1682. this.showSimilarProductModal = false;
  1683. }
  1684. },
  1685. //选择部件分类名称
  1686. handlePartsSelect(e, item) {
  1687. this.axios({
  1688. method: "get",
  1689. url: "/api/parts_index",
  1690. params: {
  1691. bp_id: e,
  1692. },
  1693. })
  1694. .then((res) => {
  1695. this.$nextTick(() => {
  1696. item.part_id = "";
  1697. item.partsNameList = res.data.data;
  1698. this.$forceUpdate();
  1699. });
  1700. })
  1701. .catch((err) => {});
  1702. },
  1703. //新增部件名称
  1704. handlePartTitleCreate(item, val) {
  1705. item.partsNameList.push({
  1706. id: val,
  1707. title: val,
  1708. });
  1709. this.$forceUpdate();
  1710. },
  1711. //新增工艺组合名称
  1712. handleProcessRouteCreate(item, val) {
  1713. //////
  1714. item.isAddProcessRoute = true;
  1715. item.ProcessAttrList = JSON.parse(
  1716. JSON.stringify(this.tempProcessAttrList)
  1717. );
  1718. // 新增工艺组合,展示所有工艺
  1719. item.ProcessAttrList.map((item) => {
  1720. item.cld &&
  1721. item.cld.length > 0 &&
  1722. item.cld.map((level1) => {
  1723. level1.list &&
  1724. level1.list.length > 0 &&
  1725. level1.list.map((level2) => {
  1726. level2.display = true;
  1727. });
  1728. });
  1729. });
  1730. if (!item.partsProcessRouteList) {
  1731. item.partsProcessRouteList = [];
  1732. }
  1733. item.partsProcessRouteList.push({
  1734. id: val,
  1735. title: val,
  1736. });
  1737. this.$forceUpdate();
  1738. },
  1739. // 部件名称
  1740. handlePartsNameSelect(item, val) {
  1741. if (val) {
  1742. if (val.label != val.value) {
  1743. item.isAddPart = false;
  1744. this.axios({
  1745. method: "get",
  1746. url: "/api/parts_detail",
  1747. params: {
  1748. id: val.value,
  1749. },
  1750. }).then((res) => {
  1751. item.pay_state = res.data.label;
  1752. item.company = res.data.company;
  1753. item.ProcessAttrList = this.tempProcessAttrList;
  1754. item.partsWoodTableData ? "" : (item.partsWoodTableData = []);
  1755. item.partsMetalseData ? "" : (item.partsMetalseData = []);
  1756. item.partsWoodTableData = res.data.detail.filter(
  1757. (v) => v.type_id == 1 || v.type_id == 2
  1758. );
  1759. item.partsMetalseData = res.data.detail.filter(
  1760. (v) => v.type_id == 5
  1761. );
  1762. this.axios({
  1763. method: "get",
  1764. url: "/api/process_route_index",
  1765. params: {
  1766. part_id: val.value,
  1767. },
  1768. })
  1769. .then((re) => {
  1770. this.$nextTick(() => {
  1771. item.partsProcessRouteList = re.data.detail;
  1772. this.$forceUpdate();
  1773. });
  1774. })
  1775. .catch((err) => {});
  1776. });
  1777. } else {
  1778. item.isAddPart = true;
  1779. // item.ProcessAttrList = this.tempProcessAttrList;
  1780. // item.partsWoodTableData = [];
  1781. // item.partsMetalseData = [];
  1782. // item.process_name = "";
  1783. }
  1784. }
  1785. },
  1786. // 选择工艺组合名称
  1787. handleProcessRouteSelect(item, val) {
  1788. if (val) {
  1789. item.ProcessAttrList.map((level0) => {
  1790. level0.cld &&
  1791. level0.cld.length > 0 &&
  1792. level0.cld.map((level1) => {
  1793. level1.list &&
  1794. level1.list.length > 0 &&
  1795. level1.list.map((level2) => {
  1796. level2.display = true;
  1797. });
  1798. });
  1799. });
  1800. if (val.label != val.value) {
  1801. item.isAddProcessRoute = false;
  1802. this.axios({
  1803. method: "get",
  1804. url: "/api/process_route_detail",
  1805. params: {
  1806. id: val.value,
  1807. },
  1808. }).then((res) => {
  1809. this.info = res.data;
  1810. this.info.bps = this.temp_info_bps;
  1811. item.process_price = res.data.price;
  1812. this.selectTags = res.data.produce_list;
  1813. const selectTagsId = this.selectTags.map((item) => item.id);
  1814. item.ProcessAttrList = res.data.list;
  1815. item.process_name = res.data.technological_route_title;
  1816. item.properties = res.data.pp_id.split(","); ///存在问题
  1817. this.info.bps.forEach((v) => {
  1818. v.cld &&
  1819. v.cld.length > 0 &&
  1820. v.cld.forEach((z) => {
  1821. z.show = selectTagsId.includes(z.id);
  1822. z.cld &&
  1823. z.cld.length > 0 &&
  1824. z.cld.forEach((elem) => {
  1825. elem.show = selectTagsId.includes(elem.id);
  1826. elem.cld &&
  1827. elem.cld.length > 0 &&
  1828. elem.cld.forEach((ele) => {
  1829. ele.show = selectTagsId.includes(ele.id);
  1830. ele.cld &&
  1831. ele.cld.length > 0 &&
  1832. ele.cld.forEach((el) => {
  1833. el.show = selectTagsId.includes(el.id);
  1834. });
  1835. });
  1836. });
  1837. });
  1838. });
  1839. item.ProcessAttrList.map((level0) => {
  1840. level0.cld &&
  1841. level0.cld.length > 0 &&
  1842. level0.cld.map((level1) => {
  1843. level1.list &&
  1844. level1.list.length > 0 &&
  1845. level1.list.map((level2) => {
  1846. level2.display = level2.show;
  1847. });
  1848. });
  1849. });
  1850. item.partsProcessLineTableData = this.selectTags;
  1851. });
  1852. } else {
  1853. item.isAddProcessRoute = true;
  1854. }
  1855. }
  1856. },
  1857. //选择工艺路线
  1858. editRouter(item, index) {
  1859. // 重新打开则重新判定是否为新增工艺路线
  1860. this.isNewProcess = false;
  1861. this.showProcessLineModal = true;
  1862. this.tempSelectedPartIndex = index;
  1863. this.handleSearchProcessLine(this.tempProcessLine.title);
  1864. },
  1865. handleSearchProcessLine(title) {
  1866. this.axios({
  1867. method: "get",
  1868. url: "/api/technological_route",
  1869. params: {
  1870. title,
  1871. },
  1872. }).then((res) => {
  1873. this.processLineTableData = res.data.data;
  1874. });
  1875. },
  1876. changeCheck(e, item, selectArray) {
  1877. // 一旦更改便标记为新增工艺路线
  1878. this.isNewProcess = true;
  1879. //复选框选中与非选中同时同步tag标签跟随操作
  1880. item.show = e;
  1881. if (e) {
  1882. selectArray.push(item);
  1883. } else {
  1884. let id = item.id;
  1885. let id_index = selectArray.findIndex((v) => v.id == id);
  1886. selectArray.splice(id_index, 1);
  1887. }
  1888. },
  1889. closeTag(key, arr, row) {
  1890. //取消tag标签展示操作并同步下方的复选框ui同步
  1891. for (const key in this.info.bps) {
  1892. const element = this.info.bps[key];
  1893. element.cld.map((p) => {
  1894. p.id == row.id ? (p.show = false) : "";
  1895. p.cld &&
  1896. p.cld.length > 0 &&
  1897. p.cld.map((q) => {
  1898. q.id == row.id ? (q.show = false) : "";
  1899. q.cld &&
  1900. q.cld.length > 0 &&
  1901. q.cld.map((r) => {
  1902. r.id == row.id ? (r.show = false) : "";
  1903. r.cld &&
  1904. r.cld.length > 0 &&
  1905. r.cld.map((s) => {
  1906. s.id == row.id ? (s.show = false) : "";
  1907. });
  1908. });
  1909. });
  1910. });
  1911. }
  1912. arr.splice(key, 1);
  1913. },
  1914. setBoxChange(parent, child) {
  1915. return;
  1916. // const { type } = this.$route.query;
  1917. // if (type == 3) {
  1918. // return;
  1919. // }
  1920. // child.show = !child.show;
  1921. // child.list.forEach((element) => {
  1922. // element.show = child.show;
  1923. // });
  1924. },
  1925. setRadioChange(parent, child, index, parts, cld) {
  1926. if (this.type == 1) {
  1927. if (parts.isAddProcessRoute) {
  1928. cld.forEach((element) => {
  1929. element.list.forEach((elem) => {
  1930. elem.id != child.id && (elem.show = false);
  1931. });
  1932. });
  1933. child.show = !child.show;
  1934. parts.properties[index] = child.id;
  1935. }
  1936. }
  1937. this.$forceUpdate();
  1938. },
  1939. // setRadioChange(parent, child) {
  1940. // const { type } = this.$route.query;
  1941. // if (type == 3) {
  1942. // return;
  1943. // }
  1944. // // let flag = true;
  1945. // parent.list.forEach((element) => {
  1946. // element.show = false
  1947. // if (!element.show) {
  1948. // // flag = false;
  1949. // }
  1950. // });
  1951. // child.show = !child.show;
  1952. // console.log('child.show :>> ', child.show);
  1953. // // parent.show = flag;
  1954. // this.$forceUpdate();
  1955. // },
  1956. handleProcessLineSet(row, index) {
  1957. this.process_name = row.title;
  1958. this.info.id = row.id;
  1959. this.info.title = row.title;
  1960. this.info.procedure_id = row.procedure_id;
  1961. this.selectTags = [];
  1962. const arr = this.info.procedure_id
  1963. ? this.info.procedure_id.split(",")
  1964. : [];
  1965. for (const key in this.info.bps) {
  1966. const el = this.info.bps[key];
  1967. el.cld.forEach((z) => {
  1968. z.show = false;
  1969. z.cld &&
  1970. z.cld.length > 0 &&
  1971. z.cld.forEach((elem) => {
  1972. elem.show = false;
  1973. elem.cld &&
  1974. elem.cld.length > 0 &&
  1975. elem.cld.forEach((ele) => {
  1976. ele.show = false;
  1977. });
  1978. });
  1979. });
  1980. }
  1981. for (let index = 0; index < arr.length; index++) {
  1982. const element = arr[index];
  1983. this.info.bps.map((lv1) => {
  1984. lv1.cld &&
  1985. lv1.cld.length > 0 &&
  1986. lv1.cld.map((lv2) => {
  1987. if (lv2.id == element) {
  1988. lv2.show = true;
  1989. lv2.p_id && this.selectTags.push(lv2);
  1990. }
  1991. lv2.cld &&
  1992. lv2.cld.length > 0 &&
  1993. lv2.cld.map((lv3) => {
  1994. if (lv3.id == element) {
  1995. lv3.show = true;
  1996. lv3.p_id && this.selectTags.push(lv3);
  1997. }
  1998. lv3.cld &&
  1999. lv3.cld.length > 0 &&
  2000. lv3.cld.map((lv4) => {
  2001. if (lv4.id == element) {
  2002. lv4.show = true;
  2003. lv4.p_id && this.selectTags.push(lv4);
  2004. }
  2005. });
  2006. });
  2007. });
  2008. });
  2009. }
  2010. this.showProcessLineDetailModal = true;
  2011. this.showProcessLineModal = false;
  2012. },
  2013. changeProcessLineSize() {},
  2014. changeProcessLinePage() {},
  2015. handleProcessLineConfirm() {},
  2016. handleProcessLineSearch() {},
  2017. handlePartAdd(item, index) {
  2018. let obj = {
  2019. isAddPart: true,
  2020. isAddProcessRoute: true,
  2021. long: "",
  2022. width: "",
  2023. thick: "",
  2024. parts_type: "", //部件分类名称
  2025. pay_state: "", //标签
  2026. part_id: "", //部件名称
  2027. company: "", //单位
  2028. processCombination: "", //工艺组合名称
  2029. process_price: "", //工艺价格
  2030. ProcessAttrList: JSON.parse(JSON.stringify(this.tempProcessAttrList)), //工艺属性列表
  2031. partsProcessLineTableData: [
  2032. {
  2033. id: "",
  2034. type: "",
  2035. title: "",
  2036. time: "",
  2037. wages: "",
  2038. capacity: "",
  2039. },
  2040. ], //工艺路线表格
  2041. partsWoodTableData: [
  2042. {
  2043. title: "",
  2044. spare_parts: "",
  2045. number: "",
  2046. company: "",
  2047. long: "",
  2048. wide: "",
  2049. thick: "",
  2050. technological_requirement_id: "",
  2051. sub_num: "",
  2052. veneer_id: "",
  2053. paint_id: "",
  2054. label: "",
  2055. print_num: "",
  2056. },
  2057. ], //零部件表格
  2058. partsMetalseData: [
  2059. {
  2060. spare_parts: "",
  2061. number: "",
  2062. company: "",
  2063. price: "",
  2064. total_price: "",
  2065. },
  2066. ], //五金表格
  2067. partsNameList: [{ id: "", title: "" }], //部件名称列表
  2068. checkBox: [],
  2069. keyUseType: 0,
  2070. };
  2071. this.formData.parts.splice(index + 1, 0, obj);
  2072. },
  2073. handlePartCopy(item, index) {
  2074. let obj = JSON.parse(JSON.stringify(item));
  2075. // this.formData.parts.splice(index, 0, obj);
  2076. this.formData.parts.push(obj);
  2077. },
  2078. handlePartDele(item, index) {
  2079. this.formData.parts.splice(index, 1);
  2080. },
  2081. handlePartWoodAdd(index) {
  2082. let formData = JSON.parse(JSON.stringify(this.formData));
  2083. formData.parts[index].partsWoodTableData.push({
  2084. type_id: 1,
  2085. title: "",
  2086. spare_parts: "",
  2087. number: "",
  2088. company: "",
  2089. long: "",
  2090. wide: "",
  2091. thick: "",
  2092. technological_requirement_id: "",
  2093. sub_num: "",
  2094. veneer_id: "",
  2095. paint_id: "",
  2096. label: "",
  2097. print_num: "",
  2098. });
  2099. this.formData = formData;
  2100. },
  2101. handlePartWoodCopy(row, index, parentIndex) {
  2102. this.$nextTick(() => {
  2103. let obj = JSON.parse(
  2104. JSON.stringify(
  2105. this.formData.parts[parentIndex].partsWoodTableData[index]
  2106. )
  2107. );
  2108. this.formData.parts[parentIndex].partsWoodTableData.splice(
  2109. index + 1,
  2110. 0,
  2111. obj
  2112. );
  2113. // this.formData.parts[parentIndex].partsWoodTableData.push(obj)
  2114. this.$forceUpdate();
  2115. });
  2116. },
  2117. handlePartWoodDele(row, index, parentIndex) {
  2118. this.formData.parts[parentIndex].partsWoodTableData.splice(index, 1);
  2119. },
  2120. handlePartMetalsAdd(index) {
  2121. let formData = JSON.parse(JSON.stringify(this.formData));
  2122. if (formData.parts[index].partsMetalseData == undefined) {
  2123. formData.parts[index].partsMetalseData = [];
  2124. }
  2125. formData.parts[index].partsMetalseData.push({
  2126. type_id: 2,
  2127. spare_parts: "",
  2128. number: "",
  2129. company: "",
  2130. price: "",
  2131. total_price: "",
  2132. });
  2133. this.formData = formData;
  2134. },
  2135. handlePartMetalsCopy(row, index, parentIndex) {
  2136. let obj = JSON.parse(JSON.stringify(row));
  2137. this.formData.parts[parentIndex].partsMetalseData.splice(
  2138. index + 1,
  2139. 0,
  2140. obj
  2141. );
  2142. },
  2143. handlePartMetalsDele(row, index, parentIndex) {
  2144. this.formData.parts[parentIndex].partsMetalseData.splice(index, 1);
  2145. },
  2146. handleProcessLineSelected() {},
  2147. async postData() {
  2148. let sum = 0;
  2149. this.formData.parts.forEach((element) => {
  2150. sum += element.proportion * 1;
  2151. });
  2152. const BJ_name = this.formData.parts.map((item) => {
  2153. return item.part_id;
  2154. });
  2155. const atfer_BJ_name = Array.from(new Set(BJ_name));
  2156. if (atfer_BJ_name.length != BJ_name.length) {
  2157. return this.$Message.error("部件名称存在重复");
  2158. }
  2159. const GYLX_name = this.formData.parts.map((item) => {
  2160. return item.processCombination;
  2161. });
  2162. const atfer_GYLX_name = Array.from(new Set(GYLX_name));
  2163. if (GYLX_name.length != atfer_GYLX_name.length) {
  2164. return this.$Message.error("工艺路线存在重复");
  2165. }
  2166. if (sum != 100) {
  2167. this.$Message.error("产值比之和须为100");
  2168. } else {
  2169. // 部件保存
  2170. let save_sucess = true;
  2171. for (let i in this.formData.parts) {
  2172. let element = this.formData.parts[i];
  2173. let flag = false;
  2174. element.partsNameList.forEach((ele) => {
  2175. if (element.part_id == ele.id && ele.id == ele.title) {
  2176. flag = true;
  2177. }
  2178. });
  2179. if (flag) {
  2180. let result = await this.axios({
  2181. method: "post",
  2182. url: "/api/order_area_explode_part",
  2183. data: {
  2184. top: {
  2185. p_id: element.parts_type,
  2186. bp_id: this.nowSelectObj.id, //相似产品
  2187. company: element.company,
  2188. label: element.pay_state,
  2189. title: element.part_id,
  2190. },
  2191. op: "add",
  2192. detail: [
  2193. ...element.partsWoodTableData,
  2194. ...element.partsMetalseData,
  2195. ],
  2196. },
  2197. });
  2198. if (result.code == 200) {
  2199. element.part_id = result.data.id;
  2200. // 工艺路线保存 partsProcessLineTableData
  2201. let procedure = "";
  2202. let bool = false;
  2203. element.partsProcessRouteList.forEach((ele) => {
  2204. if (
  2205. element.processCombination == ele.id &&
  2206. ele.id == ele.title
  2207. ) {
  2208. bool = true;
  2209. }
  2210. });
  2211. element.partsProcessLineTableData.forEach(async (el, idx) => {
  2212. if (idx == element.length - 1) {
  2213. procedure += el.id + "";
  2214. } else {
  2215. procedure += el.id + ",";
  2216. }
  2217. });
  2218. if (bool) {
  2219. let res = await this.axios({
  2220. method: "post",
  2221. url: "/api/order_area_explode_process",
  2222. data: {
  2223. parts_id: element.part_id, /////
  2224. price: element.process_price,
  2225. properties:
  2226. typeof element.properties == "string"
  2227. ? [element.properties]
  2228. : element.properties,
  2229. // properties: element.properties,
  2230. title: element.processCombination,
  2231. procedure,
  2232. op: "add",
  2233. },
  2234. });
  2235. element.route_id = res.data.id;
  2236. element.part_id = result.data.id;
  2237. } else {
  2238. element.route_id = element.processCombination;
  2239. }
  2240. } else {
  2241. save_sucess = false;
  2242. }
  2243. } else {
  2244. // 工艺路线保存 partsProcessLineTableData
  2245. let procedure = "";
  2246. let bool = false;
  2247. element.partsProcessRouteList.forEach((ele) => {
  2248. if (element.processCombination == ele.id && ele.id == ele.title) {
  2249. bool = true;
  2250. }
  2251. });
  2252. element.partsProcessLineTableData.forEach(async (el, idx) => {
  2253. if (idx == element.length - 1) {
  2254. procedure += el.id + "";
  2255. } else {
  2256. procedure += el.id + ",";
  2257. }
  2258. });
  2259. if (bool) {
  2260. let res = await this.axios({
  2261. method: "post",
  2262. url: "/api/order_area_explode_process",
  2263. data: {
  2264. parts_id: element.part_id, /////
  2265. price: element.process_price,
  2266. properties:
  2267. typeof element.properties == "string"
  2268. ? [element.properties]
  2269. : element.properties,
  2270. // properties: element.properties,
  2271. title: element.processCombination,
  2272. procedure,
  2273. op: "add",
  2274. },
  2275. });
  2276. if (res.code == 200) {
  2277. element.route_id = res.data.id;
  2278. } else {
  2279. save_sucess = false;
  2280. }
  2281. } else {
  2282. element.route_id = element.processCombination;
  2283. }
  2284. }
  2285. }
  2286. this.formData.parts.forEach((element) => {
  2287. element.detail = [
  2288. ...element.partsWoodTableData,
  2289. ...element.partsMetalseData,
  2290. ];
  2291. });
  2292. // 产品编辑保存
  2293. if (save_sucess) {
  2294. await this.axios({
  2295. method: "post",
  2296. url: "/api/order_area_explode_save",
  2297. data: {
  2298. ...this.formData,
  2299. order_no: this.$route.query.order_no,
  2300. orders_area_product_detail_id: this.$route.query
  2301. .orders_area_product_detail_id,
  2302. },
  2303. }).then((res) => {
  2304. if (res.code == 200) {
  2305. this.$Message.success(res.msg);
  2306. this.goback();
  2307. }
  2308. });
  2309. }
  2310. }
  2311. },
  2312. goback() {
  2313. this.$router.go(-1);
  2314. },
  2315. successKey(str) {
  2316. if (this.keyUseType == 1) {
  2317. this.formData.parts[this.attrParentindex].partsWoodTableData[
  2318. this.attrIndex
  2319. ][this.attrName] = str;
  2320. // this.$set(this.formData.parts[this.attrParentindex].partsWoodTableData[this.attrIndex],[this.attrName], str)
  2321. } else {
  2322. this.formData.parts[this.attrParentindex][this.attrName] = str;
  2323. }
  2324. this.showKey = false;
  2325. },
  2326. cancelKey() {
  2327. this.showKey = false;
  2328. },
  2329. openKey(partsIndex, index, attr, partsItem) {
  2330. // this.axios({
  2331. // method: "get",
  2332. // url: "/api/basics_product_list",
  2333. // params: {
  2334. // id: partsItem.part_id,
  2335. // },
  2336. // })
  2337. // .then((res) => {
  2338. // res.data.forEach((element) => {
  2339. // if (element.id == partsItem.part_id) {
  2340. // this.measureList = element.measure;
  2341. // }
  2342. // });
  2343. this.showKey = true;
  2344. this.attrParentindex = partsIndex;
  2345. if (index != -1) {
  2346. this.attrIndex = index;
  2347. this.keyUseType = 1;
  2348. } else {
  2349. this.keyUseType = 2;
  2350. }
  2351. this.attrName = attr;
  2352. // })
  2353. },
  2354. changeSe(e, n, partsIndex, row) {
  2355. let event = window.event;
  2356. let unit = event.target.dataset.unit;
  2357. // row.company = unit ? unit : ''
  2358. // row.thick = e.tag
  2359. // row.title = e.title
  2360. this.formData.parts[partsIndex].partsWoodTableData[n].company = unit
  2361. ? unit
  2362. : "";
  2363. this.formData.parts[partsIndex].partsWoodTableData[n].thick = e.tag;
  2364. this.formData.parts[partsIndex].partsWoodTableData[n].title = e.title;
  2365. },
  2366. changeMetal(e, n, partsIndex) {
  2367. let event = window.event;
  2368. let unit = event.target.dataset.unit;
  2369. this.formData.parts[partsIndex].partsMetalseData[n].company = unit
  2370. ? unit
  2371. : "";
  2372. },
  2373. handleMetalTotalPriceChange(row) {
  2374. row.total_price = 1 * row.price * row.number;
  2375. },
  2376. handleClick(e) {
  2377. let data = JSON.parse(e);
  2378. this.nowSelectObj = data;
  2379. this.info.bp_id = this.nowSelectObj.id;
  2380. this.axios("/api/basics_product_list", {
  2381. params: { id: this.nowSelectObj.id },
  2382. }).then((res) => {
  2383. res.data.forEach((element) => {
  2384. if (element.id == this.nowSelectObj.id) {
  2385. this.measureList = element.measure;
  2386. }
  2387. });
  2388. });
  2389. },
  2390. checkImg(item) {
  2391. let list = [];
  2392. item.forEach((el) => {
  2393. list.push({ img_url: el });
  2394. });
  2395. // this.axios('/api/orders_img', { params: { id: this.order_area_product_id, type: 1 } }).then(res => {
  2396. // if (res.code == 200) {
  2397. this.$previewImg({
  2398. list,
  2399. baseUrl: this.$store.state.ip,
  2400. baseImgField: "img_url",
  2401. baseTitleField: "",
  2402. });
  2403. // }
  2404. // })
  2405. },
  2406. },
  2407. // 监听属性 类似于data概念
  2408. computed: {},
  2409. // 监控data中的数据变化
  2410. watch: {},
  2411. beforeCreate() {}, // 生命周期 - 创建之前
  2412. beforeMount() {}, // 生命周期 - 挂载之前
  2413. beforeUpdate() {}, // 生命周期 - 更新之前
  2414. updated() {}, // 生命周期 - 更新之后
  2415. beforeDestroy() {}, // 生命周期 - 销毁之前
  2416. destroyed() {}, // 生命周期 - 销毁完成
  2417. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  2418. };
  2419. </script>
  2420. <style lang="scss" scoped>
  2421. .BidSystemProductDeOrderDeorderdetail {
  2422. position: relative;
  2423. overflow: hidden;
  2424. overflow-y: auto;
  2425. .top_info {
  2426. display: flex;
  2427. justify-content: flex-start;
  2428. align-items: center;
  2429. flex-wrap: wrap;
  2430. padding: 10px;
  2431. span {
  2432. min-width: 40px;
  2433. margin-right: 5px;
  2434. }
  2435. div {
  2436. display: flex;
  2437. justify-content: flex-start;
  2438. align-items: center;
  2439. width: 200px;
  2440. padding: 10px;
  2441. img {
  2442. max-width: 60px;
  2443. }
  2444. }
  2445. }
  2446. .similar_product {
  2447. position: relative;
  2448. padding: 15px;
  2449. margin-bottom: 30px;
  2450. border-radius: 5px;
  2451. box-shadow: 1px 1px 5px 1px #999;
  2452. display: flex;
  2453. justify-content: flex-start;
  2454. align-items: center;
  2455. }
  2456. .parts {
  2457. position: relative;
  2458. padding: 15px;
  2459. margin-bottom: 30px;
  2460. border-radius: 5px;
  2461. box-shadow: 1px 1px 5px 1px #999;
  2462. /deep/ .ivu-form-item {
  2463. display: inline-block;
  2464. width: 350px;
  2465. }
  2466. .parts_title {
  2467. display: flex;
  2468. justify-content: space-between;
  2469. }
  2470. .parts_content {
  2471. font-size: 14px;
  2472. .parts_content_attr {
  2473. display: flex;
  2474. justify-content: flex-start;
  2475. align-items: center;
  2476. flex-wrap: wrap;
  2477. // width: 350px;
  2478. span {
  2479. width: 80px;
  2480. text-align: center;
  2481. }
  2482. div {
  2483. display: flex;
  2484. width: 100%;
  2485. justify-content: flex-start;
  2486. align-items: center;
  2487. margin: 5px 0;
  2488. span {
  2489. margin: 0 5px;
  2490. }
  2491. }
  2492. }
  2493. .parts_content_line {
  2494. // width: 350px;
  2495. padding-left: 17px;
  2496. span {
  2497. margin-right: 5px;
  2498. }
  2499. }
  2500. .parts_content_lineTable,
  2501. .parts_content_partTable,
  2502. .parts_content_metalsTable {
  2503. margin: 10px 0;
  2504. }
  2505. .parts_content_part {
  2506. span {
  2507. margin-right: 5px;
  2508. }
  2509. }
  2510. }
  2511. }
  2512. }
  2513. .similarProductModal,
  2514. .ProcessLineModal {
  2515. /deep/ .ivu-form-item {
  2516. display: inline-block;
  2517. width: 220px;
  2518. }
  2519. }
  2520. .page {
  2521. display: flex;
  2522. justify-content: center;
  2523. margin-top: 10px;
  2524. }
  2525. .hierarchy {
  2526. .radio-g {
  2527. padding: 10px 0;
  2528. display: flex;
  2529. justify-content: flex-start;
  2530. align-items: center;
  2531. .radio-box {
  2532. display: flex;
  2533. flex-wrap: wrap;
  2534. justify-content: flex-start;
  2535. border-left: 1px solid #3764ff;
  2536. .radio-us {
  2537. background: #fff;
  2538. padding: 5px 20px;
  2539. margin: 5px;
  2540. margin-right: 18px;
  2541. color: #3764ff;
  2542. border-radius: 15px;
  2543. border: 1px solid #3764ff;
  2544. cursor: pointer;
  2545. }
  2546. .radio-us-foc {
  2547. color: #fff;
  2548. background: #3764ff;
  2549. border: 1px solid #3764ff;
  2550. }
  2551. }
  2552. .tit_box {
  2553. .box-us {
  2554. padding: 5px 20px;
  2555. margin: 5px;
  2556. margin-right: 18px;
  2557. border-radius: 5px;
  2558. cursor: pointer;
  2559. width: 100px;
  2560. display: inline-block;
  2561. text-align: center;
  2562. color: #3764ff;
  2563. background: #fff;
  2564. border: 1px solid #3764ff;
  2565. }
  2566. .box-us-foc {
  2567. color: #fff;
  2568. background: #3764ff;
  2569. border: 1px solid #3764ff;
  2570. }
  2571. }
  2572. .radio-us-none {
  2573. display: none;
  2574. }
  2575. }
  2576. }
  2577. .modal_process_route1 {
  2578. display: flex;
  2579. justify-content: space-around;
  2580. }
  2581. .modal_process_route {
  2582. .modal_process_route_top {
  2583. display: flex;
  2584. justify-content: space-around;
  2585. padding: 10px 0;
  2586. }
  2587. }
  2588. /deep/ .ivu-table-wrapper {
  2589. overflow: visible;
  2590. }
  2591. /deep/ .ivu-modal {
  2592. .modal_process_route_content {
  2593. max-height: 600px;
  2594. position: relative;
  2595. overflow: hidden;
  2596. overflow-y: auto;
  2597. }
  2598. }
  2599. .SortableList {
  2600. // display: flex;
  2601. // justify-content: flex-start;
  2602. // align-items: center;
  2603. // flex-wrap: wrap;
  2604. .SortableItem {
  2605. .tag-modal {
  2606. display: flex;
  2607. align-items: center;
  2608. .before {
  2609. width: 20px;
  2610. background: #3764ff;
  2611. height: 24px;
  2612. border-radius: 5px 0 0 5px;
  2613. display: flex;
  2614. justify-content: center;
  2615. align-items: center;
  2616. color: #fff;
  2617. }
  2618. }
  2619. }
  2620. }
  2621. /deep/.ivu-modal-body {
  2622. height: 750px;
  2623. overflow: auto;
  2624. }
  2625. .modal_content {
  2626. display: flex;
  2627. justify-content: space-around;
  2628. height: 100%;
  2629. .modal_content_left {
  2630. max-width: 40%;
  2631. min-width: 30%;
  2632. border-right: 1px solid #d8d8d8;
  2633. }
  2634. .modal_content_right {
  2635. width: 60%;
  2636. max-height: 700px;
  2637. padding-left: 10px;
  2638. overflow: hidden;
  2639. overflow-y: auto;
  2640. font-size: 18px;
  2641. }
  2642. }
  2643. .vertical-center-modal1 {
  2644. display: flex;
  2645. align-items: center;
  2646. justify-content: center;
  2647. .ivu-modal {
  2648. top: 0;
  2649. }
  2650. }
  2651. /deep/.el-input--small .el-input__inner {
  2652. height: 24px;
  2653. line-height: 24px;
  2654. }
  2655. </style>