|
|
|
|
@ -22,13 +22,16 @@
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="项目表单" prop="projectForm">
|
|
|
|
|
<el-input
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.projectForm"
|
|
|
|
|
placeholder="请输入项目表单"
|
|
|
|
|
multiple
|
|
|
|
|
filterable
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
placeholder="请选择项目表单"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
/>
|
|
|
|
|
>
|
|
|
|
|
<el-option v-for="item in planOptions" :key="String(item.id)" :label="item.planName" :value="String(item.id)" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button @click="handleQuery">
|
|
|
|
|
@ -71,7 +74,7 @@
|
|
|
|
|
<span v-else>-</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="项目表单" align="center" prop="projectForm" min-width="140" />
|
|
|
|
|
<el-table-column label="项目表单" align="center" prop="projectFormName" min-width="140" />
|
|
|
|
|
<el-table-column label="开始日期" align="center" prop="startDate" :formatter="dateFormatter2" width="120" />
|
|
|
|
|
<el-table-column label="结束日期" align="center" prop="endDate" :formatter="dateFormatter2" width="120" />
|
|
|
|
|
<el-table-column label="cron 表达式" align="center" prop="cronExpression" min-width="180" />
|
|
|
|
|
@ -124,6 +127,7 @@ import { DICT_TYPE } from '@/utils/dict'
|
|
|
|
|
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
|
|
|
|
|
import download from '@/utils/download'
|
|
|
|
|
import { TaskManagementApi, TaskManagementVO } from '@/api/mes/taskManagement'
|
|
|
|
|
import { PlanMaintenanceApi } from '@/api/mes/planmaintenance'
|
|
|
|
|
import TaskManagementForm from './TaskManagementForm.vue'
|
|
|
|
|
|
|
|
|
|
defineOptions({ name: 'TaskManagement' })
|
|
|
|
|
@ -142,19 +146,52 @@ const total = ref(0)
|
|
|
|
|
const exportLoading = ref(false)
|
|
|
|
|
const selectedIds = ref<number[]>([])
|
|
|
|
|
|
|
|
|
|
type PlanOption = {
|
|
|
|
|
id: number | string
|
|
|
|
|
planName: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const planOptions = ref<PlanOption[]>([])
|
|
|
|
|
|
|
|
|
|
const queryParams = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
name: undefined as string | undefined,
|
|
|
|
|
taskType: undefined as number | undefined,
|
|
|
|
|
projectForm: undefined as string | undefined
|
|
|
|
|
projectForm: [] as string[]
|
|
|
|
|
})
|
|
|
|
|
const queryFormRef = ref()
|
|
|
|
|
|
|
|
|
|
const parseIdsValue = (value: any): string[] => {
|
|
|
|
|
if (!value) return []
|
|
|
|
|
if (Array.isArray(value)) return value.map((v) => String(v).trim()).filter(Boolean)
|
|
|
|
|
return String(value)
|
|
|
|
|
.split(',')
|
|
|
|
|
.map((v) => v.trim())
|
|
|
|
|
.filter(Boolean)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const toCommaSeparatedIds = (value: any): string | undefined => {
|
|
|
|
|
const ids = parseIdsValue(value)
|
|
|
|
|
return ids.length ? ids.join(',') : undefined
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ensurePlanOptionsLoaded = async () => {
|
|
|
|
|
const planRes = await PlanMaintenanceApi.getPlanMaintenancePage({ pageNo: 1, pageSize: 100 })
|
|
|
|
|
planOptions.value = (planRes?.list ?? []) as PlanOption[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const buildQueryParams = () => {
|
|
|
|
|
return {
|
|
|
|
|
...queryParams,
|
|
|
|
|
projectForm: toCommaSeparatedIds(queryParams.projectForm)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const data = await TaskManagementApi.getTaskManagementPage(queryParams)
|
|
|
|
|
const data = await TaskManagementApi.getTaskManagementPage(buildQueryParams())
|
|
|
|
|
list.value = data.list
|
|
|
|
|
total.value = data.total
|
|
|
|
|
} finally {
|
|
|
|
|
@ -211,7 +248,7 @@ const handleExport = async () => {
|
|
|
|
|
try {
|
|
|
|
|
await message.exportConfirm()
|
|
|
|
|
exportLoading.value = true
|
|
|
|
|
const params: Record<string, any> = { ...queryParams }
|
|
|
|
|
const params: Record<string, any> = buildQueryParams()
|
|
|
|
|
if (selectedIds.value.length > 0) {
|
|
|
|
|
params.ids = selectedIds.value.join(',')
|
|
|
|
|
}
|
|
|
|
|
@ -224,6 +261,6 @@ const handleExport = async () => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getList()
|
|
|
|
|
Promise.all([ensurePlanOptionsLoaded(), getList()])
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|