Explorar o código

Merge branch 'master' of https://git.cocorobo.cn/CocoRoboLabs/ssti-CollegeManage

yuanyiming %!s(int64=2) %!d(string=hai) anos
pai
achega
cbcea6323a
Modificáronse 1 ficheiros con 99 adicións e 49 borrados
  1. 99 49
      src/views/firm.vue

+ 99 - 49
src/views/firm.vue

@@ -10,10 +10,12 @@
         <div class="selectTwo">
             <div class="selectsBlock">
                 <el-input v-model="input" style="width:200px" placeholder="请输入"></el-input>
-                <el-button type="primary" class="btn2" >查询</el-button>
+                <el-button type="primary" class="btn2" @click="getData()">查询</el-button>
             </div>
         </div>
-        <el-button type="primary" class="btn" @click="selectFile" size="mini">上传文件</el-button>
+        <div class="upFile">
+          <beUpload @getFile="getFile" :navName="'上传文件'" :accept="accept"> </beUpload>
+        </div>
       </div>
       
       <div class="projectBlock">
@@ -26,21 +28,21 @@
         >
        
         <el-table-column
-          prop="projectName"
+          prop="startFile.fileName"
           label="文件名称"
           align="center"
           min-width="25%">
         </el-table-column>
 
         <el-table-column
-          prop="date"
+          prop="create_at"
           label="上传时间"
           align="center"
           min-width="25%">
         </el-table-column>
         
         <el-table-column
-          prop="size"
+          prop="startFile.size"
           label="文件大小"
           align="center"
           min-width="20%">
@@ -55,12 +57,20 @@
           <template #default="scope">
               <div class="operations">
                       <el-button type="primary" class="bt1" size="mini" >查看信息</el-button>
-                      <el-button type="primary" class="bt1" size="mini" @click="del(scope)" >删除</el-button>
+                      <el-button type="primary" class="bt1" size="mini" @click="del(scope.row.startupId)" >删除</el-button>
               </div>
           </template>
         </el-table-column>
       </el-table>
-   
+      <div id="footerPage">
+        <el-pagination
+          background
+          @current-change="changePage"
+          layout="prev, pager, next"
+          :page-size="Page.lim"
+          :total="Page.total">
+        </el-pagination>
+      </div>
       </div>
       
 <!-- 删除通知开始 -->
@@ -72,7 +82,7 @@
       <div class="addDialogLogo">LOGO</div>
       <span class="deleteContent">确定删除文件?</span>
       <span slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="dialogVisible1=false" class="btn5">确认删除</el-button>
+        <el-button type="primary" @click="commitDel" class="btn5">确认删除</el-button>
         <el-button @click="dialogVisible1=false" class="btn5" >取消</el-button>
       </span>
     </el-dialog>
@@ -81,65 +91,92 @@
   </template>
   
   <script>
+  import beUpload from '@/components/tool/beUpload.vue'; 
       export default {
+        components:{beUpload},
         data() {
           return {
+            accept:"*",
             dialogVisible1:false,
+            delId:"",
             input:'',
-            options:[],
-            options1:[],
-            options2:[],
-            options3:[],
-            options4:[],
-            tableData:[{
-            projectName:'创业孵化基地企业情况信息表',
-            date:'2022年11月13日',
-            size:'50k'
-            },
-            {
-              projectName:'创业孵化基地企业情况信息表',
-              size:'50k',
-              date:'2022年11月12日',
-            }
-            ],
-            pavalues:{
-              value:'',
-              value1:'',
-              value2:'',
-              value3:'',
-              value4:'',
+            tableData:[],
+            Page:{
+              nowPage:1,
+              total:0,
+              lim:8,
             }
           }
         },
         methods:{
-          del(){
-            this.dialogVisible1=true
+          del(Id){
+            this.delId = Id;
+            this.dialogVisible1=true;
           },
-          selectFile(){
-            let input = document.createElement('input');
-            input.type='file';
-            input.accept='.doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,.png, .jpg, .jpeg'
-            input.click();
-            input.addEventListener("change",()=>{
-              const fileLiu = input.files[0];
-              console.log(fileLiu);
-              const NowDate = new Date(); 
-              let data = {
-                projectName:fileLiu.name,
-                size:Math.floor(fileLiu.size/1024/1024)+"MB",
-                date:`${NowDate.getFullYear()}年${NowDate.getMonth()+1}月${NowDate.getDate()}日`,
+          commitDel(){
+            this.ajax.post(this.$store.state.api+"/UpdateFirmFileState",{
+              uid:this.$store.state.userInfo.userid,
+              sid:this.delId,
+              st:1
+            }).then(res=>{
+              if(res.data==1){
+                this.$message.success("删除成功");
+              }else{
+                this.$message.error("删除失败");
               }
-              this.tableData.push(data);
-              input.remove();
+              this.getData();
+              this.dialogVisible1 = false;
+              this.delId="";
+            }).catch(err=>{
+              console.log(err);
             })
-          }
-          
+          },
+          changePage(newPage){
+            this.Page.nowPage = newPage;
+            this.getData();
+          },
+          getFile(val){
+            this.ajax.post(this.$store.state.api+"/UploadFirmFile",{
+              uid:this.$store.state.userInfo.userid,
+              file:JSON.stringify(val)
+            }).then(res=>{
+              if(res.data==1){
+                this.$message.success("上传成功")
+              }else{
+                this.$message.error("上传失败")
+              }
+              this.getData();
+            })
+          },
+          getData(){
+            this.tableData = []
+            this.ajax.get(this.$store.state.api+"/GetFirmFile",{
+              uid:this.$store.state.userInfo.userid,
+              tit:this.input,
+              page:this.Page.nowPage,
+              lim:this.Page.lim,
+            }).then(res=>{
+              res.data[0].forEach(item=>{
+                item["startFile"] = JSON.parse(item['startFile']);
+                this.tableData.push(item)
+              })
+              this.Page.total = res.data[1][0]['total']
+            }).catch(err=>{
+              console.log(err)
+            })
+          },
+        },
+        mounted(){
+          this.getData();
         }
       }
   </script>
   
   <style lang="less">
   .firm{
+    width: 100%;
+    height: 100%;
+    position: relative;
     .pAHeader{
       width: 100%;
       display: flex;
@@ -164,6 +201,7 @@
     overflow: hidden;
   }
   .deleteContent{
+    width: 100%;
     margin: 30px 0;
     font-size: 22px;
     color: #000;
@@ -177,6 +215,8 @@
     left: 20px; top: 15px; 
   }
   .el-dialog__header{
+    display: flex;
+    justify-content: center;
   background: #32455b;
   }
   .el-dialog__title{
@@ -228,5 +268,15 @@
       font-size: 16px;
       background: #477edd;
     }
+}
+.upFile{
+  height: 40px !important;
+}
+#footerPage{
+  width: 100%;
+  position: absolute;
+  bottom: 0;
+  display: flex;
+  justify-content: flex-end;
 }
   </style>