pull/1/head
z 2024-01-15 13:51:54 +08:00
parent fef033926e
commit fee5d6f786
11 changed files with 589 additions and 6 deletions

View File

@ -531,6 +531,41 @@ export default [
},
component: "hidden_danger_government/ledger/view",
},
{
path: "/hidden_danger_government/ledger/print",
meta: {
title: "打印",
activeMenu: "/hidden_danger_government/ledger",
},
component: "hidden_danger_government/ledger/print",
},
],
},
],
},
{
path: "/continuous_improvement",
redirect: "/continuous_improvement/hazard_analysis",
meta: { title: "持续改进", model: MODEL["1"] },
component: "children",
children: [
{
path: "/continuous_improvement/hazard_analysis",
meta: { title: "隐患分析", isSubMenu: false },
component: "children",
children: [
{
path: "",
component: "continuous_improvement/hazard_analysis/index",
},
{
path: "/continuous_improvement/hazard_analysis/view",
meta: {
title: "查看",
activeMenu: "/continuous_improvement/hazard_analysis",
},
component: "continuous_improvement/hazard_analysis/view",
},
],
},
],

View File

@ -0,0 +1,45 @@
import { ElLoading, ElMessage } from "element-plus";
import dayjs from "dayjs";
import axios from "axios";
export default function useDownloadBlob(
url,
option = {
name: dayjs().format("YYYY-MM-DD HH:mm:ss"),
type: "application/vnd.ms-excel",
}
) {
return new Promise((resolve, reject) => {
const loading = ElLoading.service({
lock: true,
text: "加载中...",
background: "rgba(0, 0, 0, 0.5)",
});
axios
.get(url, { responseType: "blob" })
.then((resData) => {
if (resData.data.type === "application/json") {
throw new Error("导出失败");
}
const blob = new Blob([resData.data], {
type: option.type,
});
const downloadElement = document.createElement("a");
const href = window.URL.createObjectURL(blob);
downloadElement.style.display = "none";
downloadElement.href = href;
downloadElement.download = option.name;
document.body.appendChild(downloadElement);
downloadElement.click();
document.body.removeChild(downloadElement);
window.URL.revokeObjectURL(href);
loading.close();
resolve(resData);
})
.catch((err) => {
ElMessage.error("导出失败");
loading.close();
reject(err);
});
});
}

View File

@ -46,7 +46,6 @@ axios.interceptors.response.use(
return config;
},
(error) => {
console.log(error);
if (error && error.response) {
switch (error.response.status) {
case 0:

View File

@ -13,3 +13,5 @@ export const setHiddenDangerCancelMajorHazards = (params) =>
post("/hidden/editHIDDENLEVEL", params); // 重大隐患管理取消重大隐患
export const setHiddenDangerConfirmMajorHazards = (params) =>
post("/hidden/editISCONFIRM", params); // 重大隐患管理确认重大隐患
export const getHiddenDangerPrintList = (params) =>
post("/hidden/listAllToPrint", params); // 隐患打印列表

View File

@ -0,0 +1,172 @@
<template>
<div>
<el-card>
<el-form
:model="searchForm"
label-width="100px"
@submit.prevent="fnResetPaginationTransfer"
>
<el-row>
<el-col :span="6">
<el-form-item label="隐患描述" prop="KEYWORDS">
<el-input v-model="searchForm.KEYWORDS" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="发现日期" prop="dates">
<el-date-picker
v-model="searchForm.dates"
type="daterange"
value-format="YYYY-MM-DD"
format="YYYY-MM-DD"
range-separator="至"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="隐患发现人" prop="CREATORNAME">
<el-input v-model="searchForm.CREATORNAME" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="部门" prop="DEPTIDS">
<layout-department
v-model="searchForm.DEPTIDS"
multiple
show-checkbox
collapse-tags
root-disabled="Y"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="隐患级别" prop="HIDDENLEVEL">
<el-select v-model="searchForm.HIDDENLEVEL">
<el-option
v-for="item in hazardLevelList"
:key="item.BIANMA"
:label="item.NAME"
:value="item.BIANMA"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label-width="10px">
<el-button type="primary" native-type="submit">搜索</el-button>
<el-button native-type="reset" @click="fnResetPaginationTransfer">
重置
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<layout-card>
<layout-table
:data="list"
@get-data="fnGetDataTransfer"
v-model:pagination="pagination"
>
<el-table-column label="序号" width="60">
<template #default="{ $index }">
{{ serialNumber(pagination, $index) }}
</template>
</el-table-column>
<el-table-column
prop="HIDDENDESCR"
label="隐患描述"
show-overflow-tooltip
/>
<el-table-column label="隐患处置" width="100">
<template v-slot="{ row }">
<span v-if="row.RECTIFICATIONTYPE === '1'"></span>
<span v-else-if="row.RECTIFICATIONTYPE === '2'">限期整改</span>
</template>
</el-table-column>
<el-table-column prop="HIDDENLEVELNAME" label="隐患级别" width="120" />
<el-table-column label="隐患状态" width="100">
<template v-slot="{ row }">
{{ translationStatus(row.STATE, stateList) }}
</template>
</el-table-column>
<el-table-column prop="CREATTIME" label="发现时间" width="160" />
<el-table-column prop="CREATORNAME" label="发现人" width="100" />
<el-table-column
prop="RECTIFICATIONTIME"
label="整改时间"
width="160"
/>
<el-table-column
prop="RECTIFICATIONORNAME"
label="整改人"
width="100"
/>
<el-table-column label="验收人" width="100">
<template v-slot="{ row }">
<span v-if="row.RECTIFICATIONTYPE === '2'">
{{ row.CHECKNAME }}
</span>
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template #default="{ row }">
<el-button
type="primary"
text
link
@click="
router.push({
path: '/continuous_improvement/hazard_analysis/view',
query: { HIDDEN_ID: row.HIDDEN_ID },
})
"
>
查看
</el-button>
<el-button type="primary" text link> 分析 </el-button>
</template>
</el-table-column>
</layout-table>
</layout-card>
</div>
</template>
<script setup>
import { useRouter } from "vue-router";
import { serialNumber, translationStatus } from "@/assets/js/utils";
import useListData from "@/assets/js/useListData.js";
import LayoutDepartment from "@/components/department/index.vue";
import { getHiddenDangerList } from "@/request/hidden_danger_government.js";
import { layoutFnGetHazardLevel } from "@/assets/js/data_dictionary.js";
const stateList = [
{ NAME: "未整改", ID: "1" },
{ NAME: "已整改", ID: "2" },
{ NAME: "已整改", ID: "3" },
{ NAME: "已验收", ID: "4" },
{ NAME: "已过期", ID: "-1" },
];
const router = useRouter();
const { list, pagination, searchForm, fnGetData, fnResetPagination } =
useListData(getHiddenDangerList, {
otherParams: { STATE: 4, DISPOSESTATE: "-1", ANALYSIS: 1 },
});
const fnGetDataTransfer = () => {
fnGetData({
STARTTIME: searchForm.value.dates?.[0],
ENDTIME: searchForm.value.dates?.[1],
DEPTIDS: searchForm.value.DEPTIDS?.join(","),
});
};
const fnResetPaginationTransfer = () => {
fnResetPagination({
STARTTIME: searchForm.value.dates?.[0],
ENDTIME: searchForm.value.dates?.[1],
DEPTIDS: searchForm.value.DEPTIDS?.join(","),
});
};
const hazardLevelList = await layoutFnGetHazardLevel();
</script>
<style scoped></style>

View File

@ -0,0 +1,9 @@
<template>
<hidden-view print />
</template>
<script setup>
import HiddenView from "@/views/hazard_investigation/checklist_inspection_status/hidden_danger_view.vue";
</script>
<style scoped lang="scss"></style>

View File

@ -194,7 +194,7 @@
</template>
</el-descriptions>
</template>
<template v-if="data.info.STATE >= 4">
<template v-if="data.info.STATE >= 4 && data.checkList.length > 0">
<el-divider content-position="left">验收信息</el-divider>
<template v-for="(item, index) in data.checkList" :key="index">
<el-descriptions :column="1" border class="mt-10">

View File

@ -66,8 +66,6 @@ const { list } = useListData(getInventoryManagementView, {
info.value = resData.pd;
},
});
console.log(list);
console.log(info);
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,169 @@
<template>
<el-dialog v-model="visible" title="导出" :on-close="fnClose">
<el-checkbox
:indeterminate="isIndeterminate"
v-model="checkAll"
@change="fnCheckAllChange"
>
全选
</el-checkbox>
<el-checkbox v-model="havePicture">
导出带图片的excel(最多10条)
</el-checkbox>
<el-divider />
<el-checkbox-group v-model="checkOptions" @change="fnCheckedChange">
<el-row>
<el-col v-for="(item, index) in options" :span="4" :key="index">
<el-checkbox :label="item" :value="item" />
</el-col>
</el-row>
</el-checkbox-group>
<template #footer>
<el-button @click="fnClose"> </el-button>
<el-button type="primary" @click="fnSubmit"> </el-button>
</template>
</el-dialog>
</template>
<script setup>
import { useVModel } from "@vueuse/core";
import { ref } from "vue";
import { debounce } from "throttle-debounce";
import dayjs from "dayjs";
import { ElMessage } from "element-plus";
import useDownloadBlob from "@/assets/js/useDownloadBlob.js";
import QS from "qs";
const props = defineProps({
visible: {
type: Boolean,
required: true,
default: false,
},
searchForm: {
type: Object,
required: true,
default: () => {},
},
ids: {
type: Array,
required: true,
default: () => [],
},
});
const emits = defineEmits(["update:visible"]);
const visible = useVModel(props, "visible", emits);
const options = [
"隐患来源",
"风险点(单元)",
"辨识部位",
"存在风险",
"风险分级",
"检查内容",
"隐患级别",
"隐患状态",
"隐患描述",
"隐患部位",
"隐患发现部门",
"发现人",
"发现时间",
"整改类型",
"整改期限",
"隐患图片",
"整改描述",
"整改部门",
"整改人",
"整改时间",
"整改后图片",
"整改方案",
"排查日期",
"隐患清单",
"治理标准要求",
"治理方法",
"经费和物资的落实",
"负责治理人员",
"工时安排",
"时限要求",
"工作要求",
"其他事项",
"方案图片",
"验收描述",
"是否合格",
"验收部门",
"验收人",
"验收时间",
"验收图片",
];
const checkAll = ref(true);
const isIndeterminate = ref(false);
const checkOptions = ref(options);
const havePicture = ref(false);
const fnCheckAllChange = (val) => {
checkOptions.value = val ? options : [];
isIndeterminate.value = false;
};
const fnCheckedChange = (value) => {
const checkedCount = value.length;
checkAll.value = checkedCount === options.length;
isIndeterminate.value = checkedCount > 0 && checkedCount < options.length;
};
const fnClose = () => {
visible.value = false;
checkOptions.value = options;
isIndeterminate.value = false;
checkAll.value = true;
havePicture.value = false;
};
const fnSubmit = debounce(
1000,
() => {
let data = {
havePicture: havePicture.value ? "1" : "0",
options: JSON.stringify(checkOptions.value),
};
if (havePicture.value) {
const ids = props.ids;
if (ids.length === 0) {
ElMessage.warning("请选择要导出的数据");
return;
}
if (ids.length > 10) {
ElMessage.warning("选择的数据超过10条");
return;
}
data = {
...data,
hiddenIds: ids.join(","),
};
} else {
const searchForm = props.searchForm;
if (!searchForm.dates || searchForm.dates.length < 2) {
ElMessage.warning("请选择发现日期");
return;
}
if (
dayjs(searchForm.dates[1]).diff(dayjs(searchForm.dates[0]), "days") > 30
) {
ElMessage.warning("开始日期与结束日期间最多间隔30天");
return;
}
data = {
...data,
KEYWORDS: searchForm.KEYWORDS,
DISPOSESTATE: "-1",
STATE: searchForm.STATE,
STARTTIME: searchForm.dates[0],
ENDTIME: searchForm.dates[1],
DEPTIDS: searchForm.DEPTIDS,
ISQUALIFIED: searchForm.ISQUALIFIED,
HIDDENLEVEL: "hiddenLevel0001",
IS_SELF: "0",
};
}
useDownloadBlob("/hidden/excel" + "?" + QS.stringify(data));
},
{ atBegin: true }
);
</script>
<style scoped lang="scss"></style>

View File

@ -61,8 +61,8 @@
</el-col>
<el-col :span="12">
<el-form-item label-width="10px" class="end">
<el-button>打印</el-button>
<el-button> 导出 </el-button>
<el-button @click="fnPrint"></el-button>
<el-button @click="fnExport"></el-button>
</el-form-item>
</el-col>
</el-row>
@ -157,6 +157,11 @@
</template>
</layout-table>
</layout-card>
<export-excel
v-model:visible="data.exportExcelDialog.visible"
:search-form="searchForm"
:ids="data.exportExcelDialog.ids"
/>
</div>
</template>
@ -170,6 +175,8 @@ import useButtonJurisdiction from "@/assets/js/useButtonJurisdiction.js";
import useListData from "@/assets/js/useListData.js";
import LayoutDepartment from "@/components/department/index.vue";
import { getHiddenDangerList } from "@/request/hidden_danger_government.js";
import ExportExcel from "./components/export_excel.vue";
import { reactive } from "vue";
const stateList = [
{ NAME: "未整改", ID: "1" },
@ -178,6 +185,12 @@ const stateList = [
{ NAME: "已过期", ID: "-1" },
];
const router = useRouter();
const data = reactive({
exportExcelDialog: {
visible: false,
ids: [],
},
});
const { list, pagination, searchForm, fnGetData, fnResetPagination, tableRef } =
useListData(getHiddenDangerList, {
otherParams: {
@ -211,6 +224,23 @@ const fnDelete = debounce(
},
{ atBegin: true }
);
const fnPrint = () => {
const selectionData = tableRef.value.getSelectionRows();
if (selectionData.length === 0) {
ElMessage.warning("请选择需要打印的数据");
return;
}
const DATA_IDS = selectionData.map((item) => item.HIDDEN_ID).join(",");
router.push({
path: "/hidden_danger_government/ledger/print",
query: { DATA_IDS },
});
};
const fnExport = () => {
const selectionData = tableRef.value.getSelectionRows();
data.exportExcelDialog.ids = selectionData.map((item) => item.HIDDEN_ID);
data.exportExcelDialog.visible = true;
};
</script>
<style scoped></style>

View File

@ -0,0 +1,124 @@
<template>
<layout-card>
<div id="printContent">
<el-divider content-position="left">隐患台账</el-divider>
<div class="print_no_use">
<layout-table :data="list" :show-pagination="false">
<el-table-column type="index" label="序号" width="60" />
<el-table-column prop="CREATTIME" label="排查时间" width="90" />
<el-table-column prop="CREATORNAME" label="检查人" width="80" />
<el-table-column
prop="HIDDENFINDDEPTNAME"
label="责任部门"
width="90"
/>
<el-table-column prop="HIDDENDESCR" label="事故隐患" width="90" />
<el-table-column prop="HIDDENLEVELNAME" label="隐患等级" width="90" />
<el-table-column prop="RECTIFYDESCR" label="治理措施" />
<el-table-column label="完成时限" width="90">
<template v-slot="{ row }">
{{
row.RECTIFICATIONTYPE === "1"
? dayjs(row.CREATTIME).format("YYYY-MM-DD")
: row.RECTIFICATIONDEADLINE
}}
</template>
</el-table-column>
<el-table-column
prop="RECTIFICATIONORNAME"
label="整改责任人"
width="110"
/>
<el-table-column label="验收人员" width="90">
<template v-slot="{ row }">
{{ row.RECTIFICATIONTYPE === "1" ? "立即整改" : row.CHECKNAME }}
</template>
</el-table-column>
<el-table-column label="验收时间" width="90">
<template v-slot="{ row }">
{{
row.RECTIFICATIONTYPE === "1"
? dayjs(row.CREATTIME).format("YYYY-MM-DD")
: row.CHECK_TIME
}}
</template>
</el-table-column>
<el-table-column label="验收结果" width="90">
<template v-slot="{ row }">
{{ row.STATE === "4" ? "验收通过" : "" }}
</template>
</el-table-column>
</layout-table>
</div>
<table class="print_use">
<thead>
<tr>
<th width="60">序号</th>
<th width="90">排查时间</th>
<th width="80">检查人</th>
<th width="90">责任部门</th>
<th width="90">事故隐患</th>
<th width="90">隐患等级</th>
<th>治理措施</th>
<th width="90">完成时限</th>
<th width="110">整改责任人</th>
<th width="90">验收人员</th>
<th width="90">验收时间</th>
<th width="90">验收结果</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in list" :key="index">
<td>{{ index + 1 }}</td>
<td>{{ item.CREATTIME }}</td>
<td>{{ item.CREATORNAME }}</td>
<td>{{ item.HIDDENFINDDEPTNAME }}</td>
<td>{{ item.HIDDENDESCR }}</td>
<td>{{ item.HIDDENLEVELNAME }}</td>
<td>{{ item.RECTIFYDESCR }}</td>
<td>
{{
item.RECTIFICATIONTYPE === "1"
? dayjs(item.CREATTIME).format("YYYY-MM-DD")
: item.RECTIFICATIONDEADLINE
}}
</td>
<td>{{ item.RECTIFICATIONORNAME }}</td>
<td>
{{ item.RECTIFICATIONTYPE === "1" ? "立即整改" : item.CHECKNAME }}
</td>
<td>
{{
item.RECTIFICATIONTYPE === "1"
? dayjs(item.CREATTIME).format("YYYY-MM-DD")
: item.CHECK_TIME
}}
</td>
<td>{{ item.STATE === "4" ? "验收通过" : "" }}</td>
</tr>
</tbody>
</table>
</div>
<div class="tc mt-10">
<el-button type="primary" v-print="'#printContent'"></el-button>
</div>
<div v-html="PRINT_STYLE" />
</layout-card>
</template>
<script setup>
import useListData from "@/assets/js/useListData.js";
import { getHiddenDangerPrintList } from "@/request/hidden_danger_government.js";
import { useRoute } from "vue-router";
import dayjs from "dayjs";
import { PRINT_STYLE } from "@/assets/js/constant.js";
const route = useRoute();
const { DATA_IDS } = route.query;
const { list } = useListData(getHiddenDangerPrintList, {
otherParams: { ids: DATA_IDS },
usePagination: false,
});
</script>
<style scoped lang="scss"></style>