Browse Source

跟进记录

wsx 10 tháng trước cách đây
mục cha
commit
3ea29affcc

+ 15 - 19
src/views/saleManage/businessOpportunity/components/addFollowDialog.vue

@@ -9,8 +9,8 @@
       :close-on-click-modal="false"
       :append-to-body="true"
       :maxable="true"
-    :resizable="true"
-      width="60%"
+      :resizable="true"
+      width="50%"
     >
       <el-form
         label-width="100px"
@@ -24,7 +24,7 @@
             v-model="form.linkId"
             multiple
             placeholder="请选择"
-            style="width: 300px"
+            style="width: 100%"
             @change="onchangeLink"
           >
             <el-option
@@ -42,7 +42,7 @@
             value-format="yyyy-MM-dd HH:mm:ss"
             placeholder="结束时间"
             type="datetime"
-            style="width: 200px"
+            style="width: 100%"
             class="filter-item"
           ></el-date-picker>
         </el-form-item>
@@ -82,15 +82,15 @@
             :showLib="false"
             :limit="5"
           />  -->
-          <fileMain v-model="form.files" ></fileMain>
-
-          </el-form-item
-        >
+          <fileMain v-model="form.files"></fileMain>
+        </el-form-item>
       </el-form>
 
       <div slot="footer" class="dialog-footer">
         <el-button size="small" @click="handleClose">关 闭</el-button>
-        <el-button size="small" @click="sumbit" type="primary" v-click-once>确 认</el-button>
+        <el-button size="small" @click="sumbit" type="primary" v-click-once
+          >确 认</el-button
+        >
       </div>
     </ele-modal>
   </div>
@@ -102,14 +102,13 @@
   // import fileMain from '@/components/upload/fileUpload';
 
   import {
-
     UpdateInformation,
     addInformation,
     getcontactlink
   } from '@/api/saleManage/businessFollow';
   export default {
     mixins: [dictMixins],
-    components:{
+    components: {
       // fileUpload
     },
     data() {
@@ -123,8 +122,7 @@
         nextPlan: '',
         opportunityId: '',
         stageCode: '',
-        files: [],
-        
+        files: []
       };
 
       return {
@@ -146,7 +144,7 @@
           stageCode: [
             { required: true, message: '请选择跟进阶段', trigger: 'change' }
           ],
-          
+
           linkName: [
             {
               required: true,
@@ -175,11 +173,9 @@
           this.isUpdate = false;
         } else {
           this.isUpdate = true;
-          this.row.linkId = this.row.linkId&&this.row.linkId.split(',') || [];
-          this.form = this.row
-
-
-
+          this.row.linkId =
+            (this.row.linkId && this.row.linkId.split(',')) || [];
+          this.form = this.row;
         }
       },
 

+ 73 - 10
src/views/saleManage/contact/components/darwerComponents/addFollowDialog.vue

@@ -8,7 +8,7 @@
       :visible.sync="dialogVisible"
       :close-on-click-modal="false"
       :append-to-body="true"
-      width="60%"
+      width="50%"
     >
       <el-form
         label-width="100px"
@@ -22,8 +22,8 @@
             v-model="form.linkId"
             multiple
             placeholder="请选择"
-            style="width: 300px"
             @change="onchangeLink"
+            style="width: 100%"
           >
             <el-option
               v-for="item in linkNameOptions"
@@ -40,7 +40,7 @@
             value-format="yyyy-MM-dd HH:mm:ss"
             placeholder="结束时间"
             type="datetime"
-            style="width: 200px"
+            style="width: 100%"
             class="filter-item"
           ></el-date-picker>
         </el-form-item>
@@ -88,10 +88,16 @@
 <script>
   import dictMixins from '@/mixins/dictMixins';
   import { copyObj } from '@/utils/util';
+  import { deepClone } from '@/utils/index';
+  import {
+    addInformation,
+    UpdateInformation
+  } from '@/api/saleManage/businessFollow';
 
   // import fileMain from '@/components/addDoc/index';
 
   export default {
+    inject: ['contactId'],
     mixins: [dictMixins],
     components: {
       // fileMain
@@ -108,7 +114,8 @@
         opportunityId: '',
         stageCode: '',
         files: [],
-        stageName: ''
+        stageName: '',
+        partaName: ''
       };
 
       return {
@@ -158,13 +165,23 @@
         this.type = type;
         this.row = copyObj(row);
         this.dialogVisible = true;
-        if (type != 'add') {
+
+        if (type == 'add') {
+          this.isUpdate = false;
+        } else {
+          this.isUpdate = true;
+          this.row.linkId =
+            (this.row.linkId && this.row.linkId.split(',')) || [];
           this.form = this.row;
-          if (row.linkId) {
-            this.$set(this.form, 'linkId', row.linkId.split(','));
-          }
-      
         }
+
+        // if (type != 'add') {
+        //   if (row.linkId) {
+        //     this.$set(this.form, 'linkId', row.linkId.split(','));
+        //   }
+        // }
+
+        console.log(this.form);
       },
 
       //表单验证
@@ -193,14 +210,60 @@
         this.form.linkName = selectedLabels;
       },
 
-      //保存
       async sumbit() {
+        this.form.contactId = this.contactId();
+        try {
+          await this.getValidate();
+          if (!this.isUpdate) {
+            delete this.form.id;
+          }
+          this.form.stageName = this.getDictValue(
+            '商机阶段',
+            this.form.stageCode
+          );
+          let params = deepClone(this.form);
+          params = Object.assign({}, params, {
+            linkId: params?.linkId?.join(',') || ''
+          });
+
+          if (this.isUpdate) {
+            UpdateInformation(params)
+              .then((res) => {
+                this.loading = false;
+                this.$message.success('修改成功');
+                this.cancel();
+                this.$emit('done');
+              })
+              .catch((e) => {
+                //this.loading = false;
+              });
+          } else {
+            addInformation(params)
+              .then((res) => {
+                this.loading = false;
+                this.$message.success('新增成功');
+                this.cancel();
+                this.$emit('done');
+              })
+              .catch((e) => {
+                //this.loading = false;
+              });
+          }
+        } catch (error) {
+          console.log(error);
+        }
+      },
+
+      //保存--以前的
+      async sumbit1() {
         try {
           await this.getValidate();
           this.form.stageName = this.getDictValue(
             '商机阶段',
             this.form.stageCode
           );
+          console.log(this.form, '--suc');
+          this.form.return;
           this.$emit('done', {
             data: JSON.parse(JSON.stringify(this.form)),
             type: this.type,

+ 141 - 0
src/views/saleManage/contact/components/darwerComponents/followDetailDialog.vue

@@ -0,0 +1,141 @@
+<template>
+  <ele-modal
+    custom-class="ele-dialog-form"
+    v-if="visible"
+    :visible.sync="visible"
+    :title="title"
+    :close-on-click-modal="false"
+    :append-to-body="true"
+    width="70%"
+    @close="cancel"
+    :maxable="true"
+    :resizable="true"
+  >
+      <el-form
+          label-width="160px"
+          ref="formRef"
+          :model="form"
+          style="margin-top: 30px"
+        >
+          <el-row>
+            <el-col :span="8">
+              <el-form-item
+                label="跟进内容:"
+                prop="content"
+              >
+                {{form.content}}
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="达成共识:" prop="agreement">
+                {{form.agreement}}
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="下一步计划:" prop="nextPlan">
+                {{form.nextPlan}}
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="创建时间:" prop="createTime">
+                {{form.createTime}}
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="跟进时间:" prop="followupTime">
+                {{form.followupTime}}
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="客户联系人名称:" prop="linkName">
+                {{ form.linkName}}
+              </el-form-item>
+            </el-col>
+          
+           
+          </el-row>
+        </el-form>
+
+    <div slot="footer" class="footer">
+      <el-button @click="cancel">返回</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+import {contactDetail} from '@/api/saleManage/contact';
+import {getFile} from '@/api/system/file';
+import {getInfoById as getCategoryInfo} from '@/api/classifyManage/index';
+import fileUpload from '@/components/upload/fileUpload';
+import dictMixins from '@/mixins/dictMixins';
+import deptSelect from '@/components/CommomSelect/dept-select.vue';
+import personSelect from '@/components/CommomSelect/person-select.vue';
+import {copyObj} from '@/utils/util';
+
+
+export default {
+    props: {
+      categoryTreeList: Array
+    },
+    mixins: [dictMixins],
+    components: {
+      fileUpload,
+      deptSelect,
+      personSelect
+    },
+    data() {
+      let formDef = {
+        id:'',
+          contactName: '',
+          contactId: 0,
+          name: '',
+          remark: '',
+          responsibleName: '',
+          responsibleId: '',
+          source: '',
+          status: 1
+        };
+    
+      return {
+        visible: false,
+        title: '详情',
+        row: {},
+        activeName: 'base',
+        formDef,
+        form: copyObj(formDef),
+        tableBankData: [],
+        tableLinkData: [],
+        ifChiefList: [
+          {
+            value: 0,
+            label: '否'
+          },
+          {
+            value: 1,
+            label: '是'
+          }
+        ],
+      };
+    },
+    methods: {
+      async open(row) {
+        this.form = row;
+        this.visible = true;
+      },
+
+      cancel() {
+        this.$nextTick(() => {
+          // 关闭后,销毁所有的表单数据
+          this.form = copyObj(this.formDef),
+          this.otherForm = copyObj(this.otherFormDef),
+          this.tableBankData = []
+          this.tableLinkData = []
+          this.visible = false;
+        })
+      },
+
+   
+
+    }
+  };
+</script>

+ 46 - 41
src/views/saleManage/contact/components/darwerComponents/followList.vue

@@ -11,14 +11,10 @@
       <!-- 表头工具栏 -->
       <template v-slot:toolbar>
         <el-button type="primary" @click="openEdit('add', {})">添加</el-button>
-        <el-button type="primary" @click="save">确认修改</el-button>
+        <!-- <el-button type="primary" @click="save">确认修改</el-button> -->
       </template>
       <template v-slot:content="{ row }">
-        <el-link
-          type="primary"
-          :underline="false"
-          @click="openEdit('view', row)"
-        >
+        <el-link type="primary" :underline="false" @click="openDetail(row)">
           {{ row.content }}</el-link
         >
       </template>
@@ -48,23 +44,22 @@
       </template>
     </ele-pro-table>
     <AddFollowDialog ref="addFollowDialogRef" @done="done"></AddFollowDialog>
+    <followDetailDialog ref="contactDetailDialogRef"></followDetailDialog>
   </el-card>
 </template>
 
 <script>
-  import {
-    getTableList,
-    deleteInformation
-  } from '@/api/saleManage/businessFollow';
+  import { deleteInformation } from '@/api/saleManage/businessFollow';
 
   import AddFollowDialog from './addFollowDialog.vue';
   import { contactUpdate } from '@/api/saleManage/contact';
-
   import { contactDetail } from '@/api/saleManage/contact';
+  import followDetailDialog from './followDetailDialog.vue';
 
   export default {
     components: {
-      AddFollowDialog
+      AddFollowDialog,
+      followDetailDialog
     },
 
     data() {
@@ -149,7 +144,6 @@
         ]
       };
     },
-
     methods: {
       openEdit(type, row, index) {
         this.$refs.addFollowDialogRef.open(
@@ -161,45 +155,56 @@
         this.$refs.addFollowDialogRef.$refs.form &&
           this.$refs.addFollowDialogRef.$refs.form.clearValidate();
       },
-
+      openDetail(row) {
+        this.$refs.contactDetailDialogRef.open(row);
+      },
       async init(row) {
         this.form = row;
         this.list = row.base.opportunityFollowupList;
       },
       handleBankDel(row, index) {
-        console.log(row);
-        
-        // deleteInformation([row])
+        deleteInformation([row.id]).then((res) => {
+          this.$message.success('删除成功!');
+          this.getList();
+        });
 
         // this.list.splice(index, 1);
         // this.save();
       },
-      done({ data, type, index }) {
-        data.linkId = data.linkId.toString();
-        if (type == 'add') {
-          this.list.unshift(data);
-        } else {
-          this.$set(this.list, index, data);
-        }
+
+      getList() {
+        contactDetail(this.form.base.id).then((res) => {
+          this.list = res.base.opportunityFollowupList;
+        });
       },
-      save() {
-        console.log(this.form);
-
-        this.form.base.opportunityFollowupList = this.list;
-        contactUpdate(this.form)
-          .then((res) => {
-            this.$message.success('修改成功');
-
-            contactDetail(this.form.base.id).then((res) => {
-              this.list = res.base.opportunityFollowupList;
-            });
-
-            this.$emit('success');
-          })
-          .catch((e) => {
-            //this.loading = false;
-          });
+      done() {
+        this.getList();
       }
+
+      // done({ data, type, index }) {
+      //   data.linkId = data.linkId.toString();
+      //   if (type == 'add') {
+      //     this.list.unshift(data);
+      //   } else {
+      //     this.$set(this.list, index, data);
+      //   }
+      // },
+      // save() {
+      //   this.form.base.opportunityFollowupList = this.list;
+      //   contactUpdate(this.form)
+      //     .then((res) => {
+      //       this.$message.success('修改成功');
+
+      //       contactDetail(this.form.base.id).then((res) => {
+      //         this.list = res.base.opportunityFollowupList;
+      //       });
+
+      //       this.$emit('success');
+      //     })
+      //     .catch((e) => {
+      //       //this.loading = false;
+      //     });
+      // }
     }
   };
 </script>

+ 9 - 2
src/views/saleManage/contact/index.vue

@@ -138,7 +138,7 @@
                   修改
                 </el-link>
                 <el-link
-                  v-if=" row.status !=1"
+                  v-if="row.status != 1"
                   type="primary"
                   :underline="false"
                   icon="el-icon-check"
@@ -474,7 +474,13 @@
         showEdit: true,
         visible: false,
         codeVisible: false,
-        cacheKeyUrl: 'eos-6c810d8f-saleManage-contact'
+        cacheKeyUrl: 'eos-6c810d8f-saleManage-contact',
+        contactId: ''
+      };
+    },
+    provide() {
+      return {
+        contactId: () => this.contactId
       };
     },
     computed: {},
@@ -497,6 +503,7 @@
         });
       },
       async addFollowDialog(row) {
+        this.contactId = row.id;
         const data = await contactDetail(row.id);
         this.visible = true;
         this.$nextTick(() => {

+ 3 - 4
src/views/saleManage/followList/components/addFollowDialog.vue

@@ -9,6 +9,7 @@
       :close-on-click-modal="false"
       :append-to-body="true"
       width="50%"
+      top="10vh"
     >
       <el-form
         label-width="100px"
@@ -242,6 +243,7 @@
 
       //保存
       async sumbit() {
+        console.log(this.form);
         try {
           await this.getValidate();
           this.form.stageName = this.getDictValue(
@@ -307,16 +309,13 @@
           size: 10,
           contactId: obj.id
         });
-
         this.opportunityList = res.list;
-
         this.linkNameOptions = linkList;
-
         this.form = Object.assign({}, this.form, {
           contactId: base?.id,
           partaName: base?.name
         });
-
+        console.log(this.form);
         this.form.linkId = '';
       }
     }

+ 3 - 2
src/views/saleManage/followList/components/viewDialog.vue

@@ -3,7 +3,7 @@
     custom-class="ele-dialog-form long-dialog-form"
     :centered="true"
     :visible.sync="addOrEditDialogFlag"
-    :title="title"
+    :title="'跟进记录'"
     :append-to-body="false"
     :close-on-click-modal="false"
     width="70%"
@@ -250,6 +250,7 @@
       /* 刷新表格 */
       reload(where) {
         this.$refs.table.reload({ pageNum: 1, where: where });
+        this.$parent.reload();
       },
       //关闭弹窗
       cancel() {
@@ -265,9 +266,9 @@
           this.$refs.addFollowDialogRef.$refs.form.clearValidate();
       },
       remove(row) {
+        console.log(row); 
         deleteInformation([row.id]).then((res) => {
           this.$message.success('删除成功!');
-
           this.reload();
         });
       },