batchJobBom.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947
  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 (!this.currentTaskDiagram.isFirstTask) {
  306. // this.getSemiProductList(newVal);
  307. // }
  308. },
  309. },
  310. },
  311. components: { semiProductJobBomPL, batchProductJobBom },
  312. data() {
  313. return {
  314. forValue: {},
  315. tableData: [],
  316. batchNo: "",
  317. notFormedList: [],
  318. clientEnvironmentId:
  319. uni.getStorageSync("userInfo") &&
  320. uni.getStorageSync("userInfo").clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  321. };
  322. },
  323. created() {
  324. console.log(this.item, "item13131223223");
  325. // this.item.product = this.item.pickOutInList;
  326. let newList = [];
  327. if (
  328. this.item.pickOutInList.length != 0 &&
  329. this.item.product.length == 0 &&
  330. this.item.currentTaskDiagram.type == 6
  331. ) {
  332. this.item.pickOutInList.forEach((item) => {
  333. const data = this.deepCopy(item);
  334. newList.push(data);
  335. });
  336. this.$set(this.item, "product", newList);
  337. }
  338. // this.item.product.push(...newList);
  339. // console.log(this.item.product, "this.item.product");
  340. // this.item.pickOutInList = [];
  341. // this.$set(this.item, "product", ...newList);
  342. // this.$set(this.item, "pickOutInList", []);
  343. // }
  344. if (this.isDetails) {
  345. this.notFormedList = this.notFormedList.map((m) => {
  346. return {
  347. notFormedNum: Number(m.quantity),
  348. notFormedWeight: m.weight,
  349. ...m,
  350. };
  351. });
  352. }
  353. this.getByCode();
  354. },
  355. methods: {
  356. tableDataFn(tableData) {
  357. console.log(tableData);
  358. let adultCount = 0;
  359. let noAdultCount = 0;
  360. this.arrDataStatistics(tableData);
  361. tableData.forEach((v) => {
  362. if (v.selected) {
  363. console.log(11111);
  364. if (v.extInfo.isQualified == 1) {
  365. adultCount += 1;
  366. } else {
  367. noAdultCount += 1;
  368. }
  369. }
  370. });
  371. this.$set(this.item.workReportInfo, "formedNum", adultCount);
  372. this.$set(this.item.workReportInfo, "notFormedNum", noAdultCount);
  373. // this.tableData = this.notFormedList;
  374. if (!(this.clientEnvironmentId == 3 || this.item.singleReport !== 1)) {
  375. this.item.semiProductList = tableData;
  376. }
  377. },
  378. deepCopy(obj, hash = new WeakMap()) {
  379. if (obj === null) return null;
  380. if (obj instanceof Date) return new Date(obj);
  381. if (obj instanceof RegExp) return new RegExp(obj);
  382. if (typeof obj !== "object" && typeof obj !== "function") return obj;
  383. if (hash.has(obj)) return hash.get(obj);
  384. const result = Array.isArray(obj) ? [] : {};
  385. hash.set(obj, result);
  386. return Object.keys(obj).reduce((acc, key) => {
  387. acc[key] = this.deepCopy(obj[key], hash);
  388. return acc;
  389. }, result);
  390. },
  391. arrDataStatistics(arr) {
  392. console.log(arr);
  393. const adultCount = arr.filter(
  394. (user) => user.extInfo.isQualified == 1
  395. ).length;
  396. const noAdultCount = arr.filter(
  397. (user) => user.extInfo.isQualified !== 1
  398. ).length;
  399. console.log(adultCount, noAdultCount);
  400. this.$set(this.item.workReportInfo, "formedNum", adultCount);
  401. this.$set(this.item.workReportInfo, "notFormedNum", noAdultCount);
  402. },
  403. getByCode() {
  404. parameterGetByCode({ code: "enable_quality_plus" }).then((res) => {
  405. if (
  406. res.value == "1" &&
  407. (this.item.currentTaskDiagram.type == 6 ||
  408. this.item.currentTaskDiagram.type == 2 ||
  409. this.item.currentTaskDiagram.type == 2)
  410. ) {
  411. uni.showModal({
  412. title: "提示",
  413. content: "质检需要去PC端进行",
  414. success: function (res) {
  415. if (res.confirm) {
  416. console.log("用户点击确定");
  417. } else if (res.cancel) {
  418. console.log("用户点击取消");
  419. }
  420. },
  421. });
  422. }
  423. });
  424. },
  425. getSemiProductList(newVal) {
  426. console.log(newVal);
  427. if (newVal.semiProductList.length) {
  428. newVal.semiProductList.map((v) => {
  429. v.selected = true;
  430. });
  431. this.arrDataStatistics(newVal.semiProductList);
  432. this.tableData = newVal.semiProductList;
  433. }
  434. if (newVal.pickOutInList.length) {
  435. newVal.pickOutInList.map((v) => {
  436. v.selected = true;
  437. });
  438. this.arrDataStatistics(newVal.pickOutInList);
  439. this.tableData = newVal.pickOutInList;
  440. }
  441. },
  442. singleBatch() {
  443. console.log(this.item.workReportInfo, "11111111");
  444. if (!this.item.workReportInfo.formedNum)
  445. return uni.showToast({
  446. icon: "none",
  447. title: "请输入合格品数",
  448. });
  449. // if (
  450. // !this.item.workReportInfo.notFormedNum ||
  451. // this.item.workReportInfo.notFormedNum != 0
  452. // )
  453. // return uni.showToast({
  454. // icon: "none",
  455. // title: "请输入不合格品数",
  456. // });
  457. const req = {
  458. formedNum: this.item.workReportInfo.formedNum,
  459. notFormedNum: this.item.workReportInfo.notFormedNum || 0,
  460. taskId: this.item.workReportInfo.taskId,
  461. workOrderId: this.item.workReportInfo.workOrderId,
  462. };
  463. createInProductBatch(req).then((res) => {
  464. if (res && res.length) {
  465. this.forValue = res[0];
  466. res.map((v) => {
  467. v.selected = true;
  468. });
  469. this.tableData = res;
  470. this.item.product = res;
  471. console.log(this.item);
  472. }
  473. });
  474. },
  475. singleBatchTg() {
  476. if (!this.item.workReportInfo.formedNum)
  477. return uni.showToast({
  478. icon: "none",
  479. title: "请输入合格品数",
  480. });
  481. // if (
  482. // !this.item.workReportInfo.notFormedNum ||
  483. // this.item.workReportInfo.notFormedNum != 0
  484. // )
  485. // return uni.showToast({
  486. // icon: "none",
  487. // title: "请输入不合格品数",
  488. // });
  489. const req = {
  490. formedNum: this.item.workReportInfo.formedNum,
  491. notFormedNum: this.item.workReportInfo.notFormedNum || 0,
  492. taskId: this.item.workReportInfo.taskId,
  493. workOrderId: this.item.workReportInfo.workOrderId,
  494. };
  495. createInProductBatchTG(req).then((res) => {
  496. if (res && res.length) {
  497. this.forValue = res[0];
  498. res.map((v) => {
  499. v.selected = true;
  500. v.extInfo.batchReportInfo = [
  501. {
  502. allFeedQuantity: "",
  503. allReportWeight: "",
  504. taskId: "",
  505. taskName: "",
  506. },
  507. ];
  508. v.extInfo.notBatchReportInfo = [
  509. {
  510. allFeedQuantity: "",
  511. notType: "",
  512. taskId: "",
  513. taskName: "",
  514. notReason: "",
  515. },
  516. ];
  517. });
  518. this.list = res;
  519. this.item.semiProductList = res;
  520. }
  521. });
  522. // console.log(this.item, "this.itemthis.itemthis.itemthis.item12121");
  523. },
  524. /**
  525. * 更新批次号
  526. *
  527. * @param e 事件对象
  528. */
  529. batchNoNew(e) {
  530. this.item.workReportInfo.batchNo = this.item.batchNo + e.target.value;
  531. },
  532. setFormedNum(num) {
  533. this.item.workReportInfo.formedNum = num;
  534. let weight =
  535. Number(this.item.workReportInfo.formedNum) *
  536. Number(this.item.singleWeight) *
  537. Number(this.item.weightMultiple);
  538. if (["G", "g", "克"].includes(this.item.singleWeightUnit)) {
  539. weight = parseFloat((weight / 1000).toFixed(2));
  540. } else {
  541. weight = parseFloat(weight.toFixed(2));
  542. }
  543. this.$set(this.item.workReportInfo, "formedWeight", weight);
  544. this.$forceUpdate();
  545. },
  546. penalize() {
  547. this.$emit("penalize", null);
  548. },
  549. handleView(name) {
  550. uni.showToast({
  551. icon: "none",
  552. title: name || "未设置",
  553. });
  554. },
  555. blurNum(value) {
  556. let total = 0;
  557. //匹配非数字
  558. let val = value.formedNum;
  559. let reg = new RegExp("([^0-9]*)", "g");
  560. let ma = val.match(reg);
  561. //如果有非数字,替换成""
  562. if (ma.length > 0) {
  563. for (let k in ma) {
  564. if (ma[k] != "") {
  565. val = val.replace(ma[k], 0);
  566. }
  567. }
  568. }
  569. //可以为0,但不能以0开头
  570. if (val.startsWith("0") && val.length > 1) {
  571. val = val.substring(1, val.length);
  572. }
  573. value.formedNum = val;
  574. if (this.item.currentTaskDiagram.isFirstTask) {
  575. // formingNum 生产数量 feedQuantity this.item.product[0] //投料数量
  576. if (value.formedNum > this.item.formingNum) {
  577. this.$set(
  578. this.item.workReportInfo,
  579. "workReportInfo",
  580. this.item.formingNum
  581. );
  582. this.$set(this.item.workReportInfo, "notFormedNum", 0);
  583. this.notForme();
  584. return uni.showToast({
  585. icon: "none",
  586. title: "合格品数量不能大于要求生产数量",
  587. });
  588. }
  589. } else {
  590. if (this.item.product.length) {
  591. const feedNumber = this.item.product.reduce((acc, pre) => {
  592. return pre.feedQuantity ? acc + Number(pre.feedQuantity) : acc;
  593. }, 0);
  594. console.log(this.item, "this.item.product");
  595. if (value.formedNum > feedNumber) {
  596. this.$set(this.item.workReportInfo, "formedNum", feedNumber);
  597. this.$set(this.item.workReportInfo, "notFormedNum", 0);
  598. return uni.showToast({
  599. icon: "none",
  600. title: "合格品数量不能大于投料数量",
  601. });
  602. }
  603. // if (value.formedNum > this.item.product[0].feedQuantity) {
  604. // console.log(this.item.product[0].feedQuantity);
  605. // this.$set(
  606. // this.item.workReportInfo,
  607. // "workReportInfo",
  608. // this.item.product[0].feedQuantity
  609. // );
  610. // this.$set(this.notFormedList[0], "notFormedNum", 0);
  611. // this.notForme();
  612. // return uni.showToast({
  613. // icon: "none",
  614. // title: "合格品数量不能大于投料数量",
  615. // });
  616. // }
  617. }
  618. }
  619. console.log(
  620. Number(this.item.workReportInfo.formedNum),
  621. "Number(this.item.workReportInfo.feedQuantity)"
  622. );
  623. console.log(Number(value.formedNum), "Number(value.formedNum)");
  624. if (
  625. this.item.product[0] &&
  626. this.item.product[0].feedQuantity > 0 &&
  627. Number(this.item.workReportInfo.formedNum)
  628. ) {
  629. console.log("555555");
  630. this.$set(
  631. this.notFormedList[0],
  632. "notFormedNum",
  633. Number(value.formedNum) - Number(this.item.workReportInfo.formedNum)
  634. );
  635. this.notForme();
  636. }
  637. let weight =
  638. Number(this.item.workReportInfo.formedNum) *
  639. Number(this.item.singleWeight) *
  640. Number(this.item.weightMultiple);
  641. if (["G", "g", "克"].includes(this.item.singleWeightUnit)) {
  642. weight = parseFloat((weight / 1000).toFixed(2));
  643. } else {
  644. weight = parseFloat(weight.toFixed(2));
  645. }
  646. this.$set(this.item.workReportInfo, "formedWeight", weight);
  647. total =
  648. Number(this.item.workReportInfo.formedNum) +
  649. Number(this.item.workReportInfo.notFormedNum);
  650. console.log(total);
  651. this.$emit("modeNum", total);
  652. this.$forceUpdate();
  653. },
  654. notForme() {
  655. let weight =
  656. Number(this.item.workReportInfo.notFormedNum) *
  657. Number(this.item.singleWeight) *
  658. Number(this.item.weightMultiple);
  659. if (
  660. this.item.singleWeightUnit == "G" ||
  661. this.item.singleWeightUnit == "g" ||
  662. this.item.singleWeightUnit == "克"
  663. ) {
  664. weight = parseFloat((weight / 1000).toFixed(2));
  665. } else {
  666. weight = parseFloat(weight.toFixed(2));
  667. }
  668. this.$set(this.item.workReportInfo, "notFormedWeight", weight);
  669. // if (
  670. // this.item.product[0] &&
  671. // this.item.product[0].feedQuantity > 0 &&
  672. // Number(this.notFormedList[0].notFormedNum)
  673. // ) {
  674. // this.$set(
  675. // this.item.workReportInfo,
  676. // "formedNum",
  677. // this.item.product[0].feedQuantity -
  678. // Number(this.notFormedList[0].notFormedNum)
  679. // );
  680. // let weight =
  681. // Number(this.item.workReportInfo.formedNum) *
  682. // Number(this.item.singleWeight) *
  683. // Number(this.item.weightMultiple);
  684. // if (
  685. // this.item.singleWeightUnit == "G" ||
  686. // this.item.singleWeightUnit == "g" ||
  687. // this.item.singleWeightUnit == "克"
  688. // ) {
  689. // weight = parseFloat((weight / 1000).toFixed(2));
  690. // } else {
  691. // weight = parseFloat(weight.toFixed(2));
  692. // }
  693. // this.$set(this.item.workReportInfo, "formedWeight", weight);
  694. // }
  695. this.$forceUpdate();
  696. },
  697. changeNum(value) {
  698. // 不合格数量
  699. let val = value;
  700. //匹配非数字
  701. let reg = new RegExp("([^0-9]*)", "g");
  702. let ma = val.match(reg);
  703. //如果有非数字,替换成""
  704. if (ma.length > 0) {
  705. for (let k in ma) {
  706. if (ma[k] != "") {
  707. val = val.replace(ma[k], "0");
  708. }
  709. }
  710. }
  711. //可以为0,但不能以0开头
  712. if (val.startsWith("0") && val.length > 1) {
  713. val = val.substring(1, val.length);
  714. }
  715. // this.$set(this.item.workReportInfo, 'formedNum', val)
  716. value = val;
  717. console.log(Number(this.item.workReportInfo.formedNum), 1);
  718. console.log(Number(this.item.workReportInfo.notFormedNum), 2);
  719. let total =
  720. Number(this.item.workReportInfo.formedNum) +
  721. Number(this.item.workReportInfo.notFormedNum);
  722. console.log(total);
  723. this.$emit("modeNum", total);
  724. this.notForme();
  725. // this.blurNum()
  726. },
  727. },
  728. };
  729. </script>
  730. <style lang="scss" scoped>
  731. .unit-btn {
  732. background-color: #157a2c;
  733. height: 48rpx;
  734. padding: 0 20rpx;
  735. line-height: 48rpx;
  736. color: #fff;
  737. }
  738. .content_num {
  739. display: flex;
  740. align-items: center;
  741. padding: 0 4rpx;
  742. font-size: 26rpx !important;
  743. /deep/ .uni-input-input {
  744. border: 2rpx solid #f0f8f2;
  745. background: #f0f8f2;
  746. color: $theme-color;
  747. }
  748. }
  749. .item {
  750. display: flex;
  751. justify-content: space-between;
  752. }
  753. .title_box {
  754. margin-top: 20rpx;
  755. .name {
  756. font-size: 28rpx;
  757. font-style: normal;
  758. font-weight: 400;
  759. color: $theme-color;
  760. padding-left: 20rpx;
  761. position: relative;
  762. &:before {
  763. position: absolute;
  764. content: "";
  765. left: 0rpx;
  766. top: 0rpx;
  767. bottom: 0rpx;
  768. width: 4rpx;
  769. height: 28rpx;
  770. background: $theme-color;
  771. margin: auto;
  772. }
  773. }
  774. }
  775. .material {
  776. margin-top: 10rpx;
  777. .content_table {
  778. width: 100%;
  779. border: 2rpx solid $border-color;
  780. .item {
  781. display: flex;
  782. border-bottom: 2rpx solid $border-color;
  783. .lable {
  784. width: 132rpx;
  785. text-align: center;
  786. background-color: #f7f9fa;
  787. font-size: 26rpx;
  788. border-right: 2rpx solid $border-color;
  789. flex-shrink: 0;
  790. }
  791. .lable220 {
  792. width: 220rpx !important;
  793. font-size: 24rpx;
  794. }
  795. .lable150 {
  796. width: 156rpx !important;
  797. font-size: 24rpx;
  798. }
  799. .ww80 {
  800. width: 80rpx;
  801. }
  802. .content {
  803. width: 518rpx;
  804. min-height: 64rpx;
  805. font-size: 28rpx;
  806. line-height: 28rpx;
  807. font-style: normal;
  808. font-weight: 400;
  809. padding: 18rpx 8rpx;
  810. box-sizing: border-box;
  811. word-wrap: break-word;
  812. flex-grow: 1 !important;
  813. .unit {
  814. padding: 0 4rpx;
  815. font-size: 24rpx;
  816. color: #404446;
  817. }
  818. .penalize {
  819. width: 160rpx;
  820. line-height: 60rpx;
  821. background: $theme-color;
  822. font-size: 24rpx;
  823. text-align: center;
  824. color: #fff;
  825. }
  826. }
  827. .pd4 {
  828. padding: 4rpx 8rpx;
  829. }
  830. &:last-child {
  831. border-bottom: none;
  832. }
  833. }
  834. .ww55 {
  835. width: 55%;
  836. }
  837. .ww45 {
  838. width: 45%;
  839. }
  840. }
  841. }
  842. </style>