style:模具-压网记录隐藏根据系统参数判断

main
黄伟杰 2 days ago
parent 12e4be5a07
commit 869347ed46

@ -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()

@ -388,7 +388,7 @@
</el-steps>
</div>
</el-tab-pane>
<el-tab-pane :label="t('MoldManagement.MoldBrandDetail.pressureNetRecord')" name="pressureNet">
<el-tab-pane v-if="showPressNet" :label="t('MoldManagement.MoldBrandDetail.pressureNetRecord')" name="pressureNet">
<div v-loading="pressureNetLoading">
<el-form :inline="true" class="device-ledger-tab-toolbar">
<el-form-item :label="t('MoldManagement.MoldBrandDetail.pressureNetTime')">
@ -517,6 +517,7 @@ import { MoldBrandApi, type MoldBrandVO } from '@/api/erp/mold'
import { TicketManagementApi } from '@/api/mold/ticketManagement'
import { MoldRepairApi } from '@/api/mold/moldrepair'
import { MoldOperateApi } from '@/api/mes/moldoperate'
import * as ConfigApi from '@/api/infra/config'
import QrcodeActionCard from '@/components/QrcodeActionCard/index.vue'
defineOptions({ name: 'ErpMoldBrandDetail' })
@ -532,6 +533,8 @@ const detailData = ref<(MoldBrandVO & Record<string, any>) | null>(null)
const childMolds = ref<any[]>([])
const activeTab = ref('molds')
const loadedTabs = ref<Set<string>>(new Set(['molds']))
const pressNetConfigLoaded = ref(false)
const isPressNetHidden = ref(false)
const inspectionHistory = ref<any[]>([])
const maintainHistory = ref<any[]>([])
const repairList = ref<any[]>([])
@ -566,6 +569,7 @@ const pressureNetLoading = ref(false)
const installLoading = ref(false)
const imageList = computed(() => parseImages(detailData.value?.images))
const showPressNet = computed(() => pressNetConfigLoaded.value && !isPressNetHidden.value)
const drawingRows = computed(() => parseAssetRows(detailData.value?.drawings))
const operationManualRows = computed(() => parseAssetRows(detailData.value?.operationManual))
const operationVideoRows = computed(() => parseAssetRows(detailData.value?.operationVideo))
@ -1053,6 +1057,20 @@ const getDetail = 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 loadTabData = async (tab: string) => {
if (loadedTabs.value.has(tab)) return
loadedTabs.value.add(tab)
@ -1083,8 +1101,8 @@ watch(activeTab, (val) => {
loadTabData(val)
})
onMounted(() => {
getDetail()
onMounted(async () => {
await Promise.all([loadPressNetConfig(), getDetail()])
})
</script>

Loading…
Cancel
Save