更改了画像搜索方式

main
许宏杰 3 weeks ago
parent 8b0f295e27
commit d45a9373f2

@ -1,8 +1,8 @@
import request from "@/utils/request"; import request from "@/utils/request";
// 本地 // 本地
// let api = "API" let api = process.env.NODE_ENV === "production" ?location.origin: "API"
// 线上 // 线上
let api = location.origin // let api = location.origin
export default { export default {
frimLogin() { frimLogin() {
return request({ return request({

@ -15,9 +15,10 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
// 创建axios实例 // 创建axios实例
const service = axios.create({ const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分 // axios中请求配置有baseURL选项表示请求URL公共部分
// baseURL: process.env.VUE_APP_BASE_API, //本地调试
baseURL: process.env.NODE_ENV === "production" ? location.origin +"/api/ggfw" : process.env.VUE_APP_BASE_API,
//!线上--2.17-198 //!线上--2.17-198
baseURL:location.origin +"/api/ggfw", // baseURL:location.origin +"/api/ggfw",
//!其他 //!其他
// baseURL:location.origin, // baseURL:location.origin,
// 超时 // 超时

@ -44,11 +44,12 @@
<div class="input"> <div class="input">
<el-input v-model="input" placeholder="请输入产品名称、批准文号/备案编号"></el-input> <el-input v-model="input" placeholder="请输入产品名称、批准文号/备案编号"></el-input>
</div> </div>
<div class="sousuo" @click="gotoBgpage"> <!-- @click="gotoBgpage" -->
<div class="sousuo" @click="getsearchList()" >
<img src="@/assets/images/daping/searchicon.png" alt="" /> <img src="@/assets/images/daping/searchicon.png" alt="" />
搜索 搜索
</div> </div>
<div class="box-dialog" v-loading="loading" v-if="dialog"> <div class="box-dialog" v-loading="loading" v-show="!loading">
<div class="dialog-item" v-for='(item, index) in searchList' :key="index" @click="getValue(item)"> <div class="dialog-item" v-for='(item, index) in searchList' :key="index" @click="getValue(item)">
{{ item.name }} {{ item.name }}
</div> </div>
@ -204,19 +205,19 @@ export default {
} }
}, },
watch: { watch: {
async input(newValue, oldValue) { // async input(newValue, oldValue) {
// let data = await this.$api.productPortrayal.findByName({current:1,size:10}); // // let data = await this.$api.productPortrayal.findByName({current:1,size:10});
if (newValue) { // if (newValue) {
this.loading = true; // this.loading = true;
this.dialog = true; // this.dialog = true;
// let a = this.throttle(this.getsearchList,500) // // let a = this.throttle(this.getsearchList,500)
this.getsearchList(newValue); // this.getsearchList(newValue);
} else { // } else {
this.dialog = false; // this.dialog = false;
this.searchList = []; // this.searchList = [];
this.loading = false; // this.loading = false;
} // }
} // }
}, },
created() { this.dataNow(1) }, created() { this.dataNow(1) },
mounted() { mounted() {
@ -226,6 +227,7 @@ export default {
this.userName = user.realName this.userName = user.realName
}, },
methods: { methods: {
ListGO(item) { ListGO(item) {
this.$router.push({ path: "/bgpage", query: { code: item.code, name: item.name, type: item.type } }) this.$router.push({ path: "/bgpage", query: { code: item.code, name: item.name, type: item.type } })
}, },
@ -311,19 +313,21 @@ export default {
getValue(item) { getValue(item) {
this.input = item.name; this.input = item.name;
this.getData = item; this.getData = item;
setTimeout(() => { this.loading = true;
this.dialog = false; this.gotoBgpage()
}, 200);
}, },
async getsearchList(newValue) { async getsearchList() {
let data = await this.$api.productPortrayal.findByName({ name: newValue }); let res = await this.$api.productPortrayal.findByName({ name: this.input });
if (data.code == 200) {
this.loading = false; this.loading = false;
this.searchList = data.data; this.searchList = res.data;
if (this.searchList.length < 1) {
this.dialog = false; if(this.searchList.length>0){
this.loading = false
}else{
this.$modal.msgWarning("未搜索到结果!")
this.loading = true
} }
}
}, },
tuichudengl() { tuichudengl() {
console.log(111); console.log(111);

Loading…
Cancel
Save