wsx 11 mesi fa
parent
commit
6a015c7c1f

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

@@ -8,7 +8,7 @@
       :visible.sync="dialogVisible"
       :close-on-click-modal="false"
       :append-to-body="true"
-      width="40%"
+      width="50%"
     >
       <el-form
         label-width="100px"
@@ -164,6 +164,9 @@
           contactId: [
             { required: true, message: '选择客户', trigger: 'change' }
           ],
+          linkId: [
+            { required: true, message: '选择客户联系人', trigger: 'change' }
+          ],
 
           content: [
             { required: true, message: '请输入跟进内容', trigger: 'blur' }

+ 71 - 19
src/views/saleManage/followList/components/addFollowDialog22.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,8 +24,8 @@
             v-model="form.linkId"
             multiple
             placeholder="请选择"
-            style="width: 300px"
             @change="onchangeLink"
+            style="width: 100%"
           >
             <el-option
               v-for="item in linkNameOptions"
@@ -36,13 +36,32 @@
             </el-option>
           </el-select>
         </el-form-item>
+
+        <el-form-item label="商机名称" prop="opportunityId">
+          <el-select
+            clearable
+            v-model="form.opportunityId"
+            placeholder="请选择"
+            style="width: 100%"
+            @change="onchangeOpportunity"
+          >
+            <el-option
+              v-for="item in opportunityList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+
         <el-form-item label="跟进时间" prop="followupTime">
           <el-date-picker
             v-model="form.followupTime"
             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 +101,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>
@@ -101,15 +120,16 @@
   import { deepClone } from '@/utils/index';
   // import fileMain from '@/components/upload/fileUpload';
 
-  import {
+  import { getTableList } from '@/api/saleManage/businessOpportunity';
 
+  import {
     UpdateInformation,
     addInformation,
     getcontactlink
   } from '@/api/saleManage/businessFollow';
   export default {
     mixins: [dictMixins],
-    components:{
+    components: {
       // fileUpload
     },
     data() {
@@ -123,8 +143,7 @@
         nextPlan: '',
         opportunityId: '',
         stageCode: '',
-        files: [],
-        
+        files: []
       };
 
       return {
@@ -137,6 +156,9 @@
         formDef,
         form: copyObj(formDef),
         rules: {
+          linkId: [
+            { required: true, message: '选择客户联系人', trigger: 'change' }
+          ],
           content: [
             { required: true, message: '请输入跟进内容', trigger: 'blur' }
           ],
@@ -146,7 +168,7 @@
           stageCode: [
             { required: true, message: '请选择跟进阶段', trigger: 'change' }
           ],
-          
+
           linkName: [
             {
               required: true,
@@ -159,13 +181,16 @@
         // 提交状态
         loading: false,
         // 是否是修改
-        isUpdate: false
+        isUpdate: false,
+        opportunityList: []
       };
     },
     created() {},
     methods: {
       //更改弹框状态
       async open(type, row, currentDetail) {
+        console.log(row, currentDetail);
+
         this.title = type === 'add' ? '新增' : '修改';
         this.currentDetail = currentDetail;
         this.row = copyObj(row);
@@ -175,11 +200,25 @@
           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;
+          this.getOpportunityList();
         }
       },
 
+      async getOpportunityList() {
+        let res = await getTableList({
+          pageNum: 1,
+          size: 10,
+          contactId: this.row.contactId
+        });
+
+        console.log(res);
+
+        this.opportunityList = res.list;
+      },
+
       //表单验证
       getValidate() {
         return new Promise((resolve, reject) => {
@@ -216,6 +255,17 @@
         this.form.linkName = selectedLabels;
       },
 
+      onchangeOpportunity(value) {
+        if (!value) {
+          this.form.opportunityName = '';
+          return;
+        }
+
+        this.form.opportunityName = this.opportunityList.find(
+          (item) => item.id === value
+        )?.name;
+      },
+
       //保存
       async sumbit() {
         try {
@@ -228,14 +278,16 @@
           }
           let _stageName = this.getDictValue('商机阶段', this.form.stageCode);
           let params = deepClone(this.form);
-          let { contactId, id } = this.currentDetail;
+
+          let { contactId } = this.currentDetail;
           params = Object.assign({}, params, {
             contactId: contactId,
-            opportunityId: id,
             linkId: params?.linkId?.join(',') || '',
             stageName: _stageName,
             files: this.form.files || []
           });
+
+          console.log(params);
           if (this.isUpdate) {
             UpdateInformation(params)
               .then((res) => {

+ 42 - 6
src/views/saleManage/followList/components/viewDialog.vue

@@ -22,6 +22,8 @@
       height="calc(100vh - 350px)"
       class="dict-table"
       :initLoad="false"
+      :selection.sync="selection"
+      row-key="id"
     >
       <!-- <template v-slot:content="{ row }">
         <el-link type="primary" :underline="false" @click="openDetail(row)">
@@ -71,17 +73,27 @@
     <div slot="footer">
       <el-button @click="cancel">返回</el-button>
     </div>
+
+    <pop-el-modal
+      :popVisible.sync="delVisible"
+      content="是否确定删除?"
+      @done="commitBtn"
+    />
   </ele-modal>
 </template>
 <script>
   import dictMixins from '@/mixins/dictMixins';
   // import fileMain from '@/components/addDoc/index.vue';
-  import { getTableList } from '@/api/saleManage/businessFollow';
+  import popElModal from '@/components/pop-el-modal';
+  import {
+    getTableList,
+    deleteInformation
+  } from '@/api/saleManage/businessFollow';
 
   import AddFollowDialog22 from './addFollowDialog22.vue';
   export default {
     mixins: [dictMixins],
-    components: { AddFollowDialog22 },
+    components: { AddFollowDialog22, popElModal },
 
     computed: {
       columns() {
@@ -89,7 +101,8 @@
           width: 45,
           type: 'selection',
           columnKey: 'selection',
-          align: 'center'
+          align: 'center',
+          reserveSelection: true
         };
         let arr = [
           {
@@ -205,14 +218,18 @@
       return {
         addOrEditDialogFlag: false,
         showAction: false,
-        current:{}
+        current: {},
+        delVisible: false,
+        selection: []
       };
     },
     mounted() {},
     created() {},
     methods: {
       open(params, type) {
-         this.current = params;
+        console.log(params);
+
+        this.current = params;
         this.showAction = type === 'view' ? false : true;
         console.log(params);
 
@@ -238,11 +255,30 @@
       cancel() {
         this.addOrEditDialogFlag = false;
       },
-      allDelBtn() {},
+      allDelBtn() {
+        if (this.selection?.length === 0) return;
+        this.delVisible = true;
+      },
       openEdit(type, row) {
         this.$refs.addFollowDialogRef.open(type, row, this.current);
         this.$refs.addFollowDialogRef.$refs.form &&
           this.$refs.addFollowDialogRef.$refs.form.clearValidate();
+      },
+      remove(row) {
+        deleteInformation([row.id]).then((res) => {
+          this.$message.success('删除成功!');
+
+          this.reload();
+        });
+      },
+      commitBtn() {
+        console.log(this.selection);
+        const dataId = this.selection.map((v) => v.id);
+        deleteInformation(dataId).then((res) => {
+          this.selection = [];
+          this.$message.success('删除成功!');
+          this.reload();
+        });
       }
     }
   };