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> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search <Search
:schema="InspectionJobMain.allSchemas.searchSchema" ref="searchRef"
@search="setSearchParams" :schema="searchSchema"
@reset="setSearchParams" @search="searchParams"
@reset="searchParams"
/> />
</ContentWrap> </ContentWrap>
@ -124,8 +125,6 @@ import { getReportUrl } from '@/utils/systemParam'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { formatDate } from '@/utils/formatTime' import { formatDate } from '@/utils/formatTime'
//
defineOptions({ name: 'inspectionJobMain' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
@ -181,7 +180,19 @@ const { tableObject, tableMethods } = useTable({
// //
const { getList, setSearchParams } = tableMethods 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 = [ const HeadButttondata = [
defaultButtons.defaultExportBtn({ hasPermi: 'qms:inspection-job-main:export' }), // defaultButtons.defaultExportBtn({ hasPermi: 'qms:inspection-job-main:export' }), //
@ -453,13 +464,13 @@ const handleImport = () => {
const searchFormClick = (searchData) => { const searchFormClick = (searchData) => {
let isHave = searchData?.filters?.some((item) => item.column == 'inspectionType') let isHave = searchData?.filters?.some((item) => item.column == 'inspectionType')
if (!isHave) { if (!isHave) {
if (route.name == 'inspectionJobProductionMain') { if (route.name == 'inspectionJobProduction') {
searchData.filters.push({ searchData.filters.push({
action: '==', action: '==',
column: 'inspectionType', column: 'inspectionType',
value: '4' value: '4'
}) })
} else if (route.name == 'inspectionJobPurchaseMain') { } else if (route.name == 'inspectionJobPurchase') {
searchData.filters.push({ searchData.filters.push({
action: '==', action: '==',
column: 'inspectionType', column: 'inspectionType',
@ -479,47 +490,48 @@ const searchFormClick = (searchData) => {
} }
getList() // 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 () => { onMounted(async () => {
console.log(11,route.name) if (route.name == 'inspectionJobProduction') {
if (route.name == 'inspectionJobProductionMain') {
tableObject.params = { tableObject.params = {
available: true, available: true,
inspectionType: '4' 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 = { tableObject.params = {
available: true, available: true,
inspectionType: '1' 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 { } else {
tableObject.params = { tableObject.params = {
available: true, available: true,
excludeInspectionType: '1,4' 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')
}
})
} }
searchParams(tableObject.params)
getList()
// importTemplateData.templateUrl = await InspectionJobMainApi.importTemplate()
}) })
onActivated(() => { defineExpose({
if (route.name == 'inspectionJobProductionMain') { getList
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()
}) })
</script> </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: '检验类型', label: '检验类型',
field: 'inspectionType', field: 'inspectionType',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.INSPECTION_TYPE_NEW, dictType: DICT_TYPE.INSPECTION_TYPE,
dictClass: 'string', dictClass: 'string',
isSearch: true, isSearch: true,
form: { form: {
@ -293,7 +293,7 @@ export const InspectionJobMain = useCrudSchemas(
dictClass: 'string', // 默认都是字符串类型其他暂不考虑 dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isTable: false, isTable: false,
isDetail: false, isDetail: false,
isSearch: true, isSearch: false,
isTableForm: false, isTableForm: false,
isForm: 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 <Search
:schema="InspectionRecordMain.allSchemas.searchSchema" :schema="InspectionRecordMain.allSchemas.searchSchema"
@search="setSearchParams" @search="searchParams"
@reset="setSearchParams" @reset="searchParams"
/> />
</ContentWrap> </ContentWrap>
@ -172,6 +172,19 @@ const { tableObject, tableMethods } = useTable({
// //
const { getList, setSearchParams } = tableMethods 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 = [ let HeadButttondata = [
defaultButtons.defaultExportBtn({ hasPermi: 'qms:inspection-recode-main:export' }), // defaultButtons.defaultExportBtn({ hasPermi: 'qms:inspection-recode-main:export' }), //
@ -431,7 +444,7 @@ const submitFormExecute = async (formType, data) => {
const searchFormClick = (searchData) => { const searchFormClick = (searchData) => {
let isHave = searchData?.filters?.some((item) => item.column == 'inspectionType') let isHave = searchData?.filters?.some((item) => item.column == 'inspectionType')
if (!isHave) { if (!isHave) {
if (route.name == 'inspectionRecordPurchaseMain') { if (route.name == 'inspectionRecordPurchase') {
searchData.filters.push({ searchData.filters.push({
action: '==', action: '==',
column: 'inspectionType', column: 'inspectionType',
@ -441,7 +454,7 @@ const searchFormClick = (searchData) => {
column: 'available', column: 'available',
value: true value: true
}) })
} else if (route.name == 'inspectionRecordProductionMain') { } else if (route.name == 'inspectionRecordProduction') {
searchData.filters.push({ searchData.filters.push({
action: '==', action: '==',
column: 'inspectionType', column: 'inspectionType',
@ -469,12 +482,12 @@ const searchFormClick = (searchData) => {
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
if (route.name == 'inspectionRecordPurchaseMain') { if (route.name == 'inspectionRecordPurchase') {
tableObject.params = { tableObject.params = {
available: true, available: true,
inspectionType: '1' inspectionType: '1'
} }
} else if (route.name == 'inspectionRecordProductionMain') { } else if (route.name == 'inspectionRecordProduction') {
tableObject.params = { tableObject.params = {
available: true, available: true,
inspectionType: '4' inspectionType: '4'
@ -488,24 +501,7 @@ onMounted(async () => {
getList() getList()
}) })
onActivated(() => { defineExpose({
if (route.name == 'inspectionRecordPurchaseMain') { getList
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()
}) })
</script> </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