BUG 优化

dev
xiepeng 2024-04-09 19:08:35 +08:00
parent ba03a2fa12
commit 680b3cc994
7 changed files with 341 additions and 176 deletions

View File

@ -17,9 +17,15 @@ export const getSecurityNoticeInfo = (params) =>
post("/securitynotice/goEdit", params); // 安全通知详情 post("/securitynotice/goEdit", params); // 安全通知详情
export const addSecurityNotice = (params) => export const addSecurityNotice = (params) =>
upload("/securitynotice/add", params); // 添加安全通知 upload("/securitynotice/add", params); // 添加安全通知
export const editSecurityNotice = (params) =>
upload("/securitynotice/edit", params); // 修改安全通知
export const getUserBuUserId = (params) => export const getUserBuUserId = (params) =>
post("/user/getUserByUserId", params); post("/user/getUserByUserId", params);
export const issueSecurityNotice = (params) =>
post("/securitynotice/issueSecurityNotice", params); // 发布安全通知
// 通知等级 // 通知等级
export const layoutFnGetNotificationsClassification = async () => { export const layoutFnGetNotificationsClassification = async () => {
const resData = await getLevelsByParentId({ const resData = await getLevelsByParentId({

View File

@ -10,7 +10,7 @@
<el-row> <el-row>
<el-col :span="5"> <el-col :span="5">
<el-form-item label="从业人员" prop="USER_ID"> <el-form-item label="从业人员" prop="USER_ID">
<el-select v-model="data.form.USER_ID" placeholder="请选择从业人员"> <el-select v-model="data.form.NAME" placeholder="请选择从业人员">
<el-option <el-option
v-for="item in data.unitsList" v-for="item in data.unitsList"
:key="item.USER_ID" :key="item.USER_ID"

View File

@ -9,14 +9,12 @@
<el-row> <el-row>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="从业人员" prop="USER_ID"> <el-form-item label="从业人员" prop="USER_ID">
<el-select v-model="searchForm.USER_ID"> <el-input
<el-option v-model="searchForm.USER_ID"
v-for="item in data.unitsList" placeholder="请输入从业人员"
:key="item.USER_ID" tabindex="1"
:label="item.NAME" >
:value="item.USER_ID" </el-input>
/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">

View File

@ -74,13 +74,14 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="回复状态" prop="REPLYSTATUS"> <el-form-item label="需要回复" prop="REPLYSTATUS">
<el-switch <el-switch
v-model="data.form.REPLYSTATUS" v-model="data.form.REPLYSTATUS"
inline-prompt
active-text="是"
inactive-text="否"
active-value="1" active-value="1"
inactive-value="0" inactive-value="0"
active-color="#13ce66"
inactive-color="#ff4949"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>

View File

@ -1,155 +1,239 @@
<template> <template>
<div> <layout-card>
<el-card>
<el-form <el-form
:model="searchForm" ref="formRef"
label-width="100px" :model="data.form"
@submit.prevent="searchNotifications" :rules="rules"
label-width="175px"
> >
<el-divider content-position="left">修改</el-divider>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="12">
<el-form-item label="从业人员" prop="PERSON"> <el-form-item label="通知标题" prop="TITLE">
<el-input v-model="searchForm.PERSON" /> <el-input
v-model="data.form.TITLE"
placeholder="请输入内容"
clearable
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="12">
<el-form-item label="从业类型" prop="PRACTITIONERTYPE"> <el-form-item label="通知等级" prop="LEVEL">
<el-select v-model="searchForm.PRACTITIONERTYPE"> <el-select
v-model="data.form.LEVEL"
placeholder="请选择通知等级"
clearable
>
<el-option <el-option
v-for="item in relatedClassificationList" v-for="item in relatedClassificationList"
:key="item.BIANMA" :key="item.BIANMA"
:label="item.name" :label="item.NAME"
:value="item.BIANMA" :value="item.BIANMA"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="24">
<el-form-item label="签收状态" prop="SIGNEDSTATUS"> <el-form-item label="人员选择" prop="PERSON">
<el-select v-model="searchForm.SIGNEDSTATUS"> <div style="flex: 1; display: flex">
<el-option label="已签收" :value="1" /> <el-input
<!-- 1代表已签收 --> v-model="data.form.PERSON"
<el-option label="未签收" :value="0" /> type="textarea"
<!-- 0代表未签收 --> placeholder="请选择人员"
</el-select> disabled
</el-form-item> ></el-input>
</el-col> <el-button
<el-col :span="8"> class="ml-10"
<el-form-item label="回复状态" prop="REPLYSTATUS"> type="primary"
<el-select v-model="searchForm.REPLYSTATUS"> @click="data.SelectPersonDialogVisible = true"
<el-option label="已回复" :value="1" />
<!-- 1代表已回复 -->
<el-option label="未回复" :value="0" />
<!-- 0代表未回复 -->
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item>
<el-button type="primary" native-type="submit">搜索</el-button>
<el-button native-type="reset" @click="resetSearchForm"
>重置</el-button
> >
选择
</el-button>
</div>
</el-form-item>
</el-col>
<el-row>
<el-col :span="12">
<el-form-item label="通知附件" prop="fileList">
<layout-upload
v-model:file-list="data.form.fileList"
accept=".pdf"
delete-to-server
:limit="9"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="通知视频" prop="videoList">
<layout-upload
v-model:file-list="data.form.videoList"
accept=".mp4"
delete-to-server
:limit="9"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="需要回复" prop="REPLYSTATUS">
<el-switch
v-model="data.form.REPLYSTATUS"
inline-prompt
active-text="是"
inactive-text="否"
active-value="1"
inactive-value="0"
/>
</el-form-item>
</el-col>
</el-row>
<el-col :span="24">
<el-form-item label="通知内容" prop="NOTIFICATIONCONTENT">
<layout-editor v-model="data.form.NOTIFICATIONCONTENT" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
</el-card> <div class="tc mt-10">
<layout-card> <el-button type="primary" @click="fnSubmit"> </el-button>
<layout-table
v-model:pagination="pagination"
:data="list"
stripe
border
show-header
@get-data="fnGetData"
>
<el-table-column label="序号" width="60">
<template #default="{ $index }">
{{ serialNumber(pagination, $index) }}
</template>
</el-table-column>
<el-table-column label="从业人员" prop="PERSON" />
<el-table-column label="从业类型" prop="PRACTITIONERTYPE" />
<el-table-column label="签收时间" prop="SIGNEDDATE">
<template #default="{ row }">
<span v-if="row.SIGNEDDATE">{{ row.SIGNEDDATE }}</span>
<el-tag v-else></el-tag>
</template>
</el-table-column>
<el-table-column label="回复时间" prop="REPLYDATE">
<template #default="{ row }">
<span v-if="row.REPLYDATE">{{ row.REPLYDATE }}</span>
<el-tag v-else></el-tag>
</template>
</el-table-column>
<el-table-column label="回复内容" prop="REPLYCONTENT">
<template #default="{ row }">
<span v-if="row.REPLYCONTENT">{{ row.REPLYCONTENT }}</span>
<el-tag v-else></el-tag>
</template>
</el-table-column>
</layout-table>
</layout-card>
</div> </div>
<select-person
v-model:visible="data.SelectPersonDialogVisible"
:list-data="data.listAll"
@submit="fnSelectPersonSubmit"
@submitall="fnSelectAllRiskSubmit"
/>
</layout-card>
</template> </template>
<script setup> <script setup>
import { reactive, onMounted, ref } from "vue";
import { useRoute } from "vue-router";
import { import {
getSecurityNotice, layoutFnGetNotificationsClassification,
layoutFnGetSIGNEDSTATUSClassification, editSecurityNotice,
getSecurityNoticeInfo
} from "@/request/safety_production_related.js"; } from "@/request/safety_production_related.js";
import { serialNumber } from "@/assets/js/utils"; import { onMounted, reactive, ref } from "vue";
import useListData from "@/assets/js/useListData"; import LayoutUpload from "@/components/upload/index.vue";
import LayoutEditor from "@/components/editor/index.vue";
import SelectPerson from "./components/select_person.vue";
import useFormValidate from "@/assets/js/useFormValidate.js";
import { ElMessage } from "element-plus";
import { getSecurityPerson } from "@/request/waybill_registration.js";
import { useRoute, useRouter } from "vue-router";
import { addingPrefixToFile } from "@/assets/js/utils.js";
const formRef = ref(null);
const route = useRoute(); const route = useRoute();
const NOTIFICATION_ID = route.query.NOTIFICATION_ID; const NOTIFICATION_ID = route.query.NOTIFICATION_ID;
const searchForm = reactive({ const rules = {
PERSON: "", TITLE: [{ required: true, message: "请输入通知标题", trigger: "blur" }],
PRACTITIONERTYPE: "", LEVEL: [{ required: true, message: "请选择通知等级", trigger: "blur" }],
SIGNEDSTATUS: null, PERSON: [{ required: true, message: "请选择通知人员", trigger: "blur" }],
REPLYSTATUS: null, NOTIFICATIONCONTENT: [
}); { required: true, message: "请输入通知内容", trigger: "blur" },
const { list, pagination, fnGetData, fnResetPagination } = useListData(
getSecurityNotice,
{ {
searchForm, validator: (rule, value, callback) => {
otherParams: { NOTIFICATION_ID }, if (value === "<p><br></p>") callback(new Error("请输入通知内容"));
usePagination: true, else callback();
} },
); trigger: "blur",
},
async function searchNotifications() { ],
const params = Object.keys(searchForm).reduce((acc, key) => { };
acc[key] = searchForm[key]; const relatedClassificationTempList =
return acc; await layoutFnGetNotificationsClassification();
}, {}); const relatedClassificationList = [];
JSON.parse(relatedClassificationTempList.value.zTreeNodes).forEach((e) => {
params.NOTIFICATION_ID = NOTIFICATION_ID; relatedClassificationList.push({ name: e.id, BIANMA: e.name });
await fnGetData(params); });
} const router = useRouter();
const data = reactive({
// form: {
function resetSearchForm() { TITLE: "",
Object.keys(searchForm).forEach((key) => { TRANSPORTATIONCOMPANY: "",
searchForm[key] = ""; LEVEL: "",
PERSON: "",
fileList: [],
videoList: [],
NOTIFICATIONCONTENT: "",
allStatus: 0, //
REPLYSTATUS: "",
personList: [],
},
}); });
fnResetPagination({ NOTIFICATION_ID });
}
const relatedClassificationList = ref(null);
onMounted(async () => { onMounted(async () => {
const data = await layoutFnGetSIGNEDSTATUSClassification(); await fnPerson();
relatedClassificationList.value = JSON.parse(data.value.zTreeNodes);
}); });
// onMounted(() => { const fnPerson = async () => {
// fnGetData({ NOTIFICATION_ID }); const resData = await getSecurityPerson({});
// }); data.personList = [resData.pd];
};
const fnSubmit = async () => {
await useFormValidate(formRef);
const formData = new FormData();
Object.keys(data.form).forEach((key) => {
if (key !== "fileList" && key !== "videoList" && key !== "PERSON") {
formData.append(key, data.form[key]);
}
});
formData.append("PERSON_ID", data.form.PERSON_ID);
if(data.form.fileList !== "" || data.form.videoList !== "" ) {
data.form.fileList.forEach((file) => {
if (file.raw) {
formData.append("fileList", file.raw);
}
});
data.form.videoList.forEach((file) => {
if (file.raw) {
formData.append("videoList", file.raw);
}
});
}
await editSecurityNotice(formData);
ElMessage({
message: "修改成功",
type: "success",
duration: 3000,
});
router.push("/safety_production_related/security_notice");
};
const fnSelectPersonSubmit = (selectionData) => {
const userIds = selectionData.map((item) => item.USER_ID).join(", ");
const names = selectionData.map((item) => item.NAME).join(", ");
data.form.PERSON_ID = userIds;
data.form.PERSON = names;
};
const fnSelectAllRiskSubmit = (allData) => {
const dataList = allData.value;
const userIds = dataList.map((item) => item.USER_ID).join(", ");
const names = dataList.map((item) => item.NAME).join(", ");
data.form.PERSON_ID = userIds;
data.form.PERSON = names;
data.form.allStatus = 1;
data.form.PERSON = "已全部选择";
};
const fnGetData = async () => {
if (!NOTIFICATION_ID) return;
const resData = await getSecurityNoticeInfo({ NOTIFICATION_ID });
data.form = resData.pd;
data.form.PERSON = resData.names[0].NAME
data.form.fileList = addingPrefixToFile([
{
FILEPATH: data.form.ATTACHMENT_ROUTE
}
]);
data.form.videoList = addingPrefixToFile([
{
FILEPATH: data.form.VIDEO_ROUTE
}
]);
};
fnGetData();
</script> </script>
<style scoped></style> <style scoped lang="scss"></style>

View File

@ -58,16 +58,16 @@
{{ serialNumber(pagination, $index) }} {{ serialNumber(pagination, $index) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="TITLE" label="通知标题" width="350" /> <el-table-column prop="TITLE" label="通知标题" width="400" />
<el-table-column label="通知等级" width="150"> <el-table-column label="通知等级" width="200">
<template #default="{ row }"> <template #default="{ row }">
<el-tag>{{ row.LEVEL }}</el-tag> <el-tag>{{ row.LEVEL }}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="POSTSTATUS" label="发布状态" width="150"> <el-table-column prop="POSTSTATUS" label="发布状态" width="200">
<template #default="{ row }"> <template #default="{ row }">
<el-tag v-if="row.POSTSTATUS === 0"></el-tag> <el-tag v-if="row.POSTSTATUS === '0'" type = "warning "></el-tag>
<el-tag v-else></el-tag> <el-tag v-else type="success">已发布</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="回复情况" width="150"> <el-table-column label="回复情况" width="150">
@ -90,11 +90,38 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="CREATETIME" label="创建时间" width="200" /> <el-table-column prop="CREATETIME" label="创建时间" width="200" />
<el-table-column prop="CORP_NAME" label="运输企业" width="250"> <!-- <el-table-column prop="CORP_NAME" label="运输企业" width="250"/>-->
</el-table-column> <el-table-column label="操作" width="200">
<el-table-column label="操作" width="100">
<template #default="{ row }"> <template #default="{ row }">
<el-button <el-button
type="primary"
text
link
@click="
router.push({
path: '/safety_production_related/security_notice/notice_info',
query: { NOTIFICATION_ID: row.NOTIFICATION_ID },
})
"
>
查看
</el-button>
<el-button
v-if="row.POSTSTATUS !== '1'"
type="primary"
text
link
@click="
router.push({
path: '/safety_production_related/security_notice/details',
query: { NOTIFICATION_ID: row.NOTIFICATION_ID },
})
"
>
修改
</el-button>
<el-button
v-if="row.POSTSTATUS !== '1'"
type="danger" type="danger"
text text
link link
@ -102,6 +129,15 @@
> >
删除 删除
</el-button> </el-button>
<el-button
v-if="row.POSTSTATUS !== '1'"
type="success"
text
link
@click="issueItem(row.NOTIFICATION_ID)"
>
发布
</el-button>
</template> </template>
</el-table-column> </el-table-column>
<template #button> <template #button>
@ -137,6 +173,7 @@ import {
layoutFnGetNotificationsClassification, layoutFnGetNotificationsClassification,
dateteSecurityAllNotice, dateteSecurityAllNotice,
dateteSecurityNotice, dateteSecurityNotice,
issueSecurityNotice
} from "@/request/safety_production_related.js"; } from "@/request/safety_production_related.js";
import { ElMessageBox, ElMessage } from "element-plus"; import { ElMessageBox, ElMessage } from "element-plus";
import { debounce } from "throttle-debounce"; import { debounce } from "throttle-debounce";
@ -150,7 +187,7 @@ const { list, pagination, searchForm, fnGetData, fnResetPagination } =
useListData(getSecurityNoticeList); useListData(getSecurityNoticeList);
const fnResetPaginationTransfer = () => { const fnResetPaginationTransfer = () => {
fnResetPagination({ fnResetPagination({
DEPTIDS: searchForm.value.DEPTIDS?.join(","), DEPTIDS: searchForm.value.DEPTIDS?.join(",")
}); });
}; };
const fnBatchDelete = debounce( const fnBatchDelete = debounce(
@ -177,13 +214,22 @@ const relatedClassificationList = ref(null);
// //
const deleteItem = async (value) => { const deleteItem = async (value) => {
await ElMessageBox.confirm(`确定要删除吗?`, { await ElMessageBox.confirm(`确定要删除吗?`, {
type: "warning", type: "warning"
}); });
await dateteSecurityNotice({ NOTIFICATION_ID: value }); await dateteSecurityNotice({ NOTIFICATION_ID: value });
ElMessage.success("删除成功"); ElMessage.success("删除成功");
fnGetData(); fnGetData();
}; };
const issueItem = async (value) => {
await ElMessageBox.confirm(`确定要发布此条通知吗?`, {
type: "warning"
});
await issueSecurityNotice({ NOTIFICATION_ID: value });
ElMessage.success("发布成功");
fnGetData();
};
onMounted(async () => { onMounted(async () => {
const data = await layoutFnGetNotificationsClassification(); const data = await layoutFnGetNotificationsClassification();
relatedClassificationList.value = JSON.parse(data.value.zTreeNodes); relatedClassificationList.value = JSON.parse(data.value.zTreeNodes);

View File

@ -8,39 +8,68 @@
<el-descriptions-item label="通知等级"> <el-descriptions-item label="通知等级">
{{ detailItems.LEVEL }} {{ detailItems.LEVEL }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="回复状态"> <el-descriptions-item label="需要回复">
<div style="display: flex; align-items: center"> {{ detailItems.REPLYSTATUS === "1" ? "是" : "否" }}
<el-switch
v-model="detailItems.REPLYSTATUS"
active-value="1"
inactive-value="0"
active-color="#13ce66"
inactive-color="#ff4949"
>
</el-switch>
<span style="margin-left: 8px">
{{ detailItems.REPLYSTATUS === "1" ? "开" : "关" }}
</span>
</div>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="企业下发人"> <!-- <el-descriptions-item label="企业下发人">
{{ detailItems.CREATORNAME }} {{ detailItems.CREATORNAME }}
</el-descriptions-item> </el-descriptions-item>-->
<el-descriptions-item label="运输企业"> <el-descriptions-item label="运输企业">
{{ detailItems.TRANSPORTATIONCOMPANY }} {{ detailItems.CREATORNAME }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="通知内容"> <el-descriptions-item label="通知内容">
<div v-html="detailItems.NOTIFICATIONCONTENT"></div> <div v-html="detailItems.NOTIFICATIONCONTENT"></div>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="通知附件">
<a
:href="VITE_FILE_URL + detailItems.ATTACHMENT_ROUTE"
target="_blank"
rel="noopener noreferrer"
>查看通知附件</a
>
</el-descriptions-item>
<el-descriptions-item label="通知视频">
<video
:src="VITE_FILE_URL + detailItems.VIDEO_ROUTE"
controls
></video>
</el-descriptions-item>
</el-descriptions> </el-descriptions>
<el-table
:border="true"
:data="detailItems.readDetail"
:show-header="true"
v-if="detailItems.POSTSTATUS === '1'"
>
<el-table-column label="姓名" align="center">
<template #default="{ row }"> {{ row.NAME }}<br /> </template>
</el-table-column>
<el-table-column label="阅读时间" align="center">
<template #default="{ row }"> {{ row.SIGNEDDATE }}<br /> </template>
</el-table-column>
<el-table-column label="回复内容" align="center" v-if="detailItems.REPLYSTATUS === '1'" >
<template #default="{ row }">
{{ row.REPLYCONTENT }}<br />
</template>
</el-table-column>
<el-table-column label="回复时间" align="center" v-if="detailItems.REPLYSTATUS === '1'">
<template #default="{ row }">
{{ row.REPLYDATE }}<br />
</template>
</el-table-column>
</el-table>
</layout-card> </layout-card>
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref } from "vue"; import { ref } from "vue";
import { getSecurityNoticeInfo } from "@/request/safety_production_related.js"; import { getSecurityNoticeInfo } from "@/request/safety_production_related.js";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
const VITE_FILE_URL = import.meta.env.VITE_FILE_URL;
const route = useRoute(); const route = useRoute();
const { NOTIFICATION_ID } = route.query; const { NOTIFICATION_ID } = route.query;
@ -54,6 +83,7 @@ const detailItems = ref({
const fnGetData = async () => { const fnGetData = async () => {
const response = await getSecurityNoticeInfo({ NOTIFICATION_ID }); const response = await getSecurityNoticeInfo({ NOTIFICATION_ID });
detailItems.value = response.pd; detailItems.value = response.pd;
console.log("detail",detailItems);
}; };
fnGetData(); fnGetData();
</script> </script>