安全例会

pull/1/head
dearlin 2024-02-06 15:40:39 +08:00
parent 91f0d30d74
commit 1744e25b89
7 changed files with 724 additions and 1 deletions

2
.env
View File

@ -1,4 +1,4 @@
VITE_BASE_URL=http://192.168.0.42:8099/
VITE_BASE_URL=http://192.168.0.79:8091/
VITE_PROXY=/api/
VITE_FILE_URL=https://file.zcloudchina.com/YTHFile
VITE_TEMPLATE_URL=https://qaaq.qhdsafety.com/file/

View File

@ -0,0 +1,12 @@
import { post } from "@/request/axios.js";
export const getSafetyMeetingList = (params) =>
post("/safetyMeeting/list", params); // 安全例会列表
export const setSafetyMeetingData = (params) =>
post("/safetyMeeting/add", params); // 安全例会新增
export const setSafetyMeetingDelete = (params) =>
post("/safetyMeeting/delete", params); // 安全例会删除
export const getSafetyMeetingView = (params) =>
post("/safetyMeeting/goEdit", params); // 安全例会详情
export const setSafetyMeetingEdit = (params) =>
post("/safetyMeeting/edit", params); // 安全例会修改

View File

@ -0,0 +1,253 @@
<template>
<layout-card>
<el-form
ref="formRef"
:rules="rules"
:model="data.form"
label-width="120px"
>
<el-row>
<el-col :span="24">
<el-form-item label="安全例会标题" prop="SAFETY_MEETING_TITLE">
<el-input
v-model="data.form.SAFETY_MEETING_TITLE"
placeholder="请输入"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-divider content-position="left">涉及人</el-divider>
</el-col>
<el-col :span="24">
<el-form-item class="end">
<el-button type="primary" @click="fnAddPeople"></el-button>
</el-form-item>
</el-col>
<template v-for="(item, index) in data.form.people" :key="item.id">
<el-col :span="8">
<el-form-item
:label="'部门' + (index + 1)"
:prop="'people.' + index + '.DEPARTMENT_ID'"
:rules="{
required: true,
message: '部门不能为空',
trigger: 'blur',
}"
>
<layout-department
v-model="item.DEPARTMENT_ID"
@update:model-value="
fnDepartmentChange($event, index, 'people')
"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
:label="'岗位' + (index + 1)"
:prop="'people.' + index + '.POST_ID'"
:rules="{
required: true,
message: '岗位不能为空',
trigger: 'blur',
}"
>
<el-select
:model-value="item.POST_ID"
@change="fnPostChange($event, index, 'people')"
>
<el-option
v-for="item in item.postList"
:key="item.POST_ID"
:label="item.NAME"
:value="item.POST_ID"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
:label="'人员' + (index + 1)"
:prop="'people.' + index + '.USER_ID'"
:rules="{
required: true,
message: '人员不能为空',
trigger: 'blur',
}"
>
<div
style="
flex: 1;
display: flex;
justify-content: space-between;
align-items: flex-start;
"
>
<el-select v-model="item.USER_ID" multiple>
<el-option
v-for="item in item.userList"
:key="item.USER_ID"
:label="item.NAME"
:value="item.USER_ID"
/>
</el-select>
<el-button
v-if="index !== 0"
class="ml-10"
type="danger"
@click="data.form.people.splice(index, 1)"
>
删除
</el-button>
</div>
</el-form-item>
</el-col>
</template>
<el-col :span="24">
<el-divider content-position="left">安全例会内容</el-divider>
</el-col>
<el-col :span="24">
<el-form-item label="正文" prop="TEXT">
<el-input
v-model="data.form.SAFETY_MEETING_CONTENT"
type="textarea"
:autosize="{ minRows: 3 }"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="mt-10 tc">
<el-button type="primary" @click="fnSubmit"></el-button>
</div>
</layout-card>
</template>
<script setup>
import { reactive, ref } from "vue";
import LayoutDepartment from "@/components/department/index.vue";
import { getPostListAll, getUserListAll } from "@/request/data_dictionary.js";
import { verifyDuplicateSelection } from "@/assets/js/utils.js";
import { debounce } from "throttle-debounce";
import { useRoute, useRouter } from "vue-router";
import useFormValidate from "@/assets/js/useFormValidate.js";
import { ElMessage } from "element-plus";
import {
getSafetyMeetingView,
setSafetyMeetingEdit,
setSafetyMeetingData,
} from "@/request/safety_meeting.js";
import { uniqBy } from "lodash-es";
const route = useRoute();
const router = useRouter();
const { SAFETY_MEETING_ID } = route.query;
const rules = {
PROMISE_NAME: [
{ required: true, message: "安全例会名称不能为空", trigger: "blur" },
],
};
const formRef = ref(null);
const data = reactive({
form: {
people: [],
},
selectTemplateDialogVisible: false,
isSelectTemplate: false,
});
const fnAddPeople = () => {
data.form.people.push({
postList: [],
userList: [],
DEPARTMENT_ID: "",
POST_ID: "",
USER_ID: [],
id: Math.random(),
});
};
const fnGetData = async () => {
if (!SAFETY_MEETING_ID) {
fnAddPeople();
return;
}
const resData = await getSafetyMeetingView({ SAFETY_MEETING_ID });
const DETAIL = [];
const people = resData.people;
const newPeople = [];
for (let i = 0; i < people.length; i++) {
newPeople.push({
...people[i],
postList: [],
userList: [],
USER_ID: [],
id: people[i].PROMISEPEOPLE_ID,
});
for (let j = 0; j < newPeople.length; j++) {
if (people[i].POST_ID === newPeople[j].POST_ID) {
newPeople[j].USER_ID.push(people[i].USER_ID);
}
}
}
data.form = {
...resData.varList,
DETAIL,
people: uniqBy(newPeople, "POST_ID"),
};
data.isSelectTemplate = true;
for (let i = 0; i < data.form.people.length; i++) {
await fnGetPostList(data.form.people[i].DEPARTMENT_ID, i, "people");
await fnGetUserList(
data.form.people[i].DEPARTMENT_ID,
data.form.people[i].POST_ID,
i,
"people"
);
}
};
fnGetData();
const fnDepartmentChange = (value, index, key) => {
data.form[key][index].POST_ID = "";
data.form[key][index].USER_ID = [];
data.form[key][index].postList = [];
data.form[key][index].userList = [];
fnGetPostList(value, index, key);
};
const fnGetPostList = async (DEPARTMENT_ID, index, key) => {
const resData = await getPostListAll({ DEPARTMENT_ID });
data.form[key][index].postList = resData.postList;
};
const fnPostChange = async (value, index, key) => {
await verifyDuplicateSelection(data.form[key], index, "POST_ID", value);
data.form[key][index].USER_ID = [];
data.form[key][index].userList = [];
await fnGetUserList(data.form[key][index].DEPARTMENT_ID, value, index, key);
};
const fnGetUserList = async (DEPARTMENT_ID, POST_ID, index, key) => {
const resData = await getUserListAll({ DEPARTMENT_ID, POST_ID });
data.form[key][index].userList = resData.userList;
};
const fnSubmit = debounce(
1000,
async () => {
await useFormValidate(formRef);
const people = data.form.people.map((item) => ({
DEPARTMENT_ID: item.DEPARTMENT_ID,
POST_ID: item.POST_ID,
USER_ID: item.USER_ID,
}));
const params = {
...data.form,
people: JSON.stringify(people),
SAFETY_MEETING_ID,
};
!SAFETY_MEETING_ID
? await setSafetyMeetingData(params)
: await setSafetyMeetingEdit(params);
ElMessage.success("操作成功");
router.back();
},
{ atBegin: true }
);
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,99 @@
<template>
<el-dialog v-model="visible" title="选择模板">
<el-form
:model="searchForm"
label-width="90px"
@submit.prevent="fnResetPagination"
>
<el-row>
<el-col :span="8">
<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-width="10px">
<el-button type="primary" native-type="submit">搜索</el-button>
<el-button native-type="reset" @click="fnResetPagination">
重置
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<layout-table
:data="list"
@get-data="fnGetData"
v-model:pagination="pagination"
>
<el-table-column label="序号" width="60">
<template #default="{ $index }">
{{ serialNumber(pagination, $index) }}
</template>
</el-table-column>
<el-table-column prop="PROMISE_NAME" label="承诺书名称" />
<el-table-column label="类型">
<template v-slot="{ row }">
{{ row.TYPE === "0" ? "承诺书" : "责任状" }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200">
<template v-slot="{ row }">
<el-button type="primary" text link @click="fnCheck(row)">
选择
</el-button>
</template>
</el-table-column>
</layout-table>
<template #footer>
<el-button @click="fnClose"></el-button>
</template>
</el-dialog>
</template>
<script setup>
import { useVModel } from "@vueuse/core";
import useListData from "@/assets/js/useListData.js";
import {
getAdministrationSelectTemplateCheck,
getAdministrationSelectTemplateList,
} from "@/request/security_commitment_pro.js";
import { serialNumber } from "@/assets/js/utils.js";
import { watch } from "vue";
const props = defineProps({
visible: {
type: Boolean,
required: true,
default: false,
},
});
const emits = defineEmits(["update:visible", "check"]);
const visible = useVModel(props, "visible", emits);
const { list, pagination, searchForm, fnGetData, fnResetPagination } =
useListData(getAdministrationSelectTemplateList, {
immediate: false,
});
const fnClose = () => {
visible.value = false;
};
const fnCheck = async (row) => {
const resData = await getAdministrationSelectTemplateCheck({
PROMISE_ID: row.PROMISE_ID,
});
const DETAIL = resData.varList.map((item) => ({
value: item.COLLATERAL,
id: item.PROMISEDETAIL_ID,
}));
fnClose();
emits("check", { DETAIL, TEXT: row.TEXT, TYPE: row.TYPE });
};
const stop = watch(visible, (val) => {
if (val) {
fnGetData();
stop && stop();
}
});
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,85 @@
<template>
<layout-card>
<layout-table
:data="list"
@get-data="fnGetData"
v-model:pagination="pagination"
>
<el-table-column label="序号" width="60">
<template #default="{ $index }">
{{ serialNumber(pagination, $index) }}
</template>
</el-table-column>
<el-table-column prop="DEPTNAME" label="部门" />
<el-table-column prop="POST_NAME" label="岗位" />
<el-table-column prop="USERNAME" label="人员" />
<el-table-column prop="SIGNTIME" label="签署时间" />
<el-table-column label="状态">
<template v-slot="{ row }">
{{ row.ISSIGN === 0 ? "未签署" : "已签署" }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template v-slot="{ row }">
<el-button
type="primary"
text
link
@click="fnView(row.PROMISEPEOPLE_ID)"
>
查看
</el-button>
</template>
</el-table-column>
</layout-table>
<view-info
v-model:visible="data.viewDialog.visible"
:info="data.viewDialog.info"
/>
</layout-card>
</template>
<script setup>
import { useRoute } from "vue-router";
import useListData from "@/assets/js/useListData.js";
import {
getAdministrationDetailsList,
getAdministrationDetailsView,
} from "@/request/security_commitment_pro.js";
import { serialNumber } from "@/assets/js/utils.js";
import { reactive } from "vue";
import ViewInfo from "../template/components/view.vue";
const route = useRoute();
const { PROMISE_ID } = route.query;
const { list, pagination, fnGetData } = useListData(
getAdministrationDetailsList,
{ otherParams: { PROMISE_ID } }
);
const data = reactive({
viewDialog: {
visible: false,
info: {},
},
});
const fnView = async (PROMISEPEOPLE_ID) => {
const resData = await getAdministrationDetailsView({
PROMISEPEOPLE_ID,
PROMISE_ID,
});
const DETAIL = resData.COLLATERAL.map((item) => ({
value: item.COLLATERAL,
id: item.PROMISEDETAIL_ID,
}));
data.viewDialog.info = {
...resData.varList,
DETAIL,
FILEPATH: resData.ISGN.FILEPATH,
SIGNTIME: resData.ISGN.SIGNTIME,
COVERPEOPLE: resData.COVERPEOPLE[0].USERNAME,
};
data.viewDialog.visible = true;
};
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,138 @@
<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-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="SAFETY_MEETING_TITLE" label="安全例会标题" />
<el-table-column prop="SAFETY_MEETING_CONTENT" label="安全例会内容" />
<el-table-column prop="CREATTIME" label="添加时间" width="150" />
<el-table-column label="签字人数/涉及人数">
<template v-slot="{ row }">
{{ row.SIGNATURES }}/{{ row.ALL_SIGNATURES }}
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template v-slot="{ row }">
<el-button
type="primary"
text
link
@click="
router.push({
path: '/security_commitment_pro/administration/view',
query: { PROMISE_ID: row.PROMISE_ID },
})
"
>
查看
</el-button>
<el-button
type="primary"
text
link
@click="
fnEnableOrDisable(row.STATE === '0' ? 1 : 0, row.PROMISE_ID)
"
>
{{ row.STATE === "0" ? "禁用" : "启用" }}
</el-button>
<el-button
:disabled="row.ISSIGN !== 0"
type="primary"
text
link
@click="
router.push({
path: '/security_commitment_pro/administration/edit',
query: { PROMISE_ID: row.PROMISE_ID },
})
"
>
编辑
</el-button>
</template>
</el-table-column>
<template #button>
<el-button
type="primary"
@click="
router.push({
path: '/safety_meeting/meeting/add',
})
"
>
新增
</el-button>
</template>
</layout-table>
</layout-card>
</div>
</template>
<script setup>
import { serialNumber } from "@/assets/js/utils";
import useListData from "@/assets/js/useListData.js";
import { getSafetyMeetingList } from "@/request/safety_meeting.js";
import { debounce } from "throttle-debounce";
import { ElMessage, ElMessageBox } from "element-plus";
import { useRouter } from "vue-router";
const router = useRouter();
const { list, pagination, searchForm, fnGetData, fnResetPagination } =
useListData(getSafetyMeetingList);
const fnGetDataTransfer = () => {
fnGetData({
DEPTIDS: searchForm.value.DEPTIDS?.join(","),
});
};
const fnResetPaginationTransfer = () => {
fnResetPagination({
DEPTIDS: searchForm.value.DEPTIDS?.join(","),
});
};
const fnEnableOrDisable = debounce(
1000,
async (STATE) => {
const message = STATE === 0 ? "启用" : "禁用";
await ElMessageBox.confirm(`确定要${message}当前承诺书吗?`, {
type: "warning",
});
ElMessage.success(`${message}成功`);
fnResetPaginationTransfer();
},
{ atBegin: true }
);
</script>
<style scoped></style>

View File

@ -0,0 +1,136 @@
<template>
<layout-card>
<el-divider content-position="left">基本信息</el-divider>
<el-descriptions :column="2" border>
<el-descriptions-item label="承诺书名称">
{{ info.PROMISE_NAME }}
</el-descriptions-item>
<el-descriptions-item label="级别">
{{ info.LEVELNAME }}
</el-descriptions-item>
<el-descriptions-item label="适用期限开始">
{{ info.PROMISE_TERM_START }}
</el-descriptions-item>
<el-descriptions-item label="适用期限结束">
{{ info.PROMISE_TERM_END }}
</el-descriptions-item>
</el-descriptions>
<el-divider content-position="left">承诺人</el-divider>
<el-descriptions :column="3" border>
<template v-for="(item, index) in info.people" :key="item.id">
<el-descriptions-item :label="'部门' + (index + 1)">
{{ item.DEPTNAME }}
</el-descriptions-item>
<el-descriptions-item :label="'岗位' + (index + 1)">
{{ item.POSTNAME }}
</el-descriptions-item>
<el-descriptions-item :label="'人员' + (index + 1)">
{{ item.USERNAME?.join("、") }}
</el-descriptions-item>
</template>
</el-descriptions>
<el-divider content-position="left">被承诺人</el-divider>
<el-descriptions :column="3" border>
<template v-for="(item, index) in info.coverpeople" :key="item.id">
<el-descriptions-item :label="'部门' + (index + 1)">
{{ item.DEPTNAME }}
</el-descriptions-item>
<el-descriptions-item :label="'岗位' + (index + 1)">
{{ item.POSTNAME }}
</el-descriptions-item>
<el-descriptions-item :label="'人员' + (index + 1)">
{{ item.USERNAME?.join("、") }}
</el-descriptions-item>
</template>
</el-descriptions>
<el-divider content-position="left">承诺内容</el-divider>
<el-descriptions :column="1" border>
<el-descriptions-item label="正文">
{{ info.TEXT }}
</el-descriptions-item>
<template v-for="(item, index) in info.DETAIL" :key="item.id">
<el-descriptions-item :label="'副文' + (index + 1)">
{{ item.value }}
</el-descriptions-item>
</template>
</el-descriptions>
<div class="tc mt-10">
<el-button type="primary" @click="fnView"> </el-button>
</div>
<view-info
v-model:visible="data.viewDialog.visible"
:info="data.viewDialog.info"
/>
</layout-card>
</template>
<script setup>
import { reactive, ref } from "vue";
import { getAdministrationView } from "@/request/security_commitment_pro.js";
import { useRoute } from "vue-router";
import ViewInfo from "../template/components/view.vue";
import { uniqBy } from "lodash-es";
const route = useRoute();
const { PROMISE_ID } = route.query;
const info = ref({});
const data = reactive({
viewDialog: {
visible: false,
info: {},
},
});
const fnGetData = async () => {
const resData = await getAdministrationView({ PROMISE_ID });
const DETAIL = resData.promistDetail.map((item) => ({
value: item.COLLATERAL,
id: item.PROMISEDETAIL_ID,
}));
const people = resData.people;
const coverpeople = resData.coverpeople;
const newPeople = [];
const newCoverpeople = [];
for (let i = 0; i < people.length; i++) {
newPeople.push({
...people[i],
USERNAME: [],
id: people[i].PROMISEPEOPLE_ID,
});
for (let j = 0; j < newPeople.length; j++) {
if (people[i].POST_ID === newPeople[j].POST_ID) {
newPeople[j].USERNAME.push(people[i].USERNAME);
}
}
}
for (let i = 0; i < coverpeople.length; i++) {
newCoverpeople.push({
...coverpeople[i],
USERNAME: [],
id: coverpeople[i].PROMISEPEOPLE_ID,
});
for (let j = 0; j < newCoverpeople.length; j++) {
if (coverpeople[i].POST_ID === newCoverpeople[j].POST_ID) {
newCoverpeople[j].USERNAME.push(coverpeople[i].USERNAME);
}
}
}
info.value = {
...resData.varList,
DETAIL,
people: uniqBy(newPeople, "POST_ID"),
coverpeople: uniqBy(newCoverpeople, "POST_ID"),
};
};
fnGetData();
const fnView = () => {
data.viewDialog.info = {
...info.value,
FILEPATH: "",
SIGNTIME: "",
COVERPEOPLE: info.value.coverpeople[0].USERNAME[0],
};
data.viewDialog.visible = true;
};
</script>
<style scoped lang="scss"></style>