Browse Source

检验方案和检验任务切回页面刷新问题

hella_online_20240816
zhang_li 3 months ago
parent
commit
869869fe85
  1. 78
      src/views/qms/inspectionJob/index.vue
  2. 14
      src/views/qms/inspectionJob/inspectionJob.vue
  3. 4
      src/views/qms/inspectionJob/inspectionJobMain.data.ts
  4. 14
      src/views/qms/inspectionJob/inspectionJobProduction.vue
  5. 15
      src/views/qms/inspectionJob/inspectionJobPurchase.vue
  6. 46
      src/views/qms/inspectionRecord/index.vue
  7. 14
      src/views/qms/inspectionRecord/inspectionRecord.vue
  8. 14
      src/views/qms/inspectionRecord/inspectionRecordProduction.vue
  9. 14
      src/views/qms/inspectionRecord/inspectionRecordPurchase.vue

78
src/views/qms/inspectionJob/index.vue

@ -2,9 +2,10 @@
<ContentWrap>
<!-- 搜索工作栏 -->
<Search
:schema="InspectionJobMain.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
ref="searchRef"
:schema="searchSchema"
@search="searchParams"
@reset="searchParams"
/>
</ContentWrap>
@ -124,8 +125,6 @@ import { getReportUrl } from '@/utils/systemParam'
import { useUserStore } from '@/store/modules/user'
import { formatDate } from '@/utils/formatTime'
//
defineOptions({ name: 'inspectionJobMain' })
const message = useMessage() //
const { t } = useI18n() //
@ -181,7 +180,19 @@ const { tableObject, tableMethods } = useTable({
//
const { getList, setSearchParams } = tableMethods
const searchParams = (model) => {
if (route.name == 'inspectionJobProduction') {
model.available = 'TRUE'
model.inspectionType = '4'
} else if (route.name == 'inspectionJobPurchase') {
model.available = 'TRUE'
model.inspectionType = '1'
} else {
model.available = 'TRUE'
model.excludeInspectionType = '1,4'
}
setSearchParams(model)
}
//
const HeadButttondata = [
defaultButtons.defaultExportBtn({ hasPermi: 'qms:inspection-job-main:export' }), //
@ -453,13 +464,13 @@ const handleImport = () => {
const searchFormClick = (searchData) => {
let isHave = searchData?.filters?.some((item) => item.column == 'inspectionType')
if (!isHave) {
if (route.name == 'inspectionJobProductionMain') {
if (route.name == 'inspectionJobProduction') {
searchData.filters.push({
action: '==',
column: 'inspectionType',
value: '4'
})
} else if (route.name == 'inspectionJobPurchaseMain') {
} else if (route.name == 'inspectionJobPurchase') {
searchData.filters.push({
action: '==',
column: 'inspectionType',
@ -479,47 +490,48 @@ const searchFormClick = (searchData) => {
}
getList() //
}
const searchRef = ref()
const searchSchema = ref(JSON.parse(JSON.stringify(InspectionJobMain.allSchemas.searchSchema)))
const options = InspectionJobMain.allSchemas.searchSchema.find((item) => item.field == 'inspectionType')
/** 初始化 **/
onMounted(async () => {
console.log(11,route.name)
if (route.name == 'inspectionJobProductionMain') {
if (route.name == 'inspectionJobProduction') {
tableObject.params = {
available: true,
inspectionType: '4'
}
} else if (route.name == 'inspectionJobPurchaseMain') {
searchSchema.value.forEach((item) => {
if (item.field == 'inspectionType') {
item.componentProps.options=options.componentProps.options?.filter((cur) => cur.value == '4')
}
})
console.log(999,searchSchema.value)
searchRef.value.setFormValues({ inspectionType: '4' })
} else if (route.name == 'inspectionJobPurchase') {
tableObject.params = {
available: true,
inspectionType: '1'
}
searchSchema.value.forEach((item) => {
if (item.field == 'inspectionType') {
item.componentProps.options = options.componentProps.options?.filter((cur) => cur.value == '1')
}
})
searchRef.value.setFormValues({ inspectionType: '1' })
} else {
tableObject.params = {
available: true,
excludeInspectionType: '1,4'
}
searchSchema.value.forEach((item) => {
if (item.field == 'inspectionType') {
item.componentProps.options = options.componentProps.options?.filter(cur=>cur.value != '1' && cur.value != '4')
}
})
}
getList()
// importTemplateData.templateUrl = await InspectionJobMainApi.importTemplate()
searchParams(tableObject.params)
})
onActivated(() => {
if (route.name == 'inspectionJobProductionMain') {
tableObject.params = {
available: true,
inspectionType: '4'
}
} else if (route.name == 'inspectionJobPurchaseMain') {
tableObject.params = {
available: true,
inspectionType: '1'
}
} else {
tableObject.params = {
available: true,
excludeInspectionType: '1,4'
}
}
getList()
defineExpose({
getList
})
</script>

14
src/views/qms/inspectionJob/inspectionJob.vue

@ -0,0 +1,14 @@
<template>
<index ref="indesRef"/>
</template>
<script setup lang="ts">
import index from './index.vue'
//
defineOptions({ name: 'inspectionJobMain' })
const indesRef = ref()
onActivated(() => {
indesRef.value.getList()
})
</script>

4
src/views/qms/inspectionJob/inspectionJobMain.data.ts

@ -272,7 +272,7 @@ export const InspectionJobMain = useCrudSchemas(
label: '检验类型',
field: 'inspectionType',
sort: 'custom',
dictType: DICT_TYPE.INSPECTION_TYPE_NEW,
dictType: DICT_TYPE.INSPECTION_TYPE,
dictClass: 'string',
isSearch: true,
form: {
@ -293,7 +293,7 @@ export const InspectionJobMain = useCrudSchemas(
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isTable: false,
isDetail: false,
isSearch: true,
isSearch: false,
isTableForm: false,
isForm: false
},

14
src/views/qms/inspectionJob/inspectionJobProduction.vue

@ -0,0 +1,14 @@
<template>
<index ref='indesRef'/>
</template>
<script setup lang="ts">
import index from './index.vue'
//
defineOptions({ name: 'inspectionJobProduction' })
const indesRef = ref()
onActivated(() => {
indesRef.value.getList()
})
</script>

15
src/views/qms/inspectionJob/inspectionJobPurchase.vue

@ -0,0 +1,15 @@
<template>
<index ref="indesRef"/>
</template>
<script setup lang="ts">
import index from './index.vue'
//
defineOptions({ name: 'inspectionJobPurchase' })
console.log(2222)
const indesRef = ref()
onActivated(() => {
indesRef.value.getList()
})
</script>

46
src/views/qms/inspectionRecord/index.vue

@ -3,8 +3,8 @@
<!-- 搜索工作栏 -->
<Search
:schema="InspectionRecordMain.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
@search="searchParams"
@reset="searchParams"
/>
</ContentWrap>
@ -172,6 +172,19 @@ const { tableObject, tableMethods } = useTable({
//
const { getList, setSearchParams } = tableMethods
const searchParams = (model) => {
if (route.name == 'inspectionRecordProduction') {
model.available = 'TRUE'
model.inspectionType = '4'
} else if (route.name == 'inspectionRecordPurchase') {
model.available = 'TRUE'
model.inspectionType = '1'
} else {
model.available = 'TRUE'
model.excludeInspectionType = '1,4,11'
}
setSearchParams(model)
}
//
let HeadButttondata = [
defaultButtons.defaultExportBtn({ hasPermi: 'qms:inspection-recode-main:export' }), //
@ -431,7 +444,7 @@ const submitFormExecute = async (formType, data) => {
const searchFormClick = (searchData) => {
let isHave = searchData?.filters?.some((item) => item.column == 'inspectionType')
if (!isHave) {
if (route.name == 'inspectionRecordPurchaseMain') {
if (route.name == 'inspectionRecordPurchase') {
searchData.filters.push({
action: '==',
column: 'inspectionType',
@ -441,7 +454,7 @@ const searchFormClick = (searchData) => {
column: 'available',
value: true
})
} else if (route.name == 'inspectionRecordProductionMain') {
} else if (route.name == 'inspectionRecordProduction') {
searchData.filters.push({
action: '==',
column: 'inspectionType',
@ -469,12 +482,12 @@ const searchFormClick = (searchData) => {
/** 初始化 **/
onMounted(async () => {
if (route.name == 'inspectionRecordPurchaseMain') {
if (route.name == 'inspectionRecordPurchase') {
tableObject.params = {
available: true,
inspectionType: '1'
}
} else if (route.name == 'inspectionRecordProductionMain') {
} else if (route.name == 'inspectionRecordProduction') {
tableObject.params = {
available: true,
inspectionType: '4'
@ -488,24 +501,7 @@ onMounted(async () => {
getList()
})
onActivated(() => {
if (route.name == 'inspectionRecordPurchaseMain') {
tableObject.params = {
available: true,
inspectionType: '1'
}
} else if (route.name == 'inspectionRecordProductionMain') {
tableObject.params = {
available: true,
inspectionType: '4'
}
} else {
tableObject.params = {
available: true,
excludeInspectionType: '1,4,11'
}
}
getList()
defineExpose({
getList
})
</script>

14
src/views/qms/inspectionRecord/inspectionRecord.vue

@ -0,0 +1,14 @@
<template>
<index ref='indesRef'/>
</template>
<script setup lang="ts">
import index from './index.vue'
//
defineOptions({ name: 'inspectionRecord' })
const indesRef = ref()
onActivated(() => {
indesRef.value.getList()
})
</script>

14
src/views/qms/inspectionRecord/inspectionRecordProduction.vue

@ -0,0 +1,14 @@
<template>
<index ref='indesRef'/>
</template>
<script setup lang="ts">
import index from './index.vue'
//
defineOptions({ name: 'inspectionRecordProduction' })
const indesRef = ref()
onActivated(() => {
indesRef.value.getList()
})
</script>

14
src/views/qms/inspectionRecord/inspectionRecordPurchase.vue

@ -0,0 +1,14 @@
<template>
<index ref='indesRef'/>
</template>
<script setup lang="ts">
import index from './index.vue'
//
defineOptions({ name: 'inspectionRecordPurchase' })
const indesRef = ref()
onActivated(() => {
indesRef.value.getList()
})
</script>
Loading…
Cancel
Save