init:first commit of plus-ui
This commit is contained in:
@ -0,0 +1,135 @@
|
||||
<template>
|
||||
<div class="system-document-container">
|
||||
<el-card shadow="hover">
|
||||
<div class="system-document-search mb15">
|
||||
<el-form :model="param" ref="queryRef" :inline="true" label-width="100px">
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-button type="success" v-hasPermi="['project:project:remove']" :disabled="multiple" @click="onRecyclingStation(null)"
|
||||
><el-icon><RefreshRight /></el-icon>批量恢复</el-button
|
||||
>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
<el-table v-loading="loading" :data="tableData" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" align="center" type="index" min-width="30px" />
|
||||
<el-table-column label="文件名称" align="center" prop="fileName" min-width="100px" />
|
||||
<el-table-column label="文件类型" align="center" prop="fileType" min-width="100px">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.fileType == '1' ? '文件' : '文件夹' }}</span>
|
||||
</template> </el-table-column
|
||||
><el-table-column label="文件路径" align="center" min-width="100px">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.filePath }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="删除时间" align="center" prop="deletedAt" min-width="100px"> </el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding" min-width="100px" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button type="success" v-hasPermi="['project:project:remove']" link @click="onRecyclingStation(scope.row)"
|
||||
><el-icon><RefreshRight /></el-icon>恢复</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- <pagination v-show="total > 0" :total="total" v-model:page="param.pageNum" v-model:limit="param.pageSize" @pagination="getDocumentDataList" /> -->
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { toRefs, reactive, ref, defineComponent, getCurrentInstance } from 'vue';
|
||||
import { ElMessageBox, ElMessage, ElLoading } from 'element-plus';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
import { documentRecycleBinList, completionDataRecyclingStation } from '@/api/safety/documentSafetyMeeting';
|
||||
export default defineComponent({
|
||||
name: 'index',
|
||||
setup() {
|
||||
const { proxy } = <any>getCurrentInstance();
|
||||
const loading = ref(false);
|
||||
const queryRef = ref();
|
||||
// 非多个禁用
|
||||
const multiple = ref(true);
|
||||
const state = reactive({
|
||||
tableData: [],
|
||||
param: {
|
||||
type: 2,
|
||||
projectId: currentProject.value.id
|
||||
},
|
||||
total: 0,
|
||||
ids: [] //所选择的文件
|
||||
});
|
||||
// 获取资料删除的列表数据
|
||||
const getDocumentDataList = () => {
|
||||
loading.value = true;
|
||||
documentRecycleBinList(state.param).then((res: any) => {
|
||||
let list = res.rows ?? [];
|
||||
state.tableData = list;
|
||||
console.log('🚀 ~ documentRecycleBinList ~ state.tableData:', state.tableData);
|
||||
|
||||
state.total = res.total;
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
// 多选框选中数据
|
||||
const handleSelectionChange = (selection) => {
|
||||
state.ids = selection.map((item) => item.id);
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
const onRecyclingStation = (row) => {
|
||||
let ids = [];
|
||||
if (row) {
|
||||
ids = [row.id];
|
||||
} else {
|
||||
// 批量
|
||||
ids = state.ids;
|
||||
}
|
||||
ElMessageBox.confirm('你确定要恢复所选文件或文件夹?', '提示', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '正在恢复中……',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
completionDataRecyclingStation(ids).then((res) => {
|
||||
loading.close();
|
||||
if (res.code == 200) {
|
||||
getDocumentDataList();
|
||||
ElMessage.success('操作成功');
|
||||
} else {
|
||||
ElMessage.error(res.msg);
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
return {
|
||||
proxy,
|
||||
multiple,
|
||||
loading,
|
||||
onRecyclingStation,
|
||||
handleSelectionChange,
|
||||
getDocumentDataList,
|
||||
...toRefs(state)
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.colBlock {
|
||||
display: block;
|
||||
}
|
||||
.colNone {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
524
src/views/safety/documentSafetyMeeting/index.vue
Normal file
524
src/views/safety/documentSafetyMeeting/index.vue
Normal file
@ -0,0 +1,524 @@
|
||||
<template>
|
||||
<div class="documentCompletion-data">
|
||||
<el-tabs v-model="activeName" class="p-4" @tab-click="handleClick">
|
||||
<el-tab-pane label="文件夹" name="first">
|
||||
<el-button type="success" :disabled="toolStart" @click="handleFile(3)"
|
||||
><el-icon><Plus /></el-icon>新建文件夹</el-button
|
||||
>
|
||||
<el-button type="primary" :disabled="toolStart" @click="handleFile(2)"
|
||||
><el-icon><Upload /></el-icon>上传文件</el-button
|
||||
>
|
||||
<el-card style="margin-top: 10px">
|
||||
<div class="breadcrumb-img">
|
||||
<el-breadcrumb>
|
||||
<el-breadcrumb-item @click="onBreadcrumb(item)" v-for="(item, i) of breadcrumbList" :key="i">
|
||||
<span title="点击打开文件夹" style="cursor: pointer">{{ item.fileName }}</span>
|
||||
</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<div class="tool-All">
|
||||
<div v-if="!toolStart">
|
||||
<el-button type="primary" v-hasPermi="['project:project:remove']" @click="onBatchAll">
|
||||
<el-icon><Menu /></el-icon>批量操作</el-button
|
||||
>
|
||||
</div>
|
||||
<div v-if="toolStart">
|
||||
<el-button type="warning" @click="onBatchAll">
|
||||
<el-icon><Tools /></el-icon>取消操作</el-button
|
||||
>
|
||||
<el-button type="danger" @click="onDeleteAll">
|
||||
<el-icon><Delete /></el-icon>删除</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card style="margin-top: 10px">
|
||||
<div class="file_detail" id="file_detail1">
|
||||
<el-row class="row-bg" v-if="fileList.length">
|
||||
<el-col :span="2" v-for="(item, i) of fileList" :key="i">
|
||||
<div :class="{ file_style: true }">
|
||||
<div @click="onNav(item)" title="点击打开文件" @contextmenu="onContextmenu($event, item, i)">
|
||||
<img src="../../../assets/icons/svg/file1.png" v-if="item.fileType == '2'" alt="" />
|
||||
<img src="../../../assets/icons/svg/file.png" v-else-if="item.fileType == '1'" alt="" />
|
||||
<el-image
|
||||
v-else-if="item.fileType == '3'"
|
||||
style="width: 100%; height: 100%"
|
||||
:src="item.filePath"
|
||||
:zoom-rate="1.2"
|
||||
:max-scale="7"
|
||||
:min-scale="0.2"
|
||||
:initial-index="4"
|
||||
:preview-src-list="[item.filenPathCoding]"
|
||||
fit="cover"
|
||||
/>
|
||||
<img :src="'/icon/' + item.fileType + '.png'" v-else />
|
||||
</div>
|
||||
<span @click="onFileName(item)" title="点击重命名">{{ item.fileName }}</span>
|
||||
<div :class="{ fileActive: toolStart }" v-if="toolStart" @click="onToolAll(item)"></div>
|
||||
<div class="checkbox-box" v-if="toolStart">
|
||||
<el-checkbox v-model="item.checkbox" size="large" />
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-empty :image-size="200" description="暂无文件" v-else />
|
||||
<div class="right_box" id="right_box">
|
||||
<div v-for="(item, i) of list" :key="i" @click="item.callback($event)">
|
||||
{{ item.name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="回收站" name="second">
|
||||
<RecyclingStation ref="RecyclingStationRef"></RecyclingStation>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { toRefs, reactive, onMounted, ref, defineComponent, computed, getCurrentInstance, toRaw, nextTick, onBeforeUnmount } from 'vue';
|
||||
import { ElMessageBox, ElMessage, ElLoading } from 'element-plus';
|
||||
import {
|
||||
documentCompletionTreeStructure,
|
||||
documentCompletionDelete,
|
||||
documentCompletionAdd,
|
||||
documentCompletionEdit,
|
||||
newFolder,
|
||||
uniFileDownload
|
||||
} from '@/api/safety/documentSafetyMeeting/index';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
// 回收站
|
||||
import RecyclingStation from '@/views/safety/documentSafetyMeeting/RecyclingStation/index.vue';
|
||||
export default defineComponent({
|
||||
name: 'index',
|
||||
components: {
|
||||
RecyclingStation
|
||||
},
|
||||
setup() {
|
||||
const { proxy } = <any>getCurrentInstance();
|
||||
const RecyclingStationRef = ref();
|
||||
// 字典选项数据
|
||||
const {} = proxy.useDict();
|
||||
// 文件下载
|
||||
const onExport = (event) => {
|
||||
event.stopPropagation();
|
||||
// 文件下载 state.typeFile: 2、文件夹 1、文件
|
||||
if (state.typeFile == '2') {
|
||||
window.open(state.relativePath, '_black');
|
||||
} else {
|
||||
uniFileDownload({ relativePath: state.relativePath, type: state.typeFile }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
window.open(res.data.Path, '_black');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
// 文件删除
|
||||
const onDeleteFile = (event) => {
|
||||
event.stopPropagation();
|
||||
setDel([state.delId]);
|
||||
};
|
||||
const state = reactive({
|
||||
fileList: [],
|
||||
activeName: 'first',
|
||||
breadcrumbList: [{ id: 0, fileName: '目录' }], //菜单列表
|
||||
projectId: currentProject.value.id,
|
||||
parentPid: '0', //父级的id 默认为0
|
||||
fileType: 0, //文件 或压缩文件
|
||||
list: [
|
||||
{ id: 1, name: '文件下载', callback: onExport, auth: 'api/v1/system/documentSafetyMeeting/safetyDataUniFileDownload' },
|
||||
{ id: 2, name: '文件删除', callback: onDeleteFile, auth: 'api/v1/system/documentSafetyMeeting/delete' }
|
||||
],
|
||||
relativePath: '', //文件下载需要相对路径
|
||||
delId: '', //删除需要的id
|
||||
toolStart: false,
|
||||
imageType: ['jpg', 'png', 'jpeg'],
|
||||
wordType: ['docx', 'doc', 'pdf', 'xls', 'xlsx', 'pptx', 'ppt'],
|
||||
typeFile: ''
|
||||
});
|
||||
onMounted(() => {
|
||||
// 全局设置阻止右键点击
|
||||
document.addEventListener('contextmenu', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
let file_detail_box = document.getElementById('file_detail1');
|
||||
// 监听当前元素点击事件 并关闭弹框
|
||||
file_detail_box.addEventListener('click', () => {
|
||||
let box = document.getElementById('right_box');
|
||||
box.style.display = 'none';
|
||||
});
|
||||
// 默认第一级 父级pid为0
|
||||
getdocumentCompletionTreeStructure();
|
||||
// 压缩文件上传
|
||||
|
||||
proxy.mittBus.on('bigUploader.uploadFileSuccess' + 1010, (res: any) => {
|
||||
const { filename, totalSize, url, identifier, fileType } = res;
|
||||
let arr = filename.split('.');
|
||||
let fileType1 = arr[arr.length - 1];
|
||||
if (fileType1 == 'zip' || fileType1 == 'rar') {
|
||||
state.fileType = 1;
|
||||
} else {
|
||||
//除了压缩 其他文件
|
||||
state.fileType = 2;
|
||||
}
|
||||
let obj = {
|
||||
filePath: {
|
||||
url,
|
||||
name: filename,
|
||||
size: totalSize,
|
||||
fileType: '.' + fileType1 //后缀名
|
||||
},
|
||||
file: ''
|
||||
};
|
||||
documentCompletionAdd(obj).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '上传成功'
|
||||
});
|
||||
getdocumentCompletionTreeStructure(); //获取当前当前文件夹的文件数据
|
||||
} else {
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: res.message
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
onBeforeUnmount(() => {
|
||||
// 取消订阅特定事件
|
||||
proxy.mittBus.off('bigUploader.uploadFileSuccess' + 1010);
|
||||
});
|
||||
const getdocumentCompletionTreeStructure = () => {
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '正在查询文件……',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
documentCompletionTreeStructure({ projectId: currentProject.value.id, pid: state.parentPid }).then((res: any) => {
|
||||
loading.close();
|
||||
if (res.code == 200) {
|
||||
state.fileList = res.data || [];
|
||||
if (state.fileList.length) {
|
||||
state.fileList.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
checkbox: false
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
const handleFile = (type) => {
|
||||
state.fileType = type;
|
||||
if (type == 3) {
|
||||
// 新建文件夹
|
||||
ElMessageBox.prompt('填写文件夹名', '新建文件夹', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消'
|
||||
})
|
||||
.then(({ value }) => {
|
||||
// pid 父级
|
||||
newFolder({ fileName: value, pid: state.parentPid == '0' ? '' : state.parentPid, projectId: state.projectId }).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
getdocumentCompletionTreeStructure();
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '添加成功'
|
||||
});
|
||||
} else {
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: res.data
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
} else {
|
||||
// 竣工图
|
||||
proxy.mittBus.emit('bigUploader.uploadFile', { type: 100, types: 1010, accept: [] });
|
||||
}
|
||||
return;
|
||||
};
|
||||
// 页面跳转
|
||||
const onNav = (item) => {
|
||||
// 通过后缀判断该文件是什么类型
|
||||
// 图片格式 jpg、png、jpeg、
|
||||
// word文档格式:docx、doc、pdf、xls、xlsx、pptx、ppt
|
||||
// 其他全文件夹
|
||||
if (item.fileType == '3') {
|
||||
// 可以预览图片
|
||||
return;
|
||||
} else if (item.fileType == '2') {
|
||||
// 打开文件夹
|
||||
state.parentPid = item.id;
|
||||
state.breadcrumbList.push(item); //路径设置
|
||||
state.fileList = [];
|
||||
// 获取对应文件夹的数据
|
||||
getdocumentCompletionTreeStructure();
|
||||
} else {
|
||||
window.open(item.filenPathCoding, '_black');
|
||||
return;
|
||||
}
|
||||
};
|
||||
const onFileName = (item) => {
|
||||
// 修改文件名称
|
||||
ElMessageBox.prompt('文件名称修改', '重命名', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
inputValue: item.name
|
||||
})
|
||||
.then(({ value }) => {
|
||||
// 确定
|
||||
documentCompletionEdit({ id: item.id, name: value, type: item.type }).then((res: any) => {
|
||||
if (res.code == 200) {
|
||||
item.name = value;
|
||||
getdocumentCompletionTreeStructure();
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '修改成功'
|
||||
});
|
||||
} else {
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: res.message
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
const handleClick = (val) => {
|
||||
if (state.activeName == 'second') {
|
||||
getdocumentCompletionTreeStructure();
|
||||
} else {
|
||||
RecyclingStationRef.value.getDocumentDataList();
|
||||
}
|
||||
};
|
||||
const onBreadcrumb = (item) => {
|
||||
if (item.fileName == '目录') {
|
||||
state.parentPid = '0';
|
||||
state.breadcrumbList = [{ id: 0, fileName: '目录' }]; //菜单列表
|
||||
// 最初目录
|
||||
getdocumentCompletionTreeStructure();
|
||||
} else {
|
||||
let arr = [];
|
||||
let array = state.breadcrumbList;
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
arr.push(array[index]);
|
||||
if (array[index].fileName == item.fileName) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
state.breadcrumbList = arr;
|
||||
// 通过 当前点击的文件进行获取数据
|
||||
// 重复点击不用再次获取
|
||||
if (item.id == state.parentPid) return;
|
||||
state.parentPid = item.id;
|
||||
getdocumentCompletionTreeStructure();
|
||||
}
|
||||
};
|
||||
// 批量操作数据
|
||||
const onBatchAll = () => {
|
||||
state.toolStart = !state.toolStart;
|
||||
};
|
||||
const setDel = (ids) => {
|
||||
let msg = '你确定要删除所选数据?';
|
||||
if (ids.length === 0) {
|
||||
ElMessage.error('请选择要删除的数据。');
|
||||
return;
|
||||
}
|
||||
ElMessageBox.confirm(msg, '温馨提示', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
console.log(ids);
|
||||
|
||||
documentCompletionDelete(ids).then((res) => {
|
||||
if (res.code == 200) {
|
||||
let box = document.getElementById('right_box');
|
||||
box.style.display = 'none'; //显示div盒子
|
||||
ElMessage.success('删除成功');
|
||||
getdocumentCompletionTreeStructure();
|
||||
} else {
|
||||
ElMessage.error(res.msg);
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
// 批量删除
|
||||
const onDeleteAll = () => {
|
||||
//获取所有已经选中的数据
|
||||
let selectList = [];
|
||||
if (state.fileList.length) {
|
||||
state.fileList.map((item) => {
|
||||
if (item.checkbox) {
|
||||
selectList.push(item.id);
|
||||
}
|
||||
});
|
||||
if (!selectList.length) {
|
||||
ElMessage.warning('请选择需要删除的文件');
|
||||
return;
|
||||
}
|
||||
setDel(selectList);
|
||||
}
|
||||
};
|
||||
// 批量选择
|
||||
const onToolAll = (row) => {
|
||||
row.checkbox = !row.checkbox;
|
||||
};
|
||||
const onContextmenu = (event, item, i) => {
|
||||
state.typeFile = item.fileType;
|
||||
state.relativePath = item.filenPath;
|
||||
state.delId = item.id;
|
||||
let len = (100 / 12) * (i % 12) + 4 + '%';
|
||||
let box = document.getElementById('right_box');
|
||||
box.style.top = event.clientY - 250 + 'px'; //鼠标点击时给div定位Y轴
|
||||
box.style.left = len; //鼠标点击时给div定位X轴
|
||||
box.style.display = 'block'; //显示div盒子
|
||||
};
|
||||
return {
|
||||
proxy,
|
||||
handleFile,
|
||||
onFileName,
|
||||
onNav,
|
||||
handleClick,
|
||||
RecyclingStationRef,
|
||||
onBreadcrumb,
|
||||
onBatchAll,
|
||||
onDeleteAll,
|
||||
onExport,
|
||||
onDeleteFile,
|
||||
onToolAll,
|
||||
onContextmenu,
|
||||
...toRefs(state)
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.documentCompletion-data {
|
||||
.el-card__body {
|
||||
padding: 10px !important;
|
||||
}
|
||||
|
||||
.breadcrumb-img {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
padding-right: 10px;
|
||||
.tool-All {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
> div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
.batch {
|
||||
width: 24px;
|
||||
}
|
||||
}
|
||||
.file_detail {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 66vh;
|
||||
overflow: auto;
|
||||
.right_box {
|
||||
position: absolute;
|
||||
z-index: 999;
|
||||
background-color: rgb(0 0 0 / 56%);
|
||||
width: 120px;
|
||||
height: 100px;
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: none;
|
||||
border-radius: 6px;
|
||||
padding: 14px 4px;
|
||||
> div {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
padding: 8px 20px;
|
||||
cursor: pointer;
|
||||
font-family: revert;
|
||||
border-radius: 5px;
|
||||
}
|
||||
> div:hover {
|
||||
background-color: rgb(0 0 0 / 80%);
|
||||
}
|
||||
}
|
||||
.file_style {
|
||||
// height: 100px;
|
||||
width: 90px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
animation: 0.5s ease;
|
||||
position: relative;
|
||||
margin-bottom: 10px;
|
||||
> div {
|
||||
width: 100%;
|
||||
// height: 70%;
|
||||
height: 80px;
|
||||
> img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.checkbox-box {
|
||||
position: absolute;
|
||||
top: -8px;
|
||||
left: 60px;
|
||||
z-index: 1000;
|
||||
}
|
||||
> span {
|
||||
font-size: 12px;
|
||||
width: 100%;
|
||||
display: block;
|
||||
text-align: center;
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
// justify-content: center;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
}
|
||||
.file_style:hover {
|
||||
background-color: rgba(189, 189, 189, 0.322);
|
||||
border-radius: 5px;
|
||||
}
|
||||
.fileActive {
|
||||
display: block;
|
||||
top: 0;
|
||||
position: absolute;
|
||||
z-index: 999;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100% !important;
|
||||
border-radius: 5px;
|
||||
background-color: rgba(189, 189, 189, 0.322);
|
||||
}
|
||||
}
|
||||
}
|
||||
.colBlock {
|
||||
display: block;
|
||||
}
|
||||
.colNone {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
278
src/views/safety/questionBank/index.vue
Normal file
278
src/views/safety/questionBank/index.vue
Normal file
@ -0,0 +1,278 @@
|
||||
<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="categoryType">
|
||||
<el-select v-model="queryParams.categoryType" placeholder="请选择题目类别" clearable>
|
||||
<el-option v-for="dict in safety_question_category_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="题目类型" prop="questionType">
|
||||
<el-select v-model="queryParams.questionType" placeholder="请选择题目类型" clearable>
|
||||
<el-option v-for="dict in safety_question_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="题目内容" prop="questionContent">
|
||||
<el-input v-model="queryParams.questionContent" placeholder="请输入题目内容" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="选项" prop="options">
|
||||
<el-input v-model="queryParams.options" placeholder="请输入选项" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="正确答案" prop="correctAnswer">
|
||||
<el-input v-model="queryParams.correctAnswer" placeholder="请输入正确答案" clearable @keyup.enter="handleQuery" />
|
||||
</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="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['safety:questionBank:add']"> 新增 </el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['safety:questionBank:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['safety:questionBank:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['safety:questionBank:export']">导出 </el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="questionBankList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键id" align="center" prop="id" v-if="true" />
|
||||
<el-table-column label="题目类别" align="center" prop="categoryType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="safety_question_category_type" :value="scope.row.categoryType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="题目类型" align="center" prop="questionType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="safety_question_type" :value="scope.row.questionType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="题目内容" align="center" prop="questionContent" />
|
||||
<el-table-column label="选项" align="center" prop="options" />
|
||||
<el-table-column label="正确答案" align="center" prop="correctAnswer" />
|
||||
<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="['safety:questionBank:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['safety:questionBank: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="questionBankFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="题目类别" prop="categoryType">
|
||||
<el-select v-model="form.categoryType" placeholder="请选择题目类别">
|
||||
<el-option v-for="dict in safety_question_category_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="题目类型" prop="questionType">
|
||||
<el-select v-model="form.questionType" placeholder="请选择题目类型">
|
||||
<el-option v-for="dict in safety_question_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="题目内容" prop="questionContent">
|
||||
<el-input v-model="form.questionContent" placeholder="请输入题目内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="选项" prop="options">
|
||||
<el-input v-model="form.options" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="正确答案" prop="correctAnswer">
|
||||
<el-input v-model="form.correctAnswer" 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>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="QuestionBank" lang="ts">
|
||||
import { addQuestionBank, delQuestionBank, getQuestionBank, listQuestionBank, updateQuestionBank } from '@/api/safety/questionBank';
|
||||
import { QuestionBankForm, QuestionBankQuery, QuestionBankVO } from '@/api/safety/questionBank/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { safety_question_type, safety_question_category_type } = toRefs<any>(proxy?.useDict('safety_question_type', 'safety_question_category_type'));
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const questionBankList = ref<QuestionBankVO[]>([]);
|
||||
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 queryFormRef = ref<ElFormInstance>();
|
||||
const questionBankFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: QuestionBankForm = {
|
||||
id: undefined,
|
||||
categoryType: undefined,
|
||||
questionType: undefined,
|
||||
questionContent: undefined,
|
||||
options: undefined,
|
||||
correctAnswer: undefined
|
||||
};
|
||||
const data = reactive<PageData<QuestionBankForm, QuestionBankQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
categoryType: undefined,
|
||||
questionType: undefined,
|
||||
questionContent: undefined,
|
||||
options: undefined,
|
||||
correctAnswer: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }],
|
||||
categoryType: [{ required: true, message: '题目类别不能为空', trigger: 'change' }],
|
||||
questionType: [{ required: true, message: '题目类型不能为空', trigger: 'change' }],
|
||||
questionContent: [{ required: true, message: '题目内容不能为空', trigger: 'blur' }],
|
||||
options: [{ required: true, message: '选项不能为空', trigger: 'blur' }],
|
||||
correctAnswer: [{ required: true, message: '正确答案不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询题库列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listQuestionBank(queryParams.value);
|
||||
questionBankList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
questionBankFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: QuestionBankVO[]) => {
|
||||
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?: QuestionBankVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getQuestionBank(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改题库';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
questionBankFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateQuestionBank(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addQuestionBank(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: QuestionBankVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除题库编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delQuestionBank(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download(
|
||||
'safety/questionBank/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`questionBank_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
247
src/views/safety/questionUserAnswer/index.vue
Normal file
247
src/views/safety/questionUserAnswer/index.vue
Normal file
@ -0,0 +1,247 @@
|
||||
<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="userName">
|
||||
<el-input v-model="queryParams.userName" placeholder="请输入用户姓名" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="班组" prop="teamId">
|
||||
<el-select v-model="queryParams.teamId" clearable placeholder="全部">
|
||||
<el-option v-for="item in ProjectTeam" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</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-tooltip placement="top" effect="dark">
|
||||
<template #content>
|
||||
注:上传压缩包内的文件夹名称需设置为【姓名-身份证-满分-得分-及格分】, <br />
|
||||
例如:小明-5130112333654X-100-59-60
|
||||
</template>
|
||||
<file-upload
|
||||
:limit="1"
|
||||
v-model:model-value="filePath"
|
||||
isImportInfo
|
||||
:fileType="['zip']"
|
||||
uploadUrl="/safety/questionUserAnswer/upload/zip"
|
||||
:file-size="5000"
|
||||
:data="{ projectId: currentProject.id }"
|
||||
><el-button type="success" plain icon="Upload">上传线下安全考试</el-button></file-upload
|
||||
>
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Download" :disabled="single" @click="handleDownload()">批量下载试卷</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="questionUserAnswerList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键id" align="center" prop="id" v-if="false" />
|
||||
<el-table-column label="姓名" align="center" prop="userName" />
|
||||
<el-table-column label="及格线/总分" align="center" prop="pass" />
|
||||
<el-table-column label="得分" align="center" prop="score" />
|
||||
<el-table-column label="计划时间" align="center" prop="examTime" />
|
||||
<el-table-column label="用时时间" align="center" prop="takeTime" />
|
||||
<el-table-column label="考试时间" align="center" prop="createTime" />
|
||||
<el-table-column label="类型" align="center" prop="examType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="user_exam_type" :value="scope.row.examType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-link type="primary" :underline="false" :href="scope.row.fileUrl[0]" target="_blank">
|
||||
<el-button link type="primary" icon="View">预览试卷</el-button>
|
||||
</el-link>
|
||||
|
||||
<el-button link type="primary" icon="Download" @click="downloadOssOne(scope.row)">下载试卷</el-button>
|
||||
</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>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="QuestionUserAnswer" lang="ts">
|
||||
import {
|
||||
listQuestionUserAnswer,
|
||||
getQuestionUserAnswer,
|
||||
delQuestionUserAnswer,
|
||||
addQuestionUserAnswer,
|
||||
updateQuestionUserAnswer,
|
||||
uploadQuestionUserAnswer
|
||||
} from '@/api/safety/questionUserAnswer';
|
||||
import { QuestionUserAnswerVO, QuestionUserAnswerQuery, QuestionUserAnswerForm } from '@/api/safety/questionUserAnswer/types';
|
||||
import { downLoadOss } from '@/api/system/oss';
|
||||
import download from '@/plugins/download';
|
||||
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
import { blobValidate } from '@/utils/ruoyi';
|
||||
import FileSaver from 'file-saver';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { user_exam_type } = toRefs<any>(proxy?.useDict('user_exam_type'));
|
||||
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const ProjectTeam = computed(() => userStore.ProjectTeamList);
|
||||
|
||||
const questionUserAnswerList = ref<QuestionUserAnswerVO[]>([]);
|
||||
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 filePath = ref<string>('');
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const questionUserAnswerFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: QuestionUserAnswerForm = {
|
||||
id: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
userId: undefined,
|
||||
bankId: undefined,
|
||||
answer: undefined,
|
||||
userName: undefined,
|
||||
score: undefined,
|
||||
examTime: undefined,
|
||||
takeTime: undefined,
|
||||
pass: undefined,
|
||||
file: undefined,
|
||||
teamId: undefined
|
||||
};
|
||||
const data = reactive<PageData<QuestionUserAnswerForm, QuestionUserAnswerQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
userId: undefined,
|
||||
examType: undefined,
|
||||
teamId: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
userName: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }],
|
||||
projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }],
|
||||
userId: [{ required: true, message: '用户id不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询用户试卷存储列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listQuestionUserAnswer(queryParams.value);
|
||||
questionUserAnswerList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
questionUserAnswerFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: QuestionUserAnswerVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length == 0;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
// const handleUpdate = async (row?: QuestionUserAnswerVO) => {
|
||||
// reset();
|
||||
// const _id = row?.id || ids.value[0];
|
||||
// const res = await getQuestionUserAnswer(_id);
|
||||
// Object.assign(form.value, res.data);
|
||||
// dialog.visible = true;
|
||||
// dialog.title = '修改用户试卷存储';
|
||||
// };
|
||||
|
||||
/** 批量下载按钮操作 */
|
||||
const handleDownload = async () => {
|
||||
const _ids = ids.value;
|
||||
await downLoadOss({ idList: _ids }, '/safety/questionUserAnswer/exportFile', '安全考试.zip');
|
||||
};
|
||||
/** 下载单个按钮操作 */
|
||||
const downloadOssOne = async (row?: QuestionUserAnswerVO) => {
|
||||
await download.oss(row?.file);
|
||||
};
|
||||
|
||||
// const fileWatch = watch(
|
||||
// () => filePath.value,
|
||||
// (nid, oid) => {
|
||||
// uploadQuestionUserAnswer({ file: filePath.value, projectId: currentProject.value.id }).then((res) => {
|
||||
// console.log(res);
|
||||
// });
|
||||
// }
|
||||
// );
|
||||
|
||||
//监听项目id刷新数据
|
||||
const listeningProject = watch(
|
||||
() => currentProject.value.id,
|
||||
(nid, oid) => {
|
||||
queryParams.value.projectId = nid;
|
||||
form.value.projectId = nid;
|
||||
getList();
|
||||
}
|
||||
);
|
||||
|
||||
onUnmounted(() => {
|
||||
listeningProject();
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
236
src/views/safety/questionsCategory/index.vue
Normal file
236
src/views/safety/questionsCategory/index.vue
Normal file
@ -0,0 +1,236 @@
|
||||
<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="categoryName">
|
||||
<el-input v-model="queryParams.categoryName" placeholder="请输入题库类别" clearable @keyup.enter="handleQuery" />
|
||||
</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="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['safety:questionsCategory:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['safety:questionsCategory:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['safety:questionsCategory:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="questionsCategoryList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" align="center" type="index" width="100" />
|
||||
<el-table-column label="题库类别" align="center" prop="categoryName" />
|
||||
<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="['safety:questionsCategory:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['safety:questionsCategory: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="questionsCategoryFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="题库类别" prop="categoryName">
|
||||
<el-input v-model="form.categoryName" 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>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="QuestionsCategory" lang="ts">
|
||||
import {
|
||||
listQuestionsCategory,
|
||||
getQuestionsCategory,
|
||||
delQuestionsCategory,
|
||||
addQuestionsCategory,
|
||||
updateQuestionsCategory
|
||||
} from '@/api/safety/questionsCategory';
|
||||
import { QuestionsCategoryVO, QuestionsCategoryQuery, QuestionsCategoryForm } from '@/api/safety/questionsCategory/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const questionsCategoryList = ref<QuestionsCategoryVO[]>([]);
|
||||
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 queryFormRef = ref<ElFormInstance>();
|
||||
const questionsCategoryFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: QuestionsCategoryForm = {
|
||||
id: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
categoryName: undefined
|
||||
};
|
||||
const data = reactive<PageData<QuestionsCategoryForm, QuestionsCategoryQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
projectId: currentProject.value.id,
|
||||
categoryName: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }],
|
||||
projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }],
|
||||
categoryName: [{ required: true, message: '题库类别不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询题库类别列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listQuestionsCategory(queryParams.value);
|
||||
questionsCategoryList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
questionsCategoryFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: QuestionsCategoryVO[]) => {
|
||||
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?: QuestionsCategoryVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getQuestionsCategory(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改题库类别';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
questionsCategoryFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
form.value.projectId = currentProject.value.id;
|
||||
if (form.value.id) {
|
||||
await updateQuestionsCategory(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addQuestionsCategory(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: QuestionsCategoryVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除题库类别编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delQuestionsCategory(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
//监听项目id刷新数据
|
||||
const listeningProject = watch(
|
||||
() => currentProject.value.id,
|
||||
(nid, oid) => {
|
||||
queryParams.value.projectId = nid;
|
||||
form.value.projectId = nid;
|
||||
getList();
|
||||
}
|
||||
);
|
||||
|
||||
onUnmounted(() => {
|
||||
listeningProject();
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
309
src/views/safety/questionsConfig/index.vue
Normal file
309
src/views/safety/questionsConfig/index.vue
Normal file
@ -0,0 +1,309 @@
|
||||
<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="singleChoice">
|
||||
<el-input v-model="queryParams.singleChoice" placeholder="请输入单选题" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单选分数" prop="singleScore">
|
||||
<el-input v-model="queryParams.singleScore" placeholder="请输入单选分数" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="多选题" prop="multipleChoice">
|
||||
<el-input v-model="queryParams.multipleChoice" placeholder="请输入多选题" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="多选分数" prop="multipleScore">
|
||||
<el-input v-model="queryParams.multipleScore" placeholder="请输入多选分数" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="判断题" prop="estimate">
|
||||
<el-input v-model="queryParams.estimate" placeholder="请输入判断题" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="判断分数" prop="estimateScore">
|
||||
<el-input v-model="queryParams.estimateScore" placeholder="请输入判断分数" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="满分" prop="fullMark">
|
||||
<el-input v-model="queryParams.fullMark" placeholder="请输入满分" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="及格线" prop="passScore">
|
||||
<el-input v-model="queryParams.passScore" placeholder="请输入及格线" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="答题最大时间" prop="answerTime">
|
||||
<el-input v-model="queryParams.answerTime" placeholder="请输入答题最大时间" clearable @keyup.enter="handleQuery" />
|
||||
</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="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['safety:questionsConfig:add']"> 新增 </el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['safety:questionsConfig:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['safety:questionsConfig:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['safety:questionsConfig:export']">导出 </el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="questionsConfigList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键id" align="center" prop="id" v-if="true" />
|
||||
<el-table-column label="单选题" align="center" prop="singleChoice" />
|
||||
<el-table-column label="单选分数" align="center" prop="singleScore" />
|
||||
<el-table-column label="多选题" align="center" prop="multipleChoice" />
|
||||
<el-table-column label="多选分数" align="center" prop="multipleScore" />
|
||||
<el-table-column label="判断题" align="center" prop="estimate" />
|
||||
<el-table-column label="判断分数" align="center" prop="estimateScore" />
|
||||
<el-table-column label="满分" align="center" prop="fullMark" />
|
||||
<el-table-column label="及格线" align="center" prop="passScore" />
|
||||
<el-table-column label="答题最大时间" align="center" prop="answerTime" />
|
||||
<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="['safety:questionsConfig:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['safety:questionsConfig: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="questionsConfigFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="单选题" prop="singleChoice">
|
||||
<el-input v-model="form.singleChoice" placeholder="请输入单选题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单选分数" prop="singleScore">
|
||||
<el-input v-model="form.singleScore" placeholder="请输入单选分数" />
|
||||
</el-form-item>
|
||||
<el-form-item label="多选题" prop="multipleChoice">
|
||||
<el-input v-model="form.multipleChoice" placeholder="请输入多选题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="多选分数" prop="multipleScore">
|
||||
<el-input v-model="form.multipleScore" placeholder="请输入多选分数" />
|
||||
</el-form-item>
|
||||
<el-form-item label="判断题" prop="estimate">
|
||||
<el-input v-model="form.estimate" placeholder="请输入判断题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="判断分数" prop="estimateScore">
|
||||
<el-input v-model="form.estimateScore" placeholder="请输入判断分数" />
|
||||
</el-form-item>
|
||||
<el-form-item label="满分" prop="fullMark">
|
||||
<el-input v-model="form.fullMark" placeholder="请输入满分" />
|
||||
</el-form-item>
|
||||
<el-form-item label="及格线" prop="passScore">
|
||||
<el-input v-model="form.passScore" placeholder="请输入及格线" />
|
||||
</el-form-item>
|
||||
<el-form-item label="答题最大时间" prop="answerTime">
|
||||
<el-input v-model="form.answerTime" 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>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="QuestionsConfig" lang="ts">
|
||||
import { addQuestionsConfig, delQuestionsConfig, getQuestionsConfig, listQuestionsConfig, updateQuestionsConfig } from '@/api/safety/questionsConfig';
|
||||
import { QuestionsConfigForm, QuestionsConfigQuery, QuestionsConfigVO } from '@/api/safety/questionsConfig/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const questionsConfigList = ref<QuestionsConfigVO[]>([]);
|
||||
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 queryFormRef = ref<ElFormInstance>();
|
||||
const questionsConfigFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: QuestionsConfigForm = {
|
||||
id: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
singleChoice: undefined,
|
||||
singleScore: undefined,
|
||||
multipleChoice: undefined,
|
||||
multipleScore: undefined,
|
||||
estimate: undefined,
|
||||
estimateScore: undefined,
|
||||
fullMark: undefined,
|
||||
passScore: undefined,
|
||||
answerTime: undefined
|
||||
};
|
||||
const data = reactive<PageData<QuestionsConfigForm, QuestionsConfigQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
projectId: currentProject.value.id,
|
||||
singleChoice: undefined,
|
||||
singleScore: undefined,
|
||||
multipleChoice: undefined,
|
||||
multipleScore: undefined,
|
||||
estimate: undefined,
|
||||
estimateScore: undefined,
|
||||
fullMark: undefined,
|
||||
passScore: undefined,
|
||||
answerTime: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }],
|
||||
singleChoice: [{ required: true, message: '单选题不能为空', trigger: 'blur' }],
|
||||
singleScore: [{ required: true, message: '单选分数不能为空', trigger: 'blur' }],
|
||||
multipleChoice: [{ required: true, message: '多选题不能为空', trigger: 'blur' }],
|
||||
multipleScore: [{ required: true, message: '多选分数不能为空', trigger: 'blur' }],
|
||||
estimate: [{ required: true, message: '判断题不能为空', trigger: 'blur' }],
|
||||
estimateScore: [{ required: true, message: '判断分数不能为空', trigger: 'blur' }],
|
||||
fullMark: [{ required: true, message: '满分不能为空', trigger: 'blur' }],
|
||||
passScore: [{ required: true, message: '及格线不能为空', trigger: 'blur' }],
|
||||
answerTime: [{ required: true, message: '答题最大时间不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询题库配置列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listQuestionsConfig(queryParams.value);
|
||||
questionsConfigList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
questionsConfigFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: QuestionsConfigVO[]) => {
|
||||
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?: QuestionsConfigVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getQuestionsConfig(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改题库配置';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
questionsConfigFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateQuestionsConfig(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addQuestionsConfig(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: QuestionsConfigVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除题库配置编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delQuestionsConfig(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download(
|
||||
'safety/questionsConfig/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`questionsConfig_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
@ -0,0 +1,243 @@
|
||||
<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?.creatorName }}</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">
|
||||
<dict-tag :options="safety_inspection_check_type" :value="safetyInspectionDetail?.checkType" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="违章类型" label-class-name="white">
|
||||
<dict-tag :options="safety_inspection_violation_type" :value="safetyInspectionDetail?.violationType" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="检查时间" class-name="zebra">{{ safetyInspectionDetail?.checkTime }} </el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="检查人" class-name="zebra">{{ safetyInspectionDetail?.creatorName }} </el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="整改人" label-class-name="white"
|
||||
>{{ safetyInspectionDetail?.correctorName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="要求整改期限" label-class-name="white">
|
||||
{{ dayjs(safetyInspectionDetail?.rectificationDeadline).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?.hiddenDanger }}
|
||||
</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>
|
||||
</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>
|
||||
<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="班组" label-class-name="white"
|
||||
>{{ safetyInspectionDetail?.teamName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="整改日期" label-class-name="white"
|
||||
>{{ safetyInspectionDetail?.rectificationTime }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="整改措施及完成情况" :span="2" label-class-name="white">
|
||||
{{ safetyInspectionDetail?.measure }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="整改附件" :span="2" label-class-name="white">
|
||||
<el-space wrap>
|
||||
<div v-for="item in rectificationFileList" :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}`" :underline="false" target="_blank">
|
||||
<span> {{ item.originalName }} </span>
|
||||
</el-link>
|
||||
</span>
|
||||
</div>
|
||||
</el-space>
|
||||
</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="复查人" label-class-name="white"
|
||||
>{{ safetyInspectionDetail?.creatorName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="复查日期" label-class-name="white"
|
||||
>{{ safetyInspectionDetail?.reviewTime }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="复查情况" :span="2" label-class-name="white"
|
||||
>{{ safetyInspectionDetail?.review }}
|
||||
</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 { SafetyInspectionVO } from '@/api/safety/safetyInspection/types';
|
||||
import { getSafetyInspection } from '@/api/safety/safetyInspection';
|
||||
import { downLoadOss, listByIds } from '@/api/system/oss';
|
||||
import { OssVO } from '@/api/system/oss/types';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
interface Props {
|
||||
safetyInspectionId?: string | number;
|
||||
}
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { safety_inspection_violation_type, safety_inspection_type, safety_inspection_check_type } = toRefs<any>(
|
||||
proxy?.useDict('safety_inspection_violation_type', 'review_type', 'reply_type', 'safety_inspection_type', 'safety_inspection_check_type')
|
||||
);
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const props = defineProps<Props>();
|
||||
const loading = ref<boolean>(false);
|
||||
const safetyInspectionDetail = ref<SafetyInspectionVO>();
|
||||
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 getSafetyInspection(props.safetyInspectionId);
|
||||
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.safetyInspectionId);
|
||||
get();
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.safetyInspectionId,
|
||||
(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>
|
407
src/views/safety/safetyInspection/index.vue
Normal file
407
src/views/safety/safetyInspection/index.vue
Normal file
@ -0,0 +1,407 @@
|
||||
<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="checkType">
|
||||
<el-select v-model="queryParams.checkType" placeholder="全部" clearable>
|
||||
<el-option v-for="dict in safety_inspection_check_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="违章类型" prop="violationType">
|
||||
<el-select v-model="queryParams.violationType" placeholder="全部" clearable>
|
||||
<el-option v-for="dict in safety_inspection_violation_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="处理状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="全部" clearable>
|
||||
<el-option v-for="dict in safety_inspection_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</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="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['safety:safetyInspection:add']"> 新增 </el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['safety:safetyInspection:remove']">
|
||||
删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['safety:safetyInspection:export']">导出 </el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="safetyInspectionList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" type="index" width="60" align="center" />
|
||||
<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="correctorName" />
|
||||
<el-table-column label="检查时间" align="center" prop="rectificationDeadline" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.rectificationDeadline, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="检查类型" align="center" prop="checkType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="safety_inspection_check_type" :value="scope.row.checkType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="违章类型" align="center" prop="violationType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="safety_inspection_violation_type" :value="scope.row.violationType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="巡检结果" align="center" prop="inspectionResult">
|
||||
<template #default="scope">
|
||||
<el-tooltip placement="top" effect="dark">
|
||||
<template #content>
|
||||
<div class="max-w-670px">{{ scope.row.inspectionResult }}</div>
|
||||
</template>
|
||||
<el-text truncated>
|
||||
{{ scope.row.inspectionResult }}
|
||||
</el-text>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="整改人" align="center" prop="correctorName" />
|
||||
<el-table-column label="复查状态" align="center" prop="reviewType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="review_type" :value="scope.row.reviewType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="220">
|
||||
<template #default="scope">
|
||||
<el-space>
|
||||
<el-button link type="primary" icon="View" @click="handleShowDialog(scope.row)" v-hasPermi="['safety:safetyInspection:query']">
|
||||
详情
|
||||
</el-button>
|
||||
<!-- <el-button link type="success" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['safety:safetyInspection:edit']">修改 </el-button> -->
|
||||
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['safety:safetyInspection:remove']">
|
||||
删除
|
||||
</el-button>
|
||||
</el-space>
|
||||
</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" append-to-body>
|
||||
<el-form ref="safetyInspectionFormRef" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="检查类型" prop="checkType">
|
||||
<el-select v-model="form.checkType" placeholder="请选择检查类型">
|
||||
<el-option v-for="dict in safety_inspection_check_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="违章类型" prop="violationType">
|
||||
<el-select v-model="form.violationType" placeholder="请选择违章类型">
|
||||
<el-option v-for="dict in safety_inspection_violation_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="巡检结果" prop="inspectionResult">
|
||||
<el-input v-model="form.inspectionResult" placeholder="请输入巡检结果" />
|
||||
</el-form-item>
|
||||
<el-form-item label="整改班组" prop="teamId">
|
||||
<el-select v-model="form.teamId" placeholder="请选择整改班组">
|
||||
<el-option v-for="item in teamOpt" :key="item.value" :label="item.label" :value="item.value" @click="changeForeman(item.value)" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="整改人" prop="correctorId">
|
||||
<el-select v-model="form.correctorId" placeholder="请选择整改人" :disabled="!form.teamId">
|
||||
<el-option v-for="item in foremanOpt" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="问题隐患" prop="hiddenDanger">
|
||||
<el-input v-model="form.hiddenDanger" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="整改措施" prop="measure">
|
||||
<el-input v-model="form.measure" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="要求整改期限" prop="checkTime">
|
||||
<el-date-picker clearable v-model="form.rectificationDeadline" type="date" value-format="YYYY-MM-DD" placeholder="选择要求整改期限" />
|
||||
</el-form-item>
|
||||
<el-form-item label="检查附件" prop="checkFile">
|
||||
<file-upload v-model="form.checkFile" :file-size="20" :file-type="['doc', 'docx', 'pdf', 'png', 'jpg', 'jpeg']" />
|
||||
</el-form-item>
|
||||
<el-form-item label="整改附件" prop="rectificationFile">
|
||||
<file-upload v-model="form.rectificationFile" :file-size="20" :file-type="['doc', 'docx', 'pdf', 'png', 'jpg', 'jpeg']" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" 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">
|
||||
<safety-inspection-detail-dialog :safety-inspection-id="currentSafetyInspectionId" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="SafetyInspection" lang="ts">
|
||||
import {
|
||||
addSafetyInspection,
|
||||
delSafetyInspection,
|
||||
getSafetyInspection,
|
||||
listSafetyInspection,
|
||||
updateSafetyInspection
|
||||
} from '@/api/safety/safetyInspection';
|
||||
import { SafetyInspectionForm, SafetyInspectionQuery, SafetyInspectionVO } from '@/api/safety/safetyInspection/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
import SafetyInspectionDetailDialog from '@/views/safety/safetyInspection/component/SafetyInspectionDetailDialog.vue';
|
||||
import { listProjectTeamForeman } from '@/api/project/projectTeam';
|
||||
import { foremanQuery, ProjectTeamForemanResp } from '@/api/project/projectTeam/types';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { safety_inspection_violation_type, review_type, safety_inspection_type, safety_inspection_check_type } = toRefs<any>(
|
||||
proxy?.useDict('safety_inspection_violation_type', 'review_type', 'safety_inspection_type', 'safety_inspection_check_type')
|
||||
);
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const safetyInspectionList = ref<SafetyInspectionVO[]>([]);
|
||||
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 queryFormRef = ref<ElFormInstance>();
|
||||
const safetyInspectionFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: SafetyInspectionForm = {
|
||||
id: undefined,
|
||||
pid: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
checkType: undefined,
|
||||
violationType: undefined,
|
||||
inspectionResult: undefined,
|
||||
teamId: undefined,
|
||||
correctorId: undefined,
|
||||
rectificationDeadline: undefined,
|
||||
isReply: undefined,
|
||||
replyDate: undefined,
|
||||
status: undefined,
|
||||
hiddenDanger: undefined,
|
||||
measure: undefined,
|
||||
review: undefined,
|
||||
reviewType: undefined,
|
||||
checkTime: undefined,
|
||||
rectificationTime: undefined,
|
||||
reviewTime: undefined,
|
||||
checkFile: undefined,
|
||||
rectificationFile: undefined,
|
||||
remark: undefined
|
||||
};
|
||||
const data = reactive<PageData<SafetyInspectionForm, SafetyInspectionQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
id: undefined,
|
||||
pid: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
checkType: undefined,
|
||||
violationType: undefined,
|
||||
inspectionResult: undefined,
|
||||
teamId: undefined,
|
||||
correctorId: undefined,
|
||||
isReply: undefined,
|
||||
replyDate: undefined,
|
||||
status: undefined,
|
||||
hiddenDanger: undefined,
|
||||
measure: undefined,
|
||||
review: undefined,
|
||||
reviewType: undefined,
|
||||
checkTime: undefined,
|
||||
rectificationTime: undefined,
|
||||
reviewTime: undefined,
|
||||
remark: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }],
|
||||
projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }],
|
||||
checkType: [{ required: true, message: '检查类型不能为空', trigger: 'blur' }],
|
||||
violationType: [{ required: true, message: '违章类型不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
const teamOpt = ref([]);
|
||||
const foremanOpt = ref([]);
|
||||
const teamList = ref<ProjectTeamForemanResp[]>();
|
||||
/** 查询安全巡检工单列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listSafetyInspection(queryParams.value);
|
||||
safetyInspectionList.value = res.rows;
|
||||
total.value = res.total;
|
||||
// 获取项目班组信息
|
||||
const teamRes = await listProjectTeamForeman(currentProject.value.id);
|
||||
teamList.value = teamRes.data;
|
||||
teamOpt.value = teamList.value.map((team: ProjectTeamForemanResp) => ({
|
||||
label: team.teamName,
|
||||
value: team.id
|
||||
}));
|
||||
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
const changeForeman = (value: string | number) => {
|
||||
const team = teamList.value.filter((team) => team.id === value)[0];
|
||||
foremanOpt.value = team.foremanList?.map((foreman: foremanQuery) => ({
|
||||
label: foreman.foremanName,
|
||||
value: foreman.foremanId
|
||||
}));
|
||||
form.value.correctorId = '';
|
||||
};
|
||||
|
||||
/** 展开安全巡检工单详情对话框操作 */
|
||||
const currentSafetyInspectionId = ref<string | number>();
|
||||
const showDetailDialog = ref<boolean>(false);
|
||||
const handleShowDialog = (row?: SafetyInspectionVO) => {
|
||||
currentSafetyInspectionId.value = row.id;
|
||||
|
||||
showDetailDialog.value = true;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
safetyInspectionFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: SafetyInspectionVO[]) => {
|
||||
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?: SafetyInspectionVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getSafetyInspection(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改安全巡检工单';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
safetyInspectionFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
form.value.projectId = currentProject.value.id;
|
||||
if (form.value.id) {
|
||||
await updateSafetyInspection(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addSafetyInspection(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: SafetyInspectionVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除安全巡检工单编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delSafetyInspection(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download(
|
||||
'safety/safetyInspection/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`safetyInspection_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
//监听项目id刷新数据
|
||||
const listeningProject = watch(
|
||||
() => currentProject.value.id,
|
||||
(nid, oid) => {
|
||||
queryParams.value.projectId = nid;
|
||||
form.value.projectId = nid;
|
||||
getList();
|
||||
}
|
||||
);
|
||||
|
||||
onUnmounted(() => {
|
||||
listeningProject();
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
103
src/views/safety/safetyLog/component/SafetyLogDetailDialog.vue
Normal file
103
src/views/safety/safetyLog/component/SafetyLogDetailDialog.vue
Normal file
@ -0,0 +1,103 @@
|
||||
<template>
|
||||
<el-card v-loading="loading">
|
||||
<h2 style="text-align: center; margin-top: 5px; font-weight: bold">安全日志</h2>
|
||||
<el-row>
|
||||
<el-col :span="12" style="text-align: left">记录人:{{ safetyLogDetail?.creator?.name }}</el-col>
|
||||
<el-col :span="12" style="text-align: right">记录时间:{{ safetyLogDetail?.createTime }}</el-col>
|
||||
</el-row>
|
||||
<el-descriptions :column="3" border style="margin-top: 8px">
|
||||
<el-descriptions-item label-align="center" width="160px" label="项目名称" :span="3">{{ currentProject?.name }} </el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="发生日期">{{ safetyLogDetail?.dateOfOccurrence }} </el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="气温">
|
||||
<span>最高:{{ safetyLogDetail?.airTemperatureMax }}(℃)</span>
|
||||
<span>最低:{{ safetyLogDetail?.airTemperatureMin }}(℃)</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="气候">
|
||||
<dict-tag :value="safetyLogDetail?.weather" :options="weather_type" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="工程施工部位及施工进展情况" :span="3">
|
||||
{{ safetyLogDetail?.progress }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="当日主要危险性项目作业内容" :span="3">
|
||||
{{ safetyLogDetail?.jobContent }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="施工项目安全教育与安全交底情况" :span="3">
|
||||
{{ safetyLogDetail?.discloseCondition }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="施工作业队伍班前施工安全活动情况" :span="3">
|
||||
{{ safetyLogDetail?.activityCondition }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="现场施工安全巡视与检查情况" :span="3">
|
||||
{{ safetyLogDetail?.examineCondition }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="季节施工防寒、防暑等措施实施情况" :span="3">
|
||||
{{ safetyLogDetail?.implementCondition }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="监理通知有关部门安全检查情况" :span="3">
|
||||
{{ safetyLogDetail?.safetyInspectionCondition }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="停工、加班情况" :span="3">{{ safetyLogDetail?.stoppageOrOvertime }} </el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="其他应记录的安全与文明施工事项" :span="3">
|
||||
{{ safetyLogDetail?.otherCondition }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="附件" :span="3">
|
||||
<el-space direction="vertical">
|
||||
<el-link v-for="item in fileList" :key="item.ossId" :href="`${item.url}`" type="primary" :underline="false" target="_blank">
|
||||
<span> {{ item.originalName }} </span>
|
||||
</el-link>
|
||||
</el-space>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-align="center" label="备注" :span="3">{{ safetyLogDetail?.remark }} </el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { SafetyLogVO } from '@/api/safety/safetyLog/types';
|
||||
import { getSafetyLog } from '@/api/safety/safetyLog';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
import { listByIds } from '@/api/system/oss';
|
||||
import { OssVO } from '@/api/system/oss/types';
|
||||
|
||||
interface Props {
|
||||
safetyLogId?: string | number;
|
||||
}
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { weather_type } = toRefs<any>(proxy?.useDict('weather_type'));
|
||||
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const props = defineProps<Props>();
|
||||
const loading = ref<boolean>(false);
|
||||
const safetyLogDetail = ref<SafetyLogVO>();
|
||||
const fileList = ref<Array<OssVO>>([]);
|
||||
const get = async () => {
|
||||
loading.value = true;
|
||||
const res = await getSafetyLog(props.safetyLogId);
|
||||
if (res.data && res.code === 200) {
|
||||
safetyLogDetail.value = res.data;
|
||||
if (res.data.fileId) {
|
||||
const fileRes = await listByIds(res.data.fileId.split(','));
|
||||
fileList.value = fileRes.data;
|
||||
}
|
||||
}
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
get();
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.safetyLogId,
|
||||
(newId, oldId) => {
|
||||
if (newId !== oldId) {
|
||||
fileList.value = undefined;
|
||||
get();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
336
src/views/safety/safetyLog/index.vue
Normal file
336
src/views/safety/safetyLog/index.vue
Normal file
@ -0,0 +1,336 @@
|
||||
<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="dateOfOccurrence">
|
||||
<el-date-picker clearable v-model="queryParams.dateOfOccurrence" type="date" value-format="YYYY-MM-DD" placeholder="请选择发生日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="录入人" prop="creatorName">
|
||||
<el-input clearable v-model="queryParams.creatorName" 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="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['safety:safetyLog:add']">新增 </el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['safety:safetyLog:remove']">
|
||||
批量删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['safety:safetyLog:export']">导出 </el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="safetyLogList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" type="index" width="60" align="center" />
|
||||
<el-table-column label="日志名称" align="center">
|
||||
<template #default="scope">
|
||||
<span>{{ dayjs(scope.row.dateOfOccurrence).format('YYYY 年 MM 月 DD 日') }}安全日志</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="发生日期" align="center" prop="dateOfOccurrence" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.dateOfOccurrence, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="录入时间" align="center" prop="createTime" />
|
||||
<el-table-column label="录入人" align="center" prop="creatorName" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-space>
|
||||
<el-button link type="primary" icon="View" @click="handleShowDialog(scope.row)" v-hasPermi="['safety:safetyLog:query']">
|
||||
详情
|
||||
</el-button>
|
||||
<!-- <el-button link type="success" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['safety:safetyLog:edit']"> 修改 </el-button> -->
|
||||
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['safety:safetyLog:remove']"> 删除 </el-button>
|
||||
</el-space>
|
||||
</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="950px" append-to-body>
|
||||
<el-form ref="safetyLogFormRef" :model="form" :rules="rules" label-width="250px">
|
||||
<el-form-item label="发生日期" prop="dateOfOccurrence">
|
||||
<el-date-picker clearable v-model="form.dateOfOccurrence" type="date" value-format="YYYY-MM-DD" placeholder="请选择发生日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="最高气温" prop="airTemperatureMax">
|
||||
<el-input v-model="form.airTemperatureMax" placeholder="请输入最高气温" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最低气温" prop="airTemperatureMin">
|
||||
<el-input v-model="form.airTemperatureMin" placeholder="请输入最低气温" />
|
||||
</el-form-item>
|
||||
<el-form-item label="气候" prop="weather">
|
||||
<el-select v-model="form.weather" placeholder="请选择气候">
|
||||
<el-option v-for="dict in weather_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工程施工部位及施工进展情况" prop="progress">
|
||||
<el-input v-model="form.progress" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="当日主要危险性项目作业内容">
|
||||
<editor v-model="form.jobContent" :min-height="192" />
|
||||
</el-form-item>
|
||||
<el-form-item label="施工项目安全教育与安全交底情况">
|
||||
<editor v-model="form.discloseCondition" :min-height="192" />
|
||||
</el-form-item>
|
||||
<el-form-item label="施工作业队伍班前施工安全活动情况">
|
||||
<editor v-model="form.activityCondition" :min-height="192" />
|
||||
</el-form-item>
|
||||
<el-form-item label="现场施工安全巡视与检查情况">
|
||||
<editor v-model="form.examineCondition" :min-height="192" />
|
||||
</el-form-item>
|
||||
<el-form-item label="季节施工防寒、防暑等措施实施情况">
|
||||
<editor v-model="form.implementCondition" :min-height="192" />
|
||||
</el-form-item>
|
||||
<el-form-item label="监理通知有关部门安全检查情况">
|
||||
<editor v-model="form.safetyInspectionCondition" :min-height="192" />
|
||||
</el-form-item>
|
||||
<el-form-item label="停工、加班情况">
|
||||
<editor v-model="form.stoppageOrOvertime" :min-height="192" />
|
||||
</el-form-item>
|
||||
<el-form-item label="其他应记录的安全与文明施工事项">
|
||||
<editor v-model="form.otherCondition" :min-height="192" />
|
||||
</el-form-item>
|
||||
<el-form-item label="附件" prop="fileId">
|
||||
<file-upload v-model="form.fileId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" 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">
|
||||
<safety-log-detail-dialog :safety-log-id="currentSafetyLogId" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="SafetyLog" lang="ts">
|
||||
import { addSafetyLog, delSafetyLog, getSafetyLog, listSafetyLog, updateSafetyLog } from '@/api/safety/safetyLog';
|
||||
import { SafetyLogForm, SafetyLogQuery, SafetyLogVO } from '@/api/safety/safetyLog/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
import dayjs from 'dayjs';
|
||||
import SafetyLogDetailDialog from '@/views/safety/safetyLog/component/SafetyLogDetailDialog.vue';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { weather_type } = toRefs<any>(proxy?.useDict('weather_type'));
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const safetyLogList = ref<SafetyLogVO[]>([]);
|
||||
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 queryFormRef = ref<ElFormInstance>();
|
||||
const safetyLogFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: SafetyLogForm = {
|
||||
id: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
dateOfOccurrence: undefined,
|
||||
airTemperatureMax: undefined,
|
||||
airTemperatureMin: undefined,
|
||||
weather: undefined,
|
||||
progress: undefined,
|
||||
jobContent: undefined,
|
||||
discloseCondition: undefined,
|
||||
activityCondition: undefined,
|
||||
examineCondition: undefined,
|
||||
implementCondition: undefined,
|
||||
safetyInspectionCondition: undefined,
|
||||
stoppageOrOvertime: undefined,
|
||||
otherCondition: undefined,
|
||||
fileId: undefined,
|
||||
creatorName: undefined,
|
||||
remark: undefined
|
||||
};
|
||||
const data = reactive<PageData<SafetyLogForm, SafetyLogQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
projectId: currentProject.value.id,
|
||||
dateOfOccurrence: undefined,
|
||||
airTemperatureMax: undefined,
|
||||
airTemperatureMin: undefined,
|
||||
weather: undefined,
|
||||
progress: undefined,
|
||||
jobContent: undefined,
|
||||
discloseCondition: undefined,
|
||||
activityCondition: undefined,
|
||||
examineCondition: undefined,
|
||||
implementCondition: undefined,
|
||||
safetyInspectionCondition: undefined,
|
||||
stoppageOrOvertime: undefined,
|
||||
otherCondition: undefined,
|
||||
remark: undefined,
|
||||
creatorName: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }],
|
||||
projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询安全日志列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listSafetyLog(queryParams.value);
|
||||
safetyLogList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
safetyLogFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: SafetyLogVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 展开安全日志详情对话框操作 */
|
||||
const currentSafetyLogId = ref<string | number>();
|
||||
const showDetailDialog = ref<boolean>(false);
|
||||
const handleShowDialog = (row?: SafetyLogVO) => {
|
||||
currentSafetyLogId.value = row.id;
|
||||
showDetailDialog.value = true;
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
dialog.title = '添加安全日志';
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: SafetyLogVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getSafetyLog(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改安全日志';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
safetyLogFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
form.value.projectId = currentProject.value.id;
|
||||
if (form.value.id) {
|
||||
await updateSafetyLog(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addSafetyLog(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: SafetyLogVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除安全日志编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delSafetyLog(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download(
|
||||
'safety/safetyLog/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`safetyLog_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
//监听项目id刷新数据
|
||||
const listeningProject = watch(
|
||||
() => currentProject.value.id,
|
||||
(nid, oid) => {
|
||||
queryParams.value.projectId = nid;
|
||||
form.value.projectId = nid;
|
||||
getList();
|
||||
}
|
||||
);
|
||||
|
||||
onUnmounted(() => {
|
||||
listeningProject();
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
284
src/views/safety/safetyWeeklyReport/index.vue
Normal file
284
src/views/safety/safetyWeeklyReport/index.vue
Normal file
@ -0,0 +1,284 @@
|
||||
<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="scope">
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="queryParams.scopeDate"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-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="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['safety:safetyWeeklyReport:add']">新增 </el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete()"
|
||||
v-hasPermi="['safety:safetyWeeklyReport:remove']"
|
||||
>
|
||||
批量删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['safety:safetyWeeklyReport:export']">导出 </el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="safetyWeeklyReportList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" type="index" width="60" align="center" />
|
||||
<el-table-column label="周期" align="center" prop="week" />
|
||||
<el-table-column label="周期范围" align="center" prop="scope" width="260">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.scope, '{y}-{m}-{d}') }} 至 {{ parseTime(scope.row.scopeEnd, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-space>
|
||||
<el-button link type="success" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['safety:safetyWeeklyReport:edit']">
|
||||
修改
|
||||
</el-button>
|
||||
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['safety:safetyWeeklyReport:remove']">
|
||||
删除
|
||||
</el-button>
|
||||
</el-space>
|
||||
</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="safetyWeeklyReportFormRef" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="周期" prop="week">
|
||||
<el-input v-model="form.week" placeholder="请输入周期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="周期开始范围" prop="scope">
|
||||
<el-date-picker clearable v-model="form.scope" type="date" value-format="YYYY-MM-DD" placeholder="请选择周期范围" />
|
||||
</el-form-item>
|
||||
<el-form-item label="周期范围结束" prop="scopeEnd">
|
||||
<el-date-picker clearable v-model="form.scopeEnd" type="date" value-format="YYYY-MM-DD" placeholder="请选择周期范围结束" />
|
||||
</el-form-item>
|
||||
<el-form-item label="文件位置" prop="path">
|
||||
<div><file-upload v-model="form.path" :file-size="20" :limit="1" :file-type="['doc', 'docx']" /></div>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" 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>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="SafetyWeeklyReport" lang="ts">
|
||||
import {
|
||||
addSafetyWeeklyReport,
|
||||
delSafetyWeeklyReport,
|
||||
getSafetyWeeklyReport,
|
||||
listSafetyWeeklyReport,
|
||||
updateSafetyWeeklyReport
|
||||
} from '@/api/safety/safetyWeeklyReport';
|
||||
import { SafetyWeeklyReportForm, SafetyWeeklyReportQuery, SafetyWeeklyReportVO } from '@/api/safety/safetyWeeklyReport/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const safetyWeeklyReportList = ref<SafetyWeeklyReportVO[]>([]);
|
||||
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 queryFormRef = ref<ElFormInstance>();
|
||||
const safetyWeeklyReportFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: SafetyWeeklyReportForm = {
|
||||
id: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
week: undefined,
|
||||
scope: undefined,
|
||||
scopeEnd: undefined,
|
||||
path: undefined,
|
||||
remark: undefined
|
||||
};
|
||||
const data = reactive<PageData<SafetyWeeklyReportForm, SafetyWeeklyReportQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
id: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
week: undefined,
|
||||
scopeDate: undefined,
|
||||
remark: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }],
|
||||
projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询安全周报列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listSafetyWeeklyReport(queryParams.value);
|
||||
safetyWeeklyReportList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
safetyWeeklyReportFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: SafetyWeeklyReportVO[]) => {
|
||||
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?: SafetyWeeklyReportVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getSafetyWeeklyReport(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改安全周报';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
safetyWeeklyReportFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
form.value.projectId = currentProject.value.id;
|
||||
if (form.value.id) {
|
||||
await updateSafetyWeeklyReport(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addSafetyWeeklyReport(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: SafetyWeeklyReportVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除安全周报编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delSafetyWeeklyReport(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download(
|
||||
'safety/safetyWeeklyReport/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`safetyWeeklyReport_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
//监听项目id刷新数据
|
||||
const listeningProject = watch(
|
||||
() => currentProject.value.id,
|
||||
(nid, oid) => {
|
||||
queryParams.value.projectId = nid;
|
||||
form.value.projectId = nid;
|
||||
getList();
|
||||
}
|
||||
);
|
||||
|
||||
onUnmounted(() => {
|
||||
listeningProject();
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-descriptions v-loading="loading" :column="2">
|
||||
<el-descriptions-item :span="2" label="宣讲人">{{ teamMeetingDetail?.compereName }}</el-descriptions-item>
|
||||
<el-descriptions-item :span="2" label="参与人">
|
||||
<span :key="item.id" v-for="item in teamMeetingDetail?.participantList">{{ item.name }},</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="班组名称">{{ teamMeetingDetail?.teamName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="施工单位">{{ teamMeetingDetail?.contractorName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="开会时间">{{ dayjs(teamMeetingDetail?.meetingDate).format('YYYY 年 MM 月 DD 日') }}</el-descriptions-item>
|
||||
<el-descriptions-item label="上传时间">{{ teamMeetingDetail?.createTime }}</el-descriptions-item>
|
||||
<el-descriptions-item :span="2" label="班会内容">{{ teamMeetingDetail?.content }}</el-descriptions-item>
|
||||
<el-descriptions-item :span="2" label="班会图片">
|
||||
<el-space wrap>
|
||||
<span :key="item" v-for="item in teamMeetingDetail?.pictureUrlList">
|
||||
<image-preview :src="item" width="200px" />
|
||||
</span>
|
||||
</el-space>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getTeamMeeting } from '@/api/safety/teamMeeting';
|
||||
import { TeamMeetingVO } from '@/api/safety/teamMeeting/types';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
interface Props {
|
||||
teamMeetingId?: string | number;
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
const loading = ref<boolean>(false);
|
||||
const teamMeetingDetail = ref<TeamMeetingVO>();
|
||||
const get = async () => {
|
||||
loading.value = true;
|
||||
const res = await getTeamMeeting(props.teamMeetingId);
|
||||
if (res.data && res.code === 200) {
|
||||
teamMeetingDetail.value = res.data;
|
||||
}
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
get();
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.teamMeetingId,
|
||||
(newId, oldId) => {
|
||||
if (newId !== oldId) {
|
||||
get();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
288
src/views/safety/teamMeeting/index.vue
Normal file
288
src/views/safety/teamMeeting/index.vue
Normal file
@ -0,0 +1,288 @@
|
||||
<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="meetingDate">
|
||||
<el-date-picker clearable v-model="queryParams.meetingDate" 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="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['safety:teamMeeting:add']"> 新增 </el-button>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['safety:teamMeeting:remove']">
|
||||
删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['safety:teamMeeting:export']">导出 </el-button>
|
||||
</el-col> -->
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="teamMeetingList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" type="index" width="60" align="center" />
|
||||
<el-table-column label="宣讲人" align="center" prop="compereName" />
|
||||
<el-table-column label="施工单位" align="center" prop="contractorName" />
|
||||
<el-table-column label="班组名称" align="center" prop="teamName" />
|
||||
<el-table-column label="参与人数" align="center">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.participantList.length + 1 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="开会时间" align="center" prop="meetingDate" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.meetingDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="上传时间" align="center" prop="createTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {hh}:{mm}:{ss}') }}</span>
|
||||
</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-space>
|
||||
<el-button link type="primary" icon="View" @click="handleShowDrawer(scope.row)" v-hasPermi="['safety:teamMeeting:query']">
|
||||
详情
|
||||
</el-button>
|
||||
<!-- <el-button link type="success" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['safety:teamMeeting:edit']"> 修改 </el-button> -->
|
||||
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['safety:teamMeeting:remove']">
|
||||
删除
|
||||
</el-button>
|
||||
</el-space>
|
||||
</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="teamMeetingFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="开会时间" prop="meetingDate">
|
||||
<el-date-picker clearable v-model="form.meetingDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择开会时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="班会内容">
|
||||
<editor v-model="form.content" :min-height="192" />
|
||||
</el-form-item>
|
||||
<el-form-item label="班会图片" prop="picture">
|
||||
<image-upload v-model="form.pictureList" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" 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="showDetailDrawer" width="800px">
|
||||
<team-meeting-detail-drawer :team-meeting-id="currentTeamMeetingId" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="TeamMeeting" lang="ts">
|
||||
import { addTeamMeeting, delTeamMeeting, getTeamMeeting, listTeamMeeting, updateTeamMeeting } from '@/api/safety/teamMeeting';
|
||||
import { TeamMeetingForm, TeamMeetingQuery, TeamMeetingVO } from '@/api/safety/teamMeeting/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
import TeamMeetingDetailDrawer from '@/views/safety/teamMeeting/component/TeamMeetingDetailDrawer.vue';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const teamMeetingList = ref<TeamMeetingVO[]>([]);
|
||||
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 queryFormRef = ref<ElFormInstance>();
|
||||
const teamMeetingFormRef = ref<ElFormInstance>();
|
||||
const currentTeamMeetingId = ref<string | number>(0);
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: TeamMeetingForm = {
|
||||
id: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
teamId: undefined,
|
||||
contractorId: undefined,
|
||||
meetingDate: undefined,
|
||||
compereId: undefined,
|
||||
participantIdList: undefined,
|
||||
content: undefined,
|
||||
pictureList: undefined,
|
||||
remark: undefined
|
||||
};
|
||||
const data = reactive<PageData<TeamMeetingForm, TeamMeetingQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
projectId: currentProject.value.id,
|
||||
teamId: undefined,
|
||||
contractorId: undefined,
|
||||
meetingDate: undefined,
|
||||
compereId: undefined,
|
||||
participantIdList: undefined,
|
||||
content: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }],
|
||||
projectId: [{ required: true, message: '项目id不能为空', trigger: 'change' }],
|
||||
teamId: [{ required: true, message: '班组id不能为空', trigger: 'change' }],
|
||||
contractorId: [{ required: true, message: '分包公司id不能为空', trigger: 'change' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询站班会列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listTeamMeeting(queryParams.value);
|
||||
teamMeetingList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
teamMeetingFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: TeamMeetingVO[]) => {
|
||||
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 showDetailDrawer = ref<boolean>(false);
|
||||
const handleShowDrawer = (row?: TeamMeetingVO) => {
|
||||
currentTeamMeetingId.value = row.id;
|
||||
showDetailDrawer.value = true;
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: TeamMeetingVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getTeamMeeting(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改站班会';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
teamMeetingFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateTeamMeeting(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addTeamMeeting(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: TeamMeetingVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除站班会编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delTeamMeeting(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download(
|
||||
'safety/teamMeeting/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`teamMeeting_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
//监听项目id刷新数据
|
||||
const listeningProject = watch(
|
||||
() => currentProject.value.id,
|
||||
(nid, oid) => {
|
||||
queryParams.value.projectId = nid;
|
||||
form.value.projectId = nid;
|
||||
getList();
|
||||
}
|
||||
);
|
||||
|
||||
onUnmounted(() => {
|
||||
listeningProject();
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
Reference in New Issue
Block a user