deorderdetail.vue 83 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664
  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. });
  2183. if (flag) {
  2184. let result = await this.axios({
  2185. method: "post",
  2186. url: "/api/order_area_explode_part",
  2187. data: {
  2188. top: {
  2189. p_id: element.parts_type,
  2190. bp_id: this.nowSelectObj.id, //相似产品
  2191. company: element.company,
  2192. label: element.pay_state,
  2193. title: element.part_id,
  2194. },
  2195. op: "add",
  2196. detail: [
  2197. ...element.partsWoodTableData,
  2198. ...element.partsMetalseData,
  2199. ],
  2200. },
  2201. });
  2202. if (result.code == 200) {
  2203. element.part_id = result.data.id;
  2204. // 工艺路线保存 partsProcessLineTableData
  2205. let procedure = "";
  2206. let bool = false;
  2207. element.partsProcessRouteList.forEach((ele) => {
  2208. if (
  2209. element.processCombination == ele.id &&
  2210. ele.id == ele.title
  2211. ) {
  2212. bool = true;
  2213. }
  2214. });
  2215. element.partsProcessLineTableData.forEach(async (el, idx) => {
  2216. if (idx == element.length - 1) {
  2217. procedure += el.id + "";
  2218. } else {
  2219. procedure += el.id + ",";
  2220. }
  2221. });
  2222. if (bool) {
  2223. let res = await this.axios({
  2224. method: "post",
  2225. url: "/api/order_area_explode_process",
  2226. data: {
  2227. parts_id: element.part_id, /////
  2228. price: element.process_price,
  2229. properties:
  2230. typeof element.properties == "string"
  2231. ? [element.properties]
  2232. : element.properties,
  2233. // properties: element.properties,
  2234. title: element.processCombination,
  2235. procedure,
  2236. op: "add",
  2237. },
  2238. });
  2239. element.route_id = res.data.id;
  2240. element.part_id = result.data.id;
  2241. } else {
  2242. element.route_id = element.processCombination;
  2243. }
  2244. } else {
  2245. save_sucess = false;
  2246. }
  2247. } else {
  2248. // 工艺路线保存 partsProcessLineTableData
  2249. let procedure = "";
  2250. let bool = false;
  2251. element.partsProcessRouteList.forEach((ele) => {
  2252. if (element.processCombination == ele.id && ele.id == ele.title) {
  2253. bool = true;
  2254. }
  2255. });
  2256. element.partsProcessLineTableData.forEach(async (el, idx) => {
  2257. if (idx == element.length - 1) {
  2258. procedure += el.id + "";
  2259. } else {
  2260. procedure += el.id + ",";
  2261. }
  2262. });
  2263. if (bool) {
  2264. let res = await this.axios({
  2265. method: "post",
  2266. url: "/api/order_area_explode_process",
  2267. data: {
  2268. parts_id: element.part_id, /////
  2269. price: element.process_price,
  2270. properties:
  2271. typeof element.properties == "string"
  2272. ? [element.properties]
  2273. : element.properties,
  2274. // properties: element.properties,
  2275. title: element.processCombination,
  2276. procedure,
  2277. op: "add",
  2278. },
  2279. });
  2280. if (res.code == 200) {
  2281. element.route_id = res.data.id;
  2282. } else {
  2283. save_sucess = false;
  2284. }
  2285. } else {
  2286. element.route_id = element.processCombination;
  2287. }
  2288. }
  2289. }
  2290. this.formData.parts.forEach((element) => {
  2291. element.detail = [
  2292. ...element.partsWoodTableData,
  2293. ...element.partsMetalseData,
  2294. ];
  2295. });
  2296. // 产品编辑保存
  2297. if (save_sucess) {
  2298. await this.axios({
  2299. method: "post",
  2300. url: "/api/order_area_explode_save",
  2301. data: {
  2302. ...this.formData,
  2303. order_no: this.$route.query.order_no,
  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 #dedede;
  2540. .radio-us {
  2541. background: #f4f5f7;
  2542. padding: 5px 20px;
  2543. margin: 5px;
  2544. margin-right: 18px;
  2545. color: #999999;
  2546. border-radius: 15px;
  2547. border: 1px solid #dedede;
  2548. cursor: pointer;
  2549. }
  2550. .radio-us-foc {
  2551. color: #3764ff;
  2552. background: #fff;
  2553. border: 1px solid #3764ff;
  2554. }
  2555. }
  2556. .tit_box {
  2557. .box-us {
  2558. background: #f4f5f7;
  2559. padding: 5px 20px;
  2560. margin: 5px;
  2561. margin-right: 18px;
  2562. color: #999999;
  2563. border-radius: 5px;
  2564. border: 1px solid #dedede;
  2565. cursor: pointer;
  2566. width: 100px;
  2567. display: inline-block;
  2568. text-align: center;
  2569. }
  2570. .box-us-foc {
  2571. color: #3764ff;
  2572. background: #fff;
  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>