Common.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  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"
  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'),
  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. },
  278. methods: {
  279. async getReportCount () {
  280. const res = await reportCount({
  281. taskCode: this.taskInfo.code,
  282. workOrderId: this.infoData.id
  283. });
  284. this.countMsg = res;
  285. },
  286. getEquip () {
  287. this.$refs.equipmentRef.openSingle(
  288. [this.workReportDeviceList],
  289. (res) => {
  290. this.workReportDeviceList.code = res.code;
  291. this.workReportDeviceList.name = res.name;
  292. this.workReportDeviceList.model = res.modelType;
  293. this.workReportDeviceList.specification = res.specification;
  294. this.workReportDeviceList.sourceInstanceId = res.id;
  295. this.workReportDeviceList.rootCategoryLevelId =
  296. res.rootCategoryLevelId;
  297. this.workReportDeviceList.path = res.positionList[0]?.pathName;
  298. }
  299. );
  300. },
  301. report (fun) {
  302. this.$refs.formRef.validate((value) => {
  303. if (value) {
  304. this.$confirm('是否确定要报工?', '提示').then(() => {
  305. this.categoryMsg = Object.assign(this.categoryMsg, {
  306. brandNum: this.infoData.brandNo,
  307. sourceCategoryId: this.infoData.categoryId,
  308. name: this.infoData.productName,
  309. code: this.infoData.productCode
  310. });
  311. fun({
  312. checkState: 1,
  313. workReport: this.workReport,
  314. workReportDeviceList: [this.workReportDeviceList],
  315. workReportCategoryList: [this.categoryMsg]
  316. }).then((res) => {
  317. this.$message.success('报工成功!');
  318. this.getReportCount();
  319. });
  320. });
  321. } else {
  322. this.$message.error('请输入必填项!');
  323. }
  324. });
  325. }
  326. }
  327. };
  328. </script>
  329. <style lang="scss" scoped>
  330. .form-no-message {
  331. :deep(.el-input-number) {
  332. .el-input__inner {
  333. text-align: left !important;
  334. }
  335. }
  336. }
  337. .message-box {
  338. display: flex;
  339. justify-content: space-between;
  340. align-items: center;
  341. margin-bottom: 16px;
  342. .label {
  343. margin-right: 5px;
  344. }
  345. ul {
  346. list-style: none;
  347. display: flex;
  348. align-items: center;
  349. justify-content: flex-start;
  350. li {
  351. margin-right: 20px;
  352. }
  353. }
  354. .right {
  355. padding-top: 22px;
  356. display: flex;
  357. align-items: center;
  358. .el-form-item {
  359. margin-left: 10px;
  360. }
  361. }
  362. }
  363. </style>