Commit 004051562e94537eecb3ea9a83cfb7d1c6ea55a3

Authored by wuxw
1 parent f61bd6e8

优化代码

src/api/oa/oaWorkflowManageApi.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +
  3 +// 查询流程列表
  4 +export function getOaWorkflowList(params) {
  5 + return new Promise((resolve, reject) => {
  6 + request({
  7 + url: '/oaWorkflow/queryOaWorkflow',
  8 + method: 'get',
  9 + params
  10 + }).then(response => {
  11 + const res = response.data
  12 + resolve(res)
  13 + }).catch(error => {
  14 + reject(error)
  15 + })
  16 + })
  17 +}
  18 +
  19 +// 新增流程
  20 +export function saveOaWorkflow(data) {
  21 + return new Promise((resolve, reject) => {
  22 + request({
  23 + url: '/oaWorkflow/saveOaWorkflow',
  24 + method: 'post',
  25 + data
  26 + }).then(response => {
  27 + const res = response.data
  28 + resolve(res)
  29 + }).catch(error => {
  30 + reject(error)
  31 + })
  32 + })
  33 +}
  34 +
  35 +// 修改流程
  36 +export function updateOaWorkflow(data) {
  37 + return new Promise((resolve, reject) => {
  38 + request({
  39 + url: '/oaWorkflow/updateOaWorkflow',
  40 + method: 'post',
  41 + data
  42 + }).then(response => {
  43 + const res = response.data
  44 + resolve(res)
  45 + }).catch(error => {
  46 + reject(error)
  47 + })
  48 + })
  49 +}
  50 +
  51 +// 删除流程
  52 +export function deleteOaWorkflow(data) {
  53 + return new Promise((resolve, reject) => {
  54 + request({
  55 + url: '/oaWorkflow/deleteOaWorkflow',
  56 + method: 'post',
  57 + data
  58 + }).then(response => {
  59 + const res = response.data
  60 + resolve(res)
  61 + }).catch(error => {
  62 + reject(error)
  63 + })
  64 + })
  65 +}
  66 +
  67 +// 发布流程
  68 +export function deployModel(data) {
  69 + return new Promise((resolve, reject) => {
  70 + request({
  71 + url: '/workflow/deployModel',
  72 + method: 'post',
  73 + data
  74 + }).then(response => {
  75 + const res = response.data
  76 + resolve(res)
  77 + }).catch(error => {
  78 + reject(error)
  79 + })
  80 + })
  81 +}
0 \ No newline at end of file 82 \ No newline at end of file
src/components/oa/addOaWorkflow.vue 0 → 100644
  1 +<template>
  2 + <el-dialog
  3 + :title="$t('oaWorkflowManage.add.title')"
  4 + :visible.sync="visible"
  5 + width="50%"
  6 + @close="handleClose"
  7 + >
  8 + <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  9 + <el-form-item
  10 + :label="$t('oaWorkflowManage.add.flowName')"
  11 + prop="flowName"
  12 + >
  13 + <el-input
  14 + v-model="form.flowName"
  15 + :placeholder="$t('oaWorkflowManage.add.flowNamePlaceholder')"
  16 + />
  17 + </el-form-item>
  18 + <el-form-item
  19 + :label="$t('oaWorkflowManage.add.flowType')"
  20 + prop="flowType"
  21 + >
  22 + <el-select
  23 + v-model="form.flowType"
  24 + :placeholder="$t('oaWorkflowManage.add.flowTypePlaceholder')"
  25 + style="width:100%"
  26 + >
  27 + <el-option
  28 + v-for="item in flowTypes"
  29 + :key="item.statusCd"
  30 + :label="item.name"
  31 + :value="item.statusCd"
  32 + />
  33 + </el-select>
  34 + </el-form-item>
  35 + <el-form-item :label="$t('oaWorkflowManage.add.describle')">
  36 + <el-input
  37 + v-model="form.describle"
  38 + type="textarea"
  39 + :placeholder="$t('oaWorkflowManage.add.describlePlaceholder')"
  40 + :rows="3"
  41 + />
  42 + </el-form-item>
  43 + </el-form>
  44 + <span slot="footer" class="dialog-footer">
  45 + <el-button @click="visible = false">
  46 + {{ $t('common.cancel') }}
  47 + </el-button>
  48 + <el-button type="primary" @click="handleSubmit">
  49 + {{ $t('common.confirm') }}
  50 + </el-button>
  51 + </span>
  52 + </el-dialog>
  53 +</template>
  54 +
  55 +<script>
  56 +import { saveOaWorkflow } from '@/api/oa/oaWorkflowManageApi'
  57 +import { getDict } from '@/api/community/communityApi'
  58 +
  59 +export default {
  60 + name: 'AddOaWorkflow',
  61 + data() {
  62 + return {
  63 + visible: false,
  64 + form: {
  65 + flowName: '',
  66 + flowType: '',
  67 + describle: ''
  68 + },
  69 + flowTypes: [],
  70 + rules: {
  71 + flowName: [
  72 + { required: true, message: this.$t('oaWorkflowManage.validate.flowNameRequired'), trigger: 'blur' },
  73 + { max: 64, message: this.$t('oaWorkflowManage.validate.flowNameMaxLength'), trigger: 'blur' }
  74 + ],
  75 + flowType: [
  76 + { required: true, message: this.$t('oaWorkflowManage.validate.flowTypeRequired'), trigger: 'change' }
  77 + ]
  78 + }
  79 + }
  80 + },
  81 + methods: {
  82 + open() {
  83 + this.visible = true
  84 + this.getDictData()
  85 + },
  86 + async getDictData() {
  87 + try {
  88 + this.flowTypes = await getDict('oa_workflow', 'flow_type')
  89 + } catch (error) {
  90 + console.error('获取字典数据失败:', error)
  91 + }
  92 + },
  93 + handleClose() {
  94 + this.$refs.form.resetFields()
  95 + this.form = {
  96 + flowName: '',
  97 + flowType: '',
  98 + describle: ''
  99 + }
  100 + },
  101 + handleSubmit() {
  102 + this.$refs.form.validate(async valid => {
  103 + if (valid) {
  104 + try {
  105 + await saveOaWorkflow(this.form)
  106 + this.$message.success(this.$t('oaWorkflowManage.add.success'))
  107 + this.visible = false
  108 + this.$emit('success')
  109 + } catch (error) {
  110 + this.$message.error(this.$t('oaWorkflowManage.add.error'))
  111 + }
  112 + }
  113 + })
  114 + }
  115 + }
  116 +}
  117 +</script>
0 \ No newline at end of file 118 \ No newline at end of file
src/components/oa/deleteOaWorkflow.vue 0 → 100644
  1 +<template>
  2 + <el-dialog
  3 + :title="$t('oaWorkflowManage.delete.title')"
  4 + :visible.sync="visible"
  5 + width="30%"
  6 + @close="handleClose"
  7 + >
  8 + <div class="text-center">
  9 + <p>{{ $t('oaWorkflowManage.delete.confirmText') }}</p>
  10 + </div>
  11 + <span slot="footer" class="dialog-footer">
  12 + <el-button @click="visible = false">
  13 + {{ $t('common.cancel') }}
  14 + </el-button>
  15 + <el-button type="primary" @click="handleConfirm">
  16 + {{ $t('common.confirm') }}
  17 + </el-button>
  18 + </span>
  19 + </el-dialog>
  20 +</template>
  21 +
  22 +<script>
  23 +import { deleteOaWorkflow } from '@/api/oa/oaWorkflowManageApi'
  24 +
  25 +export default {
  26 + name: 'DeleteOaWorkflow',
  27 + data() {
  28 + return {
  29 + visible: false,
  30 + flowId: ''
  31 + }
  32 + },
  33 + methods: {
  34 + open(data) {
  35 + this.visible = true
  36 + this.flowId = data.flowId
  37 + },
  38 + handleClose() {
  39 + this.flowId = ''
  40 + },
  41 + async handleConfirm() {
  42 + try {
  43 + await deleteOaWorkflow({ flowId: this.flowId })
  44 + this.$message.success(this.$t('oaWorkflowManage.delete.success'))
  45 + this.visible = false
  46 + this.$emit('success')
  47 + } catch (error) {
  48 + this.$message.error(this.$t('oaWorkflowManage.delete.error'))
  49 + }
  50 + }
  51 + }
  52 +}
  53 +</script>
0 \ No newline at end of file 54 \ No newline at end of file
src/components/oa/editOaWorkflow.vue 0 → 100644
  1 +<template>
  2 + <el-dialog
  3 + :title="$t('oaWorkflowManage.edit.title')"
  4 + :visible.sync="visible"
  5 + width="50%"
  6 + @close="handleClose"
  7 + >
  8 + <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  9 + <el-form-item
  10 + :label="$t('oaWorkflowManage.edit.flowName')"
  11 + prop="flowName"
  12 + >
  13 + <el-input
  14 + v-model="form.flowName"
  15 + :placeholder="$t('oaWorkflowManage.edit.flowNamePlaceholder')"
  16 + />
  17 + </el-form-item>
  18 + <el-form-item :label="$t('oaWorkflowManage.edit.describle')">
  19 + <el-input
  20 + v-model="form.describle"
  21 + type="textarea"
  22 + :placeholder="$t('oaWorkflowManage.edit.describlePlaceholder')"
  23 + :rows="3"
  24 + />
  25 + </el-form-item>
  26 + </el-form>
  27 + <span slot="footer" class="dialog-footer">
  28 + <el-button @click="visible = false">
  29 + {{ $t('common.cancel') }}
  30 + </el-button>
  31 + <el-button type="primary" @click="handleSubmit">
  32 + {{ $t('common.confirm') }}
  33 + </el-button>
  34 + </span>
  35 + </el-dialog>
  36 +</template>
  37 +
  38 +<script>
  39 +import { updateOaWorkflow } from '@/api/oa/oaWorkflowManageApi'
  40 +
  41 +export default {
  42 + name: 'EditOaWorkflow',
  43 + data() {
  44 + return {
  45 + visible: false,
  46 + form: {
  47 + flowId: '',
  48 + flowName: '',
  49 + describle: ''
  50 + },
  51 + rules: {
  52 + flowName: [
  53 + { required: true, message: this.$t('oaWorkflowManage.validate.flowNameRequired'), trigger: 'blur' },
  54 + { max: 64, message: this.$t('oaWorkflowManage.validate.flowNameMaxLength'), trigger: 'blur' }
  55 + ],
  56 + flowId: [
  57 + { required: true, message: this.$t('oaWorkflowManage.validate.flowIdRequired'), trigger: 'blur' }
  58 + ]
  59 + }
  60 + }
  61 + },
  62 + methods: {
  63 + open(data) {
  64 + this.visible = true
  65 + this.form = {
  66 + flowId: data.flowId,
  67 + flowName: data.flowName,
  68 + describle: data.describle || ''
  69 + }
  70 + },
  71 + handleClose() {
  72 + this.$refs.form.resetFields()
  73 + this.form = {
  74 + flowId: '',
  75 + flowName: '',
  76 + describle: ''
  77 + }
  78 + },
  79 + handleSubmit() {
  80 + this.$refs.form.validate(async valid => {
  81 + if (valid) {
  82 + try {
  83 + await updateOaWorkflow(this.form)
  84 + this.$message.success(this.$t('oaWorkflowManage.edit.success'))
  85 + this.visible = false
  86 + this.$emit('success')
  87 + } catch (error) {
  88 + this.$message.error(this.$t('oaWorkflowManage.edit.error'))
  89 + }
  90 + }
  91 + })
  92 + }
  93 + }
  94 +}
  95 +</script>
0 \ No newline at end of file 96 \ No newline at end of file
src/i18n/oaI18n.js
@@ -26,6 +26,7 @@ import { messages as examineStaffManageMessages } from &#39;../views/oa/examineStaff @@ -26,6 +26,7 @@ import { messages as examineStaffManageMessages } from &#39;../views/oa/examineStaff
26 import { messages as addExamineStaffMessages } from '../views/oa/addExamineStaffLang' 26 import { messages as addExamineStaffMessages } from '../views/oa/addExamineStaffLang'
27 import { messages as editExamineStaffMessages } from '../views/oa/editExamineStaffLang' 27 import { messages as editExamineStaffMessages } from '../views/oa/editExamineStaffLang'
28 import { messages as examineStaffValueMessages } from '../views/oa/examineStaffValueLang' 28 import { messages as examineStaffValueMessages } from '../views/oa/examineStaffValueLang'
  29 +import { messages as oaWorkflowManageMessages } from '../views/oa/oaWorkflowManageLang'
29 30
30 export const messages ={ 31 export const messages ={
31 en:{ 32 en:{
@@ -57,6 +58,7 @@ export const messages ={ @@ -57,6 +58,7 @@ export const messages ={
57 ...addExamineStaffMessages.en, 58 ...addExamineStaffMessages.en,
58 ...editExamineStaffMessages.en, 59 ...editExamineStaffMessages.en,
59 ...examineStaffValueMessages.en, 60 ...examineStaffValueMessages.en,
  61 + ...oaWorkflowManageMessages.en,
60 }, 62 },
61 zh:{ 63 zh:{
62 ...activitiesTypeManageMessages.zh, 64 ...activitiesTypeManageMessages.zh,
@@ -87,5 +89,6 @@ export const messages ={ @@ -87,5 +89,6 @@ export const messages ={
87 ...addExamineStaffMessages.zh, 89 ...addExamineStaffMessages.zh,
88 ...editExamineStaffMessages.zh, 90 ...editExamineStaffMessages.zh,
89 ...examineStaffValueMessages.zh, 91 ...examineStaffValueMessages.zh,
  92 + ...oaWorkflowManageMessages.zh,
90 } 93 }
91 } 94 }
92 \ No newline at end of file 95 \ No newline at end of file
src/router/oaRouter.js
@@ -124,4 +124,9 @@ export default [ @@ -124,4 +124,9 @@ export default [
124 name: '/pages/examine/examineStaffValue', 124 name: '/pages/examine/examineStaffValue',
125 component: () => import('@/views/oa/examineStaffValueList.vue') 125 component: () => import('@/views/oa/examineStaffValueList.vue')
126 }, 126 },
  127 + {
  128 + path:'/pages/property/oaWorkflowManage',
  129 + name:'/pages/property/oaWorkflowManage',
  130 + component: () => import('@/views/oa/oaWorkflowManageList.vue')
  131 + },
127 ] 132 ]
128 \ No newline at end of file 133 \ No newline at end of file
src/views/oa/oaWorkflowManageLang.js 0 → 100644
  1 +export const messages = {
  2 + en: {
  3 + oaWorkflowManage: {
  4 + search: {
  5 + title: 'Search Conditions',
  6 + flowNamePlaceholder: 'Please enter workflow name',
  7 + flowTypePlaceholder: 'Please select workflow type',
  8 + selectAll: 'All'
  9 + },
  10 + list: {
  11 + title: 'Workflow Instances',
  12 + addWorkflow: 'New Workflow'
  13 + },
  14 + table: {
  15 + flowId: 'Workflow ID',
  16 + flowName: 'Workflow Name',
  17 + flowType: 'Workflow Type',
  18 + normalFlow: 'Normal Workflow',
  19 + unknown: 'Unknown',
  20 + modelId: 'Model ID',
  21 + state: 'Status',
  22 + deployed: 'Deployed',
  23 + pendingDeploy: 'Pending Deploy',
  24 + describle: 'Description',
  25 + createTime: 'Create Time',
  26 + workflow: 'Workflow',
  27 + designForm: 'Design Form',
  28 + deploy: 'Deploy'
  29 + },
  30 + add: {
  31 + title: 'New Workflow',
  32 + flowName: 'Workflow Name',
  33 + flowNamePlaceholder: 'Required, please enter workflow name',
  34 + flowType: 'Workflow Type',
  35 + flowTypePlaceholder: 'Required, please select workflow type',
  36 + describle: 'Remark',
  37 + describlePlaceholder: 'Optional, please enter remark',
  38 + success: 'Add successfully',
  39 + error: 'Add failed'
  40 + },
  41 + edit: {
  42 + title: 'Edit Workflow',
  43 + flowName: 'Workflow Name',
  44 + flowNamePlaceholder: 'Required, please enter workflow name',
  45 + describle: 'Remark',
  46 + describlePlaceholder: 'Optional, please enter remark',
  47 + success: 'Edit successfully',
  48 + error: 'Edit failed'
  49 + },
  50 + delete: {
  51 + title: 'Confirm Operation',
  52 + confirmText: 'Are you sure to delete this workflow instance?',
  53 + success: 'Delete successfully',
  54 + error: 'Delete failed'
  55 + },
  56 + validate: {
  57 + flowNameRequired: 'Workflow name is required',
  58 + flowNameMaxLength: 'Workflow name cannot exceed 64 characters',
  59 + flowTypeRequired: 'Workflow type is required',
  60 + flowIdRequired: 'Workflow ID is required'
  61 + },
  62 + fetchError: 'Failed to get workflow list',
  63 + deployError: 'Failed to deploy workflow'
  64 + }
  65 + },
  66 + zh: {
  67 + oaWorkflowManage: {
  68 + search: {
  69 + title: '查询条件',
  70 + flowNamePlaceholder: '请输入流程名称',
  71 + flowTypePlaceholder: '请选择流程类型',
  72 + selectAll: '全部'
  73 + },
  74 + list: {
  75 + title: '流程实例',
  76 + addWorkflow: '新建流程'
  77 + },
  78 + table: {
  79 + flowId: '工作流ID',
  80 + flowName: '流程名称',
  81 + flowType: '流程类型',
  82 + normalFlow: '普通流程',
  83 + unknown: '未知',
  84 + modelId: '模型ID',
  85 + state: '状态',
  86 + deployed: '已部署',
  87 + pendingDeploy: '待部署',
  88 + describle: '描述',
  89 + createTime: '创建时间',
  90 + workflow: '流程',
  91 + designForm: '设计表单',
  92 + deploy: '发布'
  93 + },
  94 + add: {
  95 + title: '新建流程',
  96 + flowName: '流程名称',
  97 + flowNamePlaceholder: '必填,请填写流程名称',
  98 + flowType: '流程类型',
  99 + flowTypePlaceholder: '必填,请选择流程类型',
  100 + describle: '备注',
  101 + describlePlaceholder: '选填,请填写备注',
  102 + success: '添加成功',
  103 + error: '添加失败'
  104 + },
  105 + edit: {
  106 + title: '修改流程',
  107 + flowName: '流程名称',
  108 + flowNamePlaceholder: '必填,请填写流程名称',
  109 + describle: '备注',
  110 + describlePlaceholder: '选填,请填写备注',
  111 + success: '修改成功',
  112 + error: '修改失败'
  113 + },
  114 + delete: {
  115 + title: '请确认您的操作',
  116 + confirmText: '确定删除流程实例',
  117 + success: '删除成功',
  118 + error: '删除失败'
  119 + },
  120 + validate: {
  121 + flowNameRequired: '流程名称不能为空',
  122 + flowNameMaxLength: '流程名称超过64位',
  123 + flowTypeRequired: '流程类型不能为空',
  124 + flowIdRequired: '工作流ID不能为空'
  125 + },
  126 + fetchError: '获取流程列表失败',
  127 + deployError: '发布流程失败'
  128 + }
  129 + }
  130 +}
0 \ No newline at end of file 131 \ No newline at end of file
src/views/oa/oaWorkflowManageList.vue 0 → 100644
  1 +<template>
  2 + <div class="oa-workflow-manage-container">
  3 + <!-- 查询条件 -->
  4 + <el-card class="search-wrapper">
  5 + <div slot="header" class="flex justify-between">
  6 + <span>{{ $t('oaWorkflowManage.search.title') }}</span>
  7 + </div>
  8 + <el-row :gutter="20">
  9 + <el-col :span="6">
  10 + <el-input
  11 + v-model.trim="searchForm.flowName"
  12 + :placeholder="$t('oaWorkflowManage.search.flowNamePlaceholder')"
  13 + clearable
  14 + />
  15 + </el-col>
  16 + <el-col :span="6">
  17 + <el-select
  18 + v-model="searchForm.flowType"
  19 + :placeholder="$t('oaWorkflowManage.search.flowTypePlaceholder')"
  20 + style="width:100%"
  21 + >
  22 + <el-option
  23 + :label="$t('oaWorkflowManage.search.selectAll')"
  24 + value=""
  25 + />
  26 + <el-option
  27 + v-for="item in flowTypes"
  28 + :key="item.statusCd"
  29 + :label="item.name"
  30 + :value="item.statusCd"
  31 + />
  32 + </el-select>
  33 + </el-col>
  34 + <el-col :span="6">
  35 + <el-button type="primary" @click="handleSearch">
  36 + <i class="el-icon-search"></i>
  37 + {{ $t('common.search') }}
  38 + </el-button>
  39 + <el-button @click="handleReset">
  40 + <i class="el-icon-refresh"></i>
  41 + {{ $t('common.reset') }}
  42 + </el-button>
  43 + </el-col>
  44 + </el-row>
  45 + </el-card>
  46 +
  47 + <!-- 流程实例列表 -->
  48 + <el-card class="list-wrapper">
  49 + <div slot="header" class="flex justify-between">
  50 + <span>{{ $t('oaWorkflowManage.list.title') }}</span>
  51 + <el-button
  52 + type="primary"
  53 + size="small"
  54 + style="float:right"
  55 + @click="handleAdd"
  56 + >
  57 + <i class="el-icon-plus"></i>
  58 + {{ $t('oaWorkflowManage.list.addWorkflow') }}
  59 + </el-button>
  60 + </div>
  61 +
  62 + <el-table
  63 + v-loading="loading"
  64 + :data="tableData"
  65 + border
  66 + style="width:100%"
  67 + >
  68 + <el-table-column
  69 + prop="flowId"
  70 + :label="$t('oaWorkflowManage.table.flowId')"
  71 + align="center"
  72 + />
  73 + <el-table-column
  74 + prop="flowName"
  75 + :label="$t('oaWorkflowManage.table.flowName')"
  76 + align="center"
  77 + />
  78 + <el-table-column
  79 + prop="flowType"
  80 + :label="$t('oaWorkflowManage.table.flowType')"
  81 + align="center"
  82 + >
  83 + <template slot-scope="scope">
  84 + {{ scope.row.flowType === '1001' ? $t('oaWorkflowManage.table.normalFlow') : $t('oaWorkflowManage.table.unknown') }}
  85 + </template>
  86 + </el-table-column>
  87 + <el-table-column
  88 + prop="modelId"
  89 + :label="$t('oaWorkflowManage.table.modelId')"
  90 + align="center"
  91 + />
  92 + <el-table-column
  93 + prop="flowKey"
  94 + label="KEY"
  95 + align="center"
  96 + />
  97 + <el-table-column
  98 + prop="state"
  99 + :label="$t('oaWorkflowManage.table.state')"
  100 + align="center"
  101 + >
  102 + <template slot-scope="scope">
  103 + {{ scope.row.state === 'C' ? $t('oaWorkflowManage.table.deployed') : $t('oaWorkflowManage.table.pendingDeploy') }}
  104 + </template>
  105 + </el-table-column>
  106 + <el-table-column
  107 + prop="describle"
  108 + :label="$t('oaWorkflowManage.table.describle')"
  109 + align="center"
  110 + width="150"
  111 + />
  112 + <el-table-column
  113 + prop="createTime"
  114 + :label="$t('oaWorkflowManage.table.createTime')"
  115 + align="center"
  116 + />
  117 + <el-table-column
  118 + :label="$t('common.operation')"
  119 + align="center"
  120 + width="300"
  121 + fixed="right"
  122 + >
  123 + <template slot-scope="scope">
  124 + <el-button
  125 + size="mini"
  126 + @click="handleWorkflowEditor(scope.row)"
  127 + >
  128 + {{ $t('oaWorkflowManage.table.workflow') }}
  129 + </el-button>
  130 + <el-button
  131 + size="mini"
  132 + @click="handleWorkflowForm(scope.row)"
  133 + >
  134 + {{ $t('oaWorkflowManage.table.designForm') }}
  135 + </el-button>
  136 + <el-button
  137 + v-if="scope.row.state === 'W'"
  138 + size="mini"
  139 + type="success"
  140 + @click="handleDeploy(scope.row)"
  141 + >
  142 + {{ $t('oaWorkflowManage.table.deploy') }}
  143 + </el-button>
  144 + <el-button
  145 + size="mini"
  146 + type="primary"
  147 + @click="handleEdit(scope.row)"
  148 + >
  149 + {{ $t('common.edit') }}
  150 + </el-button>
  151 + <el-button
  152 + size="mini"
  153 + type="danger"
  154 + @click="handleDelete(scope.row)"
  155 + >
  156 + {{ $t('common.delete') }}
  157 + </el-button>
  158 + </template>
  159 + </el-table-column>
  160 + </el-table>
  161 +
  162 + <el-pagination
  163 + :current-page="pagination.current"
  164 + :page-sizes="[10, 20, 30, 50]"
  165 + :page-size="pagination.size"
  166 + :total="pagination.total"
  167 + layout="total, sizes, prev, pager, next, jumper"
  168 + @size-change="handleSizeChange"
  169 + @current-change="handleCurrentChange"
  170 + />
  171 + </el-card>
  172 +
  173 + <!-- 组件 -->
  174 + <add-oa-workflow ref="addWorkflow" @success="handleSuccess" />
  175 + <edit-oa-workflow ref="editWorkflow" @success="handleSuccess" />
  176 + <delete-oa-workflow ref="deleteWorkflow" @success="handleSuccess" />
  177 + </div>
  178 +</template>
  179 +
  180 +<script>
  181 +import { getOaWorkflowList, deployModel } from '@/api/oa/oaWorkflowManageApi'
  182 +import { getDict } from '@/api/community/communityApi'
  183 +import AddOaWorkflow from '@/components/oa/addOaWorkflow'
  184 +import EditOaWorkflow from '@/components/oa/editOaWorkflow'
  185 +import DeleteOaWorkflow from '@/components/oa/deleteOaWorkflow'
  186 +
  187 +export default {
  188 + name: 'OaWorkflowManageList',
  189 + components: {
  190 + AddOaWorkflow,
  191 + EditOaWorkflow,
  192 + DeleteOaWorkflow
  193 + },
  194 + data() {
  195 + return {
  196 + loading: false,
  197 + searchForm: {
  198 + flowName: '',
  199 + flowType: '',
  200 + state: ''
  201 + },
  202 + tableData: [],
  203 + flowTypes: [],
  204 + states: [],
  205 + pagination: {
  206 + current: 1,
  207 + size: 10,
  208 + total: 0
  209 + }
  210 + }
  211 + },
  212 + created() {
  213 + this.getList()
  214 + this.getDictData()
  215 + },
  216 + methods: {
  217 + async getList() {
  218 + try {
  219 + this.loading = true
  220 + const params = {
  221 + page: this.pagination.current,
  222 + row: this.pagination.size,
  223 + ...this.searchForm
  224 + }
  225 + const { data, total } = await getOaWorkflowList(params)
  226 + this.tableData = data
  227 + this.pagination.total = total
  228 + } catch (error) {
  229 + this.$message.error(this.$t('oaWorkflowManage.fetchError'))
  230 + } finally {
  231 + this.loading = false
  232 + }
  233 + },
  234 + async getDictData() {
  235 + try {
  236 + this.flowTypes = await getDict('oa_workflow', 'flow_type')
  237 + this.states = await getDict('oa_workflow', 'state')
  238 + } catch (error) {
  239 + console.error('获取字典数据失败:', error)
  240 + }
  241 + },
  242 + handleSearch() {
  243 + this.pagination.current = 1
  244 + this.getList()
  245 + },
  246 + handleReset() {
  247 + this.searchForm = {
  248 + flowName: '',
  249 + flowType: '',
  250 + state: ''
  251 + }
  252 + this.handleSearch()
  253 + },
  254 + handleAdd() {
  255 + this.$refs.addWorkflow.open()
  256 + },
  257 + handleEdit(row) {
  258 + this.$refs.editWorkflow.open(row)
  259 + },
  260 + handleDelete(row) {
  261 + this.$refs.deleteWorkflow.open(row)
  262 + },
  263 + handleWorkflowEditor(row) {
  264 + window.open(`/bpmnjs/index.html?flowId=${row.flowId}&modelId=${row.modelId}`)
  265 + },
  266 + handleWorkflowForm(row) {
  267 + window.open(`/formjs/editor.html?flowId=${row.flowId}&modelId=${row.modelId}`)
  268 + },
  269 + async handleDeploy(row) {
  270 + try {
  271 + this.loading = true
  272 + const res = await deployModel({ modelId: row.modelId })
  273 + this.$message.success(res.msg)
  274 + this.getList()
  275 + } catch (error) {
  276 + this.$message.error(this.$t('oaWorkflowManage.deployError'))
  277 + } finally {
  278 + this.loading = false
  279 + }
  280 + },
  281 + handleSuccess() {
  282 + this.getList()
  283 + },
  284 + handleSizeChange(val) {
  285 + this.pagination.size = val
  286 + this.getList()
  287 + },
  288 + handleCurrentChange(val) {
  289 + this.pagination.current = val
  290 + this.getList()
  291 + }
  292 + }
  293 +}
  294 +</script>
  295 +
  296 +<style lang="scss" scoped>
  297 +.oa-workflow-manage-container {
  298 + padding: 20px;
  299 +
  300 + .search-wrapper {
  301 + margin-bottom: 20px;
  302 +
  303 + .el-input {
  304 + width: 100%;
  305 + }
  306 + }
  307 +
  308 + .list-wrapper {
  309 + margin-bottom: 20px;
  310 +
  311 + .el-pagination {
  312 + margin-top: 20px;
  313 + text-align: right;
  314 + }
  315 + }
  316 +}
  317 +</style>
0 \ No newline at end of file 318 \ No newline at end of file