yuanrf пре 1 година
родитељ
комит
b41f0692cd
1 измењених фајлова са 141 додато и 57 уклоњено
  1. 141 57
      src/components/OP/OpCustomers.vue

+ 141 - 57
src/components/OP/OpCustomers.vue

@@ -63,8 +63,8 @@
                 class="demo-ruleForm">
                 <div style="display: flex;">
                     <div style="width: 25%;">
-                        <el-form-item label="保险名称:" prop="iid" label-width="160px">
-                            <el-select v-model="OpCustomersData.iid" filterable placeholder="保险名称" @change="iidChane">
+                        <el-form-item label="保险种类:" prop="iid" label-width="160px">
+                            <el-select v-model="OpCustomersData.iid" filterable placeholder="保险种类" @change="iidChane">
                                 <el-option v-for="item in insuranceCostList" :key="item.id" :label="item.gName"
                                     :value="item.id">
                                 </el-option>
@@ -79,23 +79,28 @@
                     </div> -->
                     <div style="width: 25%;">
                         <el-form-item label="客户名称:" prop="clientName" label-width="160px">
-                            <el-input placeholder="客户名称" v-model="OpCustomersData.clientName">
-                            </el-input>
+                            <el-select v-model="OpCustomersData.clientName" placeholder="客户名称" multiple clearable
+                                filterable>
+                                <el-option v-for="item in fliterClient" :key="item.id" :label="item.name"
+                                    :value="item.id">
+                                </el-option>
+                            </el-select>
                         </el-form-item>
                     </div>
                     <div style="width: 25%;">
                         <el-form-item label="保险费用:" prop="insuranceCosts" label-width="160px">
                             <el-input placeholder="保险费用" v-model="OpCustomersData.insuranceCosts" style="width: 48%;">
                             </el-input>
-                            <el-select v-model="OpCustomersData.currency" filterable placeholder="币种" style="width: 50%;">
-                                <el-option v-for="item in currencyList" :key="item.currencyId" :label="item.currencyCode"
-                                    :value="item.currencyId">
+                            <el-select v-model="OpCustomersData.currency" filterable placeholder="币种"
+                                style="width: 50%;">
+                                <el-option v-for="item in currencyList" :key="item.currencyId"
+                                    :label="item.currencyCode" :value="item.currencyId">
                                 </el-option>
                             </el-select>
                         </el-form-item>
                     </div>
                 </div>
-                <div style="display: flex;">
+                <!-- <div style="display: flex;">
                     <div style="width: 25%;">
                         <el-form-item label="附件" prop="attachment" label-width="160px">
 
@@ -103,13 +108,11 @@
                                 style="width: 200px;" :before-remove="beforeRemove" :limit="1" :on-exceed="exceed"
                                 :action="uploadURL" :headers="headers" :auto-upload="false" :on-change="onChange">
                                 <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
-                                <!-- <el-button style="margin-left: 10px;" size="small" type="success"
-                                    @click="submitUpload">上传到服务器</el-button> -->
                             </el-upload>
 
                         </el-form-item>
                     </div>
-                </div>
+                </div> -->
                 <div style="display: flex;">
                     <div style="width: 100%;">
                         <el-form-item label="备 注:" prop="Remark" label-width="160px">
@@ -148,8 +151,8 @@
                                 :disabled="true">
                             </el-input>
                             <el-select v-model="OpCustomersData.currency" style="width: 45%;" :disabled="true">
-                                <el-option v-for="item in currencyList" :key="item.currencyId" :label="item.currencyCode"
-                                    :value="item.currencyId">
+                                <el-option v-for="item in currencyList" :key="item.currencyId"
+                                    :label="item.currencyCode" :value="item.currencyId">
                                 </el-option>
                             </el-select>
                         </el-form-item>
@@ -161,7 +164,8 @@
                             <el-form-item label="卡类型:" prop="ctdId" label-width="160px">
                                 <el-select v-model="OpCustomersData.ctdId" placeholder="卡类型" style="width: 100%;"
                                     @change="ctdChange">
-                                    <el-option v-for="item in bankCard" :key="item.id" :label="item.name" :value="item.id">
+                                    <el-option v-for="item in bankCard" :key="item.id" :label="item.name"
+                                        :value="item.id">
                                     </el-option>
                                 </el-select>
                             </el-form-item>
@@ -271,7 +275,6 @@
     </div>
 </template>
 <script>
-import { dE } from '@fullcalendar/core/internal-common';
 export default {
     data() {
         return {
@@ -299,7 +302,7 @@ export default {
                 id: 0,
                 diId: 0,
                 iid: 2,
-                clientName: '',
+                clientName: [],
                 insuranceCosts: 0,
                 currency: '',
                 attachment: '',
@@ -346,7 +349,7 @@ export default {
                     { required: true, message: '请选择保险名称', trigger: ['blur', 'change'] },
                 ],
                 clientName: [
-                    { required: true, message: '请输入客户名称', trigger: ['blur', 'change'] },
+                    { type: "array", required: true, message: '请选择客户名称', trigger: ['blur', 'change'] },
                 ],
                 insuranceCosts: [
                     { required: true, message: '请输入费用金额', trigger: ['blur', 'change'] },
@@ -374,7 +377,8 @@ export default {
                 otherBankName: [{ required: true, message: '对方开户行', trigger: ['blur', 'change'] },],
                 otherSideNo: [{ required: true, message: '对方银行卡号', trigger: ['blur', 'change'] },],
                 totherSideName: [{ required: true, message: '对方姓名', trigger: ['blur', 'change'] },],
-            }
+            },
+            clientNameId: [],
         }
     },
     methods: {
@@ -394,15 +398,15 @@ export default {
                     ctId: 82
                 }
             }).then(function (res) {
+                console.log('DecreasePaymentsSelect', res.data.data);
                 if (res.data.code == 200) {
-                    that.delegationInfoList = res.data.data.groupName
-                    that.payment = res.data.data.payment
+                    that.delegationInfoList = res.data.data.groupName; //团组列表
+                    that.payment = res.data.data.payment; //支付方式
                     for (let index = 0; index < that.delegationInfoList.length; index++) {
-
                         if (that.delegationInfoList[index].id == that.OpCustomersData.diId) {
                             that.delegationInfo = that.delegationInfoList[index];
-                            that.OpCustomersData.diId = that.delegationInfo.id
-                            that.VisitDate = that.transformDateFormat(that.delegationInfo.visitStartDate) + '至' + that.transformDateFormat(that.delegationInfo.visitEndDate);
+                            //that.OpCustomersData.diId = that.delegationInfo.id
+                            that.VisitDate = that.transformDateFormat(that.delegationInfo.visitStartDate) + '至' + that.transformDateFormat(that.delegationInfo.visitEndDate); //时间
                             var url = "/api/Groups/CustomersInitialize"
                             that.$axios({
                                 method: 'post',
@@ -426,6 +430,18 @@ export default {
 
                                     that.bankCard = res.data.data.bankCard;//卡类型下拉框
                                     that.payment = res.data.data.payment;//支付方式下拉框
+
+
+                                    if (that.OpCustomersData.id != null && that.OpCustomersData.id != undefined && that.OpCustomersData.id != 0) {
+                                        that.QueryCustomersById();
+                                        that.title = "修改保险费用";
+                                        that.OpCustomersData.status = 2
+                                        that.isShow = true
+                                    } else {
+                                        that.OpCustomersData.status = 1
+                                        that.title = "新增保险费用"
+                                        that.isShow = false
+                                    }
                                 }
                             })
                             break;
@@ -466,6 +482,8 @@ export default {
                             that.bankCard = res.data.data.bankCard;//卡类型下拉框
                             that.payment = res.data.data.payment;//支付方式下拉框
                         }
+                        that.QueryClient();
+                        that.OpCustomersData.clientName = [];
                     })
                     break;
                 }
@@ -554,7 +572,9 @@ export default {
                             break;
                         }
                     }
-                    that.OpCustomersData.clientName = Customers.clientName
+                    var respClientName = Customers.clientName
+                    that.OpCustomersData.clientName = that.ClientFormat(respClientName);
+
                     that.OpCustomersData.insuranceCosts = Customers.insuranceCosts
                     that.OpCustomersData.currency = Customers.currency
                     that.OpCustomersData.attachment = Customers.attachment
@@ -586,36 +606,24 @@ export default {
             if (this.IsAuditGM == 1) {
                 this.$message.error('已通过审核,不可修改!');
             } else {
-                if (this.OpCustomersData.diId == null && this.OpCustomersData.diId == undefined && this.OpCustomersData.diId == "") {
+                if (this.OpCustomersData.diId == null || this.OpCustomersData.diId == undefined || this.OpCustomersData.diId == "") {
                     this.$message.error("请选择团组名称");
                     return;
                 } else {
                     const that = this;
                     that.$refs.OpCustomersData.validate((valid) => {
+                        debugger;
                         if (valid) {
-                            if (that.projectName != "" && that.projectName != null && that.projectName != undefined) {
-                                that.$refs.upload.submit();//上传文件到服务器
-                            } else {
-                                if (that.DelfileName != null && that.DelfileName != "" && that.DelfileName != undefined) {
-                                    that.$axios({
-                                        method: 'post',
-                                        url: "/api/Groups/DelFileCus",
-                                        headers: {
-                                            Authorization: 'Bearer ' + that.token
-                                        },
-                                        data: {
-                                            fileName: that.DelfileName,
-                                            id: that.OpCustomersData.id
-                                        }
-                                    }).then(function (res) {
-                                    })
-                                }
+                            {
+
                                 that.OpCustomersData.createUserId = that.userId;
                                 if (that.OpCustomersData.ctdId == '') {
                                     that.OpCustomersData.ctdId = 0
                                 }
 
                                 var url = "/api/Groups/OpCustomers"
+                                that.OpCustomersData.clientName = that.ClientFormat(that.OpCustomersData.clientName);//处理数组
+
                                 that.$axios({
                                     method: 'post',
                                     url: url,
@@ -637,11 +645,14 @@ export default {
                                                     diId: that.OpCustomersData.diId
                                                 }
                                             })
-                                        }, 3000);
+                                        }, 500);
                                     } else {
                                         that.$message.error(res.data.msg);
                                     }
-                                })
+                                }).finally(() => {
+                                    that.OpCustomersData.clientName = that.ClientFormat(that.OpCustomersData.clientName);
+                                    console.log('run finally code');
+                                });
                             }
 
                         } else {
@@ -652,6 +663,9 @@ export default {
                 }
             }
         },
+
+        /* 文件上传相关
+
         //上传
         // 文件超出限制
         exceed(files, fileList) {
@@ -786,6 +800,8 @@ export default {
 
             this.projectName = file.name
         },
+        */
+
         EscAdd() {
             this.$router.push({
                 path: "/home/Customers",
@@ -793,26 +809,91 @@ export default {
                     diId: this.OpCustomersData.diId
                 }
             })
+        },
+        //加载团组客户名单
+        QueryClient() {
+            var url = "/api/Groups/QueryClientInfoByDIID"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.token
+                },
+                data: {
+                    diid: this.OpCustomersData.diId
+                }
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    //客户名单
+                    console.log(res.data.data);
+                    that.clientNameId = res.data.data;
+                }
+            })
+        },
+        ClientFormat(val) {
+
+            var result = [];
+
+            if (typeof val == "string") {
+
+                if (val.indexOf(',') != -1) {
+                    result = val.split(',').map(x => { return Number(x) }).filter(f => f > 0)
+                } else {
+                    var clientId = Number(val);
+                    if (clientId > 0) {
+                        result = [clientId]
+                    }
+                }
+
+            } else if (Array.isArray(val)) {
+
+                if (val.length > 0) {
+                    result = val.join();
+                }
+
+            } else {
+                result = val;
+            }
+
+            return result;
+
+
         }
     },
 
     mounted() {
         this.token = JSON.parse(localStorage.getItem('userinif')).token;
         this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
-        this.initializeSelect();
         this.OpCustomersData.diId = parseInt(this.$route.query.DiId)
+        this.QueryClient();
+        this.initializeSelect();
         this.OpCustomersData.id = this.$route.query.id
-        if (this.OpCustomersData.id != null && this.OpCustomersData.id != undefined && this.OpCustomersData.id != 0) {
-            this.QueryCustomersById();
-            this.title = "修改保险费用";
-            this.OpCustomersData.status = 2
-            this.isShow = true
-        } else {
-            this.OpCustomersData.status = 1
-            this.title = "新增保险费用"
-            this.isShow = false
-        }
+    },
+    computed: {
+        //客户名单属性
+        fliterClient() {
+            var arr = [];
+            if (this.clientNameId.length < 1) {
+                return [];
+            }
 
+            this.clientNameId.forEach(element => {
+
+                var item = "";
+                if (element.pinyin) {
+                    item += element.pinyin;
+                }
+                if (element.firstName && element.lastName) {
+                    item += "(" + element.lastName + element.firstName + ")";
+                }
+
+                if (item) {
+                    arr.push({ id: element.id, name: item });
+                }
+            });
+            return arr;
+        }
     }
 }
 </script>
@@ -860,12 +941,15 @@ export default {
     box-shadow: 0 0 5px #0005;
     border-radius: 10px;
 }
-.opcustomers-box .el-select{
+
+.opcustomers-box .el-select {
     width: 100%;
 }
-.opcustomers-box  .el-date-editor .el-input{
+
+.opcustomers-box .el-date-editor .el-input {
     width: 100%;
 }
+
 @media screen and (max-width: 1700px) {
     .appraise-box>div {
         width: 48%;