优化 稿件变量属性控制
This commit is contained in:
parent
5b64e3b160
commit
91a9dd8f0e
|
|
@ -246,7 +246,7 @@
|
|||
</div>
|
||||
<el-button
|
||||
v-if="that.propInfo[tmp.key].canChange"
|
||||
@click="appendList(tmp.key)">
|
||||
@click="appendImageList(tmp.key)">
|
||||
添加
|
||||
</el-button>
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -46,8 +46,7 @@
|
|||
<el-col :span="12">
|
||||
<div style="width: 120px;display: flex">
|
||||
<el-checkbox
|
||||
v-model="that.configInfo.canChange"
|
||||
:disabled="that.configInfo.isCombo">
|
||||
v-model="that.configInfo.canChange">
|
||||
<span>允许调整数量</span>
|
||||
</el-checkbox>
|
||||
</div>
|
||||
|
|
@ -71,13 +70,12 @@
|
|||
v-model="that.configInfo.minSize"
|
||||
:min="1"
|
||||
:max="that.configInfo.maxSize"
|
||||
:disabled="that.configInfo.isCombo"/>
|
||||
:disabled="that.configInfo.shape"/>
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
max
|
||||
<el-input-number
|
||||
v-model="that.configInfo.maxSize" :min="1"
|
||||
:disabled="that.configInfo.isCombo"/>
|
||||
v-model="that.configInfo.maxSize" :min="that.configInfo.shape ? 3 : 1"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@
|
|||
</div>
|
||||
<el-button
|
||||
v-if="that.propInfo[tmp.key].canChange"
|
||||
@click="appendList(tmp.key)">
|
||||
@click="appendImageList(tmp.key)">
|
||||
添加
|
||||
</el-button>
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -46,8 +46,7 @@
|
|||
<el-col :span="12">
|
||||
<div style="width: 120px;display: flex">
|
||||
<el-checkbox
|
||||
v-model="that.configInfo.canChange"
|
||||
:disabled="that.configInfo.isCombo">
|
||||
v-model="that.configInfo.canChange">
|
||||
<span>允许调整数量</span>
|
||||
</el-checkbox>
|
||||
</div>
|
||||
|
|
@ -71,13 +70,12 @@
|
|||
v-model="that.configInfo.minSize"
|
||||
:min="1"
|
||||
:max="that.configInfo.maxSize"
|
||||
:disabled="that.configInfo.isCombo"/>
|
||||
:disabled="that.configInfo.shape"/>
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
max
|
||||
<el-input-number
|
||||
v-model="that.configInfo.maxSize" :min="1"
|
||||
:disabled="that.configInfo.isCombo"/>
|
||||
v-model="that.configInfo.maxSize" :min="that.configInfo.shape ? 3 : 1"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue