|
|
@ -50,7 +50,7 @@ |
|
|
|
:apiUpdate="SelectedSetApi.updateSelectedSet" |
|
|
|
:apiCreate="SelectedSetApi.createSelectedSet" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
:isBusiness="false" |
|
|
|
:isBusiness="true" |
|
|
|
@onChange="onChange" |
|
|
|
@handleAddTable="handleAddTable" |
|
|
|
@handleDeleteTable="handleDeleteTable" |
|
|
@ -92,6 +92,7 @@ import { SelectedProject,SelectedProjectRules } from '../selectedProject/selecte |
|
|
|
import * as SelectedProjectApi from '@/api/qms/selectedProject' |
|
|
|
import * as DictDataApi from '@/api/system/dict/dict.data' |
|
|
|
import component from 'virtual:svg-icons-register' |
|
|
|
import * as DictTypeApi from '@/api/system/dict/dict.type' |
|
|
|
// import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
|
// import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|
|
|
// import Detail from '@/components/Detail/src/Detail.vue' |
|
|
@ -105,9 +106,11 @@ const route = useRoute() // 路由信息 |
|
|
|
const tableData = ref([]) |
|
|
|
const routeName = ref() |
|
|
|
const selectDictType = ref() |
|
|
|
const optionsList = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref(SelectedSet.allSchemas.tableColumns) |
|
|
|
|
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
@ -287,7 +290,21 @@ const handleDeleteTable = (item, index) => { |
|
|
|
|
|
|
|
// 主子数据 提交 |
|
|
|
const submitForm = async (formType, data) => { |
|
|
|
|
|
|
|
data.selectedProjectDOList = tableData.value// 拼接子表数据参数 |
|
|
|
data.selectedProjectDOList = data.selectedProjectDOList.map(item => { |
|
|
|
// 按照 '-%%%-'' 拆分 dictionaryCode |
|
|
|
const [dictionaryCode, dictionaryValue] = item.dictionaryTypeAndCode.split('-%%%-'); |
|
|
|
const dictionary = optionsList.value.find(temp => temp.options.some(option => option.value === item.dictionaryTypeAndCode)) |
|
|
|
const dictionaryLabel = dictionary?.options.find(option => option.value === item.dictionaryTypeAndCode)?.label |
|
|
|
// 返回一个新对象,包含拆分后的 dictionaryCode 和 dictionaryValue,以及原始项中的其他属性 |
|
|
|
return { |
|
|
|
...item, |
|
|
|
dictionaryCode, |
|
|
|
dictionaryValue, |
|
|
|
dictionaryLabel |
|
|
|
}; |
|
|
|
}); |
|
|
|
console.log(data.subList) |
|
|
|
try { |
|
|
|
if (formType === 'create') { |
|
|
@ -321,20 +338,21 @@ const detailOpenForm = (type, row, masterParmas) => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const detailBasiFormOnChange = (field,val) => { |
|
|
|
const detailBasiFormOnChange = (field,val,detailFormRef) => { |
|
|
|
console.log(field) |
|
|
|
console.log(val) |
|
|
|
if(field == 'dictionaryCode'){ |
|
|
|
DictDataApi.queryByDictType(val).then(res => { |
|
|
|
SelectedProject.allSchemas.formSchema.find(item => { |
|
|
|
return item.field == 'dictionaryValue' |
|
|
|
}).componentProps.options = res.map(item=>{ |
|
|
|
return { |
|
|
|
value: item.value, |
|
|
|
label: item.label |
|
|
|
} |
|
|
|
console.log(33,detailFormRef) |
|
|
|
if(field == 'dictionaryTypeAndCode'){ |
|
|
|
// 按照 '-%%%-'' 拆分 dictionaryCode |
|
|
|
const [dictionaryCode, dictionaryValue] = val.split('-%%%-'); |
|
|
|
const dictionary = optionsList.value.find(temp => temp.options.some(option => option.value === val)) |
|
|
|
const dictionaryLabel = dictionary?.options.find(option => option.value === val)?.label |
|
|
|
const setV = {} |
|
|
|
setV['dictionaryLabel'] = dictionaryLabel |
|
|
|
setV['dictionaryCode'] = dictionaryCode |
|
|
|
setV['dictionaryValue'] = dictionaryValue |
|
|
|
nextTick(() => { |
|
|
|
detailFormRef.setValues(setV) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -342,9 +360,24 @@ const formSelectChange = (a,b,c,d) => { |
|
|
|
console.log(111) |
|
|
|
} |
|
|
|
|
|
|
|
const getDicDetails = ()=>{ |
|
|
|
DictTypeApi.getDictTypeAndData('inspection').then(res=>{ |
|
|
|
res.forEach(element => { |
|
|
|
element.options = element.dictDataRespVOList.map(item => { |
|
|
|
return { |
|
|
|
value: element.type + "-%%%-" + item.value, |
|
|
|
label: element.name + "-" + item.label |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
optionsList.value = res |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
/** 初始化 **/ |
|
|
|
onMounted(async () => { |
|
|
|
getList() |
|
|
|
getDicDetails() |
|
|
|
importTemplateData.templateUrl = await SelectedSetApi.importTemplate() |
|
|
|
}) |
|
|
|
|
|
|
|