Kaynağa Gözat

修改依托单位个人中心

YY 2 yıl önce
ebeveyn
işleme
59978eab1c
1 değiştirilmiş dosya ile 8 ekleme ve 17 silme
  1. 8 17
      src/components/account/unit-1.vue

+ 8 - 17
src/components/account/unit-1.vue

@@ -262,13 +262,13 @@ const changeForm = (val: { name: string; phone: string; email: string; unit_name
 };
 // 研究方向添加
 const addDriection = () => {
-  let direction: any = form.value.direction;
+  let direction: any = uform.value.direction;
   if (direction.length >= 5) {
     ElMessage({ message: `研究方向最多添加五个`, type: 'error' });
   } else {
     direction.push({ id: moment().valueOf(), name: '' });
   }
-  form.value.direction = direction;
+  uform.value.direction = direction;
 };
 // 研究方向删除
 const delDriection = (e: { id: '' }) => {
@@ -281,7 +281,8 @@ const utoSave = async (data: any) => {
   if (data.status == '2') data.status = '0';
   if (data._id) res = await unitStudioApply.update(data);
   else {
-    res = await unitStudioApply.update(data);
+    delete data._id;
+    res = await unitStudioApply.create(data);
     // 入住科学工作室 修改unit表中的is_studio
     updateBasic();
   }
@@ -292,11 +293,11 @@ const utoSave = async (data: any) => {
 };
 // 修改基础信息
 const updateBasic = async () => {
-  let res: IQueryResult = await unit.update({ _id: user.value._id, is_studio: 'Y', account: user.value.account });
-  console.log(res);
+  let res: IQueryResult = await unit.update({ _id: user.value._id, is_studio: 'Y', account: user.value.account, unit_name: user.value.unit_name });
 };
 // 监听数据
-const dataChange = (model: string, value: Array<[]>) => {
+const dataChange = (e: { model: string; value: Array<[]> }) => {
+  const { model, value } = e;
   if (model == 'fields') {
     if (value.length > 2) {
       ElMessage({ message: `数据过多,请重新选择`, type: 'error' });
@@ -317,17 +318,7 @@ const uonChange = (e: { model: string; value: Array<[]> }) => {
 const toSave = async (data: any) => {
   let res: IQueryResult = await unit.update(data);
   if (res.errcode == 0) {
-    // ElMessage({ type: 'success', message: '维护信息成功' });
-    // 同步修改依托单位信息
-    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);
+    ElMessage({ type: 'success', message: '维护信息成功' });
     await search();
   } else ElMessage({ type: 'warning', message: `${res.errmsg}` });
 };