HalfAdded.vue 14 KB

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