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 = [
defaultButtons.defaultAddBtn({hasPermi:'wms:selectedProject:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:selectedProject:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:selectedProject:export'}), //
defaultButtons.defaultAddBtn({hasPermi:'qms:selectedProject:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'qms:selectedProject:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'qms:selectedProject:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
@ -133,8 +133,8 @@ const buttonBaseClick = (val, item) => {
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:selectedProject:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:selectedProject:delete'}), //
defaultButtons.mainListEditBtn({hasPermi:'qms:selectedProject:update'}), //
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 * 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({
code: [required],
dictionaryTypeAndCode: [required],
// dictionaryTypeAndCode: [required],
estimateCode: [required],
defectLevel: [required],
})
@ -36,59 +28,14 @@ export const SelectedProject = useCrudSchemas(reactive<CrudSchema[]>([
}
},
{
label: '字典及字典项',
field: 'dictionaryTypeAndCode',
label: '选定集',
field: 'dictionaryValue',
sort: 'custom',
formatter: (_: Recordable, __: TableColumn, cellValue: boolean) => {
return optionsList.find(item => item.options.some(option => option.value === cellValue))?.options.find(option => option.value === cellValue)?.label
},
isSearch: false,
isDetail: false,
isSearch: true,
isTableForm: true,
isDetail: true,
isTable: 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: '评估代码',
@ -104,20 +51,20 @@ export const SelectedProject = useCrudSchemas(reactive<CrudSchema[]>([
component: 'Select',
}
},
{
label: '缺陷级别',
field: 'defectLevel',
sort: 'custom',
isSearch: true,
dictType: DICT_TYPE.DEFECT_LEVEL,
dictClass: 'string',
tableForm: {
type: 'Select',
},
form: {
component: 'Select',
}
},
// {
// label: '缺陷级别',
// field: 'defectLevel',
// sort: 'custom',
// isSearch: true,
// dictType: DICT_TYPE.DEFECT_LEVEL,
// dictClass: 'string',
// tableForm: {
// type: 'Select',
// },
// form: {
// component: 'Select',
// }
// },
{
label: '操作',
field: 'action',

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

@ -338,19 +338,6 @@ const submitForm = async (formType, data) => {
return
}
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 {
if (formType === 'create') {
await SelectedSetApi.createSelectedSet(data)
@ -373,43 +360,10 @@ const validateDetailEmpty = (data) => {
}
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) => {
// dictionaryTypeAndCode
const codes = data.map(item => item.dictionaryTypeAndCode);
const codes = data.map(item => item.dictionaryValue);
// Set dictionaryTypeAndCode
const uniqueCodes = new Set(codes);
@ -430,9 +384,7 @@ const detailValidate = (data) => {
const detailOpenForm = (type, row, masterParmas) => {
if(type == 'create'){
updateSelections(masterParmas.masterId,row)
}else if('update'){
updateSelections(masterParmas.masterId,row)
}
}
@ -440,42 +392,15 @@ const detailOpenForm = (type, row, masterParmas) => {
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 = ()=>{
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
})
const formSelectChange = (a,b,c,d) => {
}
/** 初始化 **/
onMounted(async () => {
getList()
getDicDetails()
importTemplateData.templateUrl = await SelectedSetApi.importTemplate()
})

Loading…
Cancel
Save