cz 2 жил өмнө
parent
commit
d4a8229176

+ 103 - 95
src/views/connect/E-mail/businessConfig/index.vue

@@ -64,24 +64,18 @@
         </template>
 
         <template #rSlot>
-          <el-row style="width: 100%">
-            <el-col :span="8">
+          <el-row style="width: 100%" :gutter="15">
+            <el-col :span="10">
               <el-select
-                v-model="formData.data.countryId"
+                v-model="formData.data.receiveProtocol"
                 placeholder="收件协议"
                 disabled
               >
-                <el-option
-                  v-for="item in countryData"
-                  :label="item.chineseName"
-                  :value="item.id"
-                >
-                </el-option>
               </el-select>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="10">
               <el-input
-                v-model="formData.data.contactPerson"
+                v-model="formData.data.receivePort"
                 placeholder="请输入"
               >
               </el-input>
@@ -89,26 +83,17 @@
           </el-row>
         </template>
         <template #sSlot>
-          <el-row style="width: 100%">
-            <el-col :span="8">
+          <el-row style="width: 100%" :gutter="15">
+            <el-col :span="10">
               <el-select
-                v-model="formData.data.countryId"
+                v-model="formData.data.sendProtocol"
                 placeholder="发件协议"
                 disabled
               >
-                <el-option
-                  v-for="item in countryData"
-                  :label="item.chineseName"
-                  :value="item.id"
-                >
-                </el-option>
               </el-select>
             </el-col>
-            <el-col :span="8">
-              <el-input
-                v-model="formData.data.contactPerson"
-                placeholder="请输入"
-              >
+            <el-col :span="10">
+              <el-input v-model="formData.data.sendPort" placeholder="请输入">
               </el-input>
             </el-col>
           </el-row>
@@ -149,6 +134,17 @@
         >
         </byTable>
       </div>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm('byform')"
+          size="large"
+          :loading="submitLoading"
+        >
+          确 定
+        </el-button>
+      </template>
     </el-dialog>
   </div>
 </template>
@@ -174,7 +170,6 @@ const sourceListOne = ref({
 });
 let dialogVisible = ref(false);
 let dialogVisibleOne = ref(false);
-let roomDialogVisible = ref(false);
 let modalType = ref("add");
 let submitType = ref("");
 let titleText = ref("");
@@ -200,46 +195,43 @@ const config = computed(() => {
     {
       attrs: {
         label: "邮箱地址",
-        prop: "type",
-      },
-      render(type) {
-        return "华为";
+        prop: "domainName",
       },
     },
     {
       attrs: {
         label: "授权码",
-        prop: "name",
+        prop: "mailPassword",
       },
     },
     {
       attrs: {
         label: "绑定用户",
-        prop: "endPoint",
+        prop: "userId",
       },
     },
     {
       attrs: {
         label: "收件协议",
-        prop: "accessKeyId",
+        prop: "receiveProtocol",
       },
     },
     {
       attrs: {
         label: "收件端口号",
-        prop: "secretAccessKey",
+        prop: "receivePort",
       },
     },
     {
       attrs: {
         label: "发件协议",
-        prop: "productId",
+        prop: "sendProtocol",
       },
     },
     {
       attrs: {
         label: "发件端口号",
-        prop: "fa",
+        prop: "sendPort",
       },
     },
 
@@ -260,7 +252,7 @@ const config = computed(() => {
             },
             el: "button",
             click() {
-              getDtl(row);
+              getDtl(row, "10");
             },
           },
           {
@@ -283,7 +275,7 @@ const config = computed(() => {
               ).then(() => {
                 // 删除
                 proxy
-                  .post("/supplierInfo/delete", {
+                  .post("/enterpriseMailbox/delete", {
                     id: row.id,
                   })
                   .then((res) => {
@@ -305,49 +297,48 @@ const configOne = computed(() => {
   return [
     {
       attrs: {
-        label: "邮箱域名",
-        prop: "type",
-      },
-      render(type) {
-        return "华为";
+        label: "邮箱地址",
+        prop: "mailUser",
       },
     },
     {
       attrs: {
         label: "海外邮箱",
-        prop: "name",
+        prop: "type",
+      },
+      render(type) {
+        return type == 2 ? "是" : "否";
       },
     },
     {
       attrs: {
         label: "收件协议",
-        prop: "endPoint",
+        prop: "receiveProtocol",
       },
     },
-
     {
       attrs: {
         label: "收件端口号",
-        prop: "secretAccessKey",
+        prop: "receivePort",
       },
     },
     {
       attrs: {
         label: "发件协议",
-        prop: "productId",
+        prop: "sendProtocol",
       },
     },
     {
       attrs: {
         label: "发件端口号",
-        prop: "fa",
+        prop: "sendPort",
       },
     },
 
     {
       attrs: {
         label: "操作",
-        width: "150",
+        width: "200",
         align: "right",
       },
       // 渲染 el-button,一般用在最后一列。
@@ -361,7 +352,7 @@ const configOne = computed(() => {
             },
             el: "button",
             click() {
-              getDtl(row);
+              getDtl(row, "20");
             },
           },
           {
@@ -384,7 +375,7 @@ const configOne = computed(() => {
               ).then(() => {
                 // 删除
                 proxy
-                  .post("/supplierInfo/delete", {
+                  .post("/enterpriseDomain/delete", {
                     id: row.id,
                   })
                   .then((res) => {
@@ -403,16 +394,12 @@ const configOne = computed(() => {
   ];
 });
 let formData = reactive({
-  data: {
-    type: "1",
-  },
-  treeData: [],
+  data: {},
 });
 const formOption = reactive({
   inline: true,
   labelWidth: 100,
   itemWidth: 100,
-  rules: [],
 });
 const byform = ref(null);
 const treeData = ref([]);
@@ -440,7 +427,7 @@ const configData = [
   [
     {
       type: "input",
-      prop: "type",
+      prop: "mailUser",
       label: "邮箱域名",
       required: true,
     },
@@ -451,31 +438,36 @@ const configData = [
       required: true,
       border: true,
       data: [
-        { label: "是", value: "1" },
-        { label: "否", value: "2" },
+        { label: "是", value: "2" },
+        { label: "否", value: "1" },
       ],
     },
+
     {
       type: "input",
-      prop: "type",
+      prop: "receiveHost",
       label: "收件服务器地址",
       required: true,
     },
     {
       type: "slot",
       slotName: "rSlot",
+      prop: "receivePort",
       label: "收件协议",
+      required: true,
     },
     {
       type: "input",
-      prop: "type",
+      prop: "sendHost",
       label: "发件服务器地址",
       required: true,
     },
     {
       type: "slot",
       slotName: "sSlot",
+      prop: "sendPort",
       label: "发件协议",
+      required: true,
     },
   ],
 ];
@@ -483,14 +475,28 @@ const configData = [
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
-  proxy.post("/tdaConfig/page", sourceList.value.pagination).then((message) => {
-    console.log(message);
-    sourceList.value.data = message.rows;
-    sourceList.value.pagination.total = message.total;
-    setTimeout(() => {
-      loading.value = false;
-    }, 200);
-  });
+  proxy
+    .post("/enterpriseMailbox/page", sourceList.value.pagination)
+    .then((message) => {
+      console.log(message);
+      sourceList.value.data = message.rows;
+      sourceList.value.pagination.total = message.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
+};
+
+const getListOne = async () => {
+  loading.value = true;
+  proxy
+    .post("/enterpriseDomain/page", sourceList.value.pagination)
+    .then((message) => {
+      sourceListOne.value.data = message.rows;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
 };
 
 const openModal = (type) => {
@@ -512,19 +518,13 @@ const openModalOne = () => {
   modalType.value = "add";
   formData.data = {};
 };
-const selection = ref({
-  data: [],
-});
-const select = (_selection, row) => {
-  selection.value.data = _selection;
-  console.log(_selection.length);
-};
+
 const submitForm = () => {
   console.log(byform.value);
   byform.value.handleSubmit((valid) => {
+    submitLoading.value = true;
     if (submitType.value === "10") {
-      submitLoading.value = true;
-      proxy.post("/tdaConfig/" + modalType.value, formData.data).then(
+      proxy.post("/enterpriseMailbox/" + modalType.value, formData.data).then(
         (res) => {
           ElMessage({
             message: modalType.value == "add" ? "添加成功" : "编辑成功",
@@ -537,31 +537,39 @@ const submitForm = () => {
         (err) => (submitLoading.value = false)
       );
     } else if (submitType.value === "20") {
+      proxy.post("/enterpriseDomain/" + modalType.value, formData.data).then(
+        (res) => {
+          ElMessage({
+            message: modalType.value == "add" ? "添加成功" : "编辑成功",
+            type: "success",
+          });
+          submitLoading.value = false;
+          getListOne();
+        },
+        (err) => (submitLoading.value = false)
+      );
     }
   });
 };
 
-const getDtl = (row) => {
+const getDtl = (row, type) => {
   modalType.value = "edit";
-  formData.data = {
-    supplierPriceList: [],
-  };
+  if (type === "10") {
+    proxy.post("/enterpriseMailbox/detail", { id: row.id }).then((res) => {
+      formData.data = res;
+      console.log(res);
+    });
+  } else if (type === "20") {
+    proxy.post("/enterpriseDomain/detail", { id: row.id }).then((res) => {
+      formData.data = res;
+      console.log(res);
+    });
+  }
   dialogVisible.value = true;
-  // proxy.post("/tdaConfig/detail", { id: row.id }).then((res) => {
-  //   formData.data = res;
-  //   console.log(formData);
-  //   dialogVisible.value = true;
-  // });
-};
-
-const addRow = () => {
-  formData.data.supplierPriceList.push({
-    price: "",
-    pricea: "",
-  });
 };
 
 getList();
+getListOne();
 </script>
   
 <style lang="scss" scoped>

+ 86 - 108
src/views/connect/E-mail/personalConfig/index.vue

@@ -40,24 +40,18 @@
         ref="byform"
       >
         <template #rSlot>
-          <el-row style="width: 100%">
-            <el-col :span="8">
+          <el-row style="width: 100%" :gutter="15">
+            <el-col :span="10">
               <el-select
-                v-model="formData.data.countryId"
+                v-model="formData.data.receiveProtocol"
                 placeholder="收件协议"
                 disabled
               >
-                <el-option
-                  v-for="item in countryData"
-                  :label="item.chineseName"
-                  :value="item.id"
-                >
-                </el-option>
               </el-select>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="10">
               <el-input
-                v-model="formData.data.contactPerson"
+                v-model="formData.data.receivePort"
                 placeholder="请输入"
               >
               </el-input>
@@ -65,26 +59,17 @@
           </el-row>
         </template>
         <template #sSlot>
-          <el-row style="width: 100%">
-            <el-col :span="8">
+          <el-row style="width: 100%" :gutter="15">
+            <el-col :span="10">
               <el-select
-                v-model="formData.data.countryId"
+                v-model="formData.data.sendProtocol"
                 placeholder="发件协议"
                 disabled
               >
-                <el-option
-                  v-for="item in countryData"
-                  :label="item.chineseName"
-                  :value="item.id"
-                >
-                </el-option>
               </el-select>
             </el-col>
-            <el-col :span="8">
-              <el-input
-                v-model="formData.data.contactPerson"
-                placeholder="请输入"
-              >
+            <el-col :span="10">
+              <el-input v-model="formData.data.sendPort" placeholder="请输入">
               </el-input>
             </el-col>
           </el-row>
@@ -111,6 +96,8 @@ import { ElMessage, ElMessageBox } from "element-plus";
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
 import { computed, defineComponent, ref } from "vue";
+import { validEmail } from "@/utils/validate.js";
+
 const loading = ref(false);
 const submitLoading = ref(false);
 const sourceList = ref({
@@ -122,23 +109,25 @@ const sourceList = ref({
   },
 });
 let dialogVisible = ref(false);
-let roomDialogVisible = ref(false);
 let modalType = ref("add");
 let rules = ref({
-  name: [{ required: true, message: "请输入平台名称", trigger: "blur" }],
-  endPoint: [{ required: true, message: "请输入EndPoint", trigger: "blur" }],
-  accessKey: [{ required: true, message: "请输入access_key", trigger: "blur" }],
-  accessCode: [
-    { required: true, message: "请输入access_code", trigger: "blur" },
+  mailUser: [{ required: true, message: "请输入邮箱地址", trigger: "blur" }],
+  type: [{ required: true, message: "请选择邮箱类型", trigger: "change" }],
+  mailPassword: [{ required: true, message: "请输入授权码", trigger: "blur" }],
+  receiveHost: [
+    { required: true, message: "请输入收件服务器地址", trigger: "blur" },
   ],
-
-  accessKeyId: [
-    { required: true, message: "请输入Access Key Id", trigger: "blur" },
+  receivePort: [{ required: true, message: "请输入收件端口", trigger: "blur" }],
+  receiveProtocol: [
+    { required: true, message: "请输入收件协议", trigger: "blur" },
+  ],
+  sendHost: [
+    { required: true, message: "请输入发件服务器地址", trigger: "blur" },
   ],
-  secretAccessKey: [
-    { required: true, message: "请输入Secret Access Key", trigger: "blur" },
+  sendPort: [{ required: true, message: "请输入发件端口", trigger: "blur" }],
+  sendProtocol: [
+    { required: true, message: "请输入发件协议", trigger: "blur" },
   ],
-  productId: [{ required: true, message: "请输入项目 ID", trigger: "blur" }],
 });
 const { proxy } = getCurrentInstance();
 const selectConfig = [];
@@ -147,48 +136,46 @@ const config = computed(() => {
     {
       attrs: {
         label: "邮箱地址",
-        prop: "type",
-        width: 100,
-      },
-      render(type) {
-        return "华为";
+        prop: "mailUser",
       },
     },
     {
       attrs: {
         label: "海外邮箱",
-        prop: "name",
-        width: 150,
+        prop: "type",
+      },
+      render(type) {
+        return type == 2 ? "是" : "否";
       },
     },
     {
       attrs: {
         label: "授权码",
-        prop: "endPoint",
+        prop: "mailPassword",
       },
     },
     {
       attrs: {
         label: "收件协议",
-        prop: "accessKeyId",
+        prop: "receiveProtocol",
       },
     },
     {
       attrs: {
         label: "收件端口号",
-        prop: "secretAccessKey",
+        prop: "receivePort",
       },
     },
     {
       attrs: {
         label: "发件协议",
-        prop: "productId",
+        prop: "sendProtocol",
       },
     },
     {
       attrs: {
         label: "发件端口号",
-        prop: "productId",
+        prop: "sendPort",
       },
     },
 
@@ -232,7 +219,7 @@ const config = computed(() => {
               ).then(() => {
                 // 删除
                 proxy
-                  .post("/supplierInfo/delete", {
+                  .post("/personalMailbox/delete", {
                     id: row.id,
                   })
                   .then((res) => {
@@ -252,10 +239,7 @@ const config = computed(() => {
 });
 
 let formData = reactive({
-  data: {
-    type: "1",
-  },
-  treeData: [],
+  data: {},
 });
 const formOption = reactive({
   inline: true,
@@ -264,12 +248,11 @@ const formOption = reactive({
   rules: [],
 });
 const byform = ref(null);
-const treeData = ref([]);
 const formConfig = computed(() => {
   return [
     {
       type: "input",
-      prop: "type",
+      prop: "mailUser",
       label: "邮箱地址",
       required: true,
     },
@@ -280,37 +263,39 @@ const formConfig = computed(() => {
       required: true,
       border: true,
       data: [
-        { label: "是", value: "1" },
-        { label: "否", value: "2" },
+        { label: "是", value: "2" },
+        { label: "否", value: "1" },
       ],
     },
     {
       type: "input",
-      prop: "type",
+      prop: "mailPassword",
       label: "授权码",
       required: true,
     },
     {
       type: "input",
-      prop: "type",
+      prop: "receiveHost",
       label: "收件服务器地址",
       required: true,
     },
     {
       type: "slot",
       slotName: "rSlot",
+      prop: "receivePort",
       label: "收件协议",
+      required: true,
     },
     {
       type: "input",
-      prop: "type",
+      prop: "sendHost",
       label: "发件服务器地址",
       required: true,
     },
     {
       type: "slot",
       slotName: "sSlot",
-      prop: "contactPerson",
+      prop: "sendPort",
       label: "发件协议",
       required: true,
     },
@@ -319,63 +304,56 @@ const formConfig = computed(() => {
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
-  proxy.post("/tdaConfig/page", sourceList.value.pagination).then((message) => {
-    console.log(message);
-    sourceList.value.data = message.rows;
-    sourceList.value.pagination.total = message.total;
-    setTimeout(() => {
-      loading.value = false;
-    }, 200);
-  });
+  proxy
+    .post("/personalMailbox/page", sourceList.value.pagination)
+    .then((message) => {
+      console.log(message);
+      sourceList.value.data = message.rows;
+      sourceList.value.pagination.total = message.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
 };
 const openModal = () => {
-  dialogVisible.value = true;
   modalType.value = "add";
-  formData.data = {};
-};
-const selection = ref({
-  data: [],
-});
-const select = (_selection, row) => {
-  selection.value.data = _selection;
-  console.log(_selection.length);
+  formData.data.type = "1";
+  formData.data.receiveProtocol = "IMAP";
+  formData.data.sendProtocol = "SMTP";
+  dialogVisible.value = true;
 };
+
 const submitForm = () => {
-  console.log(byform.value);
   byform.value.handleSubmit((valid) => {
-    submitLoading.value = true;
-    proxy.post("/tdaConfig/" + modalType.value, formData.data).then(
-      (res) => {
-        ElMessage({
-          message: modalType.value == "add" ? "添加成功" : "编辑成功",
-          type: "success",
-        });
-        dialogVisible.value = false;
-        submitLoading.value = false;
-        getList();
-      },
-      (err) => (submitLoading.value = false)
-    );
+    if (validEmail(formData.data.mailUser)) {
+      submitLoading.value = true;
+      proxy.post("/personalMailbox/" + modalType.value, formData.data).then(
+        (res) => {
+          ElMessage({
+            message: modalType.value == "add" ? "添加成功" : "编辑成功",
+            type: "success",
+          });
+          dialogVisible.value = false;
+          submitLoading.value = false;
+          getList();
+        },
+        (err) => (submitLoading.value = false)
+      );
+    } else {
+      ElMessage({
+        message: "邮箱格式不正确!",
+        type: "info",
+      });
+    }
   });
 };
 
 const getDtl = (row) => {
   modalType.value = "edit";
-  formData.data = {
-    supplierPriceList: [],
-  };
-  dialogVisible.value = true;
-  // proxy.post("/tdaConfig/detail", { id: row.id }).then((res) => {
-  //   formData.data = res;
-  //   console.log(formData);
-  //   dialogVisible.value = true;
-  // });
-};
-
-const addRow = () => {
-  formData.data.supplierPriceList.push({
-    price: "",
-    pricea: "",
+  proxy.post("/personalMailbox/detail", { id: row.id }).then((res) => {
+    res.type = res.type + "";
+    formData.data = res;
+    dialogVisible.value = true;
   });
 };
 

+ 228 - 98
src/views/oa/mailList/outside/index.vue

@@ -36,10 +36,26 @@
         :rules="rules"
         ref="byform"
       >
+        <template #enterpriseSlot>
+          <div style="width: 100%">
+            <el-select
+              filterable
+              allow-create
+              v-model="formData.data.enterpriseId"
+              :disabled="modalType !== 'add'"
+            >
+              <el-option
+                v-for="item in enterpriseData"
+                :label="item.enterpriseName"
+                :value="item.enterpriseId"
+              >
+              </el-option>
+            </el-select>
+          </div>
+        </template>
         <template #fileSlot>
           <div style="width: 100%">
             <el-button type="primary" @click="addRow"> 添加 </el-button>
-
             <el-form
               ref="tableForm"
               :model="formData.data"
@@ -48,28 +64,42 @@
               style="margin-top: 15px"
             >
               <el-table
-                :data="formData.data.supplierPriceList"
+                :data="formData.data.contactsList"
                 v-if="modalType == 'add'"
               >
-                <el-table-column prop="pricea" label="联系人" min-width="150">
+                <el-table-column
+                  prop="contactName"
+                  label="联系人"
+                  min-width="150"
+                >
                   <template #default="{ row, $index }">
                     <el-form-item
-                      :prop="'supplierPriceList.' + $index + '.pricea'"
-                      :rules="rules.pricea"
+                      :prop="'contactsList.' + $index + '.contactName'"
+                      :rules="rules.contactName"
                       :inline-message="true"
                     >
-                      <el-input v-model="row.pricea" placeholder="请输入" />
+                      <el-input
+                        v-model="row.contactName"
+                        placeholder="请输入"
+                      />
                     </el-form-item>
                   </template>
                 </el-table-column>
-                <el-table-column prop="price" label="手机号" min-width="150">
+                <el-table-column
+                  prop="phoneNumber"
+                  label="手机号"
+                  min-width="150"
+                >
                   <template #default="{ row, $index }">
                     <el-form-item
-                      :prop="'supplierPriceList.' + $index + '.price'"
-                      :rules="rules.price"
+                      :prop="'contactsList.' + $index + '.phoneNumber'"
+                      :rules="rules.phoneNumber"
                       :inline-message="true"
                     >
-                      <el-input v-model="row.price" placeholder="请输入" />
+                      <el-input
+                        v-model="row.phoneNumber"
+                        placeholder="请输入"
+                      />
                     </el-form-item>
                   </template>
                 </el-table-column>
@@ -84,28 +114,44 @@
               </el-table>
 
               <el-table
-                :data="formData.data.supplierPriceList"
+                :data="formData.data.externalAddressBookList"
                 v-if="modalType == 'edit'"
               >
-                <el-table-column prop="pricea" label="类型" min-width="150">
+                <el-table-column prop="type" label="类型" min-width="150">
                   <template #default="{ row, $index }">
                     <el-form-item
-                      :prop="'supplierPriceList.' + $index + '.pricea'"
-                      :rules="rules.pricea"
+                      :prop="'internalAddressBookList.' + $index + '.type'"
                       :inline-message="true"
                     >
-                      <el-input v-model="row.pricea" placeholder="请输入" />
+                      <!-- :rules="rules.type" -->
+                      <el-select v-model="row.type" placeholder="请选择">
+                        <el-option
+                          v-for="item in contactInformationType"
+                          :label="item.dictValue"
+                          :value="item.dictKey"
+                        >
+                        </el-option>
+                      </el-select>
                     </el-form-item>
                   </template>
                 </el-table-column>
-                <el-table-column prop="price" label="联系号码" min-width="150">
+                <el-table-column
+                  prop="contactNumber"
+                  label="联系号码"
+                  min-width="150"
+                >
                   <template #default="{ row, $index }">
                     <el-form-item
-                      :prop="'supplierPriceList.' + $index + '.price'"
-                      :rules="rules.price"
+                      :prop="
+                        'internalAddressBookList.' + $index + '.contactNumber'
+                      "
                       :inline-message="true"
                     >
-                      <el-input v-model="row.price" placeholder="请输入" />
+                      <!-- :rules="rules.contactNumber" -->
+                      <el-input
+                        v-model="row.contactNumber"
+                        placeholder="请输入"
+                      />
                     </el-form-item>
                   </template>
                 </el-table-column>
@@ -145,6 +191,7 @@ import byForm from "@/components/byForm/index";
 import FileUpload from "@/components/FileUpload/index";
 import { computed, defineComponent, ref } from "vue";
 import { getToken } from "@/utils/auth";
+import useUserStore from "@/store/modules/user";
 
 const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传文件服务器地址
 const headers = ref({ Authorization: "Bearer " + getToken() });
@@ -157,7 +204,6 @@ const sourceList = ref({
     total: 3,
     pageNum: 1,
     pageSize: 10,
-    type: "",
     keyword: "",
   },
 });
@@ -165,8 +211,15 @@ let dialogVisible = ref(false);
 let modalType = ref("add");
 let fileList = ref([]);
 let rules = ref({
-  pricea: [{ required: true, message: "请输入联系人", trigger: "blur" }],
-  price: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
+  enterpriseId: [
+    { required: true, message: "请选择/输入企业", trigger: ["change", "blur"] },
+  ],
+  contactName: [{ required: true, message: "请输入联系人", trigger: "blur" }],
+  phoneNumber: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
+  type: [{ required: true, message: "请选择联系类型", trigger: "change" }],
+  contactNumber: [
+    { required: true, message: "请输入联系号码", trigger: "blur" },
+  ],
 });
 const { proxy } = getCurrentInstance();
 const selectConfig = reactive([
@@ -194,14 +247,14 @@ const config = computed(() => {
     {
       attrs: {
         label: "来源",
-        prop: "type",
+        prop: "enterpriseType",
       },
-      render(type) {
-        return type === 1
+      render(enterpriseType) {
+        return enterpriseType === 1
           ? "客户"
-          : type === 2
+          : enterpriseType === 2
           ? "供应商"
-          : type === 3
+          : enterpriseType === 3
           ? "自定义"
           : "";
       },
@@ -209,37 +262,37 @@ const config = computed(() => {
     {
       attrs: {
         label: "关联企业",
-        prop: "code",
+        prop: "enterpriseName",
       },
     },
     {
       attrs: {
         label: "联系人",
-        prop: "name",
+        prop: "contactName",
       },
     },
     {
       attrs: {
         label: "手机号",
-        prop: "remarks",
+        prop: "phoneNumber",
       },
     },
     {
       attrs: {
         label: "电子邮箱",
-        prop: "contactPerson",
+        prop: "createTime",
       },
     },
     {
       attrs: {
         label: "座机",
-        prop: "contactNumber",
+        prop: "createTime",
       },
     },
     {
       attrs: {
         label: "WhatsApp",
-        prop: "remark",
+        prop: "createTime",
       },
     },
 
@@ -283,7 +336,7 @@ const config = computed(() => {
               ).then(() => {
                 // 删除
                 proxy
-                  .post("/supplierInfo/delete", {
+                  .post("/contacts/delete", {
                     id: row.id,
                   })
                   .then((res) => {
@@ -319,64 +372,113 @@ const formConfig = ref([]);
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
-  proxy
-    .post("/supplierInfo/page", sourceList.value.pagination)
-    .then((message) => {
-      console.log(message);
-      sourceList.value.data = message.rows;
-      sourceList.value.pagination.total = message.total;
-      setTimeout(() => {
-        loading.value = false;
-      }, 200);
-    });
+  proxy.post("/contacts/page", sourceList.value.pagination).then((message) => {
+    console.log(message);
+    sourceList.value.data = message.rows;
+    sourceList.value.pagination.total = message.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
 };
 const openModal = () => {
   dialogVisible.value = true;
   formConfig.value = configData[0];
   modalType.value = "add";
   formData.data = {
-    supplierPriceList: [],
+    contactsList: [],
   };
 };
 
 const submitForm = () => {
   byform.value.handleSubmit((valid) => {
-    // if (fileList.value.length > 0) {
-    //   formData.data.fileList = fileList.value;
-
-    // } else {
-    //   return ElMessage({
-    //     message: "请上传附件!",
-    //     type: "info",
-    //   });
-    // }
-
-    submitLoading.value = true;
-    proxy.post("/supplierInfo/" + modalType.value, formData.data).then(
-      (res) => {
-        ElMessage({
-          message: modalType.value == "add" ? "添加成功" : "编辑成功",
-          type: "success",
+    if (modalType.value === "add") {
+      if (formData.data.contactsList.length > 0) {
+        proxy.$refs.tableForm.validate((vaild) => {
+          if (vaild) {
+            const current = enterpriseData.value.find(
+              (x) => x.enterpriseId === formData.data.enterpriseId
+            );
+            if (current && current !== undefined) {
+              formData.data.enterpriseType = current.enterpriseType;
+            } else {
+              formData.data.enterpriseType = 3;
+              formData.data.enterpriseName = formData.data.enterpriseId;
+              formData.data.enterpriseId = "";
+            }
+            submitLoading.value = true;
+            proxy.post("/contacts/" + modalType.value, formData.data).then(
+              (res) => {
+                ElMessage({
+                  message: modalType.value == "add" ? "添加成功" : "编辑成功",
+                  type: "success",
+                });
+                dialogVisible.value = false;
+                submitLoading.value = false;
+                getList();
+              },
+              (err) => {
+                submitLoading.value = false;
+              }
+            );
+          }
+        });
+      } else {
+        return ElMessage({
+          message: "请添加联系人!",
+          type: "info",
         });
-        fileList.value = [];
-        dialogVisible.value = false;
-        submitLoading.value = false;
-        getList();
-      },
-      (err) => {
-        console.log(err, "aswwwww");
-        submitLoading.value = false;
       }
-    );
+    } else {
+      if (formData.data.externalAddressBookList.length > 0) {
+        console.log(formData.data, "aww");
+        proxy.$refs.tableForm.validate((vaild) => {
+          if (vaild) {
+            submitLoading.value = true;
+            proxy.post("/contacts/" + modalType.value, formData.data).then(
+              (res) => {
+                const submitData = {
+                  externalAddressBookList:
+                    formData.data.externalAddressBookList.map((x) => ({
+                      ...x,
+                      id: formData.data.id,
+                    })),
+                };
+                proxy
+                  .post("/contacts/" + modalType.value, submitData)
+                  .then((res) => {
+                    ElMessage({
+                      message: "编辑成功",
+                      type: "success",
+                    });
+                    dialogVisible.value = false;
+                    submitLoading.value = false;
+                    getList();
+                  });
+              },
+              (err) => {
+                submitLoading.value = false;
+              }
+            );
+          }
+        });
+      } else {
+        return ElMessage({
+          message: "请添加联系方式!",
+          type: "info",
+        });
+      }
+    }
   });
 };
+
 const configData = [
   [
     {
-      type: "input",
-      prop: "type",
+      type: "slot",
+      slotName: "enterpriseSlot",
+      prop: "enterpriseId",
       label: "关联企业",
-      required: true,
     },
     {
       type: "slot",
@@ -386,14 +488,13 @@ const configData = [
   ],
   [
     {
-      type: "input",
-      prop: "type",
+      type: "slot",
+      slotName: "enterpriseSlot",
+      prop: "enterpriseId",
       label: "关联企业",
-      required: true,
-      disabled: true,
     },
     {
-      prop: "name",
+      prop: "contactName",
       type: "input",
       label: "联系人",
     },
@@ -404,36 +505,65 @@ const configData = [
     },
   ],
 ];
+
+const enterpriseData = ref([]);
+
+const contactInformationType = ref([]);
+const getDict = () => {
+  const tenantId = useUserStore().user.tenantId;
+  proxy
+    .post("/dictTenantData/page", {
+      pageNum: 1,
+      pageSize: 999,
+      tenantId: "@福建宏星!#¥%……&*()",
+      dictCode: "contact_information",
+    })
+    .then((res) => {
+      contactInformationType.value = res.rows;
+    });
+
+  proxy.post("/contacts/list", { pageNum: 1, pageSize: 9999 }).then((res) => {
+    enterpriseData.value = res;
+  });
+};
+
 const getDtl = (row) => {
   modalType.value = "edit";
   formConfig.value = configData[1];
   dialogVisible.value = true;
-
-  // proxy.post("/supplierInfo/detail", { id: row.id }).then((res) => {
-  //   getCityData(res.countryId, "20");
-  //   getCityData(res.provinceId, "30");
-  //   // fileList.value = [
-  //   //   {
-  //   //     id: "",
-  //   //     fileName: res.fileName,
-  //   //     path: "",
-  //   //   },
-  //   // ];
-  //   res.type = res.type + "";
-  //   formData.data = res;
-  //   dialogVisible.value = true;
-  // });
+  proxy.post("/contacts/detail", { id: row.id }).then((res) => {
+    res.externalAddressBookList = [];
+    formData.data = res;
+    proxy.post("/externalAddressBook/detail", { id: row.id }).then((res) => {
+      console.log(res, "ass");
+    });
+  });
 };
 
-const handleRemove = (file) => {};
+const handleRemove = (index) => {
+  if (modalType.value === "add") {
+    formData.data.contactsList.splice(index, 1);
+  } else {
+    formData.data.externalAddressBookList.splice(index, 1);
+  }
+};
 
 getList();
+getDict();
 
 const addRow = () => {
-  formData.data.supplierPriceList.push({
-    price: "",
-    pricea: "",
-  });
+  if (modalType.value === "add") {
+    formData.data.contactsList.push({
+      contactName: "",
+      phoneNumber: "",
+    });
+  } else {
+    formData.data.externalAddressBookList.push({
+      id: "",
+      type: "",
+      contactNumber: "",
+    });
+  }
 };
 </script>
   

+ 14 - 1
src/views/process/processApproval/index.vue

@@ -139,7 +139,10 @@
 
 
 <script setup>
+//申购发起
 import SendSubscribe from "@/components/process/SendSubscribe";
+import { ElMessage, ElMessageBox } from "element-plus";
+
 const activeName = ref("first");
 const handleClick = (tab, event) => {
   console.log(tab, event);
@@ -169,7 +172,7 @@ const handleSubmit = async () => {
             remark: x.remark,
           }));
           proxy.post("/subscribe/add", data).then((res) => {
-            console.log(res, "wss");
+            skipPage();
           });
         }
       });
@@ -179,6 +182,16 @@ const handleSubmit = async () => {
   }
 };
 
+const skipPage = () => {
+  ElMessage({
+    message: "操作成功!",
+    type: "success",
+  });
+  proxy.$router.replace({
+    path: "/purchaseManage/purchaseManage/subscribe",
+  });
+};
+
 onMounted(() => {});
 </script>
 

+ 1 - 1
src/views/purchaseManage/purchaseManage/purchase/index.vue

@@ -338,7 +338,7 @@ const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
   proxy
-    .post("/productInfo/page", sourceList.value.pagination)
+    .post("/subscribeDetail/page", sourceList.value.pagination)
     .then((message) => {
       console.log(message);
       sourceList.value.data = message.rows;

+ 9 - 5
src/views/purchaseManage/purchaseManage/subscribe/index.vue

@@ -16,7 +16,7 @@
         :action-list="[
           {
             text: '发起申购',
-            action: () => openModal('add'),
+            action: () => openModal(),
           },
         ]"
         @get-list="getList"
@@ -197,6 +197,9 @@ const config = computed(() => {
         label: "货品类型",
         prop: "productType",
       },
+      render(productType) {
+        return productType == 1 ? "产品" : "物料";
+      },
     },
     {
       attrs: {
@@ -369,11 +372,12 @@ const getList = async (req) => {
       }, 200);
     });
 };
-// const openModal = () => {
-//  proxy.$router.push({
 
-//  })
-// };
+const openModal = () => {
+  proxy.$router.replace({
+    path: "/process/processApproval",
+  });
+};
 
 const submitForm = () => {
   if (fileList.value.length > 0) {