|
|
@@ -78,7 +78,7 @@ const close = () => {
|
|
|
}
|
|
|
watch(props, () => {
|
|
|
if (props.attrIdList && props.attrIdList.length) {
|
|
|
- console.log(props.attrIdList)
|
|
|
+ console.log(11111, props.attrIdList)
|
|
|
attractivelist.value = props.attrIdList;//获取编辑数据
|
|
|
const matchedid = matchDataByIds(attractivelist.value);//
|
|
|
const matchedinfo = matchDataByInfos(attractivelist.value)
|
|
|
@@ -102,6 +102,19 @@ const save = () => {
|
|
|
...checkeddata.InsuranceInformation,
|
|
|
...checkeddata.InsuranceCostFactor,
|
|
|
]
|
|
|
+ // let arr = [...props.attrIdList, ...mergedData]
|
|
|
+ // console.log('原有的', props.attrIdList)
|
|
|
+ // console.log('新选的', mergedData)
|
|
|
+ // console.log('合并的', arr)
|
|
|
+ // let brr = arr.reduce((acc, current) => {
|
|
|
+ // const a = acc.find(item => item.id === current.id)
|
|
|
+ // if(!a) {
|
|
|
+ // return acc.concat([current])
|
|
|
+ // } else {
|
|
|
+ // return acc
|
|
|
+ // }
|
|
|
+ // }, [])
|
|
|
+ // console.log('去重的', brr)
|
|
|
if (mergedData.length == 0) {
|
|
|
return ElMessage({
|
|
|
type: 'error',
|
|
|
@@ -190,12 +203,20 @@ const itemclick = (type: any) => {
|
|
|
activename.value = type.name;
|
|
|
}
|
|
|
const dataStore = reactive<dataStore>({
|
|
|
- VehicleInformation: [],//车辆信息
|
|
|
- VehicleOwnerInformation: [],//车主信息
|
|
|
- PolicyholderInformation: [],//车主信息
|
|
|
- InsuredInformation: [],//车主信息
|
|
|
- InsuranceInformation: [], //车主信息
|
|
|
- InsuranceCostFactor: [],//保司费用因子
|
|
|
+ VehicleInformation: [],//车辆信息
|
|
|
+ VehicleOwnerInformation: [],//车主信息
|
|
|
+ PolicyholderInformation: [],//车主信息
|
|
|
+ InsuredInformation: [],//车主信息
|
|
|
+ InsuranceInformation: [], //车主信息
|
|
|
+ InsuranceCostFactor: [],//保司费用因子
|
|
|
+})
|
|
|
+const dataStoreNo = reactive<dataStore>({
|
|
|
+ VehicleInformation: [],//车辆信息
|
|
|
+ VehicleOwnerInformation: [],//车主信息
|
|
|
+ PolicyholderInformation: [],//车主信息
|
|
|
+ InsuredInformation: [],//车主信息
|
|
|
+ InsuranceInformation: [], //车主信息
|
|
|
+ InsuranceCostFactor: [],//保司费用因子
|
|
|
})
|
|
|
interface checkeddata {
|
|
|
[key: string]: any[]
|
|
|
@@ -214,16 +235,17 @@ interface VehicleInformation {
|
|
|
id: string,
|
|
|
}[]
|
|
|
interface dataStore {
|
|
|
- VehicleInformation: VehicleInformation[],
|
|
|
- VehicleOwnerInformation: VehicleInformation[],
|
|
|
- PolicyholderInformation: VehicleInformation[],
|
|
|
- InsuredInformation: VehicleInformation[],
|
|
|
- InsuranceInformation: VehicleInformation[],
|
|
|
- InsuranceCostFactor: VehicleInformation[],
|
|
|
+ VehicleInformation: VehicleInformation[],
|
|
|
+ VehicleOwnerInformation: VehicleInformation[],
|
|
|
+ PolicyholderInformation: VehicleInformation[],
|
|
|
+ InsuredInformation: VehicleInformation[],
|
|
|
+ InsuranceInformation: VehicleInformation[],
|
|
|
+ InsuranceCostFactor: VehicleInformation[],
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
|
ruleAttr();
|
|
|
+ ruleAttrNo();
|
|
|
regionLicenseRegion('0');//车牌地区
|
|
|
regionLicenseNumber('14');//车牌号
|
|
|
})
|
|
|
@@ -240,11 +262,24 @@ const ruleAttr = () => {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+const ruleAttrNo = () => {
|
|
|
+ api.agreementApi.ruleAttrGroup({ attrName: '' }).then((res: any) => {
|
|
|
+ if (res.code == '200') {
|
|
|
+ dataStoreNo.VehicleInformation = res.data.VehicleInformation ? processArray(res.data.VehicleInformation) : [];
|
|
|
+ dataStoreNo.VehicleOwnerInformation = res.data.VehicleOwnerInformation ? processArray(res.data.VehicleOwnerInformation) : [];
|
|
|
+ dataStoreNo.PolicyholderInformation = res.data.PolicyholderInformation ? processArray(res.data.PolicyholderInformation) : [];
|
|
|
+ dataStoreNo.InsuredInformation = res.data.InsuredInformation ? processArray(res.data.InsuredInformation) : [];
|
|
|
+ dataStoreNo.InsuranceInformation = res.data.InsuranceInformation ? processArray(res.data.InsuranceInformation) : [];
|
|
|
+ dataStoreNo.InsuranceCostFactor = res.data.InsuranceCostFactor ? processArray(res.data.InsuranceCostFactor) : [];
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
//选择事件集中处理
|
|
|
type title = keyof typeof dataStore;
|
|
|
const change = (value: any, title: title) => {
|
|
|
+ console.log('选择了?', value)
|
|
|
// 使用动态属性访问
|
|
|
- let arrayToUpdate = dataStore[title];//获取对应类型数组
|
|
|
+ let arrayToUpdate = dataStoreNo[title];//获取对应类型数组
|
|
|
if (arrayToUpdate) {
|
|
|
checkeddata[title] = [];//默认清空
|
|
|
arrayToUpdate = arrayToUpdate.map((val) => {
|