create-order.vue 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500
  1. <template>
  2. <div>
  3. <ele-modal
  4. :visible.sync="visible"
  5. :title="title"
  6. width="80vw"
  7. append-to-body
  8. :maxable="true"
  9. >
  10. <el-form
  11. ref="form"
  12. :model="form"
  13. :rules="rules"
  14. label-width="90px"
  15. class="create-form"
  16. >
  17. <el-row :gutter="24">
  18. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  19. <el-form-item label="销售订单号:">
  20. <el-input
  21. clearable
  22. :maxlength="20"
  23. v-model="form.code"
  24. disabled
  25. />
  26. </el-form-item>
  27. </el-col>
  28. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  29. <el-form-item label="订单类型:" prop="orderType">
  30. <el-select v-model="form.orderType" style="width: 100%">
  31. <el-option
  32. v-for="item of orderTypeList"
  33. :key="item.id"
  34. :label="item.label"
  35. :value="item.id"
  36. ></el-option>
  37. </el-select>
  38. </el-form-item>
  39. </el-col>
  40. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  41. <el-form-item label="销售类型:">
  42. <DictSelection
  43. dictName="订单类型"
  44. clearable
  45. v-model="form.saleType"
  46. >
  47. </DictSelection>
  48. </el-form-item>
  49. </el-col>
  50. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  51. <el-form-item label="按单按库:">
  52. <DictSelection
  53. dictName="按单按库"
  54. clearable
  55. v-model="form.orderLibraryType"
  56. >
  57. </DictSelection>
  58. </el-form-item>
  59. </el-col>
  60. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  61. <el-form-item label="客户名称:">
  62. <el-input
  63. clearable
  64. v-model="form.customerName"
  65. :disabled="form.saleType == 3"
  66. style="width: calc(100% - 70px)"
  67. />
  68. <!-- <el-button style="margin-left: 3px;" size="small" type="primary" @click.native="$refs.contactDialogRef.open()"
  69. >选择
  70. </el-button> -->
  71. <contactDialog
  72. style="margin-left: 3px"
  73. @changeParent="contactDialogSuccess"
  74. ></contactDialog>
  75. </el-form-item>
  76. </el-col>
  77. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  78. <el-form-item label="客户简称:">
  79. <el-input
  80. clearable
  81. v-model="form.simpleName"
  82. :disabled="form.saleType == 3"
  83. />
  84. </el-form-item>
  85. </el-col>
  86. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  87. <el-form-item label="客户代号:">
  88. <el-input
  89. clearable
  90. v-model="form.serialNo"
  91. :disabled="form.saleType == 3"
  92. />
  93. </el-form-item>
  94. </el-col>
  95. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  96. <el-form-item label="业务员:">
  97. <el-input
  98. clearable
  99. v-model="form.salesman"
  100. style="width: calc(100% - 70px)"
  101. />
  102. <el-button
  103. style="margin-left: 3px"
  104. type="primary"
  105. size="small"
  106. @click="selectPersonnel"
  107. >选择</el-button
  108. >
  109. </el-form-item>
  110. </el-col>
  111. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  112. <el-form-item label="交付日期:" prop="deliveryTime">
  113. <el-date-picker
  114. :picker-options="pickerOptions"
  115. style="width: 100%"
  116. v-model="form.deliveryTime"
  117. type="date"
  118. placeholder="选择日期"
  119. value-format="yyyy-MM-dd"
  120. >
  121. </el-date-picker>
  122. </el-form-item>
  123. </el-col>
  124. <!-- <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  125. <el-form-item label="齐套状态:" prop="completeState">
  126. <el-select v-model="form.completeState" style="width: 100%">
  127. <el-option v-for="item of completeList" :key="item.code" :label="item.name"
  128. :value="item.code"></el-option>
  129. </el-select>
  130. </el-form-item>
  131. </el-col> -->
  132. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  133. <el-form-item label="备注:">
  134. <el-input clearable v-model="form.notes" />
  135. </el-form-item>
  136. </el-col>
  137. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  138. <el-form-item label="交付要求:">
  139. <DictSelection
  140. dictName="紧急程度"
  141. clearable
  142. v-model="form.deliveryRequirements"
  143. >
  144. </DictSelection>
  145. </el-form-item>
  146. </el-col>
  147. </el-row>
  148. <el-table :data="form.productInfoList" border height="40vh" key="id">
  149. <el-table-column label="序号" align="center" width="60">
  150. <template slot-scope="scope">
  151. <span>{{ scope.$index + 1 }}</span>
  152. </template>
  153. </el-table-column>
  154. <el-table-column label="行号" align="center" prop="lineNumber">
  155. </el-table-column>
  156. <el-table-column
  157. label="名称"
  158. align="center"
  159. prop="productName"
  160. width="150"
  161. show-overflow-tooltip
  162. >
  163. </el-table-column>
  164. <el-table-column
  165. label="编码"
  166. align="center"
  167. prop="productCode"
  168. width="150"
  169. show-overflow-tooltip
  170. >
  171. </el-table-column>
  172. <el-table-column label="牌号" align="center" prop="brandNo">
  173. </el-table-column>
  174. <el-table-column label="型号" align="center" prop="model">
  175. </el-table-column>
  176. <el-table-column
  177. label="规格"
  178. align="center"
  179. prop="specification"
  180. width="150"
  181. show-overflow-tooltip
  182. >
  183. </el-table-column>
  184. <el-table-column label="单重" align="center" prop="productUnitWeight">
  185. </el-table-column>
  186. <el-table-column label="重量单位" align="center" prop="weightUnit">
  187. </el-table-column>
  188. <el-table-column
  189. label="机型"
  190. align="center"
  191. prop="modelKey"
  192. width="240"
  193. >
  194. <template slot-scope="scope">
  195. <el-form-item
  196. label-width="0px"
  197. :prop="'productInfoList.' + scope.$index + '.modelKey'"
  198. >
  199. <el-select
  200. clearable
  201. v-model="scope.row.modelKey"
  202. multiple
  203. filterable
  204. allow-create
  205. default-first-option
  206. >
  207. <el-option
  208. v-for="item in modelList"
  209. :key="item.label"
  210. :value="item.label"
  211. :label="item.label"
  212. >
  213. </el-option>
  214. </el-select>
  215. </el-form-item>
  216. </template>
  217. </el-table-column>
  218. <el-table-column
  219. label="颜色"
  220. align="center"
  221. prop="colorKey"
  222. width="240"
  223. >
  224. <template slot-scope="scope">
  225. <el-form-item
  226. label-width="0px"
  227. :prop="'productInfoList.' + scope.$index + '.colorKey'"
  228. >
  229. <el-select
  230. clearable
  231. v-model="scope.row.colorKey"
  232. multiple
  233. filterable
  234. allow-create
  235. default-first-option
  236. >
  237. <el-option
  238. v-for="item in colorList"
  239. :key="item.label"
  240. :value="item.label"
  241. :label="item.label"
  242. >
  243. </el-option>
  244. </el-select>
  245. </el-form-item>
  246. </template>
  247. </el-table-column>
  248. <el-table-column
  249. label="生产编号"
  250. align="center"
  251. prop="productionCodes"
  252. width="140"
  253. >
  254. <template slot-scope="scope">
  255. <el-form-item
  256. label-width="0px"
  257. :prop="'productInfoList.' + scope.$index + '.productionCodes'"
  258. >
  259. <el-input
  260. style="width: 100%"
  261. size="small"
  262. v-model="scope.row.productionCodes"
  263. placeholder="请输入"
  264. >
  265. </el-input>
  266. </el-form-item>
  267. </template>
  268. </el-table-column>
  269. <el-table-column
  270. label="批次号"
  271. align="center"
  272. prop="batchNo"
  273. width="140"
  274. >
  275. <template slot-scope="scope">
  276. <el-form-item
  277. label-width="0px"
  278. :prop="'productInfoList.' + scope.$index + '.batchNo'"
  279. >
  280. <el-input
  281. style="width: 100%"
  282. size="small"
  283. v-model="scope.row.batchNo"
  284. placeholder="请输入"
  285. @input="
  286. (value) =>
  287. (scope.row.batchNo = value.replace(/[^a-zA-Z0-9_-]/g, ''))
  288. "
  289. >
  290. </el-input>
  291. </el-form-item>
  292. </template>
  293. </el-table-column>
  294. <el-table-column
  295. label="订单数量"
  296. width="140"
  297. align="center"
  298. prop="contractNum"
  299. >
  300. <template slot="header" slot-scope="scope">
  301. <div class="header_required"
  302. ><span class="is-required">订单数量</span></div
  303. >
  304. </template>
  305. <template slot-scope="scope">
  306. <el-form-item
  307. label-width="0px"
  308. :prop="'productInfoList.' + scope.$index + '.contractNum'"
  309. :rules="{
  310. required: true,
  311. message: '请输入订单数量',
  312. trigger: 'blur'
  313. }"
  314. >
  315. <el-input
  316. v-model.number="scope.row.contractNum"
  317. size="small"
  318. type="number"
  319. style="width: 100%"
  320. placeholder="输入数量"
  321. @input="inputNumber(scope.row, scope.$index)"
  322. ></el-input>
  323. </el-form-item>
  324. </template>
  325. </el-table-column>
  326. <el-table-column
  327. label="BOM类型"
  328. width="140"
  329. align="center"
  330. prop="productType"
  331. >
  332. <template slot="header" slot-scope="scope">
  333. <div :class="isRequired ? 'header_required' : ''"
  334. ><span class="is-required">BOM类型</span></div
  335. >
  336. </template>
  337. <template slot-scope="scope">
  338. <el-form-item
  339. label-width="0px"
  340. :prop="'productInfoList.' + scope.$index + '.productType'"
  341. >
  342. <el-select
  343. v-model="scope.row.productType"
  344. @change="changeProductType(scope.row, scope.$index)"
  345. :key="scope.$index"
  346. :disabled="!isAdd"
  347. >
  348. <el-option
  349. v-for="item of scope.row.producedList"
  350. :key="scope.$index + item.code"
  351. :label="item.name"
  352. :value="item.code"
  353. ></el-option>
  354. </el-select>
  355. </el-form-item>
  356. </template>
  357. </el-table-column>
  358. <el-table-column
  359. :label-class-name="isRequired ? 'header_required' : ''"
  360. label="BOM版本"
  361. width="140"
  362. align="center"
  363. prop="bomCategoryId"
  364. v-if="clientEnvironmentId != 4"
  365. >
  366. <template slot="header" slot-scope="scope">
  367. <div :class="isRequired ? 'header_required' : ''"
  368. ><span class="is-required">BOM版本</span></div
  369. >
  370. </template>
  371. <template slot-scope="scope">
  372. <el-form-item
  373. label-width="0px"
  374. :prop="'productInfoList.' + scope.$index + '.bomCategoryId'"
  375. :key="scope.$index"
  376. >
  377. <el-select
  378. v-model="scope.row.bomCategoryId"
  379. @change="changeBomId(scope.row, scope.$index)"
  380. :disabled="!isAdd"
  381. >
  382. <el-option
  383. v-for="item of scope.row.bomVersionList"
  384. :key="item.id"
  385. :label="item.name + '(V' + item.versions + '.0)'"
  386. :value="item.id"
  387. ></el-option>
  388. </el-select>
  389. </el-form-item>
  390. </template>
  391. </el-table-column>
  392. <el-table-column
  393. label="工艺路线"
  394. width="240"
  395. align="center"
  396. prop="produceRoutingId"
  397. v-if="clientEnvironmentId != 4"
  398. >
  399. <template slot="header" slot-scope="scope">
  400. <div class="header_required"
  401. ><span class="is-required">工艺路线</span></div
  402. >
  403. </template>
  404. <template slot-scope="scope">
  405. <el-form-item
  406. label-width="0px"
  407. :prop="'productInfoList.' + scope.$index + '.produceRoutingId'"
  408. >
  409. <div style="display: flex">
  410. <el-select
  411. v-model="scope.row.produceRoutingId"
  412. @change="changeRoutingList(scope.row, scope.$index)"
  413. v-show="isRouteSelect(scope.row)"
  414. >
  415. <el-option
  416. v-for="item of scope.row.routingList"
  417. :key="item.id"
  418. :label="item.name"
  419. :value="item.id"
  420. ></el-option>
  421. </el-select>
  422. <div style="display: flex">
  423. <el-input
  424. v-show="!isRouteSelect(scope.row)"
  425. disabled
  426. v-model="scope.row.produceRoutingName"
  427. ></el-input>
  428. <el-button
  429. v-show="isSelectShow"
  430. type="primary"
  431. size="mini"
  432. @click="openDialog(scope.$index)"
  433. >选择</el-button
  434. >
  435. </div>
  436. </div>
  437. </el-form-item>
  438. </template>
  439. </el-table-column>
  440. <el-table-column
  441. label="工艺路线"
  442. align="center"
  443. prop="produceRoutingName"
  444. v-if="clientEnvironmentId == 4"
  445. >
  446. <template slot-scope="scope">
  447. <el-form-item
  448. label-width="0px"
  449. :prop="
  450. 'productInfoList.' + scope.$index + '.produceRoutingName'
  451. "
  452. >
  453. <el-input
  454. v-model="form.produceRoutingName"
  455. style="width: 100%"
  456. readonly
  457. ></el-input>
  458. </el-form-item>
  459. </template>
  460. </el-table-column>
  461. <el-table-column
  462. label="所属工厂"
  463. width="140"
  464. align="center"
  465. prop="factoriesId"
  466. >
  467. <template slot="header" slot-scope="scope">
  468. <div class="header_required"
  469. ><span class="is-required">所属工厂</span></div
  470. >
  471. </template>
  472. <template slot-scope="scope">
  473. <el-form-item label-width="0px">
  474. <el-select
  475. v-model="scope.row.factoriesId"
  476. :key="scope.row.factoriesId"
  477. @change="(e) => factorChange(e, scope.row)"
  478. >
  479. <el-option
  480. v-for="item of factoryList"
  481. :key="item.id"
  482. :label="item.name"
  483. :value="item.id"
  484. ></el-option>
  485. </el-select>
  486. </el-form-item>
  487. </template>
  488. </el-table-column>
  489. <el-table-column label="计量单位" align="center" prop="measuringUnit">
  490. </el-table-column>
  491. <el-table-column
  492. label="模数"
  493. align="center"
  494. width="100"
  495. v-if="clientEnvironmentId == '4'"
  496. >
  497. <template slot-scope="scope">
  498. <div>
  499. <el-input
  500. style="width: 100%"
  501. size="small"
  502. v-model="scope.row.moCount"
  503. oninput="value=value.replace(/[^0-9.]/g,'')"
  504. @input="
  505. tableHandleKeyUp(scope.row, scope.$index, $event, 'moCount')
  506. "
  507. placeholder="请输入"
  508. >
  509. </el-input>
  510. </div>
  511. </template>
  512. </el-table-column>
  513. <el-table-column
  514. align="center"
  515. width="100"
  516. label="块数"
  517. v-if="clientEnvironmentId == '4'"
  518. >
  519. <template slot-scope="scope">
  520. <div>
  521. <el-input
  522. size="small"
  523. style="width: 100%"
  524. @input="
  525. tableHandleKeyUp(
  526. scope.row,
  527. scope.$index,
  528. $event,
  529. 'blockCount'
  530. )
  531. "
  532. v-model="scope.row.blockCount"
  533. placeholder="请输入"
  534. ></el-input>
  535. </div>
  536. </template>
  537. </el-table-column>
  538. <el-table-column label="订单重量" align="center" prop="productWeight">
  539. <template slot-scope="{ row }">
  540. <span>{{ row.productWeight ? row.productWeight : '-' }}</span>
  541. </template>
  542. </el-table-column>
  543. <el-table-column label="操作" align="center" width="160">
  544. <template slot-scope="scope">
  545. <!-- <el-link
  546. type="primary"
  547. :underline="false"
  548. @click="homogeneityInspect(scope.row)"
  549. >
  550. 齐套性检查
  551. </el-link> -->
  552. <el-button
  553. type="text"
  554. @click="handleDeleteItem(scope.$index)"
  555. v-if="!scope.row.id"
  556. >删除</el-button
  557. >
  558. </template>
  559. </el-table-column>
  560. </el-table>
  561. <div class="add-product" @click="addEquipment" v-if="isAdd">
  562. <i class="el-icon-circle-plus-outline"></i>
  563. </div>
  564. </el-form>
  565. <template v-slot:footer>
  566. <el-button @click="cancel">取消</el-button>
  567. <el-button type="primary" @click="save" :loading="loading">
  568. 确定
  569. </el-button>
  570. </template>
  571. <!-- 选择工艺路线 -->
  572. <ProcessRoute ref="processRouteRef" @changeParent="changeParent" />
  573. <!-- 选择产品 -->
  574. <EquipmentDialog
  575. ref="equipmentRefs"
  576. @choose="confirmChoose"
  577. :selectList="
  578. form.productInfoList.filter(
  579. (i) => !disabledList.find((p) => p.productCode === i.productCode)
  580. )
  581. "
  582. >
  583. </EquipmentDialog>
  584. </ele-modal>
  585. <orderHomogeneityInspectDialog
  586. ref="orderHomogeneityInspectDialog"
  587. ></orderHomogeneityInspectDialog>
  588. <orderHomogeneityInspectInstallDialog
  589. ref="orderHomogeneityInspectInstallDialog"
  590. >
  591. </orderHomogeneityInspectInstallDialog>
  592. <personnelDialog ref="personnelRef" @changePersonnel="changePersonnel" />
  593. </div>
  594. </template>
  595. <script>
  596. import { getCode } from '@/api/codeManagement';
  597. import EquipmentDialog from '../components/EquipmentDialog.vue';
  598. import orderHomogeneityInspectDialog from './orderHomogeneityInspectDialog';
  599. import orderHomogeneityInspectInstallDialog from './orderHomogeneityInspectInstallDialog';
  600. import ProcessRoute from '@/components/selectionDialog/processRoute.vue';
  601. import personnelDialog from './personnelDialog.vue';
  602. import {
  603. createOrUpdate,
  604. getOrderDetail,
  605. bomListByPlan,
  606. bomRoutingList,
  607. getFactoryList,
  608. findBomCategoryByCategoryIds
  609. } from '@/api/saleOrder';
  610. import { listBomType } from '@/api/productionPlan/index';
  611. import { parameterGetByCode } from '@/api/mainData/index';
  612. import dayjs from 'dayjs';
  613. import { multiply } from '@/utils/math';
  614. import contactDialog from '@/components/contactDialog/openContactDialog.vue';
  615. import { getByCode } from '@/api/system/dictionary-data';
  616. export default {
  617. name: 'CreateOrder',
  618. components: {
  619. EquipmentDialog,
  620. orderHomogeneityInspectDialog,
  621. orderHomogeneityInspectInstallDialog,
  622. ProcessRoute,
  623. contactDialog,
  624. personnelDialog
  625. },
  626. props: {
  627. isAdd: {
  628. type: Boolean,
  629. default: true
  630. }
  631. },
  632. data() {
  633. return {
  634. visible: false,
  635. loading: false,
  636. disabledList: [], //已保存数据不做删除
  637. form: {
  638. salesman: '',
  639. salesmanId: '',
  640. productInfoList: [],
  641. deliveryRequirements: 1,
  642. saleType: 1,
  643. orderLibraryType: 2,
  644. productType: 2,
  645. bomCategoryId: '',
  646. produceRoutingId: '',
  647. factoriesId: '',
  648. deliveryTime: dayjs(
  649. new Date().getTime() + 3600 * 1000 * 24 * 10
  650. ).format('YYYY-MM-DD'),
  651. orderType: 0
  652. },
  653. // 表单验证规则
  654. rules: {
  655. deliveryTime: [
  656. { required: true, message: '请选择交付日期', trigger: 'change' }
  657. ],
  658. orderType: [
  659. { required: true, message: '请选择订单类型', trigger: 'blur' }
  660. ]
  661. },
  662. typeList: [
  663. { id: 1, label: '内销订单' },
  664. { id: 2, label: '外销订单' },
  665. { id: 3, label: '预制订单' }
  666. ],
  667. producedList: [
  668. { code: 2, name: '加工(MBOM)' },
  669. { code: 3, name: '装配(ABOM)' }
  670. ],
  671. completeList: [
  672. { code: 1, name: '齐套' },
  673. { code: 2, name: '缺料' }
  674. ],
  675. routingList: [],
  676. factoryList: [],
  677. title: '创建订单',
  678. pickerOptions: {
  679. disabledDate: (time) => {
  680. // 禁用日期
  681. let nowData = new Date();
  682. nowData = new Date(nowData.setDate(nowData.getDate() - 1));
  683. return time < nowData;
  684. }
  685. },
  686. // 订单类型
  687. orderTypeList: [
  688. {
  689. id: 0,
  690. label: '库存性订单'
  691. },
  692. {
  693. id: 1,
  694. label: '生产性订单'
  695. },
  696. {
  697. id: 2,
  698. label: '无客户生产性订单'
  699. },
  700. {
  701. id: 4,
  702. label: '不定向订单'
  703. }
  704. ],
  705. selectIndex: 0, // 选择工艺路线的当前数据下标
  706. processingRequired: 0, // 生产类型跟BOM 版本是否必填 1:是 0:否
  707. sourceSalesOrderId: '', // 源销售订单ID
  708. modelList: [], // 机型数据
  709. colorList: [] // 颜色数据
  710. };
  711. },
  712. watch: {
  713. // disabledList() {
  714. // console.log(this.disabledList, 'disabledList');
  715. // }
  716. },
  717. computed: {
  718. // 是否开启响应式布局
  719. styleResponsive() {
  720. return this.$store.state.theme.styleResponsive;
  721. },
  722. clientEnvironmentId() {
  723. return this.$store.state.user.info.clientEnvironmentId;
  724. },
  725. // 是否必填字段
  726. isRequired() {
  727. // if (this.form.planType == 5) {
  728. // return false;
  729. // }
  730. return this.processingRequired == 1;
  731. },
  732. // 工艺路线 输入框展示跟选择框判断
  733. isRouteSelect() {
  734. return (row) => {
  735. if (this.isRequired) {
  736. return true;
  737. }
  738. if (!row.selectionRowShow) {
  739. return true;
  740. }
  741. return false;
  742. };
  743. },
  744. // 选择按钮的显示
  745. isSelectShow() {
  746. // if (this.form.planType == 5) {
  747. // return true;
  748. // }
  749. return this.processingRequired == 0;
  750. }
  751. },
  752. created() {},
  753. mounted() {
  754. this.mandatoryField();
  755. this.getFactoryList();
  756. this.getCodeData();
  757. },
  758. methods: {
  759. selectPersonnel() {
  760. this.$refs.personnelRef.open(this.form.salesmanId);
  761. },
  762. changePersonnel(row) {
  763. this.form.salesman = row.name;
  764. this.form.salesmanId = row.id;
  765. },
  766. // 获取
  767. async getCodeData() {
  768. let arr1 = await this.getLevelCode('product_model_key');
  769. let arr2 = await this.getLevelCode('product_color_key');
  770. this.modelList = arr1;
  771. this.colorList = arr2;
  772. },
  773. async getLevelCode(code) {
  774. try {
  775. const res = await getByCode(code);
  776. if (res.code == 0) {
  777. let list = Object.values(res.data).map((el) => {
  778. let k = Object.keys(el)[0];
  779. let v = Object.values(el)[0];
  780. return {
  781. label: v,
  782. value: k
  783. };
  784. });
  785. return list;
  786. }
  787. } catch (err) {
  788. this.$message.error(err.message);
  789. }
  790. },
  791. // 是否必填
  792. mandatoryField() {
  793. parameterGetByCode({
  794. code: 'production_plan_code'
  795. }).then((res) => {
  796. if (res) {
  797. this.processingRequired = res.value;
  798. }
  799. });
  800. },
  801. factorChange(e, row) {
  802. let obj = this.factoryList.find((el) => el.id === e);
  803. if (obj) {
  804. row.factoriesIdName = obj.name;
  805. }
  806. // factoriesIdName
  807. },
  808. // filterInput(value) {
  809. // let aaa = value.replace(/[^a-zA-Z0-9]/g, '');
  810. // console.log('cccaaaaaaaccc', aaa);
  811. // },
  812. changeRoutingList(row, index) {
  813. const obj = row.routingList?.find(
  814. (item) => item.id === row.produceRoutingId
  815. );
  816. if (obj) {
  817. row.produceRoutingName = obj.name;
  818. }
  819. },
  820. async getFactoryList() {
  821. this.factoryList = await getFactoryList();
  822. },
  823. open(row) {
  824. this.visible = true;
  825. if (row) {
  826. this.title = '修改订单';
  827. this.getDetail(row.code);
  828. } else {
  829. this.title = '创建订单';
  830. this.getSaleCode();
  831. }
  832. },
  833. getDetail(code) {
  834. getOrderDetail(code).then(async (res) => {
  835. console.log(res, 'res');
  836. if (res.productInfoList) {
  837. for (let item of res.productInfoList) {
  838. if (!item.bomCategoryId) {
  839. item.productType = '';
  840. item.selectionRowShow = true;
  841. } else {
  842. item.selectionRowShow = false;
  843. }
  844. if (item.productType) {
  845. item.productType = parseInt(item.productType);
  846. }
  847. }
  848. }
  849. if (res.productInfoList && res.productInfoList.length != 0) {
  850. res.productInfoList.forEach((item, index) => {
  851. if (item.colorKey && typeof item.colorKey == 'string') {
  852. this.$set(
  853. res.productInfoList[index],
  854. 'colorKey',
  855. item.colorKey.split(',')
  856. );
  857. }
  858. if (item.modelKey && typeof item.modelKey == 'string') {
  859. this.$set(
  860. res.productInfoList[index],
  861. 'modelKey',
  862. item.modelKey.split(',')
  863. );
  864. }
  865. item.lackNum = null;
  866. });
  867. }
  868. // this.disabledList = res.productInfoList;
  869. if (res.productInfoList.length > 0) {
  870. const promiselist = [];
  871. res.productInfoList.forEach(async (el, index) => {
  872. promiselist.push(this.getBomInfo(el));
  873. });
  874. await Promise.all(promiselist);
  875. console.log(this.disabledList, '3333');
  876. // let ids = res.productInfoList.map((item) => item.categoryId);
  877. // const data = await findBomCategoryByCategoryIds(ids);
  878. // this.handleResult(res.productInfoList, data, 'init');
  879. }
  880. this.disabledList = res.productInfoList;
  881. this.form = res;
  882. const promiseProduct = [];
  883. this.form.productInfoList.forEach(async (el, index) => {
  884. let lis = el.producedList;
  885. if (!el.bomCategoryId && lis && lis.length > 0) {
  886. el.productType = el.producedList[0].code;
  887. promiseProduct.push(this.changeProductType(el, index));
  888. }
  889. });
  890. await Promise.all(promiseProduct);
  891. // // 如果没有bom版本的选择的话
  892. });
  893. },
  894. // 获取bom信息
  895. async getBomInfo(data) {
  896. let params = { categoryId: data.categoryId };
  897. const res = await listBomType(params);
  898. if (!res || res.length == 0) return;
  899. let bomMap = {
  900. 1: { code: 1, name: 'PBOM' },
  901. 2: { code: 2, name: 'MBOM' },
  902. 3: { code: 3, name: 'ABOM' }
  903. };
  904. let arr = [];
  905. res.map((item) => {
  906. if (bomMap[item.bomType]) {
  907. arr.push(bomMap[item.bomType]);
  908. delete bomMap[item.bomType];
  909. }
  910. });
  911. console.log('什么时候进来');
  912. // this.$set(data, 'producedList', arr);
  913. data.producedList = arr;
  914. console.log(arr, 'arr');
  915. },
  916. cancel() {
  917. this.form = {
  918. salesmanId: '',
  919. salesman: '',
  920. productInfoList: [],
  921. deliveryRequirements: 1,
  922. saleType: 1,
  923. orderLibraryType: 2,
  924. deliveryTime: dayjs(
  925. new Date().getTime() + 3600 * 1000 * 24 * 10
  926. ).format('YYYY-MM-DD')
  927. };
  928. this.$refs.form.clearValidate();
  929. this.visible = false;
  930. },
  931. contactDialogSuccess(data) {
  932. this.$set(this.form, 'customerName', data.name);
  933. this.$set(this.form, 'simpleName', data.simpleName);
  934. this.$set(this.form, 'serialNo', data.serialNo);
  935. this.$set(this.form, 'simpleName', data.simpleName);
  936. },
  937. // 表格:模数、数量(方)、块数输入框 输入事件
  938. tableHandleKeyUp(row, index, e, name) {
  939. let modelArr = row.specification.split('*');
  940. let modelLong = modelArr[0]; // model规格长度
  941. let modeWide = modelArr[1]; // model规格宽度
  942. let modeHight = modelArr[2].substr(0, modelArr[2].indexOf('cm')); // model规格高度
  943. modeHight = Number(modeHight);
  944. if (name === 'moCount') {
  945. // 模数
  946. row.moCount = e;
  947. // 计算块数的公式:
  948. // (一模6米长度 / model规格长度) * (一模1.2米宽度 / model规格宽度) = 每一模的块数
  949. // 每一模的块数*模数moCount = 总块数
  950. if (row.productName.includes('板材')) {
  951. row.blockCount =
  952. Math.floor(600 / modelLong) *
  953. Math.floor(120 / modeHight) *
  954. Math.floor(60 / modeWide) *
  955. row.moCount;
  956. } else if (row.productName.includes('砌块')) {
  957. let modelLongFixed = (600 / modelLong).toFixed(2);
  958. modelLongFixed = modelLongFixed.substring(
  959. 0,
  960. modelLongFixed.length - 1
  961. );
  962. let modeWideFixed = (120 / modeWide).toFixed(2);
  963. modeWideFixed = modeWideFixed.substring(
  964. 0,
  965. modeWideFixed.length - 1
  966. );
  967. let modeHightFixed = (60 / modeHight).toFixed(2);
  968. modeHightFixed = modeHightFixed.substring(
  969. 0,
  970. modeHightFixed.length - 1
  971. );
  972. row.blockCount =
  973. Math.floor(modelLongFixed * modeWideFixed * modeHightFixed) *
  974. row.moCount;
  975. }
  976. row.contractNum =
  977. ((modelLong * modeWide * modeHight) / 1000000).toFixed(5) *
  978. row.blockCount;
  979. } else if (name === 'sum') {
  980. //方数
  981. row.contractNum = e;
  982. row.blockCount = Math.floor(
  983. e / ((modelLong * modeWide * modeHight) / 1000000)
  984. );
  985. if (row.productName.includes('板材')) {
  986. row.moCount = Math.ceil(
  987. row.blockCount /
  988. (Math.floor(600 / modelLong) *
  989. Math.floor(120 / modeHight) *
  990. Math.floor(60 / modeWide))
  991. );
  992. } else if (row.productName.includes('砌块')) {
  993. row.moCount = Math.ceil(
  994. row.blockCount /
  995. Math.floor(
  996. (600 / modelLong) * (120 / modeHight) * (60 / modeWide)
  997. )
  998. );
  999. }
  1000. } else if (name === 'blockCount') {
  1001. //块数
  1002. row.blockCount = e;
  1003. if (row.productName.includes('板材')) {
  1004. row.moCount = Math.ceil(
  1005. row.blockCount /
  1006. (Math.floor(600 / modelLong) *
  1007. Math.floor(120 / modeHight) *
  1008. Math.floor(60 / modeWide))
  1009. );
  1010. } else if (row.productName.includes('砌块')) {
  1011. row.moCount = Math.ceil(
  1012. row.blockCount /
  1013. Math.floor(
  1014. (600 / modelLong) * (120 / modeHight) * (60 / modeWide)
  1015. )
  1016. );
  1017. }
  1018. row.contractNum =
  1019. (Number(e) * modelLong * modeWide * modeHight) / 1000000;
  1020. }
  1021. row.contractNum = Number(row.contractNum.toFixed(5));
  1022. },
  1023. // 删除产品
  1024. handleDeleteItem(index) {
  1025. this.form.productInfoList.splice(index, 1);
  1026. this.changeLineNumber();
  1027. },
  1028. addEquipment() {
  1029. this.$refs.equipmentRefs.open();
  1030. },
  1031. /* 保存编辑 */
  1032. save() {
  1033. this.$refs.form.validate((valid) => {
  1034. if (!valid) {
  1035. return false;
  1036. }
  1037. if (!this.form.productInfoList.length) {
  1038. return this.$message.warning('产品列表不能为空!');
  1039. }
  1040. let flag = this.parameterVerification();
  1041. // 必填参数校验
  1042. if (!flag) return;
  1043. console.log(this.form, '33333333333');
  1044. this.loading = true;
  1045. let params = {
  1046. ...this.form,
  1047. sourceType: this.isAdd ? 1 : 2
  1048. };
  1049. if (!this.isAdd) {
  1050. params.sourceSalesOrderId = this.sourceSalesOrderId;
  1051. params.productInfoList.forEach((el) => delete el.id);
  1052. }
  1053. params.productInfoList.forEach((item) => {
  1054. item.colorKey = item.colorKey.toString();
  1055. item.modelKey = item.modelKey.toString();
  1056. });
  1057. createOrUpdate(params)
  1058. .then((res) => {
  1059. this.loading = false;
  1060. this.$message.success('成功');
  1061. this.cancel();
  1062. this.$emit('refresh');
  1063. })
  1064. .catch((e) => {
  1065. this.loading = false;
  1066. });
  1067. });
  1068. },
  1069. // 参数校验
  1070. parameterVerification() {
  1071. let flag = true;
  1072. for (let i = 0; i < this.form.productInfoList.length; i++) {
  1073. let v = this.form.productInfoList[i];
  1074. if (this.isRequired) {
  1075. if (!v.productType) {
  1076. flag = false;
  1077. this.$message.warning('请选择生产类型');
  1078. break;
  1079. }
  1080. if (!v.productType) {
  1081. flag = false;
  1082. this.$message.warning('请选择BOM版本');
  1083. break;
  1084. }
  1085. }
  1086. if (!v.contractNum) {
  1087. flag = false;
  1088. this.$message.warning('请输入订单数量且订单数量不能为0');
  1089. break;
  1090. }
  1091. //contractNum
  1092. if (!v.produceRoutingId) {
  1093. flag = false;
  1094. this.$message.warning('请选择工艺路线');
  1095. break;
  1096. }
  1097. if (!v.factoriesId) {
  1098. flag = false;
  1099. this.$message.warning('请选择所属工厂');
  1100. break;
  1101. }
  1102. }
  1103. // this.form.productInfoList.forEach((v) => {
  1104. // if (this.isRequired) {
  1105. // if (!v.productType) {
  1106. // flag = false;
  1107. // this.$message.warning('请选择生产类型');
  1108. // return;
  1109. // }
  1110. // if (!v.productType) {
  1111. // flag = false;
  1112. // this.$message.warning('请选择BOM版本');
  1113. // return;
  1114. // }
  1115. // }
  1116. // if (!v.produceRoutingId) {
  1117. // flag = false;
  1118. // this.$message.warning('请选择工艺路线');
  1119. // return;
  1120. // }
  1121. // });
  1122. return flag;
  1123. },
  1124. // 选择订单类型
  1125. chooseType(val) {
  1126. if (val == 2) {
  1127. this.$set(this.form, 'orderLibraryType', 1);
  1128. } else {
  1129. this.$set(this.form, 'orderLibraryType', 2);
  1130. }
  1131. this.$set(this.form, 'customerName', '');
  1132. },
  1133. async getSaleCode() {
  1134. const res = await getCode('order_sale_code');
  1135. if (res) {
  1136. this.$set(this.form, 'code', res);
  1137. }
  1138. },
  1139. // 确定选择
  1140. async confirmChoose(list) {
  1141. list.map((el) => (el.selectionRowShow = false));
  1142. list = list
  1143. .filter(
  1144. (i) =>
  1145. !this.disabledList.find(
  1146. (p) => p.productCode == i.code || p.productCode == i.productCode
  1147. )
  1148. )
  1149. .map((item, index) => {
  1150. if (item.productCode) {
  1151. return item;
  1152. } else {
  1153. return {
  1154. categoryId: item.id,
  1155. productCode: item.code,
  1156. productName: item.name,
  1157. productUnitWeight: item.netWeight,
  1158. weightUnit: item.weightUnit,
  1159. model: item.modelType,
  1160. specification: item.specification,
  1161. brandNo: item.brandNum,
  1162. measuringUnit: item.measuringUnit
  1163. };
  1164. }
  1165. })
  1166. .concat(this.disabledList);
  1167. // 取出在弹窗中选中并且不在表格中的数据
  1168. const result = list.filter(
  1169. (i) =>
  1170. this.form.productInfoList.findIndex(
  1171. (p) => p.productCode === i.productCode
  1172. ) === -1
  1173. );
  1174. // 取出在表格中并且不在弹窗中选中的数据 即取消选中的数据
  1175. const del = this.form.productInfoList.filter(
  1176. (i) => list.findIndex((p) => p.productCode === i.productCode) === -1
  1177. );
  1178. for (let i = this.form.productInfoList.length - 1; i >= 0; i--) {
  1179. for (let j in del) {
  1180. if (
  1181. this.form.productInfoList[i].productCode === del[j].productCode
  1182. ) {
  1183. this.form.productInfoList.splice(i, 1);
  1184. break;
  1185. }
  1186. }
  1187. }
  1188. if (result.length > 0) {
  1189. // let ids = result.map((item) => item.categoryId);
  1190. // const res = await findBomCategoryByCategoryIds(ids);
  1191. // let datas = JSON.parse(JSON.stringify(result));
  1192. // console.log(datas, 'datas 00000');
  1193. // datas = await this.handleResult(datas, res);
  1194. let datas = JSON.parse(JSON.stringify(result));
  1195. const promiselist = [];
  1196. datas.forEach(async (el) => {
  1197. promiselist.push(this.getBomInfo(el));
  1198. this.getBomInfo(el);
  1199. });
  1200. await Promise.all(promiselist);
  1201. this.form.productInfoList = this.form.productInfoList.concat(datas);
  1202. const promiseProduct = [];
  1203. this.form.productInfoList.forEach(async (el, index) => {
  1204. let lis = el.producedList;
  1205. if (!el.bomCategoryId && lis && lis.length > 0) {
  1206. el.productType = el.producedList[0].code;
  1207. promiseProduct.push(this.changeProductType(el, index));
  1208. }
  1209. });
  1210. await Promise.all(promiseProduct);
  1211. } else {
  1212. this.form.productInfoList = this.form.productInfoList.concat(result);
  1213. }
  1214. this.changeLineNumber();
  1215. },
  1216. // 计算生产类型数据
  1217. calculationType(data) {
  1218. console.log(data, 'data 99955');
  1219. let list = [];
  1220. let listMap = {
  1221. 1: { code: 1, name: 'PBOM' },
  1222. 2: { code: 2, name: 'MBOM' },
  1223. 3: { code: 3, name: 'ABOM' }
  1224. };
  1225. data.forEach((el) => {
  1226. if (listMap[el.bomType]) {
  1227. list.push(listMap[el.bomType]);
  1228. delete listMap[el.bomType];
  1229. }
  1230. });
  1231. return list;
  1232. },
  1233. //
  1234. async handleResult(result, res, type) {
  1235. result.forEach((item) => {
  1236. if (!res[item.categoryId]) {
  1237. return;
  1238. }
  1239. let val = res[item.categoryId];
  1240. if (!val || val.length == 0) {
  1241. return;
  1242. }
  1243. let arr = [];
  1244. let first = val[0];
  1245. arr = val.filter((item) => item.bomType == first.bomType);
  1246. if (!item.productType) {
  1247. item.productType = first.bomType - 0;
  1248. }
  1249. console.log(arr, 'arr');
  1250. let list = this.calculationType(val);
  1251. item.producedList = list;
  1252. if (!type) {
  1253. item.bomVersionList = arr;
  1254. // arr.map((el) => (el.bomCategoryId = el.id));
  1255. item.bomCategoryId = arr[0].id;
  1256. }
  1257. // if (type) {
  1258. // let obj = item.bomVersionList.find(
  1259. // (el) => el.id == item.bomCategoryId
  1260. // );
  1261. // if (obj) return;
  1262. // this.changeBomId(item.bomVersionList[0],0)
  1263. // console.log(obj,'obj 11')
  1264. // }
  1265. });
  1266. result.forEach(async (ele) => {
  1267. ele = await this.getFindRoutingListByBomId(ele);
  1268. console.log(ele, 'ele');
  1269. });
  1270. return result;
  1271. },
  1272. // 获取工艺路线
  1273. async getFindRoutingListByBomId(ele) {
  1274. let proArr = ele.bomVersionList;
  1275. if (!proArr || proArr.length == 0) {
  1276. return ele;
  1277. }
  1278. console.log(proArr, 'proArr');
  1279. const res = await bomRoutingList(proArr[0].id);
  1280. let arr = res || [];
  1281. if (arr.length > 0) {
  1282. this.$set(ele, 'routingList', arr);
  1283. ele.produceRoutingName = arr[0].name;
  1284. this.$set(ele, 'produceRoutingId', arr[0].id);
  1285. }
  1286. return ele;
  1287. },
  1288. // // await this.changeBomId(arr[0], 0);
  1289. changeLineNumber() {
  1290. this.form.productInfoList.map((item, index) => {
  1291. item.lineNumber = 10 * (index + 1);
  1292. });
  1293. },
  1294. inputNumber(row, index) {
  1295. const pos = this.form.productInfoList;
  1296. if (pos[index].productUnitWeight) {
  1297. const number = multiply(row.contractNum, row.productUnitWeight);
  1298. this.$set(pos[index], 'productWeight', number);
  1299. }
  1300. if (this.clientEnvironmentId == 4) {
  1301. this.tableHandleKeyUp(row, '', row.contractNum, 'sum');
  1302. }
  1303. },
  1304. getProcessRouteData(list, sourceSalesOrderId) {
  1305. this.sourceSalesOrderId = sourceSalesOrderId;
  1306. list.map(async (row, index) => {
  1307. await this.changeBomId(row, index);
  1308. });
  1309. this.changeLineNumber();
  1310. },
  1311. // 清空BOM 跟工艺路线
  1312. wipeData(index) {
  1313. let row = this.form.productInfoList[index];
  1314. row.bomCategoryId = '';
  1315. row.routingList = [];
  1316. row.bomVersionList = [];
  1317. row.produceRoutingId = '';
  1318. row.produceRoutingName = '';
  1319. // row.produceVersionName = '';
  1320. row.selectionRowShow = false;
  1321. // this.selectionRowShow = false;
  1322. },
  1323. // 选择生产类型
  1324. async changeProductType(row, index) {
  1325. let param = {
  1326. bomType: row.productType,
  1327. categoryId: row.categoryId
  1328. };
  1329. this.wipeData(index);
  1330. const res = await bomListByPlan(param);
  1331. console.log(res, 'res 3333');
  1332. let arr = res || [];
  1333. let data = this.form.productInfoList[index];
  1334. if (arr.length) {
  1335. this.form.productInfoList[index].bomVersionList = arr;
  1336. row.bomCategoryId = arr[0].id;
  1337. await this.changeBomId(row, index);
  1338. let arrAll = JSON.parse(JSON.stringify(this.form));
  1339. this.$set(this, 'form', arrAll);
  1340. }
  1341. this.$forceUpdate();
  1342. // let arr = res || [];
  1343. // if (arr.length == 0) {
  1344. // row.bomCategoryId = '';
  1345. // }
  1346. // this.$set(this.form.productInfoList[index], 'bomVersionList', arr);
  1347. // this.$forceUpdate();
  1348. // console.log(this.form,'this.formthis.form')
  1349. },
  1350. // 选择BOM
  1351. async changeBomId(row, index) {
  1352. console.log(row, '这里看看吧');
  1353. const res = await bomRoutingList(row.bomCategoryId);
  1354. let arr = res || [];
  1355. // if (arr.length == 0) {
  1356. // row.produceRoutingId = '';
  1357. // }
  1358. console.log(arr, 'arr');
  1359. if (arr.length > 0) {
  1360. this.$set(this.form.productInfoList[index], 'routingList', arr);
  1361. row.produceRoutingName = arr[0].name;
  1362. this.$set(
  1363. this.form.productInfoList[index],
  1364. 'produceRoutingId',
  1365. arr[0].id
  1366. );
  1367. }
  1368. this.$forceUpdate();
  1369. },
  1370. homogeneityInspect(row) {
  1371. if (!row.productType) {
  1372. this.$message.warning('请选择生产类型');
  1373. return;
  1374. }
  1375. if (!row.bomCategoryId) {
  1376. this.$message.warning('请选择BOM版本');
  1377. return;
  1378. }
  1379. if (!row.contractNum) {
  1380. this.$message.warning('请输入订单数量且订单数量不能为0');
  1381. return;
  1382. }
  1383. console.log(row, 'row');
  1384. console.log(this.form, 'form +++');
  1385. this.$refs.orderHomogeneityInspectDialog.open([row], this.form, 'new');
  1386. // if (row.productType == 2) {
  1387. // let data = [];
  1388. // data.push(row);
  1389. // this.$refs.orderHomogeneityInspectDialog.open(data, this.form, 'new');
  1390. // } else if (row.productType == 3) {
  1391. // this.$refs.orderHomogeneityInspectInstallDialog.open([row.id]);
  1392. // } else {
  1393. // this.$message.warning('请确认生产类型!');
  1394. // }
  1395. },
  1396. // 打开工艺路线
  1397. openDialog(index) {
  1398. this.selectIndex = index;
  1399. this.$refs.processRouteRef.open();
  1400. },
  1401. // 选择工艺路线
  1402. changeParent(item) {
  1403. let data = this.form.productInfoList[this.selectIndex];
  1404. this.$set(data, 'bomVersionList', []);
  1405. this.$set(data, 'bomCategoryId', '');
  1406. this.$set(data, 'model', '');
  1407. this.$set(data, 'routingList', []);
  1408. this.$set(data, 'productType', '');
  1409. this.$set(data, 'produceRoutingName', item.name);
  1410. this.$set(data, 'produceRoutingId', item.id);
  1411. this.$set(data, 'selectionRowShow', true);
  1412. // this.selectionRowShow = true;
  1413. }
  1414. }
  1415. };
  1416. </script>
  1417. <style lang="scss" scoped>
  1418. .basic-details-title {
  1419. margin: 10px 0;
  1420. }
  1421. .add-product {
  1422. width: 100%;
  1423. display: flex;
  1424. align-items: center;
  1425. justify-content: flex-end;
  1426. font-size: 30px;
  1427. color: #1890ff;
  1428. margin: 10px 0;
  1429. cursor: pointer;
  1430. }
  1431. .create-form .el-form-item {
  1432. margin-bottom: 15px !important;
  1433. }
  1434. .header_required {
  1435. .is-required:before {
  1436. content: '*';
  1437. color: #f56c6c;
  1438. margin-right: 4px;
  1439. }
  1440. }
  1441. </style>