增加商品索引初始化功能

master
Chopper 2021-05-18 14:18:08 +08:00
parent c457f6abc9
commit d32ea4f1ce
2 changed files with 18 additions and 3 deletions

View File

@ -411,3 +411,8 @@ export const getChildRegion = (id) => {
export const resetPassword = (params) => {
return postRequest(`/user/resetPassword/${params}"`);
};
// 初始化商品索引
export const createIndex = () => {
return getRequest(`/elasticsearch`);
};

View File

@ -55,14 +55,14 @@
</div>
<div class="label-btns">
<Button type="primary" @click="submit('formValidate')"></Button>
<Button type="primary" style="margin-left: 100px" @click="createIndex()"></Button>
</div>
</Form>
</div>
</template>
<script>
import { setSetting } from "@/api/index";
import { setSetting,createIndex } from "@/api/index";
import { handleSubmit } from "./validate";
export default {
props: ["res", "type"],
@ -90,13 +90,23 @@ export default {
this.init();
},
methods: {
//
submit(name) {
let that = this;
if( handleSubmit(that, name )){
this.setupSetting()
}
},
//
createIndex(){
createIndex().then((res) => {
if (res.success) {
this.$Message.success("开始生成!");
} else {
this.$Message.error("服务器异常!");
}
});
},
setupSetting() {
setSetting(this.type, this.formValidate).then((res) => {
if (res.success) {