Commit a84b05f2 authored by ccc2wdd's avatar ccc2wdd

安全管理,数据填报情况统计

parent 007759ef
......@@ -14,7 +14,7 @@ enum Api {
GetCycelDetails = '/pro/educationTraining/cycle/details',
EditCycel = '/pro/educationTraining/cycle/edit',
EditStatus = '/pro/educationTraining/cycle/editStatus',
BusinessComDetails = 'pro/educationTraining/cycle/businessComDetails',
BusinessComDetails = '/pro/educationTraining/cycle/businessComDetails',
}
export const getListByPage = (params?: ProjectParams) =>
......
......@@ -8,6 +8,10 @@ enum Api {
UpdateProject = '/pro/dangerManagement/update',
DeleteProject = '/pro/dangerManagement/del',
Audit = '/pro/dangerManagement/audit',
GetCycelDetails = '/pro/dangerManagement/cycle/details',
EditCycel = '/pro/dangerManagement/cycle/edit',
EditStatus = '/pro/dangerManagement/cycle/editStatus',
BusinessComDetails = '/pro/dangerManagement/cycle/businessComDetails',
}
export const getListByPage = (params?: ProjectParams) =>
......@@ -31,3 +35,27 @@ export const auditItem = (params?: any) =>
url: Api.Audit,
params,
});
export const getCycel = (params?: any) =>
defHttp.post<any>({
url: Api.GetCycelDetails,
params,
});
export const setCycel = (params?: any) =>
defHttp.post<any>({
url: Api.EditCycel,
params,
});
export const setEditStatus = (params?: any) =>
defHttp.post<any>({
url: Api.EditStatus,
params,
});
export const getFillComDetails = (params?: any) =>
defHttp.post<any>({
url: Api.BusinessComDetails,
params,
});
This diff is collapsed.
<template>
<BasicModal
v-bind="$attrs"
@register="register"
title="设置填报周期"
:minHeight="30"
okText="保存"
@ok="handleSubmit"
>
<BasicForm @register="registerForm" :model="modelRef" />
</BasicModal>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicForm, useForm } from '@/components/Form';
import { setCycel } from '@/api/project/saftyManage';
const props = defineProps({
userData: { type: Object },
});
const emit = defineEmits(['getCycle', 'register']);
const modelRef = ref({});
const [registerForm, { getFieldsValue, validate }] = useForm({
labelWidth: 100,
schemas: [
{
field: 'year',
label: '填报年份',
required: true,
component: 'DatePicker',
componentProps: {
placeholder: '选择年份',
picker: 'year',
style: { width: '100%' },
valueFormat: 'YYYY',
format: 'YYYY',
},
},
{
field: 'quarter',
label: '填报季度',
required: true,
component: 'Select',
componentProps: {
options: [
{
label: '第一季度',
value: '第一季度',
},
{
label: '第二季度',
value: '第二季度',
},
{
label: '第三季度',
value: '第三季度',
},
{
label: '第四季度',
value: '第四季度',
},
],
placeholder: '季度',
style: { width: '100%' },
},
},
],
showActionButtonGroup: false,
actionColOptions: {
span: 24,
},
});
const cycleData = ref({
beginTime: '2024-07-01',
endTime: '2024-09-02',
fillCycle: '2024-第四季度',
isEdit: '0',
deptNum: 8,
noNum: 6,
});
const [register, { closeModal }] = useModalInner((data) => {
cycleData.value = data.data;
});
function handleSubmit() {
validate().then(() => {
const value = getFieldsValue();
cycleData.value.fillCycle = value.year + '-' + value.quarter;
setCycel(cycleData.value).then(() => {
emit('getCycle');
});
closeModal();
});
}
</script>
<template>
<BasicModal v-bind="$attrs" width="80%" @register="register" :title="getTitle" :showOkBtn="false">
<Table
:pagination="false"
:dataSource="dataSource"
:columns="columns"
bordered
:sticky="true"
:loading="loadingRef"
>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'comStatus'">
<Tag color="green" v-if="record.comStatus === '1'"> 已完成 </Tag>
<Tag color="red" v-else> 未完成 </Tag>
</template>
</template>
</Table>
</BasicModal>
</template>
<script setup lang="ts">
import { useModalInner } from '@/components/Modal';
import BasicModal from '@/components/Modal/src/BasicModal.vue';
import { ref } from 'vue';
import { Table, Tag } from 'ant-design-vue';
import { getFillComDetails } from '@/api/project/saftyManage';
const loadingRef = ref(false);
// 列表
const dataSource = ref([]);
// 表头
const columns = [
{
title: '公司名称',
dataIndex: 'companyName',
width: 200,
},
{
title: '完成状态',
dataIndex: 'comStatus',
width: 180,
},
{
title: '上报时间',
dataIndex: 'updateTime',
width: 150,
},
];
const getTitle = ref('');
const params = ref({ mothCycle: '' });
const [register, { closeModal }] = useModalInner(async (data) => {
params.value.mothCycle = data.data.fillCycle;
dataSource.value = await getFillComDetails(params.value);
});
</script>
<style scoped lang="less"></style>
This diff is collapsed.
......@@ -11,10 +11,11 @@
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, reactive } from 'vue';
import { ref } from 'vue';
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicForm, FormSchema, useForm } from '@/components/Form';
import { BasicForm, useForm } from '@/components/Form';
import { setCycel } from '@/api/project/safetyEducation';
const props = defineProps({
userData: { type: Object },
});
......@@ -79,7 +80,6 @@
noNum: 6,
});
const [register, { closeModal }] = useModalInner((data) => {
console.log(data.data);
cycleData.value = data.data;
});
......@@ -89,7 +89,6 @@
cycleData.value.fillCycle = value.year + '-' + value.quarter;
setCycel(cycleData.value).then(() => {
emit('getCycle');
console.log('2123', cycleData.value);
});
closeModal();
});
......
......@@ -51,7 +51,6 @@
const [register, { closeModal }] = useModalInner(async (data) => {
params.value.mothCycle = data.data.fillCycle;
dataSource.value = await getFillComDetails(params.value);
// console.log('212', list);
});
</script>
<style scoped lang="less"></style>
......@@ -168,7 +168,6 @@
const APopconfirm = Popconfirm;
const userStore = useUserStore();
const isExamine = ref<boolean>(false);
let isEdit = ref('1');
const getUserInfo = computed(() => {
const { realName = '', avatar, desc, deptId } = userStore.getUserInfo || {};
return { realName, avatar: avatar, desc, deptId };
......@@ -431,9 +430,8 @@
isExamine.value = true;
}
});
const data = await getDepartmentList();
// console.log(data);
searchForm.value[2].componentProps.options = data;
const depart = await getDepartmentList();
searchForm.value[2].componentProps.options = depart;
getStatisticList();
});
......@@ -480,14 +478,8 @@
}
const targetDate = new Date(year, endMonth + 1, 0); // 得到该季度最后一天
console.log('targetDate', targetDate);
// 计算时间差(毫秒)
const timeDifference = targetDate - today;
console.log('timeDifference', timeDifference);
console.log(
'Math.max(0, Math.ceil(timeDifference / (1000 * 60 * 60 * 24)))',
Math.max(0, Math.ceil(timeDifference / (1000 * 60 * 60 * 24))),
);
// 计算天数差(天数 = 毫秒差 / 每天的毫秒数)
return Math.max(0, Math.ceil(timeDifference / (1000 * 60 * 60 * 24)));
}
......@@ -505,7 +497,6 @@
}
function returnEdit() {
console.log('mothCycle.value.isEdit', mothCycle.value.isEdit);
if (mothCycle.value.isEdit == '1') {
mothCycle.value.isEdit = '0';
setEditStatus(mothCycle.value);
......@@ -518,7 +509,6 @@
async function getSetCycle() {
mothCycle.value = await getCycel();
console.log('mothCycle.value', mothCycle.value);
}
//新增
......@@ -558,7 +548,6 @@
async function handleExamine(record: Recordable) {
const id = record.id;
const res = await auditItem({ id });
console.log(res);
await getStatisticList();
}
......@@ -597,20 +586,17 @@
//加载列表数据
async function getStatisticList() {
loadingRef.value = true;
console.log('params.value', params.value);
let data = await getListAll(params.value);
if (data.length > 0) {
isEdit.value = data[0].reviewStatus;
const cycle = await getCycel();
mothCycle.value = cycle;
console.log('getStatisticList:mothCycle.value', mothCycle.value);
// dataSource.value = data;
//将相同的合并单元格
let propsList = ['companyName'];
propsList.map((item) => {
changeData(data, item);
});
mothCycle.value = await getCycel();
// let cycle = await getListAll(mothCycle.value.fillCycle);
// mothCycle.value.isEdit = cycle[0].reviewStatus;
}
// 将相同的合并单元格
let propsList = ['companyName'];
propsList.map((item) => {
changeData(data, item);
});
loadingRef.value = false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment