HalfAdded.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  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="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. workReportDeviceList.path
  210. }}</el-descriptions-item>
  211. <el-descriptions-item label="操作"
  212. ><el-link @click="getEquip">更改设备</el-link></el-descriptions-item
  213. >
  214. </el-descriptions>
  215. </el-card>
  216. <equipmentDailog
  217. ref="equipmentRef"
  218. :produceVersionId="infoData.produceVersionId"
  219. />
  220. <catogaryDialog ref="catogaryDialogRef" />
  221. </el-form>
  222. </template>
  223. <script>
  224. import personSelectRemote from '@/components/CommomSelect/person-select-remote';
  225. import equipmentDailog from '@/components/EquipmentDailog/equipment-dailog';
  226. import { reportCount } from '@/api/produceOrder';
  227. import catogaryDialog from '../catogaryDialog.vue';
  228. import dayjs from 'dayjs';
  229. export default {
  230. components: { personSelectRemote, equipmentDailog, catogaryDialog },
  231. props: {
  232. infoData: {
  233. type: Object,
  234. default: () => ({})
  235. },
  236. taskInfo: {
  237. type: Object,
  238. default: () => ({})
  239. }
  240. },
  241. data () {
  242. return {
  243. categoryMsg: {
  244. batchNo: '',
  245. number: '',
  246. totalWeight: '',
  247. brandNum: '',
  248. sourceCategoryId: '',
  249. rootCategoryLevelId: '9',
  250. name: '',
  251. code: ''
  252. },
  253. workReport: {
  254. qualityStandard: '',
  255. qualityItem: '',
  256. executorId: '',
  257. executorJobNum: '',
  258. executeTime: dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss'),
  259. remark: '',
  260. productInfo: {
  261. standardNum: '',
  262. standardWeight: '',
  263. noStandardNum: '',
  264. noStandardWeight: ''
  265. }
  266. },
  267. workReportDeviceList: {
  268. code: '',
  269. name: '',
  270. path: '',
  271. model: '',
  272. rootCategoryLevelId: '',
  273. specification: ''
  274. },
  275. countMsg: {},
  276. // 舟皿信息
  277. boatMsg: {
  278. code: '',
  279. name: '',
  280. path: '',
  281. model: '',
  282. rootCategoryLevelId: '',
  283. specification: '',
  284. extraField: {
  285. num: ''
  286. }
  287. }
  288. };
  289. },
  290. watch: {
  291. taskInfo: {
  292. immediate: true,
  293. handler () {
  294. if (this.taskInfo.code) {
  295. this.getReportCount();
  296. }
  297. }
  298. }
  299. },
  300. created () {
  301. this.workReport.executorId = this.$store.state.user.info?.userId;
  302. this.workReport.executorJobNum = this.$store.state.user.info?.jobNumber;
  303. },
  304. methods: {
  305. getCategory (id, memo) {
  306. this.$refs.catogaryDialogRef.open(id, this[memo], (res) => {
  307. this[memo].rootCategoryLevelId = res.categoryLevelId;
  308. this[memo].code = res.code;
  309. this[memo].name = res.name;
  310. this[memo].specification = res.specification;
  311. this[memo].sourceInstanceId = res.id;
  312. if (memo === 'moduleMsg') {
  313. this[memo].model = res.modelType;
  314. this[memo].extraField.stampingTimes = '';
  315. } else {
  316. this[memo].extraField.num = '';
  317. }
  318. });
  319. },
  320. async getReportCount () {
  321. const res = await reportCount({
  322. taskCode: this.taskInfo.code,
  323. workOrderId: this.infoData.id
  324. });
  325. this.countMsg = res;
  326. },
  327. getEquip () {
  328. this.$refs.equipmentRef.openSingle(
  329. [this.workReportDeviceList],
  330. (res) => {
  331. this.workReportDeviceList.code = res.code;
  332. this.workReportDeviceList.name = res.name;
  333. this.workReportDeviceList.model = res.modelType;
  334. this.workReportDeviceList.specification = res.specification;
  335. this.workReportDeviceList.sourceInstanceId = res.id;
  336. this.workReportDeviceList.rootCategoryLevelId =
  337. res.rootCategoryLevelId;
  338. this.workReportDeviceList.path = res.positionList[0]?.pathName;
  339. }
  340. );
  341. },
  342. report (fun) {
  343. this.$refs.formRef.validate((value) => {
  344. if (value) {
  345. this.$confirm('是否确定要报工?', '提示').then(() => {
  346. this.categoryMsg = Object.assign(this.categoryMsg, {
  347. brandNum: this.infoData.brandNo,
  348. sourceCategoryId: this.infoData.categoryId,
  349. name: this.infoData.productName,
  350. code: this.infoData.productCode
  351. });
  352. fun({
  353. checkState: 1,
  354. workReport: this.workReport,
  355. workReportDeviceList: [this.workReportDeviceList],
  356. workReportCategoryList: [this.categoryMsg]
  357. }).then((res) => {
  358. this.$message.success('报工成功!');
  359. this.getReportCount();
  360. });
  361. });
  362. } else {
  363. this.$message.error('请输入必填项!');
  364. }
  365. });
  366. }
  367. }
  368. };
  369. </script>
  370. <style lang="scss" scoped>
  371. .form-no-message {
  372. :deep(.el-input-number) {
  373. .el-input__inner {
  374. text-align: left !important;
  375. }
  376. }
  377. }
  378. .message-box {
  379. display: flex;
  380. justify-content: space-between;
  381. align-items: center;
  382. margin-bottom: 16px;
  383. .label {
  384. margin-right: 5px;
  385. }
  386. ul {
  387. list-style: none;
  388. display: flex;
  389. align-items: center;
  390. justify-content: flex-start;
  391. li {
  392. margin-right: 20px;
  393. }
  394. }
  395. .right {
  396. padding-top: 22px;
  397. display: flex;
  398. align-items: center;
  399. .el-form-item {
  400. margin-left: 10px;
  401. }
  402. }
  403. }
  404. </style>