fix: BUG修改

This commit is contained in:
kun 2023-06-21 18:13:53 +08:00
parent fd4b04dff7
commit 3ae2a2c555
5 changed files with 139 additions and 332 deletions

View File

@ -361,6 +361,10 @@ export const addDividerQuestion = (params: FormData) => {
export const attendanceStatistics = () => {
return http.get(BASEURL + `/gov/workerStat/attendStatistics`);
};
// 人员出勤监管-出勤统计数据
export const attendanceData = (params: FormData) => {
return http.post(BASEURL + `/gov/workerStat/attendRecord`, params);
};
// 列表查询视频管理表信息
// export const getVideo = (params: { projectSn?: string; engineeringSn?: string }) => {

View File

@ -44,7 +44,6 @@
<el-form-item>
<el-button type="primary" @click="handleSearch">查询</el-button>
<el-button style="background-color: #ffb750; color: #fff">刷新</el-button>
<el-button class="addButtonStyle" @click="addVideoData">新增</el-button>
</el-form-item>
</el-form>
<!-- </div> -->
@ -57,13 +56,6 @@
<div class="page_text flx-justify-column">
<div class="img_title">
<span>{{ item.title }}</span>
<el-button type="primary" link @click="handleEditItem(2, item)">
<img src="@/assets/images/tableIcon/updateIcon.png" alt="" class="configureIcon" />
<span>编辑</span>
</el-button>
<el-button style="margin-right: 12px" type="danger" link :icon="Delete" @click="deleteAccount(item)"
>删除</el-button
>
</div>
<div class="img_bottom">
<!-- <div class="position" style="font-size: 12px">位置{{ item.deviceName }}</div> -->
@ -90,62 +82,13 @@
</div>
</div>
</div>
<el-dialog class="imgDialog" :title="title" width="40%" v-model="visible" show-close>
<el-form class="diaForm" :rules="rules" :model="formData" ref="ruleFormRef" label-width="160px">
<el-form-item label="录像标题:" prop="title">
<el-input style="width: 80%" v-model="formData.title" placeholder="请输入" />
</el-form-item>
<el-form-item label="上传时间:" prop="uploadTime">
<el-date-picker
style="width: 80%"
v-model="formData.uploadTime"
format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DD HH:mm:ss"
type="datetime"
placeholder="请选择时间"
/>
</el-form-item>
<el-form-item label="备注:" prop="remark">
<el-input style="width: 80%" v-model="formData.remark" type="textarea" :rows="3" placeholder="请输入" />
</el-form-item>
<el-form-item label="录像文件:" prop="videoUrl">
<el-upload
ref="upload"
:headers="headers"
:file-list="fileList"
class="upload-demo"
:action="`${baseUrl}` + '/xmgl/file/upload'"
:on-remove="onRemove"
multiple
:limit="1"
:on-success="uploadSuccess"
:before-upload="beforeUpload"
style="width: 100%"
>
<el-button class="uploadBtn" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
</el-form>
<template #footer>
<div>
<el-button class="hzCancelStyle" @click="visible = false">取消</el-button>
<el-button class="hzStyle" type="primary" @click="confirm(ruleFormRef, formData)"> 保存 </el-button>
</div>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { ref, reactive, onMounted, watch } from "vue";
import { getAIQuestionPage, addAIrecords, getAiMonitorDev } from "@/api/modules/goverment";
import { videoDataAdd, videoDataEdit, videoDataDelete } from "@/api/modules/enterpriseApi";
import Pagination from "@/components/ProTable/components/Pagination.vue";
import { ElMessage, UploadProps } from "element-plus";
import type { FormRules, FormInstance, UploadInstance } from "element-plus";
import { GlobalStore } from "@/stores";
import { Delete } from "@element-plus/icons-vue";
import { jxj_User } from "@/api/types";
import { useHandleData } from "@/hooks/useHandleData";
import LeftMenu from "@/components/LeftMenu/LeftMenu.vue";
import type { ResAiProjectPage, ResAiEngineerPage } from "@/api/types/government/AIwaring";
import changeTheme from "@/components/changeTheme/index.vue";
@ -157,12 +100,7 @@ const pages = ref({
});
const records = ref<ResAiProjectPage[] | ResAiEngineerPage[]>([]);
const active = ref(0);
const upload = ref<UploadInstance>();
const fileList = ref([]);
const store = GlobalStore();
const headers = ref({ Authorization: "Bearer " + store.token });
const ruleFormRef = ref<FormInstance>();
const baseUrl = import.meta.env.VITE_API_URL;
interface formData {
title: string;
uploadTime: string;
@ -176,46 +114,7 @@ const formData = ref<formData>({
videoUrl: ""
});
const background = ref(true);
const visible = ref(false);
const title = ref("新增录像");
const rules = reactive<FormRules>({
serialNumber: {
required: true,
message: "请输入",
trigger: "blur"
},
dname: {
required: true,
message: "请输入",
trigger: "change"
},
brand: {
required: true,
message: "请输入",
trigger: "change"
},
model: {
required: true,
message: "请输入",
trigger: "change"
},
droneType: {
required: true,
message: "请输入",
trigger: "change"
},
liveUrl: {
required: true,
message: "请输入",
trigger: "change"
},
image: {
required: true,
message: "请上传",
trigger: "change"
}
});
const pageable = ref({
pageNo: 1,
pageSize: 12,
@ -237,15 +136,6 @@ const searchSn = ref("");
//
const searchName = ref<string>("");
//
const beforeUpload = file => {
console.log(file);
const type = file.type;
if (type != "video/mp4") {
ElMessage.error("请上传视频文件");
return false;
}
};
// div
const onSearch = async (params: ResAiProjectPage | ResAiEngineerPage) => {
const { result } = await getUnmannedPage(
@ -290,88 +180,16 @@ const onCurChange = async (params: number) => {
}
pages.value.total = +res.result.total;
};
//
const deleteAccount = async (params: jxj_User.ResUserList) => {
await useHandleData(videoDataDelete, { id: params.id }, `删除`);
getVideoData();
};
const handleSearch = () => {
console.log(666);
getVideoData();
};
const handleEditItem = (index: number, row: any) => {
title.value = "编辑录像";
formData.value = { ...row };
console.log(formData.value);
fileList.value = reactive([{ name: "文件", url: row.videoUrl }]);
visible.value = true;
};
const getVideoData = async () => {
const res = await getUnmannedPage({ ...pageable.value, ...form.value });
videoData.value.records = res.result.records;
console.log(videoData.value);
console.log(res);
};
const handleExceed: UploadProps["onExceed"] = files => {
// console.log(1111);
// upload.value!.clearFiles();
// const file = files[0] as UploadRawFile;
// file.uid = genFileId();
// // fileList.value = file;
// upload.value!.handleStart(file);
// upload.value?.submit();
};
const uploadSuccess = (response: any) => {
ElMessage.success("上传成功");
formData.value.videoUrl = response.result.url;
fileList.value = [{ name: response.result.originalFilename, url: response.result.downloadPath }];
};
const onRemove: UploadProps["onRemove"] = (file, uploadFiles) => {
formData.value.videoUrl = "";
fileList.value = reactive([]);
};
//
const addVideoData = () => {
title.value = "新增录像";
formData.value = reactive<formData>({
title: "",
uploadTime: "",
remark: "",
videoUrl: ""
});
fileList.value = reactive([]);
visible.value = true;
};
const confirm = async (formEl: FormInstance | undefined, form: any) => {
//
if (!formEl) return;
await formEl.validate(async (valid, fields) => {
if (valid) {
console.log(666);
console.log(searchSn.value);
formData.value.engineeringSn = searchSn.value;
if (formData.value.id) {
const res = await videoDataEdit(form);
ElMessage.success("编辑成功");
visible.value = false;
getVideoData();
} else {
const res = await videoDataAdd(form);
ElMessage.success("保存成功");
visible.value = false;
getVideoData();
}
} else {
console.log("error submit!", fields);
ElMessage({
showClose: true,
message: "请完善表单信息!",
type: "error"
});
}
});
};
//
const handleCurrentChange = async (page: number) => {};
// form

View File

@ -16,7 +16,7 @@
<div class="statistics-search">
<el-card shadow="never" class="topCard">
<span style="margin: 0 10px 2px 0">人员分类</span>
<el-select v-model="searchForm.personType" placeholder="请选择">
<el-select v-model="searchForm.personType" clearable placeholder="请选择">
<el-option v-for="item in categoryList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<span style="margin: 0 10px 2px 20px">提交时间</span>
@ -24,12 +24,13 @@
v-model="searchForm.dateRange"
style="width: 300px"
type="daterange"
valueFormat="YYYY-MM-DD"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
<el-button class="hzStyle" type="primary" style="margin-left: 20px" @click="handleSubmit(ruleFormRef)">发送</el-button>
<el-button class="hzStyle" type="primary" style="margin-left: 20px" @click="getAttendanceData">发送</el-button>
</el-card>
</div>
<div class="statistics-echart">
@ -43,22 +44,8 @@
<script setup lang="tsx" name="ProjectSupervisionRecord">
import { ref, reactive, nextTick, onMounted } from "vue";
import { ElMessage, ElMessageBox, ElTree, FormInstance } from "element-plus";
import { useRouter } from "vue-router";
import { ColumnProps } from "@/components/ProTable/interface";
import { useHandleData } from "@/hooks/useHandleData";
import ProTable from "@/components/ProTable/index.vue";
import { getRelevanceList } from "@/api/modules/common";
import { jxj_User } from "@/api/types";
import engineeringDrawer from "@/components/engineeringDrawer/index.vue";
import allEngineering from "@/components/allEngineering/index.vue";
import TreeFilter from "@/components/TreeFilter/index.vue";
import AMap from "@/components/AMap/AMap.vue";
import { editRolePermissions, getTreemRoleList, getTreeByIdList } from "@/api/modules/goverment";
import DialogForm from "@/components/DialogForm/index.vue";
import { attendanceStatistics } from "@/api/modules/goverment";
import { Delete } from "@element-plus/icons-vue";
import { ElMessage, ElMessageBox } from "element-plus";
import { attendanceStatistics, attendanceData } from "@/api/modules/goverment";
import { GlobalStore } from "@/stores";
import * as echarts from "echarts";
import { useEcharts } from "@/hooks/useEcharts";
@ -105,30 +92,7 @@ const categoryList = ref([
value: 2
}
]);
//
const handleSubmit = async (formEl: FormInstance | undefined) => {
if (!formEl) return;
await formEl.validate(async (valid, fields) => {
if (valid) {
} else {
console.log("error submit!", fields);
ElMessage({
showClose: true,
message: "请完善表单信息!",
type: "error"
});
}
});
};
const getStatistics = async () => {
const res = await attendanceStatistics();
statisticsOption.value.map(item => {
item.value = res.result[item.prop];
});
console.log(res);
};
onMounted(() => {
getStatistics();
const drawEcharts = () => {
let myChart: echarts.ECharts = echarts.init(echartsRef.value as HTMLElement);
let option: echarts.EChartsOption = {
tooltip: {
@ -229,6 +193,28 @@ onMounted(() => {
]
};
useEcharts(myChart, option);
};
const getAttendanceData = async () => {
console.log(searchForm.value.dateRange);
let requestData = {
personType: searchForm.value.personType,
startTime: searchForm.value.dateRange.length > 0 ? searchForm.value.dateRange[0] : "",
endTime: searchForm.value.dateRange.length > 0 ? searchForm.value.dateRange[1] : ""
};
const res = await attendanceData(requestData);
console.log(res);
drawEcharts();
};
const getStatistics = async () => {
const res = await attendanceStatistics();
statisticsOption.value.map(item => {
item.value = res.result[item.prop];
});
console.log(res);
};
onMounted(() => {
getStatistics();
getAttendanceData();
});
</script>
<style scoped lang="scss">

View File

@ -7,7 +7,8 @@
// padding: 0 20px;
// overflow: hidden;
.middle-video {
margin: 0 20px;
// margin: 0 20px;
margin-left: 20px;
flex: 1;
.title-video {
height: 56px;
@ -36,111 +37,110 @@
// background-color: rgba(255, 192, 203, 0.4);
}
}
.right-form {
width: 15vw;
height: 100%;
background: #092945;
border-radius: 8px;
display: flex;
flex-direction: column;
// overflow: scroll;
.date-form {
display: flex;
padding: 15px 12px;
border-bottom: 1px solid #09314e;
.searchBtn {
margin-left: 10px;
background: #087ba4;
border-radius: 4px;
}
:deep() {
.el-input__wrapper {
background-color: transparent;
box-shadow: 0 0 0 1px #087ba4 inset;
}
.el-range-input {
color: white;
}
}
}
.right-header {
flex: 1;
overflow: auto;
// .right-form {
// width: 15vw;
// height: 100%;
// background: #092945;
// border-radius: 8px;
// display: flex;
// flex-direction: column;
// .date-form {
// display: flex;
// padding: 15px 12px;
// border-bottom: 1px solid #09314e;
// .searchBtn {
// margin-left: 10px;
// background: #087ba4;
// border-radius: 4px;
// }
// :deep() {
// .el-input__wrapper {
// background-color: transparent;
// box-shadow: 0 0 0 1px #087ba4 inset;
// }
// .el-range-input {
// color: white;
// }
// }
// }
// .right-header {
// flex: 1;
// overflow: auto;
.question-form {
// flex: 1;
// height: 120px;
padding: 12px;
border-bottom: 1px solid #09314e;
.title {
color: #ffffff;
font-family: "siyuan_Medium";
}
.desc {
margin-top: 4px;
.question {
color: #c4c4c4;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-size: 12px;
}
.date {
display: flex;
align-items: flex-end;
justify-content: space-between;
margin-top: 37px;
span {
color: rgba(196, 196, 196, 0.65);
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-size: 10px;
}
}
}
}
}
:deep(.el-pagination) {
.el-pagination__goto {
color: var(--el-color-primary);
}
.el-pagination__classifier {
color: var(--el-color-primary);
}
.el-input__wrapper {
color: var(--el-color-primary);
background-color: transparent;
border: none;
box-shadow: 0 0 0 1px var(--el-color-primary, var(--el-color-primary)) inset;
height: 26px;
}
.el-input__inner {
color: var(--el-color-primary);
}
.el-pager li {
border: none;
box-shadow: 0 0 0 1px var(--el-color-primary, var(--el-color-primary)) inset;
background-color: transparent;
color: white;
border: none;
height: 26px;
}
.el-pager li:active {
color: var(--el-color-primary);
border: none;
height: 26px;
}
.el-pagination__total {
color: var(--el-color-primary);
}
.btn-prev,
.btn-next,
.btn-prev:disabled,
.btn-next:disabled {
color: var(--el-color-primary);
background-color: transparent;
border: 1px solid var(--el-color-primary);
height: 26px;
}
}
}
// .question-form {
// // flex: 1;
// // height: 120px;
// padding: 12px;
// border-bottom: 1px solid #09314e;
// .title {
// color: #ffffff;
// font-family: "siyuan_Medium";
// }
// .desc {
// margin-top: 4px;
// .question {
// color: #c4c4c4;
// font-family: Source Han Sans CN-Regular, Source Han Sans CN;
// font-size: 12px;
// }
// .date {
// display: flex;
// align-items: flex-end;
// justify-content: space-between;
// margin-top: 37px;
// span {
// color: rgba(196, 196, 196, 0.65);
// font-family: Source Han Sans CN-Regular, Source Han Sans CN;
// font-size: 10px;
// }
// }
// }
// }
// }
// :deep(.el-pagination) {
// .el-pagination__goto {
// color: var(--el-color-primary);
// }
// .el-pagination__classifier {
// color: var(--el-color-primary);
// }
// .el-input__wrapper {
// color: var(--el-color-primary);
// background-color: transparent;
// border: none;
// box-shadow: 0 0 0 1px var(--el-color-primary, var(--el-color-primary)) inset;
// height: 26px;
// }
// .el-input__inner {
// color: var(--el-color-primary);
// }
// .el-pager li {
// border: none;
// box-shadow: 0 0 0 1px var(--el-color-primary, var(--el-color-primary)) inset;
// background-color: transparent;
// color: white;
// border: none;
// height: 26px;
// }
// .el-pager li:active {
// color: var(--el-color-primary);
// border: none;
// height: 26px;
// }
// .el-pagination__total {
// color: var(--el-color-primary);
// }
// .btn-prev,
// .btn-next,
// .btn-prev:disabled,
// .btn-next:disabled {
// color: var(--el-color-primary);
// background-color: transparent;
// border: 1px solid var(--el-color-primary);
// height: 26px;
// }
// }
// }
}
.demo-tabs > .el-tabs__content {

View File

@ -40,7 +40,7 @@
></div>
</div>
</div>
<div class="right-form">
<!-- <div class="right-form">
<div class="date-form">
<el-date-picker
v-model="dateForm.dateTime"
@ -83,7 +83,6 @@
</div>
</div>
<div class="question-form" v-for="item in rightForm" :key="item.monitorId">
<!-- <div class="title">{{ active === "first" ? item.projectName : item.engineeringName }}</div> -->
<div class="title">{{ item.engineeringName === null ? item.projectName : item.engineeringName }}</div>
<div class="desc">
@ -150,7 +149,7 @@
:handleCurrentChange="handleCurrentChange"
class="pagination"
/>
</div>
</div> -->
</div>
</div>
</template>