戴艳蓉 3 anos atrás
pai
commit
c18b69a527

+ 7 - 7
src/App.vue

@@ -6,7 +6,7 @@
 
 <script>
 import { JudgeEnvironment } from "@/utils/validate";
-import asyncRequest from "@/mock/service/process/oing";
+import asyncRequest from "@/mock/service/stock/survey";
 import { getCode } from "@/utils/dingding";
 export default {
   name: "App",
@@ -16,7 +16,7 @@ export default {
     };
   },
   async created() {
-      const res = await asyncRequest.list(this.parmValue);
+      const res = await asyncRequest.log({},{});
       console.log(res);
       // if (res && res.code === 0 && res.data) {
       //   this.tableData = res.data.list;
@@ -35,11 +35,11 @@ export default {
     //   })
     //   .catch((err) => {});
 
-    // if (JudgeEnvironment() === "isDingDing") {
-    //   await this.testing();
-    // } else {
-    //   await this.getMenu();
-    // }
+    if (JudgeEnvironment() === "isDingDing") {
+      await this.testing();
+    } else {
+      await this.getMenu();
+    }
   },
   methods: {
     async testing() {

+ 2 - 3
src/mock/axios.js

@@ -9,12 +9,11 @@ export default async (
     headers = header,
 ) => {
     return new Promise((resolve, reject) => {
-
+        console.log(url)
         axios
-            .post(`/${url}`, {})
+            .post(`/${url.url||url}`, {})
             .then((res) => {
                 resolve(res.data)
-               
             })
             .catch((err) => {
                 reject(err);

+ 4 - 4
src/mock/index.js

@@ -1,20 +1,18 @@
 import Mock from 'mockjs'
 
 import * as process from './modules/process'
-
+import * as stock from './modules/stock'
 let baseUrl = ""
 let openMock = true
 
 fnCreate(process, openMock)
-
+fnCreate(stock, openMock)
 /**
  * 创建mock模拟数据
  * @param {*} mod 模块
  * @param {*} isOpen 是否开启?
  */
 function fnCreate(mod, isOpen = true) {
-    console.log(mod);
-
     if (isOpen) {
         for (var key in mod) {
             ((res) => {
@@ -24,6 +22,8 @@ function fnCreate(mod, isOpen = true) {
                         url = url + "/"
                     }
                     url = url + res.url
+                    // console.log(url)
+                    // console.log(new RegExp(url))
                     Mock.mock(new RegExp(url), res.type, (opts) => {
                         opts['data'] = opts.body ? JSON.parse(opts.body) : null
                         delete opts.body

+ 1 - 1
src/mock/model/http.js

@@ -1,5 +1,5 @@
 export default {
-    code: "0",
+    code: 0,
     data: {},
     mag: "",
 }

+ 15 - 77
src/mock/modules/process.js

@@ -4,23 +4,24 @@ import Mock from 'mockjs'
 const Random = Mock.Random
 
 export function oingList() { //我的待办列表
-  let model = http
-  list.count = 100
-  list.list = []
+  let model = JSON.parse(JSON.stringify(http)) 
+  let listModel= JSON.parse(JSON.stringify(list)) 
+  listModel.count = 100
+  listModel.list = []
 
   for (let i = 0; i < 15; i++) {
-    list.list.push(Mock.mock({
+    listModel.list.push(Mock.mock({
       id: '@increment',//待办编号
       'title|1': ['备货申请', '采购入库', '咨询确认单审批', '销售确认单审批', '销售出库', '售后退货申请', '售后退货', '采购调拨', '采购盘点'],//流程名称
       orderNo: '@guid',//单据号
       'type|1': ['待审核', '待采购反馈', '待发货', '待收货', '待申请售后'],//当前节点
       timestamp: +Mock.Random.date('T'),//停留时间
       author: '@cname',//发起人
-      reviewer: '@ctitle',//发起部门
+      'reviewer|1': ['采购部', '网络部', '信息部', '财务部', '客服部', '项目部', '人事部'],//发起部门
       addTime: '@datetime', //创建时间
     }))
   }
-  model.data = list
+  model.data = listModel
 
   return {
     url: 'process/oingList',
@@ -30,91 +31,28 @@ export function oingList() { //我的待办列表
 }
 
 export function doneList() { //我的已办列表
-  let model = http
-  list.count = 100
-  list.list = []
+  let model = JSON.parse(JSON.stringify(http)) 
+  let listModel= JSON.parse(JSON.stringify(list)) 
+  listModel.count = 100
+  listModel.list = []
 
   for (let i = 0; i < 15; i++) {
-    list.list.push(Mock.mock({
+    listModel.list.push(Mock.mock({
       id: '@increment',//待办编号
       'title|1': ['备货申请', '采购入库', '咨询确认单审批', '销售确认单审批', '销售出库', '售后退货申请', '售后退货', '采购调拨', '采购盘点'],//流程名称
       orderNo: '@guid',//单据号
       'type|1': ['待审核', '待采购反馈', '待发货', '待收货', '待申请售后'],//当前节点
       timestamp: +Mock.Random.date('T'),//停留时间
       author: '@cname',//发起人
-      reviewer: '@ctitle',//发起部门
+      'reviewer|1': ['采购部', '网络部', '信息部', '财务部', '客服部', '项目部', '人事部'],//发起部门
       addTime: '@datetime', //创建时间
     }))
   }
-  model.data = list
+  model.data = listModel
 
   return {
     url: 'process/doneList',
     type: 'post',
     data: model
   }
-}
-
-export function storeListAll() {
-  let model = http
-  model.data = []
-
-  for (let i = 0; i < 50; i++) {
-    let father = Mock.mock({
-      id: '@increment',//id
-      name: '@ctitle(5)',//公司名称
-      child: []
-    })
-    for (let j = 0; j < 10; j++) {
-      father.child.push(Mock.mock({
-        id: '@increment',//id
-        name: '@ctitle(5)',//仓库名称
-      }))
-    }
-
-
-
-    model.data.push(father)
-  }
-  return {
-    url: 'process/storeListAll',
-    type: 'post',
-    data: model
-  }
-}
-
-
-export function statistics() {
-  let model = http
-    model.data= Mock.mock({
-      value1: '@integer(300, 5000)',//当前库存
-      value2: '@integer(300, 5000)',//待入库
-      value3: '@integer(300, 5000)',//待出库
-      value4: '@integer(300, 5000)',//可用库存
-      value5: '@integer(300, 5000)',//在途库存
-    })
-  return {
-    url: 'process/statistics',
-    type: 'post',
-    data: model
-  }
-}
-
-export function storeLog() {
-  let model = http
-    model.data= Mock.mock({
-      value1: '@integer(300, 5000)',//当前库存
-      value2: '@integer(300, 5000)',//待入库
-      value3: '@integer(300, 5000)',//待出库
-      value4: '@integer(300, 5000)',//可用库存
-      value5: '@integer(300, 5000)',//在途库存
-    })
-  return {
-    url: 'process/storeLog',
-    type: 'post',
-    data: model
-  }
-}
-
-
-
+}

+ 77 - 0
src/mock/modules/stock.js

@@ -0,0 +1,77 @@
+import http from "@/mock/model/http"
+import list from "@/mock/model/list"
+import Mock from 'mockjs'
+const Random = Mock.Random
+
+export function stockListAll() {
+  let model = JSON.parse(JSON.stringify(http)) 
+  model.data = []
+
+  for (let i = 0; i < 50; i++) {
+    let father = Mock.mock({
+      id: '@increment',//id
+      name: '@ctitle(5)',//公司名称
+      child: []
+    })
+    for (let j = 0; j < 10; j++) {
+      father.child.push(Mock.mock({
+        id: '@increment',//id
+        name: '@ctitle(5)',//仓库名称
+      }))
+    }
+
+
+
+    model.data.push(father)
+  }
+  return {
+    url: 'stock/stockListAll',
+    type: 'post',
+    data: model
+  }
+}
+
+
+export function statistics() {
+  let model = JSON.parse(JSON.stringify(http)) 
+    model.data= Mock.mock({
+      value1: '@integer(300, 5000)',//当前库存
+      value2: '@integer(300, 5000)',//待入库
+      value3: '@integer(300, 5000)',//待出库
+      value4: '@integer(300, 5000)',//可用库存
+      value5: '@integer(300, 5000)',//在途库存
+    })
+  return {
+    url: 'stock/statistics',
+    type: 'post',
+    data: model
+  }
+}
+
+export function stockLog() {
+  let model = JSON.parse(JSON.stringify(http)) 
+  let listModel= JSON.parse(JSON.stringify(list)) 
+  listModel.count = 100
+  listModel.list = []
+
+  for (let i = 0; i < 15; i++) {
+    listModel.list.push(Mock.mock({
+      id: '@increment',//记录编号
+      author: '@cname',//操作人
+      'reviewer|1': ['采购部', '网络部', '信息部', '财务部', '客服部', '项目部', '人事部'],//操作人部门
+      'type|1': ['待入库', '待出库', '其他入库', '其他出库', '正式入库', '正式出库'],//仓库类型
+      "number|1-100":100,//操作数量
+      'typeo|1': ['采购入库单', '销售出库单', '售后退货', '采购调拨', '采购盘点'],//库存来源
+      addTime: '@datetime', //操作时间
+    }))
+  }
+  model.data = listModel
+  return {
+    url: 'stock/stockLog',
+    type: 'post',
+    data: model
+  }
+}
+
+
+

+ 8 - 0
src/mock/service/process/done/index.js

@@ -0,0 +1,8 @@
+// 账号
+import http from '@/mock/axios'
+const api = 'process/'
+export default {
+  // 分页查询
+  list:  (data, params) => http(api + 'doneList', data, 'post', params),
+ 
+}

+ 3 - 2
src/mock/service/process/oing/index.js

@@ -3,6 +3,7 @@ import http from '@/mock/axios'
 const api = 'process/'
 export default {
   // 分页查询
-  list:  (data, params) => http(api + 'oingList', data, 'post', params),
- 
+  list: (data, params) => http(api + 'oingList', data, 'post', params),
+
 }
+

+ 8 - 0
src/mock/service/stock/oing/index.js

@@ -0,0 +1,8 @@
+// 账号
+import http from '@/mock/axios'
+const api = 'process/'
+export default {
+  // 分页查询
+  list:  (data, params) => http(api + 'oingList', data, 'post', params),
+ 
+}

+ 11 - 0
src/mock/service/stock/survey/index.js

@@ -0,0 +1,11 @@
+// 账号
+import http from '@/mock/axios'
+const api = 'stock/'
+export default {
+    // 统计
+    statistics: (data, params) => http(api + 'statistics', data, 'post', params),
+    // 全部企业&&仓库
+    listAll: (data, params) => http(api + 'stockListAll', data, 'post', params),
+    // 日志
+    log: (data, params) => http(api + 'stockLog', data, 'post', params),
+}

+ 4 - 4
src/views/login/index.vue

@@ -150,10 +150,10 @@ export default {
       ver: "",
       show: false,
       loginForm: {
-        username: "17744520491",
-        password: "dingding123",
-        // username: "15501067031",
-        // password: "wugg123",
+        // username: "17744520491",
+        // password: "dingding123",
+        username: "15501067031",
+        password: "wugg123",
       },
       loginRules: {
         username: [