Index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. <template>
  2. <div
  3. id="playerMap"
  4. ref="playerMap"
  5. class="app-container yunMapDiv"
  6. style="height: 200%"
  7. >
  8. <!-- 全屏 -->
  9. <el-row :gutter="20" class="rowCls">
  10. <div class="headerBg">
  11. <h2>现场工控端</h2>
  12. <div class="battonDiv">
  13. <el-tooltip
  14. v-if="!isFullSreen"
  15. class="item"
  16. effect="dark"
  17. :content="$t('largeScreen.common.screening')"
  18. placement="top-start"
  19. >
  20. <a @click="fullPing()"><i class="el-icon-full-screen"></i></a>
  21. </el-tooltip>
  22. <el-tooltip
  23. v-else
  24. class="item"
  25. effect="dark"
  26. :content="$t('largeScreen.common.cancel')"
  27. placement="top-start"
  28. >
  29. <a @click="exitFullPing()"><i class="el-icon-switch-button"></i></a>
  30. </el-tooltip>
  31. </div>
  32. </div>
  33. <!--
  34. <el-image
  35. style="width: 100%; height: 100%"
  36. :src="url"
  37. fit="fill"
  38. ></el-image> -->
  39. </el-row>
  40. <!-- 区域模块 -->
  41. <div style="text-align: left; margin-left: 5%">
  42. <!-- 搜索-部分 -->
  43. <div class="defaultRow noBorder">
  44. <el-select
  45. v-model="currentStationId"
  46. :span="2"
  47. @change="selectChange"
  48. :placeholder="$t('common.pleaseSelect')"
  49. >
  50. <el-option
  51. v-for="item in options"
  52. :key="item.id"
  53. :label="item.name"
  54. :value="item.id"
  55. >
  56. </el-option>
  57. </el-select>
  58. <span :span="2" style="margin-left: 2%">
  59. <el-button
  60. plain
  61. type="primary"
  62. icon="el-icon-view"
  63. size="medium"
  64. @click="readView"
  65. >
  66. 读RFID
  67. </el-button>
  68. </span>
  69. <span :span="2" style="margin-right: 5%; float: right">
  70. <el-button
  71. plain
  72. type="primary"
  73. icon="el-icon-view"
  74. size="medium"
  75. @click="navigator"
  76. >
  77. 我的班表
  78. </el-button>
  79. </span>
  80. </div>
  81. <el-tabs style="text-align: left; margin-top: 25px" @tab-click="tabClick">
  82. <el-tab-pane label="未完成">
  83. <span class="tabTitle" slot="label"
  84. ><el-badge :value="taskCount" class="badge"
  85. ><i class="el-icon-date"></i> 未完成</el-badge
  86. >
  87. </span>
  88. <el-col
  89. :span="index == 0 ? 12 : 8"
  90. :gutter="24"
  91. v-for="(item, index) in taskData.slice(0, 3)"
  92. :key="item.id"
  93. :offset="index == 0 ? 0 : 1"
  94. v-show="item.status < 3 ? true : false"
  95. :style="
  96. index == 0
  97. ? 'zoom:1;min-width:300px;'
  98. : 'zoom:0.6;min-width:180px;'
  99. "
  100. >
  101. <el-card :gutter="24" class="box-card" style="margin: 5px" >
  102. <div class="card_content" >
  103. <div class="block card_header" @click="view(item)">
  104. <el-image
  105. style="
  106. width: 90px;
  107. height: 80px;
  108. max-width: 200%;
  109. max-height: 200%;
  110. "
  111. :src="resolveLogo('status' + (index + 1) + '.png')"
  112. fit="fill"
  113. >
  114. </el-image>
  115. <span>{{ item.taskName }}</span>
  116. <div class="itemNo">任务编号: {{ item.no }}</div>
  117. </div>
  118. <el-form style="margin-top: 10px">
  119. <el-form-item label="零件名称:">
  120. <span>{{ item.name }}</span>
  121. </el-form-item>
  122. <el-form-item label="工序号:">
  123. <span>{{ item.taskNo }}</span>
  124. </el-form-item>
  125. <el-form-item label="托盘编号:">
  126. <span>{{ item.trayNo }}</span>
  127. </el-form-item>
  128. <el-form-item label="额定时间:">
  129. <span>{{ item.time }}分钟</span>
  130. <!--<div class="timeprogress">
  131. <el-progress
  132. :text-inside="true"
  133. :stroke-width="15"
  134. :percentage="setPercentage(item.time, item.left)"
  135. color="#FF3366"
  136. :format="setItemText(item.time, item.left)"
  137. ></el-progress>
  138. </div>-->
  139. </el-form-item>
  140. <!-- <el-form-item>-->
  141. <!-- <span style="margin: 2% 0; float: right">-->
  142. <!-- <el-button-->
  143. <!-- plain-->
  144. <!-- type="primary"-->
  145. <!-- icon="el-icon-view"-->
  146. <!-- size="medium"-->
  147. <!-- :disabled="index == 0 ? false : true"-->
  148. <!-- @click.native="finishTask(item)"-->
  149. <!-- >-->
  150. <!-- 完成-->
  151. <!-- </el-button>-->
  152. <!-- </span>-->
  153. <!-- </el-form-item>-->
  154. </el-form>
  155. </div>
  156. </el-card>
  157. </el-col>
  158. </el-tab-pane>
  159. <el-tab-pane label="已完成">
  160. <span class="tabTitle" slot="label">
  161. <i class="el-icon-date"></i> 已完成
  162. </span>
  163. <div class="tableTransparent">
  164. <el-table
  165. style="height:100%;min-height:80px;"
  166. :header-cell-style="{ background: '#1890ff', color: '#fff' }"
  167. :key="tableKey"
  168. ref="table"
  169. v-loading="loading"
  170. :data="tableData.records"
  171. border
  172. fit
  173. row-key="id"
  174. >
  175. <el-table-column
  176. :label="$t('common.serialNo')"
  177. width="55px"
  178. align="center"
  179. >
  180. <template slot-scope="scope">
  181. <div>
  182. {{
  183. scope.$index +
  184. (queryParams.current - 1) * queryParams.size +
  185. 1
  186. }}
  187. </div>
  188. </template>
  189. </el-table-column>
  190. <el-table-column prop="name" label="零件名称" align="center">
  191. </el-table-column>
  192. <el-table-column prop="procedureNo" label="工序号" width="80" align="center">
  193. </el-table-column>
  194. <el-table-column prop="procedureName" label="工序名称" align="center">
  195. </el-table-column>
  196. <el-table-column prop="ratedWorkHours" label="额定时间" width="100" align="center">
  197. </el-table-column>
  198. <el-table-column prop="activeTime" label="实际时间" width="100" align="center">
  199. </el-table-column>
  200. <el-table-column prop="startTime" label="开始时间" width="150" align="center">
  201. </el-table-column>
  202. <el-table-column prop="endTime" label="结束时间" width="150" align="center">
  203. </el-table-column>
  204. <el-table-column prop="overTime" label="是否超时" width="100" align="center">
  205. <template slot-scope="scope">
  206. {{ scope.overTime ? "是" : "否" }}
  207. </template>
  208. </el-table-column>
  209. </el-table>
  210. <pagination
  211. v-show="tableData.total > 0"
  212. :limit.sync="queryParams.size"
  213. :page.sync="queryParams.current"
  214. :total="Number(tableData.total)"
  215. @pagination="fetch"
  216. />
  217. </div>
  218. </el-tab-pane>
  219. </el-tabs>
  220. </div>
  221. <!-- 【查看】组件 -->
  222. <task-view
  223. ref="view"
  224. :dialog-visible="tenantViewVisible"
  225. @get-data="showRFID"
  226. @close="viewClose"
  227. />
  228. <!-- 【查看】组件 -->
  229. <task-view1
  230. ref="view1"
  231. :dialog-visible="view1Visible"
  232. @close="viewClose"
  233. @success="editSuccess"
  234. />
  235. <task-view2
  236. ref="view2"
  237. :dialog-visible="view2Visible"
  238. @close="viewClose"
  239. @success="editSuccess"
  240. />
  241. <!-- 【查看】组件 -->
  242. <task-view3
  243. ref="view3"
  244. :dialog-visible="view3Visible"
  245. @close="viewClose"
  246. @success="editSuccess"
  247. />
  248. </div>
  249. </template>
  250. <script>
  251. // 【查看】组件
  252. import TaskView from "./components/View";
  253. import TaskView1 from "./components/View1";
  254. import TaskView2 from "./components/View2";
  255. import TaskView3 from "./components/View3";
  256. import { fullScreen, exitFullScreen, initQueryParams } from "@/utils/commons";
  257. import stationMgrApi from "@/api/machiningClient/stationMgr";
  258. import taskMgrApi from "@/api/runManageCenter/taskMgr";
  259. import Pagination from "@/components/Pagination"
  260. export default {
  261. name: "TouchScreen",
  262. components: {Pagination, TaskView,TaskView1,TaskView2,TaskView3 },
  263. props: {},
  264. data() {
  265. return {
  266. tableKey: 0,
  267. queryParams: initQueryParams({}),
  268. options: [
  269. ],
  270. currentStationId: "",
  271. currentStationName: "",
  272. taskCount: "",
  273. taskData: [
  274. ],
  275. current: 1,
  276. confirmDisabled: true,
  277. tenantViewVisible: false,
  278. view1Visible: false,
  279. view2Visible: false,
  280. view3Visible: false,
  281. isFullSreen: false, // 默认不全屏
  282. loading: false,
  283. tableData: {
  284. total: 0
  285. }
  286. };
  287. },
  288. // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
  289. created() {
  290. this.getStation();
  291. },
  292. computed: {
  293. currentUser() {
  294. return this.$store.state.account.user;
  295. },
  296. },
  297. mounted() {},
  298. methods: {
  299. tabClick(e){
  300. console.log("被选择的tab:", e.index)
  301. // 待执行-tab
  302. if(e.index == 0){
  303. this.getStation()
  304. }
  305. // 已完成-tab
  306. if(e.index == 1){
  307. this.fetch()
  308. }
  309. },
  310. // 全屏
  311. fullPing() {
  312. this.$nextTick(() => {
  313. // 显示【退出全屏】
  314. this.isFullSreen = true;
  315. // 如果是退出全屏
  316. let $playerMap = this.$refs.playerMap;
  317. if ($playerMap) {
  318. fullScreen($playerMap);
  319. }
  320. });
  321. },
  322. // 退出全屏
  323. exitFullPing() {
  324. this.$nextTick(() => {
  325. // 显示【全屏】
  326. this.isFullSreen = false;
  327. // 如果是全屏
  328. exitFullScreen(document.getElementById("playerMap"));
  329. });
  330. },
  331. selectChange(value) {
  332. console.log(value);
  333. },
  334. getStation() {
  335. stationMgrApi
  336. .getStation({ userId: this.$store.state.account.user.id })
  337. .then((res) => {
  338. res = res.data;
  339. if (res.isSuccess) {
  340. if (res.data.length > 0) {
  341. this.options = res.data;
  342. this.currentStationId = this.options[0].id
  343. this.currentStationName = this.options[0].name
  344. taskMgrApi.getStationTasks({ resourceId : this.currentStationId,type : "0" }).then((res) => {
  345. res = res.data;
  346. if (res.isSuccess) {
  347. if (res.data.length > 0) {
  348. this.taskData = res.data;
  349. }
  350. }
  351. });
  352. }
  353. }
  354. });
  355. },
  356. readView() {
  357. //this.tenantViewVisible = true
  358. this.$refs.view.read(null);
  359. },
  360. showRFID(code) {
  361. console.log(code);
  362. },
  363. resolveLogo(logo) {
  364. return require(`@/assets/yunMap/${logo}`);
  365. },
  366. view (item) {
  367. // let that = this;
  368. // let current = that.options.filter(function (c, i, a) {
  369. // if (c.value == that.currentStationId) {
  370. // return c
  371. // }
  372. // })
  373. // item.procedurePosition = current[0].name;
  374. // 只有开始中的页面可以点击进入详情页面操作
  375. item.currentStationName = this.currentStationName
  376. if(item.status === '2' && item.interfaceType=='04'){
  377. if(item.taskName == '上料'){
  378. this.$refs.view1.setTenant(item)
  379. this.view1Visible = true
  380. }else if(item.taskName == '人工翻面'){
  381. this.$refs.view2.setTenant(item)
  382. this.view2Visible = true
  383. }else if(item.taskName == '下料'){
  384. this.$refs.view3.setTenant(item)
  385. this.view3Visible = true
  386. }
  387. }
  388. },
  389. viewClose() {
  390. this.view1Visible = false
  391. this.view2Visible = false
  392. this.view3Visible = false
  393. },
  394. editSuccess(item){
  395. this.getStation(item)
  396. // this.taskData.shift();
  397. },
  398. setPercentage(time, left) {
  399. return this.formatGap(time, left)[0] > 100
  400. ? 100
  401. : this.formatGap(time, left)[0];
  402. },
  403. // 设置进度文本内容
  404. setItemText(time, left) {
  405. return () => {
  406. return this.formatGap(time, left)[1];
  407. };
  408. },
  409. //时间差转换
  410. formatGap(time, left) {
  411. return [Number(parseInt((100 * left) / time)), "剩余" + left + "分钟"];
  412. },
  413. fetch(params = {}) {
  414. this.loading = true
  415. if (this.queryParams.timeRange) {
  416. this.queryParams.map.deliveryTime_st = this.queryParams.timeRange[0]
  417. this.queryParams.map.deliveryTime_ed = this.queryParams.timeRange[1]
  418. }
  419. this.queryParams.current = params.current ? params.current : this.queryParams.current
  420. this.queryParams.size = params.size ? params.size : this.queryParams.size
  421. console.log(this.$store.state.account.user.id)
  422. this.queryParams.model.updateUser = this.$store.state.account.user.id
  423. taskMgrApi.getFinishList(this.queryParams).then(response => {
  424. const res = response.data
  425. if (res.isSuccess) {
  426. this.tableData = res.data
  427. console.log(this.tableData)
  428. // 给列表设置条数
  429. this.$emit('setTabNums', res.data.total, 'tab2')
  430. }
  431. // eslint-disable-next-line no-return-assign
  432. }).finally(() => this.loading = false)
  433. },
  434. getFullTime(date) {
  435. var yy = date.getFullYear(); //年
  436. var mm = date.getMonth() + 1; //月
  437. var dd = date.getDate(); //日
  438. var hh = date.getHours(); //时
  439. var ii = date.getMinutes(); //分
  440. var ss = date.getSeconds(); //秒
  441. var clock = yy + "-";
  442. if (mm < 10) clock += "0";
  443. clock += mm + "-";
  444. if (dd < 10) clock += "0";
  445. clock += dd + " ";
  446. if (hh < 10) clock += "0";
  447. clock += hh + ":";
  448. if (ii < 10) clock += "0";
  449. clock += ii + ":";
  450. if (ss < 10) clock += "0";
  451. clock += ss;
  452. return clock;
  453. },
  454. navigator() {
  455. this.$router.push("/classScheduleMgr/classScheduleMgr");
  456. },
  457. },
  458. };
  459. </script>
  460. <style lang="scss" scoped>
  461. .tabDiv {
  462. position: relative;
  463. overflow: hidden;
  464. width: 100%;
  465. height: 100%;
  466. .battonDiv {
  467. z-index: 9;
  468. }
  469. }
  470. .tabTitle {
  471. font-size: 24px;
  472. height: 24px;
  473. line-height: 24px;
  474. }
  475. .card_content {
  476. padding: 8px;
  477. width: 100%;
  478. text-align: left;
  479. color: #fff;
  480. }
  481. .card_header {
  482. position: relative;
  483. border-bottom: 1px solid #fff;
  484. margin: 10px 0;
  485. }
  486. .indexNo {
  487. position: absolute;
  488. top: 25%;
  489. left: 9%;
  490. font-size: 24px;
  491. line-height: 24px;
  492. height: 24px;
  493. color: #fff;
  494. z-index: 999;
  495. }
  496. .indexNo2 {
  497. position: absolute;
  498. top: 25%;
  499. left: 6%;
  500. font-size: 24px;
  501. line-height: 24px;
  502. height: 24px;
  503. color: #fff;
  504. z-index: 999;
  505. }
  506. .itemNo {
  507. font-size: 12px;
  508. line-height: 12px;
  509. height: 12px;
  510. text-align: right;
  511. color: #fff;
  512. margin-left: 20%;
  513. margin-bottom: 10px;
  514. }
  515. .timeprogress >>> .el-progress-bar__outer {
  516. background-color: #1890ff;
  517. }
  518. .timeprogress .el-progress-bar__inner {
  519. text-align: center;
  520. }
  521. .el-form-item >>> .el-form-item__label {
  522. color: #fff;
  523. }
  524. .el-form-item {
  525. margin-bottom: 0;
  526. }
  527. .tabTitle >>> .el-badge {
  528. position: relative;
  529. display: inline-block;
  530. vertical-align: baseline;
  531. }
  532. .badge {
  533. margin-top: 10px;
  534. margin-right: 20px;
  535. }
  536. .tableTransparent >>> .el-table,
  537. .el-table__expanded-cell {
  538. background-color: transparent;
  539. }
  540. </style>