From 24b00a82a34eb11c6ec1bc1ce018a6e969e791d0 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 15 十二月 2023 17:32:11 +0800
Subject: [PATCH] 1. 新增自动评估记录的获取和展示; 2. 新增评估记录排序功能; 3. 新增评估任务界面;

---
 src/views/fytz/user/components/CompUserInfo.vue |  126 ++++++++++++++++++++++++------------------
 1 files changed, 72 insertions(+), 54 deletions(-)

diff --git a/src/views/fytz/user/components/CompUserInfo.vue b/src/views/fytz/user/components/CompUserInfo.vue
index e8be54c..1270998 100644
--- a/src/views/fytz/user/components/CompUserInfo.vue
+++ b/src/views/fytz/user/components/CompUserInfo.vue
@@ -33,9 +33,7 @@
         </el-col>
         <el-col :span="6" v-if="!create">
           <el-row justify="end">
-            <el-button type="danger" @click="onResetPw" :loading="pwLoading"
-              >閲嶇疆瀵嗙爜</el-button
-            >
+            <el-button type="danger" @click="onResetPw" :loading="pwLoading">閲嶇疆瀵嗙爜</el-button>
           </el-row>
         </el-col>
       </el-form-item>
@@ -54,20 +52,13 @@
       </el-form-item> -->
       <el-form-item label="鏄惁鍙敤" prop="isenable">
         <el-switch v-model="formObj.isenable" />
-        <span style="margin-left: 16px">{{
-          formObj.isenable ? '鍙敤' : '涓嶅彲鐢�'
-        }}</span>
+        <span style="margin-left: 16px">{{ formObj.isenable ? '鍙敤' : '涓嶅彲鐢�' }}</span>
       </el-form-item>
       <el-form-item label="宸ュ彿" prop="workno">
         <el-input clearable v-model="formObj.workno" placeholder="宸ュ彿" />
       </el-form-item>
       <el-form-item label="鎵嬫満" prop="telephone">
-        <el-input
-          clearable
-          type="tel"
-          v-model="formObj.telephone"
-          placeholder="鎵嬫満"
-        />
+        <el-input clearable type="tel" v-model="formObj.telephone" placeholder="鎵嬫満" />
       </el-form-item>
       <!-- <el-form-item label="鐪�/甯�/鍖�/闀�" prop="_locations">
         <el-cascader
@@ -94,6 +85,7 @@
 import { getSceneName } from '@/enum/scene';
 import { enumLocation } from '@/enum/location';
 import userApi from '@/api/fytz/userApi';
+import { useMessageBoxTip } from '@/composables/messageBox';
 
 const props = defineProps({
   //鍩烘湰淇℃伅
@@ -101,36 +93,37 @@
   isEdit: Boolean,
   create: {
     type: Boolean,
-    default: false,
+    default: false
   },
   active: {
     type: Boolean,
-    default: false,
-  },
+    default: false
+  }
 });
 
 const emit = defineEmits(['onSubmit', 'onCancel', 'update:isEdit']);
 
 const _formInfo = ref();
+const _formObject = { value: {} };
 const _edit = ref(false);
 const locations = enumLocation(false);
 const locationsProps = reactive({
-  checkStrictly: true,
+  checkStrictly: true
 });
 const rules = reactive({
   acountname: [
     {
       required: true,
       message: '璐︽埛鍚嶄笉鑳戒负绌�',
-      trigger: 'blur',
-    },
+      trigger: 'blur'
+    }
   ],
   realname: [
     {
       required: true,
       message: '鐢ㄦ埛鏄电О涓嶈兘涓虹┖',
-      trigger: 'blur',
-    },
+      trigger: 'blur'
+    }
   ],
   // password: [
   //   {
@@ -143,30 +136,30 @@
     {
       required: true,
       message: '鐢ㄦ埛绫诲瀷涓嶈兘涓虹┖',
-      trigger: 'change',
-    },
+      trigger: 'change'
+    }
   ],
   _locations: [
     {
       required: props.create,
       message: '鐪�/甯�/鍖�/闀囦笉鑳戒负绌�',
-      trigger: 'change',
-    },
+      trigger: 'change'
+    }
   ],
   _scenetype: [
     {
       required: true,
       message: '鍦烘櫙绫诲瀷涓嶈兘涓虹┖',
-      trigger: 'change',
-    },
-  ],
+      trigger: 'change'
+    }
+  ]
 });
 
 // 鐢ㄦ埛鍩烘湰淇℃伅鏍煎紡鍖�
 function parseUserInfo(s) {
   s._usertype = {
     label: s.usertype,
-    value: s.usertypeid + '',
+    value: s.usertypeid + ''
   };
 
   s._scenetype = getSceneName(s.extension2, 1);
@@ -176,6 +169,19 @@
   return s;
 }
 
+function parseUserInfoReverse(formObj) {
+  // 鐢ㄦ埛绫诲瀷淇℃伅濉厖
+  const b = formObj.value._usertype;
+  formObj.value.usertypeid = b.value;
+  formObj.value.usertype = b.label;
+
+  // 鍦烘櫙绫诲瀷淇℃伅濉厖
+  const c = formObj.value._scenetype;
+  formObj.value.extension2 = c.value;
+
+  return formObj;
+}
+
 function createUser(formObj, func) {
   return userApi
     .createUser(formObj.value)
@@ -183,6 +189,7 @@
       emit('onSubmit', formObj);
     })
     .finally(() => {
+      _formObject.value = formObj.value;
       func();
     });
 }
@@ -194,38 +201,32 @@
       emit('onSubmit', formObj);
     })
     .finally(() => {
-      func();
+      _formObject.value = formObj.value;
+      if (func) func();
     });
 }
 
 function submit(formObj, func) {
   // 琛屾斂鍖哄垝淇℃伅濉厖
-  const a = formObj.value._locations;
-  if (a[0]) {
-    formObj.value.provincecode = a[0][0];
-    formObj.value.provincename = a[0][1];
-  }
-  if (a[1]) {
-    formObj.value.citycode = a[1][0];
-    formObj.value.cityname = a[1][1];
-  }
-  if (a[2]) {
-    formObj.value.districtcode = a[2][0];
-    formObj.value.extension1 = a[2][1];
-  }
-  if (a[3]) {
-    formObj.value.towncode = a[3][0];
-    formObj.value.townname = a[3][1];
-  }
+  // const a = formObj.value._locations;
+  // if (a[0]) {
+  //   formObj.value.provincecode = a[0][0];
+  //   formObj.value.provincename = a[0][1];
+  // }
+  // if (a[1]) {
+  //   formObj.value.citycode = a[1][0];
+  //   formObj.value.cityname = a[1][1];
+  // }
+  // if (a[2]) {
+  //   formObj.value.districtcode = a[2][0];
+  //   formObj.value.extension1 = a[2][1];
+  // }
+  // if (a[3]) {
+  //   formObj.value.towncode = a[3][0];
+  //   formObj.value.townname = a[3][1];
+  // }
 
-  // 鐢ㄦ埛绫诲瀷淇℃伅濉厖
-  const b = formObj.value._usertype;
-  formObj.value.usertypeid = b.value;
-  formObj.value.usertype = b.label;
-
-  // 鍦烘櫙绫诲瀷淇℃伅濉厖
-  const c = formObj.value._scenetype;
-  formObj.value.extension2 = c.value;
+  parseUserInfoReverse(formObj);
 
   return props.create ? createUser(formObj, func) : updateUser(formObj, func);
 }
@@ -238,6 +239,7 @@
   () => props.formInfo,
   (nValue) => {
     _formInfo.value = parseUserInfo(nValue);
+    _formObject.value = _formInfo.value;
   }
 );
 
@@ -245,5 +247,21 @@
   emit('update:isEdit', nValue);
 });
 
+
+// 閲嶇疆瀵嗙爜
+
 const pwLoading = ref(false);
+
+function onResetPw() {
+  useMessageBoxTip({
+    confirmMsg: '鏄惁閲嶇疆璇ュ満鏅瘑鐮侊紵',
+    confirmTitle: '閲嶇疆瀵嗙爜',
+    onConfirm: async () => {
+      pwLoading.value = true
+      _formObject.value.password = '123456';
+      await updateUser(_formObject);
+      pwLoading.value = false
+    }
+  });
+}
 </script>

--
Gitblit v1.9.3