浏览代码

员工邮箱整改

cz 1 年之前
父节点
当前提交
7ec0cc572e

+ 24 - 16
src/views/connect/E-mail/businessConfig/index.vue

@@ -420,8 +420,9 @@ const formOption = reactive({
 });
 const byform = ref(null);
 const treeData = ref([]);
-const formConfig = ref({});
-const configData = [
+let formConfig = ref({});
+const userList = ref([]);
+const configData = computed(() => [
   [
     {
       type: "slot",
@@ -440,15 +441,7 @@ const configData = [
       type: "select",
       prop: "userId",
       label: "绑定用户",
-      isLoad: {
-        url: `/tenantUser/list?pageNum=1&pageSize=9999&tenantId=${
-          useUserStore().user.tenantId
-        }`,
-        labelKey: "nickName",
-        labelVal: "userId",
-        method: "get",
-        resUrl: "rows",
-      },
+      data: userList.value,
     },
   ],
   [
@@ -517,7 +510,7 @@ const configData = [
       itemWidth: 33.33,
     },
   ],
-];
+]);
 
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
@@ -553,10 +546,10 @@ const openModal = (type) => {
   submitType.value = type;
   if (type === "10") {
     titleText.value = "添加邮箱";
-    formConfig.value = configData[0];
+    formConfig.value = configData.value[0];
   } else if (type === "20") {
     titleText.value = "添加域名";
-    formConfig.value = configData[1];
+    formConfig.value = configData.value[1];
     formData.data = {
       type: "1",
       receiveProtocol: "IMAP",
@@ -608,21 +601,36 @@ const getDtl = (row, type) => {
   submitType.value = type;
   if (type === "10") {
     proxy.post("/enterpriseMailbox/detail", { id: row.id }).then((res) => {
-      formConfig.value = configData[0];
+      formConfig.value = configData.value[0];
       formData.data = res;
     });
   } else if (type === "20") {
     proxy.post("/enterpriseDomain/detail", { id: row.id }).then((res) => {
-      formConfig.value = configData[1];
+      formConfig.value = configData.value[1];
       res.type = res.type + "";
       formData.data = res;
     });
   }
   dialogVisible.value = true;
 };
+const getDict = () => {
+  proxy
+    .get(
+      `/tenantUser/list?pageNum=1&pageSize=9999&tenantId=${
+        useUserStore().user.tenantId
+      }`
+    )
+    .then((res) => {
+      userList.value = res.rows.map((x) => ({
+        label: x.nickName,
+        value: x.userId,
+      }));
+    });
+};
 
 getList();
 getListOne();
+getDict();
 </script>
   
 <style lang="scss" scoped>

+ 126 - 153
src/views/connect/E-mail/mail/com/left.vue

@@ -102,9 +102,9 @@
           <el-tree
             :data="staffMailData"
             node-key="id"
-            default-expand-all
             :expand-on-click-node="false"
-            @node-click="(data, node) => clickTreeMail(data, node)"
+            default-expand-all
+            @node-click="(data, node) => handleTreeNodeNewClick(data, node)"
           >
             <template #default="{ node, data }">
               <span class="tree-content">
@@ -113,7 +113,7 @@
                   v-if="data.id == '0'"
                   style="margin-right: 5px"
                 ></i>
-                <span>{{ data.mailUser }}</span>
+                <span>{{ data.name }}</span>
               </span>
             </template>
           </el-tree>
@@ -338,6 +338,7 @@ const mailMapData = {
 let selectFloderId = ref("");
 const mailList = ref([]);
 const staffMailData = ref([]);
+const userList = ref([]);
 const formOption = reactive({
   inline: true,
   labelWidth: 100,
@@ -510,68 +511,71 @@ const handleDelFolder = (data) => {
     });
   });
 };
+const handleMapMailListData = (arr) => {
+  for (let i = 0; i < arr.length; i++) {
+    const iele = arr[i];
+    iele.mailFolderInfoListCopy = [];
+    iele.otherFolder = [];
+    for (let j = 0; j < iele.mailFolderInfoList.length; j++) {
+      const jele = iele.mailFolderInfoList[j];
+      if (mailMapData["inbox"].includes(jele.name)) {
+        iele.mailFolderInfoListCopy.push({
+          ...jele,
+          name: "收件箱",
+          sort: 1,
+        });
+      } else if (mailMapData["unread"].includes(jele.name)) {
+        iele.mailFolderInfoListCopy.push({
+          ...jele,
+          name: "未读邮件",
+          sort: 2,
+        });
+      } else if (mailMapData["draft"].includes(jele.name)) {
+        iele.mailFolderInfoListCopy.push({
+          ...jele,
+          name: "草稿箱",
+          sort: 3,
+        });
+      } else if (mailMapData["sent"].includes(jele.name)) {
+        iele.mailFolderInfoListCopy.push({
+          ...jele,
+          name: "已发送",
+          sort: 4,
+        });
+      } else if (mailMapData["delete"].includes(jele.name)) {
+        iele.mailFolderInfoListCopy.push({
+          ...jele,
+          name: "已删除",
+          sort: 5,
+        });
+      } else if (mailMapData["waste"].includes(jele.name)) {
+        iele.mailFolderInfoListCopy.push({
+          ...jele,
+          name: "垃圾邮件",
+          sort: 6,
+        });
+      } else {
+        iele.otherFolder.push(jele);
+      }
+    }
+    if (iele.otherFolder.length > 0) {
+      iele.otherFolder = [
+        {
+          name: "官方文件夹",
+          id: "0",
+          children: iele.otherFolder,
+        },
+      ];
+    }
+    iele.mailFolderInfoListCopy.sort((a, b) => a.sort - b.sort);
+  }
+  return arr;
+};
 
 const getMialList = () => {
   proxy.get("/mailService/getUserEmailList").then((res) => {
-    for (let i = 0; i < res.data.length; i++) {
-      const iele = res.data[i];
-      iele.mailFolderInfoListCopy = [];
-      iele.otherFolder = [];
-      for (let j = 0; j < iele.mailFolderInfoList.length; j++) {
-        const jele = iele.mailFolderInfoList[j];
-        if (mailMapData["inbox"].includes(jele.name)) {
-          iele.mailFolderInfoListCopy.push({
-            ...jele,
-            name: "收件箱",
-            sort: 1,
-          });
-        } else if (mailMapData["unread"].includes(jele.name)) {
-          iele.mailFolderInfoListCopy.push({
-            ...jele,
-            name: "未读邮件",
-            sort: 2,
-          });
-        } else if (mailMapData["draft"].includes(jele.name)) {
-          iele.mailFolderInfoListCopy.push({
-            ...jele,
-            name: "草稿箱",
-            sort: 3,
-          });
-        } else if (mailMapData["sent"].includes(jele.name)) {
-          iele.mailFolderInfoListCopy.push({
-            ...jele,
-            name: "已发送",
-            sort: 4,
-          });
-        } else if (mailMapData["delete"].includes(jele.name)) {
-          iele.mailFolderInfoListCopy.push({
-            ...jele,
-            name: "已删除",
-            sort: 5,
-          });
-        } else if (mailMapData["waste"].includes(jele.name)) {
-          iele.mailFolderInfoListCopy.push({
-            ...jele,
-            name: "垃圾邮件",
-            sort: 6,
-          });
-        } else {
-          iele.otherFolder.push(jele);
-        }
-      }
-      if (iele.otherFolder.length > 0) {
-        iele.otherFolder = [
-          {
-            name: "官方文件夹",
-            id: "0",
-            children: iele.otherFolder,
-          },
-        ];
-      }
-
-      iele.mailFolderInfoListCopy.sort((a, b) => a.sort - b.sort);
-    }
-    mailList.value = res.data;
+    const arr = handleMapMailListData(res.data);
+    mailList.value = arr;
     if (mailList.value.length) {
       // 默认赋值第一邮箱
       selectMail.value = mailList.value[0];
@@ -584,86 +588,22 @@ const getMialList = () => {
       }
     }
   });
-  proxy
-    .post("/mailInfo/getUserEmailList", { id: useUserStore().user.userId })
-    .then((res) => {
-      if (res && res.length > 0) {
-        res = res.map((x) => {
-          return {
-            ...x,
-            sort: 1,
-            children: x.mailFolderInfoList.map((y) => ({
-              ...y,
-              mailUser: y.name,
-            })),
-          };
-        });
-        for (let i = 0; i < res.length; i++) {
-          const iele = res[i];
-          iele.mailFolderInfoListCopy = [];
-          iele.otherFolder = [];
-          for (let j = 0; j < iele.mailFolderInfoList.length; j++) {
-            const jele = iele.mailFolderInfoList[j];
-            if (mailMapData["inbox"].includes(jele.name)) {
-              iele.mailFolderInfoListCopy.push({
-                ...jele,
-                name: "收件箱",
-                sort: 1,
-              });
-            } else if (mailMapData["unread"].includes(jele.name)) {
-              iele.mailFolderInfoListCopy.push({
-                ...jele,
-                name: "未读邮件",
-                sort: 2,
-              });
-            } else if (mailMapData["draft"].includes(jele.name)) {
-              iele.mailFolderInfoListCopy.push({
-                ...jele,
-                name: "草稿箱",
-                sort: 3,
-              });
-            } else if (mailMapData["sent"].includes(jele.name)) {
-              iele.mailFolderInfoListCopy.push({
-                ...jele,
-                name: "已发送",
-                sort: 4,
-              });
-            } else if (mailMapData["delete"].includes(jele.name)) {
-              iele.mailFolderInfoListCopy.push({
-                ...jele,
-                name: "已删除",
-                sort: 5,
-              });
-            } else if (mailMapData["waste"].includes(jele.name)) {
-              iele.mailFolderInfoListCopy.push({
-                ...jele,
-                name: "垃圾邮件",
-                sort: 6,
-              });
-            } else {
-              iele.otherFolder.push(jele);
-            }
-          }
-          if (iele.otherFolder.length > 0) {
-            iele.otherFolder = [
-              {
-                name: "官方文件夹",
-                id: "0",
-                children: iele.otherFolder,
-              },
-            ];
-          }
-          iele.mailFolderInfoListCopy.sort((a, b) => a.sort - b.sort);
-        }
-        staffMailData.value = [
-          {
-            mailUser: "员工邮箱",
-            id: "0",
-            children: res,
-          },
-        ];
-      }
-    });
+
+  proxy.post("/mailInfo/getUserList").then((res) => {
+    if (res && res.length > 0) {
+      res = res.map((x) => ({
+        ...x,
+        name: x.nickName + "(点击获取员工邮箱)",
+      }));
+    }
+    staffMailData.value = [
+      {
+        name: "员工邮箱",
+        id: "0",
+        children: res,
+      },
+    ];
+  });
 };
 
 const handleClickMail = (item, flag = true) => {
@@ -740,18 +680,51 @@ const handleTreeNodeClick = (data, type) => {
 };
 
 const clickTreeMail = (data, node) => {
-  if (data.id !== "0" && data.sort !== 1) {
-    let mailData = node.parent.data;
-    if (mailStore.selectMail.id === mailData.id) {
-      const menuData = {
-        id: data.id,
-        name: data.name,
-      };
-      handleOpenMenu(menuData, "10");
-    } else {
-      handleClickMail(mailData, false);
-      handleOpenMenu(data, "10");
+  let mailData = node.parent.data;
+  if (mailStore.selectMail.id === mailData.id) {
+    const menuData = {
+      id: data.id,
+      name: data.name,
+    };
+    handleOpenMenu(menuData, "10");
+  } else {
+    handleClickMail(mailData, false);
+    handleOpenMenu(data, "10");
+  }
+};
+
+const handleTreeNodeNewClick = (data, node) => {
+  if (data.id == "0") {
+    return;
+  } else if (data.userId) {
+    const index = staffMailData.value[0].children.findIndex(
+      (x) => x.userId === data.userId
+    );
+    if (index >= 0) {
+      if (
+        staffMailData.value[0].children[index].children &&
+        staffMailData.value[0].children[index].children.length > 0
+      ) {
+        return;
+      } else {
+        proxy
+          .post("/mailInfo/getUserEmailList", { id: data.userId })
+          .then((res) => {
+            let arr = handleMapMailListData(res);
+            arr = arr.map((x) => ({
+              ...x,
+              name: x.mailUser,
+              children: x.mailFolderInfoList.map((x) => ({
+                ...x,
+                isFolder: true,
+              })),
+            }));
+            staffMailData.value[0].children[index].children = arr;
+          });
+      }
     }
+  } else if (data.isFolder) {
+    clickTreeMail(data, node);
   }
 };
 

+ 109 - 39
src/views/salesMange/saleContract/claim/index.vue

@@ -8,34 +8,76 @@
       highlight-current-row
       :selectConfig="selectConfig"
       :action-list="[]"
-      @get-list="getList">
-      <template #money="{ item }"> {{ item.currency }} {{ moneyFormat(item.amount) }} </template>
+      @get-list="getList"
+    >
+      <template #money="{ item }">
+        {{ item.currency }} {{ moneyFormat(item.amount) }}
+      </template>
       <template #isClaim="{ item }">
         <div style="width: 100%">
           <span v-if="item.isClaim == 0">未认领</span>
-          <a style="color: #409eff; cursor: pointer" @click="clickRecord(item)" v-else-if="item.isClaim == 1">已认领</a>
-          <a style="color: #409eff; cursor: pointer" @click="clickRecord(item)" v-else>部分认领</a>
+          <a
+            style="color: #409eff; cursor: pointer"
+            @click="clickRecord(item)"
+            v-else-if="item.isClaim == 1"
+            >已认领</a
+          >
+          <a
+            style="color: #409eff; cursor: pointer"
+            @click="clickRecord(item)"
+            v-else
+            >部分认领</a
+          >
         </div>
       </template>
     </byTable>
 
-    <el-dialog title="认领" v-if="dialogVisible" v-model="dialogVisible" width="500" v-loading="loading">
-      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
+    <el-dialog
+      title="认领"
+      v-if="dialogVisible"
+      v-model="dialogVisible"
+      width="500"
+      v-loading="loading"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="byform"
+      >
         <template #detail>
           <div style="width: 100%">
-            <el-button type="primary" style="margin-bottom: 10px" @click="dialogVisibleOne = true">选择合同</el-button>
+            <el-button
+              type="primary"
+              style="margin-bottom: 10px"
+              @click="dialogVisibleOne = true"
+              >选择合同</el-button
+            >
             <el-table :data="formData.data.claimContractList">
               <el-table-column prop="contractCode" label="合同编码" />
               <el-table-column prop="money" label="关联金额" min-width="150">
                 <template #default="{ row, $index }">
-                  <el-form-item :prop="'claimContractList.' + $index + '.money'" :rules="rules.money" :inline-message="true">
-                    <el-input-number v-model="row.money" :precision="4" :controls="false" :min="0" onmousewheel="return false;" />
+                  <el-form-item
+                    :prop="'claimContractList.' + $index + '.money'"
+                    :rules="rules.money"
+                    :inline-message="true"
+                  >
+                    <el-input-number
+                      v-model="row.money"
+                      :precision="4"
+                      :controls="false"
+                      :min="0"
+                      onmousewheel="return false;"
+                    />
                   </el-form-item>
                 </template>
               </el-table-column>
               <el-table-column prop="zip" label="操作" width="100">
                 <template #default="{ $index }">
-                  <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
+                  <el-button type="primary" link @click="handleRemove($index)"
+                    >删除</el-button
+                  >
                 </template>
               </el-table-column>
             </el-table>
@@ -52,7 +94,8 @@
               :on-preview="handlePreview"
               :on-remove="handleRemove"
               :on-success="handleSuccess"
-              :before-upload="handleBeforeUpload">
+              :before-upload="handleBeforeUpload"
+            >
               <el-button type="primary">选择</el-button>
             </el-upload>
             <div>
@@ -64,7 +107,8 @@
                   v-for="(item, index) in fileListCopy"
                   :key="index"
                   closable
-                  @close="handleClose(index)">
+                  @close="handleClose(index)"
+                >
                   {{ item.fileName }}
                 </el-tag>
               </div>
@@ -74,18 +118,46 @@
       </byForm>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
-        <el-button type="primary" @click="submitForm('byform')" size="large" :loading="submitLoading"> 确 定 </el-button>
+        <el-button
+          type="primary"
+          @click="submitForm('byform')"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
       </template>
     </el-dialog>
 
-    <el-dialog title="合同选择" v-if="dialogVisibleOne" v-model="dialogVisibleOne" width="80%" v-loading="loading" destroy-on-close>
-      <ContractSelect @handleSelectContrct="handleSelectContrct"></ContractSelect>
+    <el-dialog
+      title="合同选择"
+      v-if="dialogVisibleOne"
+      v-model="dialogVisibleOne"
+      width="80%"
+      v-loading="loading"
+      destroy-on-close
+    >
+      <ContractSelect
+        @handleSelectContrct="handleSelectContrct"
+      ></ContractSelect>
     </el-dialog>
 
-    <el-dialog title="认领记录" v-if="openRecord" v-model="openRecord" width="500">
-      <byForm :formConfig="formRecordConfig" :formOption="formOption" v-model="rowData.data">
+    <el-dialog
+      title="认领记录"
+      v-if="openRecord"
+      v-model="openRecord"
+      width="500"
+    >
+      <byForm
+        :formConfig="formRecordConfig"
+        :formOption="formOption"
+        v-model="rowData.data"
+      >
         <template #recordList>
-          <div style="width: 100%" v-if="rowData.data.recordList && rowData.data.recordList.length > 0">
+          <div
+            style="width: 100%"
+            v-if="rowData.data.recordList && rowData.data.recordList.length > 0"
+          >
             <div v-for="(item, index) in rowData.data.recordList" :key="index">
               <div style="color: #ccc">{{ item.createTime }}</div>
               <div>认领人: {{ item.claimUserName }}</div>
@@ -200,15 +272,6 @@ const config = computed(() => {
         prop: "remarks",
       },
     },
-    // {
-    //   attrs: {
-    //     label: "认领状态",
-    //     prop: "isClaim",
-    //   },
-    //   render(type) {
-    //     return proxy.dictValueLabel(type, claim.value);
-    //   },
-    // },
     {
       attrs: {
         label: "认领状态",
@@ -219,12 +282,12 @@ const config = computed(() => {
     {
       attrs: {
         label: "操作",
-        width: "100",
+        width: "140",
         align: "right",
       },
       renderHTML(row) {
         return [
-          row.isClaim == 0
+          row.isClaim != 1
             ? {
                 attrs: {
                   label: "认领",
@@ -238,7 +301,9 @@ const config = computed(() => {
                   getDtl(row);
                 },
               }
-            : {
+            : {},
+          row.isClaim != 0
+            ? {
                 attrs: {
                   label: "取消认领",
                   text: true,
@@ -270,7 +335,8 @@ const config = computed(() => {
                       });
                   });
                 },
-              },
+              }
+            : {},
         ];
       },
     },
@@ -353,13 +419,15 @@ const formConfig = reactive([
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
-  proxy.post("/accountRunningWater/page", sourceList.value.pagination).then((message) => {
-    sourceList.value.data = message.rows;
-    sourceList.value.pagination.total = message.total;
-    setTimeout(() => {
-      loading.value = false;
-    }, 200);
-  });
+  proxy
+    .post("/accountRunningWater/page", sourceList.value.pagination)
+    .then((message) => {
+      sourceList.value.data = message.rows;
+      sourceList.value.pagination.total = message.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
 };
 const submitForm = () => {
   byform.value.handleSubmit((valid) => {
@@ -473,7 +541,9 @@ const handleRemove = (index) => {
   });
 };
 const handleSelectContrct = (row) => {
-  const flag = formData.data.claimContractList.some((x) => x.contractId === row.id);
+  const flag = formData.data.claimContractList.some(
+    (x) => x.contractId === row.id
+  );
   if (flag)
     return ElMessage({
       message: "该合同已选择",