2
3
yuedefeng 5 лет назад
Родитель
Сommit
ae181721d6

+ 28 - 45
src/dashoo.cn/frontend_web/src/pages/select/processselect/wfmultihistory.vue

@@ -1,6 +1,6 @@
 <template>
   <div style="overflow: auto">
-    <el-table highlight-current-row :data="historyTask" border>
+    <el-table :data="historyTask" border size="mini">
       <el-table-column prop="taskName" sortable min-width="130" label="当前状态" align="center" show-overflow-tooltip></el-table-column>
       <el-table-column prop="remarks" sortable min-width="130" label="审批意见" align="center" show-overflow-tooltip>
         <template slot-scope="scope">
@@ -23,7 +23,7 @@
       </el-table-column>
       <el-table-column prop="startTime" sortable min-width="150" label="开始时间" align="center" show-overflow-tooltip>
         <template slot-scope="scope">
-          {{ jstimehandle(timestampToTime(scope.row.startTime)) }}
+          {{ timestampToTime(scope.row.startTime) }}
         </template>
       </el-table-column>
       <el-table-column prop="endTime" sortable min-width="150" label="结束时间" align="center" show-overflow-tooltip>
@@ -32,9 +32,9 @@
         </template>
       </el-table-column>
     </el-table>
-    <!-- <div style="margin-top:5px; text-align: center;">
+    <!--<el-card style="text-align: center; overflow-x: auto">
       <img :src="baseurl + 'workflow/historyimg/' + entryinfo.instance +'?t='+(new Date()).getTime() " v-if="entryinfo.instance">
-    </div> -->
+    </el-card>-->
   </div>
 </template>
 
@@ -42,10 +42,9 @@
   import {
     mapGetters
   } from 'vuex'
-  import payapi from '@/api/oilsupplier/paymentinfo'
 
   export default {
-    name: 'wfmultihistory',
+    name: 'wfhistory',
     props: {
       visible: {
         type: Boolean,
@@ -54,6 +53,9 @@
       entryinfo: {}
     },
     created () {
+      this.historyTask = []
+      this.tmp_historyTask = []
+      this.userlist = []
       this.getHistoryTask()
     },
     computed: {
@@ -64,6 +66,9 @@
     watch: {
       entryinfo: {
         handler: function (newVal, oldVal) {
+          this.historyTask = []
+          this.tmp_historyTask = []
+          this.userlist = []
           this.getHistoryTask()
         },
         deep: true
@@ -78,70 +83,58 @@
         instance: '',
         selfVisible: this.visible, // 避免vue双向绑定警告
         historyTask: [],
-        userlist: [],
+        tmp_historyTask: [],
+        userlist: []
       }
     },
     methods: {
       getHistoryTask () {
-        this.historyTask = []
-        let _this = this
-        this.$axios.get('/audithistory/list?id=' + this.entryinfo.business)
-          .then(res => {
-            let instanceIds = ''
-            for (let idx in res.data.item) {
-              instanceIds += res.data.item[idx].WorkflowId + ','
-            }
-            instanceIds += _this.entryinfo.instance + ','
-            _this.getHistoryMultiTask(instanceIds)
-          })
-          .catch(err => {
-            // handle error
-            console.error(err)
-          })
-      },
-      getHistoryMultiTask (instanceIds) {
+        this.tmp_historyTask = []
         let _this = this
         const params = {
           process: _this.entryinfo.process,
           business: _this.entryinfo.business,
-          instance: instanceIds
+          instance: _this.entryinfo.instance
         }
-        this.$axios.get('/workflow/historymultitask', {
+        this.$axios.get('workflow/historytask', {
           params
         })
           .then(res => {
-            // _this.historyTask = res.data.items
+            console.log('历史任务', res.data)
             this.tmp_historyTask = res.data.items
             let useridstr = ''
             for (let i = 0; i < this.tmp_historyTask.length; i++) {
+              if (this.tmp_historyTask[i].assignee !== '') {
+                useridstr = useridstr + this.tmp_historyTask[i].assignee + ','
+              }
               if (this.tmp_historyTask[i].users !== '') {
                 useridstr = useridstr + this.tmp_historyTask[i].users + ','
               }
             }
             if (useridstr) {
               useridstr = useridstr.substring(0, useridstr.length - 1)
+              this.getuserlist(useridstr)
             }
-            this.getuserlist(useridstr)
           })
           .catch(err => {
             // handle error
             console.error(err)
           })
       },
-      assigneeToAssignee(val) {
+      assigneeToAssignee (val) {
         for (let i = 0; i < this.userlist.length; i++) {
           if (val == this.userlist[i].Id) {
             return this.userlist[i].Realname
           }
         }
       },
-      assigneeToUsers(users) {
-        let userNames = ""
+      assigneeToUsers (users) {
+        let userNames = ''
         let userArr = users.split(',')
         for (let idx = 0; idx < userArr.length; idx++) {
           let val = userArr[idx]
           for (let i = 0; i < this.userlist.length; i++) {
-            if (parseInt(val) == parseInt(this.userlist[i].Id)) {
+            if (parseInt(val) === parseInt(this.userlist[i].Id)) {
               userNames += this.userlist[i].Realname + ', '
             }
           }
@@ -152,28 +145,20 @@
         return userNames
       },
       getuserlist (val) {
+        // let params = {
+        //   userids: val
+        // }
         this.$axios.post('workflow/userlist_post?userids=' + val)
           .then(res => {
             // response
             this.userlist = res.data.items
             this.historyTask = this.tmp_historyTask
-            this.getpayinfo()
           })
           .catch(err => {
             // handle error
             console.error(err)
           })
       },
-      getpayinfo () {
-        let params = {
-          srcid: this.entryinfo.Id
-        }
-        this.$axios.get('/workflow/getWorkflowNodeBySrcId', {params}).then(res => {
-          if (res.data !== null) {
-            this.historyTask = this.historyTask.concat(res.data)
-          }
-        })
-      },
       timestampToTime (val) {
         var date = new Date(val) // 时间戳为10位需*1000,时间戳为13位的话不需乘1000
         var Y = date.getFullYear() + '-'
@@ -195,8 +180,6 @@
           return '----'
         } else if (val === '1970-01-1 8:0:0') {
           return '----'
-        } else if (val === '1-01-1 8:5:43') {
-          return '----'
         } else {
           val = val.replace('T', ' ')
           return val.substring(0, 19)