浏览代码

修改依托单位个人中心

zs 2 年之前
父节点
当前提交
4c1062e1fe
共有 1 个文件被更改,包括 15 次插入2 次删除
  1. 15 2
      src/components/account/unit-1.vue

+ 15 - 2
src/components/account/unit-1.vue

@@ -169,6 +169,7 @@ let user: Ref<{ _id: string; name: string; unit_name: string; account: string; u
 // 表单
 let form: Ref<{ is_studio: string; prove: Array<[]>; direction: Array<[]> }> = ref({ is_studio: '', prove: [], direction: [] });
 let uform: Ref<{
+  _id: string;
   card: Array<any>;
   unit_phone: { phone: string; is_show: string };
   unit_email: { email: string; is_show: string };
@@ -182,6 +183,7 @@ let uform: Ref<{
   unit_contact: string;
   address: string;
 }> = ref({
+  _id: '',
   card: [],
   unit_phone: { phone: '', is_show: '' },
   unit_email: { email: '', is_show: '' },
@@ -225,6 +227,7 @@ const search = async () => {
   if (res.errcode == 0) {
     if (res.total > 0) {
       uform.value = res.data[0] as {
+        _id: '';
         card: [];
         unit_phone: { phone: ''; is_show: '' };
         unit_email: { email: ''; is_show: '' };
@@ -311,11 +314,21 @@ const uonChange = (e: { model: string; value: Array<[]> }) => {
   uform.value[model] = value;
 };
 // 添加
-const toSave = async (data: object) => {
+const toSave = async (data: any) => {
   let res: IQueryResult = await unit.update(data);
   if (res.errcode == 0) {
     ElMessage({ type: 'success', message: '维护信息成功' });
-    search();
+    // 同步修改依托单位信息
+    let form = {
+      _id: uform.value._id,
+      unit_contact: data.name,
+      unit_phone: { phone: data.phone },
+      unit_email: { email: data.email },
+      company: data.unit_name,
+      address: data.unit_address,
+    };
+    await utoSave(form);
+    await search();
   } else ElMessage({ type: 'warning', message: `${res.errmsg}` });
 };
 // 查询其他信息