禅道bug修复

This commit is contained in:
BianLzhaoMin 2026-01-12 10:58:58 +08:00
parent 42fa793d30
commit abfd780bf4
4 changed files with 250 additions and 44 deletions

View File

@ -16,7 +16,7 @@
</el-form-item>
<el-form-item>
<ComButton type="primary" icon="Search" @click="handleSearch">搜索</ComButton>
<ComButton icon="Refresh" @click="handleReset">重置</ComButton>
<ComButton type="warning" plain icon="Refresh" @click="handleReset">重置</ComButton>
</el-form-item>
</el-form>
</el-card>
@ -146,7 +146,11 @@ const processFormData = (data) => {
//
if (Array.isArray(value) && value.length > 0) {
item.paramsList.forEach((paramName, index) => {
if (value[index] !== undefined && value[index] !== null && value[index] !== '') {
if (
value[index] !== undefined &&
value[index] !== null &&
value[index] !== ''
) {
processedData[paramName] = value[index]
}
})

View File

@ -19,6 +19,16 @@
>
新建人员
</ComButton>
<ComButton
pain
type="info"
icon="Upload"
@click="onHandleImport"
v-hasPermi="['person:person:import']"
>
导入人员
</ComButton>
</template>
<template #longTermSecondment="{ row }">
<el-switch
@ -48,6 +58,47 @@
</el-row>
</template>
</ComDialog>
<!-- 人员导入对话框 -->
<ComDialog :dialog-config="uploadDialogConfig" @closeDialogOuter="onCloseUploadDialog">
<template #outerContent>
<el-upload
ref="uploadRef"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:on-change="handleFileChange"
:on-remove="handleFileRemove"
:auto-upload="false"
drag
>
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<template #tip>
<div class="el-upload__tip text-center">
<span>仅允许导入xlsxlsx格式文件</span>
<el-link
type="primary"
:underline="false"
style="font-size: 12px; vertical-align: baseline"
@click="onHandleDownloadTemplate"
>
下载模板
</el-link>
</div>
</template>
</el-upload>
<el-row class="common-btn-row">
<ComButton plain type="info" @click="onCloseUploadDialog">取消</ComButton>
<ComButton type="primary" @click="submitFileForm">确定</ComButton>
</el-row>
</template>
</ComDialog>
</div>
</template>
@ -65,6 +116,7 @@ import {
} from '@/api/common.js'
import { useOptions } from '@/hooks/useOptions'
import { bus, BUS_EVENTS } from '@/utils/bus'
import { getToken } from '@/utils/auth'
import config from './config'
import ComTable from '@/components/ComTable/index.vue'
import ComButton from '@/components/ComButton/index.vue'
@ -86,6 +138,28 @@ const editId = ref(null)
// {},
// )
//
const uploadDialogConfig = reactive({
outerVisible: false,
outerTitle: '人员导入',
outerWidth: '400px',
minHeight: '300px',
maxHeight: '70vh',
})
//
const upload = reactive({
//
isUploading: false,
//
updateSupport: 0,
//
headers: { Authorization: 'Bearer ' + getToken() },
//
url: import.meta.env.VITE_APP_BASE_API + '/personnel/importPersonnel',
selectedFile: null,
})
const { options: allPositionAndInspectionStationOptions } = useOptions(
'allPositionAndInspectionStationOptions',
getInspectionStationSelectAPI,
@ -252,4 +326,71 @@ const onHandleLongTermSecondmentChange = (value, row) => {
}
})
}
//
const onHandleImport = () => {
uploadDialogConfig.outerTitle = '人员导入'
uploadDialogConfig.outerVisible = true
upload.selectedFile = null
upload.updateSupport = 0
}
//
const onCloseUploadDialog = () => {
uploadDialogConfig.outerVisible = false
upload.selectedFile = null
upload.isUploading = false
if (uploadRef.value) {
uploadRef.value.clearFiles()
}
}
//
const handleFileUploadProgress = (event, file, fileList) => {
upload.isUploading = true
}
//
const handleFileChange = (file, fileList) => {
upload.selectedFile = file
}
//
const handleFileRemove = (file, fileList) => {
upload.selectedFile = null
}
//
const handleFileSuccess = (response, file, fileList) => {
uploadDialogConfig.outerVisible = false
upload.isUploading = false
uploadRef.value?.handleRemove(file)
proxy.$alert(
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
response.msg +
'</div>',
'导入结果',
{ dangerouslyUseHTMLString: true },
)
comTableRef.value?.refresh()
}
//
const submitFileForm = () => {
const file = upload.selectedFile
if (
!file ||
file.length === 0 ||
(!file.name.toLowerCase().endsWith('.xls') && !file.name.toLowerCase().endsWith('.xlsx'))
) {
proxy.$modal.msgError('请选择后缀为 "xls"或"xlsx"的文件。')
return
}
uploadRef.value?.submit()
}
//
const onHandleDownloadTemplate = () => {
proxy.download('/personnel/downloadPersonnelExcel', {}, `人员模板.xlsx`)
}
</script>

View File

@ -532,12 +532,36 @@ const selectedManagerNames = computed(() => {
return (formData.value.planPersonnelList || []).map((item) => item.name).join('、')
})
// managerDialog.selected
const syncTableSelection = () => {
if (!personTableRef.value || !managerDialogConfig.outerVisible) return
nextTick(() => {
//
personTableRef.value.clearSelection()
// managerDialog.selected
const selectedIds = new Set(managerDialog.selected.map((item) => item.id))
filteredPersons.value.forEach((row) => {
if (selectedIds.has(row.id)) {
personTableRef.value.toggleRowSelection(row, true)
}
})
})
}
// filteredPersons
watch(
() => filteredPersons.value,
() => {
if (managerDialogConfig.outerVisible) {
syncTableSelection()
}
},
)
const onOpenPersonPicker = async (type = 'plan') => {
managerDialog.type = type
managerDialogConfig.outerVisible = true
await nextTick()
if (personTableRef.value) {
personTableRef.value.clearSelection()
let currentList = []
if (type === 'plan') {
currentList = formData.value.planPersonnelList || []
@ -553,18 +577,25 @@ const onOpenPersonPicker = async (type = 'plan') => {
currentList = formData.value.actualGroundPersonnelList || []
}
personList.value.forEach((row) => {
const exists = currentList.find((item) => item.id === row.id)
if (exists) {
personTableRef.value.toggleRowSelection(row, true)
}
})
managerDialog.selected = [...currentList]
}
await nextTick()
syncTableSelection()
}
const onManagerSelectionChange = (rows) => {
managerDialog.selected = [...rows]
// ID
const currentFilteredIds = new Set(filteredPersons.value.map((row) => row.id))
//
const keptSelected = managerDialog.selected.filter(
(person) => !currentFilteredIds.has(person.id),
)
//
const selectedInFiltered = rows
// +
managerDialog.selected = [...keptSelected, ...selectedInFiltered]
}
const onRemoveManager = (item) => {

View File

@ -488,10 +488,10 @@
<el-col :span="16">
<div class="person-search-bar">
<el-input
v-model.trim="managerDialog.keyword"
placeholder="输入姓名搜索"
clearable
prefix-icon="Search"
placeholder="输入姓名搜索"
v-model.trim="managerDialog.keyword"
/>
</div>
<el-table
@ -578,7 +578,7 @@
</template>
<script setup name="MonthlyPlanEdit">
import { ref, reactive, computed, getCurrentInstance, nextTick, onMounted } from 'vue'
import { ref, reactive, computed, getCurrentInstance, nextTick, onMounted, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { updatePlanAPI } from '@/api/planMange/plan.js'
import {
@ -877,24 +877,54 @@ const selectedManagerNames = computed(() =>
formData.value.planPersonnelList.map((item) => item.name).join('、'),
)
const onOpenPersonPicker = async () => {
managerDialog.visible = true
managerDialogConfig.outerVisible = true
await nextTick()
if (personTableRef.value) {
// managerDialog.selected
const syncTableSelection = () => {
if (!personTableRef.value || !managerDialog.visible) return
nextTick(() => {
//
personTableRef.value.clearSelection()
personList.value.forEach((row) => {
const exists = formData.value.planPersonnelList.find((item) => item.id === row.id)
if (exists) {
// managerDialog.selected
const selectedIds = new Set(managerDialog.selected.map((item) => item.id))
filteredPersons.value.forEach((row) => {
if (selectedIds.has(row.id)) {
personTableRef.value.toggleRowSelection(row, true)
}
})
})
}
// filteredPersons
watch(
() => filteredPersons.value,
() => {
if (managerDialog.visible) {
syncTableSelection()
}
},
)
const onOpenPersonPicker = async () => {
managerDialog.visible = true
managerDialogConfig.outerVisible = true
managerDialog.selected = [...formData.value.planPersonnelList]
await nextTick()
syncTableSelection()
}
const onManagerSelectionChange = (rows) => {
managerDialog.selected = [...rows]
// ID
const currentFilteredIds = new Set(filteredPersons.value.map((row) => row.id))
//
const keptSelected = managerDialog.selected.filter(
(person) => !currentFilteredIds.has(person.id),
)
//
const selectedInFiltered = rows
// +
managerDialog.selected = [...keptSelected, ...selectedInFiltered]
}
const onRemoveManager = (item) => {