zhujun 2 anos atrás
pai
commit
d519a7f4db

+ 69 - 0
src/components/pop-modal/index.vue

@@ -0,0 +1,69 @@
+<template>
+    <div class="pop-modal">
+        <ele-modal
+        width="400px"
+        :title="title"
+        :visible.sync="visible"
+        custom-class="ele-dialog-form"
+        :close-on-click-modal="true"
+        @update:visible="updateVisible"
+    >
+        <div style="padding: 10px 0 20px;">{{content}}</div>
+        <template v-slot:footer>
+      <el-button @click="updateVisible(false)">取消</el-button>
+      <el-button type="primary" :loading="loading" @click="handleCommit">
+        提交
+      </el-button>
+    </template>
+    </ele-modal>
+    </div>
+  </template>
+  
+  <script>
+    export default {
+        data(){
+          return {
+            loading:false
+        }
+        },
+      props: {
+        title: {
+          typeof: String,
+          default: '温馨提示'
+        },
+        content:{
+            typeof: String,
+          default: ''
+        },
+        visible: {
+          typeof: Boolean,
+          default: false
+        }
+      },
+      methods:{
+          /* 更新visible */
+      updateVisible(value) {
+        this.$emit('update:visible', value);
+      },
+      handleCommit(){
+        this.loading = true;
+        this.$emit('done');
+        setTimeout(() => {
+            this.updateVisible(false);
+            this.loading = false;
+        }, 800);
+      }
+      }
+    };
+  </script>
+  <style lang="scss" scoped>
+    ::v-deep .ele-dialog-form {
+     .el-dialog__header{
+        border-bottom: 0;
+     }
+     .el-dialog__footer{
+        border-top: 0;
+     }
+    }
+  </style>
+  

+ 7 - 1
src/components/upload/fileUpload.vue

@@ -6,6 +6,7 @@
       :http-request="handlRequest"
       :before-remove="beforeRemove"
       :on-remove="handleRemove"
+      :on-preview="handleItem"
       multiple
       :before-upload="beforeUpload"
       :file-list="fileList"
@@ -71,7 +72,8 @@
   import {
     uploadFile,
     removeFile,
-    getFileList
+    getFileList,
+    getFile
   } from '@/api/system/file/index.js';
   import { getImageUrl, getImagePath } from '@/utils/file';
   export default {
@@ -172,6 +174,10 @@
     },
 
     methods: {
+      //点击查看图片
+      handleItem(file){
+       getFile({ objectName: file.storePath }, file.name);
+      },
       delFileList () {
         this.$emit('input', []);
       },

+ 42 - 18
src/views/saleManage/contact/components/addContactDialog.vue

@@ -593,7 +593,7 @@ export default {
             { required: true, message: '请输入客户名称', trigger: 'blur' }
           ],
           authorizationLimit: [
-            { required: true, message: '请输入授信额度', trigger: 'change' }
+            { required: true, message: '请输入授信额度', trigger: 'blur' }
           ]
         },
         otherRules: {
@@ -705,24 +705,44 @@ export default {
         //   this.removeLinkList.push(row.id);
         }
       },
+      getValidate() {
+          return Promise.all([
+            new Promise((resolve, reject) => {
+              this.$refs.form.validate((valid) => {
+                if (!valid) {
+                  this.activeName = 'base';
+                  reject(false);
+                } else {
+                  resolve(true);
+                }
+              });
+            }),
+            new Promise((resolve, reject) => {
+              this.$refs.otherForm.validate((valid) => {
+                if (!valid) {
+                  this.activeName = 'other';
+                  reject(false);
+                } else {
+                  resolve(true);
+                }
+              });
+            }),
+            new Promise((resolve, reject) => {
+              if (this.tableLinkData.length === 0) {
+                this.$message.error("联系人信息至少有1条");
+                this.activeName = 'link';
+                reject(false);
+              } else {
+                resolve(true);
+              }
+            })
+          ]);
+     },
       async save() {
-        const isBaseValid = await this.$refs.form.validate();
-        const isOtherValid = await this.$refs.otherForm.validate();
-        if (!isBaseValid) {
-          this.activeName = 'base';
-          return false;
-        }
-        if (!isOtherValid) {
-          this.activeName = 'other';
-          return false;
-        }
-        if(this.tableLinkData && this.tableLinkData.length === 0){
-          this.$message.error("联系人信息至少有1条");
-          this.activeName = 'link';
-          return false;
-        }
-
-        this.loading = true;
+        try {
+           await this.getValidate();
+           // 表单验证通过,执行保存操作
+           this.loading = true;
         // 基本信息处理
         if (this.$refs.address.getCheckedNodes()) {
           let node = this.$refs.address.getCheckedNodes()[0];
@@ -808,7 +828,11 @@ export default {
             .catch((e) => {
               //this.loading = false;
             });
+          }
+        } catch (error) {
+          // 表单验证未通过,不执行保存操作
         }
+       
       },
       cancel() {
         this.$nextTick(() => {

+ 36 - 1
src/views/saleManage/contact/index.vue

@@ -28,6 +28,7 @@
               height="calc(100vh - 300px)"
               full-height="calc(100vh - 116px)"
               tool-class="ele-toolbar-form"
+              :selection.sync="selection"
               cache-key="eomContactPageTable"
             >
               <!-- 表头工具栏 -->
@@ -41,6 +42,16 @@
                 >
                   新建
                 </el-button>
+                <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:name="{ row }">
@@ -101,7 +112,8 @@
 
     <AddContactDialog ref="addContactDialogRef" :categoryTreeList="treeList" @done="reload"></AddContactDialog>
     <ContactDetailDialog ref="contactDetailDialogRef"></ContactDetailDialog>
-
+<!-- 多选删除弹窗 -->
+    <pop-modal :visible.sync="delVisible" content="是否确定删除?" @done="commitBtn"/>
   </div>
 </template>
 
@@ -109,6 +121,7 @@
 import ContactSearch from './components/contactSearch.vue';
 import AddContactDialog from './components/addContactDialog.vue';
 import ContactDetailDialog from './components/contactDetailDialog.vue';
+import popModal from '@/components/pop-modal';
 import AssetTree from '@/components/AssetTree';
 import {contactDelete, contactPage, contactTypeTree, updateStatus} from '@/api/saleManage/contact';
 import dictMixins from '@/mixins/dictMixins';
@@ -118,14 +131,23 @@ export default {
     components: {
       AssetTree,
       ContactSearch,
+      popModal,
       AddContactDialog,
       ContactDetailDialog,
     },
     data() {
       return {
+        selection:[],
+        delVisible:false,
         // 加载状态
         loading: false,
         columns: [
+        {
+             width: 45,
+             type: 'selection',
+             columnKey: 'selection',
+             align: 'center'
+          },
           {
             columnKey: 'index',
             label: '序号',
@@ -289,6 +311,19 @@ export default {
         this.$refs.addContactDialogRef.$refs.form &&
         this.$refs.addContactDialogRef.$refs.form.clearValidate();
       },
+      //批量删除
+      allDelBtn(){
+        if(this.selection.length===0) return
+        this.delVisible=true
+      },
+      commitBtn(){
+        console.log(this.selection)
+        const dataId=this.selection.map(v=>v.id)
+        contactDelete(dataId).then((res) => {
+          this.$message.success('删除成功!');
+          this.reload();
+        });
+      },
       remove(row) {
         contactDelete([row.id]).then((res) => {
           this.$message.success('删除成功!');