|
58 | 58 | </el-col> |
59 | 59 | <template v-if="data.type === 'number' || data.type === 'string'"> |
60 | 60 | <el-col :span="3"> |
61 | | - <el-input v-model="data._value" placeholder="值"></el-input> |
62 | | - </el-col> |
63 | | - <el-col :span="3"> |
64 | | - <el-input v-model="data._label" placeholder="标签"></el-input> |
65 | | - </el-col> |
66 | | - <el-col :span="2"> |
67 | | - <el-button type="primary" @click="addOption(index)">增加选项</el-button> |
| 61 | + <el-select v-model="data._select_type" placeholder="选择类型"> |
| 62 | + <el-option label="固定" value="fixed"></el-option> |
| 63 | + <el-option label="接口" value="api"></el-option> |
| 64 | + </el-select> |
68 | 65 | </el-col> |
| 66 | + <template v-if="data._select_type === 'fixed'"> |
| 67 | + <el-col :span="3"> |
| 68 | + <el-input v-model="data._value" placeholder="值"></el-input> |
| 69 | + </el-col> |
| 70 | + <el-col :span="3"> |
| 71 | + <el-input v-model="data._label" placeholder="标签"></el-input> |
| 72 | + </el-col> |
| 73 | + <el-col :span="1"> |
| 74 | + <el-button type="primary" @click="addOption(index)">增加</el-button> |
| 75 | + </el-col> |
| 76 | + </template> |
| 77 | + <template v-if="data._select_type === 'api'"> |
| 78 | + <el-col :span="3"> |
| 79 | + <el-input v-model="data._api_path" placeholder="接口地址"></el-input> |
| 80 | + </el-col> |
| 81 | + <el-col :span="2"> |
| 82 | + <el-input v-model="data._label" placeholder="标签"></el-input> |
| 83 | + </el-col> |
| 84 | + <el-col :span="2"> |
| 85 | + <el-input v-model="data._value" placeholder="内容"></el-input> |
| 86 | + </el-col> |
| 87 | + </template> |
69 | 88 | </template> |
70 | 89 | </el-row> |
71 | 90 | </el-form-item> |
|
204 | 223 | this.$message.error('请选择保存路径') |
205 | 224 | return |
206 | 225 | } |
207 | | - const filterDataList = this.dataList.map(data => { |
208 | | - const keys = Object.keys(data).filter(key => !key.startsWith('_')) |
209 | | - const newData = {} |
210 | | - keys.forEach(key => { newData[key] = data[key] }) |
211 | | - return newData |
212 | | - }) |
213 | | - console.log('filterDataList', filterDataList) |
214 | | - d2Curd(filePath[0], this.dataConfig, filterDataList) |
| 226 | + // const filterDataList = this.dataList.map(data => { |
| 227 | + // const keys = Object.keys(data).filter(key => !key.startsWith('_')) |
| 228 | + // const newData = {} |
| 229 | + // keys.forEach(key => { newData[key] = data[key] }) |
| 230 | + // return newData |
| 231 | + // }) |
| 232 | + console.log('filterDataList', this.dataList) |
| 233 | + d2Curd(filePath[0], this.dataConfig, this.dataList) |
215 | 234 | }, |
216 | 235 | addOption (index) { |
217 | 236 | const data = this.dataList[index] |
|
0 commit comments