Răsfoiți Sursa

新增任务管理我的任务可以接收和拒绝

695593266@qq.com 9 luni în urmă
părinte
comite
0fea658752

+ 20 - 0
src/api/workOrderList/index.js

@@ -154,3 +154,23 @@ export async function batchUpdateRealTimeConfirm(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+//任务接收和拒绝
+export async function taskManagement(data) {
+  const res = await request.put(`/aps/assign/disposal`, data);
+  console.log(res.data.code == 0);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+//转派任务
+export async function transferTasks(data) {
+  const res = await request.put(`/aps/assign/redeploy`, data);
+  console.log(res.data.code == 0);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 1 - 1
src/views/produce/components/outsourcing/outsourceList.vue

@@ -769,7 +769,7 @@
           item.isSelection = '1';
           item.categoryId = item.id;
           item.newWeight = item.weight;
-          this.pickOutInList.push(item);
+          this.pickOutInList.push(this.deepCopy(item));
           this.selectionData();
           this.bomMaterialList.splice(index, 1);
           this.$forceUpdate();

+ 8 - 3
src/views/produce/components/picking/details.vue

@@ -219,11 +219,11 @@
         this.detailedShow = false;
       },
       openOutsourcingPicking() {
-        if (this.workListIds.length == 1) {
+        if (this.workListIds) {
           this.getTaskInstanceByIdFn();
           // this.outsourcingPickingShow=true
         } else {
-          this.$message.warning('只能选择一条工单进行委外领料');
+          this.$message.warning('请选择工单');
         }
       },
       closeOutsourcingPicking() {
@@ -237,7 +237,12 @@
 
       //获取工单列表
       getTaskInstanceByIdFn() {
-        this.pickingShow = true;
+        if (this.workListIds.length == 1) {
+          this.pickingShow = true;
+        } else {
+          this.$message.warning('只能选择一个工单进行委外领料');
+        }
+
         // let param = {
         //   ids: [this.workListIds[0]],
         //   taskId: this.taskId

+ 1 - 4
src/views/produce/components/picking/index.vue

@@ -508,9 +508,7 @@
         } else {
           const idsList = [];
           let totalNum = 0;
-          // item.warehouseList.forEach((it) => {
-          //   if(Number(it.availableCountBase))
-          // });
+
           for (let i = 0; i < item.warehouseList.length; i++) {
             totalNum += Number(item.warehouseList[i].availableCountBase);
 
@@ -529,7 +527,6 @@
           );
         }
 
-        console.log(item);
       },
 
       detailData(data, dimension, index) {

+ 13 - 7
src/views/produce/index.vue

@@ -593,12 +593,12 @@
 
       // 获取工序列表
       getTaskList() {
-        console.log(
-          localStorage.getItem('singleUserInfo'),
-          'localStorage.getItem'
-        );
+        // console.log(
+        //   localStorage.getItem('singleUserInfo'),
+        //   'localStorage.getItem'
+        // );
 
-        console.log(this.$store.state.user, 'this.$store.state.user.allInfo');
+        // console.log(this.$store.state.user, 'this.$store.state.user.allInfo');
         if (localStorage.getItem('singleUserInfo') == '1') {
           singleListTask(this.$store.state.user.allInfo).then((res) => {
             res.map((v) => {
@@ -790,6 +790,8 @@
         if (t === 'error') {
           if (this.workListIds.length > 1) {
             return this.$message.warning('异常只能选择一个工单!');
+          } else if (this.workListIds.length < 1) {
+            return this.$message.warning('请选择工单!');
           }
           // console.log(this.workListIds, 'this.workListIds');
           this.$refs.createErrorRef.open('add', this.workData.list[0]);
@@ -806,6 +808,8 @@
         if (t === 'work') {
           if (this.workListIds.length > 1) {
             return this.$message.warning('工艺文件只能选择一个工单!');
+          } else if (this.workListIds.length < 1) {
+            return this.$message.warning('请选择工单!');
           }
 
           await parameterGetByCode({
@@ -879,9 +883,9 @@
         if (t == 'Outsourcing') {
           if (this.workListIds.length > 1) {
             return this.$message.warning('委外工序只能选择一个工单!');
-          } else if (this.workListIds.length < 1)
+          } else if (this.workListIds.length < 1) {
             return this.$message.warning('请选择工单!');
-          else {
+          } else {
             // /
             this.handOutsource(this.workListIds[0]);
           }
@@ -950,6 +954,8 @@
       pickAdd() {
         if (this.workListIds.length > 1) {
           return this.$message.warning('领料只能选择一个工单!');
+        } else if (this.workListIds.length < 1) {
+          return this.$message.warning('请选择工单!');
         }
         this.pickingShow = true;
       },

+ 113 - 23
src/views/taskList/index.vue

@@ -44,9 +44,14 @@
           >{{ row.workOrderCode }}
         </el-link>
       </template>
+      <template v-slot:disposalStatus="{ row }">
+        <el-tag v-if="row.disposalStatus == 1" type="success">已接受</el-tag>
+        <el-tag v-if="row.disposalStatus == 2" type="danger">已拒绝</el-tag>
+      </template>
+
       <template v-slot:action="{ row }">
         <el-link
-          v-if="tabValue == '2'"
+          v-if="tabValue == '2' && row.disposalStatus == '2'"
           :underline="false"
           type="primary"
           @click="reassignTask(row)"
@@ -56,11 +61,58 @@
           :underline="false"
           type="primary"
           @click="details('report', row)"
+          v-if="row.disposalStatus == '1' || tabValue == '2'"
           >报工
         </el-link>
-        <el-link :underline="false" type="primary" @click="viewRecords(row.id)"
+        <el-link
+          :underline="false"
+          type="primary"
+          @click="viewRecords(row.id)"
+          v-if="row.disposalStatus == '1' || tabValue == '2'"
           >报工记录
         </el-link>
+
+        <el-popconfirm
+          icon="el-icon-info"
+          title="确定接收任务吗?"
+          @confirm="receiveTask(row.id, '1')"
+          v-if="
+            row.disposalStatus != '1' &&
+            row.disposalStatus != '2' &&
+            tabValue != '2'
+          "
+        >
+          <el-button slot="reference" type="text">接收任务</el-button>
+        </el-popconfirm>
+
+        <el-popconfirm
+          icon="el-icon-info"
+          title="确定拒绝任务吗?"
+          @confirm="receiveTask(row.id, '2')"
+          v-if="
+            row.disposalStatus != '1' &&
+            row.disposalStatus != '2' &&
+            tabValue != '2'
+          "
+        >
+          <el-button slot="reference" type="text">拒绝任务</el-button>
+        </el-popconfirm>
+
+        <!-- <el-link
+          :underline="false"
+          type="primary"
+          @click="receiveTask(row)"
+          v-if="row.disposalStatus != '1'"
+          >接收任务
+        </el-link> -->
+
+        <!-- <el-link
+          :underline="false"
+          type="primary"
+          @click="rejectTask(row)"
+          v-if="row.disposalStatus != '1'"
+          >拒绝任务
+        </el-link> -->
       </template>
     </ele-pro-table>
     <modifyDialog ref="modifyRef" />
@@ -69,6 +121,7 @@
     <el-dialog
       title="选择人员"
       :visible.sync="dialogFormVisible"
+      v-if="dialogFormVisible"
       width="30%"
       center
     >
@@ -107,8 +160,11 @@
   import {
     pageByCurrentUser,
     pageByCurrentUserLeader,
-    listUpdateRealTimeRecord
+    listUpdateRealTimeRecord,
+    taskManagement,
+    transferTasks
   } from '@/api/workOrderList';
+  import { revokeWork } from '@/api/manufacture/spreadWorkOrder';
 
   export default {
     components: { TaskSearch, Ddtails, modifyDialog },
@@ -122,7 +178,8 @@
           { label: '待下达', value: 8 }
         ],
         form: {
-          userId: ''
+          userId: '',
+          id: ''
         },
         dialogFormVisible: false,
         teamList: []
@@ -348,6 +405,13 @@
             // },
             width: 120
           },
+          {
+            prop: 'disposalStatus',
+            label: '任务接收状态',
+            align: 'center',
+            slot: 'disposalStatus',
+            width: 120
+          },
           {
             prop: 'customerName',
             label: '客户名称',
@@ -384,35 +448,20 @@
     },
     created() {},
     mounted() {
-      // console.log(
-      //   this.$hasPermission('mes:taskreport:myorder'),
-      //   this.$hasPermission('mes:taskreport:allorder')
-      // );
+      if (this.$hasPermission('mes:taskreport:allorder')) {
+        this.tabValue = '2';
+      }
 
       if (this.$hasPermission('mes:taskreport:myorder')) {
         this.tabValue = '1';
       }
 
-      if (this.$hasPermission('mes:taskreport:allorder')) {
-        this.tabValue = '2';
-      }
-
       if (
         !this.$hasPermission('mes:taskreport:myorder') &&
         !this.$hasPermission('mes:taskreport:allorder')
       ) {
         this.tabValue = '';
       }
-
-      // console.log(this.tabValue);
-      // console.log(
-      //   this.$hasPermission('mes:taskreport:myorder'),
-      //   'mes:taskreport:myorder'
-      // );
-      // console.log(
-      //   this.$hasPermission('mes:taskreport:allorder'),
-      //   'mes:taskreport:allorder'
-      // );
     },
     methods: {
       handleTabClick(e) {
@@ -435,18 +484,59 @@
         }
       },
 
-      chooseUser() {
+      async chooseUser() {
         if (!this.form.userId) {
           return this.$message.warning('请选择转派人员');
         }
 
+        const data = this.teamList.find((it) => it.id == this.form.userId);
+
+        await transferTasks({
+          assigneeId: data.id,
+          assigneeName: data.name,
+          id: this.form.id
+        }).then((res) => {
+          console.log(res);
+        });
+
         this.dialogFormVisible = false;
 
         this.reload();
       },
 
+      async receiveTask(id, type) {
+        await taskManagement({
+          id,
+          disposalStatus: Number(type)
+        }).then((res) => {
+          console.log(res);
+          this.reload();
+        });
+      },
+
+      // async receiveTask(item) {
+      //   await taskManagement({
+      //     id: item.id,
+      //     disposalStatus: 1
+      //   }).then((res) => {
+      //     console.log(res);
+      //     this.reload();
+      //   });
+      // },
+
+      // async rejectTask(item) {
+      //   await taskManagement({
+      //     id: item.id,
+      //     disposalStatus: 2
+      //   }).then((res) => {
+      //     console.log(res);
+      //     this.reload();
+      //   });
+      // },
+
       async reassignTask(item) {
         this.form.userId = '';
+        this.form.id = item.id;
         await getteampage({ name: item.assignTeamName }).then((res) => {
           this.teamList = res.list[0].userVOList;
         });