integrated_traffic_vue/src/views/hidden_danger_government/ledger/index.vue

259 lines
8.2 KiB
Vue
Raw Normal View History

2024-01-13 17:35:14 +08:00
<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="STATE">
<el-select v-model="searchForm.STATE">
<el-option
v-for="item in stateList"
:key="item.ID"
:label="item.NAME"
:value="item.ID"
/>
</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-col :span="12">
<el-form-item label-width="10px" class="end">
2024-01-15 13:51:54 +08:00
<el-button @click="fnPrint"></el-button>
<el-button @click="fnExport"></el-button>
2024-01-13 17:35:14 +08:00
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<layout-card>
<layout-table
ref="tableRef"
2024-02-21 09:42:49 +08:00
v-model:pagination="pagination"
:data="list"
2024-01-13 17:35:14 +08:00
row-key="HIDDEN_ID"
2024-02-21 09:42:49 +08:00
@get-data="fnGetDataTransfer"
2024-01-13 17:35:14 +08:00
>
<el-table-column reserve-selection type="selection" width="55" />
<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">
2024-02-21 09:42:49 +08:00
<template #default="{ row }">
2024-01-13 17:35:14 +08:00
<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">
2024-02-21 09:42:49 +08:00
<template #default="{ row }">
2024-01-13 17:35:14 +08:00
{{ 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">
2024-02-21 09:42:49 +08:00
<template #default="{ row }">
2024-01-13 17:35:14 +08:00
<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: '/hidden_danger_government/ledger/view',
2024-02-21 16:14:40 +08:00
query: {
HIDDEN_ID: row.HIDDEN_ID,
LIST_TYPE: row.LIST_TYPE,
},
2024-01-13 17:35:14 +08:00
})
"
>
查看
</el-button>
<el-button
v-if="buttonJurisdiction.del"
type="primary"
text
link
2024-02-21 16:14:40 +08:00
@click="fnDelete(row.HIDDEN_ID, row.LIST_TYPE)"
2024-01-13 17:35:14 +08:00
>
删除
</el-button>
</template>
</el-table-column>
<template #button>
<el-button
v-if="buttonJurisdiction.add"
type="primary"
@click="
router.push({ path: '/hidden_danger_government/ledger/add' })
"
>
新增
</el-button>
</template>
</layout-table>
</layout-card>
2024-01-15 13:51:54 +08:00
<export-excel
v-model:visible="data.exportExcelDialog.visible"
:search-form="searchForm"
:ids="data.exportExcelDialog.ids"
/>
2024-01-13 17:35:14 +08:00
</div>
</template>
<script setup>
2024-02-22 16:30:07 +08:00
import { useRouter, useRoute } from "vue-router";
2024-01-13 17:35:14 +08:00
import { serialNumber, translationStatus } from "@/assets/js/utils";
2024-02-21 16:14:40 +08:00
import {
setCustomHiddenDangerDelete,
setHiddenDangerDelete,
} from "@/request/hazard_investigation.js";
2024-01-13 17:35:14 +08:00
import { debounce } from "throttle-debounce";
import { ElMessage, ElMessageBox } from "element-plus";
import useButtonJurisdiction from "@/assets/js/useButtonJurisdiction.js";
import useListData from "@/assets/js/useListData.js";
import LayoutDepartment from "@/components/department/index.vue";
2024-02-21 16:14:40 +08:00
import { getHiddenDangerListAll } from "@/request/hidden_danger_government.js";
2024-01-15 13:51:54 +08:00
import ExportExcel from "./components/export_excel.vue";
import { reactive } from "vue";
2024-01-13 17:35:14 +08:00
const stateList = [
{ NAME: "未整改", ID: "1" },
{ NAME: "已整改", ID: "3" },
{ NAME: "已验收", ID: "4" },
{ NAME: "已过期", ID: "-1" },
];
const router = useRouter();
2024-02-22 16:30:07 +08:00
const route = useRoute();
const { STATE } = route.query;
2024-01-15 13:51:54 +08:00
const data = reactive({
exportExcelDialog: {
visible: false,
ids: [],
},
});
2024-01-13 17:35:14 +08:00
const { list, pagination, searchForm, fnGetData, fnResetPagination, tableRef } =
2024-02-21 16:14:40 +08:00
useListData(getHiddenDangerListAll, {
2024-01-13 17:35:14 +08:00
otherParams: {
HIDDENLEVEL: "hiddenLevel0001",
DISPOSESTATE: "-1",
IS_SELF: "0",
2024-02-28 09:02:04 +08:00
STATE: 100,
2024-01-13 17:35:14 +08:00
},
2024-02-22 16:30:07 +08:00
defaultSearchForm: { STATE },
2024-01-13 17:35:14 +08:00
});
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 buttonJurisdiction = await useButtonJurisdiction("hidden");
const fnDelete = debounce(
1000,
2024-02-21 16:14:40 +08:00
async (HIDDEN_ID, LIST_TYPE) => {
2024-01-13 17:35:14 +08:00
await ElMessageBox.confirm("确定要删除吗?", { type: "warning" });
2024-02-21 16:14:40 +08:00
LIST_TYPE === "1"
? await setHiddenDangerDelete({ HIDDEN_ID })
: await setCustomHiddenDangerDelete({ HIDDEN_ID });
2024-01-13 17:35:14 +08:00
ElMessage.success("删除成功");
fnResetPaginationTransfer();
},
{ atBegin: true }
);
2024-01-15 13:51:54 +08:00
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;
};
2024-01-13 17:35:14 +08:00
</script>
<style scoped></style>