Heating.vue 13 KB

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