Forráskód Böngészése

人员档案人员详情修改完成

guoqing 2 éve
szülő
commit
8a69dacef0
1 módosított fájl, 179 hozzáadás és 43 törlés
  1. 179 43
      src/views/placeManage/placePerson/placePersoninfo.vue

+ 179 - 43
src/views/placeManage/placePerson/placePersoninfo.vue

@@ -327,6 +327,7 @@
             v-model:show="hs_persontype"
             title="人员类型"
             show-cancel-button
+            @confirm="changperson"
           >
             <div class="dialog">
               <van-list>
@@ -451,21 +452,26 @@
             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>
-        <van-cell-group v-if="item.dataType === '2'">
+        <van-cell-group v-else-if="item.dataType === '2'">
           <van-field
             v-model="item.value"
             center
@@ -473,7 +479,7 @@
             input-align="right"
           />
         </van-cell-group>
-        <van-cell-group v-if="item.dataType === '3'">
+        <van-cell-group v-else-if="item.dataType === '3'">
           <van-field
             :v-model="item.value"
             center
@@ -481,7 +487,7 @@
             input-align="right"
           />
         </van-cell-group>
-        <van-cell-group v-if="item.dataType === '4'">
+        <van-cell-group v-else-if="item.dataType === '4'">
           <van-field
             name="uploader"
             label-align="top"
@@ -500,7 +506,7 @@
             </template>
           </van-field>
         </van-cell-group>
-        <van-cell-group v-if="item.dataType === '5'">
+        <van-cell-group v-else-if="item.dataType === '5'">
           <van-field
             v-model="item.value"
             center
@@ -531,19 +537,26 @@
             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>
       </van-col>
+      <div class="subbtn">
+        <van-button type="primary" @click="submit">确认修改</van-button>
+      </div>
     </div>
   </div>
 </template>
@@ -556,7 +569,7 @@ import placePerson from "@/api/placePerson/placePerson";
 import PlaceRegister from "@/api/placeRegister/placeRegister";
 import UserManage from "@/api/user/UserManage";
 import tools from "@/api/sys/tools";
-import placeRegister from '@/api/placeRegister/placeRegister';
+import placeRegister from "@/api/placeRegister/placeRegister";
 export default {
   setup() {
     const data = ref({});
@@ -583,25 +596,57 @@ export default {
             "hs_personnel_education",
             data.value.nationalEducationLevel
           );
-        religiousName.value = current.appContext.config.globalProperties.$dictUtils.getDictLabel(
+        religiousName.value =
+          current.appContext.config.globalProperties.$dictUtils.getDictLabel(
             "hs_religion_type",
             data.value.religion
           );
-        let location = data.value.location
+        let location = data.value.location;
         locationName.value = location.name;
-        typeOfEmployeesName.value = current.appContext.config.globalProperties.$dictUtils.getDictLabel(
+        typeOfEmployeesName.value =
+          current.appContext.config.globalProperties.$dictUtils.getDictLabel(
             "hs_type_of_employees",
             data.value.typeOfEmployees
           );
-          let arr = data.value.personnelType.split(',')
-          personnalType.value = getValue1(arr).join(',')
-        let tissid = data.value.zjzz.id
-        if(tissid!=''){
-          new placePerson().queryId({id:tissid}).then((res)=>{
-          tissueName.value = res.organizationName
-        })
+        let arr = data.value.personnelType.split(",");
+        personnalType.value = getValue1(arr).join(",");
+        let tissid = data.value.zjzz.id;
+        if (tissid != "") {
+          new placePerson().queryId({ id: tissid }).then((res) => {
+            tissueName.value = res.organizationName;
+          });
         }
         activitytext.value = getActivity(data.value.bkcheck);
+        data.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().nativePlace().then((res) => {
@@ -665,7 +710,7 @@ export default {
         4: "其他",
       };
       return type[item];
-    }
+    };
     // 性别
     const sexName = ref("");
     const sex = [
@@ -747,7 +792,9 @@ export default {
       let id = "";
       id = val.id;
       locationName.value = val.name;
-      const json = Object.assign(data.value, { location: { id: id,name:val.name} });
+      const json = Object.assign(data.value, {
+        location: { id: id, name: val.name },
+      });
       data.value = json;
       checked.value = val.id;
     };
@@ -930,12 +977,39 @@ export default {
     let hs_persontype = ref(false);
     const toggle = (index) => {
       checkboxRefs.value[index].toggle();
-      let str = "";
-      str = checked2.value.join();
-      const json = Object.assign({ ...data.value }, { personnelType: str });
+      personnalType.value = getValue(checked2.value).join();
+      showZW.value = checked2.value.join();
+    };
+    const changperson = () => {
+      const json = Object.assign(
+        { ...data.value },
+        { personnelType: showZW.value }
+      );
       data.value = json;
-      personnalType.value = getValue1(checked2.value).join(',');
-      showZW.value = str;
+      changePersonnelType();
+    };
+    const changePersonnelType = () => {
+      let userManagenmetDetailsDTOList = [];
+      new placePerson()
+        .userDTOqueryId(data.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);
+          });
+          data.value.userManagenmetDetailsDTOList =
+            userManagenmetDetailsDTOList;
+        });
     };
     onBeforeUpdate(() => {
       checkboxRefs.value = [];
@@ -972,18 +1046,19 @@ export default {
       return Array;
     };
     // 扩展信息选择
-    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];
+      data.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];
+      data.value.userManagenmetDetailsDTOList[inputIndex].value =
         selectedOptions[0].text +
         "-" +
         selectedOptions[1].text +
@@ -1016,6 +1091,54 @@ export default {
     const onClickLeft = () => {
       history.back();
     };
+    //数据提交
+    const submit = () => {
+      data.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(data.value).then((res) => {
+        if (res.status == 200) {
+          xm.showToast({
+            message: "人员添加成功",
+          });
+          router.push({
+            path: "/placePerson",
+          });
+        } else {
+          xm.showToast({
+            message: "人员添加失败",
+          });
+          console.log(res);
+        }
+      });
+    };
     return {
       onClickLeft,
       data,
@@ -1086,6 +1209,7 @@ export default {
       toggle,
       checkboxRefs,
       showZW,
+      changperson,
       // 是否参加非法活动
       activity,
       hs_activity,
@@ -1098,14 +1222,13 @@ export default {
       getPlace1,
       options,
       getLocation,
-      //扩展信息选择器
-      teachPosition,
+      //扩展信息选择
       hs_select,
       getselect,
       //扩展信息时间
       hs_Date,
-      issueDate,
       getDate,
+      submit,
     };
   },
 };
@@ -1117,4 +1240,17 @@ export default {
   height: 400px;
   overflow: auto;
 }
+.subbtn {
+  margin: 20px;
+  text-align: center;
+}
+.subbtn .van-button {
+  width: 100%;
+  margin: 5px;
+}
+.van-uploader .van-button {
+  border: none;
+  color: #36a7f3;
+  top: -4px;
+}
 </style>