Explorar o código

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-eom into dev

yusheng hai 11 meses
pai
achega
856233763a

+ 12 - 5
src/views/saleManage/followList/components/addFollowDialog.vue

@@ -8,7 +8,7 @@
       :visible.sync="dialogVisible"
       :close-on-click-modal="false"
       :append-to-body="true"
-      width="60%"
+      width="40%"
     >
       <el-form
         label-width="100px"
@@ -17,7 +17,7 @@
         :rules="rules"
         style="margin-top: 30px; padding-right: 20px"
       >
-        <el-form-item label="客户名称" prop="partaName">
+        <el-form-item label="客户名称" prop="contactId">
           <el-input
             clearable
             v-model="form.partaName"
@@ -32,7 +32,7 @@
             v-model="form.linkId"
             multiple
             placeholder="请选择"
-            style="width: 300px"
+            style="width: 100%"
             @change="onchangeLink"
           >
             <el-option
@@ -47,9 +47,10 @@
 
         <el-form-item label="商机名称" prop="opportunityId">
           <el-select
+            clearable
             v-model="form.opportunityId"
             placeholder="请选择"
-            style="width: 300px"
+            style="width: 100%"
           >
             <el-option
               v-for="item in opportunityList"
@@ -67,7 +68,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>
@@ -160,6 +161,10 @@
         formDef,
         form: copyObj(formDef),
         rules: {
+          contactId: [
+            { required: true, message: '选择客户', trigger: 'change' }
+          ],
+
           content: [
             { required: true, message: '请输入跟进内容', trigger: 'blur' }
           ],
@@ -308,6 +313,8 @@
           contactId: base?.id,
           partaName: base?.name
         });
+
+        this.form.linkId = '';
       }
     }
   };

+ 285 - 0
src/views/saleManage/followList/components/addFollowDialog22.vue

@@ -0,0 +1,285 @@
+<template>
+  <div class="container">
+    <!-- 单据弹窗 -->
+    <ele-modal
+      :title="title"
+      :before-close="handleClose"
+      custom-class="ele-dialog-form long-dialog-form"
+      :visible.sync="dialogVisible"
+      :close-on-click-modal="false"
+      :append-to-body="true"
+      :maxable="true"
+    :resizable="true"
+      width="60%"
+    >
+      <el-form
+        label-width="100px"
+        ref="form"
+        :model="form"
+        :rules="rules"
+        style="margin-top: 30px; padding-right: 20px"
+      >
+        <el-form-item label="客户联系人" prop="linkId">
+          <el-select
+            v-model="form.linkId"
+            multiple
+            placeholder="请选择"
+            style="width: 300px"
+            @change="onchangeLink"
+          >
+            <el-option
+              v-for="item in linkNameOptions"
+              :key="item.id"
+              :label="item.linkName"
+              :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"
+            class="filter-item"
+          ></el-date-picker>
+        </el-form-item>
+        <el-form-item label="跟进阶段" prop="stageCode">
+          <DictSelection dictName="商机阶段" clearable v-model="form.stageCode">
+          </DictSelection>
+        </el-form-item>
+        <el-form-item label="跟进内容" prop="content">
+          <el-input
+            placeholder="请输入"
+            type="textarea"
+            v-model="form.content"
+            maxlength="500"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="达成共识" prop="agreement">
+          <el-input
+            placeholder="请输入"
+            type="textarea"
+            v-model="form.agreement"
+            maxlength="500"
+          ></el-input>
+        </el-form-item>
+
+        <el-form-item label="下一步计划" prop="nextPlan">
+          <el-input
+            placeholder="请输入"
+            v-model="form.nextPlan"
+            type="textarea"
+            maxlength="300"
+          ></el-input>
+        </el-form-item>
+        <el-form-item prop="files" label="附件">
+          <!-- <fileUpload
+            v-model="form.files"
+            module="main"
+            :showLib="false"
+            :limit="5"
+          />  -->
+          <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>
+      </div>
+    </ele-modal>
+  </div>
+</template>
+<script>
+  import dictMixins from '@/mixins/dictMixins';
+  import { copyObj } from '@/utils/util';
+  import { deepClone } from '@/utils/index';
+  // import fileMain from '@/components/upload/fileUpload';
+
+  import {
+
+    UpdateInformation,
+    addInformation,
+    getcontactlink
+  } from '@/api/saleManage/businessFollow';
+  export default {
+    mixins: [dictMixins],
+    components:{
+      // fileUpload
+    },
+    data() {
+      let formDef = {
+        agreement: '',
+        contactId: '',
+        content: '',
+        followupTime: '',
+        linkId: '',
+        linkName: '',
+        nextPlan: '',
+        opportunityId: '',
+        stageCode: '',
+        files: [],
+        
+      };
+
+      return {
+        dialogVisible: false,
+        currentDetail: {}, //选择的客户信息
+        linkNameOptions: [],
+        title: '',
+        row: {},
+        activeName: 'base',
+        formDef,
+        form: copyObj(formDef),
+        rules: {
+          content: [
+            { required: true, message: '请输入跟进内容', trigger: 'blur' }
+          ],
+          followupTime: [
+            { required: true, message: '请选择跟进时间', trigger: 'change' }
+          ],
+          stageCode: [
+            { required: true, message: '请选择跟进阶段', trigger: 'change' }
+          ],
+          
+          linkName: [
+            {
+              required: true,
+              message: '请选择客户联系人名称',
+              trigger: 'change'
+            }
+          ]
+        },
+
+        // 提交状态
+        loading: false,
+        // 是否是修改
+        isUpdate: false
+      };
+    },
+    created() {},
+    methods: {
+      //更改弹框状态
+      async open(type, row, currentDetail) {
+        this.title = type === 'add' ? '新增' : '修改';
+        this.currentDetail = currentDetail;
+        this.row = copyObj(row);
+        this.dialogVisible = true;
+        this.getInfo();
+        if (type == 'add') {
+          this.isUpdate = false;
+        } else {
+          this.isUpdate = true;
+          this.row.linkId = this.row.linkId&&this.row.linkId.split(',') || [];
+          this.form = this.row
+        }
+      },
+
+      //表单验证
+      getValidate() {
+        return new Promise((resolve, reject) => {
+          this.$refs.form.validate((valid) => {
+            if (!valid) {
+              reject(false);
+            } else {
+              resolve(true);
+            }
+          });
+        });
+      },
+
+      //初始数据
+      async getInfo() {
+        const data = await getcontactlink({
+          contactId: this.currentDetail?.contactId
+        });
+        if (data && data?.length) {
+          this.linkNameOptions = data;
+        }
+      },
+
+      //选择下拉框
+      onchangeLink(selectedOptions) {
+        const selectedLabels = selectedOptions
+          .map((optionId) => {
+            const option = this.linkNameOptions.find(
+              (opt) => opt.id === optionId
+            );
+            return option ? option.linkName : '';
+          })
+          .join(',');
+        this.form.linkName = selectedLabels;
+      },
+
+      //保存
+      async sumbit() {
+        try {
+          await this.getValidate();
+          // 表单验证通过,执行保存操作
+          this.loading = true;
+
+          if (!this.isUpdate) {
+            delete this.form.id;
+          }
+          let _stageName = this.getDictValue('商机阶段', this.form.stageCode);
+          let params = deepClone(this.form);
+          let { contactId, id } = this.currentDetail;
+          params = Object.assign({}, params, {
+            contactId: contactId,
+            opportunityId: id,
+            linkId: params?.linkId?.join(',') || '',
+            stageName: _stageName,
+            files: this.form.files || []
+          });
+          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);
+          // 表单验证未通过,不执行保存操作
+        }
+      },
+      cancel() {
+        this.$nextTick(() => {
+          // 关闭后,销毁所有的表单数据
+          this.$refs['form'] && this.$refs['form'].resetFields();
+          (this.form = copyObj(this.formDef)), (this.dialogVisible = false);
+        });
+      },
+      handleClose() {
+        this.cancel();
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .container {
+    padding: 10px 0;
+  }
+</style>

+ 22 - 16
src/views/saleManage/followList/components/list.vue

@@ -34,7 +34,7 @@
         >
           新建
         </el-button>
-        <el-button
+        <!-- <el-button
           size="small"
           type="danger"
           el-icon-delete
@@ -43,7 +43,7 @@
           :disabled="selection?.length === 0"
         >
           批量删除
-        </el-button>
+        </el-button> -->
       </template>
 
       <template v-slot:action="{ row }">
@@ -51,12 +51,12 @@
           type="primary"
           :underline="false"
           icon="el-icon-edit"
-          @click="openEdit('编辑', row)"
+          @click="handleAddOrEdit(row, 'edit')"
         >
           修改
         </el-link>
 
-        <el-popconfirm
+        <!-- <el-popconfirm
           class="ele-action"
           title="确定要删除此信息吗?"
           @confirm="remove(row)"
@@ -66,7 +66,7 @@
               删除
             </el-link>
           </template>
-        </el-popconfirm>
+        </el-popconfirm> -->
       </template>
     </ele-pro-table>
 
@@ -185,16 +185,19 @@
     created() {},
     methods: {
       //新增、修改
-      handleAddOrEdit(row = {}) {
+      handleAddOrEdit(row = {}, type) {
         this.$nextTick(() => {
-          this.$refs.viewDialogRef.open({
-            contactId: row.contactId,
-            deptIds: row.deptIds,
-            beginTime: row.beginTime,
-            endTime: row.endTime,
-            deptId: row.deptId,
-            userId: row.userId
-          });
+          this.$refs.viewDialogRef.open(
+            {
+              contactId: row.contactId,
+              deptIds: row.deptIds,
+              beginTime: row.beginTime,
+              endTime: row.endTime,
+              deptId: row.deptId,
+              userId: row.userId
+            },
+            type
+          );
         });
       },
 
@@ -219,8 +222,11 @@
       },
       allDelBtn() {},
       remove() {},
-      done({ data }) {
-        console.log(data);
+      done() {
+        console.log('123');
+
+        this.reload();
+        // console.log(data);
       }
     }
   };

+ 89 - 7
src/views/saleManage/followList/components/viewDialog.vue

@@ -11,6 +11,10 @@
     :maxable="true"
     :resizable="true"
   >
+    <AddFollowDialog22
+      ref="addFollowDialogRef"
+      @done="reload"
+    ></AddFollowDialog22>
     <ele-pro-table
       ref="table"
       :columns="columns"
@@ -27,6 +31,42 @@
       <template v-slot:files="{ row }">
         <fileMain v-model="row.files" type="view"></fileMain>
       </template>
+
+      <template v-slot:toolbar v-if="showAction">
+        <el-button
+          size="small"
+          type="danger"
+          el-icon-delete
+          class="ele-btn-icon"
+          @click="allDelBtn"
+          :disabled="selection?.length === 0"
+        >
+          批量删除
+        </el-button>
+      </template>
+
+      <template v-slot:action="{ row }">
+        <el-link
+          type="primary"
+          :underline="false"
+          icon="el-icon-edit"
+          @click="openEdit('edit', row)"
+        >
+          修改
+        </el-link>
+
+        <el-popconfirm
+          class="ele-action"
+          title="确定要删除此信息吗?"
+          @confirm="remove(row)"
+        >
+          <template v-slot:reference>
+            <el-link type="danger" :underline="false" icon="el-icon-delete">
+              删除
+            </el-link>
+          </template>
+        </el-popconfirm>
+      </template>
     </ele-pro-table>
     <div slot="footer">
       <el-button @click="cancel">返回</el-button>
@@ -37,14 +77,21 @@
   import dictMixins from '@/mixins/dictMixins';
   // import fileMain from '@/components/addDoc/index.vue';
   import { getTableList } from '@/api/saleManage/businessFollow';
+
+  import AddFollowDialog22 from './addFollowDialog22.vue';
   export default {
     mixins: [dictMixins],
-    // components: { fileMain },
+    components: { AddFollowDialog22 },
 
-    data() {
-      return {
-        addOrEditDialogFlag: false,
-        columns: [
+    computed: {
+      columns() {
+        let section = {
+          width: 45,
+          type: 'selection',
+          columnKey: 'selection',
+          align: 'center'
+        };
+        let arr = [
           {
             columnKey: 'index',
             label: '序号',
@@ -133,13 +180,42 @@
             showOverflowTooltip: true,
             minWidth: 110
           }
-        ]
+        ];
+
+        let action = {
+          columnKey: 'action',
+          label: '操作',
+          width: 180,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          showOverflowTooltip: true,
+          fixed: 'right'
+        };
+        if (this.showAction) {
+          arr.push(action);
+          arr.unshift(section);
+        }
+
+        return arr;
+      }
+    },
+
+    data() {
+      return {
+        addOrEditDialogFlag: false,
+        showAction: false,
+        current:{}
       };
     },
     mounted() {},
     created() {},
     methods: {
-      open(params) {
+      open(params, type) {
+         this.current = params;
+        this.showAction = type === 'view' ? false : true;
+        console.log(params);
+
         this.addOrEditDialogFlag = true;
         this.$nextTick(() => {
           this.reload(params);
@@ -161,6 +237,12 @@
       //关闭弹窗
       cancel() {
         this.addOrEditDialogFlag = false;
+      },
+      allDelBtn() {},
+      openEdit(type, row) {
+        this.$refs.addFollowDialogRef.open(type, row, this.current);
+        this.$refs.addFollowDialogRef.$refs.form &&
+          this.$refs.addFollowDialogRef.$refs.form.clearValidate();
       }
     }
   };