From a1d03a0e810219f8353748f6e55699bf2e1a77a6 Mon Sep 17 00:00:00 2001 From: Admin <978517621@qq.com> Date: 星期一, 15 八月 2022 19:48:10 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/api/specialWorkSystem/approveBasic/index.ts | 45 +++ .env.development | 3 src/stores/userInfo.ts | 1 src/layout/navBars/breadcrumb/user.vue | 5 src/views/specialWorkSystem/workFlow/approveBasic/index.vue | 441 +++++++++++++++++++++++++++++++ src/views/doublePrevent/riskLevel/action/components/riskControlMeasureDialog.vue | 6 src/utils/request.ts | 23 + src/router/backEnd.ts | 8 src/views/loginPage/component/accountLogin.vue | 9 src/views/newHome/index.vue | 3 src/views/specialWorkSystem/workFlow/approveBasic/components/approveBasicDialog.vue | 241 +++++++++++++++++ 11 files changed, 762 insertions(+), 23 deletions(-) diff --git a/.env.development b/.env.development index e10b42b..0214cc8 100644 --- a/.env.development +++ b/.env.development @@ -4,6 +4,9 @@ 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.29:8008' #黄振接口地址 diff --git a/src/api/specialWorkSystem/approveBasic/index.ts b/src/api/specialWorkSystem/approveBasic/index.ts new file mode 100644 index 0000000..8e4b170 --- /dev/null +++ b/src/api/specialWorkSystem/approveBasic/index.ts @@ -0,0 +1,45 @@ +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' + }); + } + }; +} diff --git a/src/layout/navBars/breadcrumb/user.vue b/src/layout/navBars/breadcrumb/user.vue index beea3ff..5a46abf 100644 --- a/src/layout/navBars/breadcrumb/user.vue +++ b/src/layout/navBars/breadcrumb/user.vue @@ -100,6 +100,7 @@ import { NextLoading } from '/@/utils/loading'; import { useRequestOldRoutes } from '/@/stores/requestOldRoutes'; import { dynamicRoutes } from '/@/router/route'; +import Cookies from 'js-cookie'; export default defineComponent({ name: 'layoutBreadcrumbUser', @@ -250,8 +251,8 @@ const getSysName = async () => { if (window.nextLoading === undefined) NextLoading.start(); - if (!Session.get('token')) return false; - const res = await menuApi.getMenuAdmin(Session.get('projectId') === null ? '' : Session.get('projectId')); + if (!Cookies.get('token')) return false; + const res = await menuApi.getMenuAdmin(Cookies.get('projectId') === null ? '' : Cookies.get('projectId')); if (res.data.code === '200') { state.systemName = res.data.data[1].project.projectName; console.log(state.systemName); diff --git a/src/router/backEnd.ts b/src/router/backEnd.ts index 023d0b6..83a8d37 100644 --- a/src/router/backEnd.ts +++ b/src/router/backEnd.ts @@ -3,7 +3,6 @@ import pinia from '/@/stores/index'; import { useUserInfo } from '/@/stores/userInfo'; import { useRequestOldRoutes } from '/@/stores/requestOldRoutes'; -import { Session } from '/@/utils/storage'; import { NextLoading } from '/@/utils/loading'; import { dynamicRoutes, notFoundAndNoPower } from '/@/router/route'; import { formatTwoStageRoutes, formatFlatteningRoutes, router } from '/@/router/index'; @@ -11,6 +10,7 @@ import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes'; import { useMenuApi } from '/@/api/systemManage/menu/index'; import { ElMessage } from 'element-plus'; +import Cookies from 'js-cookie'; const menuApi = useMenuApi(); @@ -26,8 +26,8 @@ export async function initBackEndControlRoutes() { if (window.nextLoading === undefined) NextLoading.start(); - if (!Session.get('token')) return false; - const res = await getBackEndControlRoutes(Session.get('projectId') === null ? '' : Session.get('projectId')); + if (!Cookies.get('token')) return false; + const res = await getBackEndControlRoutes(Cookies.get('projectId') === null ? '' : Cookies.get('projectId')); await useRequestOldRoutes().setRequestOldRoutes(JSON.parse(JSON.stringify(res.data.data))); dynamicRoutes[0].children = await backEndComponent(res.data.data); await setAddRoute(); @@ -70,7 +70,7 @@ * @description 路径:/src/views/system/homeMenu/component/menuDialog.vue */ export function setBackEndControlRefreshRoutes() { - getBackEndControlRoutes(Session.get('projectId')); + getBackEndControlRoutes(Cookies.get('projectId')); } export function backEndComponent(routes: any) { diff --git a/src/stores/userInfo.ts b/src/stores/userInfo.ts index c4eb3bc..be7e8c0 100644 --- a/src/stores/userInfo.ts +++ b/src/stores/userInfo.ts @@ -1,7 +1,6 @@ import { defineStore } from 'pinia'; import Cookies from 'js-cookie'; import { UserInfosStates } from './interface'; -import { Session } from '/@/utils/storage'; /** * 用户信息 diff --git a/src/utils/request.ts b/src/utils/request.ts index 4abb65d..ef709ab 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -1,7 +1,9 @@ import axios from 'axios'; import { ElMessage, ElMessageBox } from 'element-plus'; -import { Session } from '/@/utils/storage'; import JSONbig from 'json-bigint'; +import Cookies from 'js-cookie'; +import {useLoginApi} from "/@/api/login"; +import { Session, } from '/@/utils/storage'; // var jsonBig = require('json-bigint')({ "storeAsString": true }); // 配置新建一个 axios 实例 @@ -18,9 +20,9 @@ config.data[key] = null; } } - if (Session.get('token')) { - (<any>config.headers).common['Authorization'] = `${Session.get('token')}`; - (<any>config.headers).common['uid'] = `${Session.get('uid')}`; + if (Cookies.get('token')) { + (<any>config.headers).common['Authorization'] = `${Cookies.get('token')}`; + (<any>config.headers).common['uid'] = `${Cookies.get('uid')}`; } return config; }, @@ -56,10 +58,13 @@ }, 1000); } else if (response.data.code && response.data.code === 'A0215') { ElMessage.error('token失效'); - setTimeout(() => { - Session.clear(); - window.location.href = '/'; - }, 1000); + // logOut; + useLoginApi().signOut().then(()=>{ + setTimeout(() => { + Session.clear(); + window.location.href = '/'; + }, 1000); + }) } // if(response.data.code && response.data.code !== '200'){ return Promise.resolve(response); @@ -88,7 +93,7 @@ if (error.message.indexOf('timeout') != -1) { ElMessage.error('网络超时'); setTimeout(() => { - Session.clear(); + // Session.clear(); window.location.href = '/'; }, 1000); } else if (error.message == 'Network Error') { diff --git a/src/views/doublePrevent/riskLevel/action/components/riskControlMeasureDialog.vue b/src/views/doublePrevent/riskLevel/action/components/riskControlMeasureDialog.vue index f02b43d..316d156 100644 --- a/src/views/doublePrevent/riskLevel/action/components/riskControlMeasureDialog.vue +++ b/src/views/doublePrevent/riskLevel/action/components/riskControlMeasureDialog.vue @@ -29,21 +29,21 @@ </el-col> <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> <el-form-item label="管控措施分类1" prop="classify1"> - <el-select class="input-add" :disabled="!disabled" v-model="riskControlMeasureForm.classify1" @change="changeClassifyTwoList" placeholder="请选择管控方式" clearable> + <el-select class="input-add" :disabled="!disabled" v-model="riskControlMeasureForm.classify1" @change="changeClassifyTwoList" placeholder="请选择管控措施分类1" clearable> <el-option v-for="item in classifyOneList" :key="item.id" :label="item.riskMeasureName" :value="item.id"></el-option> </el-select> </el-form-item> </el-col> <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> <el-form-item label="管控措施分类2" prop="classify2"> - <el-select class="input-add" :disabled="!disabled" v-model="riskControlMeasureForm.classify2" placeholder="请选择管控方式" clearable> + <el-select class="input-add" :disabled="!disabled" v-model="riskControlMeasureForm.classify2" placeholder="请选择管控措施分类2" clearable> <el-option v-for="item in classifyTwoList" :key="item.id" :label="item.riskMeasureName" :value="item.id"></el-option> </el-select> </el-form-item> </el-col> <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> <el-form-item label="管控措施分类3" prop="classify3"> - <el-input class="input-add" :disabled="!disabled" v-model.trim="riskControlMeasureForm.classify3" placeholder="请选择管控方式" clearable> </el-input> + <el-input class="input-add" :disabled="!disabled" v-model.trim="riskControlMeasureForm.classify3" placeholder="请填写管控措施分类3" clearable> </el-input> </el-form-item> </el-col> <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> diff --git a/src/views/loginPage/component/accountLogin.vue b/src/views/loginPage/component/accountLogin.vue index 4830d5b..604b58f 100644 --- a/src/views/loginPage/component/accountLogin.vue +++ b/src/views/loginPage/component/accountLogin.vue @@ -73,9 +73,12 @@ let res = await useLoginApi().signIn(state.ruleForm); if (res.data.code === '200') { await userInfo.setUserInfos(res.data.data); - Session.set('token', res.data.data.accessToken); - Session.set('projectId', ''); - Session.set('uid', res.data.data.uid); + Cookies.set('token', res.data.data.accessToken); + Cookies.set('projectId', ''); + Cookies.set('uid', res.data.data.uid); + // Session.set('token', res.data.data.accessToken); + // Session.set('projectId', ''); + // Session.set('uid', res.data.data.uid); await signInSuccess(); } else { state.loading.signIn = false; diff --git a/src/views/newHome/index.vue b/src/views/newHome/index.vue index 2028dee..4e61775 100644 --- a/src/views/newHome/index.vue +++ b/src/views/newHome/index.vue @@ -189,6 +189,7 @@ import { useI18n } from 'vue-i18n'; import screenfull from 'screenfull'; import router from '../../router' +import Cookies from 'js-cookie' // 定义接口来定义对象的类型 interface LoginState { @@ -349,7 +350,7 @@ //调后台菜单接口 const renderFun = async () => { - Session.set('projectId', state.projectId); + Cookies.set('projectId', state.projectId); userInfos.value.projectId = state.projectId; await initBackEndControlRoutes().then(() => { let linkToMenu = [...routesList.value]; diff --git a/src/views/specialWorkSystem/workFlow/approveBasic/components/approveBasicDialog.vue b/src/views/specialWorkSystem/workFlow/approveBasic/components/approveBasicDialog.vue new file mode 100644 index 0000000..9127f73 --- /dev/null +++ b/src/views/specialWorkSystem/workFlow/approveBasic/components/approveBasicDialog.vue @@ -0,0 +1,241 @@ +<template> + <div class="system-add-menu-container"> + <el-dialog :title="title" v-model="isShowApproveBasicDialog" width="600px" :close-on-click-modal="false"> + <el-form :model="approveBasicForm" :rules="approveBasicFormRules" ref="approveBasicFormRef" size="default" label-width="120px"> + <el-row :gutter="35"> + <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> + <el-form-item label="标题" prop="title"> + <el-input class="input-add" :disabled="!disabled" v-model.trim="approveBasicForm.title" placeholder="请输入标题名称" clearable></el-input> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> + <el-form-item label="标准类型" prop="ruleStandType"> + <el-select class="input-add" :disabled="!disabled" v-model="approveBasicForm.ruleStandType" placeholder="请选择标准类型" clearable filterable> + <el-option v-for="item in ruleStandTypeList" :key="item.id" :label="item.name" :value="item.id"></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> + <el-form-item label="最大值" prop="maxVal"> + <el-input v-model="approveBasicForm.maxVal" type="number" class="input-add" placeholder="请根据需求选择"> + <template #prepend> + <el-select v-model="approveBasicForm.maxValMatchPattern" placeholder="请根据需求选择" style="width: 115px"> + <el-option v-for="item in typeTwoList" :key="item.id" :value="item.id" :label="item.name"> </el-option> + </el-select> + </template> + </el-input> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> + <el-form-item label="最小值" prop="minVal"> + <el-input v-model="approveBasicForm.minVal" type="number" class="input-add" placeholder="请根据需求选择"> + <template #prepend> + <el-select v-model="approveBasicForm.minValMatchPattern" placeholder="请根据需求选择" style="width: 115px"> + <el-option v-for="item in typeList" :key="item.id" :value="item.id" :label="item.name"> </el-option> + </el-select> + </template> + </el-input> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20"> + <el-form-item label="描述" prop="info"> + <el-input class="input-add" :rows="3" v-model.trim="approveBasicForm.info" type="textarea" placeholder="请输入描述" ></el-input> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20" v-show="personTime"> + <el-form-item label="创建人" prop="location"> + <el-input class="input-add" :disabled="!disabled" v-model.trim="approveBasicForm.createByUserName"></el-input> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20" v-show="personTime"> + <el-form-item label="创建时间" prop="location"> + <el-input class="input-add" :disabled="!disabled" v-model.trim="approveBasicForm.gmtCreate"></el-input> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20" v-show="personTime"> + <el-form-item label="最后修改人" prop="location"> + <el-input class="input-add" :disabled="!disabled" v-model.trim="approveBasicForm.lastEditUserName"></el-input> + </el-form-item> + </el-col> + <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20" v-show="personTime"> + <el-form-item label="最后修改时间" prop="location"> + <el-input class="input-add" :disabled="!disabled" v-model.trim="approveBasicForm.gmtModitify"></el-input> + </el-form-item> + </el-col> + </el-row> + </el-form> + <template #footer> + <span class="dialog-footer" v-show="disabled"> + <el-button @click="isShowApproveBasicDialog = !isShowApproveBasicDialog" size="default">取 消</el-button> + <el-button type="primary" @click="submitApproveBasic" v-throttle size="default">确 定</el-button> + </span> + </template> + </el-dialog> + </div> +</template> + +<script lang="ts"> +interface stateType { + isShowApproveBasicDialog: Boolean; + disabled: Boolean; + personTime: Boolean; + approveBasicForm: { + ruleStandType: null|number, + minVal: null|number, + minValMatchPattern: null, + maxVal: null|number, + maxValMatchPattern: null|number, + title:null| string, + info:null| string, + }; + title: string; + departmentList: []; + ruleStandTypeList: Array<levelListState>; + typeList: Array<levelListState>; + typeTwoList: Array<levelListState>; + approveBasicFormRules: {}; +} +interface levelListState { + id:number, + name:string +} +import { reactive, toRefs, ref } from 'vue'; +import { approveBasicApi } from '/@/api/specialWorkSystem/approveBasic'; +import { ElMessage } from 'element-plus'; +export default { + name: 'approveBasicDialog', + setup(props: any, context: any) { + const approveBasicFormRef = ref(); + const state = reactive<stateType>({ + title: '', + disabled: false, + personTime: false, + departmentList: [], + isShowApproveBasicDialog: false, + ruleStandTypeList: [ + { id: 1, name: '可燃气浓度' }, + { id: 2, name: '氧气浓度' }, + { id: 3, name: '一氧化碳浓度' }, + { id: 4, name: '硫化氢浓度' }, + { id: 5, name: '温度' }, + { id: 6, name: '压力' }, + { id: 7, name: '震动' }, + ], + typeList:[ + { id: 1, name: '大于' }, + { id: 2, name: '等于' }, + { id: 4, name: '大于等于' }, + ], + typeTwoList:[ + { id: 3, name: '小于' }, + { id: 2, name: '等于' }, + { id: 5, name: '小于等于' }, + ], + approveBasicForm: { + ruleStandType: null, + minVal: null, + minValMatchPattern: null, + maxVal: null, + maxValMatchPattern: null, + title: null, + info: null, + }, + approveBasicFormRules: { + ruleStandType: [{ required: true, message: '请选择标准类型', trigger: 'change' }], + minVal: [{ required: true, message: '请填写标最低值', trigger: 'blur' }], + maxVal: [{ required: true, message: '请填写标最高值', trigger: 'blur' }], + title: [{ required: true, message: '请选择风险等级', trigger: 'blur' }], + info: [{ required: true, message: '请填写描述信息', trigger: 'blur' }] + } + }); + + //打开模态框 + const showApproveBasicDialog = (type: string, value: object, department: []) => { + state.isShowApproveBasicDialog = true; + state.departmentList = department; + setTimeout(() => { + approveBasicFormRef.value.clearValidate(); + }); + if (type === '新增') { + state.disabled = true; + state.personTime = false; + state.title = '新增审批标准'; + state.approveBasicForm = { + ruleStandType: null, + minVal: null, + minValMatchPattern: null, + maxVal: null, + maxValMatchPattern: null, + title: null, + info: null, + }; + } else if (type === '查看') { + state.disabled = false; + state.personTime = true; + state.title = '查看审批标准'; + state.approveBasicForm = JSON.parse(JSON.stringify(value)); + } else { + state.disabled = true; + state.personTime = false; + state.title = '修改审批标准'; + state.approveBasicForm = JSON.parse(JSON.stringify(value)); + } + }; + + //新增修改提交 + const submitApproveBasic = async () => { + approveBasicFormRef.value.validate(async (valid: Boolean) => { + if (valid) { + if (state.title === '新增审批标准') { + let res = await approveBasicApi().addApproveBasic(state.approveBasicForm); + if (res.data.code === '200') { + ElMessage({ + type: 'success', + message: '审批标准新增成功', + duration: 2000 + }); + state.isShowApproveBasicDialog = false; + context.emit('refreshApproveBasic'); + } else { + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + } else { + let res = await approveBasicApi().modApproveBasic(state.approveBasicForm); + if (res.data.code === '200') { + ElMessage({ + type: 'success', + message: '审批标准修改成功', + duration: 2000 + }); + state.isShowApproveBasicDialog = false; + context.emit('refreshApproveBasic'); + } else { + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + } + } else { + ElMessage({ + type: 'warning', + message: '请完善基本信息' + }); + } + }); + }; + + return { + ...toRefs(state), + approveBasicFormRef, + submitApproveBasic, + showApproveBasicDialog + }; + } +}; +</script> + +<style scoped></style> diff --git a/src/views/specialWorkSystem/workFlow/approveBasic/index.vue b/src/views/specialWorkSystem/workFlow/approveBasic/index.vue new file mode 100644 index 0000000..6841635 --- /dev/null +++ b/src/views/specialWorkSystem/workFlow/approveBasic/index.vue @@ -0,0 +1,441 @@ +<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.execClassgroupId" clearable filterable class="input-box" placeholder="执行班组"> + <el-option v-for="item in classGroupList" :key="item.id" :label="item.groupName" :value="item.id"></el-option> + </el-select> + </div> + <div style="padding-bottom: 10px"> + <el-button type="primary" @click="getInspectionTask">查询</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="openApproveBasicDialog('新增', {})">新建</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.approveBasicData" style="width: 100%" height="calc(100% - 100px)" :header-cell-style="{ background: '#fafafa' }"> + <el-table-column property="title" label="标题" /> + <el-table-column property="ruleStandType" label="标准类型"> + <template #default="scope"> + <span> + {{ parseNumber(scope.row.ruleStandType, '标准类型') }} + </span> + </template> + </el-table-column> + <el-table-column property="minVal" label="最低值"> + <template #default="scope"> + <span> + {{ parseNumber(scope.row.minValMatchPattern, '最低值') }} + </span> + <span> + {{scope.row.minVal}} + </span> + </template> + </el-table-column> + <el-table-column property="maxVal" label="最高值"> + <template #default="scope"> + <span> + {{ parseNumber(scope.row.maxValMatchPattern, '最高值') }} + </span> + <span> + {{ scope.row.maxVal }} + </span> + </template> + </el-table-column> + <el-table-column property="info" 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="openApproveBasicDialog('查看', scope.row)">查看</el-button> + <el-button link type="primary" size="small" :icon="Edit" @click="openApproveBasicDialog('修改', scope.row)">修改</el-button> + <el-button link type="danger" size="small" :icon="Delete" @click="deleteApproveBasic(scope.row)">删除</el-button> + </template> + </el-table-column> + </el-table> + <br> + <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> + <approve-basic-dialog ref="approveBasicDialogRef" @refreshApproveBasic="getInspectionTask"></approve-basic-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 { approveBasicApi } from '/@/api/specialWorkSystem/approveBasic'; +import { departmentApi } from '/@/api/systemManage/department'; +import approveBasicDialog from '/@/views/specialWorkSystem/workFlow/approveBasic/components/approveBasicDialog.vue'; +let global: any = { + homeChartOne: null, + homeChartTwo: null, + homeCharThree: null, + dispose: [null, '', undefined] +}; + +interface stateType { + tableData: { + approveBasicData: []; + total: number; + loading: boolean; + params: { + pageIndex: number | null; + pageSize: number | null; + unitName: string | null; + workType: number | null; + createUserId: number | null; + execClassgroupId: number | null; + checkCycle: number | null; + checkCycleUnit: number | null; + }; + }; + ruleStandTypeList: Array<type>; + typeList: Array<type>; + typeTwoList: Array<type>; +} +interface type { + id: number; + name: string; +} +interface classGroup { + id: number; + groupName: string; +} +export default { + name: 'index', + components: { approveBasicDialog }, + setup() { + const approveBasicDialogRef = ref(); + const state = reactive<stateType>({ + tableData: { + approveBasicData: [], + total: 0, + loading: false, + params: { + pageIndex: 1, + pageSize: 10, + unitName: null, + workType: null, + createUserId: null, + execClassgroupId: null, + checkCycle: null, + checkCycleUnit: null + } + }, + ruleStandTypeList: [ + { id: 1, name: '可燃气浓度' }, + { id: 2, name: '氧气浓度' }, + { id: 3, name: '一氧化碳浓度' }, + { id: 4, name: '硫化氢浓度' }, + { id: 5, name: '温度' }, + { id: 6, name: '压力' }, + { id: 7, name: '震动' }, + ], + typeList:[ + { id: 1, name: '大于' }, + { id: 2, name: '等于' }, + { id: 4, name: '大于等于' }, + ], + typeTwoList:[ + { id: 3, name: '小于' }, + { id: 2, name: '等于' }, + { id: 5, name: '小于等于' }, + ], + + }); + + //获取巡检任务数据 + const getInspectionTask = async () => { + let res = await approveBasicApi().getApproveBasicList(state.tableData.params); + if (res.data.code === '200') { + state.tableData.approveBasicData = res.data.data; + state.tableData.total = res.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 deleteApproveBasic = (row: any) => { + ElMessageBox.confirm(`此操作将永久删除该任务:“${row.title}”,是否继续?`, '提示', { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning' + }) + .then(async () => { + let res = await approveBasicApi().deleteApproveBasic({ id: row.id }); + if (res.data.code === '200') { + ElMessage({ + type: 'success', + duration: 2000, + message: '删除成功' + }); + await getInspectionTask(); + } else { + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + }) + .catch(() => {}); + }; + + const openApproveBasicDialog = (type: string, value: {}) => { + approveBasicDialogRef.value.showApproveBasicDialog(type, value); + }; + + const parseNumber = (value: number, type: string) => { + if (type === '标准类型') { + return state.ruleStandTypeList.find((item) => item.id === value)?.name; + } else if (type === '最高值') { + return state.typeTwoList.find((item) => item.id == value)?.name; + } else { + return state.typeList.find((item) => item.id == value)?.name; + } + }; + + // 分页改变 + const onHandleSizeChange = (val: number) => { + state.tableData.params.pageSize = val; + getInspectionTask(); + }; + // 分页改变 + const onHandleCurrentChange = (val: number) => { + state.tableData.params.pageIndex = val; + getInspectionTask(); + }; + + const reset = () => { + state.tableData.params = { + pageIndex: 1, + pageSize: 10, + unitName: null, + workType: null, + createUserId: null, + execClassgroupId: null, + checkCycle: null, + checkCycleUnit: null + }; + }; + + // 页面加载时 + onMounted(() => { + getInspectionTask(); + }); + + return { + View, + Edit, + Delete, + Refresh, + Plus, + reset, + parseNumber, + deleteApproveBasic, + getInspectionTask, + onHandleSizeChange, + onHandleCurrentChange, + approveBasicDialogRef, + openApproveBasicDialog, + ...toRefs(state) + }; + } +}; +</script> + +<style scoped lang="scss"> +$homeNavLengh: 8; +.home-container { + height: calc(100vh - 114px); + 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