liuhj vor 3 Monaten
Ursprung
Commit
c65ac4b1fc
1 geänderte Dateien mit 595 neuen und 5 gelöschten Zeilen
  1. 595 5
      src/components/OP/SharedFile.vue

+ 595 - 5
src/components/OP/SharedFile.vue

@@ -1,19 +1,609 @@
 <template>
     <div class="sharedsile-all">
-        214
+        <div style="color: red;margin-bottom: 5px;">文件类型与团组名称选择哪个就是上传到对应的类型和团组!!!</div>
+        <div style="display: flex;justify-content: space-between;align-items: baseline;">
+            <div class="sharedsile-Groups">
+                <div class="sharedsile-Groups-li">
+                    <label>文件类型:</label>
+                    <el-select @change="QuerySharedFile" v-model="filetype" clearable filterable placeholder="团组选择"
+                        style="width: 150px;">
+                        <el-option v-for="item in filetypelist" :key="item.id" :label="item.name" :value="item.id">
+                        </el-option>
+                    </el-select>
+                </div>
+                <div v-if="filetype == 1412" class="sharedsile-Groups-li">
+                    <label>团组名称:</label>
+                    <el-select @change="QuerySharedFile" v-model="diIdselect" clearable filterable placeholder="团组选择"
+                        style="width: 300px;">
+                        <el-option v-for="item in delegationInfoList" :key="item.id" :label="item.teamName"
+                            :value="item.id">
+                        </el-option>
+                    </el-select>
+                </div>
+            </div>
+            <div>
+                <el-upload class="upload-demo" ref="upload" action="" :multiple="true" :on-change="handleChange"
+                    :on-preview="handlePreview" :on-remove="handleRemove" :file-list="fileList" :auto-upload="false">
+                    <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
+                    <el-button style="margin-left: 10px;" size="small" type="success"
+                        @click="submitUpload">上传到服务器</el-button>
+                    <div slot="tip" class="el-upload__tip">请不要上传过大的文件!</div>
+                </el-upload>
+            </div>
+        </div>
+        <div v-if="tabledata.length!=0" class="share-table">
+            <el-table :data="tabledata" border style="width: 100%">
+                <el-table-column prop="fileName" label="文件名称">
+                </el-table-column>
+                <el-table-column prop="createTime" label="上传时间" width="180">
+                </el-table-column>
+                <el-table-column label="操作" width="200">
+                    <template slot-scope="scope">
+                        <el-button size="mini" @click="Downloadshare(scope.row)" type="primary">下载</el-button>
+                        <el-button size="mini" @click="handleDelete(scope.row)" type="danger">删除</el-button>
+                    </template>
+                </el-table-column>
+            </el-table>
+            <el-pagination style="margin-top: 20px; text-align: center;" background
+                layout="prev, pager, next, sizes, total" :current-page="currentPage" :page-size="pageSize"
+                :page-sizes="[1, 5, 10, 15]" :total="total" @current-change="handlePageChange"
+                @size-change="handleSizeChange">
+            </el-pagination>
+        </div>
+        <div v-if="filetype == 1412" class="sharedsile-ps">PS:请先选择团组再下载!</div>
+        <div v-if="filetype == 1412" class="sharedsile-table">
+            <div class="sharedsile-table-tr">
+                <div class="sharedsile-table-tb tb-name">OP行程单</div>
+                <div class="sharedsile-table-tb tb-type">WORD</div>
+                <div class="sharedsile-table-tb tb-Language">中文</div>
+                <div class="sharedsile-table-tb tb-download">
+                    <el-button size="small" @click="dcwzxc(0)" type="primary">下载</el-button>
+                </div>
+            </div>
+            <div class="sharedsile-table-tr">
+                <div class="sharedsile-table-tb tb-name">OP行程单</div>
+                <div class="sharedsile-table-tb tb-type">PDF</div>
+                <div class="sharedsile-table-tb tb-Language">中文</div>
+                <div class="sharedsile-table-tb tb-download">
+                    <el-button size="small" @click="dcwzxc(1)" type="primary">下载</el-button>
+                </div>
+            </div>
+            <div class="sharedsile-table-tr">
+                <div class="sharedsile-table-tb tb-name">团组名单</div>
+                <div class="sharedsile-table-tb tb-type">WORD</div>
+                <div class="sharedsile-table-tb tb-Language">中文</div>
+                <div class="sharedsile-table-tb tb-download">
+                    <el-button size="small" @click="Exportlist(0)" type="primary">下载</el-button>
+                </div>
+            </div>
+            <div class="sharedsile-table-tr">
+                <div class="sharedsile-table-tb tb-name">团组名单</div>
+                <div class="sharedsile-table-tb tb-type">WORD</div>
+                <div class="sharedsile-table-tb tb-Language">英文</div>
+                <div class="sharedsile-table-tb tb-download">
+                    <el-button size="small" @click="Exportlist(1)" type="primary">下载</el-button>
+                </div>
+            </div>
+            <div class="sharedsile-table-tr">
+                <div class="sharedsile-table-tb tb-name">导出倒推表</div>
+                <div class="sharedsile-table-tb tb-type">WORD</div>
+                <div class="sharedsile-table-tb tb-Language">中文</div>
+                <div class="sharedsile-table-tb tb-download">
+                    <el-button size="small" @click="PostInvertedListFileDownload" type="primary">下载</el-button>
+                </div>
+            </div>
+            <div class="sharedsile-table-tr">
+                <div class="sharedsile-table-tb tb-name">出国出境经费审核计算明细</div>
+                <div class="sharedsile-table-tb tb-type">WORD</div>
+                <div class="sharedsile-table-tb tb-Language">中文</div>
+                <div class="sharedsile-table-tb tb-download">
+                    <el-button size="small" @click="eptschedule(1, 1005)" type="primary">下载</el-button>
+                </div>
+            </div>
+            <div class="sharedsile-table-tr">
+                <div class="sharedsile-table-tb tb-name">因公出国(境)经费测算明细表</div>
+                <div class="sharedsile-table-tb tb-type">WORD</div>
+                <div class="sharedsile-table-tb tb-Language">中文</div>
+                <div class="sharedsile-table-tb tb-download">
+                    <el-button size="small" @click="eptschedule(1, 1006)" type="primary">下载</el-button>
+                </div>
+            </div>
+            <div class="sharedsile-table-tr">
+                <div class="sharedsile-table-tb tb-name">四川省商务厅出国经费财政先行审核表</div>
+                <div class="sharedsile-table-tb tb-type">EXCEL</div>
+                <div class="sharedsile-table-tb tb-Language">中文</div>
+                <div class="sharedsile-table-tb tb-download">
+                    <el-button size="small" @click="eptschedule(1, 1007)" type="primary">下载</el-button>
+                </div>
+            </div>
+            <div class="sharedsile-table-tr">
+                <div class="sharedsile-table-tb tb-name">成都市因公临时出国任务和预算审批意见表(外专培训团专用)</div>
+                <div class="sharedsile-table-tb tb-type">WORD</div>
+                <div class="sharedsile-table-tb tb-Language">中文</div>
+                <div class="sharedsile-table-tb tb-download">
+                    <el-button size="small" @click="eptschedule(1, 1066)" type="primary">下载</el-button>
+                </div>
+            </div>
+            <div class="sharedsile-table-tr">
+                <div class="sharedsile-table-tb tb-name">派员单位出(境)任务和预算审批意见表</div>
+                <div class="sharedsile-table-tb tb-type">WORD</div>
+                <div class="sharedsile-table-tb tb-Language">中文</div>
+                <div class="sharedsile-table-tb tb-download">
+                    <el-button size="small" @click="eptschedule(2, 1008)" type="primary">下载</el-button>
+                </div>
+            </div>
+            <div class="sharedsile-table-tr">
+                <div class="sharedsile-table-tb tb-name">省级单位出(境)经费报销单</div>
+                <div class="sharedsile-table-tb tb-type">WORD</div>
+                <div class="sharedsile-table-tb tb-Language">中文</div>
+                <div class="sharedsile-table-tb tb-download">
+                    <el-button size="small" @click="eptschedule(2, 1009)" type="primary">下载</el-button>
+                </div>
+            </div>
+        </div>
     </div>
 </template>
 <script>
 export default {
-    
+    data() {
+        return {
+            diIdselect: '',
+            delegationInfoList: [],
+            filetype: '',
+            filetypelist: [],
+            pageloadData: {
+                "portType": 1,
+                "pageIndex": 1,
+                "pageSize": 10,
+                "contact": "",
+                "location": "",
+                "client": "",
+                "userid": "",
+                "lvlid": 0,
+                "business": "",
+                "Range": 0,
+                "Category": 0,
+                "operationUserId": 0
+            },
+            token: '',
+            pageId: '',
+            userId: '',
+            fileList: [],
+            tabledata: [],
+            currentPage: 1, // 当前页码
+            pageSize: 5, // 每页显示条数
+            total: 0, // 总条数
+        }
+    },
+    methods: {
+        //基础数据
+        SharedFileInit() {
+            var url = "/api/Groups/SharedFileInit"
+            var that = this
+            this.$axios({
+                method: 'get',
+                url: url,
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    that.delegationInfoList = res.data.data.dropDownGroupList;
+                    that.diIdselect = that.delegationInfoList[0].id;
+                    that.filetypelist = res.data.data.dropDownType;
+                    that.filetype = that.filetypelist[0].id;
+                    that.QuerySharedFile();
+                } else {
+                    that.$message.error(res.data.msg);
+                }
+            })
+        },
+        //页面加载
+        padeload() {
+            var url = "/api/Business/PostGroupNameScreen"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + this.token
+                },
+                data: {
+                    portType: 1,
+                    pageIndex: 1,
+                    pageSize: 9000,
+                    groupName: '',
+                    userId: that.userId == 21 ? -1 : that.userId,
+                }
+            }).then(function (res) {
+                console.log(res)
+                if (res.data.code == 200) {
+                    that.delegationInfoList = res.data.data;
+                    that.diIdselect = that.delegationInfoList[0].id;
+                } else {
+                    that.$message.error(res.data.msg);
+                }
+            })
+        },
+        //文件列表
+        QuerySharedFile() {
+            var url = "/api/Groups/QuerySharedFile"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + this.token
+                },
+                data: {
+                    pageIndex: that.currentPage,
+                    pageSize: that.pageSize,
+                    fileType: that.filetype,
+                    diid: that.filetype != 1412 ? 0 : that.diIdselect,
+                }
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    that.tabledata = res.data.data.fileList;
+                    that.total = res.data.data.totalCount; 
+                } else {
+                    that.$message.error(res.data.msg);
+                }
+            })
+        },
+        // 分页页码改变事件
+        handlePageChange(val) {
+            this.currentPage = val; // 更新当前页码
+            this.QuerySharedFile(); // 重新查询数据
+        },
+
+        // 每页显示条数改变事件
+        handleSizeChange(val) {
+            this.pageSize = val; // 更新每页显示条数
+            this.currentPage = 1; // 重置当前页码
+            this.QuerySharedFile(); // 重新查询数据
+        },
+        //ctable获取团组
+        PostGroupListByCTableAndUserId() {
+            var url = "/api/Business/PostGroupListByCTableAndUserId"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + this.token
+                },
+                data: {
+                    portType: 1,
+                    pageIndex: 1,
+                    pageSize: 9000,
+                    cTable: 1081,
+                    userId: that.userId,
+                    teamName: "",
+                }
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    that.delegationInfoList = res.data.data;
+                    that.diIdselect = that.delegationInfoList[0].id;
+                } else {
+                    that.$message.error(res.data.msg);
+                }
+            })
+        },
+        //导出完整行程
+        dcwzxc(val) {
+            var url = "/api/Groups/ExportTravel"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.token
+                },
+                data: {
+                    diid: that.diIdselect,
+                    isPDF: val
+                }
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    that.$message({
+                        message: res.data.msg,
+                        type: 'success',
+                        offset: 50
+                    });
+                    window.open(res.data.data.replace('C:/Server/File/OA2023/', 'http://132.232.92.186:24/'));
+                } else {
+                    that.$message.error(res.data.msg);
+                }
+            }).catch(function (error) {
+                that.$message.error(error);
+            });
+        },
+        //团组名单
+        Exportlist(val) {
+            var url = "/api/Groups/PostTourClientListDownloadFile"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + this.token
+                },
+                data: {
+                    portType: 1,
+                    userId: that.userId,
+                    pageId: that.pageId,
+                    diId: that.diIdselect,
+                    language: val
+                }
+            }).then(function (res) {
+                console.log(res)
+                if (res.data.code == 200) {
+                    window.location.href = res.data.data
+                    that.$message({
+                        type: 'success',
+                        message: res.data.msg
+                    });
+                } else {
+                    that.$message.error(res.data.msg);
+                }
+            }).catch(function (error) {
+                that.$message.error("下载失败!");
+            });
+        },
+        //导出倒推表
+        PostInvertedListFileDownload() {
+            var url = "/api/Groups/PostInvertedListFileDownload"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.token
+                },
+                data: {
+                    portType: 1,
+                    diId: that.diIdselect
+                }
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    that.$message({
+                        message: res.data.msg,
+                        type: 'success',
+                        offset: 50
+                    });
+                    window.open(res.data.data);
+                } else {
+                    that.$message.error(res.data.msg);
+                }
+            }).catch(function (error) {
+                that.$message.error(error);
+            });
+        },
+        //三公导出
+        eptschedule(val1, val2) {
+            var url = "/api/Groups/PostEnterExitCostDownload"
+            var that = this
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + this.token
+                },
+                data: {
+                    portType: 1,
+                    diId: that.diIdselect,
+                    exportType: val1,
+                    subTypeId: val2
+                }
+            }).then(function (res) {
+                console.log(res)
+                if (res.data.code == 200) {
+                    that.$message({
+                        type: 'success',
+                        message: res.data.msg
+                    });
+                    window.open(res.data.data.url);
+                } else {
+                    that.$message.error(res.data.msg);
+                }
+            })
+        },
+        // 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用,function(file, fileList)
+        handleChange(file, fileList) {
+            // if (fileList.length > 1 && fileList.status !== "fail") {
+            //     fileList.splice(0, 1);
+            // } else if (fileList.status === "fail") {
+            //     errorMsg("上传失败,请重新上传!");
+            //     fileList.splice(0, 1);
+            // }
+            this.fileList = fileList
+        },
+        //上传服务器
+        submitUpload() {
+            var verdict = false
+            //判断是否有文件再上传
+            console.log(this.fileList);
+
+            if (this.fileList.length === 0) {
+                return this.$message.warning('请选取文件后再上传!');
+            }
+            // 下面的代码将创建一个空的FormData对象:
+            const formData = new FormData()
+            // 你可以使用FormData.append来添加键/值对到表单里面;
+            this.fileList.forEach((file) => {
+                if (file.raw != undefined) {
+                    verdict = true;
+                    formData.append('Files', file.raw);
+                }
+            })
+
+            formData.append('Diid', this.filetype != 1412 ? 0 : this.diIdselect);
+            formData.append('Userid', this.userId);
+            formData.append('FileType', this.filetype);
+            if (!verdict) {
+                return
+            }
+            var that = this;
+            var url = "/api/Groups/SharedFileUpload"
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.token
+                },
+                data: formData
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    that.clearFileList(); // 上传成功后清空文件列表
+                    that.QuerySharedFile();
+                    that.$message.success(res.data.msg);
+                    // window.open(res.data.data.url)
+                } else {
+                    that.$message.error(res.data.msg);
+                }
+            })
+        },
+        // 清空文件列表
+        clearFileList() {
+            this.$refs.upload.clearFiles(); // 调用 el-upload 的 clearFiles 方法
+            this.fileList = []; // 清空本地文件列表
+        },
+        handleRemove(file, fileList) {
+            console.log(file, fileList);
+        },
+        handlePreview(file) {
+            console.log(file);
+        },
+        Downloadshare(val) {
+            window.open(val.filePath)
+        },
+        handleDelete(val) {
+            this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+            }).then(() => {
+                var url = "/api/Groups/DeleteSharedFile"
+                var that = this
+                this.$axios({
+                    method: 'post',
+                    url: url,
+                    headers: {
+                        Authorization: 'Bearer '
+                    },
+                    data:{
+                        id: val.id,
+                        userId: that.userId,
+                    }
+                }).then(function (res) {
+                    if(res.data.code==200){
+                        that.$message({
+                            message:res.data.msg ,
+                            type: 'success',
+                        });
+                        that.QuerySharedFile();
+                    }else{
+                        that.$message({
+                            message:res.data.msg ,
+                            type: 'warning',
+                        });
+                    }
+                })
+            }).catch(() => {
+                this.$message({
+                    type: 'info',
+                    message: '已取消删除'
+                });          
+            });
+            
+        }
+    },
+    created() {
+        this.token = JSON.parse(localStorage.getItem('userinif')).token;
+        this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
+        this.pageId = Number(localStorage.getItem('indexs').split('-')[1]);//页面id
+        // this.PostGroupListByCTableAndUserId()
+        this.SharedFileInit();
+
+    }
 }
 </script>
 <style>
-.sharedsile-all{
+.sharedsile-all {
     background-color: #fff;
-    padding: 10px;
+    padding: 20px;
     box-shadow: 0 0 5px #0005;
     border-radius: 10px;
-    min-height: 830px;
+    min-height: 810px;
+}
+
+.sharedsile-Groups {
+    display: flex;
+}
+
+.sharedsile-btn {
+    width: 200px;
+}
+
+.sharedsile-table-tr {
+    display: flex;
+}
+
+.sharedsile-ps {
+    margin-top: 20px;
+    font-size: 14px;
+}
+
+.sharedsile-table {
+    max-height: 700px;
+    border-bottom: 1px solid #DCDFE6;
+    overflow: hidden;
+    overflow: auto;
+}
+
+.sharedsile-table-tr {
+    border-top: 1px solid #DCDFE6;
+}
+
+.sharedsile-table-tb {
+    padding: 10px;
+    text-align: center;
+    border-left: 1px solid #DCDFE6;
+    font-size: 14px;
+    color: #555;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+}
+
+.sharedsile-table-tb:last-child {
+    border-right: 1px solid #DCDFE6;
+}
+
+.tb-name {
+    width: 40%;
+}
+
+.tb-type {
+    width: 25%;
+}
+
+.tb-Language {
+    width: 25%;
+}
+
+.tb-download {
+    width: 10%;
+}
+
+.sharedsile-Groups-li {
+    display: flex;
+    align-items: center;
+    margin-right: 10px;
+}
+
+.sharedsile-Groups-li label {
+    width: 60px;
+}
+
+.share-table {
+    margin-top: 10px;
 }
 </style>