[Fix][UI] Set task group name empty of default value (#10243)

(cherry picked from commit b337eef2e6)
This commit is contained in:
Devosend 2022-05-25 19:22:07 +08:00 committed by Jiajie Zhong
parent 69db18ebd7
commit f5277570f0
2 changed files with 33 additions and 29 deletions

View File

@ -110,9 +110,6 @@ const taskGroupQueue = defineComponent({
queryTaskGroupListPaging(taskGroupOptionsParams).then( queryTaskGroupListPaging(taskGroupOptionsParams).then(
(res: TaskGroupRes) => { (res: TaskGroupRes) => {
res.totalList.map((item) => { res.totalList.map((item) => {
if (!searchParamRef.groupId) {
searchParamRef.groupId = item.id
}
const option: SelectMixedOption = { const option: SelectMixedOption = {
label: item.name, label: item.name,
value: item.id value: item.id
@ -165,6 +162,8 @@ const taskGroupQueue = defineComponent({
<NSelect <NSelect
size='small' size='small'
options={taskGroupOptions} options={taskGroupOptions}
clearable
style={{ width: '180px' }}
v-model:value={this.searchParamRef.groupId} v-model:value={this.searchParamRef.groupId}
placeholder={t('resource.task_group_queue.task_group_name')} placeholder={t('resource.task_group_queue.task_group_name')}
/> />

View File

@ -132,38 +132,43 @@ export function useTable(
pageNo: 1, pageNo: 1,
pageSize: 2147483647 pageSize: 2147483647
} }
Promise.all([ Promise.all([
queryTaskListInTaskGroupQueueById(params), queryTaskListInTaskGroupQueueById(params),
queryTaskGroupListPaging(taskGroupSearchParams) queryTaskGroupListPaging(taskGroupSearchParams)
]).then((values: any[]) => { ]).then(
const taskGroupList = values[1].totalList (values: any[]) => {
variables.totalPage = values[0].totalPage const taskGroupList = values[1].totalList
variables.tableData = values[0].totalList.map( variables.totalPage = values[0].totalPage
(item: any, unused: number) => { variables.tableData = values[0].totalList.map(
let taskGroupName = '' (item: any, unused: number) => {
if (taskGroupList) { let taskGroupName = ''
const taskGroup = _.find(taskGroupList, { id: item.groupId }) if (taskGroupList) {
if (taskGroup) { const taskGroup = _.find(taskGroupList, { id: item.groupId })
taskGroupName = taskGroup.name if (taskGroup) {
taskGroupName = taskGroup.name
}
}
item.taskGroupName = taskGroupName
item.createTime = format(
parseTime(item.createTime),
'yyyy-MM-dd HH:mm:ss'
)
item.updateTime = format(
parseTime(item.updateTime),
'yyyy-MM-dd HH:mm:ss'
)
return {
...item
} }
} }
)
},
() => {}
)
item.taskGroupName = taskGroupName variables.loadingRef = false
item.createTime = format(
parseTime(item.createTime),
'yyyy-MM-dd HH:mm:ss'
)
item.updateTime = format(
parseTime(item.updateTime),
'yyyy-MM-dd HH:mm:ss'
)
return {
...item
}
}
)
variables.loadingRef = false
})
} }
return { getTableData, variables, columns } return { getTableData, variables, columns }