Heating.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  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.netWeight"
  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. standardNum: '',
  265. standardWeight: '',
  266. noStandardNum: '',
  267. noStandardWeight: ''
  268. }
  269. },
  270. workReportDeviceList: {
  271. code: '',
  272. name: '',
  273. path: '',
  274. model: '',
  275. rootCategoryLevelId: '',
  276. specification: '',
  277. extraField: {
  278. temperatureCurve: ''
  279. }
  280. },
  281. countMsg: {},
  282. // 舟皿信息
  283. boatMsg: {
  284. code: '',
  285. name: '',
  286. path: '',
  287. model: '',
  288. rootCategoryLevelId: '',
  289. specification: '',
  290. extraField: {
  291. num: ''
  292. }
  293. }
  294. };
  295. },
  296. watch: {
  297. taskInfo: {
  298. immediate: true,
  299. handler () {
  300. if (this.taskInfo.code) {
  301. this.getReportCount();
  302. }
  303. }
  304. },
  305. infoData: {
  306. immediate: true,
  307. handler () {
  308. if (this.infoData.id) {
  309. // 设备
  310. this.workReportDeviceList = Object.assign(
  311. {},
  312. this.workReportDeviceList,
  313. {
  314. code: this.infoData.deviceCode,
  315. name: this.infoData.deviceName,
  316. rootCategoryLevelId: this.infoData.rootCategoryLevelId,
  317. path: this.infoData.path[0]?.pathName,
  318. model: this.infoData.model,
  319. sourceInstanceId: this.infoData.sourceInstanceId,
  320. specification: this.infoData.specification
  321. }
  322. );
  323. }
  324. }
  325. }
  326. },
  327. created () {
  328. this.workReport.executorId = this.$store.state.user.info?.userId;
  329. this.workReport.executorJobNum = this.$store.state.user.info?.jobNumber;
  330. },
  331. methods: {
  332. getCategory (id, memo) {
  333. this.$refs.catogaryDialogRef.open(id, this[memo], (res) => {
  334. this[memo].rootCategoryLevelId = res.categoryLevelId;
  335. this[memo].code = res.code;
  336. this[memo].name = res.name;
  337. this[memo].specification = res.specification;
  338. this[memo].sourceInstanceId = res.id;
  339. if (memo === 'moduleMsg') {
  340. this[memo].model = res.modelType;
  341. this[memo].extraField.stampingTimes = '';
  342. } else {
  343. this[memo].extraField.num = '';
  344. }
  345. });
  346. },
  347. async getReportCount () {
  348. const res = await reportCount({
  349. taskCode: this.taskInfo.code,
  350. workOrderId: this.infoData.id
  351. });
  352. this.countMsg = res;
  353. },
  354. getEquip () {
  355. this.$refs.equipmentRef.openSingle(
  356. [this.workReportDeviceList],
  357. (res) => {
  358. this.workReportDeviceList.code = res.code;
  359. this.workReportDeviceList.name = res.name;
  360. this.workReportDeviceList.model = res.category?.category?.modelType;
  361. this.workReportDeviceList.specification =
  362. res.category?.category?.specification;
  363. this.workReportDeviceList.sourceInstanceId = res.id;
  364. this.workReportDeviceList.rootCategoryLevelId =
  365. res.rootCategoryLevelId;
  366. this.workReportDeviceList.path = res.positionList[0]?.pathName;
  367. }
  368. );
  369. },
  370. report (fun) {
  371. this.$refs.formRef.validate((value) => {
  372. if (value) {
  373. if (!this.workReportDeviceList.code) {
  374. return this.$message.error('请选择设备');
  375. }
  376. this.$confirm('是否确定要报工?', '提示').then(() => {
  377. this.categoryMsg = Object.assign(this.categoryMsg, {
  378. brandNum: this.infoData.brandNo,
  379. sourceCategoryId: this.infoData.categoryId,
  380. name: this.infoData.productName,
  381. code: this.infoData.productCode
  382. });
  383. fun({
  384. checkState: 1,
  385. workReport: this.workReport,
  386. workReportDeviceList: [this.workReportDeviceList],
  387. workReportCategoryList: [this.categoryMsg]
  388. }).then((res) => {
  389. // this.$message.success('报工成功!');
  390. // this.getReportCount();
  391. });
  392. });
  393. } else {
  394. this.$message.error('请输入必填项!');
  395. }
  396. });
  397. }
  398. }
  399. };
  400. </script>
  401. <style lang="scss" scoped>
  402. .form-no-message {
  403. :deep(.el-input-number) {
  404. .el-input__inner {
  405. text-align: left !important;
  406. }
  407. }
  408. }
  409. .message-box {
  410. display: flex;
  411. justify-content: space-between;
  412. align-items: center;
  413. margin-bottom: 16px;
  414. .label {
  415. margin-right: 5px;
  416. }
  417. ul {
  418. list-style: none;
  419. display: flex;
  420. align-items: center;
  421. justify-content: flex-start;
  422. li {
  423. margin-right: 20px;
  424. }
  425. }
  426. .right {
  427. padding-top: 22px;
  428. display: flex;
  429. align-items: center;
  430. .el-form-item {
  431. margin-left: 10px;
  432. }
  433. }
  434. }
  435. </style>