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 = () => { export const attendanceStatistics = () => {
return http.get(BASEURL + `/gov/workerStat/attendStatistics`); 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 }) => { // export const getVideo = (params: { projectSn?: string; engineeringSn?: string }) => {

View File

@ -44,7 +44,6 @@
<el-form-item> <el-form-item>
<el-button type="primary" @click="handleSearch">查询</el-button> <el-button type="primary" @click="handleSearch">查询</el-button>
<el-button style="background-color: #ffb750; color: #fff">刷新</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-item>
</el-form> </el-form>
<!-- </div> --> <!-- </div> -->
@ -57,13 +56,6 @@
<div class="page_text flx-justify-column"> <div class="page_text flx-justify-column">
<div class="img_title"> <div class="img_title">
<span>{{ item.title }}</span> <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>
<div class="img_bottom"> <div class="img_bottom">
<!-- <div class="position" style="font-size: 12px">位置{{ item.deviceName }}</div> --> <!-- <div class="position" style="font-size: 12px">位置{{ item.deviceName }}</div> -->
@ -90,62 +82,13 @@
</div> </div>
</div> </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> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, onMounted, watch } from "vue"; 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 Pagination from "@/components/ProTable/components/Pagination.vue";
import { ElMessage, UploadProps } from "element-plus"; import { ElMessage, UploadProps } from "element-plus";
import type { FormRules, FormInstance, UploadInstance } from "element-plus";
import { GlobalStore } from "@/stores"; 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 LeftMenu from "@/components/LeftMenu/LeftMenu.vue";
import type { ResAiProjectPage, ResAiEngineerPage } from "@/api/types/government/AIwaring"; import type { ResAiProjectPage, ResAiEngineerPage } from "@/api/types/government/AIwaring";
import changeTheme from "@/components/changeTheme/index.vue"; import changeTheme from "@/components/changeTheme/index.vue";
@ -157,12 +100,7 @@ const pages = ref({
}); });
const records = ref<ResAiProjectPage[] | ResAiEngineerPage[]>([]); const records = ref<ResAiProjectPage[] | ResAiEngineerPage[]>([]);
const active = ref(0); const active = ref(0);
const upload = ref<UploadInstance>();
const fileList = ref([]);
const store = GlobalStore(); const store = GlobalStore();
const headers = ref({ Authorization: "Bearer " + store.token });
const ruleFormRef = ref<FormInstance>();
const baseUrl = import.meta.env.VITE_API_URL;
interface formData { interface formData {
title: string; title: string;
uploadTime: string; uploadTime: string;
@ -176,46 +114,7 @@ const formData = ref<formData>({
videoUrl: "" videoUrl: ""
}); });
const background = ref(true); 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({ const pageable = ref({
pageNo: 1, pageNo: 1,
pageSize: 12, pageSize: 12,
@ -237,15 +136,6 @@ const searchSn = ref("");
// //
const searchName = ref<string>(""); const searchName = ref<string>("");
//
const beforeUpload = file => {
console.log(file);
const type = file.type;
if (type != "video/mp4") {
ElMessage.error("请上传视频文件");
return false;
}
};
// div // div
const onSearch = async (params: ResAiProjectPage | ResAiEngineerPage) => { const onSearch = async (params: ResAiProjectPage | ResAiEngineerPage) => {
const { result } = await getUnmannedPage( const { result } = await getUnmannedPage(
@ -290,88 +180,16 @@ const onCurChange = async (params: number) => {
} }
pages.value.total = +res.result.total; pages.value.total = +res.result.total;
}; };
//
const deleteAccount = async (params: jxj_User.ResUserList) => {
await useHandleData(videoDataDelete, { id: params.id }, `删除`);
getVideoData();
};
const handleSearch = () => { const handleSearch = () => {
console.log(666); console.log(666);
getVideoData(); 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 getVideoData = async () => {
const res = await getUnmannedPage({ ...pageable.value, ...form.value }); const res = await getUnmannedPage({ ...pageable.value, ...form.value });
videoData.value.records = res.result.records; videoData.value.records = res.result.records;
console.log(videoData.value); console.log(videoData.value);
console.log(res); 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) => {}; const handleCurrentChange = async (page: number) => {};
// form // form

View File

@ -16,7 +16,7 @@
<div class="statistics-search"> <div class="statistics-search">
<el-card shadow="never" class="topCard"> <el-card shadow="never" class="topCard">
<span style="margin: 0 10px 2px 0">人员分类</span> <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-option v-for="item in categoryList" :key="item.value" :label="item.label" :value="item.value" />
</el-select> </el-select>
<span style="margin: 0 10px 2px 20px">提交时间</span> <span style="margin: 0 10px 2px 20px">提交时间</span>
@ -24,12 +24,13 @@
v-model="searchForm.dateRange" v-model="searchForm.dateRange"
style="width: 300px" style="width: 300px"
type="daterange" type="daterange"
valueFormat="YYYY-MM-DD"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
> >
</el-date-picker> </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> </el-card>
</div> </div>
<div class="statistics-echart"> <div class="statistics-echart">
@ -43,22 +44,8 @@
<script setup lang="tsx" name="ProjectSupervisionRecord"> <script setup lang="tsx" name="ProjectSupervisionRecord">
import { ref, reactive, nextTick, onMounted } from "vue"; import { ref, reactive, nextTick, onMounted } from "vue";
import { ElMessage, ElMessageBox, ElTree, FormInstance } from "element-plus"; import { ElMessage, ElMessageBox } from "element-plus";
import { useRouter } from "vue-router"; import { attendanceStatistics, attendanceData } from "@/api/modules/goverment";
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 { GlobalStore } from "@/stores"; import { GlobalStore } from "@/stores";
import * as echarts from "echarts"; import * as echarts from "echarts";
import { useEcharts } from "@/hooks/useEcharts"; import { useEcharts } from "@/hooks/useEcharts";
@ -105,30 +92,7 @@ const categoryList = ref([
value: 2 value: 2
} }
]); ]);
// const drawEcharts = () => {
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();
let myChart: echarts.ECharts = echarts.init(echartsRef.value as HTMLElement); let myChart: echarts.ECharts = echarts.init(echartsRef.value as HTMLElement);
let option: echarts.EChartsOption = { let option: echarts.EChartsOption = {
tooltip: { tooltip: {
@ -229,6 +193,28 @@ onMounted(() => {
] ]
}; };
useEcharts(myChart, option); 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> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

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

View File

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