Browse Source

采样过程

master_hella_20240701
zhaoyiran 7 months ago
parent
commit
34d9f6c7fd
  1. 4
      src/api/qms/samplingProcess/index.ts
  2. 57
      src/views/qms/samplingProcess/index.vue
  3. 9
      src/views/qms/samplingProcess/samplingProcess.data.ts

4
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`})
}

57
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 = {

9
src/views/qms/samplingProcess/samplingProcess.data.ts

@ -38,7 +38,7 @@ export const SamplingProcess = useCrudSchemas(reactive<CrudSchema[]>([
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'SelectV2'
component: 'Select'
},
},
{
@ -48,7 +48,7 @@ export const SamplingProcess = useCrudSchemas(reactive<CrudSchema[]>([
dictType: DICT_TYPE.EVALUATION_MODE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
form: {
component: 'SelectV2'
component: 'Select'
},
},
{
@ -60,6 +60,9 @@ export const SamplingProcess = useCrudSchemas(reactive<CrudSchema[]>([
label: '采样方案编码',
field: 'sampleProgCode',
sort: 'custom',
form: {
component: 'Select'
},
},
{
label: '是否可用',
@ -68,7 +71,7 @@ export const SamplingProcess = useCrudSchemas(reactive<CrudSchema[]>([
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
form: {
component: 'SelectV2'
component: 'Select'
},
},
{

Loading…
Cancel
Save