HalfAdded.vue 15 KB

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