Ver código fonte

完善异常群众现居地选择

LuChongMei 1 ano atrás
pai
commit
4b91bb6f73

+ 12 - 5
src/api/sys/tools.js

@@ -3,6 +3,13 @@ export default class Tools {
     treeData() {
         return request.get(`/tools/area_yc/treeData`);
     };
+    //籍贯接口
+    nativePlace(params) {
+        return request.get(
+            `/sys/area/treeData`,
+            params
+        )
+    };
     placeList(params) {
         return request.get(
             `/religioussites/siteinfo/religiousSitesInfo/list`,
@@ -46,11 +53,11 @@ export default class Tools {
     };
     // 用户查询
     queryById(id) {
-            return request.get(
-                `/sys/user/queryById`, { id: id }
-            )
-        }
-        // 获取场所地点
+        return request.get(
+            `/sys/user/queryById`, { id: id }
+        )
+    }
+    // 获取场所地点
     areaQueryById(id) {
         return request.get(
             '/religioussites/siteinfo/religiousSitesInfo/queryById', { id: id })

+ 28 - 18
src/views/activityMan/differentbelievers/ReligiousPeopleReportView.vue

@@ -40,16 +40,16 @@
         <van-field v-model="inputForm.nativePlace" center readonly label="籍贯:" placeholder="请选择籍贯" input-align="right"
           right-icon="arrow-down" @click="showArea = true" />
         <van-popup v-model:show="showArea" round position="bottom">
-          <van-cascader v-model="cascaderValue" title="请选择籍贯" :options="options" @close="showArea = false"
-            @finish="onFinish2" />
+          <van-picker title="籍贯选择" :columns="options" :columns-field-names="customFieldName" @cancel="showArea = false"
+            @confirm="onFinish2" />
         </van-popup>
       </van-cell-group>
       <van-cell-group>
         <van-field v-model="inputForm.currentResidence" center readonly label="现居地:" placeholder="请选择现居地"
           input-align="right" right-icon="arrow-down" @click="showCurrentArea = true" />
         <van-popup v-model:show="showCurrentArea" round position="bottom">
-          <van-cascader v-model="cascaderValue" title="请选择现居地" :options="options" @close="showCurrentArea = false"
-            @finish="onFinish" />
+          <van-picker title="现居地选择" :columns="options" :columns-field-names="customFieldName"
+            @cancel="showCurrentArea = false" @confirm="onFinish" />
         </van-popup>
       </van-cell-group>
       <van-cell-group>
@@ -127,6 +127,10 @@ export default {
     // 根据路由初始化
     let route = useRoute();
     onMounted(() => {
+      //籍贯接口
+      new tools().nativePlace().then((res) => {
+        options.value.push(...res);
+      });
       if (route.query.id) {
         new ReligiousPeopleReportService()
           .queryById(route.query.id)
@@ -161,24 +165,30 @@ export default {
     });
     // 现居地选择
     const showCurrentArea = ref(false);
-    const cascaderValue = ref("");
+    const customFieldName = {
+      text: "name",
+      value: "id",
+    };
     // 选项列表,children 代表子选项,支持多级嵌套
-    const options = useCascaderAreaData();
+    const options = ref([]);
     // 全部选项选择完毕后,会触发 finish 事件
     const onFinish = ({ selectedOptions }) => {
       showCurrentArea.value = false;
       console.log(selectedOptions);
-      inputForm.value.currentResidence = '中国/' + selectedOptions
-        .map((option) => option.text)
+      inputForm.value.currentResidence = selectedOptions
+        .map((option) => option.name)
         .join("/");
-      inputForm.value.currentResidenceId = '100000/' + selectedOptions
-        .map((option) => option.value)
+      inputForm.value.currentResidenceId = selectedOptions
+        .map((option) => option.id)
         .join("/");
-      inputForm.value.currentResidenceLevel1 = '100000'
-      inputForm.value.currentResidenceLevel2 = selectedOptions[0].value ? selectedOptions[0].value : ''
-      inputForm.value.currentResidenceLevel3 = selectedOptions[1].value ? selectedOptions[1].value : ''
-      inputForm.value.currentResidenceLevel4 = selectedOptions[2].value ? selectedOptions[2].value : ''
-    };
+
+      inputForm.value.currentResidenceLevel1 = selectedOptions[0] ? selectedOptions[0].id : ''
+      inputForm.value.currentResidenceLevel2 = selectedOptions[1] ? selectedOptions[1].id : ''
+      inputForm.value.currentResidenceLevel3 = selectedOptions[2] ? selectedOptions[2].id : ''
+      inputForm.value.currentResidenceLevel4 = selectedOptions[3] ? selectedOptions[3].id : ''
+      inputForm.value.currentResidenceLevel5 = selectedOptions[4] ? selectedOptions[4].id : ''
+      inputForm.value.currentResidenceLevel6 = selectedOptions[5] ? selectedOptions[5].id : ''
+    }
     const getLocation = () => {
       xm.getLocation().then(data => {
         inputForm.value.currentResidenceDetail = data.POIName;
@@ -189,8 +199,8 @@ export default {
     // 全部选项选择完毕后,会触发 finish 事件
     const onFinish2 = ({ selectedOptions }) => {
       showArea.value = false;
-      inputForm.value.nativePlace = '中国/' + selectedOptions
-        .map((option) => option.text)
+      inputForm.value.nativePlace = selectedOptions
+        .map((option) => option.name)
         .join("/");
     };
     const getType = ({ selectedOptions }) => {
@@ -266,7 +276,7 @@ export default {
       options,
       onFinish,
       onFinish2,
-      cascaderValue,
+      customFieldName,
       isLoading,
       getType,
       // 文件上传

+ 0 - 1
src/views/activityMan/personList.vue

@@ -97,7 +97,6 @@ export default {
       (newValue, oldValue) => {
         if (oldValue != newValue) {
           index = 0;
-
         }
       },
       { deep: true }