Drying.vue 13 KB

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