Common.vue 12 KB

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