From df39b348c7743e3275aca6053a46c2d63efc5bfb Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期五, 24 三月 2023 10:30:25 +0800
Subject: [PATCH] 修改部门管理
---
src/views/intellectInspect/inspectIndex/index.vue | 78 ++++++++++++++-
src/views/system/department/component/deptDialog.vue | 98 +++++++++++++------
src/api/intellectInspectSystem/inspectIndex/index.ts | 9 +
src/views/intellectInspect/inspectIndex/components/fullScreen.vue | 60 +++++++++++
src/views/system/department/index.vue | 8 +
src/views/intellectInspect/inspectRecordManage/inspectRecord/index.vue | 8 -
6 files changed, 211 insertions(+), 50 deletions(-)
diff --git a/src/api/intellectInspectSystem/inspectIndex/index.ts b/src/api/intellectInspectSystem/inspectIndex/index.ts
index e5eee90..7110a1d 100644
--- a/src/api/intellectInspectSystem/inspectIndex/index.ts
+++ b/src/api/intellectInspectSystem/inspectIndex/index.ts
@@ -3,6 +3,15 @@
export function inspectIndexApi() {
return {
//
+ getCountExcepOrder: (data: object) => {
+ return request({
+ url: import.meta.env.VITE_API_URL + `/SafeCheckSmartScreen/select/countExcepOrderByLineChart`,
+ method: 'post',
+ data: data
+ });
+ },
+
+ //
getListExcepOrderByPage: (data: object) => {
return request({
url: import.meta.env.VITE_API_URL + `/SafeCheck/abnormalWorkOrder/select/listExcepOrderByPage`,
diff --git a/src/views/intellectInspect/inspectIndex/components/fullScreen.vue b/src/views/intellectInspect/inspectIndex/components/fullScreen.vue
index a0fb74f..bcb65de 100644
--- a/src/views/intellectInspect/inspectIndex/components/fullScreen.vue
+++ b/src/views/intellectInspect/inspectIndex/components/fullScreen.vue
@@ -14,6 +14,24 @@
<dv-border-box10 class="item-bg" :color="['rgba(8, 109, 209, 0.2)']"></dv-border-box10>
<div class="chart-tit">
<span class="tit">年度巡检异常趋势</span>
+ <div class="filter-part">
+ <el-select v-model="depId1" size="small" :teleported="false">
+ <el-option
+ v-for="item in depList1"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id"
+ />
+ </el-select>
+ <el-select v-model="depId2" size="small" :teleported="false">
+ <el-option
+ v-for="item in depList2"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id"
+ />
+ </el-select>
+ </div>
</div>
<div class="chart" :id="xjLine"></div>
</div>
@@ -21,7 +39,7 @@
<dv-border-box10 class="item-bg"></dv-border-box10>
<div class="chart-tit">
<span class="tit">异常区域设备统计</span>
- <div class="filter-part">
+ <div class="filter-part2">
<el-switch
v-model="chartStatus"
inline-prompt
@@ -224,6 +242,7 @@
workTypeList: Array<type>;
departmentList: [];
timeType: Array<type>;
+ depList1: Array<type>;
classGroupList: Array<classGroup>;
quotaList: [];
inspectPointAllList: [];
@@ -232,7 +251,9 @@
dialogVisible:boolean;
workNum: string;
beImgs: [];
- afImgs: []
+ afImgs: [];
+ depId1:number|null
+ depId2:number|null
}
interface type {
id: number;
@@ -276,6 +297,26 @@
{ id: 4, name: '月' },
{ id: 5, name: '年' }
],
+ depList1: [
+ {
+ name: '电石事业部',
+ id: 49
+ },
+ {
+ name: '电力事业部',
+ id: 50
+ },
+ {
+ name: '有机化工事业部',
+ id: 48
+ },
+ {
+ name: '甲醇事业部',
+ id: 32
+ }
+ ],
+ depId1: null,
+ depId2: null,
classGroupList: [],
quotaList: [],
inspectPointAllList: [],
@@ -816,6 +857,21 @@
display: flex;
align-items: center;
justify-content: right;
+ .el-select{
+ width: 50% !important;
+ margin-left: 10px;
+ }
+ .el-switch{
+ width: 100% !important;
+ :deep(.el-switch__core){
+ width: 100% !important;
+ }
+ }
+ }
+ .filter-part2{
+ display: flex;
+ align-items: center;
+ justify-content: right;
width: 20%;
.el-switch{
width: 100% !important;
diff --git a/src/views/intellectInspect/inspectIndex/index.vue b/src/views/intellectInspect/inspectIndex/index.vue
index ce2d582..9b0c8fb 100644
--- a/src/views/intellectInspect/inspectIndex/index.vue
+++ b/src/views/intellectInspect/inspectIndex/index.vue
@@ -13,13 +13,16 @@
<div class="chart-item">
<div class="chart-tit">
<span class="tit">年度巡检异常趋势</span>
+ <div class="filter-part">
+ <el-cascader v-model="searchDepId" :options="depList" :props="casProps" :show-all-levels="false" size="small"/>
+ </div>
</div>
<div class="chart" :id="xjLine"></div>
</div>
<div class="chart-item">
<div class="chart-tit">
<span class="tit">异常区域设备统计</span>
- <div class="filter-part">
+ <div class="filter-part2">
<el-switch
v-model="chartStatus"
inline-prompt
@@ -206,6 +209,7 @@
import { departmentApi } from '/@/api/systemManage/department';
import screenfull from "screenfull";
import { BorderBox10 as DvBorderBox10 } from '@kjgl77/datav-vue3'
+import {specialIndexApi} from "/@/api/specialWorkSystem/specialIndex";
// 定义接口来定义对象的类型
interface stateType {
tableData: Array<string>;
@@ -228,7 +232,10 @@
dialogVisible:boolean;
workNum: string;
beImgs: [];
- afImgs: []
+ afImgs: [];
+ searchDepId: number|null
+ depList: Array<any>
+ casProps:object
}
interface type {
id: number;
@@ -272,6 +279,32 @@
{ id: 4, name: '月' },
{ id: 5, name: '年' }
],
+ searchDepId: null,
+ depList: [
+ {
+ name: '电石事业部',
+ depId: 49
+ },
+ {
+ name: '电力事业部',
+ id: 50
+ },
+ {
+ name: '有机化工事业部',
+ id: 48
+ },
+ {
+ name: '甲醇事业部',
+ id: 32
+ }
+ ],
+ casProps: {
+ expandTrigger: 'hover',
+ emitPath: false,
+ value: 'depId',
+ label: 'depName',
+ checkStrictly: true
+ },
classGroupList: [],
quotaList: [],
inspectPointAllList: [],
@@ -289,10 +322,11 @@
// 页面载入时执行方法
onMounted(() => {
+ getDepartmentData();
+ getCountExcepOrder();
getInspectRecord();
getListExcepOrder();
getDayData();
- getDepartmentData();
initXjLine()
initSbtj()
});
@@ -310,6 +344,17 @@
}
const checkAllList =()=>{
unusualListRef.value.showUnusualList()
+ }
+ const getCountExcepOrder = async ()=>{
+ let res = await inspectIndexApi().getCountExcepOrder({depId: state.searchDepId});
+ if (res.data.code === '200') {
+ console.log('折线图趋势数据>>>', res.data.data)
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: res.data.msg
+ });
+ }
}
const acceptance =(row:object)=>{
ElMessageBox.confirm(
@@ -597,6 +642,14 @@
let res = await departmentApi().getDepartmentList();
if (res.data.code === '200') {
state.departmentList = res.data.data;
+ const newList = []
+ for(let i of state.departmentList[0].children){
+ if(i.depId == 32 || i.depId == 48 ||i.depId == 49 || i.depId == 50){
+ newList.push(i)
+ }
+ }
+ state.depList = newList
+ console.log(state.depList,'3434')
} else {
ElMessage({
type: 'warning',
@@ -743,6 +796,21 @@
display: flex;
align-items: center;
justify-content: right;
+ .el-select{
+ width: 50% !important;
+ margin-left: 10px;
+ }
+ .el-switch{
+ width: 100% !important;
+ :deep(.el-switch__core){
+ width: 100% !important;
+ }
+ }
+ }
+ .filter-part2{
+ display: flex;
+ align-items: center;
+ justify-content: right;
width: 20%;
.el-switch{
width: 100% !important;
@@ -802,10 +870,6 @@
.tit{
font-size: 20px;
font-weight: bolder;
- }
- :deep(.el-switch__core){
- width: 120px;
-
}
.top-info {
display: flex;
diff --git a/src/views/intellectInspect/inspectRecordManage/inspectRecord/index.vue b/src/views/intellectInspect/inspectRecordManage/inspectRecord/index.vue
index 28f223d..0134bf9 100644
--- a/src/views/intellectInspect/inspectRecordManage/inspectRecord/index.vue
+++ b/src/views/intellectInspect/inspectRecordManage/inspectRecord/index.vue
@@ -52,13 +52,7 @@
</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="execClassgroupName" label="巡检班组"/>
<el-table-column property="frequency" label="检查频次">
<template #default="scope">
<span>
diff --git a/src/views/system/department/component/deptDialog.vue b/src/views/system/department/component/deptDialog.vue
index 5ea28a3..cb69709 100644
--- a/src/views/system/department/component/deptDialog.vue
+++ b/src/views/system/department/component/deptDialog.vue
@@ -1,11 +1,11 @@
<template>
<div class="system-add-dept-container">
<el-dialog :title="title" v-model="isShowDialog" width="600px">
- <el-form :model="departmentForm" size="default" label-width="90px">
+ <el-form ref="ruleFormRef" :model="departmentForm" :rules="rules" size="default" label-width="90px">
<el-row :gutter="35">
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
- <el-form-item label="部门等级">
- <el-select v-model="departmentForm.depLevel" placeholder="请输入部门等级" class="input-add" clearable>
+ <el-form-item label="部门等级" prop="depLevel">
+ <el-select v-model="departmentForm.depLevel" placeholder="请选择部门等级" class="input-add" clearable>
<el-option
v-for="item in depLevelList"
:key="item.id"
@@ -16,14 +16,19 @@
</el-form-item>
</el-col>
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
- <el-form-item label="上级部门">
+ <el-form-item label="上级部门" prop="parentDepId">
<el-cascader :options="deptData" class="input-add" :props="{ emitPath: false, checkStrictly: true, value: 'depId', label: 'depName' }" placeholder="请选择部门" clearable v-model="departmentForm.parentDepId"> </el-cascader>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
- <el-form-item label="部门名称">
+ <el-form-item label="部门名称" prop="depName">
<el-input v-model="departmentForm.depName" class="input-add" 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="depCode">
+ <el-input v-model="departmentForm.depCode" class="input-add" 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="部门描述">
@@ -35,7 +40,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="onCancel" size="default">取 消</el-button>
- <el-button type="primary" v-throttle @click="onSubmit" size="default">确 定</el-button>
+ <el-button type="primary" v-throttle @click="onSubmit(ruleFormRef)" size="default">确 定</el-button>
</span>
</template>
</el-dialog>
@@ -44,9 +49,9 @@
<script lang="ts">
import { ElMessage } from 'element-plus';
-import { reactive, toRefs, onMounted, defineComponent } from 'vue';
+import { ref, reactive, toRefs, onMounted, defineComponent } from 'vue';
import { departmentApi } from '/@/api/systemManage/department';
-
+import type { FormInstance, FormRules } from 'element-plus'
// 定义接口来定义对象的类型
interface TableDataRow {
name: string;
@@ -59,12 +64,13 @@
isShowDialog: boolean;
departmentForm: {
depName: string;
+ depCode: string;
depInfo: string;
parentDepId: string;
depLevel:null | number
};
deptData: Array<TableDataRow>;
- depLevelList: Array<Type>;
+ depLevelList: Array<Type>
}
interface Type{
id:number;
@@ -79,6 +85,7 @@
isShowDialog: false,
departmentForm: {
depName: '',
+ depCode: '',
parentDepId: '',
depInfo: '',
depLevel:null,
@@ -90,7 +97,26 @@
{id:3,name:'车间'},
] // 部门数据
});
-
+ const checkCode = (rule: any, value: any, callback: any) => {
+ if (!value) {
+ return callback(new Error('请输入部门编号'))
+ }
+ setTimeout(() => {
+ const regex = /^[a-zA-Z0-9]+$/
+ if (regex.test(value)) {
+ callback()
+ } else {
+ callback(new Error('部门编号只能有英文字母和数字构成'))
+ }
+ }, 1000)
+ }
+ const ruleFormRef = ref<FormInstance>()
+ const rules = reactive<FormRules>({
+ depName: [{ required: true, message: '请填写部门名称', trigger: 'blur' }],
+ parentDepId: [{ required: true, message: '请选择上级部门', trigger: 'blur' }],
+ depLevel: [{ required: true, message: '请选择部门等级', trigger: 'blur' }],
+ depCode: [{ required: true, validator: checkCode, trigger: 'blur' }]
+ });
// 打开弹窗
const openDialog = (type: string, value: any, departmentList: []) => {
state.isShowDialog = true;
@@ -99,6 +125,7 @@
state.title = '新增部门';
state.departmentForm = {
depName: '',
+ depCode: '',
parentDepId: '',
depLevel:null,
depInfo: ''
@@ -117,40 +144,47 @@
closeDialog();
};
// 新增
- const onSubmit = async () => {
- if (state.title === '新增部门') {
- let res = await departmentApi().addDepartment(state.departmentForm);
- if (res.data.code === '200') {
+ const onSubmit = async (formEl: FormInstance | undefined) => {
+ if (!formEl) return
+ await formEl.validate(async (valid, fields) => {
+ if (valid) {
+ if (state.title === '新增部门') {
+ let res = await departmentApi().addDepartment(state.departmentForm);
+ if (res.data.code === '200') {
ElMessage({
- type: 'success',
- message: '部门新增成功',
- duration: 2000
+ type: 'success',
+ message: '部门新增成功',
+ duration: 2000
});
closeDialog();
context.emit('getDepartmentList');
- } else {
+ } else {
ElMessage({
- type: 'warning',
- message: res.data.msg
+ type: 'warning',
+ message: res.data.msg
});
- }
- } else {
- let res = await departmentApi().modDepartment(state.departmentForm);
- if (res.data.code === '200') {
+ }
+ } else {
+ let res = await departmentApi().modDepartment(state.departmentForm);
+ if (res.data.code === '200') {
ElMessage({
- type: 'success',
- message: '部门修改成功',
- duration: 2000
+ type: 'success',
+ message: '部门修改成功',
+ duration: 2000
});
closeDialog();
context.emit('getDepartmentList');
- } else {
+ } else {
ElMessage({
- type: 'warning',
- message: res.data.msg
+ type: 'warning',
+ message: res.data.msg
});
+ }
}
- }
+ } else {
+ console.log('error submit!', fields)
+ }
+ })
};
// 初始化部门数据
const initTableData = () => {};
@@ -159,6 +193,8 @@
initTableData();
});
return {
+ ruleFormRef,
+ rules,
openDialog,
closeDialog,
onCancel,
diff --git a/src/views/system/department/index.vue b/src/views/system/department/index.vue
index 07c711a..6627085 100644
--- a/src/views/system/department/index.vue
+++ b/src/views/system/department/index.vue
@@ -17,8 +17,10 @@
</el-button>
</div>
<el-table :data="tableData.data" style="width: 100%" row-key="depId" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
- <el-table-column prop="depName" label="部门名称" show-overflow-tooltip> </el-table-column>
- <el-table-column prop="depInfo" label="部门描述" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="depName" label="部门名称" show-overflow-tooltip/>
+ <el-table-column prop="depLevelDesc" label="部门等级" show-overflow-tooltip/>
+ <el-table-column prop="depCode" label="部门编号" show-overflow-tooltip/>
+ <el-table-column prop="depInfo" label="部门描述" show-overflow-tooltip/>
<el-table-column label="操作" show-overflow-tooltip width="140">
<template #default="scope">
<el-button size="small" text type="primary" @click="onOpenDeptDialog('新增', '')">新增</el-button>
@@ -87,7 +89,7 @@
};
// 删除当前行
const onTabelRowDel = (row: TableDataRow) => {
- ElMessageBox.confirm(`此操作将永久删除部门:${row.depId}, 是否继续?`, '提示', {
+ ElMessageBox.confirm(`此操作将永久删除部门:${row.depName}, 是否继续?`, '提示', {
confirmButtonText: '删除',
cancelButtonText: '取消',
type: 'warning'
--
Gitblit v1.9.2