|
@@ -33,6 +33,7 @@
|
|
<van-picker
|
|
<van-picker
|
|
title="活动场所"
|
|
title="活动场所"
|
|
:columns="places"
|
|
:columns="places"
|
|
|
|
+ :columns-field-names="customFieldName"
|
|
@cancel="showPlace = false"
|
|
@cancel="showPlace = false"
|
|
@confirm="getPlace"
|
|
@confirm="getPlace"
|
|
/>
|
|
/>
|
|
@@ -129,6 +130,7 @@
|
|
:options="options"
|
|
:options="options"
|
|
@close="showArea = false"
|
|
@close="showArea = false"
|
|
@finish="onFinish"
|
|
@finish="onFinish"
|
|
|
|
+ :field-names="fieldNames"
|
|
/>
|
|
/>
|
|
</van-popup>
|
|
</van-popup>
|
|
</van-cell-group>
|
|
</van-cell-group>
|
|
@@ -212,10 +214,9 @@
|
|
import { reactive, ref } from "vue";
|
|
import { reactive, ref } from "vue";
|
|
import personList from "../personList.vue";
|
|
import personList from "../personList.vue";
|
|
import placeActivityServer from "@/api/placeActivity/placeActivityServer";
|
|
import placeActivityServer from "@/api/placeActivity/placeActivityServer";
|
|
-import tools from '@/api/sys/tools'
|
|
+import tools from "@/api/sys/tools";
|
|
export default {
|
|
export default {
|
|
components: { personList },
|
|
components: { personList },
|
|
- tools:new tools(),
|
|
|
|
setup() {
|
|
setup() {
|
|
// 返回
|
|
// 返回
|
|
const onClickLeft = () => {
|
|
const onClickLeft = () => {
|
|
@@ -239,17 +240,24 @@ export default {
|
|
into: "",
|
|
into: "",
|
|
});
|
|
});
|
|
// 场所名称
|
|
// 场所名称
|
|
- const places = [
|
|
+ let places = ref([]);
|
|
- { text: "杭州", value: "Hangzhou" },
|
|
+ const customFieldName = {
|
|
- { text: "宁波", value: "Ningbo" },
|
|
+ text: "name",
|
|
- { text: "温州", value: "Wenzhou" },
|
|
+ value: "name",
|
|
- { text: "绍兴", value: "Shaoxing" },
|
|
+ };
|
|
- { text: "湖州", value: "Huzhou" },
|
|
+ new tools()
|
|
- ];
|
|
+ .placeList({
|
|
|
|
+ current: 1,
|
|
|
|
+ size: 10000,
|
|
|
|
+ })
|
|
|
|
+ .then(({ records }) => {
|
|
|
|
+ places.value.push(...records) ;
|
|
|
|
+ });
|
|
let showPlace = ref(false);
|
|
let showPlace = ref(false);
|
|
const getPlace = ({ selectedOptions }) => {
|
|
const getPlace = ({ selectedOptions }) => {
|
|
|
|
+ // console.log("选择",selectedOptions);
|
|
showPlace.value = false;
|
|
showPlace.value = false;
|
|
- placeActivity.place = selectedOptions[0].text;
|
|
+ placeActivity.place = selectedOptions[0].name;
|
|
};
|
|
};
|
|
// 获取活动时间
|
|
// 获取活动时间
|
|
let showAct = ref(false);
|
|
let showAct = ref(false);
|
|
@@ -278,32 +286,28 @@ export default {
|
|
// 地区选择
|
|
// 地区选择
|
|
let showArea = ref(false);
|
|
let showArea = ref(false);
|
|
const cascaderValue = ref("");
|
|
const cascaderValue = ref("");
|
|
- tools.treeData().then((res) => {
|
|
+ const fieldNames = {
|
|
|
|
+ text: "name",
|
|
|
|
+ value: "code",
|
|
|
|
+ children: "children",
|
|
|
|
+ };
|
|
|
|
+ // 选项列表,children 代表子选项,支持多级嵌套
|
|
|
|
+ let options = ref([]);
|
|
|
|
+ new tools().treeData().then((res) => {
|
|
console.log("area", res);
|
|
console.log("area", res);
|
|
|
|
+ options.value.push(res[0]);
|
|
});
|
|
});
|
|
- // 选项列表,children 代表子选项,支持多级嵌套
|
|
|
|
- const options = [
|
|
|
|
- {
|
|
|
|
- text: "浙江省",
|
|
|
|
- value: "330000",
|
|
|
|
- children: [{ text: "杭州市", value: "330100" }],
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- text: "江苏省",
|
|
|
|
- value: "320000",
|
|
|
|
- children: [{ text: "南京市", value: "320100" }],
|
|
|
|
- },
|
|
|
|
- ];
|
|
|
|
// 全部选项选择完毕后,会触发 finish 事件
|
|
// 全部选项选择完毕后,会触发 finish 事件
|
|
const onFinish = ({ selectedOptions }) => {
|
|
const onFinish = ({ selectedOptions }) => {
|
|
showArea.value = false;
|
|
showArea.value = false;
|
|
placeActivity.activityPlace = selectedOptions
|
|
placeActivity.activityPlace = selectedOptions
|
|
- .map((option) => option.text)
|
|
+ .map((option) => option.name)
|
|
.join("/");
|
|
.join("/");
|
|
};
|
|
};
|
|
return {
|
|
return {
|
|
placeActivity,
|
|
placeActivity,
|
|
// 活动场所
|
|
// 活动场所
|
|
|
|
+ customFieldName,
|
|
showPlace,
|
|
showPlace,
|
|
places,
|
|
places,
|
|
getPlace,
|
|
getPlace,
|
|
@@ -321,6 +325,7 @@ export default {
|
|
reselected,
|
|
reselected,
|
|
// 地区选择
|
|
// 地区选择
|
|
showArea,
|
|
showArea,
|
|
|
|
+ fieldNames,
|
|
options,
|
|
options,
|
|
onFinish,
|
|
onFinish,
|
|
cascaderValue,
|
|
cascaderValue,
|