batchProductJobBom.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275
  1. <template>
  2. <view>
  3. <view class="title_box rx-bc">
  4. <view class="name"> 报工信息: ({{ list.length || 0 }})个</view>
  5. </view>
  6. <view
  7. :class="[
  8. 'material',
  9. it.extInfo.reportWeight && it.extInfo.reportWeight && 'materialBor',
  10. ]"
  11. v-for="(it, idx) in list"
  12. :key="idx"
  13. >
  14. <view class="content_table">
  15. <view class="item rx-sc">
  16. <view class="rx">
  17. <view class="lable lable190 rx-cc" v-if="isDetails">
  18. <view class="round">{{ idx + 1 }}</view>
  19. <uni-icons
  20. custom-prefix="iconfont"
  21. type="icon-shanchu"
  22. size="16"
  23. color="#fa3534"
  24. ></uni-icons>
  25. 物料编码
  26. </view>
  27. <view class="lable lable190 rx-cc" @click="getDelete2(idx)" v-else>
  28. <view class="round">{{ idx + 1 }}</view>
  29. <uni-icons
  30. custom-prefix="iconfont"
  31. type="icon-shanchu"
  32. size="16"
  33. color="#fa3534"
  34. ></uni-icons>
  35. 物料编码
  36. </view>
  37. <view class="content rx-bc">
  38. <view>{{ it.code }} </view>
  39. <view
  40. class="tag_box"
  41. v-if="
  42. Object.prototype.hasOwnProperty.call(it, 'extInfo') &&
  43. Object.prototype.hasOwnProperty.call(
  44. it.extInfo,
  45. 'productionTimes'
  46. ) &&
  47. Object.prototype.hasOwnProperty.call(
  48. it.extInfo.productionTimes,
  49. item.currentTaskDiagram.taskId
  50. )
  51. "
  52. >
  53. {{ it.extInfo.productionTimes[item.currentTaskDiagram.taskId] }}
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="item rx-sc">
  59. <view class="rx">
  60. <view class="lable lable150 rx-cc">名称</view>
  61. <view class="content rx-bc">
  62. <view
  63. >{{ it.name }}
  64. <text
  65. v-if="[2, 23, 9, 28].includes(Number(it.rootCategoryLevelId))"
  66. >
  67. ({{
  68. it.rootCategoryLevelId == 2
  69. ? "在制品"
  70. : it.rootCategoryLevelId == 23
  71. ? "半成品"
  72. : it.rootCategoryLevelId == 9
  73. ? "产品"
  74. : it.rootCategoryLevelId == 28
  75. ? "废品"
  76. : ""
  77. }})
  78. </text>
  79. </view>
  80. <view class="rx-ec">
  81. <view
  82. class="tag_box"
  83. v-if="it.isCache"
  84. style="margin-right: -36rpx; margin-right: 4rpx"
  85. >缓</view
  86. >
  87. <view
  88. class="tag_box"
  89. v-if="
  90. Object.prototype.hasOwnProperty.call(
  91. it.extInfo,
  92. 'isOutsource'
  93. ) && it.extInfo.isOutsource == 1
  94. "
  95. style="margin-right: -36rpx"
  96. >委外</view
  97. >
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. <view class="item rx-sc">
  103. <view class="rx">
  104. <view class="lable lable150 rx-cc">型号</view>
  105. <view class="content rx-sc">
  106. <view>{{ it.modelType }}</view>
  107. </view>
  108. </view>
  109. </view>
  110. <view class="item rx-sc">
  111. <view class="rx ww50">
  112. <view class="lable lable150 rx-cc">物料代号</view>
  113. <view class="content content_num">
  114. <view v-if="isDetails">{{ it.extInfo.materielCode }}</view>
  115. <input
  116. class="uni-input"
  117. v-else
  118. v-model="it.extInfo.materielCode"
  119. />
  120. </view>
  121. </view>
  122. <view class="rx ww50">
  123. <view class="lable lable150 rx-cc">客户代号</view>
  124. <view class="content content_num">
  125. <view v-if="isDetails">{{ it.extInfo.clientCode }}</view>
  126. <input class="uni-input" v-else v-model="it.extInfo.clientCode" />
  127. </view>
  128. </view>
  129. </view>
  130. <view class="item rx-sc">
  131. <view class="rx ww50">
  132. <view class="lable lable150 rx-cc">刻码</view>
  133. <view class="content content_num">
  134. <view v-if="isDetails">{{ it.extInfo.engrave }}</view>
  135. <input class="uni-input" v-else v-model="it.extInfo.engrave" />
  136. </view>
  137. </view>
  138. <view class="rx ww50">
  139. <view class="lable lable150 rx-cc">序列号</view>
  140. <view class="content content_num">
  141. <view v-if="isDetails">{{ it.extInfo.productSequence }}</view>
  142. </view>
  143. </view>
  144. </view>
  145. <view class="item rx-sc">
  146. <view class="rx ww50">
  147. <view class="lable lable150 rx-cc">设备</view>
  148. <view class="content content_num">
  149. <view v-if="isDetails">{{ it.deviceName }}</view>
  150. <zxz-uni-data-select
  151. :localdata="deviceList"
  152. v-model="it.deviceId"
  153. dataValue="instanceId"
  154. format="{name}"
  155. dataKey="instanceId"
  156. filterable
  157. :clear="false"
  158. v-else
  159. ></zxz-uni-data-select>
  160. </view>
  161. <!-- <view class="content ">
  162. <view>{{ it.deviceName || it.extInfo.deviceName }}</view>
  163. </view> -->
  164. </view>
  165. <view class="rx ww50">
  166. <view class="lable lable150 rx-cc">炉次号</view>
  167. <view class="content content_num">
  168. <view v-if="isDetails">{{ it.extInfo.heatNumber }}</view>
  169. <input class="uni-input" v-else v-model="it.extInfo.heatNumber" />
  170. </view>
  171. </view>
  172. </view>
  173. <view class="item rx-sc">
  174. <view class="rx ww50">
  175. <view class="lable lable150 rx-cc">位置</view>
  176. <view class="content content_num">
  177. <view v-if="isDetails">{{ it.extInfo.position }}</view>
  178. <input class="uni-input" v-else v-model="it.extInfo.position" />
  179. </view>
  180. </view>
  181. <view class="rx ww50">
  182. <view class="lable lable150 rx-cc">数量</view>
  183. <view class="content content_num">
  184. <view v-if="isDetails">{{ it.feedQuantity }}</view>
  185. <view>{{ it.feedQuantity }}</view>
  186. </view>
  187. </view>
  188. </view>
  189. <!-- <view class="item rx-sc">
  190. <view class="rx ww45">
  191. <view class="lable lable150 rx-cc">是否合格</view>
  192. <view class="content content_num">
  193. <zxz-uni-data-select
  194. :localdata="isQualifiedList"
  195. v-model="it.extInfo.isQualified"
  196. dataValue="code"
  197. format="{name}"
  198. dataKey="code"
  199. filterable
  200. :disabled="isDetails"
  201. :clear="false"
  202. @change="handleInput"
  203. ></zxz-uni-data-select>
  204. </view>
  205. </view>
  206. <view class="rx ww50">
  207. <view class="lable lable150 rx-cc">类型</view>
  208. <view class="content content_num">
  209. <zxz-uni-data-select
  210. :localdata="notTypeList"
  211. v-model="it.extInfo.notType"
  212. dataValue="code"
  213. format="{name}"
  214. dataKey="code"
  215. filterable
  216. :disabled="isDetails"
  217. :clear="false"
  218. ></zxz-uni-data-select>
  219. </view>
  220. </view>
  221. </view>
  222. <view
  223. class="item rx-sc"
  224. v-if="
  225. it.extInfo.isQualified != 1 &&
  226. it.extInfo.notType != 5 &&
  227. it.extInfo.notType != 8
  228. "
  229. >
  230. <view class="rx">
  231. <view class="lable lable150 rx-cc">原因</view>
  232. <view class="content content_num">
  233. <view v-if="isDetails">{{ it.extInfo.notReason }}</view>
  234. <input class="uni-input" v-else v-model="it.extInfo.notReason" />
  235. </view>
  236. </view>
  237. </view> -->
  238. <view class="item rx-sc">
  239. <view class="rx ww50">
  240. <view class="lable lable150 rx-cc">是否合格</view>
  241. <view class="content content_num">
  242. <zxz-uni-data-select
  243. :localdata="isQualifiedList"
  244. v-model="it.extInfo.isQualified"
  245. dataValue="code"
  246. format="{name}"
  247. dataKey="code"
  248. filterable
  249. :disabled="isDetails"
  250. :clear="false"
  251. ></zxz-uni-data-select>
  252. </view>
  253. </view>
  254. <view
  255. class="rx ww50"
  256. v-if="it.extInfo.isQualified && it.extInfo.isQualified == 2"
  257. >
  258. <view class="lable lable150 rx-cc">处置类型</view>
  259. <view class="content content_num">
  260. <zxz-uni-data-select
  261. :localdata="notTypeList"
  262. v-model="it.extInfo.notType"
  263. dataValue="code"
  264. format="{name}"
  265. dataKey="code"
  266. filterable
  267. :disabled="isDetails"
  268. :clear="false"
  269. ></zxz-uni-data-select>
  270. </view>
  271. </view>
  272. </view>
  273. <view class="item rx-sc">
  274. <view class="rx ww50">
  275. <view class="lable lable150 rx-cc">原因/处置</view>
  276. <view
  277. class="content content_num"
  278. v-if="
  279. it.extInfo.isQualified != 1 &&
  280. it.extInfo.notType != 5 &&
  281. it.extInfo.notType != 8 &&
  282. it.extInfo.notType
  283. "
  284. >
  285. <view v-if="isDetails">{{ it.extInfo.notReason }}</view>
  286. <input class="uni-input" v-else v-model="it.extInfo.notReason" />
  287. </view>
  288. <view
  289. v-if="![1, 2, 3, 4, 6, 9, 7].includes(Number(it.extInfo.notType))"
  290. class="content content_num"
  291. >
  292. <span v-if="isDetails">{{ it.extInfo.taskName }}</span>
  293. <zxz-uni-data-select
  294. :localdata="stepsList"
  295. v-model="it.extInfo.taskId"
  296. dataValue="taskId"
  297. format="{taskTypeName}"
  298. dataKey="taskId"
  299. filterable
  300. :disabled="isDetails"
  301. :clear="false"
  302. >
  303. </zxz-uni-data-select>
  304. </view>
  305. </view>
  306. <view class="rx ww50">
  307. <view class="lable lable150 rx-cc">报工重量</view>
  308. <view class="content content_num">
  309. <view v-if="isDetails">{{ it.extInfo.reportWeight }}</view>
  310. <input
  311. class="uni-input"
  312. v-else
  313. v-model="it.extInfo.reportWeight"
  314. @input="handleInput"
  315. />
  316. </view>
  317. </view>
  318. </view>
  319. </view>
  320. <view
  321. class="content_table2"
  322. v-if="
  323. ![1, 2, 3, 4].includes(Number(it.extInfo.notType)) &&
  324. clientEnvironmentId == 3
  325. "
  326. >
  327. <view class="head row rx-sc">
  328. <view class="item ww25" style="font-size: 20rpx"
  329. >{{ it.extInfo.newWeight ? "上道工序重量" : "物料重量" }}
  330. {{ it.extInfo.weightUnit }}
  331. </view>
  332. <view class="item ww25">报工重量{{ it.extInfo.weightUnit }}</view>
  333. <view class="item ww25" v-if="isFirstTask == 1">质检结果 </view>
  334. <view class="item ww25" :class="[isFirstTask == 1 ? 'ww25' : 'ww50']"
  335. >处置
  336. </view>
  337. </view>
  338. <view class="table">
  339. <view class="tr row rx-sc">
  340. <view
  341. class="item ww25"
  342. v-if="
  343. Object.prototype.hasOwnProperty.call(it.extInfo, 'newWeight') &&
  344. it.extInfo.newWeight
  345. "
  346. >
  347. {{ it.extInfo.newWeight }}
  348. </view>
  349. <view
  350. class="item ww25 content_num"
  351. v-if="
  352. !Object.prototype.hasOwnProperty.call(
  353. it.extInfo,
  354. 'newWeight'
  355. ) ||
  356. it.extInfo.newWeight == null ||
  357. it.extInfo.newWeight == 0
  358. "
  359. >
  360. <input
  361. class="uni-input"
  362. v-model="it.extInfo.weight"
  363. type="digit"
  364. />
  365. </view>
  366. <view class="item ww25 content_num">
  367. <view v-if="isDetails">{{ it.extInfo.reportWeight }}</view>
  368. <input
  369. class="uni-input"
  370. v-else
  371. v-model="it.extInfo.reportWeight"
  372. type="digit"
  373. @input="handleInput"
  374. />
  375. </view>
  376. <view
  377. class="item ww25"
  378. @click="openNumerate(it, idx)"
  379. v-if="isFirstTask == 1"
  380. >
  381. <view class="numerate">点击计算</view>
  382. </view>
  383. <view
  384. class="item"
  385. v-if="isDetails"
  386. :class="[isFirstTask == 1 ? 'ww25' : 'ww50']"
  387. >
  388. {{ it.extInfo.taskName }}
  389. </view>
  390. <view
  391. class="item"
  392. v-else
  393. :class="[isFirstTask == 1 ? 'ww25' : 'ww50']"
  394. >
  395. <zxz-uni-data-select
  396. :localdata="stepsList"
  397. v-model="it.extInfo.taskId"
  398. dataValue="taskId"
  399. format="{taskTypeName}"
  400. dataKey="taskId"
  401. filterable
  402. @change="(e) => (it.extInfo.taskName = e.taskTypeName)"
  403. :clear="false"
  404. ></zxz-uni-data-select>
  405. </view>
  406. </view>
  407. </view>
  408. </view>
  409. </view>
  410. <u-popup
  411. :show="show"
  412. mode="center"
  413. v-if="show"
  414. :closeOnClickOverlay="false"
  415. >
  416. <view class="popup_box">
  417. <view class="title_box rx-bc">
  418. <view class="name">工序计算列表</view>
  419. <view class="btn_box rx-ec">
  420. <view class="btn" @click="handAddParam">新增</view>
  421. </view>
  422. </view>
  423. <view class="content_table2">
  424. <view class="head row rx-sc">
  425. <view class="item ww30">工序名称</view>
  426. <view class="item ww20">坯体密度</view>
  427. <view class="item ww20">密度系数</view>
  428. <view class="item ww20">重量</view>
  429. <view class="item ww10">操作</view>
  430. </view>
  431. <view class="table">
  432. <view
  433. class="tr row rx-sc"
  434. v-for="(it, idx) in paramList"
  435. :key="idx"
  436. >
  437. <view class="item rx-bc ww30">
  438. <zxz-uni-data-select
  439. :localdata="stepsList"
  440. v-model="it.taskId"
  441. dataValue="taskId"
  442. format="{taskTypeName}"
  443. dataKey="taskId"
  444. filterable
  445. @change="(e) => (it.taskName = e.taskTypeName)"
  446. :clear="false"
  447. ></zxz-uni-data-select>
  448. </view>
  449. <view class="item ww20 content_num">
  450. <input
  451. class="uni-input"
  452. v-model="it.billet"
  453. type="digit"
  454. @input="changeInp(it, idx)"
  455. />
  456. </view>
  457. <view class="item ww20 content_num">
  458. <input
  459. class="uni-input"
  460. v-model="it.density"
  461. type="digit"
  462. @input="changeInp(it, idx)"
  463. />
  464. </view>
  465. <view
  466. class="item ww20"
  467. v-if="idx == 0 || idx != paramList.length - 1"
  468. >
  469. < {{ it.CVIWeight }}
  470. </view>
  471. <view
  472. class="item ww20"
  473. v-if="paramList.length > 1 && idx == paramList.length - 1"
  474. >
  475. ≥ {{ it.CVIWeight }}
  476. </view>
  477. <view class="item ww10 rx-cc" @click="getDelete(idx)">
  478. <uni-icons
  479. custom-prefix="iconfont"
  480. type="icon-shanchu"
  481. size="20"
  482. color="#fa3534"
  483. ></uni-icons>
  484. </view>
  485. </view>
  486. </view>
  487. <view class="formula_box"
  488. >计算公式: 物料重量/坯体密度*密度系数
  489. </view>
  490. <view class="rx-cc">
  491. <u-button
  492. size="small"
  493. class="u-reset-button"
  494. style="width: 300rpx; margin: 20rpx"
  495. type="success"
  496. @click="paramSave"
  497. >工序列表保存</u-button
  498. >
  499. </view>
  500. <view class="reportWeight rx-sc">
  501. 物料重量: {{ weight }} ; 报工重量: {{ reportWeight }}
  502. </view>
  503. </view>
  504. <view class="operate_box rx-sc">
  505. <u-button size="small" class="u-reset-button" @click="cancel"
  506. >取消</u-button
  507. >
  508. <u-button
  509. size="small"
  510. class="u-reset-button"
  511. type="success"
  512. @click="save"
  513. >确定</u-button
  514. >
  515. </view>
  516. </view>
  517. </u-popup>
  518. </view>
  519. </template>
  520. <script>
  521. import { getTaskInstanceList } from "@/api/pda/workOrder.js";
  522. import { saveParam, getComputeParam } from "@/api/pda/tangu.js";
  523. export default {
  524. props: {
  525. item: {
  526. type: Object,
  527. default: () => {},
  528. },
  529. list: {
  530. type: Array,
  531. default: () => [],
  532. },
  533. isDetails: {
  534. type: Boolean,
  535. default: false,
  536. },
  537. equipmentList: {
  538. type: Array,
  539. default: () => [],
  540. },
  541. },
  542. watch: {
  543. equipmentList: {
  544. immediate: true,
  545. deep: true,
  546. handler(newVal) {
  547. this.deviceList = newVal;
  548. this.changeHeatNumber();
  549. },
  550. },
  551. list: {
  552. immediate: true,
  553. deep: true,
  554. handler(newVal) {
  555. if (newVal.length) {
  556. console.log(newVal);
  557. this.newList = newVal;
  558. this.sumweight(newVal);
  559. this.sunTj();
  560. }
  561. },
  562. },
  563. },
  564. mounted() {
  565. if (this.deviceList.length > 0) {
  566. this.list.forEach((item) => {
  567. item.deviceId = this.deviceList[0].id
  568. ? this.deviceList[0].id
  569. : this.deviceList[0].instanceId;
  570. });
  571. }
  572. },
  573. data() {
  574. return {
  575. taskTypeName: null,
  576. isFirstTask: null,
  577. stepsList: [],
  578. clientEnvironmentId:
  579. uni.getStorageSync("userInfo") &&
  580. uni.getStorageSync("userInfo").clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  581. show: false,
  582. rowIt: [],
  583. paramList: [],
  584. paramObj: {},
  585. weight: 0,
  586. reportWeight: 0,
  587. resultObj: {},
  588. resultIdx: 0,
  589. deviceList: [],
  590. isQualifiedList: [
  591. {
  592. code: "1",
  593. name: "合格",
  594. },
  595. {
  596. code: "2",
  597. name: "不合格",
  598. },
  599. ],
  600. notTypeList: [
  601. {
  602. code: 1,
  603. name: "返工",
  604. },
  605. {
  606. code: 2,
  607. name: "返修",
  608. },
  609. {
  610. code: 3,
  611. name: "报废",
  612. },
  613. {
  614. code: 4,
  615. name: "降级使用",
  616. },
  617. {
  618. code: 5,
  619. name: "让步接收",
  620. },
  621. {
  622. code: 6,
  623. name: "留样",
  624. },
  625. {
  626. code: 7,
  627. name: "消耗",
  628. },
  629. {
  630. code: 8,
  631. name: "回用",
  632. },
  633. {
  634. code: 9,
  635. name: "转试销",
  636. },
  637. ],
  638. };
  639. },
  640. created() {
  641. this.taskTypeName = this.item.currentTaskDiagram.taskTypeName;
  642. this.isFirstTask = this.item.currentTaskDiagram.isFirstTask;
  643. console.log(this.list, "this.list");
  644. this.getSteps();
  645. this.getCompute();
  646. setTimeout(() => {
  647. this.handleInput();
  648. }, 800);
  649. },
  650. methods: {
  651. getSteps() {
  652. getTaskInstanceList(this.item.workOrderId).then((res) => {
  653. res.pop();
  654. this.stepsList = res;
  655. });
  656. },
  657. getCompute() {
  658. getComputeParam(
  659. this.item.workOrderId,
  660. this.item.currentTaskDiagram.taskId
  661. ).then((res) => {
  662. this.paramList = [];
  663. this.paramList = (res && res.paramList) || [];
  664. this.paramObj = res || {};
  665. });
  666. },
  667. handAddParam() {
  668. // billet: null,
  669. // density: null,
  670. // result: null,
  671. // PIPDensity: null,
  672. // volume: null,
  673. // coefficient: null
  674. if (this.isFirstTask == 1) {
  675. this.paramList.push({
  676. taskId: null,
  677. taskName: null,
  678. });
  679. }
  680. },
  681. getDelete(idx) {
  682. this.paramList.splice(idx, 1);
  683. },
  684. changeInp(item, index) {
  685. if (Number(item.billet) && Number(item.density)) {
  686. this.paramList[index].CVIWeight = (
  687. (Number(this.weight) / item.billet) *
  688. item.density
  689. ).toFixed(2);
  690. }
  691. },
  692. paramSave() {
  693. if (this.isFirstTask == 1 && this.paramList.length > 0) {
  694. let bol;
  695. let _i;
  696. bol = this.paramList.every((e, i) => {
  697. _i = i + 1;
  698. return e.taskId && e.billet && e.density;
  699. });
  700. if (!bol) {
  701. uni.showToast({
  702. title: `请完善第${_i}计算数据`,
  703. icon: "none",
  704. });
  705. return false;
  706. }
  707. if (this.paramList.length < 1) {
  708. uni.showToast({
  709. title: `请输入二个以上计算数据`,
  710. icon: "none",
  711. });
  712. return false;
  713. }
  714. }
  715. let param = {};
  716. if (!Object.prototype.hasOwnProperty.call(this.paramObj, "id")) {
  717. param = {
  718. paramList: this.paramList,
  719. workOrderId: this.item.workOrderId,
  720. taskId: this.item.currentTaskDiagram.taskId,
  721. };
  722. } else {
  723. this.paramObj.paramList = this.paramList;
  724. param = this.paramObj;
  725. }
  726. saveParam(param).then((res) => {
  727. uni.showToast({
  728. icon: "none",
  729. title: "操作成功",
  730. });
  731. this.getCompute();
  732. });
  733. },
  734. openNumerate(row, idx) {
  735. if (!row.extInfo.reportWeight) {
  736. uni.showToast({
  737. icon: "none",
  738. title: "请先输入报工重量",
  739. });
  740. return false;
  741. }
  742. this.weight = row.extInfo.weight;
  743. this.reportWeight = row.extInfo.reportWeight;
  744. this.resultIdx = idx;
  745. this.show = true;
  746. },
  747. handleInput() {
  748. let arr = JSON.parse(JSON.stringify(this.list));
  749. this.sumweight(arr);
  750. // this.sunTj();
  751. console.log("arr11111112222", arr);
  752. // console.log('this.list33333',this.list)
  753. },
  754. sumweight(arr) {
  755. let formedWeight = 0;
  756. let noFormedWeight = 0;
  757. arr.map((s, i) => {
  758. if (s.extInfo.reportWeight) {
  759. if (s.extInfo.isQualified == 1) {
  760. formedWeight += s.extInfo.reportWeight * 1;
  761. } else {
  762. noFormedWeight += s.extInfo.reportWeight * 1;
  763. }
  764. } else {
  765. s.extInfo.reportWeight = null;
  766. }
  767. this.$set(this.list[i].extInfo, "reportWeight", s.extInfo.reportWeight);
  768. });
  769. if (this.item.workReportInfo) {
  770. this.item.workReportInfo.formedWeight = parseFloat(
  771. formedWeight.toFixed(2)
  772. );
  773. this.item.workReportInfo.notFormedWeight = parseFloat(
  774. noFormedWeight.toFixed(2)
  775. );
  776. }
  777. },
  778. sunTj() {
  779. if (this.item.workReportInfo && this.item.singleReport == 1) {
  780. this.item.workReportInfo.formedNum = this.newList.filter(
  781. (v) => v.extInfo.isQualified == 1
  782. ).length;
  783. this.item.workReportInfo.notFormedNum = this.newList.filter(
  784. (v) => v.extInfo.isQualified !== 1
  785. ).length;
  786. }
  787. },
  788. cancel() {
  789. this.show = false;
  790. this.reportWeight = 0;
  791. this.weight = 0;
  792. },
  793. taskChange(e) {
  794. console.log(e);
  795. },
  796. getDelete2(idx) {
  797. uni.showModal({
  798. title: "删除",
  799. content: "是否确实删除此物料!",
  800. confirmText: "确认", //这块是确定按钮的文字
  801. success: (rr) => {
  802. if (rr.confirm) {
  803. this.list.splice(idx, 1);
  804. }
  805. if (this.list.length != 0) {
  806. this.$set(this.item.workReportInfo, "formedNum", 0);
  807. this.$set(this.item.workReportInfo, "notFormedNum", 0);
  808. }
  809. this.$forceUpdate();
  810. },
  811. });
  812. },
  813. save() {
  814. if (this.isFirstTask == 1) {
  815. this.resultObj = {};
  816. if (Number(this.reportWeight) < Number(this.paramList[0].CVIWeight)) {
  817. this.resultObj = this.paramList[0];
  818. this.setDataSave();
  819. return false;
  820. }
  821. if (
  822. Number(this.reportWeight) >=
  823. this.paramList[this.paramList.length - 1].CVIWeight
  824. ) {
  825. this.resultObj = this.paramList[this.paramList.length - 1];
  826. this.setDataSave();
  827. return false;
  828. }
  829. for (let i = 1; i < this.paramList.length; i++) {
  830. console.log(i);
  831. console.log(
  832. 11,
  833. Number(this.paramList[i - 1].CVIWeight),
  834. Number(this.reportWeight)
  835. );
  836. if (
  837. Number(this.paramList[i - 1].CVIWeight) <
  838. Number(this.reportWeight) &&
  839. Number(this.reportWeight) < Number(this.paramList[i].CVIWeight)
  840. ) {
  841. this.resultObj = this.paramList[i];
  842. break;
  843. }
  844. }
  845. this.setDataSave();
  846. }
  847. },
  848. setDataSave() {
  849. this.$set(
  850. this.list[this.resultIdx].extInfo,
  851. "taskId",
  852. this.resultObj.taskId
  853. );
  854. this.$set(
  855. this.list[this.resultIdx].extInfo,
  856. "density",
  857. this.resultObj.density
  858. );
  859. this.$set(
  860. this.list[this.resultIdx].extInfo,
  861. "billet",
  862. this.resultObj.billet
  863. );
  864. this.$set(
  865. this.list[this.resultIdx].extInfo,
  866. "taskName",
  867. this.resultObj.taskName
  868. );
  869. this.cancel();
  870. },
  871. changeHeatNumber() {
  872. if (this.deviceList.length != 0) {
  873. this.deviceList.forEach((f) => {
  874. this.list.forEach((o) => {
  875. if (
  876. o.deviceId &&
  877. f.instanceId == o.deviceId &&
  878. this.deviceList.length > 1
  879. ) {
  880. o.extInfo.heatNumber = f.extInfo.heatNumber;
  881. o.deviceId = f.instanceId;
  882. this.$forceUpdate();
  883. } else if (this.deviceList.length == 1) {
  884. o.extInfo.heatNumber = this.deviceList[0].extInfo.heatNumber;
  885. o.deviceId = this.deviceList[0].instanceId;
  886. this.$forceUpdate();
  887. } else if (this.deviceList.length > 1) {
  888. o.extInfo.heatNumber = f.extInfo.heatNumber;
  889. o.deviceId = f.instanceId;
  890. this.$forceUpdate();
  891. }
  892. });
  893. });
  894. }
  895. },
  896. },
  897. };
  898. </script>
  899. <style lang="scss" scoped>
  900. .title_box {
  901. margin-top: 20rpx;
  902. .name {
  903. font-size: 28rpx;
  904. font-style: normal;
  905. font-weight: 400;
  906. color: $theme-color;
  907. padding-left: 20rpx;
  908. position: relative;
  909. &:before {
  910. position: absolute;
  911. content: "";
  912. left: 0rpx;
  913. top: 0rpx;
  914. bottom: 0rpx;
  915. width: 4rpx;
  916. height: 28rpx;
  917. background: $theme-color;
  918. margin: auto;
  919. }
  920. }
  921. .btn_box {
  922. .btn {
  923. padding: 0 18rpx;
  924. height: 50rpx;
  925. line-height: 50rpx;
  926. background: $theme-color;
  927. font-size: 26rpx;
  928. font-style: normal;
  929. font-weight: 400;
  930. font-size: 24rpx;
  931. color: #fff;
  932. border-radius: 4rpx;
  933. margin-left: 24rpx;
  934. }
  935. }
  936. }
  937. .material {
  938. margin-top: 16rpx;
  939. border: 1rpx solid transparent;
  940. .content_table {
  941. width: 100%;
  942. border: 2rpx solid $border-color;
  943. box-sizing: border-box;
  944. .item {
  945. display: flex;
  946. border-bottom: 2rpx solid $border-color;
  947. .lable {
  948. width: 132rpx;
  949. text-align: center;
  950. background-color: #f7f9fa;
  951. font-size: 26rpx;
  952. border-right: 2rpx solid $border-color;
  953. flex-shrink: 0;
  954. }
  955. .lable150 {
  956. width: 156rpx !important;
  957. font-size: 24rpx;
  958. }
  959. .lable190 {
  960. width: 200rpx !important;
  961. font-size: 24rpx;
  962. }
  963. .ww80 {
  964. width: 80rpx;
  965. }
  966. .content {
  967. width: 518rpx;
  968. min-height: 64rpx;
  969. font-size: 28rpx;
  970. line-height: 28rpx;
  971. font-style: normal;
  972. font-weight: 400;
  973. padding: 18rpx 8rpx;
  974. box-sizing: border-box;
  975. word-wrap: break-word;
  976. flex-grow: 1 !important;
  977. .unit {
  978. padding: 0 4rpx;
  979. font-size: 24rpx;
  980. color: #404446;
  981. }
  982. .penalize {
  983. width: 160rpx;
  984. line-height: 60rpx;
  985. background: $theme-color;
  986. font-size: 24rpx;
  987. text-align: center;
  988. color: #fff;
  989. }
  990. }
  991. .content_H {
  992. min-height: 92rpx;
  993. }
  994. .pd4 {
  995. padding: 4rpx 8rpx;
  996. }
  997. &:last-child {
  998. border-bottom: none;
  999. }
  1000. }
  1001. .ww55 {
  1002. width: 55%;
  1003. }
  1004. .ww50 {
  1005. width: 50%;
  1006. }
  1007. .ww45 {
  1008. width: 45%;
  1009. }
  1010. .tag_box {
  1011. padding: 2rpx 10rpx;
  1012. margin-right: 12rpx;
  1013. background: #e6a23c;
  1014. font-size: 22rpx;
  1015. color: #fff;
  1016. border-radius: 4rpx;
  1017. }
  1018. }
  1019. }
  1020. .materialBor {
  1021. border: 1rpx solid #157a2c;
  1022. }
  1023. .content_table2 {
  1024. width: 100%;
  1025. .row {
  1026. width: 100%;
  1027. .item {
  1028. color: #404446;
  1029. font-size: 28rpx;
  1030. padding-left: 12rpx;
  1031. }
  1032. .color157 {
  1033. color: $theme-color;
  1034. }
  1035. .ww30 {
  1036. width: 30%;
  1037. }
  1038. .ww20 {
  1039. width: 20%;
  1040. }
  1041. .ww15 {
  1042. width: 15%;
  1043. }
  1044. .ww25 {
  1045. width: 25%;
  1046. }
  1047. .ww50 {
  1048. width: 50%;
  1049. }
  1050. .ww10 {
  1051. width: 10%;
  1052. }
  1053. }
  1054. .head {
  1055. height: 64rpx;
  1056. background: #f7f9fa;
  1057. // border-top: 2rpx solid #E3E5E5;
  1058. border-left: 2rpx solid #e3e5e5;
  1059. box-sizing: border-box;
  1060. .item {
  1061. height: 64rpx;
  1062. line-height: 64rpx;
  1063. border-right: 2rpx solid #e3e5e5;
  1064. box-sizing: border-box;
  1065. font-size: 22rpx;
  1066. }
  1067. }
  1068. .tr {
  1069. border-top: 2rpx solid #e3e5e5;
  1070. border-left: 2rpx solid #e3e5e5;
  1071. .item {
  1072. font-size: 24rpx;
  1073. min-height: 74rpx;
  1074. display: flex;
  1075. align-items: center;
  1076. border-right: 2rpx solid #e3e5e5;
  1077. box-sizing: border-box;
  1078. white-space: normal;
  1079. word-break: break-all;
  1080. }
  1081. &:last-child {
  1082. border-bottom: 2rpx solid #e3e5e5;
  1083. }
  1084. .numerate {
  1085. font-size: 22rpx;
  1086. color: $theme-color;
  1087. }
  1088. }
  1089. }
  1090. .content_num {
  1091. display: flex;
  1092. align-items: center;
  1093. padding: 0 4rpx;
  1094. /deep/ .uni-input-input {
  1095. border: 2rpx solid #f0f8f2;
  1096. background: #f0f8f2;
  1097. color: $theme-color;
  1098. }
  1099. }
  1100. .round {
  1101. width: 32rpx;
  1102. height: 32rpx;
  1103. line-height: 30rpx;
  1104. text-align: center;
  1105. border-radius: 50%;
  1106. background: $theme-color;
  1107. font-size: 24rpx;
  1108. font-style: normal;
  1109. font-weight: 400;
  1110. color: #fff;
  1111. margin-right: 10rpx;
  1112. }
  1113. .popup_box {
  1114. width: 94vw;
  1115. padding: 16rpx 12rpx;
  1116. box-sizing: border-box;
  1117. }
  1118. .operate_box {
  1119. margin-top: 32rpx;
  1120. padding: 10rpx 100rpx;
  1121. /deep/ .u-button {
  1122. width: 160rpx;
  1123. }
  1124. }
  1125. .formula_box {
  1126. font-size: 24rpx;
  1127. font-style: normal;
  1128. font-weight: 400;
  1129. margin-top: 12rpx;
  1130. }
  1131. .reportWeight {
  1132. font-size: 24rpx;
  1133. font-style: normal;
  1134. font-weight: 400;
  1135. margin-top: 30rpx;
  1136. text {
  1137. color: $theme-color;
  1138. }
  1139. }
  1140. </style>