优化供应器编辑

This commit is contained in:
Sakura-RanChen
2025-05-14 16:48:35 +08:00
parent ac52714498
commit 1efaf048f5
@@ -49,7 +49,7 @@
<div class="fields-container"> <div class="fields-container">
<el-table :data="form.fields" style="width: 100%;" border size="medium" :key="tableKey"> <el-table :data="form.fields" style="width: 100%;" border size="medium" :key="tableKey">
<el-table-column label="选择" align="center" width="120"> <el-table-column label="选择" align="center" width="50">
<template slot-scope="scope"> <template slot-scope="scope">
<el-checkbox v-model="scope.row.selected" @change="handleFieldSelectChange"></el-checkbox> <el-checkbox v-model="scope.row.selected" @change="handleFieldSelectChange"></el-checkbox>
</template> </template>
@@ -60,7 +60,7 @@
<el-input v-model="scope.row.key" placeholder="字段key"></el-input> <el-input v-model="scope.row.key" placeholder="字段key"></el-input>
</template> </template>
<template v-else> <template v-else>
{{ scope.row.key || '-' }} {{ scope.row.key }}
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
@@ -70,7 +70,7 @@
<el-input v-model="scope.row.label" placeholder="字段标签"></el-input> <el-input v-model="scope.row.label" placeholder="字段标签"></el-input>
</template> </template>
<template v-else> <template v-else>
{{ scope.row.label || '-' }} {{ scope.row.label }}
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
@@ -89,6 +89,16 @@
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="默认值">
<template slot-scope="scope">
<template v-if="scope.row.editing">
<el-input v-model="scope.row.default_value" placeholder="请输入默认值"></el-input>
</template>
<template v-else>
{{ scope.row.default_value }}
</template>
</template>
</el-table-column>
<el-table-column label="操作" width="150" align="center"> <el-table-column label="操作" width="150" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-if="!scope.row.editing" type="primary" size="mini" @click="startEditing(scope.row)"> <el-button v-if="!scope.row.editing" type="primary" size="mini" @click="startEditing(scope.row)">
@@ -148,7 +158,7 @@ export default {
'boolean': '布尔值', 'boolean': '布尔值',
'dict': '字典' 'dict': '字典'
}; };
return typeMap[type] || '-'; return typeMap[type];
}, },
startEditing(row) { startEditing(row) {
@@ -205,6 +215,7 @@ export default {
key: '', key: '',
label: '', label: '',
type: 'string', type: 'string',
default_value: '',
selected: false, selected: false,
editing: true editing: true
}); });