Bladeren bron

fixed page split in model

maqingyang 1 jaar geleden
bovenliggende
commit
93ab558316

+ 2 - 1
package.json

@@ -3,7 +3,8 @@
   "version": "0.1.0",
   "private": true,
   "scripts": {
-    "serve": "vue-cli-service serve",
+    
+    "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
     "build": "vue-cli-service build"
   },
   "dependencies": {

+ 13 - 3
src/api/index.js

@@ -91,6 +91,14 @@ export function cooperatorProductList(pageNum,pageSize){
             pageSize:pageSize,
         });
 }
+export function getCooperatorByModel(pageNum,pageSize,modelNo){
+    return request.post('/cooperator_product/getCooperatorByModel',
+        {
+            pageNum:pageNum,
+            pageSize:pageSize,
+            modelNo:modelNo,
+        });
+}
 export function findCooperatorProductFieldByNum(productNum){
     return request({
         url: '/cooperator_product/findCooperatorProductFieldByNum/'+ productNum,
@@ -211,10 +219,12 @@ export function fieldInfo(){
     return request.get('/model/getField');
 }
 
-export function modelInfo(){
-    return request.get('/model/getUserModel');
+export function modelInfo(pageNum,pageSize){
+    return request.post('/model/getUserModel',{
+        pageNum:pageNum,
+        pageSize:pageSize,
+    });
 }
-
 export function modelSubmit(model_data){
     return request.post('/model/addModel',{
         modeldata:model_data

+ 11 - 1
src/router/index.js

@@ -492,7 +492,7 @@ var routes = [{
             },
             {
                 path: '/modelEdit',
-                name: '首页',
+                name: '编辑模型',
                 component: () => import('../views/system/modelEdit.vue'),
                 meta: {
                     keepAlive: false,
@@ -500,6 +500,16 @@ var routes = [{
                     menu: 'userinfo'
                 }
             },
+            {
+                path: '/modelModify',
+                name: '修改模型信息',
+                component: () => import('../views/system/modelModify.vue'),
+                meta: {
+                    keepAlive: false,
+                    show: true,
+                    menu: 'userinfo'
+                }
+            },
             {
                 path: '/fieldTemplateEdit',
                 name: '编辑字段模板',

+ 8 - 8
src/views/system/businessAnalysis.vue

@@ -32,50 +32,50 @@
         <div class="line-between-divs"></div>
 
         <el-table :data="businessShowData.slice((currentPage-1)*pagesize,currentPage*pagesize)" style="width: 100%;" @row-click="onButtonClick" stripe>
-          <el-table-column align="center" label="申请编号" width="240">
+          <el-table-column align="center" label="申请编号" >
             <template v-slot="{row}">
               <span>{{ row.businessNum}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="客户名称" width="150">
+          <el-table-column align="center" label="客户名称">
             <template v-slot="{row}">
               <span>{{ row.customerName}}</span>
             </template>
           </el-table-column>
 
 
-          <el-table-column align="center" label="合作方" width="150">
+          <el-table-column align="center" label="合作方" >
             <template v-slot="{row}">
               <span>{{ row.cooperatorName}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="产品名称" width="150">
+          <el-table-column align="center" label="产品名称">
             <template v-slot="{row}">
               <span>{{ row.productName}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="证件号码" width="180">
+          <el-table-column align="center" label="证件号码">
             <template v-slot="{row}">
               <span>{{ row.certificateNum}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="流程状态" width="150">
+          <el-table-column align="center" label="流程状态" >
             <template v-slot="{row}">
               <span>{{ row.status}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="申请时间" width="180">
+          <el-table-column align="center" label="申请时间" >
             <template v-slot="{row}">
               <span>{{ row.createTime}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="经办人员" width="122">
+          <el-table-column align="center" label="经办人员" >
             <template v-slot="{row}">
               <span>自动</span>
             </template>

+ 8 - 8
src/views/system/businessFail.vue

@@ -32,50 +32,50 @@
         <div class="line-between-divs"></div>
 
         <el-table :data="businessShowData.slice((currentPage-1)*pagesize,currentPage*pagesize)" style="width: 100%;" @row-click="onButtonClick" stripe>
-          <el-table-column align="center" label="申请编号" width="240">
+          <el-table-column align="center" label="申请编号">
             <template v-slot="{row}">
               <span>{{ row.businessNum}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="客户名称" width="150">
+          <el-table-column align="center" label="客户名称" >
             <template v-slot="{row}">
               <span>{{ row.customerName}}</span>
             </template>
           </el-table-column>
 
 
-          <el-table-column align="center" label="合作方" width="150">
+          <el-table-column align="center" label="合作方" >
             <template v-slot="{row}">
               <span>{{ row.cooperatorName}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="产品名称" width="150">
+          <el-table-column align="center" label="产品名称">
             <template v-slot="{row}">
               <span>{{ row.productName}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="证件号码" width="180">
+          <el-table-column align="center" label="证件号码">
             <template v-slot="{row}">
               <span>{{ row.certificateNum}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="流程状态" width="150">
+          <el-table-column align="center" label="流程状态" >
             <template v-slot="{row}">
               <span>{{ row.status}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="申请时间" width="180">
+          <el-table-column align="center" label="申请时间" >
             <template v-slot="{row}">
               <span>{{ row.createTime}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="经办人员" width="122">
+          <el-table-column align="center" label="经办人员" >
             <template v-slot="{row}">
               <span>自动</span>
             </template>

+ 8 - 8
src/views/system/businesstodo.vue

@@ -36,50 +36,50 @@
         <div class="line-between-divs"></div>
 
         <el-table :data="businessShowData.slice((currentPage-1)*pagesize,currentPage*pagesize)" style="width: 100%;" @row-click="onButtonClick" stripe>
-          <el-table-column align="center" label="申请编号" width="240">
+          <el-table-column align="center" label="申请编号" >
             <template v-slot="{row}">
               <span>{{ row.businessNum}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="客户名称" width="150">
+          <el-table-column align="center" label="客户名称" >
             <template v-slot="{row}">
               <span>{{ row.customerName}}</span>
             </template>
           </el-table-column>
 
 
-          <el-table-column align="center" label="合作方" width="150">
+          <el-table-column align="center" label="合作方" >
             <template v-slot="{row}">
               <span>{{ row.cooperatorName}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="产品名称" width="150">
+          <el-table-column align="center" label="产品名称" >
             <template v-slot="{row}">
               <span>{{ row.productName}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="证件号码" width="180">
+          <el-table-column align="center" label="证件号码" >
             <template v-slot="{row}">
               <span>{{ row.certificateNum}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="流程状态" width="150">
+          <el-table-column align="center" label="流程状态" >
             <template v-slot="{row}">
               <span>{{ row.status}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="申请时间" width="180">
+          <el-table-column align="center" label="申请时间" >
             <template v-slot="{row}">
               <span>{{ row.createTime}}</span>
             </template>
           </el-table-column>
 
-          <el-table-column align="center" label="经办人员" width="122">
+          <el-table-column align="center" label="经办人员" >
             <template v-slot="{row}">
               <span>自动</span>
             </template>

+ 2 - 3
src/views/system/cooperatorInfo.vue

@@ -57,9 +57,8 @@
                             @current-change="handleCurrentChange"
                             :current-page="currentPage"
                             :page-size="pagesize"
-                             :page-sizes="[5,10,15]"
-
-                             layout="total,jumper,prev, pager, next,sizes"
+                            :page-sizes="[5,10,15]"
+                            layout="total,jumper,prev, pager, next,sizes"
                             :total=totalSize>
               </el-pagination>
             </div>

+ 11 - 11
src/views/system/fieldDerive.vue

@@ -33,59 +33,59 @@
           </el-tab-pane>
           <el-tab-pane label="衍生字段" name="second">
             <el-table :data="fieldDeriveShow" style="width: 100%;" stripe>
-              <el-table-column align="center" label="编号" width="100">
+              <el-table-column align="center" label="编号" >
                 <template v-slot="{row}">
                   <span>{{ row.fieldNo}}</span>
                 </template>
               </el-table-column>
 
 
-              <el-table-column align="center" label="字段名称(中文)" width="140">
+              <el-table-column align="center" label="字段名称(中文)">
                 <template v-slot="{row}">
                   <span>{{ row.nameZh}}</span>
                 </template>
               </el-table-column>
 
-              <el-table-column align="center" label="字段名称(英文)" width="140">
+              <el-table-column align="center" label="字段名称(英文)">
                 <template v-slot="{row}">
                   <span>{{ row.name}}</span>
                 </template>
               </el-table-column>
 
-              <el-table-column align="center" label="提取逻辑" width="100">
+              <el-table-column align="center" label="提取逻辑" >
                 <template v-slot="{row}">
                   <span>{{ row.fetchLogic}}</span>
                 </template>
               </el-table-column>
 
-              <el-table-column align="center" label="类型" width="100">
+              <el-table-column align="center" label="类型" >
                 <template v-slot="{row}">
                   <span>{{ row.type}}</span>
                 </template>
               </el-table-column>
 
-              <el-table-column align="center" label="字段状态" width="100">
+              <el-table-column align="center" label="字段状态" >
                 <template v-slot="{row}">
                   <span>{{ row.status}}</span>
                 </template>
               </el-table-column>
 
-              <el-table-column align="center" label="创建者" width="100">
+              <el-table-column align="center" label="创建者" >
                 <template v-slot="{row}">
                   <span>{{ row.createBy}}</span>
                 </template>
               </el-table-column>
 
-              <el-table-column align="center" label="创建时间" width="150">
+              <el-table-column align="center" label="创建时间" >
                 <template v-slot="{row}">
                   <span>{{ row.createTime}}</span>
                 </template>
               </el-table-column>
 
-                  <el-table-column align="center" label="操作" width="150">
+                  <el-table-column align="center" label="操作" >
                     <template v-slot="{row}">
-                      <el-button size="mini" type="primary" @click="edit(row)">编辑</el-button>
-                      <el-button size="mini" type="danger" @click="fieldDelete(row)">删除</el-button>
+                      <el-button size="mini" type="primary" @click.stop="edit(row)">编辑</el-button>
+                      <el-button size="mini" type="danger" @click.stop="fieldDelete(row)">删除</el-button>
 
                 </template>
               </el-table-column>

+ 17 - 17
src/views/system/fieldInfo.vue

@@ -29,50 +29,50 @@
         <el-tabs v-model="activeName2"  @tab-click="handleClick2" stretch>
           <el-tab-pane label="基础字段"  name="first">
             <el-table :data="fieldBaseShow" style="width: 100%;" stripe>
-              <el-table-column align="center" label="编号" width="100">
+              <el-table-column align="center" label="编号" >
                 <template v-slot="{row}">
                   <span>{{ row.fieldNo}}</span>
                 </template>
               </el-table-column>
 
 
-              <el-table-column align="center" label="字段名称(中文)" width="140">
+              <el-table-column align="center" label="字段名称(中文)" >
                 <template v-slot="{row}">
                   <span>{{ row.nameZh}}</span>
                 </template>
               </el-table-column>
 
-              <el-table-column align="center" label="字段名称(英文)" width="140">
+              <el-table-column align="center" label="字段名称(英文)" >
                 <template v-slot="{row}">
                   <span>{{ row.name}}</span>
                 </template>
               </el-table-column>
 
-              <el-table-column align="center" label="提取逻辑" width="100">
+              <el-table-column align="center" label="提取逻辑" >
                 <template v-slot="{row}">
                   <span>{{ row.fetchLogic}}</span>
                 </template>
               </el-table-column>
 
-              <el-table-column align="center" label="类型" width="100">
+              <el-table-column align="center" label="类型">
                 <template v-slot="{row}">
                   <span>{{ row.type}}</span>
                 </template>
               </el-table-column>
 
-                  <el-table-column prop="state" label="状态" width="100">
+                  <el-table-column prop="state" label="状态" >
                     <template slot-scope="scope">
                       {{ scope.row.state ? '已启用' : '已禁用' }}
                     </template>
                   </el-table-column>
 
-              <el-table-column align="center" label="创建者" width="100">
+              <el-table-column align="center" label="创建者" >
                 <template v-slot="{row}">
                   <span>{{ row.createBy}}</span>
                 </template>
               </el-table-column>
 
-                  <el-table-column align="center" label="创建时间" width="200">
+                  <el-table-column align="center" label="创建时间">
                     <template v-slot="{row}">
                       <span>{{ row.createTime}}</span>
                     </template>
@@ -93,56 +93,56 @@
               </el-tab-pane>
           <el-tab-pane label="衍生字段" name="second">
             <el-table :data="fieldDeriveShow" style="width: 100%;" stripe>
-              <el-table-column align="center" label="编号" width="100">
+              <el-table-column align="center" label="编号" >
                 <template v-slot="{row}">
                   <span>{{ row.fieldNo}}</span>
                 </template>
               </el-table-column>
 
 
-              <el-table-column align="center" label="字段名称(中文)" width="140">
+              <el-table-column align="center" label="字段名称(中文)">
                 <template v-slot="{row}">
                   <span>{{ row.nameZh}}</span>
                 </template>
               </el-table-column>
 
-              <el-table-column align="center" label="字段名称(英文)" width="140">
+              <el-table-column align="center" label="字段名称(英文)" >
                 <template v-slot="{row}">
                   <span>{{ row.name}}</span>
                 </template>
               </el-table-column>
 
-              <el-table-column align="center" label="提取逻辑" width="100">
+              <el-table-column align="center" label="提取逻辑" >
                 <template v-slot="{row}">
                   <span>{{ row.fetchLogic}}</span>
                 </template>
               </el-table-column>
 
-              <el-table-column align="center" label="类型" width="100">
+              <el-table-column align="center" label="类型" >
                 <template v-slot="{row}">
                   <span>{{ row.type}}</span>
                 </template>
               </el-table-column>
 
-              <el-table-column align="center" label="字段状态" width="100">
+              <el-table-column align="center" label="字段状态" >
                 <template v-slot="{row}">
                   <span>{{ row.status}}</span>
                 </template>
               </el-table-column>
 
-              <el-table-column align="center" label="创建者" width="100">
+              <el-table-column align="center" label="创建者" >
                 <template v-slot="{row}">
                   <span>{{ row.createBy}}</span>
                 </template>
               </el-table-column>
 
-              <el-table-column align="center" label="创建时间" width="150">
+              <el-table-column align="center" label="创建时间">
                 <template v-slot="{row}">
                   <span>{{ row.createTime}}</span>
                 </template>
               </el-table-column>
 
-              <el-table-column align="center" label="操作" width="150">
+              <el-table-column align="center" label="操作" >
                 <template v-slot="{row}">
                   <el-button size="mini" type="primary" @click="edit(row)">编辑</el-button>
                   <el-button size="mini" type="danger" @click="delete(row.id)">删除</el-button>

+ 6 - 6
src/views/system/fieldTemplate.vue

@@ -31,40 +31,40 @@
         <el-tabs v-model="activeName2"   stretch>
           <el-tab-pane label="字段表模板"  name="first">
             <el-table :data="templateDataShow" style="width: 100%;" stripe>
-              <el-table-column align="center" label="字段表编号" width="200">
+              <el-table-column align="center" label="字段表编号">
                 <template v-slot="{row}">
                   <span>{{ row.templateNo}}</span>
                 </template>
               </el-table-column>
 
 
-              <el-table-column align="center" label="字段表名称" width="200">
+              <el-table-column align="center" label="字段表名称">
                 <template v-slot="{row}">
                   <span>{{ row.templateName}}</span>
                 </template>
               </el-table-column>
 
 
-              <el-table-column align="center" label="字段表状态" width="170">
+              <el-table-column align="center" label="字段表状态">
                 <template v-slot="{row}">
 
                   <span>{{ row.state ? '已启用' : '已停用' }}</span>
                 </template>
               </el-table-column>
 
-                  <el-table-column align="center" label="创建者" width="140">
+                  <el-table-column align="center" label="创建者" >
                     <template v-slot="{row}">
                       <span>{{ row.createBy}}</span>
                     </template>
                   </el-table-column>
 
-              <el-table-column align="center" label="创建时间" width="170">
+              <el-table-column align="center" label="创建时间" >
                 <template v-slot="{row}">
                   <span>{{ row.createTime}}</span>
                 </template>
               </el-table-column>
 
-              <el-table-column align="center" label="操作" width="170">
+              <el-table-column align="center" label="操作" >
                 <template v-slot="{row}">
                   <el-button size="mini" type="primary" @click="fieldTemplateEdit(row)">编辑</el-button>
                   <el-button size="mini" type="danger" @click="templateDelete(row)">删除</el-button>

+ 15 - 1
src/views/system/modelEdit.vue

@@ -46,7 +46,7 @@
             <div class = "upper_bottom_bar" style="margin-top: 20px" >
                 <el-button :disabled="this.modelState === '已上线'"  round type="success" size="medium" @click="online" style="margin-right: 10px;">部署</el-button>
                 <el-button :disabled="this.modelState === '暂停使用'" round type="danger" size="medium" @click="offline" style="margin-right: 10px;">暂停</el-button>
-                <el-button round type="warning" size="medium" @click="openDialog" style="margin-right: 10px;">修改</el-button>
+                <el-button round type="warning" size="medium" @click="gotoModify" style="margin-right: 10px;">修改</el-button>
                 <el-button round type="primary" size="medium" style="margin-right: 10px;" @click="returnLink" >返回</el-button>
             </div>
             <!-- <div class = "bottom-bar" style="margin-top: 20px" >
@@ -108,6 +108,7 @@
         modelName:this.$route.query.modelName,
         modelType:this.$route.query.modelType,
         modelState:this.$route.query.modelState,
+        filePath: this.$route.query.filePath,
         cooperatorProductData: [],
         cooperatorProductShowData: [],
         type_list: [
@@ -344,6 +345,19 @@
                 this.$message.error('模型名称不可以为空');
             }
         },
+        gotoModify(){
+            this.$router.push({
+                path: '/modelModify',
+                query: {
+                    modelId:this.modelId,
+                    modelNo:this.modelNo,
+                    modelName:this.modelName,
+                    modelType:this.modelType,
+                    modelState: this.modelState,
+                    filePath:this.filePath,
+                }
+            })
+        }
     },
     fillter: {},
   }

+ 50 - 54
src/views/system/modelInfo.vue

@@ -82,32 +82,32 @@
             </el-table-column>
         </el-table>
         
-        <el-pagination
+        <div class="yema">
+          <el-pagination background
                         @size-change="handleSizeChange"
                         @current-change="handleCurrentChange"
                         :current-page="currentPage"
-                        :page-sizes="[10, 20, 30, 40]"
-                        :page-size="pageSize"
-                        layout="total,jumper,prev, pager, next,sizes"
-                        :total="totalRows"
-                    ></el-pagination>
+                        :page-size="pagesize"
+                         :page-sizes="[5,10,15]"
+
+                         layout="total,jumper,prev, pager, next,sizes"
+                        :total=totalSize >
+          </el-pagination>
+        </div>
         <div class = "bottom-bar" style="margin-top: 20px" >
                 <el-button round type="primary" size="medium" style="position: absolute; left: 55%;" @click="returnLink" >返回</el-button>
         </div>
         </el-main>
         
       </el-container>
-            
-      <div class="yema">
-  
-  </div>
     </div>
   </template>
   
   <script>
   
   import {
-    cooperatorProductList
+    cooperatorProductList,
+    getCooperatorByModel
   } from '@/api/index.js'
   import store from "@/store";
   import request from '@/utils/request.js'
@@ -120,15 +120,15 @@
     components: {},
     data() {
       return {
-        // cooperatorName : this.$route.query.cooperatorName,
+        activeKey: 0,
+        currentPage: 1,
+        pagesize:10,
+        totalSize:'',
         modelNo:this.$route.query.modelNo,
         modelName:this.$route.query.modelName,
         filePath:this.$route.query.filePath,
         cooperatorProductData: [],
-        cooperatorProductShowData: [],
-        currentPage:1,
-        pageSize:10,
-        totalRows:0
+        cooperatorProductShowData:[],
       }
     },
     watch: {},
@@ -138,55 +138,51 @@
     beforeMount() {},
     mounted() 
     {
-        cooperatorProductList().then((res) => {
-                if (res.data.cooperator_Product_List) {
-                    this.cooperatorProductData = res.data.cooperator_Product_List;
-                    console.log(this.cooperatorProductData);
-                    this.cooperatorProductData=this.cooperatorProductData.filter(item => {
-                        const modelIdMatch = item.modelId==this.$route.query.modelNo;
-                        console.log(item);
-                        console.log(this.$route.query.modelNo);
-                        // return true;
-                        return modelIdMatch;
-                    });
-                    this.loadData();
-                }
-                
-            }
+        getCooperatorByModel(this.currentPage,this.pagesize,this.modelNo).then(
+          res=>
+          {
+            this.cooperatorProductData=res.data.cooperator_Product_List.list;
+            this.cooperatorProductShowData = this.cooperatorProductData;
+            var j = parseInt(res.data.cooperator_Product_List.total);
+            this.totalSize = j;
+          }
         );
     },
     beforeUpdate() {},
     updated() {},
     destroyed() {},
     methods: {
-      loadData() {
-            // 模拟异步请求数据
-            setTimeout(() => {
-                // 根据当前页码和每页显示的数据条数计算起始索引和结束索引
-                const startIndex = (this.currentPage - 1) * this.pageSize;
-                const endIndex = startIndex + this.pageSize;
-                // 截取指定范围的数据
-                const data = this.cooperatorProductData.slice(startIndex, endIndex);
-                this.cooperatorProductShowData = data;
-                this.totalRows = this.cooperatorProductData.length;
-            }, 500);
-        },
+      handleCurrentChange:function(currentPage){
+        this.currentPage=currentPage;
+        getCooperatorByModel(this.currentPage,this.pagesize,this.modelNo).then(
+            res=>
+            {
+              this.cooperatorProductData=res.data.cooperator_Product_List.list;
+              this.cooperatorProductShowData = this.cooperatorProductData
+
+              // console.log(this.cooperatorShowData[0].cooperatorName)
+            }
+          )
+      },
+      handleSizeChange:function(size){
+        this.pagesize=size;
+        getCooperatorByModel(this.currentPage,this.pagesize,this.modelNo).then(
+            res=>
+            {
+              this.cooperatorProductData=res.data.cooperator_Product_List.list;
+              this.cooperatorProductShowData = this.cooperatorProductData
+
+              // console.log(this.cooperatorShowData[0].cooperatorName)
+            }
+        )
+      },
+
       returnLink()
       {
         //指定跳转地址
         this.$router.push('/userinfo');
       },
-      handleSizeChange(size) {
-            // 每页显示的数据条数发生变化时触发
-            this.pageSize = size;
-            this.currentPage = 1; // 重置当前页码为第一页
-            this.loadData();
-        },
-        handleCurrentChange(page) {
-            // 当前页码发生变化时触发
-            this.currentPage = page;
-            this.loadData();
-        },
+
     },
     fillter: {},
   }

+ 364 - 0
src/views/system/modelModify.vue

@@ -0,0 +1,364 @@
+<template>
+    <div class="container" style="min-height: 100%; padding-bottom: 100px;">
+ 
+   <el-container>
+     <el-aside width="250px">
+         <el-menu
+         default-active="1"
+         class="el-menu-vertical-demo"
+         
+         >
+         <el-menu-item @click="gotolink2" class="vertical-center" index="1">
+             <i class="el-icon-location"></i>
+             <span slot="title">模型列表</span>
+         </el-menu-item>
+         </el-menu>
+     </el-aside>
+     <!-- <div class="line" /> -->
+   <el-main  style="height: 80vh;">
+     <el-form  class="other_model_view" ref="form"  label-width="70px">
+       <el-form-item label="模型名称" width="150px">
+           <el-input v-model="inputValue" style="width:200px"></el-input>
+       </el-form-item>
+ 
+       <el-form-item label="模型类型" width="100px">
+           <el-select v-model="model_type" placeholder="选择模型类型">
+                               <!-- <el-option key="1" label="REC飞行计划" value="Rec_fly"></el-option>
+                               <el-option key="2" label="REC管制操作" value="Rec_control"></el-option>
+                               <el-option key="3" label="自动化系统日志" value="log"></el-option> -->
+                   <el-option v-for='item in type_list' :key="item.key" :label="item.label"
+                   :value="item.key"
+                   />
+           </el-select>
+ 
+       </el-form-item>
+ 
+ <!--      <el-form-item label="输入参数" width="100px">-->
+ <!--          <span> 自定义字段的json类型文件路径 </span>-->
+ 
+ <!--      </el-form-item>-->
+ 
+ 
+ <!--      <el-form-item label="输出参数" width="100px">-->
+ <!--                        <el-button-->
+ <!--                            type="text"-->
+ <!--                            class="red"-->
+ <!--                            @click="outputSetup()"-->
+ <!--                        >新增输出类型</el-button>    -->
+ <!--      </el-form-item>-->
+ 
+       
+ 
+ 
+ 
+       <el-form-item v-if="model_type=='3'" label="端口" width="100px">
+               <el-input v-model="port" style="width:150px"></el-input>
+       </el-form-item>
+ 
+       
+       <el-form-item v-if="model_type=='3'" label="url地址" width="100px">
+               <el-input v-model="url_ad" style="width:150px"></el-input>
+       </el-form-item>
+       
+       <el-form-item  v-if="model_type!='4'" label="选择文件" width="200px">
+             <input type="file" ref="myfile">
+             <span>  文件大小限制:小于50M </span>
+         <!-- <span>{{
+           allChunksUploaded ? "完成" : "上传进度:" + uploadProcess + "%"
+         }}</span> -->
+       </el-form-item>
+   </el-form>
+   <div class = "upper_bottom_bar" style="margin-top: 20px">
+     <el-button round  type="success"  size="medium" style="margin-right: 10px;" @click="confirmModel">确认修改</el-button>
+     <el-button round type="primary" size="medium" style="margin-right: 10px;" @click="returnLink" >返回</el-button>
+   </div>
+ </el-main>
+   </el-container>
+   </div>
+ </template>
+ 
+ <script>
+ import {
+   getList,
+   userInfo,
+   modelSubmit,
+ } from '@/api/index.js'
+ import store from "@/store";
+ import request from '@/utils/request.js'
+ import Axios, { AxiosResponse } from "axios";
+ // import { randomId } from '../../api';
+ export default {
+   name: "mxpz",
+   
+   data() {
+     return {
+       modelId: this.$route.query.modelId,
+       modelNo:this.$route.query.modelNo,
+       modelName:this.$route.query.modelName,
+       modelType:this.$route.query.modelType,
+       modelState:this.$route.query.modelState,
+       filePath: this.$route.query.filePath,
+       inputValue:this.$route.query.modelName,
+       upload_file:"",
+       allChunksUploaded:false,
+       uploadProcess:0,
+       chunkSize:50*1024*1024,
+       port:"",
+       url_ad:"",
+       model_name:"",
+       model_type:"",
+       output_list:[
+ 
+       ],
+       type_list:[
+         {
+           key:1,
+            label:"jar包"
+         },
+                {
+           key:2,
+            label:"python包"
+         },
+         {
+           key:3,
+            label:"http服务"
+         },
+         {
+           key:4,
+           label:"空模型"
+         },
+       ],
+     }
+   },
+   mounted() {
+   },
+   methods: {
+    confirmModel() {
+            if (this.inputValue !== '') {
+            this.modelName=this.inputValue;
+            
+            console.log(this.modelName);
+            console.log(this.modelNo);
+            request.post('model/changeModelName',
+                {
+                    modelName:this.modelName,
+                    modelNo:this.modelNo,
+                }
+            );
+            this.$message.success('修改成功');
+            this.$router.push({
+                path: '/modelEdit',
+                query: {
+                    modelId:this.modelId,
+                    modelNo:this.modelNo,
+                    modelName:this.modelName,
+                    modelType:this.modelType,
+                    modelState: this.modelState,
+                    filePath:this.filePath,
+                }
+            })
+            }
+            else{
+                this.$message.error('模型名称不可以为空');
+            }
+        },
+     returnLink()
+       {
+         //指定跳转地址
+         this.$router.push({
+                path: '/modelEdit',
+                query: {
+                    modelId:this.modelId,
+                    modelNo:this.modelNo,
+                    modelName:this.modelName,
+                    modelType:this.modelType,
+                    modelState: this.modelState,
+                    filePath:this.filePath,
+                }
+            })
+       },
+     getFile(event)
+      {
+         let file = event.target.files[0];
+        
+     },
+     outputSetup()
+     {
+           //这个地方应该有dialog显示入参类型
+     },
+     submit_model()
+     {
+      
+       if(this.model_name=="")
+       {
+         this.$alert("请输入模型名称");
+         return;
+       }
+ 
+       if(this.model_type=="")
+       {
+          this.$alert("请选择模型类型");
+          return;
+       }
+       
+ 
+       let myfile = this.$refs.myfile;
+       let files = myfile.files;
+       let file = files[0];
+       let fileName = file.name;
+         let index = fileName.lastIndexOf(".");
+         if (index != -1) {
+             let suffix = fileName.substr(index + 1).toLowerCase();
+             if (suffix != 'jar' &&  suffix != 'py' && suffix!='war' ) {
+                 this.$alert("请上传正确格式文件!后缀为jar/py/war");
+             }
+         }
+       this.upload_file=file;
+       this.handleUpload();
+       this.$router.push('/userinfo');
+     },
+     makeChunks(file) {
+     const fileChunks={
+       file,
+       chunks: [],
+     };
+     if (file.size < this.chunkSize) {
+       fileChunks.chunks.push({ start: 0, end: file.size });
+       return fileChunks;
+     }
+     let chunksLength;
+     if (file.size % this.chunkSize === 0) {
+       chunksLength = Math.round(Math.floor(file.size / this.chunkSize));
+     } else {
+       chunksLength = Math.round(Math.floor(file.size / this.chunkSize)) + 1;
+     }
+     let leftSize = file.size;
+     while (leftSize > 0) {
+       const start = fileChunks.chunks.length * this.chunkSize;
+       const end =
+         start + this.chunkSize >= file.size
+           ? file.size
+           : start + this.chunkSize;
+       leftSize -= end - start;
+       fileChunks.chunks.push({ start, end });
+     }
+     return fileChunks;
+   },
+   randomId() {
+     let str = "";
+     for (let i = 0; i < 4; i++) {
+       str += Math.random()
+         .toString()
+         .replace(/\./, "");
+     }
+     str = "uid" + str;
+     // 取前32位随机字符,不足补0
+     return str.length >= 32
+       ? str.substr(0, 32)
+       : str + repeat("0", 32 - str.length);
+   },
+   handleUpload() {
+     console.log(`file: ${JSON.stringify(this.upload_file)}`);
+     const fileChunks = this.makeChunks(this.upload_file);
+     // 重置上传进度的状态
+     this.allChunksUploaded = false;
+     this.uploadProcess = 0;
+     // 计算上传进度
+     // const calUploadProcess = (): number => {
+     //   let uploadedCount = 0;
+     //   _.each(allChunksUploadStatus, (item) => {
+     //     if (item) uploadedCount++;
+     //   });
+     //   return new Number(
+     //     ((uploadedCount * 100) / allChunksUploadStatus.length).toFixed(0)
+     //   ).valueOf();
+     // };
+     // 生成uid,传递给后端,后端根据uid对子文件块进行合并
+     const fileUid =this.randomId();
+     console.log(fileChunks.chunks.length);
+     for(var k in fileChunks.chunks)
+     {
+        var chunk=fileChunks.chunks[k];
+       const formData = new FormData();
+       formData.append("index", k + "");
+       formData.append("chunk", fileChunks.file.slice(chunk.start, chunk.end));
+       formData.append("name", fileChunks.file.name);
+       formData.append("chunksLength", fileChunks.chunks.length + "");
+       formData.append("uid", fileUid);
+       formData.append("output_list", this.output_list)
+       if(this.model_type=="3")
+       {
+         formData.append("model_name",this.model_name+";"+this.port+this.url_ad);
+       }
+       else 
+       {
+         formData.append("model_name",this.model_name);
+       }
+       formData.append("model_type",this.model_type);
+       request.post("/othermodel/fileupload", formData)
+         .catch((reason) => 
+         {
+         console.error(`error: ${JSON.stringify(reason)}`)
+         }
+         )
+         .then((res) => {
+           // if (typeof res === "object") {
+           //   const data = res.data;
+           //   if (isChunkUploadResult(data)) {
+           //     if (data.status) {
+           //       allChunksUploadStatus[index] = true;
+           //       // 更新上传百分比
+           //       this.uploadProcess = calUploadProcess();
+           //       // 更新上传状态
+           //       if (this.uploadProcess === 100) this.allChunksUploaded = true;
+           //     }
+           //   }
+           // }
+           this.$alert("上传成功");
+           location.reload();
+           console.log(res);
+         });
+     }
+ 
+     // location.reload();
+   }
+ 
+   }
+ }
+ </script>
+ 
+ <style scoped>
+ .top_show
+ {
+     margin-bottom: 30px;
+ }
+ .model_add_button{
+ float: right;
+ margin-left:10px
+ }
+ .txt_show
+ {
+   margin-left: 10px;
+ }
+ .el-select
+ {
+ width:200px; 
+ margin-right:10px; 
+ margin-bottom:10px
+ }
+ .line{
+   float: left;
+   width: 0.1em;
+   height: 19.5em;
+   margin-right: 1em;
+   margin-left: 0em;
+   background:#000000;
+ }
+ .upper_bottom_bar{
+     display:flex;
+ }
+ .result_view{
+ 
+   margin-top:20px
+ }
+ </style>

+ 53 - 99
src/views/system/userinfo.vue

@@ -42,63 +42,52 @@
             <div class="line-between-divs"></div>
                 <div class="model_table">
                     <el-table class="info-table" :data="modelShowData" @row-click="showDetail" stripe border style="width: 100%">
-                        <el-table-column align="center" label="模型名称" :width="200">
+                        <el-table-column align="center" label="模型名称" >
                             <template v-slot="{row}">
                                                         <span
                                                         >{{ row.modelName }}</span>
                             </template>
                         </el-table-column>
-                        <el-table-column align="center" label="模型编号" :width="150">
+                        <el-table-column align="center" label="模型编号"  sortable>
                             <template v-slot="{row}">
                                 <span>{{ row.modelNo }}</span>
                             </template>
                         </el-table-column>
-                        <el-table-column align="center" label="状态" :width="120">
+                        <el-table-column align="center" label="状态"  sortable>
                             <template v-slot="{row}">
                                 <span>{{ row.status }}</span>
                             </template>
                         </el-table-column>
 
-                        <el-table-column align="center" label="模型类型" :width="200">
+                        <el-table-column align="center" label="模型类型"  sortable>
                             <template v-slot="{row}">
                                 <span>{{ type_list[row.modelType] }}</span>
                             </template>
                         </el-table-column>
 
-                        <el-table-column align="center" label="创建时间" :width="250">
+                        <el-table-column align="center"  prop="date" label="创建时间"  sortable>
                             <template v-slot="{row}">
                                 <span>{{ row.createTime }}</span>
                             </template>
                         </el-table-column>
 
-                        <el-table-column align="center" label="操作" :width="150">
+                        <el-table-column align="center" label="操作" sortable>
                             <template slot-scope="scope">
-                                <el-button
-                                        type="text"
-
-                                        class="red"
-                                        @click.stop="edit(scope, scope.row)"
-                                >编辑
-                                </el-button>
-                                <el-button
-                                        type="text"
-                                        class="red"
-                                        @click.stop="modelDelet(scope, scope.row)"
-                                >删除
-                                </el-button>
+                                <el-button size="mini" type="primary" @click.stop="edit(scope, scope.row)">编辑</el-button>
+                                <el-button size="mini" type="danger" @click.stop="modelDelet(scope, scope.row)">删除</el-button>
                             </template>
                         </el-table-column>
                     </el-table>
 
                     <el-pagination background
-                        @size-change="handleSizeChange"
-                        @current-change="handleCurrentChange"
-                        :current-page="currentPage"
-                        :page-sizes="[10, 20, 30, 40]"
-                        :page-size="pageSize"
-                        layout="total,jumper,prev, pager, next,sizes"
-                        :total="totalRows"
-                    ></el-pagination>
+                            @size-change="handleSizeChange"
+                            @current-change="handleCurrentChange"
+                            :current-page="currentPage"
+                            :page-size="pagesize"
+                            :page-sizes="[5,10,15]"
+                            layout="total,jumper,prev, pager, next,sizes"
+                            :total=totalSize>
+              </el-pagination>
 
                 </div>
                 <el-dialog
@@ -133,16 +122,16 @@ export default {
     name: "userinfo",
     data() {
         return {
-            userName: "",
-            nickName: "",
-            fieldState: "",
-            fieldData: {},
-            fieldExist: false,
+            activeKey: 0,
+            currentPage: 1,
+            pagesize:10,
             modelShowData: [],
             modelData: [],
-            cooperatorProductData: [],
-            cooperatorProductShowData: [],
-            modelExist: false,
+            // userName: "",
+            // nickName: "",
+            // fieldState: "",
+            // fieldData: {},
+            // fieldExist: false,
             type_list: [
                 "自定义模型",
                 "jar模型",
@@ -168,84 +157,49 @@ export default {
 
             selectedItem: null,
             rowToDelete:null,
-
-            currentPage:1,
-            pageSize:10,
-            totalRows:0,
+            totalSize:'',
             dialogVisible:false
 
         }
     },
     mounted() {
-        userInfo().then((res) => {
-            this.nickName = res.data.nickName;
-            this.userName = res.data.userName;
-            // console.log( res.data);
-
-        });
-        // fieldInfo().then((res)=>{
-        //   if(res.data.fieldData)
-        //   {
-        //       this.fieldExist=true;
-        //       this.fieldData = JSON.parse(res.data.fieldData);
-        //       console.log(res.data);
-        //       this.fieldState=res.data.fieldState;
-        //   }
-        //
+        // userInfo().then((res) => {
+        //     this.nickName = res.data.nickName;
+        //     this.userName = res.data.userName;
         // });
-
-        modelInfo().then((res) => {
-                if (res.data.modelData) {
-                    this.modelExist = true;
-                    this.modelData = res.data.modelData;
-                    this.loadData();
-                    // this.modelShowData = this.modelData;
-                    console.log(this.modelData);
-                }
-            }
-        );
-
-        cooperatorProductList().then((res) => {
-                if (res.data.cooperator_Product_List) {
-                    this.cooperatorProductData = res.data.cooperator_Product_List;
-                    console.log(this.cooperatorProductData);
-                }
-            }
-        );
+        modelInfo(this.currentPage,this.pagesize).then(res=>
+        {   
+            console.log(this.pageSize);
+            this.modelData = res.data.modelData.list;
+            this.modelShowData = this.modelData;
+            var j = parseInt(res.data.modelData.total);
+            this.totalSize = j;
+            // console.log(this.modelShowData[0]);
+        })
     },
     methods: {
-        loadData() {
-            // 模拟异步请求数据
-            setTimeout(() => {
-                // 根据当前页码和每页显示的数据条数计算起始索引和结束索引
-                const startIndex = (this.currentPage - 1) * this.pageSize;
-                const endIndex = startIndex + this.pageSize;
-                // 截取指定范围的数据
-                const data = this.modelData.slice(startIndex, endIndex);
-                this.modelShowData = data;
-                this.totalRows = this.modelData.length;
-            }, 500);
+        handleCurrentChange:function(currentPage) {
+            // 当前页码发生变化时触发
+            this.currentPage=currentPage;
+            modelInfo(this.currentPage,this.pagesize).then(res=>
+                {
+                    this.modelData = res.data.modelData.list;
+                    this.modelShowData = this.modelData;
+                }
+            ) 
         },
-        handleSizeChange(size) {
+        handleSizeChange:function(size){
             // 每页显示的数据条数发生变化时触发
             this.pageSize = size;
-            this.currentPage = 1; // 重置当前页码为第一页
-            this.loadData();
-        },
-        handleCurrentChange(page) {
-            // 当前页码发生变化时触发
-            this.currentPage = page;
-            this.loadData();
+            modelInfo(this.currentPage,this.pagesize).then(res=>
+                {
+                    this.modelData = res.data.modelData.list;
+                    this.modelShowData = this.modelData;
+                }
+            ) 
         },
         showDetail(row) {
             this.selectedItem = row;
-            this.cooperatorProductShowData=this.cooperatorProductData.filter(item => {
-                const modelIdMatch = item.modelId==row.modelNo;
-                console.log(item);
-                console.log(row.modelNo);
-                // return true;
-                return modelIdMatch;
-            });
             this.$router.push({
                 path: '/modelInfo',
                 query: {