Heating.vue 14 KB

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