禅道bug修复
This commit is contained in:
parent
42fa793d30
commit
abfd780bf4
|
|
@ -16,7 +16,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<ComButton type="primary" icon="Search" @click="handleSearch">搜索</ComButton>
|
<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-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
@ -137,26 +137,30 @@ const getComponentProps = (item) => {
|
||||||
// 处理表单数据,将 paramsList 配置的数组值转换为指定参数名
|
// 处理表单数据,将 paramsList 配置的数组值转换为指定参数名
|
||||||
const processFormData = (data) => {
|
const processFormData = (data) => {
|
||||||
const processedData = { ...data }
|
const processedData = { ...data }
|
||||||
|
|
||||||
props.formColumns.forEach((item) => {
|
props.formColumns.forEach((item) => {
|
||||||
// 检查是否有 paramsList 配置
|
// 检查是否有 paramsList 配置
|
||||||
if (item.paramsList && Array.isArray(item.paramsList) && item.paramsList.length > 0) {
|
if (item.paramsList && Array.isArray(item.paramsList) && item.paramsList.length > 0) {
|
||||||
const value = processedData[item.prop]
|
const value = processedData[item.prop]
|
||||||
|
|
||||||
// 如果值是数组且不为空,将其拆分为指定的参数名
|
// 如果值是数组且不为空,将其拆分为指定的参数名
|
||||||
if (Array.isArray(value) && value.length > 0) {
|
if (Array.isArray(value) && value.length > 0) {
|
||||||
item.paramsList.forEach((paramName, index) => {
|
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]
|
processedData[paramName] = value[index]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除原来的数组字段,避免出现 month[0] 和 month[1] 的形式
|
// 删除原来的数组字段,避免出现 month[0] 和 month[1] 的形式
|
||||||
delete processedData[item.prop]
|
delete processedData[item.prop]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return processedData
|
return processedData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,16 @@
|
||||||
>
|
>
|
||||||
新建人员
|
新建人员
|
||||||
</ComButton>
|
</ComButton>
|
||||||
|
|
||||||
|
<ComButton
|
||||||
|
pain
|
||||||
|
type="info"
|
||||||
|
icon="Upload"
|
||||||
|
@click="onHandleImport"
|
||||||
|
v-hasPermi="['person:person:import']"
|
||||||
|
>
|
||||||
|
导入人员
|
||||||
|
</ComButton>
|
||||||
</template>
|
</template>
|
||||||
<template #longTermSecondment="{ row }">
|
<template #longTermSecondment="{ row }">
|
||||||
<el-switch
|
<el-switch
|
||||||
|
|
@ -48,6 +58,47 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
</ComDialog>
|
</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>仅允许导入xls、xlsx格式文件。</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -65,6 +116,7 @@ import {
|
||||||
} from '@/api/common.js'
|
} from '@/api/common.js'
|
||||||
import { useOptions } from '@/hooks/useOptions'
|
import { useOptions } from '@/hooks/useOptions'
|
||||||
import { bus, BUS_EVENTS } from '@/utils/bus'
|
import { bus, BUS_EVENTS } from '@/utils/bus'
|
||||||
|
import { getToken } from '@/utils/auth'
|
||||||
import config from './config'
|
import config from './config'
|
||||||
import ComTable from '@/components/ComTable/index.vue'
|
import ComTable from '@/components/ComTable/index.vue'
|
||||||
import ComButton from '@/components/ComButton/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(
|
const { options: allPositionAndInspectionStationOptions } = useOptions(
|
||||||
'allPositionAndInspectionStationOptions',
|
'allPositionAndInspectionStationOptions',
|
||||||
getInspectionStationSelectAPI,
|
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>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -532,39 +532,70 @@ const selectedManagerNames = computed(() => {
|
||||||
return (formData.value.planPersonnelList || []).map((item) => item.name).join('、')
|
return (formData.value.planPersonnelList || []).map((item) => item.name).join('、')
|
||||||
})
|
})
|
||||||
|
|
||||||
const onOpenPersonPicker = async (type = 'plan') => {
|
// 同步表格选中状态:根据 managerDialog.selected 设置表格的选中状态
|
||||||
managerDialog.type = type
|
const syncTableSelection = () => {
|
||||||
managerDialogConfig.outerVisible = true
|
if (!personTableRef.value || !managerDialogConfig.outerVisible) return
|
||||||
await nextTick()
|
nextTick(() => {
|
||||||
if (personTableRef.value) {
|
// 清空当前表格选中状态
|
||||||
personTableRef.value.clearSelection()
|
personTableRef.value.clearSelection()
|
||||||
let currentList = []
|
// 根据 managerDialog.selected 重新设置选中状态
|
||||||
if (type === 'plan') {
|
const selectedIds = new Set(managerDialog.selected.map((item) => item.id))
|
||||||
currentList = formData.value.planPersonnelList || []
|
filteredPersons.value.forEach((row) => {
|
||||||
} else if (type === 'actual') {
|
if (selectedIds.has(row.id)) {
|
||||||
currentList = formData.value.actualPersonnelList || []
|
|
||||||
} else if (type === 'highAltitude') {
|
|
||||||
currentList = formData.value.highAltitudePersonnelList || []
|
|
||||||
} else if (type === 'ground') {
|
|
||||||
currentList = formData.value.groundPersonnelList || []
|
|
||||||
} else if (type === 'actual_highAltitude') {
|
|
||||||
currentList = formData.value.actualHighAltitudePersonnelList || []
|
|
||||||
} else if (type === 'actual_ground') {
|
|
||||||
currentList = formData.value.actualGroundPersonnelList || []
|
|
||||||
}
|
|
||||||
|
|
||||||
personList.value.forEach((row) => {
|
|
||||||
const exists = currentList.find((item) => item.id === row.id)
|
|
||||||
if (exists) {
|
|
||||||
personTableRef.value.toggleRowSelection(row, true)
|
personTableRef.value.toggleRowSelection(row, true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
managerDialog.selected = [...currentList]
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听 filteredPersons 变化,重新同步表格选中状态
|
||||||
|
watch(
|
||||||
|
() => filteredPersons.value,
|
||||||
|
() => {
|
||||||
|
if (managerDialogConfig.outerVisible) {
|
||||||
|
syncTableSelection()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
const onOpenPersonPicker = async (type = 'plan') => {
|
||||||
|
managerDialog.type = type
|
||||||
|
managerDialogConfig.outerVisible = true
|
||||||
|
|
||||||
|
let currentList = []
|
||||||
|
if (type === 'plan') {
|
||||||
|
currentList = formData.value.planPersonnelList || []
|
||||||
|
} else if (type === 'actual') {
|
||||||
|
currentList = formData.value.actualPersonnelList || []
|
||||||
|
} else if (type === 'highAltitude') {
|
||||||
|
currentList = formData.value.highAltitudePersonnelList || []
|
||||||
|
} else if (type === 'ground') {
|
||||||
|
currentList = formData.value.groundPersonnelList || []
|
||||||
|
} else if (type === 'actual_highAltitude') {
|
||||||
|
currentList = formData.value.actualHighAltitudePersonnelList || []
|
||||||
|
} else if (type === 'actual_ground') {
|
||||||
|
currentList = formData.value.actualGroundPersonnelList || []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
managerDialog.selected = [...currentList]
|
||||||
|
await nextTick()
|
||||||
|
syncTableSelection()
|
||||||
}
|
}
|
||||||
|
|
||||||
const onManagerSelectionChange = (rows) => {
|
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) => {
|
const onRemoveManager = (item) => {
|
||||||
|
|
|
||||||
|
|
@ -488,10 +488,10 @@
|
||||||
<el-col :span="16">
|
<el-col :span="16">
|
||||||
<div class="person-search-bar">
|
<div class="person-search-bar">
|
||||||
<el-input
|
<el-input
|
||||||
v-model.trim="managerDialog.keyword"
|
|
||||||
placeholder="输入姓名搜索"
|
|
||||||
clearable
|
clearable
|
||||||
prefix-icon="Search"
|
prefix-icon="Search"
|
||||||
|
placeholder="输入姓名搜索"
|
||||||
|
v-model.trim="managerDialog.keyword"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<el-table
|
<el-table
|
||||||
|
|
@ -578,7 +578,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="MonthlyPlanEdit">
|
<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 { useRoute, useRouter } from 'vue-router'
|
||||||
import { updatePlanAPI } from '@/api/planMange/plan.js'
|
import { updatePlanAPI } from '@/api/planMange/plan.js'
|
||||||
import {
|
import {
|
||||||
|
|
@ -877,24 +877,54 @@ const selectedManagerNames = computed(() =>
|
||||||
formData.value.planPersonnelList.map((item) => item.name).join('、'),
|
formData.value.planPersonnelList.map((item) => item.name).join('、'),
|
||||||
)
|
)
|
||||||
|
|
||||||
const onOpenPersonPicker = async () => {
|
// 同步表格选中状态:根据 managerDialog.selected 设置表格的选中状态
|
||||||
managerDialog.visible = true
|
const syncTableSelection = () => {
|
||||||
managerDialogConfig.outerVisible = true
|
if (!personTableRef.value || !managerDialog.visible) return
|
||||||
await nextTick()
|
nextTick(() => {
|
||||||
if (personTableRef.value) {
|
// 清空当前表格选中状态
|
||||||
personTableRef.value.clearSelection()
|
personTableRef.value.clearSelection()
|
||||||
personList.value.forEach((row) => {
|
// 根据 managerDialog.selected 重新设置选中状态
|
||||||
const exists = formData.value.planPersonnelList.find((item) => item.id === row.id)
|
const selectedIds = new Set(managerDialog.selected.map((item) => item.id))
|
||||||
if (exists) {
|
filteredPersons.value.forEach((row) => {
|
||||||
|
if (selectedIds.has(row.id)) {
|
||||||
personTableRef.value.toggleRowSelection(row, true)
|
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]
|
managerDialog.selected = [...formData.value.planPersonnelList]
|
||||||
|
await nextTick()
|
||||||
|
syncTableSelection()
|
||||||
}
|
}
|
||||||
|
|
||||||
const onManagerSelectionChange = (rows) => {
|
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) => {
|
const onRemoveManager = (item) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue