浏览代码

style(code): 统一代码格式化和语法修复

- 修复 App.vue 中的缩进和空格格式问题
- 统一 api 目录下所有文件中的参数格式 (query 与 query)
- 交换 dictManage.js 中 list 和 updateItem 函数的位置
- 移除多余空行和空白字符
- 将注释格式从 /* */ 统一为 //
- 修复 crontab 组件中的语法格式问题
- 标准化对象属性格式和分号使用
sunny 1 月之前
父节点
当前提交
e161763f11
共有 82 个文件被更改,包括 5377 次插入5509 次删除
  1. 19 19
      src/App.vue
  2. 4 4
      src/api/assembly.js
  3. 5 5
      src/api/breakage.js
  4. 2 2
      src/api/business.js
  5. 1 1
      src/api/dept.js
  6. 11 17
      src/api/dictManage.js
  7. 4 4
      src/api/disassembly.js
  8. 2 2
      src/api/distributor.js
  9. 2 2
      src/api/express.js
  10. 4 5
      src/api/goodsManage.js
  11. 0 3
      src/api/goodsTypeList.js
  12. 2 2
      src/api/guest.js
  13. 0 10
      src/api/organize.js
  14. 42 42
      src/api/public.js
  15. 4 4
      src/api/requisition.js
  16. 4 4
      src/api/retrieval.js
  17. 3 3
      src/api/stockCount.js
  18. 1 2
      src/api/storage.js
  19. 1 1
      src/api/store.js
  20. 7 8
      src/api/supplier.js
  21. 4 4
      src/api/swap.js
  22. 5 6
      src/api/user.js
  23. 2 2
      src/api/vip.js
  24. 1 1
      src/api/warehouse.js
  25. 4 4
      src/api/warehousing.js
  26. 102 102
      src/components/Crontab/day.vue
  27. 74 74
      src/components/Crontab/hour.vue
  28. 146 146
      src/components/Crontab/index.vue
  29. 75 75
      src/components/Crontab/min.vue
  30. 75 75
      src/components/Crontab/month.vue
  31. 531 534
      src/components/Crontab/result.vue
  32. 78 78
      src/components/Crontab/second.vue
  33. 127 127
      src/components/Crontab/week.vue
  34. 85 85
      src/components/Crontab/year.vue
  35. 23 23
      src/components/RightToolbar/index.vue
  36. 5 5
      src/components/SkuDesc/index.vue
  37. 5 5
      src/components/Tinymce/index.vue
  38. 7 7
      src/main.js
  39. 28 114
      src/permission.js
  40. 105 105
      src/router/index.js
  41. 3 3
      src/store/modules/permission.js
  42. 2 2
      src/store/modules/user.js
  43. 2 2
      src/ui-components/PickerGoods/src/defaultOptions.js
  44. 3 3
      src/ui-components/PickerGoods/src/main.js
  45. 2 2
      src/ui-components/PickerGoods/src/main.vue
  46. 3 3
      src/ui-components/index.js
  47. 20 20
      src/utils/index.js
  48. 16 18
      src/utils/request.js
  49. 11 11
      src/views/basicSetting/express.vue
  50. 10 10
      src/views/basicSetting/store.vue
  51. 388 388
      src/views/basicSetting/supplier.vue
  52. 10 10
      src/views/basicSetting/warehouse.vue
  53. 44 44
      src/views/customer/business.vue
  54. 20 20
      src/views/customer/distributor.vue
  55. 12 12
      src/views/customer/guest.vue
  56. 27 27
      src/views/customer/vip.vue
  57. 7 7
      src/views/dashboard/index.vue
  58. 214 217
      src/views/dictManage/dictDataList.vue
  59. 186 189
      src/views/dictManage/dictList.vue
  60. 6 6
      src/views/goodsManage/brand.vue
  61. 454 457
      src/views/goodsManage/goodsList.vue
  62. 76 76
      src/views/goodsManage/goodsTypeList.vue
  63. 7 7
      src/views/report/stockReport.vue
  64. 98 98
      src/views/stock/assembly/assembly.vue
  65. 170 171
      src/views/stock/assembly/assemblyAdd.vue
  66. 98 98
      src/views/stock/breakage/breakage.vue
  67. 153 154
      src/views/stock/breakage/breakageAdd.vue
  68. 98 98
      src/views/stock/disassembly/disassembly.vue
  69. 173 174
      src/views/stock/disassembly/disassemblyAdd.vue
  70. 98 98
      src/views/stock/requisition/requisition.vue
  71. 199 200
      src/views/stock/requisition/requisitionAdd.vue
  72. 106 106
      src/views/stock/retrieval/retrieval.vue
  73. 180 181
      src/views/stock/retrieval/retrievalAdd.vue
  74. 80 80
      src/views/stock/stockCount/stockCount.vue
  75. 156 157
      src/views/stock/stockCount/stockCountAdd.vue
  76. 98 98
      src/views/stock/swap/swap.vue
  77. 161 162
      src/views/stock/swap/swapAdd.vue
  78. 67 67
      src/views/stock/warehousing/warehousing.vue
  79. 202 203
      src/views/stock/warehousing/warehousingAdd.vue
  80. 39 40
      src/views/sys/admin.vue
  81. 71 71
      src/views/sys/dept.vue
  82. 7 7
      src/views/sys/role.vue

+ 19 - 19
src/App.vue

@@ -5,27 +5,27 @@
 </template>
 
 <script>
-  export default{
-    name: 'APP',
-    provide (){
-      return {
-        reload: this.reload
-      }
-    },
-    data () {
-      return {
-        isRouterAlive:true
-      }
-    },
-    methods: {
-      reload(){
-        this.isRouterAlive = false
-        this.$nextTick(function () {
-          this.isRouterAlive = true
-        })
-      }
+export default {
+  name: 'APP',
+  provide() {
+    return {
+      reload: this.reload
+    }
+  },
+  data() {
+    return {
+      isRouterAlive: true
+    }
+  },
+  methods: {
+    reload() {
+      this.isRouterAlive = false
+      this.$nextTick(function() {
+        this.isRouterAlive = true
+      })
     }
   }
+}
 </script>
 <style>
 #app .theme-picker {

+ 4 - 4
src/api/assembly.js

@@ -12,7 +12,7 @@ export function executeAssembly(query) {
   return request({
     url: '/warehouse-assembly/execute',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -28,7 +28,7 @@ export function readAssembly(query) {
   return request({
     url: '/warehouse-assembly/info',
     method: 'get',
-    params:query
+    params: query
   })
 }
 
@@ -44,7 +44,7 @@ export function deleteAssembly(query) {
   return request({
     url: '/warehouse-assembly/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -52,6 +52,6 @@ export function cancelAssembly(query) {
   return request({
     url: '/warehouse-assembly/cancel',
     method: 'post',
-    params:query
+    params: query
   })
 }

+ 5 - 5
src/api/breakage.js

@@ -12,7 +12,7 @@ export function executeBreakage(query) {
   return request({
     url: '/warehouse-breakage/execute',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -28,7 +28,7 @@ export function readBreakage(query) {
   return request({
     url: '/warehouse-breakage/info',
     method: 'get',
-    params:query
+    params: query
   })
 }
 
@@ -44,7 +44,7 @@ export function deleteBreakage(query) {
   return request({
     url: '/warehouse-breakage/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -52,6 +52,6 @@ export function cancelBreakage(query) {
   return request({
     url: '/warehouse-breakage/cancel',
     method: 'post',
-    params:query
+    params: query
   })
-}
+}

+ 2 - 2
src/api/business.js

@@ -36,7 +36,7 @@ export function deleteBusiness(query) {
   return request({
     url: '/customer-business/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -44,6 +44,6 @@ export function setState(query) {
   return request({
     url: '/customer-business/updateStatus',
     method: 'post',
-    params:query
+    params: query
   })
 }

+ 1 - 1
src/api/dept.js

@@ -49,4 +49,4 @@ export function delDept(deptId) {
     url: '/system/dept/' + deptId,
     method: 'delete'
   })
-}
+}

+ 11 - 17
src/api/dictManage.js

@@ -8,19 +8,19 @@ export function createItem(data) {
   })
 }
 
-export function updateItem(data) {
+export function list(query) {
   return request({
-    url: '/system/dict/type/edit',
-    method: 'post',
-    data
+    url: '/system/dict/type/list',
+    method: 'get',
+    params: query
   })
 }
 
-export function list(query) {
+export function updateItem(data) {
   return request({
-    url: '/system/dict/type/list',
-    method: 'get',
-    params:query
+    url: '/system/dict/type/edit',
+    method: 'post',
+    data
   })
 }
 
@@ -28,7 +28,7 @@ export function deleteitem(query) {
   return request({
     url: '/system/dict/type/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -43,7 +43,7 @@ export function dataList(query) {
   return request({
     url: '/system/dict/data/list',
     method: 'get',
-    params:query
+    params: query
   })
 }
 export function dataAdd(data) {
@@ -64,12 +64,6 @@ export function dataRemove(query) {
   return request({
     url: '/system/dict/data/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }
-
-
-
-
-
-

+ 4 - 4
src/api/disassembly.js

@@ -12,7 +12,7 @@ export function executeDisassembly(query) {
   return request({
     url: '/warehouse-disassembly/execute',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -28,7 +28,7 @@ export function readDisassembly(query) {
   return request({
     url: '/warehouse-disassembly/info',
     method: 'get',
-    params:query
+    params: query
   })
 }
 
@@ -44,7 +44,7 @@ export function deleteDisassembly(query) {
   return request({
     url: '/warehouse-disassembly/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -52,6 +52,6 @@ export function cancelDisassembly(query) {
   return request({
     url: '/warehouse-disassembly/cancel',
     method: 'post',
-    params:query
+    params: query
   })
 }

+ 2 - 2
src/api/distributor.js

@@ -36,7 +36,7 @@ export function deleteDistributor(query) {
   return request({
     url: '/customer-distributor/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -44,6 +44,6 @@ export function setState(query) {
   return request({
     url: '/customer-distributor/updateStatus',
     method: 'post',
-    params:query
+    params: query
   })
 }

+ 2 - 2
src/api/express.js

@@ -36,7 +36,7 @@ export function deleteExpress(query) {
   return request({
     url: 'logistics-company/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -44,6 +44,6 @@ export function setState(query) {
   return request({
     url: 'logistics-company/updateStatus',
     method: 'post',
-    params:query
+    params: query
   })
 }

+ 4 - 5
src/api/goodsManage.js

@@ -1,6 +1,5 @@
 import request from '@/utils/request'
 
-
 export function createItem(data) {
   return request({
     url: '/product/add',
@@ -13,7 +12,7 @@ export function updateItem(query) {
   return request({
     url: '/product/edit',
     method: 'post',
-    data:query
+    data: query
   })
 }
 
@@ -21,7 +20,7 @@ export function goodsList(query) {
   return request({
     url: '/product/page',
     method: 'get',
-    params:query
+    params: query
   })
 }
 
@@ -37,6 +36,6 @@ export function removeItem(query) {
   return request({
     url: '/product/remove',
     method: 'post',
-    params:query
+    params: query
   })
-}
+}

+ 0 - 3
src/api/goodsTypeList.js

@@ -53,6 +53,3 @@ export function delDept(query) {
     params: query
   })
 }
-
-
-

+ 2 - 2
src/api/guest.js

@@ -36,7 +36,7 @@ export function deleteGuest(query) {
   return request({
     url: '/customer-guest/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -44,6 +44,6 @@ export function setState(query) {
   return request({
     url: '/customer-guest/updateStatus',
     method: 'post',
-    params:query
+    params: query
   })
 }

+ 0 - 10
src/api/organize.js

@@ -1,15 +1,6 @@
 import request from '@/utils/request'
 
 export function selectOrg(query) {
-  return request({
-    url: '/organize/selectOrganize',
-    method: 'post',
-    params: query
-  })
-}
-
-
-export function createOrg(query) {
   return request({
     url: '/organize/createOrganize',
     method: 'post',
@@ -65,7 +56,6 @@ export function auditOrganizeInterest(query) {
   })
 }
 
-
 export function selectUserByUserName(query) {
   return request({
     url: '/organize/selectUserByUserName',

+ 42 - 42
src/api/public.js

@@ -1,4 +1,5 @@
 import request from '@/utils/request'
+
 // 添加规则
 export function rulesDetail(query) {
   return request({
@@ -17,51 +18,51 @@ export function updateRule(query) {
 }
 // 获取全部公司
 export function companyTypeList(query) {
-    return request({
-      url: '/sys/user/getCompanys',
-      method: 'post',
-      params:query
-    })
-  }
-  // 获取全部部门
-  export function depTypeList(query) {
-    return request({
-      url: '/sys/user/getDepts',
-      method: 'post',
-      params:query
-    })
-  }
-  //获取全部用户
-  export function allUserList(query) {
-    return request({
-      url: '/sys/user/getAll',
-      method: 'post',
-      params:query
-    })
-  }
+  return request({
+    url: '/sys/user/getCompanys',
+    method: 'post',
+    params: query
+  })
+}
+// 获取全部部门
+export function depTypeList(query) {
+  return request({
+    url: '/sys/user/getDepts',
+    method: 'post',
+    params: query
+  })
+}
+// 获取全部用户
+export function allUserList(query) {
+  return request({
+    url: '/sys/user/getAll',
+    method: 'post',
+    params: query
+  })
+}
 
-  //字典下拉列表
-  export function dataTypeList(query) {
-    return request({
-      url: '/system/dict/data/type',
-      method: 'get',
-      params:query
-    })
-  }
-  // 获取全部商品
-  export function goodsList(query) {
-    return request({
-      url: '/mall-sku/integral/optionselect',
-      method: 'get',
-      params:query
-    })
-  }
+// 字典下拉列表
+export function dataTypeList(query) {
+  return request({
+    url: '/system/dict/data/type',
+    method: 'get',
+    params: query
+  })
+}
+// 获取全部商品
+export function goodsList(query) {
+  return request({
+    url: '/mall-sku/integral/optionselect',
+    method: 'get',
+    params: query
+  })
+}
 // 获取已开启兑换券下拉
 export function couponsList(query) {
   return request({
     url: '/coupon/actOptionselect',
     method: 'get',
-    params:query
+    params: query
   })
 }
 
@@ -70,7 +71,7 @@ export function prizePoolList(query) {
   return request({
     url: '/mall-pool-type/actOptionselect',
     method: 'get',
-    params:query
+    params: query
   })
 }
 
@@ -79,7 +80,6 @@ export function drawPoolList(query) {
   return request({
     url: '/mall-draw-pool/actOptionselect',
     method: 'get',
-    params:query
+    params: query
   })
 }
-  

+ 4 - 4
src/api/requisition.js

@@ -12,7 +12,7 @@ export function executeRequisition(query) {
   return request({
     url: '/warehouse-requisition/execute',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -28,7 +28,7 @@ export function readRequisition(query) {
   return request({
     url: '/warehouse-requisition/info',
     method: 'get',
-    params:query
+    params: query
   })
 }
 
@@ -44,7 +44,7 @@ export function deleteRequisition(query) {
   return request({
     url: '/warehouse-requisition/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -52,6 +52,6 @@ export function cancelRequisition(query) {
   return request({
     url: '/warehouse-requisition/cancel',
     method: 'post',
-    params:query
+    params: query
   })
 }

+ 4 - 4
src/api/retrieval.js

@@ -12,7 +12,7 @@ export function executeRetrieval(query) {
   return request({
     url: '/warehouse-out/execute',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -28,7 +28,7 @@ export function readRetrieval(query) {
   return request({
     url: '/warehouse-out/info',
     method: 'get',
-    params:query
+    params: query
   })
 }
 
@@ -44,7 +44,7 @@ export function deleteRetrieval(query) {
   return request({
     url: '/warehouse-out/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -52,7 +52,7 @@ export function cancelRetrieval(query) {
   return request({
     url: '/warehouse-out/cancel',
     method: 'post',
-    params:query
+    params: query
   })
 }
 

+ 3 - 3
src/api/stockCount.js

@@ -12,7 +12,7 @@ export function executeStockCount(query) {
   return request({
     url: '/warehouse-stockCount/execute',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -28,7 +28,7 @@ export function readStockCount(query) {
   return request({
     url: '/warehouse-stockCount/info',
     method: 'get',
-    params:query
+    params: query
   })
 }
 
@@ -44,6 +44,6 @@ export function deleteStockCount(query) {
   return request({
     url: '/warehouse-stockCount/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }

+ 1 - 2
src/api/storage.js

@@ -6,7 +6,7 @@ const service = axios.create({
   timeout: 10000 // request timeout
 })
 
-/*批量导入员工福利信息 excel*/
+// 批量导入员工福利信息 excel
 export function insetListWelfare(data) {
   return service({
     url: '/welfare/insertList',
@@ -55,7 +55,6 @@ export function updateStorage(data) {
 }
 
 export function deleteStorage(data) {
-  debugger;
   return service({
     url: '/storage/delete',
     method: 'post',

+ 1 - 1
src/api/store.js

@@ -44,6 +44,6 @@ export function deleteStore(query) {
   return request({
     url: '/store-info/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }

+ 7 - 8
src/api/supplier.js

@@ -1,6 +1,5 @@
 import request from '@/utils/request'
 
-
 export function createSupplier(data) {
   return request({
     url: '/supplier-info/add',
@@ -13,7 +12,7 @@ export function updateSupplier(query) {
   return request({
     url: '/supplier-info/edit',
     method: 'post',
-    data:query
+    data: query
   })
 }
 
@@ -21,7 +20,7 @@ export function listSupplier(query) {
   return request({
     url: '/supplier-info/page',
     method: 'get',
-    params:query
+    params: query
   })
 }
 
@@ -29,7 +28,7 @@ export function supplierList(query) {
   return request({
     url: '/supplier-info/list',
     method: 'get',
-    params:query
+    params: query
   })
 }
 
@@ -37,7 +36,7 @@ export function deleteSupplier(query) {
   return request({
     url: '/supplier-info/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -45,7 +44,7 @@ export function typeListSupplier(query) {
   return request({
     url: '/supplier-info/list/type',
     method: 'get',
-    params:query
+    params: query
   })
 }
 
@@ -53,6 +52,6 @@ export function setStateSupplier(query) {
   return request({
     url: '/supplier-info/updateStatus',
     method: 'post',
-    params:query
+    params: query
   })
-}
+}

+ 4 - 4
src/api/swap.js

@@ -12,7 +12,7 @@ export function executeSwap(query) {
   return request({
     url: '/warehouse-swap/execute',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -28,7 +28,7 @@ export function readSwap(query) {
   return request({
     url: '/warehouse-swap/info',
     method: 'get',
-    params:query
+    params: query
   })
 }
 
@@ -44,7 +44,7 @@ export function deleteSwap(query) {
   return request({
     url: '/warehouse-swap/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -52,6 +52,6 @@ export function cancelSwap(query) {
   return request({
     url: '/warehouse-swap/cancel',
     method: 'post',
-    params:query
+    params: query
   })
 }

+ 5 - 6
src/api/user.js

@@ -1,6 +1,6 @@
 import request from '@/utils/request'
 
-/*查询校友录列表*/
+// 查询校友录列表
 export function fetchList(query) {
   return request({
     url: '/user/list',
@@ -17,14 +17,13 @@ export function exportAllUser(query) {
   })
 }
 
-/*查询游客列表*/
+// 查询游客列表
 export function fetYKList(query) {
   return request({
-    url:'/user/findYKList',
-    method:'get',
-    params:query
+    url: '/user/findYKList',
+    method: 'get',
+    params: query
   })
-
 }
 
 export function fetchCheckUserList(query) {

+ 2 - 2
src/api/vip.js

@@ -36,7 +36,7 @@ export function deleteVip(query) {
   return request({
     url: '/customer-vip/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -44,7 +44,7 @@ export function setState(query) {
   return request({
     url: '/customer-vip/updateStatus',
     method: 'post',
-    params:query
+    params: query
   })
 }
 

+ 1 - 1
src/api/warehouse.js

@@ -44,6 +44,6 @@ export function deleteWarehouse(query) {
   return request({
     url: '/warehouse-info/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }

+ 4 - 4
src/api/warehousing.js

@@ -12,7 +12,7 @@ export function executeWarehousing(query) {
   return request({
     url: '/warehouse-entry/execute',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -28,7 +28,7 @@ export function readWarehousing(query) {
   return request({
     url: '/warehouse-entry/info',
     method: 'get',
-    params:query
+    params: query
   })
 }
 
@@ -44,7 +44,7 @@ export function deleteWarehousing(query) {
   return request({
     url: '/warehouse-entry/remove',
     method: 'post',
-    params:query
+    params: query
   })
 }
 
@@ -52,6 +52,6 @@ export function cancelWarehousing(query) {
   return request({
     url: '/warehouse-entry/cancel',
     method: 'post',
-    params:query
+    params: query
   })
 }

+ 102 - 102
src/components/Crontab/day.vue

@@ -54,108 +54,108 @@
 
 <script>
 export default {
-	data() {
-		return {
-			radioValue: 1,
-			workday: 1,
-			cycle01: 1,
-			cycle02: 2,
-			average01: 1,
-			average02: 1,
-			checkboxList: [],
-			checkNum: this.$options.propsData.check
-		}
-	},
-	name: 'crontab-day',
-	props: ['check', 'cron'],
-	methods: {
-		// 单选按钮值变化时
-		radioChange() {
-			('day rachange');
-			if (this.radioValue !== 2 && this.cron.week !== '?') {
-				this.$emit('update', 'week', '?', 'day')
-			}
+  data() {
+    return {
+      radioValue: 1,
+      workday: 1,
+      cycle01: 1,
+      cycle02: 2,
+      average01: 1,
+      average02: 1,
+      checkboxList: [],
+      checkNum: this.$options.propsData.check
+    }
+  },
+  name: 'crontab-day',
+  props: ['check', 'cron'],
+  methods: {
+    // 单选按钮值变化时
+    radioChange() {
+      ('day rachange')
+      if (this.radioValue !== 2 && this.cron.week !== '?') {
+        this.$emit('update', 'week', '?', 'day')
+      }
 
-			switch (this.radioValue) {
-				case 1:
-					this.$emit('update', 'day', '*');
-					break;
-				case 2:
-					this.$emit('update', 'day', '?');
-					break;
-				case 3:
-					this.$emit('update', 'day', this.cycleTotal);
-					break;
-				case 4:
-					this.$emit('update', 'day', this.averageTotal);
-					break;
-				case 5:
-					this.$emit('update', 'day', this.workday + 'W');
-					break;
-				case 6:
-					this.$emit('update', 'day', 'L');
-					break;
-				case 7:
-					this.$emit('update', 'day', this.checkboxString);
-					break;
-			}
-			('day rachange end');
-		},
-		// 周期两个值变化时
-		cycleChange() {
-			if (this.radioValue == '3') {
-				this.$emit('update', 'day', this.cycleTotal);
-			}
-		},
-		// 平均两个值变化时
-		averageChange() {
-			if (this.radioValue == '4') {
-				this.$emit('update', 'day', this.averageTotal);
-			}
-		},
-		// 最近工作日值变化时
-		workdayChange() {
-			if (this.radioValue == '5') {
-				this.$emit('update', 'day', this.workdayCheck + 'W');
-			}
-		},
-		// checkbox值变化时
-		checkboxChange() {
-			if (this.radioValue == '7') {
-				this.$emit('update', 'day', this.checkboxString);
-			}
-		}
-	},
-	watch: {
-		'radioValue': 'radioChange',
-		'cycleTotal': 'cycleChange',
-		'averageTotal': 'averageChange',
-		'workdayCheck': 'workdayChange',
-		'checkboxString': 'checkboxChange',
-	},
-	computed: {
-		// 计算两个周期值
-		cycleTotal: function () {
-			const cycle01 = this.checkNum(this.cycle01, 1, 30)
-			const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 31, 31)
-			return cycle01 + '-' + cycle02;
-		},
-		// 计算平均用到的值
-		averageTotal: function () {
-			const average01 = this.checkNum(this.average01, 1, 30)
-			const average02 = this.checkNum(this.average02, 1, 31 - average01 || 0)
-			return average01 + '/' + average02;
-		},
-		// 计算工作日格式
-		workdayCheck: function () {
-			const workday = this.checkNum(this.workday, 1, 31)
-			return workday;
-		},
-		// 计算勾选的checkbox值合集
-		checkboxString: function () {
-			let str = this.checkboxList.join();
-			return str == '' ? '*' : str;
-		}
-	}
+      switch (this.radioValue) {
+        case 1:
+          this.$emit('update', 'day', '*')
+          break
+        case 2:
+          this.$emit('update', 'day', '?')
+          break
+        case 3:
+          this.$emit('update', 'day', this.cycleTotal)
+          break
+        case 4:
+          this.$emit('update', 'day', this.averageTotal)
+          break
+        case 5:
+          this.$emit('update', 'day', this.workday + 'W')
+          break
+        case 6:
+          this.$emit('update', 'day', 'L')
+          break
+        case 7:
+          this.$emit('update', 'day', this.checkboxString)
+          break
+      }
+      ('day rachange end')
+    },
+    // 周期两个值变化时
+    cycleChange() {
+      if (this.radioValue == '3') {
+        this.$emit('update', 'day', this.cycleTotal)
+      }
+    },
+    // 平均两个值变化时
+    averageChange() {
+      if (this.radioValue == '4') {
+        this.$emit('update', 'day', this.averageTotal)
+      }
+    },
+    // 最近工作日值变化时
+    workdayChange() {
+      if (this.radioValue == '5') {
+        this.$emit('update', 'day', this.workdayCheck + 'W')
+      }
+    },
+    // checkbox值变化时
+    checkboxChange() {
+      if (this.radioValue == '7') {
+        this.$emit('update', 'day', this.checkboxString)
+      }
+    }
+  },
+  watch: {
+    'radioValue': 'radioChange',
+    'cycleTotal': 'cycleChange',
+    'averageTotal': 'averageChange',
+    'workdayCheck': 'workdayChange',
+    'checkboxString': 'checkboxChange'
+  },
+  computed: {
+    // 计算两个周期值
+    cycleTotal: function() {
+      const cycle01 = this.checkNum(this.cycle01, 1, 30)
+      const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 31, 31)
+      return cycle01 + '-' + cycle02
+    },
+    // 计算平均用到的值
+    averageTotal: function() {
+      const average01 = this.checkNum(this.average01, 1, 30)
+      const average02 = this.checkNum(this.average02, 1, 31 - average01 || 0)
+      return average01 + '/' + average02
+    },
+    // 计算工作日格式
+    workdayCheck: function() {
+      const workday = this.checkNum(this.workday, 1, 31)
+      return workday
+    },
+    // 计算勾选的checkbox值合集
+    checkboxString: function() {
+      const str = this.checkboxList.join()
+      return str == '' ? '*' : str
+    }
+  }
 }
 </script>

+ 74 - 74
src/components/Crontab/hour.vue

@@ -35,80 +35,80 @@
 
 <script>
 export default {
-	data() {
-		return {
-			radioValue: 1,
-			cycle01: 0,
-			cycle02: 1,
-			average01: 0,
-			average02: 1,
-			checkboxList: [],
-			checkNum: this.$options.propsData.check
-		}
-	},
-	name: 'crontab-hour',
-	props: ['check', 'cron'],
-	methods: {
-		// 单选按钮值变化时
-		radioChange() {
-			switch (this.radioValue) {
-				case 1:
+  data() {
+    return {
+      radioValue: 1,
+      cycle01: 0,
+      cycle02: 1,
+      average01: 0,
+      average02: 1,
+      checkboxList: [],
+      checkNum: this.$options.propsData.check
+    }
+  },
+  name: 'crontab-hour',
+  props: ['check', 'cron'],
+  methods: {
+    // 单选按钮值变化时
+    radioChange() {
+      switch (this.radioValue) {
+        case 1:
         	this.$emit('update', 'hour', '*')
-        	break;
-				case 2:
-					this.$emit('update', 'hour', this.cycleTotal);
-					break;
-				case 3:
-					this.$emit('update', 'hour', this.averageTotal);
-					break;
-				case 4:
-					this.$emit('update', 'hour', this.checkboxString);
-					break;
-			}
-		},
-		// 周期两个值变化时
-		cycleChange() {
-			if (this.radioValue == '2') {
-				this.$emit('update', 'hour', this.cycleTotal);
-			}
-		},
-		// 平均两个值变化时
-		averageChange() {
-			if (this.radioValue == '3') {
-				this.$emit('update', 'hour', this.averageTotal);
-			}
-		},
-		// checkbox值变化时
-		checkboxChange() {
-			if (this.radioValue == '4') {
-				this.$emit('update', 'hour', this.checkboxString);
-			}
-		}
-	},
-	watch: {
-		'radioValue': 'radioChange',
-		'cycleTotal': 'cycleChange',
-		'averageTotal': 'averageChange',
-		'checkboxString': 'checkboxChange'
-	},
-	computed: {
-		// 计算两个周期值
-		cycleTotal: function () {
-			const cycle01 = this.checkNum(this.cycle01, 0, 22)
-			const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 23)
-			return cycle01 + '-' + cycle02;
-		},
-		// 计算平均用到的值
-		averageTotal: function () {
-			const average01 = this.checkNum(this.average01, 0, 22)
-			const average02 = this.checkNum(this.average02, 1, 23 - average01 || 0)
-			return average01 + '/' + average02;
-		},
-		// 计算勾选的checkbox值合集
-		checkboxString: function () {
-			let str = this.checkboxList.join();
-			return str == '' ? '*' : str;
-		}
-	}
+        	break
+        case 2:
+          this.$emit('update', 'hour', this.cycleTotal)
+          break
+        case 3:
+          this.$emit('update', 'hour', this.averageTotal)
+          break
+        case 4:
+          this.$emit('update', 'hour', this.checkboxString)
+          break
+      }
+    },
+    // 周期两个值变化时
+    cycleChange() {
+      if (this.radioValue == '2') {
+        this.$emit('update', 'hour', this.cycleTotal)
+      }
+    },
+    // 平均两个值变化时
+    averageChange() {
+      if (this.radioValue == '3') {
+        this.$emit('update', 'hour', this.averageTotal)
+      }
+    },
+    // checkbox值变化时
+    checkboxChange() {
+      if (this.radioValue == '4') {
+        this.$emit('update', 'hour', this.checkboxString)
+      }
+    }
+  },
+  watch: {
+    'radioValue': 'radioChange',
+    'cycleTotal': 'cycleChange',
+    'averageTotal': 'averageChange',
+    'checkboxString': 'checkboxChange'
+  },
+  computed: {
+    // 计算两个周期值
+    cycleTotal: function() {
+      const cycle01 = this.checkNum(this.cycle01, 0, 22)
+      const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 23)
+      return cycle01 + '-' + cycle02
+    },
+    // 计算平均用到的值
+    averageTotal: function() {
+      const average01 = this.checkNum(this.average01, 0, 22)
+      const average02 = this.checkNum(this.average02, 1, 23 - average01 || 0)
+      return average01 + '/' + average02
+    },
+    // 计算勾选的checkbox值合集
+    checkboxString: function() {
+      const str = this.checkboxList.join()
+      return str == '' ? '*' : str
+    }
+  }
 }
 </script>

+ 146 - 146
src/components/Crontab/index.vue

@@ -113,239 +113,239 @@
 </template>
 
 <script>
-import CrontabSecond from "./second.vue";
-import CrontabMin from "./min.vue";
-import CrontabHour from "./hour.vue";
-import CrontabDay from "./day.vue";
-import CrontabMonth from "./month.vue";
-import CrontabWeek from "./week.vue";
-import CrontabYear from "./year.vue";
-import CrontabResult from "./result.vue";
+import CrontabSecond from './second.vue'
+import CrontabMin from './min.vue'
+import CrontabHour from './hour.vue'
+import CrontabDay from './day.vue'
+import CrontabMonth from './month.vue'
+import CrontabWeek from './week.vue'
+import CrontabYear from './year.vue'
+import CrontabResult from './result.vue'
 
 export default {
   data() {
     return {
-      tabTitles: ["秒", "分钟", "小时", "日", "月", "周", "年"],
+      tabTitles: ['秒', '分钟', '小时', '日', '月', '周', '年'],
       tabActive: 0,
       myindex: 0,
       crontabValueObj: {
-        second: "*",
-        min: "*",
-        hour: "*",
-        day: "*",
-        month: "*",
-        week: "?",
-        year: "",
-      },
-    };
+        second: '*',
+        min: '*',
+        hour: '*',
+        day: '*',
+        month: '*',
+        week: '?',
+        year: ''
+      }
+    }
   },
-  name: "vcrontab",
-  props: ["expression", "hideComponent"],
+  name: 'vcrontab',
+  props: ['expression', 'hideComponent'],
   methods: {
     shouldHide(key) {
-      if (this.hideComponent && this.hideComponent.includes(key)) return false;
-      return true;
+      if (this.hideComponent && this.hideComponent.includes(key)) return false
+      return true
     },
     resolveExp() {
       // 反解析 表达式
       if (this.expression) {
-        let arr = this.expression.split(" ");
+        const arr = this.expression.split(' ')
         if (arr.length >= 6) {
-          //6 位以上是合法表达式
-          let obj = {
+          // 6 位以上是合法表达式
+          const obj = {
             second: arr[0],
             min: arr[1],
             hour: arr[2],
             day: arr[3],
             month: arr[4],
             week: arr[5],
-            year: arr[6] ? arr[6] : "",
-          };
+            year: arr[6] ? arr[6] : ''
+          }
           this.crontabValueObj = {
-            ...obj,
-          };
-          for (let i in obj) {
-            if (obj[i]) this.changeRadio(i, obj[i]);
+            ...obj
+          }
+          for (const i in obj) {
+            if (obj[i]) this.changeRadio(i, obj[i])
           }
         }
       } else {
         // 没有传入的表达式 则还原
-        this.clearCron();
+        this.clearCron()
       }
     },
     // tab切换值
     tabCheck(index) {
-      this.tabActive = index;
+      this.tabActive = index
     },
     // 由子组件触发,更改表达式组成的字段值
     updateCrontabValue(name, value, from) {
-      "updateCrontabValue", name, value, from;
-      this.crontabValueObj[name] = value;
+      'updateCrontabValue', name, value, from
+      this.crontabValueObj[name] = value
       if (from && from !== name) {
-        console.log(`来自组件 ${from} 改变了 ${name} ${value}`);
-        this.changeRadio(name, value);
+        console.log(`来自组件 ${from} 改变了 ${name} ${value}`)
+        this.changeRadio(name, value)
       }
     },
     // 赋值到组件
     changeRadio(name, value) {
-      let arr = ["second", "min", "hour", "month"],
-        refName = "cron" + name,
-        insValue;
+      let arr = ['second', 'min', 'hour', 'month'],
+        refName = 'cron' + name,
+        insValue
 
-      if (!this.$refs[refName]) return;
+      if (!this.$refs[refName]) return
 
       if (arr.includes(name)) {
-        if (value === "*") {
-          insValue = 1;
-        } else if (value.indexOf("-") > -1) {
-          let indexArr = value.split("-");
+        if (value === '*') {
+          insValue = 1
+        } else if (value.indexOf('-') > -1) {
+          const indexArr = value.split('-')
           isNaN(indexArr[0])
             ? (this.$refs[refName].cycle01 = 0)
-            : (this.$refs[refName].cycle01 = indexArr[0]);
-          this.$refs[refName].cycle02 = indexArr[1];
-          insValue = 2;
-        } else if (value.indexOf("/") > -1) {
-          let indexArr = value.split("/");
+            : (this.$refs[refName].cycle01 = indexArr[0])
+          this.$refs[refName].cycle02 = indexArr[1]
+          insValue = 2
+        } else if (value.indexOf('/') > -1) {
+          const indexArr = value.split('/')
           isNaN(indexArr[0])
             ? (this.$refs[refName].average01 = 0)
-            : (this.$refs[refName].average01 = indexArr[0]);
-          this.$refs[refName].average02 = indexArr[1];
-          insValue = 3;
+            : (this.$refs[refName].average01 = indexArr[0])
+          this.$refs[refName].average02 = indexArr[1]
+          insValue = 3
         } else {
-          insValue = 4;
-          this.$refs[refName].checkboxList = value.split(",");
+          insValue = 4
+          this.$refs[refName].checkboxList = value.split(',')
         }
-      } else if (name == "day") {
-        if (value === "*") {
-          insValue = 1;
-        } else if (value == "?") {
-          insValue = 2;
-        } else if (value.indexOf("-") > -1) {
-          let indexArr = value.split("-");
+      } else if (name == 'day') {
+        if (value === '*') {
+          insValue = 1
+        } else if (value == '?') {
+          insValue = 2
+        } else if (value.indexOf('-') > -1) {
+          const indexArr = value.split('-')
           isNaN(indexArr[0])
             ? (this.$refs[refName].cycle01 = 0)
-            : (this.$refs[refName].cycle01 = indexArr[0]);
-          this.$refs[refName].cycle02 = indexArr[1];
-          insValue = 3;
-        } else if (value.indexOf("/") > -1) {
-          let indexArr = value.split("/");
+            : (this.$refs[refName].cycle01 = indexArr[0])
+          this.$refs[refName].cycle02 = indexArr[1]
+          insValue = 3
+        } else if (value.indexOf('/') > -1) {
+          const indexArr = value.split('/')
           isNaN(indexArr[0])
             ? (this.$refs[refName].average01 = 0)
-            : (this.$refs[refName].average01 = indexArr[0]);
-          this.$refs[refName].average02 = indexArr[1];
-          insValue = 4;
-        } else if (value.indexOf("W") > -1) {
-          let indexArr = value.split("W");
+            : (this.$refs[refName].average01 = indexArr[0])
+          this.$refs[refName].average02 = indexArr[1]
+          insValue = 4
+        } else if (value.indexOf('W') > -1) {
+          const indexArr = value.split('W')
           isNaN(indexArr[0])
             ? (this.$refs[refName].workday = 0)
-            : (this.$refs[refName].workday = indexArr[0]);
-          insValue = 5;
-        } else if (value === "L") {
-          insValue = 6;
+            : (this.$refs[refName].workday = indexArr[0])
+          insValue = 5
+        } else if (value === 'L') {
+          insValue = 6
         } else {
-          this.$refs[refName].checkboxList = value.split(",");
-          insValue = 7;
+          this.$refs[refName].checkboxList = value.split(',')
+          insValue = 7
         }
-      } else if (name == "week") {
-        if (value === "*") {
-          insValue = 1;
-        } else if (value == "?") {
-          insValue = 2;
-        } else if (value.indexOf("-") > -1) {
-          let indexArr = value.split("-");
+      } else if (name == 'week') {
+        if (value === '*') {
+          insValue = 1
+        } else if (value == '?') {
+          insValue = 2
+        } else if (value.indexOf('-') > -1) {
+          const indexArr = value.split('-')
           isNaN(indexArr[0])
             ? (this.$refs[refName].cycle01 = 0)
-            : (this.$refs[refName].cycle01 = indexArr[0]);
-          this.$refs[refName].cycle02 = indexArr[1];
-          insValue = 3;
-        } else if (value.indexOf("#") > -1) {
-          let indexArr = value.split("#");
+            : (this.$refs[refName].cycle01 = indexArr[0])
+          this.$refs[refName].cycle02 = indexArr[1]
+          insValue = 3
+        } else if (value.indexOf('#') > -1) {
+          const indexArr = value.split('#')
           isNaN(indexArr[0])
             ? (this.$refs[refName].average01 = 1)
-            : (this.$refs[refName].average01 = indexArr[0]);
-          this.$refs[refName].average02 = indexArr[1];
-          insValue = 4;
-        } else if (value.indexOf("L") > -1) {
-          let indexArr = value.split("L");
+            : (this.$refs[refName].average01 = indexArr[0])
+          this.$refs[refName].average02 = indexArr[1]
+          insValue = 4
+        } else if (value.indexOf('L') > -1) {
+          const indexArr = value.split('L')
           isNaN(indexArr[0])
             ? (this.$refs[refName].weekday = 1)
-            : (this.$refs[refName].weekday = indexArr[0]);
-          insValue = 5;
+            : (this.$refs[refName].weekday = indexArr[0])
+          insValue = 5
         } else {
-          this.$refs[refName].checkboxList = value.split(",");
-          insValue = 6;
+          this.$refs[refName].checkboxList = value.split(',')
+          insValue = 6
         }
-      } else if (name == "year") {
-        if (value == "") {
-          insValue = 1;
-        } else if (value == "*") {
-          insValue = 2;
-        } else if (value.indexOf("-") > -1) {
-          insValue = 3;
-        } else if (value.indexOf("/") > -1) {
-          insValue = 4;
+      } else if (name == 'year') {
+        if (value == '') {
+          insValue = 1
+        } else if (value == '*') {
+          insValue = 2
+        } else if (value.indexOf('-') > -1) {
+          insValue = 3
+        } else if (value.indexOf('/') > -1) {
+          insValue = 4
         } else {
-          this.$refs[refName].checkboxList = value.split(",");
-          insValue = 5;
+          this.$refs[refName].checkboxList = value.split(',')
+          insValue = 5
         }
       }
-      this.$refs[refName].radioValue = insValue;
+      this.$refs[refName].radioValue = insValue
     },
     // 表单选项的子组件校验数字格式(通过-props传递)
     checkNumber(value, minLimit, maxLimit) {
       // 检查必须为整数
-      value = Math.floor(value);
+      value = Math.floor(value)
       if (value < minLimit) {
-        value = minLimit;
+        value = minLimit
       } else if (value > maxLimit) {
-        value = maxLimit;
+        value = maxLimit
       }
-      return value;
+      return value
     },
     // 隐藏弹窗
     hidePopup() {
-      this.$emit("hide");
+      this.$emit('hide')
     },
     // 填充表达式
     submitFill() {
-      this.$emit("fill", this.crontabValueString);
-      this.hidePopup();
+      this.$emit('fill', this.crontabValueString)
+      this.hidePopup()
     },
     clearCron() {
       // 还原选择项
-      ("准备还原");
+      ('准备还原')
       this.crontabValueObj = {
-        second: "*",
-        min: "*",
-        hour: "*",
-        day: "*",
-        month: "*",
-        week: "?",
-        year: "",
-      };
-      for (let j in this.crontabValueObj) {
-        this.changeRadio(j, this.crontabValueObj[j]);
+        second: '*',
+        min: '*',
+        hour: '*',
+        day: '*',
+        month: '*',
+        week: '?',
+        year: ''
       }
-    },
+      for (const j in this.crontabValueObj) {
+        this.changeRadio(j, this.crontabValueObj[j])
+      }
+    }
   },
   computed: {
     crontabValueString: function() {
-      let obj = this.crontabValueObj;
-      let str =
+      const obj = this.crontabValueObj
+      const str =
         obj.second +
-        " " +
+        ' ' +
         obj.min +
-        " " +
+        ' ' +
         obj.hour +
-        " " +
+        ' ' +
         obj.day +
-        " " +
+        ' ' +
         obj.month +
-        " " +
+        ' ' +
         obj.week +
-        (obj.year == "" ? "" : " " + obj.year);
-      return str;
-    },
+        (obj.year == '' ? '' : ' ' + obj.year)
+      return str
+    }
   },
   components: {
     CrontabSecond,
@@ -355,18 +355,18 @@ export default {
     CrontabMonth,
     CrontabWeek,
     CrontabYear,
-    CrontabResult,
+    CrontabResult
   },
   watch: {
-    expression: "resolveExp",
+    expression: 'resolveExp',
     hideComponent(value) {
       // 隐藏部分组件
-    },
+    }
   },
   mounted: function() {
-    this.resolveExp();
-  },
-};
+    this.resolveExp()
+  }
+}
 </script>
 <style scoped>
 .pop_btn {

+ 75 - 75
src/components/Crontab/min.vue

@@ -36,81 +36,81 @@
 
 <script>
 export default {
-	data() {
-		return {
-			radioValue: 1,
-			cycle01: 1,
-			cycle02: 2,
-			average01: 0,
-			average02: 1,
-			checkboxList: [],
-			checkNum: this.$options.propsData.check
-		}
-	},
-	name: 'crontab-min',
-	props: ['check', 'cron'],
-	methods: {
-		// 单选按钮值变化时
-		radioChange() {
-			switch (this.radioValue) {
-				case 1:
-					this.$emit('update', 'min', '*', 'min');
-					break;
-				case 2:
-					this.$emit('update', 'min', this.cycleTotal, 'min');
-					break;
-				case 3:
-					this.$emit('update', 'min', this.averageTotal, 'min');
-					break;
-				case 4:
-					this.$emit('update', 'min', this.checkboxString, 'min');
-					break;
-			}
-		},
-		// 周期两个值变化时
-		cycleChange() {
-			if (this.radioValue == '2') {
-				this.$emit('update', 'min', this.cycleTotal, 'min');
-			}
-		},
-		// 平均两个值变化时
-		averageChange() {
-			if (this.radioValue == '3') {
-				this.$emit('update', 'min', this.averageTotal, 'min');
-			}
-		},
-		// checkbox值变化时
-		checkboxChange() {
-			if (this.radioValue == '4') {
-				this.$emit('update', 'min', this.checkboxString, 'min');
-			}
-		},
+  data() {
+    return {
+      radioValue: 1,
+      cycle01: 1,
+      cycle02: 2,
+      average01: 0,
+      average02: 1,
+      checkboxList: [],
+      checkNum: this.$options.propsData.check
+    }
+  },
+  name: 'crontab-min',
+  props: ['check', 'cron'],
+  methods: {
+    // 单选按钮值变化时
+    radioChange() {
+      switch (this.radioValue) {
+        case 1:
+          this.$emit('update', 'min', '*', 'min')
+          break
+        case 2:
+          this.$emit('update', 'min', this.cycleTotal, 'min')
+          break
+        case 3:
+          this.$emit('update', 'min', this.averageTotal, 'min')
+          break
+        case 4:
+          this.$emit('update', 'min', this.checkboxString, 'min')
+          break
+      }
+    },
+    // 周期两个值变化时
+    cycleChange() {
+      if (this.radioValue == '2') {
+        this.$emit('update', 'min', this.cycleTotal, 'min')
+      }
+    },
+    // 平均两个值变化时
+    averageChange() {
+      if (this.radioValue == '3') {
+        this.$emit('update', 'min', this.averageTotal, 'min')
+      }
+    },
+    // checkbox值变化时
+    checkboxChange() {
+      if (this.radioValue == '4') {
+        this.$emit('update', 'min', this.checkboxString, 'min')
+      }
+    }
 
-	},
-	watch: {
-		'radioValue': 'radioChange',
-		'cycleTotal': 'cycleChange',
-		'averageTotal': 'averageChange',
-		'checkboxString': 'checkboxChange',
-	},
-	computed: {
-		// 计算两个周期值
-		cycleTotal: function () {
-			const cycle01 = this.checkNum(this.cycle01, 0, 58)
-			const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59)
-			return cycle01 + '-' + cycle02;
-		},
-		// 计算平均用到的值
-		averageTotal: function () {
-			const average01 = this.checkNum(this.average01, 0, 58)
-			const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0)
-			return average01 + '/' + average02;
-		},
-		// 计算勾选的checkbox值合集
-		checkboxString: function () {
-			let str = this.checkboxList.join();
-			return str == '' ? '*' : str;
-		}
-	}
+  },
+  watch: {
+    'radioValue': 'radioChange',
+    'cycleTotal': 'cycleChange',
+    'averageTotal': 'averageChange',
+    'checkboxString': 'checkboxChange'
+  },
+  computed: {
+    // 计算两个周期值
+    cycleTotal: function() {
+      const cycle01 = this.checkNum(this.cycle01, 0, 58)
+      const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59)
+      return cycle01 + '-' + cycle02
+    },
+    // 计算平均用到的值
+    averageTotal: function() {
+      const average01 = this.checkNum(this.average01, 0, 58)
+      const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0)
+      return average01 + '/' + average02
+    },
+    // 计算勾选的checkbox值合集
+    checkboxString: function() {
+      const str = this.checkboxList.join()
+      return str == '' ? '*' : str
+    }
+  }
 }
 </script>

+ 75 - 75
src/components/Crontab/month.vue

@@ -35,80 +35,80 @@
 
 <script>
 export default {
-	data() {
-		return {
-			radioValue: 1,
-			cycle01: 1,
-			cycle02: 2,
-			average01: 1,
-			average02: 1,
-			checkboxList: [],
-			checkNum: this.check
-		}
-	},
-	name: 'crontab-month',
-	props: ['check', 'cron'],
-	methods: {
-		// 单选按钮值变化时
-		radioChange() {
-			switch (this.radioValue) {
-				case 1:
-					this.$emit('update', 'month', '*');
-					break;
-				case 2:
-					this.$emit('update', 'month', this.cycleTotal);
-					break;
-				case 3:
-					this.$emit('update', 'month', this.averageTotal);
-					break;
-				case 4:
-					this.$emit('update', 'month', this.checkboxString);
-					break;
-			}
-		},
-		// 周期两个值变化时
-		cycleChange() {
-			if (this.radioValue == '2') {
-				this.$emit('update', 'month', this.cycleTotal);
-			}
-		},
-		// 平均两个值变化时
-		averageChange() {
-			if (this.radioValue == '3') {
-				this.$emit('update', 'month', this.averageTotal);
-			}
-		},
-		// checkbox值变化时
-		checkboxChange() {
-			if (this.radioValue == '4') {
-				this.$emit('update', 'month', this.checkboxString);
-			}
-		}
-	},
-	watch: {
-		'radioValue': 'radioChange',
-		'cycleTotal': 'cycleChange',
-		'averageTotal': 'averageChange',
-		'checkboxString': 'checkboxChange'
-	},
-	computed: {
-		// 计算两个周期值
-		cycleTotal: function () {
-			const cycle01 = this.checkNum(this.cycle01, 1, 11)
-			const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 12)
-			return cycle01 + '-' + cycle02;
-		},
-		// 计算平均用到的值
-		averageTotal: function () {
-			const average01 = this.checkNum(this.average01, 1, 11)
-			const average02 = this.checkNum(this.average02, 1, 12 - average01 || 0)
-			return average01 + '/' + average02;
-		},
-		// 计算勾选的checkbox值合集
-		checkboxString: function () {
-			let str = this.checkboxList.join();
-			return str == '' ? '*' : str;
-		}
-	}
+  data() {
+    return {
+      radioValue: 1,
+      cycle01: 1,
+      cycle02: 2,
+      average01: 1,
+      average02: 1,
+      checkboxList: [],
+      checkNum: this.check
+    }
+  },
+  name: 'crontab-month',
+  props: ['check', 'cron'],
+  methods: {
+    // 单选按钮值变化时
+    radioChange() {
+      switch (this.radioValue) {
+        case 1:
+          this.$emit('update', 'month', '*')
+          break
+        case 2:
+          this.$emit('update', 'month', this.cycleTotal)
+          break
+        case 3:
+          this.$emit('update', 'month', this.averageTotal)
+          break
+        case 4:
+          this.$emit('update', 'month', this.checkboxString)
+          break
+      }
+    },
+    // 周期两个值变化时
+    cycleChange() {
+      if (this.radioValue == '2') {
+        this.$emit('update', 'month', this.cycleTotal)
+      }
+    },
+    // 平均两个值变化时
+    averageChange() {
+      if (this.radioValue == '3') {
+        this.$emit('update', 'month', this.averageTotal)
+      }
+    },
+    // checkbox值变化时
+    checkboxChange() {
+      if (this.radioValue == '4') {
+        this.$emit('update', 'month', this.checkboxString)
+      }
+    }
+  },
+  watch: {
+    'radioValue': 'radioChange',
+    'cycleTotal': 'cycleChange',
+    'averageTotal': 'averageChange',
+    'checkboxString': 'checkboxChange'
+  },
+  computed: {
+    // 计算两个周期值
+    cycleTotal: function() {
+      const cycle01 = this.checkNum(this.cycle01, 1, 11)
+      const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 12)
+      return cycle01 + '-' + cycle02
+    },
+    // 计算平均用到的值
+    averageTotal: function() {
+      const average01 = this.checkNum(this.average01, 1, 11)
+      const average02 = this.checkNum(this.average02, 1, 12 - average01 || 0)
+      return average01 + '/' + average02
+    },
+    // 计算勾选的checkbox值合集
+    checkboxString: function() {
+      const str = this.checkboxList.join()
+      return str == '' ? '*' : str
+    }
+  }
 }
 </script>

文件差异内容过多而无法显示
+ 531 - 534
src/components/Crontab/result.vue


+ 78 - 78
src/components/Crontab/second.vue

@@ -35,83 +35,83 @@
 
 <script>
 export default {
-	data() {
-		return {
-			radioValue: 1,
-			cycle01: 1,
-			cycle02: 2,
-			average01: 0,
-			average02: 1,
-			checkboxList: [],
-			checkNum: this.$options.propsData.check
-		}
-	},
-	name: 'crontab-second',
-	props: ['check', 'radioParent'],
-	methods: {
-		// 单选按钮值变化时
-		radioChange() {
-			switch (this.radioValue) {
-				case 1:
-					this.$emit('update', 'second', '*', 'second');
-					break;
-				case 2:
-					this.$emit('update', 'second', this.cycleTotal);
-					break;
-				case 3:
-					this.$emit('update', 'second', this.averageTotal);
-					break;
-				case 4:
-					this.$emit('update', 'second', this.checkboxString);
-					break;
-			}
-		},
-		// 周期两个值变化时
-		cycleChange() {
-			if (this.radioValue == '2') {
-				this.$emit('update', 'second', this.cycleTotal);
-			}
-		},
-		// 平均两个值变化时
-		averageChange() {
-			if (this.radioValue == '3') {
-				this.$emit('update', 'second', this.averageTotal);
-			}
-		},
-		// checkbox值变化时
-		checkboxChange() {
-			if (this.radioValue == '4') {
-				this.$emit('update', 'second', this.checkboxString);
-			}
-		}
-	},
-	watch: {
-		'radioValue': 'radioChange',
-		'cycleTotal': 'cycleChange',
-		'averageTotal': 'averageChange',
-		'checkboxString': 'checkboxChange',
-		radioParent() {
-			this.radioValue = this.radioParent
-		}
-	},
-	computed: {
-		// 计算两个周期值
-		cycleTotal: function () {
-			const cycle01 = this.checkNum(this.cycle01, 0, 58)
-			const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59)
-			return cycle01 + '-' + cycle02;
-		},
-		// 计算平均用到的值
-		averageTotal: function () {
-			const average01 = this.checkNum(this.average01, 0, 58)
-			const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0)
-			return average01 + '/' + average02;
-		},
-		// 计算勾选的checkbox值合集
-		checkboxString: function () {
-			let str = this.checkboxList.join();
-			return str == '' ? '*' : str;
-		}
-	}
+  data() {
+    return {
+      radioValue: 1,
+      cycle01: 1,
+      cycle02: 2,
+      average01: 0,
+      average02: 1,
+      checkboxList: [],
+      checkNum: this.$options.propsData.check
+    }
+  },
+  name: 'crontab-second',
+  props: ['check', 'radioParent'],
+  methods: {
+    // 单选按钮值变化时
+    radioChange() {
+      switch (this.radioValue) {
+        case 1:
+          this.$emit('update', 'second', '*', 'second')
+          break
+        case 2:
+          this.$emit('update', 'second', this.cycleTotal)
+          break
+        case 3:
+          this.$emit('update', 'second', this.averageTotal)
+          break
+        case 4:
+          this.$emit('update', 'second', this.checkboxString)
+          break
+      }
+    },
+    // 周期两个值变化时
+    cycleChange() {
+      if (this.radioValue == '2') {
+        this.$emit('update', 'second', this.cycleTotal)
+      }
+    },
+    // 平均两个值变化时
+    averageChange() {
+      if (this.radioValue == '3') {
+        this.$emit('update', 'second', this.averageTotal)
+      }
+    },
+    // checkbox值变化时
+    checkboxChange() {
+      if (this.radioValue == '4') {
+        this.$emit('update', 'second', this.checkboxString)
+      }
+    }
+  },
+  watch: {
+    'radioValue': 'radioChange',
+    'cycleTotal': 'cycleChange',
+    'averageTotal': 'averageChange',
+    'checkboxString': 'checkboxChange',
+    radioParent() {
+      this.radioValue = this.radioParent
+    }
+  },
+  computed: {
+    // 计算两个周期值
+    cycleTotal: function() {
+      const cycle01 = this.checkNum(this.cycle01, 0, 58)
+      const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59)
+      return cycle01 + '-' + cycle02
+    },
+    // 计算平均用到的值
+    averageTotal: function() {
+      const average01 = this.checkNum(this.average01, 0, 58)
+      const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0)
+      return average01 + '/' + average02
+    },
+    // 计算勾选的checkbox值合集
+    checkboxString: function() {
+      const str = this.checkboxList.join()
+      return str == '' ? '*' : str
+    }
+  }
 }
 </script>

+ 127 - 127
src/components/Crontab/week.vue

@@ -70,133 +70,133 @@
 
 <script>
 export default {
-	data() {
-		return {
-			radioValue: 2,
-			weekday: 2,
-			cycle01: 2,
-			cycle02: 3,
-			average01: 1,
-			average02: 2,
-			checkboxList: [],
-			weekList: [
-				{
-					key: 2,
-					value: '星期一'
-				},
-				{
-					key: 3,
-					value: '星期二'
-				},
-				{
-					key: 4,
-					value: '星期三'
-				},
-				{
-					key: 5,
-					value: '星期四'
-				},
-				{
-					key: 6,
-					value: '星期五'
-				},
-				{
-					key: 7,
-					value: '星期六'
-				},
-				{
-					key: 1,
-					value: '星期日'
-				}
-			],
-			checkNum: this.$options.propsData.check
-		}
-	},
-	name: 'crontab-week',
-	props: ['check', 'cron'],
-	methods: {
-		// 单选按钮值变化时
-		radioChange() {
-			if (this.radioValue !== 2 && this.cron.day !== '?') {
-				this.$emit('update', 'day', '?', 'week');
-			}
-			switch (this.radioValue) {
-				case 1:
-					this.$emit('update', 'week', '*');
-					break;
-				case 2:
-					this.$emit('update', 'week', '?');
-					break;
-				case 3:
-					this.$emit('update', 'week', this.cycleTotal);
-					break;
-				case 4:
-					this.$emit('update', 'week', this.averageTotal);
-					break;
-				case 5:
-					this.$emit('update', 'week', this.weekdayCheck + 'L');
-					break;
-				case 6:
-					this.$emit('update', 'week', this.checkboxString);
-					break;
-			}
-		},
+  data() {
+    return {
+      radioValue: 2,
+      weekday: 2,
+      cycle01: 2,
+      cycle02: 3,
+      average01: 1,
+      average02: 2,
+      checkboxList: [],
+      weekList: [
+        {
+          key: 2,
+          value: '星期一'
+        },
+        {
+          key: 3,
+          value: '星期二'
+        },
+        {
+          key: 4,
+          value: '星期三'
+        },
+        {
+          key: 5,
+          value: '星期四'
+        },
+        {
+          key: 6,
+          value: '星期五'
+        },
+        {
+          key: 7,
+          value: '星期六'
+        },
+        {
+          key: 1,
+          value: '星期日'
+        }
+      ],
+      checkNum: this.$options.propsData.check
+    }
+  },
+  name: 'crontab-week',
+  props: ['check', 'cron'],
+  methods: {
+    // 单选按钮值变化时
+    radioChange() {
+      if (this.radioValue !== 2 && this.cron.day !== '?') {
+        this.$emit('update', 'day', '?', 'week')
+      }
+      switch (this.radioValue) {
+        case 1:
+          this.$emit('update', 'week', '*')
+          break
+        case 2:
+          this.$emit('update', 'week', '?')
+          break
+        case 3:
+          this.$emit('update', 'week', this.cycleTotal)
+          break
+        case 4:
+          this.$emit('update', 'week', this.averageTotal)
+          break
+        case 5:
+          this.$emit('update', 'week', this.weekdayCheck + 'L')
+          break
+        case 6:
+          this.$emit('update', 'week', this.checkboxString)
+          break
+      }
+    },
 
-		// 周期两个值变化时
-		cycleChange() {
-			if (this.radioValue == '3') {
-				this.$emit('update', 'week', this.cycleTotal);
-			}
-		},
-		// 平均两个值变化时
-		averageChange() {
-			if (this.radioValue == '4') {
-				this.$emit('update', 'week', this.averageTotal);
-			}
-		},
-		// 最近工作日值变化时
-		weekdayChange() {
-			if (this.radioValue == '5') {
-				this.$emit('update', 'week', this.weekday + 'L');
-			}
-		},
-		// checkbox值变化时
-		checkboxChange() {
-			if (this.radioValue == '6') {
-				this.$emit('update', 'week', this.checkboxString);
-			}
-		},
-	},
-	watch: {
-		'radioValue': 'radioChange',
-		'cycleTotal': 'cycleChange',
-		'averageTotal': 'averageChange',
-		'weekdayCheck': 'weekdayChange',
-		'checkboxString': 'checkboxChange',
-	},
-	computed: {
-		// 计算两个周期值
-		cycleTotal: function () {
-			this.cycle01 = this.checkNum(this.cycle01, 1, 7)
-			this.cycle02 = this.checkNum(this.cycle02, 1, 7)
-			return this.cycle01 + '-' + this.cycle02;
-		},
-		// 计算平均用到的值
-		averageTotal: function () {
-			this.average01 = this.checkNum(this.average01, 1, 4)
-			this.average02 = this.checkNum(this.average02, 1, 7)
-			return this.average02 + '#' + this.average01;
-		},
-		// 最近的工作日(格式)
-		weekdayCheck: function () {
-			this.weekday = this.checkNum(this.weekday, 1, 7)
-			return this.weekday;
-		},
-		// 计算勾选的checkbox值合集
-		checkboxString: function () {
-			let str = this.checkboxList.join();
-			return str == '' ? '*' : str;
-		}
-	}
+    // 周期两个值变化时
+    cycleChange() {
+      if (this.radioValue == '3') {
+        this.$emit('update', 'week', this.cycleTotal)
+      }
+    },
+    // 平均两个值变化时
+    averageChange() {
+      if (this.radioValue == '4') {
+        this.$emit('update', 'week', this.averageTotal)
+      }
+    },
+    // 最近工作日值变化时
+    weekdayChange() {
+      if (this.radioValue == '5') {
+        this.$emit('update', 'week', this.weekday + 'L')
+      }
+    },
+    // checkbox值变化时
+    checkboxChange() {
+      if (this.radioValue == '6') {
+        this.$emit('update', 'week', this.checkboxString)
+      }
+    }
+  },
+  watch: {
+    'radioValue': 'radioChange',
+    'cycleTotal': 'cycleChange',
+    'averageTotal': 'averageChange',
+    'weekdayCheck': 'weekdayChange',
+    'checkboxString': 'checkboxChange'
+  },
+  computed: {
+    // 计算两个周期值
+    cycleTotal: function() {
+      this.cycle01 = this.checkNum(this.cycle01, 1, 7)
+      this.cycle02 = this.checkNum(this.cycle02, 1, 7)
+      return this.cycle01 + '-' + this.cycle02
+    },
+    // 计算平均用到的值
+    averageTotal: function() {
+      this.average01 = this.checkNum(this.average01, 1, 4)
+      this.average02 = this.checkNum(this.average02, 1, 7)
+      return this.average02 + '#' + this.average01
+    },
+    // 最近的工作日(格式)
+    weekdayCheck: function() {
+      this.weekday = this.checkNum(this.weekday, 1, 7)
+      return this.weekday
+    },
+    // 计算勾选的checkbox值合集
+    checkboxString: function() {
+      const str = this.checkboxList.join()
+      return str == '' ? '*' : str
+    }
+  }
 }
 </script>

+ 85 - 85
src/components/Crontab/year.vue

@@ -42,90 +42,90 @@
 
 <script>
 export default {
-	data() {
-		return {
-			fullYear: 0,
-			radioValue: 1,
-			cycle01: 0,
-			cycle02: 0,
-			average01: 0,
-			average02: 1,
-			checkboxList: [],
-			checkNum: this.$options.propsData.check
-		}
-	},
-	name: 'crontab-year',
-	props: ['check', 'month', 'cron'],
-	methods: {
-		// 单选按钮值变化时
-		radioChange() {
-			switch (this.radioValue) {
-				case 1:
-					this.$emit('update', 'year', '');
-					break;
-				case 2:
-					this.$emit('update', 'year', '*');
-					break;
-				case 3:
-					this.$emit('update', 'year', this.cycleTotal);
-					break;
-				case 4:
-					this.$emit('update', 'year', this.averageTotal);
-					break;
-				case 5:
-					this.$emit('update', 'year', this.checkboxString);
-					break;
-			}
-		},
-		// 周期两个值变化时
-		cycleChange() {
-			if (this.radioValue == '3') {
-				this.$emit('update', 'year', this.cycleTotal);
-			}
-		},
-		// 平均两个值变化时
-		averageChange() {
-			if (this.radioValue == '4') {
-				this.$emit('update', 'year', this.averageTotal);
-			}
-		},
-		// checkbox值变化时
-		checkboxChange() {
-			if (this.radioValue == '5') {
-				this.$emit('update', 'year', this.checkboxString);
-			}
-		}
-	},
-	watch: {
-		'radioValue': 'radioChange',
-		'cycleTotal': 'cycleChange',
-		'averageTotal': 'averageChange',
-		'checkboxString': 'checkboxChange'
-	},
-	computed: {
-		// 计算两个周期值
-		cycleTotal: function () {
-			const cycle01 = this.checkNum(this.cycle01, this.fullYear, 2098)
-			const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : this.fullYear + 1, 2099)
-			return cycle01 + '-' + cycle02;
-		},
-		// 计算平均用到的值
-		averageTotal: function () {
-			const average01 = this.checkNum(this.average01, this.fullYear, 2098)
-			const average02 = this.checkNum(this.average02, 1, 2099 - average01 || this.fullYear)
-			return average01 + '/' + average02;
-		},
-		// 计算勾选的checkbox值合集
-		checkboxString: function () {
-			let str = this.checkboxList.join();
-			return str;
-		}
-	},
-	mounted: function () {
-		// 仅获取当前年份
-		this.fullYear = Number(new Date().getFullYear());
-		this.cycle01 = this.fullYear
-		this.average01 = this.fullYear
-	}
+  data() {
+    return {
+      fullYear: 0,
+      radioValue: 1,
+      cycle01: 0,
+      cycle02: 0,
+      average01: 0,
+      average02: 1,
+      checkboxList: [],
+      checkNum: this.$options.propsData.check
+    }
+  },
+  name: 'crontab-year',
+  props: ['check', 'month', 'cron'],
+  methods: {
+    // 单选按钮值变化时
+    radioChange() {
+      switch (this.radioValue) {
+        case 1:
+          this.$emit('update', 'year', '')
+          break
+        case 2:
+          this.$emit('update', 'year', '*')
+          break
+        case 3:
+          this.$emit('update', 'year', this.cycleTotal)
+          break
+        case 4:
+          this.$emit('update', 'year', this.averageTotal)
+          break
+        case 5:
+          this.$emit('update', 'year', this.checkboxString)
+          break
+      }
+    },
+    // 周期两个值变化时
+    cycleChange() {
+      if (this.radioValue == '3') {
+        this.$emit('update', 'year', this.cycleTotal)
+      }
+    },
+    // 平均两个值变化时
+    averageChange() {
+      if (this.radioValue == '4') {
+        this.$emit('update', 'year', this.averageTotal)
+      }
+    },
+    // checkbox值变化时
+    checkboxChange() {
+      if (this.radioValue == '5') {
+        this.$emit('update', 'year', this.checkboxString)
+      }
+    }
+  },
+  watch: {
+    'radioValue': 'radioChange',
+    'cycleTotal': 'cycleChange',
+    'averageTotal': 'averageChange',
+    'checkboxString': 'checkboxChange'
+  },
+  computed: {
+    // 计算两个周期值
+    cycleTotal: function() {
+      const cycle01 = this.checkNum(this.cycle01, this.fullYear, 2098)
+      const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : this.fullYear + 1, 2099)
+      return cycle01 + '-' + cycle02
+    },
+    // 计算平均用到的值
+    averageTotal: function() {
+      const average01 = this.checkNum(this.average01, this.fullYear, 2098)
+      const average02 = this.checkNum(this.average02, 1, 2099 - average01 || this.fullYear)
+      return average01 + '/' + average02
+    },
+    // 计算勾选的checkbox值合集
+    checkboxString: function() {
+      const str = this.checkboxList.join()
+      return str
+    }
+  },
+  mounted: function() {
+    // 仅获取当前年份
+    this.fullYear = Number(new Date().getFullYear())
+    this.cycle01 = this.fullYear
+    this.average01 = this.fullYear
+  }
 }
 </script>

+ 23 - 23
src/components/RightToolbar/index.vue

@@ -23,73 +23,73 @@
 </template>
 <script>
 export default {
-  name: "RightToolbar",
+  name: 'RightToolbar',
   data() {
     return {
       // 显隐数据
       value: [],
       // 弹出层标题
-      title: "显示/隐藏",
+      title: '显示/隐藏',
       // 是否显示弹出层
-      open: false,
-    };
+      open: false
+    }
   },
   props: {
     showSearch: {
       type: Boolean,
-      default: true,
+      default: true
     },
     columns: {
-      type: Array,
+      type: Array
     },
     search: {
       type: Boolean,
-      default: true,
+      default: true
     },
     gutter: {
       type: Number,
-      default: 10,
-    },
+      default: 10
+    }
   },
   computed: {
     style() {
-      const ret = {};
+      const ret = {}
       if (this.gutter) {
-        ret.marginRight = `${this.gutter / 2}px`;
+        ret.marginRight = `${this.gutter / 2}px`
       }
-      return ret;
+      return ret
     }
   },
   created() {
     // 显隐列初始默认隐藏列
-    for (let item in this.columns) {
+    for (const item in this.columns) {
       if (this.columns[item].visible === false) {
-        this.value.push(parseInt(item));
+        this.value.push(parseInt(item))
       }
     }
   },
   methods: {
     // 搜索
     toggleSearch() {
-      this.$emit("update:showSearch", !this.showSearch);
+      this.$emit('update:showSearch', !this.showSearch)
     },
     // 刷新
     refresh() {
-      this.$emit("queryTable");
+      this.$emit('queryTable')
     },
     // 右侧列表元素变化
     dataChange(data) {
-      for (let item in this.columns) {
-        const key = this.columns[item].key;
-        this.columns[item].visible = !data.includes(key);
+      for (const item in this.columns) {
+        const key = this.columns[item].key
+        this.columns[item].visible = !data.includes(key)
       }
     },
     // 打开显隐列dialog
     showColumn() {
-      this.open = true;
-    },
-  },
-};
+      this.open = true
+    }
+  }
+}
 </script>
 <style lang="scss" scoped>
 ::v-deep .el-transfer__button {

+ 5 - 5
src/components/SkuDesc/index.vue

@@ -77,9 +77,9 @@ export default {
         advlist_bullet_styles: 'square',
         advlist_number_styles: 'default',
         default_link_target: '_blank',
-        relative_urls : false,
-		remove_script_host : false,
-		document_base_url : 'http://xiaoyou.dgtis.com/',
+        relative_urls: false,
+        remove_script_host: false,
+        document_base_url: 'http://xiaoyou.dgtis.com/',
         link_title: false,
         init_instance_callback: editor => {
           if (_this.value) {
@@ -95,8 +95,8 @@ export default {
           const formData = new FormData()
           formData.append('file', blobInfo.blob())
           uploadPic(formData).then(res => {
-          var resurl=res.data.data.url;
-          console.log(resurl);
+            var resurl = res.data.data.url
+            console.log(resurl)
             success(resurl)
           }).catch(() => {
             failure('上传失败,请重新上传')

+ 5 - 5
src/components/Tinymce/index.vue

@@ -77,9 +77,9 @@ export default {
         advlist_bullet_styles: 'square',
         advlist_number_styles: 'default',
         default_link_target: '_blank',
-        relative_urls : false,
-		remove_script_host : false,
-		document_base_url : 'http://xiaoyou.dgtis.com/',
+        relative_urls: false,
+        remove_script_host: false,
+        document_base_url: 'http://xiaoyou.dgtis.com/',
         link_title: false,
         init_instance_callback: editor => {
           if (_this.value) {
@@ -95,8 +95,8 @@ export default {
           const formData = new FormData()
           formData.append('file', blobInfo.blob())
           uploadPic(formData).then(res => {
-          var resurl=res.data.data.url;
-          console.log(resurl);
+            var resurl = res.data.data.url
+            console.log(resurl)
             success(resurl)
           }).catch(() => {
             failure('上传失败,请重新上传')

+ 7 - 7
src/main.js

@@ -13,9 +13,9 @@ import store from './store'
 import './icons' // icon
 import './permission' // permission control
 // import './mock' // simulation data
-import { handleTree,resetForm } from "@/utils/index";
+import { handleTree, resetForm } from '@/utils/index'
 // 自定义表格工具组件
-import RightToolbar from "@/components/RightToolbar"
+import RightToolbar from '@/components/RightToolbar'
 
 import UIComponents from '@/ui-components'
 
@@ -24,12 +24,12 @@ Vue.use(Element, {
 })
 Vue.use(UIComponents)
 // 全局方法挂载
-Vue.prototype.upLoadUrl = process.env.BASE_API +  '/storage/create';
-Vue.config.productionTip = false;
-Vue.prototype.handleTree = handleTree;
-Vue.prototype.resetForm = resetForm;
+Vue.prototype.upLoadUrl = process.env.BASE_API + '/storage/create'
+Vue.config.productionTip = false
+Vue.prototype.handleTree = handleTree
+Vue.prototype.resetForm = resetForm
 // 全局组件挂载
-Vue.component('RightToolbar', RightToolbar);
+Vue.component('RightToolbar', RightToolbar)
 
 new Vue({
   el: '#app',

+ 28 - 114
src/permission.js

@@ -1,153 +1,67 @@
 import router from './router'
 import store from './store'
 import { Message } from 'element-ui'
-import NProgress from 'nprogress' // progress bar
-import 'nprogress/nprogress.css'// progress bar style
-import { getToken,setToken } from '@/utils/auth' // getToken from cookie
+import NProgress from 'nprogress'
+import 'nprogress/nprogress.css'
+import { getToken, setToken } from '@/utils/auth'
 
-NProgress.configure({ showSpinner: false })// NProgress Configuration
+NProgress.configure({ showSpinner: false })
 
-// permissiom judge function
 function hasPermission(roles, permissionRoles) {
-  if (roles.indexOf('admin') >= 0) return true // admin permission passed directly
+  if (roles.indexOf('admin') >= 0) return true
   if (!permissionRoles) return true
   return roles.some(role => permissionRoles.indexOf(role) >= 0)
 }
 
-const whiteList = ['/login', '/authredirect']// no redirect whitelist
-//自定义路由
-const myRoles = [
-  //商品管理
-  'goodsManage', 
-  'goodsTypeList', 
-  'goodsList', 
-  'brand',
-  //基础设置
-  'basicSetting', 
-  'supplier', 
-  'warehouse',
-  'express',
-  'store',
-  //仓库管理
-  'stock',
-  // 入库单
-  'warehousing',
-  'warehousingAdd',
-  'warehousingEdit',
-  'warehousingDetail',
-  // 出库单
-  'retrieval',
-  'retrievalAdd',
-  'retrievalEdit',
-  'retrievalDetail',
-  // 调拨单
-  'requisition',
-  'requisitionAdd',
-  'requisitionEdit',
-  'requisitionDetail',
-  // 换货单
-  'swap',
-  'swapAdd',
-  'swapEdit',
-  'swapDetail',
-  // 组装单
-  'assembly',
-  'assemblyAdd',
-  'assemblyEdit',
-  'assemblyDetail',
-  // 拆卸单
-  'disassembly',
-  'disassemblyAdd',
-  'disassemblyEdit',
-  'disassemblyDetail',
-  // 报损单
-  'breakage',
-  'breakageAdd',
-  'breakageEdit',
-  'breakageDetail',
-  // 盘点单
-  'stockCount',
-  'stockCountAdd',
-  'stockCountEdit',
-  'stockCountDetail',
-
-  // 客户管理
-  'customer',
-  'distributor',
-  'business',
-  'vip',
-  'guest',
-
-  //报表管理
-  'report',
-  'stockReport',
-  //字典管理
-  'dictManage', 
-  'dictList', 
-  'dictDataList', 
-  //系统管理
-  'sysManage',
-  'admin',
-  'dept',
-  'role',
-]
+const whiteList = ['/login', '/authredirect']
 
 router.beforeEach((to, from, next) => {
-  NProgress.start() // start progress bar
-  // store.dispatch('SetToken', 'y8evar5b5yecmr6hjrhyokxw5tiqizw9');
-  // setToken('y8evar5b5yecmr6hjrhyokxw5tiqizw9');
-  const path = to.path;
-  const token = to.query.xToken;
-  if (path.indexOf('auth') != -1 && token) { 
-    store.dispatch('SetToken', token);
-    setToken(token);
+  NProgress.start()
+  const path = to.path
+  const token = to.query.xToken
+  if (path.indexOf('auth') !== -1 && token) {
+    store.dispatch('SetToken', token)
+    setToken(token)
   }
-  if (getToken()) { // determine if there has token
-    /* has token*/
+  if (getToken()) {
     if (to.path === '/login') {
       next({ path: '/' })
-      NProgress.done() // if current page is dashboard will not trigger	afterEach hook, so manually handle it
+      NProgress.done()
     } else {
-      if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息
+      if (store.getters.roles.length === 0) {
         store.dispatch('GetUserInfo').then(res => {
-          store.dispatch('GetUserMenus').then(res => { // 拉取user_info
-            const roles = res.data.data // note: roles must be a array! such as: ['editor','develop']
-            // const roles = myRoles;
-            store.dispatch('GenerateRoutes', { roles }).then(() => { // 根据roles权限生成可访问的路由表
-              router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表
-              next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
-              next({ path: '/' });
+          store.dispatch('GetUserMenus').then(res => {
+            const roles = res.data.data
+            store.dispatch('GenerateRoutes', { roles }).then(() => {
+              router.addRoutes(store.getters.addRouters)
+              next({ ...to, replace: true })
+              next({ path: '/' })
             })
           })
         }).catch(() => {
           store.dispatch('FedLogOut').then(() => {
             Message.error('Verification failed, please login again')
-            location.href = process.env.OS_API;
-            // next({ path: '/login' })
+            location.href = process.env.OS_API
           })
         })
       } else {
-        // 没有动态改变权限的需求可直接next() 删除下方权限判断 ↓
         if (hasPermission(store.getters.roles, to.meta.roles)) {
-          next()//
+          next()
         } else {
-          next({ path: '/401', replace: true, query: { noGoBack: true }})
+          next({ path: '/401', replace: true, query: { noGoBack: true } })
         }
-        // 可删 ↑
       }
     }
   } else {
-    /* has no token*/
-    if (whiteList.indexOf(to.path) !== -1) { // 在免登录白名单,直接进入
+    if (whiteList.indexOf(to.path) !== -1) {
       next()
     } else {
-      location.href = process.env.OS_API;
-      // next('/login') // 否则全部重定向到登录页
-      NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it
+      location.href = process.env.OS_API
+      NProgress.done()
     }
   }
 })
 
 router.afterEach(() => {
-  NProgress.done() // finish progress bar
+  NProgress.done()
 })

+ 105 - 105
src/router/index.js

@@ -65,7 +65,7 @@ export const asyncRouterMap = [
     children: [
       { path: 'goodsTypeList', component: _import('goodsManage/goodsTypeList'), name: 'goodsTypeList', meta: { title: '商品类别', noCache: true }},
       { path: 'goodsList', component: _import('goodsManage/goodsList'), name: 'goodsList', meta: { title: '商品列表', noCache: true }},
-      { path: 'brand', component: _import('goodsManage/brand'), name: 'brand', meta: { title: '品牌管理', noCache: true }},
+      { path: 'brand', component: _import('goodsManage/brand'), name: 'brand', meta: { title: '品牌管理', noCache: true }}
     ]
   },
   {
@@ -81,117 +81,117 @@ export const asyncRouterMap = [
       { path: 'supplier', component: _import('basicSetting/supplier'), name: 'supplier', meta: { title: '供应商管理', noCache: true }},
       { path: 'warehouse', component: _import('basicSetting/warehouse'), name: 'warehouse', meta: { title: '仓库管理', noCache: true }},
       { path: 'express', component: _import('basicSetting/express'), name: 'express', meta: { title: '物流公司', noCache: true }},
-      { path: 'store', component: _import('basicSetting/store'), name: 'store', meta: { title: '门店管理', noCache: true }},
+      { path: 'store', component: _import('basicSetting/store'), name: 'store', meta: { title: '门店管理', noCache: true }}
     ]
   },
   {
-      path: '/stock',
-      component: Layout,
-      redirect: 'noredirect',
-      name: 'stock',
-      meta: { title: '仓库管理', icon: 'shangpin' },
-      children: [
-        // 入库单
-        { path: 'warehousing', component: _import('stock/warehousing/warehousing'), name: 'warehousing', meta: { title: '入库单', noCache: true }},
-        { path: 'warehousingAdd', component: _import('stock/warehousing/warehousingAdd'), name: 'warehousingAdd', meta: { title: '新增入库单', noCache: false, hideTag: true, hidden: true }},
-        { path: 'warehousingEdit/:id', component: _import('stock/warehousing/warehousingAdd'), name: 'warehousingEdit', meta: { title: '编辑入库单', noCache: false, hideTag: true, hidden: true }},
-        { path: 'warehousingDetail/:id', component: _import('stock/warehousing/warehousingAdd'), name: 'warehousingDetail', meta: { title: '入库单详情', noCache: false, hideTag: true, hidden: true }},
-        // 出库单
-        { path: 'retrieval', component: _import('stock/retrieval/retrieval'), name: 'retrieval', meta: { title: '出库单', noCache: true }},
-        { path: 'retrievalAdd', component: _import('stock/retrieval/retrievalAdd'), name: 'retrievalAdd', meta: { title: '新增出库单', noCache: false, hideTag: true, hidden: true }},
-        { path: 'retrievalEdit/:id', component: _import('stock/retrieval/retrievalAdd'), name: 'retrievalEdit', meta: { title: '编辑出库单', noCache: false, hideTag: true, hidden: true }},
-        { path: 'retrievalDetail/:id', component: _import('stock/retrieval/retrievalAdd'), name: 'retrievalDetail', meta: { title: '出库单详情', noCache: false, hideTag: true, hidden: true }},
-        // 调拨单
-        { path: 'requisition', component: _import('stock/requisition/requisition'), name: 'requisition', meta: { title: '调拨单', noCache: true }},
-        { path: 'requisitionAdd', component: _import('stock/requisition/requisitionAdd'), name: 'requisitionAdd', meta: { title: '新增调拨单', noCache: false, hideTag: true, hidden: true }},
-        { path: 'requisitionEdit/:id', component: _import('stock/requisition/requisitionAdd'), name: 'requisitionEdit', meta: { title: '编辑调拨单', noCache: false, hideTag: true, hidden: true }},
-        { path: 'requisitionDetail/:id', component: _import('stock/requisition/requisitionAdd'), name: 'requisitionDetail', meta: { title: '调拨单详情', noCache: false, hideTag: true, hidden: true }},
-        // 换货单
-        { path: 'swap', component: _import('stock/swap/swap'), name: 'swap', meta: { title: '换货单', noCache: true }},
-        { path: 'swapAdd', component: _import('stock/swap/swapAdd'), name: 'swapAdd', meta: { title: '新增换货单', noCache: false, hideTag: true, hidden: true }},
-        { path: 'swapEdit/:id', component: _import('stock/swap/swapAdd'), name: 'swapEdit', meta: { title: '编辑换货单', noCache: false, hideTag: true, hidden: true }},
-        { path: 'swapDetail/:id', component: _import('stock/swap/swapAdd'), name: 'swapDetail', meta: { title: '换货单详情', noCache: false, hideTag: true, hidden: true }},
-        // 组装单
-        { path: 'assembly', component: _import('stock/assembly/assembly'), name: 'assembly', meta: { title: '组装单', noCache: true }},
-        { path: 'assemblyAdd', component: _import('stock/assembly/assemblyAdd'), name: 'assemblyAdd', meta: { title: '新增组装单', noCache: false, hideTag: true, hidden: true }},
-        { path: 'assemblyEdit/:id', component: _import('stock/assembly/assemblyAdd'), name: 'assemblyEdit', meta: { title: '编辑组装单', noCache: false, hideTag: true, hidden: true }},
-        { path: 'assemblyDetail/:id', component: _import('stock/assembly/assemblyAdd'), name: 'assemblyDetail', meta: { title: '组装单详情', noCache: false, hideTag: true, hidden: true }},
-        // 拆卸单
-        { path: 'disassembly', component: _import('stock/disassembly/disassembly'), name: 'disassembly', meta: { title: '拆卸单', noCache: true }},
-        { path: 'disassemblyAdd', component: _import('stock/disassembly/disassemblyAdd'), name: 'disassemblyAdd', meta: { title: '新增拆卸单', noCache: false, hideTag: true, hidden: true }},
-        { path: 'disassemblyEdit/:id', component: _import('stock/disassembly/disassemblyAdd'), name: 'disassemblyEdit', meta: { title: '编辑拆卸单', noCache: false, hideTag: true, hidden: true }},
-        { path: 'disassemblyDetail/:id', component: _import('stock/disassembly/disassemblyAdd'), name: 'disassemblyDetail', meta: { title: '拆卸单详情', noCache: false, hideTag: true, hidden: true }},
-        // 报损单
-        { path: 'breakage', component: _import('stock/breakage/breakage'), name: 'breakage', meta: { title: '报损单', noCache: true }},
-        { path: 'breakageAdd', component: _import('stock/breakage/breakageAdd'), name: 'breakageAdd', meta: { title: '新增报损单', noCache: false, hideTag: true, hidden: true }},
-        { path: 'breakageEdit/:id', component: _import('stock/breakage/breakageAdd'), name: 'breakageEdit', meta: { title: '编辑报损单', noCache: false, hideTag: true, hidden: true }},
-        { path: 'breakageDetail/:id', component: _import('stock/breakage/breakageAdd'), name: 'breakageDetail', meta: { title: '报损单详情', noCache: false, hideTag: true, hidden: true }},
-        // 盘点单
-        { path: 'stockCount', component: _import('stock/stockCount/stockCount'), name: 'stockCount', meta: { title: '盘点单', noCache: true }},
-        { path: 'stockCountAdd', component: _import('stock/stockCount/stockCountAdd'), name: 'stockCountAdd', meta: { title: '新增盘点单', noCache: false, hideTag: true, hidden: true }},
-        { path: 'stockCountEdit/:id', component: _import('stock/stockCount/stockCountAdd'), name: 'stockCountEdit', meta: { title: '编辑盘点单', noCache: false, hideTag: true, hidden: true }},
-        { path: 'stockCountDetail/:id', component: _import('stock/stockCount/stockCountAdd'), name: 'stockCountDetail', meta: { title: '盘点单详情', noCache: false, hideTag: true, hidden: true }},
-      ]
-    },
-    {
-      path: '/customer',
-      component: Layout,
-      redirect: 'noredirect',
-      name: 'customer',
-      meta: {
-        title: '客户管理',
-        icon: 'shangpin'
-      },
-      children: [
-        { path: 'distributor', component: _import('customer/distributor'), name: 'distributor', meta: { title: '分销商管理', noCache: true }},
-        { path: 'business', component: _import('customer/business'), name: 'business', meta: { title: '企业客户管理', noCache: true }},
-        { path: 'vip', component: _import('customer/vip'), name: 'vip', meta: { title: '会员管理', noCache: true }},
-        { path: 'guest', component: _import('customer/guest'), name: 'guest', meta: { title: '散客管理', noCache: true }},
-      ]
+    path: '/stock',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'stock',
+    meta: { title: '仓库管理', icon: 'shangpin' },
+    children: [
+      // 入库单
+      { path: 'warehousing', component: _import('stock/warehousing/warehousing'), name: 'warehousing', meta: { title: '入库单', noCache: true }},
+      { path: 'warehousingAdd', component: _import('stock/warehousing/warehousingAdd'), name: 'warehousingAdd', meta: { title: '新增入库单', noCache: false, hideTag: true, hidden: true }},
+      { path: 'warehousingEdit/:id', component: _import('stock/warehousing/warehousingAdd'), name: 'warehousingEdit', meta: { title: '编辑入库单', noCache: false, hideTag: true, hidden: true }},
+      { path: 'warehousingDetail/:id', component: _import('stock/warehousing/warehousingAdd'), name: 'warehousingDetail', meta: { title: '入库单详情', noCache: false, hideTag: true, hidden: true }},
+      // 出库单
+      { path: 'retrieval', component: _import('stock/retrieval/retrieval'), name: 'retrieval', meta: { title: '出库单', noCache: true }},
+      { path: 'retrievalAdd', component: _import('stock/retrieval/retrievalAdd'), name: 'retrievalAdd', meta: { title: '新增出库单', noCache: false, hideTag: true, hidden: true }},
+      { path: 'retrievalEdit/:id', component: _import('stock/retrieval/retrievalAdd'), name: 'retrievalEdit', meta: { title: '编辑出库单', noCache: false, hideTag: true, hidden: true }},
+      { path: 'retrievalDetail/:id', component: _import('stock/retrieval/retrievalAdd'), name: 'retrievalDetail', meta: { title: '出库单详情', noCache: false, hideTag: true, hidden: true }},
+      // 调拨单
+      { path: 'requisition', component: _import('stock/requisition/requisition'), name: 'requisition', meta: { title: '调拨单', noCache: true }},
+      { path: 'requisitionAdd', component: _import('stock/requisition/requisitionAdd'), name: 'requisitionAdd', meta: { title: '新增调拨单', noCache: false, hideTag: true, hidden: true }},
+      { path: 'requisitionEdit/:id', component: _import('stock/requisition/requisitionAdd'), name: 'requisitionEdit', meta: { title: '编辑调拨单', noCache: false, hideTag: true, hidden: true }},
+      { path: 'requisitionDetail/:id', component: _import('stock/requisition/requisitionAdd'), name: 'requisitionDetail', meta: { title: '调拨单详情', noCache: false, hideTag: true, hidden: true }},
+      // 换货单
+      { path: 'swap', component: _import('stock/swap/swap'), name: 'swap', meta: { title: '换货单', noCache: true }},
+      { path: 'swapAdd', component: _import('stock/swap/swapAdd'), name: 'swapAdd', meta: { title: '新增换货单', noCache: false, hideTag: true, hidden: true }},
+      { path: 'swapEdit/:id', component: _import('stock/swap/swapAdd'), name: 'swapEdit', meta: { title: '编辑换货单', noCache: false, hideTag: true, hidden: true }},
+      { path: 'swapDetail/:id', component: _import('stock/swap/swapAdd'), name: 'swapDetail', meta: { title: '换货单详情', noCache: false, hideTag: true, hidden: true }},
+      // 组装单
+      { path: 'assembly', component: _import('stock/assembly/assembly'), name: 'assembly', meta: { title: '组装单', noCache: true }},
+      { path: 'assemblyAdd', component: _import('stock/assembly/assemblyAdd'), name: 'assemblyAdd', meta: { title: '新增组装单', noCache: false, hideTag: true, hidden: true }},
+      { path: 'assemblyEdit/:id', component: _import('stock/assembly/assemblyAdd'), name: 'assemblyEdit', meta: { title: '编辑组装单', noCache: false, hideTag: true, hidden: true }},
+      { path: 'assemblyDetail/:id', component: _import('stock/assembly/assemblyAdd'), name: 'assemblyDetail', meta: { title: '组装单详情', noCache: false, hideTag: true, hidden: true }},
+      // 拆卸单
+      { path: 'disassembly', component: _import('stock/disassembly/disassembly'), name: 'disassembly', meta: { title: '拆卸单', noCache: true }},
+      { path: 'disassemblyAdd', component: _import('stock/disassembly/disassemblyAdd'), name: 'disassemblyAdd', meta: { title: '新增拆卸单', noCache: false, hideTag: true, hidden: true }},
+      { path: 'disassemblyEdit/:id', component: _import('stock/disassembly/disassemblyAdd'), name: 'disassemblyEdit', meta: { title: '编辑拆卸单', noCache: false, hideTag: true, hidden: true }},
+      { path: 'disassemblyDetail/:id', component: _import('stock/disassembly/disassemblyAdd'), name: 'disassemblyDetail', meta: { title: '拆卸单详情', noCache: false, hideTag: true, hidden: true }},
+      // 报损单
+      { path: 'breakage', component: _import('stock/breakage/breakage'), name: 'breakage', meta: { title: '报损单', noCache: true }},
+      { path: 'breakageAdd', component: _import('stock/breakage/breakageAdd'), name: 'breakageAdd', meta: { title: '新增报损单', noCache: false, hideTag: true, hidden: true }},
+      { path: 'breakageEdit/:id', component: _import('stock/breakage/breakageAdd'), name: 'breakageEdit', meta: { title: '编辑报损单', noCache: false, hideTag: true, hidden: true }},
+      { path: 'breakageDetail/:id', component: _import('stock/breakage/breakageAdd'), name: 'breakageDetail', meta: { title: '报损单详情', noCache: false, hideTag: true, hidden: true }},
+      // 盘点单
+      { path: 'stockCount', component: _import('stock/stockCount/stockCount'), name: 'stockCount', meta: { title: '盘点单', noCache: true }},
+      { path: 'stockCountAdd', component: _import('stock/stockCount/stockCountAdd'), name: 'stockCountAdd', meta: { title: '新增盘点单', noCache: false, hideTag: true, hidden: true }},
+      { path: 'stockCountEdit/:id', component: _import('stock/stockCount/stockCountAdd'), name: 'stockCountEdit', meta: { title: '编辑盘点单', noCache: false, hideTag: true, hidden: true }},
+      { path: 'stockCountDetail/:id', component: _import('stock/stockCount/stockCountAdd'), name: 'stockCountDetail', meta: { title: '盘点单详情', noCache: false, hideTag: true, hidden: true }}
+    ]
+  },
+  {
+    path: '/customer',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'customer',
+    meta: {
+      title: '客户管理',
+      icon: 'shangpin'
     },
-    {
-      path: '/dictManage',
-      component: Layout,
-      redirect: 'noredirect',
-      name: 'dictManage',
-      meta: {
-        title: '字典管理',
-        icon: 'zidian'
-      },
-      children: [
-        { path: 'dictList', component: _import('dictManage/dictList'), name: 'dictList', meta: { title: '字典列表', noCache: true }},
-        { path: 'dictDataList/:id', component: _import('dictManage/dictDataList'), name: 'dictDataList', meta: { title: '字典数据', noCache: false, hideTag: true, hidden: true }},
-      ]
+    children: [
+      { path: 'distributor', component: _import('customer/distributor'), name: 'distributor', meta: { title: '分销商管理', noCache: true }},
+      { path: 'business', component: _import('customer/business'), name: 'business', meta: { title: '企业客户管理', noCache: true }},
+      { path: 'vip', component: _import('customer/vip'), name: 'vip', meta: { title: '会员管理', noCache: true }},
+      { path: 'guest', component: _import('customer/guest'), name: 'guest', meta: { title: '散客管理', noCache: true }}
+    ]
+  },
+  {
+    path: '/dictManage',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'dictManage',
+    meta: {
+      title: '字典管理',
+      icon: 'zidian'
     },
-    {
-      path: '/report',
-      component: Layout,
-      redirect: 'noredirect',
-      name: 'report',
-      meta: {
-        title: '报表管理',
-        icon: 'zidian'
-      },
-      children: [
-        { path: 'stockReport', component: _import('report/stockReport'), name: 'stockReport', meta: { title: '库存报表',icon: 'dashboard', noCache: true }},
-      ]
+    children: [
+      { path: 'dictList', component: _import('dictManage/dictList'), name: 'dictList', meta: { title: '字典列表', noCache: true }},
+      { path: 'dictDataList/:id', component: _import('dictManage/dictDataList'), name: 'dictDataList', meta: { title: '字典数据', noCache: false, hideTag: true, hidden: true }}
+    ]
+  },
+  {
+    path: '/report',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'report',
+    meta: {
+      title: '报表管理',
+      icon: 'zidian'
     },
+    children: [
+      { path: 'stockReport', component: _import('report/stockReport'), name: 'stockReport', meta: { title: '库存报表', icon: 'dashboard', noCache: true }}
+    ]
+  },
 
-    {
-      path: '/sys',
-      component: Layout,
-      redirect: 'noredirect',
-      name: 'sysManage',
-      meta: {
-        title: '系统管理',
-        icon: 'chart'
-      },
-      children: [
-        { path: 'admin', component: _import('sys/admin'), name: 'admin', meta: { title: '用户管理', noCache: true }},
-        { path: 'dept', component: _import('sys/dept'), name: 'dept', meta: { title: '部门管理', noCache: true }},
-        { path: 'role', component: _import('sys/role'), name: 'role', meta: { title: '角色管理', noCache: true }},
-      ]
+  {
+    path: '/sys',
+    component: Layout,
+    redirect: 'noredirect',
+    name: 'sysManage',
+    meta: {
+      title: '系统管理',
+      icon: 'chart'
     },
+    children: [
+      { path: 'admin', component: _import('sys/admin'), name: 'admin', meta: { title: '用户管理', noCache: true }},
+      { path: 'dept', component: _import('sys/dept'), name: 'dept', meta: { title: '部门管理', noCache: true }},
+      { path: 'role', component: _import('sys/role'), name: 'role', meta: { title: '角色管理', noCache: true }}
+    ]
+  },
 
-    { path: '*', redirect: '/404', hidden: true }
+  { path: '*', redirect: '/404', hidden: true }
 ]

+ 3 - 3
src/store/modules/permission.js

@@ -32,12 +32,12 @@ function filterAsyncRouter(asyncRouterMap, roles) {
       children = filterAsyncRouter(children, roles)
       obj.children = children
     }
-    if(children && children.length) {
+    if (children && children.length) {
       accessedRouters.push(obj)
-    } else if(hasPermission(roles, obj)) {
+    } else if (hasPermission(roles, obj)) {
       accessedRouters.push(obj)
     }
-  });
+  })
   // const accessedRouters = list.filter(route => {
   //   if (route.children && route.children.length) {
   //     route.children = filterAsyncRouter(route.children, roles)

+ 2 - 2
src/store/modules/user.js

@@ -44,8 +44,8 @@ const user = {
   },
 
   actions: {
-    //保存token
-    SetToken({ commit }, token){
+    // 保存token
+    SetToken({ commit }, token) {
       commit('SET_TOKEN', token)
     },
     // 用户名登录

+ 2 - 2
src/ui-components/PickerGoods/src/defaultOptions.js

@@ -51,7 +51,7 @@ export const data = {
 // 一般列
 export const generalColumns = [
   { label: '商品编号', prop: 'productCode' },
-  { label: '商品名称', prop: 'productName'},
-  { label: '单价(¥)', prop: 'createPrice' },
+  { label: '商品名称', prop: 'productName' },
+  { label: '单价(¥)', prop: 'createPrice' }
   // { label: '商品类别', prop: 'dictType' }
 ]

+ 3 - 3
src/ui-components/PickerGoods/src/main.js

@@ -2,7 +2,7 @@ import Vue from 'vue'
 import Main from './main.vue'
 import * as Options from './defaultOptions'
 
-let GoodsConstructor = Vue.extend(Main)
+const GoodsConstructor = Vue.extend(Main)
 
 let instance
 let seed = 1
@@ -14,9 +14,9 @@ const Goods = function(options) {
   return new Promise((resolve, reject) => {
     options = options || {}
     if (!options.goodsApi) {
-      options.goodsApi = process.env.BASE_API +'/warehouse-info/info/inventory';
+      options.goodsApi = process.env.BASE_API + '/warehouse-info/info/inventory'
     }
-    let id = 'goods_picker_' + seed++
+    const id = 'goods_picker_' + seed++
     options.show = true
     instance = new GoodsConstructor({ propsData: options })
     instance.id = id

+ 2 - 2
src/ui-components/PickerGoods/src/main.vue

@@ -55,7 +55,7 @@ export default {
       radioGuide: '',
       goodsParams: {
         page: 1,
-        limit: 10,
+        limit: 10
         // market_enable: true //状态
       },
       searchParams: {
@@ -153,7 +153,7 @@ export default {
         loading: false,
         params: {
           ...params,
-          ...this.goodsApiParams,
+          ...this.goodsApiParams
         }
       }).then(response => {
         this.loading = false

+ 3 - 3
src/ui-components/index.js

@@ -3,8 +3,8 @@
  */
 import PickerGoods from './PickerGoods'
 
-let components = {
-  PickerGoods,
+const components = {
+  PickerGoods
 }
 
 components.install = function(Vue, opts) {
@@ -14,7 +14,7 @@ components.install = function(Vue, opts) {
 }
 
 export {
-  PickerGoods,
+  PickerGoods
 }
 
 export default components

+ 20 - 20
src/utils/index.js

@@ -10,53 +10,53 @@
  * @param {*} children 孩子节点字段 默认 'children'
  */
 export function handleTree(data, id, parentId, children) {
-  let config = {
+  const config = {
     id: id || 'id',
     parentId: parentId || 'parentId',
     childrenList: children || 'children'
-  };
+  }
 
-  var childrenListMap = {};
-  var nodeIds = {};
-  var tree = [];
+  var childrenListMap = {}
+  var nodeIds = {}
+  var tree = []
 
-  for (let d of data) {
-    let parentId = d[config.parentId];
+  for (const d of data) {
+    const parentId = d[config.parentId]
     if (childrenListMap[parentId] == null) {
-      childrenListMap[parentId] = [];
+      childrenListMap[parentId] = []
     }
-    nodeIds[d[config.id]] = d;
-    childrenListMap[parentId].push(d);
+    nodeIds[d[config.id]] = d
+    childrenListMap[parentId].push(d)
   }
 
-  for (let d of data) {
-    let parentId = d[config.parentId];
+  for (const d of data) {
+    const parentId = d[config.parentId]
     if (nodeIds[parentId] == null) {
-      tree.push(d);
+      tree.push(d)
     }
   }
 
-  for (let t of tree) {
-    adaptToChildrenList(t);
+  for (const t of tree) {
+    adaptToChildrenList(t)
   }
 
   function adaptToChildrenList(o) {
     if (childrenListMap[o[config.id]] !== null) {
-      o[config.childrenList] = childrenListMap[o[config.id]];
+      o[config.childrenList] = childrenListMap[o[config.id]]
     }
     if (o[config.childrenList]) {
-      for (let c of o[config.childrenList]) {
-        adaptToChildrenList(c);
+      for (const c of o[config.childrenList]) {
+        adaptToChildrenList(c)
       }
     }
   }
-  return tree;
+  return tree
 }
 
 // 表单重置
 export function resetForm(refName) {
   if (this.$refs[refName]) {
-    this.$refs[refName].resetFields();
+    this.$refs[refName].resetFields()
   }
 }
 

+ 16 - 18
src/utils/request.js

@@ -22,50 +22,48 @@ service.interceptors.request.use(config => {
   Promise.reject(error)
 })
 
-// respone interceptor
+// response interceptor
 service.interceptors.response.use(
   response => {
     const res = response.data
-    let errmsg = res.errmsg;
     if (res.errno !== 0) {
-      if(res.errno==401){
+      if (res.errno === 401) {
         MessageBox.alert('没有权限登录系统,请重新登录', '已退出', {
           confirmButtonText: '重新登录',
           type: 'error'
         }).then(() => {
           store.dispatch('FedLogOut').then(() => {
-            location.href = process.env.OS_API;
-            // location.reload()
+            location.href = process.env.OS_API
           })
         })
-      }else if(res.errno==403){
+      } else if (res.errno === 403) {
         MessageBox.alert('登录超时自动退出系统,请重新登录', '已退出', {
           confirmButtonText: '重新登录',
           type: 'error'
         }).then(() => {
           store.dispatch('FedLogOut').then(() => {
-            location.href = process.env.OS_API;
-             // location.reload()
+            location.href = process.env.OS_API
           })
         })
-      }else{
-        MessageBox.alert(errmsg,'操作失败', {
+      } else {
+        MessageBox.alert(res.errmsg, '操作失败', {
           confirmButtonText: '确定',
           type: 'error'
-        }).then(() => {})
+        })
       }
-      return Promise.reject('error')
-    } else {
-      return response
+      return Promise.reject(new Error(res.errmsg || 'Error'))
     }
-  }, error => {
-    console.log('err' + error)// for debug
+    return response
+  },
+  error => {
+    console.log('err' + error)
     Message({
       message: '连接超时(后台不能连接,请联系系统管理员)',
       type: 'error',
-      duration: 5 * 1000
+      duration: 5000
     })
     return Promise.reject(error)
-  })
+  }
+)
 
 export default service

+ 11 - 11
src/views/basicSetting/express.vue

@@ -130,19 +130,19 @@ export default {
       listLoading: false,
       statusList: [
         { type: 0, name: '启用' },
-        { type: 1, name: '停用' },
+        { type: 1, name: '停用' }
       ],
       listQuery: {
         page: 1,
         limit: 10,
         logisticsName: '',
-        status: '',
+        status: ''
       },
       dataForm: {
         logisticsName: undefined,
         queryCode: undefined,
         rookieCode: undefined,
-        remarks: undefined,
+        remarks: undefined
       },
       dialogFormVisible: false,
       dialogStatus: '',
@@ -153,8 +153,8 @@ export default {
       rules: {
         logisticsName: [{ required: true, message: '物流公司名称不能为空', trigger: 'blur' }],
         queryCode: [{ required: true, message: '快递查询代码不能为空', trigger: 'blur' }],
-        rookieCode: [{ required: true, message: '菜鸟代码不能为空', trigger: 'blur' }],
-      },
+        rookieCode: [{ required: true, message: '菜鸟代码不能为空', trigger: 'blur' }]
+      }
     }
   },
   created() {
@@ -166,9 +166,9 @@ export default {
         page: 1,
         limit: 10,
         logisticsName: '',
-        status: '',
-      };
-      this.handleQuery();
+        status: ''
+      }
+      this.handleQuery()
     },
     getList() {
       this.listLoading = true
@@ -199,7 +199,7 @@ export default {
         logisticsName: undefined,
         queryCode: undefined,
         rookieCode: undefined,
-        remarks: undefined,
+        remarks: undefined
       }
     },
     handleCreate() {
@@ -268,7 +268,7 @@ export default {
       }).catch(() => { })
     },
     handleDownload() {
-      window.location.href = process.env.BASE_API + '/logistics-company/export';
+      window.location.href = process.env.BASE_API + '/logistics-company/export'
     },
     changeState(id, status) {
       setState({ id: id, status: status }).then(response => {
@@ -280,7 +280,7 @@ export default {
         })
         this.getList()
       })
-    },
+    }
   }
 }
 </script>

+ 10 - 10
src/views/basicSetting/store.vue

@@ -139,7 +139,7 @@ export default {
         limit: 10,
         storeCode: '',
         storeName: '',
-        contactsId: '',
+        contactsId: ''
       },
       dataForm: {
         storeCode: undefined,
@@ -147,7 +147,7 @@ export default {
         contactsId: undefined,
         contactsPhone: undefined,
         storeAddress: undefined,
-        remarks: undefined,
+        remarks: undefined
       },
       dialogFormVisible: false,
       dialogStatus: '',
@@ -157,13 +157,13 @@ export default {
       },
       rules: {
         storeCode: [
-          { required: true, message: "门店编号不能为空", trigger: "blur" },
+          { required: true, message: '门店编号不能为空', trigger: 'blur' }
         ],
         storeName: [{ required: true, message: '门店名称不能为空', trigger: 'blur' }],
         contactsId: [{ required: true, message: '联系人不能为空', trigger: 'blur' }],
         contactsPhone: [{ required: true, message: '联系电话不能为空', trigger: 'blur' }],
         storeAddress: [{ required: true, message: '门店地址不能为空', trigger: 'blur' }]
-      },
+      }
     }
   },
   created() {
@@ -176,9 +176,9 @@ export default {
         limit: 10,
         storeCode: '',
         storeName: '',
-        contactsId: '',
-      };
-      this.handleQuery();
+        contactsId: ''
+      }
+      this.handleQuery()
     },
     getList() {
       this.listLoading = true
@@ -211,7 +211,7 @@ export default {
         contactsId: undefined,
         contactsPhone: undefined,
         storeAddress: undefined,
-        remarks: undefined,
+        remarks: undefined
       }
     },
     handleCreate() {
@@ -280,8 +280,8 @@ export default {
       }).catch(() => { })
     },
     handleDownload() {
-      window.location.href = process.env.BASE_API + '/store-info/export';
-    },
+      window.location.href = process.env.BASE_API + '/store-info/export'
+    }
   }
 }
 </script>

+ 388 - 388
src/views/basicSetting/supplier.vue

@@ -253,400 +253,400 @@
 </template>
 
 <script>
-import { createSupplier, updateSupplier, listSupplier, deleteSupplier, typeListSupplier, setStateSupplier } from "@/api/supplier";
-import { listDept } from "@/api/dept";
-import Treeselect from "@riophae/vue-treeselect";
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
-import waves from "@/directive/waves";
+import { createSupplier, updateSupplier, listSupplier, deleteSupplier, typeListSupplier, setStateSupplier } from '@/api/supplier'
+import { listDept } from '@/api/dept'
+import Treeselect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import waves from '@/directive/waves'
 
 export default {
-    components: { Treeselect },
-    directives: { waves },
-    data() {
-        return {
-            categoryOptions: [],
-            activeName: 'first',
-            brandOptions: [],
-            goodsStatusList: [
-                { type: 0, name: '启用' },
-                { type: 1, name: '停用' },
-            ],
-            list: [],
-            total: 0,
-            listLoading: false,
-            listQuery: {
-                page: 1,
-                limit: 10,
-                supplierName: '',
-                supplierNum: '',
-                typeId: '',
-                responsibleDept: undefined,
-                isEnable: '',
-            },
-            dataForm: {
-                supplierName: undefined,
-                supplierNum: undefined,
-                typeId: undefined,
-                supplierPurchasAddress: undefined,
-                registeredCapital: undefined,
-                bankCardNo: undefined,
-                bankCardName: undefined,
-                nature: undefined,
-                taxrate: undefined,
-                supplierContact: undefined,
-                supplierPhone: undefined,
-                supplierAddress: undefined,
-                responsibleDept: undefined,
-                supplierRemark: undefined,
-                businessName: undefined,
-                businessStartTime: undefined,
-                businessEndTime: undefined,
-                businessFile: undefined,
-                businessFiles: [],
-                financeFileId: undefined,
-                financeFiles: [],
-                auditFileId: undefined,
-                auditFiles: [],
-                qualifiedName: undefined,
-                qualifiedStartTime: undefined,
-                qualifiedEndTime: undefined,
-                qualifiedFile: undefined,
-                qualifiedFiles: [],
-            },
-            dialogFormVisible: false,
-            dialogStatus: '',
-            textMap: {
-                update: "编辑供应商",
-                create: "添加供应商",
-            },
-            rules: {
-                supplierName: [{ required: true, message: "请填写供应商名称", trigger: "blur" }],
-                typeId: [{ required: true, message: "请选择供应商类别", trigger: "blur" }],
-                supplierPurchasAddress: [{ required: true, message: "请填写地域", trigger: "blur" }],
-                registeredCapital: [
-                    { required: true, message: "请填写注册资本金", trigger: "blur" },
-                    { pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,2})?$/, message: "请输入合法的金额数字,最多两位小数", trigger: "blur" }
-                ],
-                bankCardNo: [{ required: true, message: "请填写银行卡号", trigger: "blur" }],
-                bankCardName: [{ required: true, message: "请填写银行名称", trigger: "blur" }],
-                nature: [{ required: true, message: "请选择纳税性质", trigger: "blur" }],
-                taxrate: [{ required: true, message: "请选择税率", trigger: "blur" }],
-                supplierContact: [{ required: true, message: "请填写联系人", trigger: "blur" }],
-                supplierPhone: [{ required: true, message: "请填写联系电话", trigger: "blur" }],
-                supplierAddress: [{ required: true, message: "请填写单位地址", trigger: "blur" }],
-                responsibleDept: [{ required: true, message: "请选择申请部门", trigger: "blur" }],
-                supplierRemark: [{ required: true, message: "请填写申请事由", trigger: "blur" }],
-                businessName: [{ required: true, message: "请填写营业执照名称", trigger: "blur" }],
-                businessStartTime: [{ required: true, message: "请选择开始日期", trigger: "blur" }],
-                businessEndTime: [{ required: true, message: "请选择结束日期", trigger: "blur" }],
-                businessFile: [{ required: true, message: "请上传营业执照", trigger: "blur" }],
-            },
-            fileImgUrl: this.upLoadUrl,
+  components: { Treeselect },
+  directives: { waves },
+  data() {
+    return {
+      categoryOptions: [],
+      activeName: 'first',
+      brandOptions: [],
+      goodsStatusList: [
+        { type: 0, name: '启用' },
+        { type: 1, name: '停用' }
+      ],
+      list: [],
+      total: 0,
+      listLoading: false,
+      listQuery: {
+        page: 1,
+        limit: 10,
+        supplierName: '',
+        supplierNum: '',
+        typeId: '',
+        responsibleDept: undefined,
+        isEnable: ''
+      },
+      dataForm: {
+        supplierName: undefined,
+        supplierNum: undefined,
+        typeId: undefined,
+        supplierPurchasAddress: undefined,
+        registeredCapital: undefined,
+        bankCardNo: undefined,
+        bankCardName: undefined,
+        nature: undefined,
+        taxrate: undefined,
+        supplierContact: undefined,
+        supplierPhone: undefined,
+        supplierAddress: undefined,
+        responsibleDept: undefined,
+        supplierRemark: undefined,
+        businessName: undefined,
+        businessStartTime: undefined,
+        businessEndTime: undefined,
+        businessFile: undefined,
+        businessFiles: [],
+        financeFileId: undefined,
+        financeFiles: [],
+        auditFileId: undefined,
+        auditFiles: [],
+        qualifiedName: undefined,
+        qualifiedStartTime: undefined,
+        qualifiedEndTime: undefined,
+        qualifiedFile: undefined,
+        qualifiedFiles: []
+      },
+      dialogFormVisible: false,
+      dialogStatus: '',
+      textMap: {
+        update: '编辑供应商',
+        create: '添加供应商'
+      },
+      rules: {
+        supplierName: [{ required: true, message: '请填写供应商名称', trigger: 'blur' }],
+        typeId: [{ required: true, message: '请选择供应商类别', trigger: 'blur' }],
+        supplierPurchasAddress: [{ required: true, message: '请填写地域', trigger: 'blur' }],
+        registeredCapital: [
+          { required: true, message: '请填写注册资本金', trigger: 'blur' },
+          { pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,2})?$/, message: '请输入合法的金额数字,最多两位小数', trigger: 'blur' }
+        ],
+        bankCardNo: [{ required: true, message: '请填写银行卡号', trigger: 'blur' }],
+        bankCardName: [{ required: true, message: '请填写银行名称', trigger: 'blur' }],
+        nature: [{ required: true, message: '请选择纳税性质', trigger: 'blur' }],
+        taxrate: [{ required: true, message: '请选择税率', trigger: 'blur' }],
+        supplierContact: [{ required: true, message: '请填写联系人', trigger: 'blur' }],
+        supplierPhone: [{ required: true, message: '请填写联系电话', trigger: 'blur' }],
+        supplierAddress: [{ required: true, message: '请填写单位地址', trigger: 'blur' }],
+        responsibleDept: [{ required: true, message: '请选择申请部门', trigger: 'blur' }],
+        supplierRemark: [{ required: true, message: '请填写申请事由', trigger: 'blur' }],
+        businessName: [{ required: true, message: '请填写营业执照名称', trigger: 'blur' }],
+        businessStartTime: [{ required: true, message: '请选择开始日期', trigger: 'blur' }],
+        businessEndTime: [{ required: true, message: '请选择结束日期', trigger: 'blur' }],
+        businessFile: [{ required: true, message: '请上传营业执照', trigger: 'blur' }]
+      },
+      fileImgUrl: this.upLoadUrl
+    }
+  },
+  created() {
+    this.getListDept()
+    this.getTypeList()
+    this.getList()
+  },
+  methods: {
+    handleDownLoad() {
+      window.location.href = process.env.BASE_API + '/supplier-info/export'
+    },
+    changeState(id, isEnable) {
+      setStateSupplier({ id: id, isEnable: isEnable }).then(response => {
+        this.$notify({ title: '成功', message: '状态修改成功', type: 'success', duration: 2000 })
+        this.getList()
+      })
+    },
+    getListDept() {
+      listDept().then(response => {
+        this.categoryOptions = this.handleTree(response.data.data, 'deptId')
+      })
+    },
+    normalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children
+      }
+      return { id: node.deptId, label: node.deptName, children: node.children }
+    },
+    handleClick(tab, event) {
+      console.log(tab, event)
+    },
+    handleRemoveFile(file, fileList, type) {
+      if (type == 'financeFiles') {
+        const financeFiles = []
+        for (const i in fileList) {
+          const id = fileList[i].response.data.id
+          financeFiles.push(id)
+        }
+        this.dataForm.financeFileId = financeFiles.join(',')
+      } else {
+        const auditFiles = []
+        for (const i in fileList) {
+          const id = fileList[i].response.data.id
+          auditFiles.push(id)
+        }
+        this.dataForm.auditFileId = auditFiles.join(',')
+      }
+    },
+    beforeUploadFile(file) {
+      const size = file.size / 1024 / 1024
+      if (size > 10) {
+        this.$message.error('文件大小不能超过 10MB!')
+        return false
+      }
+    },
+    handleFileSuccess(res, file, fileList, type) {
+      if (type == 'financeFiles') {
+        const financeFiles = []
+        for (const i in fileList) {
+          const response = fileList[i].response
+          if (response.errno && response.errno != '0') {
+            this.$message.error('该文件上传失败,已被移除,请重新上传!')
+            financeFiles.splice(i, 1)
+          } else {
+            const id = fileList[i].response.data.id
+            financeFiles.push(id)
+          }
+        }
+        this.dataForm.financeFileId = financeFiles.join(',')
+      } else {
+        const auditFiles = []
+        for (const i in fileList) {
+          const response = fileList[i].response
+          if (response.errno && response.errno != '0') {
+            this.$message.error('该文件上传失败,已被移除,请重新上传!')
+            auditFiles.splice(i, 1)
+          } else {
+            const id = fileList[i].response.data.id
+            auditFiles.push(id)
+          }
+        }
+        this.dataForm.auditFileId = auditFiles.join(',')
+      }
+    },
+    handleRemoveImg(file, fileList, type) {
+      if (type == 'qualifiedFiles') {
+        const qualifiedFiles = []
+        for (const i in fileList) {
+          const id = fileList[i].response.data.id
+          qualifiedFiles.push(id)
+        }
+        this.dataForm.qualifiedFile = qualifiedFiles.join(',')
+      } else {
+        const businessFiles = []
+        for (const i in fileList) {
+          const id = fileList[i].response.data.id
+          businessFiles.push(id)
+        }
+        this.dataForm.businessFile = businessFiles.join(',')
+      }
+    },
+    beforeUploadImg(file) {
+      const isJPGs = file.type === 'image/jpeg'
+      console.log(isJPGs)
+    },
+    handleExceed(files, fileList) {
+      this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件!,共选择了 ${files.length + fileList.length} 个文件`)
+    },
+    handleImgSucess(res, file, fileList, type) {
+      if (type == 'qualifiedFiles') {
+        const qualifiedFiles = []
+        for (const i in fileList) {
+          const response = fileList[i].response
+          if (response.errno && response.errno != '0') {
+            this.$message.error('该图片上传失败,已被移除,请重新上传!')
+            fileList.splice(i, 1)
+          } else {
+            const id = fileList[i].response.data.id
+            qualifiedFiles.push(id)
+          }
         }
+        this.dataForm.qualifiedFile = qualifiedFiles.join(',')
+      } else {
+        const businessFiles = []
+        for (const i in fileList) {
+          const response = fileList[i].response
+          if (response.errno && response.errno != '0') {
+            this.$message.error('该图片上传失败,已被移除,请重新上传!')
+            businessFiles.splice(i, 1)
+          } else {
+            const id = fileList[i].response.data.id
+            businessFiles.push(id)
+          }
+        }
+        this.dataForm.businessFile = businessFiles.join(',')
+      }
+    },
+    resetForm() {
+      this.dataForm = {
+        supplierName: undefined,
+        supplierNum: undefined,
+        typeId: undefined,
+        supplierPurchasAddress: undefined,
+        registeredCapital: undefined,
+        bankCardNo: undefined,
+        bankCardName: undefined,
+        nature: undefined,
+        taxrate: undefined,
+        supplierContact: undefined,
+        supplierPhone: undefined,
+        supplierAddress: undefined,
+        responsibleDept: undefined,
+        supplierRemark: undefined,
+        businessName: undefined,
+        businessStartTime: undefined,
+        businessEndTime: undefined,
+        businessFile: undefined,
+        businessFiles: [],
+        financeFileId: undefined,
+        financeFiles: [],
+        auditFileId: undefined,
+        auditFiles: [],
+        qualifiedName: undefined,
+        qualifiedStartTime: undefined,
+        qualifiedEndTime: undefined,
+        qualifiedFile: undefined,
+        qualifiedFiles: []
+      }
+    },
+    handleAdd() {
+      this.activeName = 'first'
+      this.resetForm()
+      this.dialogFormVisible = true
+      this.dialogStatus = 'create'
+      this.$nextTick(() => {
+        this.$refs['dataForm'].clearValidate()
+      })
+    },
+    createData() {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          createSupplier(this.dataForm).then((response) => {
+            this.getList()
+            this.dialogFormVisible = false
+            this.$notify({ title: '成功', message: '创建成功', type: 'success', duration: 2000 })
+            this.reload()
+          }).catch(() => { })
+        }
+      })
+    },
+    handleUpdate(row) {
+      this.activeName = 'first'
+      this.dataForm = Object.assign({}, row)
+      if (this.dataForm.businessFiles) {
+        const files = this.dataForm.businessFiles
+        this.dataForm.businessFiles = []
+        for (const i in files) {
+          this.dataForm.businessFiles.push({
+            name: files[i].oldName,
+            url: files[i].url,
+            response: { error: '0', data: { url: files[i].url, id: files[i].id }}
+          })
+        }
+      }
+      if (this.dataForm.qualifiedFiles) {
+        const files = this.dataForm.qualifiedFiles
+        this.dataForm.qualifiedFiles = []
+        for (const i in files) {
+          this.dataForm.qualifiedFiles.push({
+            name: files[i].oldName,
+            url: files[i].url,
+            response: { error: '0', data: { url: files[i].url, id: files[i].id }}
+          })
+        }
+      }
+      if (this.dataForm.financeFiles) {
+        const files = this.dataForm.financeFiles
+        this.dataForm.financeFiles = []
+        for (const i in files) {
+          this.dataForm.financeFiles.push({
+            name: files[i].oldName,
+            url: files[i].url,
+            response: { error: '0', data: { url: files[i].url, id: files[i].id }}
+          })
+        }
+      }
+      if (this.dataForm.auditFiles) {
+        const files = this.dataForm.auditFiles
+        this.dataForm.auditFiles = []
+        for (const i in files) {
+          this.dataForm.auditFiles.push({
+            name: files[i].oldName,
+            url: files[i].url,
+            response: { error: '0', data: { url: files[i].url, id: files[i].id }}
+          })
+        }
+      }
+      this.dialogStatus = 'update'
+      this.dialogFormVisible = true
+      this.$nextTick(() => {
+        this.$refs['dataForm'].clearValidate()
+      })
+    },
+    updateData() {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          updateSupplier(this.dataForm).then(() => {
+            this.dialogFormVisible = false
+            this.$notify({ title: '成功', message: '更新成功', type: 'success', duration: 2000 })
+            this.getList()
+          })
+        }
+      })
+    },
+    handleDelete(row) {
+      this.$confirm('确认删除吗?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
+        .then(() => {
+          deleteSupplier({ id: row.id }).then(response => {
+            this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
+            this.getList()
+          })
+        }).catch(() => { })
+    },
+    getTypeList() {
+      typeListSupplier().then(response => {
+        this.brandOptions = response.data.data.map((item) => {
+          return { value: item.typeId, label: item.typeName }
+        })
+      }).catch(() => {
+        this.brandOptions = []
+      })
+    },
+    getList() {
+      this.listLoading = true
+      listSupplier(this.listQuery).then(response => {
+        this.list = response.data.data.items
+        this.total = response.data.data.total
+        this.listLoading = false
+      }).catch(() => { })
+    },
+    handleQuery() {
+      this.listQuery.page = 1
+      this.getList()
+    },
+    resetQuery() {
+      this.listQuery = {
+        page: 1,
+        limit: 10,
+        supplierName: '',
+        supplierNum: '',
+        typeId: '',
+        responsibleDept: '',
+        isEnable: ''
+      }
+      this.handleQuery()
     },
-    created() {
-        this.getListDept();
-        this.getTypeList();
-        this.getList();
+    handleSizeChange(val) {
+      this.listQuery.limit = val
+      this.getList()
     },
-    methods: {
-        handleDownLoad() {
-            window.location.href = process.env.BASE_API + '/supplier-info/export';
-        },
-        changeState(id, isEnable) {
-            setStateSupplier({ id: id, isEnable: isEnable }).then(response => {
-                this.$notify({ title: '成功', message: '状态修改成功', type: 'success', duration: 2000 });
-                this.getList();
-            });
-        },
-        getListDept() {
-            listDept().then(response => {
-                this.categoryOptions = this.handleTree(response.data.data, "deptId");
-            });
-        },
-        normalizer(node) {
-            if (node.children && !node.children.length) {
-                delete node.children;
-            }
-            return { id: node.deptId, label: node.deptName, children: node.children };
-        },
-        handleClick(tab, event) {
-            console.log(tab, event);
-        },
-        handleRemoveFile(file, fileList, type) {
-            if (type == "financeFiles") {
-                let financeFiles = [];
-                for (let i in fileList) {
-                    let id = fileList[i].response.data.id;
-                    financeFiles.push(id);
-                }
-                this.dataForm.financeFileId = financeFiles.join(",");
-            } else {
-                let auditFiles = [];
-                for (let i in fileList) {
-                    let id = fileList[i].response.data.id;
-                    auditFiles.push(id);
-                }
-                this.dataForm.auditFileId = auditFiles.join(",");
-            }
-        },
-        beforeUploadFile(file) {
-            const size = file.size / 1024 / 1024;
-            if (size > 10) {
-                this.$message.error("文件大小不能超过 10MB!");
-                return false;
-            }
-        },
-        handleFileSuccess(res, file, fileList, type) {
-            if (type == "financeFiles") {
-                let financeFiles = [];
-                for (let i in fileList) {
-                    let response = fileList[i].response;
-                    if (response.errno && response.errno != "0") {
-                        this.$message.error("该文件上传失败,已被移除,请重新上传!");
-                        financeFiles.splice(i, 1);
-                    } else {
-                        let id = fileList[i].response.data.id;
-                        financeFiles.push(id);
-                    }
-                }
-                this.dataForm.financeFileId = financeFiles.join(",");
-            } else {
-                let auditFiles = [];
-                for (let i in fileList) {
-                    let response = fileList[i].response;
-                    if (response.errno && response.errno != "0") {
-                        this.$message.error("该文件上传失败,已被移除,请重新上传!");
-                        auditFiles.splice(i, 1);
-                    } else {
-                        let id = fileList[i].response.data.id;
-                        auditFiles.push(id);
-                    }
-                }
-                this.dataForm.auditFileId = auditFiles.join(",");
-            }
-        },
-        handleRemoveImg(file, fileList, type) {
-            if (type == "qualifiedFiles") {
-                let qualifiedFiles = [];
-                for (let i in fileList) {
-                    let id = fileList[i].response.data.id;
-                    qualifiedFiles.push(id);
-                }
-                this.dataForm.qualifiedFile = qualifiedFiles.join(",");
-            } else {
-                let businessFiles = [];
-                for (let i in fileList) {
-                    let id = fileList[i].response.data.id;
-                    businessFiles.push(id);
-                }
-                this.dataForm.businessFile = businessFiles.join(",");
-            }
-        },
-        beforeUploadImg(file) {
-            const isJPGs = file.type === "image/jpeg";
-            console.log(isJPGs);
-        },
-        handleExceed(files, fileList) {
-            this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件!,共选择了 ${files.length + fileList.length} 个文件`);
-        },
-        handleImgSucess(res, file, fileList, type) {
-            if (type == "qualifiedFiles") {
-                let qualifiedFiles = [];
-                for (let i in fileList) {
-                    let response = fileList[i].response;
-                    if (response.errno && response.errno != "0") {
-                        this.$message.error("该图片上传失败,已被移除,请重新上传!");
-                        fileList.splice(i, 1);
-                    } else {
-                        let id = fileList[i].response.data.id;
-                        qualifiedFiles.push(id);
-                    }
-                }
-                this.dataForm.qualifiedFile = qualifiedFiles.join(",");
-            } else {
-                let businessFiles = [];
-                for (let i in fileList) {
-                    let response = fileList[i].response;
-                    if (response.errno && response.errno != "0") {
-                        this.$message.error("该图片上传失败,已被移除,请重新上传!");
-                        businessFiles.splice(i, 1);
-                    } else {
-                        let id = fileList[i].response.data.id;
-                        businessFiles.push(id);
-                    }
-                }
-                this.dataForm.businessFile = businessFiles.join(",");
-            }
-        },
-        resetForm() {
-            this.dataForm = {
-                supplierName: undefined,
-                supplierNum: undefined,
-                typeId: undefined,
-                supplierPurchasAddress: undefined,
-                registeredCapital: undefined,
-                bankCardNo: undefined,
-                bankCardName: undefined,
-                nature: undefined,
-                taxrate: undefined,
-                supplierContact: undefined,
-                supplierPhone: undefined,
-                supplierAddress: undefined,
-                responsibleDept: undefined,
-                supplierRemark: undefined,
-                businessName: undefined,
-                businessStartTime: undefined,
-                businessEndTime: undefined,
-                businessFile: undefined,
-                businessFiles: [],
-                financeFileId: undefined,
-                financeFiles: [],
-                auditFileId: undefined,
-                auditFiles: [],
-                qualifiedName: undefined,
-                qualifiedStartTime: undefined,
-                qualifiedEndTime: undefined,
-                qualifiedFile: undefined,
-                qualifiedFiles: [],
-            };
-        },
-        handleAdd() {
-            this.activeName = 'first';
-            this.resetForm();
-            this.dialogFormVisible = true;
-            this.dialogStatus = "create";
-            this.$nextTick(() => {
-                this.$refs["dataForm"].clearValidate();
-            });
-        },
-        createData() {
-            this.$refs["dataForm"].validate((valid) => {
-                if (valid) {
-                    createSupplier(this.dataForm).then((response) => {
-                        this.getList();
-                        this.dialogFormVisible = false;
-                        this.$notify({ title: "成功", message: "创建成功", type: "success", duration: 2000 });
-                        this.reload();
-                    }).catch(() => { });
-                }
-            });
-        },
-        handleUpdate(row) {
-            this.activeName = 'first';
-            this.dataForm = Object.assign({}, row);
-            if (this.dataForm.businessFiles) {
-                let files = this.dataForm.businessFiles;
-                this.dataForm.businessFiles = [];
-                for (let i in files) {
-                    this.dataForm.businessFiles.push({
-                        name: files[i].oldName,
-                        url: files[i].url,
-                        response: { error: "0", data: { url: files[i].url, id: files[i].id } },
-                    });
-                }
-            }
-            if (this.dataForm.qualifiedFiles) {
-                let files = this.dataForm.qualifiedFiles;
-                this.dataForm.qualifiedFiles = [];
-                for (let i in files) {
-                    this.dataForm.qualifiedFiles.push({
-                        name: files[i].oldName,
-                        url: files[i].url,
-                        response: { error: "0", data: { url: files[i].url, id: files[i].id } },
-                    });
-                }
-            }
-            if (this.dataForm.financeFiles) {
-                let files = this.dataForm.financeFiles;
-                this.dataForm.financeFiles = [];
-                for (let i in files) {
-                    this.dataForm.financeFiles.push({
-                        name: files[i].oldName,
-                        url: files[i].url,
-                        response: { error: "0", data: { url: files[i].url, id: files[i].id } },
-                    });
-                }
-            }
-            if (this.dataForm.auditFiles) {
-                let files = this.dataForm.auditFiles;
-                this.dataForm.auditFiles = [];
-                for (let i in files) {
-                    this.dataForm.auditFiles.push({
-                        name: files[i].oldName,
-                        url: files[i].url,
-                        response: { error: "0", data: { url: files[i].url, id: files[i].id } },
-                    });
-                }
-            }
-            this.dialogStatus = 'update';
-            this.dialogFormVisible = true;
-            this.$nextTick(() => {
-                this.$refs['dataForm'].clearValidate();
-            });
-        },
-        updateData() {
-            this.$refs['dataForm'].validate((valid) => {
-                if (valid) {
-                    updateSupplier(this.dataForm).then(() => {
-                        this.dialogFormVisible = false;
-                        this.$notify({ title: '成功', message: '更新成功', type: 'success', duration: 2000 });
-                        this.getList();
-                    });
-                }
-            });
-        },
-        handleDelete(row) {
-            this.$confirm('确认删除吗?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
-                .then(() => {
-                    deleteSupplier({ id: row.id }).then(response => {
-                        this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 });
-                        this.getList();
-                    });
-                }).catch(() => { });
-        },
-        getTypeList() {
-            typeListSupplier().then(response => {
-                this.brandOptions = response.data.data.map((item) => {
-                    return { value: item.typeId, label: item.typeName };
-                });
-            }).catch(() => {
-                this.brandOptions = [];
-            });
-        },
-        getList() {
-            this.listLoading = true;
-            listSupplier(this.listQuery).then(response => {
-                this.list = response.data.data.items;
-                this.total = response.data.data.total;
-                this.listLoading = false;
-            }).catch(() => { });
-        },
-        handleQuery() {
-            this.listQuery.page = 1;
-            this.getList();
-        },
-        resetQuery() {
-            this.listQuery = {
-                page: 1,
-                limit: 10,
-                supplierName: '',
-                supplierNum: '',
-                typeId: '',
-                responsibleDept: '',
-                isEnable: '',
-            };
-            this.handleQuery();
-        },
-        handleSizeChange(val) {
-            this.listQuery.limit = val;
-            this.getList();
-        },
-        handleCurrentChange(val) {
-            this.listQuery.page = val;
-            this.getList();
-        },
+    handleCurrentChange(val) {
+      this.listQuery.page = val
+      this.getList()
     }
+  }
 }
 </script>
 

+ 10 - 10
src/views/basicSetting/warehouse.vue

@@ -144,7 +144,7 @@ export default {
         limit: 10,
         warehouseCode: '',
         warehouseName: '',
-        adminId: '',
+        adminId: ''
       },
       dataForm: {
         warehouseCode: undefined,
@@ -152,7 +152,7 @@ export default {
         adminId: undefined,
         adminPhone: undefined,
         warehouseAddress: undefined,
-        remarks: undefined,
+        remarks: undefined
       },
       dialogFormVisible: false,
       dialogStatus: '',
@@ -162,13 +162,13 @@ export default {
       },
       rules: {
         warehouseCode: [
-          { required: true, message: "仓库编号不能为空", trigger: "blur" },
+          { required: true, message: '仓库编号不能为空', trigger: 'blur' }
         ],
         warehouseName: [{ required: true, message: '仓库名称不能为空', trigger: 'blur' }],
         adminId: [{ required: true, message: '管理员不能为空', trigger: 'blur' }],
         adminPhone: [{ required: true, message: '联系电话不能为空', trigger: 'blur' }],
         warehouseAddress: [{ required: true, message: '仓库地址不能为空', trigger: 'blur' }]
-      },
+      }
     }
   },
   created() {
@@ -181,9 +181,9 @@ export default {
         limit: 10,
         warehouseCode: '',
         warehouseName: '',
-        adminId: '',
-      };
-      this.handleQuery();
+        adminId: ''
+      }
+      this.handleQuery()
     },
     getList() {
       this.listLoading = true
@@ -216,7 +216,7 @@ export default {
         adminId: undefined,
         adminPhone: undefined,
         warehouseAddress: undefined,
-        remarks: undefined,
+        remarks: undefined
       }
     },
     handleCreate() {
@@ -285,8 +285,8 @@ export default {
       }).catch(() => { })
     },
     handleDownload() {
-      window.location.href = process.env.BASE_API + '/warehouse-info/export';
-    },
+      window.location.href = process.env.BASE_API + '/warehouse-info/export'
+    }
   }
 }
 </script>

+ 44 - 44
src/views/customer/business.vue

@@ -115,27 +115,27 @@ export default {
       total: undefined,
       listLoading: true,
       statusList: [
-                {
-                    type: 0,
-                    name: '启用'
-                },
-                {
-                    type: 1,
-                    name: '停用'
-                },
-            ],
+        {
+          type: 0,
+          name: '启用'
+        },
+        {
+          type: 1,
+          name: '停用'
+        }
+      ],
       listQuery: {
         page: 1,
         limit: 10,
         companyName: undefined,
-        status: undefined,
+        status: undefined
       },
       dataForm: {
         customerCode: undefined,
         companyName: undefined,
         contactsName: undefined,
         contactsPhone: undefined,
-        remarks: undefined,
+        remarks: undefined
       },
       dialogFormVisible: false,
       dialogStatus: '',
@@ -145,18 +145,18 @@ export default {
       },
       rules: {
         customerCode: [
-          { required: true, message: "企业编号不能为空", trigger: "blur" },
+          { required: true, message: '企业编号不能为空', trigger: 'blur' }
           // { min: 6, max: 6, message: "企业编号必须为6位", trigger: "blur" },
           // { pattern: /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,}$/, message: "企业编号必须为6位字母加数字", trigger: "blur" }
         ],
         companyName: [{ required: true, message: '企业名称不能为空', trigger: 'blur' }],
         contactsName: [{ required: true, message: '联系人不能为空', trigger: 'blur' }],
-        contactsPhone: [{ required: true, message: '联系电话不能为空', trigger: 'blur' }],
-      },
+        contactsPhone: [{ required: true, message: '联系电话不能为空', trigger: 'blur' }]
+      }
     }
   },
   created() {
-    this.getList();
+    this.getList()
   },
   methods: {
     /** 重置按钮操作 */
@@ -165,9 +165,9 @@ export default {
         page: 1,
         limit: 10,
         companyName: undefined,
-        status: undefined,
-      };
-      this.handleQuery();
+        status: undefined
+      }
+      this.handleQuery()
     },
     getList() {
       this.listLoading = true
@@ -199,7 +199,7 @@ export default {
         companyName: undefined,
         contactsName: undefined,
         contactsPhone: undefined,
-        remarks: undefined,
+        remarks: undefined
       }
     },
     handleCreate() {
@@ -260,37 +260,37 @@ export default {
     },
     handleDelete(row) {
       this.$confirm('确认删除吗?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          deleteBusiness({id:row.id}).then(response => {
-            this.$notify({
-              title: '成功',
-              message: '删除成功',
-              type: 'success',
-              duration: 2000
-            })
-            this.getList()
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        deleteBusiness({ id: row.id }).then(response => {
+          this.$notify({
+            title: '成功',
+            message: '删除成功',
+            type: 'success',
+            duration: 2000
           })
-        }).catch(() => {
-  
+          this.getList()
         })
+      }).catch(() => {
+
+      })
     },
     handleDownload() {
-      window.location.href = process.env.BASE_API + '/customer-business/export';
+      window.location.href = process.env.BASE_API + '/customer-business/export'
     },
     changeState(id, status) {
-            setState({ id: id, status: status }).then(response => {
-                this.$notify({
-                    title: '成功',
-                    message: '状态修改成功',
-                    type: 'success',
-                    duration: 2000
-                })
-                this.getList()
-            })
-        },
+      setState({ id: id, status: status }).then(response => {
+        this.$notify({
+          title: '成功',
+          message: '状态修改成功',
+          type: 'success',
+          duration: 2000
+        })
+        this.getList()
+      })
+    }
   }
 }
 </script>

+ 20 - 20
src/views/customer/distributor.vue

@@ -125,7 +125,7 @@
 </template>
 <script>
 import { listDistributor, createDistributor, updateDistributor, deleteDistributor, setState } from '@/api/distributor'
-import { dataTypeList } from "@/api/public";
+import { dataTypeList } from '@/api/public'
 import waves from '@/directive/waves' // 水波纹指令
 
 export default {
@@ -144,14 +144,14 @@ export default {
         {
           type: 1,
           name: '停用'
-        },
+        }
       ],
       listQuery: {
         page: 1,
         limit: 10,
         companyName: undefined,
         companyLevel: undefined,
-        status: undefined,
+        status: undefined
       },
       dataForm: {
         customerCode: undefined,
@@ -160,16 +160,16 @@ export default {
         contractStart: undefined,
         contractEnd: undefined,
         contactsName: undefined,
-        contactsPhone: undefined,
+        contactsPhone: undefined
       },
       startDatePickerOptions: {
         disabledDate: (date) => {
-          return this.dataForm.contractEnd && date > new Date(this.dataForm.contractEnd);
+          return this.dataForm.contractEnd && date > new Date(this.dataForm.contractEnd)
         }
       },
       endDatePickerOptions: {
         disabledDate: (date) => {
-          return this.dataForm.contractStart && date < new Date(this.dataForm.contractStart);
+          return this.dataForm.contractStart && date < new Date(this.dataForm.contractStart)
         }
       },
       dialogFormVisible: false,
@@ -180,7 +180,7 @@ export default {
       },
       rules: {
         customerCode: [
-          { required: true, message: "分销商编号不能为空", trigger: "blur" },
+          { required: true, message: '分销商编号不能为空', trigger: 'blur' }
           // { min: 7, max: 7, message: "分销商编号必须为7位", trigger: "blur" },
           // { pattern: /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{7,}$/, message: "分销商编号必须为7位字母加数字", trigger: "blur" }
         ],
@@ -189,20 +189,20 @@ export default {
         contractStart: [{ required: true, message: '请选择分销商等级', trigger: 'blur' }],
         contractEnd: [{ required: true, message: '请选择合同结束日期', trigger: 'blur' }],
         contactsName: [{ required: true, message: '联系人不能为空', trigger: 'blur' }],
-        contactsPhone: [{ required: true, message: '联系电话不能为空', trigger: 'blur' }],
-      },
+        contactsPhone: [{ required: true, message: '联系电话不能为空', trigger: 'blur' }]
+      }
     }
   },
   created() {
-    this.getDictType();
-    this.getList();
+    this.getDictType()
+    this.getList()
   },
   methods: {
     getDictType() {
-      //分销商等级
+      // 分销商等级
       dataTypeList({ dictType: 'company_level' }).then(response => {
-        this.company_level = response.data.data;
-      });
+        this.company_level = response.data.data
+      })
     },
     /** 重置按钮操作 */
     resetQuery() {
@@ -211,9 +211,9 @@ export default {
         limit: 10,
         companyName: undefined,
         companyLevel: undefined,
-        status: undefined,
-      };
-      this.handleQuery();
+        status: undefined
+      }
+      this.handleQuery()
     },
     getList() {
       this.listLoading = true
@@ -247,7 +247,7 @@ export default {
         contractStart: undefined,
         contractEnd: undefined,
         contactsName: undefined,
-        contactsPhone: undefined,
+        contactsPhone: undefined
       }
     },
     handleCreate() {
@@ -326,7 +326,7 @@ export default {
       })
     },
     handleDownload() {
-      window.location.href = process.env.BASE_API + '/customer-distributor/export';
+      window.location.href = process.env.BASE_API + '/customer-distributor/export'
     },
     changeState(id, status) {
       setState({ id: id, status: status }).then(response => {
@@ -338,7 +338,7 @@ export default {
         })
         this.getList()
       })
-    },
+    }
   }
 }
 </script>

+ 12 - 12
src/views/customer/guest.vue

@@ -122,21 +122,21 @@ export default {
         {
           type: 1,
           name: '女'
-        },
+        }
       ],
       listQuery: {
         page: 1,
         limit: 10,
         customerCode: undefined,
         customerName: undefined,
-        sex: undefined,
+        sex: undefined
       },
       dataForm: {
         customerCode: undefined,
         customerName: undefined,
         sex: undefined,
         customerPhone: undefined,
-        remarks: undefined,
+        remarks: undefined
       },
       dialogFormVisible: false,
       dialogStatus: '',
@@ -146,12 +146,12 @@ export default {
       },
       rules: {
         customerCode: [
-          { required: true, message: "散客编号不能为空", trigger: "blur" },
+          { required: true, message: '散客编号不能为空', trigger: 'blur' }
           // { min: 6, max: 6, message: "散客编号必须为7位", trigger: "blur" },
           // { pattern: /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,}$/, message: "散客编号必须为6位字母加数字", trigger: "blur" }
         ],
-        customerName: [{ required: true, message: '散客姓名不能为空', trigger: 'blur' }],
-      },
+        customerName: [{ required: true, message: '散客姓名不能为空', trigger: 'blur' }]
+      }
     }
   },
   created() {
@@ -165,9 +165,9 @@ export default {
         limit: 10,
         customerCode: undefined,
         customerName: undefined,
-        sex: undefined,
-      };
-      this.handleQuery();
+        sex: undefined
+      }
+      this.handleQuery()
     },
     getList() {
       this.listLoading = true
@@ -199,7 +199,7 @@ export default {
         customerName: undefined,
         sex: undefined,
         customerPhone: undefined,
-        remarks: undefined,
+        remarks: undefined
       }
     },
     handleCreate() {
@@ -278,7 +278,7 @@ export default {
       })
     },
     handleDownload() {
-      window.location.href = process.env.BASE_API + '/customer-guest/export';
+      window.location.href = process.env.BASE_API + '/customer-guest/export'
     },
     changeState(id, status) {
       setState({ id: id, status: status }).then(response => {
@@ -290,7 +290,7 @@ export default {
         })
         this.getList()
       })
-    },
+    }
   }
 }
 </script>

+ 27 - 27
src/views/customer/vip.vue

@@ -146,16 +146,16 @@
   </div>
 </template>
 <script>
-import { listVip, createVip, updateVip, deleteVip, setState, vipLevel } from '@/api/vip';
-import { dataTypeList } from "@/api/public";
+import { listVip, createVip, updateVip, deleteVip, setState, vipLevel } from '@/api/vip'
+import { dataTypeList } from '@/api/public'
 import waves from '@/directive/waves' // 水波纹指令
 
 export default {
   directives: { waves },
   data() {
     return {
-      register_channel:[],
-      customer_level:[],
+      register_channel: [],
+      customer_level: [],
       list: [],
       total: undefined,
       listLoading: true,
@@ -167,7 +167,7 @@ export default {
         {
           type: '1',
           name: '女'
-        },
+        }
       ],
       statusList: [
         {
@@ -177,7 +177,7 @@ export default {
         {
           type: 1,
           name: '停用'
-        },
+        }
       ],
       listQuery: {
         page: 1,
@@ -186,7 +186,7 @@ export default {
         sex: undefined,
         registerChannel: undefined,
         customerLevel: undefined,
-        status: undefined,
+        status: undefined
       },
       dataForm: {
         customerCode: undefined,
@@ -196,7 +196,7 @@ export default {
         customerBirthday: undefined,
         customerLevel: undefined,
         pointsBalance: undefined,
-        remarks: undefined,
+        remarks: undefined
       },
       dialogFormVisible: false,
       dialogStatus: '',
@@ -206,28 +206,28 @@ export default {
       },
       rules: {
         customerCode: [
-          { required: true, message: "会员编号不能为空", trigger: "blur" },
+          { required: true, message: '会员编号不能为空', trigger: 'blur' }
           // { min: 14, max: 14, message: "会员编号必须为14位", trigger: "blur" },
           // { pattern: /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{14,}$/, message: "会员编号必须为14位字母加数字", trigger: "blur" }
         ],
-        customerName: [{ required: true, message: '会员姓名不能为空', trigger: 'blur' }],
-      },
+        customerName: [{ required: true, message: '会员姓名不能为空', trigger: 'blur' }]
+      }
     }
   },
   created() {
-    this.getDictType();
-    this.getList();
+    this.getDictType()
+    this.getList()
   },
   methods: {
-    getDictType(){
-      //注册渠道
+    getDictType() {
+      // 注册渠道
       dataTypeList({ dictType: 'register_channel' }).then(response => {
-        this.register_channel = response.data.data;
-      });
-       //会员等级
-       vipLevel().then(response => {
-        this.customer_level = response.data.data;
-      });
+        this.register_channel = response.data.data
+      })
+      // 会员等级
+      vipLevel().then(response => {
+        this.customer_level = response.data.data
+      })
     },
     /** 重置按钮操作 */
     resetQuery() {
@@ -238,9 +238,9 @@ export default {
         sex: undefined,
         registerChannel: undefined,
         customerLevel: undefined,
-        status: undefined,
-      };
-      this.handleQuery();
+        status: undefined
+      }
+      this.handleQuery()
     },
     getList() {
       this.listLoading = true
@@ -275,7 +275,7 @@ export default {
         customerBirthday: undefined,
         customerLevel: undefined,
         pointsBalance: undefined,
-        remarks: undefined,
+        remarks: undefined
       }
     },
     handleCreate() {
@@ -354,7 +354,7 @@ export default {
       })
     },
     handleDownload() {
-      window.location.href = process.env.BASE_API + '/customer-vip/export';
+      window.location.href = process.env.BASE_API + '/customer-vip/export'
     },
     changeState(id, status) {
       setState({ id: id, status: status }).then(response => {
@@ -366,7 +366,7 @@ export default {
         })
         this.getList()
       })
-    },
+    }
   }
 }
 </script>

+ 7 - 7
src/views/dashboard/index.vue

@@ -101,13 +101,13 @@ export default {
   },
   data() {
     return {
-      userTotal: 0,//校友录数量
-      visitorsTotal: 0,//游客数量
-      awaitAuditTotal: 0,//待审核数量
-      yesterdayTotal: 0,//昨日浏览人数
-      todayTotal:0,//今日评论数量
-      groupTotal:0,//圈子待审核数量
-      questionTotal:0,//提问待回答数量
+      userTotal: 0, // 校友录数量
+      visitorsTotal: 0, // 游客数量
+      awaitAuditTotal: 0, // 待审核数量
+      yesterdayTotal: 0, // 昨日浏览人数
+      todayTotal: 0, // 今日评论数量
+      groupTotal: 0, // 圈子待审核数量
+      questionTotal: 0, // 提问待回答数量
       goodsTotal: 0,
       productTotal: 0,
       orderTotal: 0

+ 214 - 217
src/views/dictManage/dictDataList.vue

@@ -136,242 +136,239 @@
 </style>
   
 <script>
-import { dataList, dataAdd, dataEdit, dataRemove, optionSelect } from "@/api/dictManage";
-import waves from "@/directive/waves"; // 水波纹指令
+import { dataList, dataAdd, dataEdit, dataRemove, optionSelect } from '@/api/dictManage'
+import waves from '@/directive/waves' // 水波纹指令
 import Tinymce from '@/components/Tinymce'
 
 export default {
-    components: { Tinymce },
-    directives: { waves },
-    data() {
-        return {
-            dictType:'',
-            dictNameList: [],
-            typeList: [
-                {
-                    type: '0',
-                    name: "正常",
-                },
-                {
-                    type: '1',
-                    name: "停用",
-                },
-            ],
-            list: [
-            ],
-            delarr: [],
-            multipleSelection: [],
-            total: 0,
-            listLoading: false,
-            listQuery: {
-                page: 1,
-                limit: 10,
-                dictType: '',
-                dictLabel: '',
-                status: '',
-            },
-            dataForm: {
-                dictType: undefined,
-                dictLabel: undefined,
-                dictValue: undefined,
-                dictSort: undefined,
-                status: '0',
-                remark: undefined,
-            },
-            dialogFormVisible: false,
-            dialogStatus: '',
-            textMap: {
-                update: "编辑",
-                create: "创建",
-            },
-            imageUrl: undefined,
-            rules: {
-                dictLabel: [{ required: true, message: "字典标签不能为空", trigger: "blur" }],
-                dictValue: [{ required: true, message: "字典键值不能为空", trigger: "blur" }],
-                dictSort: [{ required: true, message: "显示排序不能为空", trigger: "blur" }],
-            },
+  components: { Tinymce },
+  directives: { waves },
+  data() {
+    return {
+      dictType: '',
+      dictNameList: [],
+      typeList: [
+        {
+          type: '0',
+          name: '正常'
+        },
+        {
+          type: '1',
+          name: '停用'
         }
+      ],
+      list: [
+      ],
+      delarr: [],
+      multipleSelection: [],
+      total: 0,
+      listLoading: false,
+      listQuery: {
+        page: 1,
+        limit: 10,
+        dictType: '',
+        dictLabel: '',
+        status: ''
+      },
+      dataForm: {
+        dictType: undefined,
+        dictLabel: undefined,
+        dictValue: undefined,
+        dictSort: undefined,
+        status: '0',
+        remark: undefined
+      },
+      dialogFormVisible: false,
+      dialogStatus: '',
+      textMap: {
+        update: '编辑',
+        create: '创建'
+      },
+      imageUrl: undefined,
+      rules: {
+        dictLabel: [{ required: true, message: '字典标签不能为空', trigger: 'blur' }],
+        dictValue: [{ required: true, message: '字典键值不能为空', trigger: 'blur' }],
+        dictSort: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }]
+      }
+    }
+  },
+  created() {
+    this.dictType = this.$route.params.id
+    this.getOptionSelect()
+  },
+  methods: {
+    changeDictType(val) {
+      this.dictType = val
+      this.listQuery.dictType = val
+      this.getList()
     },
-    created() {
-        this.dictType = this.$route.params.id;
-        this.getOptionSelect();
+    getOptionSelect() {
+      optionSelect().then(response => {
+        this.dictNameList = response.data.data
+        this.listQuery.dictType = this.dictType
+        this.getList()
+      }).catch(() => {})
     },
-    methods: {
-        changeDictType(val){
-            this.dictType = val;
-            this.listQuery.dictType = val;
-            this.getList();
-        },
-        getOptionSelect(){
-            optionSelect().then(response => {
-                this.dictNameList = response.data.data;
-                this.listQuery.dictType = this.dictType;
-                this.getList();
-            }).catch(() => {})
-        },
-        resetForm() {
-            this.dataForm = {
-                dictType: undefined,
-                dictLabel: undefined,
-                dictValue: undefined,
-                dictSort: undefined,
-                status: '0',
-                remark: undefined,
-            };
-        },
-        handleCreate() {
-            this.resetForm();
-            this.dataForm.dictType = this.dictType;
-            this.dialogFormVisible = true;
-            this.dialogStatus = "create";
-            this.$nextTick(() => {
-                this.$refs["dataForm"].clearValidate();
-            });
-        },
-        createData() {
-            this.$refs["dataForm"].validate((valid) => {
-                if (valid) {
-                    dataAdd(this.dataForm)
-                        .then(() => {
-                            this.getList();
-                            this.dialogFormVisible = false;
+    resetForm() {
+      this.dataForm = {
+        dictType: undefined,
+        dictLabel: undefined,
+        dictValue: undefined,
+        dictSort: undefined,
+        status: '0',
+        remark: undefined
+      }
+    },
+    handleCreate() {
+      this.resetForm()
+      this.dataForm.dictType = this.dictType
+      this.dialogFormVisible = true
+      this.dialogStatus = 'create'
+      this.$nextTick(() => {
+        this.$refs['dataForm'].clearValidate()
+      })
+    },
+    createData() {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          dataAdd(this.dataForm)
+            .then(() => {
+              this.getList()
+              this.dialogFormVisible = false
 
-                            this.$notify({
-                                title: "成功",
-                                message: "创建成功",
-                                type: "success",
-                                duration: 2000,
-                            });
-                            this.getList()
-                        })
-                }
-            });
-        },
-        getList() {
-            this.listLoading = true
-            dataList(this.listQuery).then(response => {
-                this.list = response.data.data.items
-                this.total = response.data.data.total
-                this.listLoading = false
-            }).catch(() => {
-                this.list = []
-                this.total = 0
-                this.listLoading = false
+              this.$notify({
+                title: '成功',
+                message: '创建成功',
+                type: 'success',
+                duration: 2000
+              })
+              this.getList()
             })
-        },
-
-        handleQuery() {
-            this.listQuery.page = 1
-            this.getList()
-        },
-        /** 重置按钮操作 */
-        resetQuery() {
-            this.listQuery = {
-                dictType: '',
-                dictLabel: '',
-                status: '',
-            };
-            this.handleQuery();
-        },
+        }
+      })
+    },
+    getList() {
+      this.listLoading = true
+      dataList(this.listQuery).then(response => {
+        this.list = response.data.data.items
+        this.total = response.data.data.total
+        this.listLoading = false
+      }).catch(() => {
+        this.list = []
+        this.total = 0
+        this.listLoading = false
+      })
+    },
 
-        handleSizeChange(val) {
-            this.listQuery.limit = val
-            this.getList()
-        },
+    handleQuery() {
+      this.listQuery.page = 1
+      this.getList()
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.listQuery = {
+        dictType: '',
+        dictLabel: '',
+        status: ''
+      }
+      this.handleQuery()
+    },
 
-        handleCurrentChange(val) {
-            this.listQuery.page = val
-            this.getList()
-        },
+    handleSizeChange(val) {
+      this.listQuery.limit = val
+      this.getList()
+    },
 
-        handleUpdate(row) {
-            this.dataForm = Object.assign({}, row);
-            this.dialogStatus = 'update'
-            this.dialogFormVisible = true
-            this.$nextTick(() => {
-                this.$refs['dataForm'].clearValidate()
-            })
-        },
+    handleCurrentChange(val) {
+      this.listQuery.page = val
+      this.getList()
+    },
 
-        updateData() {
-            this.$refs['dataForm'].validate((valid) => {
-                if (valid) {
-                    dataEdit(this.dataForm).then(() => {
-                        this.dialogFormVisible = false
-                        this.$notify({
-                            title: '成功',
-                            message: '更新成功',
-                            type: 'success',
-                            duration: 2000
-                        })
-                        this.getList()
-                    })
+    handleUpdate(row) {
+      this.dataForm = Object.assign({}, row)
+      this.dialogStatus = 'update'
+      this.dialogFormVisible = true
+      this.$nextTick(() => {
+        this.$refs['dataForm'].clearValidate()
+      })
+    },
 
-                }
+    updateData() {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          dataEdit(this.dataForm).then(() => {
+            this.dialogFormVisible = false
+            this.$notify({
+              title: '成功',
+              message: '更新成功',
+              type: 'success',
+              duration: 2000
             })
-        },
-
-        handleDelete(row) {
-
-            this.$confirm('确认删除吗?', '提示', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                type: 'warning'
-            }).then(() => {
-                dataRemove({ dictCodes:row.dictCode}).then(response => {
-                    this.$notify({
-                        title: '成功',
-                        message: '删除成功',
-                        type: 'success',
-                        duration: 2000
-                    })
-                    const index = this.list.indexOf(row)
-                    this.list.splice(index, 1)
-                })
-            }).catch(() => {
+            this.getList()
+          })
+        }
+      })
+    },
 
-            })
+    handleDelete(row) {
+      this.$confirm('确认删除吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        dataRemove({ dictCodes: row.dictCode }).then(response => {
+          this.$notify({
+            title: '成功',
+            message: '删除成功',
+            type: 'success',
+            duration: 2000
+          })
+          const index = this.list.indexOf(row)
+          this.list.splice(index, 1)
+        })
+      }).catch(() => {
 
-        },
-        delAll() {
-            this.$confirm("确认删除吗?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
-            })
-                .then(() => {
-                    const length = this.multipleSelection.length;
+      })
+    },
+    delAll() {
+      this.$confirm('确认删除吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      })
+        .then(() => {
+          const length = this.multipleSelection.length
 
-                    if (length > 0) {
-                        for (let i = 0; i < length; i++) {
-                            this.delarr.push(this.multipleSelection[i].dictCode);
-                        }
-                        const  dictCodes = this.delarr.join(",");
-                        dataRemove({  dictCodes:  dictCodes })
-                            .then(() => {
-                                this.$notify({
-                                    title: "成功",
-                                    message: "删除成功",
-                                    type: "success",
-                                    duration: 2000,
-                                });
-                                this.getList();
-                            })
-                            .catch(() => { });
-                    } else {
-                        this.$notify({
-                            title: "警告提示",
-                            message: "请选择要删除的信息!",
-                            type: "warning",
-                        });
-                    }
+          if (length > 0) {
+            for (let i = 0; i < length; i++) {
+              this.delarr.push(this.multipleSelection[i].dictCode)
+            }
+            const dictCodes = this.delarr.join(',')
+            dataRemove({ dictCodes: dictCodes })
+              .then(() => {
+                this.$notify({
+                  title: '成功',
+                  message: '删除成功',
+                  type: 'success',
+                  duration: 2000
                 })
-                .catch(() => { });
-        },
-        handleSelectionChange(val) {
-            this.multipleSelection = val;
-        },
+                this.getList()
+              })
+              .catch(() => { })
+          } else {
+            this.$notify({
+              title: '警告提示',
+              message: '请选择要删除的信息!',
+              type: 'warning'
+            })
+          }
+        })
+        .catch(() => { })
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val
     }
+  }
 }
 </script>
 <style>

+ 186 - 189
src/views/dictManage/dictList.vue

@@ -128,150 +128,150 @@
 </style>
 
 <script>
-    import { list, createItem, updateItem, deleteitem } from "@/api/dictManage";
-    import waves from "@/directive/waves"; // 水波纹指令
-    import Tinymce from '@/components/Tinymce'
-  
-  export default {
+    import { list, createItem, updateItem, deleteitem } from '@/api/dictManage'
+import waves from '@/directive/waves' // 水波纹指令
+import Tinymce from '@/components/Tinymce'
+
+export default {
     components: { Tinymce },
     directives: { waves },
     data() {
-      return {
-        typeList: [
-        {
-          type: "0",
-          name: "正常",
-        },
-        {
-          type: "1",
-          name: "停用",
-        },
-      ],
-        list: [
-          
-        ],
-        delarr: [],
-        multipleSelection: [],
-        total: 0,
-        listLoading: false,
-        listQuery: {
-          page: 1,
-          limit: 10,
-          dictName: '',
-          dictType: '',
-          status: '',
-        },
-        dataForm: {
-          dictName: undefined,
-          dictType: undefined,
-          status: 1,
-          remark: undefined,
-        },
-        dialogFormVisible: false,
-        dialogStatus: '',
-        textMap: {
-          update: "编辑",
-          create: "创建",
-        },
-        imageUrl: undefined,
-        rules: {
-          dictName: [{ required: true, message: "字典名称不能为空", trigger: "blur" }],
-          dictType: [{ required: true, message: "字典类型不能为空", trigger: "blur" }],
-        },
-      }
+        return {
+          typeList: [
+            {
+              type: '0',
+              name: '正常'
+            },
+            {
+              type: '1',
+              name: '停用'
+            }
+          ],
+          list: [
+    
+          ],
+          delarr: [],
+          multipleSelection: [],
+          total: 0,
+          listLoading: false,
+          listQuery: {
+            page: 1,
+            limit: 10,
+            dictName: '',
+            dictType: '',
+            status: ''
+          },
+          dataForm: {
+            dictName: undefined,
+            dictType: undefined,
+            status: 1,
+            remark: undefined
+          },
+          dialogFormVisible: false,
+          dialogStatus: '',
+          textMap: {
+            update: '编辑',
+            create: '创建'
+          },
+          imageUrl: undefined,
+          rules: {
+            dictName: [{ required: true, message: '字典名称不能为空', trigger: 'blur' }],
+            dictType: [{ required: true, message: '字典类型不能为空', trigger: 'blur' }]
+          }
+        }
     },
     created() {
-        this.getList();
-    },
+        this.getList()
+  },
     methods: {
-        handleDictData(row){
+        handleDictData(row) {
 
         },
-      resetForm() {
-        this.dataForm = {
+        resetForm() {
+          this.dataForm = {
             dictName: undefined,
             dictType: undefined,
             status: 1,
-            remark: undefined,
-        };
-      },
-      handleCreate() {
-        this.resetForm();
-        this.dialogFormVisible = true;
-        this.dialogStatus = "create";
-        this.$nextTick(() => {
-          this.$refs["dataForm"].clearValidate();
-        });
-      },
-      createData() {
-        this.$refs["dataForm"].validate((valid) => {
-          if (valid) {
-            createItem(this.dataForm)
-                  .then(() => {
-                    this.getList();
-                    this.dialogFormVisible = false;
-  
-                    this.$notify({
-                      title: "成功",
-                      message: "创建成功",
-                      type: "success",
-                      duration: 2000,
-                    });
-                    this.getList()
+            remark: undefined
+          }
+    },
+        handleCreate() {
+          this.resetForm()
+    this.dialogFormVisible = true
+    this.dialogStatus = 'create'
+          this.$nextTick(() => {
+            this.$refs['dataForm'].clearValidate()
+    })
+    },
+        createData() {
+          this.$refs['dataForm'].validate((valid) => {
+            if (valid) {
+              createItem(this.dataForm)
+                .then(() => {
+                  this.getList()
+                  this.dialogFormVisible = false
+
+                  this.$notify({
+                    title: '成功',
+                    message: '创建成功',
+                    type: 'success',
+                    duration: 2000
                   })
+                  this.getList()
+                })
+            }
+          })
+    },
+        getList() {
+          this.listLoading = true
+          list(this.listQuery).then(response => {
+            this.list = response.data.data.items
+            this.total = response.data.data.total
+            this.listLoading = false
+          }).catch(() => {
+            this.list = []
+            this.total = 0
+            this.listLoading = false
+          })
+        },
+
+        handleQuery() {
+          this.listQuery.page = 1
+          this.getList()
+        },
+        /** 重置按钮操作 */
+        resetQuery() {
+          this.listQuery = {
+            dictName: '',
+            dictType: '',
+            status: ''
           }
-        });
-      },
-      getList() {
-        this.listLoading = true
-        list(this.listQuery).then(response => {
-          this.list = response.data.data.items
-          this.total = response.data.data.total
-          this.listLoading = false
-        }).catch(() => {
-          this.list = []
-          this.total = 0
-          this.listLoading = false
-        })
-      },
-  
-      handleQuery() {
-        this.listQuery.page = 1
-        this.getList()
-      },
-       /** 重置按钮操作 */
-       resetQuery() {
-            this.listQuery = {
-              dictName: '',
-              dictType: '',
-              status: '',
-            };
-            this.handleQuery();
+          this.handleQuery()
+    },
+
+        handleSizeChange(val) {
+          this.listQuery.limit = val
+          this.getList()
         },
-  
-      handleSizeChange(val) {
-        this.listQuery.limit = val
-        this.getList()
-      },
-  
-      handleCurrentChange(val) {
-        this.listQuery.page = val
-        this.getList()
-      },
-  
-      handleUpdate(row) {
-        this.dataForm = Object.assign({}, row);
-        this.dialogStatus = 'update'
-        this.dialogFormVisible = true
-        this.$nextTick(() => {
-          this.$refs['dataForm'].clearValidate()
-        })
-      },
-  
-      updateData() {
-        this.$refs['dataForm'].validate((valid) => {
-          if (valid) {
-            updateItem(this.dataForm).then(() => {
+
+        handleCurrentChange(val) {
+          this.listQuery.page = val
+          this.getList()
+        },
+
+        handleUpdate(row) {
+          this.dataForm = Object.assign({}, row)
+    this.dialogStatus = 'update'
+          this.dialogFormVisible = true
+          this.$nextTick(() => {
+            this.$refs['dataForm'].clearValidate()
+          })
+        },
+
+        updateData() {
+          this.$refs['dataForm'].validate((valid) => {
+            if (valid) {
+              updateItem(this.dataForm).then(() => {
                 this.dialogFormVisible = false
                 this.$notify({
                   title: '成功',
@@ -281,72 +281,69 @@
                 })
                 this.getList()
               })
-            
-          }
-        })
-      },
-  
-      handleDelete(row) {
-  
-        this.$confirm('确认删除吗?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          deleteitem({dictIds:row.dictId}).then(response => {
-            this.$notify({
-              title: '成功',
-              message: '删除成功',
-              type: 'success',
-              duration: 2000
-            })
-            this.getList()
+            }
           })
-        }).catch(() => {
+        },
 
-        })
-  
-      },
-      delAll() {
-            this.$confirm("确认删除吗?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
+        handleDelete(row) {
+          this.$confirm('确认删除吗?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          }).then(() => {
+            deleteitem({ dictIds: row.dictId }).then(response => {
+              this.$notify({
+                title: '成功',
+                message: '删除成功',
+                type: 'success',
+                duration: 2000
+              })
+              this.getList()
             })
-                .then(() => {
-                    const length = this.multipleSelection.length;
+          }).catch(() => {
 
-                    if (length > 0) {
-                        for (let i = 0; i < length; i++) {
-                            this.delarr.push(this.multipleSelection[i].dictId);
-                        }
-                        const dictIds = this.delarr.join(",");
-                        deleteitem({ dictIds: dictIds })
-                            .then(() => {
-                                this.$notify({
-                                    title: "成功",
-                                    message: "删除成功",
-                                    type: "success",
-                                    duration: 2000,
-                                });
-                                this.getList();
-                            })
-                            .catch(() => { });
-                    } else {
-                        this.$notify({
-                            title: "警告提示",
-                            message: "请选择要删除的信息!",
-                            type: "warning",
-                        });
-                    }
-                })
-                .catch(() => { });
+          })
         },
+        delAll() {
+          this.$confirm('确认删除吗?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          })
+            .then(() => {
+              const length = this.multipleSelection.length
+
+              if (length > 0) {
+                for (let i = 0; i < length; i++) {
+                  this.delarr.push(this.multipleSelection[i].dictId)
+                }
+                const dictIds = this.delarr.join(',')
+                deleteitem({ dictIds: dictIds })
+                  .then(() => {
+                    this.$notify({
+                      title: '成功',
+                      message: '删除成功',
+                      type: 'success',
+                      duration: 2000
+                    })
+                    this.getList()
+                  })
+                  .catch(() => { })
+              } else {
+                this.$notify({
+                  title: '警告提示',
+                  message: '请选择要删除的信息!',
+                  type: 'warning'
+                })
+              }
+            })
+            .catch(() => { })
+    },
         handleSelectionChange(val) {
-            this.multipleSelection = val;
-        },
+          this.multipleSelection = val
     }
-  }
+    }
+}
 </script>
 <style>
   .ad-avatar-uploader .el-upload {

+ 6 - 6
src/views/goodsManage/brand.vue

@@ -255,7 +255,7 @@ export default {
         name: [{ required: true, message: '品牌商名称不能为空', trigger: 'blur' }]
       },
       downloadLoading: false,
-      fileImgUrl: this.upLoadUrl,
+      fileImgUrl: this.upLoadUrl
     }
   },
   created() {
@@ -270,8 +270,8 @@ export default {
         id: undefined,
         name: undefined,
         sort: '+id'
-      };
-      this.handleQuery();
+      }
+      this.handleQuery()
     },
     judgeIsnew(data) {
       return data.isNew == '1' ? '是' : '不是'
@@ -429,7 +429,7 @@ export default {
     // 图片上传开始
     // 品牌商图片
     handleBrandSuccess(res, file) {
-      this.dataForm.picUrl = res.data.url;
+      this.dataForm.picUrl = res.data.url
     },
     beforeBrandUpload(file) {
       const isLt2M = file.size / 1024 / 1024 < 2
@@ -440,7 +440,7 @@ export default {
     },
     // 宣传图片
     handlePublicitySuccess(res, file) {
-      this.dataForm.listPicUrl = res.data.url;
+      this.dataForm.listPicUrl = res.data.url
     },
     beforePublicityUpload(file) {
       const isLt2M = file.size / 1024 / 1024 < 2
@@ -451,7 +451,7 @@ export default {
     },
     // APP 宣传图片
     handleAppcitySuccess(res, file) {
-      this.dataForm.appListPicUrl = res.data.url;
+      this.dataForm.appListPicUrl = res.data.url
     },
     beforeAppcityUpload(file) {
       const isLt2M = file.size / 1024 / 1024 < 2

+ 454 - 457
src/views/goodsManage/goodsList.vue

@@ -287,481 +287,478 @@
     </div>
 </template>
 <script>
-import { createItem, updateItem, goodsList, removeItem } from "@/api/goodsManage";
-import { listDept } from "@/api/goodsTypeList";
-import { listBrand } from '@/api/brand';
+import { createItem, updateItem, goodsList, removeItem } from '@/api/goodsManage'
+import { listDept } from '@/api/goodsTypeList'
+import { listBrand } from '@/api/brand'
 import { getToken } from '@/utils/auth' // getToken from cookie
-import Treeselect from "@riophae/vue-treeselect";
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
-import { dataTypeList } from "@/api/public";
-import waves from "@/directive/waves"; // 水波纹指令
+import Treeselect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import { dataTypeList } from '@/api/public'
+import waves from '@/directive/waves' // 水波纹指令
 
 export default {
-    name: 'goodsList',
-    components: { Treeselect },
-    directives: { waves },
-    data() {
-        return {
-            // 商品导入参数
-            upload: {
-                // 是否显示弹出层(商品导入)
-                open: false,
-                // 弹出层标题(商品导入)
-                title: "",
-                // 是否禁用上传
-                isUploading: false,
-                // 设置上传的请求头部
-                headers: { Authorization: "Bearer " + getToken() },
-                // 上传的地址
-                url: process.env.BASE_API + "/product/import"
-            },
-            tea_type: [],
-            tea_level: [],
-            tea_series: [],
-            tea_package_format: [],
-            tea_get_season: [],
-            tea_storage_require: [],
-            // 树选项
-            categoryOptions: [],
-            activeName: 'first',
-            brandOptions: [],
-            goodsStatusList: [
-                {
-                    type: 0,
-                    name: '启用'
-                },
-                {
-                    type: 1,
-                    name: '停用'
-                },
-            ],
-            list: [],
-            total: 0,
-            listLoading: false,
-            listQuery: {
-                page: 1,
-                limit: 10,
-                productName: '',
-                productShortForm: '',
-                categoryId: undefined,
-                brandId: '',
-                status: '',
-            },
-            listBrandQuery: {
-                limit: 1000,
-                sort: '+id'
-            },
-            dataForm: {
-                productName: undefined,
-                productCode: undefined,
-                productShortForm: undefined,
-                categoryId: undefined,
-                brandId: undefined,
-                price: undefined,
-                salePrice: undefined,
-                costPrice: undefined,
-                weight: 1,
-                status: 0,
-                imgUrl: undefined,
-                teaTypeId: undefined,
-                teaLevel: undefined,
-                teaSeries: undefined,
-                teaPackageFormat: [],
-                teaOrigin: undefined,
-                teaGetSeason: undefined,
-                teaGuaranteeNumber: undefined,
-                teaGuaranteeUnit: '年',
-                productDate: undefined,
-                teaAgingYear: undefined,
-                teaFiles: undefined,
-                files: [],
-                teaStorageRequire: [],
-            },
-            dialogFormVisible: false,
-            dialogStatus: '',
-            textMap: {
-                update: "编辑商品",
-                create: "添加商品",
-            },
-            rules: {
-                productName: [{ required: true, message: "请填写商品名称", trigger: "blur" }],
-                productCode: [
-                    { required: true, message: "请填写商品编号", trigger: "blur" },
-                    // { min: 14, max: 14, message: "商品编号必须为14位", trigger: "blur" },
-                    // { pattern: /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{14,}$/, message: "商品编号必须为14位字母加数字", trigger: "blur" }
-                ],
-                productShortForm: [{ required: true, message: "请填写商品简称", trigger: "blur" }],
-                categoryId: [{ required: true, message: "请选择商品类别", trigger: "blur" }],
-                price: [
-                    { required: true, message: "请填写零售价", trigger: "blur" },
-                    {
-                        pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,2})?$/,
-                        message: "请输入合法的金额数字,最多两位小数",
-                        trigger: "blur"
-                    }
-                ],
-                salePrice: [
-                    { required: true, message: "请填写销售价", trigger: "blur" },
-                    {
-                        pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,2})?$/,
-                        message: "请输入合法的金额数字,最多两位小数",
-                        trigger: "blur"
-                    }
-                ],
-                costPrice: [
-                    { required: true, message: "请填写成本价", trigger: "blur" },
-                    {
-                        pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,2})?$/,
-                        message: "请输入合法的金额数字,最多两位小数",
-                        trigger: "blur"
-                    }
-                ],
-                weight: [
-                    { required: true, message: "请填写重量", trigger: "blur" },
-
-                ],
-                status: [{ required: true, message: "请选择状态", trigger: "blur" }],
-            },
-            dialogListVisible: false,
-            fileImgUrl: this.upLoadUrl,
+  name: 'goodsList',
+  components: { Treeselect },
+  directives: { waves },
+  data() {
+    return {
+      // 商品导入参数
+      upload: {
+        // 是否显示弹出层(商品导入)
+        open: false,
+        // 弹出层标题(商品导入)
+        title: '',
+        // 是否禁用上传
+        isUploading: false,
+        // 设置上传的请求头部
+        headers: { Authorization: 'Bearer ' + getToken() },
+        // 上传的地址
+        url: process.env.BASE_API + '/product/import'
+      },
+      tea_type: [],
+      tea_level: [],
+      tea_series: [],
+      tea_package_format: [],
+      tea_get_season: [],
+      tea_storage_require: [],
+      // 树选项
+      categoryOptions: [],
+      activeName: 'first',
+      brandOptions: [],
+      goodsStatusList: [
+        {
+          type: 0,
+          name: '启用'
+        },
+        {
+          type: 1,
+          name: '停用'
         }
+      ],
+      list: [],
+      total: 0,
+      listLoading: false,
+      listQuery: {
+        page: 1,
+        limit: 10,
+        productName: '',
+        productShortForm: '',
+        categoryId: undefined,
+        brandId: '',
+        status: ''
+      },
+      listBrandQuery: {
+        limit: 1000,
+        sort: '+id'
+      },
+      dataForm: {
+        productName: undefined,
+        productCode: undefined,
+        productShortForm: undefined,
+        categoryId: undefined,
+        brandId: undefined,
+        price: undefined,
+        salePrice: undefined,
+        costPrice: undefined,
+        weight: 1,
+        status: 0,
+        imgUrl: undefined,
+        teaTypeId: undefined,
+        teaLevel: undefined,
+        teaSeries: undefined,
+        teaPackageFormat: [],
+        teaOrigin: undefined,
+        teaGetSeason: undefined,
+        teaGuaranteeNumber: undefined,
+        teaGuaranteeUnit: '年',
+        productDate: undefined,
+        teaAgingYear: undefined,
+        teaFiles: undefined,
+        files: [],
+        teaStorageRequire: []
+      },
+      dialogFormVisible: false,
+      dialogStatus: '',
+      textMap: {
+        update: '编辑商品',
+        create: '添加商品'
+      },
+      rules: {
+        productName: [{ required: true, message: '请填写商品名称', trigger: 'blur' }],
+        productCode: [
+          { required: true, message: '请填写商品编号', trigger: 'blur' }
+          // { min: 14, max: 14, message: "商品编号必须为14位", trigger: "blur" },
+          // { pattern: /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{14,}$/, message: "商品编号必须为14位字母加数字", trigger: "blur" }
+        ],
+        productShortForm: [{ required: true, message: '请填写商品简称', trigger: 'blur' }],
+        categoryId: [{ required: true, message: '请选择商品类别', trigger: 'blur' }],
+        price: [
+          { required: true, message: '请填写零售价', trigger: 'blur' },
+          {
+            pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,2})?$/,
+            message: '请输入合法的金额数字,最多两位小数',
+            trigger: 'blur'
+          }
+        ],
+        salePrice: [
+          { required: true, message: '请填写销售价', trigger: 'blur' },
+          {
+            pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,2})?$/,
+            message: '请输入合法的金额数字,最多两位小数',
+            trigger: 'blur'
+          }
+        ],
+        costPrice: [
+          { required: true, message: '请填写成本价', trigger: 'blur' },
+          {
+            pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,2})?$/,
+            message: '请输入合法的金额数字,最多两位小数',
+            trigger: 'blur'
+          }
+        ],
+        weight: [
+          { required: true, message: '请填写重量', trigger: 'blur' }
+
+        ],
+        status: [{ required: true, message: '请选择状态', trigger: 'blur' }]
+      },
+      dialogListVisible: false,
+      fileImgUrl: this.upLoadUrl
+    }
+  },
+  created() {
+    this.getListCategory()
+    this.getBrandList()
+    this.getDictType()
+    this.getList()
+  },
+  methods: {
+    /** 导入按钮操作 */
+    handleImport() {
+      this.upload.title = '商品导入'
+      this.upload.open = true
     },
-    created() {
-        this.getListCategory();
-        this.getBrandList();
-        this.getDictType();
-        this.getList();
+    /** 下载模板操作 */
+    importTemplate() {
+      window.location.href = process.env.BASE_API + '/product/down/productTemplate'
     },
-    methods: {
-        /** 导入按钮操作 */
-        handleImport() {
-            this.upload.title = "商品导入";
-            this.upload.open = true;
-        },
-        /** 下载模板操作 */
-        importTemplate() {
-            window.location.href = process.env.BASE_API + '/product/down/productTemplate';
-        },
-        // 文件上传中处理
-        handleFileUploadProgress(event, file, fileList) {
-            this.upload.isUploading = true;
-        },
-        // 文件上传成功处理
-        handleProductTemplate(response, file, fileList) {
-            this.upload.open = false;
-            this.upload.isUploading = false;
-            this.$refs.upload.clearFiles();
-            this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.data + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
-            this.getList();
-        },
-        // 提交上传文件
-        submitFileForm() {
-            this.$refs.upload.submit();
-        },
-        handleDownLoad() {
-            window.location.href = process.env.BASE_API + '/product/export?productName=' + this.listQuery.productName + '&productShortForm=' + this.listQuery.productShortForm;
-        },
-        getListCategory() {
-            listDept().then(response => {
-                this.categoryOptions = this.handleTree(response.data.data, "id");
-            });
-        },
-        /** 转换证书数据结构 */
-        normalizer(node) {
-            if (node.children && !node.children.length) {
-                delete node.children;
-            }
-            return {
-                id: node.id,
-                label: node.categoryName,
-                children: node.children
-            };
-        },
-        handleClick(tab, event) {
-            console.log(tab, event);
-        },
-        getDictType() {
-            //茶叶品牌tea_type
-            dataTypeList({ dictType: 'tea_type' }).then(response => {
-                this.tea_type = response.data.data;
-            });
-            //茶叶级别tea_level
-            dataTypeList({ dictType: 'tea_level' }).then(response => {
-                this.tea_level = response.data.data;
-            });
-            //茶叶系列tea_series
-            dataTypeList({ dictType: 'tea_series' }).then(response => {
-                this.tea_series = response.data.data;
-            });
-            //包装形式tea_package_format
-            dataTypeList({ dictType: 'tea_package_format' }).then(response => {
-                this.tea_package_format = response.data.data;
-            });
-            //采摘季节tea_get_season
-            dataTypeList({ dictType: 'tea_get_season' }).then(response => {
-                this.tea_get_season = response.data.data;
-            });
-            //存储要求tea_storage_require
-            dataTypeList({ dictType: 'tea_storage_require' }).then(response => {
-                this.tea_storage_require = response.data.data;
-            });
-        },
-        handleRemoveFile(file, fileList) {
-            console.log(file, fileList);
-            let teaFiles = [];
-            for (let i in fileList) {
-                let id = fileList[i].response.data.id;
-                teaFiles.push(id);
-            }
-            this.dataForm.teaFiles = teaFiles.join(",");
-        },
-        beforeUploadFile(file) {
-            console.log(file);
-            const size = file.size / 1024 / 1024;
-            console.log(size);
-            if (size > 10) {
-                this.$message.error("文件大小不能超过10MB!");
-                return false;
-            }
-        },
-        handleFileSuccess(res, file, fileList) {
-            console.log(file, fileList);
-            console.log("------", "==========");
-            console.log("res = ", res);
-
-            let teaFiles = [];
-            for (let i in fileList) {
-                let response = fileList[i].response;
-                if (response.errno && response.errno != "0") {
-                    this.$message.error("该文件上传失败,已被移除,请重新上传!");
-                    // 上传失败移除该 file 对象
-                    fileList.splice(i, 1);
-                } else {
-                    let id = fileList[i].response.data.id;
-                    teaFiles.push(id);
-                }
-            }
-            this.dataForm.teaFiles = teaFiles.join(",");
-        },
-        handleRemoveImg(file, fileList) {
-            console.log(file, fileList);
-            let images = [];
-            for (let i in fileList) {
-                let response = fileList[i].response;
-                let url = response.data.url;
-                images.push(url);
-                this.dataForm.imgUrl = images.join(",");
-            }
-        },
-        beforeUploadImg(file) {
-            const isJPGs = file.type === "image/jpeg";
-            console.log(isJPGs);
-        },
-        handleExceed(files, fileList) {
-            this.$message.warning(
-                `当前限制选择 1 个文件,本次选择了 ${files.length} 个文件!,共选择了 ${files.length + fileList.length
-                } 个文件`
-            );
-        },
-        handleImgSucess(res, file, fileList) {
-            this.dataForm.imgUrl = ""; // 清空画廊图片数组
-
-            let images = [];
-            for (let i in fileList) {
-                let response = fileList[i].response;
-                if (response.errno && response.errno != "0") {
-                    this.$message.error("该图片上传失败,已被移除,请重新上传!");
-                    // 上传失败移除该 file 对象
-                    fileList.splice(i, 1);
-                } else {
-                    let url = response.data.url;
-                    images.push(url);
-                }
-            }
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true
+    },
+    // 文件上传成功处理
+    handleProductTemplate(response, file, fileList) {
+      this.upload.open = false
+      this.upload.isUploading = false
+      this.$refs.upload.clearFiles()
+      this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.data + '</div>', '导入结果', { dangerouslyUseHTMLString: true })
+      this.getList()
+    },
+    // 提交上传文件
+    submitFileForm() {
+      this.$refs.upload.submit()
+    },
+    handleDownLoad() {
+      window.location.href = process.env.BASE_API + '/product/export?productName=' + this.listQuery.productName + '&productShortForm=' + this.listQuery.productShortForm
+    },
+    getListCategory() {
+      listDept().then(response => {
+        this.categoryOptions = this.handleTree(response.data.data, 'id')
+      })
+    },
+    /** 转换证书数据结构 */
+    normalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children
+      }
+      return {
+        id: node.id,
+        label: node.categoryName,
+        children: node.children
+      }
+    },
+    handleClick(tab, event) {
+      console.log(tab, event)
+    },
+    getDictType() {
+      // 茶叶品牌tea_type
+      dataTypeList({ dictType: 'tea_type' }).then(response => {
+        this.tea_type = response.data.data
+      })
+      // 茶叶级别tea_level
+      dataTypeList({ dictType: 'tea_level' }).then(response => {
+        this.tea_level = response.data.data
+      })
+      // 茶叶系列tea_series
+      dataTypeList({ dictType: 'tea_series' }).then(response => {
+        this.tea_series = response.data.data
+      })
+      // 包装形式tea_package_format
+      dataTypeList({ dictType: 'tea_package_format' }).then(response => {
+        this.tea_package_format = response.data.data
+      })
+      // 采摘季节tea_get_season
+      dataTypeList({ dictType: 'tea_get_season' }).then(response => {
+        this.tea_get_season = response.data.data
+      })
+      // 存储要求tea_storage_require
+      dataTypeList({ dictType: 'tea_storage_require' }).then(response => {
+        this.tea_storage_require = response.data.data
+      })
+    },
+    handleRemoveFile(file, fileList) {
+      console.log(file, fileList)
+      const teaFiles = []
+      for (const i in fileList) {
+        const id = fileList[i].response.data.id
+        teaFiles.push(id)
+      }
+      this.dataForm.teaFiles = teaFiles.join(',')
+    },
+    beforeUploadFile(file) {
+      console.log(file)
+      const size = file.size / 1024 / 1024
+      console.log(size)
+      if (size > 10) {
+        this.$message.error('文件大小不能超过10MB!')
+        return false
+      }
+    },
+    handleFileSuccess(res, file, fileList) {
+      console.log(file, fileList)
+      console.log('------', '==========')
+      console.log('res = ', res)
 
-            this.dataForm.imgUrl = images.join(",");
-        },
-        resetForm() {
-            this.dataForm = {
-                productName: undefined,
-                productCode: undefined,
-                productShortForm: undefined,
-                categoryId: undefined,
-                brandId: undefined,
-                price: undefined,
-                salePrice: undefined,
-                costPrice: undefined,
-                weight: 1,
-                status: 0,
-                imgUrl: undefined,
-                images: [],
-                teaTypeId: undefined,
-                teaLevel: undefined,
-                teaSeries: undefined,
-                teaPackageFormat: [],
-                teaOrigin: undefined,
-                teaGetSeason: undefined,
-                teaGuaranteeNumber: undefined,
-                teaGuaranteeUnit: '年',
-                productDate: undefined,
-                teaAgingYear: undefined,
-                teaFiles: undefined,
-                files: [],
-                teaStorageRequire: [],
-            };
-        },
-        handleAdd() {
-            this.activeName = 'first';
-            this.resetForm();
+      const teaFiles = []
+      for (const i in fileList) {
+        const response = fileList[i].response
+        if (response.errno && response.errno != '0') {
+          this.$message.error('该文件上传失败,已被移除,请重新上传!')
+          // 上传失败移除该 file 对象
+          fileList.splice(i, 1)
+        } else {
+          const id = fileList[i].response.data.id
+          teaFiles.push(id)
+        }
+      }
+      this.dataForm.teaFiles = teaFiles.join(',')
+    },
+    handleRemoveImg(file, fileList) {
+      console.log(file, fileList)
+      const images = []
+      for (const i in fileList) {
+        const response = fileList[i].response
+        const url = response.data.url
+        images.push(url)
+        this.dataForm.imgUrl = images.join(',')
+      }
+    },
+    beforeUploadImg(file) {
+      const isJPGs = file.type === 'image/jpeg'
+      console.log(isJPGs)
+    },
+    handleExceed(files, fileList) {
+      this.$message.warning(
+        `当前限制选择 1 个文件,本次选择了 ${files.length} 个文件!,共选择了 ${files.length + fileList.length
+        } 个文件`
+      )
+    },
+    handleImgSucess(res, file, fileList) {
+      this.dataForm.imgUrl = '' // 清空画廊图片数组
 
-            this.dialogFormVisible = true;
-            this.dialogStatus = "create";
+      const images = []
+      for (const i in fileList) {
+        const response = fileList[i].response
+        if (response.errno && response.errno != '0') {
+          this.$message.error('该图片上传失败,已被移除,请重新上传!')
+          // 上传失败移除该 file 对象
+          fileList.splice(i, 1)
+        } else {
+          const url = response.data.url
+          images.push(url)
+        }
+      }
 
-            this.$nextTick(() => {
-                this.$refs["dataForm"].clearValidate();
-            });
-        },
-        createData() {
-            this.$refs["dataForm"].validate((valid) => {
-                if (valid) {
-                    console.log(this.dataForm);
-                    createItem(this.dataForm)
-                        .then((response) => {
-                            this.getList();
-                            this.dialogFormVisible = false;
-                            this.$notify({
-                                title: "成功",
-                                message: "创建成功",
-                                type: "success",
-                                duration: 2000,
-                            });
-                            this.reload();
-                        })
-                        .catch(() => { });
-                }
-            });
-        },
-        handleUpdate(row) {
-            this.activeName = 'first';
-            this.dataForm = Object.assign({}, row);
-            if (this.dataForm.imgUrl) {
-                let images = this.dataForm.imgUrl.split(",");
-                this.dataForm.images = [];
-                for (let i in images) {
-                    let url = images[i];
-                    let name = "image_" + i;
+      this.dataForm.imgUrl = images.join(',')
+    },
+    resetForm() {
+      this.dataForm = {
+        productName: undefined,
+        productCode: undefined,
+        productShortForm: undefined,
+        categoryId: undefined,
+        brandId: undefined,
+        price: undefined,
+        salePrice: undefined,
+        costPrice: undefined,
+        weight: 1,
+        status: 0,
+        imgUrl: undefined,
+        images: [],
+        teaTypeId: undefined,
+        teaLevel: undefined,
+        teaSeries: undefined,
+        teaPackageFormat: [],
+        teaOrigin: undefined,
+        teaGetSeason: undefined,
+        teaGuaranteeNumber: undefined,
+        teaGuaranteeUnit: '年',
+        productDate: undefined,
+        teaAgingYear: undefined,
+        teaFiles: undefined,
+        files: [],
+        teaStorageRequire: []
+      }
+    },
+    handleAdd() {
+      this.activeName = 'first'
+      this.resetForm()
 
-                    this.dataForm.images.push({
-                        name: name,
-                        url: url,
-                        response: { error: "0", data: { url: url } },
-                    });
-                }
-            }
-            if (this.dataForm.teaFiles) {
-                let files = this.dataForm.files;
-                this.dataForm.files = [];
-                for (let i in files) {
-                    let url = files[i].url;
-                    let name = files[i].oldName;
-                    let id = files[i].id;
+      this.dialogFormVisible = true
+      this.dialogStatus = 'create'
 
-                    this.dataForm.files.push({
-                        name: name,
-                        url: url,
-                        response: { error: "0", data: { url: url, id: id } },
-                    });
-                }
-            }
-            this.dialogStatus = 'update'
-            this.dialogFormVisible = true
-            this.$nextTick(() => {
-                this.$refs['dataForm'].clearValidate()
+      this.$nextTick(() => {
+        this.$refs['dataForm'].clearValidate()
+      })
+    },
+    createData() {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          console.log(this.dataForm)
+          createItem(this.dataForm)
+            .then((response) => {
+              this.getList()
+              this.dialogFormVisible = false
+              this.$notify({
+                title: '成功',
+                message: '创建成功',
+                type: 'success',
+                duration: 2000
+              })
+              this.reload()
             })
-        },
-        updateData() {
-            this.$refs['dataForm'].validate((valid) => {
-                if (valid) {
-                    updateItem(this.dataForm).then(() => {
-                        this.dialogFormVisible = false
-                        this.$notify({
-                            title: '成功',
-                            message: '更新成功',
-                            type: 'success',
-                            duration: 2000
-                        })
-                        this.getList()
-                    })
-
-                }
+            .catch(() => { })
+        }
+      })
+    },
+    handleUpdate(row) {
+      this.activeName = 'first'
+      this.dataForm = Object.assign({}, row)
+      if (this.dataForm.imgUrl) {
+        const images = this.dataForm.imgUrl.split(',')
+        this.dataForm.images = []
+        for (const i in images) {
+          const url = images[i]
+          const name = 'image_' + i
 
-            })
-        },
-        handleDelete(id) {
-            this.$confirm('确认删除吗?', '提示', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                type: 'warning'
-            }).then(() => {
-                removeItem({ id: id }).then(response => {
-                    this.$notify({
-                        title: '成功',
-                        message: '删除成功',
-                        type: 'success',
-                        duration: 2000
-                    })
-                    this.getList();
-                })
-            }).catch(() => {
+          this.dataForm.images.push({
+            name: name,
+            url: url,
+            response: { error: '0', data: { url: url }}
+          })
+        }
+      }
+      if (this.dataForm.teaFiles) {
+        const files = this.dataForm.files
+        this.dataForm.files = []
+        for (const i in files) {
+          const url = files[i].url
+          const name = files[i].oldName
+          const id = files[i].id
 
+          this.dataForm.files.push({
+            name: name,
+            url: url,
+            response: { error: '0', data: { url: url, id: id }}
+          })
+        }
+      }
+      this.dialogStatus = 'update'
+      this.dialogFormVisible = true
+      this.$nextTick(() => {
+        this.$refs['dataForm'].clearValidate()
+      })
+    },
+    updateData() {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          updateItem(this.dataForm).then(() => {
+            this.dialogFormVisible = false
+            this.$notify({
+              title: '成功',
+              message: '更新成功',
+              type: 'success',
+              duration: 2000
             })
+            this.getList()
+          })
+        }
+      })
+    },
+    handleDelete(id) {
+      this.$confirm('确认删除吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        removeItem({ id: id }).then(response => {
+          this.$notify({
+            title: '成功',
+            message: '删除成功',
+            type: 'success',
+            duration: 2000
+          })
+          this.getList()
+        })
+      }).catch(() => {
 
-        },
-        getBrandList() {
-            // 获取品牌信息
-            listBrand(this.listBrandQuery).then(response => {
-                this.brandOptions = response.data.data.items.map((item) => {
-                    return { value: item.id, label: item.name }
-                });
-            }).catch(() => {
-                this.brandOptions = [];
-            })
-        },
-        getList() {
-            this.listLoading = true
-            goodsList(this.listQuery).then(response => {
-                this.list = response.data.data.items
-                this.total = response.data.data.total
-                this.listLoading = false
-            }).catch(() => { })
-        },
+      })
+    },
+    getBrandList() {
+      // 获取品牌信息
+      listBrand(this.listBrandQuery).then(response => {
+        this.brandOptions = response.data.data.items.map((item) => {
+          return { value: item.id, label: item.name }
+        })
+      }).catch(() => {
+        this.brandOptions = []
+      })
+    },
+    getList() {
+      this.listLoading = true
+      goodsList(this.listQuery).then(response => {
+        this.list = response.data.data.items
+        this.total = response.data.data.total
+        this.listLoading = false
+      }).catch(() => { })
+    },
 
-        handleQuery() {
-            this.listQuery.page = 1
-            this.getList()
-        },
-        /** 重置按钮操作 */
-        resetQuery() {
-            this.listQuery = {
-                page: 1,
-                limit: 10,
-                productName: '',
-                productShortForm: '',
-                categoryId: '',
-                brandId: '',
-                status: '',
-            };
-            this.handleQuery();
-        },
-        handleSizeChange(val) {
-            this.listQuery.limit = val
-            this.getList()
-        },
-        handleCurrentChange(val) {
-            this.listQuery.page = val
-            this.getList()
-        },
+    handleQuery() {
+      this.listQuery.page = 1
+      this.getList()
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.listQuery = {
+        page: 1,
+        limit: 10,
+        productName: '',
+        productShortForm: '',
+        categoryId: '',
+        brandId: '',
+        status: ''
+      }
+      this.handleQuery()
+    },
+    handleSizeChange(val) {
+      this.listQuery.limit = val
+      this.getList()
+    },
+    handleCurrentChange(val) {
+      this.listQuery.page = val
+      this.getList()
     }
+  }
 }
 </script>
 <style>

+ 76 - 76
src/views/goodsManage/goodsTypeList.vue

@@ -144,10 +144,10 @@
 </template>
 
 <script>
-import { listDept, getDept, delDept, addDept, updateDept } from "@/api/goodsTypeList";
-import Treeselect from "@riophae/vue-treeselect";
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
-import waves from "@/directive/waves"; // 水波纹指令
+import { listDept, getDept, delDept, addDept, updateDept } from '@/api/goodsTypeList'
+import Treeselect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import waves from '@/directive/waves' // 水波纹指令
 
 export default {
   components: { Treeselect },
@@ -161,7 +161,7 @@ export default {
       // 表格树数据
       deptList: [],
       // 弹出层标题
-      title: "",
+      title: '',
       // 是否显示弹出层
       open: false,
       // 是否展开,默认全部展开
@@ -178,56 +178,56 @@ export default {
       // 表单校验
       rules: {
         parentId: [
-          { required: true, message: "上级商品类别不能为空", trigger: "blur" }
+          { required: true, message: '上级商品类别不能为空', trigger: 'blur' }
         ],
         categoryParentCode: [
-          { required: true, message: "上级商品类别编号不能为空", trigger: "blur" }
+          { required: true, message: '上级商品类别编号不能为空', trigger: 'blur' }
         ],
         categoryName: [
-          { required: true, message: "商品类别名称不能为空", trigger: "blur" }
+          { required: true, message: '商品类别名称不能为空', trigger: 'blur' }
         ],
         categoryCode: [
-          { required: true, message: "商品类别编号不能为空", trigger: "blur" }
+          { required: true, message: '商品类别编号不能为空', trigger: 'blur' }
         ]
       }
-    };
+    }
   },
   created() {
-    this.getList();
+    this.getList()
   },
   methods: {
     // 选中树形选项
     departTreeSelected(node, instanceId) {
-      console.log(node, instanceId);
-      this.form.categoryParentCode = node.categoryCode;
+      console.log(node, instanceId)
+      this.form.categoryParentCode = node.categoryCode
     },
     handleDownLoad() {
-      window.location.href = process.env.BASE_API + '/product-category/export/category';
+      window.location.href = process.env.BASE_API + '/product-category/export/category'
     },
     /** 查询商品类别列表 */
     getList() {
-      this.loading = true;
+      this.loading = true
       listDept(this.listQuery).then(response => {
-        this.deptList = this.handleTree(response.data.data, 'id');
-        console.log(this.deptList);
-        this.loading = false;
-      });
+        this.deptList = this.handleTree(response.data.data, 'id')
+        console.log(this.deptList)
+        this.loading = false
+      })
     },
     /** 转换商品类别数据结构 */
     normalizer(node) {
       if (node.children && !node.children.length) {
-        delete node.children;
+        delete node.children
       }
       return {
         id: node.id,
         label: node.categoryName,
         children: node.children
-      };
+      }
     },
     // 取消按钮
     cancel() {
-      this.open = false;
-      this.reset();
+      this.open = false
+      this.reset()
     },
     // 表单重置
     reset() {
@@ -237,58 +237,58 @@ export default {
         categoryParentCode: undefined,
         categoryName: undefined,
         categoryCode: undefined
-      };
-      this.resetForm("form");
+      }
+      this.resetForm('form')
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.getList();
+      this.getList()
     },
     /** 重置按钮操作 */
     resetQuery() {
       this.listQuery = {
         categoryCode: undefined,
         categoryName: undefined
-      };
-      this.handleQuery();
+      }
+      this.handleQuery()
     },
     /** 新增按钮操作 */
     handleAdd(row) {
-      this.reset();
-      this.isShowParent = false;
+      this.reset()
+      this.isShowParent = false
       if (row && row.id) {
-        this.isShowParent = true;
-        this.form.parentId = row.id;
-        this.form.categoryParentCode = row.categoryCode;
+        this.isShowParent = true
+        this.form.parentId = row.id
+        this.form.categoryParentCode = row.categoryCode
       }
-      this.open = true;
-      this.title = "添加商品类别";
+      this.open = true
+      this.title = '添加商品类别'
     },
     /** 展开/折叠操作 */
     toggleExpandAll() {
-      this.refreshTable = false;
-      this.isExpandAll = !this.isExpandAll;
+      this.refreshTable = false
+      this.isExpandAll = !this.isExpandAll
       this.$nextTick(() => {
-        this.refreshTable = true;
-      });
+        this.refreshTable = true
+      })
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.reset();
-      this.isShowParent = false;
+      this.reset()
+      this.isShowParent = false
       getDept({ id: row.id }).then(response => {
-        let data = response.data.data;
-        this.form = data;
+        const data = response.data.data
+        this.form = data
         if (data.parentId) {
-          this.isShowParent = true;
+          this.isShowParent = true
         }
-        this.open = true;
-        this.title = "修改商品类别";
-      });
+        this.open = true
+        this.title = '修改商品类别'
+      })
     },
     /** 提交按钮 */
     submitForm: function() {
-      this.$refs["form"].validate(valid => {
+      this.$refs['form'].validate(valid => {
         if (valid) {
           if (this.form.id != undefined) {
             updateDept(this.form).then(response => {
@@ -297,10 +297,10 @@ export default {
                 message: '修改成功',
                 type: 'success',
                 duration: 2000
-              });
-              this.open = false;
-              this.getList();
-            });
+              })
+              this.open = false
+              this.getList()
+            })
           } else {
             addDept(this.form).then(response => {
               this.$notify({
@@ -308,36 +308,36 @@ export default {
                 message: '新增成功',
                 type: 'success',
                 duration: 2000
-              });
-              this.open = false;
-              this.getList();
-            });
+              })
+              this.open = false
+              this.getList()
+            })
           }
         }
-      });
+      })
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      console.log(row);
-      this.$confirm('是否确认删除名称为"' + row.categoryName + '"的数据项?', "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning"
-      })
-      .then(() => {
-        return delDept({ id: row.id });
-      })
-      .then(() => {
-        this.getList();
-        this.$notify({
-          title: '成功',
-          message: '删除成功',
-          type: 'success',
-          duration: 2000
-        });
+      console.log(row)
+      this.$confirm('是否确认删除名称为"' + row.categoryName + '"的数据项?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
       })
-      .catch(() => {});
+        .then(() => {
+          return delDept({ id: row.id })
+        })
+        .then(() => {
+          this.getList()
+          this.$notify({
+            title: '成功',
+            message: '删除成功',
+            type: 'success',
+            duration: 2000
+          })
+        })
+        .catch(() => {})
     }
   }
-};
+}
 </script>

+ 7 - 7
src/views/report/stockReport.vue

@@ -101,13 +101,13 @@ export default {
   },
   data() {
     return {
-      userTotal: 0,//校友录数量
-      visitorsTotal: 0,//游客数量
-      awaitAuditTotal: 0,//待审核数量
-      yesterdayTotal: 0,//昨日浏览人数
-      todayTotal:0,//今日评论数量
-      groupTotal:0,//圈子待审核数量
-      questionTotal:0,//提问待回答数量
+      userTotal: 0, // 校友录数量
+      visitorsTotal: 0, // 游客数量
+      awaitAuditTotal: 0, // 待审核数量
+      yesterdayTotal: 0, // 昨日浏览人数
+      todayTotal: 0, // 今日评论数量
+      groupTotal: 0, // 圈子待审核数量
+      questionTotal: 0, // 提问待回答数量
       goodsTotal: 0,
       productTotal: 0,
       orderTotal: 0

+ 98 - 98
src/views/stock/assembly/assembly.vue

@@ -155,9 +155,9 @@
 </template>
 
 <script>
-import { listAssembly, deleteAssembly, executeAssembly, cancelAssembly } from "@/api/assembly";
-import { warehouseList } from "@/api/warehouse";
-import { allUserList } from "@/api/public";
+import { listAssembly, deleteAssembly, executeAssembly, cancelAssembly } from '@/api/assembly'
+import { warehouseList } from '@/api/warehouse'
+import { allUserList } from '@/api/public'
 
 export default {
   data() {
@@ -168,14 +168,14 @@ export default {
         cancelMsg: ''
       },
       rules: {
-        cancelMsg: [{ required: true, message: "作废原因不能为空", trigger: "blur" }],
+        cancelMsg: [{ required: true, message: '作废原因不能为空', trigger: 'blur' }]
       },
       warehouseList: [],
       userSelsctList: [],
       typeList: [
-        { type: '0', name: "已组装" },
-        { type: '1', name: "待组装" },
-        { type: '2', name: "已作废" },
+        { type: '0', name: '已组装' },
+        { type: '1', name: '待组装' },
+        { type: '2', name: '已作废' }
       ],
       list: [],
       delarr: [],
@@ -190,49 +190,49 @@ export default {
         warehouseId: '',
         addHandlerId: '',
         isRunFinish: '',
-        assembleProductName: '',
-      },
+        assembleProductName: ''
+      }
     }
   },
   created() {
-    this.getStoreList();
-    this.getAllUserList(); 
-    this.getList();
+    this.getStoreList()
+    this.getAllUserList()
+    this.getList()
   },
   methods: {
     handleCancelShow(id) {
-      this.dialogFormVisible = true;
-      this.cancelId = id;
+      this.dialogFormVisible = true
+      this.cancelId = id
       this.$nextTick(() => {
-        this.dataForm.cancelMsg = '';
-        this.$refs["dataForm"].clearValidate();
-      });
+        this.dataForm.cancelMsg = ''
+        this.$refs['dataForm'].clearValidate()
+      })
     },
     handleCancel() {
-      this.$refs["dataForm"].validate((valid) => {
+      this.$refs['dataForm'].validate((valid) => {
         if (valid) {
           cancelAssembly({ id: this.cancelId, cancelMsg: this.dataForm.cancelMsg }).then(() => {
-            this.dialogFormVisible = false;
+            this.dialogFormVisible = false
             this.$notify({
-              title: "成功",
-              message: "操作成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
+              title: '成功',
+              message: '操作成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
         }
       })
     },
     getStoreList() {
       warehouseList().then(response => {
-        this.warehouseList = response.data.data;
-      }).catch(() => { });
+        this.warehouseList = response.data.data
+      }).catch(() => { })
     },
     getAllUserList() {
       allUserList().then(response => {
-        this.userSelsctList = response.data.data;
-      }).catch(() => { });
+        this.userSelsctList = response.data.data
+      }).catch(() => { })
     },
     resetQuery() {
       this.listQuery = {
@@ -243,42 +243,42 @@ export default {
         warehouseId: '',
         addHandlerId: '',
         isRunFinish: '',
-        assembleProductName: '',
-      };
-      this.getList();
+        assembleProductName: ''
+      }
+      this.getList()
     },
     handleDownload() {
-      window.location.href = process.env.BASE_API + '/warehouse-assembly/export';
+      window.location.href = process.env.BASE_API + '/warehouse-assembly/export'
     },
     handleCreate() {
-      this.$router.push({ name: 'assemblyAdd' });
+      this.$router.push({ name: 'assemblyAdd' })
     },
     getList() {
-      this.listLoading = true;
+      this.listLoading = true
       listAssembly(this.listQuery).then(response => {
-        this.list = response.data.data.items;
-        this.total = response.data.data.total;
-        this.listLoading = false;
+        this.list = response.data.data.items
+        this.total = response.data.data.total
+        this.listLoading = false
       }).catch(() => {
-        this.list = [];
-        this.total = 0;
-        this.listLoading = false;
-      });
+        this.list = []
+        this.total = 0
+        this.listLoading = false
+      })
     },
     handleFilter() {
-      this.listQuery.page = 1;
-      this.getList();
+      this.listQuery.page = 1
+      this.getList()
     },
     handleSizeChange(val) {
-      this.listQuery.limit = val;
-      this.getList();
+      this.listQuery.limit = val
+      this.getList()
     },
     handleCurrentChange(val) {
-      this.listQuery.page = val;
-      this.getList();
+      this.listQuery.page = val
+      this.getList()
     },
     handleUpdate(row) {
-      this.$router.push({ name: 'assemblyEdit', params: { id: row.id } });
+      this.$router.push({ name: 'assemblyEdit', params: { id: row.id }})
     },
     handleExecute(row) {
       this.$confirm('确认组装吗?', '提示', {
@@ -292,39 +292,39 @@ export default {
             message: '组装成功',
             type: 'success',
             duration: 2000
-          });
-          this.getList();
-        });
-      }).catch(() => { });
+          })
+          this.getList()
+        })
+      }).catch(() => { })
     },
     executeAll() {
-      const length = this.multipleSelection.length;
+      const length = this.multipleSelection.length
       if (length > 0) {
-        this.$confirm("确认组装吗?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
+        this.$confirm('确认组装吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }).then(() => {
           for (let i = 0; i < length; i++) {
-            this.delarr.push(this.multipleSelection[i].id);
+            this.delarr.push(this.multipleSelection[i].id)
           }
-          const ids = this.delarr.join(",");
+          const ids = this.delarr.join(',')
           executeAssembly({ ids: ids }).then(() => {
             this.$notify({
-              title: "成功",
-              message: "组装成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
-        });
+              title: '成功',
+              message: '组装成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
+        })
       } else {
         this.$notify({
-          title: "提示",
-          message: "请选择要组装的信息!",
-          type: "warning",
-        });
+          title: '提示',
+          message: '请选择要组装的信息!',
+          type: 'warning'
+        })
       }
     },
     handleDelete(row) {
@@ -339,44 +339,44 @@ export default {
             message: '删除成功',
             type: 'success',
             duration: 2000
-          });
-          this.getList();
-        });
-      }).catch(() => { });
+          })
+          this.getList()
+        })
+      }).catch(() => { })
     },
     delAll() {
-      const length = this.multipleSelection.length;
+      const length = this.multipleSelection.length
       if (length > 0) {
-        this.$confirm("确认删除吗?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
+        this.$confirm('确认删除吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }).then(() => {
           for (let i = 0; i < length; i++) {
-            this.delarr.push(this.multipleSelection[i].id);
+            this.delarr.push(this.multipleSelection[i].id)
           }
-          const ids = this.delarr.join(",");
+          const ids = this.delarr.join(',')
           deleteAssembly({ ids: ids }).then(() => {
             this.$notify({
-              title: "成功",
-              message: "删除成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
-        });
+              title: '成功',
+              message: '删除成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
+        })
       } else {
         this.$notify({
-          title: "提示",
-          message: "请选择要删除的信息!",
-          type: "warning",
-        });
+          title: '提示',
+          message: '请选择要删除的信息!',
+          type: 'warning'
+        })
       }
     },
     handleSelectionChange(val) {
-      this.multipleSelection = val;
-    },
+      this.multipleSelection = val
+    }
   }
 }
 </script>

+ 170 - 171
src/views/stock/assembly/assemblyAdd.vue

@@ -104,188 +104,187 @@
     </div>
 </template>
 <script>
-import { createAssembly, updateAssembly, readAssembly } from "@/api/assembly";
-import { listGoods } from "@/api/goodsManage";
-import { warehouseList } from "@/api/warehouse";
-import { allUserList } from "@/api/public";
-import waves from "@/directive/waves"; // 水波纹指令
+import { createAssembly, updateAssembly, readAssembly } from '@/api/assembly'
+import { listGoods } from '@/api/goodsManage'
+import { warehouseList } from '@/api/warehouse'
+import { allUserList } from '@/api/public'
+import waves from '@/directive/waves' // 水波纹指令
 
 export default {
-    directives: { waves },
-    data() {
-        return {
-            userSelsctList: [],
-            assembleProducList: [],
-            warehouseList: [],
-            id: '',
-            type: '',
-            /** 表单*/
-            dataForm: {
-                serialDate: '',
-                warehouseId: undefined,
-                updateUserName: undefined,
-                addHandlerId: undefined,
-                assembleProductId: undefined,
-                updateNumber: 1,
-                remarks: undefined,
-                inventoryEntryInfos: [],
-                inventoryOutInfos: []
-            },
-            rules: {
-                serialDate: [
-                    { required: true, message: '请选择组装时间', trigger: 'blur' }
-                ],
-                warehouseId: [
-                    { required: true, message: '请选择仓库', trigger: 'blur' }
-                ],
-                remarks: [
-                    { required: true, message: '请填写组装原因', trigger: 'blur' }
-                ],
-                addHandlerId: [
-                    { required: true, message: '请选择经手人', trigger: 'blur' }
-                ],
-                assembleProductId: [
-                    { required: true, message: '请选择组装商品', trigger: 'blur' }
-                ],
-                updateNumber: [
-                    { required: true, message: '请输入组装数量', trigger: 'blur' }
-                ],
-            },
+  directives: { waves },
+  data() {
+    return {
+      userSelsctList: [],
+      assembleProducList: [],
+      warehouseList: [],
+      id: '',
+      type: '',
+      /** 表单*/
+      dataForm: {
+        serialDate: '',
+        warehouseId: undefined,
+        updateUserName: undefined,
+        addHandlerId: undefined,
+        assembleProductId: undefined,
+        updateNumber: 1,
+        remarks: undefined,
+        inventoryEntryInfos: [],
+        inventoryOutInfos: []
+      },
+      rules: {
+        serialDate: [
+          { required: true, message: '请选择组装时间', trigger: 'blur' }
+        ],
+        warehouseId: [
+          { required: true, message: '请选择仓库', trigger: 'blur' }
+        ],
+        remarks: [
+          { required: true, message: '请填写组装原因', trigger: 'blur' }
+        ],
+        addHandlerId: [
+          { required: true, message: '请选择经手人', trigger: 'blur' }
+        ],
+        assembleProductId: [
+          { required: true, message: '请选择组装商品', trigger: 'blur' }
+        ],
+        updateNumber: [
+          { required: true, message: '请输入组装数量', trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  watch: {
+    $route: {
+      immediate: true,
+      handler(newVal) {
+        if (this.$route.name === 'assemblyAdd') {
+          this.dataForm = {
+            serialDate: '',
+            warehouseId: undefined,
+            updateUserName: undefined,
+            addHandlerId: undefined,
+            assembleProductId: undefined,
+            updateNumber: 1,
+            remarks: undefined,
+            inventoryEntryInfos: [],
+            inventoryOutInfos: []
+          }
+        } else if (this.$route.name === 'assemblyDetail') {
+          this.type = 'detail'
         }
-    },
-    watch: {
-        $route: {
-            immediate: true,
-            handler(newVal) {
-                if (this.$route.name === 'assemblyAdd') {
-                    this.dataForm = {
-                        serialDate: '',
-                        warehouseId: undefined,
-                        updateUserName: undefined,
-                        addHandlerId: undefined,
-                        assembleProductId: undefined,
-                        updateNumber: 1,
-                        remarks: undefined,
-                        inventoryEntryInfos: [],
-                        inventoryOutInfos: []
-                    }
-                } else if (this.$route.name === 'assemblyDetail') {
-                    this.type = 'detail'
-                }
-                if (this.$route.params.id) {
-                    this.id = this.$route.params.id
-                    this.getDataFormDetail()
-                }
-            }
+        if (this.$route.params.id) {
+          this.id = this.$route.params.id
+          this.getDataFormDetail()
         }
+      }
+    }
+  },
+  mounted() {
+    this.getAssembleProducList()
+    this.getWarehouseList()
+    this.getAllUserList()
+  },
+  methods: {
+    /** 获取组装商品列表数据 */
+    getAssembleProducList() {
+      listGoods().then(response => {
+        this.assembleProducList = response.data.data
+      }).catch(() => { })
     },
-    mounted() {
-        this.getAssembleProducList();
-        this.getWarehouseList();
-        this.getAllUserList();
+    /** 获取仓库列表数据 */
+    getWarehouseList() {
+      warehouseList().then(response => {
+        this.warehouseList = response.data.data
+      }).catch(() => { })
     },
-    methods: {
-        /** 获取组装商品列表数据 */
-        getAssembleProducList() {
-            listGoods().then(response => {
-                this.assembleProducList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取仓库列表数据 */
-        getWarehouseList() {
-            warehouseList().then(response => {
-                this.warehouseList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取人员列表数据 */
-        getAllUserList() {
-            allUserList().then(response => {
-                this.userSelsctList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取详情页面数据 */
-        getDataFormDetail() {
-            readAssembly({ id: this.id }).then(response => {
-                let dataForm = response.data.data;
-                dataForm.inventoryEntryInfos = dataForm.inventoryEntryInfos == null ? [] : dataForm.inventoryEntryInfos
-                dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
-                this.dataForm = dataForm;
-            }).catch(() => { })
-        },
-        // 选择商品
-        async handleSelectGoods(val) {
-            if (!this.dataForm.warehouseId) {
-                this.$message.error('请先选择仓库!')
-                return
+    /** 获取人员列表数据 */
+    getAllUserList() {
+      allUserList().then(response => {
+        this.userSelsctList = response.data.data
+      }).catch(() => { })
+    },
+    /** 获取详情页面数据 */
+    getDataFormDetail() {
+      readAssembly({ id: this.id }).then(response => {
+        const dataForm = response.data.data
+        dataForm.inventoryEntryInfos = dataForm.inventoryEntryInfos == null ? [] : dataForm.inventoryEntryInfos
+        dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
+        this.dataForm = dataForm
+      }).catch(() => { })
+    },
+    // 选择商品
+    async handleSelectGoods(val) {
+      if (!this.dataForm.warehouseId) {
+        this.$message.error('请先选择仓库!')
+        return
+      } else {
+        const selectedIds = val == 'inventoryEntryInfos' ? this.dataForm.inventoryEntryInfos.map(item => item.id) : this.dataForm.inventoryOutInfos.map(item => item.id)
+        const Goods = await this.$EnPickerGoods({
+          // goodsApi: '/warehouse-entry/info/inventory',
+          selectedIds: selectedIds,
+          goodsApiParams: { warehouseId: this.dataForm.warehouseId, type: '2' }
+        })
+        if (!Goods.length) return
+        if (val == 'inventoryEntryInfos') {
+          const inventoryEntryInfos = Goods.map(item => {
+            item.updateNumber = 1
+            item.sumPrice = item.createPrice * 1
+            return item
+          })
+          this.dataForm.inventoryEntryInfos = this.dataForm.inventoryEntryInfos && this.dataForm.inventoryEntryInfos.length ? this.dataForm.inventoryEntryInfos.concat(inventoryEntryInfos) : this.dataForm.inventoryEntryInfos = inventoryEntryInfos
+        } else {
+          const inventoryOutInfos = Goods.map(item => {
+            item.updateNumber = 1
+            item.sumPrice = item.createPrice * 1
+            return item
+          })
+          this.dataForm.inventoryOutInfos = this.dataForm.inventoryOutInfos && this.dataForm.inventoryOutInfos.length ? this.dataForm.inventoryOutInfos.concat(inventoryOutInfos) : this.dataForm.inventoryOutInfos = inventoryOutInfos
+        }
+      }
+    },
+    submitForm() {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          if (this.dataForm.inventoryOutInfos.length == 0) {
+            this.$message.error('请选择商品/物料!')
+            return
+          } else {
+            if (this.id) {
+              updateAssembly(this.dataForm).then(() => {
+                this.$notify({
+                  title: '成功',
+                  message: '更新成功',
+                  type: 'success',
+                  duration: 2000
+                })
+                this.roBack()
+              })
             } else {
-                let selectedIds = val=='inventoryEntryInfos' ? this.dataForm.inventoryEntryInfos.map(item => item.id) : this.dataForm.inventoryOutInfos.map(item => item.id);
-                const Goods = await this.$EnPickerGoods({
-                    // goodsApi: '/warehouse-entry/info/inventory',
-                    selectedIds: selectedIds,
-                    goodsApiParams: { warehouseId: this.dataForm.warehouseId, type:'2' }
+              createAssembly(this.dataForm).then(() => {
+                this.$notify({
+                  title: '成功',
+                  message: '创建成功',
+                  type: 'success',
+                  duration: 2000
                 })
-                if (!Goods.length) return
-                if(val=='inventoryEntryInfos'){
-                    const inventoryEntryInfos = Goods.map(item => {
-                        item.updateNumber = 1
-                        item.sumPrice = item.createPrice * 1
-                        return item
-                    })
-                    this.dataForm.inventoryEntryInfos = this.dataForm.inventoryEntryInfos && this.dataForm.inventoryEntryInfos.length ? this.dataForm.inventoryEntryInfos.concat(inventoryEntryInfos) : this.dataForm.inventoryEntryInfos = inventoryEntryInfos
-                }else{
-                    const inventoryOutInfos = Goods.map(item => {
-                        item.updateNumber = 1
-                        item.sumPrice = item.createPrice * 1
-                        return item
-                    })
-                    this.dataForm.inventoryOutInfos = this.dataForm.inventoryOutInfos && this.dataForm.inventoryOutInfos.length ? this.dataForm.inventoryOutInfos.concat(inventoryOutInfos) : this.dataForm.inventoryOutInfos = inventoryOutInfos
-                }
-            }
-
-        },
-        submitForm() {
-            this.$refs["dataForm"].validate((valid) => {
-                if (valid) {
-                    if (this.dataForm.inventoryOutInfos.length == 0) {
-                        this.$message.error('请选择商品/物料!')
-                        return
-                    } else {
-                        if (this.id) {
-                            updateAssembly(this.dataForm).then(() => {
-                                this.$notify({
-                                    title: '成功',
-                                    message: '更新成功',
-                                    type: 'success',
-                                    duration: 2000
-                                })
-                                this.roBack();
-                            })
-                        } else {
-                            createAssembly(this.dataForm).then(() => {
-                                this.$notify({
-                                    title: "成功",
-                                    message: "创建成功",
-                                    type: "success",
-                                    duration: 2000,
-                                });
-                                this.roBack();
-                            })
-                        }
-                    }
-                }
-            });
-        },
-        handleChange(row) {
-            if (row.createPrice && row.updateNumber) {
-                row.sumPrice = row.createPrice * row.updateNumber
+                this.roBack()
+              })
             }
-        },
-        roBack() {
-            this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
-                this.$router.push({ name: 'assembly' })
-            })
+          }
         }
+      })
+    },
+    handleChange(row) {
+      if (row.createPrice && row.updateNumber) {
+        row.sumPrice = row.createPrice * row.updateNumber
+      }
+    },
+    roBack() {
+      this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
+        this.$router.push({ name: 'assembly' })
+      })
     }
+  }
 }
 </script>
 <style>

+ 98 - 98
src/views/stock/breakage/breakage.vue

@@ -147,9 +147,9 @@
 </template>
 
 <script>
-import { listBreakage, deleteBreakage, executeBreakage, cancelBreakage } from "@/api/breakage";
-import { warehouseList } from "@/api/warehouse";
-import { allUserList } from "@/api/public";
+import { listBreakage, deleteBreakage, executeBreakage, cancelBreakage } from '@/api/breakage'
+import { warehouseList } from '@/api/warehouse'
+import { allUserList } from '@/api/public'
 
 export default {
   data() {
@@ -160,12 +160,12 @@ export default {
         cancelMsg: ''
       },
       rules: {
-        cancelMsg: [{ required: true, message: "作废原因不能为空", trigger: "blur" }],
+        cancelMsg: [{ required: true, message: '作废原因不能为空', trigger: 'blur' }]
       },
       typeList: [
-        { type: '0', name: "已报损" },
-        { type: '1', name: "待报损" },
-        { type: '2', name: "已作废" },
+        { type: '0', name: '已报损' },
+        { type: '1', name: '待报损' },
+        { type: '2', name: '已作废' }
       ],
       warehouseList: [],
       userSelsctList: [],
@@ -181,49 +181,49 @@ export default {
         endDate: '',
         warehouseId: '',
         addHandlerId: '',
-        isRunFinish: '',
-      },
+        isRunFinish: ''
+      }
     }
   },
   created() {
-    this.getStoreList();
-    this.getAllUserList(); 
-    this.getList();
+    this.getStoreList()
+    this.getAllUserList()
+    this.getList()
   },
   methods: {
     handleCancelShow(id) {
-      this.dialogFormVisible = true;
-      this.cancelId = id;
+      this.dialogFormVisible = true
+      this.cancelId = id
       this.$nextTick(() => {
-        this.dataForm.cancelMsg = '';
-        this.$refs["dataForm"].clearValidate();
-      });
+        this.dataForm.cancelMsg = ''
+        this.$refs['dataForm'].clearValidate()
+      })
     },
     handleCancel() {
-      this.$refs["dataForm"].validate((valid) => {
+      this.$refs['dataForm'].validate((valid) => {
         if (valid) {
           cancelBreakage({ id: this.cancelId, cancelMsg: this.dataForm.cancelMsg }).then(() => {
-            this.dialogFormVisible = false;
+            this.dialogFormVisible = false
             this.$notify({
-              title: "成功",
-              message: "操作成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
+              title: '成功',
+              message: '操作成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
         }
       })
     },
     getStoreList() {
       warehouseList().then(response => {
-        this.warehouseList = response.data.data;
-      }).catch(() => { });
+        this.warehouseList = response.data.data
+      }).catch(() => { })
     },
     getAllUserList() {
       allUserList().then(response => {
-        this.userSelsctList = response.data.data;
-      }).catch(() => { });
+        this.userSelsctList = response.data.data
+      }).catch(() => { })
     },
     resetQuery() {
       this.listQuery = {
@@ -233,42 +233,42 @@ export default {
         endDate: '',
         warehouseId: '',
         addHandlerId: '',
-        isRunFinish: '',
-      };
-      this.getList();
+        isRunFinish: ''
+      }
+      this.getList()
     },
     handleDownload() {
-      window.location.href = process.env.BASE_API + '/warehouse-breakage/export';
+      window.location.href = process.env.BASE_API + '/warehouse-breakage/export'
     },
     handleCreate() {
-      this.$router.push({ name: 'breakageAdd' });
+      this.$router.push({ name: 'breakageAdd' })
     },
     getList() {
-      this.listLoading = true;
+      this.listLoading = true
       listBreakage(this.listQuery).then(response => {
-        this.list = response.data.data.items;
-        this.total = response.data.data.total;
-        this.listLoading = false;
+        this.list = response.data.data.items
+        this.total = response.data.data.total
+        this.listLoading = false
       }).catch(() => {
-        this.list = [];
-        this.total = 0;
-        this.listLoading = false;
-      });
+        this.list = []
+        this.total = 0
+        this.listLoading = false
+      })
     },
     handleFilter() {
-      this.listQuery.page = 1;
-      this.getList();
+      this.listQuery.page = 1
+      this.getList()
     },
     handleSizeChange(val) {
-      this.listQuery.limit = val;
-      this.getList();
+      this.listQuery.limit = val
+      this.getList()
     },
     handleCurrentChange(val) {
-      this.listQuery.page = val;
-      this.getList();
+      this.listQuery.page = val
+      this.getList()
     },
     handleUpdate(row) {
-      this.$router.push({ name: 'breakageEdit', params: { id: row.id } });
+      this.$router.push({ name: 'breakageEdit', params: { id: row.id }})
     },
     handleExecute(row) {
       this.$confirm('确认报损吗?', '提示', {
@@ -282,39 +282,39 @@ export default {
             message: '报损成功',
             type: 'success',
             duration: 2000
-          });
-          this.getList();
-        });
-      }).catch(() => { });
+          })
+          this.getList()
+        })
+      }).catch(() => { })
     },
     executeAll() {
-      const length = this.multipleSelection.length;
+      const length = this.multipleSelection.length
       if (length > 0) {
-        this.$confirm("确认报损吗?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
+        this.$confirm('确认报损吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }).then(() => {
           for (let i = 0; i < length; i++) {
-            this.delarr.push(this.multipleSelection[i].id);
+            this.delarr.push(this.multipleSelection[i].id)
           }
-          const ids = this.delarr.join(",");
+          const ids = this.delarr.join(',')
           executeBreakage({ ids: ids }).then(() => {
             this.$notify({
-              title: "成功",
-              message: "报损成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
-        });
+              title: '成功',
+              message: '报损成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
+        })
       } else {
         this.$notify({
-          title: "提示",
-          message: "请选择要报损的信息!",
-          type: "warning",
-        });
+          title: '提示',
+          message: '请选择要报损的信息!',
+          type: 'warning'
+        })
       }
     },
     handleDelete(row) {
@@ -329,44 +329,44 @@ export default {
             message: '删除成功',
             type: 'success',
             duration: 2000
-          });
-          this.getList();
-        });
-      }).catch(() => { });
+          })
+          this.getList()
+        })
+      }).catch(() => { })
     },
     delAll() {
-      const length = this.multipleSelection.length;
+      const length = this.multipleSelection.length
       if (length > 0) {
-        this.$confirm("确认删除吗?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
+        this.$confirm('确认删除吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }).then(() => {
           for (let i = 0; i < length; i++) {
-            this.delarr.push(this.multipleSelection[i].id);
+            this.delarr.push(this.multipleSelection[i].id)
           }
-          const ids = this.delarr.join(",");
+          const ids = this.delarr.join(',')
           deleteBreakage({ ids: ids }).then(() => {
             this.$notify({
-              title: "成功",
-              message: "删除成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
-        });
+              title: '成功',
+              message: '删除成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
+        })
       } else {
         this.$notify({
-          title: "提示",
-          message: "请选择要删除的信息!",
-          type: "warning",
-        });
+          title: '提示',
+          message: '请选择要删除的信息!',
+          type: 'warning'
+        })
       }
     },
     handleSelectionChange(val) {
-      this.multipleSelection = val;
-    },
+      this.multipleSelection = val
+    }
   }
 }
 </script>

+ 153 - 154
src/views/stock/breakage/breakageAdd.vue

@@ -92,170 +92,169 @@
     </div>
 </template>
 <script>
-import { createBreakage, updateBreakage, readBreakage } from "@/api/breakage";
-import { warehouseList } from "@/api/warehouse";
-import { allUserList, dataTypeList } from "@/api/public";
-import waves from "@/directive/waves"; // 水波纹指令
+import { createBreakage, updateBreakage, readBreakage } from '@/api/breakage'
+import { warehouseList } from '@/api/warehouse'
+import { allUserList, dataTypeList } from '@/api/public'
+import waves from '@/directive/waves' // 水波纹指令
 
 export default {
-    directives: { waves },
-    data() {
-        return {
-            userSelsctList:[],
-            breakTypeList: [],
-            warehouseList: [],
-            id: '',
-            type: '',
-            /** 表单*/
-            dataForm: {
-                serialDate:'',
-                breakType:undefined,
-                warehouseId:undefined,
-                addHandlerId:undefined,
-                remarks:undefined,
-                inventoryOutInfos: []
-            },
-            rules: {
-                serialDate: [
-                    { required: true, message: '请选择报损时间', trigger: 'blur' }
-                ],
-                breakType: [
-                    { required: true, message: '请选择报损类型', trigger: 'blur' }
-                ],
-                warehouseId: [
-                    { required: true, message: '请选择仓库', trigger: 'blur' }
-                ],
-                addHandlerId: [
-                    { required: true, message: '请选择经手人', trigger: 'blur' }
-                ],
-                remarks: [
-                    { required: true, message: '请填写报损原因', trigger: 'blur' }
-                ],
-            },
+  directives: { waves },
+  data() {
+    return {
+      userSelsctList: [],
+      breakTypeList: [],
+      warehouseList: [],
+      id: '',
+      type: '',
+      /** 表单*/
+      dataForm: {
+        serialDate: '',
+        breakType: undefined,
+        warehouseId: undefined,
+        addHandlerId: undefined,
+        remarks: undefined,
+        inventoryOutInfos: []
+      },
+      rules: {
+        serialDate: [
+          { required: true, message: '请选择报损时间', trigger: 'blur' }
+        ],
+        breakType: [
+          { required: true, message: '请选择报损类型', trigger: 'blur' }
+        ],
+        warehouseId: [
+          { required: true, message: '请选择仓库', trigger: 'blur' }
+        ],
+        addHandlerId: [
+          { required: true, message: '请选择经手人', trigger: 'blur' }
+        ],
+        remarks: [
+          { required: true, message: '请填写报损原因', trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  watch: {
+    $route: {
+      immediate: true,
+      handler(newVal) {
+        if (this.$route.name === 'breakageAdd') {
+          this.dataForm = {
+            serialDate: '',
+            breakType: undefined,
+            warehouseId: undefined,
+            addHandlerId: undefined,
+            remarks: undefined,
+            inventoryOutInfos: []
+          }
+        } else if (this.$route.name === 'breakageDetail') {
+          this.type = 'detail'
         }
-    },
-    watch: {
-        $route: {
-            immediate: true,
-            handler(newVal) {
-                if (this.$route.name === 'breakageAdd') {
-                    this.dataForm = {
-                        serialDate:'',
-                        breakType:undefined,
-                        warehouseId:undefined,
-                        addHandlerId:undefined,
-                        remarks:undefined,
-                        inventoryOutInfos: []
-                    }
-                } else if (this.$route.name === 'breakageDetail') {
-                    this.type = 'detail'
-                }
-                if (this.$route.params.id) {
-                    this.id = this.$route.params.id
-                    this.getDataFormDetail()
-                }
-            }
+        if (this.$route.params.id) {
+          this.id = this.$route.params.id
+          this.getDataFormDetail()
         }
+      }
+    }
+  },
+  mounted() {
+    this.getBreakTypeList()
+    this.getStoreList()
+    this.getAllUserList()
+  },
+  methods: {
+    /** 获取报损类型列表数据 */
+    getBreakTypeList() {
+      dataTypeList({ dictType: 'break_type' }).then(response => {
+        this.breakTypeList = response.data.data
+      })
+    },
+    /** 获取仓库列表数据 */
+    getStoreList() {
+      warehouseList().then(response => {
+        this.warehouseList = response.data.data
+      }).catch(() => {})
+    },
+    /** 获取人员列表数据 */
+    getAllUserList() {
+      allUserList().then(response => {
+        this.userSelsctList = response.data.data
+      }).catch(() => { })
     },
-    mounted() {
-        this.getBreakTypeList();
-        this.getStoreList(); 
-        this.getAllUserList(); 
+    /** 获取详情页面数据 */
+    getDataFormDetail() {
+      readBreakage({ id: this.id }).then(response => {
+        const dataForm = response.data.data
+        dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
+        dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
+        this.dataForm = dataForm
+      }).catch(() => {})
     },
-    methods: {
-        /** 获取报损类型列表数据 */
-        getBreakTypeList(){
-             dataTypeList({ dictType: 'break_type' }).then(response => {
-                this.breakTypeList = response.data.data;
-            });
-        },
-        /** 获取仓库列表数据 */
-        getStoreList() {
-            warehouseList().then(response => {
-                this.warehouseList = response.data.data;
-            }).catch(() => {});
-        },
-        /** 获取人员列表数据 */
-        getAllUserList() {
-            allUserList().then(response => {
-                this.userSelsctList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取详情页面数据 */
-        getDataFormDetail() {
-            readBreakage({ id: this.id }).then(response => {
-                let dataForm = response.data.data;
-                dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
-                dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
-                this.dataForm = dataForm;
-            }).catch(() => {})
-        },
-         // 选择商品
-        async handleSelectGoods() {
-            if (!this.dataForm.warehouseId) {
-                this.$message.error('请先选择调出仓库!')
-                return
-            }else{
-                console.log(this.dataForm.inventoryOutInfos)
-                let selectedIds = this.dataForm.inventoryOutInfos.map(item => item.id);
-                const Goods = await this.$EnPickerGoods({
-                    // goodsApi: '/warehouse-entry/info/inventory',
-                    selectedIds: selectedIds,
-                    goodsApiParams: { warehouseId: this.dataForm.warehouseId, type:'2' }
+    // 选择商品
+    async handleSelectGoods() {
+      if (!this.dataForm.warehouseId) {
+        this.$message.error('请先选择调出仓库!')
+        return
+      } else {
+        console.log(this.dataForm.inventoryOutInfos)
+        const selectedIds = this.dataForm.inventoryOutInfos.map(item => item.id)
+        const Goods = await this.$EnPickerGoods({
+          // goodsApi: '/warehouse-entry/info/inventory',
+          selectedIds: selectedIds,
+          goodsApiParams: { warehouseId: this.dataForm.warehouseId, type: '2' }
+        })
+        if (!Goods.length) return
+        const inventoryOutInfos = Goods.map(item => {
+          item.updateNumber = 1
+          item.sumPrice = item.createPrice * 1
+          return item
+        })
+        this.dataForm.inventoryOutInfos = this.dataForm.inventoryOutInfos && this.dataForm.inventoryOutInfos.length ? this.dataForm.inventoryOutInfos.concat(inventoryOutInfos) : this.dataForm.inventoryOutInfos = inventoryOutInfos
+      }
+    },
+    submitForm() {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          if (this.dataForm.inventoryOutInfos.length == 0) {
+            this.$message.error('请选择商品/物料!')
+            return
+          } else {
+            if (this.id) {
+              updateBreakage(this.dataForm).then(() => {
+                this.$notify({
+                  title: '成功',
+                  message: '更新成功',
+                  type: 'success',
+                  duration: 2000
                 })
-                if (!Goods.length) return
-                const inventoryOutInfos = Goods.map(item => {
-                    item.updateNumber = 1
-                    item.sumPrice = item.createPrice * 1
-                    return item
+                this.roBack()
+              })
+            } else {
+              createBreakage(this.dataForm).then(() => {
+                this.$notify({
+                  title: '成功',
+                  message: '创建成功',
+                  type: 'success',
+                  duration: 2000
                 })
-                this.dataForm.inventoryOutInfos = this.dataForm.inventoryOutInfos && this.dataForm.inventoryOutInfos.length ? this.dataForm.inventoryOutInfos.concat(inventoryOutInfos) : this.dataForm.inventoryOutInfos = inventoryOutInfos
-            }
-            
-        },
-        submitForm(){
-            this.$refs["dataForm"].validate((valid) => {
-                if (valid) {
-                    if(this.dataForm.inventoryOutInfos.length == 0){
-                        this.$message.error('请选择商品/物料!')
-                        return
-                    }else{
-                        if(this.id){
-                            updateBreakage(this.dataForm).then(() => {
-                                this.$notify({
-                                    title: '成功',
-                                    message: '更新成功',
-                                    type: 'success',
-                                    duration: 2000
-                                })
-                                this.roBack();
-                            })
-                        }else{
-                            createBreakage(this.dataForm).then(() => {
-                                this.$notify({
-                                    title: "成功",
-                                    message: "创建成功",
-                                    type: "success",
-                                    duration: 2000,
-                                });
-                                this.roBack();
-                            })
-                        }
-                    }   
-                }
-            });
-        },
-        handleChange(row) {
-            if (row.createPrice && row.updateNumber) {
-                row.sumPrice = row.createPrice * row.updateNumber
+                this.roBack()
+              })
             }
-        },
-        roBack() {
-             this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
-                this.$router.push({ name: 'breakage' })
-            })
-        },
+          }
+        }
+      })
+    },
+    handleChange(row) {
+      if (row.createPrice && row.updateNumber) {
+        row.sumPrice = row.createPrice * row.updateNumber
+      }
+    },
+    roBack() {
+      this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
+        this.$router.push({ name: 'breakage' })
+      })
     }
+  }
 }
 </script>
 <style>

+ 98 - 98
src/views/stock/disassembly/disassembly.vue

@@ -155,9 +155,9 @@
 </template>
 
 <script>
-import { listDisassembly, deleteDisassembly, executeDisassembly, cancelDisassembly } from "@/api/disassembly";
-import { warehouseList } from "@/api/warehouse";
-import { allUserList } from "@/api/public";
+import { listDisassembly, deleteDisassembly, executeDisassembly, cancelDisassembly } from '@/api/disassembly'
+import { warehouseList } from '@/api/warehouse'
+import { allUserList } from '@/api/public'
 
 export default {
   data() {
@@ -168,14 +168,14 @@ export default {
         cancelMsg: ''
       },
       rules: {
-        cancelMsg: [{ required: true, message: "作废原因不能为空", trigger: "blur" }],
+        cancelMsg: [{ required: true, message: '作废原因不能为空', trigger: 'blur' }]
       },
       warehouseList: [],
       userSelsctList: [],
       typeList: [
-        { type: '0', name: "已拆卸" },
-        { type: '1', name: "待拆卸" },
-        { type: '2', name: "已作废" },
+        { type: '0', name: '已拆卸' },
+        { type: '1', name: '待拆卸' },
+        { type: '2', name: '已作废' }
       ],
       list: [],
       delarr: [],
@@ -190,49 +190,49 @@ export default {
         warehouseId: '',
         addHandlerId: '',
         isRunFinish: '',
-        assembleProductName: '',
-      },
+        assembleProductName: ''
+      }
     }
   },
   created() {
-    this.getStoreList();
-    this.getAllUserList(); 
-    this.getList();
+    this.getStoreList()
+    this.getAllUserList()
+    this.getList()
   },
   methods: {
     handleCancelShow(id) {
-      this.dialogFormVisible = true;
-      this.cancelId = id;
+      this.dialogFormVisible = true
+      this.cancelId = id
       this.$nextTick(() => {
-        this.dataForm.cancelMsg = '';
-        this.$refs["dataForm"].clearValidate();
-      });
+        this.dataForm.cancelMsg = ''
+        this.$refs['dataForm'].clearValidate()
+      })
     },
     handleCancel() {
-      this.$refs["dataForm"].validate((valid) => {
+      this.$refs['dataForm'].validate((valid) => {
         if (valid) {
           cancelDisassembly({ id: this.cancelId, cancelMsg: this.dataForm.cancelMsg }).then(() => {
-            this.dialogFormVisible = false;
+            this.dialogFormVisible = false
             this.$notify({
-              title: "成功",
-              message: "操作成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
+              title: '成功',
+              message: '操作成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
         }
       })
     },
     getStoreList() {
       warehouseList().then(response => {
-        this.warehouseList = response.data.data;
-      }).catch(() => { });
+        this.warehouseList = response.data.data
+      }).catch(() => { })
     },
     getAllUserList() {
       allUserList().then(response => {
-        this.userSelsctList = response.data.data;
-      }).catch(() => { });
+        this.userSelsctList = response.data.data
+      }).catch(() => { })
     },
     resetQuery() {
       this.listQuery = {
@@ -243,42 +243,42 @@ export default {
         warehouseId: '',
         addHandlerId: '',
         isRunFinish: '',
-        assembleProductName: '',
-      };
-      this.getList();
+        assembleProductName: ''
+      }
+      this.getList()
     },
     handleDownload() {
-      window.location.href = process.env.BASE_API + '/warehouse-disassembly/export';
+      window.location.href = process.env.BASE_API + '/warehouse-disassembly/export'
     },
     handleCreate() {
-      this.$router.push({ name: 'disassemblyAdd' });
+      this.$router.push({ name: 'disassemblyAdd' })
     },
     getList() {
-      this.listLoading = true;
+      this.listLoading = true
       listDisassembly(this.listQuery).then(response => {
-        this.list = response.data.data.items;
-        this.total = response.data.data.total;
-        this.listLoading = false;
+        this.list = response.data.data.items
+        this.total = response.data.data.total
+        this.listLoading = false
       }).catch(() => {
-        this.list = [];
-        this.total = 0;
-        this.listLoading = false;
-      });
+        this.list = []
+        this.total = 0
+        this.listLoading = false
+      })
     },
     handleFilter() {
-      this.listQuery.page = 1;
-      this.getList();
+      this.listQuery.page = 1
+      this.getList()
     },
     handleSizeChange(val) {
-      this.listQuery.limit = val;
-      this.getList();
+      this.listQuery.limit = val
+      this.getList()
     },
     handleCurrentChange(val) {
-      this.listQuery.page = val;
-      this.getList();
+      this.listQuery.page = val
+      this.getList()
     },
     handleUpdate(row) {
-      this.$router.push({ name: 'disassemblyEdit', params: { id: row.id } });
+      this.$router.push({ name: 'disassemblyEdit', params: { id: row.id }})
     },
     handleExecute(row) {
       this.$confirm('确认拆卸吗?', '提示', {
@@ -292,39 +292,39 @@ export default {
             message: '拆卸成功',
             type: 'success',
             duration: 2000
-          });
-          this.getList();
-        });
-      }).catch(() => { });
+          })
+          this.getList()
+        })
+      }).catch(() => { })
     },
     executeAll() {
-      const length = this.multipleSelection.length;
+      const length = this.multipleSelection.length
       if (length > 0) {
-        this.$confirm("确认拆卸吗?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
+        this.$confirm('确认拆卸吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }).then(() => {
           for (let i = 0; i < length; i++) {
-            this.delarr.push(this.multipleSelection[i].id);
+            this.delarr.push(this.multipleSelection[i].id)
           }
-          const ids = this.delarr.join(",");
+          const ids = this.delarr.join(',')
           executeDisassembly({ ids: ids }).then(() => {
             this.$notify({
-              title: "成功",
-              message: "拆卸成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
-        });
+              title: '成功',
+              message: '拆卸成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
+        })
       } else {
         this.$notify({
-          title: "提示",
-          message: "请选择要拆卸的信息!",
-          type: "warning",
-        });
+          title: '提示',
+          message: '请选择要拆卸的信息!',
+          type: 'warning'
+        })
       }
     },
     handleDelete(row) {
@@ -339,44 +339,44 @@ export default {
             message: '删除成功',
             type: 'success',
             duration: 2000
-          });
-          this.getList();
-        });
-      }).catch(() => { });
+          })
+          this.getList()
+        })
+      }).catch(() => { })
     },
     delAll() {
-      const length = this.multipleSelection.length;
+      const length = this.multipleSelection.length
       if (length > 0) {
-        this.$confirm("确认删除吗?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
+        this.$confirm('确认删除吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }).then(() => {
           for (let i = 0; i < length; i++) {
-            this.delarr.push(this.multipleSelection[i].id);
+            this.delarr.push(this.multipleSelection[i].id)
           }
-          const ids = this.delarr.join(",");
+          const ids = this.delarr.join(',')
           deleteDisassembly({ ids: ids }).then(() => {
             this.$notify({
-              title: "成功",
-              message: "删除成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
-        });
+              title: '成功',
+              message: '删除成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
+        })
       } else {
         this.$notify({
-          title: "提示",
-          message: "请选择要删除的信息!",
-          type: "warning",
-        });
+          title: '提示',
+          message: '请选择要删除的信息!',
+          type: 'warning'
+        })
       }
     },
     handleSelectionChange(val) {
-      this.multipleSelection = val;
-    },
+      this.multipleSelection = val
+    }
   }
 }
 </script>

+ 173 - 174
src/views/stock/disassembly/disassemblyAdd.vue

@@ -104,191 +104,190 @@
     </div>
 </template>
 <script>
-import { createDisassembly, updateDisassembly, readDisassembly } from "@/api/disassembly";
-import { listGoods } from "@/api/goodsManage";
-import { warehouseList } from "@/api/warehouse";
-import { allUserList } from "@/api/public";
-import waves from "@/directive/waves"; // 水波纹指令
+import { createDisassembly, updateDisassembly, readDisassembly } from '@/api/disassembly'
+import { listGoods } from '@/api/goodsManage'
+import { warehouseList } from '@/api/warehouse'
+import { allUserList } from '@/api/public'
+import waves from '@/directive/waves' // 水波纹指令
 
 export default {
-    directives: { waves },
-    data() {
-        return {
-            userSelsctList: [],
-            assembleProducList: [],
-            warehouseList: [],
-            id: '',
-            type: '',
-            /** 表单*/
-            dataForm: {
-                serialDate: '',
-                warehouseId: undefined,
-                updateUserName: undefined,
-                addHandlerId: undefined,
-                assembleProductId: undefined,
-                updateNumber: 1,
-                remarks: undefined,
-                inventoryEntryInfos: [],
-                inventoryOutInfos: []
-            },
-            rules: {
-                serialDate: [
-                    { required: true, message: '请选择拆卸时间', trigger: 'blur' }
-                ],
-                warehouseId: [
-                    { required: true, message: '请选择仓库', trigger: 'blur' }
-                ],
-                remarks: [
-                    { required: true, message: '请填写拆卸原因', trigger: 'blur' }
-                ],
-                addHandlerId: [
-                    { required: true, message: '请选择经手人', trigger: 'blur' }
-                ],
-                assembleProductId: [
-                    { required: true, message: '请选择拆卸商品', trigger: 'blur' }
-                ],
-                updateNumber: [
-                    { required: true, message: '请输入拆卸数量', trigger: 'blur' }
-                ],
-            },
+  directives: { waves },
+  data() {
+    return {
+      userSelsctList: [],
+      assembleProducList: [],
+      warehouseList: [],
+      id: '',
+      type: '',
+      /** 表单*/
+      dataForm: {
+        serialDate: '',
+        warehouseId: undefined,
+        updateUserName: undefined,
+        addHandlerId: undefined,
+        assembleProductId: undefined,
+        updateNumber: 1,
+        remarks: undefined,
+        inventoryEntryInfos: [],
+        inventoryOutInfos: []
+      },
+      rules: {
+        serialDate: [
+          { required: true, message: '请选择拆卸时间', trigger: 'blur' }
+        ],
+        warehouseId: [
+          { required: true, message: '请选择仓库', trigger: 'blur' }
+        ],
+        remarks: [
+          { required: true, message: '请填写拆卸原因', trigger: 'blur' }
+        ],
+        addHandlerId: [
+          { required: true, message: '请选择经手人', trigger: 'blur' }
+        ],
+        assembleProductId: [
+          { required: true, message: '请选择拆卸商品', trigger: 'blur' }
+        ],
+        updateNumber: [
+          { required: true, message: '请输入拆卸数量', trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  watch: {
+    $route: {
+      immediate: true,
+      handler(newVal) {
+        if (this.$route.name === 'disassemblyAdd') {
+          this.dataForm = {
+            serialDate: '',
+            warehouseId: undefined,
+            updateUserName: undefined,
+            addHandlerId: undefined,
+            assembleProductId: undefined,
+            updateNumber: 1,
+            remarks: undefined,
+            inventoryEntryInfos: [],
+            inventoryOutInfos: []
+          }
+        } else if (this.$route.name === 'disassemblyDetail') {
+          this.type = 'detail'
         }
-    },
-    watch: {
-        $route: {
-            immediate: true,
-            handler(newVal) {
-                if (this.$route.name === 'disassemblyAdd') {
-                    this.dataForm = {
-                        serialDate: '',
-                        warehouseId: undefined,
-                        updateUserName: undefined,
-                        addHandlerId: undefined,
-                        assembleProductId: undefined,
-                        updateNumber: 1,
-                        remarks: undefined,
-                        inventoryEntryInfos: [],
-                        inventoryOutInfos: []
-                    }
-                } else if (this.$route.name === 'disassemblyDetail') {
-                    this.type = 'detail'
-                }
-                if (this.$route.params.id) {
-                    this.id = this.$route.params.id
-                    this.getDataFormDetail()
-                }
-            }
+        if (this.$route.params.id) {
+          this.id = this.$route.params.id
+          this.getDataFormDetail()
         }
+      }
+    }
+  },
+  mounted() {
+    this.getAssembleProducList()
+    this.getWarehouseList()
+    this.getAllUserList()
+  },
+  methods: {
+    handleChangeWarehouse() {
+      this.getAssembleProducList()
+    },
+    /** 获取拆卸商品列表数据 */
+    getAssembleProducList() {
+      listGoods({ warehouseId: this.dataForm.warehouseId }).then(response => {
+        this.assembleProducList = response.data.data
+      }).catch(() => { })
+    },
+    /** 获取仓库列表数据 */
+    getWarehouseList() {
+      warehouseList().then(response => {
+        this.warehouseList = response.data.data
+      }).catch(() => { })
+    },
+    /** 获取人员列表数据 */
+    getAllUserList() {
+      allUserList().then(response => {
+        this.userSelsctList = response.data.data
+      }).catch(() => { })
     },
-    mounted() {
-        this.getAssembleProducList();
-        this.getWarehouseList();
-        this.getAllUserList();
+    /** 获取详情页面数据 */
+    getDataFormDetail() {
+      readDisassembly({ id: this.id }).then(response => {
+        const dataForm = response.data.data
+        dataForm.inventoryEntryInfos = dataForm.inventoryEntryInfos == null ? [] : dataForm.inventoryEntryInfos
+        dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
+        this.dataForm = dataForm
+      }).catch(() => { })
     },
-    methods: {
-        handleChangeWarehouse(){
-            this.getAssembleProducList();
-        },
-        /** 获取拆卸商品列表数据 */
-        getAssembleProducList() {
-            listGoods({warehouseId: this.dataForm.warehouseId}).then(response => {
-                this.assembleProducList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取仓库列表数据 */
-        getWarehouseList() {
-            warehouseList().then(response => {
-                this.warehouseList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取人员列表数据 */
-        getAllUserList() {
-            allUserList().then(response => {
-                this.userSelsctList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取详情页面数据 */
-        getDataFormDetail() {
-            readDisassembly({ id: this.id }).then(response => {
-                let dataForm = response.data.data;
-                dataForm.inventoryEntryInfos = dataForm.inventoryEntryInfos == null ? [] : dataForm.inventoryEntryInfos
-                dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
-                this.dataForm = dataForm;
-            }).catch(() => { })
-        },
-        // 选择商品
-        async handleSelectGoods(val) {
-            if (!this.dataForm.warehouseId) {
-                this.$message.error('请先选择仓库!')
-                return
+    // 选择商品
+    async handleSelectGoods(val) {
+      if (!this.dataForm.warehouseId) {
+        this.$message.error('请先选择仓库!')
+        return
+      } else {
+        const selectedIds = val == 'inventoryEntryInfos' ? this.dataForm.inventoryEntryInfos.map(item => item.id) : this.dataForm.inventoryOutInfos.map(item => item.id)
+        const Goods = await this.$EnPickerGoods({
+          // goodsApi: '/warehouse-entry/info/inventory',
+          selectedIds: selectedIds,
+          goodsApiParams: { warehouseId: this.dataForm.warehouseId, type: '1' }
+        })
+        if (!Goods.length) return
+        if (val == 'inventoryEntryInfos') {
+          const inventoryEntryInfos = Goods.map(item => {
+            item.updateNumber = 1
+            item.sumPrice = item.createPrice * 1
+            return item
+          })
+          this.dataForm.inventoryEntryInfos = this.dataForm.inventoryEntryInfos && this.dataForm.inventoryEntryInfos.length ? this.dataForm.inventoryEntryInfos.concat(inventoryEntryInfos) : this.dataForm.inventoryEntryInfos = inventoryEntryInfos
+        } else {
+          const inventoryOutInfos = Goods.map(item => {
+            item.updateNumber = 1
+            item.sumPrice = item.createPrice * 1
+            return item
+          })
+          this.dataForm.inventoryOutInfos = this.dataForm.inventoryOutInfos && this.dataForm.inventoryOutInfos.length ? this.dataForm.inventoryOutInfos.concat(inventoryOutInfos) : this.dataForm.inventoryOutInfos = inventoryOutInfos
+        }
+      }
+    },
+    submitForm() {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          if (this.dataForm.inventoryEntryInfos.length == 0) {
+            this.$message.error('请选择商品/物料!')
+            return
+          } else {
+            if (this.id) {
+              updateDisassembly(this.dataForm).then(() => {
+                this.$notify({
+                  title: '成功',
+                  message: '更新成功',
+                  type: 'success',
+                  duration: 2000
+                })
+                this.roBack()
+              })
             } else {
-                let selectedIds = val=='inventoryEntryInfos' ? this.dataForm.inventoryEntryInfos.map(item => item.id) : this.dataForm.inventoryOutInfos.map(item => item.id);
-                const Goods = await this.$EnPickerGoods({
-                    // goodsApi: '/warehouse-entry/info/inventory',
-                    selectedIds: selectedIds,
-                    goodsApiParams: { warehouseId: this.dataForm.warehouseId, type:'1' }
+              createDisassembly(this.dataForm).then(() => {
+                this.$notify({
+                  title: '成功',
+                  message: '创建成功',
+                  type: 'success',
+                  duration: 2000
                 })
-                if (!Goods.length) return
-                if(val=='inventoryEntryInfos'){
-                    const inventoryEntryInfos = Goods.map(item => {
-                        item.updateNumber = 1
-                        item.sumPrice = item.createPrice * 1
-                        return item
-                    })
-                    this.dataForm.inventoryEntryInfos = this.dataForm.inventoryEntryInfos && this.dataForm.inventoryEntryInfos.length ? this.dataForm.inventoryEntryInfos.concat(inventoryEntryInfos) : this.dataForm.inventoryEntryInfos = inventoryEntryInfos
-                }else{
-                    const inventoryOutInfos = Goods.map(item => {
-                        item.updateNumber = 1
-                        item.sumPrice = item.createPrice * 1
-                        return item
-                    })
-                    this.dataForm.inventoryOutInfos = this.dataForm.inventoryOutInfos && this.dataForm.inventoryOutInfos.length ? this.dataForm.inventoryOutInfos.concat(inventoryOutInfos) : this.dataForm.inventoryOutInfos = inventoryOutInfos
-                }
+                this.roBack()
+              })
             }
-
-        },
-        submitForm() {
-            this.$refs["dataForm"].validate((valid) => {
-                if (valid) {
-                    if (this.dataForm.inventoryEntryInfos.length == 0) {
-                        this.$message.error('请选择商品/物料!')
-                        return
-                    } else {
-                        if (this.id) {
-                            updateDisassembly(this.dataForm).then(() => {
-                                this.$notify({
-                                    title: '成功',
-                                    message: '更新成功',
-                                    type: 'success',
-                                    duration: 2000
-                                })
-                                this.roBack();
-                            })
-                        } else {
-                            createDisassembly(this.dataForm).then(() => {
-                                this.$notify({
-                                    title: "成功",
-                                    message: "创建成功",
-                                    type: "success",
-                                    duration: 2000,
-                                });
-                                this.roBack();
-                            })
-                        }
-                    }
-                }
-            });
-        },
-        handleChange(row) {
-            if (row.createPrice && row.updateNumber) {
-                row.sumPrice = row.createPrice * row.updateNumber
-            }
-        },
-        roBack() {
-            this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
-                this.$router.push({ name: 'disassembly' })
-            })
+          }
         }
+      })
+    },
+    handleChange(row) {
+      if (row.createPrice && row.updateNumber) {
+        row.sumPrice = row.createPrice * row.updateNumber
+      }
+    },
+    roBack() {
+      this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
+        this.$router.push({ name: 'disassembly' })
+      })
     }
+  }
 }
 </script>
 <style>

+ 98 - 98
src/views/stock/requisition/requisition.vue

@@ -167,9 +167,9 @@
 </template>
 
 <script>
-import { listRequisition, deleteRequisition, executeRequisition, cancelRequisition } from "@/api/requisition";
-import { warehouseList } from "@/api/warehouse";
-import { allUserList } from "@/api/public";
+import { listRequisition, deleteRequisition, executeRequisition, cancelRequisition } from '@/api/requisition'
+import { warehouseList } from '@/api/warehouse'
+import { allUserList } from '@/api/public'
 
 export default {
   data() {
@@ -180,14 +180,14 @@ export default {
         cancelMsg: ''
       },
       rules: {
-        cancelMsg: [{ required: true, message: "作废原因不能为空", trigger: "blur" }],
+        cancelMsg: [{ required: true, message: '作废原因不能为空', trigger: 'blur' }]
       },
       warehouseList: [],
       userSelsctList: [],
       typeList: [
-        { type: '0', name: "已发货" },
-        { type: '1', name: "待发货" },
-        { type: '2', name: "已作废" },
+        { type: '0', name: '已发货' },
+        { type: '1', name: '待发货' },
+        { type: '2', name: '已作废' }
       ],
       list: [],
       delarr: [],
@@ -203,49 +203,49 @@ export default {
         outHandlerId: '',
         warehouseTargetId: '',
         addHandlerId: '',
-        isDelivery: '',
-      },
+        isDelivery: ''
+      }
     }
   },
   created() {
-    this.getStoreList();
-    this.getAllUserList(); 
-    this.getList();
+    this.getStoreList()
+    this.getAllUserList()
+    this.getList()
   },
   methods: {
     handleCancelShow(id) {
-      this.dialogFormVisible = true;
-      this.cancelId = id;
+      this.dialogFormVisible = true
+      this.cancelId = id
       this.$nextTick(() => {
-        this.dataForm.cancelMsg = '';
-        this.$refs["dataForm"].clearValidate();
-      });
+        this.dataForm.cancelMsg = ''
+        this.$refs['dataForm'].clearValidate()
+      })
     },
     handleCancel() {
-      this.$refs["dataForm"].validate((valid) => {
+      this.$refs['dataForm'].validate((valid) => {
         if (valid) {
           cancelRequisition({ id: this.cancelId, cancelMsg: this.dataForm.cancelMsg }).then(() => {
-            this.dialogFormVisible = false;
+            this.dialogFormVisible = false
             this.$notify({
-              title: "成功",
-              message: "操作成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
+              title: '成功',
+              message: '操作成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
         }
       })
     },
     getStoreList() {
       warehouseList().then(response => {
-        this.warehouseList = response.data.data;
-      }).catch(() => { });
+        this.warehouseList = response.data.data
+      }).catch(() => { })
     },
     getAllUserList() {
       allUserList().then(response => {
-        this.userSelsctList = response.data.data;
-      }).catch(() => { });
+        this.userSelsctList = response.data.data
+      }).catch(() => { })
     },
     resetQuery() {
       this.listQuery = {
@@ -257,42 +257,42 @@ export default {
         outHandlerId: '',
         warehouseTargetId: '',
         addHandlerId: '',
-        isDelivery: '',
-      };
-      this.getList();
+        isDelivery: ''
+      }
+      this.getList()
     },
     handleDownload() {
-      window.location.href = process.env.BASE_API + '/warehouse-requisition/export';
+      window.location.href = process.env.BASE_API + '/warehouse-requisition/export'
     },
     handleCreate() {
-      this.$router.push({ name: 'requisitionAdd' });
+      this.$router.push({ name: 'requisitionAdd' })
     },
     getList() {
-      this.listLoading = true;
+      this.listLoading = true
       listRequisition(this.listQuery).then(response => {
-        this.list = response.data.data.items;
-        this.total = response.data.data.total;
-        this.listLoading = false;
+        this.list = response.data.data.items
+        this.total = response.data.data.total
+        this.listLoading = false
       }).catch(() => {
-        this.list = [];
-        this.total = 0;
-        this.listLoading = false;
-      });
+        this.list = []
+        this.total = 0
+        this.listLoading = false
+      })
     },
     handleFilter() {
-      this.listQuery.page = 1;
-      this.getList();
+      this.listQuery.page = 1
+      this.getList()
     },
     handleSizeChange(val) {
-      this.listQuery.limit = val;
-      this.getList();
+      this.listQuery.limit = val
+      this.getList()
     },
     handleCurrentChange(val) {
-      this.listQuery.page = val;
-      this.getList();
+      this.listQuery.page = val
+      this.getList()
     },
     handleUpdate(row) {
-      this.$router.push({ name: 'requisitionEdit', params: { id: row.id } });
+      this.$router.push({ name: 'requisitionEdit', params: { id: row.id }})
     },
     handleExecute(row) {
       this.$confirm('确认调拨吗?', '提示', {
@@ -306,39 +306,39 @@ export default {
             message: '调拨成功',
             type: 'success',
             duration: 2000
-          });
-          this.getList();
-        });
-      }).catch(() => { });
+          })
+          this.getList()
+        })
+      }).catch(() => { })
     },
     executeAll() {
-      const length = this.multipleSelection.length;
+      const length = this.multipleSelection.length
       if (length > 0) {
-        this.$confirm("确认调拨吗?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
+        this.$confirm('确认调拨吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }).then(() => {
           for (let i = 0; i < length; i++) {
-            this.delarr.push(this.multipleSelection[i].id);
+            this.delarr.push(this.multipleSelection[i].id)
           }
-          const ids = this.delarr.join(",");
+          const ids = this.delarr.join(',')
           executeRequisition({ ids: ids }).then(() => {
             this.$notify({
-              title: "成功",
-              message: "调拨成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
-        });
+              title: '成功',
+              message: '调拨成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
+        })
       } else {
         this.$notify({
-          title: "提示",
-          message: "请选择要调拨的信息!",
-          type: "warning",
-        });
+          title: '提示',
+          message: '请选择要调拨的信息!',
+          type: 'warning'
+        })
       }
     },
     handleDelete(row) {
@@ -353,44 +353,44 @@ export default {
             message: '删除成功',
             type: 'success',
             duration: 2000
-          });
-          this.getList();
-        });
-      }).catch(() => { });
+          })
+          this.getList()
+        })
+      }).catch(() => { })
     },
     delAll() {
-      const length = this.multipleSelection.length;
+      const length = this.multipleSelection.length
       if (length > 0) {
-        this.$confirm("确认删除吗?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
+        this.$confirm('确认删除吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }).then(() => {
           for (let i = 0; i < length; i++) {
-            this.delarr.push(this.multipleSelection[i].id);
+            this.delarr.push(this.multipleSelection[i].id)
           }
-          const ids = this.delarr.join(",");
+          const ids = this.delarr.join(',')
           deleteRequisition({ ids: ids }).then(() => {
             this.$notify({
-              title: "成功",
-              message: "删除成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
-        });
+              title: '成功',
+              message: '删除成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
+        })
       } else {
         this.$notify({
-          title: "提示",
-          message: "请选择要删除的信息!",
-          type: "warning",
-        });
+          title: '提示',
+          message: '请选择要删除的信息!',
+          type: 'warning'
+        })
       }
     },
     handleSelectionChange(val) {
-      this.multipleSelection = val;
-    },
+      this.multipleSelection = val
+    }
   }
 }
 </script>

+ 199 - 200
src/views/stock/requisition/requisitionAdd.vue

@@ -107,219 +107,218 @@
     </div>
 </template>
 <script>
-import { createRequisition, updateRequisition, readRequisition } from "@/api/requisition";
-import { supplierList } from "@/api/supplier";
-import { warehouseList } from "@/api/warehouse";
-import { allUserList } from "@/api/public";
-import waves from "@/directive/waves"; // 水波纹指令
+import { createRequisition, updateRequisition, readRequisition } from '@/api/requisition'
+import { supplierList } from '@/api/supplier'
+import { warehouseList } from '@/api/warehouse'
+import { allUserList } from '@/api/public'
+import waves from '@/directive/waves' // 水波纹指令
 
 export default {
-    directives: { waves },
-    data() {
-        return {
-            fileUrl:this.upLoadUrl,
-            userSelsctList:[],
-            supplierList: [],
-            warehouseList: [],
-            id: '',
-            type: '',
-            /** 表单*/
-            dataForm: {
-                serialDate:'',
-                warehouseId:undefined,
-                outHandlerId:undefined,
-                warehouseTargetId:undefined,
-                addHandlerId:undefined,
-                fileIds:undefined,
-                fileList: [],
-                remarks:undefined,
-                inventoryEntryInfos: []
-            },
-            rules: {
-                serialDate: [
-                    { required: true, message: '请选择调拨时间', trigger: 'blur' }
-                ],
-                warehouseId: [
-                    { required: true, message: '请选择调出仓库', trigger: 'blur' }
-                ],
-                outHandlerId: [
-                    { required: true, message: '请选择调出经手人', trigger: 'blur' }
-                ],
-                warehouseTargetId: [
-                    { required: true, message: '请选择调入仓库', trigger: 'blur' }
-                ],
-                addHandlerId: [
-                    { required: true, message: '请选择调入经手人', trigger: 'blur' }
-                ],
-                remarks: [
-                    { required: true, message: '请输入备注', trigger: 'blur' }
-                ],
-            },
+  directives: { waves },
+  data() {
+    return {
+      fileUrl: this.upLoadUrl,
+      userSelsctList: [],
+      supplierList: [],
+      warehouseList: [],
+      id: '',
+      type: '',
+      /** 表单*/
+      dataForm: {
+        serialDate: '',
+        warehouseId: undefined,
+        outHandlerId: undefined,
+        warehouseTargetId: undefined,
+        addHandlerId: undefined,
+        fileIds: undefined,
+        fileList: [],
+        remarks: undefined,
+        inventoryEntryInfos: []
+      },
+      rules: {
+        serialDate: [
+          { required: true, message: '请选择调拨时间', trigger: 'blur' }
+        ],
+        warehouseId: [
+          { required: true, message: '请选择调出仓库', trigger: 'blur' }
+        ],
+        outHandlerId: [
+          { required: true, message: '请选择调出经手人', trigger: 'blur' }
+        ],
+        warehouseTargetId: [
+          { required: true, message: '请选择调入仓库', trigger: 'blur' }
+        ],
+        addHandlerId: [
+          { required: true, message: '请选择调入经手人', trigger: 'blur' }
+        ],
+        remarks: [
+          { required: true, message: '请输入备注', trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  watch: {
+    $route: {
+      immediate: true,
+      handler(newVal) {
+        if (this.$route.name === 'requisitionAdd') {
+          this.dataForm = {
+            serialDate: '',
+            warehouseId: undefined,
+            outHandlerId: undefined,
+            warehouseTargetId: undefined,
+            addHandlerId: undefined,
+            fileIds: undefined,
+            fileList: [],
+            remarks: undefined,
+            inventoryEntryInfos: []
+          }
+        } else if (this.$route.name === 'requisitionDetail') {
+          this.type = 'detail'
         }
-    },
-    watch: {
-        $route: {
-            immediate: true,
-            handler(newVal) {
-                if (this.$route.name === 'requisitionAdd') {
-                    this.dataForm = {
-                        serialDate:'',
-                        warehouseId:undefined,
-                        outHandlerId:undefined,
-                        warehouseTargetId:undefined,
-                        addHandlerId:undefined,
-                        fileIds:undefined,
-                        fileList: [],
-                        remarks:undefined,
-                        inventoryEntryInfos: []
-                    }
-                } else if (this.$route.name === 'requisitionDetail') {
-                    this.type = 'detail'
-                }
-                if (this.$route.params.id) {
-                    this.id = this.$route.params.id
-                    this.getDataFormDetail()
-                }
-            }
+        if (this.$route.params.id) {
+          this.id = this.$route.params.id
+          this.getDataFormDetail()
         }
+      }
+    }
+  },
+  mounted() {
+    this.getSupplierList()
+    this.getStoreList()
+    this.getAllUserList()
+  },
+  methods: {
+    /** 获取供应商列表数据 */
+    getSupplierList() {
+      supplierList().then(response => {
+        this.supplierList = response.data.data
+      }).catch(() => { })
+    },
+    /** 获取仓库列表数据 */
+    getStoreList() {
+      warehouseList().then(response => {
+        this.warehouseList = response.data.data
+      }).catch(() => {})
     },
-    mounted() {
-        this.getSupplierList();
-        this.getStoreList(); 
-        this.getAllUserList(); 
+    /** 获取人员列表数据 */
+    getAllUserList() {
+      allUserList().then(response => {
+        this.userSelsctList = response.data.data
+      }).catch(() => { })
     },
-    methods: {
-        /** 获取供应商列表数据 */
-        getSupplierList(){
-            supplierList().then(response => {
-                this.supplierList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取仓库列表数据 */
-        getStoreList() {
-            warehouseList().then(response => {
-                this.warehouseList = response.data.data;
-            }).catch(() => {});
-        },
-        /** 获取人员列表数据 */
-        getAllUserList() {
-            allUserList().then(response => {
-                this.userSelsctList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取详情页面数据 */
-        getDataFormDetail() {
-            readRequisition({ id: this.id }).then(response => {
-                let dataForm = response.data.data;
-                dataForm.inventoryEntryInfos = dataForm.inventoryEntryInfos == null ? [] : dataForm.inventoryEntryInfos
-                dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
-                this.dataForm = dataForm;
-                this.dataForm.fileList = dataForm.files == null ? [] : dataForm.files;
-            }).catch(() => {})
-        },
-         // 选择商品
-        async handleSelectGoods() {
-            if (!this.dataForm.warehouseId) {
-                this.$message.error('请先选择调出仓库!')
-                return
-            }else{
-                console.log(this.dataForm.inventoryEntryInfos)
-                let selectedIds = this.dataForm.inventoryEntryInfos.map(item => item.id);
-                const Goods = await this.$EnPickerGoods({
-                    // goodsApi: '/warehouse-entry/info/inventory',
-                    selectedIds: selectedIds,
-                    goodsApiParams: { warehouseId: this.dataForm.warehouseId, type:'2' }
+    /** 获取详情页面数据 */
+    getDataFormDetail() {
+      readRequisition({ id: this.id }).then(response => {
+        const dataForm = response.data.data
+        dataForm.inventoryEntryInfos = dataForm.inventoryEntryInfos == null ? [] : dataForm.inventoryEntryInfos
+        dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
+        this.dataForm = dataForm
+        this.dataForm.fileList = dataForm.files == null ? [] : dataForm.files
+      }).catch(() => {})
+    },
+    // 选择商品
+    async handleSelectGoods() {
+      if (!this.dataForm.warehouseId) {
+        this.$message.error('请先选择调出仓库!')
+        return
+      } else {
+        console.log(this.dataForm.inventoryEntryInfos)
+        const selectedIds = this.dataForm.inventoryEntryInfos.map(item => item.id)
+        const Goods = await this.$EnPickerGoods({
+          // goodsApi: '/warehouse-entry/info/inventory',
+          selectedIds: selectedIds,
+          goodsApiParams: { warehouseId: this.dataForm.warehouseId, type: '2' }
+        })
+        if (!Goods.length) return
+        const inventoryEntryInfos = Goods.map(item => {
+          item.updateNumber = 1
+          item.sumPrice = item.createPrice * 1
+          return item
+        })
+        this.dataForm.inventoryEntryInfos = this.dataForm.inventoryEntryInfos && this.dataForm.inventoryEntryInfos.length ? this.dataForm.inventoryEntryInfos.concat(inventoryEntryInfos) : this.dataForm.inventoryEntryInfos = inventoryEntryInfos
+      }
+    },
+    submitForm() {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          if (this.dataForm.inventoryEntryInfos.length == 0) {
+            this.$message.error('请选择商品/物料!')
+            return
+          } else {
+            if (this.id) {
+              updateRequisition(this.dataForm).then(() => {
+                this.$notify({
+                  title: '成功',
+                  message: '更新成功',
+                  type: 'success',
+                  duration: 2000
                 })
-                if (!Goods.length) return
-                const inventoryEntryInfos = Goods.map(item => {
-                    item.updateNumber = 1
-                    item.sumPrice = item.createPrice * 1
-                    return item
+                this.roBack()
+              })
+            } else {
+              createRequisition(this.dataForm).then(() => {
+                this.$notify({
+                  title: '成功',
+                  message: '创建成功',
+                  type: 'success',
+                  duration: 2000
                 })
-                this.dataForm.inventoryEntryInfos = this.dataForm.inventoryEntryInfos && this.dataForm.inventoryEntryInfos.length ? this.dataForm.inventoryEntryInfos.concat(inventoryEntryInfos) : this.dataForm.inventoryEntryInfos = inventoryEntryInfos
-            }
-            
-        },
-        submitForm(){
-            this.$refs["dataForm"].validate((valid) => {
-                if (valid) {
-                    if(this.dataForm.inventoryEntryInfos.length == 0){
-                        this.$message.error('请选择商品/物料!')
-                        return
-                    }else{
-                        if(this.id){
-                            updateRequisition(this.dataForm).then(() => {
-                                this.$notify({
-                                    title: '成功',
-                                    message: '更新成功',
-                                    type: 'success',
-                                    duration: 2000
-                                })
-                                this.roBack();
-                            })
-                        }else{
-                            createRequisition(this.dataForm).then(() => {
-                                this.$notify({
-                                    title: "成功",
-                                    message: "创建成功",
-                                    type: "success",
-                                    duration: 2000,
-                                });
-                                this.roBack();
-                            })
-                        }
-                    }   
-                }
-            });
-        },
-        handleChange(row) {
-            if (row.createPrice && row.updateNumber) {
-                row.sumPrice = row.createPrice * row.updateNumber
+                this.roBack()
+              })
             }
-        },
-        roBack() {
-            this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
-                this.$router.push({ name: 'requisition' })
-            })
-        },
-        handleRemove(file, fileList) {
-        console.log(file, fileList);
-        let fileIds = [];
-        for (let i in fileList) {
-            let id = fileList[i].response.data.id;
-            fileIds.push(id);
+          }
         }
-        this.dataForm.fileIds = fileIds.join(",");
-        },
-        beforeUploadFile(file) {
-        console.log(file);
-        const size = file.size / 1024 / 1024;
-        console.log(size);
-        if (size > 10) {
-            this.$message.error("文件大小不能超过10MB!");
-            return false;
-        }
-        },
-        handleFileSuccess(res, file, fileList) {
-        console.log(file, fileList);
-        console.log("------", "==========");
-        console.log("res = ", res);
+      })
+    },
+    handleChange(row) {
+      if (row.createPrice && row.updateNumber) {
+        row.sumPrice = row.createPrice * row.updateNumber
+      }
+    },
+    roBack() {
+      this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
+        this.$router.push({ name: 'requisition' })
+      })
+    },
+    handleRemove(file, fileList) {
+      console.log(file, fileList)
+      const fileIds = []
+      for (const i in fileList) {
+        const id = fileList[i].response.data.id
+        fileIds.push(id)
+      }
+      this.dataForm.fileIds = fileIds.join(',')
+    },
+    beforeUploadFile(file) {
+      console.log(file)
+      const size = file.size / 1024 / 1024
+      console.log(size)
+      if (size > 10) {
+        this.$message.error('文件大小不能超过10MB!')
+        return false
+      }
+    },
+    handleFileSuccess(res, file, fileList) {
+      console.log(file, fileList)
+      console.log('------', '==========')
+      console.log('res = ', res)
 
-        let fileIds = [];
-        for (let i in fileList) {
-            let response = fileList[i].response;
-            if (response.errno && response.errno != "0") {
-            this.$message.error("该文件上传失败,已被移除,请重新上传!");
-            // 上传失败移除该 file 对象
-            fileList.splice(i, 1);
-            } else {
-            let id = fileList[i].response.data.id;
-            fileIds.push(id);
-            }
+      const fileIds = []
+      for (const i in fileList) {
+        const response = fileList[i].response
+        if (response.errno && response.errno != '0') {
+          this.$message.error('该文件上传失败,已被移除,请重新上传!')
+          // 上传失败移除该 file 对象
+          fileList.splice(i, 1)
+        } else {
+          const id = fileList[i].response.data.id
+          fileIds.push(id)
         }
-        this.dataForm.fileIds = fileIds.join(",");
-        },
+      }
+      this.dataForm.fileIds = fileIds.join(',')
     }
+  }
 }
 </script>
 <style>

+ 106 - 106
src/views/stock/retrieval/retrieval.vue

@@ -153,12 +153,12 @@
 </template>
 
 <script>
-import { listRetrieval, deleteRetrieval, executeRetrieval, cancelRetrieval } from "@/api/retrieval";
-import { storeList } from "@/api/store";
-import { warehouseList } from "@/api/warehouse";
-import { listDept } from "@/api/dept";
-import Treeselect from "@riophae/vue-treeselect";
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import { listRetrieval, deleteRetrieval, executeRetrieval, cancelRetrieval } from '@/api/retrieval'
+import { storeList } from '@/api/store'
+import { warehouseList } from '@/api/warehouse'
+import { listDept } from '@/api/dept'
+import Treeselect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
 
 export default {
   components: { Treeselect },
@@ -170,15 +170,15 @@ export default {
         cancelMsg: ''
       },
       rules: {
-        cancelMsg: [{ required: true, message: "作废原因不能为空", trigger: "blur" }],
+        cancelMsg: [{ required: true, message: '作废原因不能为空', trigger: 'blur' }]
       },
       deptOptions: [],
       storeList: [],
       warehouseList: [],
       typeList: [
-        { type: '0', name: "已发货" },
-        { type: '1', name: "待发货" },
-        { type: '2', name: "已作废" },
+        { type: '0', name: '已发货' },
+        { type: '1', name: '待发货' },
+        { type: '2', name: '已作废' }
       ],
       list: [],
       delarr: [],
@@ -193,65 +193,65 @@ export default {
         requireDepartmentId: undefined,
         storeId: '',
         warehouseId: '',
-        isRunFinish: '',
-      },
+        isRunFinish: ''
+      }
     }
   },
   created() {
-    this.getStoreList();
-    this.getWarehouseList();
-    this.getList();
-    this.getListDept();
+    this.getStoreList()
+    this.getWarehouseList()
+    this.getList()
+    this.getListDept()
   },
   methods: {
     handleCancelShow(id) {
-      this.dialogFormVisible = true;
-      this.cancelId = id;
+      this.dialogFormVisible = true
+      this.cancelId = id
       this.$nextTick(() => {
-        this.dataForm.cancelMsg = '';
-        this.$refs["dataForm"].clearValidate();
-      });
+        this.dataForm.cancelMsg = ''
+        this.$refs['dataForm'].clearValidate()
+      })
     },
     handleCancel() {
-      this.$refs["dataForm"].validate((valid) => {
+      this.$refs['dataForm'].validate((valid) => {
         if (valid) {
           cancelRetrieval({ id: this.cancelId, cancelMsg: this.dataForm.cancelMsg }).then(() => {
-            this.dialogFormVisible = false;
+            this.dialogFormVisible = false
             this.$notify({
-              title: "成功",
-              message: "操作成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
+              title: '成功',
+              message: '操作成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
         }
       })
     },
     getListDept() {
       listDept().then(response => {
-        this.deptOptions = this.handleTree(response.data.data, "deptId");
-      });
+        this.deptOptions = this.handleTree(response.data.data, 'deptId')
+      })
     },
     normalizer(node) {
       if (node.children && !node.children.length) {
-        delete node.children;
+        delete node.children
       }
       return {
         id: node.deptId,
         label: node.deptName,
         children: node.children
-      };
+      }
     },
     getStoreList() {
       storeList().then(response => {
-        this.storeList = response.data.data;
-      }).catch(() => { });
+        this.storeList = response.data.data
+      }).catch(() => { })
     },
     getWarehouseList() {
       warehouseList().then(response => {
-        this.warehouseList = response.data.data;
-      }).catch(() => { });
+        this.warehouseList = response.data.data
+      }).catch(() => { })
     },
     resetQuery() {
       this.listQuery = {
@@ -262,42 +262,42 @@ export default {
         requireDepartmentId: undefined,
         storeId: '',
         warehouseId: '',
-        isRunFinish: '',
-      };
-      this.getList();
+        isRunFinish: ''
+      }
+      this.getList()
     },
     handleDownload() {
-      window.location.href = process.env.BASE_API + '/warehouse-out/export';
+      window.location.href = process.env.BASE_API + '/warehouse-out/export'
     },
     handleCreate() {
-      this.$router.push({ name: 'retrievalAdd' });
+      this.$router.push({ name: 'retrievalAdd' })
     },
     getList() {
-      this.listLoading = true;
+      this.listLoading = true
       listRetrieval(this.listQuery).then(response => {
-        this.list = response.data.data.items;
-        this.total = response.data.data.total;
-        this.listLoading = false;
+        this.list = response.data.data.items
+        this.total = response.data.data.total
+        this.listLoading = false
       }).catch(() => {
-        this.list = [];
-        this.total = 0;
-        this.listLoading = false;
-      });
+        this.list = []
+        this.total = 0
+        this.listLoading = false
+      })
     },
     handleFilter() {
-      this.listQuery.page = 1;
-      this.getList();
+      this.listQuery.page = 1
+      this.getList()
     },
     handleSizeChange(val) {
-      this.listQuery.limit = val;
-      this.getList();
+      this.listQuery.limit = val
+      this.getList()
     },
     handleCurrentChange(val) {
-      this.listQuery.page = val;
-      this.getList();
+      this.listQuery.page = val
+      this.getList()
     },
     handleUpdate(row) {
-      this.$router.push({ name: 'retrievalEdit', params: { id: row.id } });
+      this.$router.push({ name: 'retrievalEdit', params: { id: row.id }})
     },
     handleExecute(row) {
       this.$confirm('确认发货吗?', '提示', {
@@ -311,39 +311,39 @@ export default {
             message: '发货成功',
             type: 'success',
             duration: 2000
-          });
-          this.getList();
-        });
-      }).catch(() => { });
+          })
+          this.getList()
+        })
+      }).catch(() => { })
     },
     executeAll() {
-      const length = this.multipleSelection.length;
+      const length = this.multipleSelection.length
       if (length > 0) {
-        this.$confirm("确认发货吗?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
+        this.$confirm('确认发货吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }).then(() => {
           for (let i = 0; i < length; i++) {
-            this.delarr.push(this.multipleSelection[i].id);
+            this.delarr.push(this.multipleSelection[i].id)
           }
-          const ids = this.delarr.join(",");
+          const ids = this.delarr.join(',')
           executeRetrieval({ ids: ids }).then(() => {
             this.$notify({
-              title: "成功",
-              message: "发货成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
-        });
+              title: '成功',
+              message: '发货成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
+        })
       } else {
         this.$notify({
-          title: "提示",
-          message: "请选择要发货的信息!",
-          type: "warning",
-        });
+          title: '提示',
+          message: '请选择要发货的信息!',
+          type: 'warning'
+        })
       }
     },
     handleDelete(row) {
@@ -358,44 +358,44 @@ export default {
             message: '删除成功',
             type: 'success',
             duration: 2000
-          });
-          this.getList();
-        });
-      }).catch(() => { });
+          })
+          this.getList()
+        })
+      }).catch(() => { })
     },
     delAll() {
-      const length = this.multipleSelection.length;
+      const length = this.multipleSelection.length
       if (length > 0) {
-        this.$confirm("确认删除吗?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
+        this.$confirm('确认删除吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }).then(() => {
           for (let i = 0; i < length; i++) {
-            this.delarr.push(this.multipleSelection[i].id);
+            this.delarr.push(this.multipleSelection[i].id)
           }
-          const ids = this.delarr.join(",");
+          const ids = this.delarr.join(',')
           deleteRetrieval({ ids: ids }).then(() => {
             this.$notify({
-              title: "成功",
-              message: "删除成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
-        });
+              title: '成功',
+              message: '删除成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
+        })
       } else {
         this.$notify({
-          title: "提示",
-          message: "请选择要删除的信息!",
-          type: "warning",
-        });
+          title: '提示',
+          message: '请选择要删除的信息!',
+          type: 'warning'
+        })
       }
     },
     handleSelectionChange(val) {
-      this.multipleSelection = val;
-    },
+      this.multipleSelection = val
+    }
   }
 }
 </script>

+ 180 - 181
src/views/stock/retrieval/retrievalAdd.vue

@@ -109,197 +109,196 @@
     </div>
 </template>
 <script>
-import { createRetrieval, updateRetrieval, readRetrieval } from "@/api/retrieval";
-import { storeList } from "@/api/store";
-import { warehouseList } from "@/api/warehouse";
-import { listDept } from "@/api/dept";
-import { allUserList } from "@/api/public";
-import Treeselect from "@riophae/vue-treeselect";
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
-import waves from "@/directive/waves"; // 水波纹指令
+import { createRetrieval, updateRetrieval, readRetrieval } from '@/api/retrieval'
+import { storeList } from '@/api/store'
+import { warehouseList } from '@/api/warehouse'
+import { listDept } from '@/api/dept'
+import { allUserList } from '@/api/public'
+import Treeselect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import waves from '@/directive/waves' // 水波纹指令
 
 export default {
-    components: { Treeselect },
-    directives: { waves },
-    data() {
-        return {
-            recipientsList:[],
-            // 树选项
-            deptOptions: [],
-            recipientsList:[],
-            storeList: [],
-            warehouseList: [],
-            id: '',
-            type: '',
-            /** 表单*/
-            dataForm: {
-                serialDate:'',
-                requireDepartmentId:undefined,
-                storeId:undefined,
-                warehouseId:undefined,
-                outHandlerId:undefined,
-                remarks:undefined,
-                inventoryOutInfos: []
-            },
-            rules: {
-                serialDate: [
-                    { required: true, message: '请选择出库时间', trigger: 'blur' }
-                ],
-                requireDepartmentId: [
-                    { required: true, message: '请选择出库部门', trigger: 'blur' }
-                ],
-                warehouseId: [
-                    { required: true, message: '请选择仓库', trigger: 'blur' }
-                ],
-                outHandlerId: [
-                    { required: true, message: '请选择经手人', trigger: 'blur' }
-                ],
-                remarks: [
-                    { required: true, message: '请输入备注', trigger: 'blur' }
-                ],
-            },
+  components: { Treeselect },
+  directives: { waves },
+  data() {
+    return {
+      recipientsList: [],
+      // 树选项
+      deptOptions: [],
+      recipientsList: [],
+      storeList: [],
+      warehouseList: [],
+      id: '',
+      type: '',
+      /** 表单*/
+      dataForm: {
+        serialDate: '',
+        requireDepartmentId: undefined,
+        storeId: undefined,
+        warehouseId: undefined,
+        outHandlerId: undefined,
+        remarks: undefined,
+        inventoryOutInfos: []
+      },
+      rules: {
+        serialDate: [
+          { required: true, message: '请选择出库时间', trigger: 'blur' }
+        ],
+        requireDepartmentId: [
+          { required: true, message: '请选择出库部门', trigger: 'blur' }
+        ],
+        warehouseId: [
+          { required: true, message: '请选择仓库', trigger: 'blur' }
+        ],
+        outHandlerId: [
+          { required: true, message: '请选择经手人', trigger: 'blur' }
+        ],
+        remarks: [
+          { required: true, message: '请输入备注', trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  watch: {
+    $route: {
+      immediate: true,
+      handler(newVal) {
+        if (this.$route.name === 'retrievalAdd') {
+          this.dataForm = {
+            serialDate: undefined,
+            storeId: undefined,
+            warehouseId: undefined,
+            outHandlerId: undefined,
+            fileIds: undefined,
+            fileList: [],
+            inventoryOutInfos: []
+          }
+        } else if (this.$route.name === 'retrievalDetail') {
+          this.type = 'detail'
         }
-    },
-    watch: {
-        $route: {
-            immediate: true,
-            handler(newVal) {
-                if (this.$route.name === 'retrievalAdd') {
-                    this.dataForm = {
-                        serialDate:undefined,
-                        storeId:undefined,
-                        warehouseId:undefined,
-                        outHandlerId:undefined,
-                        fileIds:undefined,
-                        fileList: [],
-                        inventoryOutInfos: []
-                    }
-                } else if (this.$route.name === 'retrievalDetail') {
-                    this.type = 'detail'
-                }
-                if (this.$route.params.id) {
-                    this.id = this.$route.params.id
-                    this.getDataFormDetail()
-                }
-            }
+        if (this.$route.params.id) {
+          this.id = this.$route.params.id
+          this.getDataFormDetail()
         }
+      }
+    }
+  },
+  mounted() {
+    this.getStoreList()
+    this.getWarehouseList()
+    this.getListDept()
+    this.getAllUserList()
+  },
+  methods: {
+    getListDept() {
+      listDept().then(response => {
+        this.deptOptions = this.handleTree(response.data.data, 'deptId')
+      })
     },
-    mounted() {
-        this.getStoreList();
-        this.getWarehouseList(); 
-        this.getListDept();
-        this.getAllUserList(); 
+    /** 转换部门数据结构 */
+    normalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children
+      }
+      return {
+        id: node.deptId,
+        label: node.deptName,
+        children: node.children
+      }
     },
-    methods: {
-        getListDept() {
-            listDept().then(response => {
-                this.deptOptions = this.handleTree(response.data.data, "deptId");
-            });
-        },
-        /** 转换部门数据结构 */
-        normalizer(node) {
-            if (node.children && !node.children.length) {
-                delete node.children;
-            }
-            return {
-                id: node.deptId,
-                label: node.deptName,
-                children: node.children
-            };
-        },
-        /** 获取门店列表数据 */
-        getStoreList(){
-            storeList().then(response => {
-                this.storeList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取仓库列表数据 */
-        getWarehouseList() {
-            warehouseList().then(response => {
-                this.warehouseList = response.data.data;
-            }).catch(() => {});
-        },
-        /** 获取人员列表数据 */
-        getAllUserList() {
-            allUserList().then(response => {
-                this.recipientsList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取详情页面数据 */
-        getDataFormDetail() {
-            readRetrieval({ id: this.id }).then(response => {
-                let dataForm = response.data.data;
-                dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
-                dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
-                this.dataForm = dataForm;
-            }).catch(() => {})
-        },
-         // 选择商品
-        async handleSelectGoods() {
-            if (!this.dataForm.warehouseId) {
-                this.$message.error('请先选择仓库!')
-                return
-            }else{
-                console.log(this.dataForm.inventoryOutInfos)
-                let selectedIds = this.dataForm.inventoryOutInfos.map(item => item.id);
-                const Goods = await this.$EnPickerGoods({
-                    // goodsApi: '/warehouse-entry/info/inventory',
-                    selectedIds: selectedIds,
-                    goodsApiParams: { warehouseId: this.dataForm.warehouseId, type:'2' }
+    /** 获取门店列表数据 */
+    getStoreList() {
+      storeList().then(response => {
+        this.storeList = response.data.data
+      }).catch(() => { })
+    },
+    /** 获取仓库列表数据 */
+    getWarehouseList() {
+      warehouseList().then(response => {
+        this.warehouseList = response.data.data
+      }).catch(() => {})
+    },
+    /** 获取人员列表数据 */
+    getAllUserList() {
+      allUserList().then(response => {
+        this.recipientsList = response.data.data
+      }).catch(() => { })
+    },
+    /** 获取详情页面数据 */
+    getDataFormDetail() {
+      readRetrieval({ id: this.id }).then(response => {
+        const dataForm = response.data.data
+        dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
+        dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
+        this.dataForm = dataForm
+      }).catch(() => {})
+    },
+    // 选择商品
+    async handleSelectGoods() {
+      if (!this.dataForm.warehouseId) {
+        this.$message.error('请先选择仓库!')
+        return
+      } else {
+        console.log(this.dataForm.inventoryOutInfos)
+        const selectedIds = this.dataForm.inventoryOutInfos.map(item => item.id)
+        const Goods = await this.$EnPickerGoods({
+          // goodsApi: '/warehouse-entry/info/inventory',
+          selectedIds: selectedIds,
+          goodsApiParams: { warehouseId: this.dataForm.warehouseId, type: '2' }
+        })
+        if (!Goods.length) return
+        const inventoryOutInfos = Goods.map(item => {
+          item.updateNumber = 1
+          item.sumPrice = item.createPrice * 1
+          return item
+        })
+        this.dataForm.inventoryOutInfos = this.dataForm.inventoryOutInfos && this.dataForm.inventoryOutInfos.length ? this.dataForm.inventoryOutInfos.concat(inventoryOutInfos) : this.dataForm.inventoryOutInfos = inventoryOutInfos
+      }
+    },
+    submitForm() {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          if (this.dataForm.inventoryOutInfos.length == 0) {
+            this.$message.error('请选择商品/物料!')
+            return
+          } else {
+            if (this.id) {
+              updateRetrieval(this.dataForm).then(() => {
+                this.$notify({
+                  title: '成功',
+                  message: '更新成功',
+                  type: 'success',
+                  duration: 2000
                 })
-                if (!Goods.length) return
-                const inventoryOutInfos = Goods.map(item => {
-                    item.updateNumber = 1
-                    item.sumPrice = item.createPrice * 1
-                    return item
+                this.roBack()
+              })
+            } else {
+              createRetrieval(this.dataForm).then(() => {
+                this.$notify({
+                  title: '成功',
+                  message: '创建成功',
+                  type: 'success',
+                  duration: 2000
                 })
-                this.dataForm.inventoryOutInfos = this.dataForm.inventoryOutInfos && this.dataForm.inventoryOutInfos.length ? this.dataForm.inventoryOutInfos.concat(inventoryOutInfos) : this.dataForm.inventoryOutInfos = inventoryOutInfos
-            }
-            
-        },
-        submitForm(){
-            this.$refs["dataForm"].validate((valid) => {
-                if (valid) {
-                    if(this.dataForm.inventoryOutInfos.length == 0){
-                        this.$message.error('请选择商品/物料!')
-                        return
-                    }else{
-                        if(this.id){
-                            updateRetrieval(this.dataForm).then(() => {
-                                this.$notify({
-                                    title: '成功',
-                                    message: '更新成功',
-                                    type: 'success',
-                                    duration: 2000
-                                })
-                                this.roBack();
-                            })
-                        }else{
-                            createRetrieval(this.dataForm).then(() => {
-                                this.$notify({
-                                    title: "成功",
-                                    message: "创建成功",
-                                    type: "success",
-                                    duration: 2000,
-                                });
-                                this.roBack();
-                            })
-                        }
-                    }   
-                }
-            });
-        },
-        handleChange(row) {
-            if (row.createPrice && row.updateNumber) {
-                row.sumPrice = row.createPrice * row.updateNumber
+                this.roBack()
+              })
             }
-        },
-        roBack() {
-            this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
-                this.$router.push({ name: 'retrieval' })
-            })
-        },
+          }
+        }
+      })
+    },
+    handleChange(row) {
+      if (row.createPrice && row.updateNumber) {
+        row.sumPrice = row.createPrice * row.updateNumber
+      }
+    },
+    roBack() {
+      this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
+        this.$router.push({ name: 'retrieval' })
+      })
     }
+  }
 }
 </script>
 <style>

+ 80 - 80
src/views/stock/stockCount/stockCount.vue

@@ -109,9 +109,9 @@
 </template>
 
 <script>
-import { listStockCount, deleteStockCount, executeStockCount } from "@/api/stockCount";
-import { warehouseList } from "@/api/warehouse";
-import { allUserList } from "@/api/public";
+import { listStockCount, deleteStockCount, executeStockCount } from '@/api/stockCount'
+import { warehouseList } from '@/api/warehouse'
+import { allUserList } from '@/api/public'
 
 export default {
   data() {
@@ -129,25 +129,25 @@ export default {
         startDate: '',
         endDate: '',
         warehouseId: '',
-        addHandlerId: '',
-      },
+        addHandlerId: ''
+      }
     }
   },
   created() {
-    this.getStoreList();
-    this.getAllUserList(); 
-    this.getList();
+    this.getStoreList()
+    this.getAllUserList()
+    this.getList()
   },
   methods: {
     getStoreList() {
       warehouseList().then(response => {
-        this.warehouseList = response.data.data;
-      }).catch(() => { });
+        this.warehouseList = response.data.data
+      }).catch(() => { })
     },
     getAllUserList() {
       allUserList().then(response => {
-        this.userSelsctList = response.data.data;
-      }).catch(() => { });
+        this.userSelsctList = response.data.data
+      }).catch(() => { })
     },
     resetQuery() {
       this.listQuery = {
@@ -156,42 +156,42 @@ export default {
         startDate: '',
         endDate: '',
         warehouseId: '',
-        addHandlerId: '',
-      };
-      this.getList();
+        addHandlerId: ''
+      }
+      this.getList()
     },
     handleDownload() {
-      window.location.href = process.env.BASE_API + '/warehouse-stockCount/export';
+      window.location.href = process.env.BASE_API + '/warehouse-stockCount/export'
     },
     handleCreate() {
-      this.$router.push({ name: 'stockCountAdd' });
+      this.$router.push({ name: 'stockCountAdd' })
     },
     getList() {
-      this.listLoading = true;
+      this.listLoading = true
       listStockCount(this.listQuery).then(response => {
-        this.list = response.data.data.items;
-        this.total = response.data.data.total;
-        this.listLoading = false;
+        this.list = response.data.data.items
+        this.total = response.data.data.total
+        this.listLoading = false
       }).catch(() => {
-        this.list = [];
-        this.total = 0;
-        this.listLoading = false;
-      });
+        this.list = []
+        this.total = 0
+        this.listLoading = false
+      })
     },
     handleFilter() {
-      this.listQuery.page = 1;
-      this.getList();
+      this.listQuery.page = 1
+      this.getList()
     },
     handleSizeChange(val) {
-      this.listQuery.limit = val;
-      this.getList();
+      this.listQuery.limit = val
+      this.getList()
     },
     handleCurrentChange(val) {
-      this.listQuery.page = val;
-      this.getList();
+      this.listQuery.page = val
+      this.getList()
     },
     handleUpdate(row) {
-      this.$router.push({ name: 'stockCountEdit', params: { id: row.id } });
+      this.$router.push({ name: 'stockCountEdit', params: { id: row.id }})
     },
     handleExecute(row) {
       this.$confirm('确认盘点吗?', '提示', {
@@ -205,39 +205,39 @@ export default {
             message: '盘点成功',
             type: 'success',
             duration: 2000
-          });
-          this.getList();
-        });
-      }).catch(() => { });
+          })
+          this.getList()
+        })
+      }).catch(() => { })
     },
     executeAll() {
-      const length = this.multipleSelection.length;
+      const length = this.multipleSelection.length
       if (length > 0) {
-        this.$confirm("确认盘点吗?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
+        this.$confirm('确认盘点吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }).then(() => {
           for (let i = 0; i < length; i++) {
-            this.delarr.push(this.multipleSelection[i].id);
+            this.delarr.push(this.multipleSelection[i].id)
           }
-          const ids = this.delarr.join(",");
+          const ids = this.delarr.join(',')
           executeStockCount({ ids: ids }).then(() => {
             this.$notify({
-              title: "成功",
-              message: "盘点成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
-        });
+              title: '成功',
+              message: '盘点成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
+        })
       } else {
         this.$notify({
-          title: "提示",
-          message: "请选择要盘点的信息!",
-          type: "warning",
-        });
+          title: '提示',
+          message: '请选择要盘点的信息!',
+          type: 'warning'
+        })
       }
     },
     handleDelete(row) {
@@ -252,44 +252,44 @@ export default {
             message: '删除成功',
             type: 'success',
             duration: 2000
-          });
-          this.getList();
-        });
-      }).catch(() => { });
+          })
+          this.getList()
+        })
+      }).catch(() => { })
     },
     delAll() {
-      const length = this.multipleSelection.length;
+      const length = this.multipleSelection.length
       if (length > 0) {
-        this.$confirm("确认删除吗?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
+        this.$confirm('确认删除吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }).then(() => {
           for (let i = 0; i < length; i++) {
-            this.delarr.push(this.multipleSelection[i].id);
+            this.delarr.push(this.multipleSelection[i].id)
           }
-          const ids = this.delarr.join(",");
+          const ids = this.delarr.join(',')
           deleteStockCount({ ids: ids }).then(() => {
             this.$notify({
-              title: "成功",
-              message: "删除成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
-        });
+              title: '成功',
+              message: '删除成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
+        })
       } else {
         this.$notify({
-          title: "提示",
-          message: "请选择要删除的信息!",
-          type: "warning",
-        });
+          title: '提示',
+          message: '请选择要删除的信息!',
+          type: 'warning'
+        })
       }
     },
     handleSelectionChange(val) {
-      this.multipleSelection = val;
-    },
+      this.multipleSelection = val
+    }
   }
 }
 </script>

+ 156 - 157
src/views/stock/stockCount/stockCountAdd.vue

@@ -89,174 +89,173 @@
     </div>
 </template>
 <script>
-import { createStockCount, updateStockCount, readStockCount } from "@/api/stockCount";
-import { supplierList } from "@/api/supplier";
-import { warehouseList } from "@/api/warehouse";
-import { allUserList } from "@/api/public";
-import waves from "@/directive/waves"; // 水波纹指令
+import { createStockCount, updateStockCount, readStockCount } from '@/api/stockCount'
+import { supplierList } from '@/api/supplier'
+import { warehouseList } from '@/api/warehouse'
+import { allUserList } from '@/api/public'
+import waves from '@/directive/waves' // 水波纹指令
 
 export default {
-    directives: { waves },
-    data() {
-        return {
-            userSelsctList: [],
-            supplierList: [],
-            warehouseList: [],
-            id: '',
-            type: '',
-            /** 表单*/
-            dataForm: {
-                serialDate: '',
-                warehouseId: undefined,
-                addHandlerId: undefined,
-                remarks: undefined,
-                inventoryEntryInfos: [],
-                inventoryOutInfos: []
-            },
-            rules: {
-                serialDate: [
-                    { required: true, message: '请选择盘点时间', trigger: 'blur' }
-                ],
-                warehouseId: [
-                    { required: true, message: '请选择仓库', trigger: 'blur' }
-                ],
-                remarks: [
-                    { required: true, message: '请填写盘点原因', trigger: 'blur' }
-                ],
-                addHandlerId: [
-                    { required: true, message: '请选择盘点人', trigger: 'blur' }
-                ],
-            },
+  directives: { waves },
+  data() {
+    return {
+      userSelsctList: [],
+      supplierList: [],
+      warehouseList: [],
+      id: '',
+      type: '',
+      /** 表单*/
+      dataForm: {
+        serialDate: '',
+        warehouseId: undefined,
+        addHandlerId: undefined,
+        remarks: undefined,
+        inventoryEntryInfos: [],
+        inventoryOutInfos: []
+      },
+      rules: {
+        serialDate: [
+          { required: true, message: '请选择盘点时间', trigger: 'blur' }
+        ],
+        warehouseId: [
+          { required: true, message: '请选择仓库', trigger: 'blur' }
+        ],
+        remarks: [
+          { required: true, message: '请填写盘点原因', trigger: 'blur' }
+        ],
+        addHandlerId: [
+          { required: true, message: '请选择盘点人', trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  watch: {
+    $route: {
+      immediate: true,
+      handler(newVal) {
+        if (this.$route.name === 'stockCountAdd') {
+          this.dataForm = {
+            serialDate: '',
+            warehouseId: undefined,
+            addHandlerId: undefined,
+            remarks: undefined,
+            inventoryEntryInfos: [],
+            inventoryOutInfos: []
+          }
+        } else if (this.$route.name === 'stockCountDetail') {
+          this.type = 'detail'
         }
-    },
-    watch: {
-        $route: {
-            immediate: true,
-            handler(newVal) {
-                if (this.$route.name === 'stockCountAdd') {
-                    this.dataForm = {
-                        serialDate: '',
-                        warehouseId: undefined,
-                        addHandlerId: undefined,
-                        remarks: undefined,
-                        inventoryEntryInfos: [],
-                        inventoryOutInfos: []
-                    }
-                } else if (this.$route.name === 'stockCountDetail') {
-                    this.type = 'detail'
-                }
-                if (this.$route.params.id) {
-                    this.id = this.$route.params.id
-                    this.getDataFormDetail()
-                }
-            }
+        if (this.$route.params.id) {
+          this.id = this.$route.params.id
+          this.getDataFormDetail()
         }
+      }
+    }
+  },
+  mounted() {
+    this.getSupplierList()
+    this.getStoreList()
+    this.getAllUserList()
+  },
+  methods: {
+    /** 获取供应商列表数据 */
+    getSupplierList() {
+      supplierList().then(response => {
+        this.supplierList = response.data.data
+      }).catch(() => { })
+    },
+    /** 获取仓库列表数据 */
+    getStoreList() {
+      warehouseList().then(response => {
+        this.warehouseList = response.data.data
+      }).catch(() => { })
+    },
+    /** 获取人员列表数据 */
+    getAllUserList() {
+      allUserList().then(response => {
+        this.userSelsctList = response.data.data
+      }).catch(() => { })
     },
-    mounted() {
-        this.getSupplierList();
-        this.getStoreList();
-        this.getAllUserList();
+    /** 获取详情页面数据 */
+    getDataFormDetail() {
+      readStockCount({ id: this.id }).then(response => {
+        const dataForm = response.data.data
+        dataForm.inventoryEntryInfos = dataForm.inventoryEntryInfos == null ? [] : dataForm.inventoryEntryInfos
+        dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
+        this.dataForm = dataForm
+      }).catch(() => { })
     },
-    methods: {
-        /** 获取供应商列表数据 */
-        getSupplierList() {
-            supplierList().then(response => {
-                this.supplierList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取仓库列表数据 */
-        getStoreList() {
-            warehouseList().then(response => {
-                this.warehouseList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取人员列表数据 */
-        getAllUserList() {
-            allUserList().then(response => {
-                this.userSelsctList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取详情页面数据 */
-        getDataFormDetail() {
-            readStockCount({ id: this.id }).then(response => {
-                let dataForm = response.data.data;
-                dataForm.inventoryEntryInfos = dataForm.inventoryEntryInfos == null ? [] : dataForm.inventoryEntryInfos
-                dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
-                this.dataForm = dataForm;
-            }).catch(() => { })
-        },
-        // 选择商品
-        async handleSelectGoods(val) {
-            if (!this.dataForm.warehouseId) {
-                this.$message.error('请先选择仓库!')
-                return
+    // 选择商品
+    async handleSelectGoods(val) {
+      if (!this.dataForm.warehouseId) {
+        this.$message.error('请先选择仓库!')
+        return
+      } else {
+        const selectedIds = val == 'inventoryEntryInfos' ? this.dataForm.inventoryEntryInfos.map(item => item.id) : this.dataForm.inventoryOutInfos.map(item => item.id)
+        const Goods = await this.$EnPickerGoods({
+          // goodsApi: '/warehouse-entry/info/inventory',
+          selectedIds: selectedIds,
+          goodsApiParams: { warehouseId: this.dataForm.warehouseId, type: '2' }
+        })
+        if (!Goods.length) return
+        if (val == 'inventoryEntryInfos') {
+          const inventoryEntryInfos = Goods.map(item => {
+            item.updateNumber = 1
+            item.diffCount = item.createProductNumber - 1
+            return item
+          })
+          this.dataForm.inventoryEntryInfos = this.dataForm.inventoryEntryInfos && this.dataForm.inventoryEntryInfos.length ? this.dataForm.inventoryEntryInfos.concat(inventoryEntryInfos) : this.dataForm.inventoryEntryInfos = inventoryEntryInfos
+        } else {
+          const inventoryOutInfos = Goods.map(item => {
+            item.updateNumber = 1
+            item.diffCount = item.createProductNumber - 1
+            return item
+          })
+          this.dataForm.inventoryOutInfos = this.dataForm.inventoryOutInfos && this.dataForm.inventoryOutInfos.length ? this.dataForm.inventoryOutInfos.concat(inventoryOutInfos) : this.dataForm.inventoryOutInfos = inventoryOutInfos
+        }
+      }
+    },
+    submitForm() {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          if (this.dataForm.inventoryEntryInfos.length == 0) {
+            this.$message.error('请选择商品/物料!')
+            return
+          } else {
+            if (this.id) {
+              updateStockCount(this.dataForm).then(() => {
+                this.$notify({
+                  title: '成功',
+                  message: '更新成功',
+                  type: 'success',
+                  duration: 2000
+                })
+                this.roBack()
+              })
             } else {
-                let selectedIds = val=='inventoryEntryInfos' ? this.dataForm.inventoryEntryInfos.map(item => item.id) : this.dataForm.inventoryOutInfos.map(item => item.id);
-                const Goods = await this.$EnPickerGoods({
-                    // goodsApi: '/warehouse-entry/info/inventory',
-                    selectedIds: selectedIds,
-                    goodsApiParams: { warehouseId: this.dataForm.warehouseId, type:'2' }
+              createStockCount(this.dataForm).then(() => {
+                this.$notify({
+                  title: '成功',
+                  message: '创建成功',
+                  type: 'success',
+                  duration: 2000
                 })
-                if (!Goods.length) return
-                if(val=='inventoryEntryInfos'){
-                    const inventoryEntryInfos = Goods.map(item => {
-                        item.updateNumber = 1
-                        item.diffCount = item.createProductNumber - 1
-                        return item
-                    })
-                    this.dataForm.inventoryEntryInfos = this.dataForm.inventoryEntryInfos && this.dataForm.inventoryEntryInfos.length ? this.dataForm.inventoryEntryInfos.concat(inventoryEntryInfos) : this.dataForm.inventoryEntryInfos = inventoryEntryInfos
-                }else{
-                    const inventoryOutInfos = Goods.map(item => {
-                        item.updateNumber = 1
-                        item.diffCount = item.createProductNumber - 1
-                        return item
-                    })
-                    this.dataForm.inventoryOutInfos = this.dataForm.inventoryOutInfos && this.dataForm.inventoryOutInfos.length ? this.dataForm.inventoryOutInfos.concat(inventoryOutInfos) : this.dataForm.inventoryOutInfos = inventoryOutInfos
-                }
+                this.roBack()
+              })
             }
-
-        },
-        submitForm() {
-            this.$refs["dataForm"].validate((valid) => {
-                if (valid) {
-                    if (this.dataForm.inventoryEntryInfos.length == 0) {
-                        this.$message.error('请选择商品/物料!')
-                        return
-                    } else {
-                        if (this.id) {
-                            updateStockCount(this.dataForm).then(() => {
-                                this.$notify({
-                                    title: '成功',
-                                    message: '更新成功',
-                                    type: 'success',
-                                    duration: 2000
-                                })
-                                this.roBack();
-                            })
-                        } else {
-                            createStockCount(this.dataForm).then(() => {
-                                this.$notify({
-                                    title: "成功",
-                                    message: "创建成功",
-                                    type: "success",
-                                    duration: 2000,
-                                });
-                                this.roBack();
-                            })
-                        }
-                    }
-                }
-            });
-        },
-        handleChange(row) {
-            row.diffCount = row.createProductNumber - row.updateNumber
-        },
-        roBack() {
-           this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
-                this.$router.push({ name: 'stockCount' })
-            })
+          }
         }
+      })
+    },
+    handleChange(row) {
+      row.diffCount = row.createProductNumber - row.updateNumber
+    },
+    roBack() {
+      this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
+        this.$router.push({ name: 'stockCount' })
+      })
     }
+  }
 }
 </script>
 <style>

+ 98 - 98
src/views/stock/swap/swap.vue

@@ -147,9 +147,9 @@
 </template>
 
 <script>
-import { listSwap, deleteSwap, executeSwap, cancelSwap } from "@/api/swap";
-import { warehouseList } from "@/api/warehouse";
-import { allUserList } from "@/api/public";
+import { listSwap, deleteSwap, executeSwap, cancelSwap } from '@/api/swap'
+import { warehouseList } from '@/api/warehouse'
+import { allUserList } from '@/api/public'
 
 export default {
   data() {
@@ -160,14 +160,14 @@ export default {
         cancelMsg: ''
       },
       rules: {
-        cancelMsg: [{ required: true, message: "作废原因不能为空", trigger: "blur" }],
+        cancelMsg: [{ required: true, message: '作废原因不能为空', trigger: 'blur' }]
       },
       warehouseList: [],
       userSelsctList: [],
       typeList: [
-        { type: '0', name: "已发货" },
-        { type: '1', name: "待发货" },
-        { type: '2', name: "已作废" },
+        { type: '0', name: '已发货' },
+        { type: '1', name: '待发货' },
+        { type: '2', name: '已作废' }
       ],
       list: [],
       delarr: [],
@@ -181,49 +181,49 @@ export default {
         endDate: '',
         warehouseId: '',
         addHandlerId: '',
-        isDelivery: '',
-      },
+        isDelivery: ''
+      }
     }
   },
   created() {
-    this.getStoreList();
-    this.getAllUserList(); 
-    this.getList();
+    this.getStoreList()
+    this.getAllUserList()
+    this.getList()
   },
   methods: {
     handleCancelShow(id) {
-      this.dialogFormVisible = true;
-      this.cancelId = id;
+      this.dialogFormVisible = true
+      this.cancelId = id
       this.$nextTick(() => {
-        this.dataForm.cancelMsg = '';
-        this.$refs["dataForm"].clearValidate();
-      });
+        this.dataForm.cancelMsg = ''
+        this.$refs['dataForm'].clearValidate()
+      })
     },
     handleCancel() {
-      this.$refs["dataForm"].validate((valid) => {
+      this.$refs['dataForm'].validate((valid) => {
         if (valid) {
           cancelSwap({ id: this.cancelId, cancelMsg: this.dataForm.cancelMsg }).then(() => {
-            this.dialogFormVisible = false;
+            this.dialogFormVisible = false
             this.$notify({
-              title: "成功",
-              message: "操作成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
+              title: '成功',
+              message: '操作成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
         }
       })
     },
     getStoreList() {
       warehouseList().then(response => {
-        this.warehouseList = response.data.data;
-      }).catch(() => { });
+        this.warehouseList = response.data.data
+      }).catch(() => { })
     },
     getAllUserList() {
       allUserList().then(response => {
-        this.userSelsctList = response.data.data;
-      }).catch(() => { });
+        this.userSelsctList = response.data.data
+      }).catch(() => { })
     },
     resetQuery() {
       this.listQuery = {
@@ -233,42 +233,42 @@ export default {
         endDate: '',
         warehouseId: '',
         addHandlerId: '',
-        isDelivery: '',
-      };
-      this.getList();
+        isDelivery: ''
+      }
+      this.getList()
     },
     handleDownload() {
-      window.location.href = process.env.BASE_API + '/warehouse-swap/export';
+      window.location.href = process.env.BASE_API + '/warehouse-swap/export'
     },
     handleCreate() {
-      this.$router.push({ name: 'swapAdd' });
+      this.$router.push({ name: 'swapAdd' })
     },
     getList() {
-      this.listLoading = true;
+      this.listLoading = true
       listSwap(this.listQuery).then(response => {
-        this.list = response.data.data.items;
-        this.total = response.data.data.total;
-        this.listLoading = false;
+        this.list = response.data.data.items
+        this.total = response.data.data.total
+        this.listLoading = false
       }).catch(() => {
-        this.list = [];
-        this.total = 0;
-        this.listLoading = false;
-      });
+        this.list = []
+        this.total = 0
+        this.listLoading = false
+      })
     },
     handleFilter() {
-      this.listQuery.page = 1;
-      this.getList();
+      this.listQuery.page = 1
+      this.getList()
     },
     handleSizeChange(val) {
-      this.listQuery.limit = val;
-      this.getList();
+      this.listQuery.limit = val
+      this.getList()
     },
     handleCurrentChange(val) {
-      this.listQuery.page = val;
-      this.getList();
+      this.listQuery.page = val
+      this.getList()
     },
     handleUpdate(row) {
-      this.$router.push({ name: 'swapEdit', params: { id: row.id } });
+      this.$router.push({ name: 'swapEdit', params: { id: row.id }})
     },
     handleExecute(row) {
       this.$confirm('确认换货吗?', '提示', {
@@ -282,39 +282,39 @@ export default {
             message: '换货成功',
             type: 'success',
             duration: 2000
-          });
-          this.getList();
-        });
-      }).catch(() => { });
+          })
+          this.getList()
+        })
+      }).catch(() => { })
     },
     executeAll() {
-      const length = this.multipleSelection.length;
+      const length = this.multipleSelection.length
       if (length > 0) {
-        this.$confirm("确认换货吗?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
+        this.$confirm('确认换货吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }).then(() => {
           for (let i = 0; i < length; i++) {
-            this.delarr.push(this.multipleSelection[i].id);
+            this.delarr.push(this.multipleSelection[i].id)
           }
-          const ids = this.delarr.join(",");
+          const ids = this.delarr.join(',')
           executeSwap({ ids: ids }).then(() => {
             this.$notify({
-              title: "成功",
-              message: "换货成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
-        });
+              title: '成功',
+              message: '换货成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
+        })
       } else {
         this.$notify({
-          title: "提示",
-          message: "请选择要换货的信息!",
-          type: "warning",
-        });
+          title: '提示',
+          message: '请选择要换货的信息!',
+          type: 'warning'
+        })
       }
     },
     handleDelete(row) {
@@ -329,44 +329,44 @@ export default {
             message: '删除成功',
             type: 'success',
             duration: 2000
-          });
-          this.getList();
-        });
-      }).catch(() => { });
+          })
+          this.getList()
+        })
+      }).catch(() => { })
     },
     delAll() {
-      const length = this.multipleSelection.length;
+      const length = this.multipleSelection.length
       if (length > 0) {
-        this.$confirm("确认删除吗?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
+        this.$confirm('确认删除吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }).then(() => {
           for (let i = 0; i < length; i++) {
-            this.delarr.push(this.multipleSelection[i].id);
+            this.delarr.push(this.multipleSelection[i].id)
           }
-          const ids = this.delarr.join(",");
+          const ids = this.delarr.join(',')
           deleteSwap({ ids: ids }).then(() => {
             this.$notify({
-              title: "成功",
-              message: "删除成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
-        });
+              title: '成功',
+              message: '删除成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
+        })
       } else {
         this.$notify({
-          title: "提示",
-          message: "请选择要删除的信息!",
-          type: "warning",
-        });
+          title: '提示',
+          message: '请选择要删除的信息!',
+          type: 'warning'
+        })
       }
     },
     handleSelectionChange(val) {
-      this.multipleSelection = val;
-    },
+      this.multipleSelection = val
+    }
   }
 }
 </script>

+ 161 - 162
src/views/stock/swap/swapAdd.vue

@@ -157,179 +157,178 @@
     </div>
 </template>
 <script>
-import { createSwap, updateSwap, readSwap } from "@/api/swap";
-import { supplierList } from "@/api/supplier";
-import { warehouseList } from "@/api/warehouse";
-import { allUserList } from "@/api/public";
-import waves from "@/directive/waves"; // 水波纹指令
+import { createSwap, updateSwap, readSwap } from '@/api/swap'
+import { supplierList } from '@/api/supplier'
+import { warehouseList } from '@/api/warehouse'
+import { allUserList } from '@/api/public'
+import waves from '@/directive/waves' // 水波纹指令
 
 export default {
-    directives: { waves },
-    data() {
-        return {
-            userSelsctList: [],
-            supplierList: [],
-            warehouseList: [],
-            id: '',
-            type: '',
-            /** 表单*/
-            dataForm: {
-                serialDate: '',
-                warehouseId: undefined,
-                updateUserName: undefined,
-                addHandlerId: undefined,
-                remarks: undefined,
-                inventoryEntryInfos: [],
-                inventoryOutInfos: []
-            },
-            rules: {
-                serialDate: [
-                    { required: true, message: '请选择换货时间', trigger: 'blur' }
-                ],
-                warehouseId: [
-                    { required: true, message: '请选择仓库', trigger: 'blur' }
-                ],
-                remarks: [
-                    { required: true, message: '请填写换货原因', trigger: 'blur' }
-                ],
-                addHandlerId: [
-                    { required: true, message: '请选择经手人', trigger: 'blur' }
-                ],
-            },
+  directives: { waves },
+  data() {
+    return {
+      userSelsctList: [],
+      supplierList: [],
+      warehouseList: [],
+      id: '',
+      type: '',
+      /** 表单*/
+      dataForm: {
+        serialDate: '',
+        warehouseId: undefined,
+        updateUserName: undefined,
+        addHandlerId: undefined,
+        remarks: undefined,
+        inventoryEntryInfos: [],
+        inventoryOutInfos: []
+      },
+      rules: {
+        serialDate: [
+          { required: true, message: '请选择换货时间', trigger: 'blur' }
+        ],
+        warehouseId: [
+          { required: true, message: '请选择仓库', trigger: 'blur' }
+        ],
+        remarks: [
+          { required: true, message: '请填写换货原因', trigger: 'blur' }
+        ],
+        addHandlerId: [
+          { required: true, message: '请选择经手人', trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  watch: {
+    $route: {
+      immediate: true,
+      handler(newVal) {
+        if (this.$route.name === 'swapAdd') {
+          this.dataForm = {
+            serialDate: '',
+            warehouseId: undefined,
+            updateUserName: undefined,
+            addHandlerId: undefined,
+            remarks: undefined,
+            inventoryEntryInfos: [],
+            inventoryOutInfos: []
+          }
+        } else if (this.$route.name === 'swapDetail') {
+          this.type = 'detail'
         }
-    },
-    watch: {
-        $route: {
-            immediate: true,
-            handler(newVal) {
-                if (this.$route.name === 'swapAdd') {
-                    this.dataForm = {
-                        serialDate: '',
-                        warehouseId: undefined,
-                        updateUserName: undefined,
-                        addHandlerId: undefined,
-                        remarks: undefined,
-                        inventoryEntryInfos: [],
-                        inventoryOutInfos: []
-                    }
-                } else if (this.$route.name === 'swapDetail') {
-                    this.type = 'detail'
-                }
-                if (this.$route.params.id) {
-                    this.id = this.$route.params.id
-                    this.getDataFormDetail()
-                }
-            }
+        if (this.$route.params.id) {
+          this.id = this.$route.params.id
+          this.getDataFormDetail()
         }
+      }
+    }
+  },
+  mounted() {
+    this.getSupplierList()
+    this.getStoreList()
+    this.getAllUserList()
+  },
+  methods: {
+    /** 获取供应商列表数据 */
+    getSupplierList() {
+      supplierList().then(response => {
+        this.supplierList = response.data.data
+      }).catch(() => { })
     },
-    mounted() {
-        this.getSupplierList();
-        this.getStoreList();
-        this.getAllUserList();
+    /** 获取仓库列表数据 */
+    getStoreList() {
+      warehouseList().then(response => {
+        this.warehouseList = response.data.data
+      }).catch(() => { })
     },
-    methods: {
-        /** 获取供应商列表数据 */
-        getSupplierList() {
-            supplierList().then(response => {
-                this.supplierList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取仓库列表数据 */
-        getStoreList() {
-            warehouseList().then(response => {
-                this.warehouseList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取人员列表数据 */
-        getAllUserList() {
-            allUserList().then(response => {
-                this.userSelsctList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取详情页面数据 */
-        getDataFormDetail() {
-            readSwap({ id: this.id }).then(response => {
-                let dataForm = response.data.data;
-                dataForm.inventoryEntryInfos = dataForm.inventoryEntryInfos == null ? [] : dataForm.inventoryEntryInfos
-                dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
-                this.dataForm = dataForm;
-                this.dataForm.fileList = dataForm.files == null ? [] : dataForm.files;
-            }).catch(() => { })
-        },
-        // 选择商品
-        async handleSelectGoods(val) {
-            if (!this.dataForm.warehouseId) {
-                this.$message.error('请先选择仓库!')
-                return
+    /** 获取人员列表数据 */
+    getAllUserList() {
+      allUserList().then(response => {
+        this.userSelsctList = response.data.data
+      }).catch(() => { })
+    },
+    /** 获取详情页面数据 */
+    getDataFormDetail() {
+      readSwap({ id: this.id }).then(response => {
+        const dataForm = response.data.data
+        dataForm.inventoryEntryInfos = dataForm.inventoryEntryInfos == null ? [] : dataForm.inventoryEntryInfos
+        dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
+        this.dataForm = dataForm
+        this.dataForm.fileList = dataForm.files == null ? [] : dataForm.files
+      }).catch(() => { })
+    },
+    // 选择商品
+    async handleSelectGoods(val) {
+      if (!this.dataForm.warehouseId) {
+        this.$message.error('请先选择仓库!')
+        return
+      } else {
+        const selectedIds = val == 'inventoryEntryInfos' ? this.dataForm.inventoryEntryInfos.map(item => item.id) : this.dataForm.inventoryOutInfos.map(item => item.id)
+        const Goods = await this.$EnPickerGoods({
+          // goodsApi: '/warehouse-entry/info/inventory',
+          selectedIds: selectedIds,
+          goodsApiParams: { warehouseId: this.dataForm.warehouseId, type: '2' }
+        })
+        if (!Goods.length) return
+        if (val == 'inventoryEntryInfos') {
+          const inventoryEntryInfos = Goods.map(item => {
+            item.updateNumber = 1
+            item.sumPrice = item.createPrice * 1
+            return item
+          })
+          this.dataForm.inventoryEntryInfos = this.dataForm.inventoryEntryInfos && this.dataForm.inventoryEntryInfos.length ? this.dataForm.inventoryEntryInfos.concat(inventoryEntryInfos) : this.dataForm.inventoryEntryInfos = inventoryEntryInfos
+        } else {
+          const inventoryOutInfos = Goods.map(item => {
+            item.updateNumber = 1
+            item.sumPrice = item.createPrice * 1
+            return item
+          })
+          this.dataForm.inventoryOutInfos = this.dataForm.inventoryOutInfos && this.dataForm.inventoryOutInfos.length ? this.dataForm.inventoryOutInfos.concat(inventoryOutInfos) : this.dataForm.inventoryOutInfos = inventoryOutInfos
+        }
+      }
+    },
+    submitForm() {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          if (this.dataForm.inventoryEntryInfos.length == 0 || this.dataForm.inventoryOutInfos.length == 0) {
+            this.$message.error('请选择商品/物料!')
+            return
+          } else {
+            if (this.id) {
+              updateSwap(this.dataForm).then(() => {
+                this.$notify({
+                  title: '成功',
+                  message: '更新成功',
+                  type: 'success',
+                  duration: 2000
+                })
+                this.roBack()
+              })
             } else {
-                let selectedIds = val=='inventoryEntryInfos' ? this.dataForm.inventoryEntryInfos.map(item => item.id) : this.dataForm.inventoryOutInfos.map(item => item.id);
-                const Goods = await this.$EnPickerGoods({
-                    // goodsApi: '/warehouse-entry/info/inventory',
-                    selectedIds: selectedIds,
-                    goodsApiParams: { warehouseId: this.dataForm.warehouseId, type:'2' }
+              createSwap(this.dataForm).then(() => {
+                this.$notify({
+                  title: '成功',
+                  message: '创建成功',
+                  type: 'success',
+                  duration: 2000
                 })
-                if (!Goods.length) return
-                if(val=='inventoryEntryInfos'){
-                    const inventoryEntryInfos = Goods.map(item => {
-                        item.updateNumber = 1
-                        item.sumPrice = item.createPrice * 1
-                        return item
-                    })
-                    this.dataForm.inventoryEntryInfos = this.dataForm.inventoryEntryInfos && this.dataForm.inventoryEntryInfos.length ? this.dataForm.inventoryEntryInfos.concat(inventoryEntryInfos) : this.dataForm.inventoryEntryInfos = inventoryEntryInfos
-                }else{
-                    const inventoryOutInfos = Goods.map(item => {
-                        item.updateNumber = 1
-                        item.sumPrice = item.createPrice * 1
-                        return item
-                    })
-                    this.dataForm.inventoryOutInfos = this.dataForm.inventoryOutInfos && this.dataForm.inventoryOutInfos.length ? this.dataForm.inventoryOutInfos.concat(inventoryOutInfos) : this.dataForm.inventoryOutInfos = inventoryOutInfos
-                }
-            }
-
-        },
-        submitForm() {
-            this.$refs["dataForm"].validate((valid) => {
-                if (valid) {
-                    if (this.dataForm.inventoryEntryInfos.length == 0 || this.dataForm.inventoryOutInfos.length == 0) {
-                        this.$message.error('请选择商品/物料!')
-                        return
-                    } else {
-                        if (this.id) {
-                            updateSwap(this.dataForm).then(() => {
-                                this.$notify({
-                                    title: '成功',
-                                    message: '更新成功',
-                                    type: 'success',
-                                    duration: 2000
-                                })
-                                this.roBack();
-                            })
-                        } else {
-                            createSwap(this.dataForm).then(() => {
-                                this.$notify({
-                                    title: "成功",
-                                    message: "创建成功",
-                                    type: "success",
-                                    duration: 2000,
-                                });
-                                this.roBack();
-                            })
-                        }
-                    }
-                }
-            });
-        },
-        handleChange(row) {
-            if (row.createPrice && row.updateNumber) {
-                row.sumPrice = row.createPrice * row.updateNumber
+                this.roBack()
+              })
             }
-        },
-        roBack() {
-           this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
-                this.$router.push({ name: 'swap' })
-            })
+          }
         }
+      })
+    },
+    handleChange(row) {
+      if (row.createPrice && row.updateNumber) {
+        row.sumPrice = row.createPrice * row.updateNumber
+      }
+    },
+    roBack() {
+      this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
+        this.$router.push({ name: 'swap' })
+      })
     }
+  }
 }
 </script>
 <style>

+ 67 - 67
src/views/stock/warehousing/warehousing.vue

@@ -135,9 +135,9 @@
 
 <script>
 // script 部分保持不变,仅保留原有逻辑
-import { listWarehousing, deleteWarehousing, executeWarehousing, cancelWarehousing } from "@/api/warehousing";
-import { warehouseList } from "@/api/warehouse";
-import waves from "@/directive/waves";
+import { listWarehousing, deleteWarehousing, executeWarehousing, cancelWarehousing } from '@/api/warehousing'
+import { warehouseList } from '@/api/warehouse'
+import waves from '@/directive/waves'
 
 export default {
   directives: { waves },
@@ -149,13 +149,13 @@ export default {
         cancelMsg: ''
       },
       rules: {
-        cancelMsg: [{ required: true, message: "作废原因不能为空", trigger: "blur" }],
+        cancelMsg: [{ required: true, message: '作废原因不能为空', trigger: 'blur' }]
       },
       warehouseList: [],
       typeList: [
-        { type: '0', name: "已入库" },
-        { type: '1', name: "待入库" },
-        { type: '2', name: "已作废" },
+        { type: '0', name: '已入库' },
+        { type: '1', name: '待入库' },
+        { type: '2', name: '已作废' }
       ],
       list: [],
       delarr: [],
@@ -168,44 +168,44 @@ export default {
         startDate: '',
         endDate: '',
         warehouseId: '',
-        isRunFinish: '',
-      },
+        isRunFinish: ''
+      }
     }
   },
   created() {
-    this.getStoreList();
-    this.getList();
+    this.getStoreList()
+    this.getList()
   },
   methods: {
     // 原有方法保持不变
     handleCancelShow(id) {
-      this.dialogFormVisible = true;
-      this.cancelId = id;
+      this.dialogFormVisible = true
+      this.cancelId = id
       this.$nextTick(() => {
-        this.dataForm.cancelMsg = '';
-        this.$refs["dataForm"].clearValidate();
-      });
+        this.dataForm.cancelMsg = ''
+        this.$refs['dataForm'].clearValidate()
+      })
     },
     handleCancel() {
-      this.$refs["dataForm"].validate((valid) => {
+      this.$refs['dataForm'].validate((valid) => {
         if (valid) {
           cancelWarehousing({ id: this.cancelId, cancelMsg: this.dataForm.cancelMsg }).then(() => {
-            this.dialogFormVisible = false;
+            this.dialogFormVisible = false
             this.$notify({
-              title: "成功",
-              message: "操作成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
-          });
+              title: '成功',
+              message: '操作成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
+          })
         }
       })
     },
     getStoreList() {
       warehouseList().then(response => {
-        this.warehouseList = response.data.data;
-      }).catch(() => { });
+        this.warehouseList = response.data.data
+      }).catch(() => { })
     },
     resetQuery() {
       this.listQuery = {
@@ -214,12 +214,12 @@ export default {
         startDate: '',
         endDate: '',
         warehouseId: '',
-        isRunFinish: '',
+        isRunFinish: ''
       },
-        this.getList()
+      this.getList()
     },
     handleDownload() {
-      window.location.href = process.env.BASE_API + '/warehouse-entry/export';
+      window.location.href = process.env.BASE_API + '/warehouse-entry/export'
     },
     handleCreate() {
       this.$router.push({ name: 'warehousingAdd' })
@@ -249,7 +249,7 @@ export default {
       this.getList()
     },
     handleUpdate(row) {
-      this.$router.push({ name: 'warehousingEdit', params: { id: row.id } })
+      this.$router.push({ name: 'warehousingEdit', params: { id: row.id }})
     },
     handleExecute(row) {
       this.$confirm('确认入库吗?', '提示', {
@@ -269,33 +269,33 @@ export default {
       }).catch(() => { })
     },
     executeAll() {
-      const length = this.multipleSelection.length;
+      const length = this.multipleSelection.length
       if (length > 0) {
-        this.$confirm("确认入库吗?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
+        this.$confirm('确认入库吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }).then(() => {
           for (let i = 0; i < length; i++) {
-            this.delarr.push(this.multipleSelection[i].id);
+            this.delarr.push(this.multipleSelection[i].id)
           }
-          const ids = this.delarr.join(",");
+          const ids = this.delarr.join(',')
           executeWarehousing({ ids: ids }).then(() => {
             this.$notify({
-              title: "成功",
-              message: "入库成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
+              title: '成功',
+              message: '入库成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
           })
         })
       } else {
         this.$notify({
-          title: "提示",
-          message: "请选择要入库的信息!",
-          type: "warning",
-        });
+          title: '提示',
+          message: '请选择要入库的信息!',
+          type: 'warning'
+        })
       }
     },
     handleDelete(row) {
@@ -316,38 +316,38 @@ export default {
       }).catch(() => { })
     },
     delAll() {
-      const length = this.multipleSelection.length;
+      const length = this.multipleSelection.length
       if (length > 0) {
-        this.$confirm("确认删除吗?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
+        this.$confirm('确认删除吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }).then(() => {
           for (let i = 0; i < length; i++) {
-            this.delarr.push(this.multipleSelection[i].id);
+            this.delarr.push(this.multipleSelection[i].id)
           }
-          const ids = this.delarr.join(",");
+          const ids = this.delarr.join(',')
           deleteWarehousing({ ids: ids }).then(() => {
             this.$notify({
-              title: "成功",
-              message: "删除成功",
-              type: "success",
-              duration: 2000,
-            });
-            this.getList();
+              title: '成功',
+              message: '删除成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getList()
           })
         })
       } else {
         this.$notify({
-          title: "提示",
-          message: "请选择要删除的信息!",
-          type: "warning",
-        });
+          title: '提示',
+          message: '请选择要删除的信息!',
+          type: 'warning'
+        })
       }
     },
     handleSelectionChange(val) {
-      this.multipleSelection = val;
-    },
+      this.multipleSelection = val
+    }
   }
 }
 </script>

+ 202 - 203
src/views/stock/warehousing/warehousingAdd.vue

@@ -107,222 +107,221 @@
     </div>
 </template>
 <script>
-import { createWarehousing, updateWarehousing, readWarehousing } from "@/api/warehousing";
-import { supplierList } from "@/api/supplier";
-import { warehouseList } from "@/api/warehouse";
-import { allUserList } from "@/api/public";
-import waves from "@/directive/waves"; // 水波纹指令
+import { createWarehousing, updateWarehousing, readWarehousing } from '@/api/warehousing'
+import { supplierList } from '@/api/supplier'
+import { warehouseList } from '@/api/warehouse'
+import { allUserList } from '@/api/public'
+import waves from '@/directive/waves' // 水波纹指令
 
 export default {
-    directives: { waves },
-    data() {
-        return {
-            fileUrl:this.upLoadUrl,
-            recipientsList:[],
-            supplierList: [],
-            warehouseList: [],
-            id: '',
-            type: '',
-            /** 表单*/
-            dataForm: {
-                serialDate:'',
-                supplierId:undefined,
-                warehouseId:undefined,
-                addHandlerId:undefined,
-                fileIds:undefined,
-                fileList: [],
-                inventoryEntryInfos: []
-            },
-            rules: {
-                serialDate: [
-                    { required: true, message: '请选择入库时间', trigger: 'blur' }
-                ],
-                warehouseId: [
-                    { required: true, message: '请选择仓库', trigger: 'blur' }
-                ],
-                addHandlerId: [
-                    { required: true, message: '请选择经手人', trigger: 'blur' }
-                ],
-            },
+  directives: { waves },
+  data() {
+    return {
+      fileUrl: this.upLoadUrl,
+      recipientsList: [],
+      supplierList: [],
+      warehouseList: [],
+      id: '',
+      type: '',
+      /** 表单*/
+      dataForm: {
+        serialDate: '',
+        supplierId: undefined,
+        warehouseId: undefined,
+        addHandlerId: undefined,
+        fileIds: undefined,
+        fileList: [],
+        inventoryEntryInfos: []
+      },
+      rules: {
+        serialDate: [
+          { required: true, message: '请选择入库时间', trigger: 'blur' }
+        ],
+        warehouseId: [
+          { required: true, message: '请选择仓库', trigger: 'blur' }
+        ],
+        addHandlerId: [
+          { required: true, message: '请选择经手人', trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  watch: {
+    $route: {
+      immediate: true,
+      handler(newVal) {
+        if (this.$route.name === 'warehousingAdd') {
+          this.dataForm = {
+            serialDate: undefined,
+            supplierId: undefined,
+            warehouseId: undefined,
+            addHandlerId: undefined,
+            fileIds: undefined,
+            fileList: [],
+            inventoryEntryInfos: []
+          }
+        } else if (this.$route.name === 'warehousingDetail') {
+          this.type = 'detail'
         }
-    },
-    watch: {
-        $route: {
-            immediate: true,
-            handler(newVal) {
-                if (this.$route.name === 'warehousingAdd') {
-                    this.dataForm = {
-                        serialDate:undefined,
-                        supplierId:undefined,
-                        warehouseId:undefined,
-                        addHandlerId:undefined,
-                        fileIds:undefined,
-                        fileList: [],
-                        inventoryEntryInfos: []
-                    }
-                } else if (this.$route.name === 'warehousingDetail') {
-                    this.type = 'detail'
-                }
-                if (this.$route.params.id) {
-                    this.id = this.$route.params.id
-                    this.getDataFormDetail()
-                }
-            }
+        if (this.$route.params.id) {
+          this.id = this.$route.params.id
+          this.getDataFormDetail()
         }
+      }
+    }
+  },
+  mounted() {
+    this.getSupplierList()
+    this.getStoreList()
+    this.getAllUserList()
+  },
+  methods: {
+    /** 获取供应商列表数据 */
+    getSupplierList() {
+      supplierList().then(response => {
+        this.supplierList = response.data.data
+      }).catch(() => { })
+    },
+    /** 获取仓库列表数据 */
+    getStoreList() {
+      warehouseList().then(response => {
+        this.warehouseList = response.data.data
+      }).catch(() => {})
     },
-    mounted() {
-        this.getSupplierList();
-        this.getStoreList(); 
-        this.getAllUserList(); 
+    /** 获取人员列表数据 */
+    getAllUserList() {
+      allUserList().then(response => {
+        this.recipientsList = response.data.data
+      }).catch(() => { })
     },
-    methods: {
-        /** 获取供应商列表数据 */
-        getSupplierList(){
-            supplierList().then(response => {
-                this.supplierList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取仓库列表数据 */
-        getStoreList() {
-            warehouseList().then(response => {
-                this.warehouseList = response.data.data;
-            }).catch(() => {});
-        },
-        /** 获取人员列表数据 */
-        getAllUserList() {
-            allUserList().then(response => {
-                this.recipientsList = response.data.data;
-            }).catch(() => { });
-        },
-        /** 获取详情页面数据 */
-        getDataFormDetail() {
-            readWarehousing({ id: this.id }).then(response => {
-                let dataForm = response.data.data;
-                dataForm.inventoryEntryInfos = dataForm.inventoryEntryInfos == null ? [] : dataForm.inventoryEntryInfos
-                dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
-                this.dataForm = dataForm;
-                this.dataForm.fileList = dataForm.files == null ? [] : dataForm.files;
-            }).catch(() => {})
-        },
-         // 选择商品
-        async handleSelectGoods() {
-            if (!this.dataForm.warehouseId) {
-                this.$message.error('请先选择仓库!')
-                return
-            }else{
-                console.log(this.dataForm.inventoryEntryInfos)
-                let selectedIds = this.dataForm.inventoryEntryInfos.map(item => item.id);
-                const Goods = await this.$EnPickerGoods({
-                    // goodsApi: '/warehouse-entry/info/inventory',
-                    selectedIds: selectedIds,
-                    goodsApiParams: { warehouseId: this.dataForm.warehouseId, type:'1' }
+    /** 获取详情页面数据 */
+    getDataFormDetail() {
+      readWarehousing({ id: this.id }).then(response => {
+        const dataForm = response.data.data
+        dataForm.inventoryEntryInfos = dataForm.inventoryEntryInfos == null ? [] : dataForm.inventoryEntryInfos
+        dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
+        this.dataForm = dataForm
+        this.dataForm.fileList = dataForm.files == null ? [] : dataForm.files
+      }).catch(() => {})
+    },
+    // 选择商品
+    async handleSelectGoods() {
+      if (!this.dataForm.warehouseId) {
+        this.$message.error('请先选择仓库!')
+        return
+      } else {
+        console.log(this.dataForm.inventoryEntryInfos)
+        const selectedIds = this.dataForm.inventoryEntryInfos.map(item => item.id)
+        const Goods = await this.$EnPickerGoods({
+          // goodsApi: '/warehouse-entry/info/inventory',
+          selectedIds: selectedIds,
+          goodsApiParams: { warehouseId: this.dataForm.warehouseId, type: '1' }
+        })
+        if (!Goods.length) return
+        const inventoryEntryInfos = Goods.map(item => {
+          item.updateNumber = 1
+          item.sumPrice = item.createPrice * 1
+          return item
+        })
+        this.dataForm.inventoryEntryInfos = this.dataForm.inventoryEntryInfos && this.dataForm.inventoryEntryInfos.length ? this.dataForm.inventoryEntryInfos.concat(inventoryEntryInfos) : this.dataForm.inventoryEntryInfos = inventoryEntryInfos
+      }
+    },
+    submitForm() {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          if (this.dataForm.inventoryEntryInfos.length == 0) {
+            this.$message.error('请选择商品/物料!')
+            return
+          } else {
+            if (this.id) {
+              updateWarehousing(this.dataForm).then(() => {
+                this.$notify({
+                  title: '成功',
+                  message: '更新成功',
+                  type: 'success',
+                  duration: 2000
                 })
-                if (!Goods.length) return
-                const inventoryEntryInfos = Goods.map(item => {
-                    item.updateNumber = 1
-                    item.sumPrice = item.createPrice * 1
-                    return item
+                this.roBack()
+              })
+            } else {
+              createWarehousing(this.dataForm).then(() => {
+                this.$notify({
+                  title: '成功',
+                  message: '创建成功',
+                  type: 'success',
+                  duration: 2000
                 })
-                this.dataForm.inventoryEntryInfos = this.dataForm.inventoryEntryInfos && this.dataForm.inventoryEntryInfos.length ? this.dataForm.inventoryEntryInfos.concat(inventoryEntryInfos) : this.dataForm.inventoryEntryInfos = inventoryEntryInfos
-            }
-            
-        },
-        submitForm(){
-            this.$refs["dataForm"].validate((valid) => {
-                if (valid) {
-                    if(this.dataForm.inventoryEntryInfos.length == 0){
-                        this.$message.error('请选择商品/物料!')
-                        return
-                    }else{
-                        if(this.id){
-                            updateWarehousing(this.dataForm).then(() => {
-                                this.$notify({
-                                    title: '成功',
-                                    message: '更新成功',
-                                    type: 'success',
-                                    duration: 2000
-                                })
-                                this.roBack();
-                            })
-                        }else{
-                            createWarehousing(this.dataForm).then(() => {
-                                this.$notify({
-                                    title: "成功",
-                                    message: "创建成功",
-                                    type: "success",
-                                    duration: 2000,
-                                });
-                                this.roBack();
-                            })
-                        }
-                    }   
-                }
-            });
-        },
-        handleChange(row) {
-            if (row.createPrice && row.updateNumber) {
-                row.sumPrice = row.createPrice * row.updateNumber
+                this.roBack()
+              })
             }
-        },
-        roBack() {
-            // const { callback } = this.$route.params
-            // if (typeof callback === 'function') callback()
-            // this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
-            //     const latestView = views.slice(-1)[0]
-            //     if (latestView) {
-            //         this.$router.push(latestView.path)
-            //     } else {
-            //         this.$router.push('/')
-            //     }
-            // })
-           this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
-                this.$router.push({ name: 'warehousing' })
-            })
-        },
-        handleRemove(file, fileList) {
-        console.log(file, fileList);
-        let fileIds = [];
-        for (let i in fileList) {
-            let id = fileList[i].response.data.id;
-            fileIds.push(id);
+          }
         }
-        this.dataForm.fileIds = fileIds.join(",");
-        },
-        handleExceed(files, fileList) {
-            this.$message.warning(
-                `当前限制选择 1 个文件,本次选择了 ${files.length} 个文件!,共选择了 ${files.length + fileList.length
-                } 个文件`
-            );
-        },
-        beforeUploadFile(file) {
-        console.log(file);
-        const size = file.size / 1024 / 1024;
-        console.log(size);
-        if (size > 10) {
-            this.$message.error("文件大小不能超过10MB!");
-            return false;
-        }
-        },
-        handleFileSuccess(res, file, fileList) {
-        console.log(file, fileList);
-        console.log("------", "==========");
-        console.log("res = ", res);
+      })
+    },
+    handleChange(row) {
+      if (row.createPrice && row.updateNumber) {
+        row.sumPrice = row.createPrice * row.updateNumber
+      }
+    },
+    roBack() {
+      // const { callback } = this.$route.params
+      // if (typeof callback === 'function') callback()
+      // this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
+      //     const latestView = views.slice(-1)[0]
+      //     if (latestView) {
+      //         this.$router.push(latestView.path)
+      //     } else {
+      //         this.$router.push('/')
+      //     }
+      // })
+      this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
+        this.$router.push({ name: 'warehousing' })
+      })
+    },
+    handleRemove(file, fileList) {
+      console.log(file, fileList)
+      const fileIds = []
+      for (const i in fileList) {
+        const id = fileList[i].response.data.id
+        fileIds.push(id)
+      }
+      this.dataForm.fileIds = fileIds.join(',')
+    },
+    handleExceed(files, fileList) {
+      this.$message.warning(
+        `当前限制选择 1 个文件,本次选择了 ${files.length} 个文件!,共选择了 ${files.length + fileList.length
+        } 个文件`
+      )
+    },
+    beforeUploadFile(file) {
+      console.log(file)
+      const size = file.size / 1024 / 1024
+      console.log(size)
+      if (size > 10) {
+        this.$message.error('文件大小不能超过10MB!')
+        return false
+      }
+    },
+    handleFileSuccess(res, file, fileList) {
+      console.log(file, fileList)
+      console.log('------', '==========')
+      console.log('res = ', res)
 
-        let fileIds = [];
-        for (let i in fileList) {
-            let response = fileList[i].response;
-            if (response.errno && response.errno != "0") {
-            this.$message.error("该文件上传失败,已被移除,请重新上传!");
-            // 上传失败移除该 file 对象
-            fileList.splice(i, 1);
-            } else {
-            let id = fileList[i].response.data.id;
-            fileIds.push(id);
-            }
+      const fileIds = []
+      for (const i in fileList) {
+        const response = fileList[i].response
+        if (response.errno && response.errno != '0') {
+          this.$message.error('该文件上传失败,已被移除,请重新上传!')
+          // 上传失败移除该 file 对象
+          fileList.splice(i, 1)
+        } else {
+          const id = fileList[i].response.data.id
+          fileIds.push(id)
         }
-        this.dataForm.fileIds = fileIds.join(",");
-        },
+      }
+      this.dataForm.fileIds = fileIds.join(',')
     }
+  }
 }
 </script>
 <style>

+ 39 - 40
src/views/sys/admin.vue

@@ -171,11 +171,11 @@
 </style>
 
 <script>
-import { listAdmin, createAdmin, updateAdmin, deleteAdmin, getWxUserId, getUser} from '@/api/admin'
-import { selectUserByUserName } from "@/api/organize"
+import { listAdmin, createAdmin, updateAdmin, deleteAdmin, getWxUserId, getUser } from '@/api/admin'
+import { selectUserByUserName } from '@/api/organize'
 import { roleList, selectAdminRole, addAdminRole } from '@/api/role'
 import { createStorage } from '@/api/storage'
-import { allUserList } from "@/api/public";
+import { allUserList } from '@/api/public'
 import waves from '@/directive/waves' // 水波纹指令
 
 export default {
@@ -184,14 +184,14 @@ export default {
     waves
   },
   data() {
-    var validateUserName = (rule,value,callback) => {
+    var validateUserName = (rule, value, callback) => {
       if (value === '') {
         callback(new Error('请输入用户名'))
       } else {
-        if(this.dialogStatus === 'create'){
-          getUser({userName:value}).then(response=>{
-            if (response.data.data){
-              callback(new Error("用户名已存在"))
+        if (this.dialogStatus === 'create') {
+          getUser({ userName: value }).then(response => {
+            if (response.data.data) {
+              callback(new Error('用户名已存在'))
             } else {
               callback()
             }
@@ -199,14 +199,13 @@ export default {
         } else {
           callback()
         }
-
       }
     }
     var validatePass = (rule, value, callback) => {
       if (value === '') {
         callback(new Error('请输入密码'))
       } else {
-        const reg = /([0-9]+[a-zA-Z]+|[a-zA-Z]+[0-9]+)[0-9a-zA-Z]*/;
+        const reg = /([0-9]+[a-zA-Z]+|[a-zA-Z]+[0-9]+)[0-9a-zA-Z]*/
         if (!reg.test(value)) {
           callback(new Error('请输入字母、数字组合'))
         }
@@ -253,7 +252,7 @@ export default {
         phone: undefined
       },
       typeDate: {
-        imgBelongs:"3"
+        imgBelongs: '3'
       },
       dialogFormVisible: false,
       dialogStatus: '',
@@ -266,15 +265,15 @@ export default {
         nickname: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
         password: [
           { required: true, message: '密码不能为空', trigger: 'blur' },
-          { min:8, max:18, message: '长度在 8 到 18 个字符' },
+          { min: 8, max: 18, message: '长度在 8 到 18 个字符' },
           { validator: validatePass, trigger: 'blur' }
         ],
         checkPassword: [
           { required: true, message: '密码不能为空', trigger: 'blur' },
           { validator: validatePass2, trigger: 'blur' }
         ],
-        phone: [{required: true, message: '手机号码不能为空', trigger: 'blur'}],
-        userId: [{required: true, message: '关联微信用户不能为空', trigger: 'blur'}]
+        phone: [{ required: true, message: '手机号码不能为空', trigger: 'blur' }],
+        userId: [{ required: true, message: '关联微信用户不能为空', trigger: 'blur' }]
       },
       downloadLoading: false,
       roleList: [
@@ -287,16 +286,16 @@ export default {
     }
   },
   created() {
-    this.getList();
-    this.getRoleList();
-    this.getAllUserList(); 
+    this.getList()
+    this.getRoleList()
+    this.getAllUserList()
   },
   methods: {
     getAllUserList() {
-            allUserList().then(response => {
-                this.recipientsList = response.data.data;
-            }).catch(() => {});
-        },
+      allUserList().then(response => {
+        this.recipientsList = response.data.data
+      }).catch(() => {})
+    },
     getList() {
       this.listLoading = true
       listAdmin(this.listQuery).then(response => {
@@ -313,15 +312,15 @@ export default {
       this.listQuery.page = 1
       this.getList()
     },
-     /** 重置按钮操作 */
-     resetQuery() {
-        this.listQuery = {
-          username: undefined,
-          nickname: undefined,
-          sort: '+id'
-        };
-        this.handleQuery();
-      },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.listQuery = {
+        username: undefined,
+        nickname: undefined,
+        sort: '+id'
+      }
+      this.handleQuery()
+    },
     handleSizeChange(val) {
       this.listQuery.limit = val
       this.getList()
@@ -349,11 +348,11 @@ export default {
         this.$message.error('上传失败,请重新上传')
       })
     },
-    remoteMethod(query){
-      this.selectLoading = true;
-      selectUserByUserName({"userName":query}).then(res => {
+    remoteMethod(query) {
+      this.selectLoading = true
+      selectUserByUserName({ 'userName': query }).then(res => {
         this.optionsOrgUser = res.data.data
-        this.selectLoading = false;
+        this.selectLoading = false
       })
     },
     handleCreate() {
@@ -429,7 +428,7 @@ export default {
       })
     },
     handleDownload() {
-      window.location.href = process.env.BASE_API + '/admin/export';
+      window.location.href = process.env.BASE_API + '/admin/export'
     },
     getRoleList() {
       roleList({ page: 1, limit: 100 })
@@ -442,7 +441,7 @@ export default {
         .then(response => {
           var role = response.data.data
           if (role) {
-            role = role.map( function(val) {
+            role = role.map(function(val) {
               return val - 0
             })
           } else {
@@ -466,10 +465,10 @@ export default {
 
     getWxUserId() {
       console.log(this.dataForm.phone)
-      if(this.dataForm.phone) {
-        getWxUserId({'phone' : this.dataForm.phone}).then(response => {
-          let userId = response.data.data.userId
-          if(userId != 0) {
+      if (this.dataForm.phone) {
+        getWxUserId({ 'phone': this.dataForm.phone }).then(response => {
+          const userId = response.data.data.userId
+          if (userId != 0) {
             this.dataForm.userId = userId
           } else {
             this.$alert('无法查询该手机关联的微信用户 Id,请重新输入', '提示', {

+ 71 - 71
src/views/sys/dept.vue

@@ -125,25 +125,25 @@
 </template>
 
 <script>
-import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/dept";
-import Treeselect from "@riophae/vue-treeselect";
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from '@/api/dept'
+import Treeselect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
 
 export default {
-  name: "Dept",
+  name: 'Dept',
   components: { Treeselect },
   data() {
     return {
-     statusList: [
-                {
-                  value: '0',
-                  label: '启用'
-                },
-                {
-                  value: '1',
-                  label: '停用'
-                },
-            ],
+      statusList: [
+        {
+          value: '0',
+          label: '启用'
+        },
+        {
+          value: '1',
+          label: '停用'
+        }
+      ],
       // 遮罩层
       loading: true,
       // 显示搜索条件
@@ -153,7 +153,7 @@ export default {
       // 部门树选项
       deptOptions: [],
       // 弹出层标题
-      title: "",
+      title: '',
       // 是否显示弹出层
       open: false,
       // 是否展开,默认全部展开
@@ -170,58 +170,58 @@ export default {
       // 表单校验
       rules: {
         parentId: [
-          { required: true, message: "上级部门不能为空", trigger: "blur" }
+          { required: true, message: '上级部门不能为空', trigger: 'blur' }
         ],
         deptName: [
-          { required: true, message: "部门名称不能为空", trigger: "blur" }
+          { required: true, message: '部门名称不能为空', trigger: 'blur' }
         ],
         orderNum: [
-          { required: true, message: "显示排序不能为空", trigger: "blur" }
+          { required: true, message: '显示排序不能为空', trigger: 'blur' }
         ],
         email: [
           {
-            type: "email",
-            message: "请输入正确的邮箱地址",
-            trigger: ["blur", "change"]
+            type: 'email',
+            message: '请输入正确的邮箱地址',
+            trigger: ['blur', 'change']
           }
         ],
         phone: [
           {
             pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
-            message: "请输入正确的手机号码",
-            trigger: "blur"
+            message: '请输入正确的手机号码',
+            trigger: 'blur'
           }
         ]
       }
-    };
+    }
   },
   created() {
-    this.getList();
+    this.getList()
   },
   methods: {
     /** 查询部门列表 */
     getList() {
-      this.loading = true;
+      this.loading = true
       listDept(this.queryParams).then(response => {
-        this.deptList = this.handleTree(response.data.data, "deptId");
-        this.loading = false;
-      });
+        this.deptList = this.handleTree(response.data.data, 'deptId')
+        this.loading = false
+      })
     },
     /** 转换部门数据结构 */
     normalizer(node) {
       if (node.children && !node.children.length) {
-        delete node.children;
+        delete node.children
       }
       return {
         id: node.deptId,
         label: node.deptName,
         children: node.children
-      };
+      }
     },
     // 取消按钮
     cancel() {
-      this.open = false;
-      this.reset();
+      this.open = false
+      this.reset()
     },
     // 表单重置
     reset() {
@@ -233,61 +233,61 @@ export default {
         leader: undefined,
         phone: undefined,
         email: undefined,
-        status: "0"
-      };
-      this.resetForm("form");
+        status: '0'
+      }
+      this.resetForm('form')
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.getList();
+      this.getList()
     },
     /** 重置按钮操作 */
     resetQuery() {
       this.queryParams = {
         deptName: undefined,
         status: undefined
-      };
-      this.handleQuery();
+      }
+      this.handleQuery()
     },
     /** 新增按钮操作 */
     handleAdd(row) {
-      this.reset();
+      this.reset()
       if (row != undefined) {
-        this.form.parentId = row.deptId;
+        this.form.parentId = row.deptId
       }
-      this.open = true;
-      this.title = "添加部门";
+      this.open = true
+      this.title = '添加部门'
       listDept().then(response => {
-        this.deptOptions = this.handleTree(response.data.data, "deptId");
-      });
+        this.deptOptions = this.handleTree(response.data.data, 'deptId')
+      })
     },
     /** 展开/折叠操作 */
     toggleExpandAll() {
-      this.refreshTable = false;
-      this.isExpandAll = !this.isExpandAll;
+      this.refreshTable = false
+      this.isExpandAll = !this.isExpandAll
       this.$nextTick(() => {
-        this.refreshTable = true;
-      });
+        this.refreshTable = true
+      })
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.reset();
+      this.reset()
       getDept(row.deptId).then(response => {
-        this.form = response.data.data;
-        this.open = true;
-        this.title = "修改部门";
+        this.form = response.data.data
+        this.open = true
+        this.title = '修改部门'
         listDeptExcludeChild(row.deptId).then(response => {
-          this.deptOptions = this.handleTree(response.data.data, "deptId");
+          this.deptOptions = this.handleTree(response.data.data, 'deptId')
           if (this.deptOptions.length == 0) {
-            const noResultsOptions = { deptId: this.form.parentId, deptName: this.form.parentName, children: [] };
-            this.deptOptions.push(noResultsOptions);
+            const noResultsOptions = { deptId: this.form.parentId, deptName: this.form.parentName, children: [] }
+            this.deptOptions.push(noResultsOptions)
           }
-        });
-      });
+        })
+      })
     },
     /** 提交按钮 */
     submitForm: function() {
-      this.$refs["form"].validate(valid => {
+      this.$refs['form'].validate(valid => {
         if (valid) {
           if (this.form.deptId != undefined) {
             updateDept(this.form).then(response => {
@@ -297,9 +297,9 @@ export default {
                 type: 'success',
                 duration: 2000
               })
-              this.open = false;
-              this.getList();
-            });
+              this.open = false
+              this.getList()
+            })
           } else {
             addDept(this.form).then(response => {
               this.$notify({
@@ -308,22 +308,22 @@ export default {
                 type: 'success',
                 duration: 2000
               })
-              this.open = false;
-              this.getList();
-            });
+              this.open = false
+              this.getList()
+            })
           }
         }
-      });
+      })
     },
     /** 删除按钮操作 */
     handleDelete(row) {
       this.$confirm('是否确认删除名称为"' + row.deptName + '"的数据项?').then(function() {
-        return delDept(row.deptId);
+        return delDept(row.deptId)
       }).then(() => {
-        this.getList();
-        this.$msgSuccess("删除成功");
-      }).catch(() => {});
+        this.getList()
+        this.$msgSuccess('删除成功')
+      }).catch(() => {})
     }
   }
-};
+}
 </script>

+ 7 - 7
src/views/sys/role.vue

@@ -171,13 +171,13 @@ export default {
       this.listQuery.page = 1
       this.getList()
     },
-     /** 重置按钮操作 */
-     resetQuery() {
-        this.listQuery = {
-           roleName: ''
-        };
-        this.handleQuery();
-      },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.listQuery = {
+        roleName: ''
+      }
+      this.handleQuery()
+    },
     handleSizeChange(val) {
       this.listQuery.limit = val
       this.getList()