From 0cbef2d33036643cd971f9132f88db8360817f49 Mon Sep 17 00:00:00 2001 From: Your Name <123456> Date: 星期三, 17 八月 2022 19:54:12 +0800 Subject: [PATCH] 审批规则 --- 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 | 1262 ++++++++++++++-------------- 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,948 insertions(+), 679 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 da39b51..9a7f9f8 100644 --- a/src/views/intellectInspect/intelligentLine/index.vue +++ b/src/views/intellectInspect/intelligentLine/index.vue @@ -1,7 +1,7 @@ <template> <div class="container"> <div class="big-title" @click="goBack()">国泰新华智能巡检系统</div> - <div style="height: 20px;font-size: 14px;line-height: 20px; color: #00ffff; margin-top: 4px">{{ present }}</div> + <div style="height: 20px; font-size: 14px; line-height: 20px; color: #00ffff; margin-top: 4px">{{ present }}</div> <div class="btns"> <div class="fullbtn" @click="onScreenfullClick"> <div class="toFull"> @@ -10,73 +10,73 @@ <div>全屏</div> </div> <div class="backBtn" @click="goBack()"> - <img src="../../../assets/loginPage/back-icon.png"/> + <img src="../../../assets/loginPage/back-icon.png" /> <div>退出</div> </div> </div> <div class="blocks"> <div> - <div class="star-pic"> - <div class="star-bg"><img src="../../../assets/loginPage/star-bg.png" /></div> - <div class="star"><img src="../../../assets/loginPage/device-pic.png" /></div> - </div> - <div class="line-map" v-if="dataList && dataList.length > 0"> - <div class="line-item" v-for="(item, index) in dataList" :key="index"> - <div class="picbox"> - <img src="../../../assets/loginPage/equipment.jpg"/> - <p> - RFID: <span>{{ item.rfid }}</span> - </p> - <p> - 位置: <span>{{ item.region.toString() }}</span> - </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="indi-dot"></div> - <!-- <div class="indi-pulse"></div>--> - <!-- <div class="indi-pulse1"></div>--> + <div class="star-pic"> + <div class="star-bg"><img src="../../../assets/loginPage/star-bg.png" /></div> + <div class="star"><img src="../../../assets/loginPage/device-pic.png" /></div> + </div> + <div class="line-map" v-if="dataList && dataList.length > 0"> + <div class="line-item" v-for="(item, index) in dataList" :key="index"> + <div class="picbox"> + <img src="../../../assets/loginPage/equipment.jpg" /> + <p> + RFID: <span>{{ item.rfid }}</span> + </p> + <p> + 位置: <span>{{ item.region.toString() }}</span> + </p> </div> - <div class="arrow" v-if="item.points.some((e) => e.reportResult != null)"></div> - <div class="top-line" :class="item.points.some((e) => e.reportResult !== null) ? '' : 'fadeLine'"></div> - </div> - <div class="more-info"> - <div class="item" v-for="(t, i) in item.points" :key="i" :class="t.reportResult == null ? 'undone' : t.reportResult == 1 ? 'warning' : ''"> - <section> - <div class="dot"></div> - <div class="pulse"></div> - <div class="pulse1"></div> - </section> - <div :class="t.reportResult == null ? 'noBorder' : t.reportResult == 1 ? 'redBorder' : ''"> - <div> - <span>巡检点:</span><span>{{ t.point }}</span> - </div> - <div> - <span>巡检状态:</span><span>{{ t.pointCheckStatus == 1 ? '未完成' : '已完成' }}</span> - </div> - <div v-if="t.reportResult != null"> - <span>巡检指标:</span><span>{{ t.quotaContent }}</span> - </div> - <div v-if="(t.dataReportType == 2 || t.dataReportType == 3) && t.secondReferenceResult"> - <span>参数:</span><span class="target">{{ t.secondReferenceResult + t.quotaUnit }}</span> - </div> - <div> - <span>巡检结果:</span><span class="target">{{ t.reportResult == null ? '--' : t.reportResult == 0 ? '正常' : '异常' }}</span> + <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="indi-dot"></div> + <!-- <div class="indi-pulse"></div>--> + <!-- <div class="indi-pulse1"></div>--> + </div> + <div class="arrow" v-if="item.points.some((e) => e.reportResult != null)"></div> + <div class="top-line" :class="item.points.some((e) => e.reportResult !== null) ? '' : 'fadeLine'"></div> + </div> + <div class="more-info"> + <div class="item" v-for="(t, i) in item.points" :key="i" :class="t.reportResult == null ? 'undone' : t.reportResult == 1 ? 'warning' : ''"> + <section> + <div class="dot"></div> + <div class="pulse"></div> + <div class="pulse1"></div> + </section> + <div :class="t.reportResult == null ? 'noBorder' : t.reportResult == 1 ? 'redBorder' : ''"> + <div> + <span>巡检点:</span><span>{{ t.point }}</span> + </div> + <div> + <span>巡检状态:</span><span>{{ t.pointCheckStatus == 1 ? '未完成' : '已完成' }}</span> + </div> + <div v-if="t.reportResult != null"> + <span>巡检指标:</span><span>{{ t.quotaContent }}</span> + </div> + <div v-if="(t.dataReportType == 2 || t.dataReportType == 3) && t.secondReferenceResult"> + <span>参数:</span><span class="target">{{ t.secondReferenceResult + t.quotaUnit }}</span> + </div> + <div> + <span>巡检结果:</span><span class="target">{{ t.reportResult == null ? '--' : t.reportResult == 0 ? '正常' : '异常' }}</span> + </div> </div> </div> </div> </div> - </div> - <div class="line-item finish"> - <div class="picbox"></div> - <div class="area-head"> - <div class="finish-point"> - <div>完成巡检</div> + <div class="line-item finish"> + <div class="picbox"></div> + <div class="area-head"> + <div class="finish-point"> + <div>完成巡检</div> + </div> </div> </div> </div> - </div> - <div class="tip" v-else>抱歉,暂时查询不到巡检路线...</div> + <div class="tip" v-else>抱歉,暂时查询不到巡检路线...</div> </div> </div> </div> @@ -85,8 +85,8 @@ <script lang="ts"> import screenfull from 'screenfull'; import { lineApi } from '/@/api/intelligentLine'; -import {toRefs, reactive, ref, onMounted, onUnmounted, computed, nextTick} from 'vue'; -import {useRoute} from 'vue-router'; +import { toRefs, reactive, ref, onMounted, onUnmounted, computed, nextTick } from 'vue'; +import { useRoute } from 'vue-router'; import { storeToRefs } from 'pinia'; import { initBackEndControlRoutes } from '/@/router/backEnd'; import { Session } from '/@/utils/storage'; @@ -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(() => { @@ -138,18 +139,18 @@ // 获取url - const getUrl =async (id:string)=>{ + 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,14 +175,14 @@ message: res.data.msg }); } - } + }; // const send = () => { // state.socket.send(params); // }; // 接口获取数据 - const getLine = async (id:string) => { + const getLine = async (id: string) => { let res = await lineApi().getLine({ id: id }); if (res.data.code === '200') { userInfos.value.dataList = res.data.data; @@ -217,11 +218,11 @@ // 页面关闭处理 onUnmounted(() => { // 销毁监听 - nextTick(()=>{ + nextTick(() => { state.socket.onclose = () => { console.log('socket已经关闭'); }; - }) + }); }); return { dataList, @@ -235,600 +236,600 @@ <!-- Add "scoped" attribute to limit CSS to this component only --> <style scoped lang="scss"> - @media screen and (min-width: 1366px) { - .big-title { - font-size: 28px; - margin: 10px 0 20px; +@media screen and (min-width: 1366px) { + .big-title { + font-size: 28px; + margin: 10px 0 20px; + } + .btns { + position: absolute; + z-index: 99999; + right: 60px; + top: 40px; + div { + font-size: 16px; + color: #00ffff; } - .btns { - position: absolute; - z-index: 99999; - right: 60px; - top: 40px; - div { - font-size: 16px; - color: #00ffff; - } - } - .line-item { - width: calc((100vw - 40px) / 6); - padding-left: 20px; - display: flex; - flex-direction: column; - align-items: flex-start; - margin-right: 20px; - flex-wrap: nowrap; + } + .line-item { + width: calc((100vw - 40px) / 6); + padding-left: 20px; + display: flex; + flex-direction: column; + align-items: flex-start; + margin-right: 20px; + flex-wrap: nowrap; - .picbox { - width: 100%; - height: 180px; - padding: 10px; - margin-bottom: 40px; - box-sizing: border-box; - - 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-top: 10px; - span { - color: #fff; - } - } - } - } - .item { - width: calc((100vw - 40px) / 6); - height: calc((100vh - 130px) / 5); - padding: 0 20px 20px 50px; - position: relative; + .picbox { + width: 100%; + height: 180px; + padding: 10px; + margin-bottom: 40px; box-sizing: border-box; - border-left: 1px solid #36fcfc; - &:last-of-type { - border: none; - } - - section { - width: 24px; - height: 24px; - border-radius: 50%; - position: absolute; - border: 1px solid rgba(0, 225, 255, 0.6); - top: -12px; - left: 10px; - - .dot { - position: absolute; - width: 12px; - height: 12px; - left: 5px; - top: 5px; - -webkit-border-radius: 50%; - -moz-border-radius: 50%; - border: 1px solid #0072ff; - border-radius: 50%; - background-color: #00e1ff; - z-index: 2; - } - .pulse { - position: absolute; - width: 48px; - height: 48px; - left: -13px; - top: -13px; - border: 1px solid #00e1ff; - -webkit-border-radius: 50%; - -moz-border-radius: 50%; - border-radius: 50%; - z-index: 1; - opacity: 0; - -webkit-animation: warn 2s ease-out; - -moz-animation: warn 2s ease-out; - animation: warn 2s ease-out; - -webkit-animation-iteration-count: infinite; - -moz-animation-iteration-count: infinite; - animation-iteration-count: infinite; - box-shadow: 1px 1px 30px #00e1ff; - } - .pulse1 { - position: absolute; - width: 48px; - height: 48px; - left: -13px; - top: -13px; - border: 1px solid #00e1ff; - -webkit-border-radius: 50%; - -moz-border-radius: 50%; - border-radius: 50%; - z-index: 1; - opacity: 0; - -webkit-animation: warn1 2s ease-out; - -moz-animation: warn1 2s ease-out; - animation: warn1 2s ease-out; - -webkit-animation-iteration-count: infinite; - -moz-animation-iteration-count: infinite; - animation-iteration-count: infinite; - box-shadow: 1px 1px 30px #00e1ff; - } - } - & > div { - padding: 10px 0; - transform: translateY(-14px); - border-radius: 8px; - background-image: linear-gradient(to right, rgba(8, 109, 209, 0.4), rgba(11, 255, 255, 0.2)); - border: 1px solid rgba(54, 252, 252, 1); - display: flex; - flex-direction: column; - justify-content: center; - - div { - margin-bottom: 5px; - &:last-of-type { - margin-bottom: 0; - } - span { - display: inline-block; - white-space: nowrap; - width: 50%; - font-size: 13px; - color: #fff; - text-align: left; - - &:first-of-type { - text-align: right; - color: rgba(255, 255, 255, 0.8); - } - } - } - } - .noBorder{ - border: 1px solid rgba(54, 252, 252, 0.1); - } - .redBorder{ - border: 1px solid #ff0000; + img { + display: block; + width: 100%; + height: 100px; + margin-bottom: 8px; + border-radius: 4px; } p { - width: 140px; - height: 50px; - font-size: 18px; - line-height: 48px; - text-align: center; - color: #fff; - border-radius: 8px; - background-image: linear-gradient(to right, rgba(11, 255, 255, 0.2), rgba(8, 109, 209, 0.4)); - border: 1px solid rgba(54, 252, 252, 0.6); - } - } - .finish-point { - position: absolute; - width: 90px; - height: 90px; - border: 2px solid #0072ff; - left: -30px; - top: -45px; - border-radius: 50%; - - & > div { - width: 80px; - height: 80px; - position: absolute; - left: 3px; - top: 3px; - background: #0072ff; - border-radius: 50%; - color: #fff; - font-size: 16px; - line-height: 80px; - text-align: center; - font-weight: bolder; + font-size: 14px; + white-space: nowrap; + color: rgba(255, 255, 255, 0.8); + margin-top: 10px; + span { + color: #fff; + } } } } + .item { + width: calc((100vw - 40px) / 6); + height: calc((100vh - 130px) / 5); + padding: 0 20px 20px 50px; + position: relative; + box-sizing: border-box; + border-left: 1px solid #36fcfc; - @media screen and (min-width: 1200px) and (max-width: 1366px){ - .big-title { - font-size: 28px; - margin: 10px 0 20px; + &:last-of-type { + border: none; } - .btns { + + section { + width: 24px; + height: 24px; + border-radius: 50%; position: absolute; - z-index: 99999; - right: 40px; - top: 40px; - div { - font-size: 14px; - color: #00ffff; + border: 1px solid rgba(0, 225, 255, 0.6); + top: -12px; + left: 10px; + + .dot { + position: absolute; + width: 12px; + height: 12px; + left: 5px; + top: 5px; + -webkit-border-radius: 50%; + -moz-border-radius: 50%; + border: 1px solid #0072ff; + border-radius: 50%; + background-color: #00e1ff; + z-index: 2; + } + .pulse { + position: absolute; + width: 48px; + height: 48px; + left: -13px; + top: -13px; + border: 1px solid #00e1ff; + -webkit-border-radius: 50%; + -moz-border-radius: 50%; + border-radius: 50%; + z-index: 1; + opacity: 0; + -webkit-animation: warn 2s ease-out; + -moz-animation: warn 2s ease-out; + animation: warn 2s ease-out; + -webkit-animation-iteration-count: infinite; + -moz-animation-iteration-count: infinite; + animation-iteration-count: infinite; + box-shadow: 1px 1px 30px #00e1ff; + } + .pulse1 { + position: absolute; + width: 48px; + height: 48px; + left: -13px; + top: -13px; + border: 1px solid #00e1ff; + -webkit-border-radius: 50%; + -moz-border-radius: 50%; + border-radius: 50%; + z-index: 1; + opacity: 0; + -webkit-animation: warn1 2s ease-out; + -moz-animation: warn1 2s ease-out; + animation: warn1 2s ease-out; + -webkit-animation-iteration-count: infinite; + -moz-animation-iteration-count: infinite; + animation-iteration-count: infinite; + box-shadow: 1px 1px 30px #00e1ff; } } - .line-item { - width: calc((100vw - 40px) / 5); - padding-left: 20px; + & > div { + padding: 10px 0; + transform: translateY(-14px); + border-radius: 8px; + background-image: linear-gradient(to right, rgba(8, 109, 209, 0.4), rgba(11, 255, 255, 0.2)); + border: 1px solid rgba(54, 252, 252, 1); display: flex; flex-direction: column; - align-items: flex-start; - margin-right: 20px; - flex-wrap: nowrap; - .picbox { - width: 100%; - height: 180px; - padding: 10px; - margin-bottom: 40px; - box-sizing: border-box; + justify-content: center; - img { - display: block; - width: 100%; - height: 100px; - margin-bottom: 6px; - border-radius: 4px; + div { + margin-bottom: 5px; + &:last-of-type { + margin-bottom: 0; } - p { - font-size: 14px; + span { + display: inline-block; white-space: nowrap; - color: rgba(255, 255, 255, 0.8); - margin-top: 10px; - span { - color: #fff; + width: 50%; + font-size: 13px; + color: #fff; + text-align: left; + + &:first-of-type { + text-align: right; + color: rgba(255, 255, 255, 0.8); } } } } - .item { - width: calc((100vw - 40px) / 5); - height: calc((100vh - 130px) / 5); - padding: 0 20px 20px 40px; - position: relative; - box-sizing: border-box; - border-left: 1px solid #36fcfc; - - &:last-of-type { - border: none; - } - - section { - width: 24px; - height: 24px; - border-radius: 50%; - position: absolute; - border: 1px solid rgba(0, 225, 255, 0.6); - top: -12px; - left: 10px; - - .dot { - position: absolute; - width: 12px; - height: 12px; - left: 5px; - top: 5px; - -webkit-border-radius: 50%; - -moz-border-radius: 50%; - border: 1px solid #0072ff; - border-radius: 50%; - background-color: #00e1ff; - z-index: 2; - } - .pulse { - position: absolute; - width: 48px; - height: 48px; - left: -13px; - top: -13px; - border: 1px solid #00e1ff; - -webkit-border-radius: 50%; - -moz-border-radius: 50%; - border-radius: 50%; - z-index: 1; - opacity: 0; - -webkit-animation: warn 2s ease-out; - -moz-animation: warn 2s ease-out; - animation: warn 2s ease-out; - -webkit-animation-iteration-count: infinite; - -moz-animation-iteration-count: infinite; - animation-iteration-count: infinite; - box-shadow: 1px 1px 30px #00e1ff; - } - .pulse1 { - position: absolute; - width: 48px; - height: 48px; - left: -13px; - top: -13px; - border: 1px solid #00e1ff; - -webkit-border-radius: 50%; - -moz-border-radius: 50%; - border-radius: 50%; - z-index: 1; - opacity: 0; - -webkit-animation: warn1 2s ease-out; - -moz-animation: warn1 2s ease-out; - animation: warn1 2s ease-out; - -webkit-animation-iteration-count: infinite; - -moz-animation-iteration-count: infinite; - animation-iteration-count: infinite; - box-shadow: 1px 1px 30px #00e1ff; - } - } - & > div { - width: 90%; - padding: 10px 0; - transform: translateY(-14px); - border-radius: 8px; - background-image: linear-gradient(to right, rgba(8, 109, 209, 0.4), rgba(11, 255, 255, 0.2)); - border: 1px solid rgba(54, 252, 252, 1); - display: flex; - flex-direction: column; - justify-content: center; - - div { - width: 100%; - margin-bottom: 5px; - &:last-of-type { - margin-bottom: 0; - } - span { - display: inline-block; - white-space: nowrap; - width: 50%; - font-size: 13px; - color: #fff; - text-align: left; - - &:first-of-type { - text-align: right; - color: rgba(255, 255, 255, 0.8); - } - } - } - } - .noBorder{ - border: 1px solid rgba(54, 252, 252, 0.1); - } - .redBorder{ - border: 1px solid #ff0000; - } - p { - width: 140px; - height: 50px; - font-size: 18px; - line-height: 48px; - text-align: center; - color: #fff; - border-radius: 8px; - background-image: linear-gradient(to right, rgba(11, 255, 255, 0.2), rgba(8, 109, 209, 0.4)); - border: 1px solid rgba(54, 252, 252, 0.6); - } + .noBorder { + border: 1px solid rgba(54, 252, 252, 0.1); } - .finish-point { - position: absolute; + .redBorder { + border: 1px solid #ff0000; + } + p { + width: 140px; + height: 50px; + font-size: 18px; + line-height: 48px; + text-align: center; + color: #fff; + border-radius: 8px; + background-image: linear-gradient(to right, rgba(11, 255, 255, 0.2), rgba(8, 109, 209, 0.4)); + border: 1px solid rgba(54, 252, 252, 0.6); + } + } + .finish-point { + position: absolute; + width: 90px; + height: 90px; + border: 2px solid #0072ff; + left: -30px; + top: -45px; + border-radius: 50%; + + & > div { width: 80px; height: 80px; - border: 1px solid #0072ff; - left: -20px; - top: -40px; + position: absolute; + left: 3px; + top: 3px; + background: #0072ff; border-radius: 50%; - - & > div { - width: 70px; - height: 70px; - position: absolute; - left: 4px; - top: 4px; - background: #0072ff; - border-radius: 50%; - color: #fff; - font-size: 14px; - line-height: 70px; - text-align: center; - font-weight: bolder; - } + color: #fff; + font-size: 16px; + line-height: 80px; + text-align: center; + font-weight: bolder; } } +} - @media screen and (max-width: 1200px){ - .big-title { - font-size: 20px; - margin: 5px 0 10px; +@media screen and (min-width: 1200px) and (max-width: 1366px) { + .big-title { + font-size: 28px; + margin: 10px 0 20px; + } + .btns { + position: absolute; + z-index: 99999; + right: 40px; + top: 40px; + div { + font-size: 14px; + color: #00ffff; } - .btns { - position: absolute; - z-index: 99999; - right: 20px; - top: 40px; - div { - font-size: 12px; - color: #00ffff; - } - } - .line-item { - width: 20vw; - padding-left: 10px; - display: flex; - flex-direction: column; - align-items: flex-start; - margin-right: 20px; - flex-wrap: nowrap; - .picbox { - width: 100%; - height: 160px; - padding: 10px; - margin-bottom: 30px; - box-sizing: border-box; - - img { - display: block; - width: 100%; - height: 80px; - margin-bottom: 10px; - border-radius: 4px; - } - p { - font-size: 12px; - color: rgba(255, 255, 255, 0.8); - margin-top: 6px; - span { - color: #fff; - } - } - } - } - .item { - width: 20vw; - height: calc((100vh - 130px) / 5); - padding: 0 0 20px 30px; - position: relative; + } + .line-item { + width: calc((100vw - 40px) / 5); + padding-left: 20px; + display: flex; + flex-direction: column; + align-items: flex-start; + margin-right: 20px; + flex-wrap: nowrap; + .picbox { + width: 100%; + height: 180px; + padding: 10px; + margin-bottom: 40px; box-sizing: border-box; - border-left: 1px solid #36fcfc; - &:last-of-type { - border: none; - } - - section { - width: 24px; - height: 24px; - border-radius: 50%; - position: absolute; - border: 1px solid rgba(0, 225, 255, 0.6); - top: -12px; - left: 2px; - - .dot { - position: absolute; - width: 12px; - height: 12px; - left: 5px; - top: 5px; - -webkit-border-radius: 50%; - -moz-border-radius: 50%; - border: 1px solid #0072ff; - border-radius: 50%; - background-color: #00e1ff; - z-index: 2; - } - .pulse { - position: absolute; - width: 48px; - height: 48px; - left: -13px; - top: -13px; - border: 1px solid #00e1ff; - -webkit-border-radius: 50%; - -moz-border-radius: 50%; - border-radius: 50%; - z-index: 1; - opacity: 0; - -webkit-animation: warn 2s ease-out; - -moz-animation: warn 2s ease-out; - animation: warn 2s ease-out; - -webkit-animation-iteration-count: infinite; - -moz-animation-iteration-count: infinite; - animation-iteration-count: infinite; - box-shadow: 1px 1px 30px #00e1ff; - } - .pulse1 { - position: absolute; - width: 48px; - height: 48px; - left: -13px; - top: -13px; - border: 1px solid #00e1ff; - -webkit-border-radius: 50%; - -moz-border-radius: 50%; - border-radius: 50%; - z-index: 1; - opacity: 0; - -webkit-animation: warn1 2s ease-out; - -moz-animation: warn1 2s ease-out; - animation: warn1 2s ease-out; - -webkit-animation-iteration-count: infinite; - -moz-animation-iteration-count: infinite; - animation-iteration-count: infinite; - box-shadow: 1px 1px 30px #00e1ff; - } - } - & > div { - width: 80%; - padding: 4px 0; - transform: translateY(-14px); - border-radius: 8px; - background-image: linear-gradient(to right, rgba(8, 109, 209, 0.4), rgba(11, 255, 255, 0.2)); - border: 1px solid rgba(54, 252, 252, 1); - display: flex; - flex-direction: column; - justify-content: center; - - div { - width: 100%; - margin-bottom: 2px; - &:last-of-type { - margin-bottom: 0; - } - span { - width: 50%; - display: inline-block; - white-space: nowrap; - font-size: 12px; - color: #fff; - text-align: left; - - &:first-of-type { - text-align: right; - color: rgba(255, 255, 255, 0.8); - } - } - } - } - .noBorder{ - border: 1px solid rgba(54, 252, 252, 0.1); - } - .redBorder{ - border: 1px solid #ff0000; + img { + display: block; + width: 100%; + height: 100px; + margin-bottom: 6px; + border-radius: 4px; } p { - width: 140px; - height: 50px; - font-size: 18px; - line-height: 48px; - text-align: center; - color: #fff; - border-radius: 8px; - background-image: linear-gradient(to right, rgba(11, 255, 255, 0.2), rgba(8, 109, 209, 0.4)); - border: 1px solid rgba(54, 252, 252, 0.6); - } - } - .finish-point { - position: absolute; - width: 70px; - height: 70px; - border: 1px solid #0072ff; - left: -10px; - top: -35px; - border-radius: 50%; - - & > div { - width: 60px; - height: 60px; - position: absolute; - left: 4px; - top: 4px; - background: #0072ff; - border-radius: 50%; - color: #fff; - font-size: 12px; - line-height: 60px; - text-align: center; - font-weight: bolder; + font-size: 14px; + white-space: nowrap; + color: rgba(255, 255, 255, 0.8); + margin-top: 10px; + span { + color: #fff; + } } } } + .item { + width: calc((100vw - 40px) / 5); + height: calc((100vh - 130px) / 5); + padding: 0 20px 20px 40px; + position: relative; + box-sizing: border-box; + border-left: 1px solid #36fcfc; + + &:last-of-type { + border: none; + } + + section { + width: 24px; + height: 24px; + border-radius: 50%; + position: absolute; + border: 1px solid rgba(0, 225, 255, 0.6); + top: -12px; + left: 10px; + + .dot { + position: absolute; + width: 12px; + height: 12px; + left: 5px; + top: 5px; + -webkit-border-radius: 50%; + -moz-border-radius: 50%; + border: 1px solid #0072ff; + border-radius: 50%; + background-color: #00e1ff; + z-index: 2; + } + .pulse { + position: absolute; + width: 48px; + height: 48px; + left: -13px; + top: -13px; + border: 1px solid #00e1ff; + -webkit-border-radius: 50%; + -moz-border-radius: 50%; + border-radius: 50%; + z-index: 1; + opacity: 0; + -webkit-animation: warn 2s ease-out; + -moz-animation: warn 2s ease-out; + animation: warn 2s ease-out; + -webkit-animation-iteration-count: infinite; + -moz-animation-iteration-count: infinite; + animation-iteration-count: infinite; + box-shadow: 1px 1px 30px #00e1ff; + } + .pulse1 { + position: absolute; + width: 48px; + height: 48px; + left: -13px; + top: -13px; + border: 1px solid #00e1ff; + -webkit-border-radius: 50%; + -moz-border-radius: 50%; + border-radius: 50%; + z-index: 1; + opacity: 0; + -webkit-animation: warn1 2s ease-out; + -moz-animation: warn1 2s ease-out; + animation: warn1 2s ease-out; + -webkit-animation-iteration-count: infinite; + -moz-animation-iteration-count: infinite; + animation-iteration-count: infinite; + box-shadow: 1px 1px 30px #00e1ff; + } + } + & > div { + width: 90%; + padding: 10px 0; + transform: translateY(-14px); + border-radius: 8px; + background-image: linear-gradient(to right, rgba(8, 109, 209, 0.4), rgba(11, 255, 255, 0.2)); + border: 1px solid rgba(54, 252, 252, 1); + display: flex; + flex-direction: column; + justify-content: center; + + div { + width: 100%; + margin-bottom: 5px; + &:last-of-type { + margin-bottom: 0; + } + span { + display: inline-block; + white-space: nowrap; + width: 50%; + font-size: 13px; + color: #fff; + text-align: left; + + &:first-of-type { + text-align: right; + color: rgba(255, 255, 255, 0.8); + } + } + } + } + .noBorder { + border: 1px solid rgba(54, 252, 252, 0.1); + } + .redBorder { + border: 1px solid #ff0000; + } + p { + width: 140px; + height: 50px; + font-size: 18px; + line-height: 48px; + text-align: center; + color: #fff; + border-radius: 8px; + background-image: linear-gradient(to right, rgba(11, 255, 255, 0.2), rgba(8, 109, 209, 0.4)); + border: 1px solid rgba(54, 252, 252, 0.6); + } + } + .finish-point { + position: absolute; + width: 80px; + height: 80px; + border: 1px solid #0072ff; + left: -20px; + top: -40px; + border-radius: 50%; + + & > div { + width: 70px; + height: 70px; + position: absolute; + left: 4px; + top: 4px; + background: #0072ff; + border-radius: 50%; + color: #fff; + font-size: 14px; + line-height: 70px; + text-align: center; + font-weight: bolder; + } + } +} + +@media screen and (max-width: 1200px) { + .big-title { + font-size: 20px; + margin: 5px 0 10px; + } + .btns { + position: absolute; + z-index: 99999; + right: 20px; + top: 40px; + div { + font-size: 12px; + color: #00ffff; + } + } + .line-item { + width: 20vw; + padding-left: 10px; + display: flex; + flex-direction: column; + align-items: flex-start; + margin-right: 20px; + flex-wrap: nowrap; + .picbox { + width: 100%; + height: 160px; + padding: 10px; + margin-bottom: 30px; + box-sizing: border-box; + + img { + display: block; + width: 100%; + height: 80px; + margin-bottom: 10px; + border-radius: 4px; + } + p { + font-size: 12px; + color: rgba(255, 255, 255, 0.8); + margin-top: 6px; + span { + color: #fff; + } + } + } + } + .item { + width: 20vw; + height: calc((100vh - 130px) / 5); + padding: 0 0 20px 30px; + position: relative; + box-sizing: border-box; + border-left: 1px solid #36fcfc; + + &:last-of-type { + border: none; + } + + section { + width: 24px; + height: 24px; + border-radius: 50%; + position: absolute; + border: 1px solid rgba(0, 225, 255, 0.6); + top: -12px; + left: 2px; + + .dot { + position: absolute; + width: 12px; + height: 12px; + left: 5px; + top: 5px; + -webkit-border-radius: 50%; + -moz-border-radius: 50%; + border: 1px solid #0072ff; + border-radius: 50%; + background-color: #00e1ff; + z-index: 2; + } + .pulse { + position: absolute; + width: 48px; + height: 48px; + left: -13px; + top: -13px; + border: 1px solid #00e1ff; + -webkit-border-radius: 50%; + -moz-border-radius: 50%; + border-radius: 50%; + z-index: 1; + opacity: 0; + -webkit-animation: warn 2s ease-out; + -moz-animation: warn 2s ease-out; + animation: warn 2s ease-out; + -webkit-animation-iteration-count: infinite; + -moz-animation-iteration-count: infinite; + animation-iteration-count: infinite; + box-shadow: 1px 1px 30px #00e1ff; + } + .pulse1 { + position: absolute; + width: 48px; + height: 48px; + left: -13px; + top: -13px; + border: 1px solid #00e1ff; + -webkit-border-radius: 50%; + -moz-border-radius: 50%; + border-radius: 50%; + z-index: 1; + opacity: 0; + -webkit-animation: warn1 2s ease-out; + -moz-animation: warn1 2s ease-out; + animation: warn1 2s ease-out; + -webkit-animation-iteration-count: infinite; + -moz-animation-iteration-count: infinite; + animation-iteration-count: infinite; + box-shadow: 1px 1px 30px #00e1ff; + } + } + & > div { + width: 80%; + padding: 4px 0; + transform: translateY(-14px); + border-radius: 8px; + background-image: linear-gradient(to right, rgba(8, 109, 209, 0.4), rgba(11, 255, 255, 0.2)); + border: 1px solid rgba(54, 252, 252, 1); + display: flex; + flex-direction: column; + justify-content: center; + + div { + width: 100%; + margin-bottom: 2px; + &:last-of-type { + margin-bottom: 0; + } + span { + width: 50%; + display: inline-block; + white-space: nowrap; + font-size: 12px; + color: #fff; + text-align: left; + + &:first-of-type { + text-align: right; + color: rgba(255, 255, 255, 0.8); + } + } + } + } + .noBorder { + border: 1px solid rgba(54, 252, 252, 0.1); + } + .redBorder { + border: 1px solid #ff0000; + } + p { + width: 140px; + height: 50px; + font-size: 18px; + line-height: 48px; + text-align: center; + color: #fff; + border-radius: 8px; + background-image: linear-gradient(to right, rgba(11, 255, 255, 0.2), rgba(8, 109, 209, 0.4)); + border: 1px solid rgba(54, 252, 252, 0.6); + } + } + .finish-point { + position: absolute; + width: 70px; + height: 70px; + border: 1px solid #0072ff; + left: -10px; + top: -35px; + border-radius: 50%; + + & > div { + width: 60px; + height: 60px; + position: absolute; + left: 4px; + top: 4px; + background: #0072ff; + border-radius: 50%; + color: #fff; + font-size: 12px; + line-height: 60px; + text-align: center; + font-weight: bolder; + } + } +} @keyframes warn { 0% { @@ -960,7 +961,7 @@ padding: 10px 40px 35px; box-sizing: border-box; - &>div{ + & > div { width: 100%; height: 100%; display: flex; @@ -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 { 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