瀏覽代碼

团组信息设置报批时间

liuhj 1 周之前
父節點
當前提交
4792ffaed2
共有 2 個文件被更改,包括 228 次插入12 次删除
  1. 44 7
      src/components/OP/OPgroup.vue
  2. 184 5
      src/components/OP/visaform.vue

+ 44 - 7
src/components/OP/OPgroup.vue

@@ -15,6 +15,14 @@
                 <el-button @click="GroupListFile" type="primary">下载</el-button>
             </div>
         </el-dialog>
+        <el-dialog top="35vh" width="400px" title="设置报批通知时间" :visible.sync="notificationVisible" :close-on-click-modal="false">
+            <el-date-picker style="width:100%;" v-model="stepOperationTime" type="datetime" placeholder="选择日期时间">
+            </el-date-picker>
+            <div class="group-dialog-btn">
+                <el-button @click="notificationVisible = false">取消</el-button>
+                <el-button @click="EnterpriseWeChatNotificationAsyncBaoPi" type="primary">确认</el-button>
+            </div>
+        </el-dialog>
         <div class="group-list">
             <div class="group-box">
                 <div>
@@ -143,7 +151,7 @@
                                 @click="confirmDeparture(scope.$index, scope.row)"><i
                                     class="el-icon-check"></i></el-button>
                             <el-button v-if="scope.row.tourCode != ''" :type="scope.row.step == 2 ? 'primary' : ''"
-                                @click="EnterpriseWeChatNotificationAsyncBaoPi(scope.$index, scope.row)" size="mini"
+                                @click="opentimeTC(scope.$index, scope.row)" size="mini"
                                 :title="scope.row.step == 2 ? '已通知开始业务操作' : '通知国交部各岗位可以开始业务操作'"><i
                                     class="el-icon-check"></i></el-button>
                         </template>
@@ -240,6 +248,10 @@ export default {
             customerleveloptions: [],
             contractVisible: false,
             hetonggroupId: 0,
+            
+            notificationVisible:false,
+            stepOperationTime:'',
+            timeID:'',
         }
     },
     activated() {
@@ -460,12 +472,35 @@ export default {
 
             })
         },
+        //处理时间
+        notificationdisposeTime(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;
+            var hh = date.getHours();
+            hh = hh < 10 ? ('0' + hh) : hh;
+            var mm = date.getMinutes();
+            mm = mm < 10 ? ('0' + mm) : mm;
+            var ss = date.getSeconds();
+            ss = ss < 10 ? ('0' + ss) : ss;
+            let time = y + '-' + m + '-' + d+' '+hh+':'+mm+':'+ss;
+            return time
+        },
+        //open
+        opentimeTC(index,row){
+            this.notificationVisible=true;
+            this.timeID=row.id;
+            this.stepOperationTime=row.stepOperationTime;
+        },
         //报批
-        EnterpriseWeChatNotificationAsyncBaoPi(index, row) {
-            if (row.step == 2) {
-                this.$message.error("已通知开始业务操作,无需重复操作!");
-                return
-            }
+        EnterpriseWeChatNotificationAsyncBaoPi() {
+            // if (row.step == 2) {
+            //     this.$message.error("已通知开始业务操作,无需重复操作!");
+            //     return
+            // }
             var url = "/api/Groups/EnterpriseWeChatNotificationAsyncBaoPi"
             var that = this
             this.$axios({
@@ -476,7 +511,8 @@ export default {
                 },
                 data: {
                     currUserId: that.userid,
-                    diid: row.id,
+                    diid: that.timeID,
+                    stepOperationTime:that.notificationdisposeTime(that.stepOperationTime)
                 }
             }).then(function (res) {
                 if (res.data.code == 200) {
@@ -484,6 +520,7 @@ export default {
                         message: res.data.msg,
                         type: 'success',
                     });
+                    that.notificationVisible=false;
                 } else {
                     that.$message.error(res.data.msg);
                 }

+ 184 - 5
src/components/OP/visaform.vue

@@ -30,11 +30,23 @@
             </div>
         </div>
         <el-row >
-            
-            <el-button type="primary">上传</el-button>
-            
-            <el-button type="primary">一键导出签证</el-button> 
-            
+            <div>
+                <el-upload
+                class="upload-inline"
+                action="#"
+                :multiple="false"
+                :show-file-list="false"
+                :before-upload="beforeWordUpload"
+                :on-change="handleWordFileChange"
+                :auto-upload="false"
+                accept=".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document">
+                    <el-button type="primary" :loading="isUploading">
+                        <span v-if="!isUploading">上传</span>
+                        <span v-else>上传中...</span>
+                    </el-button>
+                </el-upload>
+                <el-button @click="VisaFileDownload" type="primary">一键导出签证</el-button> 
+            </div>
             <!-- <el-button type="primary">一键导省外办</el-button>
             <el-button type="primary">一键导市外办</el-button>
             <el-button type="primary">签证事项表</el-button>
@@ -115,6 +127,9 @@ export default {
             multipleTable: [],
             token: '',
             fileList: [],
+
+            uploadFile: null,           // 当前选中的Word文件
+            isUploading: false,         // 上传状态
         }
     },
     methods: {
@@ -165,6 +180,24 @@ export default {
                 that.getCrm()
             })
         },
+        //导出签证
+        VisaFileDownload() {
+            var url = "api/Groups/VisaFileDownload?groupId="+this.gnamevalue+"&fileTypeId="+this.groupvalues
+            var that = this
+            this.$axios({
+                method: 'get',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + this.token
+                },
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    window.open(res.data.data);
+                }
+            })
+        },
+        
+
         getCrm() {
             this.tableData = [];
             var url = "api/Groups/GetCrmByGroupId"
@@ -244,6 +277,137 @@ export default {
                 }
             })
         },
+
+
+
+         handleWordFileChange(file, fileList) {
+            console.log('文件已选择:', file);
+            this.uploadFile = file.raw;
+            
+            // 选择文件后立即自动上传
+            if (file.status === 'ready') {
+                this.uploadWordFile();
+            }
+        },
+        
+        // 🆕 上传前的验证
+        beforeWordUpload(file) {
+            // 验证文件类型
+            const isWord = file.type === 'application/msword' || 
+                          file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' ||
+                          file.name.endsWith('.doc') || 
+                          file.name.endsWith('.docx');
+            
+            if (!isWord) {
+                this.$message.error('只能上传Word文件(.doc/.docx)!');
+                return false;
+            }
+            // 验证文件大小(限制为10MB)
+            const isLt10M = file.size / 1024 / 1024 < 10;
+            if (!isLt10M) {
+                this.$message.error('文件大小不能超过10MB!');
+                return false;
+            }
+            return true;
+        },
+        
+        // 🆕 执行上传到指定接口
+        async uploadWordFile() {
+            if (!this.uploadFile) {
+                this.$message.warning('请选择Word文件');
+                return;
+            }
+            // 验证文件类型
+            if (!this.beforeWordUpload(this.uploadFile)) {
+                return;
+            }
+            this.isUploading = true;
+            
+            const formData = new FormData();
+            formData.append('visaFile', this.uploadFile);
+            var url = "api/Groups/VisaFileUploadAndUpdate"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + this.token
+                },
+                data: formData,
+                
+            }).then(function (res) {
+                if (res.data.code==200) {
+                    that.isUploading = false;
+                    that.uploadFile = null;
+                }else{
+                    that.isUploading = false;
+                }
+            })
+            // try {
+            //     // 创建FormData对象
+            //     // formData.append('groupId', this.gnamevalue);
+            //     // formData.append('portType', '1');
+                
+            //     // 添加签证国别(如果已选择)
+            //     // if (this.groupvalues) {
+            //     //     formData.append('visaNationality', this.groupvalues);
+            //     // }
+                
+            //     const url = 'api/Groups/VisaFileUploadAndUpdate';
+            //     const response = await this.$axios({
+            //         method: 'post',
+            //         url: url,
+            //         headers: {
+            //             'Authorization': 'Bearer ' + this.token,
+            //             'Content-Type': 'multipart/form-data'
+            //         },
+            //         data: formData
+            //     });
+                
+            //     console.log('上传接口响应:', response);
+                
+            //     if (response.data.code === 200) {
+            //         this.$message.success(response.data.message || '文件上传成功!');
+                    
+            //         // 上传成功后刷新表格数据
+            //         this.getCrm();
+                    
+            //         // 清空上传的文件
+            //         this.uploadFile = null;
+                    
+            //         // 如果接口返回了更新后的数据,可以在这里处理
+            //         if (response.data.data) {
+            //             // 根据实际接口返回的数据结构进行处理
+            //             console.log('接口返回数据:', response.data.data);
+            //         }
+            //     } else {
+            //         this.$message.error(response.data.message || '上传失败,请重试!');
+            //     }
+            // } catch (error) {
+            //     console.error('上传过程中出错:', error);
+                
+            //     let errorMessage = '上传失败,请重试!';
+            //     if (error.response) {
+            //         // 服务器返回了错误状态码
+            //         errorMessage = error.response.data.message || `服务器错误: ${error.response.status}`;
+            //     } else if (error.request) {
+            //         // 请求发出但没有收到响应
+            //         errorMessage = '网络错误,请检查网络连接';
+            //     }
+                
+            //     this.$message.error(errorMessage);
+            // } finally {
+            //     this.isUploading = false;
+            // }
+        },
+        
+        // 🆕 如果需要,可以添加一个手动触发上传的方法
+        triggerUpload() {
+            // 这个方法可以通过编程方式触发文件选择
+            // 如果需要的话,可以添加相关逻辑
+        }
+
+
     },
     mounted() {
         this.token = JSON.parse(localStorage.getItem('userinif')).token;
@@ -349,4 +513,19 @@ export default {
     justify-content: space-between;
     align-items: center;
 }
+
+/* 🆕 添加上传按钮的内联样式 */
+.upload-inline {
+    display: inline-block;
+}
+
+/* 保持原有样式不变 */
+.visa-box {
+    background-color: #fff;
+    padding: 10px;
+    box-shadow: 0 0 5px #0005;
+    border-radius: 10px;
+    min-height: 780px;
+}
+
 </style>