diff --git a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DesignPropEdit.vue b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DesignPropEdit.vue index 6744930..4c3b964 100644 --- a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DesignPropEdit.vue +++ b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DesignPropEdit.vue @@ -246,7 +246,7 @@ + @click="appendImageList(tmp.key)"> 添加 @@ -411,24 +411,25 @@ const initSucceed = () => { emit('initSucceed') } const changeData = (index: number, key: string) => { + const info = that.propInfo[key]; const infoList = getIngredientInfoListByType(info.groupType) let mapping = {} for (let i = 0; i < infoList.length; i++) { mapping[infoList[i].label] = infoList[i].langMapping; } + console.log("111",infoList,mapping) // 多语言变量替换 const allData = [...that.propInfo[key].dataInfo] const fLang = allData[0].locale; - let m1 = mapping[allData[0].label] - + let m1 = mapping[allData[0].showLabel] if(m1){ let ratio = allData[0].ratio for (let i = 0; i < allData.length; i++) { if(i>0 && allData[i].locale === fLang){ ratio = allData[i].ratio - m1 = mapping[allData[i].label] + m1 = mapping[allData[i].showLabel] } for (let j = 0; j < m1.length; j++) { if( allData[i].locale === m1[j].locale){ @@ -437,7 +438,7 @@ const changeData = (index: number, key: string) => { if (str === null || str === undefined || str === -1) { str = '' } - allData[i].label = `${m1[j].value}`.replaceAll('${r}', `${str}`) + allData[i].label= `${m1[j].value}`.replaceAll('${r}', `${str}`) break; } } @@ -445,6 +446,7 @@ const changeData = (index: number, key: string) => { that.propInfo[key].dataInfo = [...allData]; + console.log("allData",allData) resetData(); } @@ -541,6 +543,36 @@ const deleteList = (key, index) => { } } +const appendImageList = (key) => { + const item = that.propInfo[key] + console.log("item.dataInfo",item) + const group = findGroup(key,that.propInfo) + const keys = Object.keys(group); + console.log("keys",keys) + // 有多少组变量 + if(keys.length >= item.maxSize ){ + useMessage().notifyWarning("最大数量为:"+item.maxSize) + return; + } + const locale = item.dataInfo[0].locale + const tmpArr = [...item.dataInfo] + + for (let i = 0; i < tmpArr.length; i++) { + if(i > 0 && tmpArr[i].locale === locale){ + break; + } + item.dataInfo.push( + { + label: '', + url: '', + ratio: 0, + ...tmpArr[i] + } + ) + } + resetData(); +} + const appendList = (key) => { const item = that.propInfo[key] console.log("item.dataInfo",item) @@ -761,7 +793,6 @@ const checkPropInfo = (info)=>{ const firstLang = newInfo[key].dataInfo[0].locale; for (let i1 = 0; i1 < newInfo[key].dataInfo.length; i1++) { - if(firstLang === newInfo[key].dataInfo[i1].locale){ if(newInfo[key].groupType === '1'){ rInfo += newInfo[key].dataInfo[i1].ratio diff --git a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DynamicPropConfig.vue b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DynamicPropConfig.vue index 370a210..3111a55 100644 --- a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DynamicPropConfig.vue +++ b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DynamicPropConfig.vue @@ -46,8 +46,7 @@
+ v-model="that.configInfo.canChange"> 允许调整数量
@@ -71,13 +70,12 @@ v-model="that.configInfo.minSize" :min="1" :max="that.configInfo.maxSize" - :disabled="that.configInfo.isCombo"/> + :disabled="that.configInfo.shape"/>
max + v-model="that.configInfo.maxSize" :min="that.configInfo.shape ? 3 : 1"/> diff --git a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/index.vue b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/index.vue index 8b6a069..c8e7ad4 100644 --- a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/index.vue +++ b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/index.vue @@ -294,7 +294,17 @@ const rightKeyMenu = computed(() => { } } } - handlerGroupList(cells, true, 2, cells.length) + let m = 2; + let max = 100; + for (let i = 0; i < that.pageConfig.propList.length; i++) { + if (that.pageConfig.propList[i].groupId === cells[0].getData().propGroupId) { + console.log("that.pageConfig.propList##",that.pageConfig.propList) + max = that.pageConfig.propList[i].maxSize || 100 + break; + } + } + console.log("cells",cells) + handlerGroupList(cells, true, m, Math.max(max,cells.length)) } }) } else if (that.selectedCellsList.length > 0) { @@ -1150,9 +1160,12 @@ const getJson = () => { let canInput = prop.canInput === undefined ? false : prop.canInput; if (combo) { - min = dataInfoList.length; - max = dataInfoList.length; - canChange = false; + min = Math.min(dataInfoList.length,min); + max = Math.max(dataInfoList.length,max); + if(!canChange){ + canChange = false; + } + } propDefault[prop.groupId] = { groupName: prop.groupName, diff --git a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DesignPropEdit.vue b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DesignPropEdit.vue index 6744930..4c3b964 100644 --- a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DesignPropEdit.vue +++ b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DesignPropEdit.vue @@ -246,7 +246,7 @@ + @click="appendImageList(tmp.key)"> 添加 @@ -411,24 +411,25 @@ const initSucceed = () => { emit('initSucceed') } const changeData = (index: number, key: string) => { + const info = that.propInfo[key]; const infoList = getIngredientInfoListByType(info.groupType) let mapping = {} for (let i = 0; i < infoList.length; i++) { mapping[infoList[i].label] = infoList[i].langMapping; } + console.log("111",infoList,mapping) // 多语言变量替换 const allData = [...that.propInfo[key].dataInfo] const fLang = allData[0].locale; - let m1 = mapping[allData[0].label] - + let m1 = mapping[allData[0].showLabel] if(m1){ let ratio = allData[0].ratio for (let i = 0; i < allData.length; i++) { if(i>0 && allData[i].locale === fLang){ ratio = allData[i].ratio - m1 = mapping[allData[i].label] + m1 = mapping[allData[i].showLabel] } for (let j = 0; j < m1.length; j++) { if( allData[i].locale === m1[j].locale){ @@ -437,7 +438,7 @@ const changeData = (index: number, key: string) => { if (str === null || str === undefined || str === -1) { str = '' } - allData[i].label = `${m1[j].value}`.replaceAll('${r}', `${str}`) + allData[i].label= `${m1[j].value}`.replaceAll('${r}', `${str}`) break; } } @@ -445,6 +446,7 @@ const changeData = (index: number, key: string) => { that.propInfo[key].dataInfo = [...allData]; + console.log("allData",allData) resetData(); } @@ -541,6 +543,36 @@ const deleteList = (key, index) => { } } +const appendImageList = (key) => { + const item = that.propInfo[key] + console.log("item.dataInfo",item) + const group = findGroup(key,that.propInfo) + const keys = Object.keys(group); + console.log("keys",keys) + // 有多少组变量 + if(keys.length >= item.maxSize ){ + useMessage().notifyWarning("最大数量为:"+item.maxSize) + return; + } + const locale = item.dataInfo[0].locale + const tmpArr = [...item.dataInfo] + + for (let i = 0; i < tmpArr.length; i++) { + if(i > 0 && tmpArr[i].locale === locale){ + break; + } + item.dataInfo.push( + { + label: '', + url: '', + ratio: 0, + ...tmpArr[i] + } + ) + } + resetData(); +} + const appendList = (key) => { const item = that.propInfo[key] console.log("item.dataInfo",item) @@ -761,7 +793,6 @@ const checkPropInfo = (info)=>{ const firstLang = newInfo[key].dataInfo[0].locale; for (let i1 = 0; i1 < newInfo[key].dataInfo.length; i1++) { - if(firstLang === newInfo[key].dataInfo[i1].locale){ if(newInfo[key].groupType === '1'){ rInfo += newInfo[key].dataInfo[i1].ratio diff --git a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DynamicPropConfig.vue b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DynamicPropConfig.vue index 370a210..3111a55 100644 --- a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DynamicPropConfig.vue +++ b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DynamicPropConfig.vue @@ -46,8 +46,7 @@
+ v-model="that.configInfo.canChange"> 允许调整数量
@@ -71,13 +70,12 @@ v-model="that.configInfo.minSize" :min="1" :max="that.configInfo.maxSize" - :disabled="that.configInfo.isCombo"/> + :disabled="that.configInfo.shape"/>
max + v-model="that.configInfo.maxSize" :min="that.configInfo.shape ? 3 : 1"/> diff --git a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/index.vue b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/index.vue index 8b6a069..c8e7ad4 100644 --- a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/index.vue +++ b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/index.vue @@ -294,7 +294,17 @@ const rightKeyMenu = computed(() => { } } } - handlerGroupList(cells, true, 2, cells.length) + let m = 2; + let max = 100; + for (let i = 0; i < that.pageConfig.propList.length; i++) { + if (that.pageConfig.propList[i].groupId === cells[0].getData().propGroupId) { + console.log("that.pageConfig.propList##",that.pageConfig.propList) + max = that.pageConfig.propList[i].maxSize || 100 + break; + } + } + console.log("cells",cells) + handlerGroupList(cells, true, m, Math.max(max,cells.length)) } }) } else if (that.selectedCellsList.length > 0) { @@ -1150,9 +1160,12 @@ const getJson = () => { let canInput = prop.canInput === undefined ? false : prop.canInput; if (combo) { - min = dataInfoList.length; - max = dataInfoList.length; - canChange = false; + min = Math.min(dataInfoList.length,min); + max = Math.max(dataInfoList.length,max); + if(!canChange){ + canChange = false; + } + } propDefault[prop.groupId] = { groupName: prop.groupName,