liuhj 1 年之前
父节点
当前提交
89e8bfa282
共有 7 个文件被更改,包括 751 次插入249 次删除
  1. 12 149
      package-lock.json
  2. 1 1
      package.json
  3. 70 0
      src/components/child/test.vue
  4. 29 26
      src/components/home.vue
  5. 40 39
      src/components/system/AssignTasks.vue
  6. 593 34
      src/components/system/TaskList.vue
  7. 6 0
      src/router/index.js

+ 12 - 149
package-lock.json

@@ -8,6 +8,7 @@
       "name": "oa-system",
       "version": "1.0.0",
       "dependencies": {
+        "@aspnet/signalr": "^1.0.27",
         "@ckeditor/ckeditor5-build-classic": "^38.1.0",
         "@ckeditor/ckeditor5-vue2": "^3.0.1",
         "@fullcalendar/core": "^6.1.4",
@@ -15,7 +16,6 @@
         "@fullcalendar/interaction": "^6.1.4",
         "@fullcalendar/timegrid": "^6.1.4",
         "@fullcalendar/vue": "^6.1.4",
-        "@microsoft/signalr": "^8.0.0",
         "axios": "^1.3.4",
         "element-ui": "^2.15.13",
         "pinyin-pro": "^3.17.0",
@@ -70,6 +70,12 @@
         "npm": ">= 3.0.0"
       }
     },
+    "node_modules/@aspnet/signalr": {
+      "version": "1.0.27",
+      "resolved": "https://registry.npmjs.org/@aspnet/signalr/-/signalr-1.0.27.tgz",
+      "integrity": "sha512-utZvBF9snjdwIBpvcFa6htqFTVaTN50QIZUoiznKpYSZImew1a1Ci7VYmK8HODqwRqUtj0o5/xR1nzt8xex5sA==",
+      "deprecated": "This package is no longer supported. Consider using @microsoft/signalr."
+    },
     "node_modules/@babel/parser": {
       "version": "7.21.2",
       "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.2.tgz",
@@ -593,46 +599,6 @@
         "vue": "^2.6.12"
       }
     },
-    "node_modules/@microsoft/signalr": {
-      "version": "8.0.0",
-      "resolved": "https://registry.npmjs.org/@microsoft/signalr/-/signalr-8.0.0.tgz",
-      "integrity": "sha512-K/wS/VmzRWePCGqGh8MU8OWbS1Zvu7DG7LSJS62fBB8rJUXwwj4axQtqrAAwKGUZHQF6CuteuQR9xMsVpM2JNA==",
-      "dependencies": {
-        "abort-controller": "^3.0.0",
-        "eventsource": "^2.0.2",
-        "fetch-cookie": "^2.0.3",
-        "node-fetch": "^2.6.7",
-        "ws": "^7.4.5"
-      }
-    },
-    "node_modules/@microsoft/signalr/node_modules/eventsource": {
-      "version": "2.0.2",
-      "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz",
-      "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==",
-      "engines": {
-        "node": ">=12.0.0"
-      }
-    },
-    "node_modules/@microsoft/signalr/node_modules/ws": {
-      "version": "7.5.9",
-      "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz",
-      "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==",
-      "engines": {
-        "node": ">=8.3.0"
-      },
-      "peerDependencies": {
-        "bufferutil": "^4.0.1",
-        "utf-8-validate": "^5.0.2"
-      },
-      "peerDependenciesMeta": {
-        "bufferutil": {
-          "optional": true
-        },
-        "utf-8-validate": {
-          "optional": true
-        }
-      }
-    },
     "node_modules/@popperjs/core": {
       "version": "2.11.6",
       "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.6.tgz",
@@ -689,17 +655,6 @@
         "node": ">=0.10.0"
       }
     },
-    "node_modules/abort-controller": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
-      "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
-      "dependencies": {
-        "event-target-shim": "^5.0.0"
-      },
-      "engines": {
-        "node": ">=6.5"
-      }
-    },
     "node_modules/accepts": {
       "version": "1.3.8",
       "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
@@ -5154,14 +5109,6 @@
         "es5-ext": "~0.10.14"
       }
     },
-    "node_modules/event-target-shim": {
-      "version": "5.0.1",
-      "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
-      "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
-      "engines": {
-        "node": ">=6"
-      }
-    },
     "node_modules/eventemitter3": {
       "version": "4.0.7",
       "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
@@ -5540,15 +5487,6 @@
         "node": ">=0.4.0"
       }
     },
-    "node_modules/fetch-cookie": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-2.1.0.tgz",
-      "integrity": "sha512-39+cZRbWfbibmj22R2Jy6dmTbAWC+oqun1f1FzQaNurkPDUP4C38jpeZbiXCR88RKRVDp8UcDrbFXkNhN+NjYg==",
-      "dependencies": {
-        "set-cookie-parser": "^2.4.8",
-        "tough-cookie": "^4.0.0"
-      }
-    },
     "node_modules/file-loader": {
       "version": "1.1.11",
       "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz",
@@ -8202,25 +8140,6 @@
         "lower-case": "^1.1.1"
       }
     },
-    "node_modules/node-fetch": {
-      "version": "2.7.0",
-      "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
-      "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
-      "dependencies": {
-        "whatwg-url": "^5.0.0"
-      },
-      "engines": {
-        "node": "4.x || >=6.0.0"
-      },
-      "peerDependencies": {
-        "encoding": "^0.1.0"
-      },
-      "peerDependenciesMeta": {
-        "encoding": {
-          "optional": true
-        }
-      }
-    },
     "node_modules/node-forge": {
       "version": "0.10.0",
       "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz",
@@ -11852,11 +11771,6 @@
       "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==",
       "dev": true
     },
-    "node_modules/psl": {
-      "version": "1.9.0",
-      "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",
-      "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag=="
-    },
     "node_modules/public-encrypt": {
       "version": "4.0.3",
       "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz",
@@ -11964,7 +11878,8 @@
     "node_modules/querystringify": {
       "version": "2.2.0",
       "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
-      "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ=="
+      "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==",
+      "dev": true
     },
     "node_modules/quill": {
       "version": "1.3.7",
@@ -12394,7 +12309,8 @@
     "node_modules/requires-port": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
-      "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ=="
+      "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
+      "dev": true
     },
     "node_modules/resize-observer-polyfill": {
       "version": "1.5.1",
@@ -12720,11 +12636,6 @@
       "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
       "dev": true
     },
-    "node_modules/set-cookie-parser": {
-      "version": "2.6.0",
-      "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz",
-      "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ=="
-    },
     "node_modules/set-value": {
       "version": "2.0.1",
       "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
@@ -13936,33 +13847,6 @@
       "integrity": "sha512-FclLrw8b9bMWf4QlCJuHBEVhSRsqDj6u3nIjAzPeJvgl//1hBlffdlk0MALceL14+koWEdU4ofRAXofbODxQzg==",
       "dev": true
     },
-    "node_modules/tough-cookie": {
-      "version": "4.1.3",
-      "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz",
-      "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==",
-      "dependencies": {
-        "psl": "^1.1.33",
-        "punycode": "^2.1.1",
-        "universalify": "^0.2.0",
-        "url-parse": "^1.5.3"
-      },
-      "engines": {
-        "node": ">=6"
-      }
-    },
-    "node_modules/tough-cookie/node_modules/punycode": {
-      "version": "2.3.1",
-      "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
-      "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
-      "engines": {
-        "node": ">=6"
-      }
-    },
-    "node_modules/tr46": {
-      "version": "0.0.3",
-      "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
-      "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
-    },
     "node_modules/trim-newlines": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz",
@@ -14264,14 +14148,6 @@
         "imurmurhash": "^0.1.4"
       }
     },
-    "node_modules/universalify": {
-      "version": "0.2.0",
-      "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz",
-      "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==",
-      "engines": {
-        "node": ">= 4.0.0"
-      }
-    },
     "node_modules/unpipe": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
@@ -14412,6 +14288,7 @@
       "version": "1.5.10",
       "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
       "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
+      "dev": true,
       "dependencies": {
         "querystringify": "^2.1.1",
         "requires-port": "^1.0.0"
@@ -14958,11 +14835,6 @@
         "minimalistic-assert": "^1.0.0"
       }
     },
-    "node_modules/webidl-conversions": {
-      "version": "3.0.1",
-      "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
-      "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
-    },
     "node_modules/webpack": {
       "version": "3.12.0",
       "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.12.0.tgz",
@@ -15585,15 +15457,6 @@
         "node": ">=0.8.0"
       }
     },
-    "node_modules/whatwg-url": {
-      "version": "5.0.0",
-      "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
-      "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
-      "dependencies": {
-        "tr46": "~0.0.3",
-        "webidl-conversions": "^3.0.0"
-      }
-    },
     "node_modules/whet.extend": {
       "version": "0.9.9",
       "resolved": "https://registry.npmjs.org/whet.extend/-/whet.extend-0.9.9.tgz",

+ 1 - 1
package.json

@@ -10,6 +10,7 @@
     "build": "node build/build.js"
   },
   "dependencies": {
+    "@aspnet/signalr": "^1.0.27",
     "@ckeditor/ckeditor5-build-classic": "^38.1.0",
     "@ckeditor/ckeditor5-vue2": "^3.0.1",
     "@fullcalendar/core": "^6.1.4",
@@ -17,7 +18,6 @@
     "@fullcalendar/interaction": "^6.1.4",
     "@fullcalendar/timegrid": "^6.1.4",
     "@fullcalendar/vue": "^6.1.4",
-    "@microsoft/signalr": "^8.0.0",
     "axios": "^1.3.4",
     "element-ui": "^2.15.13",
     "pinyin-pro": "^3.17.0",

+ 70 - 0
src/components/child/test.vue

@@ -0,0 +1,70 @@
+<template>
+    <div class="home">
+      <h1>前端演示SignalR</h1>
+      <input v-model="user" type="text" />
+      <input v-model="message" type="text" />
+      <button @click="sendAll">发送全部</button>
+      <button @click="sendOwn">对自己发送</button>
+      <div>
+        <ul v-for="(item ,index) in messages" v-bind:key="index +'itemMessage'">
+          <li>{{item.user}} says {{item.message}}</li>
+        </ul>
+      </div>
+    </div>
+  </template>
+  
+  <script>
+  import * as signalR from "@aspnet/signalr";
+  export default {
+    name: "SignalR",
+    components: {},
+    data() {
+      return {
+        user: "", //用户
+        message: "", //消息
+        connection: "", //signalr连接
+        messages: [] //返回消息
+      };
+    },
+    methods: {
+      //给全部发送消息
+      sendAll: function() {
+        this.connection
+          .invoke("SendMessage", this.user, this.message)
+          .catch(function(err) {
+            return console.error(err);
+          });
+      },
+      //只给自己发送消息
+      sendOwn: function() {
+        this.connection
+          .invoke("SendMessageCaller", this.message)
+          .catch(function(err) {
+            return console.error(err);
+          });
+      }
+  
+   
+    },
+    created: function() {
+      let thisVue = this;
+      this.connection = new signalR.HubConnectionBuilder()
+        .withUrl("http://132.232.92.186:8888/api/chatHub", {
+          skipNegotiation: true,
+          transport: signalR.HttpTransportType.WebSockets
+        })
+        .configureLogging(signalR.LogLevel.Information)
+        .build();
+      this.connection.on("ReceiveMessage", function(user, message,inif) {
+        thisVue.messages.push({ user, message,inif });
+        console.log({ user, message,inif });
+      });
+      this.connection.on("ReceiveCaller", function(message) {
+        let user = "自己";//这里为了push不报错,我就弄了一个默认值。
+        thisVue.messages.push({ user, message });
+        console.log({ user, message });
+      });
+      this.connection.start();
+    }
+  };
+  </script>

+ 29 - 26
src/components/home.vue

@@ -187,6 +187,7 @@
   </div>
 </template>
 <script>
+import * as signalR from "@aspnet/signalr";
 // const signalR=require('@microsoft/signalr')
 // import * as signalR from "@microsoft/signalr";
 // import * as signalR from "../../node_modules/microso";
@@ -194,6 +195,8 @@
 export default {
   data() {
     return {
+      userId:'',
+      token:'',
       menuList: [],
       isCollapse: false,
       panduan: "",
@@ -311,31 +314,29 @@ export default {
     },
 
     //消息通知
-    PostTaskAllocationInit(){
-            var url = "/api/PersonnelModule/PostTaskAllocationInit"
-            var that = this
-            this.$axios({
-                method: 'post',
-                url: url,
-                headers: {
-                    Authorization: 'Bearer ' + that.userId
-                },
-                data:{
-                    portType:1,
-                    userId: 5
-                }
-            }).then(function (res) {
-                console.log(res)
-                if(res.data.code==200){
-                    that.persolist=res.data.data.executeTaskUserInfos;
-                    that.PostTaskAllocationDetails()
-                }else{
-                    that.$message.error(res.data.msg);
-                }
-            }).catch(function (error) {
-                that.$message.error("获取数据源失败!");
-            });
-        },
+    chatHub(){
+        var url = "/api/chatHub"
+        var that = this
+        this.$axios({
+            method: 'post',
+            url: url,
+            headers: {
+                Authorization: 'Bearer ' + that.token
+            },
+            data:{
+              userId:that.userId
+            }
+        }).then(function (res) {
+            console.log(res)
+            if(res.data.code==200){
+              
+            }else{
+                that.$message.error(res.data.msg);
+            }
+        }).catch(function (error) {
+            that.$message.error("获取数据源失败!");
+        });
+    },
 
     //实时通讯
     // async startConnection() {
@@ -365,11 +366,13 @@ export default {
     // },
   },
   mounted() {
+    this.userId=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
+    this.token=JSON.parse(localStorage.getItem('userinif')).token;
     this.removal();
     this.radioChange(false);
     this.ifIndexValue();
     this.getmenu();
-    console.log(this.$store.state.webSocketMsg)
+    // this.chatHub();
   },
   created() {
     this.userinif = JSON.parse(localStorage.getItem('userinif'));

+ 40 - 39
src/components/system/AssignTasks.vue

@@ -118,7 +118,7 @@
 export default {
     data () {
         return {
-            id:'',
+            id:0,
             token:'',
             pageId:'',
             userId:'',
@@ -225,43 +225,44 @@ export default {
         //获取详情
         PostTaskAllocationDetails(){
             console.log(this.id)
-            if(this.id==undefined){
-                return
-            }
-            var url = "/api/PersonnelModule/PostTaskAllocationDetails"
-            var that = this
-            this.$axios({
-                method: 'post',
-                url: url,
-                headers: {
-                    Authorization: 'Bearer ' + that.userId
-                },
-                data:{
-                    portType:1,
-                    userId: 5,
-                    pageId: that.pageId,
-                    id: that.id,
-                }
-            }).then(function (res) {
-                console.log(res)
-                if(res.data.code==200){
-                    that.taskform.department=res.data.data.depId;
-                    that.taskform.taskname=res.data.data.taskName;
-                    that.taskform.value=res.data.data.taskPriority;
-                    that.taskform.Thegroup=res.data.data.diId;
-                    for(var i=0;i<res.data.data.userTaskInfos.length;i++){
-                        that.taskform.staff.push(res.data.data.userTaskInfos[i].userId);
+            if(this.id==undefined||this.id==NaN){
+                return false
+            }else{
+                var url = "/api/PersonnelModule/PostTaskAllocationDetails"
+                var that = this
+                this.$axios({
+                    method: 'post',
+                    url: url,
+                    headers: {
+                        Authorization: 'Bearer ' + that.userId
+                    },
+                    data:{
+                        portType:1,
+                        userId: 5,
+                        pageId: that.pageId,
+                        id: that.id,
                     }
-                    that.content=res.data.data.taskContent;
-                    that.taskform.schedulerules=[res.data.data.predictBeginTime,res.data.data.predictEndTime];
-                    that.taskform.kpi=res.data.data.isIntoPerformance==1?true:false;
-                    
-                }else{
-                    that.$message.error(res.data.msg);
-                }
-            }).catch(function (error) {
-                that.$message.error("获取详情");
-            });
+                }).then(function (res) {
+                    console.log(res)
+                    if(res.data.code==200){
+                        that.taskform.department=res.data.data.depId;
+                        that.taskform.taskname=res.data.data.taskName;
+                        that.taskform.value=res.data.data.taskPriority;
+                        that.taskform.Thegroup=res.data.data.diId;
+                        for(var i=0;i<res.data.data.userTaskInfos.length;i++){
+                            that.taskform.staff.push(res.data.data.userTaskInfos[i].userId);
+                        }
+                        that.content=res.data.data.taskContent;
+                        that.taskform.schedulerules=[res.data.data.predictBeginTime,res.data.data.predictEndTime];
+                        that.taskform.kpi=res.data.data.isIntoPerformance==1?true:false;
+                        
+                    }else{
+                        that.$message.error(res.data.msg);
+                    }
+                }).catch(function (error) {
+                    that.$message.error("获取详情失败");
+                });
+            }
         },
         //基础数据原
         PostTaskAllocationInit(){
@@ -358,7 +359,7 @@ export default {
                     portType:1,
                     userId: 5,
                     pageId: that.pageId,
-                    id: 0,
+                    id: id,
                     depId: that.taskform.department,
                     diId: that.taskform.Thegroup,
                     taskPriority:that.taskform.value,
@@ -392,7 +393,7 @@ export default {
         }
     },
     mounted(){
-        this.id = Number(this.$route.query.id);
+        this.id = this.$route.query.id;
         this.token=JSON.parse(localStorage.getItem('userinif')).token;
         this.pageId=Number(localStorage.getItem('indexs').split('-')[1]);//页面id
         this.userId=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;

+ 593 - 34
src/components/system/TaskList.vue

@@ -6,7 +6,7 @@
                 <el-form style="display: flex;justify-content: space-between;align-items: center;" label-width="70px" class="demo-ruleForm">
                     <div class="tasklist-head-select">
                         <el-form-item label="任务名称" prop="name">
-                            <el-select size="medium" @change="changetasknames" filterable  v-model="tasknames" placeholder="请选择">
+                            <el-select :clearable="true" size="medium" @change="changetasknames" filterable  v-model="tasknames" placeholder="请选择">
                                 <el-option
                                     v-for="item in tasknamelist"
                                     :key="item"
@@ -45,6 +45,114 @@
                 :data="tableData"
                 border
                 style="width: 100%">
+                    <el-table-column type="expand">
+                        <template slot-scope="scopee">                                                                                                                                                                                                                                                                                                                                                                                                                             
+                            <div v-if="userId==scopee.row.taskerDetails[0].taskCreateUserId" class="table-boxli">
+                                <el-table
+                                :data="scopee.row.taskerDetails"
+                                border
+                                style="width: 100%">
+                                    <el-table-column 
+                                    type="index" 
+                                    label="序号" 
+                                    width="50" >
+                                    </el-table-column>
+                                    <el-table-column
+                                    prop="userName"
+                                    label="姓名"
+                                    width="100">
+                                    </el-table-column>
+                                    <el-table-column
+                                    prop="beginTime"
+                                    label="开始日期"
+                                    width="180">
+                                    </el-table-column>
+                                    <el-table-column
+                                    prop="overTime"
+                                    label="完成日期"
+                                    width="180">
+                                    </el-table-column>
+                                    <el-table-column
+                                    label="状态"
+                                    width="80">
+                                        <template slot-scope="scopeStatus">
+                                            <span v-if="scopeStatus.row.taskStatus==-1">
+                                                未开始 
+                                            </span>
+                                            <span v-if="scopeStatus.row.taskStatus==0">
+                                                已知晓
+                                            </span>
+                                            <span v-if="scopeStatus.row.taskStatus==1">
+                                                进行中
+                                            </span>
+                                            <span v-if="scopeStatus.row.taskStatus==2">
+                                                待审核
+                                            </span>
+                                            <span v-if="scopeStatus.row.taskStatus==3">
+                                                未完成
+                                            </span>
+                                            <span v-if="scopeStatus.row.taskStatus==4">
+                                                已完成
+                                            </span>
+                                            <span v-if="scopeStatus.row.taskStatus==5">
+                                                任务中止
+                                            </span>
+                                        </template>
+                                    </el-table-column>
+                                    <el-table-column
+                                    prop="score"
+                                    label="评分"
+                                    width="180">
+                                    <template slot-scope="scopescore">
+                                        <span v-if="scopescore.row.score==0">
+                                            未评分
+                                        </span>
+                                        <span v-if="scopescore.row.score==1">
+                                            不合格
+                                        </span>
+                                        <span v-if="scopescore.row.score==2">
+                                            一般
+                                        </span>
+                                        <span v-if="scopescore.row.score==3">
+                                            良好
+                                        </span>
+                                        <span v-if="scopescore.row.score==4">
+                                            优秀
+                                        </span>
+                                    </template>
+                                    </el-table-column>
+                                    <el-table-column
+                                    prop="scoreRemark"
+                                    label="评分备注"
+                                    width="250">
+                                    </el-table-column>
+                                    <el-table-column
+                                    prop="cause"
+                                    label="备注">
+                                    </el-table-column>
+                                    <el-table-column
+                                    label="操作"
+                                    width="180">
+                                    <template slot-scope="scopes">
+                                        <el-select v-if="scopes.row.taskStatus==2" size="small" @change="statuschange($event,scopes.row)" style="width:100px;margin-right: 15px;" v-model="reviewstatus" placeholder="请选择">
+                                            <!-- <el-option label="未审核" value="shanghai"></el-option> -->
+                                            <el-option label="已完成" value="4"></el-option>
+                                            <!-- <el-option label="终止" value="beijing"></el-option> -->
+                                            <el-option label="未完成" value="3"></el-option>
+                                        </el-select>
+                                        <el-button
+                                        v-if="scopes.row.taskStatus==4"
+                                        type="text"
+                                        size="small"
+                                        @click="scoreclick(scopes.$index,scopes.row)">
+                                        评分
+                                        </el-button>
+                                    </template>
+                                    </el-table-column>
+                                </el-table>
+                            </div>
+                        </template>
+                    </el-table-column>
                     <el-table-column
                     prop="taskName"
                     label="任务名称">
@@ -63,22 +171,47 @@
                     prop="status"
                     label="状态"
                     width="80">
-                    <template slot-scope="scope">
-                        <span v-if="scope.row.status==0">
-                            未开始
-                        </span>
-                        <span v-if="scope.row.status==1">
-                            进行中
-                        </span>
-                        <span v-if="scope.row.status==2">
-                            待审核
-                        </span>
-                        <span v-if="scope.row.status==3">
-                            未完成
-                        </span>
-                        <span v-if="scope.row.status==4">
-                            已完成
-                        </span>
+                    <template slot-scope="scopes">
+                        <div  v-if="scopes.row.createUserName==cnName">
+                            <span v-if="scopes.row.status==0">
+                                未开始
+                            </span>
+                            <span v-if="scopes.row.status==1">
+                                进行中
+                            </span>
+                            <span v-if="scopes.row.status==2">
+                                待审核
+                            </span>
+                            <span v-if="scopes.row.status==3">
+                                未完成
+                            </span>
+                            <span v-if="scopes.row.status==4">
+                                已完成
+                            </span>
+                        </div>
+                        <div v-else-if="scopes.row.createUserName!=cnName">
+                            <span v-if="scopes.row.status==-1">
+                                未开始 
+                            </span>
+                            <span v-if="scopes.row.status==0">
+                                已知晓
+                            </span>
+                            <span v-if="scopes.row.status==1">
+                                进行中
+                            </span>
+                            <span v-if="scopes.row.status==2">
+                                待审核
+                            </span>
+                            <span v-if="scopes.row.status==3">
+                                未完成
+                            </span>
+                            <span v-if="scopes.row.status==4">
+                                已完成
+                            </span>
+                            <span v-if="scopes.row.status==5">
+                                任务中止
+                            </span>
+                        </div>
                     </template>
                         <!-- <template v-if="status" slot-scope="scope">
                             {{ scope.row.status==0? scope.row.status==1?:'全部'  }}
@@ -102,9 +235,11 @@
                     <el-table-column
                     prop="date"
                     label="预计起止时间"
-                    width="200">
-                        <template slot-scope="scope">
-                            {{ scope.row.predictBeginTime }}~{{ scope.row.predictEndTime }}
+                    width="170">
+                        <template slot-scope="scopeTime">
+                            {{ scopeTime.row.predictBeginTime }}
+                            <br/>
+                            {{ scopeTime.row.predictEndTime }}
                         </template>
                     </el-table-column>
                     <el-table-column
@@ -119,26 +254,50 @@
                     </el-table-column>
                     <el-table-column
                     label="操作"
-                    width="180">
-                        <template slot-scope="scope">
+                    width="210">
+                        <template slot-scope="scopebtn">
+                            <!-- //任务创建者
+                            确认任务完成 编辑 删除
+                            //任务归属者
+                            开始 完成  -->
                             <el-button
+                            v-if="cnName!=scopebtn.row.createUserName"
                             type="text"
-                            size="small">
-                            开始
+                            size="small"
+                            @click.native.prevent="PostTaskAllocationSetStartStatus(scopebtn.$index, scopebtn.row)">
+                            已知晓
                             </el-button>
                             <el-button
+                            v-if="cnName!=scopebtn.row.createUserName"
                             type="text"
-                            size="small">
+                            size="small"
+                            @click.native.prevent="PostTaskAllocationSetOverStatus(scopebtn.$index, scopebtn.row)">
                             完成
                             </el-button>
                             <el-button
-                            @click.native.prevent="taskedit(scope.$index, scope.row)"
+                            v-if="cnName==scopebtn.row.createUserName"
+                            @click.native.prevent="taskedit(scopebtn.$index, scopebtn.row)"
                             type="text"
                             size="small">
                             编辑
                             </el-button>
                             <el-button
-                            @click.native.prevent="deleteRow(scope.$index, tableData)"
+                            v-if="cnName!=scopebtn.row.createUserName"
+                            @click.native.prevent="taskedit(scopebtn.$index, scopebtn.row)"
+                            type="text"
+                            size="small">
+                            详细
+                            </el-button>
+                            <el-button
+                            v-if="cnName==scopebtn.row.createUserName"
+                            @click.native.prevent="PostTaskAllocationTermination(scopebtn.$index, scopebtn.row)"
+                            type="text"
+                            size="small">
+                            任务终止
+                            </el-button>
+                            <el-button
+                            v-if="cnName==scopebtn.row.createUserName"
+                            @click.native.prevent="deleteRow(scopebtn.$index,scopebtn.row,tableData)"
                             type="text"
                             size="small">
                             移除
@@ -156,12 +315,37 @@
                     layout="total, sizes, prev, pager, next, jumper"
                     :total="count">
                     </el-pagination>
-                </div>
+                </div> 
             </div>
+            <el-dialog top="30vh" width="900px" title="等级评分" :visible.sync="dialogFormVisible">
+                <el-form >
+                    <div class="score-box">
+                        <el-form-item label="姓名" :label-width="labelWidth">
+                            <el-input :disabled="true" v-model="scorename" placeholder="姓名"></el-input>
+                        </el-form-item>
+                        <el-form-item label="评分" :label-width="labelWidth">
+                            <el-radio-group v-model="score">
+                                <el-radio label="不合格"></el-radio>
+                                <el-radio label="一般"></el-radio>
+                                <el-radio label="良好"></el-radio>
+                                <el-radio label="优秀"></el-radio>
+                              </el-radio-group>
+                        </el-form-item>
+                        <el-form-item size="medium" label="评分备注" :label-width="labelWidth">
+                            <el-input rows="1" type="textarea" v-model="scoreRemark"></el-input>
+                        </el-form-item>
+                    </div>
+                </el-form>
+                <div slot="footer" class="dialog-footer">
+                  <el-button @click="dialogFormVisible = false">取 消</el-button>
+                  <el-button type="primary" @click="scoreconfirm()">确 定</el-button>
+                </div>
+              </el-dialog>
         </div>
     </div>
 </template>
 <script>
+import { co } from '@fullcalendar/core/internal-common'
 export default {
     data () {
         return {
@@ -219,6 +403,15 @@ export default {
             pagesize:10,
             currentPage: 1,
             count:0,
+            dialogFormVisible:false,
+            labelWidth:'80px',
+            scorename:'',
+            score:'',
+            scoreid:'',
+            ID:'',
+            scoreRemark:'',
+            cnName:'',//登录用户名
+            reviewstatus:'',
         }
     },
     methods: {
@@ -257,6 +450,17 @@ export default {
             }
             var url = "/api/PersonnelModule/PostTaskAllocationPage"
             var that = this
+            var data={
+                    portType:1,
+                    userId: that.userId,
+                    pageId: that.pageId,
+                    pageIndex: that.currentPage,
+                    pageSize: that.pagesize,
+                    type: that.assignmenttype,
+                    status: that.completionstatus,
+                    taskName: that.tasknames,
+                }
+                console.log(JSON.stringify(data))
             this.$axios({
                 method: 'post',
                 url: url,
@@ -285,8 +489,47 @@ export default {
                 that.$message.error("获取数据源失败!");
             });
         },
-        deleteRow(index, rows) {
-            rows.splice(index, 1);
+        deleteRow(index,row,rows) {
+            this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+            }).then(() => {
+                var url = "/api/PersonnelModule/PostTaskAllocationDel"
+                var that = this
+                this.$axios({
+                    method: 'post',
+                    url: url,
+                    headers: {
+                        Authorization: 'Bearer ' + that.userId
+                    },
+                    data:{                                                                                                                                                      
+                        portType: 1,
+                        userId: that.userId,
+                        pageId: that.pageId,
+                        id: row.id,
+                    }
+                }).then(function (res) {
+                    console.log(res)
+                    if(res.data.code==200){
+                        that.$message({
+                            message: res.data.msg,
+                            type: 'success'
+                        });
+                        rows.splice(index, 1);
+                    }else{
+                        that.$message.error(res.data.msg);
+                    }
+                }).catch(function (error) {
+                    that.$message.error("任务终止失败!");
+                });
+            }).catch(() => {
+                this.$message({
+                    type: 'info',
+                    message: '已取消删除'
+                });          
+            });
+            
         },
         //每页条数改变时触发 选择一页显示多少行
         handleSizeChange(val) {
@@ -320,17 +563,286 @@ export default {
         taskedit(index,val){
             // this.$router.push({path: '/home/AssignTasks?id='+val.id+''});
             // this.$router.push({path: '/home/MyTasksinif?id='+val.id+''});
-            var cnName=JSON.parse(localStorage.getItem('userinif')).userInfo.cnName;
-            if(val.createUserName==cnName){
+            
+            if(val.createUserName==this.cnName){
                 this.$router.push({path: '/home/AssignTasks?id='+val.id+''});
             }else{
-                if(val.participant.indexOf(cnName)!=-1){
+                if(val.participant.indexOf(this.cnName)!=-1){
                     this.$router.push({path: '/home/MyTasksinif?id='+val.id+''});
                 }else{
                     this.$message.error("此任务被指派人没有此账号!");
                 }
             }
-            console.log(val,cnName);
+        },
+        //基础数据原
+        PostTaskAllocationInit(){
+            var url = "/api/PersonnelModule/PostTaskAllocationInit"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.userId
+                },
+                data:{
+                    portType:1,
+                    userId: that.userId
+                }
+            }).then(function (res) {
+                console.log(res)
+                if(res.data.code==200){
+                    that.tasknamelist=res.data.data.taskNameInfos;
+                    that.PostTaskAllocationPage()
+                }else{
+                    that.$message.error(res.data.msg);
+                }
+            }).catch(function (error) {
+                that.$message.error("获取数据源失败!");
+            });
+        },
+        //开始
+        PostTaskAllocationSetStartStatus(index,row){
+            console.log(row)
+            if(row.status>=1){
+                this.$message.error('此任务已经开始!');
+                return false
+            }else{
+                var url = "/api/PersonnelModule/PostTaskAllocationSetStartStatus"
+                var that = this
+                this.$axios({
+                    method: 'post',
+                    url: url,
+                    headers: {
+                        Authorization: 'Bearer ' + that.userId
+                    },
+                    data:{
+                        userId: that.userId,
+                        id: row.id,
+                    }
+                }).then(function (res) {
+                    console.log(res)
+                    if(res.data.code==200){
+                        that.$message({
+                            message: res.data.msg,
+                            type: 'success'
+                        });
+                        that.PostTaskAllocationPage();
+                    }else{
+                        that.$message.error(res.data.msg);
+                    }
+                }).catch(function (error) {
+                    that.$message.error("操作失败(开始步骤)");
+                });
+            }
+        },
+        //完成
+        PostTaskAllocationSetOverStatus(index,row){
+            if(row.status==2||row.status==0||row.status==4){
+                this.$message.error('此任务未开始或待审核,请勿多次提交!');
+                return false
+            }else{
+                var url = "/api/PersonnelModule/PostTaskAllocationSetOverStatus"
+                var that = this
+                this.$axios({
+                    method: 'post',
+                    url: url,
+                    headers: {
+                        Authorization: 'Bearer ' + that.userId
+                    },
+                    data:{
+                        userId: that.userId,
+                        id: row.id,
+                    }
+                }).then(function (res) {
+                    console.log(res)
+                    if(res.data.code==200){
+                        that.$message({
+                            message: res.data.msg,
+                            type: 'success'
+                        });
+                        that.PostTaskAllocationPage();
+                    }else{
+                        that.$message.error(res.data.msg);
+                    }
+                }).catch(function (error) {
+                    that.$message.error("操作失败(完成步骤)");
+                });
+            }
+        },
+        //评分
+        scoreclick(index,row){
+            console.log(index,row)
+            this.dialogFormVisible=true;
+            this.scorename=row.userName;
+            this.scoreid=row.taId;
+            this.scoreRemark=row.scoreRemark;
+            this.ID=row.id;
+            if(row.score==0){
+                this.score='良好';
+            }else{
+                this.score=row.score==4?'优秀':row.score==3?'良好':row.score==2?'一般':'不合格';
+            }
+        },
+        //评分确认
+        scoreconfirm(){
+            var score=3
+            if(this.score=='不合格'){
+                score=1
+            }else if(this.score=='一般'){
+                score=2
+            }else if(this.score=='良好'){
+                score=3
+            }else{
+                score=4
+            }
+            var url = "/api/PersonnelModule/PostTaskAllocationScore"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.userId
+                },
+                data:{                                                                                                                                                      
+                    portType: 1,
+                    userId: that.userId,
+                    pageId: that.pageId,
+                    subId: that.ID,
+                    score: score,
+                    scoreRemark: that.scoreRemark,
+                }
+            }).then(function (res) {
+                console.log(res)
+                if(res.data.code==200){
+                    that.dialogFormVisible=false;                              
+                    that.$message({
+                        message: res.data.msg,
+                        type: 'success'
+                    });
+                    that.PostTaskAllocationPage();
+                }else{
+                    that.$message.error(res.data.msg);
+                }
+            }).catch(function (error) {
+                that.$message.error("获取数据源失败!");
+            });
+        },
+        //change
+        statuschange(val,row){
+            console.log(val,row)
+            if(val==4){
+                this.PostTaskAllocationSetAuditStatus(row.id);
+            }else if(val==3){
+                this.open(row.id);
+            }
+        },
+        //审核
+        PostTaskAllocationSetAuditStatus(id){
+            var url = "/api/PersonnelModule/PostTaskAllocationSetAuditStatus"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.userId
+                },
+                data:{
+                    subId:id,
+                }
+            }).then(function (res) {
+                console.log(res)
+                if(res.data.code==200){
+                    that.$message({
+                        message: res.data.msg,
+                        type: 'success'
+                    });
+                    that.PostTaskAllocationPage();
+                }else{
+                    that.$message.error(res.data.msg);
+                }
+            }).catch(function (error) {
+                that.$message.error("审核失败!");
+            });
+        },
+        open(id) {
+            this.$prompt('请输入未完成原因', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            inputPattern: /^.+$/,
+            inputErrorMessage: '原因不能为空'
+            }).then(({ value }) => {
+                this.PostTaskAllocationSetUnFinishedStatus(id,value)
+                // this.$message({
+                //     type: 'success',
+                //     message: '你的邮箱是: ' + value
+                // });
+            }).catch(() => {
+                this.reviewstatus='';
+                // this.$message({
+                //     type: 'info',
+                //     message: '取消输入'
+                // });       
+            });
+        },
+        //未完成
+        PostTaskAllocationSetUnFinishedStatus(id,val){
+            var url = "/api/PersonnelModule/PostTaskAllocationSetUnFinishedStatus"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.userId
+                },
+                data:{
+                    subId:id,
+                    cause:val,
+                }
+            }).then(function (res) {
+                console.log(res)
+                if(res.data.code==200){
+                    that.$message({
+                        message: res.data.msg,
+                        type: 'success'
+                    });
+                    that.PostTaskAllocationPage();
+                }else{
+                    that.$message.error(res.data.msg);
+                }
+            }).catch(function (error) {
+                that.$message.error("审核失败!");
+            });
+        },
+        //任务终止
+        PostTaskAllocationTermination(index,row){
+            var url = "/api/PersonnelModule/PostTaskAllocationTermination"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.userId
+                },
+                data:{                                                                                                                                                      
+                    portType: 1,
+                    userId: that.userId,
+                    pageId: that.pageId,
+                    id: row.id,
+                }
+            }).then(function (res) {
+                console.log(res)
+                if(res.data.code==200){
+                    that.$message({
+                        message: res.data.msg,
+                        type: 'success'
+                    });
+                    that.PostTaskAllocationPage();
+                }else{
+                    that.$message.error(res.data.msg);
+                }
+            }).catch(function (error) {
+                that.$message.error("任务终止失败!");
+            });
         },
     },
     filters:{
@@ -350,6 +862,7 @@ export default {
         this.pageId=Number(localStorage.getItem('indexs').split('-')[1]);//页面id
         this.userId=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
         this.jobName=JSON.parse(localStorage.getItem('userinif')).userInfo.jobName;
+        this.cnName=JSON.parse(localStorage.getItem('userinif')).userInfo.cnName;
         this.PostTaskAllocationInit()
     }
 }
@@ -382,4 +895,50 @@ export default {
     text-align: center;
     margin-top: 15px;
 }
+.score-box{
+    display: flex;
+    flex-wrap: wrap;
+}
+.score-box .el-form-item_content{
+    width: 100%;
+}
+.score-box .el-form-item:nth-child(1){
+    width: 50%;
+}
+.score-box .el-form-item:nth-child(2){
+    width: 50%;
+}
+.score-box .el-form-item:nth-child(3){
+    width: 100%;
+}
+.tasklist-table .demo-table-expand {
+    font-size: 0;
+}
+.tasklist-table .demo-table-expand label {
+    width: 90px;
+    color: #99a9bf;
+}
+.tasklist-table .demo-table-expand .el-form-item {
+    margin-right: 0;
+    margin-bottom: 0;
+    width: 50%;
+}
+.table-boxli{
+    text-align: center;
+    padding: 0 20px;
+}
+.table-boxli .el-table--border, .el-table--group{
+    border: 1px solid #b5bfd7;
+}
+.table-boxli .el-table--border .el-table__cell{
+    border: 1px solid #b5bfd7;
+    padding: 12px 0;
+    min-width: 0;
+    -webkit-box-sizing: border-box;
+    box-sizing: border-box;
+    text-overflow: ellipsis;
+    vertical-align: middle;
+    position: relative;
+    text-align: left;
+}
 </style>

+ 6 - 0
src/router/index.js

@@ -97,6 +97,7 @@ import PickupList from '@/components/OP/PickupList';
 import TaskList from '@/components/system/TaskList';
 import AssignTasks from '@/components/system/AssignTasks';
 import MyTasksinif from '@/components/system/MyTasksinif';
+import test from '@/components/child/test';
 
 
 
@@ -572,6 +573,11 @@ export default new Router({
           name: 'MyTasksinif',
           component: MyTasksinif
         },
+        {
+          path: '/home/test',
+          name: 'test',
+          component: test
+        },
       ]
     },
     {