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