Danj0rr před 11 měsíci
rodič
revize
b9888a179a
1 změnil soubory, kde provedl 124 přidání a 108 odebrání
  1. 124 108
      src/views/system/userinfo.vue

+ 124 - 108
src/views/system/userinfo.vue

@@ -2,28 +2,28 @@
     <div class="container" style="min-height: 100%; padding-bottom: 100px;">
 
         <el-container>
-          <el-aside :width="isCollapse?'65px':'150px'">
-            <el-button   @click = "toggleCollapse" type="primary"
-                         style="display:block;margin:0 auto"
-                         size="medium"
-                         class="el-icon-s-fold">
-            </el-button>
-            <el-menu
-                default-active="1"
-                class="el-menu-vertical-demo"
-                :collapse="isCollapse"
-
-            >
-                <el-menu-item @click="gotolink2" class="vertical-center" index="1">
-                    <i class="el-icon-location"></i>
-                    <span slot="title">模型列表</span>
-                </el-menu-item>
+            <el-aside :width="isCollapse?'65px':'150px'">
+                <el-button @click="toggleCollapse" type="primary"
+                           style="display:block;margin:0 auto"
+                           size="medium"
+                           class="el-icon-s-fold">
+                </el-button>
+                <el-menu
+                        default-active="1"
+                        class="el-menu-vertical-demo"
+                        :collapse="isCollapse"
+
+                >
+                    <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>
-          <el-divider direction="vertical"></el-divider>
+            <el-divider direction="vertical"></el-divider>
 
-          <!-- <div class="line" /> -->
-            <el-main  style="height: 80vh;">
+            <!-- <div class="line" /> -->
+            <el-main style="height: 80vh;">
                 <div class="filter-container">
                     <el-input v-model="input" placeholder="模型名称" style="width: 10%" size="small" clearable/>
                     <el-date-picker
@@ -38,76 +38,80 @@
                             style=" margin-left: 3%; width: 15%"
                             size="small"
                     ></el-date-picker>
-                    <el-button type="primary" icon="el-icon-search" size="small"  
-                            style=" margin-left: 3%; height: 32px"
-                            @click="filterTable">查询
+                    <el-button type="primary" icon="el-icon-search" size="small"
+                               style=" margin-left: 3%; height: 32px"
+                               @click="filterTable">查询
                     </el-button>
-                    <el-button type="primary" round @click="addUserModel" size="small" style="margin-left: auto; height: 32px">新增
+                    <el-button type="primary" round @click="addUserModel" size="small"
+                               style="margin-left: auto; height: 32px">新增
                     </el-button>
                 </div>
                 <el-divider></el-divider>
 
-            <div class="line-between-divs"></div>
+                <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="模型名称" >
+                    <el-table class="info-table" :data="modelShowData" @row-click="showDetail" stripe border
+                              style="width: 100%">
+                        <el-table-column align="center" label="模型名称">
                             <template v-slot="{row}">
                                                         <span
                                                         >{{ row.modelName }}</span>
                             </template>
                         </el-table-column>
-                        <el-table-column align="center" label="模型编号"  >
+                        <el-table-column align="center" label="模型编号">
                             <template v-slot="{row}">
                                 <span>{{ row.modelNo }}</span>
                             </template>
                         </el-table-column>
-                        <el-table-column align="center" label="状态"  >
+                        <el-table-column align="center" label="状态">
                             <template v-slot="{row}">
                                 <span>{{ row.status }}</span>
                             </template>
                         </el-table-column>
 
-                        <el-table-column align="center" label="模型类型"  >
+                        <el-table-column align="center" label="模型类型">
                             <template v-slot="{row}">
                                 <span>{{ type_list[row.modelType] }}</span>
                             </template>
                         </el-table-column>
 
-                        <el-table-column align="center"  prop="date" label="创建时间"  >
+                        <el-table-column align="center" prop="date" label="创建时间">
                             <template v-slot="{row}">
                                 <span>{{ row.createTime }}</span>
                             </template>
                         </el-table-column>
 
-                        <el-table-column align="center" label="操作" >
+                        <el-table-column align="center" label="操作">
                             <template slot-scope="scope">
-                                <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>
+                                <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-size="pagesize"
-                            :page-sizes="[5,10,15]"
-                            layout="total,jumper,prev, pager, next,sizes"
-                            :total=totalSize>
-              </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
-                    title="提示"
-                    :visible.sync="dialogVisible"
-                    width="30%">
+                        title="提示"
+                        :visible.sync="dialogVisible"
+                        width="30%">
                     <span>确认删除这个模型?</span>
                     <span slot="footer" class="dialog-footer">
                         <el-button @click="dialogVisible = false">取消</el-button>
                         <el-button type="primary" @click="confirmDeleteModel">是的,删除模型</el-button>
                     </span>
-                    </el-dialog>
+                </el-dialog>
 
             </el-main>
         </el-container>
@@ -132,7 +136,7 @@ export default {
         return {
             activeKey: 0,
             currentPage: 1,
-            pagesize:10,
+            pagesize: 10,
             modelShowData: [],
             modelData: [],
             // userName: "",
@@ -163,9 +167,9 @@ export default {
             endTime: '',
 
             selectedItem: null,
-            rowToDelete:null,
-            totalSize:'',
-            dialogVisible:false,
+            rowToDelete: null,
+            totalSize: '',
+            dialogVisible: false,
             isCollapse: false,
 
         }
@@ -175,8 +179,7 @@ export default {
         //     this.nickName = res.data.nickName;
         //     this.userName = res.data.userName;
         // });
-        modelInfo(this.currentPage,this.pagesize).then(res=>
-        {   
+        modelInfo(this.currentPage, this.pagesize).then(res => {
             console.log(this.pageSize);
             this.modelData = res.data.modelData.list;
             this.modelShowData = this.modelData;
@@ -186,28 +189,26 @@ export default {
         })
     },
     methods: {
-      toggleCollapse(){
-        this.isCollapse = !this.isCollapse;
-      },
-        handleCurrentChange:function(currentPage) {
+        toggleCollapse() {
+            this.isCollapse = !this.isCollapse;
+        },
+        handleCurrentChange: function (currentPage) {
             // 当前页码发生变化时触发
-            this.currentPage=currentPage;
-            modelInfo(this.currentPage,this.pagesize).then(res=>
-                {
+            this.currentPage = currentPage;
+            modelInfo(this.currentPage, this.pagesize).then(res => {
                     this.modelData = res.data.modelData.list;
                     this.modelShowData = this.modelData;
                 }
-            ) 
+            )
         },
-        handleSizeChange:function(size){
+        handleSizeChange: function (size) {
             // 每页显示的数据条数发生变化时触发
             this.pageSize = size;
-            modelInfo(this.currentPage,this.pagesize).then(res=>
-                {
+            modelInfo(this.currentPage, this.pagesize).then(res => {
                     this.modelData = res.data.modelData.list;
                     this.modelShowData = this.modelData;
                 }
-            ) 
+            )
         },
         showDetail(row) {
             this.selectedItem = row;
@@ -215,13 +216,13 @@ export default {
             this.$router.push({
                 path: '/modelInfo',
                 query: {
-                    modelId:this.selectedItem.id,
-                    modelNo:this.selectedItem.modelNo,
-                    modelName:this.selectedItem.modelName,
-                    filePath:this.selectedItem.filePath
+                    modelId: this.selectedItem.id,
+                    modelNo: this.selectedItem.modelNo,
+                    modelName: this.selectedItem.modelName,
+                    filePath: this.selectedItem.filePath
                 }
             })
-            
+
         },
         filterTable() {
             const nameFilter = this.input.toLowerCase();
@@ -278,7 +279,7 @@ export default {
                             path: '/mxpz',
                             query: {
                                 modelName: row.modelName,
-                                model: res.data.model,selectedItem,
+                                model: res.data.model, selectedItem,
                                 modelId: row.id,
                                 isChange: 1
                             }
@@ -294,12 +295,12 @@ export default {
             this.$router.push({
                 path: '/modelEdit',
                 query: {
-                    modelId:row.id,
-                    modelNo:this.selectedItem.modelNo,
-                    modelName:this.selectedItem.modelName,
-                    modelType:this.selectedItem.modelType,
+                    modelId: row.id,
+                    modelNo: this.selectedItem.modelNo,
+                    modelName: this.selectedItem.modelName,
+                    modelType: this.selectedItem.modelType,
                     modelState: row.status,
-                    filePath:this.selectedItem.filePath,
+                    filePath: this.selectedItem.filePath,
                 }
             })
 
@@ -307,7 +308,7 @@ export default {
         //yuan 删除需考虑两个表12.10
         modelDelet(scope, row) {
             this.dialogVisible = true;
-            this.rowToDelete=row;
+            this.rowToDelete = row;
             // this.$dialog
             //     .confirm('确认删除?',
             //       )
@@ -323,14 +324,22 @@ export default {
 
             //     });
         },
-        confirmDeleteModel(){
+        confirmDeleteModel() {
             this.dialogVisible = false
             request.post('/model/deleteModel',
                 {
-                    modelid:  this.rowToDelete.id,
-                    fieldCombine:  this.rowToDelete.fieldCombine,
-                });
-            location.reload();
+                    modelid: this.rowToDelete.id,
+                    fieldCombine: this.rowToDelete.fieldCombine,
+                })
+                .then(
+                    res => {
+                        this.$message({
+                            message: '删除成功',
+                            type: 'success'
+                        });
+                        location.reload();
+                    }
+                );
         }
     }
 }
@@ -340,19 +349,22 @@ export default {
 .field_lookup_button {
     margin-left: 20px;
 }
+
 /deep/ .el-table th {
-  /* 样式设置 */
-  background: #f2f2f2;
-  color: #333;
+    /* 样式设置 */
+    background: #f2f2f2;
+    color: #333;
 }
-.line{
-  float: left;
-  width: 0.1em;
-  height: 19.5em;
-  margin-right: 1em;
-  margin-left: 0em;
-  background:#000000;
+
+.line {
+    float: left;
+    width: 0.1em;
+    height: 19.5em;
+    margin-right: 1em;
+    margin-left: 0em;
+    background: #000000;
 }
+
 .name_show {
     margin-left: 10px;
     margin-top: 10px;
@@ -376,29 +388,33 @@ export default {
     margin-top: 20px;
     margin-bottom: 10px;
 }
-.el-menu-vertical-demo{
-  font-weight: bold;
+
+.el-menu-vertical-demo {
+    font-weight: bold;
 }
-.filter-container{
-  display: flex;
+
+.filter-container {
+    display: flex;
 }
+
 .text-between {
-  margin-top: 5px;    /* 调整文本顶部间距 */
-  margin-bottom: 10px; /* 调整文本底部间距 */
+    margin-top: 5px; /* 调整文本顶部间距 */
+    margin-bottom: 10px; /* 调整文本底部间距 */
 }
-.el-icon-s-fold
-{
-  background: rgb(255,255,255);
-  /*font-size: 10px;*/
-  /*Tine-height: 24px;*/
-  color: black;
-  border: none;
-  text-align: center;
-  letter-spacing: 0.2rem;
-  cursor: pointer;
+
+.el-icon-s-fold {
+    background: rgb(255, 255, 255);
+    /*font-size: 10px;*/
+    /*Tine-height: 24px;*/
+    color: black;
+    border: none;
+    text-align: center;
+    letter-spacing: 0.2rem;
+    cursor: pointer;
 }
+
 .el-divider--vertical {
-  height: 47em;
-  margin-left: 20px;
+    height: 47em;
+    margin-left: 20px;
 }
 </style>