Browse Source

选项批量导入,按钮位置调整

lwx_v27
liwenxuan 4 days ago
parent
commit
32eb542f94
  1. 55
      src/components/DesignForm/formControlPropertiNew.vue

55
src/components/DesignForm/formControlPropertiNew.vue

@ -2838,8 +2838,7 @@ function getAssociatedFormsCurrentFieldTree1() {
// //
const options = ref([]) const options = ref([])
//
const selectedValues = ref(["1", "3"])
// //
const dialogVisible = ref(false) const dialogVisible = ref(false)
@ -2883,10 +2882,30 @@ const saveChanges = () => {
// //
editText.value = '' editText.value = ''
console.log('选项已更新:', {
options: options.value, controlData.value.options = mergeArrays(controlData.value.options,options.value)
selected: selectedValues.value options.value = []
}) }
function mergeArrays(a, b) {
// 1. avalue
let maxValue = 0;
a.forEach(item => {
const numValue = parseInt(item.value, 10);
if (numValue > maxValue) {
maxValue = numValue;
}
});
// 2. bvaluemaxValue+1
const newB = b.map((item, index) => ({
...item,
value: String(maxValue + 1 + index)
}));
// 3. ab
return [...a, ...newB];
} }
// liwenxuan 20251212 end // liwenxuan 20251212 end
@ -6100,7 +6119,7 @@ const formatTooltip = (val: number) => {
</div> </div>
</div> </div>
<!-- {{controlData.config.optionsType}} --> <!-- {{controlData.config.optionsType}} -->
<div v-if="showHide(['switch'], true)"> <!-- <div v-if="showHide(['switch'], true)">
<el-button @click="handelGlxxszDialogSwitch">关联选项设置</el-button> <el-button @click="handelGlxxszDialogSwitch">关联选项设置</el-button>
</div> </div>
<div <div
@ -6112,7 +6131,7 @@ const formatTooltip = (val: number) => {
</div> </div>
<div v-if="showHide(['checkbox'], true) && controlData.config.optionsType == 0"> <div v-if="showHide(['checkbox'], true) && controlData.config.optionsType == 0">
<el-button @click="handelGlxxszDialogCheckbox">关联选项设置</el-button> <el-button @click="handelGlxxszDialogCheckbox">关联选项设置</el-button>
</div> </div> -->
<div <div
v-if=" v-if="
showHide( showHide(
@ -6214,13 +6233,25 @@ const formatTooltip = (val: number) => {
<el-button @click="addSelectOption">{{ <el-button @click="addSelectOption">{{
controlData.type === "cascader" ? "编辑" : "新增" controlData.type === "cascader" ? "编辑" : "新增"
}}</el-button> }}</el-button>
</el-form-item> <el-button size="small" @click="openDialog" style="margin-right: 12px;">
<el-form-item class="form_cont"> 批量导入
<el-button type="primary" size="small" @click="openDialog" >
批量编辑
</el-button> </el-button>
<div v-if="showHide(['switch'], true)">
<el-button style="position: relative; top: -1px" @click="handelGlxxszDialogSwitch" >关联选项设置</el-button>
</div>
<div
v-if="
showHide(['radio', 'select'], true) && controlData.config.optionsType == 0
"
>
<el-button style="position: relative; top: -1px" @click="handelGlxxszDialog">关联选项设置</el-button>
</div>
<div v-if="showHide(['checkbox'], true) && controlData.config.optionsType == 0">
<el-button style="position: relative; top: -1px" @click="handelGlxxszDialogCheckbox">关联选项设置</el-button>
</div>
</el-form-item> </el-form-item>
</template> </template>
<template v-else-if="controlData.config.optionsType === 3"> <template v-else-if="controlData.config.optionsType === 3">
<el-button <el-button

Loading…
Cancel
Save