pull/1/head
xiaozhiyong 2 years ago
parent a4a912ff5f
commit 492e3c3748
  1. 77
      src/components/autocomplete/index.vue
  2. 9
      src/views/product/components/add.vue
  3. 5
      src/views/product/components/create.vue
  4. 5
      src/views/product/index.vue
  5. 5
      src/views/refineryAccount/components/add.vue
  6. 5
      src/views/refineryAccount/index.vue
  7. 5
      src/views/refineryInfo/index.vue

@ -1,5 +1,5 @@
<template> <template>
<el-autocomplete <!-- <el-autocomplete
v-model="text" v-model="text"
:fetch-suggestions="querySearchAsync" :fetch-suggestions="querySearchAsync"
:value-key="config.valueKey" :value-key="config.valueKey"
@ -7,7 +7,26 @@
clearable clearable
@select="selectAutocomplete" @select="selectAutocomplete"
@clear="params[config.querykey] = ''" @clear="params[config.querykey] = ''"
></el-autocomplete> ></el-autocomplete> -->
<el-select
v-model="params[config.querykey]"
filterable
remote
clearable
reserve-keyword
:placeholder="config.placeholder"
:remote-method="remoteMethod"
@clear="list = []"
>
<el-option
v-for="(item, index) in list"
:key="item.id + index"
:label="item[config.labelKey]"
:value="item[config.valueKey]"
>
</el-option>
</el-select>
</template> </template>
<script> <script>
@ -17,37 +36,67 @@ export default {
config: Object, config: Object,
// config: { // config: {
// serveTarget: {}, // // serveTarget: {}, //
// autocomplateKey: "", // // autocompleteKey: "", //
// labelKey: "", //label
// valueKey: "", //
// querykey: "", // // querykey: "", //
// }, // },
}, },
data() { data() {
return { return {
text: "", text: "",
list: [],
}; };
}, },
created() { watch: {
console.log("params", this.params); "config.echoId": {
handler(nval, oval) {
if (nval) {
console.log(nval);
this.remoteMethod(this.config.echoName);
}
},
deep: true,
immediate: true,
},
}, },
methods: { methods: {
// //
querySearchAsync(queryString, cb) { remoteMethod(query) {
if (queryString) { if (query !== "") {
this.loading = true;
let params = {}; let params = {};
params[this.config.autocompleteKey] = queryString; params[this.config.autocompleteKey] = query;
this.config.serveTarget(params).then((res) => { this.config.serveTarget(params).then((res) => {
let timeInstance = setTimeout(() => { let timeInstance = setTimeout(() => {
this.loading = false;
clearTimeout(timeInstance); clearTimeout(timeInstance);
if (res.data.length) { if (res.data.length) {
cb(res.data); this.list = res.data;
} else cb([]); } else this.list = [];
}, 1000 * Math.random()); }, 1000 * Math.random());
}); });
} else cb([]); } else {
}, this.list = [];
selectAutocomplete(item) { }
this.params[this.config.querykey] = item.id;
}, },
// querySearchAsync(queryString, cb) {
// if (queryString) {
// let params = {};
// params[this.config.autocompleteKey] = queryString;
// this.config.serveTarget(params).then((res) => {
// let timeInstance = setTimeout(() => {
// clearTimeout(timeInstance);
// if (res.data.length) {
// cb(res.data);
// } else cb([]);
// }, 1000 * Math.random());
// });
// } else cb([]);
// },
// selectAutocomplete(item) {
// this.params[this.config.querykey] = item.id;
// },
}, },
}; };
</script> </script>

@ -110,10 +110,13 @@ export default {
refineryList: [], refineryList: [],
configAutocomplete: { configAutocomplete: {
serveTarget: refineryInfoServe.findByEntity, serveTarget: refineryInfoServe.findByEntity,
autocomplateKey: "refineryName", autocompleteKey: "refineryName",
valueKey: "refineryName", labelKey: "refineryName",
valueKey: "id",
placeholder: "炼厂名称", placeholder: "炼厂名称",
querykey: "refineryId", querykey: "refineryId",
echoId: "",
echoName: "",
}, },
productTypeList: [ productTypeList: [
{ {
@ -170,6 +173,8 @@ export default {
if (id) { if (id) {
// //
this.form = JSON.parse(JSON.stringify(this.controlWindows.addInfo)); this.form = JSON.parse(JSON.stringify(this.controlWindows.addInfo));
this.configAutocomplete.echoId = id;
this.configAutocomplete.echoName = this.form.refineryName;
console.log("this.form", this.form.floorPrice); console.log("this.form", this.form.floorPrice);
} }
}, },

@ -93,8 +93,9 @@ export default {
refineryList: [], refineryList: [],
configAutocomplete: { configAutocomplete: {
serveTarget: refineryInfoServe.findByEntity, serveTarget: refineryInfoServe.findByEntity,
autocomplateKey: "refineryName", autocompleteKey: "refineryName",
valueKey: "refineryName", labelKey: "refineryName",
valueKey: "id",
placeholder: "炼厂名称", placeholder: "炼厂名称",
querykey: "refineryId", querykey: "refineryId",
}, },

@ -224,8 +224,9 @@ export default {
}, },
configAutocomplete: { configAutocomplete: {
serveTarget: refineryInfoServe.findByEntity, serveTarget: refineryInfoServe.findByEntity,
autocomplateKey: "refineryName", autocompleteKey: "refineryName",
valueKey: "refineryName", labelKey: "refineryName",
valueKey: "id",
placeholder: "炼厂名称", placeholder: "炼厂名称",
querykey: "refineryId", querykey: "refineryId",
}, },

@ -70,8 +70,9 @@ export default {
refineryList: [], refineryList: [],
configAutocomplete: { configAutocomplete: {
serveTarget: refineryInfoServe.findByEntity, serveTarget: refineryInfoServe.findByEntity,
autocomplateKey: "refineryName", autocompleteKey: "refineryName",
valueKey: "refineryName", labelKey: "refineryName",
valueKey: "id",
placeholder: "炼厂名称", placeholder: "炼厂名称",
querykey: "refineryId", querykey: "refineryId",
}, },

@ -162,8 +162,9 @@ export default {
}, },
configAutocomplete: { configAutocomplete: {
serveTarget: refineryInfoServe.findByEntity, serveTarget: refineryInfoServe.findByEntity,
autocomplateKey: "refineryName", autocompleteKey: "refineryName",
valueKey: "refineryName", labelKey: "refineryName",
valueKey: "id",
placeholder: "炼厂名称", placeholder: "炼厂名称",
querykey: "refineryId", querykey: "refineryId",
}, },

@ -189,8 +189,9 @@ export default {
}, },
configAutocomplete: { configAutocomplete: {
serveTarget: serve.findByEntity, serveTarget: serve.findByEntity,
autocomplateKey: "refineryName", autocompleteKey: "refineryName",
valueKey: "refineryName", labelKey: "refineryName",
valueKey: "id",
placeholder: "炼厂名称", placeholder: "炼厂名称",
querykey: "refineryId", querykey: "refineryId",
}, },

Loading…
Cancel
Save