Your Name
2022-08-17 0cbef2d33036643cd971f9132f88db8360817f49
审批规则
已修改7个文件
已添加5个文件
1319 ■■■■■ 文件已修改
.env.development 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.env.production 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/specialWorkSystem/approveBasic/index.ts 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/specialWorkSystem/approveRule/index.ts 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/specialWorkSystem/safetyAction/index.ts 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/systemManage/user/index.ts 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/intellectInspect/inspectTaskManage/inspectTask/components/inspectTaskDialog.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/intellectInspect/intelligentLine/index.vue 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/specialWorkSystem/workFlow/approveRule/components/approveItemDialog.vue 155 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/specialWorkSystem/workFlow/approveRule/components/approveLevelDialog.vue 200 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/specialWorkSystem/workFlow/approveRule/components/approveRuleDialog.vue 412 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/specialWorkSystem/workFlow/approveRule/index.vue 446 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.env.development
@@ -1,13 +1,13 @@
# 本地环境
ENV = 'development'
#VITE_API_URL = 'http://192.168.0.35:8008'
VITE_API_URL = 'http://192.168.0.35:8008'
#李宇飞接口地址
VITE_API_URL = 'http://192.168.0.50:8008'
#VITE_API_URL = 'http://192.168.0.50:8008'
#张凤接口地址
VITE_API_URL = 'http://192.168.0.29:8008'
#VITE_API_URL = 'http://192.168.0.29:8008'
#黄振接口地址
#VITE_API_URL = 'http://192.168.0.179:8008'
.env.production
@@ -4,5 +4,6 @@
# 线上环境接口地址
VITE_API_URL = 'http://121.239.169.27:16006/safeplatform'
VITE_API_URL_OUT = 'http://121.239.169.27:16006/safeplatform-out'
VITE_API_URL_SOCKET = 'http://121.239.169.27:16006/safeplatform'
#VITE_API_URL = 'http://192.168.0.52:8011/safeplatform'
#VITE_API_URL_OUT = 'http://192.168.0.52:8011/safeplatform-out'
src/api/specialWorkSystem/approveBasic/index.ts
@@ -35,10 +35,11 @@
            });
        },
        // v1
        getAllProductionDeviceList: () => {
        getAllApproveBasicList: (data: {}) => {
            return request({
                url: import.meta.env.VITE_API_URL + `/prevent/device/select/listDevices`,
                method: 'post'
                url: import.meta.env.VITE_API_URL + `/work/ruleItemStand/list`,
                method: 'post',
                data
            });
        }
    };
src/api/specialWorkSystem/approveRule/index.ts
对比新文件
@@ -0,0 +1,46 @@
import request from '/@/utils/request';
export function approveRuleApi() {
    return {
        // v1
        getApproveRuleList: (data: object) => {
            return request({
                url: import.meta.env.VITE_API_URL + `/rule/listByPage`,
                method: 'post',
                data: data
            });
        },
        // v1
        addApproveRule: (data: object) => {
            return request({
                url: import.meta.env.VITE_API_URL + `/rule/save`,
                method: 'post',
                data: data
            });
        },
        // v1
        modApproveRule: (data: object) => {
            return request({
                url: import.meta.env.VITE_API_URL + `/work/ruleItemStand/update`,
                method: 'post',
                data: data
            });
        },
        // v1
        deleteApproveRule: (data: object) => {
            return request({
                url: import.meta.env.VITE_API_URL + `/work/ruleItemStand/delete`,
                method: 'post',
                data: data
            });
        },
        // v1
        getAllApproveRuleList: (data: {}) => {
            return request({
                url: import.meta.env.VITE_API_URL + `/prevent/device/select/listDevices`,
                method: 'post',
                data
            });
        }
    };
}
src/api/specialWorkSystem/safetyAction/index.ts
@@ -35,10 +35,11 @@
            });
        },
        // v1
        getAllSafetyActionList: () => {
        getAllSafetyActionList: (data: {}) => {
            return request({
                url: import.meta.env.VITE_API_URL + `/rule/measure/list`,
                method: 'post'
                method: 'post',
                data: data
            });
        }
    };
src/api/systemManage/user/index.ts
@@ -32,6 +32,12 @@
                url: import.meta.env.VITE_API_URL + `/account/dep/list?depId=${depId == null ? '' : depId}`,
                method: 'get'
            });
        },
        getAllUser: () => {
            return request({
                url: import.meta.env.VITE_API_URL + `/account/list`,
                method: 'get'
            });
        }
    };
}
src/views/intellectInspect/inspectTaskManage/inspectTask/components/inspectTaskDialog.vue
@@ -470,7 +470,8 @@
                data.inspectTaskForm.points.push(data.inspectPointForm);
                data.inspectPointDialog = false;
            } else if (data.title === '新增巡检任务' && data.pointTitle === '修改巡检点') {
                let result = data.inspectTaskForm.points.findIndex((item) => item.id === data.inspectPointForm.id);
                debugger;
                let result = data.inspectTaskForm.points.findIndex((item) => item.execSequence === data.inspectPointForm.execSequence);
                data.inspectTaskForm.points[result] = data.inspectPointForm;
                data.inspectPointDialog = false;
            } else if (data.title === '修改巡检任务' && data.pointTitle === '新增巡检点') {
@@ -504,7 +505,7 @@
                        message: '巡检点修改成功',
                        duration: 2000
                    });
                    let result = data.inspectTaskForm.points.findIndex((item) => item.id === data.inspectPointForm.id);
                    let result = data.inspectTaskForm.points.findIndex((item) => item.execSequence === data.inspectPointForm.execSequence);
                    data.inspectTaskForm.points[result] = data.inspectPointForm;
                    data.inspectPointDialog = false;
                } else {
src/views/intellectInspect/intelligentLine/index.vue
@@ -32,7 +32,7 @@
                        </p>
                    </div>
                    <div class="area-head">
                        <div class="indicator" :class="item.points.some((e) => e.reportResult == 1) ? 'somewarning' : (item.points.some((e) => e.reportResult == null) ? 'someUndone' : '')">
                            <div class="indicator" :class="item.points.some((e) => e.reportResult == 1) ? 'somewarning' : item.points.some((e) => e.reportResult == null) ? 'someUndone' : ''">
                            <div class="indi-dot"></div>
                            <!--              <div class="indi-pulse"></div>-->
                            <!--              <div class="indi-pulse1"></div>-->
@@ -94,6 +94,7 @@
import { ElTable } from 'element-plus';
import { FormInstance, FormRules, ElMessage } from 'element-plus';
import { useUserInfo } from '/@/stores/userInfo';
import Cookies from 'js-cookie';
// 定义接口来定义对象的类型
interface stateType {
@@ -103,7 +104,7 @@
    socket: any;
    socketData: string;
    data: Array<any>;
    id: string
    id: string;
}
export default {
    name: 'intelligentLine',
@@ -126,10 +127,10 @@
            setInterval(() => {
                state.present = new Date().toLocaleString();
            }, 1000);
            let curId = route.query.id
            state.id = curId.toString()
            getLine(state.id)
            getUrl(state.id)
            let curId = route.query.id;
            state.id = curId.toString();
            getLine(state.id);
            getUrl(state.id);
        });
        const dataList = computed(() => {
@@ -141,15 +142,15 @@
        const getUrl =async (id:string)=>{
            const res = await lineApi().getUrl();
            if (res.data.code === '200') {
                state.path = 'http://' + res.data.data.ip + ':' + res.data.data.port + '/ws/test/'
                state.path = 'http://' + res.data.data.ip + ':' + res.data.data.port + '/ws/test/';
                if (typeof WebSocket === 'undefined') {
                    alert('您的浏览器不支持socket');
                } else {
                    // 实例化socket
                    // debugger
                    let uid =  userInfos.value.uid.toString()
                    var url = state.path + uid + '*' + id;
                    console.log(url,'url',uid,'uid')
                    let uid = userInfos.value.uid.toString();
                    var url = state.path + Cookies.get('uid') + '*' + id;
                    console.log(url, 'url', uid, 'uid');
                    url = url.replace('https', 'ws').replace('http', 'ws');
                    console.log(url, '获取地址');
                    state.socket = new WebSocket(url);
@@ -164,7 +165,7 @@
                    // 监听socket消息
                    state.socket.onmessage = (msg) => {
                        if (msg.data === '连接成功') return;
                        console.log(msg.data,'data')
                        console.log(msg.data, 'data');
                        userInfos.value.dataList = JSON.parse(msg.data);
                    };
                }
@@ -174,7 +175,7 @@
                    message: res.data.msg
                });
            }
        }
        };
        // const send = () => {
        //     state.socket.send(params);
@@ -221,7 +222,7 @@
                state.socket.onclose = () => {
                    console.log('socket已经关闭');
                };
            })
            });
        });
        return {
            dataList,
@@ -977,7 +978,6 @@
            align-items: flex-start;
            .line-item {
                .area-head {
                    position: relative;
                    width: 100%;
@@ -1109,7 +1109,7 @@
                    }
                    .fadeLine {
                        width: 100%;
                        border-top: 1px solid rgba(54,252,252,.6);
                        border-top: 1px solid rgba(54, 252, 252, 0.6);
                    }
                }
                .fadeBorder {
src/views/specialWorkSystem/workFlow/approveRule/components/approveItemDialog.vue
对比新文件
@@ -0,0 +1,155 @@
<template>
    <el-dialog v-model="approveItemDialog" :title="title">
        <el-form :model="approveItemForm" label-width="150px" ref="approveItemFormRef" :rules="approveItemFormRule">
            <el-col :span="24" style="margin-bottom: 24px">
                <el-form-item label="审批项名称" prop="itemName">
                    <el-input v-model="approveItemForm.itemName" class="input-add" placeholder="请填写审批项名称"> </el-input>
                </el-form-item>
            </el-col>
            <el-col :span="24" style="margin-bottom: 24px">
                <el-form-item label="审批项类型" prop="type">
                    <el-select v-model="approveItemForm.type" placeholder="请选择审批项类型" class="input-add">
                        <el-option v-for="item in typeList" :key="item.id" :value="item.id" :label="item.name"></el-option>
                    </el-select>
                </el-form-item>
            </el-col>
            <el-col :span="24" style="margin-bottom: 24px">
                <el-form-item label="措施名称" prop="measureId">
                    <el-select v-model="approveItemForm.measureId" placeholder="请选择措施" class="input-add">
                        <el-option v-for="item in actionList" :key="item.id" :value="item.id" :label="item.context"></el-option>
                    </el-select>
                </el-form-item>
            </el-col>
            <el-col :span="24" style="margin-bottom: 20px">
                <el-form-item label="标准名称" prop="standId">
                    <el-select v-model="approveItemForm.standId" class="input-add" placeholder="选择标准">
                        <el-option v-for="item in standardList" :key="item.ruleStandId" :value="item.ruleStandId" :label="item.title"></el-option>
                    </el-select>
                </el-form-item>
            </el-col>
            <div align="right">
                <el-button type="warning" @click="approveItemDialog = false" size="default" plain>取消</el-button>
                <el-button type="primary" @click="submitApproveItem()" size="default">确认</el-button>
            </div>
        </el-form>
    </el-dialog>
</template>
<script lang="ts">
import { reactive, toRefs, ref, onMounted } from 'vue';
import { ElMessage } from 'element-plus/es';
import { userApi } from '/@/api/systemManage/user';
import { safetyActionApi } from '/@/api/specialWorkSystem/safetyAction';
import approveRule from '/@/views/specialWorkSystem/workFlow/approveRule/index.vue';
import { approveBasicApi } from '/@/api/specialWorkSystem/approveBasic/index';
interface dataState {
    title: string;
    activeName: string;
    approveItemDialog: boolean;
    approveItemForm: stepAddReqDTO;
    approveItemFormRule: {};
    actionList: Array<type>;
    typeList: Array<type>;
    standardList: [];
    order: '';
}
interface stepAddReqDTO {
    itemName: string | null;
    type: null;
    measureId: number | null;
    standId: number | null;
}
interface type {
    id: number;
    name: string;
}
export default {
    name: 'approveItemDialog',
    setup(props: any, context: any) {
        const approveItemFormRef = ref();
        const data = reactive<dataState>({
            title: '',
            activeName: 'ApproveAction',
            approveItemDialog: false,
            approveItemForm: {
                itemName: null,
                type: null,
                measureId: null,
                standId: null
            },
            approveItemFormRule: {},
            actionList: [],
            typeList: [
                { id: 1, name: '数值' },
                { id: 2, name: '选项' },
                { id: 3, name: '填空' }
            ],
            standardList: [],
            order: null
        });
        const showApproveItemDialog = (type: string, value: {}, index: number) => {
            data.approveItemDialog = true;
            data.order = index;
            if (type === '新增') {
                data.title = '新增审批项';
                data.approveItemForm = {
                    itemName: null,
                    type: null,
                    measureId: null,
                    standId: null
                };
            } else {
                data.title = '修改审批项';
                data.approveItemForm = JSON.parse(JSON.stringify(value));
            }
        };
        const submitApproveItem = async () => {
            context.emit('addApprovalItem', data.approveItemForm, data.title, data.order);
            data.approveItemDialog = false;
        };
        //获取措施项
        const getActionData = async () => {
            let res = await safetyActionApi().getAllSafetyActionList({ workType: null, type: null, context: null });
            if (res.data.code === '200') {
                data.actionList = res.data.data;
            } else {
                ElMessage({
                    type: 'warning',
                    message: res.data.msg
                });
            }
        };
        //获取标准
        const getStandardData = async () => {
            let res = await approveBasicApi().getAllApproveBasicList({ ruleStandType: null, title: null });
            if (res.data.code === '200') {
                data.standardList = res.data.data;
            } else {
                ElMessage({
                    type: 'warning',
                    message: res.data.msg
                });
            }
        };
        // 页面加载时
        onMounted(() => {
            getActionData();
            getStandardData();
        });
        return {
            ...toRefs(data),
            approveItemFormRef,
            submitApproveItem,
            showApproveItemDialog
        };
    }
};
</script>
<style scoped></style>
src/views/specialWorkSystem/workFlow/approveRule/components/approveLevelDialog.vue
对比新文件
@@ -0,0 +1,200 @@
<template>
    <div>
        <el-dialog v-model="approveLevelDialog" :title="title" :close-on-click-modal="false">
            <el-form :model="approveLevelForm" label-width="150px" ref="approveLevelFormRef" :rules="approveLevelFormRule">
                <el-col :span="24" style="margin-bottom: 24px">
                    <el-form-item label="层级名称" prop="stepName">
                        <el-input v-model="approveLevelForm.stepName" class="input-add" placeholder="请填写层级名称"> </el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="24" style="margin-bottom: 24px">
                    <el-form-item label="审批层级" prop="depId">
                        <el-select v-model="approveLevelForm.type" placeholder="请选择审批层级" class="input-add">
                            <el-option v-for="item in typeList" :key="item.id" :value="item.id" :label="item.name"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="24" style="margin-bottom: 24px">
                    <el-form-item label="审批人" prop="unitAddReqDTOList">
                        <el-select v-model="approveLevelForm.unitAddReqDTOList" multiple placeholder="请选择审批人" class="input-add">
                            <el-option v-for="item in userList" :key="item.uid" :value="item.uid" :label="item.realName"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="24" style="margin-bottom: 20px">
                    <el-form-item label="审批有效时间" prop="continueTime">
                        <el-input v-model="approveLevelForm.continueTime" placeholder="请输入审批有效时间" class="input-add">
                            <template #prepend>
                                <el-select v-model="approveLevelForm.continueTimeUnit" placeholder="选择单位">
                                    <el-option v-for="item in timeList" :key="item.id" :value="item.id" :label="item.name"></el-option>
                                </el-select>
                            </template>
                        </el-input>
                    </el-form-item>
                </el-col>
                <div class="checkUnit-point">
                    <el-tabs class="active" v-model="activeName">
                        <el-tab-pane label="审批流程息" name="ApproveAction">
                            <div class="filter-container">
                                <el-button size="default" type="success" @click="openApproveActionDialog('新增', '', 0)">
                                    <el-icon>
                                        <ele-FolderAdd />
                                    </el-icon>
                                    新增审批流程
                                </el-button>
                            </div>
                            <el-table ref="table" :data="approveLevelForm.itemAddReqDTOList" style="width: 100%">
                                <el-table-column property="itemName" label="审批项名称" show-overflow-tooltip> </el-table-column>
                                <el-table-column property="type" label="审批项类型" show-overflow-tooltip> </el-table-column>
                                <el-table-column property="measureId" label="措施名称" show-overflow-tooltip></el-table-column>
                                <el-table-column property="standId" label="标准名称" show-overflow-tooltip> </el-table-column>
                                <el-table-column label="操作" width="150" align="center">
                                    <template #default="scope">
                                        <el-button type="text" size="small" @click="openApproveActionDialog('修改', scope.row, scope.$index)">修改</el-button>
                                        <el-button type="text" size="small" style="color: red" @click="deleteApproveItem(scope.$index)">删除</el-button>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-tab-pane>
                    </el-tabs>
                </div>
                <div align="right" style="padding-top: 10px">
                    <el-button type="warning" @click="approveLevelDialog = false" size="default" plain>取消</el-button>
                    <el-button type="primary" @click="submitApproveLevel()" size="default">确认</el-button>
                </div>
            </el-form>
        </el-dialog>
        <approve-item-dialog ref="approveItemDialogRef" @addApprovalItem="achieveApprovalItem"></approve-item-dialog>
    </div>
</template>
<script lang="ts">
import { reactive, toRefs, ref } from 'vue';
import approveItemDialog from '/@/views/specialWorkSystem/workFlow/approveRule/components/approveItemDialog.vue';
import { ElMessage } from 'element-plus/es';
interface dataState {
    title: string;
    activeName: string;
    approveLevelDialog: boolean;
    approveLevelForm: stepAddReqDTO;
    approveLevelFormRule: {};
    departmentList: [];
    userList: [];
    timeList: Array<type>;
    typeList: Array<type>;
    workLevelList: [];
}
interface stepAddReqDTO {
    id: number | null;
    stepName: null;
    stepSerial: number | null;
    type: number | null;
    continueTime: number | null;
    continueTimeUnit: number | null;
    unitAddReqDTOList: [];
    itemAddReqDTOList: [];
}
interface type {
    id: number;
    name: string;
}
export default {
    name: 'approveLevelDialog',
    components: { approveItemDialog },
    setup(props: any, context: any) {
        const approveLevelFormRef = ref();
        const approveItemDialogRef = ref();
        const data = reactive<dataState>({
            title: '',
            activeName: 'ApproveAction',
            approveLevelDialog: false,
            approveLevelForm: {
                id: null,
                stepName: null,
                stepSerial: null,
                type: null,
                continueTime: null,
                continueTimeUnit: null,
                unitAddReqDTOList: [],
                itemAddReqDTOList: []
            },
            approveLevelFormRule: {},
            departmentList: [],
            userList: [],
            timeList: [
                { id: 1, name: '日' },
                { id: 2, name: '时' },
                { id: 3, name: '分' }
            ],
            typeList: [
                { id: 1, name: '单人' },
                { id: 2, name: '多人' },
                { id: 3, name: '分析人' }
            ],
            workLevelList: []
        });
        const showApproveLevelDialog = (type: string, value: {}, userList: []) => {
            data.approveLevelDialog = true;
            data.userList = userList;
            if (type === '新增') {
                data.title = '新增审批层级';
                data.approveLevelForm = {
                    id: null,
                    stepName: null,
                    stepSerial: null,
                    type: null,
                    continueTime: null,
                    continueTimeUnit: null,
                    unitAddReqDTOList: [],
                    itemAddReqDTOList: []
                };
            } else {
                data.title = '修改审批层级';
                data.approveLevelForm = JSON.parse(JSON.stringify(value));
            }
        };
        const openApproveActionDialog = (type: string, value: {}, index: number) => {
            approveItemDialogRef.value.showApproveItemDialog(type, value, index);
        };
        const submitApproveLevel = async () => {
            data.approveLevelForm.unitAddReqDTOList = data.approveLevelForm.unitAddReqDTOList.map((item) => {
                return {
                    bindUid: item
                };
            });
            context.emit('addApprovalLevel', data.approveLevelForm, data.title);
            data.approveLevelDialog = false;
        };
        const achieveApprovalItem = (value: stepAddReqDTO, title: string, index: number) => {
            if (title === '新增审批项') {
                data.approveLevelForm.itemAddReqDTOList.push(value);
            } else {
                data.approveLevelForm.itemAddReqDTOList[index] = JSON.parse(JSON.stringify(value));
            }
        };
        const deleteApproveItem = async (index: number) => {
            data.approveLevelForm.itemAddReqDTOList.splice(index, 1);
        };
        return {
            ...toRefs(data),
            approveLevelFormRef,
            approveItemDialogRef,
            deleteApproveItem,
            submitApproveLevel,
            achieveApprovalItem,
            showApproveLevelDialog,
            openApproveActionDialog
        };
    }
};
</script>
<style scoped></style>
src/views/specialWorkSystem/workFlow/approveRule/components/approveRuleDialog.vue
对比新文件
@@ -0,0 +1,412 @@
<template>
    <div class="system-add-menu-container">
        <el-dialog v-model="ifShowApproveRuleDialog" :title="title">
            <el-form :model="approveRuleForm" label-width="120px" ref="approveRuleFormRef" :rules="approveRuleFormRules">
                <el-row>
                    <el-col :span="12" style="margin-bottom: 20px">
                        <el-form-item label="任务名称" prop="ruleName">
                            <el-input v-model="approveRuleForm.ruleName" :disabled="!inspectPointConfirm" class="input-add" placeholder="请填写任务名称"> </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12" style="margin-bottom: 20px">
                        <el-form-item label="部门名称" prop="depId">
                            <el-cascader :disabled="!inspectPointConfirm" placeholder="请选择部门名称" :options="departmentList" :props="{ emitPath: false, checkStrictly: true, value: 'depId', label: 'depName' }" clearable filterable class="input-add" v-model="approveRuleForm.depId"> </el-cascader>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12" style="margin-bottom: 20px">
                        <el-form-item label="作业类型" prop="workType">
                            <el-select v-model="approveRuleForm.workType" :disabled="!inspectPointConfirm" placeholder="请选择作业类型" class="input-add">
                                <el-option v-for="item in workTypeList" :key="item.id" :value="item.id" :label="item.name"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12" style="margin-bottom: 20px">
                        <el-form-item label="作业等级" prop="workLevel">
                            <el-select v-model="approveRuleForm.workLevel" :disabled="!inspectPointConfirm" placeholder="请选择作业等级" class="input-add">
                                <el-option v-for="item in workLevelList" :key="item.id" :value="item.id" :label="item.groupName"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="创建审批链">
                            <div style="width: 100%; margin-bottom: 20px" v-show="inspectPointConfirm">
                                <el-button type="primary" :icon="Plus" size="default" @click="openApproveLevelDialog('新增', '')">新增巡检点</el-button>
                            </div>
                            <div style="width: 100%; margin-left: -30px">
                                <div v-for="(item, index) in approveRuleForm.stepAddReqDTOList" class="stepItem">
                                    <div class="stepNum">{{ index + 1 }}</div>
                                    <div class="stepCard">
                                        <el-card class="box-card">
                                            <div class="text item">
                                                层级名称:<span>{{ item.stepName }}</span>
                                            </div>
                                            <!--                                            <div class="text item">-->
                                            <!--                                                所属设备区域:<span>{{ item.regionId }}</span>-->
                                            <!--                                            </div>-->
                                            <div class="text item">
                                                审批类型:<span>{{ item.type }}</span>
                                            </div>
                                            <!--                                            <div class="text item">-->
                                            <!--                                                关联RFID:<span>{{ item.rfidId }}</span>-->
                                            <!--                                            </div>-->
                                            <div class="text item">
                                                审批人:<span>{{ item.type }}</span>
                                            </div>
                                            <!--                                            <div class="text item">-->
                                            <!--                                                巡检指标:<span>{{ item.quotaId }}</span>-->
                                            <!--                                            </div>-->
                                            <div class="text item">
                                                审批有效时长:<span>{{ item.name }}</span>
                                            </div>
                                            <!--                                            <div class="text item">-->
                                            <!--                                                数据填报类型:<span>{{ item.dataReportType }}</span>-->
                                            <!--                                            </div>-->
                                            <div class="text item">
                                                审批项:<span>{{ item.firstReferenceValue ? item.firstReferenceValue : item.secondReferenceValue ? item.secondReferenceValue : item.thirdReferenceValue }}</span>
                                            </div>
                                        </el-card>
                                    </div>
                                    <div v-show="inspectPointConfirm">
                                        <!--                                <el-button type="primary" size="default" @click="addFlow(index)">新增下一区域</el-button>-->
                                        <el-button type="primary" style="margin-left: 12px" size="default" @click="openApproveLevelDialog('修改', item)">修改</el-button>
                                        <el-button type="danger" size="default" @click="deleteApproveLevel(index, item)">删除</el-button>
                                    </div>
                                </div>
                            </div>
                        </el-form-item>
                    </el-col>
                </el-row>
                <div align="right" v-show="inspectPointConfirm">
                    <el-button type="warning" @click="inspectPointDialog = false" size="default" plain>取消</el-button>
                    <el-button type="primary" @click="submitApproveRule()" size="default">确认</el-button>
                </div>
            </el-form>
        </el-dialog>
        <approve-level-dialog ref="approveLevelDialogRef" @addApprovalLevel="achieveApprovalLevel"></approve-level-dialog>
    </div>
</template>
<script lang="ts">
import { reactive, toRefs, ref } from 'vue';
import { ElMessage } from 'element-plus/es';
import { approveRuleApi } from '/@/api/specialWorkSystem/approveRule';
import approveLevelDialog from '/@/views/specialWorkSystem/workFlow/approveRule/components/approveLevelDialog.vue';
interface dataState {
    title: string;
    pointTitle: string;
    inspectPointConfirm: boolean;
    inspectPointDialog: boolean;
    ifShowApproveRuleDialog: boolean;
    inspectPointForm: stepAddReqDTO;
    approveRuleForm: {
        id: number | null;
        ruleName: number | null;
        depId: number | null;
        workType: number | null;
        workLevel: number | null;
        stepAddReqDTOList: Array<stepAddReqDTO>;
    };
    approveRuleFormRules: {};
    departmentList: [];
    userList: [];
    workTypeList: [];
    workLevelList: [];
}
interface quota {
    id: number;
    type: string;
    unit: string;
}
interface stepAddReqDTO {
    id: number | null;
    stepName: null;
    stepSerial: number | null;
    type: number | null;
    continueTime: number | null;
    continueTimeUnit: number | null;
    unitAddReqDTOList: [];
    itemAddReqDTOList: [];
}
export default {
    name: 'approveRuleDialog',
    components: { approveLevelDialog },
    setup(props: any, context: any) {
        const approveRuleFormRef = ref();
        const approveLevelDialogRef = ref();
        const data = reactive<dataState>({
            title: '',
            pointTitle: '',
            inspectPointConfirm: true,
            inspectPointDialog: false,
            ifShowApproveRuleDialog: false,
            inspectPointForm: {
                id: null,
                stepName: null,
                stepSerial: null,
                type: null,
                continueTime: null,
                continueTimeUnit: null,
                unitAddReqDTOList: [],
                itemAddReqDTOList: []
            },
            approveRuleForm: {
                id: null,
                ruleName: null,
                depId: null,
                workType: null,
                workLevel: null,
                stepAddReqDTOList: []
            },
            approveRuleFormRules: {
                unitName: [{ required: true, message: '请填写巡检任务单元名称', trigger: 'blur' }],
                workType: [{ required: true, message: '请选择巡检任务类型', trigger: 'change' }],
                execClassgroupId: [{ required: true, message: '请选择巡检班组', trigger: 'change' }],
                execDepId: [{ required: true, message: '请选择巡检部门', trigger: 'blur' }],
                checkCycle: [{ required: true, message: '请填写巡检周期', trigger: 'blur' }],
                noticeTime: [{ required: true, message: '请填写提前通知时间', trigger: 'blur' }],
                validTime: [{ required: true, message: '请填写有效时间', trigger: 'blur' }],
                firstStartTime: [{ required: true, message: '请选择周期开始时间', trigger: 'change' }]
            },
            departmentList: [],
            userList: [],
            workTypeList: [],
            workLevelList: []
        });
        const openApproveLevelDialog = (type: string, value: {}) => {
            approveLevelDialogRef.value.showApproveLevelDialog(type, value, data.userList);
        };
        const achieveApprovalLevel = (value: stepAddReqDTO, title: string) => {
            debugger;
            if (title === '新增审批层级') {
                if (data.approveRuleForm.stepAddReqDTOList.length === 0) {
                    value.stepSerial = 1;
                    data.approveRuleForm.stepAddReqDTOList.push(value);
                } else {
                    value.stepSerial = data.approveRuleForm.stepAddReqDTOList[data.approveRuleForm.stepAddReqDTOList.length - 1].stepSerial + 1;
                    data.approveRuleForm.stepAddReqDTOList.push(value);
                }
            } else {
                let result = data.approveRuleForm.stepAddReqDTOList.findIndex((item) => item.stepSerial === value.stepSerial);
                data.approveRuleForm.stepAddReqDTOList[result] = JSON.parse(JSON.stringify(value));
            }
        };
        const showApproveRuleDialog = (type: string, value: {}, departmentList: [], userList: [], workTypeList: []) => {
            data.ifShowApproveRuleDialog = true;
            data.userList = userList;
            data.workTypeList = workTypeList;
            data.departmentList = departmentList;
            if (type === '新增') {
                data.title = '新增审批规则';
                data.approveRuleForm = {
                    id: null,
                    ruleName: null,
                    depId: null,
                    workType: null,
                    workLevel: null,
                    stepAddReqDTOList: []
                };
            } else {
                data.title = '修改审批规则';
                data.approveRuleForm = JSON.parse(JSON.stringify(value));
            }
        };
        const deleteApproveLevel = (index: number, item: any) => {
            data.approveRuleForm.stepAddReqDTOList.splice(index, 1);
        };
        const submitApproveRule = () => {
            approveRuleFormRef.value.validate(async (valid: Boolean) => {
                if (valid) {
                    if (data.title === '新增审批规则') {
                        let res = await approveRuleApi().addApproveRule(data.approveRuleForm);
                        if (res.data.code === '200') {
                            ElMessage({
                                type: 'success',
                                message: '审批规则新增成功',
                                duration: 2000
                            });
                            data.ifShowApproveRuleDialog = false;
                            context.emit('refreshApproveRule');
                        } else {
                            ElMessage({
                                type: 'warning',
                                message: res.data.msg
                            });
                        }
                    } else {
                        let res = await approveRuleApi().modApproveRule(data.approveRuleForm);
                        if (res.data.code === '200') {
                            ElMessage({
                                type: 'success',
                                message: '审批规则修改成功',
                                duration: 2000
                            });
                            data.ifShowApproveRuleDialog = false;
                            context.emit('refreshApproveRule');
                        } else {
                            ElMessage({
                                type: 'warning',
                                message: res.data.msg
                            });
                        }
                    }
                } else {
                    ElMessage({
                        type: 'warning',
                        message: '请完善基本信息'
                    });
                }
            });
        };
        return {
            ...toRefs(data),
            approveLevelDialog,
            approveRuleFormRef,
            approveLevelDialogRef,
            submitApproveRule,
            achieveApprovalLevel,
            openApproveLevelDialog,
            showApproveRuleDialog,
            deleteApproveLevel
        };
    }
};
</script>
<style scoped lang="scss">
$homeNavLengh: 8;
.home-container {
    height: calc(100vh - 144px);
    box-sizing: border-box;
    overflow: hidden;
    .homeCard {
        width: 100%;
        padding: 20px;
        box-sizing: border-box;
        background: #fff;
        border-radius: 4px;
        .main-card {
            width: 100%;
            height: 100%;
            .cardTop {
                display: flex;
                align-items: center;
                justify-content: space-between;
                margin-bottom: 20px;
                .mainCardBtn {
                    margin: 0;
                }
            }
            .pageBtn {
                height: 60px;
                display: flex;
                align-items: center;
                justify-content: right;
                .demo-pagination-block + .demo-pagination-block {
                    margin-top: 10px;
                }
                .demo-pagination-block .demonstration {
                    margin-bottom: 16px;
                }
            }
        }
        &:last-of-type {
            height: calc(100% - 100px);
        }
    }
    .el-row {
        display: flex;
        align-items: center;
        margin-bottom: 20px;
        &:last-child {
            margin-bottom: 0;
        }
        .grid-content {
            align-items: center;
            min-height: 36px;
        }
        .topInfo {
            display: flex;
            align-items: center;
            font-size: 16px;
            font-weight: bold;
            & > div {
                white-space: nowrap;
                margin-right: 20px;
            }
        }
    }
}
.stepItem {
    width: 100%;
    display: flex;
    align-items: flex-start;
    margin-bottom: 30px;
    margin-left: 30px;
    padding-bottom: 30px;
    border-left: 2px solid #ccc;
    &:first-of-type {
        margin-top: 30px;
    }
    &:last-of-type {
        margin-bottom: 0;
        border-left: none;
    }
    .stepNum {
        width: 30px;
        height: 30px;
        border-radius: 15px;
        box-sizing: border-box;
        color: #333;
        border: 1px solid #999;
        line-height: 28px;
        text-align: center;
        margin-right: 10px;
        margin-left: -16px;
        margin-top: -30px;
    }
    .stepCard {
        width: 100%;
        margin-top: -30px;
        .box-card {
            width: 100%;
            &:deep(.el-card__header) {
                padding: 10px 15px;
            }
            .card-header {
                width: 100%;
                display: flex;
                justify-content: space-between;
                align-items: center;
                & > div:first-of-type {
                    margin-right: 80px;
                    font-size: 18px;
                    font-weight: bold;
                }
            }
        }
    }
    &:hover .card-header {
        color: #0098f5;
    }
    &:hover .stepNum {
        border: 2px solid #0098f5;
        color: #0098f5;
    }
}
:deep(.el-date-editor) {
    width: 100%;
}
</style>
src/views/specialWorkSystem/workFlow/approveRule/index.vue
对比新文件
@@ -0,0 +1,446 @@
<template>
    <div class="home-container">
        <div style="height: 100%">
            <el-row class="homeCard">
                <div class="basic-line">
                    <span>任务类型:</span>
                    <el-select v-model="tableData.params.workType" clearable filterable class="input-box" placeholder="任务类型">
                        <el-option v-for="item in workTypeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                </div>
                <div class="basic-line">
                    <span>任务类型:</span>
                    <el-select v-model="tableData.params.workType" clearable filterable class="input-box" placeholder="任务类型">
                        <el-option v-for="item in workTypeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                </div>
                <div class="basic-line">
                    <span>任务类型:</span>
                    <el-select v-model="tableData.params.workType" clearable filterable class="input-box" placeholder="任务类型">
                        <el-option v-for="item in workTypeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                </div>
                <div class="basic-line">
                    <span>任务类型:</span>
                    <el-select v-model="tableData.params.workType" clearable filterable class="input-box" placeholder="任务类型">
                        <el-option v-for="item in workTypeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
                    </el-select>
                </div>
                <div style="padding-bottom: 10px">
                    <el-button type="primary" @click="getApproveRule">查询</el-button>
                    <el-button plain @click="reset">重置</el-button>
                </div>
            </el-row>
            <div class="homeCard">
                <div class="main-card">
                    <el-row class="cardTop">
                        <el-col :span="12" class="mainCardBtn">
                            <el-button type="primary" :icon="Plus" size="default" @click="openApproveRuleDialog('新增', {})">新建</el-button>
                            <!--                            <el-button type="danger" :icon="Delete" size="default" plain>删除</el-button>-->
                        </el-col>
                        <el-button type="primary" :icon="Refresh" size="default" />
                    </el-row>
                    <el-table ref="multipleTableRef" :data="tableData.ApproveRuleData" style="width: 100%" height="calc(100% - 100px)" :header-cell-style="{ background: '#fafafa' }" @selection-change="handleSelectionChange">
                        <el-table-column type="selection" width="55" />
                        <el-table-column property="unitName" label="任务名称" />
                        <el-table-column property="workType" label="任务类型">
                            <template #default="scope">
                                <span>
                                    {{ parseNumber(scope.row.workType, '任务类型') }}
                                </span>
                            </template>
                        </el-table-column>
                        <el-table-column property="execClassgroupId" label="巡检班组">
                            <template #default="scope">
                                <span>
                                    {{ parseNumber(scope.row.execClassgroupId, '巡检班组') }}
                                </span>
                            </template>
                        </el-table-column>
                        <el-table-column property="frequency" label="检查频次">
                            <template #default="scope">
                                <span>
                                    {{ scope.row.checkCycle }}
                                </span>
                                <span>
                                    {{ scope.row.checkCycleUnit }}
                                </span>
                            </template>
                        </el-table-column>
                        <el-table-column property="firstStartTime" label="任务开始时间" />
                        <el-table-column prop="createUserName" label="创建人" show-overflow-tooltip></el-table-column>
                        <el-table-column prop="gmtCreate" label="创建时间" show-overflow-tooltip></el-table-column>
                        <el-table-column prop="lastEditUserName" label="最后修改人" show-overflow-tooltip></el-table-column>
                        <el-table-column prop="gmtModitify" label="最后修改时间" show-overflow-tooltip></el-table-column>
                        <el-table-column property="status" label="状态" width="60" />
                        <el-table-column fixed="right" label="操作" align="center" width="300">
                            <template #default="scope">
                                <el-button link type="primary" size="small" :icon="View" @click="openApproveRuleDialog('查看', scope.row)">查看</el-button>
                                <el-button link type="primary" size="small" :icon="Edit" @click="openApproveRuleDialog('修改', scope.row)">修改</el-button>
                                <el-button link type="danger" size="small" :icon="Delete" @click="deleteApproveRule(scope.row)">删除</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                    <div class="pageBtn">
                        <el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" :pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="tableData.params.pageIndex" background v-model:page-size="tableData.params.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="tableData.total" class="page-position"> </el-pagination>
                    </div>
                </div>
            </div>
        </div>
        <approve-rule-dialog ref="approveRuleDialogRef" @refreshApproveRule="getApproveRule"></approve-rule-dialog>
    </div>
</template>
<script lang="ts">
import { toRefs, reactive, ref, onMounted } from 'vue';
import { Edit, View, Plus, Delete, Refresh, Search, Download } from '@element-plus/icons-vue';
import { ElTable, ElMessage, ElMessageBox } from 'element-plus';
import approveRuleDialog from '/@/views/specialWorkSystem/workFlow/approveRule/components/approveRuleDialog.vue';
import { departmentApi } from '/@/api/systemManage/department';
import { approveRuleApi } from '/@/api/specialWorkSystem/approveRule/index';
import { userApi } from '/@/api/systemManage/user';
interface stateType {
    tableData: {
        approveRuleData: [];
        total: number;
        loading: boolean;
        params: {
            pageIndex: number | null;
            pageSize: number | null;
            searchParams: {
                ruleName: string | null;
                depId: number | null;
                workType: number | null;
                workLevel: number | null;
            };
        };
    };
    workTypeList: Array<type>;
    departmentList: [];
    userList: [];
    timeType: Array<type>;
}
interface type {
    id: number;
    name: string;
}
export default {
    name: 'index',
    components: { approveRuleDialog },
    setup() {
        const approveRuleDialogRef = ref();
        const state = reactive<stateType>({
            tableData: {
                approveRuleData: [],
                total: 0,
                loading: false,
                params: {
                    pageIndex: 1,
                    pageSize: 10,
                    searchParams: {
                        ruleName: null,
                        depId: null,
                        workType: null,
                        workLevel: null
                    }
                }
            },
            workTypeList: [
                { id: 1, name: '动火作业' },
                { id: 2, name: '受限空间作业' },
                { id: 3, name: '吊装作业' },
                { id: 4, name: '动土作业' },
                { id: 5, name: '断路作业' },
                { id: 6, name: '高处作业' },
                { id: 7, name: '临时用电作业' },
                { id: 8, name: '盲板抽堵作业' }
            ],
            departmentList: [],
            userList: [],
            timeType: [
                { id: 1, name: '分' },
                { id: 2, name: '小时' },
                { id: 3, name: '日' },
                { id: 4, name: '月' },
                { id: 5, name: '年' }
            ]
        });
        //获取巡检任务数据
        const getApproveRule = async () => {
            let res = await approveRuleApi().getApproveRuleList(state.tableData.params);
            if (res.data.code === '200') {
                state.tableData.approveRuleData = res.data.data.records;
                state.tableData.total = res.data.data.total;
            } else {
                ElMessage({
                    type: 'warning',
                    message: res.data.msg
                });
            }
        };
        //获取部门
        const getDepartmentData = async () => {
            let res = await departmentApi().getDepartmentList();
            if (res.data.code === '200') {
                state.departmentList = res.data.data;
            } else {
                ElMessage({
                    type: 'warning',
                    message: res.data.msg
                });
            }
        };
        //获取用户列表
        const getUserData = async () => {
            let res = await userApi().getAllUser();
            if (res.data.code === '200') {
                state.userList = res.data.data;
            } else {
                ElMessage({
                    type: 'warning',
                    message: res.data.msg
                });
            }
        };
        // 删除
        const deleteApproveRule = (row: any) => {
            ElMessageBox.confirm(`此操作将永久删除该任务:“${row.unitName}”,是否继续?`, '提示', {
                confirmButtonText: '确认',
                cancelButtonText: '取消',
                type: 'warning'
            })
                .then(async () => {
                    let res = await approveRuleApi().deleteApproveRule({ id: row.id });
                    if (res.data.code === '200') {
                        ElMessage({
                            type: 'success',
                            duration: 2000,
                            message: '删除成功'
                        });
                        await getApproveRule();
                    } else {
                        ElMessage({
                            type: 'warning',
                            message: res.data.msg
                        });
                    }
                })
                .catch(() => {});
        };
        const openApproveRuleDialog = (type: string, value: {}) => {
            approveRuleDialogRef.value.showApproveRuleDialog(type, value, state.departmentList, state.userList, state.workTypeList);
        };
        const parseNumber = (value: number, type: string) => {
            if (type === '任务类型') {
                return state.workTypeList.find((item) => item.id === value)?.name;
            } else if (type === '检查频次') {
                return state.timeType.find((item) => item.id == value)?.name;
            } else {
            }
        };
        // 分页改变
        const onHandleSizeChange = (val: number) => {
            state.tableData.params.pageSize = val;
            getApproveRule();
        };
        // 分页改变
        const onHandleCurrentChange = (val: number) => {
            state.tableData.params.pageIndex = val;
            getApproveRule();
        };
        const reset = () => {
            state.tableData.params = {
                pageIndex: 1,
                pageSize: 10,
                searchParams: {
                    ruleName: null,
                    depId: null,
                    workType: null,
                    workLevel: null
                }
            };
        };
        // 页面加载时
        onMounted(() => {
            getApproveRule();
            getDepartmentData();
            getUserData();
        });
        return {
            View,
            Edit,
            Delete,
            Refresh,
            Plus,
            reset,
            parseNumber,
            deleteApproveRule,
            getApproveRule,
            onHandleSizeChange,
            onHandleCurrentChange,
            approveRuleDialogRef,
            openApproveRuleDialog,
            ...toRefs(state)
        };
    }
};
</script>
<style scoped lang="scss">
$homeNavLengh: 8;
.home-container {
    height: calc(100vh - 144px);
    box-sizing: border-box;
    overflow: hidden;
    .homeCard {
        width: 100%;
        padding: 20px;
        box-sizing: border-box;
        background: #fff;
        border-radius: 4px;
        .main-card {
            width: 100%;
            height: 100%;
            .cardTop {
                display: flex;
                align-items: center;
                justify-content: space-between;
                margin-bottom: 20px;
                .mainCardBtn {
                    margin: 0;
                }
            }
            .pageBtn {
                height: 60px;
                display: flex;
                align-items: center;
                justify-content: right;
                .demo-pagination-block + .demo-pagination-block {
                    margin-top: 10px;
                }
                .demo-pagination-block .demonstration {
                    margin-bottom: 16px;
                }
            }
        }
        &:last-of-type {
            height: calc(100% - 100px);
        }
    }
    .el-row {
        display: flex;
        align-items: center;
        margin-bottom: 20px;
        &:last-child {
            margin-bottom: 0;
        }
        .grid-content {
            align-items: center;
            min-height: 36px;
        }
        .topInfo {
            display: flex;
            align-items: center;
            font-size: 16px;
            font-weight: bold;
            & > div {
                white-space: nowrap;
                margin-right: 20px;
            }
        }
    }
}
.stepItem {
    width: 100%;
    display: flex;
    align-items: flex-start;
    margin-bottom: 30px;
    margin-left: 30px;
    padding-bottom: 30px;
    border-left: 2px solid #ccc;
    &:first-of-type {
        margin-top: 30px;
    }
    &:last-of-type {
        margin-bottom: 0;
        border-left: none;
    }
    .stepNum {
        width: 30px;
        height: 30px;
        border-radius: 15px;
        box-sizing: border-box;
        color: #333;
        border: 1px solid #999;
        line-height: 28px;
        text-align: center;
        margin-right: 10px;
        margin-left: -16px;
        margin-top: -30px;
    }
    .stepCard {
        width: 100%;
        margin-top: -30px;
        .box-card {
            width: 100%;
            &:deep(.el-card__header) {
                padding: 10px 15px;
            }
            .card-header {
                width: 100%;
                display: flex;
                justify-content: space-between;
                align-items: center;
                & > div:first-of-type {
                    margin-right: 80px;
                    font-size: 18px;
                    font-weight: bold;
                }
            }
        }
    }
    &:hover .card-header {
        color: #0098f5;
    }
    &:hover .stepNum {
        border: 2px solid #0098f5;
        color: #0098f5;
    }
}
.el-input {
    width: 100% !important;
}
:deep(.el-date-editor) {
    width: 100%;
}
.el-select {
    width: 100%;
}
:deep(.el-textarea.is-disabled .el-textarea__inner) {
    background-color: var(--el-card-bg-color);
    color: var(--el-input-text-color, var(--el-text-color-regular));
}
:deep(.el-input.is-disabled .el-input__inner) {
    color: var(--el-input-text-color, var(--el-text-color-regular));
}
:deep(.el-input.is-disabled .el-input__wrapper) {
    background-color: var(--el-card-bg-color);
}
</style>