gaoshp
2025-06-16 ad01d0644484fb2577809c12f43e09c629632c94
我的流程
已修改3个文件
186 ■■■■■ 文件已修改
src/api/flow/todolist.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/axios.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/flow/todolist.vue 169 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/flow/todolist.js
@@ -1,5 +1,11 @@
/*
 * @Date: 2025-06-12 22:38:05
 * @LastEditors: gaoshp
 * @LastEditTime: 2025-06-16 22:42:32
 * @FilePath: /mdmweb/src/api/flow/todolist.js
 */
import request from '@/axios';
export const getLazyList = (current, size, params) => {
export const getList = (current, size, params) => {
  return request({
    url: '/blade-mdm/flow/todo-list',
    method: 'get',
@@ -10,6 +16,13 @@
    },
  });
};
export const approve = (params) => {
  return request({
    url: `/blade-mdm/flow/dispatch/completeTask?taskId=${params.taskId}&processInstanceId=${params.processInstanceId}&comment=${params.comment}`,
    method: 'post',
    data: params,
  });
}
export const add = (parentId, params) => {
  
};
src/axios.js
@@ -25,7 +25,7 @@
let isRefreshing = false; // 标记当前是否正在刷新token
let refreshTokenPromise = null; // 刷新token的Promise,避免重复请求
axios.defaults.timeout = 10000;
axios.defaults.timeout = 30000;
//返回其他状态码
axios.defaults.validateStatus = function (status) {
  return status >= 200 && status <= 500; // 默认的
src/views/flow/todolist.vue
@@ -1,31 +1,67 @@
<template>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" v-model="form" ref="crud"
            @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
            @search-change="searchChange" @search-reset="searchReset"
            @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
            <template #menu-left>
                <el-button type="primary" plain @click="reassign">重新指派
                </el-button>
            </template>
            <!-- <template #source="{ row }">
                <div style="text-align: center">
                    <i :class="row.source" />
                </div>
            </template> -->
            <template #menu="scope">
                <el-button type="primary" text size="default" v-if="permission.flow_model_update"
                    @click.stop="handleAction(scope.row, scope.index)">审批
                </el-button>
            </template>
        </avue-crud>
        <el-dialog title="审批" append-to-body v-model="approveBox" width="20%">
            <avue-form ref="form" :option="optionApprove" v-model="formApprove" @submit="handleSubmit" />
            <!-- <template #footer>
                <span class="dialog-footer">
                    <el-button @click="deployBox = false">取 消</el-button>
                    <el-button type="primary" @click="handleDoDeploy" :loading="deployLoading">确 定</el-button>
                </span>
            </template> -->
        </el-dialog>
    </basic-container>
</template>
<script>
import { getLazyList, remove, update, add, getMenu } from '@/api/flow/todolist';
import { getList, approve } from '@/api/flow/todolist';
import { mapGetters } from 'vuex';
import iconList from '@/config/iconList';
import func from '@/utils/func';
import { getMenuTree } from '@/api/system/menu';
export default {
    data() {
        return {
            row: {},
            approveBox: false,
            formApprove: {
                comment: '',
                approve: 'Y', // 默认同意
            },
            optionApprove: {
                labelWidth: 100,
                column: [
                    {
                        label: '审批结果',
                        prop: 'approve',
                        type: 'radio',
                        span: 24,
                        dicData: [
                            { label: '通过', value: 'Y' },
                            { label: '驳回', value: 'N' },
                        ],
                        rules: [{ required: true, message: '请选择审批结果', trigger: 'blur' }],
                    },
                    {
                        label: '备注',
                        span: 24,
                        prop: 'comment',
                        type: 'textarea',
                        rules: [{ required: true, message: '请输入审批意见', trigger: 'blur' }],
                    },
                ],
            },
            page: {
                pageSize: 10,
                currentPage: 1,
@@ -43,6 +79,8 @@
            },
            option: {
                addBtn: false,
                editBtn: false,
                delBtn: false,
                columnBtn: false,
                tip: false,
                // simplePage: true,
@@ -59,8 +97,10 @@
                column: [
                    {
                        label: '创建时间',
                        prop: 'time',
                        prop: 'createTime',
                        type: 'datetime',
                        format: 'YYYY-MM-DD',
                        valueFormat: 'YYYY-MM-DD',
                        search: true,
                        searchRange: true,
                        searchSpan: 8,
@@ -68,7 +108,7 @@
                    },
                    {
                        label: '关键字',
                        prop: 'keyWord',
                        prop: 'keyword',
                        width: 300,
                        search: true,
                        searchType: 'input',
@@ -87,30 +127,23 @@
                    {
                        label: '编号',
                        prop: 'name',
                        prop: 'taskId',
                        width: 100,
                    },
                    {
                        label: '任务名称',
                        prop: 'taskName',
                        width: 100,
                    },
                    {
                        label: '流程类型',
                        width: 100,
                        prop: 'path',
                        rules: [
                            {
                                required: true,
                                message: '请输入路由地址',
                                trigger: 'blur',
                            },
                        ],
                        prop: 'processDefinitionName',
                    },
                    {
                        label: '实例编号',
                        width: 100,
                        type: 'tree',
                    },
                    {
                        label: '流程实例名',
                        width: 100,
                        type: 'tree',
                        type: 'processInstanceId',
                    },
                    {
                        label: '机床',
@@ -125,27 +158,27 @@
                    {
                        label: '创建时间',
                        width: 100,
                        type: 'tree',
                        prop: 'createTime',
                    },
                    {
                        label: '到达时间',
                        width: 100,
                        type: 'tree',
                        prop: '',
                    },
                    {
                        label: '到达描述',
                        width: 100,
                        type: 'tree',
                        prop: 'comment',
                    },
                    {
                        label: '文件',
                        width: 100,
                        type: 'tree',
                        prop: '',
                    },
                    {
                        label: '到达时间',
                        width: 100,
                        type: 'tree',
                        prop: '',
                    },
                ],
@@ -154,49 +187,65 @@
        };
    },
    watch: {
        'form.category'() {
            const category = func.toInt(this.form.category);
            this.$refs.crud.option.column.filter(item => {
                if (item.prop === 'path') {
                    item.rules[0].required = category === 1;
                }
                if (item.prop === 'isOpen') {
                    item.disabled = category === 2;
                }
            });
        },
        // 'form.category'() {
        //     const category = func.toInt(this.form.category);
        //     this.$refs.crud.option.column.filter(item => {
        //         if (item.prop === 'path') {
        //             item.rules[0].required = category === 1;
        //         }
        //         if (item.prop === 'isOpen') {
        //             item.disabled = category === 2;
        //         }
        //     });
        // },
    },
    computed: {
        ...mapGetters(['userInfo', 'permission']),
        permissionList() {
            return {
                addBtn: this.validData(this.permission.menu_add, false),
                viewBtn: this.validData(this.permission.menu_view, false),
                delBtn: this.validData(this.permission.menu_delete, false),
                editBtn: this.validData(this.permission.menu_edit, false),
            };
        },
        // permissionList() {
        //     return {
        //         addBtn: this.validData(this.permission.menu_add, false),
        //         viewBtn: this.validData(this.permission.menu_view, false),
        //         delBtn: this.validData(this.permission.menu_delete, false),
        //         editBtn: this.validData(this.permission.menu_edit, false),
        //     };
        // },
    },
    methods: {
        handleAction(row, index) {
            this.approveBox = true;
            this.row = row
            console.log('handleAction', row, index);
        },
        handleSubmit (form,done) {
            approve({
                ...this.formApprove,
                taskId: this.row.taskId,
                processInstanceId: this.row.processInstanceId,
            }).then(res => {
                this.$message.success('审批成功');
                this.approveBox = false;
                this.onLoad(this.page, this.query);
                done();
            }).catch(err => {
                console.error(err);
            });
        },
        reassign() {// 重新指派
        },
        searchChange(params, done) {
            this.query = params;
            this.page.currentPage = 1;
            console.log('searchChange', params);
            params.createTimeBegin = params.createTime[0] || '';
            params.createTimeEnd = params.createTime[1] || '';
            console.log(params);
            this.onLoad(this.page, params);
            done();
        },
        searchReset() {
            this.query = {};
            this.onLoad(this.page);
        },
        searchChange(params, done) {
            this.query = params;
            this.parentId = '';
            this.page.currentPage = 1;
            this.onLoad(this.page, params);
            done();
        },
        currentChange(currentPage) {
            this.page.currentPage = currentPage;
@@ -211,11 +260,11 @@
        onLoad(page, params = {}) {
            const query = {
                ...this.query,
                category: params.category ? flowCategory(params.category) : null,
                // category: params.category ? flowCategory(params.category) : null,
                mode: this.mode,
            };
            this.loading = true;
            getLazyList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
            getList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
                const data = res.data.data;
                this.page.total = data.total;
                this.data = data.records;