Browse Source

工控机工人上下料调整

yejian 3 years ago
parent
commit
854c9bceb9

+ 18 - 9
imcs-ui/src/api/runManageCenter/taskMgr.js

@@ -2,14 +2,18 @@
 import axiosApi from '../AxiosApi.js'
 
 const apiList = {
-	getList: {
-	    method: 'POST',
-	    url: `/authority/task/all`
-	  },
-  	page: {
-	    method: 'POST',
-	    url: `/authority/task/page`
-  	},
+  getFinishList: {
+    method: 'POST',
+    url: `/authority/taskLoadUnload/page`
+  },
+  getList: {
+    method: 'POST',
+    url: `/authority/task/all`
+  },
+  page: {
+    method: 'POST',
+    url: `/authority/task/page`
+  },
 	update: {
 	    method: 'POST',
 	    url: `/authority/task/update`
@@ -96,10 +100,15 @@ const apiList = {
       method: 'POST',
       url: `/authority/task/procesRfid`
     },
-
 }
 
 export default {
+  getFinishList (data) {
+    return axiosApi({
+      ...apiList.getFinishList,
+      data
+    })
+  },
 	getList (data) {
     return axiosApi({
       ...apiList.getList,

+ 63 - 41
imcs-ui/src/views/zuihou/machiningClient/touchScreen/Index.vue

@@ -81,7 +81,7 @@
         </span>
       </div>
 
-      <el-tabs style="text-align: left; margin-top: 25px">
+      <el-tabs style="text-align: left; margin-top: 25px" @tab-click="tabClick">
         <el-tab-pane label="未完成">
           <span class="tabTitle" slot="label"
             ><el-badge :value="taskCount" class="badge"
@@ -165,10 +165,15 @@
           </span>
           <div class="tableTransparent">
             <el-table
-              :data="finishData"
-              border
 			        style="height:100%;min-height:80px;"
               :header-cell-style="{ background: '#1890ff', color: '#fff' }"
+              :key="tableKey"
+              ref="table"
+              v-loading="loading"
+              :data="tableData.records"
+              border
+              fit
+              row-key="id"
             >
               <el-table-column
                 :label="$t('common.serialNo')"
@@ -187,11 +192,11 @@
               </el-table-column>
               <el-table-column prop="name" label="零件名称" align="center">
               </el-table-column>
-              <el-table-column prop="taskNo" label="工序号" width="80" align="center">
+              <el-table-column prop="procedureNo" label="工序号" width="80" align="center">
               </el-table-column>
-              <el-table-column prop="taskName" label="工序名称" align="center">
+              <el-table-column prop="procedureName" label="工序名称" align="center">
               </el-table-column>
-              <el-table-column prop="planTime" label="额定时间" width="100" align="center">
+              <el-table-column prop="ratedWorkHours" label="额定时间" width="100" align="center">
               </el-table-column>
               <el-table-column prop="activeTime" label="实际时间" width="100" align="center">
               </el-table-column>
@@ -200,11 +205,18 @@
               <el-table-column prop="endTime" label="结束时间" width="150" align="center">
               </el-table-column>
               <el-table-column prop="overTime" label="是否超时" width="100" align="center">
-				  <template slot-scope="scope">
+				          <template slot-scope="scope">
                       {{ scope.overTime ? "是" : "否" }}
-                 </template>
+                  </template>
               </el-table-column>
             </el-table>
+            <pagination
+              v-show="tableData.total > 0"
+              :limit.sync="queryParams.size"
+              :page.sync="queryParams.current"
+              :total="Number(tableData.total)"
+              @pagination="fetch"
+            />
           </div>
         </el-tab-pane>
       </el-tabs>
@@ -251,12 +263,14 @@ import TaskView3 from "./components/View3";
 import { fullScreen, exitFullScreen, initQueryParams } from "@/utils/commons";
 import stationMgrApi from "@/api/machiningClient/stationMgr";
 import taskMgrApi from "@/api/runManageCenter/taskMgr";
+import Pagination from "@/components/Pagination"
 export default {
   name: "TouchScreen",
-  components: { TaskView,TaskView1,TaskView2,TaskView3 },
+  components: {Pagination, TaskView,TaskView1,TaskView2,TaskView3 },
   props: {},
   data() {
     return {
+      tableKey: 0,
       queryParams: initQueryParams({}),
       options: [
       ],
@@ -265,7 +279,6 @@ export default {
       taskCount: "",
       taskData: [
       ],
-      finishData: [],
       current: 1,
       confirmDisabled: true,
       tenantViewVisible: false,
@@ -273,6 +286,10 @@ export default {
       view2Visible: false,
       view3Visible: false,
       isFullSreen: false, // 默认不全屏
+      loading: false,
+      tableData: {
+        total: 0
+      }
     };
   },
   // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
@@ -286,6 +303,18 @@ export default {
   },
   mounted() {},
   methods: {
+    tabClick(e){
+      console.log("被选择的tab:", e.index)
+      // 待执行-tab
+      if(e.index == 0){
+
+      }
+      // 已完成-tab
+      if(e.index == 1){
+        this.fetch()
+      }
+    },
+
     // 全屏
     fullPing() {
       this.$nextTick(() => {
@@ -321,7 +350,7 @@ export default {
               this.options = res.data;
               this.currentStationId = this.options[0].id
               this.currentStationName = this.options[0].name
-              taskMgrApi.getStationTasks({ resourceId : this.currentStationId }).then((res) => {
+              taskMgrApi.getStationTasks({ resourceId : this.currentStationId,type : "0" }).then((res) => {
                 res = res.data;
                 if (res.isSuccess) {
                     if (res.data.length > 0) {
@@ -354,7 +383,7 @@ export default {
         // item.procedurePosition = current[0].name;
         // 只有开始中的页面可以点击进入详情页面操作
         item.currentStationName = this.currentStationName
-        if(item.status === '2' || item.status === '1'){
+        if(item.status === '2' && item.interfaceType=='04'){
             if(item.taskName == '上料'){
                 this.$refs.view1.setTenant(item)
                 this.view1Visible = true
@@ -373,7 +402,7 @@ export default {
       this.view3Visible = false
     },
     editSuccess(item){
-        this.finishTask(item)
+        this.fetch(item)
     },
     setPercentage(time, left) {
       return this.formatGap(time, left)[0] > 100
@@ -390,35 +419,28 @@ export default {
     formatGap(time, left) {
       return [Number(parseInt((100 * left) / time)), "剩余" + left + "分钟"];
     },
-    finishTask() {
-    //   item.status = 1;
-    //   this.taskCount = this.taskCount - 1;
-    //   let planTime = Math.ceil(Math.random() * 30);
-    //   let activeTime = Math.ceil(Math.random() * 30);
-    //   let currentTime = new Date();
-    //   //let currentTime2 = new Date(currentTime.valueOf() + activeTime * 60);
-	  // currentTime.setMinutes(currentTime.getMinutes() + activeTime);
-    //   let finishParams = {
-    //     planTime: planTime,
-    //     activeTime: activeTime,
-    //     startTime: this.getFullTime(new Date()),
-    //     endTime: this.getFullTime(currentTime),
-    //     overTime: planTime < activeTime ? true : false,
-    //   };
-    //   let result = Object.assign(item, finishParams);
-    //   this.finishData.push(result);
-    //   console.log(this.finishData);
-    //   this.taskData.shift();
-        // 查询最新的任务
-        taskMgrApi.getStationTasks({ resourceId : this.currentStationId }).then((res) => {
-            res = res.data;
-            if (res.isSuccess) {
-                if (res.data.length > 0) {
-                    this.taskData = res.data;
-                }
-            }
-        });
 
+    fetch(params = {}) {
+      this.loading = true
+      if (this.queryParams.timeRange) {
+        this.queryParams.map.deliveryTime_st = this.queryParams.timeRange[0]
+        this.queryParams.map.deliveryTime_ed = this.queryParams.timeRange[1]
+      }
+
+      this.queryParams.current = params.current ? params.current : this.queryParams.current
+      this.queryParams.size = params.size ? params.size : this.queryParams.size
+      console.log(this.$store.state.account.user.id)
+      this.queryParams.model.updateUser = this.$store.state.account.user.id
+      taskMgrApi.getFinishList(this.queryParams).then(response => {
+        const res = response.data
+        if (res.isSuccess) {
+          this.tableData = res.data
+          console.log(this.tableData)
+          // 给列表设置条数
+          this.$emit('setTabNums', res.data.total, 'tab2')
+        }
+        // eslint-disable-next-line no-return-assign
+      }).finally(() => this.loading = false)
     },
     getFullTime(date) {
       var yy = date.getFullYear(); //年

+ 1 - 1
imcs-ui/src/views/zuihou/machiningClient/touchScreen/components/View1.vue

@@ -193,7 +193,7 @@ export default {
   	submitForm(){
       // 更新改任务的开始时间
       // TODO 写入rfid内容,工件信息、原材料R
-      taskMgrApi.updateTaskStatus({ "id" : this.tenant.id,"meterialId":this.tenant.meterialId, "uniqueCode":this.uniqueCode, "updateType" : "end", "processType" : "1"}).then((res) => {
+      taskMgrApi.updateTaskStatus({ "id" : this.tenant.id,"meterialId":this.tenant.meterialId, "uniqueCode":this.uniqueCode, "updateType" : "end", "processType" : "1", "updateUser" : this.$store.state.account.user.id}).then((res) => {
           res = res.data;
           if (res.isSuccess) {
               // 通知列表

+ 1 - 1
imcs-ui/src/views/zuihou/machiningClient/touchScreen/components/View2.vue

@@ -135,7 +135,7 @@ export default {
   },
   methods: {
   	submitForm(){
-      taskMgrApi.updateTaskStatus({ "id" : this.tenant.id, "updateType" : "end", "processType" : "2"}).then((res) => {
+      taskMgrApi.updateTaskStatus({ "id" : this.tenant.id, "updateType" : "end", "processType" : "2","updateUser" : this.$store.state.account.user.id}).then((res) => {
           res = res.data;
           if (res.isSuccess) {
               // 通知列表

+ 1 - 1
imcs-ui/src/views/zuihou/machiningClient/touchScreen/components/View3.vue

@@ -175,7 +175,7 @@ export default {
       }
 	},
   	submitForm(){
-        taskMgrApi.updateTaskStatus({ "id" : this.tenant.id, "updateType" : "end","processType" : "3"}).then((res) => {
+        taskMgrApi.updateTaskStatus({ "id" : this.tenant.id, "updateType" : "end","processType" : "3","updateUser" : this.$store.state.account.user.id}).then((res) => {
             res = res.data;
             if (res.isSuccess) {
                 // 通知列表