index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. <template>
  2. <div class="index_box">
  3. <div class="content_box">
  4. <!-- @tab-click="handleClick" -->
  5. <!-- 工序名称 -->
  6. <!-- <Search></Search> -->
  7. <div class="content_box_tab">
  8. <el-input style="width: 180px" clearable v-model="name" placeholder="请输入筛选项" @input="seekInput" />
  9. <el-tabs v-model="activeName" type="card" stretch @tab-click="tabClickValue">
  10. <el-tab-pane label="工序" name="0">
  11. <el-tree :data="produceTaskList" :props="defaultProps" node-key="id" :highlight-current="true"
  12. @node-click="handleNodeClick">
  13. </el-tree>
  14. <!--
  15. v-loading="treeLoading"
  16. :node-key="nodeKey"
  17. ref="tree"
  18. :highlight-current="true"
  19. :expand-on-click-node="false"
  20. @node-click="handleNodeClick"
  21. v-bind="$attrs"
  22. :default-expand-all="defaultExpandAll" -->
  23. </el-tab-pane>
  24. <el-tab-pane label="工位" name="second">
  25. <!-- <AssetTree @handleNodeClick="handleNodeClickNew" @setRootId="setRootId" id="0" :paramsType="'type'"
  26. ref="treeList" eqDevice="sb" /> -->
  27. <el-tree :data="factoryworkstationList" :props="defaultPropsTow" node-key="id" :highlight-current="true"
  28. @node-click="handleNodeClick">
  29. </el-tree>
  30. </el-tab-pane>
  31. </el-tabs>
  32. </div>
  33. <div style="width: calc(100% - 220px);">
  34. <div class="seek-list" style="background-color: #157A2C;">
  35. <div>
  36. <el-input style="width: 180px;margin-right: 5px;" clearable v-model="keyWord" placeholder="请输入关键字" />
  37. <!-- <el-input style="width: 180px" clearable v-model="taskName" placeholder="请输入工序进度" /> -->
  38. <!-- -->
  39. <el-button size="mini" type="primary" style="margin: 0 5px" @click="handleSearch">查询</el-button>
  40. </div>
  41. <div style="width: 55%;color: #fff; display: flex;justify-content: space-between;">
  42. <div>
  43. <b style="margin-right:50px;">当前工序:{{ title }}</b>
  44. <b>下道工序:{{ title1 }}</b>
  45. </div>
  46. <div>
  47. 操作员:{{ info.name }}
  48. </div>
  49. </div>
  50. </div>
  51. <ele-split-layout space="0px" width="45%" :resizable="true" :min-size="200" :max-size="-200" :left-style="{
  52. overflow: 'hidden',
  53. width: '100%'
  54. }" :right-style="{ overflow: 'hidden' }" :responsive="false" style="height: calc(100vh - 70px - 50px - 90px)">
  55. <!-- 左侧 工单列表 -->
  56. <div class="left_main">
  57. <div class="top">
  58. <!-- /工单列表 -->
  59. <produceOrder @workSelect="workSelect" @rowClick="rowClick" ref="produceOrder" @getTaskName="getTaskName">
  60. </produceOrder>
  61. </div>
  62. <!-- <div class="bottom">
  63. <productionResource :BomObj="BomObj"></productionResource>
  64. </div> -->
  65. </div>
  66. <!-- 右侧 详情 -->
  67. <template v-slot:content>
  68. <div class="right_main">
  69. <!-- 领料 -->
  70. <div v-if="operationType == 'pick'">
  71. <pickDetails ref="pickListRef" @pickAdd="pickAdd"></pickDetails>
  72. </div>
  73. <div v-if="operationType == 'feed'">
  74. <!-- 投料 -->
  75. <feeding :workListIds="workListIds" :feedNeedEquipment="feedNeedEquipment"></feeding>
  76. </div>
  77. <div v-if="operationType == 'job'">
  78. <!-- // 报工列表 入库 -->
  79. <warehousing v-if="taskObj.id == -1" :workListIds="workListIds" ref="wareRef"></warehousing>
  80. <!-- // 设备 入库 -->
  81. <!-- 普通报工 -->
  82. <jobBooking v-else :workListIds="workListIds" ref="jobRef" :reportNeedFeed="reportNeedFeed"></jobBooking>
  83. </div>
  84. <!-- 质检工序 -->
  85. <div v-if="operationType == 'inspection'">
  86. <inspection :workListIds="workListIds" ref="inspectionRef"></inspection>
  87. </div>
  88. <!-- 委外 -->
  89. <div v-if="operationType == 'Outsourcing' && isType == '3'" class="right_main_box">
  90. <outsourcing :outsourceFormVal="outsourceForm" @changePlugIn="changePlugIn" v-if="isStep"></outsourcing>
  91. <!-- -->
  92. <outsourceList :outsourceFormVal="outObj" @closeForm="closeForm" @outScucc="outScucc" v-else></outsourceList>
  93. </div>
  94. </div>
  95. </template>
  96. </ele-split-layout>
  97. <footBtn @footBtn="footBtn" :type="type" style="background: rgba(223, 250, 222,0.6);padding: 10px;"></footBtn>
  98. </div>
  99. <!-- <footBtn @footBtn="footBtn"></footBtn> -->
  100. </div>
  101. <!--领料弹框 -->
  102. <picking v-if="pickingShow" @close="pickingClose" :workListIds="workListIds"></picking>
  103. <!-- 工艺文件 -->
  104. <wokePopup ref="wokePopupRef"></wokePopup>
  105. <!-- :workListIds="workListIds" :taskId="taskObj.id" -->
  106. </div>
  107. </template>
  108. <script>
  109. import Search from './components/search.vue';
  110. import footBtn from './components/footBtn.vue';
  111. import produceOrder from './components/produceOrder.vue';
  112. import productionResource from './components/productionResource/index.vue';
  113. import outsourcing from './components/outsourcing/index.vue';
  114. import picking from './components/picking/index.vue';
  115. import wokePopup from './components/picking/wokePopup.vue';
  116. import inspection from './components/inspection/index.vue';
  117. import pickDetails from './components/picking/details.vue';
  118. import AssetTree from '@/components/AssetTree/joobIndex.vue';
  119. import feeding from './components/feeding/index.vue';
  120. import jobBooking from './components/jobBooking/index.vue';
  121. import warehousing from './components/warehousing/index.vue';
  122. import outsourceList from './components/outsourcing/outsourceList.vue';
  123. import { getByTaskId, pcCheckOutsource, getTaskInstanceById, checkOutsourceMaterial, listTask, factoryworkstationPage, nextTask } from '@/api/produce/index';
  124. export default {
  125. components: {
  126. Search,
  127. footBtn,
  128. wokePopup,
  129. produceOrder,
  130. productionResource,
  131. outsourcing,
  132. picking,
  133. pickDetails,
  134. outsourceList,
  135. feeding,
  136. AssetTree,
  137. jobBooking,
  138. inspection,
  139. warehousing
  140. },
  141. data() {
  142. return {
  143. name: '',
  144. activeName: '0',
  145. taskName: '',
  146. keyWord: '',//搜索
  147. title: '',
  148. type: '',
  149. loading: false,
  150. operationType: null,
  151. workListIds: [],
  152. factoryworkstationList: [],
  153. title1: '',
  154. arr: [],
  155. arrTow:[],
  156. produceTaskList: [],
  157. isType: '',
  158. isStep: true,
  159. outsourceForm: {},
  160. outObj: {},
  161. pickingShow: false,
  162. wokePopup: false,
  163. BomObj: {},
  164. defaultProps: {
  165. children: 'children',
  166. label: 'newName'
  167. },
  168. defaultPropsTow: {
  169. children: 'children',
  170. label: 'name',
  171. value: 'code'
  172. },
  173. feedNeedEquipment:0,//投料是否要添加生产设备1是0否
  174. reportNeedFeed:0,//生产质检是否需要处置再报工1是0否
  175. };
  176. },
  177. computed: {
  178. taskObj() {
  179. return this.$store.state.user.taskObj;
  180. },
  181. info() {
  182. return this.$store.state.user.info;
  183. }
  184. },
  185. created() {
  186. this.init()
  187. this.getTaskList();
  188. this.getFactoryworkstationPageList();
  189. this.operationType = null;
  190. this.workListIds = [];
  191. },
  192. methods: {
  193. tabClickValue(){
  194. this.name ='';
  195. this.seekInput()
  196. },
  197. // 前端筛选
  198. seekInput() {
  199. // console.log(activeName);
  200. if (this.activeName == '0') {
  201. if (!this.name) return (this.produceTaskList = this.arr);
  202. this.produceTaskList = this.produceTaskList.filter(item => {
  203. return item.name.indexOf(this.name) > -1
  204. })
  205. } else {
  206. if (!this.name) return (this.factoryworkstationList = this.arrTow);
  207. this.factoryworkstationList = this.factoryworkstationList.filter(item => {
  208. return item.name.indexOf(this.name) > -1
  209. })
  210. }
  211. },
  212. // 折叠悬浮中样式调整
  213. init() {
  214. this.$store.dispatch('theme/setCollapse', true);
  215. },
  216. async getTaskName(value) {
  217. if (value.length > 0) {
  218. let res = await nextTask({
  219. taskId: this.taskObj.id,
  220. workOrderIds: value.map(item => item.id)
  221. })
  222. this.title1 = res.data.map(item => item.taskTypeName).toString()
  223. } else {
  224. this.title1 = ''
  225. }
  226. },
  227. handleSearch() {
  228. let obj = {
  229. keyWord: this.keyWord,
  230. taskName: this.taskName
  231. }
  232. this.$refs.produceOrder.handleSearch(obj);
  233. //handleSearch(this.code);
  234. },
  235. handleNodeClickNew(info) {
  236. console.log(info, '999');
  237. // this.current = info;
  238. let current = { id: info.id };
  239. this.$store.commit('user/currentObj', current);
  240. },
  241. setRootId(id) {
  242. this.rootId = id;
  243. },
  244. // 点击工序
  245. handleNodeClick(data) {
  246. console.log(data,'11111sassasgasg');
  247. this.feedNeedEquipment=data.feedNeedEquipment
  248. this.reportNeedFeed=data.reportNeedFeed
  249. let obj = {
  250. '1': `${data.workCenterName}-${data.name}(普通工序)`,
  251. '3': `${data.workCenterName}-${data.name}(质检工序)`,
  252. '4': `${data.workCenterName}-${data.name}(包装工序)`,
  253. '5': `${data.workCenterName}-${data.name}(入库工序)`,
  254. '6': `${data.workCenterName}-${data.name}(质检工序)`
  255. }
  256. this.title = obj[data.type] || '';
  257. this.type = data.type;
  258. let taskObj = {};
  259. taskObj = this.produceTaskList.find((item) => item.id === data.id);
  260. this.$store.commit('user/setTaskObj', taskObj);
  261. },
  262. // 获取工序列表
  263. getTaskList() {
  264. listTask().then((res) => {
  265. res.map(v => {
  266. v.newName = `${v.workCenterName}-${v.name}`
  267. })
  268. this.produceTaskList = res;
  269. this.arr = JSON.parse(JSON.stringify(this.produceTaskList));
  270. // newName
  271. });
  272. },
  273. // 获取工位
  274. getFactoryworkstationPageList() {
  275. factoryworkstationPage({ pageNum: 1, size: 99999999 }).then((res) => {
  276. console.log(res, 'res');
  277. this.factoryworkstationList = res.list;
  278. this.arrTow = JSON.parse(JSON.stringify(this.factoryworkstationList));
  279. // newName
  280. });
  281. },
  282. closeForm() {
  283. this.isStep = true;
  284. },
  285. outScucc(){
  286. this.operationType=null
  287. },
  288. // 切换组件
  289. async changePlugIn(e) {
  290. this.outObj = e;
  291. let req = {
  292. taskId: e.taskId,
  293. taskIds: e.taskIds,
  294. workOrderId: e.workOrderId,
  295. quantity:e.formedNumLast
  296. }
  297. const res = await checkOutsourceMaterial(req);
  298. this.outObj = { ...res.data, ...this.outsourceForm ,...this.outObj};
  299. this.isStep = false;
  300. },
  301. workSelect(data) {
  302. this.isStep = true;
  303. this.operationType = null;
  304. this.workListIds = data.ids;
  305. },
  306. pickingWokeClose() {
  307. this.wokePopup = false;
  308. },
  309. footBtn(t) {
  310. this.operationType = t;
  311. if (
  312. Object.keys(this.$store.state.user.taskObj).length === 0 &&
  313. this.$store.state.user.taskObj.constructor === Object
  314. ) {
  315. this.$message.warning('请选择工序');
  316. return false;
  317. }
  318. if (['pick', 'feed', 'job'].includes(t)) {
  319. if (this.workListIds.length == 0) {
  320. this.$message.warning('请选择工单列表');
  321. return false;
  322. }
  323. }
  324. if (t == 'pick') {
  325. this.$nextTick(() => {
  326. this.$refs.pickListRef.getList(this.workListIds);
  327. });
  328. }
  329. // 工艺路线
  330. if (t === 'work') {
  331. let req = {
  332. taskId: this.taskObj.id,
  333. workOrderId: this.workListIds[0]
  334. }
  335. this.$refs.wokePopupRef.open(req);
  336. }
  337. if (t == 'feed') {
  338. }
  339. // 委外
  340. if (t == 'Outsourcing') {
  341. if (this.workListIds.length > 1) {
  342. return this.$message.warning('委外工序只能选择一个工单!');
  343. } else if (this.workListIds.length < 1)
  344. return this.$message.warning('请选择工单!');
  345. else {
  346. // /
  347. this.handOutsource(this.workListIds[0]);
  348. }
  349. }
  350. },
  351. handOutsource(workOrderId) {
  352. console.log(this.taskObj, workOrderId);
  353. // return
  354. let param = {
  355. taskId: this.taskObj.id,
  356. workOrderId: workOrderId,
  357. }
  358. pcCheckOutsource(param).then(res => {
  359. this.outsourceForm = {
  360. ...res.data,
  361. }
  362. this.outsourceForm.name = this.taskObj.name + '委外'
  363. console.log(res, 'res');
  364. if (res.data.outsource) {
  365. this.isType = '3';
  366. this.getTaskInstanceByIdFn(workOrderId)
  367. } else {
  368. return this.$message.warning('此工序不能委外');
  369. }
  370. })
  371. },
  372. //获取工单列表
  373. getTaskInstanceByIdFn(workOrderId) {
  374. getTaskInstanceById(workOrderId).then((res) => {
  375. console.log(res, 'res');
  376. let { data } = res;
  377. if (data.length) {
  378. data = data.filter(item => item.type == 1);
  379. let arr = data.findIndex(item => item.sourceTaskId == this.taskObj.id)
  380. console.log(arr);
  381. if (arr != -1) {
  382. data.splice(0, arr + 1)
  383. }
  384. this.$set(this.outsourceForm, 'newStepsList', data)
  385. }
  386. })
  387. },
  388. pickAdd() {
  389. this.pickingShow = true;
  390. },
  391. // 关闭领料弹窗
  392. pickingClose(val) {
  393. if (val) {
  394. this.$nextTick(() => {
  395. this.$refs.pickListRef.getList(this.workListIds);
  396. });
  397. }
  398. this.pickingShow = false;
  399. },
  400. rowClick(row, taskId) {
  401. if (taskId) {
  402. let params = {
  403. categoryId: row.categoryId,
  404. taskId: taskId
  405. };
  406. getByTaskId(params).then((res) => {
  407. this.BomObj = res.data;
  408. this.$forceUpdate();
  409. });
  410. }
  411. }
  412. },
  413. mounted() {
  414. this.$nextTick(() => {
  415. const targetElements =
  416. document.getElementsByClassName('ele-admin-tabs');
  417. if (targetElements.length > 0) {
  418. // 遍历所有具有 'ele-admin-tabs' 类的元素
  419. Array.from(targetElements).forEach((element) => {
  420. // 对每个元素添加 'new-ele-admin-tabs' 类
  421. element.classList.add('new-ele-admin-tabs');
  422. });
  423. }
  424. });
  425. },
  426. destroyed() {
  427. this.$nextTick(() => {
  428. const targetElements =
  429. document.getElementsByClassName('ele-admin-tabs');
  430. if (targetElements.length > 0) {
  431. Array.from(targetElements).forEach((element) => {
  432. element.classList.remove('new-ele-admin-tabs');
  433. });
  434. }
  435. });
  436. }
  437. };
  438. </script>
  439. <style>
  440. .content_box {
  441. display: flex;
  442. }
  443. .content_box_tab {
  444. width: 220px;
  445. padding: 5px;
  446. height: calc(100vh - 73px);
  447. background-color: #fff;
  448. overflow-y: auto;
  449. }
  450. .footBtn {
  451. position: absolute;
  452. bottom: 20px;
  453. left: 0;
  454. }
  455. .new-ele-admin-tabs {
  456. display: none !important;
  457. }
  458. .c_title {
  459. color: #157a2c;
  460. font-size: 16px;
  461. font-weight: bold;
  462. }
  463. .tableZ_box {
  464. border: 1px solid #e3e5e5;
  465. margin: 6px 0;
  466. &:last-child {
  467. border-bottom: none;
  468. }
  469. .row {
  470. width: 100%;
  471. display: flex;
  472. }
  473. .col {
  474. width: calc(100% / 5);
  475. display: flex;
  476. align-items: center;
  477. min-width: 200px;
  478. min-height: 32px;
  479. border-bottom: 1px solid #e3e5e5;
  480. border-right: 1px solid #e3e5e5;
  481. &:last-child {
  482. border-right: none;
  483. }
  484. .name {
  485. display: flex;
  486. align-items: center;
  487. padding: 4px;
  488. width: 80px;
  489. height: 100%;
  490. background-color: #d0e4d5;
  491. color: #000;
  492. }
  493. .content {
  494. padding: 4px 6px;
  495. color: #000;
  496. }
  497. }
  498. .pd6 {
  499. padding: 0 6px;
  500. }
  501. }
  502. </style>
  503. <style lang="scss" scoped>
  504. .seek-list {
  505. display: flex;
  506. justify-content: space-between;
  507. align-items: center;
  508. padding: 10px 10px;
  509. }
  510. .right_main_box {
  511. background-color: #fff;
  512. height: 100%;
  513. box-sizing: border-box;
  514. }
  515. .index_box {
  516. padding: 10px;
  517. padding-bottom: 0;
  518. width: 100%;
  519. box-sizing: border-box;
  520. min-width: 1280px !important;
  521. height: calc(100vh - 60px);
  522. // overflow-x: auto;
  523. /* 当内容超出宽度时,允许水平滚动 */
  524. white-space: nowrap;
  525. /* 防止内部文本换行,确保所有内容都在一行显示 */
  526. scrollbar-width: thin;
  527. /* 设置滚动条宽度(浏览器兼容性可能有所不同) */
  528. scrollbar-color: #40a9ff transparent;
  529. /* 设置滚动条颜色和轨道颜色(同样,浏览器兼容性) */
  530. }
  531. .main {
  532. width: 100%;
  533. min-width: 1280px;
  534. height: calc(100vh - 70px - 50px - 80px);
  535. display: flex;
  536. justify-content: space-between;
  537. }
  538. .left_main {
  539. width: 100%;
  540. height: 100%;
  541. display: flex;
  542. flex-direction: column;
  543. justify-content: space-around;
  544. min-width: 640px;
  545. .top {
  546. width: 100%;
  547. height: 100%;
  548. overflow: hidden;
  549. }
  550. // .bottom {
  551. // width: 100%;
  552. // min-height: calc((100vh - 70px - 50px - 80px - 20px) / 2);
  553. // overflow: hidden;
  554. // }
  555. }
  556. ::v-deep .el-tabs__item.is-active {
  557. background-color: #DFFADE;
  558. /* 蓝色背景 */
  559. color: #333;
  560. }
  561. ::v-deep .is-active {
  562. color: #DFFADE;
  563. }
  564. .right_main {
  565. min-width: 640px;
  566. padding-bottom: 12px;
  567. height: calc((100vh - 70px - 50px - 80px - 12px));
  568. background: #f0f3f3;
  569. }
  570. </style>