liuhj 2 éve%!(EXTRA string=óta)
szülő
commit
1f7bb33959
3 módosított fájl, 184 hozzáadás és 39 törlés
  1. 124 31
      src/components/OP/Groupedit.vue
  2. 58 8
      src/components/OP/OPgroup.vue
  3. 2 0
      src/main.js

+ 124 - 31
src/components/OP/Groupedit.vue

@@ -1,5 +1,5 @@
 <template>
-    <div>
+    <div  v-loading="fullscreenLoading">
         <div class="groupedit">
             <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
                 <div class="required-box">
@@ -89,9 +89,9 @@
                     </el-form-item>
                 </el-form>
                 <el-form-item>
-                  <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
+                  <el-button type="primary" @click="submitForm('ruleForm')">确 定</el-button>
                   <el-button @click="resetForm('ruleForm')">重 置</el-button>
-                  <el-button @click="resetForm('ruleForm')">返 回</el-button>
+                  <el-button @click="clickback()">返 回</el-button>
                 </el-form-item>
               </el-form>
         </div>
@@ -99,11 +99,14 @@
 </template>
 
 <script>
+import { el } from '@fullcalendar/core/internal-common';
+import { all } from 'q';
 export default {
     data() {
       return {
         editid:'',
         token:'',
+        userid:'',
         ruleForm: {
           quotenum:'',
           groupname: '',
@@ -176,24 +179,31 @@ export default {
             { required: true, message: '请输入出款额', trigger: 'blur' },
             {pattern:"^\\d+(\\.\\d+)?$",message: "请输入正浮点数或整数",trigger: "blur"}
           ]
-        }
+        },
+        fullscreenLoading:false
       };
     },
     methods: {
-      submitForm(formName) {
-        this.$refs[formName].validate((valid) => {
-          if (valid) {
-            alert('submit!');
-          } else {
-            console.log('error submit!!');
-            return false;
-          }
-        });
-      },
-      resetForm(formName) {
-        this.$refs[formName].resetFields();
-      },
-      getdown(){
+        submitForm(formName) {
+            this.$refs[formName].validate((valid) => {
+            if (valid) {
+                this.addGroupInfo()
+            } else {
+                console.log('error submit!!');
+                return false;
+            }
+            });
+        },
+        //清空
+        resetForm(formName) {
+            this.$refs[formName].resetFields();
+        },
+        //返回
+        clickback(){
+            this.$router.go(-1);
+        },
+        //获取下拉列表
+        getdown(){
             var url="/api/Groups/GroupEditBasicSource"
             var that=this
             this.$axios({
@@ -213,23 +223,39 @@ export default {
                 }
             })
         },
+        //新增获取销售号
         getSalesQuoteNo(){
-            var url="/api/Groups/GetGroupSalesQuoteNo"
-            var that=this
             if(this.editid==undefined){
-                this.$axios({
-                    method: 'post',
-                    url:url,
-                    headers:{
-                        Authorization:'Bearer '+this.token
-                    },
-                }).then(function(res){
-                    if(res.data.code==200){
-                        that.ruleForm.quotenum=res.data.data.salesQuoteNo;
-                    }
-                })
+                var url="/api/Groups/GetGroupSalesQuoteNo"
+                var that=this
+                if(this.editid==undefined){
+                    this.$axios({
+                        method: 'post',
+                        url:url,
+                        headers:{
+                            Authorization:'Bearer '+this.token
+                        },
+                    }).then(function(res){
+                        if(res.data.code==200){
+                            that.ruleForm.quotenum=res.data.data.salesQuoteNo;
+                        }
+                    })
+                }
             }
+            
         },
+        //处理时间
+        disposeTime(val){
+            var date = new Date(val);
+            var y = date.getFullYear();
+            var m = date.getMonth() + 1;
+            m = m < 10 ? ('0' + m) : m;
+            var d = date.getDate();
+            d = d < 10 ? ('0' + d) : d;
+            let time = y + '-' + m + '-' + d;
+            return time
+        },
+        //编辑获取原数据
         getGroupInfo(){
             var url="/api/Groups/GetGroupInfo"
             var that=this
@@ -275,11 +301,78 @@ export default {
                     }
                 })
             }
+        },
+        //新增编辑
+        addGroupInfo(){
+            var url="/api/Groups/GroupOperation";
+            var that=this;
+            that.fullscreenLoading = true;
+            var status
+            if(this.editid!=undefined){
+                status=2
+            }else{
+                status=1
+            }
+            debugger
+            this.$axios({
+                    method: 'post',
+                    url:url,
+                    headers:{
+                        Authorization:'Bearer '+this.token
+                    },
+                    data:{
+                        portType:1,
+                        status:status,//添加1//修改2//删除3
+                        id:that.editid,
+                        userId:that.userid,
+                        salesQuoteNo:that.ruleForm.quotenum,
+                        jietuanOperator:parseInt(that.ruleForm.person),//
+                        teamLevSId:parseInt(that.ruleForm.grades),//
+                        teamDid:parseInt(that.ruleForm.OP),//
+                        teamName:that.ruleForm.groupname,
+                        clientName:that.ruleForm.customername,
+                        clientUnit:that.ruleForm.customerunits,
+                        visitCountry:that.ruleForm.countriesvisited.replaceAll("、","|"),
+                        visitDate:that.disposeTime(that.ruleForm.visitingtime),
+                        visitDays:parseInt(that.ruleForm.numdays),
+                        visitPNumber:parseInt(that.ruleForm.numperson),
+                        tontractTime:that.disposeTime(that.ruleForm.contracttime),
+                        payDay:parseInt(that.ruleForm.occasion),
+                        paymentMoney:parseInt(that.ruleForm.payments),
+                        visitPurpose:that.ruleForm.purposevisit,
+                        specialNeeds:that.ruleForm.specialneeds,
+                        otherNeeds:that.ruleForm.otherneeds,
+                        cgrwspbmmc:that.ruleForm.approvalname,
+                        cgrwspwh:that.ruleForm.approvalnumber1,
+                        zzscbmmc:that.ruleForm.censorshipdepartment,
+                        zzscspwh:that.ruleForm.approvalnumber2,
+                        tellPhone:that.ruleForm.phonenumber,
+                        remark:that.ruleForm.remark,
+                    }
+                }).then(function(res){
+                    console.log(res)
+                    if(res.data.code==200){
+                        that.$message({
+                            message: res.data.msg,
+                            type: 'success',
+                            offset:50
+                        });
+                        that.fullscreenLoading = false;
+                    }else{
+                        that.$message({
+                            message:res.data.msg,
+                            type: 'warning',
+                            offset:50
+                        });
+                        that.fullscreenLoading = false;
+                    }
+                })
         }
     },
     mounted(){
         this.editid=this.$route.query.id;
         this.token=JSON.parse(localStorage.getItem('userinif')).token;
+        this.userid=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
         this.getSalesQuoteNo();
         this.getdown();
         this.getGroupInfo();

+ 58 - 8
src/components/OP/OPgroup.vue

@@ -1,5 +1,5 @@
 <template>
-    <div>
+    <div v-loading="fullscreenLoading">
         <div class="group-list">
             <div class="group-title">
                 <div>团组列表</div>
@@ -19,7 +19,7 @@
                     v-model="input"
                     clearable>
                     </el-input>
-                    <el-button @click="Inquireclick()" type="primary">新增团组</el-button>
+                    <el-button @click="addgroup()" type="primary">新增团组</el-button>
                 </div>
             </div>
             <template>
@@ -94,11 +94,11 @@
                         <template slot-scope="scope">
                           <el-button
                             size="mini"
-                            @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
+                            @click="handleEdit(scope.$index, scope.row)"><i class="el-icon-edit"></i></el-button>
                           <el-button
                             size="mini"
                             type="danger"
-                            @click="handleDelete(scope.$index, scope.row)">删除</el-button>
+                            @click="handleDelete(scope.$index, scope.row,groupDatas)"><i class="el-icon-delete"></i></el-button>
                         </template>
                       </el-table-column>
                 </el-table>
@@ -143,7 +143,9 @@ export default {
             currentPage: 1, // 当前页码
             pageSize: 12 ,// 每页的数据条数
             input:'',
-            token:''
+            token:'',
+            fullscreenLoading:false,
+            userid:''
         }
     },
     methods:{
@@ -198,10 +200,14 @@ export default {
             }
             this.groupDatas=newarr;
         },
+        addgroup(){
+            this.$router.push({path: '/home/Groupedit'});
+        },
         //
         Grouplist(){
             var url="/api/Groups/GetGroupList"
             var that=this
+            that.fullscreenLoading = true;
             this.$axios({
                 method: 'post',
                 url:url,
@@ -254,6 +260,7 @@ export default {
                     })
                     that.groupDatas=that.groupData;
                     console.log(that.groupData)
+                    that.fullscreenLoading = false;
                 }
             })
         },
@@ -305,17 +312,60 @@ export default {
             }
         },
         //编辑
-        handleEdit(index, row) {
+        handleEdit(index, row,rows) {
             console.log(index, row.id);
             this.$router.push({path: '/home/Groupedit?id=' + row.id +''});
         },
         //删除
-        handleDelete(index, row) {
-            console.log(index, row.id);
+        handleDelete(index, row,rows) {
+            this.$confirm('此操作将删除该条信息, 是否继续?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+            }).then(() => {
+                var url="/api/Groups/GroupDel"
+                var that=this
+                console.log(that.userid+'----'+row.id)
+                this.$axios({
+                    method: 'post',
+                    url:url,
+                    headers:{
+                        Authorization:'Bearer '+this.token
+                    },
+                    data:{
+                        portType: 1,
+                        id:row.id,
+                        userId:that.userid
+                    }
+                }).then(function(res){
+                    console.log(res);
+                    if(res.data.code==200){
+                        that.$message({
+                            message:res.data.msg ,
+                            type: 'success',
+                            offset:50
+                        });
+                        rows.splice(index, 1);
+                    }else{
+                        that.$message({
+                            message:res.data.msg ,
+                            type: 'warning',
+                            offset:50
+                        });
+                    }
+                })
+            }).catch(() => {
+                this.$message({
+                    type: 'info',
+                    message: '已取消删除'
+                });          
+            });
+            
         }
     },
     mounted(){
         this.token=JSON.parse(localStorage.getItem('userinif')).token;
+        this.userid=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
         console.log(this.token)
         this.Grouplist();
     }

+ 2 - 0
src/main.js

@@ -10,6 +10,8 @@ import store from './store/index.js';
 
 import axios from 'axios';
 
+import { Message } from "element-ui";
+Vue.prototype.$message = Message 
 Vue.prototype.$axios=axios;
 
 Vue.config.productionTip = false