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); // 安全通知详情
export const addSecurityNotice = (params) =>
upload("/securitynotice/add", params); // 添加安全通知
export const editSecurityNotice = (params) =>
upload("/securitynotice/edit", params); // 修改安全通知
export const getUserBuUserId = (params) =>
post("/user/getUserByUserId", params);
export const issueSecurityNotice = (params) =>
post("/securitynotice/issueSecurityNotice", params); // 发布安全通知
// 通知等级
export const layoutFnGetNotificationsClassification = async () => {
const resData = await getLevelsByParentId({

View File

@ -10,7 +10,7 @@
<el-row>
<el-col :span="5">
<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
v-for="item in data.unitsList"
:key="item.USER_ID"

View File

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

View File

@ -74,13 +74,14 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="回复状态" prop="REPLYSTATUS">
<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"
active-color="#13ce66"
inactive-color="#ff4949"
/>
</el-form-item>
</el-col>

View File

@ -1,155 +1,239 @@
<template>
<div>
<el-card>
<el-form
:model="searchForm"
label-width="100px"
@submit.prevent="searchNotifications"
>
<el-row>
<el-col :span="8">
<el-form-item label="从业人员" prop="PERSON">
<el-input v-model="searchForm.PERSON" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="从业类型" prop="PRACTITIONERTYPE">
<el-select v-model="searchForm.PRACTITIONERTYPE">
<el-option
v-for="item in relatedClassificationList"
:key="item.BIANMA"
:label="item.name"
:value="item.BIANMA"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="签收状态" prop="SIGNEDSTATUS">
<el-select v-model="searchForm.SIGNEDSTATUS">
<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 label="回复状态" prop="REPLYSTATUS">
<el-select v-model="searchForm.REPLYSTATUS">
<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
<layout-card>
<el-form
ref="formRef"
:model="data.form"
:rules="rules"
label-width="175px"
>
<el-divider content-position="left">修改</el-divider>
<el-row>
<el-col :span="12">
<el-form-item label="通知标题" prop="TITLE">
<el-input
v-model="data.form.TITLE"
placeholder="请输入内容"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="通知等级" prop="LEVEL">
<el-select
v-model="data.form.LEVEL"
placeholder="请选择通知等级"
clearable
>
<el-option
v-for="item in relatedClassificationList"
:key="item.BIANMA"
:label="item.NAME"
:value="item.BIANMA"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="人员选择" prop="PERSON">
<div style="flex: 1; display: flex">
<el-input
v-model="data.form.PERSON"
type="textarea"
placeholder="请选择人员"
disabled
></el-input>
<el-button
class="ml-10"
type="primary"
@click="data.SelectPersonDialogVisible = true"
>
选择
</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-form>
</el-card>
<layout-card>
<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>
<el-col :span="24">
<el-form-item label="通知内容" prop="NOTIFICATIONCONTENT">
<layout-editor v-model="data.form.NOTIFICATIONCONTENT" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="tc mt-10">
<el-button type="primary" @click="fnSubmit"> </el-button>
</div>
<select-person
v-model:visible="data.SelectPersonDialogVisible"
:list-data="data.listAll"
@submit="fnSelectPersonSubmit"
@submitall="fnSelectAllRiskSubmit"
/>
</layout-card>
</template>
<script setup>
import { reactive, onMounted, ref } from "vue";
import { useRoute } from "vue-router";
import {
getSecurityNotice,
layoutFnGetSIGNEDSTATUSClassification,
layoutFnGetNotificationsClassification,
editSecurityNotice,
getSecurityNoticeInfo
} from "@/request/safety_production_related.js";
import { serialNumber } from "@/assets/js/utils";
import useListData from "@/assets/js/useListData";
import { onMounted, reactive, ref } from "vue";
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 NOTIFICATION_ID = route.query.NOTIFICATION_ID;
const searchForm = reactive({
PERSON: "",
PRACTITIONERTYPE: "",
SIGNEDSTATUS: null,
REPLYSTATUS: null,
const rules = {
TITLE: [{ required: true, message: "请输入通知标题", trigger: "blur" }],
LEVEL: [{ required: true, message: "请选择通知等级", trigger: "blur" }],
PERSON: [{ required: true, message: "请选择通知人员", trigger: "blur" }],
NOTIFICATIONCONTENT: [
{ required: true, message: "请输入通知内容", trigger: "blur" },
{
validator: (rule, value, callback) => {
if (value === "<p><br></p>") callback(new Error("请输入通知内容"));
else callback();
},
trigger: "blur",
},
],
};
const relatedClassificationTempList =
await layoutFnGetNotificationsClassification();
const relatedClassificationList = [];
JSON.parse(relatedClassificationTempList.value.zTreeNodes).forEach((e) => {
relatedClassificationList.push({ name: e.id, BIANMA: e.name });
});
const router = useRouter();
const data = reactive({
form: {
TITLE: "",
TRANSPORTATIONCOMPANY: "",
LEVEL: "",
PERSON: "",
fileList: [],
videoList: [],
NOTIFICATIONCONTENT: "",
allStatus: 0, //
REPLYSTATUS: "",
personList: [],
},
});
const { list, pagination, fnGetData, fnResetPagination } = useListData(
getSecurityNotice,
{
searchForm,
otherParams: { NOTIFICATION_ID },
usePagination: true,
}
);
async function searchNotifications() {
const params = Object.keys(searchForm).reduce((acc, key) => {
acc[key] = searchForm[key];
return acc;
}, {});
params.NOTIFICATION_ID = NOTIFICATION_ID;
await fnGetData(params);
}
//
function resetSearchForm() {
Object.keys(searchForm).forEach((key) => {
searchForm[key] = "";
});
fnResetPagination({ NOTIFICATION_ID });
}
const relatedClassificationList = ref(null);
onMounted(async () => {
const data = await layoutFnGetSIGNEDSTATUSClassification();
relatedClassificationList.value = JSON.parse(data.value.zTreeNodes);
await fnPerson();
});
// onMounted(() => {
// fnGetData({ NOTIFICATION_ID });
// });
const fnPerson = async () => {
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>
<style scoped></style>
<style scoped lang="scss"></style>

View File

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

View File

@ -8,39 +8,68 @@
<el-descriptions-item label="通知等级">
{{ detailItems.LEVEL }}
</el-descriptions-item>
<el-descriptions-item label="回复状态">
<div style="display: flex; align-items: center">
<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 label="需要回复">
{{ detailItems.REPLYSTATUS === "1" ? "是" : "否" }}
</el-descriptions-item>
<el-descriptions-item label="企业下发人">
<!-- <el-descriptions-item label="企业下发人">
{{ detailItems.CREATORNAME }}
</el-descriptions-item>
</el-descriptions-item>-->
<el-descriptions-item label="运输企业">
{{ detailItems.TRANSPORTATIONCOMPANY }}
{{ detailItems.CREATORNAME }}
</el-descriptions-item>
<el-descriptions-item label="通知内容">
<div v-html="detailItems.NOTIFICATIONCONTENT"></div>
</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-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>
</div>
</template>
<script setup>
import { ref } from "vue";
import { getSecurityNoticeInfo } from "@/request/safety_production_related.js";
import { useRoute } from "vue-router";
const VITE_FILE_URL = import.meta.env.VITE_FILE_URL;
const route = useRoute();
const { NOTIFICATION_ID } = route.query;
@ -54,6 +83,7 @@ const detailItems = ref({
const fnGetData = async () => {
const response = await getSecurityNoticeInfo({ NOTIFICATION_ID });
detailItems.value = response.pd;
console.log("detail",detailItems);
};
fnGetData();
</script>