Browse Source

调试

master_hella_20240701
zhaoyiran 7 months ago
parent
commit
417a382745
  1. 59
      src/views/qms/samplingProcess/index.vue
  2. 22
      src/views/qms/samplingProcess/samplingProcess.data.ts

59
src/views/qms/samplingProcess/index.vue

@ -66,7 +66,6 @@ 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' })
@ -150,8 +149,56 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
const openForm = async (type: string, row?: any) => {
basicFormRef.value.open(type, row)
SamplingProcess.allSchemas.formSchema.forEach(item=>{
if(item.field =="sampleType"){
if(row.sampleType == "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(row.sampleType == "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(row.sampleType == "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(row.sampleType == "4"){
SamplingProcess.allSchemas.formSchema.forEach(item=>{
if(item.field == "sampleSize"){
item.componentProps.disabled = true
}
if(item.field == "sampleProgCode"){
item.component = 'Select'
item.componentProps.disabled = false
}
})
}
}
})
}
// form
@ -263,13 +310,6 @@ const onChange =async (field,value)=>{
}
})
}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
@ -277,7 +317,6 @@ const onChange =async (field,value)=>{
if(item.field == "sampleProgCode"){
item.component = 'Select'
item.componentProps.disabled = false
item.componentProps.options = options
}
})
}

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

@ -1,5 +1,6 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import {getSamplingScheme} from "@/api/qms/samplingProcess";
// 表单校验
export const SamplingProcessRules = reactive({
@ -7,7 +8,7 @@ export const SamplingProcessRules = reactive({
evaluationMode: [required],
description: [required],
})
const samplingSchemeList = await getSamplingScheme()
export const SamplingProcess = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编码',
@ -56,19 +57,16 @@ export const SamplingProcess = useCrudSchemas(reactive<CrudSchema[]>([
field: 'sampleProgCode',
sort: 'custom',
form: {
component: 'Select'
component: 'Select',
componentProps: {
options: samplingSchemeList,
optionsAlias: {
labelField: 'description',
valueField: 'code'
},
}
},
},
// {
// label: '是否可用',
// field: 'available',
// sort: 'custom',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
// form: {
// component: 'Select'
// },
// },
{
label: '创建时间',
field: 'createTime',

Loading…
Cancel
Save