fix(高级搜索): 修改请求方式
--bug=1017762 --user=李玉号 【接口测试】高级搜索,责任人 / 关注人 / 所属模块 下拉框没有内容 https://www.tapd.cn/55049933/s/1258909
This commit is contained in:
parent
12af180b4b
commit
0002f98f7a
|
@ -1,13 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<ms-table-search-component v-model="component.operator.value" :component="component" v-bind="$attrs" v-on="$listeners">
|
<ms-table-search-component v-model="component.operator.value" :component="component" v-bind="$attrs"
|
||||||
|
v-on="$listeners">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-select v-if="!component.showInput" v-model="scope.component.value" :placeholder="$t('commons.please_select')" size="small"
|
<el-select v-if="!component.showInput" v-model="scope.component.value" :placeholder="$t('commons.please_select')"
|
||||||
filterable v-bind="scope.component.props" class="search-select" v-loading="result.loading">
|
size="small"
|
||||||
|
filterable v-bind="scope.component.props" class="search-select" v-loading="loading">
|
||||||
<el-option v-for="op in options" :key="op.value" :label="label(op)" :value="op.value">
|
<el-option v-for="op in options" :key="op.value" :label="label(op)" :value="op.value">
|
||||||
<span class="demand-span">{{ label(op) }}</span>
|
<span class="demand-span">{{ label(op) }}</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-input v-model="scope.component.value" v-if="component.showInput" :placeholder="$t('commons.input_content')" size="small"/>
|
<el-input v-model="scope.component.value" v-if="component.showInput" :placeholder="$t('commons.input_content')"
|
||||||
|
size="small"/>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-search-component>
|
</ms-table-search-component>
|
||||||
</template>
|
</template>
|
||||||
|
@ -15,6 +18,7 @@
|
||||||
<script>
|
<script>
|
||||||
import MsTableSearchComponent from "./MsTableSearchComponet";
|
import MsTableSearchComponent from "./MsTableSearchComponet";
|
||||||
import {getCurrentProjectID, getCurrentUser} from "../../utils/token";
|
import {getCurrentProjectID, getCurrentUser} from "../../utils/token";
|
||||||
|
import {get} from "../../plugins/request";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsTableSearchMix",
|
name: "MsTableSearchMix",
|
||||||
|
@ -23,9 +27,7 @@ export default {
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
result: {
|
loading: false,
|
||||||
loading: false
|
|
||||||
},
|
|
||||||
options: !(this.component.options instanceof Array) ? [] : this.component.options || []
|
options: !(this.component.options instanceof Array) ? [] : this.component.options || []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -37,7 +39,7 @@ export default {
|
||||||
projectId = getCurrentUser().lastProjectId;
|
projectId = getCurrentUser().lastProjectId;
|
||||||
}
|
}
|
||||||
this.component.options.url += '/' + projectId;
|
this.component.options.url += '/' + projectId;
|
||||||
this.result = this.$get(this.component.options.url, response => {
|
this.loading = get(this.component.options.url).then(response => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
response.data.forEach(item => {
|
response.data.forEach(item => {
|
||||||
this.options.push({
|
this.options.push({
|
||||||
|
@ -72,6 +74,7 @@ export default {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.demand-span {
|
.demand-span {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
v-bind="$attrs">
|
v-bind="$attrs">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-select
|
<el-select
|
||||||
v-loading="result.loading"
|
v-loading="loading"
|
||||||
v-model="scope.component.value"
|
v-model="scope.component.value"
|
||||||
:placeholder="$t('commons.please_select')"
|
:placeholder="$t('commons.please_select')"
|
||||||
:popper-append-to-body="false"
|
:popper-append-to-body="false"
|
||||||
|
@ -51,7 +51,8 @@
|
||||||
import MsTableSearchComponent from "./MsTableSearchComponet";
|
import MsTableSearchComponent from "./MsTableSearchComponet";
|
||||||
import MsNodeTree from "../module/MsNodeTree";
|
import MsNodeTree from "../module/MsNodeTree";
|
||||||
import {cloneDeep} from "lodash";
|
import {cloneDeep} from "lodash";
|
||||||
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token";
|
import {getCurrentProjectID} from "../../utils/token";
|
||||||
|
import {get, post} from "../../plugins/request";
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -64,7 +65,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
treeOptions: [],
|
treeOptions: [],
|
||||||
result: {},
|
loading: false,
|
||||||
treeNodes: [],
|
treeNodes: [],
|
||||||
filterText: '',
|
filterText: '',
|
||||||
}
|
}
|
||||||
|
@ -87,15 +88,15 @@ export default {
|
||||||
if (!url) return;
|
if (!url) return;
|
||||||
url += '/' + getCurrentProjectID();
|
url += '/' + getCurrentProjectID();
|
||||||
if (type === "POST") {
|
if (type === "POST") {
|
||||||
this.result = this.$post(url, params || {}, response => {
|
this.loading = post(url, params || {}).then(response => {
|
||||||
this.handleTreeNodes(response.data);
|
this.handleTreeNodes(response.data);
|
||||||
});
|
})
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (type === "GET") {
|
if (type === "GET") {
|
||||||
this.result = this.$get(this.handleGETUrl(url, params), response => {
|
this.loading = get(this.handleGETUrl(url, params)).then(response => {
|
||||||
this.handleTreeNodes(response.data);
|
this.handleTreeNodes(response.data);
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
reload() {
|
reload() {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<ms-table-search-component v-model="component.operator.value" :component="component" v-bind="$attrs" v-on="$listeners">
|
<ms-table-search-component v-model="component.operator.value" :component="component" v-bind="$attrs" v-on="$listeners">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-select v-model="scope.component.value" :placeholder="$t('commons.please_select')" size="small"
|
<el-select v-model="scope.component.value" :placeholder="$t('commons.please_select')" size="small"
|
||||||
filterable v-bind="scope.component.props" class="search-select" v-loading="result.loading">
|
filterable v-bind="scope.component.props" class="search-select" v-loading="loading">
|
||||||
<el-option v-for="op in options" :key="op.value" :label="label(op)" :value="op.value">
|
<el-option v-for="op in options" :key="op.value" :label="label(op)" :value="op.value">
|
||||||
<span class="demand-span">{{label(op)}}</span>
|
<span class="demand-span">{{label(op)}}</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MsTableSearchComponent from "./MsTableSearchComponet";
|
import MsTableSearchComponent from "./MsTableSearchComponet";
|
||||||
|
import {get} from "../../plugins/request";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsTableSearchSelect",
|
name: "MsTableSearchSelect",
|
||||||
|
@ -21,15 +22,13 @@ export default {
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
result: {
|
loading: false,
|
||||||
loading: false
|
|
||||||
},
|
|
||||||
options: !(this.component.options instanceof Array) ? [] : this.component.options || []
|
options: !(this.component.options instanceof Array) ? [] : this.component.options || []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
if (!(this.component.options instanceof Array) && this.component.options.url) {
|
if (!(this.component.options instanceof Array) && this.component.options.url) {
|
||||||
this.result = this.$get(this.component.options.url, response => {
|
this.loading = get(this.component.options.url).then(response => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
response.data.forEach(item => {
|
response.data.forEach(item => {
|
||||||
this.options.push({
|
this.options.push({
|
||||||
|
|
|
@ -485,7 +485,7 @@ export const PRINCIPAL = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
options: MS_USER_OPTIONS,
|
options: MS_PROJECT_USER_OPTIONS,
|
||||||
props: {
|
props: {
|
||||||
multiple: true
|
multiple: true
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue