Browse Source

选项批量导入

lwx_v27
liwenxuan 7 days ago
parent
commit
20091da23b
  1. 208
      src/components/DesignForm/formControlPropertiNew.vue

208
src/components/DesignForm/formControlPropertiNew.vue

@ -2829,6 +2829,67 @@ function getAssociatedFormsCurrentFieldTree1() {
});
}
// liwenxuan 20251212 start
//
const options = ref([])
//
const selectedValues = ref(["1", "3"])
//
const dialogVisible = ref(false)
//
const editText = ref('')
//
const openDialog = () => {
//
editText.value = options.value.map(option => option.label).join('\n')
dialogVisible.value = true
}
//
const cancelEditing = () => {
dialogVisible.value = false
editText.value = ''
}
//
const saveChanges = () => {
//
const lines = editText.value
.split('\n')
.map(line => line.trim())
.filter(line => line !== '')
//
const newOptions = lines.map((label, index) => ({
label,
value: (index + 1).toString() // 1
}))
//
options.value = newOptions
//
dialogVisible.value = false
//
editText.value = ''
console.log('选项已更新:', {
options: options.value,
selected: selectedValues.value
})
}
// liwenxuan 20251212 end
// liwenxuan 20251209 start
let datapropsformList = JSON.parse(JSON.stringify(props.formList))
const glxxszTree = computed(()=>{
@ -6151,6 +6212,12 @@ const formatTooltip = (val: number) => {
controlData.type === "cascader" ? "编辑" : "新增"
}}</el-button>
</el-form-item>
<el-form-item class="form_cont">
<el-button type="primary" size="small" @click="openDialog" >
批量编辑
</el-button>
</el-form-item>
</template>
<template v-else-if="controlData.config.optionsType === 3">
<el-button
@ -7902,6 +7969,44 @@ const formatTooltip = (val: number) => {
<!-- 用户组织联动选择 end -->
<!-- 选项批量编辑 liwenxuan 20251212 start -->
<!-- 编辑弹窗 -->
<el-dialog
v-model="dialogVisible"
title="批量编辑"
width="500px"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<div class="dialog-content">
<div class="edit-header">
<span class="edit-title">多选框-批量编辑</span>
<span class="edit-hint">每行对应一个选项</span>
</div>
<div class="textarea-container">
<el-input
v-model="editText"
type="textarea"
:rows="8"
placeholder="请输入选项,每行一个"
resize="none"
/>
</div>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="cancelEditing">取消</el-button>
<el-button type="primary" @click="saveChanges">确定</el-button>
</span>
</template>
</el-dialog>
<!-- 选项批量编辑 liwenxuan 20251212 end -->
<!-- 单选下拉多选选项来源value3--系统表单字段 start-->
@ -8101,4 +8206,107 @@ li::before {
.card-header {
text-align: right;
}
.batch-edit-demo {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
max-width: 600px;
margin: 20px auto;
padding: 20px;
}
.display-mode {
border: 1px solid #DCDFE6;
border-radius: 4px;
padding: 20px;
margin-bottom: 20px;
}
.display-mode h4 {
margin-top: 0;
margin-bottom: 15px;
color: #303133;
}
.edit-header {
margin-bottom: 20px;
}
.edit-title {
display: block;
font-weight: 500;
font-size: 14px;
color: #303133;
margin-bottom: 4px;
}
.edit-hint {
font-size: 12px;
color: #909399;
}
.textarea-container {
margin-bottom: 10px;
}
.action-bar {
margin-top: 20px;
display: flex;
justify-content: flex-end;
}
.el-checkbox {
display: block;
margin-bottom: 8px;
}
.el-checkbox:last-child {
margin-bottom: 0;
}
.dialog-content {
padding: 10px 0;
}
:deep(.el-dialog__header) {
margin-right: 0;
padding-bottom: 10px;
border-bottom: 1px solid #F0F0F0;
}
:deep(.el-dialog__title) {
font-size: 16px;
font-weight: 500;
color: #303133;
}
:deep(.el-dialog__footer) {
padding-top: 20px;
border-top: 1px solid #F0F0F0;
}
:deep(.el-textarea__inner) {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
line-height: 1.5;
padding: 12px;
}
.status-info {
padding: 15px;
background-color: #f5f7fa;
border-radius: 4px;
border: 1px solid #e4e7ed;
}
.status-info h4 {
margin-top: 0;
margin-bottom: 10px;
color: #303133;
}
.status-info p {
margin: 5px 0;
font-size: 14px;
color: #606266;
}
</style>

Loading…
Cancel
Save