deorderdetail.vue 83 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665
  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.sync="showSimilarProductModal"
  610. :close-on-click-modal="false"
  611. :close-on-press-escape="false"
  612. class="similarProductModal"
  613. width="1000px"
  614. :before-close="handleClose"
  615. >
  616. <Form :label-width="100" :model="similarProductData">
  617. <FormItem label="产品分类">
  618. <el-cascader
  619. clearable
  620. v-model="similarProductData.type_name"
  621. size="small"
  622. style="width: 120px"
  623. :show-all-levels="false"
  624. :options="PDTTypeList"
  625. :props="{
  626. expandTrigger: 'hover',
  627. children: 'child',
  628. value: 'title',
  629. label: 'title',
  630. checkStrictly: true,
  631. emitPath: false,
  632. }"
  633. @change="(e) => hanndleAddPDTTypeChange(similarProductData, e)"
  634. ></el-cascader>
  635. <!-- <Select
  636. v-model="similarProductData.type_name"
  637. placeholder="请选择"
  638. style="width: 120px"
  639. size="small"
  640. >
  641. <Option
  642. v-for="item in PDTTypeList"
  643. :value="item.title"
  644. :key="item.title"
  645. :label="item.title"
  646. ></Option>
  647. </Select> -->
  648. </FormItem>
  649. <FormItem label="产品名称:">
  650. <Input
  651. type="text"
  652. size="small"
  653. clearable
  654. v-model="similarProductData.title"
  655. style="width: 120px"
  656. />
  657. </FormItem>
  658. <FormItem label="产品型号">
  659. <Input
  660. type="text"
  661. size="small"
  662. clearable
  663. v-model="similarProductData.model"
  664. placeholder="请输入"
  665. style="width: 120px"
  666. />
  667. </FormItem>
  668. <FormItem label="图号:">
  669. <Input
  670. type="text"
  671. size="small"
  672. clearable
  673. v-model="similarProductData.url_number"
  674. style="width: 120px"
  675. />
  676. </FormItem>
  677. <Button
  678. type="primary"
  679. style="margin: 0 10px"
  680. @click="handleSimilarProductSearch"
  681. >搜索</Button
  682. >
  683. </Form>
  684. <Table
  685. :columns="similarProductColunms"
  686. border
  687. highlight-row
  688. :disabled-hover="true"
  689. @on-current-change="handleSimilarProductSelected"
  690. :loading="similarProductLoading"
  691. :data="similarProductData.similarProductList"
  692. >
  693. </Table>
  694. <div class="page">
  695. <Page
  696. @on-change="changeSimilarProductPage"
  697. :current="similarProductData.page_index"
  698. show-total
  699. :total="similarProductData.total"
  700. size="small"
  701. :page_size="similarProductData.page_size"
  702. />
  703. </div>
  704. <div class="modal-footer" slot="footer">
  705. <Button
  706. style="margin-right:10px"
  707. @click="showSimilarProductModal = false"
  708. >取消</Button
  709. >
  710. <Button
  711. type="primary"
  712. @click="handleSimilarProductConfirm(tempSimilarProductData.id)"
  713. >确认</Button
  714. >
  715. </div>
  716. </el-dialog>
  717. <!-- 选择工艺路线弹窗 -->
  718. <Modal
  719. class-name="vertical-center-modal"
  720. v-model="showProcessLineModal"
  721. title="选择工艺路线"
  722. >
  723. <div class="modal_process_route">
  724. <div class="modal_process_route_top">
  725. <div>
  726. <span>工艺路线名称:</span>
  727. <Input
  728. v-model="tempProcessLine.title"
  729. style="width: 120px"
  730. placeholder="请输入"
  731. />
  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.handleSimilarProductConfirm(res.data.product_id, this.formData);
  1467. }
  1468. });
  1469. },
  1470. handleMatchBP(array, id) {
  1471. array.forEach((element, index) => {
  1472. if (element.id != id) {
  1473. if (element.child && element.child.length > 0) {
  1474. return this.handleMatchBP(element.child, id);
  1475. }
  1476. } else {
  1477. this.nowSelectObj = element;
  1478. }
  1479. });
  1480. },
  1481. getChangeLists(e) {},
  1482. saveTableData(row, index) {
  1483. if (this.isNewProcess) {
  1484. let temparr = [];
  1485. this.selectTags.forEach((el) => {
  1486. temparr.push(el.id);
  1487. });
  1488. this.axios({
  1489. method: "post",
  1490. url: "/api/technological_route_edit",
  1491. data: {
  1492. id: "",
  1493. title: this.info.title,
  1494. procedure_id: temparr.join(","),
  1495. },
  1496. }).then((res) => {
  1497. if (res.code == 200) {
  1498. this.formData.parts[
  1499. this.tempSelectedPartIndex
  1500. ].partsProcessLineTableData = [];
  1501. this.formData.parts[
  1502. this.tempSelectedPartIndex
  1503. ].partsProcessLineTableData = this.formData.parts[
  1504. this.tempSelectedPartIndex
  1505. ].partsProcessLineTableData.concat(this.selectTags);
  1506. this.showProcessLineDetailModal = false;
  1507. this.formData.parts[
  1508. this.tempSelectedPartIndex
  1509. ].process_name = this.info.title;
  1510. }
  1511. });
  1512. } else {
  1513. this.formData.parts[
  1514. this.tempSelectedPartIndex
  1515. ].partsProcessLineTableData = [];
  1516. this.formData.parts[
  1517. this.tempSelectedPartIndex
  1518. ].partsProcessLineTableData = this.formData.parts[
  1519. this.tempSelectedPartIndex
  1520. ].partsProcessLineTableData.concat(this.selectTags);
  1521. this.showProcessLineDetailModal = false;
  1522. this.formData.parts[
  1523. this.tempSelectedPartIndex
  1524. ].process_name = this.info.title;
  1525. }
  1526. },
  1527. // 删除工艺路线列表项
  1528. handleProcessLineDele(row, i, index) {
  1529. let formData = JSON.parse(JSON.stringify(this.formData));
  1530. formData.parts[index].partsProcessLineTableData.splice(i, 1);
  1531. this.formData = formData;
  1532. },
  1533. //选择相似产品
  1534. handleSimilarProductShow() {
  1535. this.showSimilarProductModal = true;
  1536. this.similarProductLoading = true;
  1537. this.similarProductData.type_name = "";
  1538. this.similarProductData.title = "";
  1539. this.similarProductData.model = "";
  1540. this.similarProductData.url_number = "";
  1541. this.axios("/api/product", {
  1542. params: {
  1543. type_name: this.similarProductData.type_name,
  1544. title: this.similarProductData.title,
  1545. model: this.similarProductData.model,
  1546. url_number: this.similarProductData.url_number,
  1547. page_size: this.similarProductData.page_size,
  1548. page_index: this.similarProductData.page_index,
  1549. },
  1550. }).then((res) => {
  1551. this.similarProductLoading = false;
  1552. this.similarProductData.similarProductList = res.data.data;
  1553. this.similarProductData.total = res.data.total;
  1554. });
  1555. },
  1556. changeSimilarProductPage(e) {
  1557. this.similarProductLoading = true;
  1558. this.axios("/api/product", {
  1559. params: {
  1560. type_name: this.similarProductData.type_name,
  1561. title: this.similarProductData.title,
  1562. model: this.similarProductData.model,
  1563. url_number: this.similarProductData.url_number,
  1564. page_size: this.similarProductData.page_size,
  1565. page_index: e,
  1566. },
  1567. }).then((res) => {
  1568. this.similarProductLoading = false;
  1569. this.similarProductData.similarProductList = res.data.data;
  1570. this.similarProductData.similarProductList.forEach((el) => {
  1571. el.selected = false;
  1572. });
  1573. this.similarProductData.total = res.data.total;
  1574. });
  1575. },
  1576. handleSimilarProductSearch() {
  1577. this.similarProductLoading = true;
  1578. this.axios("/api/product", {
  1579. params: {
  1580. type_name: this.similarProductData.type_name,
  1581. title: this.similarProductData.title,
  1582. model: this.similarProductData.model,
  1583. url_number: this.similarProductData.url_number,
  1584. page_size: this.similarProductData.page_size,
  1585. page_index: this.similarProductData.page_index,
  1586. },
  1587. }).then((res) => {
  1588. this.similarProductLoading = false;
  1589. this.similarProductData.similarProductList = res.data.data;
  1590. this.similarProductData.similarProductList.forEach((el) => {
  1591. el.selected = false;
  1592. });
  1593. this.similarProductData.total = res.data.total;
  1594. });
  1595. },
  1596. // 产值比校验
  1597. handleProportionEdit(e, row, index) {
  1598. // e.target.value
  1599. },
  1600. handleSimilarProductSelected(row, oldrow) {
  1601. this.tempSimilarProductData = row;
  1602. },
  1603. handleSimilarProductConfirm(id, isEditItem) {
  1604. if (id) {
  1605. this.axios({
  1606. method: "get",
  1607. url: "/api/product",
  1608. params: {
  1609. id,
  1610. },
  1611. }).then((res) => {
  1612. if (res.code == 200) {
  1613. res.data.part.forEach((element) => {
  1614. this.formData.parts.forEach((ele) => {
  1615. if (element.part_id == ele.part_id) {
  1616. element.process_ids = ele.process_ids;
  1617. element.route_id = ele.route_id;
  1618. }
  1619. });
  1620. });
  1621. this.formData.parts = res.data.part;
  1622. //label
  1623. // this.formData.title = res.data.title;
  1624. // this.formData.unit = res.data.unit;
  1625. // this.formData.remark = res.data.remark;
  1626. // this.formData.url = res.data.url;
  1627. // this.formData.url_number = res.data.url_number;
  1628. // this.formData.measure = res.data.measure_id
  1629. // if (isEditItem) {
  1630. // res.data.part.forEach((element, index) => {
  1631. // Object.assign(element, this.formData.parts[index]);
  1632. // });
  1633. // }
  1634. this.formData.parts.map((element) => {
  1635. element.partsProcessLineTableData = [];
  1636. element.proportion = element.ratio;
  1637. element.wide = element.formula_w;
  1638. element.thick = element.formula_h;
  1639. element.long = element.formula_l;
  1640. element.ProcessAttrList = JSON.parse(
  1641. JSON.stringify(this.tempProcessAttrList)
  1642. ); //工艺属性列表
  1643. this.axios("/api/parts_detail", {
  1644. params: { id: element.part_id },
  1645. }).then((re) => {
  1646. // element.company = re.data.company
  1647. element.isAddPart = true;
  1648. element.isAddProcessRoute = true;
  1649. element.parts_type = re.data.p_id;
  1650. // element.part_id = re.data.title
  1651. this.axios({
  1652. method: "get",
  1653. url: "/api/parts_index",
  1654. params: {
  1655. bp_id: element.parts_type,
  1656. },
  1657. }).then((r) => {
  1658. element.partsNameList = r.data.data;
  1659. if (isEditItem) {
  1660. let item = isEditItem;
  1661. // let item = JSON.parse(JSON.stringify(isEditItem));
  1662. item.parts.forEach((element) => {
  1663. element.processCombination = element.route_id;
  1664. let obj = { value: element.route_id, label: "" };
  1665. this.handleProcessRouteSelect(element, obj);
  1666. });
  1667. isEditItem = item;
  1668. }
  1669. this.$forceUpdate();
  1670. });
  1671. element.company = re.data.company;
  1672. // element.partsNameList = [{ id: re.data.id, title: re.data.title }]
  1673. element.pay_state = re.data.label;
  1674. // element.partsWoodTableData = re.data.detail;
  1675. this.showSimilarProductModal = false;
  1676. });
  1677. let obj = { value: element.part_id };
  1678. this.handlePartsNameSelect(element, obj);
  1679. });
  1680. }
  1681. });
  1682. } else {
  1683. this.showSimilarProductModal = false;
  1684. }
  1685. },
  1686. //选择部件分类名称
  1687. handlePartsSelect(e, item) {
  1688. this.axios({
  1689. method: "get",
  1690. url: "/api/parts_index",
  1691. params: {
  1692. bp_id: e,
  1693. },
  1694. })
  1695. .then((res) => {
  1696. this.$nextTick(() => {
  1697. item.part_id = "";
  1698. item.partsNameList = res.data.data;
  1699. this.$forceUpdate();
  1700. });
  1701. })
  1702. .catch((err) => {});
  1703. },
  1704. //新增部件名称
  1705. handlePartTitleCreate(item, val) {
  1706. item.partsNameList.push({
  1707. id: val,
  1708. title: val,
  1709. });
  1710. this.$forceUpdate();
  1711. },
  1712. //新增工艺组合名称
  1713. handleProcessRouteCreate(item, val) {
  1714. //////
  1715. item.isAddProcessRoute = true;
  1716. item.ProcessAttrList = JSON.parse(
  1717. JSON.stringify(this.tempProcessAttrList)
  1718. );
  1719. // 新增工艺组合,展示所有工艺
  1720. item.ProcessAttrList.map((item) => {
  1721. item.cld &&
  1722. item.cld.length > 0 &&
  1723. item.cld.map((level1) => {
  1724. level1.list &&
  1725. level1.list.length > 0 &&
  1726. level1.list.map((level2) => {
  1727. level2.display = true;
  1728. });
  1729. });
  1730. });
  1731. if (!item.partsProcessRouteList) {
  1732. item.partsProcessRouteList = [];
  1733. }
  1734. item.partsProcessRouteList.push({
  1735. id: val,
  1736. title: val,
  1737. });
  1738. this.$forceUpdate();
  1739. },
  1740. // 部件名称
  1741. handlePartsNameSelect(item, val) {
  1742. if (val) {
  1743. if (val.label != val.value) {
  1744. item.isAddPart = false;
  1745. this.axios({
  1746. method: "get",
  1747. url: "/api/parts_detail",
  1748. params: {
  1749. id: val.value,
  1750. },
  1751. }).then((res) => {
  1752. item.pay_state = res.data.label;
  1753. item.company = res.data.company;
  1754. item.ProcessAttrList = this.tempProcessAttrList;
  1755. item.partsWoodTableData ? "" : (item.partsWoodTableData = []);
  1756. item.partsMetalseData ? "" : (item.partsMetalseData = []);
  1757. item.partsWoodTableData = res.data.detail.filter(
  1758. (v) => v.type_id == 1 || v.type_id == 2
  1759. );
  1760. item.partsMetalseData = res.data.detail.filter(
  1761. (v) => v.type_id == 5
  1762. );
  1763. this.axios({
  1764. method: "get",
  1765. url: "/api/process_route_index",
  1766. params: {
  1767. part_id: val.value,
  1768. },
  1769. })
  1770. .then((re) => {
  1771. this.$nextTick(() => {
  1772. item.partsProcessRouteList = re.data.detail;
  1773. this.$forceUpdate();
  1774. });
  1775. })
  1776. .catch((err) => {});
  1777. });
  1778. } else {
  1779. item.isAddPart = true;
  1780. // item.ProcessAttrList = this.tempProcessAttrList;
  1781. // item.partsWoodTableData = [];
  1782. // item.partsMetalseData = [];
  1783. // item.process_name = "";
  1784. }
  1785. }
  1786. },
  1787. // 选择工艺组合名称
  1788. handleProcessRouteSelect(item, val) {
  1789. if (val) {
  1790. item.ProcessAttrList.map((level0) => {
  1791. level0.cld &&
  1792. level0.cld.length > 0 &&
  1793. level0.cld.map((level1) => {
  1794. level1.list &&
  1795. level1.list.length > 0 &&
  1796. level1.list.map((level2) => {
  1797. level2.display = true;
  1798. });
  1799. });
  1800. });
  1801. if (val.label != val.value) {
  1802. item.isAddProcessRoute = false;
  1803. this.axios({
  1804. method: "get",
  1805. url: "/api/process_route_detail",
  1806. params: {
  1807. id: val.value,
  1808. },
  1809. }).then((res) => {
  1810. this.info = res.data;
  1811. this.info.bps = this.temp_info_bps;
  1812. item.process_price = res.data.price;
  1813. this.selectTags = res.data.produce_list;
  1814. const selectTagsId = this.selectTags.map((item) => item.id);
  1815. item.ProcessAttrList = res.data.list;
  1816. item.process_name = res.data.technological_route_title;
  1817. item.properties = res.data.pp_id.split(","); ///存在问题
  1818. this.info.bps.forEach((v) => {
  1819. v.cld &&
  1820. v.cld.length > 0 &&
  1821. v.cld.forEach((z) => {
  1822. z.show = selectTagsId.includes(z.id);
  1823. z.cld &&
  1824. z.cld.length > 0 &&
  1825. z.cld.forEach((elem) => {
  1826. elem.show = selectTagsId.includes(elem.id);
  1827. elem.cld &&
  1828. elem.cld.length > 0 &&
  1829. elem.cld.forEach((ele) => {
  1830. ele.show = selectTagsId.includes(ele.id);
  1831. ele.cld &&
  1832. ele.cld.length > 0 &&
  1833. ele.cld.forEach((el) => {
  1834. el.show = selectTagsId.includes(el.id);
  1835. });
  1836. });
  1837. });
  1838. });
  1839. });
  1840. item.ProcessAttrList.map((level0) => {
  1841. level0.cld &&
  1842. level0.cld.length > 0 &&
  1843. level0.cld.map((level1) => {
  1844. level1.list &&
  1845. level1.list.length > 0 &&
  1846. level1.list.map((level2) => {
  1847. level2.display = level2.show;
  1848. });
  1849. });
  1850. });
  1851. item.partsProcessLineTableData = this.selectTags;
  1852. });
  1853. } else {
  1854. item.isAddProcessRoute = true;
  1855. }
  1856. }
  1857. },
  1858. //选择工艺路线
  1859. editRouter(item, index) {
  1860. // 重新打开则重新判定是否为新增工艺路线
  1861. this.isNewProcess = false;
  1862. this.showProcessLineModal = true;
  1863. this.tempSelectedPartIndex = index;
  1864. this.handleSearchProcessLine(this.tempProcessLine.title);
  1865. },
  1866. handleSearchProcessLine(title) {
  1867. this.axios({
  1868. method: "get",
  1869. url: "/api/technological_route",
  1870. params: {
  1871. title,
  1872. },
  1873. }).then((res) => {
  1874. this.processLineTableData = res.data.data;
  1875. });
  1876. },
  1877. changeCheck(e, item, selectArray) {
  1878. // 一旦更改便标记为新增工艺路线
  1879. this.isNewProcess = true;
  1880. //复选框选中与非选中同时同步tag标签跟随操作
  1881. item.show = e;
  1882. if (e) {
  1883. selectArray.push(item);
  1884. } else {
  1885. let id = item.id;
  1886. let id_index = selectArray.findIndex((v) => v.id == id);
  1887. selectArray.splice(id_index, 1);
  1888. }
  1889. },
  1890. closeTag(key, arr, row) {
  1891. //取消tag标签展示操作并同步下方的复选框ui同步
  1892. for (const key in this.info.bps) {
  1893. const element = this.info.bps[key];
  1894. element.cld.map((p) => {
  1895. p.id == row.id ? (p.show = false) : "";
  1896. p.cld &&
  1897. p.cld.length > 0 &&
  1898. p.cld.map((q) => {
  1899. q.id == row.id ? (q.show = false) : "";
  1900. q.cld &&
  1901. q.cld.length > 0 &&
  1902. q.cld.map((r) => {
  1903. r.id == row.id ? (r.show = false) : "";
  1904. r.cld &&
  1905. r.cld.length > 0 &&
  1906. r.cld.map((s) => {
  1907. s.id == row.id ? (s.show = false) : "";
  1908. });
  1909. });
  1910. });
  1911. });
  1912. }
  1913. arr.splice(key, 1);
  1914. },
  1915. setBoxChange(parent, child) {
  1916. return;
  1917. // const { type } = this.$route.query;
  1918. // if (type == 3) {
  1919. // return;
  1920. // }
  1921. // child.show = !child.show;
  1922. // child.list.forEach((element) => {
  1923. // element.show = child.show;
  1924. // });
  1925. },
  1926. setRadioChange(parent, child, index, parts, cld) {
  1927. if (this.type == 1) {
  1928. if (parts.isAddProcessRoute) {
  1929. cld.forEach((element) => {
  1930. element.list.forEach((elem) => {
  1931. elem.id != child.id && (elem.show = false);
  1932. });
  1933. });
  1934. child.show = !child.show;
  1935. parts.properties[index] = child.id;
  1936. }
  1937. }
  1938. this.$forceUpdate();
  1939. },
  1940. // setRadioChange(parent, child) {
  1941. // const { type } = this.$route.query;
  1942. // if (type == 3) {
  1943. // return;
  1944. // }
  1945. // // let flag = true;
  1946. // parent.list.forEach((element) => {
  1947. // element.show = false
  1948. // if (!element.show) {
  1949. // // flag = false;
  1950. // }
  1951. // });
  1952. // child.show = !child.show;
  1953. // console.log('child.show :>> ', child.show);
  1954. // // parent.show = flag;
  1955. // this.$forceUpdate();
  1956. // },
  1957. handleProcessLineSet(row, index) {
  1958. this.process_name = row.title;
  1959. this.info.id = row.id;
  1960. this.info.title = row.title;
  1961. this.info.procedure_id = row.procedure_id;
  1962. this.selectTags = [];
  1963. const arr = this.info.procedure_id
  1964. ? this.info.procedure_id.split(",")
  1965. : [];
  1966. for (const key in this.info.bps) {
  1967. const el = this.info.bps[key];
  1968. el.cld.forEach((z) => {
  1969. z.show = false;
  1970. z.cld &&
  1971. z.cld.length > 0 &&
  1972. z.cld.forEach((elem) => {
  1973. elem.show = false;
  1974. elem.cld &&
  1975. elem.cld.length > 0 &&
  1976. elem.cld.forEach((ele) => {
  1977. ele.show = false;
  1978. });
  1979. });
  1980. });
  1981. }
  1982. for (let index = 0; index < arr.length; index++) {
  1983. const element = arr[index];
  1984. this.info.bps.map((lv1) => {
  1985. lv1.cld &&
  1986. lv1.cld.length > 0 &&
  1987. lv1.cld.map((lv2) => {
  1988. if (lv2.id == element) {
  1989. lv2.show = true;
  1990. lv2.p_id && this.selectTags.push(lv2);
  1991. }
  1992. lv2.cld &&
  1993. lv2.cld.length > 0 &&
  1994. lv2.cld.map((lv3) => {
  1995. if (lv3.id == element) {
  1996. lv3.show = true;
  1997. lv3.p_id && this.selectTags.push(lv3);
  1998. }
  1999. lv3.cld &&
  2000. lv3.cld.length > 0 &&
  2001. lv3.cld.map((lv4) => {
  2002. if (lv4.id == element) {
  2003. lv4.show = true;
  2004. lv4.p_id && this.selectTags.push(lv4);
  2005. }
  2006. });
  2007. });
  2008. });
  2009. });
  2010. }
  2011. this.showProcessLineDetailModal = true;
  2012. this.showProcessLineModal = false;
  2013. },
  2014. changeProcessLineSize() {},
  2015. changeProcessLinePage() {},
  2016. handleProcessLineConfirm() {},
  2017. handleProcessLineSearch() {},
  2018. handlePartAdd(item, index) {
  2019. let obj = {
  2020. isAddPart: true,
  2021. isAddProcessRoute: true,
  2022. long: "",
  2023. width: "",
  2024. thick: "",
  2025. parts_type: "", //部件分类名称
  2026. pay_state: "", //标签
  2027. part_id: "", //部件名称
  2028. company: "", //单位
  2029. processCombination: "", //工艺组合名称
  2030. process_price: "", //工艺价格
  2031. ProcessAttrList: JSON.parse(JSON.stringify(this.tempProcessAttrList)), //工艺属性列表
  2032. partsProcessLineTableData: [
  2033. {
  2034. id: "",
  2035. type: "",
  2036. title: "",
  2037. time: "",
  2038. wages: "",
  2039. capacity: "",
  2040. },
  2041. ], //工艺路线表格
  2042. partsWoodTableData: [
  2043. {
  2044. title: "",
  2045. spare_parts: "",
  2046. number: "",
  2047. company: "",
  2048. long: "",
  2049. wide: "",
  2050. thick: "",
  2051. technological_requirement_id: "",
  2052. sub_num: "",
  2053. veneer_id: "",
  2054. paint_id: "",
  2055. label: "",
  2056. print_num: "",
  2057. },
  2058. ], //零部件表格
  2059. partsMetalseData: [
  2060. {
  2061. spare_parts: "",
  2062. number: "",
  2063. company: "",
  2064. price: "",
  2065. total_price: "",
  2066. },
  2067. ], //五金表格
  2068. partsNameList: [{ id: "", title: "" }], //部件名称列表
  2069. checkBox: [],
  2070. keyUseType: 0,
  2071. };
  2072. this.formData.parts.splice(index + 1, 0, obj);
  2073. },
  2074. handlePartCopy(item, index) {
  2075. let obj = JSON.parse(JSON.stringify(item));
  2076. // this.formData.parts.splice(index, 0, obj);
  2077. this.formData.parts.push(obj);
  2078. },
  2079. handlePartDele(item, index) {
  2080. this.formData.parts.splice(index, 1);
  2081. },
  2082. handlePartWoodAdd(index) {
  2083. let formData = JSON.parse(JSON.stringify(this.formData));
  2084. formData.parts[index].partsWoodTableData.push({
  2085. type_id: 1,
  2086. title: "",
  2087. spare_parts: "",
  2088. number: "",
  2089. company: "",
  2090. long: "",
  2091. wide: "",
  2092. thick: "",
  2093. technological_requirement_id: "",
  2094. sub_num: "",
  2095. veneer_id: "",
  2096. paint_id: "",
  2097. label: "",
  2098. print_num: "",
  2099. });
  2100. this.formData = formData;
  2101. },
  2102. handlePartWoodCopy(row, index, parentIndex) {
  2103. this.$nextTick(() => {
  2104. let obj = JSON.parse(
  2105. JSON.stringify(
  2106. this.formData.parts[parentIndex].partsWoodTableData[index]
  2107. )
  2108. );
  2109. this.formData.parts[parentIndex].partsWoodTableData.splice(
  2110. index + 1,
  2111. 0,
  2112. obj
  2113. );
  2114. // this.formData.parts[parentIndex].partsWoodTableData.push(obj)
  2115. this.$forceUpdate();
  2116. });
  2117. },
  2118. handlePartWoodDele(row, index, parentIndex) {
  2119. this.formData.parts[parentIndex].partsWoodTableData.splice(index, 1);
  2120. },
  2121. handlePartMetalsAdd(index) {
  2122. let formData = JSON.parse(JSON.stringify(this.formData));
  2123. if (formData.parts[index].partsMetalseData == undefined) {
  2124. formData.parts[index].partsMetalseData = [];
  2125. }
  2126. formData.parts[index].partsMetalseData.push({
  2127. type_id: 2,
  2128. spare_parts: "",
  2129. number: "",
  2130. company: "",
  2131. price: "",
  2132. total_price: "",
  2133. });
  2134. this.formData = formData;
  2135. },
  2136. handlePartMetalsCopy(row, index, parentIndex) {
  2137. let obj = JSON.parse(JSON.stringify(row));
  2138. this.formData.parts[parentIndex].partsMetalseData.splice(
  2139. index + 1,
  2140. 0,
  2141. obj
  2142. );
  2143. },
  2144. handleClose(done) {
  2145. done();
  2146. },
  2147. handlePartMetalsDele(row, index, parentIndex) {
  2148. this.formData.parts[parentIndex].partsMetalseData.splice(index, 1);
  2149. },
  2150. handleProcessLineSelected() {},
  2151. async postData() {
  2152. let sum = 0;
  2153. this.formData.parts.forEach((element) => {
  2154. sum += element.proportion * 1;
  2155. });
  2156. const BJ_name = this.formData.parts.map((item) => {
  2157. return item.part_id;
  2158. });
  2159. const atfer_BJ_name = Array.from(new Set(BJ_name));
  2160. if (atfer_BJ_name.length != BJ_name.length) {
  2161. return this.$Message.error("部件名称存在重复");
  2162. }
  2163. const GYLX_name = this.formData.parts.map((item) => {
  2164. return item.processCombination;
  2165. });
  2166. const atfer_GYLX_name = Array.from(new Set(GYLX_name));
  2167. if (GYLX_name.length != atfer_GYLX_name.length) {
  2168. return this.$Message.error("工艺路线存在重复");
  2169. }
  2170. if (sum != 100) {
  2171. this.$Message.error("产值比之和须为100");
  2172. } else {
  2173. // 部件保存
  2174. let save_sucess = true;
  2175. for (let i in this.formData.parts) {
  2176. let element = this.formData.parts[i];
  2177. let flag = false;
  2178. element.partsNameList.forEach((ele) => {
  2179. if (element.part_id == ele.id && ele.id == ele.title) {
  2180. flag = true;
  2181. }});
  2182. if (flag) {
  2183. let result = await this.axios({
  2184. method: "post",
  2185. url: "/api/order_area_explode_part",
  2186. data: {
  2187. top: {
  2188. p_id: element.parts_type,
  2189. bp_id: this.nowSelectObj.id, //相似产品
  2190. company: element.company,
  2191. label: element.pay_state,
  2192. title: element.part_id,
  2193. },
  2194. op: "add",
  2195. detail: [
  2196. ...element.partsWoodTableData,
  2197. ...element.partsMetalseData,
  2198. ],
  2199. },
  2200. });
  2201. if (result.code == 200) {
  2202. element.part_id = result.data.id;
  2203. // 工艺路线保存 partsProcessLineTableData
  2204. let procedure = "";
  2205. let bool = false;
  2206. element.partsProcessRouteList.forEach((ele) => {
  2207. if (
  2208. element.processCombination == ele.id &&
  2209. ele.id == ele.title
  2210. ) {
  2211. bool = true;
  2212. }
  2213. });
  2214. element.partsProcessLineTableData.forEach(async (el, idx) => {
  2215. if (idx == element.length - 1) {
  2216. procedure += el.id + "";
  2217. } else {
  2218. procedure += el.id + ",";
  2219. }
  2220. });
  2221. if (bool) {
  2222. let res = await this.axios({
  2223. method: "post",
  2224. url: "/api/order_area_explode_process",
  2225. data: {
  2226. parts_id: element.part_id, /////
  2227. price: element.process_price,
  2228. properties:
  2229. typeof element.properties == "string"
  2230. ? [element.properties]
  2231. : element.properties,
  2232. // properties: element.properties,
  2233. title: element.processCombination,
  2234. procedure,
  2235. op: "add",
  2236. },
  2237. });
  2238. element.route_id = res.data.id;
  2239. element.part_id = result.data.id;
  2240. } else {
  2241. element.route_id = element.processCombination;
  2242. }
  2243. } else {
  2244. save_sucess = false;
  2245. }
  2246. } else {
  2247. // 工艺路线保存 partsProcessLineTableData
  2248. let procedure = "";
  2249. let bool = false;
  2250. element.partsProcessRouteList.forEach((ele) => {
  2251. if (element.processCombination == ele.id && ele.id == ele.title) {
  2252. bool = true;
  2253. }
  2254. });
  2255. element.partsProcessLineTableData.forEach(async (el, idx) => {
  2256. if (idx == element.length - 1) {
  2257. procedure += el.id + "";
  2258. } else {
  2259. procedure += el.id + ",";
  2260. }
  2261. });
  2262. if (bool) {
  2263. let res = await this.axios({
  2264. method: "post",
  2265. url: "/api/order_area_explode_process",
  2266. data: {
  2267. parts_id: element.part_id, /////
  2268. price: element.process_price,
  2269. properties:
  2270. typeof element.properties == "string"
  2271. ? [element.properties]
  2272. : element.properties,
  2273. // properties: element.properties,
  2274. title: element.processCombination,
  2275. procedure,
  2276. op: "add",
  2277. },
  2278. });
  2279. if (res.code == 200) {
  2280. element.route_id = res.data.id;
  2281. } else {
  2282. save_sucess = false;
  2283. }
  2284. } else {
  2285. element.route_id = element.processCombination;
  2286. }
  2287. }
  2288. }
  2289. this.formData.parts.forEach((element) => {
  2290. element.detail = [
  2291. ...element.partsWoodTableData,
  2292. ...element.partsMetalseData,
  2293. ];
  2294. });
  2295. // 产品编辑保存
  2296. if (save_sucess) {
  2297. await this.axios({
  2298. method: "post",
  2299. url: "/api/order_area_explode_save",
  2300. data: {
  2301. ...this.formData,
  2302. order_no: this.$route.query.order_no,
  2303. oa_id: this.$route.query.oa_id,
  2304. orders_area_product_detail_id: this.$route.query
  2305. .orders_area_product_detail_id,
  2306. },
  2307. }).then((res) => {
  2308. if (res.code == 200) {
  2309. this.$Message.success(res.msg);
  2310. this.goback();
  2311. }
  2312. });
  2313. }
  2314. }
  2315. },
  2316. goback() {
  2317. this.$router.go(-1);
  2318. },
  2319. successKey(str) {
  2320. if (this.keyUseType == 1) {
  2321. this.formData.parts[this.attrParentindex].partsWoodTableData[
  2322. this.attrIndex
  2323. ][this.attrName] = str;
  2324. // this.$set(this.formData.parts[this.attrParentindex].partsWoodTableData[this.attrIndex],[this.attrName], str)
  2325. } else {
  2326. this.formData.parts[this.attrParentindex][this.attrName] = str;
  2327. }
  2328. this.showKey = false;
  2329. },
  2330. cancelKey() {
  2331. this.showKey = false;
  2332. },
  2333. openKey(partsIndex, index, attr, partsItem) {
  2334. // this.axios({
  2335. // method: "get",
  2336. // url: "/api/basics_product_list",
  2337. // params: {
  2338. // id: partsItem.part_id,
  2339. // },
  2340. // })
  2341. // .then((res) => {
  2342. // res.data.forEach((element) => {
  2343. // if (element.id == partsItem.part_id) {
  2344. // this.measureList = element.measure;
  2345. // }
  2346. // });
  2347. this.showKey = true;
  2348. this.attrParentindex = partsIndex;
  2349. if (index != -1) {
  2350. this.attrIndex = index;
  2351. this.keyUseType = 1;
  2352. } else {
  2353. this.keyUseType = 2;
  2354. }
  2355. this.attrName = attr;
  2356. // })
  2357. },
  2358. changeSe(e, n, partsIndex, row) {
  2359. let event = window.event;
  2360. let unit = event.target.dataset.unit;
  2361. // row.company = unit ? unit : ''
  2362. // row.thick = e.tag
  2363. // row.title = e.title
  2364. this.formData.parts[partsIndex].partsWoodTableData[n].company = unit
  2365. ? unit
  2366. : "";
  2367. this.formData.parts[partsIndex].partsWoodTableData[n].thick = e.tag;
  2368. this.formData.parts[partsIndex].partsWoodTableData[n].title = e.title;
  2369. },
  2370. changeMetal(e, n, partsIndex) {
  2371. let event = window.event;
  2372. let unit = event.target.dataset.unit;
  2373. this.formData.parts[partsIndex].partsMetalseData[n].company = unit
  2374. ? unit
  2375. : "";
  2376. },
  2377. handleMetalTotalPriceChange(row) {
  2378. row.total_price = 1 * row.price * row.number;
  2379. },
  2380. handleClick(e) {
  2381. let data = JSON.parse(e);
  2382. this.nowSelectObj = data;
  2383. this.info.bp_id = this.nowSelectObj.id;
  2384. this.axios("/api/basics_product_list", {
  2385. params: { id: this.nowSelectObj.id },
  2386. }).then((res) => {
  2387. res.data.forEach((element) => {
  2388. if (element.id == this.nowSelectObj.id) {
  2389. this.measureList = element.measure;
  2390. }
  2391. });
  2392. });
  2393. },
  2394. checkImg(item) {
  2395. let list = [];
  2396. item.forEach((el) => {
  2397. list.push({ img_url: el });
  2398. });
  2399. // this.axios('/api/orders_img', { params: { id: this.order_area_product_id, type: 1 } }).then(res => {
  2400. // if (res.code == 200) {
  2401. this.$previewImg({
  2402. list,
  2403. baseUrl: this.$store.state.ip,
  2404. baseImgField: "img_url",
  2405. baseTitleField: "",
  2406. });
  2407. // }
  2408. // })
  2409. },
  2410. },
  2411. // 监听属性 类似于data概念
  2412. computed: {},
  2413. // 监控data中的数据变化
  2414. watch: {},
  2415. beforeCreate() {}, // 生命周期 - 创建之前
  2416. beforeMount() {}, // 生命周期 - 挂载之前
  2417. beforeUpdate() {}, // 生命周期 - 更新之前
  2418. updated() {}, // 生命周期 - 更新之后
  2419. beforeDestroy() {}, // 生命周期 - 销毁之前
  2420. destroyed() {}, // 生命周期 - 销毁完成
  2421. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  2422. };
  2423. </script>
  2424. <style lang="scss" scoped>
  2425. .BidSystemProductDeOrderDeorderdetail {
  2426. position: relative;
  2427. overflow: hidden;
  2428. overflow-y: auto;
  2429. .top_info {
  2430. display: flex;
  2431. justify-content: flex-start;
  2432. align-items: center;
  2433. flex-wrap: wrap;
  2434. padding: 10px;
  2435. span {
  2436. min-width: 40px;
  2437. margin-right: 5px;
  2438. }
  2439. div {
  2440. display: flex;
  2441. justify-content: flex-start;
  2442. align-items: center;
  2443. width: 200px;
  2444. padding: 10px;
  2445. img {
  2446. max-width: 60px;
  2447. }
  2448. }
  2449. }
  2450. .similar_product {
  2451. position: relative;
  2452. padding: 15px;
  2453. margin-bottom: 30px;
  2454. border-radius: 5px;
  2455. box-shadow: 1px 1px 5px 1px #999;
  2456. display: flex;
  2457. justify-content: flex-start;
  2458. align-items: center;
  2459. }
  2460. .parts {
  2461. position: relative;
  2462. padding: 15px;
  2463. margin-bottom: 30px;
  2464. border-radius: 5px;
  2465. box-shadow: 1px 1px 5px 1px #999;
  2466. /deep/ .ivu-form-item {
  2467. display: inline-block;
  2468. width: 350px;
  2469. }
  2470. .parts_title {
  2471. display: flex;
  2472. justify-content: space-between;
  2473. }
  2474. .parts_content {
  2475. font-size: 14px;
  2476. .parts_content_attr {
  2477. display: flex;
  2478. justify-content: flex-start;
  2479. align-items: center;
  2480. flex-wrap: wrap;
  2481. // width: 350px;
  2482. span {
  2483. width: 80px;
  2484. text-align: center;
  2485. }
  2486. div {
  2487. display: flex;
  2488. width: 100%;
  2489. justify-content: flex-start;
  2490. align-items: center;
  2491. margin: 5px 0;
  2492. span {
  2493. margin: 0 5px;
  2494. }
  2495. }
  2496. }
  2497. .parts_content_line {
  2498. // width: 350px;
  2499. padding-left: 17px;
  2500. span {
  2501. margin-right: 5px;
  2502. }
  2503. }
  2504. .parts_content_lineTable,
  2505. .parts_content_partTable,
  2506. .parts_content_metalsTable {
  2507. margin: 10px 0;
  2508. }
  2509. .parts_content_part {
  2510. span {
  2511. margin-right: 5px;
  2512. }
  2513. }
  2514. }
  2515. }
  2516. }
  2517. .similarProductModal,
  2518. .ProcessLineModal {
  2519. /deep/ .ivu-form-item {
  2520. display: inline-block;
  2521. width: 220px;
  2522. }
  2523. }
  2524. .page {
  2525. display: flex;
  2526. justify-content: center;
  2527. margin-top: 10px;
  2528. }
  2529. .hierarchy {
  2530. .radio-g {
  2531. padding: 10px 0;
  2532. display: flex;
  2533. justify-content: flex-start;
  2534. align-items: center;
  2535. .radio-box {
  2536. display: flex;
  2537. flex-wrap: wrap;
  2538. justify-content: flex-start;
  2539. border-left: 1px solid #3764ff;
  2540. .radio-us {
  2541. background: #fff;
  2542. padding: 5px 20px;
  2543. margin: 5px;
  2544. margin-right: 18px;
  2545. color: #3764ff;
  2546. border-radius: 15px;
  2547. border: 1px solid #3764ff;
  2548. cursor: pointer;
  2549. }
  2550. .radio-us-foc {
  2551. color: #fff;
  2552. background: #3764ff;
  2553. border: 1px solid #3764ff;
  2554. }
  2555. }
  2556. .tit_box {
  2557. .box-us {
  2558. background: #fff;
  2559. padding: 5px 20px;
  2560. margin: 5px;
  2561. margin-right: 18px;
  2562. color: #3764ff;
  2563. border-radius: 5px;
  2564. border: 1px solid #3764ff;
  2565. cursor: pointer;
  2566. width: 100px;
  2567. display: inline-block;
  2568. text-align: center;
  2569. }
  2570. .box-us-foc {
  2571. color: #fff;
  2572. background:#3764ff;
  2573. border: 1px solid #3764ff;
  2574. }
  2575. }
  2576. .radio-us-none {
  2577. display: none;
  2578. }
  2579. }
  2580. }
  2581. .modal_process_route1 {
  2582. display: flex;
  2583. justify-content: space-around;
  2584. }
  2585. .modal_process_route {
  2586. .modal_process_route_top {
  2587. display: flex;
  2588. justify-content: space-around;
  2589. padding: 10px 0;
  2590. }
  2591. }
  2592. /deep/ .ivu-table-wrapper {
  2593. overflow: visible;
  2594. }
  2595. /deep/ .ivu-modal {
  2596. .modal_process_route_content {
  2597. max-height: 600px;
  2598. position: relative;
  2599. overflow: hidden;
  2600. overflow-y: auto;
  2601. }
  2602. }
  2603. .SortableList {
  2604. // display: flex;
  2605. // justify-content: flex-start;
  2606. // align-items: center;
  2607. // flex-wrap: wrap;
  2608. .SortableItem {
  2609. .tag-modal {
  2610. display: flex;
  2611. align-items: center;
  2612. .before {
  2613. width: 20px;
  2614. background: #3764ff;
  2615. height: 24px;
  2616. border-radius: 5px 0 0 5px;
  2617. display: flex;
  2618. justify-content: center;
  2619. align-items: center;
  2620. color: #fff;
  2621. }
  2622. }
  2623. }
  2624. }
  2625. /deep/.ivu-modal-body {
  2626. height: 750px;
  2627. overflow: auto;
  2628. }
  2629. .modal_content {
  2630. display: flex;
  2631. justify-content: space-around;
  2632. height: 100%;
  2633. .modal_content_left {
  2634. max-width: 40%;
  2635. min-width: 30%;
  2636. border-right: 1px solid #d8d8d8;
  2637. }
  2638. .modal_content_right {
  2639. width: 60%;
  2640. max-height: 700px;
  2641. padding-left: 10px;
  2642. overflow: hidden;
  2643. overflow-y: auto;
  2644. font-size: 18px;
  2645. }
  2646. }
  2647. .vertical-center-modal1 {
  2648. display: flex;
  2649. align-items: center;
  2650. justify-content: center;
  2651. .ivu-modal {
  2652. top: 0;
  2653. }
  2654. }
  2655. /deep/.el-input--small .el-input__inner {
  2656. height: 24px;
  2657. line-height: 24px;
  2658. }
  2659. </style>