Common.vue 11 KB

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