修复bug

This commit is contained in:
wangchengming 2025-09-04 11:30:36 +08:00
parent 0ae268ecab
commit 2e54b178f5
7 changed files with 118 additions and 26 deletions

View File

@ -1,7 +1,7 @@
<template>
<div class="pdf-viewer">
<div class="pdf-viewer" v-loading="loading">
<vue-pdf-embed :source="pdfUrl" :page="currentPage" :style="`transform: scale(${scale})`"
class="pdf-document" />
@loaded="handlePdfLoaded" @progress="handleProgress" class="pdf-document" />
<div class="pdf-controls">
<el-button @click="prevPage" :disabled="currentPage <= 1">上一页</el-button>
@ -29,14 +29,31 @@ const props = defineProps({
})
const currentPage = ref(1)
const pageCount = ref(1)
const scale = ref(1)
const progress = ref(0)
const loading = ref(false)
const handlePdfLoaded = (pdf) => {
console.log('PDF 加载完成', pdf)
loading.value = false
pageCount.value = pdf.numPages
}
const handleProgress = (progressData) => {
progress.value = Math.round(progressData.loaded / progressData.total * 100)
console.log(progress.value)
if(progress.value < 100) loading.value = true
else loading.value = false
}
const prevPage = () => {
if (currentPage.value > 1) currentPage.value--
}
const nextPage = () => {
if (currentPage.value < props.pageCount) currentPage.value++
if (currentPage.value < pageCount.value) currentPage.value++
}
const zoomIn = () => {

View File

@ -1,7 +1,7 @@
<template>
<div class="pdf-viewer">
<div class="pdf-viewer" v-loading="loading">
<vue-pdf-embed :source="pdfUrl" :page="currentPage" :style="`transform: scale(${scale})`"
class="pdf-document" />
@loaded="handlePdfLoaded" @progress="handleProgress" class="pdf-document" />
<div class="pdf-controls">
<el-button @click="prevPage" :disabled="currentPage <= 1">上一页</el-button>
@ -29,14 +29,31 @@ const props = defineProps({
})
const currentPage = ref(1)
const pageCount = ref(1)
const scale = ref(1)
const progress = ref(0)
const loading = ref(false)
const handlePdfLoaded = (pdf) => {
console.log('PDF 加载完成', pdf)
loading.value = false
pageCount.value = pdf.numPages
}
const handleProgress = (progressData) => {
progress.value = Math.round(progressData.loaded / progressData.total * 100)
console.log(progress.value)
if(progress.value < 100) loading.value = true
else loading.value = false
}
const prevPage = () => {
if (currentPage.value > 1) currentPage.value--
}
const nextPage = () => {
if (currentPage.value < props.pageCount) currentPage.value++
if (currentPage.value < pageCount.value) currentPage.value++
}
const zoomIn = () => {

View File

@ -1,7 +1,7 @@
<template>
<div class="pdf-viewer">
<div class="pdf-viewer" v-loading="loading">
<vue-pdf-embed :source="pdfUrl" :page="currentPage" :style="`transform: scale(${scale})`"
class="pdf-document" />
@loaded="handlePdfLoaded" @progress="handleProgress" class="pdf-document" />
<div class="pdf-controls">
<el-button @click="prevPage" :disabled="currentPage <= 1">上一页</el-button>
@ -29,14 +29,31 @@ const props = defineProps({
})
const currentPage = ref(1)
const pageCount = ref(1)
const scale = ref(1)
const progress = ref(0)
const loading = ref(false)
const handlePdfLoaded = (pdf) => {
console.log('PDF 加载完成', pdf)
loading.value = false
pageCount.value = pdf.numPages
}
const handleProgress = (progressData) => {
progress.value = Math.round(progressData.loaded / progressData.total * 100)
console.log(progress.value)
if(progress.value < 100) loading.value = true
else loading.value = false
}
const prevPage = () => {
if (currentPage.value > 1) currentPage.value--
}
const nextPage = () => {
if (currentPage.value < props.pageCount) currentPage.value++
if (currentPage.value < pageCount.value) currentPage.value++
}
const zoomIn = () => {
@ -57,7 +74,7 @@ const zoomOut = () => {
.pdf-document {
flex: 1;
overflow: auto;
overflow: auto;
transform-origin: top left;
}

View File

@ -1,7 +1,7 @@
<template>
<div class="pdf-viewer">
<div class="pdf-viewer" v-loading="loading">
<vue-pdf-embed :source="pdfUrl" :page="currentPage" :style="`transform: scale(${scale})`"
class="pdf-document" />
@loaded="handlePdfLoaded" @progress="handleProgress" class="pdf-document" />
<div class="pdf-controls">
<el-button @click="prevPage" :disabled="currentPage <= 1">上一页</el-button>
@ -29,14 +29,31 @@ const props = defineProps({
})
const currentPage = ref(1)
const pageCount = ref(1)
const scale = ref(1)
const progress = ref(0)
const loading = ref(false)
const handlePdfLoaded = (pdf) => {
console.log('PDF 加载完成', pdf)
loading.value = false
pageCount.value = pdf.numPages
}
const handleProgress = (progressData) => {
progress.value = Math.round(progressData.loaded / progressData.total * 100)
console.log(progress.value)
if(progress.value < 100) loading.value = true
else loading.value = false
}
const prevPage = () => {
if (currentPage.value > 1) currentPage.value--
}
const nextPage = () => {
if (currentPage.value < props.pageCount) currentPage.value++
if (currentPage.value < pageCount.value) currentPage.value++
}
const zoomIn = () => {

View File

@ -92,6 +92,15 @@
<el-text v-if="scope.row.level == 3" type="danger" class="dangerText">主要偏差</el-text>
<el-text v-if="scope.row.level == 2" type="danger" class="infoinfoText">一般偏差</el-text>
<el-text v-if="scope.row.level == 1" type="success" class="successText">建议项</el-text>
<el-text v-if="scope.row.level == 4" type="success" class="yxText">优秀项</el-text>
</template>
</el-table-column>
<el-table-column prop="correctionFlag" label="是否整改" align="center" width="120">
<template #default="scope">
<el-text v-if="scope.row.correctionFlag == 1" type="danger"
class="dangerText"></el-text>
<el-text v-if="scope.row.correctionFlag == 0" type="danger"
class="successText"></el-text>
</template>
</el-table-column>
<el-table-column prop="chargeUserName" label="整改负责人" width="120" />
@ -135,7 +144,7 @@ const showTableData = ref([])
//
const cachShowTableData = ref([])
//
const ToolOptions = ref(['全部', '主要偏差', '一般偏差', '建议项'])
const ToolOptions = ref(['全部', '主要偏差', '一般偏差', '建议项', '优秀项'])
const activeIndex = ref(0)
const levelList = ref([
{ title: '高压安全审查' },
@ -179,7 +188,7 @@ const getListByDependencyList = (_dependencyId) => {
const handleYearChange = (value) => {
console.log('选中的值:', value)
//
detailForm.value = allSafetyData.value.find(item => item.year === value);
detailForm.value = allSafetyData.value.find(item => item.year === value);
detailForm?.value.reviewProblemList.forEach(item => {
showTableData.value.push(item)
cachShowTableData.value.push(item)
@ -191,6 +200,7 @@ const handleChangeLeve = (index, _level) => {
if (_level == '主要偏差') showTableData.value = cachShowTableData.value.filter(item => item.level == 3)
else if (_level == '一般偏差') showTableData.value = cachShowTableData.value.filter(item => item.level == 2)
else if (_level == '建议项') showTableData.value = cachShowTableData.value.filter(item => item.level == 1)
else if (_level == '优秀项') showTableData.value = cachShowTableData.value.filter(item => item.level == 4)
else showTableData.value = cachShowTableData.value
}
@ -311,6 +321,13 @@ const handleChangeLeve = (index, _level) => {
color: #00B32A;
}
.yxText {
font-family: Microsoft YaHei;
font-weight: 400;
font-size: 18px;
color: #767C81;
}
.dangerText {
font-family: Microsoft YaHei;
font-weight: 400;

View File

@ -123,9 +123,10 @@
<el-text v-if="scope.row.correctionFlag == 1 && !scope.row.editFlag" type="danger"
class="dangerText"></el-text>
<el-text v-if="scope.row.correctionFlag == 0 && !scope.row.editFlag" type="danger"
class="successText"></el-text>
<el-select v-show="scope.row.editFlag" v-model="scope.row.correctionFlag" placeholder="请选择"
clearable style="width: 86px">
class="successText"></el-text>
<el-select v-show="scope.row.editFlag" v-model="scope.row.correctionFlag"
placeholder="请选择" clearable style="width: 86px"
@change="handleChangeCorrectionFlag($event, scope.row)">
<el-option v-for="item in correctionFlagList" :key="item.value" :label="item.label"
:value="item.value" />
</el-select>
@ -359,7 +360,7 @@ const handleAddProblem = () => {
chargeUserId: escUserId.value,
chargeUserName: escUserName.value,
planDoneTime: null,
state: 0,
state: null,
editFlag: true
}
showTableData.value.push(itemProblem)
@ -395,6 +396,12 @@ const handleCancelClick = (row, rowIndex) => {
//
handleCountOpenItemCount()
}
//
const handleChangeCorrectionFlag = (val, row) => {
console.log('sad', val, row)
if (val == 1) row.state = 0
else row.state = null
}
//
const handleChangeLeve = (index, _level) => {
activeIndex.value = index

View File

@ -27,11 +27,11 @@
</li>
<li class="list-group-item">
<svg-icon icon-class="tree" />所属部门
<div class="pull-right" v-if="state.user.dept">{{ state.user.dept.deptName }} / {{ state.postGroup }}</div>
<div class="pull-right" v-if="state.user.dept">{{ state.user.dept?.deptName }}</div>
</li>
<li class="list-group-item">
<svg-icon icon-class="peoples" />所属角色
<div class="pull-right">{{ state.roleGroup }}</div>
<div class="pull-right" v-if="state.roleGroup">{{ state.roleGroup.roleName }}</div>
</li>
<li class="list-group-item">
<svg-icon icon-class="date" />创建日期
@ -66,7 +66,7 @@
import userAvatar from "./userAvatar"
import userInfo from "./userInfo"
import resetPwd from "./resetPwd"
import { getUserProfile } from "@/api/system/user"
import { getUserInfo } from "@/api/system/user"
const route = useRoute()
const selectedTab = ref("userinfo")
@ -77,10 +77,10 @@ const state = reactive({
})
function getUser() {
getUserProfile().then(response => {
state.user = response.data
state.roleGroup = response.roleGroup
state.postGroup = response.postGroup
getUserInfo().then(response => {
state.user = response.data
console.log(state.user)
state.roleGroup = response.data.roles.length > 0 ? response.data.roles[0] : null
})
}