fix(高级搜索): 关联需求搜索问题

This commit is contained in:
shiziyuan9527 2022-07-26 21:47:15 +08:00 committed by shiziyuan9527
parent 71d7cc5ee2
commit 8dd7f39292
3 changed files with 14 additions and 6 deletions

View File

@ -14,6 +14,7 @@
<script> <script>
import MsTableSearchComponent from "./MsTableSearchComponet"; import MsTableSearchComponent from "./MsTableSearchComponet";
import {getCurrentProjectID, getCurrentUser} from "@/common/js/utils";
export default { export default {
name: "MsTableSearchMix", name: "MsTableSearchMix",
@ -30,6 +31,12 @@ export default {
}, },
created() { created() {
if (!(this.component.options instanceof Array) && this.component.options.url) { if (!(this.component.options instanceof Array) && this.component.options.url) {
// is need to add project properties
let projectId = getCurrentProjectID();
if (!projectId) {
projectId = getCurrentUser().lastProjectId;
}
this.component.options.url += '/' + projectId;
this.result = this.$get(this.component.options.url, response => { this.result = this.$get(this.component.options.url, response => {
if (response.data) { if (response.data) {
response.data.forEach(item => { response.data.forEach(item => {

View File

@ -51,6 +51,7 @@
import MsTableSearchComponent from "@/business/components/common/components/search/MsTableSearchComponet"; import MsTableSearchComponent from "@/business/components/common/components/search/MsTableSearchComponet";
import MsNodeTree from "@/business/components/track/common/NodeTree"; import MsNodeTree from "@/business/components/track/common/NodeTree";
import {cloneDeep} from "lodash"; import {cloneDeep} from "lodash";
import {getCurrentProjectID} from "@/common/js/utils";
export default { export default {
@ -84,6 +85,7 @@ export default {
let options = cloneDeep(this.component.options); let options = cloneDeep(this.component.options);
let {url, params, type} = options; let {url, params, type} = options;
if (!url) return; if (!url) return;
url += '/' + getCurrentProjectID();
if (type === "POST") { if (type === "POST") {
this.result = this.$post(url, params || {}, response => { this.result = this.$post(url, params || {}, response => {
this.handleTreeNodes(response.data); this.handleTreeNodes(response.data);

View File

@ -3,7 +3,6 @@ import MsTableSearchDateTimePicker from "./MsTableSearchDateTimePicker";
import MsTableSearchDatePicker from "./MsTableSearchDatePicker"; import MsTableSearchDatePicker from "./MsTableSearchDatePicker";
import MsTableSearchSelect from "./MsTableSearchSelect"; import MsTableSearchSelect from "./MsTableSearchSelect";
import MsTableSearchInputNumber from "@/business/components/common/components/search/MsTableSearchInputNumber"; import MsTableSearchInputNumber from "@/business/components/common/components/search/MsTableSearchInputNumber";
import {getCurrentProjectID} from "@/common/js/utils";
import MsTableSearchMix from "@/business/components/common/components/search/MsTableSearchMix"; import MsTableSearchMix from "@/business/components/common/components/search/MsTableSearchMix";
import MsTableSearchNodeTree from "@/business/components/common/components/search/MsTableSearchNodeTree"; import MsTableSearchNodeTree from "@/business/components/common/components/search/MsTableSearchNodeTree";
@ -714,7 +713,7 @@ export const CASE_DEMAND = {
this.showInput = false; this.showInput = false;
}, },
options: { options: {
url: "/issues/demand/list/" + getCurrentProjectID(), url: "/issues/demand/list",
labelKey: "name", labelKey: "name",
valueKey: "id", valueKey: "id",
showLabel: option => { showLabel: option => {
@ -751,25 +750,25 @@ function _getModuleTree(options) {
} }
export const TEST_CASE_MODULE_TREE = _getModuleTree({ export const TEST_CASE_MODULE_TREE = _getModuleTree({
url: "/case/node/list/" + getCurrentProjectID(), url: "/case/node/list",
type: "POST", type: "POST",
params: {} // 赋值时注意顺序 params: {} // 赋值时注意顺序
}) })
export const API_MODULE_TREE = _getModuleTree({ export const API_MODULE_TREE = _getModuleTree({
url: "/api/module/list/" + getCurrentProjectID(), url: "/api/module/list",
type: "GET", type: "GET",
params: {} params: {}
}) })
export const SCENARIO_MODULE_TREE = _getModuleTree({ export const SCENARIO_MODULE_TREE = _getModuleTree({
url: "/api/automation/module/list/" + getCurrentProjectID(), url: "/api/automation/module/list",
type: "GET", type: "GET",
params: {} params: {}
}) })
export const UI_MODULE_TREE = _getModuleTree({ export const UI_MODULE_TREE = _getModuleTree({
url: "/ui/scenario/module/list/" + getCurrentProjectID(), url: "/ui/scenario/module/list",
type: "GET", type: "GET",
params: {} params: {}
}) })