HalfAdded.vue 12 KB

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