禅道bug修复
This commit is contained in:
parent
42fa793d30
commit
abfd780bf4
|
|
@ -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]
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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>仅允许导入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>
|
||||
</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>
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue