|
|
@@ -85,7 +85,7 @@
|
|
|
import { usePageLoading } from '@/hooks/web/usePageLoading'
|
|
|
import { SmartInstanceExpose, SmartTableColumn, SmartSearchFormOptionItem } from '@/types/table'
|
|
|
import { getDeptList } from '@/api/laboratory/dept'
|
|
|
-import { PressureEquipMainTypeMap } from '@/utils/constants'
|
|
|
+import { PressureEquipMainTypeMap, allCheckTypeMap } from '@/utils/constants'
|
|
|
const dictStore = useDictStore()
|
|
|
const userStore = useUserStore()
|
|
|
const getCurrentUserRoles = computed(() => userStore.getRoles)
|
|
|
@@ -131,12 +131,6 @@ import { PressureEquipMainTypeMap } from '@/utils/constants'
|
|
|
200: '合同收费'
|
|
|
}
|
|
|
|
|
|
- // 检验性质映射
|
|
|
- const checkTypeMap = {
|
|
|
- 100: '定期检验',
|
|
|
- 200: '年度检查',
|
|
|
- 300: '超年限检验'
|
|
|
- }
|
|
|
const columns = ref<SmartTableColumn[]>([
|
|
|
{
|
|
|
type: 'selection',
|
|
|
@@ -207,14 +201,13 @@ import { PressureEquipMainTypeMap } from '@/utils/constants'
|
|
|
prop: 'checkType',
|
|
|
width: 100,
|
|
|
search: {
|
|
|
- type: 'select', // 改为select类型
|
|
|
- options: Object.entries(checkTypeMap).map(([value, label]) => ({
|
|
|
- label,
|
|
|
- value: parseInt(value) // 确保值是数字类型
|
|
|
- }))
|
|
|
+ type: 'custom-select', // 使用custom-select支持动态options
|
|
|
+ fieldProps: {
|
|
|
+ placeholder: '请选择检验性质'
|
|
|
+ }
|
|
|
},
|
|
|
render: (row, value) => {
|
|
|
- return !value ? '-' : checkTypeMap[value]
|
|
|
+ return !value ? '-' : (allCheckTypeMap[row.equipMainType]?.[value] || '-')
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
@@ -439,6 +432,37 @@ import { PressureEquipMainTypeMap } from '@/utils/constants'
|
|
|
status: ['100'],
|
|
|
deptId: userStore.user.deptId
|
|
|
})
|
|
|
+ // 监听设备类型变化,动态更新检验性质搜索选项
|
|
|
+ watch(
|
|
|
+ () => searchFormData.value.equipMainType,
|
|
|
+ (newType) => {
|
|
|
+ let newOptions: SmartSearchFormOptionItem[] = []
|
|
|
+ if (newType && allCheckTypeMap[newType]) {
|
|
|
+ newOptions = Object.entries(allCheckTypeMap[newType]).map(([value, label]) => ({
|
|
|
+ label,
|
|
|
+ value: parseInt(value)
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ // 通过替换列对象触发 SmartTable 重新渲染
|
|
|
+ columns.value = columns.value.map(col => {
|
|
|
+ if (col.prop === 'checkType' && col.search) {
|
|
|
+ return {
|
|
|
+ ...col,
|
|
|
+ search: {
|
|
|
+ ...col.search,
|
|
|
+ fieldProps: {
|
|
|
+ ...col.search.fieldProps,
|
|
|
+ options: newOptions
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return col
|
|
|
+ })
|
|
|
+ // 设备类型变化时清除已选的检验性质
|
|
|
+ delete searchFormData.value.checkType
|
|
|
+ }
|
|
|
+ )
|
|
|
const loading = ref(false)
|
|
|
const dataList = ref([])
|
|
|
const SmartTableRef = ref<SmartInstanceExpose>()
|