大件运输联网系统前端代码
guoshilong
2023-01-02 29bf5936bf1da2eea81f3abe07dc738f5267c42c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<template>
  <basic-container>
    <el-form ref="form" :model="form" label-width="80px">
      <el-row type="flex" class="row-bg" justify="end">
        <el-form-item>
          <el-button @click="handleCancel">关闭</el-button>
        </el-form-item>
      </el-row>
        <!--审批信息-->
      <el-card shadow="hover">
        <div slot="header">
          <span>审批信息</span>
        </div>
        <avue-form :option="option" v-model="form"/>
      </el-card>
        <!--流程信息-->
      <el-card shadow="hover">
        <div slot="header">
          <span>流程信息</span>
        </div>
        <el-row type="flex" class="row-bg">
          <el-timeline>
            <el-timeline-item :key="flow.id" :timestamp="flow.createTime" v-for="flow in flowList" placement="top">
              <el-card shadow="hover">
                <p>{{flow.assigneeName}} 在 [{{flow.createTime}}] 开始处理 [{{flow.historyActivityName}}] 环节</p>
                <p v-if="flow.historyActivityDurationTime!==''">任务历时 [{{flow.historyActivityDurationTime}}]</p>
                <p v-if="flow.comment!==''">反馈意见: [{{flow.comment}}]</p>
                <p v-if="flow.endTime!==''">结束时间: [{{flow.endTime}}]</p>
              </el-card>
            </el-timeline-item>
          </el-timeline>
        </el-row>
      </el-card>
        <!--流程跟踪-->
      <el-card shadow="hover">
        <div slot="header">
          <span>流程跟踪</span>
        </div>
        <el-row class="row-bg">
          <flow-design :is-display="true" :process-instance-id="processInstanceId"></flow-design>
        </el-row>
      </el-card>
    </el-form>
  </basic-container>
</template>
 
<script>
import {historyFlowList} from "@/api/work/process";
import {applicationDetail} from "@/api/application/application";
import option from "@/const/application/application";
 
export default {
  name: "detail",
  data() {
    return {
      businessId: '',
      processInstanceId: '',
      src: '',
      flowList: [],
      form: {
        flow:{
          assigneeName:'',
        },
      },
      option:option
    }
  },
  created() {
    this.init();
  },
  beforeDestroy() {
    this.controlOption('close')
  },
  methods: {
    init() {
      this.processInstanceId = this.$route.params.processInstanceId;
      this.businessId = this.$route.params.businessId;
 
      //控制option
      this.controlOption('open')
 
      historyFlowList(this.processInstanceId).then(res => {
        const data = res.data;
        if (data.success) {
          this.flowList = data.data;
        }
      })
      applicationDetail(this.businessId).then(res => {
        const data = res.data;
        if (data.success) {
          this.form = data.data;
          this.initForm()
        }
      })
    },
    handleCancel() {
      this.$router.$avueRouter.closeTag();
      this.$router.push({path: `/work/start`});
    },
    //给form表单中的字段赋值
    initForm(){
      let basic = this.form.basicInfoEntity
      let basicId = basic.id
      let plan = this.form.planEntity
      let planId = plan.id
      let scheme = this.form.schemeEntity
      let schemeId = scheme.id
      let car= this.form.carEntity
      let catId = car.id
      let goods = this.form.goodsEntity
      let goodsId = goods.id
      this.form.passTime = [basic.startPassTime,basic.endPassTime]
      let form = this.form
      //保留原form中的字段
      let common = Object.assign({},form)
 
      form = Object.assign(form,basic)
      form = Object.assign(form,plan)
      form = Object.assign(form,scheme)
      form = Object.assign(form,car)
      form = Object.assign(form,goods)
 
      //覆盖回原form
      form = Object.assign(form,common)
 
      this.form.basicInfoEntity.id = basicId
      this.form.planEntity.id = planId
      this.form.schemeEntity.id = schemeId
      this.form.carEntity.id =catId
      this.form.goodsEntity.id = goodsId
    },
    controlOption(arg){
      // const suggestion = this.findObject(this.option.column,"suggestion")
      // const comment = this.findObject(this.option.column,"comment")
      if (arg == 'open'){
        this.option.detail = true
        if (!this.form.suggestion){
          // suggestion.display = false
        }
        // comment.display = false
 
      }else if (arg == 'close'){
        this.option.detail = false
        // suggestion.display = true
        // comment.display = true
      }
 
    }
  }
}
</script>
 
<style scoped>
 
</style>