-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#64 add feature: add copy_to and multi_fields feature when create ind…
…ex version [vip:platform/pallas#879]
- Loading branch information
1 parent
f96b00d
commit 3c7a223
Showing
15 changed files
with
812 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...e-web/src/pages/index_detail/version_manage/version_info_dialog/schema_copy_to_dialog.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<template> | ||
<el-dialog title="选择复制的域" v-model="isCopyToFieldsVisible" @open="initSelectList" :before-close="closeDialog"> | ||
<div class="copy-to-field"> | ||
<el-transfer | ||
filterable | ||
v-model="copyToFieldSelected" | ||
:data="copyToFieldList" | ||
:titles="['可选的域', '已选的域']"></el-transfer> | ||
</div> | ||
<div slot="footer" class="dialog-footer"> | ||
<el-button @click="closeDialog()">取 消</el-button> | ||
<el-button type="confirm" @click="sumbitCopyToField">确定</el-button> | ||
</div> | ||
</el-dialog> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: ['isCopyToFieldsVisible', 'schemaCopyToInfo', 'copyToList', 'schemaParentFieldName'], | ||
data() { | ||
return { | ||
copyToFieldList: [], | ||
copyToFieldSelected: [], | ||
}; | ||
}, | ||
methods: { | ||
closeDialog() { | ||
this.$emit('close-schema-dialog'); | ||
}, | ||
sumbitCopyToField() { | ||
if (this.copyToFieldSelected.length > 0) { | ||
this.schemaCopyToInfo.copyTo = []; | ||
this.copyToFieldSelected.forEach((element) => { | ||
this.schemaCopyToInfo.copyTo.push(element); | ||
}); | ||
this.$emit('add-schema-copy-to', this.schemaCopyToInfo.copyTo); | ||
} else { | ||
this.$message.errorMessage('请选择要复制的域!'); | ||
} | ||
}, | ||
initSelectList() { | ||
this.copyToFieldSelected = []; | ||
const arr = JSON.parse(JSON.stringify(this.copyToList)); | ||
this.copyToFieldList = arr.map((obj) => { | ||
const rObj = {}; | ||
rObj.key = obj; | ||
rObj.label = obj; | ||
return rObj; | ||
}); | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style> | ||
.copy-to-field { | ||
margin: 10px; | ||
} | ||
.copy-to-field .el-transfer-panel { | ||
width: 250px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
162 changes: 162 additions & 0 deletions
162
...b/src/pages/index_detail/version_manage/version_info_dialog/schema_multi_field_dialog.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
<template> | ||
<div class="schema-info-dialog"> | ||
<el-dialog :title="childTitle" size="large" v-model="isSchemaMultiFieldsVisible" @open="openDialog" :show-close="false" :close-on-click-modal="false" :close-on-press-escape="false"> | ||
<div class="schema-content"> | ||
<el-button type="primary" icon="plus" @click="handleAdd" v-if="!isEditable">新增字段</el-button> | ||
|
||
</div> | ||
<el-table :data="multiFieldInfo" border style="width: 100%"> | ||
<el-table-column label="字段名"> | ||
<template scope="scope"> | ||
<el-input v-model="scope.row.fieldName" :disabled="isEditable"></el-input> | ||
</template> | ||
</el-table-column> | ||
<el-table-column label="ES类型"> | ||
<template scope="scope"> | ||
<select v-model="scope.row.fieldType" size="small" :disabled="isEditable"> | ||
<option v-for="item in fieldTypes" :value="item.value" :key="item.value">{{item.label}}</option> | ||
</select> | ||
</template> | ||
</el-table-column> | ||
<el-table-column label="多值/单值"> | ||
<template scope="scope"> | ||
<select v-model="scope.row.multi" size="small" :disabled="isEditable"> | ||
<option label="单值" :value="false">单值</option> | ||
<option label="多值" :value="true">多值</option> | ||
</select> | ||
</template> | ||
</el-table-column> | ||
<el-table-column label="查询关键字"> | ||
<template scope="scope"> | ||
<el-checkbox v-model="scope.row.search" :disabled="isEditable">是否查询</el-checkbox> | ||
</template> | ||
</el-table-column> | ||
<el-table-column label="排序或聚合"> | ||
<template scope="scope"> | ||
<el-checkbox v-model="scope.row.docValue" :disabled="isEditable">用于排序或聚合</el-checkbox> | ||
</template> | ||
</el-table-column> | ||
<el-table-column v-if="!isEditable" label="操作" min-width="60"> | ||
<template scope="scope"> | ||
<el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button> | ||
</template> | ||
</el-table-column> | ||
</el-table> | ||
<div slot="footer" class="dialog-footer"> | ||
|
||
<el-button @click="cancelBtn()">取消</el-button> | ||
<el-button v-if="!isEditable" type="confirm" @click="confirmBtn()">确定</el-button> | ||
</div> | ||
</el-dialog> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: ['isSchemaMultiFieldsVisible', 'schemaMultiFieldsInfo', 'versionOperation', 'schemaParentFieldName'], | ||
data() { | ||
return { | ||
multiFieldInfo: [], | ||
fieldTypes: [{ | ||
value: 'text', | ||
label: 'text', | ||
}, { | ||
value: 'keyword', | ||
label: 'keyword', | ||
}, { | ||
value: 'date', | ||
label: 'date', | ||
}, { | ||
value: 'boolean', | ||
label: 'boolean', | ||
}, { | ||
value: 'object', | ||
label: 'object', | ||
}, { | ||
value: 'nested', | ||
label: 'nested', | ||
}, { | ||
value: 'long', | ||
label: 'long', | ||
}, { | ||
value: 'integer', | ||
label: 'integer', | ||
}, { | ||
value: 'short', | ||
label: 'short', | ||
}, { | ||
value: 'byte', | ||
label: 'byte', | ||
}, { | ||
value: 'double', | ||
label: 'double', | ||
}, { | ||
value: 'float', | ||
label: 'float', | ||
}], | ||
}; | ||
}, | ||
methods: { | ||
handleAdd() { | ||
const addMultiFieldInfo = { | ||
fieldName: '', | ||
fieldType: '', | ||
multi: '', | ||
search: false, | ||
docValue: false, | ||
}; | ||
this.multiFieldInfo.push(addMultiFieldInfo); | ||
}, | ||
cancelBtn() { | ||
this.$emit('close-schema-dialog'); | ||
}, | ||
handleDelete(row) { | ||
this.$message.confirmMessage(`确定删除字段${row.fieldName}吗?`, () => { | ||
this.$array.removeByValue(this.multiFieldInfo, row); | ||
}); | ||
}, | ||
confirmBtn() { | ||
if (this.checkChildInput(this.multiFieldInfo)) { | ||
// eslint-disable-next-line max-len | ||
this.schemaMultiFieldsInfo.multiField.splice(0, this.schemaMultiFieldsInfo.multiField.length); | ||
this.multiFieldInfo.forEach((element) => { | ||
this.schemaMultiFieldsInfo.multiField.push(element); | ||
}); | ||
this.$emit('add-schema-multi-field', this.schemaMultiFieldsInfo.multiField); | ||
} | ||
}, | ||
checkChildInput(arr) { | ||
let flag = true; | ||
Object.keys(arr).forEach((element, index) => { | ||
if (arr[index].fieldName === '') { | ||
this.$message.errorMessage('字段名不能为空'); | ||
flag = false; | ||
} else { | ||
flag = true; | ||
} | ||
}); | ||
return flag; | ||
}, | ||
openDialog() { | ||
this.multiFieldInfo = JSON.parse(JSON.stringify(this.schemaMultiFieldsInfo.multiField)); | ||
}, | ||
}, | ||
computed: { | ||
isEditable() { | ||
return this.versionOperation === 'view'; | ||
}, | ||
childTitle() { | ||
const title = `${this.schemaMultiFieldsInfo.fieldName}多域字段`; | ||
return title; | ||
}, | ||
}, | ||
}; | ||
</script> | ||
<style type="text/css"> | ||
.schema-content { | ||
margin-bottom: 10px; | ||
} | ||
.schema-info-dialog .el-dialog__footer { | ||
padding: 10px 20px 15px; | ||
} | ||
</style> |
Oops, something went wrong.