zhuguifei
2025-04-28 442928123f63ee497d766f9a7a14f0a6ee067e25
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<template>
  <a-card :bordered="false">
    <!--流程申请选择-->
    <a-input-search style="margin-bottom: 10px;margin-right:10px;width: 200px" v-model="searchProcessKey"
                    placeholder="输入流程名称" @search="onSearchProcess" />
    <a-button @click="onSearchProcess(searchProcessKey)" type="primary">查询</a-button>
    <a-button @click="onSearchProcess('')">重置</a-button>
    <a-button @click="handleToApplyList" type="primary" style="float: right;">前往我的申请列表</a-button>
      <a-empty description="无流程可供选择" v-if="activeKeyAll.length==0" />
      <div v-else>
        <a-collapse v-model="activeKey">
          <a-collapse-panel v-for="(value, index)  in activeKeyAll" :header="filterDictText(dictOptions,value)||'未分类'" :key="value">
            <a-list :grid="{ gutter: 10,column:4}" :dataSource="processDataMap[value]">
              <a-list-item slot="renderItem" slot-scope="item">
                <a-card>
                  <div slot="title">
                    <a-row>
                      <a-col span="12" :title="item.name">{{item.name}} </a-col>
                      <a-col span="12" style="text-align: right;">
                        <a href="javascript:void (0)" @click="chooseProcess(item)">发起申请</a>
                      </a-col>
                    </a-row>
                  </div>
                  <b>版本:</b>v.{{item.version}}
                  <br/>
                  <b>说明:</b>{{item.description}}
                </a-card>
              </a-list-item>
            </a-list>
          </a-collapse-panel>
        </a-collapse>
      </div>
    <!--流程表单-->
    <a-modal :destroyOnClose="true" :title="lcModa.title" v-model="lcModa.visible" :footer="null" :maskClosable="false" width="80%">
      <component :disabled="lcModa.disabled" v-if="lcModa.visible" :is="lcModa.formComponent"
                 :processData="lcModa.processData" :isNew = "lcModa.isNew"
                 @afterSubmit="afterSub" @close="lcModa.visible=false,lcModa.disabled = false"></component>
    </a-modal>
  </a-card>
 
</template>
 
<script>
import { deleteAction, getAction,downFile,postFormAction } from '@/api/manage'
  import { activitiMixin } from '@/views/activiti/mixins/activitiMixin'
  import JEllipsis from '@/components/jeecg/JEllipsis'
  import JTreeSelect from '@/components/jeecg/JTreeSelect'
  import {initDictOptions, filterDictText} from '@/components/dict/JDictSelectUtil'
  import historicDetail from '@/views/activiti/historicDetail'
  export default {
    name: "applyHome",
    mixins:[activitiMixin],
    components: {
      JEllipsis
      ,JTreeSelect
      ,historicDetail
    },
    data () {
      return {
        description: '所有',
        dictOptions:[],
        url: {
          getProcessDataList: "/activiti_process/listData",
          getFirstNode:'/actProcessIns/getFirstNode',
          applyBusiness:'/actBusiness/apply',
        },
        // 查询条件
        queryParam: {
          createTimeRange:[],
          keyWord:'',
        },
        // 表头
        labelCol: {
          xs: { span: 4 },
          sm: { span: 4 },
        },
        wrapperCol: {
          xs: { span: 20 },
          sm: { span: 20 },
        },
        processModalVisible: null,
        activeKeyAll: [],
        activeKey: [],
        processDataMap: {},
        searchProcessKey: null,
        addApplyLoading: false,
        lcModa: {
          title:'',
          disabled:false,
          visible:false,
          formComponent : null,
          isNew : false
        },
      }
    },
    computed:{
    },
    mounted() {
      this.initDictConfig()
      this.getProcessList()
    },
    methods: {
 
      initDictConfig() {
        //初始化字典 - 流程分类
        initDictOptions('bpm_process_type').then((res) => {
          if (res.success) {
            this.dictOptions = res.result;
          }
        });
      },
      filterDictText(dictOptions, text) {
        if (dictOptions instanceof Array) {
          for (let dictItem of dictOptions) {
            if (text === dictItem.value) {
              return dictItem.text
            }
          }
        }
        return text||text=='null'?'':text
      },
      /*加载流程列表*/
      getProcessList() {
        this.addApplyLoading = true;
        getAction(this.url.getProcessDataList,{status:1,roles:true}).then(res => {
          this.activeKeyAll = [];
          if (res.success) {
            var result = res.result||[];
            if (result.length>0){
              let searchProcessKey = this.searchProcessKey;
              if (searchProcessKey){ //过滤条件
                result = _.filter(result, function(o) { return o.name.indexOf(searchProcessKey)>-1; });
              }
              this.processDataMap = _.groupBy(result,'categoryId');
              for (const categoryId in this.processDataMap) {
                this.activeKeyAll.push(categoryId)
              }
              this.activeKey = this.activeKeyAll;
            }
            this.processModalVisible = true;
          }else {
            this.$message.warning(res.message)
          }
        }).finally(()=>this.addApplyLoading = false);
      },
      onSearchProcess(value) {
        this.searchProcessKey = value;
        this.getProcessList()
      },
      chooseProcess(v) {
        if (!v.routeName) {
          this.$message.warning(
            "该流程信息未配置表单,请联系开发人员!"
          );
          return;
        }
        this.lcModa.formComponent = this.getFormComponent(v.routeName).component;
        this.lcModa.title = '发起流程:'+v.name;
        this.lcModa.isNew = true;
        this.lcModa.processData = v;
        this.lcModa.visible = true;
        console.log("发起",v)
      },
      /*提交成功申请后*/
      afterSub(formData){
          this.lcModa.visible = false;
          this.$message("请前往我的申请列表提交审批!")
      },
      /*前往我的申请页面*/
      handleToApplyList() {
        this.$router.push({path:'/activiti/applyList'})
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>