batchJobBom.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977
  1. <template>
  2. <view>
  3. <!-- 单个报工 -->
  4. <view class="title_box rx-bc">
  5. <view class="name">报工信息</view>
  6. </view>
  7. <view class="material">
  8. <view class="content_table">
  9. <!-- <view class="item rx-sc">
  10. <view class="rx ">
  11. <view class="lable lable150 rx-cc ">报工数量</view>
  12. <view class="content">
  13. {{ tableData.length || 0 }}
  14. </view>
  15. </view>
  16. </view> -->
  17. <view class="item rx-sc">
  18. <view class="rx ww55">
  19. <view class="lable lable150 rx-cc">要求生产数量</view>
  20. <view class="content rx-sc">
  21. <view>{{ item.formingNum }}</view>
  22. <view class="unit">{{ item.unit }}</view>
  23. </view>
  24. </view>
  25. <view class="rx ww45">
  26. <view class="lable rx-cc ww80">重量</view>
  27. <view class="content content_num">
  28. <view>{{ item.formingWeight }}</view>
  29. <view class="unit">{{ item.weightUnit }}</view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="item rx-sc">
  34. <view class="rx ww55">
  35. <view class="lable lable150 rx-cc">合格品数量</view>
  36. <view class="content content_num">
  37. <input
  38. class="uni-input"
  39. v-model="item.workReportInfo.formedNum"
  40. :disabled="isDetails"
  41. @input="blurNum(item.workReportInfo)"
  42. type="digit"
  43. />
  44. <view class="unit">{{ item.unit }}</view>
  45. </view>
  46. </view>
  47. <view class="rx ww45">
  48. <view class="lable rx-cc ww80">重量</view>
  49. <view class="content content_num">
  50. <input
  51. class="uni-input"
  52. v-model="item.workReportInfo.formedWeight"
  53. type="digit"
  54. :disabled="isDetails"
  55. />
  56. <view class="unit">{{ item.weightUnit }}</view>
  57. </view>
  58. </view>
  59. </view>
  60. <!-- <view
  61. class="item rx-sc"
  62. v-for="(not, notIndex) in notFormedList"
  63. :key="notIndex"
  64. >
  65. <view class="rx ww55">
  66. <view class="lable lable150 rx-cc">不合格数量</view>
  67. <view class="content content_num">
  68. <input
  69. class="uni-input"
  70. v-model="item.workReportInfo.notFormedNum"
  71. type="digit"
  72. :disabled="isDetails"
  73. v-if="isDetails"
  74. @input="changeNum"
  75. />
  76. <input
  77. class="uni-input"
  78. v-model="not.notFormedNum"
  79. type="number"
  80. v-else
  81. @input="changeNum(not)"
  82. />
  83. <view class="unit">{{ item.unit }}</view>
  84. </view>
  85. </view>
  86. <view class="rx ww45">
  87. <view class="lable rx-cc ww80">重量</view>
  88. <view class="content content_num">
  89. <input
  90. class="uni-input"
  91. v-model="item.workReportInfo.notFormedWeight"
  92. type="digit"
  93. :disabled="isDetails"
  94. v-if="isDetails"
  95. />
  96. <input
  97. class="uni-input"
  98. v-model="not.notFormedWeight"
  99. type="digit"
  100. :disabled="isDetails"
  101. v-else
  102. />
  103. <view class="unit">{{ item.weightUnit }}</view>
  104. </view>
  105. </view>
  106. </view> -->
  107. <view class="item rx-sc">
  108. <view class="rx ww55">
  109. <view class="lable lable150 rx-cc">不合格数量</view>
  110. <view class="content content_num">
  111. <!-- //详情 -->
  112. <input
  113. class="uni-input"
  114. v-model="item.workReportInfo.notFormedNum"
  115. type="digit"
  116. :disabled="isDetails"
  117. @input="changeNum(item.workReportInfo.notFormedNum)"
  118. />
  119. <view class="unit">{{ item.unit }}</view>
  120. </view>
  121. </view>
  122. <view class="rx ww45">
  123. <view class="lable rx-cc ww80">重量</view>
  124. <view class="content content_num">
  125. <input
  126. class="uni-input"
  127. v-model="item.workReportInfo.notFormedWeight"
  128. type="digit"
  129. :disabled="isDetails"
  130. />
  131. <view class="unit">{{ item.weightUnit }}</view>
  132. </view>
  133. </view>
  134. </view>
  135. <view class="item rx-sc">
  136. <view class="rx ww55">
  137. <view class="lable lable150 rx-cc">报工备注</view>
  138. <view class="content content_num" style="width: 100%">
  139. <input
  140. class="uni-input"
  141. v-model="item.workReportInfo.remark"
  142. :disabled="isDetails"
  143. type="text"
  144. />
  145. </view>
  146. </view>
  147. <!-- v-if="clientEnvironmentId==2" -->
  148. <view class="rx ww45" v-if="clientEnvironmentId == 2">
  149. <view class="lable ww80 rx-cc">批次号</view>
  150. <view class="content content_num" style="width: 100%">
  151. {{ item.batchNo }}
  152. <input
  153. class="uni-input"
  154. v-model="batchNo"
  155. @input="batchNoNew"
  156. :disabled="isDetails"
  157. type="text"
  158. />
  159. </view>
  160. </view>
  161. <!-- 不是首工序展示这个按钮 -->
  162. <view
  163. class="unit-btn"
  164. @click="singleBatch"
  165. v-if="
  166. item.currentTaskDiagram &&
  167. item.currentTaskDiagram.isFirstTask == 1 &&
  168. clientEnvironmentId != 3 &&
  169. item.product &&
  170. item.product.length == 0
  171. "
  172. >创建在制品</view
  173. >
  174. <view
  175. class="unit-btn"
  176. @click="singleBatchTg"
  177. v-if="
  178. item.currentTaskDiagram &&
  179. item.currentTaskDiagram.isFirstTask == 1 &&
  180. clientEnvironmentId == 3 &&
  181. item.semiProductList &&
  182. item.semiProductList.length == 0
  183. "
  184. >创建在制品</view
  185. >
  186. </view>
  187. </view>
  188. <view class="content_table">
  189. <!-- <batchProductJobBom
  190. v-if="
  191. item.product &&
  192. item.product.length &&
  193. item.currentTaskDiagram.type != 4 &&
  194. item.currentTaskDiagram.type != 6 &&
  195. item.singleReport == 0
  196. "
  197. :item="item"
  198. :list="item.product"
  199. :equipmentList="item.equipmentList"
  200. @countNumPl="countNumPl"
  201. >
  202. </batchProductJobBom> -->
  203. <batchProductJobBom
  204. v-if="clientEnvironmentId != 3 && item.product && item.product.length"
  205. :item="item"
  206. :list="item.product"
  207. :equipmentList="item.equipmentList"
  208. @countNumPl="countNumPl"
  209. >
  210. </batchProductJobBom>
  211. <!-- <semiProductJobBomPL
  212. v-if="
  213. clientEnvironmentId == 3 &&
  214. item.semiProductList &&
  215. item.semiProductList.length
  216. "
  217. :item="item"
  218. :list="item.semiProductList"
  219. :equipmentList="item.equipmentList"
  220. @countNumPl="countNumPl"
  221. >
  222. </semiProductJobBomPL> -->
  223. <!-- <batchProductJobBom
  224. v-if="
  225. item.product &&
  226. item.product.length &&
  227. item.currentTaskDiagram &&
  228. (item.currentTaskDiagram.type == 2 ||
  229. item.currentTaskDiagram.type == 3 ||
  230. item.currentTaskDiagram.type == 6) &&
  231. item.singleReport == 0
  232. "
  233. :item="item"
  234. :list="item.product"
  235. :equipmentList="item.equipmentList"
  236. @countNumPl="countNumPl"
  237. >
  238. </batchProductJobBom> -->
  239. </view>
  240. </view>
  241. </view>
  242. </template>
  243. <script>
  244. import {
  245. createInProductBatch,
  246. createInProductBatchTG,
  247. } from "@/api/pda/jobBooking.js";
  248. // import checkboxTable from '../componentsTable/checkbox/checkbox.vue'
  249. import batchProductJobBom from "./batchProductJobBom.vue";
  250. import semiProductJobBomPL from "./semiProductJobBomPL.vue";
  251. import { parameterGetByCode } from "@/api/mainData/index.js";
  252. export default {
  253. props: {
  254. item: {
  255. type: Object,
  256. default: () => {},
  257. },
  258. notFormed: {
  259. type: Array,
  260. default: () => [],
  261. },
  262. isDetails: {
  263. type: Boolean,
  264. default: false,
  265. },
  266. currentTask: {
  267. type: Object,
  268. default: () => {},
  269. },
  270. },
  271. watch: {
  272. notFormed: {
  273. immediate: true,
  274. deep: true,
  275. handler(newVal) {
  276. this.notFormedList = newVal;
  277. },
  278. },
  279. item: {
  280. immediate: true,
  281. deep: true,
  282. handler(newVal) {
  283. console.log(newVal, "newVal");
  284. if (newVal.product && newVal.product.length != 0) {
  285. let formedNum = 0;
  286. let notFormedNum = 0;
  287. newVal.product.forEach((item) => {
  288. if (
  289. !item.extInfo.isQualified ||
  290. item.extInfo.isQualified == 1 ||
  291. item.extInfo.isQualified == 3
  292. ) {
  293. formedNum = formedNum + Number(item.feedQuantity);
  294. } else {
  295. notFormedNum = notFormedNum + Number(item.feedQuantity);
  296. }
  297. });
  298. console.log("合格数量:" + formedNum, "不合格数量:" + notFormedNum);
  299. this.$set(this.item.workReportInfo, "formedNum", formedNum);
  300. this.$set(this.item.workReportInfo, "notFormedNum", notFormedNum);
  301. // console.log(this.item.workReportInfo);
  302. this.item.workReportInfo = this.deepCopy(this.item.workReportInfo);
  303. this.$forceUpdate();
  304. }
  305. // if (
  306. // this.clientEnvironmentId == 3 &&
  307. // newVal.semiProductList &&
  308. // newVal.semiProductList.length != 0
  309. // ) {
  310. // let formedNum = 0;
  311. // let notFormedNum = 0;
  312. // newVal.semiProductList.forEach((item) => {
  313. // if (
  314. // !item.extInfo.isQualified ||
  315. // item.extInfo.isQualified == 1 ||
  316. // item.extInfo.isQualified == 3
  317. // ) {
  318. // formedNum = formedNum + Number(item.feedQuantity);
  319. // } else {
  320. // notFormedNum = notFormedNum + Number(item.feedQuantity);
  321. // }
  322. // });
  323. // console.log("合格数量:" + formedNum, "不合格数量:" + notFormedNum);
  324. // this.$set(this.item.workReportInfo, "formedNum", formedNum);
  325. // this.$set(this.item.workReportInfo, "notFormedNum", notFormedNum);
  326. // this.item.workReportInfo = this.deepCopy(this.item.workReportInfo);
  327. // this.$forceUpdate();
  328. // }
  329. // if (!this.currentTaskDiagram.isFirstTask) {
  330. // this.getSemiProductList(newVal);
  331. // }
  332. },
  333. },
  334. },
  335. components: { semiProductJobBomPL, batchProductJobBom },
  336. data() {
  337. return {
  338. forValue: {},
  339. tableData: [],
  340. batchNo: "",
  341. notFormedList: [],
  342. clientEnvironmentId:
  343. uni.getStorageSync("userInfo") &&
  344. uni.getStorageSync("userInfo").clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  345. };
  346. },
  347. created() {
  348. console.log(this.item, "item13131223223");
  349. // this.item.product = this.item.pickOutInList;
  350. let newList = [];
  351. if (
  352. this.item.pickOutInList.length != 0 &&
  353. this.item.product.length == 0 &&
  354. this.item.currentTaskDiagram.type == 6
  355. ) {
  356. this.item.pickOutInList.forEach((item) => {
  357. const data = this.deepCopy(item);
  358. newList.push(data);
  359. });
  360. this.$set(this.item, "product", newList);
  361. }
  362. // this.item.product.push(...newList);
  363. // console.log(this.item.product, "this.item.product");
  364. // this.item.pickOutInList = [];
  365. // this.$set(this.item, "product", ...newList);
  366. // this.$set(this.item, "pickOutInList", []);
  367. // }
  368. if (this.isDetails) {
  369. this.notFormedList = this.notFormedList.map((m) => {
  370. return {
  371. notFormedNum: Number(m.quantity),
  372. notFormedWeight: m.weight,
  373. ...m,
  374. };
  375. });
  376. }
  377. this.getByCode();
  378. },
  379. methods: {
  380. tableDataFn(tableData) {
  381. console.log(tableData);
  382. let adultCount = 0;
  383. let noAdultCount = 0;
  384. this.arrDataStatistics(tableData);
  385. tableData.forEach((v) => {
  386. if (v.selected) {
  387. console.log(11111);
  388. if (v.extInfo.isQualified == 1) {
  389. adultCount += 1;
  390. } else {
  391. noAdultCount += 1;
  392. }
  393. }
  394. });
  395. this.$set(this.item.workReportInfo, "formedNum", adultCount);
  396. this.$set(this.item.workReportInfo, "notFormedNum", noAdultCount);
  397. // this.tableData = this.notFormedList;
  398. if (!(this.clientEnvironmentId == 3 || this.item.singleReport !== 1)) {
  399. this.item.semiProductList = tableData;
  400. }
  401. },
  402. deepCopy(obj, hash = new WeakMap()) {
  403. if (obj === null) return null;
  404. if (obj instanceof Date) return new Date(obj);
  405. if (obj instanceof RegExp) return new RegExp(obj);
  406. if (typeof obj !== "object" && typeof obj !== "function") return obj;
  407. if (hash.has(obj)) return hash.get(obj);
  408. const result = Array.isArray(obj) ? [] : {};
  409. hash.set(obj, result);
  410. return Object.keys(obj).reduce((acc, key) => {
  411. acc[key] = this.deepCopy(obj[key], hash);
  412. return acc;
  413. }, result);
  414. },
  415. arrDataStatistics(arr) {
  416. console.log(arr);
  417. const adultCount = arr.filter(
  418. (user) => user.extInfo.isQualified == 1
  419. ).length;
  420. const noAdultCount = arr.filter(
  421. (user) => user.extInfo.isQualified !== 1
  422. ).length;
  423. console.log(adultCount, noAdultCount);
  424. this.$set(this.item.workReportInfo, "formedNum", adultCount);
  425. this.$set(this.item.workReportInfo, "notFormedNum", noAdultCount);
  426. },
  427. getByCode() {
  428. parameterGetByCode({ code: "enable_quality_plus" }).then((res) => {
  429. if (
  430. res.value == "1" &&
  431. (this.item.currentTaskDiagram.type == 6 ||
  432. this.item.currentTaskDiagram.type == 2 ||
  433. this.item.currentTaskDiagram.type == 2)
  434. ) {
  435. uni.showModal({
  436. title: "提示",
  437. content: "质检需要去PC端进行",
  438. success: function (res) {
  439. if (res.confirm) {
  440. console.log("用户点击确定");
  441. } else if (res.cancel) {
  442. console.log("用户点击取消");
  443. }
  444. },
  445. });
  446. }
  447. });
  448. },
  449. getSemiProductList(newVal) {
  450. console.log(newVal);
  451. if (newVal.semiProductList.length) {
  452. newVal.semiProductList.map((v) => {
  453. v.selected = true;
  454. });
  455. this.arrDataStatistics(newVal.semiProductList);
  456. this.tableData = newVal.semiProductList;
  457. }
  458. if (newVal.pickOutInList.length) {
  459. newVal.pickOutInList.map((v) => {
  460. v.selected = true;
  461. });
  462. this.arrDataStatistics(newVal.pickOutInList);
  463. this.tableData = newVal.pickOutInList;
  464. }
  465. },
  466. singleBatch() {
  467. console.log(this.item.workReportInfo, "11111111");
  468. if (!this.item.workReportInfo.formedNum)
  469. return uni.showToast({
  470. icon: "none",
  471. title: "请输入合格品数",
  472. });
  473. // if (
  474. // !this.item.workReportInfo.notFormedNum ||
  475. // this.item.workReportInfo.notFormedNum != 0
  476. // )
  477. // return uni.showToast({
  478. // icon: "none",
  479. // title: "请输入不合格品数",
  480. // });
  481. const req = {
  482. formedNum: this.item.workReportInfo.formedNum,
  483. notFormedNum: this.item.workReportInfo.notFormedNum || 0,
  484. taskId: this.item.workReportInfo.taskId,
  485. workOrderId: this.item.workReportInfo.workOrderId,
  486. };
  487. createInProductBatch(req).then((res) => {
  488. if (res && res.length) {
  489. this.forValue = res[0];
  490. res.map((v) => {
  491. v.selected = true;
  492. });
  493. this.tableData = res;
  494. this.item.product = res;
  495. console.log(this.item);
  496. }
  497. });
  498. },
  499. singleBatchTg() {
  500. if (!this.item.workReportInfo.formedNum)
  501. return uni.showToast({
  502. icon: "none",
  503. title: "请输入合格品数",
  504. });
  505. // if (
  506. // !this.item.workReportInfo.notFormedNum ||
  507. // this.item.workReportInfo.notFormedNum != 0
  508. // )
  509. // return uni.showToast({
  510. // icon: "none",
  511. // title: "请输入不合格品数",
  512. // });
  513. const req = {
  514. formedNum: this.item.workReportInfo.formedNum,
  515. notFormedNum: this.item.workReportInfo.notFormedNum || 0,
  516. taskId: this.item.workReportInfo.taskId,
  517. workOrderId: this.item.workReportInfo.workOrderId,
  518. };
  519. createInProductBatchTG(req).then((res) => {
  520. if (res && res.length) {
  521. this.forValue = res[0];
  522. res.map((v) => {
  523. v.selected = true;
  524. v.extInfo.batchReportInfo = [
  525. {
  526. allFeedQuantity: "",
  527. allReportWeight: "",
  528. taskId: "",
  529. taskName: "",
  530. },
  531. ];
  532. v.extInfo.notBatchReportInfo = [
  533. {
  534. allFeedQuantity: "",
  535. notType: "",
  536. taskId: "",
  537. taskName: "",
  538. notReason: "",
  539. },
  540. ];
  541. });
  542. this.list = res;
  543. this.item.semiProductList = res;
  544. }
  545. });
  546. // console.log(this.item, "this.itemthis.itemthis.itemthis.item12121");
  547. },
  548. /**
  549. * 更新批次号
  550. *
  551. * @param e 事件对象
  552. */
  553. batchNoNew(e) {
  554. this.item.workReportInfo.batchNo = this.item.batchNo + e.target.value;
  555. },
  556. setFormedNum(num) {
  557. this.item.workReportInfo.formedNum = num;
  558. let weight =
  559. Number(this.item.workReportInfo.formedNum) *
  560. Number(this.item.singleWeight) *
  561. Number(this.item.weightMultiple);
  562. if (["G", "g", "克"].includes(this.item.singleWeightUnit)) {
  563. weight = parseFloat((weight / 1000).toFixed(2));
  564. } else {
  565. weight = parseFloat(weight.toFixed(2));
  566. }
  567. this.$set(this.item.workReportInfo, "formedWeight", weight);
  568. this.$forceUpdate();
  569. },
  570. penalize() {
  571. this.$emit("penalize", null);
  572. },
  573. handleView(name) {
  574. uni.showToast({
  575. icon: "none",
  576. title: name || "未设置",
  577. });
  578. },
  579. blurNum(value) {
  580. let total = 0;
  581. //匹配非数字
  582. let val = value.formedNum;
  583. let reg = new RegExp("([^0-9]*)", "g");
  584. let ma = val.match(reg);
  585. //如果有非数字,替换成""
  586. if (ma.length > 0) {
  587. for (let k in ma) {
  588. if (ma[k] != "") {
  589. val = val.replace(ma[k], 0);
  590. }
  591. }
  592. }
  593. //可以为0,但不能以0开头
  594. if (val.startsWith("0") && val.length > 1) {
  595. val = val.substring(1, val.length);
  596. }
  597. value.formedNum = val;
  598. if (this.item.currentTaskDiagram.isFirstTask) {
  599. // formingNum 生产数量 feedQuantity this.item.product[0] //投料数量
  600. if (value.formedNum > this.item.formingNum) {
  601. this.$set(
  602. this.item.workReportInfo,
  603. "workReportInfo",
  604. this.item.formingNum
  605. );
  606. this.$set(this.item.workReportInfo, "notFormedNum", 0);
  607. this.notForme();
  608. return uni.showToast({
  609. icon: "none",
  610. title: "合格品数量不能大于要求生产数量",
  611. });
  612. }
  613. } else {
  614. if (this.item.product.length) {
  615. const feedNumber = this.item.product.reduce((acc, pre) => {
  616. return pre.feedQuantity ? acc + Number(pre.feedQuantity) : acc;
  617. }, 0);
  618. console.log(this.item, "this.item.product");
  619. if (value.formedNum > feedNumber) {
  620. this.$set(this.item.workReportInfo, "formedNum", feedNumber);
  621. this.$set(this.item.workReportInfo, "notFormedNum", 0);
  622. return uni.showToast({
  623. icon: "none",
  624. title: "合格品数量不能大于投料数量",
  625. });
  626. }
  627. // if (value.formedNum > this.item.product[0].feedQuantity) {
  628. // console.log(this.item.product[0].feedQuantity);
  629. // this.$set(
  630. // this.item.workReportInfo,
  631. // "workReportInfo",
  632. // this.item.product[0].feedQuantity
  633. // );
  634. // this.$set(this.notFormedList[0], "notFormedNum", 0);
  635. // this.notForme();
  636. // return uni.showToast({
  637. // icon: "none",
  638. // title: "合格品数量不能大于投料数量",
  639. // });
  640. // }
  641. }
  642. }
  643. console.log(
  644. Number(this.item.workReportInfo.formedNum),
  645. "Number(this.item.workReportInfo.feedQuantity)"
  646. );
  647. console.log(Number(value.formedNum), "Number(value.formedNum)");
  648. if (
  649. this.item.product[0] &&
  650. this.item.product[0].feedQuantity > 0 &&
  651. Number(this.item.workReportInfo.formedNum)
  652. ) {
  653. console.log("555555");
  654. this.$set(
  655. this.notFormedList[0],
  656. "notFormedNum",
  657. Number(value.formedNum) - Number(this.item.workReportInfo.formedNum)
  658. );
  659. this.notForme();
  660. }
  661. let weight =
  662. Number(this.item.workReportInfo.formedNum) *
  663. Number(this.item.singleWeight) *
  664. Number(this.item.weightMultiple);
  665. if (["G", "g", "克"].includes(this.item.singleWeightUnit)) {
  666. weight = parseFloat((weight / 1000).toFixed(2));
  667. } else {
  668. weight = parseFloat(weight.toFixed(2));
  669. }
  670. this.$set(this.item.workReportInfo, "formedWeight", weight);
  671. total =
  672. Number(this.item.workReportInfo.formedNum) +
  673. Number(this.item.workReportInfo.notFormedNum);
  674. console.log(total);
  675. this.$emit("modeNum", total);
  676. this.$forceUpdate();
  677. },
  678. notForme() {
  679. let weight =
  680. Number(this.item.workReportInfo.notFormedNum) *
  681. Number(this.item.singleWeight) *
  682. Number(this.item.weightMultiple);
  683. if (
  684. this.item.singleWeightUnit == "G" ||
  685. this.item.singleWeightUnit == "g" ||
  686. this.item.singleWeightUnit == "克"
  687. ) {
  688. weight = parseFloat((weight / 1000).toFixed(2));
  689. } else {
  690. weight = parseFloat(weight.toFixed(2));
  691. }
  692. this.$set(this.item.workReportInfo, "notFormedWeight", weight);
  693. // if (
  694. // this.item.product[0] &&
  695. // this.item.product[0].feedQuantity > 0 &&
  696. // Number(this.notFormedList[0].notFormedNum)
  697. // ) {
  698. // this.$set(
  699. // this.item.workReportInfo,
  700. // "formedNum",
  701. // this.item.product[0].feedQuantity -
  702. // Number(this.notFormedList[0].notFormedNum)
  703. // );
  704. // let weight =
  705. // Number(this.item.workReportInfo.formedNum) *
  706. // Number(this.item.singleWeight) *
  707. // Number(this.item.weightMultiple);
  708. // if (
  709. // this.item.singleWeightUnit == "G" ||
  710. // this.item.singleWeightUnit == "g" ||
  711. // this.item.singleWeightUnit == "克"
  712. // ) {
  713. // weight = parseFloat((weight / 1000).toFixed(2));
  714. // } else {
  715. // weight = parseFloat(weight.toFixed(2));
  716. // }
  717. // this.$set(this.item.workReportInfo, "formedWeight", weight);
  718. // }
  719. this.$forceUpdate();
  720. },
  721. changeNum(value) {
  722. // 不合格数量
  723. let val = value;
  724. //匹配非数字
  725. let reg = new RegExp("([^0-9]*)", "g");
  726. let ma = val.match(reg);
  727. //如果有非数字,替换成""
  728. if (ma.length > 0) {
  729. for (let k in ma) {
  730. if (ma[k] != "") {
  731. val = val.replace(ma[k], "0");
  732. }
  733. }
  734. }
  735. //可以为0,但不能以0开头
  736. if (val.startsWith("0") && val.length > 1) {
  737. val = val.substring(1, val.length);
  738. }
  739. // this.$set(this.item.workReportInfo, 'formedNum', val)
  740. value = val;
  741. console.log(Number(this.item.workReportInfo.formedNum), 1);
  742. console.log(Number(this.item.workReportInfo.notFormedNum), 2);
  743. let total =
  744. Number(this.item.workReportInfo.formedNum) +
  745. Number(this.item.workReportInfo.notFormedNum);
  746. console.log(total);
  747. this.$emit("modeNum", total);
  748. this.notForme();
  749. // this.blurNum()
  750. },
  751. },
  752. };
  753. </script>
  754. <style lang="scss" scoped>
  755. .unit-btn {
  756. background-color: #157a2c;
  757. height: 48rpx;
  758. padding: 0 20rpx;
  759. line-height: 48rpx;
  760. color: #fff;
  761. font-size: 12px;
  762. }
  763. .content_num {
  764. display: flex;
  765. align-items: center;
  766. padding: 0 4rpx;
  767. font-size: 26rpx !important;
  768. /deep/ .uni-input-input {
  769. border: 2rpx solid #f0f8f2;
  770. background: #f0f8f2;
  771. color: $theme-color;
  772. }
  773. }
  774. .item {
  775. display: flex;
  776. justify-content: space-between;
  777. }
  778. .title_box {
  779. margin-top: 20rpx;
  780. .name {
  781. font-size: 28rpx;
  782. font-style: normal;
  783. font-weight: 400;
  784. color: $theme-color;
  785. padding-left: 20rpx;
  786. position: relative;
  787. &:before {
  788. position: absolute;
  789. content: "";
  790. left: 0rpx;
  791. top: 0rpx;
  792. bottom: 0rpx;
  793. width: 4rpx;
  794. height: 28rpx;
  795. background: $theme-color;
  796. margin: auto;
  797. }
  798. }
  799. }
  800. .material {
  801. margin-top: 10rpx;
  802. .content_table {
  803. width: 100%;
  804. border: 2rpx solid $border-color;
  805. .item {
  806. display: flex;
  807. border-bottom: 2rpx solid $border-color;
  808. .lable {
  809. width: 132rpx;
  810. text-align: center;
  811. background-color: #f7f9fa;
  812. font-size: 26rpx;
  813. border-right: 2rpx solid $border-color;
  814. flex-shrink: 0;
  815. }
  816. .lable220 {
  817. width: 220rpx !important;
  818. font-size: 24rpx;
  819. }
  820. .lable150 {
  821. width: 156rpx !important;
  822. font-size: 24rpx;
  823. }
  824. .ww80 {
  825. width: 80rpx;
  826. }
  827. .content {
  828. width: 518rpx;
  829. min-height: 64rpx;
  830. font-size: 28rpx;
  831. line-height: 28rpx;
  832. font-style: normal;
  833. font-weight: 400;
  834. padding: 18rpx 8rpx;
  835. box-sizing: border-box;
  836. word-wrap: break-word;
  837. flex-grow: 1 !important;
  838. .unit {
  839. padding: 0 4rpx;
  840. font-size: 24rpx;
  841. color: #404446;
  842. }
  843. .penalize {
  844. width: 160rpx;
  845. line-height: 60rpx;
  846. background: $theme-color;
  847. font-size: 24rpx;
  848. text-align: center;
  849. color: #fff;
  850. }
  851. }
  852. .pd4 {
  853. padding: 4rpx 8rpx;
  854. }
  855. &:last-child {
  856. border-bottom: none;
  857. }
  858. }
  859. .ww55 {
  860. width: 55%;
  861. }
  862. .ww45 {
  863. width: 45%;
  864. }
  865. }
  866. }
  867. </style>