违规记录

This commit is contained in:
Teo
2025-07-23 11:47:11 +08:00
parent e7b0b54f01
commit d503e64098
15 changed files with 1114 additions and 146 deletions

View File

@ -0,0 +1,63 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ViolationRecordVO, ViolationRecordForm, ViolationRecordQuery } from '@/api/safety/violationRecord/types';
/**
* 查询违规记录列表
* @param query
* @returns {*}
*/
export const listViolationRecord = (query?: ViolationRecordQuery): AxiosPromise<ViolationRecordVO[]> => {
return request({
url: '/safety/violationRecord/list',
method: 'get',
params: query
});
};
/**
* 查询违规记录详细
* @param id
*/
export const getViolationRecord = (id: string | number): AxiosPromise<ViolationRecordVO> => {
return request({
url: '/safety/violationRecord/' + id,
method: 'get'
});
};
/**
* 新增违规处理人
* @param data
*/
export const addViolationRecord = (data: any) => {
return request({
url: '/safety/violationRecord/handler',
method: 'post',
data: data
});
};
/**
* 修改违规记录
* @param data
*/
export const updateViolationRecord = (data: ViolationRecordForm) => {
return request({
url: '/safety/violationRecord',
method: 'put',
data: data
});
};
/**
* 删除违规记录
* @param id
*/
export const delViolationRecord = (id: string | number | Array<string | number>) => {
return request({
url: '/safety/violationRecord/' + id,
method: 'delete'
});
};

View File

@ -0,0 +1,241 @@
export interface ViolationRecordVO {
/**
* 主键id
*/
id: string | number;
/**
* 项目id
*/
projectId: string | number;
/**
* 违章等级id
*/
levelId: string | number;
/**
* 违章类型
*/
violationType: string;
/**
* 违章时间
*/
violationTime: string;
/**
* 违章处理人id
*/
handlerId: string | number;
/**
* 整改措施
*/
measure: string;
/**
* 整改时间
*/
rectificationTime: string;
/**
* 复查情况
*/
review: string;
/**
* 复查状态1通过 2未通过
*/
reviewType: string;
/**
* 复查时间
*/
reviewTime: string;
/**
* 处理流程类型(0仅通知 1通知整改复查)
*/
processType: string;
/**
* 工单状态1通知 2整改 3复查
*/
status: string;
/**
* 备注
*/
remark: string;
}
export interface ViolationRecordForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 项目id
*/
projectId?: string | number;
/**
* 违章等级id
*/
levelId?: string | number;
/**
* 识别记录id
*/
recognizeId?: string | number;
/**
* 违章类型
*/
violationType?: string;
/**
* 违章时间
*/
violationTime?: string;
/**
* 违章处理人id
*/
handlerId?: string | number;
/**
* 处理期限
*/
disposeDeadline?: string;
/**
* 处理时间
*/
disposeTime?: string;
/**
* 整改措施
*/
measure?: string;
/**
* 整改时间
*/
rectificationTime?: string;
/**
* 复查情况
*/
review?: string;
/**
* 复查状态1通过 2未通过
*/
reviewType?: string;
/**
* 复查时间
*/
reviewTime?: string;
/**
* 处理流程类型(0仅通知 1通知整改复查)
*/
processType?: string;
/**
* 工单状态1通知 2整改 3复查
*/
status?: string;
/**
* 备注
*/
remark?: string;
}
export interface ViolationRecordQuery extends PageQuery {
/**
* 主键id
*/
id?: string | number;
/**
* 项目id
*/
projectId?: string | number;
/**
* 违章类型
*/
violationType?: string;
/**
* 违章时间
*/
violationTime?: string;
/**
* 违章处理人id
*/
handlerId?: string | number;
/**
* 处理期限
*/
disposeDeadline?: string;
/**
* 处理时间
*/
disposeTime?: string;
/**
* 整改措施
*/
measure?: string;
/**
* 整改时间
*/
rectificationTime?: string;
/**
* 复查情况
*/
review?: string;
/**
* 复查状态1通过 2未通过
*/
reviewType?: string;
/**
* 复查时间
*/
reviewTime?: string;
/**
* 处理流程类型(0仅通知 1通知整改复查)
*/
processType?: string;
/**
* 工单状态1通知 2整改 3复查
*/
status?: string;
/**
* 日期范围参数
*/
params?: any;
}

View File

@ -11,6 +11,14 @@ export function listPost(query: { pageNum: number; pageSize: number }): AxiosPro
});
}
// 查询岗位列表
export function listTreeByProject(projectId: string): AxiosPromise<PostVO[]> {
return request({
url: '/system/dept/list/treeByProjectId/' + projectId,
method: 'get'
});
}
// 查询岗位详细
export function getPost(postId: string | number): AxiosPromise<PostVO> {
return request({

View File

@ -25,7 +25,7 @@ export const globalHeaders = () => {
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8';
axios.defaults.headers['clientid'] = import.meta.env.VITE_APP_CLIENT_ID;
// axios.defaults.headers['projectId'] = cache.local.getJSON('selectedProject')?.id || '';
axios.defaults.headers['isEncrypt'] = true;
// 创建 axios 实例
const service = axios.create({
@ -85,6 +85,8 @@ service.interceptors.request.use(
// 生成一个 AES 密钥
const aesKey = generateAesKey();
config.headers[encryptHeader] = encrypt(encryptBase64(aesKey));
console.log(encrypt(encryptBase64(aesKey)));
config.data = typeof config.data === 'object' ? encryptWithAes(JSON.stringify(config.data), aesKey) : encryptWithAes(config.data, aesKey);
}
}

View File

@ -40,7 +40,7 @@
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['project:constructionUser:add']">新增 </el-button>
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['contractor:constructionUser:add']">新增 </el-button>
</el-col>
<el-col :span="1.5">
@ -50,13 +50,15 @@
icon="Delete"
:disabled="multiple"
@click="handleDelete()"
v-hasPermi="['project:constructionUser:remove']"
v-hasPermi="['contractor:constructionUser:remove']"
>
删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['project:constructionUser:export']">导出 </el-button>
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['contractor:constructionUser:export']"
>导出
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="Edit" :disabled="multiple" @click="statusDialog = true">用户状态编辑 </el-button>
@ -78,7 +80,7 @@
<el-button type="success" plain>员工资料 </el-button>
</el-col>
<el-col :span="1.5" v-show="informationStatus">
<el-button type="primary" plain icon="Edit" @click="downloadTemplate" v-hasPermi="['project:constructionUserFile:download']"
<el-button type="primary" plain icon="Edit" @click="downloadTemplate" v-hasPermi="['contractor:constructionUserFile:download']"
>下载资料模板
</el-button>
</el-col>
@ -91,7 +93,7 @@
:limit="1"
:file-size="50"
>
<el-button type="warning" plain icon="Edit" v-hasPermi="['project:constructionUserFile:upload']">导入员工资料 </el-button>
<el-button type="warning" plain icon="Edit" v-hasPermi="['contractor:constructionUserFile:upload']">导入员工资料 </el-button>
</file-upload>
</el-col>
</el-row>
@ -163,20 +165,28 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" min-width="300">
<template #default="scope">
<el-space wrap>
<el-button link type="primary" icon="View" @click="handleShowDrawer(scope.row)" v-hasPermi="['project:constructionUser:query']">
<el-button link type="primary" icon="View" @click="handleShowDrawer(scope.row)" v-hasPermi="['contractor:constructionUser:query']">
详情
</el-button>
<el-button link type="success" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['project:constructionUser:edit']">
<el-button link type="success" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['contractor:constructionUser:edit']">
修改
</el-button>
<el-button link type="warning" icon="Female" @click="handlePlayCard(scope.row)"> 打卡 </el-button>
<el-button link type="danger" icon="Avatar" @click="handleJoinBlacklist(scope.row)" v-hasPermi="['project:constructionBlacklist:add']">
<el-button
link
type="danger"
icon="Avatar"
@click="handleJoinBlacklist(scope.row)"
v-hasPermi="['contractor:constructionBlacklist:add']"
>
黑名单
</el-button>
<!-- <el-button link type="primary" icon="Switch" @click="handleToggle(scope.row)"> 切换人脸 </el-button> -->
<el-button link type="primary" icon="Switch" @click="handleChange(scope.row)"> 人员迁移 </el-button>
<el-button link type="primary" icon="Switch" @click="handleChange(scope.row)" v-hasPermi="['contractor:constructionUser:migration']">
人员迁移
</el-button>
<el-button link type="primary" icon="ChatLineSquare" @click="handleExit(scope.row)"> 入退场记录 </el-button>
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['project:constructionUser:remove']">
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['contractor:constructionUser:remove']">
删除
</el-button>
<el-tooltip content="红点:部分上传,绿点:已上传,无点:未上传" placement="right" effect="dark">
@ -779,6 +789,7 @@ const getContractorList = async () => {
label: contractor.name
}));
loading.value = false;
handleQuery();
};
const handleMonth = async (e: any) => {
@ -838,6 +849,7 @@ const reset = () => {
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
if (contractorOpt.value.length == 1) queryParams.value.contractorId = contractorOpt.value[0].value;
getList();
};
@ -1062,7 +1074,7 @@ const listeningProject = watch(
(nid, oid) => {
queryParams.value.projectId = nid;
form.value.projectId = nid;
getList();
getContractorList();
}
);
@ -1071,7 +1083,6 @@ onUnmounted(() => {
});
onMounted(() => {
getList();
getContractorList();
});
</script>

View File

@ -159,7 +159,7 @@ const currentProject = computed(() => userStore.selectedProject);
const contractorMaterialList = ref<ContractorMaterialVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const contractorMaterialRecordRef=ref(null)
const contractorMaterialRecordRef = ref(null);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
@ -218,6 +218,7 @@ const getSubList = async () => {
projectId: currentProject.value.id
});
contractorList.value = res.rows;
handleQuery();
};
/** 查询分包方物料列表 */
@ -244,6 +245,7 @@ const reset = () => {
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
if (contractorList.value.length == 1) queryParams.value.contractorId = contractorList.value[0].id;
getList();
};
@ -310,7 +312,6 @@ const listeningProject = watch(
queryParams.value.projectId = nid;
form.value.projectId = nid;
getSubList();
getList();
}
);
onUnmounted(() => {
@ -319,12 +320,11 @@ onUnmounted(() => {
const handleView = async (row: ContractorToolVO) => {
// 打开弹框
dialogRecord.visible = true;
dialogRecord.title=row.materialName+"-物料出入库";
dialogRecord.title = row.materialName + '-物料出入库';
await nextTick();
contractorMaterialRecordRef.value.getAll(row);
};
onMounted(() => {
getSubList();
getList();
});
</script>

View File

@ -35,13 +35,23 @@
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['project:contractorTool:add']">新增</el-button>
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['contractor:contractorTool:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['project:contractorTool:edit']">修改</el-button>
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['contractor:contractorTool:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['project:contractorTool:remove']">删除</el-button>
<el-button
type="danger"
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete()"
v-hasPermi="['contractor:contractorTool:remove']"
>删除</el-button
>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -66,10 +76,16 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['project:contractorTool:edit']"></el-button>
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['contractor:contractorTool:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['project:contractorTool:remove']"></el-button>
<el-button
link
type="primary"
icon="Delete"
@click="handleDelete(scope.row)"
v-hasPermi="['contractor:contractorTool:remove']"
></el-button>
</el-tooltip>
<el-tooltip content="出入库" placement="top">
<el-button link type="primary" icon="view" @click="handleView(scope.row)"></el-button>
@ -91,12 +107,7 @@
</el-form-item>
<el-form-item label="工具类型" prop="toolType">
<el-select v-model="form.toolType" placeholder="请选择工具类型">
<el-option
v-for="dict in contractor_tool_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
<el-option v-for="dict in contractor_tool_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="工具型号" prop="toolModel">
@ -127,7 +138,7 @@
<script setup name="ContractorTool" lang="ts">
import { listContractorTool, getContractorTool, delContractorTool, addContractorTool, updateContractorTool } from '@/api/project/contractorTool';
import { ContractorToolVO, ContractorToolQuery, ContractorToolForm } from '@/api/project/contractorTool/types';
import { listContractor, } from '@/api/project/contractor';
import { listContractor } from '@/api/project/contractor';
import { useUserStoreHook } from '@/store/modules/user';
import LevanAutbound from '@/views/project/contractorTool/component/LevanAutbound.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -139,7 +150,7 @@ const { contractor_tool_type } = toRefs<any>(proxy?.useDict('contractor_tool_typ
const contractorToolList = ref<ContractorToolVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const LevanAutboundRef=ref(null)
const LevanAutboundRef = ref(null);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
@ -168,8 +179,8 @@ const initFormData: ContractorToolForm = {
toolModel: undefined,
toolNumber: undefined,
file: undefined,
remark: undefined,
}
remark: undefined
};
const data = reactive<PageData<ContractorToolForm, ContractorToolQuery>>({
form: { ...initFormData },
queryParams: {
@ -181,30 +192,15 @@ const data = reactive<PageData<ContractorToolForm, ContractorToolQuery>>({
toolType: undefined,
toolModel: undefined,
toolNumber: undefined,
params: {
}
params: {}
},
rules: {
contractorId: [
{ required: true, message: "分包方不能为空", trigger: "blur" },
],
toolName: [
{ required: true, message: "工具名称不能为空", trigger: "blur" },
],
toolType: [
{ required: true, message: "工具类型不能为空", trigger: "blur" },
],
toolModel: [
{ required: true, message: "工具数量不能为空", trigger: "blur" },
],
toolNumber: [
{ required: true, message: "分包方不能为空", trigger: "blur" },
],
},
contractorId: [{ required: true, message: '分包方不能为空', trigger: 'blur' }],
toolName: [{ required: true, message: '工具名称不能为空', trigger: 'blur' }],
toolType: [{ required: true, message: '工具类型不能为空', trigger: 'blur' }],
toolModel: [{ required: true, message: '工具数量不能为空', trigger: 'blur' }],
toolNumber: [{ required: true, message: '分包方不能为空', trigger: 'blur' }]
}
});
const { contractor_tool_record_type } = toRefs<any>(proxy?.useDict('contractor_tool_record_type'));
@ -214,9 +210,10 @@ const getSubList = async () => {
const res = await listContractor({
pageNum: 1,
pageSize: 10000,
projectId: currentProject.value.id,
projectId: currentProject.value.id
});
contractorList.value = res.rows;
handleQuery();
};
/** 查询分包方工器具列表 */
@ -226,55 +223,56 @@ const getList = async () => {
contractorToolList.value = res.rows;
total.value = res.total;
loading.value = false;
}
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
}
};
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
contractorToolFormRef.value?.resetFields();
}
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
if (contractorList.value.length == 1) queryParams.value.contractorId = contractorList.value[0].id;
getList();
}
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
}
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: ContractorToolVO[]) => {
ids.value = selection.map(item => item.id);
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
};
/** 新增按钮操作 */
const handleAdd = () => {
reset();
dialog.visible = true;
dialog.title = "添加工器具";
}
dialog.title = '添加工器具';
};
/** 修改按钮操作 */
const handleUpdate = async (row?: ContractorToolVO) => {
reset();
const _id = row?.id || ids.value[0]
const _id = row?.id || ids.value[0];
const res = await getContractorTool(_id);
Object.assign(form.value, res.data);
dialog.visible = true;
dialog.title = "修改工器具";
}
dialog.title = '修改工器具';
};
/** 提交按钮 */
const submitForm = () => {
@ -282,25 +280,25 @@ const submitForm = () => {
if (valid) {
buttonLoading.value = true;
if (form.value.id) {
await updateContractorTool(form.value).finally(() => buttonLoading.value = false);
await updateContractorTool(form.value).finally(() => (buttonLoading.value = false));
} else {
await addContractorTool(form.value).finally(() => buttonLoading.value = false);
await addContractorTool(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess("操作成功");
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
});
}
};
/** 删除按钮操作 */
const handleDelete = async (row?: ContractorToolVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除分包方工器具编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
await proxy?.$modal.confirm('是否确认删除分包方工器具编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delContractorTool(_ids);
proxy?.$modal.msgSuccess("删除成功");
proxy?.$modal.msgSuccess('删除成功');
await getList();
}
};
//监听项目id刷新数据
const listeningProject = watch(
@ -308,8 +306,7 @@ const listeningProject = watch(
(nid, oid) => {
queryParams.value.projectId = nid;
form.value.projectId = nid;
getSubList()
getList();
getSubList();
}
);
onUnmounted(() => {
@ -318,12 +315,11 @@ onUnmounted(() => {
const handleView = async (row: ContractorToolVO) => {
// 打开弹框
dialogLevan.visible = true;
dialogLevan.title=row.toolName+"-工器具出入库";
dialogLevan.title = row.toolName + '-工器具出入库';
await nextTick();
LevanAutboundRef.value.getAll(row);
};
onMounted(() => {
getSubList();
getList();
});
</script>

View File

@ -40,7 +40,7 @@
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['project:constructionUser:add']">新增 </el-button>
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['contractor:constructionUser:add']">新增 </el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -49,13 +49,15 @@
icon="Delete"
:disabled="multiple"
@click="handleDelete()"
v-hasPermi="['project:constructionUser:remove']"
v-hasPermi="['contractor:constructionUser:remove']"
>
删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['project:constructionUser:export']">导出 </el-button>
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['contractor:constructionUser:export']"
>导出
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="Edit" :disabled="multiple" @click="statusDialog = true">用户状态编辑 </el-button>
@ -77,7 +79,9 @@
<el-button type="success" plain>员工资料 </el-button>
</el-col>
<el-col :span="1.5" v-show="informationStatus">
<el-button type="primary" plain icon="Edit" @click="downloadTemplate"v-hasPermi="['project:constructionUserFile:download']">下载资料模板 </el-button>
<el-button type="primary" plain icon="Edit" @click="downloadTemplate" v-hasPermi="['contractor:constructionUserFile:download']"
>下载资料模板
</el-button>
</el-col>
<el-col :span="1.5" v-show="informationStatus">
<file-upload
@ -88,7 +92,7 @@
:limit="1"
:file-size="50"
>
<el-button type="warning" plain icon="Edit"v-hasPermi="['project:constructionUserFile:upload']">导入员工资料 </el-button>
<el-button type="warning" plain icon="Edit" v-hasPermi="['contractor:constructionUserFile:upload']">导入员工资料 </el-button>
</file-upload>
</el-col>
</el-row>
@ -160,20 +164,26 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" min-width="300">
<template #default="scope">
<el-space wrap>
<el-button link type="primary" icon="View" @click="handleShowDrawer(scope.row)" v-hasPermi="['project:constructionUser:query']">
<el-button link type="primary" icon="View" @click="handleShowDrawer(scope.row)" v-hasPermi="['contractor:constructionUser:query']">
详情
</el-button>
<el-button link type="success" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['project:constructionUser:edit']">
<el-button link type="success" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['contractor:constructionUser:edit']">
修改
</el-button>
<el-button link type="warning" icon="Female" @click="handlePlayCard(scope.row)"> 打卡 </el-button>
<el-button link type="danger" icon="Avatar" @click="handleJoinBlacklist(scope.row)" v-hasPermi="['project:constructionBlacklist:add']">
<el-button
link
type="danger"
icon="Avatar"
@click="handleJoinBlacklist(scope.row)"
v-hasPermi="['contractor:constructionBlacklist:add']"
>
黑名单
</el-button>
<!-- <el-button link type="primary" icon="Switch" @click="handleToggle(scope.row)"> 切换人脸 </el-button> -->
<el-button link type="primary" icon="Switch" @click="handleChange(scope.row)"> 人员迁移 </el-button>
<el-button link type="primary" icon="ChatLineSquare" @click="handleExit(scope.row)"> 入退场记录 </el-button>
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['project:constructionUser:remove']">
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['contractor:constructionUser:remove']">
删除
</el-button>
<el-tooltip content="红点:部分上传,绿点:已上传,无点:未上传" placement="right" effect="dark">
@ -775,6 +785,7 @@ const getContractorList = async () => {
label: contractor.name
}));
loading.value = false;
handleQuery();
};
const handleMonth = async (e: any) => {
@ -834,6 +845,7 @@ const reset = () => {
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
if (contractorOpt.value.length == 1) queryParams.value.contractorId = contractorOpt.value[0].value;
getList();
};
@ -1058,7 +1070,7 @@ const listeningProject = watch(
(nid, oid) => {
queryParams.value.projectId = nid;
form.value.projectId = nid;
getList();
getContractorList();
}
);
@ -1067,7 +1079,6 @@ onUnmounted(() => {
});
onMounted(() => {
getList();
getContractorList();
});
</script>

View File

@ -33,15 +33,15 @@
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['project:subcontract:add']">新增</el-button>
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['contractor:subcontract:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['project:subcontract:edit']"
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['contractor:subcontract:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['project:subcontract:remove']"
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['contractor:subcontract:remove']"
>删除</el-button
>
</el-col>
@ -69,10 +69,16 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['project:subcontract:edit']"></el-button>
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['contractor:subcontract:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['project:subcontract:remove']"></el-button>
<el-button
link
type="primary"
icon="Delete"
@click="handleDelete(scope.row)"
v-hasPermi="['contractor:subcontract:remove']"
></el-button>
</el-tooltip>
</template>
</el-table-column>
@ -88,7 +94,7 @@
</el-select>
</el-form-item>
<el-form-item label="合同文件" prop="contractFileId">
<file-upload fileSize="" :fileType="['doc', 'xls', 'ppt', 'txt', 'pdf', 'png', 'jpg', 'jpeg']" v-model="form.contractFileId" />
<file-upload :fileType="['doc', 'xls', 'ppt', 'txt', 'pdf', 'png', 'jpg', 'jpeg']" v-model="form.contractFileId" />
</el-form-item>
<el-form-item label="合同名称" prop="contractName">
<el-input v-model="form.contractName" placeholder="请输入合同名称" />
@ -105,8 +111,7 @@
<el-input v-model="form.contractAmount" type="number" placeholder="请输入合同金额" />
</el-form-item>
<el-form-item label="合同日期" prop="contractTime">
<el-date-picker clearable v-model="form.contractTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择合同日期">
</el-date-picker>
<el-date-picker clearable v-model="form.contractTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择合同日期"> </el-date-picker>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
@ -125,7 +130,7 @@
<script setup name="Subcontract" lang="ts">
import { listSubcontract, getSubcontract, delSubcontract, addSubcontract, updateSubcontract } from '@/api/project/subcontract';
import { SubcontractVO, SubcontractQuery, SubcontractForm } from '@/api/project/subcontract/types';
import { listContractor, } from '@/api/project/contractor';
import { listContractor } from '@/api/project/contractor';
import { useUserStoreHook } from '@/store/modules/user';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -181,7 +186,7 @@ const data = reactive<PageData<SubcontractForm, SubcontractQuery>>({
contractNumber: [{ required: true, message: '合同编号不能为空', trigger: 'change' }],
contractName: [{ required: true, message: '合同名称不能为空', trigger: 'change' }],
contractAmount: [{ required: true, message: '合同金额不能为空', trigger: 'change' }],
contractTime: [{ required: true, message: '合同时间不能为空', trigger: 'change' }],
contractTime: [{ required: true, message: '合同时间不能为空', trigger: 'change' }]
}
});
@ -200,9 +205,11 @@ const getSubList = async () => {
const res = await listContractor({
pageNum: 1,
pageSize: 10000,
projectId: currentProject.value.id,
projectId: currentProject.value.id
});
contractorList.value = res.rows;
handleQuery();
};
/** 取消按钮 */
@ -220,6 +227,7 @@ const reset = () => {
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
if (contractorList.value.length == 1) queryParams.value.contractorId = contractorList.value[0].id;
getList();
};
@ -285,7 +293,7 @@ const listeningProject = watch(
(nid, oid) => {
queryParams.value.projectId = nid;
form.value.projectId = nid;
getList();
getSubList();
}
);
@ -294,6 +302,5 @@ onUnmounted(() => {
});
onMounted(() => {
getSubList();
getList();
});
</script>

View File

@ -23,10 +23,30 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" :offset="0" prop="dept">
<el-form-item label="部门">
<el-cascader
:options="postListAll"
v-model="formData.dept"
clearable
filterable
:show-all-levels="false"
placeholder="请选择部门"
:props="{ expandTrigger: 'hover', checkStrictly: true, value: 'id', emitPath: false, multiple: true }"
@change="changeDept"
>
</el-cascader>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="岗位" prop="postIdList">
<el-select v-model="formData.postIdList" placeholder="请选择岗位" multiple>
<el-option v-for="dict in postListAll" :key="dict.postId" :label="dict.postName" :value="dict.postId" />
<el-select v-model="formData.postIdList" placeholder="请选择岗位" multiple :disabled="!formData.dept">
<el-option
v-for="dict in formData.postWorkList"
:key="dict.postId"
:label="dict.deptName + '/' + dict.postName"
:value="dict.postId"
/>
</el-select>
</el-form-item>
</el-col>
@ -60,7 +80,7 @@ const userStore = useUserStoreHook();
const currentProject = computed(() => userStore.selectedProject);
// Props
defineProps<{
const props = defineProps<{
tourTypeOptions: any[];
risxList: any[];
postListAll: any[];
@ -78,6 +98,7 @@ const loading = ref(false);
const formData = reactive({
id: undefined,
violationLevel: undefined,
dept: undefined,
color: undefined,
violationType: undefined as any,
wxOrPc: undefined,
@ -88,6 +109,7 @@ const formData = reactive({
deletedAt: undefined,
projectId: currentProject.value?.id,
riskType: '',
postWorkList: [] as any[],
postIdList: [] as any[]
});
@ -127,6 +149,7 @@ const resetForm = () => {
violationLevel: undefined,
color: undefined,
violationType: undefined,
dept: undefined,
wxOrPc: undefined,
createBy: undefined,
updateBy: undefined,
@ -135,6 +158,7 @@ const resetForm = () => {
deletedAt: undefined,
projectId: currentProject.value?.id,
riskType: '',
postWorkList: [] as any[],
postIdList: []
});
};
@ -165,6 +189,32 @@ const onSubmit = () => {
});
};
const changeDept = (val: any) => {
formData.postWorkList = getPostVoListByIds(props.postListAll, val);
formData.postIdList = [];
console.log(formData.postWorkList, val);
};
function getPostVoListByIds(tree: any[], idList: (string | number)[]): any[] {
const idSet = new Set(idList.map(String)); // 用于快速匹配 ID统一为字符串比较
const result: any[] = [];
function dfs(nodes: any[]) {
for (const node of nodes) {
if (idSet.has(String(node.id))) {
result.push(...(node.postVoList || []));
}
if (node.children && node.children.length > 0) {
dfs(node.children);
}
}
}
dfs(tree);
return result;
}
defineExpose({
openDialog,
closeDialog

View File

@ -25,10 +25,30 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" :offset="0" prop="dept">
<el-form-item label="部门">
<el-cascader
:options="postListAll"
v-model="formData.dept"
clearable
filterable
:show-all-levels="false"
placeholder="请选择部门"
:props="{ expandTrigger: 'hover', checkStrictly: true, value: 'id', emitPath: false, multiple: true }"
@change="changeDept"
>
</el-cascader>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="岗位" prop="postIdList">
<el-select v-model="formData.postIdList" placeholder="请选择岗位" multiple>
<el-option v-for="dict in postListAll" :key="dict.postId" :label="dict.postName" :value="dict.postId" />
<el-select v-model="formData.postIdList" placeholder="请选择岗位" multiple :disabled="!formData.dept">
<el-option
v-for="dict in formData.postWorkList"
:key="dict.postId"
:label="dict.deptName + '/' + dict.postName"
:value="dict.postId"
/>
</el-select>
</el-form-item>
</el-col>
@ -57,7 +77,7 @@ import { ElMessage, ElLoading } from 'element-plus';
import { getViolationLevel, addViolationLevel, updateViolationLevel } from '@/api/safety/violationLevel';
import { ViolationLevelForm, ViolationLevelVO } from '@/api/safety/violationLevel/types';
defineProps<{
const props = defineProps<{
tourTypeOptions: any[];
risxList: any[];
postListAll: any[];
@ -75,11 +95,16 @@ const formData = reactive<
risx?: string[] | string;
tourType?: string[] | string;
postIdList: number[];
dept: any;
postWorkList: any[];
}
>({
id: undefined,
violationLevel: undefined,
color: undefined,
dept: undefined,
postWorkList: [] as any[],
riskType: undefined,
createBy: undefined,
updateBy: undefined,
@ -115,6 +140,8 @@ const openDialog = (row?: ViolationLevelVO) => {
const data = res.data;
data.postIdList = (data.postList || []).map((item: any) => item.postId);
data.violationType = data.violationType ? (data.violationType as string).split(',') : [];
formData.dept = (data.postList || []).map((item: any) => item.deptId);
formData.postWorkList = getPostVoListByIds(props.postListAll, formData.dept);
Object.assign(formData, data);
});
});
@ -174,11 +201,41 @@ const resetForm = () => {
createdAt: undefined,
updatedAt: undefined,
deletedAt: undefined,
dept: undefined,
postWorkList: [],
postIdList: [],
risx: '',
posts: []
});
};
const changeDept = (val: any) => {
formData.postWorkList = getPostVoListByIds(props.postListAll, val);
formData.postIdList = [];
console.log(formData.postWorkList, val);
};
function getPostVoListByIds(tree: any[], idList: (string | number)[]): any[] {
const idSet = new Set(idList.map(String)); // 用于快速匹配 ID统一为字符串比较
const result: any[] = [];
function dfs(nodes: any[]) {
for (const node of nodes) {
if (idSet.has(String(node.id))) {
result.push(...(node.postVoList || []));
}
if (node.children && node.children.length > 0) {
dfs(node.children);
}
}
}
dfs(tree);
return result;
}
defineExpose({
openDialog,
closeDialog

View File

@ -106,7 +106,7 @@ import { ViolationLevelForm, ViolationLevelVO } from '@/api/safety/violationLeve
import apiV1SystemBusViolationLevelAdd from '@/views/safety/violationLevel/component/add.vue';
import apiV1SystemBusViolationLevelEdit from '@/views/safety/violationLevel/component/edit.vue';
import { useUserStoreHook } from '@/store/modules/user';
import { listPost, optionselect } from '@/api/system/post';
import { listPost, listTreeByProject, optionselect } from '@/api/system/post';
// 获取用户 store
const userStore = useUserStoreHook();
// 从 store 中获取项目列表和当前选中的项目
@ -145,8 +145,9 @@ const state = reactive<any>({
});
const postList = () => {
listPost({ pageNum: 1, pageSize: 100 }).then((res) => {
state.postListAll = res.rows ?? [];
listTreeByProject(currentProject.value?.id).then((res) => {
console.log('🚀 ~ listTreeByProject ~ res:', res);
state.postListAll = res.data ?? [];
});
};
@ -157,8 +158,6 @@ const initTableData = () => {
const resetQuery = (formEl?: FormInstance) => {
if (!formEl) return;
formEl.resetFields();
console.log(useUserStoreHook().selectedProject, currentProject.value?.id);
busViolationLevelList();
};

View File

@ -0,0 +1,214 @@
<template>
<!-- <el-card v-loading="loading" body-class="printMe"> -->
<div class="w75% m-a">
<div id="printMe" class="pos-relative">
<div class="resultIcon"><img :src="'../../../../../src/assets/icons/svg/' + inspectionType + '.png'" alt="" /></div>
<!-- <h2 style="text-align: center; margin-top: 5px; font-weight: bold">安全生产监督检查通知书</h2> -->
<el-row>
<el-col :span="12" style="text-align: left">填报人{{ safetyInspectionDetail?.createByName }}</el-col>
<el-col :span="12" style="text-align: right">填报时间{{ safetyInspectionDetail?.createTime }}</el-col>
</el-row>
<el-descriptions :column="2" border style="margin-top: 8px" label-width="160px" size="large">
<el-descriptions-item label-align="center" label="检查项目" :span="2" class-name="zebra">{{ currentProject?.name }} </el-descriptions-item>
<el-descriptions-item label-align="center" label="违章类型" label-class-name="white" width="300px">
<dict-tag :options="violation_level_type" :value="safetyInspectionDetail?.violationType" />
</el-descriptions-item>
<el-descriptions-item label-align="center" label="违章等级" label-class-name="white">
<div class="flex">
{{ safetyInspectionDetail?.levelVo.violationLevel }}<dict-tag
:options="risk_level_type"
:value="safetyInspectionDetail?.levelVo.riskType"
/>
</div>
</el-descriptions-item>
<el-descriptions-item label-align="center" label="检查时间" class-name="zebra"
>{{ safetyInspectionDetail?.violationTime }}
</el-descriptions-item>
<el-descriptions-item label-align="center" label="检查人" class-name="zebra"
>{{ safetyInspectionDetail?.createByName }}
</el-descriptions-item>
<el-descriptions-item label-align="center" label="整改人" label-class-name="white"
>{{ safetyInspectionDetail?.handlerName }}
</el-descriptions-item>
<el-descriptions-item label-align="center" label="要求整改期限" label-class-name="white">
{{ safetyInspectionDetail?.disposeDeadline ? dayjs(safetyInspectionDetail?.disposeDeadline).format('YYYY - MM - DD ') : '' }}
</el-descriptions-item>
</el-descriptions>
<el-descriptions border direction="vertical" size="large">
<el-descriptions-item label-align="center" label="巡检结果" class-name="none"></el-descriptions-item>
</el-descriptions>
<el-descriptions :column="2" border label-width="160px" size="large">
<el-descriptions-item label-align="center" label="内容" :span="2" label-class-name="white"
>{{ safetyInspectionDetail?.recognizeVo.description }}
</el-descriptions-item>
<el-descriptions-item label-align="center" label="检查附件" :span="2" label-class-name="white">
<el-space wrap>
<!-- <div v-for="item in checkFileList" :key="item.ossId">
<span v-if="['.png', '.jpg', '.jpeg'].includes(item.fileSuffix)">
<image-preview :src="item.url" width="200px" />
</span>
<span v-else>
<el-link :href="`${item.url}`" type="primary" :underline="false" target="_blank">
<span> {{ item.originalName }} </span>
</el-link>
</span>
</div> -->
<span>
<image-preview :src="safetyInspectionDetail?.recognizeVo.picture" width="200px" />
</span>
</el-space>
</el-descriptions-item>
<el-descriptions-item label-align="center" label="检查状态" :span="2" label-class-name="white">
<el-steps style="max-width: 200px" :active="Number(safetyInspectionDetail?.status)" finish-status="finish">
<el-step v-for="item in safety_inspection_type" :key="item.value" :title="item.label" />
</el-steps>
</el-descriptions-item>
</el-descriptions>
</div>
</div>
<!-- </el-card> -->
<!-- <div class="dialog-footer">
<div class="btn-item" @click="handleExport">
<img src="../../../../assets/icons/svg/derived.png" />
<span>导出</span>
</div>
<div class="btn-item" v-print="'#printMe'">
<img src="../../../../assets/icons/svg/print.png" />
<span>打印</span>
</div>
</div> -->
</template>
<script setup lang="ts">
import { useUserStoreHook } from '@/store/modules/user';
import { downLoadOss, listByIds } from '@/api/system/oss';
import { OssVO } from '@/api/system/oss/types';
import { dayjs } from 'element-plus';
import { getViolationRecord } from '@/api/safety/violationRecord';
import { ViolationRecordVO } from '@/api/safety/violationRecord/types';
interface Props {
violationRecordId?: string | number;
}
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { violation_level_type, safety_inspection_type, risk_level_type } = toRefs<any>(
proxy?.useDict('violation_level_type', 'review_type', 'reply_type', 'safety_inspection_type', 'risk_level_type')
);
// 获取用户 store
const userStore = useUserStoreHook();
// 从 store 中获取项目列表和当前选中的项目
const currentProject = computed(() => userStore.selectedProject);
const props = defineProps<Props>();
const loading = ref<boolean>(false);
const safetyInspectionDetail = ref<any>();
const checkFileList = ref<OssVO[]>();
const rectificationFileList = ref<OssVO[]>();
//检查状态图片
const inspectionType = computed(() => {
let imgName = 'successLogo';
if (safetyInspectionDetail.value?.status == '2') imgName = 'rectification';
if (safetyInspectionDetail.value?.reviewType == '1') imgName = 'successful';
if (safetyInspectionDetail.value?.reviewType == '2') imgName = 'failure';
console.log('🚀 ~ inspectionType ~ imgName:', imgName);
return imgName;
});
const get = async () => {
loading.value = true;
const res = await getViolationRecord(props.violationRecordId);
if (res.data && res.code === 200) {
safetyInspectionDetail.value = res.data;
if (res.data.checkFile) {
const checkFileRes = await listByIds(res.data.checkFile.split(','));
checkFileList.value = checkFileRes.data;
}
if (res.data.rectificationFile) {
const rectificationFileRes = await listByIds(res.data.rectificationFile.split(','));
rectificationFileList.value = rectificationFileRes.data;
}
}
loading.value = false;
};
const handleExport = async () => {
await downLoadOss({ id: safetyInspectionDetail.value.id }, '/safety/safetyInspection/export/word', '安全生产监督检查通知书.zip');
};
onMounted(() => {
console.log('🚀 ~ onMounted ~ props.safetyInspectionId:', props.violationRecordId);
get();
});
watch(
() => props.violationRecordId,
(newId, oldId) => {
if (newId !== oldId) {
checkFileList.value = undefined;
rectificationFileList.value = undefined;
get();
}
}
);
</script>
<style scoped lang="scss">
#printMe {
padding: 15px 20px 20px 20px !important;
box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
}
:deep(.white) {
background: #fff !important;
}
:deep(.none) {
display: none !important;
}
:deep(.zebra) {
background: #f5f7fa;
}
@page {
size: auto;
margin: 0mm;
}
.dialog-footer {
height: 200px;
display: flex;
flex-direction: column;
justify-content: space-between;
position: absolute;
top: 14%;
right: 6%;
background: #fff;
box-shadow: 0 0 10px #ddd;
text-align: center;
padding: 20px 10px;
.btn-item {
display: flex;
flex-direction: column;
justify-content: center;
cursor: pointer;
}
}
.resultIcon {
position: absolute;
top: 100px;
right: 50px;
z-index: 10;
width: 105px;
height: 105px;
img {
width: 105px;
}
}
</style>

View File

@ -0,0 +1,307 @@
<template>
<div class="p-2">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="工单号" prop="id">
<el-input v-model="queryParams.id" placeholder="请输入工单号" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="违章时间" prop="violationTime">
<el-date-picker clearable v-model="queryParams.violationTime" type="date" value-format="YYYY-MM-DD" placeholder="请选择违章时间" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['safety:violationRecord:remove']"
>删除</el-button
>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="violationRecordList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="工单号" align="center" prop="id" v-if="true" />
<el-table-column label="违章等级" align="center" prop="levelVo" width="180">
<template #default="scope">
<div class="flex justify-center">
{{ scope.row.levelVo.violationLevel }}<dict-tag :options="risk_level_type" :value="scope.row.levelVo.riskType" />
</div>
</template>
</el-table-column>
<el-table-column label="违章类型" align="center" prop="violationType">
<template #default="scope">
<dict-tag :options="violation_level_type" :value="scope.row.violationType" />
</template>
</el-table-column>
<el-table-column label="违章时间" align="center" prop="violationTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.violationTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="处理人" align="center" prop="handlerName" />
<el-table-column label="整改措施" align="center" prop="measure" />
<el-table-column label="整改时间" align="center" prop="rectificationTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.rectificationTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="复查情况" align="center" prop="review" />
<el-table-column label="复查状态" align="center" prop="reviewType">
<template #default="scope">
{{ scope.row.reviewType ? (scope.row.reviewType == 1 ? '已通过' : '未通过') : '' }}
</template>
</el-table-column>
<el-table-column label="复查时间" align="center" prop="reviewTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.reviewTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="处理流程类型(0仅通知 1通知整改复查)" align="center" prop="processType" /> -->
<el-table-column label="工单状态" align="center" prop="status">
<template #default="scope">
<dict-tag :options="safety_inspection_type" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="详情" placement="top">
<el-button
link
type="primary"
icon="View"
@click="handleShowDialog(scope.row)"
v-hasPermi="['safety:violationRecord:view']"
></el-button>
</el-tooltip>
<el-tooltip content="违章处理人" placement="top">
<el-button link type="primary" icon="User" @click="handleUpdate(scope.row)" v-hasPermi="['safety:violationRecord:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['safety:violationRecord:remove']"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
<!-- 添加或修改违规记录对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
<el-form ref="violationRecordFormRef" :model="form" :rules="rules" label-width="90px">
<el-form-item label="违章处理人" prop="handlerId">
<el-input v-model="form.handlerId" placeholder="请输入违章处理人" />
</el-form-item>
<el-form-item label="处理期限" prop="disposeDeadline">
<el-date-picker clearable v-model="form.disposeDeadline" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择处理期限">
</el-date-picker>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
<el-dialog title="违规记录详情" v-model="showDetailDialog" width="60vw">
<ViolationRecordDetailDialog :violation-record-id="currentViolationRecordId" />
</el-dialog>
</div>
</template>
<script setup name="ViolationRecord" lang="ts">
import { listViolationRecord, getViolationRecord, delViolationRecord, addViolationRecord, updateViolationRecord } from '@/api/safety/violationRecord';
import { ViolationRecordVO, ViolationRecordQuery, ViolationRecordForm } from '@/api/safety/violationRecord/types';
import ViolationRecordDetailDialog from './component/violationRecordDetailDialog.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { violation_level_type, risk_level_type, safety_inspection_type } = toRefs<any>(
proxy?.useDict('violation_level_type', 'risk_level_type', 'safety_inspection_type')
);
const violationRecordList = ref<ViolationRecordVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const currentViolationRecordId = ref<string | number>(undefined);
const showDetailDialog = ref(false);
const queryFormRef = ref<ElFormInstance>();
const violationRecordFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const initFormData: ViolationRecordForm = {
id: undefined,
projectId: undefined,
levelId: undefined,
recognizeId: undefined,
violationType: undefined,
violationTime: undefined,
handlerId: undefined,
disposeDeadline: undefined,
disposeTime: undefined,
measure: undefined,
rectificationTime: undefined,
review: undefined,
reviewType: undefined,
reviewTime: undefined,
processType: undefined,
status: undefined,
remark: undefined
};
const data = reactive<PageData<ViolationRecordForm, ViolationRecordQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
id: undefined,
projectId: undefined,
violationType: undefined,
violationTime: undefined,
handlerId: undefined,
disposeDeadline: undefined,
disposeTime: undefined,
measure: undefined,
rectificationTime: undefined,
review: undefined,
reviewType: undefined,
reviewTime: undefined,
processType: undefined,
status: undefined,
params: {}
},
rules: {
id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }],
projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }],
levelId: [{ required: true, message: '违章等级id不能为空', trigger: 'blur' }],
recognizeId: [{ required: true, message: '识别记录id不能为空', trigger: 'blur' }],
processType: [{ required: true, message: '处理流程类型(0仅通知 1通知整改复查)不能为空', trigger: 'change' }],
status: [{ required: true, message: '工单状态不能为空', trigger: 'change' }]
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询违规记录列表 */
const getList = async () => {
loading.value = true;
const res = await listViolationRecord(queryParams.value);
violationRecordList.value = res.rows;
total.value = res.total;
loading.value = false;
};
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
};
/** 表单重置 */
const reset = () => {
form.value = { ...initFormData };
violationRecordFormRef.value?.resetFields();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
/** 多选框选中数据 */
const handleSelectionChange = (selection: ViolationRecordVO[]) => {
ids.value = selection.map((item) => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
};
/** 新增按钮操作 */
const handleAdd = () => {
reset();
dialog.visible = true;
dialog.title = '添加违规记录';
};
/** 修改按钮操作 */
const handleUpdate = async (row?: ViolationRecordVO) => {
reset();
form.value.id = row.id;
dialog.visible = true;
dialog.title = '选择违章处理人';
};
const handleShowDialog = (row?: ViolationRecordVO) => {
currentViolationRecordId.value = row.id;
showDetailDialog.value = true;
};
/** 提交按钮 */
const submitForm = () => {
violationRecordFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
await addViolationRecord(form.value).finally(() => (buttonLoading.value = false));
proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: ViolationRecordVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除违规记录编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delViolationRecord(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
'safety/violationRecord/export',
{
...queryParams.value
},
`violationRecord_${new Date().getTime()}.xlsx`
);
};
onMounted(() => {
getList();
});
</script>

View File

@ -29,18 +29,20 @@ export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => {
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')
},"/warm-flow-ui": {
target: 'http://192.168.110.119:8899',
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')
},"/warm-flow": {
},
'/warm-flow-ui': {
target: 'http://192.168.110.119:8899',
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')
},
"/workflow": {
'/warm-flow': {
target: 'http://192.168.110.119:8899',
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')
},
'/workflow': {
target: 'http://192.168.110.119:8899',
changeOrigin: true,
ws: true,