diff --git a/src/components/MySelect/RequestSelect.vue b/src/components/MySelect/RequestSelect.vue
index cce16feb9c3bc73fad872860e9a5253a7c2c6b12..57228accf305812430fa4312957e734d3ecc0d49 100644
--- a/src/components/MySelect/RequestSelect.vue
+++ b/src/components/MySelect/RequestSelect.vue
@@ -24,6 +24,8 @@ export default {
request: Function,
formatData: { type: Object, default: undefined },
getName: Function,
+ labelFiled: String, // 和 formatData 一样 传一种就行了
+ valueFiled: String,
},
data() {
return {
@@ -34,6 +36,9 @@ export default {
if (this.request) {
const newArr = await this.request();
this.data = this.formatData ? await formatObj(newArr, this.formatData) : newArr;
+ this.data = this.labelFiled
+ ? formatObj(newArr, { label: this.labelFiled, value: this.valueFiled, key: this.valueFiled })
+ : this.data;
}
},
methods: {
diff --git a/src/components/MySelect/search_select.vue b/src/components/MySelect/search_select.vue
index 52b987735728883b3c256f23194785932f76a265..2ae0aae90c975e0da6fb4af69a5b417746f9889b 100644
--- a/src/components/MySelect/search_select.vue
+++ b/src/components/MySelect/search_select.vue
@@ -21,8 +21,9 @@ export default {
props: {
url: String,
searchField: String,
- formatData: Object,
mode: String,
+ labelFiled: String,
+ valueFiled: String,
},
model: {
prop: 'value',
@@ -38,10 +39,11 @@ export default {
},
methods: {
async getData(searchString) {
- this.options = formatObj(
- await getReq(this.url, { [this.searchField]: searchString }),
- this.formatData,
- );
+ this.options = formatObj(await getReq(this.url, { [this.searchField]: searchString }), {
+ label: this.labelFiled,
+ value: this.valueFiled,
+ key: this.valueFiled,
+ });
},
handleSearch(value) {
if (this.timeOut) clearTimeout(this.timeOut);
diff --git a/src/pages/xunjian/task_managment/center/common/index.js b/src/pages/xunjian/task_managment/center/common/index.js
deleted file mode 100644
index 610a23d28a0cf08c81acd41410d87bfba9135b17..0000000000000000000000000000000000000000
--- a/src/pages/xunjian/task_managment/center/common/index.js
+++ /dev/null
@@ -1,17 +0,0 @@
-export const areaFormatData = {
- label: 'regionName',
- value: 'regionId',
- key: 'regionId',
-};
-
-export const statusFormtData = {
- label: 'paramName',
- value: 'paramValue',
- key: 'paramValue',
-};
-
-export const banZuFormatData = {
- label: 'paramName',
- value: 'paramValue',
- key: 'paramValue',
-};
diff --git a/src/pages/xunjian/task_managment/center/form.vue b/src/pages/xunjian/task_managment/center/form.vue
index a2e52824caeb88f3a2e84646b579d0bae3b169db..d92ed280ae49769982f8ec355c8251436f2a3618 100644
--- a/src/pages/xunjian/task_managment/center/form.vue
+++ b/src/pages/xunjian/task_managment/center/form.vue
@@ -4,8 +4,9 @@
@@ -21,8 +22,9 @@
@@ -39,7 +41,8 @@
@@ -54,7 +57,6 @@ import RequestSelect from '@/components/MySelect/RequestSelect.vue';
import SearchSelect from '@/components/MySelect/search_select.vue';
import UrlSelect from '@/components/MySelect/url_select.vue';
import { getAreaListDataApi, getBanZuListApi, addXunJianTaskApi } from '@/api';
-import { areaFormatData, banZuFormatData } from './common';
export default {
props: {
@@ -65,7 +67,6 @@ export default {
data() {
return {
getAreaListDataApi,
- banZuFormatData,
getBanZuListApi,
form: {},
rules: {
@@ -75,12 +76,6 @@ export default {
routeId: [{ required: true }],
regionId: [{ required: true }],
},
- areaFormatData,
- formatXunJianRenData: {
- value: 'userId',
- label: 'userName',
- key: 'userId',
- },
};
},
computed: {
diff --git a/src/pages/xunjian/task_managment/center/index.vue b/src/pages/xunjian/task_managment/center/index.vue
index 5dabdc52dd877f10fc5787daea11792e48f3df8c..7cd96688ddcd50aa18e98e9438fe756e0fca6c4a 100644
--- a/src/pages/xunjian/task_managment/center/index.vue
+++ b/src/pages/xunjian/task_managment/center/index.vue
@@ -19,57 +19,73 @@
-
-
-
@@ -98,20 +114,20 @@