diff --git a/src/api/qms/samplingProcess/index.ts b/src/api/qms/samplingProcess/index.ts index 96404d545..9f3f57dca 100644 --- a/src/api/qms/samplingProcess/index.ts +++ b/src/api/qms/samplingProcess/index.ts @@ -51,3 +51,7 @@ export const exportSamplingProcess = async (params) => { export const importTemplate = () => { return request.download({ url: '/qms/sampling-process/get-import-template' }) } + +export const getSamplingScheme = async () => { + return await request.get({ url: `/qms/sampling-scheme/get-available-list`}) +} diff --git a/src/views/qms/samplingProcess/index.vue b/src/views/qms/samplingProcess/index.vue index 0d7add0be..cc083c0e4 100644 --- a/src/views/qms/samplingProcess/index.vue +++ b/src/views/qms/samplingProcess/index.vue @@ -48,6 +48,7 @@ :apiCreate="SamplingProcessApi.createSamplingProcess" @searchTableSuccess="searchTableSuccess" :isBusiness="false" + @onChange="onChange" /> @@ -65,6 +66,7 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons' import TableHead from '@/components/TableHead/src/TableHead.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import Detail from '@/components/Detail/src/Detail.vue' +import {getSamplingScheme} from "@/api/qms/samplingProcess"; defineOptions({ name: 'SamplingProcess' }) @@ -226,6 +228,61 @@ const importSuccess = () => { getList() } +const onChange =async (field,value)=>{ + if(field == 'sampleType'&& value == '1'){ + SamplingProcess.allSchemas.formSchema.forEach(item=>{ + if(item.field == "sampleSize"){ + item.label='样品量' + item.component = 'Input' + item.componentProps.disabled = true + } + if(item.field == "sampleProgCode"){ + item.componentProps.disabled = true + } + }) + }else if(field == 'sampleType'&& value == '2'){ + SamplingProcess.allSchemas.formSchema.forEach(item=>{ + if(item.field == "sampleSize"){ + item.label='样品量(%)' + item.component = 'Input' + item.componentProps.disabled = false + } + if(item.field == "sampleProgCode"){ + item.componentProps.disabled = true + } + }) + }else if(field == 'sampleType'&& value == '3'){ + SamplingProcess.allSchemas.formSchema.forEach(item=>{ + if(item.field == "sampleSize"){ + item.label='样品量' + item.component = 'Input' + item.componentProps.disabled = false + } + if(item.field == "sampleProgCode"){ + item.componentProps.disabled = true + } + }) + }else if(field == 'sampleType'&& value == '4'){ + const data = await SamplingProcessApi.getSamplingScheme() + const options = data.map(item=>{ + return{ + value:item.code, + label:item.description, + } + }) + SamplingProcess.allSchemas.formSchema.forEach(item=>{ + if(item.field == "sampleSize"){ + item.componentProps.disabled = true + } + if(item.field == "sampleProgCode"){ + item.component = 'Select' + item.componentProps.disabled = false + item.componentProps.options = options + } + }) + } +} + // 筛选提交 const searchFormClick = (searchData) => { tableObject.params = { diff --git a/src/views/qms/samplingProcess/samplingProcess.data.ts b/src/views/qms/samplingProcess/samplingProcess.data.ts index 8fecb505f..dac6c5e60 100644 --- a/src/views/qms/samplingProcess/samplingProcess.data.ts +++ b/src/views/qms/samplingProcess/samplingProcess.data.ts @@ -38,7 +38,7 @@ export const SamplingProcess = useCrudSchemas(reactive([ dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isSearch: true, form: { - component: 'SelectV2' + component: 'Select' }, }, { @@ -48,7 +48,7 @@ export const SamplingProcess = useCrudSchemas(reactive([ dictType: DICT_TYPE.EVALUATION_MODE, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 form: { - component: 'SelectV2' + component: 'Select' }, }, { @@ -60,6 +60,9 @@ export const SamplingProcess = useCrudSchemas(reactive([ label: '采样方案编码', field: 'sampleProgCode', sort: 'custom', + form: { + component: 'Select' + }, }, { label: '是否可用', @@ -68,7 +71,7 @@ export const SamplingProcess = useCrudSchemas(reactive([ dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 form: { - component: 'SelectV2' + component: 'Select' }, }, {