orderHomogeneityInspectInstallDialog.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. <template>
  2. <div>
  3. <el-drawer
  4. title="齐套性检查"
  5. :visible.sync="visible"
  6. direction="rtl"
  7. :append-to-body="true"
  8. size="100%"
  9. >
  10. <div class="form-wrapper">
  11. <div style="width: 20%">
  12. <el-card class="box-card">
  13. <div class="ele-border-lighter sys-organization-list">
  14. <el-radio-group
  15. size="small"
  16. v-model="currentNodeData.bomType"
  17. @change="bomChange"
  18. >
  19. <el-radio-button :label="1">PBOM </el-radio-button>
  20. <el-radio-button :label="3">ABOM </el-radio-button>
  21. </el-radio-group>
  22. <el-tree
  23. class="treeData"
  24. :data="treeList"
  25. :expand-on-click-node="false"
  26. :props="defaultProps"
  27. ref="treeRef"
  28. :default-expanded-keys="
  29. current && current.id ? [current.id] : []
  30. "
  31. :highlight-current="true"
  32. node-key="id"
  33. @node-click="handleNodeClick"
  34. >
  35. <span class="custom-tree-node" slot-scope="{ node, data }">
  36. {{ node.label }} / {{ data.code }}
  37. </span>
  38. </el-tree>
  39. </div>
  40. </el-card>
  41. </div>
  42. <div style="width: 80%">
  43. <el-card class="box-card">
  44. <ele-pro-table
  45. ref="table"
  46. :needPage="false"
  47. :columns="columns"
  48. :init-load="false"
  49. :datasource="datasource"
  50. >
  51. <template v-slot:stockCount="{ row }">
  52. <el-link
  53. type="primary"
  54. :underline="false"
  55. @click="stockDetail(row)"
  56. >
  57. {{ row.stockCount }}
  58. </el-link>
  59. </template>
  60. <template v-slot:currentCount="{ row }">
  61. <el-link
  62. type="primary"
  63. :underline="false"
  64. @click="currentDetail(row)"
  65. >
  66. {{ row.currentCount }}
  67. </el-link>
  68. </template>
  69. <template v-slot:stockColor="{ row }">
  70. <div :class="{ statusRed: row.stockStatus == '缺料' }">
  71. {{ row.stockStatus }}
  72. </div>
  73. </template>
  74. <template v-slot:currentColor="{ row }">
  75. <div :class="{ statusRed: row.currentStatus == '缺料' }">
  76. {{ row.currentStatus }}
  77. </div>
  78. </template>
  79. <template v-slot:finishColor="{ row }">
  80. <div :class="{ statusRed: row.finishStatus == '缺料' }">
  81. {{ row.finishStatus }}
  82. </div>
  83. </template>
  84. <template v-slot:finishCount="{ row }">
  85. <div>
  86. <div v-if="row.finishCount > 0">{{ row.finishCount }}</div>
  87. <div v-else>-</div>
  88. </div>
  89. </template>
  90. </ele-pro-table>
  91. </el-card>
  92. </div>
  93. </div>
  94. <div slot="footer">
  95. <el-button plain @click="cancel">取消</el-button>
  96. <el-button type="primary" @click="confirm">确定</el-button>
  97. </div>
  98. </el-drawer>
  99. <stockDetailDialog ref="stockDetailDialog" />
  100. <currentDetailDialog ref="currentDetailDialog" />
  101. </div>
  102. </template>
  103. <script>
  104. import {
  105. pbomHomogeneityInspect,
  106. getOrderBomRoot, orderPbomHomogeneityInspect
  107. } from '@/api/productionPlan/index.js';
  108. import stockDetailDialog from '../../productionPlan/components/stockDetailDialog.vue';
  109. import currentDetailDialog from '../../productionPlan/components/currentDetailDialog.vue';
  110. export default {
  111. components: {
  112. stockDetailDialog,
  113. currentDetailDialog
  114. },
  115. data() {
  116. return {
  117. visible: false,
  118. isFullscreen: true,
  119. formData: {},
  120. requestData: {
  121. deviceCode: '',
  122. deviceName: '',
  123. deviceId: ''
  124. },
  125. requiredFormingNum: 0,
  126. // form: {
  127. // homogeneityInspect: []
  128. // },
  129. rules: {},
  130. columns: [
  131. {
  132. columnKey: 'index',
  133. label: '序号',
  134. type: 'index',
  135. width: 55,
  136. align: 'center',
  137. showOverflowTooltip: true
  138. },
  139. {
  140. prop: 'opCode',
  141. label: '工序编码',
  142. align: 'center',
  143. minWidth: 100,
  144. showOverflowTooltip: true
  145. },
  146. {
  147. prop: 'opName',
  148. label: '工序名称',
  149. align: 'center',
  150. minWidth: 100
  151. },
  152. {
  153. prop: 'bomCode',
  154. label: '物料编码',
  155. align: 'center',
  156. minWidth: 100,
  157. showOverflowTooltip: true
  158. },
  159. {
  160. prop: 'bomName',
  161. label: '物料名称',
  162. align: 'center',
  163. minWidth: 100
  164. },
  165. {
  166. prop: 'count',
  167. label: '定额数量',
  168. align: 'center',
  169. minWidth: 80
  170. },
  171. {
  172. slot: 'stockCount',
  173. prop: 'stockCount',
  174. label: '库存数量',
  175. align: 'center',
  176. minWidth: 80
  177. },
  178. {
  179. slot: 'stockColor',
  180. prop: 'stockStatus',
  181. label: '库存状态',
  182. align: 'center',
  183. minWidth: 80
  184. },
  185. {
  186. slot: 'currentCount',
  187. prop: 'currentCount',
  188. label: '在途数量',
  189. align: 'center',
  190. minWidth: 80
  191. },
  192. {
  193. slot: 'currentColor',
  194. prop: 'currentStatus',
  195. label: '在途状态',
  196. align: 'center',
  197. minWidth: 80
  198. },
  199. {
  200. slot: 'finishCount',
  201. prop: 'finishCount',
  202. label: '最终缺料数量',
  203. align: 'center',
  204. minWidth: 80
  205. },
  206. {
  207. slot: 'finishColor',
  208. prop: 'finishStatus',
  209. label: '最终状态',
  210. align: 'center',
  211. minWidth: 80
  212. }
  213. ],
  214. ids: [],
  215. leftShow: true,
  216. leftWidth: '0%',
  217. rightWidth: '100%',
  218. versList: [],
  219. searchObj: {
  220. versions: '',
  221. categoryId: '',
  222. isProduct: false,
  223. isTemp: 0
  224. },
  225. current: {},
  226. currentNodeData: {
  227. bomType: 1,
  228. children: []
  229. },
  230. treeId: '',
  231. treeList: [],
  232. defaultProps: {
  233. children: 'children',
  234. label: 'name'
  235. },
  236. orderIds: [],
  237. };
  238. },
  239. watch: {
  240. leftShow(newVal, oldVal) {
  241. if (newVal) {
  242. this.leftWidth = '30%';
  243. this.rightWidth = '70%';
  244. }
  245. }
  246. },
  247. mounted() {},
  248. methods: {
  249. reload(where) {
  250. this.$nextTick(() => {
  251. this.$refs.table.reload({ page: 1, where });
  252. });
  253. },
  254. /* 表格数据源 */
  255. datasource({ page, limit, where }) {
  256. return orderPbomHomogeneityInspect({
  257. pageNum: page,
  258. size: limit,
  259. ...where
  260. });
  261. },
  262. stockDetail(row) {
  263. this.$refs.stockDetailDialog.open(row);
  264. },
  265. currentDetail(row) {
  266. this.$refs.currentDetailDialog.open(row);
  267. },
  268. async open(data) {
  269. console.log(data);
  270. this.visible = true;
  271. this.orderIds = [];
  272. this.orderIds = data;
  273. this.treeList = [];
  274. this.treeList = await getOrderBomRoot({orderIds: this.orderIds, bomType: this.currentNodeData.bomType});
  275. if(this.treeList && this.treeList.length > 0){
  276. let bomIds = [];
  277. this.getTreeIds(this.treeList[0], bomIds)
  278. this.reload({bomIds: bomIds, orderId: this.treeList[0].orderId});
  279. }
  280. },
  281. handleClose() {
  282. this.searchObj = {
  283. versions: '',
  284. categoryId: '',
  285. isProduct: false,
  286. isTemp: 0
  287. };
  288. this.activeName = '属性';
  289. this.drawer = false;
  290. },
  291. handleFull() {
  292. this.isFullscreen = !this.isFullscreen;
  293. this.$forceUpdate();
  294. },
  295. async bomChange(e) {
  296. console.log(e, 'e');
  297. this.searchObj.versions = '';
  298. this.currentNodeData.bomType = e;
  299. this.treeList = [];
  300. this.treeList = await getOrderBomRoot({orderIds: this.orderIds, bomType: this.currentNodeData.bomType});
  301. if(this.treeList && this.treeList.length > 0){
  302. let bomIds = [];
  303. this.getTreeIds(this.treeList[0], bomIds)
  304. this.reload({bomIds: bomIds, orderId: this.treeList[0].orderId});
  305. }
  306. },
  307. handleNodeClick(data) {
  308. this.treeId = data.id;
  309. let bomIds = [];
  310. this.getTreeIds(data, bomIds);
  311. this.reload({bomIds: bomIds, orderId: data.orderId})
  312. },
  313. cancel() {
  314. this.formData = {};
  315. this.visible = false;
  316. },
  317. confirm() {
  318. this.visible = false;
  319. },
  320. getTreeIds(tree, list){
  321. if(tree){
  322. if(tree.id){
  323. list.push(tree.id);
  324. }
  325. if(tree.children && tree.children.length > 0){
  326. for(let item of tree.children){
  327. this.getTreeIds(item, list);
  328. }
  329. }
  330. }
  331. }
  332. }
  333. };
  334. </script>
  335. <style lang="scss" scoped>
  336. .mt20 {
  337. margin-top: 20px;
  338. }
  339. .el-form-item {
  340. margin-bottom: 0 !important;
  341. }
  342. .optionButton {
  343. display: flex;
  344. justify-content: flex-end;
  345. padding-bottom: 3px;
  346. }
  347. .statusRed {
  348. color: red;
  349. }
  350. .form-wrapper {
  351. display: flex;
  352. }
  353. /* 自定义全屏样式 */
  354. ::v-deep .is-fullscreen {
  355. width: 100vw !important;
  356. height: 100vh !important;
  357. overflow: hidden !important; /* 隐藏滚动条 */
  358. }
  359. ::v-deep .not-fullscreen {
  360. width: calc(100vw - 260px) !important;
  361. height: 100vh !important;
  362. overflow: hidden !important; /* 隐藏滚动条 */
  363. }
  364. .custom-drawer-header {
  365. display: flex;
  366. justify-content: space-between;
  367. align-items: center;
  368. padding: 4px 15px;
  369. background-color: #f5f7fa; /* 自定义背景色 */
  370. border-bottom: 1px solid #ebeef5; /* 自定义边框,与抽屉内容分隔 */
  371. }
  372. .drawer_content {
  373. margin: 10px 20px;
  374. box-sizing: border-box;
  375. }
  376. .sys-organization-list {
  377. height: calc(100vh - 100px);
  378. box-sizing: border-box;
  379. border-width: 1px;
  380. border-style: solid;
  381. overflow: auto;
  382. padding: 10px;
  383. box-sizing: border-box;
  384. display: flex;
  385. flex-direction: column;
  386. overflow: hidden;
  387. .treeData {
  388. height: 0 1 auto;
  389. overflow-y: auto;
  390. height: calc(100vh - 125px);
  391. }
  392. }
  393. .tab-box {
  394. margin-top: 12px;
  395. }
  396. </style>