Heating.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. <template>
  2. <el-form
  3. class="form-no-message"
  4. ref="formRef"
  5. :show-message="false"
  6. label-position="left"
  7. :model="{
  8. categoryMsg,
  9. ...workReport
  10. }"
  11. >
  12. <div class="message-box">
  13. <ul>
  14. <li> <span class="label">报工次数</span>{{ countMsg.reportNum }}</li>
  15. <li>
  16. <span class="label">累计合格品数量</span
  17. >{{ countMsg.standardTotalNum }}</li
  18. >
  19. <li>
  20. <span class="label">累计合格品重量</span
  21. >{{ countMsg.standardTotalWeight }}KG</li
  22. >
  23. <li>
  24. <span class="label">累计投料产品数量</span
  25. >{{ countMsg.feedProductWeight }}</li
  26. >
  27. </ul>
  28. <div class="right">
  29. <el-form-item
  30. label="执行人工号"
  31. prop="executorId"
  32. required
  33. label-width="100px"
  34. ><personSelectRemote
  35. v-model="workReport.executorId"
  36. placeholder="请输入"
  37. @selfChange="
  38. (val, item) => (workReport.executorJobNum = item.jobNumber)
  39. "
  40. /></el-form-item>
  41. <el-form-item
  42. label="执行日期"
  43. required
  44. prop="executeTime"
  45. label-width="100px"
  46. ><el-date-picker
  47. v-model="workReport.executeTime"
  48. value-format="yyyy-MM-dd HH:mm:ss"
  49. type="datetime"
  50. format="yyyy-MM-dd HH:mm:ss"
  51. placeholder="请选择"
  52. :disabled="formData.dateType == 2"
  53. ></el-date-picker
  54. ></el-form-item>
  55. </div>
  56. </div>
  57. <el-card>
  58. <el-descriptions title="报工信息" direction="vertical" :column="7" border>
  59. <el-descriptions-item label="">
  60. <span class="label-required after" slot="label">投料数量(PCS)</span>
  61. <el-form-item
  62. label=""
  63. label-width="0"
  64. required
  65. class="w100"
  66. prop="categoryMsg.number"
  67. >
  68. <el-input
  69. class="w100"
  70. v-model="categoryMsg.number"
  71. @input="
  72. (value) =>
  73. (categoryMsg.number = value ? parseInt(value) : value)
  74. "
  75. clearable
  76. ></el-input>
  77. </el-form-item>
  78. </el-descriptions-item>
  79. <el-descriptions-item label="">
  80. <span class="label-required after" slot="label">投料重量(KG)</span>
  81. <el-form-item
  82. label=""
  83. label-width="0"
  84. class="w100"
  85. prop="categoryMsg.totalWeight"
  86. ><el-input
  87. readonly
  88. class="w100"
  89. :value="
  90. (categoryMsg.totalWeight =
  91. categoryMsg.number === ''
  92. ? ''
  93. : multiply(
  94. categoryMsg.number,
  95. infoData.productUnitWeight || 1
  96. ))
  97. "
  98. clearable
  99. ></el-input>
  100. </el-form-item>
  101. </el-descriptions-item>
  102. <el-descriptions-item label="舟皿编号/名称" :span="2"
  103. ><el-input
  104. :value="`${boatMsg.code}/${boatMsg.name}`"
  105. @click.native="getCategory('8', 'boatMsg')"
  106. ></el-input
  107. ></el-descriptions-item>
  108. <el-descriptions-item label="舟皿数量" :span="3"
  109. ><el-input
  110. placeholder="请输入"
  111. v-model="boatMsg.extraField.boatNum"
  112. ></el-input
  113. ></el-descriptions-item>
  114. <el-descriptions-item label="质检项" :span="2">
  115. <el-input
  116. v-model="workReport.qualityItem"
  117. placeholder="请输入"
  118. ></el-input>
  119. </el-descriptions-item>
  120. <el-descriptions-item label="质检标准" :span="3">
  121. <el-input
  122. v-model="workReport.qualityStandard"
  123. placeholder="请输入"
  124. ></el-input
  125. ></el-descriptions-item>
  126. <el-descriptions-item label="">
  127. <span class="label-required after" slot="label">合格品数量(PCS)</span>
  128. <el-form-item
  129. label=""
  130. required
  131. label-width="0"
  132. class="w100"
  133. prop="productInfo.standardNum"
  134. ><el-input
  135. class="w100"
  136. v-model="workReport.productInfo.standardNum"
  137. @input="
  138. (value) =>
  139. (workReport.productInfo.standardNum = value
  140. ? parseInt(value)
  141. : value)
  142. "
  143. clearable
  144. ></el-input> </el-form-item
  145. ></el-descriptions-item>
  146. <el-descriptions-item label=""
  147. ><span class="label-required after" slot="label">合格品重量(KG)</span>
  148. <el-form-item
  149. label=""
  150. label-width="0"
  151. class="w100"
  152. prop="productInfo.standardWeight"
  153. ><el-input
  154. readonly
  155. class="w100"
  156. :value="
  157. (workReport.productInfo.standardWeight =
  158. workReport.productInfo.standardNum === ''
  159. ? ''
  160. : multiply(
  161. workReport.productInfo.standardNum,
  162. infoData.productUnitWeight || 1
  163. ))
  164. "
  165. clearable
  166. ></el-input> </el-form-item
  167. ></el-descriptions-item>
  168. <el-descriptions-item label="">
  169. <span class="label-required after" slot="label"
  170. >不合格品数量(PCS)</span
  171. >
  172. <el-form-item
  173. label=""
  174. required
  175. label-width="0"
  176. class="w100"
  177. prop="productInfo.noStandardNum"
  178. >
  179. <el-input
  180. class="w100"
  181. v-model="workReport.productInfo.noStandardNum"
  182. @input="
  183. (value) =>
  184. (workReport.productInfo.noStandardNum = value
  185. ? parseInt(value)
  186. : value)
  187. "
  188. clearable
  189. ></el-input>
  190. </el-form-item>
  191. </el-descriptions-item>
  192. <el-descriptions-item label="不合格品重量(KG)"
  193. ><el-input
  194. class="w100"
  195. readonly
  196. :value="
  197. (workReport.productInfo.noStandardWeight =
  198. workReport.productInfo.noStandardNum === ''
  199. ? ''
  200. : multiply(
  201. workReport.productInfo.noStandardNum,
  202. infoData.productUnitWeight || 1
  203. ))
  204. "
  205. clearable
  206. ></el-input
  207. ></el-descriptions-item>
  208. <el-descriptions-item label="副产品重量(KG)"
  209. ><el-input
  210. class="w100"
  211. v-model="workReport.productInfo.byProductWeight"
  212. @input="
  213. (value) =>
  214. (workReport.productInfo.byProductWeight = value
  215. ? parseInt(value)
  216. : value)
  217. "
  218. clearable
  219. ></el-input
  220. ></el-descriptions-item>
  221. <el-descriptions-item label="备注">
  222. <el-input v-model="workReport.remark"></el-input
  223. ></el-descriptions-item>
  224. </el-descriptions>
  225. <el-descriptions
  226. title="设备信息"
  227. class="mt-16"
  228. direction="vertical"
  229. :column="7"
  230. border
  231. >
  232. <el-descriptions-item label="设备编码">{{
  233. workReportDeviceList.code
  234. }}</el-descriptions-item>
  235. <el-descriptions-item label="设备名称">{{
  236. workReportDeviceList.name
  237. }}</el-descriptions-item>
  238. <el-descriptions-item label="规格">{{
  239. workReportDeviceList.specification
  240. }}</el-descriptions-item>
  241. <el-descriptions-item label="型号">{{
  242. workReportDeviceList.model
  243. }}</el-descriptions-item>
  244. <el-descriptions-item label="升温曲线">
  245. <el-input
  246. placeholder="请输入"
  247. v-model="workReportDeviceList.extraField.temperatureRamp"
  248. ></el-input>
  249. </el-descriptions-item>
  250. <el-descriptions-item label="设备位置">{{
  251. workReportDeviceList.path
  252. }}</el-descriptions-item>
  253. <el-descriptions-item label="操作"
  254. ><el-link @click="getEquip">更改设备</el-link></el-descriptions-item
  255. >
  256. </el-descriptions>
  257. </el-card>
  258. <equipmentDailog ref="equipmentRef" :taskId="taskInfo.id" />
  259. <catogaryDialog ref="catogaryDialogRef" />
  260. </el-form>
  261. </template>
  262. <script>
  263. import personSelectRemote from '@/components/CommomSelect/person-select-remote';
  264. import equipmentDailog from '@/components/EquipmentDailog/report-equipment';
  265. import { reportCount } from '@/api/produceOrder';
  266. import catogaryDialog from '../catogaryDialog.vue';
  267. import dayjs from 'dayjs';
  268. import { multiply } from '@/utils/math';
  269. export default {
  270. components: { personSelectRemote, equipmentDailog, catogaryDialog },
  271. props: {
  272. infoData: {
  273. type: Object,
  274. default: () => ({})
  275. },
  276. taskInfo: {
  277. type: Object,
  278. default: () => ({})
  279. },
  280. formData: {
  281. type: Object,
  282. default: () => ({})
  283. },
  284. firstInfo: {
  285. type: Object,
  286. default: () => ({})
  287. },
  288. currentInfo: {
  289. type: Object,
  290. default: () => ({})
  291. }
  292. },
  293. data() {
  294. return {
  295. categoryMsg: {
  296. batchNo: '',
  297. number: '',
  298. totalWeight: '',
  299. brandNum: '',
  300. sourceCategoryId: '',
  301. rootCategoryLevelId: '9',
  302. name: '',
  303. code: ''
  304. },
  305. workReport: {
  306. qualityItem: '',
  307. qualityStandard: '',
  308. executorId: '',
  309. executorJobNum: '',
  310. executeTime: dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss'),
  311. remark: '',
  312. productInfo: {
  313. byProductWeight: '',
  314. standardNum: '',
  315. standardWeight: '',
  316. noStandardNum: '',
  317. noStandardWeight: ''
  318. }
  319. },
  320. workReportDeviceList: {
  321. code: '',
  322. name: '',
  323. path: '',
  324. model: '',
  325. rootCategoryLevelId: '',
  326. specification: '',
  327. extraField: {
  328. temperatureRamp: ''
  329. }
  330. },
  331. countMsg: {},
  332. // 舟皿信息
  333. boatMsg: {
  334. code: '',
  335. name: '',
  336. path: '',
  337. model: '',
  338. rootCategoryLevelId: '',
  339. specification: '',
  340. extraField: {
  341. boatNum: ''
  342. }
  343. }
  344. };
  345. },
  346. watch: {
  347. taskInfo: {
  348. immediate: true,
  349. handler() {
  350. if (this.taskInfo.code) {
  351. this.getReportCount();
  352. }
  353. }
  354. },
  355. infoData: {
  356. immediate: true,
  357. handler() {
  358. if (
  359. this.infoData.id &&
  360. this.currentInfo.code == this.firstInfo.code &&
  361. this.infoData.deviceCode
  362. ) {
  363. // 设备
  364. this.workReportDeviceList = Object.assign(
  365. {},
  366. this.workReportDeviceList,
  367. {
  368. code: this.infoData.deviceCode,
  369. name: this.infoData.deviceName,
  370. rootCategoryLevelId: this.infoData.rootCategoryLevelId,
  371. path: this.infoData.path[0]?.pathName,
  372. model: this.infoData.model,
  373. sourceInstanceId: this.infoData.sourceInstanceId,
  374. specification: this.infoData.specification
  375. }
  376. );
  377. }
  378. }
  379. },
  380. formData: {
  381. immediate: true,
  382. handler() {
  383. if (this.formData.dateType == 2) {
  384. this.$set(
  385. this.workReport,
  386. 'executeTime',
  387. this.formData.appointTime
  388. );
  389. }
  390. }
  391. }
  392. },
  393. created() {
  394. this.workReport.executorId = this.$store.state.user.info?.userId;
  395. this.workReport.executorJobNum = this.$store.state.user.info?.jobNumber;
  396. },
  397. methods: {
  398. multiply,
  399. getCategory(id, memo) {
  400. this.$refs.catogaryDialogRef.open(id, this[memo], (res) => {
  401. this[memo].rootCategoryLevelId = res.categoryLevelId;
  402. this[memo].code = res.code;
  403. this[memo].name = res.name;
  404. this[memo].specification = res.specification;
  405. this[memo].sourceInstanceId = res.id;
  406. if (memo === 'moduleMsg') {
  407. this[memo].model = res.modelType;
  408. this[memo].extraField.stampingTimes = '';
  409. } else {
  410. this[memo].extraField.num = '';
  411. }
  412. });
  413. },
  414. async getReportCount() {
  415. const res = await reportCount({
  416. taskCode: this.taskInfo.code,
  417. workOrderId: this.infoData.id
  418. });
  419. this.countMsg = res;
  420. },
  421. getEquip() {
  422. this.$refs.equipmentRef.openSingle(
  423. [this.workReportDeviceList],
  424. (res) => {
  425. this.workReportDeviceList.code = res.code;
  426. this.workReportDeviceList.name = res.name;
  427. this.workReportDeviceList.model = res.category?.category?.modelType;
  428. this.workReportDeviceList.specification =
  429. res.category?.category?.specification;
  430. this.workReportDeviceList.sourceInstanceId = res.id;
  431. this.workReportDeviceList.rootCategoryLevelId =
  432. res.rootCategoryLevelId;
  433. this.workReportDeviceList.path = res.positionList[0]?.pathName;
  434. }
  435. );
  436. },
  437. report(fun) {
  438. this.$refs.formRef.validate((value) => {
  439. if (value) {
  440. if (!this.workReportDeviceList.code) {
  441. return this.$message.error('请选择设备');
  442. }
  443. this.$confirm('是否确定要报工?', '提示').then(() => {
  444. this.categoryMsg = Object.assign(this.categoryMsg, {
  445. brandNum: this.infoData.brandNo,
  446. sourceCategoryId: this.infoData.categoryId,
  447. name: this.infoData.productName,
  448. code: this.infoData.productCode
  449. });
  450. const workReportCategoryList = [this.categoryMsg];
  451. if (this.boatMsg.code) {
  452. workReportCategoryList.push(this.boatMsg);
  453. }
  454. fun({
  455. checkState: 1,
  456. workReport: this.workReport,
  457. workReportDeviceList: [this.workReportDeviceList],
  458. workReportCategoryList
  459. }).then((res) => {
  460. // this.$message.success('报工成功!');
  461. // this.getReportCount();
  462. });
  463. });
  464. } else {
  465. this.$message.error('请输入必填项!');
  466. }
  467. });
  468. }
  469. }
  470. };
  471. </script>
  472. <style lang="scss" scoped>
  473. .form-no-message {
  474. :deep(.el-input-number) {
  475. .el-input__inner {
  476. text-align: left !important;
  477. }
  478. }
  479. }
  480. .message-box {
  481. display: flex;
  482. justify-content: space-between;
  483. align-items: center;
  484. margin-bottom: 16px;
  485. .label {
  486. margin-right: 5px;
  487. }
  488. ul {
  489. list-style: none;
  490. display: flex;
  491. align-items: center;
  492. justify-content: flex-start;
  493. li {
  494. margin-right: 20px;
  495. }
  496. }
  497. .right {
  498. padding-top: 22px;
  499. display: flex;
  500. align-items: center;
  501. .el-form-item {
  502. margin-left: 10px;
  503. }
  504. }
  505. }
  506. </style>