Drying.vue 13 KB

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