Explorar el Código

人员档案添加页面修改

guoqing hace 1 año
padre
commit
508f94ea65
Se han modificado 1 ficheros con 95 adiciones y 62 borrados
  1. 95 62
      src/views/placeManage/placePerson/placePersonAdd.vue

+ 95 - 62
src/views/placeManage/placePerson/placePersonAdd.vue

@@ -307,7 +307,7 @@
           v-model:show="hs_persontype"
           title="人员类型"
           show-cancel-button
-          @confirm = "changperson"
+          @confirm="changperson"
         >
           <div class="dialog">
             <van-list>
@@ -423,27 +423,30 @@
             input-align="right"
           />
         </van-cell-group>
-        
         <van-cell-group v-else-if="item.dataType && item.dataDictionary != ''">
-          vhsjhf{{item.value}}
           <van-field
-            v-model="teachPosition"
+            v-model="item.value"
             center
             :label="item.chineseName"
             placeholder="请选择"
             input-align="right"
             right-icon="arrow-down"
-            @click="hs_select = true"
+            @click="hs_select[index + '_select'] = true"
           />
-          <van-popup v-model:show="hs_select" round position="bottom" >
+          <van-popup
+            v-model:show="hs_select[index + '_select']"
+            round
+            position="bottom"
+          >
             <van-picker
+              :title="item.chineseName"
               :columns="$dictUtils.getDictList(item.dataDictionary)"
               :columns-field-names="{
                 text: 'label',
                 value: 'value',
               }"
-              @cancel="hs_select = false"
-              @confirm="getselect"
+              @cancel="hs_select[index + '_select'] = false"
+              @confirm="getselect(index + '_select', $event)"
             />
           </van-popup>
         </van-cell-group>
@@ -513,15 +516,19 @@
             placeholder="请选择日期时间"
             input-align="right"
             right-icon="arrow-down"
-            @click="hs_Date = true"
+            @click="hs_Date[index + '_Date'] = true"
           />
-          <van-popup v-model:show="hs_Date" round position="bottom">
+          <van-popup
+            v-model:show="hs_Date[index + '_Date']"
+            round
+            position="bottom"
+          >
             <van-date-picker
               title="选择日期"
               :min-date="minDate"
               :max-date="maxDate"
-              @cancel="hs_Date = false"
-              @confirm="getDate"
+              @cancel="hs_Date[index + '_Date'] = false"
+              @confirm="getDate(index + '_Date', $event)"
             />
           </van-popup>
         </van-cell-group>
@@ -535,7 +542,7 @@
 </template>
 
 <script>
-import { onBeforeUpdate, onMounted, ref } from "vue";
+import { onBeforeUpdate, onMounted, ref, getCurrentInstance } from "vue";
 import placePerson from "@/api/placePerson/placePerson";
 import PlaceRegister from "@/api/placeRegister/placeRegister";
 import { useRouter } from "vue-router";
@@ -750,7 +757,7 @@ export default {
       religiousName2.value = selectedOptions[0].text;
     };
     // 所属场所
-    const locationName = ref('');
+    const locationName = ref("");
     const checked = ref("");
     const sitelist = ref([]);
     let hs_site = ref(false);
@@ -847,19 +854,17 @@ export default {
     let fileImg = ref([]);
     let workpic = ref("");
     const afterRead1 = (file) => {
-      new tools()
-        .uploadFile(file, `logo`)
-        .then(({ data }) => {
-          data.name = decodeURIComponent(
-            data.url.substring(data.url.lastIndexOf("/") + 1)
-          );
-          workpic.value += "" + data.url;
-          const json = Object.assign(inputForm.value, {
-            workPicture: workpic.value,
-          });
-          inputForm.value = json;
-          fileImg.value.push(data);
+      new tools().uploadFile(file, `logo`).then(({ data }) => {
+        data.name = decodeURIComponent(
+          data.url.substring(data.url.lastIndexOf("/") + 1)
+        );
+        workpic.value += "" + data.url;
+        const json = Object.assign(inputForm.value, {
+          workPicture: workpic.value,
         });
+        inputForm.value = json;
+        fileImg.value.push(data);
+      });
     };
     const fjdelete = (file) => {
       //删除文件操作
@@ -972,36 +977,38 @@ export default {
     const toggle = (index) => {
       checkboxRefs.value[index].toggle();
       personnalType.value = getValue(checked2.value).join();
-      showZW.value = checked2.value.join();;
+      showZW.value = checked2.value.join();
     };
-    const changperson = ()=>{
+    const changperson = () => {
       const json = Object.assign(
         { ...inputForm.value },
         { personnelType: showZW.value }
       );
       inputForm.value = json;
       changePersonnelType();
-    }
+    };
     const changePersonnelType = () => {
       let userManagenmetDetailsDTOList = [];
-      new placePerson().userDTOqueryId(inputForm.value.personnelType.toString()).then((data) => {
-        data.forEach((item) => {
-          let userManagenmetDetail = {};
-          userManagenmetDetail = Object.assign(userManagenmetDetail, {
-            id: "",
-            chineseName: item.chineseName,
-            englishName: item.englishName,
-            dataType: item.dataType,
-            value: "",
-            orderNum: item.orderNum,
-            dataDictionary: item.dataDictionary,
-            dataDictionaryId: item.dataDictionaryId,
+      new placePerson()
+        .userDTOqueryId(inputForm.value.personnelType.toString())
+        .then((data) => {
+          data.forEach((item) => {
+            let userManagenmetDetail = {};
+            userManagenmetDetail = Object.assign(userManagenmetDetail, {
+              id: "",
+              chineseName: item.chineseName,
+              englishName: item.englishName,
+              dataType: item.dataType,
+              value: "",
+              orderNum: item.orderNum,
+              dataDictionary: item.dataDictionary,
+              dataDictionaryId: item.dataDictionaryId,
+            });
+            userManagenmetDetailsDTOList.push(userManagenmetDetail);
           });
-          userManagenmetDetailsDTOList.push(userManagenmetDetail);
+          inputForm.value.userManagenmetDetailsDTOList =
+            userManagenmetDetailsDTOList;
         });
-        inputForm.value.userManagenmetDetailsDTOList = userManagenmetDetailsDTOList
-        console.log(inputForm.value.userManagenmetDetailsDTOList,'================================>inputForm.value.userManagenmetDetailsDTOList');
-      });
     };
     onBeforeUpdate(() => {
       checkboxRefs.value = [];
@@ -1053,18 +1060,19 @@ export default {
       activitytext.value = selectedOptions[0].text;
     };
     // 扩展信息选择
-    const teachPosition = ref("");
-    let hs_select = ref(false);
-    const getselect = ({selectedOptions,selectedIndexes}) => {
-      hs_select.value = false;
-      teachPosition.value = selectedOptions[0].value;
+    let hs_select = ref({});
+    const getselect = (index, { selectedOptions }) => {
+      hs_select.value[index] = false;
+      let inputIndex = index.split("_")[0];
+      inputForm.value.userManagenmetDetailsDTOList[inputIndex].value =
+        selectedOptions[0].label;
     };
     // 扩展信息的时间
-    const issueDate = ref("");
-    let hs_Date = ref(false);
-    const getDate = ({ selectedOptions }) => {
-      hs_Date.value = false;
-      issueDate.value =
+    let hs_Date = ref({});
+    const getDate = (index, { selectedOptions }) => {
+      hs_Date.value[index] = false;
+      let inputIndex = index.split("_")[0];
+      inputForm.value.userManagenmetDetailsDTOList[inputIndex].value =
         selectedOptions[0].text +
         "-" +
         selectedOptions[1].text +
@@ -1073,11 +1081,38 @@ export default {
     };
     //跳转
     let router = useRouter();
-    const handleAvatarSuccess1 = (row, res, file, filelist) => {
-      row.value = res.url;
-    };
     //数据提交
     const submit = () => {
+      inputForm.value.userManagenmetDetailsDTOList.forEach((item) => {
+        if (item.chineseName === "教职身份") {
+          const teachType = {
+            "阿訇":1,
+            "牧师":2,
+            "长老":3,
+            "传道员":4,
+            "神学生":5,
+            "道士(正一)":6,
+            "比丘":7,
+            "教师(副牧师)":8,
+            "比丘尼":9,
+          };
+          item.value = teachType[item.value];
+        }
+        if (item.chineseName === "宗教教育程度") {
+          const Type = {
+            "小学":1,
+            "初中":2,
+            "中专":3,
+            "高中":4,
+            "大专":5,
+            "本科":6,
+            "硕士研究生":7,
+            "博士研究生":8,
+            "其他":9,
+          };
+          item.value = Type[item.value];
+        }
+      });
       new placePerson().save(inputForm.value).then((res) => {
         console.log(res);
         if (res.status == 200) {
@@ -1173,13 +1208,11 @@ export default {
       hs_activity,
       getactivity,
       activitytext,
-      //教职身份
-      teachPosition,
+      //扩展信息选择
       hs_select,
       getselect,
-      //证书颁发时间
+      //扩展信息时间
       hs_Date,
-      issueDate,
       getDate,
       //图片上传
       fileList,