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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<template>
  <div>
    <a-card>
      <div class="table-page-search-wrapper">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="24">
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-model-item prop="name" label="模型名称">
                <a-input v-model="queryParam.name" allowClear placeholder="请输入模型名称" ></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="16">
              <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
                <a-button type="primary" @click="searchQuery" icon="search" style="margin-right: 8px">查询</a-button>
                <a-button type="primary" @click="searchReset" icon="reload" style="margin-right: 8px">重置</a-button>
              </span>
            </a-col>
            <a-col :xl="12" :lg="7" :md="8" :sm="8" style="text-align: right">
              <a-button @click="handleAdd" type="primary" icon="plus" style="background-color: #5FB878;border-color: #5FB878">新增</a-button>
            </a-col>
          </a-row>
        </a-form>
      </div>
 
      <a-table
        :columns="columns"
        :dataSource="dataSource"
        rowKey="id"
        :loading="loading"
        class="j-table-force-nowrap"
        :pagination="ipagination"
        @change="handleTableChange"
      >
        <template slot="deploymentId" slot-scope="text,record">
          <span v-if="record.deploymentId!=null" style="color: #7ac23c">已部署</span>
          <span v-if="record.deploymentId==null" style="color: #ff0000">未部署</span>
        </template>
 
        <span slot="action" slot-scope="text, record">
          <a href="javascript:;" @click="openModeler(record)">流程</a>
          <a-divider type="vertical"/>
          <a-dropdown>
            <a class="ant-dropdown-link">
              更多 <a-icon type="down"/>
            </a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm title="确定部署吗?" @confirm="() => deployProcess(record.id)">
                  <a v-if="record.deploymentId!=null">重新部署</a>
                  <a v-else>部署</a>
                </a-popconfirm>
              </a-menu-item>
              <a-menu-item>
                <a @click="exportHandle(record.id)">导出</a>
              </a-menu-item>
              <a-menu-item v-if="record.deploymentId ==null" >
                <a-popconfirm title="确定删除吗?" @confirm="() => del(record.id)">
                  <a style="color: red">删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
        <a-divider type="vertical" />
      </a-table>
 
      <activiti-model-modal ref="modalForm" @ok="modalFormOk" @getModels="getModels"></activiti-model-modal>
      <activiti-model ref="activitiModel" @ok="modalFormOk" ></activiti-model>
    </a-card>
  </div>
 
</template>
 
<script>
 
  import { getAction, deleteAction } from '@/api/manage'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import ActivitiModelModal from './ActivitiModelModal'
  import { getModelList } from '@/api/activiti/activiti'
  import ActivitiModel from './ActivitiModel'
 
  export default {
    name: 'ActivitiList',
    mixins: [JeecgListMixin, mixinDevice],
    components: {
      ActivitiModelModal, ActivitiModel
    },
    data() {
      return {
        columns: [
          {
            title: '序号',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function (t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            dataIndex: 'id',
            title: '模型编号',
            align: 'center'
          }, {
            dataIndex: 'name',
            title: '名称',
            align: 'center'
          }, {
            dataIndex: 'key',
            title: '模型KEY',
            align: 'center'
          }, {
            dataIndex: 'deploymentId',
            title: '状态',
            align: 'center',
            scopedSlots: { customRender: 'deploymentId' }
          }, {
            dataIndex: 'createTime',
            title: '创建时间',
            align: 'center'
          }, {
            title: '最后更新时间',
            dataIndex: 'lastUpdateTime',
            align: 'center'
          }, {
            dataIndex: 'version',
            title: '版本',
            align: 'center'
          }, {
            title: '操作',
            dataIndex: 'action',
            width: '150px',
            align: 'center',
            scopedSlots: { customRender: 'action' }
          }],
        url: {
          list: 'act/remodel/list',
          delete: '/act/remodel/deleteById',
          deploy: '/act/remodel/deploy',
          exportHandle: 'act/remodel/export'
        },
        loading: true,
        queryParam: {
           key: '',
           name: ''
        }
      }
    },
   created() {
     // this.getModels()
   },
   methods: {
     // 导出
     exportHandle(id) {
       let apiBaseUrl = window._CONFIG['domianURL'] || '/tcore-boot'
       let url = apiBaseUrl + '/act/remodel/export?id=' + id
       window.open(url)
     },
     openModeler(row) {
          this.$refs.activitiModel.openModel(row)
       },
      // 查询
      getModels() {
        let param = this.q
        this.loading = true
        getModelList(this.url.list, param).then(res => {
          console.log('查询数据', res)
          this.dataSource = res.result.records
          if (res.result.total) {
            this.ipagination.total = res.result.total
          } else {
            this.ipagination.total = 0
          }
          this.loading = false
        })
      },
      // 删除
      del(id) {
        deleteAction(this.url.delete, { id: id }).then(res => {
          if (res.success) {
            this.$message.success(res.message)
             this.searchQuery()
          } else {
            this.$message.error(res.message)
          }
        })
      },
      // 部署
      deployProcess(id) {
        getAction(this.url.deploy, { id: id }).then(res => {
          console.log('流程部署', res)
          if (res.success) {
            this.$message.success(res.result)
             this.searchQuery()
          } else {
            this.$message.error(res.message)
          }
        })
      }
    }
   }
</script>
 
<style lang="less" scoped>
 .table-operator .ant-btn {
        margin: 3px 8px 4px 0;
    }
</style>