From 3c8ada71c2f06f4c43e25e16a9717dc96caa9f5a Mon Sep 17 00:00:00 2001 From: Admin <978517621@qq.com> Date: 星期三, 17 八月 2022 20:01:13 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/api/specialWorkSystem/approveBasic/index.ts | 83 +- src/api/systemManage/user/index.ts | 6 .env.development | 6 src/views/specialWorkSystem/workFlow/approveRule/index.vue | 446 ++++++++++++++++++ src/api/specialWorkSystem/safetyAction/index.ts | 5 src/views/intellectInspect/intelligentLine/index.vue | 74 -- src/views/intellectInspect/inspectTaskManage/inspectTask/components/inspectTaskDialog.vue | 5 src/views/specialWorkSystem/workFlow/approveRule/components/approveRuleDialog.vue | 412 +++++++++++++++++ .env.production | 1 src/api/specialWorkSystem/approveRule/index.ts | 46 + src/views/specialWorkSystem/workFlow/approveRule/components/approveItemDialog.vue | 155 ++++++ src/views/specialWorkSystem/workFlow/approveRule/components/approveLevelDialog.vue | 200 ++++++++ 12 files changed, 1,336 insertions(+), 103 deletions(-) diff --git a/.env.development b/.env.development index 0aaa982..e88bf91 100644 --- a/.env.development +++ b/.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' diff --git a/.env.production b/.env.production index 73165f4..d1633bb 100644 --- a/.env.production +++ b/.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' diff --git a/src/api/specialWorkSystem/approveBasic/index.ts b/src/api/specialWorkSystem/approveBasic/index.ts index 8e4b170..15b3ba4 100644 --- a/src/api/specialWorkSystem/approveBasic/index.ts +++ b/src/api/specialWorkSystem/approveBasic/index.ts @@ -1,45 +1,46 @@ import request from '/@/utils/request'; export function approveBasicApi() { - return { - // v1 - getApproveBasicList: (data: object) => { - return request({ - url: import.meta.env.VITE_API_URL + `/work/ruleItemStand/page/list`, - method: 'post', - data: data - }); - }, - // v1 - addApproveBasic: (data: object) => { - return request({ - url: import.meta.env.VITE_API_URL + `/work/ruleItemStand/save`, - method: 'post', - data: data - }); - }, - // v1 - modApproveBasic: (data: object) => { - return request({ - url: import.meta.env.VITE_API_URL + `/work/ruleItemStand/update`, - method: 'post', - data: data - }); - }, - // v1 - deleteApproveBasic: (data: object) => { - return request({ - url: import.meta.env.VITE_API_URL + `/work/ruleItemStand/delete`, - method: 'post', - data: data - }); - }, - // v1 - getAllProductionDeviceList: () => { - return request({ - url: import.meta.env.VITE_API_URL + `/prevent/device/select/listDevices`, - method: 'post' - }); - } - }; + return { + // v1 + getApproveBasicList: (data: object) => { + return request({ + url: import.meta.env.VITE_API_URL + `/work/ruleItemStand/page/list`, + method: 'post', + data: data + }); + }, + // v1 + addApproveBasic: (data: object) => { + return request({ + url: import.meta.env.VITE_API_URL + `/work/ruleItemStand/save`, + method: 'post', + data: data + }); + }, + // v1 + modApproveBasic: (data: object) => { + return request({ + url: import.meta.env.VITE_API_URL + `/work/ruleItemStand/update`, + method: 'post', + data: data + }); + }, + // v1 + deleteApproveBasic: (data: object) => { + return request({ + url: import.meta.env.VITE_API_URL + `/work/ruleItemStand/delete`, + method: 'post', + data: data + }); + }, + // v1 + getAllApproveBasicList: (data: {}) => { + return request({ + url: import.meta.env.VITE_API_URL + `/work/ruleItemStand/list`, + method: 'post', + data + }); + } + }; } diff --git a/src/api/specialWorkSystem/approveRule/index.ts b/src/api/specialWorkSystem/approveRule/index.ts new file mode 100644 index 0000000..a87d2cd --- /dev/null +++ b/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 + }); + } + }; +} diff --git a/src/api/specialWorkSystem/safetyAction/index.ts b/src/api/specialWorkSystem/safetyAction/index.ts index 5002091..13f945a 100644 --- a/src/api/specialWorkSystem/safetyAction/index.ts +++ b/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 }); } }; diff --git a/src/api/systemManage/user/index.ts b/src/api/systemManage/user/index.ts index c7d4261..73ab166 100644 --- a/src/api/systemManage/user/index.ts +++ b/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' + }); } }; } diff --git a/src/views/intellectInspect/inspectTaskManage/inspectTask/components/inspectTaskDialog.vue b/src/views/intellectInspect/inspectTaskManage/inspectTask/components/inspectTaskDialog.vue index 2f8c470..c0ee1c0 100644 --- a/src/views/intellectInspect/inspectTaskManage/inspectTask/components/inspectTaskDialog.vue +++ b/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 { diff --git a/src/views/intellectInspect/intelligentLine/index.vue b/src/views/intellectInspect/intelligentLine/index.vue index 4c8f6e2..0c02976 100644 --- a/src/views/intellectInspect/intelligentLine/index.vue +++ b/src/views/intellectInspect/intelligentLine/index.vue @@ -105,8 +105,7 @@ socket: any; socketData: string; data: Array<any>; - id: string; - defaultImg: string + id: string } export default { name: 'intelligentLine', @@ -122,8 +121,7 @@ socketData: '', socket: null, data: [], - id: '', - defaultImg: new URL('../../../assets/default-img.jpg',import.meta.url).href + id: '' }); onMounted(() => { @@ -265,35 +263,23 @@ .picbox { width: 100%; - height: 200px; + height: 180px; padding: 10px; - margin-bottom: 20px; + margin-bottom: 40px; box-sizing: border-box; - .imgbox{ - width: 100%; - height: 120px; - position: relative; - margin-bottom: 10px; - border-radius: 4px; - overflow: hidden; - img { - display: block; - width: 100%; - height: auto; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - margin: auto; - } - } + img { + display: block; + width: 100%; + height: 100px; + margin-bottom: 8px; + border-radius: 4px; + } p { font-size: 14px; white-space: nowrap; color: rgba(255, 255, 255, 0.8); - margin-bottom: 4px; + margin-top: 10px; span { color: #fff; } @@ -303,7 +289,7 @@ .item { width: calc((100vw - 40px) / 6); height: calc((100vh - 130px) / 5); - padding: 0 40px 20px 50px; + padding: 0 20px 20px 50px; position: relative; box-sizing: border-box; border-left: 1px solid #36fcfc; @@ -478,24 +464,13 @@ padding: 10px; margin-bottom: 40px; box-sizing: border-box; - .imgbox{ + + img { + display: block; width: 100%; height: 100px; - position: relative; margin-bottom: 6px; border-radius: 4px; - overflow: hidden; - img { - display: block; - width: 100%; - height: auto; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - margin: auto; - } } p { font-size: 14px; @@ -688,24 +663,13 @@ padding: 10px; margin-bottom: 30px; box-sizing: border-box; - .imgbox{ + + img { + display: block; width: 100%; height: 80px; - position: relative; margin-bottom: 10px; border-radius: 4px; - overflow: hidden; - img { - display: block; - width: 100%; - height: auto; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - margin: auto; - } } p { font-size: 12px; diff --git a/src/views/specialWorkSystem/workFlow/approveRule/components/approveItemDialog.vue b/src/views/specialWorkSystem/workFlow/approveRule/components/approveItemDialog.vue new file mode 100644 index 0000000..33185c6 --- /dev/null +++ b/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> diff --git a/src/views/specialWorkSystem/workFlow/approveRule/components/approveLevelDialog.vue b/src/views/specialWorkSystem/workFlow/approveRule/components/approveLevelDialog.vue new file mode 100644 index 0000000..9cb42c3 --- /dev/null +++ b/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> diff --git a/src/views/specialWorkSystem/workFlow/approveRule/components/approveRuleDialog.vue b/src/views/specialWorkSystem/workFlow/approveRule/components/approveRuleDialog.vue new file mode 100644 index 0000000..540f1be --- /dev/null +++ b/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> diff --git a/src/views/specialWorkSystem/workFlow/approveRule/index.vue b/src/views/specialWorkSystem/workFlow/approveRule/index.vue new file mode 100644 index 0000000..4b2178f --- /dev/null +++ b/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> -- Gitblit v1.9.2