|
|
|
|
@ -504,6 +504,7 @@ import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
|
|
|
import { isHexColor } from '@/utils/color'
|
|
|
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
|
|
|
import { useUserStore } from '@/store/modules/user'
|
|
|
|
|
import * as ConfigApi from '@/api/infra/config'
|
|
|
|
|
|
|
|
|
|
defineOptions({ name: 'MoldMaintainView' })
|
|
|
|
|
|
|
|
|
|
@ -523,6 +524,8 @@ const userStore = useUserStore()
|
|
|
|
|
|
|
|
|
|
const submitLoading = ref(false)
|
|
|
|
|
const maintainFormRef = ref()
|
|
|
|
|
const pressNetConfigLoaded = ref(false)
|
|
|
|
|
const isPressNetHidden = ref(false)
|
|
|
|
|
|
|
|
|
|
// 表单验证规则
|
|
|
|
|
const formRules = reactive({
|
|
|
|
|
@ -619,6 +622,7 @@ const loadSubMoldList = async () => {
|
|
|
|
|
const isInspectOrMaintain = computed(() => [1, 2].includes(maintainFormData.maintainType ?? 0))
|
|
|
|
|
const isRepair = computed(() => maintainFormData.maintainType === 3)
|
|
|
|
|
const isReplaceNet = computed(() => maintainFormData.maintainType === 4)
|
|
|
|
|
const showPressNet = computed(() => pressNetConfigLoaded.value && !isPressNetHidden.value)
|
|
|
|
|
const repairCodeDisabled = computed(() => repairFormData.isCode === true)
|
|
|
|
|
const failureLevelOptions = computed(() => getStrDictOptions(DICT_TYPE.FAILURE_LEVEL))
|
|
|
|
|
|
|
|
|
|
@ -657,7 +661,9 @@ const maintainTypes = computed(() => [
|
|
|
|
|
{ value: 1, label: t('MoldManagement.MoldBrandPage.maintainTypeInspect'), icon: Search },
|
|
|
|
|
{ value: 2, label: t('MoldManagement.MoldBrandPage.maintainTypeMaintain'), icon: Tools },
|
|
|
|
|
{ value: 3, label: t('MoldManagement.MoldBrandPage.maintainTypeRepair'), icon: EditPen },
|
|
|
|
|
{ value: 4, label: t('MoldManagement.MoldBrandPage.maintainTypeReplaceNet'), icon: RefreshRight }
|
|
|
|
|
...(showPressNet.value
|
|
|
|
|
? [{ value: 4, label: t('MoldManagement.MoldBrandPage.maintainTypeReplaceNet'), icon: RefreshRight }]
|
|
|
|
|
: [])
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
// 项目表单下拉选项(用于旧逻辑兼容,不再使用 select 下拉展示)
|
|
|
|
|
@ -889,6 +895,7 @@ const handleMaintainTypeChange = () => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const selectMaintainType = async (type: number) => {
|
|
|
|
|
if (type === 4 && !showPressNet.value) return
|
|
|
|
|
maintainFormData.maintainType = type
|
|
|
|
|
if (type === 3 && !repairFormData.requireDate) {
|
|
|
|
|
repairFormData.requireDate = Date.now()
|
|
|
|
|
@ -1012,11 +1019,25 @@ const submitForm = async () => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const loadPressNetConfig = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const data = await ConfigApi.getConfigPage({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
key: 'isHidePressNet'
|
|
|
|
|
} as PageParam & { key: string })
|
|
|
|
|
const config = data?.list?.find((item) => item?.key === 'isHidePressNet')
|
|
|
|
|
isPressNetHidden.value = String(config?.value ?? '') === '1'
|
|
|
|
|
} finally {
|
|
|
|
|
pressNetConfigLoaded.value = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const open = async () => {
|
|
|
|
|
maintainFormData.maintainType = 1
|
|
|
|
|
repairFormData.requireDate = Date.now()
|
|
|
|
|
replaceNetFormData.pressureNetTime = getCurrentDateTime()
|
|
|
|
|
await initOptions()
|
|
|
|
|
await Promise.all([loadPressNetConfig(), initOptions()])
|
|
|
|
|
if (!userStore.getIsSetUser) {
|
|
|
|
|
try {
|
|
|
|
|
await userStore.setUserInfoAction()
|
|
|
|
|
|