陈龙 hai 11 meses
pai
achega
21e323a422

+ 6 - 1
source/OumanMESUni/manifest.json

@@ -68,5 +68,10 @@
     "uniStatistics" : {
         "enable" : false
     },
-    "vueVersion" : "3"
+    "vueVersion" : "3",
+    "h5" : {
+        "devServer" : {
+            "port" : 5174
+        }
+    }
 }

+ 30 - 30
source/OumanMESUni/pages/home/index.vue

@@ -1,52 +1,52 @@
 <template>
 	<view class="content">
-		<image class="logo" src="/static/logo.png"></image>
-		<view class="text-area">
-			<text class="title">{{title}}</text>
-		</view>
+		<view class="card">
+            <view class="card-item" v-for="(item, index) in menus" :key="index" @tap="openPage(item.url)">
+                <view>{{item.text}}</view>
+            </view>
+        </view>
 	</view>
 </template>
 
 <script>
+    import token from '../../utils/token.js';
+    import pages from '../../utils/pages.js';
+    
 	export default {
 		data() {
 			return {
-				title: 'Hello'
+				isLogin: false,
+                menus: []
 			}
 		},
 		onLoad() {
-
+            if (token.has()) {
+                this.isLogin = true;
+            }
+            this.menus = pages.pages;
 		},
 		methods: {
-
+            openPage(url) {
+                uni.navigateTo({
+                    url: url
+                });
+            }
 		}
 	}
 </script>
 
-<style>
+<style lang="scss">
 	.content {
 		display: flex;
-		flex-direction: column;
-		align-items: center;
-		justify-content: center;
-	}
-
-	.logo {
-		height: 200rpx;
-		width: 200rpx;
-		margin-top: 200rpx;
-		margin-left: auto;
-		margin-right: auto;
-		margin-bottom: 50rpx;
-	}
-
-	.text-area {
-		display: flex;
-		justify-content: center;
-	}
-
-	.title {
-		font-size: 36rpx;
-		color: #8f8f94;
+        flex-wrap: wrap;
+        
+        .card {
+            position: relative;
+            display: flex;
+            width: 200upx;
+            height: 200upx;
+            justify-content: center;
+            align-items: center;
+        }
 	}
 </style>

+ 1 - 6
source/OumanMESUni/pages/login/index.vue

@@ -52,13 +52,8 @@
                     data: data
                 });
                 if (res.success) {
-                    let ures = await request.sendToken({
-                        url: api.User.user.url,
-                        method: api.User.user.method
-                    });
+                    let ures = await user.getByServer();
                     if (ures.success) {
-                        user.set(ures.data);
-                        // 登录成功
                         uni.reLaunch({
                             url: '/pages/home/index'
                         });

+ 17 - 11
source/OumanMESUni/pages/login/serverSetting.vue

@@ -5,7 +5,7 @@
         <radio-group @change="radioChange">
             <label class="label" v-for="(item, index) in list" :key="item.id">
                 <view>
-                    <radio :value="item.url" :checked="index === current"></radio>
+                    <radio :value="item.id" :checked="index === current"></radio>
                 </view>
                 <view><text class="code">{{item.text}}</text><text style="padding-left: 8upx;">{{item.url}}</text>
                 </view>
@@ -23,16 +23,16 @@
 
     let storageKey = 'server_setting';
     let setting = {
-        current: -1,
+        id: -1,
         list: [{
             id: 1,
             text: '外网',
-            url: 'http://192.168.100.50/webapi/',
+            url: 'http://192.168.100.51/webapi/',
             editabled: false
         }, {
             id: 2,
             text: '内网',
-            url: 'http://192.168.100.50/webapi2/',
+            url: 'http://192.168.100.51/webapi/',
             editabled: false
         }, {
             id: 3,
@@ -52,23 +52,29 @@
             }
         },
         onLoad() {
+            let id = -1;
             let res = ext.readStorage(storageKey);
             if (ext.isNull(res)) {
                 this.list = setting.list;
-                this.current = setting.current;
                 this.apiUrl = '';
-                this.apiUrl = false;
+                this.disabledInput = false;
+                id = setting.id;
             } else {
                 this.list = res.list;
-                this.current = res.current;
-                this.apiUrl = res.list[res.current].url;
-                this.disabledInput = !res.list[res.current].editabled;
+                id = res.id;
+            }
+            for (let i = 0; i < this.list.length; i++) {
+                if (this.list[i].id === id) {
+                    this.current = i;
+                    this.apiUrl = this.list[this.current].url;
+                    this.disabledInput = !this.list[this.current].editabled;
+                }
             }
         },
         methods: {
             save() {
                 ext.addStorage(storageKey, {
-                    current: this.current,
+                    id: this.list[this.current].id,
                     list: this.list
                 });
                 request.setBaseUrl(this.apiUrl);
@@ -79,7 +85,7 @@
             },
             radioChange(evt) {
                 for (let i = 0; i < this.list.length; i++) {
-                    if (this.list[i].url === evt.detail.value) {
+                    if (this.list[i].id === parseInt(evt.detail.value)) {
                         this.current = i;
                         this.apiUrl = this.list[i].url;
                         this.disabledInput = this.current !== this.list.length - 1;

+ 50 - 21
source/OumanMESUni/utils/api.js

@@ -2,6 +2,35 @@
  * API 接口
  */
 const api = {
+    /**
+     * 人工定额管理
+     */
+    LaborQuota: {
+        /**
+         * 定额详情
+         */
+        Details: {
+            method: 'get',
+            url: 'api/LaborQuota/Details'
+        },
+
+        /**
+         * 分页查询
+         */
+        Search: {
+            method: 'get',
+            url: 'api/LaborQuota/Details'
+        },
+
+        /**
+         * 分页查询(按序展开)
+         */
+        SearchEx: {
+            method: 'get',
+            url: 'api/LaborQuota/SearchEx'
+        }
+    },
+
     /**
      * 定额调整单
      */
@@ -13,7 +42,7 @@ const api = {
             method: 'post',
             url: 'api/LaborQuotaOrder/AdjustOrder/Approve'
         },
-        
+
         /**
          * 调整单详情(含单行)
          */
@@ -21,7 +50,7 @@ const api = {
             method: 'get',
             url: 'api/LaborQuotaOrder/AdjustOrder/Details'
         },
-        
+
         /**
          * 删除调整单行
          */
@@ -29,7 +58,7 @@ const api = {
             method: 'post',
             url: 'api/LaborQuotaOrder/AdjustOrder/Lines/RemoveById'
         },
-        
+
         /**
          * 新增或修改单行
          */
@@ -37,7 +66,7 @@ const api = {
             method: 'post',
             url: 'api/LaborQuotaOrder/AdjustOrder/Lines/SaveOrUpdate'
         },
-        
+
         /**
          * 删除调整单(含单行)
          */
@@ -45,7 +74,7 @@ const api = {
             method: 'post',
             url: 'api/LaborQuotaOrder/AdjustOrder/RemoveById'
         },
-        
+
         /**
          * 保存调整单
          */
@@ -53,7 +82,7 @@ const api = {
             method: 'post',
             url: 'api/LaborQuotaOrder/AdjustOrder/Save'
         },
-        
+
         /**
          * 提交调整单
          */
@@ -61,7 +90,7 @@ const api = {
             method: 'get',
             url: 'api/LaborQuotaOrder/AdjustOrder/Submit'
         },
-        
+
         /**
          * 更新调整单
          */
@@ -70,7 +99,7 @@ const api = {
             url: 'api/LaborQuotaOrder/AdjustOrder/Update'
         }
     },
-    
+
     /**
      * 工序档案
      */
@@ -82,7 +111,7 @@ const api = {
             method: 'get',
             url: 'api/Process/Details'
         },
-        
+
         /**
          * 删除工序档案
          */
@@ -90,7 +119,7 @@ const api = {
             method: 'post',
             url: 'api/Process/RemoveById'
         },
-        
+
         /**
          * 新增工序档案
          */
@@ -98,7 +127,7 @@ const api = {
             method: 'post',
             url: 'api/Process/Save'
         },
-        
+
         /**
          * 查询工序
          */
@@ -106,7 +135,7 @@ const api = {
             method: 'get',
             url: 'api/Process/Search'
         },
-        
+
         /**
          * 更新工序档案
          */
@@ -115,7 +144,7 @@ const api = {
             url: 'api/Process/Update'
         }
     },
-    
+
     /**
      * 工作组档案
      */
@@ -127,7 +156,7 @@ const api = {
             method: 'get',
             url: 'api/WorkingTeam/Details'
         },
-        
+
         /**
          * 删除工作组档案
          */
@@ -135,7 +164,7 @@ const api = {
             method: 'post',
             url: 'api/WorkingTeam/RemoveById'
         },
-        
+
         /**
          * 新增工作组档案
          */
@@ -143,7 +172,7 @@ const api = {
             method: 'post',
             url: 'api/WorkingTeam/Save'
         },
-        
+
         /**
          * 查询工作组
          */
@@ -151,7 +180,7 @@ const api = {
             method: 'get',
             url: 'api/WorkingTeam/Search'
         },
-        
+
         /**
          * 更新工作组档案
          */
@@ -160,7 +189,7 @@ const api = {
             url: 'api/WorkingTeam/Update'
         }
     },
-    
+
     /**
      * 工作级工序
      */
@@ -172,7 +201,7 @@ const api = {
             method: 'post',
             url: 'api/WorkingTeamProcess/Add'
         },
-        
+
         /**
          * 工序详情
          */
@@ -180,7 +209,7 @@ const api = {
             method: 'get',
             url: 'api/WorkingTeamProcess/Details'
         },
-        
+
         /**
          * 关联工序列表
          */
@@ -188,7 +217,7 @@ const api = {
             method: 'get',
             url: 'api/WorkingTeamProcess/List'
         },
-        
+
         /**
          * 移除关联工序
          */

+ 40 - 0
source/OumanMESUni/utils/pages.js

@@ -0,0 +1,40 @@
+/**
+ * 页面
+ */
+class Pages {
+    /**
+     * 人工定额管理
+     */
+    loborQuota = {
+        /**
+         * 人工定额管理首页
+         */
+        index: 'pages/LoborQuota/Index'
+    }
+
+    /**
+     * 定额调整单
+     */
+    loborQuotaOrder = {
+        /**
+         * 定额调整单首页
+         */
+        index: 'pages/LoborQuotaOrder/Index'
+    }
+
+    /**
+     * 页面列表
+     */
+    get pages() {
+        let list = [{
+            text: '人工定额管理',
+            url: this.loborQuota.index
+        }, {
+            text: '定额调整单',
+            url: this.loborQuotaOrder.index
+        }];
+        return list;
+    }
+};
+
+export default new Pages();

+ 1 - 1
source/OumanMESUni/utils/token.js

@@ -94,7 +94,7 @@ export default {
             // user.set(res.data);
             // let token = res.data.Token.token_type + ' ' + res.data.Token.access_token;
             this.set({
-                token: res.data
+                token: 'Bearer ' + res.data
             });
         }
         return res;

+ 16 - 1
source/OumanMESUni/utils/user.js

@@ -1,7 +1,8 @@
 /**
  * 用户类
  */
-import ext from '../utils/extend.js';
+import ext from './extend.js';
+import api from './api.js';
 
 export default {
     /**
@@ -54,5 +55,19 @@ export default {
     clear() {
         ext.removeStorage('login_result');
         ext.removeStorage('login_info');
+    },
+
+    /**
+     * 通过服务器获取用户信息
+     */
+    async getByServer() {
+        let res = await request.sendToken({
+            url: api.User.user.url,
+            method: api.User.user.method
+        });
+        if (res.success) {
+            this.set(res.data);
+        }
+        return res;
     }
 }