|
|
|
|
@ -247,7 +247,8 @@ const processRouteQueryParams = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
code: undefined,
|
|
|
|
|
name: undefined
|
|
|
|
|
name: undefined,
|
|
|
|
|
isEnable: 'true'
|
|
|
|
|
})
|
|
|
|
|
const selectedProcessRouteId = ref<string | number | undefined>()
|
|
|
|
|
const selectedProcessRouteRow = ref<ProcessRouteVO | undefined>()
|
|
|
|
|
@ -257,6 +258,12 @@ const processRouteDisplayName = computed(() => {
|
|
|
|
|
return formData.value.processRouteName || String(formData.value.processRouteId)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const isEnabledProcessRoute = (row?: ProcessRouteVO) => {
|
|
|
|
|
if (!row) return false
|
|
|
|
|
if (row.isEnable === undefined || row.isEnable === null) return true
|
|
|
|
|
return ['true', '1'].includes(String(row.isEnable))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 打开弹窗 */
|
|
|
|
|
const open = async (type: string, id?: number, defaultData?: any) => {
|
|
|
|
|
dialogVisible.value = true
|
|
|
|
|
@ -348,7 +355,7 @@ const getProcessRouteList = async () => {
|
|
|
|
|
processRouteLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const data = await ProcessRouteApi.getProcessRoutePage(processRouteQueryParams)
|
|
|
|
|
processRouteList.value = data.list || []
|
|
|
|
|
processRouteList.value = Array.isArray(data.list) ? data.list.filter(isEnabledProcessRoute) : []
|
|
|
|
|
processRouteTotal.value = data.total || 0
|
|
|
|
|
if (selectedProcessRouteId.value) {
|
|
|
|
|
selectedProcessRouteRow.value =
|
|
|
|
|
@ -361,19 +368,24 @@ const getProcessRouteList = async () => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const openProcessRouteDialog = async () => {
|
|
|
|
|
selectedProcessRouteId.value = formData.value.processRouteId
|
|
|
|
|
selectedProcessRouteRow.value = formData.value.processRouteId
|
|
|
|
|
? {
|
|
|
|
|
id: formData.value.processRouteId,
|
|
|
|
|
name: formData.value.processRouteName
|
|
|
|
|
selectedProcessRouteId.value = undefined
|
|
|
|
|
selectedProcessRouteRow.value = undefined
|
|
|
|
|
if (formData.value.processRouteId) {
|
|
|
|
|
try {
|
|
|
|
|
const data = await ProcessRouteApi.getProcessRoute(Number(formData.value.processRouteId))
|
|
|
|
|
if (isEnabledProcessRoute(data)) {
|
|
|
|
|
selectedProcessRouteId.value = formData.value.processRouteId
|
|
|
|
|
selectedProcessRouteRow.value = data
|
|
|
|
|
}
|
|
|
|
|
: undefined
|
|
|
|
|
} catch {}
|
|
|
|
|
}
|
|
|
|
|
processRouteQueryParams.pageNo = 1
|
|
|
|
|
processRouteDialogVisible.value = true
|
|
|
|
|
await getProcessRouteList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleProcessRouteRowClick = (row: ProcessRouteVO) => {
|
|
|
|
|
if (!isEnabledProcessRoute(row)) return
|
|
|
|
|
selectedProcessRouteId.value = row.id
|
|
|
|
|
selectedProcessRouteRow.value = row
|
|
|
|
|
}
|
|
|
|
|
@ -386,6 +398,10 @@ const confirmProcessRoute = () => {
|
|
|
|
|
const row =
|
|
|
|
|
selectedProcessRouteRow.value ||
|
|
|
|
|
processRouteList.value.find((item) => String(item.id) === String(selectedProcessRouteId.value))
|
|
|
|
|
if (!isEnabledProcessRoute(row)) {
|
|
|
|
|
message.warning(t('FactoryModeling.ProductCategory.processRouteSelectRequired'))
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
formData.value.processRouteId = selectedProcessRouteId.value
|
|
|
|
|
formData.value.processRouteName = row?.name || String(selectedProcessRouteId.value)
|
|
|
|
|
processRouteDialogVisible.value = false
|
|
|
|
|
@ -405,6 +421,7 @@ const handleProcessRouteQuery = () => {
|
|
|
|
|
|
|
|
|
|
const resetProcessRouteQuery = () => {
|
|
|
|
|
processRouteQueryFormRef.value?.resetFields()
|
|
|
|
|
processRouteQueryParams.isEnable = 'true'
|
|
|
|
|
handleProcessRouteQuery()
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|