index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <ele-split-layout
  5. width="500px"
  6. allow-collapse
  7. :right-style="{ overflow: 'hidden' }"
  8. >
  9. <div class="left-box">
  10. <div class="left-item">
  11. <div class="title">产品</div>
  12. <el-popover placement="right" width="400" trigger="click">
  13. <div>
  14. <el-form
  15. ref="productFormRef"
  16. :model="productBody"
  17. label-width="80px"
  18. class="productForm"
  19. >
  20. <el-form-item label="关键字:">
  21. <el-input
  22. v-model="productBody.param"
  23. placeholder="产品编码、产品名称"
  24. ></el-input>
  25. </el-form-item>
  26. <el-form-item label="查询范围:">
  27. <el-date-picker
  28. style="width: 100%"
  29. v-model="productBody.createTimeStart"
  30. type="date"
  31. placeholder="选择日期"
  32. format="yyyy-MM-dd HH:mm:ss"
  33. value-format="yyyy-MM-dd HH:mm:ss"
  34. >
  35. </el-date-picker>
  36. <div style="margin-top: 10px">
  37. <el-date-picker
  38. style="width: 100%"
  39. v-model="productBody.createTimeEnd"
  40. type="date"
  41. placeholder="选择日期"
  42. format="yyyy-MM-dd HH:mm:ss"
  43. value-format="yyyy-MM-dd HH:mm:ss"
  44. >
  45. </el-date-picker>
  46. </div>
  47. </el-form-item>
  48. <el-form-item>
  49. <el-button
  50. type="primary"
  51. @click="getAllProductInWorkOrder"
  52. icon="el-icon-search"
  53. :loading="productButLoading"
  54. >查询</el-button
  55. >
  56. <el-button
  57. type="primary"
  58. @click="resetSubmit"
  59. icon="el-icon-refresh-left"
  60. :loading="productButLoading"
  61. >重置</el-button
  62. >
  63. </el-form-item>
  64. </el-form>
  65. </div>
  66. <el-button slot="reference" type="primary" style="width: 100%">
  67. 搜索
  68. </el-button>
  69. </el-popover>
  70. <div class="list-box" style="padding-bottom: 80px">
  71. <div
  72. class="list-item"
  73. v-for="i in productList"
  74. :key="i.productName + i.productCode"
  75. :class="{ active: i.productCode == tableQuery.productCode }"
  76. @click="changeProductName(i)"
  77. >
  78. <!-- <el-popover
  79. placement="top-start"
  80. width="200"
  81. trigger="hover"
  82. :content="`产品编码:${i.productCode},产品名称:${i.productName}`"
  83. >
  84. <template slot="reference">
  85. <div class="ele-elip" style="width: 100%">{{
  86. i.productCode
  87. }}</div>
  88. <div class="ele-elip" style="width: 100%">{{
  89. i.productName
  90. }}</div>
  91. </template>
  92. </el-popover> -->
  93. <div class="ele-elip" style="width: 100%">
  94. {{ i.productCode }}
  95. </div>
  96. <div class="ele-elip" style="width: 100%">
  97. {{ i.productName }}
  98. </div>
  99. </div>
  100. </div>
  101. <div class="footer-box">
  102. <el-pagination
  103. @size-change="handleSizeChange"
  104. @current-change="handleCurrentChange"
  105. :current-page.sync="productBody.pageNum"
  106. :page-size="productBody.size"
  107. layout="sizes,pager"
  108. :total="total"
  109. :pager-count="5"
  110. small
  111. >
  112. </el-pagination>
  113. </div>
  114. </div>
  115. <div class="left-item">
  116. <div class="title">批次号</div>
  117. <div v-if="batchNos.length > 0" class="list-box">
  118. <div
  119. class="list-item"
  120. v-for="i in batchNos"
  121. :key="i"
  122. :class="{ active: i == tableQuery.batchNo }"
  123. @click="changeBatchNo(i)"
  124. >
  125. <div> {{ i ? i : '暂无批次号' }}</div>
  126. </div>
  127. </div>
  128. <div v-else class="list-box">
  129. <div class="list-item" style="text-align: center; color: #888">
  130. 请先选择产品
  131. </div>
  132. </div>
  133. </div>
  134. <div class="left-item">
  135. <div class="title">批记录类型</div>
  136. <div class="list-box">
  137. <div
  138. class="list-item"
  139. v-for="i in types"
  140. :key="i.name"
  141. :class="{ active: activeType == i.name }"
  142. @click="changeActiveType(i)"
  143. >
  144. {{ i.name }}
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. <template v-slot:content>
  150. <div class="table-box">
  151. <component
  152. :is="activeComponentName"
  153. ref="tableRef"
  154. :tableQuery="tableQuery"
  155. ></component>
  156. </div>
  157. </template>
  158. </ele-split-layout>
  159. </el-card>
  160. </div>
  161. </template>
  162. <script>
  163. import dictMixins from '@/mixins/dictMixins';
  164. import tableColumnsMixin from '@/mixins/tableColumnsMixin';
  165. import seekPage from '@/components/common/seekPage.vue';
  166. import { getAllProductInWorkOrder } from '@/api/produce/workOrder';
  167. import workOrderTable from './components/tables/workOrderTable.vue';
  168. import materialTable from './components/tables/materialTable.vue';
  169. import materialReturnTable from './components/tables/materialReturnTable.vue';
  170. import workReportTable from './components/tables/workReportTable.vue';
  171. import qualityWorkOrderTable from './components/tables/qualityWorkOrderTable.vue';
  172. import wmsOutInt from './components/tables/wmsOutInt.vue';
  173. import batchRecordTable from './components/tables/batchRecordTable.vue';
  174. import deviceBatchRecordTable from './components/tables/deviceBatchRecordTable.vue';
  175. import craftFilesTable from './components/tables/craftFilesTable.vue';
  176. export default {
  177. components: {
  178. seekPage,
  179. workOrderTable,
  180. materialTable,
  181. materialReturnTable,
  182. workReportTable,
  183. qualityWorkOrderTable,
  184. wmsOutInt,
  185. batchRecordTable,
  186. deviceBatchRecordTable,
  187. craftFilesTable
  188. },
  189. name: 'batchRecord',
  190. mixins: [dictMixins, tableColumnsMixin],
  191. data() {
  192. return {
  193. types: [
  194. {
  195. name: '生产工单',
  196. componentName: 'workOrderTable'
  197. },
  198. {
  199. name: '领料单',
  200. componentName: 'materialTable'
  201. },
  202. {
  203. name: '退料单',
  204. componentName: 'materialReturnTable'
  205. },
  206. {
  207. name: '报工',
  208. componentName: 'workReportTable'
  209. },
  210. {
  211. name: '质检工单',
  212. componentName: 'qualityWorkOrderTable'
  213. },
  214. {
  215. name: '入库单',
  216. componentName: 'wmsOutInt'
  217. },
  218. {
  219. name: '生产记录',
  220. componentName: 'batchRecordTable'
  221. },
  222. {
  223. name: '设备工单',
  224. componentName: 'deviceBatchRecordTable'
  225. },
  226. {
  227. name: '工艺文件',
  228. componentName: 'craftFilesTable'
  229. }
  230. ],
  231. activeType: '生产工单',
  232. activeComponentName: 'workOrderTable',
  233. // 产品搜索条件
  234. productBody: {
  235. param: '',
  236. pageNum: 1,
  237. size: 10,
  238. // 创建开始时间和结束时间
  239. createTimeStart: '',
  240. createTimeEnd: ''
  241. },
  242. productButLoading: false,
  243. total: 0,
  244. // 批次号
  245. batchNos: [],
  246. // 产品列表
  247. productList: [],
  248. tableQuery: {
  249. productCode: '',
  250. batchNo: ''
  251. }
  252. };
  253. },
  254. computed: {},
  255. created() {
  256. this.getAllProductInWorkOrder();
  257. },
  258. methods: {
  259. // 刷新表格数据
  260. reload() {
  261. this.$refs.tableRef?.reload();
  262. },
  263. // 获取产品和批次号
  264. async getAllProductInWorkOrder() {
  265. try {
  266. this.productButLoading = true;
  267. const { list, count } = await getAllProductInWorkOrder(
  268. this.productBody
  269. );
  270. this.productList = list;
  271. console.log('this.productList', this.productList);
  272. this.productButLoading = false;
  273. this.total = count;
  274. } catch (error) {
  275. this.productButLoading = false;
  276. }
  277. },
  278. // 选择产品
  279. changeProductName(i) {
  280. this.tableQuery.productCode = i.productCode;
  281. // 设置批次号
  282. this.batchNos = i.batchNos;
  283. this.tableQuery.batchNo = '';
  284. // 刷新表格
  285. this.reload();
  286. },
  287. // 选择批次号
  288. changeBatchNo(i) {
  289. this.tableQuery.batchNo = i;
  290. this.reload();
  291. },
  292. // 选择批记录类型
  293. changeActiveType(i) {
  294. this.activeType = i.name;
  295. this.activeComponentName = i.componentName;
  296. this.reload();
  297. },
  298. resetSubmit() {
  299. this.productBody.param = '';
  300. this.productBody.createTimeStart = null;
  301. this.productBody.createTimeEnd = null;
  302. this.getAllProductInWorkOrder();
  303. },
  304. handleSizeChange(size) {
  305. this.productBody.size = size;
  306. this.getAllProductInWorkOrder();
  307. },
  308. handleCurrentChange(pageNum) {
  309. this.productBody.pageNum = pageNum;
  310. this.getAllProductInWorkOrder();
  311. }
  312. }
  313. };
  314. </script>
  315. <style lang="scss" scoped>
  316. .left-box {
  317. height: 100%;
  318. display: flex;
  319. .left-item {
  320. flex: 1;
  321. border-right: 1px solid #ededed;
  322. padding: 0 5px;
  323. width: 33.3%;
  324. position: relative;
  325. box-sizing: border-box;
  326. .title {
  327. text-align: center;
  328. font-size: 16px;
  329. padding: 10px 0;
  330. border-bottom: 1px solid #ededed;
  331. margin-bottom: 15px;
  332. }
  333. .list-box {
  334. margin-top: 10px;
  335. max-height: 78vh;
  336. overflow-y: auto;
  337. box-sizing: border-box;
  338. .list-item {
  339. padding: 10px 10px;
  340. border-bottom: 1px solid #ededed;
  341. font-size: 14px;
  342. cursor: pointer;
  343. word-break: break-all;
  344. }
  345. .active {
  346. background: #1890ff;
  347. color: #fff;
  348. }
  349. }
  350. .footer-box {
  351. width: 100%;
  352. height: 70px;
  353. position: absolute;
  354. left: 0;
  355. bottom: 0;
  356. z-index: 1;
  357. background: #fff;
  358. padding: 10px 0;
  359. :deep(.el-pagination__sizes) {
  360. display: block;
  361. margin-bottom: 10px;
  362. }
  363. }
  364. }
  365. }
  366. .productForm {
  367. .el-form-item {
  368. margin-bottom: 10px;
  369. }
  370. }
  371. .table-box {
  372. height: 85vh;
  373. overflow-y: auto;
  374. }
  375. </style>