Browse Source

Merge branch 'master_hella' of http://dev.ccwin-in.com:3000/sfms3.0/sfms3.0-ui into master_hella

master_hella_20240701
zhaoxuebing 7 months ago
parent
commit
d892d490ea
  1. 10
      src/views/qms/basicDataManage/selectedProject/index.vue
  2. 95
      src/views/qms/basicDataManage/selectedProject/selectedProject.data.ts
  3. 79
      src/views/qms/basicDataManage/selectedSet/index.vue

10
src/views/qms/basicDataManage/selectedProject/index.vue

@ -99,9 +99,9 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:selectedProject:create'}), // defaultButtons.defaultAddBtn({hasPermi:'qms:selectedProject:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:selectedProject:import'}), // defaultButtons.defaultImportBtn({hasPermi:'qms:selectedProject:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:selectedProject:export'}), // defaultButtons.defaultExportBtn({hasPermi:'qms:selectedProject:export'}), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
@ -133,8 +133,8 @@ const buttonBaseClick = (val, item) => {
// - // -
const butttondata = [ const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:selectedProject:update'}), // defaultButtons.mainListEditBtn({hasPermi:'qms:selectedProject:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:selectedProject:delete'}), // defaultButtons.mainListDeleteBtn({hasPermi:'qms:selectedProject:delete'}), //
] ]
// - // -

95
src/views/qms/basicDataManage/selectedProject/selectedProject.data.ts

@ -2,20 +2,12 @@ import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import * as DictTypeApi from '@/api/system/dict/dict.type' import * as DictTypeApi from '@/api/system/dict/dict.type'
const optionsList = await DictTypeApi.getDictTypeAndData('inspection')
optionsList.forEach(element => {
element.options = element.dictDataRespVOList.map(item => {
return {
value: element.type + "-%%%-" + item.value,
label: element.name + "-" + item.label
}
})
})
// 表单校验 // 表单校验
export const SelectedProjectRules = reactive({ export const SelectedProjectRules = reactive({
code: [required], code: [required],
dictionaryTypeAndCode: [required], // dictionaryTypeAndCode: [required],
estimateCode: [required], estimateCode: [required],
defectLevel: [required], defectLevel: [required],
}) })
@ -36,59 +28,14 @@ export const SelectedProject = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
{ {
label: '字典及字典项', label: '选定集',
field: 'dictionaryTypeAndCode', field: 'dictionaryValue',
sort: 'custom', sort: 'custom',
formatter: (_: Recordable, __: TableColumn, cellValue: boolean) => { isSearch: true,
return optionsList.find(item => item.options.some(option => option.value === cellValue))?.options.find(option => option.value === cellValue)?.label isTableForm: true,
}, isDetail: true,
isSearch: false,
isDetail: false,
isTable: true, isTable: true,
isForm: true, isForm: true,
tableForm: {
type: 'SelectGroup',
initOptions: optionsList,
filterable: true,
},
form: {
component: 'Select',
componentProps: {
options: optionsList,
filterable: true,
}
},
},
{
label: '字典',
field: 'dictionaryCode',
sort: 'custom',
isSearch: false,
isTableForm: false,
isDetail: false,
isTable: false,
isForm: false,
},
{
label: '字典项',
field: 'dictionaryValue',
sort: 'custom',
isSearch: false,
isTableForm: false,
isDetail: false,
isTable: false,
isForm: false,
},
{
label: '字典名称',
field: 'dictionaryLabel',
sort: 'custom',
isSearch: false,
isTableForm: false,
isDetail: false,
isTable: false,
isForm: false,
}, },
{ {
label: '评估代码', label: '评估代码',
@ -104,20 +51,20 @@ export const SelectedProject = useCrudSchemas(reactive<CrudSchema[]>([
component: 'Select', component: 'Select',
} }
}, },
{ // {
label: '缺陷级别', // label: '缺陷级别',
field: 'defectLevel', // field: 'defectLevel',
sort: 'custom', // sort: 'custom',
isSearch: true, // isSearch: true,
dictType: DICT_TYPE.DEFECT_LEVEL, // dictType: DICT_TYPE.DEFECT_LEVEL,
dictClass: 'string', // dictClass: 'string',
tableForm: { // tableForm: {
type: 'Select', // type: 'Select',
}, // },
form: { // form: {
component: 'Select', // component: 'Select',
} // }
}, // },
{ {
label: '操作', label: '操作',
field: 'action', field: 'action',

79
src/views/qms/basicDataManage/selectedSet/index.vue

@ -338,19 +338,6 @@ const submitForm = async (formType, data) => {
return return
} }
data.selectedProjectDOList = tableData.value// 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
};
});
try { try {
if (formType === 'create') { if (formType === 'create') {
await SelectedSetApi.createSelectedSet(data) await SelectedSetApi.createSelectedSet(data)
@ -373,43 +360,10 @@ const validateDetailEmpty = (data) => {
} }
return true; return true;
} }
const updateSelections = async (masterId,row) => {
let param = { masterId: masterId };
SelectedProjectApi.getSelectedProjectNoPage(param).then(res => {
DictTypeApi.getDictTypeAndData('inspection').then(originalResponse => {
// element
const response = originalResponse.map(element => {
const options = element.dictDataRespVOList.map(item => {
return {
value: element.type + "-%%%-" + item.value,
label: element.name + "-" + item.label
};
}).filter(option => {
// resdictionaryTypeAndCodeoption
return !res.some(resItem => {
if(row != null){
return option.value === resItem.dictionaryTypeAndCode && option.value != row.dictionaryTypeAndCode
}else{
return option.value === resItem.dictionaryTypeAndCode
}
});
});
return { ...element, options }; // elementoptions
}).filter(element => element.options.length > 0); // optionselement
// options
const formSchemaItem = SelectedProject.allSchemas.formSchema.find(item => item.field === 'dictionaryTypeAndCode');
if (formSchemaItem) {
formSchemaItem.componentProps.options = response;
}
});
});
};
const validateNotRepetition = (data) => { const validateNotRepetition = (data) => {
// dictionaryTypeAndCode // dictionaryTypeAndCode
const codes = data.map(item => item.dictionaryTypeAndCode); const codes = data.map(item => item.dictionaryValue);
// Set dictionaryTypeAndCode // Set dictionaryTypeAndCode
const uniqueCodes = new Set(codes); const uniqueCodes = new Set(codes);
@ -430,9 +384,7 @@ const detailValidate = (data) => {
const detailOpenForm = (type, row, masterParmas) => { const detailOpenForm = (type, row, masterParmas) => {
if(type == 'create'){ if(type == 'create'){
updateSelections(masterParmas.masterId,row)
}else if('update'){ }else if('update'){
updateSelections(masterParmas.masterId,row)
} }
} }
@ -440,42 +392,15 @@ const detailOpenForm = (type, row, masterParmas) => {
const detailBasiFormOnChange = (field,val,detailFormRef) => { const detailBasiFormOnChange = (field,val,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)
})
}
}
const formSelectChange = (a,b,c,d) => {
} }
const getDicDetails = ()=>{ const formSelectChange = (a,b,c,d) => {
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 () => { onMounted(async () => {
getList() getList()
getDicDetails()
importTemplateData.templateUrl = await SelectedSetApi.importTemplate() importTemplateData.templateUrl = await SelectedSetApi.importTemplate()
}) })

Loading…
Cancel
Save